ClonableBeaconProxy
0xfb5b5778d45ae47f15323fb59b666c655174a79c
Verification
Verified
v0.8.16+commit.07a7930e
Type
Contract
835 bytes
ABI entries
6
0 read · 0 write
License
none
Contract information
- Address
- 0xfb5b5778d45ae47f15323fb59b666c655174a79c
- Chain
- Robinhood Chain (4663)
- Compiler
- v0.8.16+commit.07a7930e
- Optimization
- Enabled
- Creator
- 0xc302CcbC35…2DC032Dd51
- Creation tx
- 0x3e33db4b2a…1b0865d313
Token
- Name
- Robinhood Markets (Ondo Tokenized)
- Symbol
- HOODon
- Decimals
- 18
- Holders
- 147
- Market
- View token page →
Read contract (0)
No read functions
The ABI is unavailable or exposes no view functions.
Events (3)
AdminChangedBeaconUpgradedUpgraded
ABI
[
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "previousAdmin",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newAdmin",
"type": "address"
}
],
"name": "AdminChanged",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "beacon",
"type": "address"
}
],
"name": "BeaconUpgraded",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"name": "Upgraded",
"type": "event"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"stateMutability": "payable",
"type": "receive"
}
]Source code
// SPDX-License-Identifier: Apache-2.0
// solhint-disable-next-line compiler-version
pragma solidity >=0.6.0 <0.9.0;
import "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.sol";
import "@openzeppelin/contracts/utils/Create2.sol";
interface ProxySetter {
function beacon() external view returns (address);
}
contract ClonableBeaconProxy is BeaconProxy {
constructor() BeaconProxy(ProxySetter(msg.sender).beacon(), "") {}
}
contract BeaconProxyFactory is ProxySetter {
bytes32 public constant cloneableProxyHash = keccak256(type(ClonableBeaconProxy).creationCode);
/**
* @notice utility function used in ClonableBeaconProxy.
* @dev this method makes it possible to use ClonableBeaconProxy.creationCode without encoding constructor parameters
* @return the beacon to be used by the proxy contract.
*/
address public override beacon;
function initialize(address _beacon) external {
require(_beacon != address(0), "INVALID_BEACON");
require(beacon == address(0), "ALREADY_INIT");
beacon = _beacon;
}
function getSalt(address user, bytes32 userSalt) public pure returns (bytes32) {
return keccak256(abi.encode(user, userSalt));
}
function createProxy(bytes32 userSalt) external returns (address) {
// deployment will fail and this function will revert if contract `salt` is not unique
bytes32 salt = getSalt(msg.sender, userSalt);
address createdContract = address(new ClonableBeaconProxy{ salt: salt }());
return createdContract;
}
function calculateExpectedAddress(address user, bytes32 userSalt)
public
view
returns (address)
{
bytes32 salt = getSalt(user, userSalt);
return Create2.computeAddress(salt, cloneableProxyHash, address(this));
}
function calculateExpectedAddress(bytes32 salt) public view returns (address) {
return Create2.computeAddress(salt, cloneableProxyHash, address(this));
}
}
Chain explorer4577msChain node91ms