Transactions
Token Transfers
Tokens
Internal Transactions
Coin Balance History
Logs
Code
Read Proxy
Write Contract
Write Proxy
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- ClonableBeaconProxy
- Optimization enabled
- true
- Compiler version
- v0.6.11+commit.5ef660b1
- Optimization runs
- 100
- Verified at
- 2023-08-24T23:26:33.523000Z
contracts/tokenbridge/libraries/ClonableBeaconProxy.sol
// SPDX-License-Identifier: Apache-2.0 // solhint-disable-next-line compiler-version pragma solidity >=0.6.0 <0.8.0; import "@openzeppelin/contracts/proxy/BeaconProxy.sol"; import "@openzeppelin/contracts/proxy/UpgradeableBeacon.sol"; import "@openzeppelin/contracts/utils/Create2.sol"; interface ProxySetter { function beacon() external view returns (address); } contract ClonableBeaconProxy is BeaconProxy { constructor() public 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)); } }
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { emit OwnershipTransferred(_owner, address(0)); _owner = address(0); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"fallback","stateMutability":"payable"},{"type":"receive","stateMutability":"payable"}]
Deployed ByteCode
0x60806040523661001357610011610017565b005b6100115b61001f61002f565b61002f61002a61013c565b6101af565b565b3b151590565b606061004284610031565b61007d5760405162461bcd60e51b815260040180806020018281038252602681526020018061029d6026913960400191505060405180910390fd5b60006060856001600160a01b0316856040518082805190602001908083835b602083106100bb5780518252601f19909201916020918201910161009c565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d806000811461011b576040519150601f19603f3d011682016040523d82523d6000602084013e610120565b606091505b50915091506101308282866101d3565b925050505b9392505050565b6000610146610277565b6001600160a01b0316635c60da1b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561017e57600080fd5b505afa158015610192573d6000803e3d6000fd5b505050506040513d60208110156101a857600080fd5b5051905090565b3660008037600080366000845af43d6000803e8080156101ce573d6000f35b3d6000fd5b606083156101e2575081610135565b8251156101f25782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561023c578181015183820152602001610224565b50505050905090810190601f1680156102695780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50549056fe416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6e7472616374a2646970667358221220e7b562ecdee95608075ce5ac1d81442e61bf46e4326f0e62fb4660d9829ca11264736f6c634300060b0033