Contract Overview
Balance:
0 CRO
CRO Value:
$0.00
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Contract Name:
CRORegistrarTokenController
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 10000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "./BaseRegistrarController.sol"; import "./ICRORegistrarTokenController.sol"; import "../tokens/ICROIDToken.sol"; /** * @dev A registrar controller for registering and renewing names with paying CROID tokens at fixed cost. */ contract CRORegistrarTokenController is BaseRegistrarController { ICROIDToken public immutable token; constructor( ICROIDToken _token, IBaseRegistrar _registrar, IPriceOracle _priceOracle, ReverseRegistrar _reverseRegistrar ) BaseRegistrarController(_registrar, _priceOracle, _reverseRegistrar) { token = _token; } function valid(string memory name) public view override returns (bool) { if (strLength(name) >= 5) { return false; } return super.valid(name); } function register( string calldata name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] calldata data, bool reverseRecord ) public { bytes32 label = keccak256(bytes(name)); IPriceOracle.Price memory price = rentPrice(name, duration); uint256 tokenAmount = price.base + price.premium; require( token.transferFrom(msg.sender, address(this), tokenAmount), "CRORegistrarTokenController: Not enough CROID token provided" ); _consumeCommitment( name, duration, makeCommitment( name, owner, duration, secret, resolver, data, reverseRecord ) ); uint256 expires = registrar.registerExtra( uint256(label), owner, duration, resolver, uint64(0) ); _setRecords(resolver, label, data); if (reverseRecord) { _setReverseRecord(name, resolver, msg.sender); } _distributeRevenue(tokenAmount); emit NameRegistered( name, label, owner, price.base, price.premium, expires ); } function renew(string calldata name, uint256 duration) external { bytes32 label = keccak256(bytes(name)); IPriceOracle.Price memory price = rentPrice(name, duration); uint256 tokenAmount = price.base; require( token.transferFrom(msg.sender, address(this), tokenAmount), "CRORegistrarTokenController: Not enough CROID token provided for renewal" ); uint256 expires = registrar.renew(uint256(label), duration); _distributeRevenue(tokenAmount); emit NameRenewed(name, label, price.base, expires); } function supportsInterface(bytes4 interfaceID) external pure override returns (bool) { return interfaceID == type(IERC165).interfaceId || interfaceID == type(ICRORegistrarTokenController).interfaceId; } function _distributeRevenue(uint256 tokenAmount) internal override { if (address(revenueDistributor) != address(0)) { // NOTICE: Is it good practice if let user approve the revenueDistributor contract directly in UI? token.approve(address(revenueDistributor), tokenAmount); revenueDistributor.depositToken(tokenAmount); } } function _heldRevenue() internal view override returns (uint256) { return token.balanceOf(address(this)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "./IBaseRegistrarController.sol"; interface ICRORegistrarTokenController is IBaseRegistrarController { function register( string calldata, address, uint256, bytes32, address, bytes[] calldata, bool ) external; function renew(string calldata, uint256) external; }
//SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "./IBaseRegistrar.sol"; import "./IBaseRegistrarController.sol"; import "../oracles/IPriceOracle.sol"; import "../registrars/ReverseRegistrar.sol"; import "../utils/StringUtils.sol"; import "../utils/Blocklist.sol"; import "../tokens/IRevenueDistributor.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "@openzeppelin/contracts/utils/Address.sol"; /** * @dev A base registrar controller for registering and renewing names. */ abstract contract BaseRegistrarController is Ownable, IBaseRegistrarController { using StringUtils for *; using Address for address; uint256 public constant MIN_REGISTRATION_DURATION = 28 days; string private constant CRO_LABEL = "cro"; bytes32 private constant CRO_NODE = 0x5dfacd0a0764eb7c9351dcd36f63cb5e2757014aa2592f976462be5c38ce9ca8; uint256 public constant MIN_COMMITMENT_AGE = 60; // 60 seconds uint256 public constant MAX_COMMITMENT_AGE = 24 * 60 * 60; // 24 hours IBaseRegistrar public immutable registrar; ReverseRegistrar public reverseRegistrar; IPriceOracle public priceOracle; Blocklist public blocklist; IRevenueDistributor public revenueDistributor; bool public chanceRequired; mapping(bytes32 => uint256) public commitments; event NameRegistered( string name, bytes32 indexed label, address indexed owner, uint256 baseCost, uint256 premium, uint256 expires ); event NameRenewed( string name, bytes32 indexed label, uint256 cost, uint256 expires ); event ReverseRegistrarChanged(address indexed reverseRegistrar); event PriceOracleChanged(address indexed priceOracle); event BlocklistChanged(address indexed blocklist); event RevenueDistributorChanged(address indexed revenueDistributor); event ChanceRequiredChanged(bool required); constructor( IBaseRegistrar _registrar, IPriceOracle _priceOracle, ReverseRegistrar _reverseRegistrar ) { registrar = _registrar; priceOracle = _priceOracle; reverseRegistrar = _reverseRegistrar; chanceRequired = false; } function rentPrice(string memory name, uint256 duration) public view virtual override returns (IPriceOracle.Price memory price) { bytes32 label = keccak256(bytes(name)); price = priceOracle.price( name, registrar.nameExpires(uint256(label)), duration ); } function valid(string memory name) public view virtual override returns (bool) { if (strLength(name) < 3) { return false; } if (address(blocklist) != address(0)) { if (blocklist.hasName(name, msg.sender)) { return false; } } return true; } function available(string memory name) public view virtual override returns (bool) { bytes32 label = keccak256(bytes(name)); return valid(name) && registrar.available(uint256(label)); } function strLength(string memory name) public view virtual override returns (uint256) { return name.strlen(); } function makeCommitment( string memory name, address owner, uint256 duration, bytes32 secret, address resolver, bytes[] calldata data, bool reverseRecord ) public pure virtual override returns (bytes32) { bytes32 label = keccak256(bytes(name)); if (data.length > 0) { require( resolver != address(0), "BaseRegistrarController: resolver is required when data is supplied" ); } return keccak256( abi.encode( label, owner, duration, resolver, data, secret, reverseRecord ) ); } function commit(bytes32 commitment) public virtual override { require(commitments[commitment] + MAX_COMMITMENT_AGE < block.timestamp, "BaseRegistrarController: invalid commitment"); commitments[commitment] = block.timestamp; } function setReverseRegistrar(address _reverseRegistrar) external onlyOwner { reverseRegistrar = ReverseRegistrar(_reverseRegistrar); emit ReverseRegistrarChanged(_reverseRegistrar); } function setPriceOracle(address _priceOracle) external onlyOwner { priceOracle = IPriceOracle(_priceOracle); emit PriceOracleChanged(_priceOracle); } function setBlocklist(address _blocklist) external onlyOwner { blocklist = Blocklist(_blocklist); emit BlocklistChanged(_blocklist); } function setRevenueDistributor(address _revenueDistributor) external onlyOwner { revenueDistributor = IRevenueDistributor(_revenueDistributor); emit RevenueDistributorChanged(_revenueDistributor); } function setChanceRequired(bool _required) external onlyOwner { chanceRequired = _required; emit ChanceRequiredChanged(_required); } function distributeHeldRevenue() external onlyOwner { _distributeRevenue(_heldRevenue()); } function minCommitmentAge() public pure returns (uint256) { return MIN_COMMITMENT_AGE; } function maxCommitmentAge() public pure returns (uint256) { return MAX_COMMITMENT_AGE; } function supportsInterface(bytes4 interfaceID) external pure virtual returns (bool) { return interfaceID == type(IERC165).interfaceId || interfaceID == type(IBaseRegistrarController).interfaceId; } /* Internal functions */ function _consumeCommitment( string memory name, uint256 duration, bytes32 commitment ) internal { // Require a valid commitment (is old enough and is committed) require( commitments[commitment] + MIN_COMMITMENT_AGE <= block.timestamp, "BaseRegistrarController: Commitment is not valid" ); // If the commitment is too old, or the name is registered, stop require( commitments[commitment] + MAX_COMMITMENT_AGE > block.timestamp, "BaseRegistrarController: Commitment has expired" ); require( available(name), "BaseRegistrarController: Name is unavailable" ); if (chanceRequired && strLength(name) < 5) { if (address(blocklist) != address(0)) { blocklist.checkChance(name, msg.sender); } } delete commitments[commitment]; require(duration >= MIN_REGISTRATION_DURATION); } function _setRecords( address resolver, bytes32 label, bytes[] calldata data ) internal { bytes32 nodehash = keccak256(abi.encodePacked(CRO_NODE, label)); for (uint256 i = 0; i < data.length; i++) { // check first few bytes are namehash bytes32 txNamehash = bytes32(data[i][4:36]); require( txNamehash == nodehash, "BaseRegistrarController: Namehash on record do not match the name being registered" ); resolver.functionCall( data[i], "BaseRegistrarController: Failed to set Record" ); } } function _setReverseRecord( string memory name, address resolver, address owner ) internal { reverseRegistrar.setNameForAddr( msg.sender, owner, resolver, string.concat(name, ".", CRO_LABEL) ); } function _heldRevenue() internal view virtual returns (uint256) { return 0; } function _distributeRevenue(uint256) internal virtual { require( false, "BaseRegistrarController: unimplemented distributing method" ); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol"; interface ICROIDToken is IERC20, IERC20Metadata, IERC20Permit { function getDeploymentStartTime() external view returns (uint256); function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "../oracles/IPriceOracle.sol"; interface IBaseRegistrarController { function rentPrice(string memory, uint256) external returns (IPriceOracle.Price memory); function valid(string memory) external returns (bool); function available(string memory) external returns (bool); function strLength(string memory) external returns (uint256); function makeCommitment( string memory, address, uint256, bytes32, address, bytes[] calldata, bool ) external returns (bytes32); function commit(bytes32) external; }
//SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IPriceOracle { struct Price { uint256 base; uint256 premium; } /** * @dev Returns the price to register or renew a name. * @param name The name being registered or renewed. * @param expires When the name presently expires (0 if this is a new registration). * @param duration How long the name is being registered or extended for, in seconds. * @return base premium tuple of base price + premium price */ function price( string calldata name, uint256 expires, uint256 duration ) external view returns (Price calldata); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "../CROID.sol"; import "./IBaseRegistrar.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; interface IBaseRegistrar is IERC721 { event ControllerAdded(address indexed controller); event ControllerRemoved(address indexed controller); event NameMigrated( uint256 indexed id, address indexed owner, uint256 expires ); event NameRegistered( uint256 indexed id, address indexed owner, uint256 expires ); event NameRenewed(uint256 indexed id, uint256 expires); // Authorises a controller, who can register and renew domains. function addController(address controller) external; // Revoke controller permission for an address. function removeController(address controller) external; // Set the resolver for the TLD this registrar manages. function setResolver(address resolver) external; // Returns the expiration timestamp of the specified label hash. function nameExpires(uint256 id) external view returns (uint256); // Returns true iff the specified name is available for registration. function available(uint256 id) external view returns (bool); /** * @dev Register a name. */ function register( uint256 id, address owner, uint256 duration ) external returns (uint256); /** * @dev Register a name only. */ function registerOnly( uint256 id, address owner, uint256 duration ) external returns (uint256); /** * @dev Register a name with extra parameters, resolver and ttl. */ function registerExtra( uint256 id, address owner, uint256 duration, address resolver, uint64 ttl ) external returns (uint256); function renew(uint256 id, uint256 duration) external returns (uint256); /** * @dev Reclaim ownership of a name in CROID, if you own it in the registrar. */ function reclaim(uint256 id, address owner) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "../CROID.sol"; import "./IReverseRegistrar.sol"; import "../resolvers/IResolver.sol"; import "../utils/Controllable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; bytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000; // namehash('addr.reverse') bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; contract ReverseRegistrar is Ownable, Controllable, IReverseRegistrar { CROID public immutable croid; IResolver public defaultResolver; event ReverseClaimed(address indexed addr, bytes32 indexed node); event ResolverChanged(address indexed resolver); /** * @dev Constructor * @param _croid The address of the CROID registry. */ constructor(CROID _croid) { croid = _croid; // Assign ownership of the reverse record to our deployer ReverseRegistrar oldRegistrar = ReverseRegistrar( _croid.owner(ADDR_REVERSE_NODE) ); if (address(oldRegistrar) != address(0x0)) { oldRegistrar.claim(msg.sender); } } modifier authorised(address addr) { require( addr == msg.sender || controllers[msg.sender] || croid.isApprovedForAll(addr, msg.sender) || ownsContract(addr), "ReverseRegistrar: Caller is not a controller or authorised by address or the address itself" ); _; } function setDefaultResolver(address resolver) public override onlyOwner { require( address(resolver) != address(0), "ReverseRegistrar: Resolver address must not be 0" ); defaultResolver = IResolver(resolver); emit ResolverChanged(resolver); } /** * @dev Transfers ownership of the reverse CROID record associated with the * calling account. * @param owner The address to set as the owner of the reverse record in CROID. * @return The CROID node hash of the reverse record. */ function claim(address owner) public override returns (bytes32) { return claimForAddr(msg.sender, owner, address(defaultResolver)); } /** * @dev Transfers ownership of the reverse CROID record associated with the * calling account. * @param addr The reverse record to set * @param owner The address to set as the owner of the reverse record in CROID. * @return The CROID node hash of the reverse record. */ function claimForAddr( address addr, address owner, address resolver ) public override authorised(addr) returns (bytes32) { bytes32 labelHash = sha3HexAddress(addr); bytes32 reverseNode = keccak256( abi.encodePacked(ADDR_REVERSE_NODE, labelHash) ); emit ReverseClaimed(addr, reverseNode); croid.setSubnodeRecord(ADDR_REVERSE_NODE, labelHash, owner, resolver, 0); return reverseNode; } /** * @dev Transfers ownership of the reverse CROID record associated with the * calling account. * @param owner The address to set as the owner of the reverse record in CROID. * @param resolver The address of the resolver to set; 0 to leave unchanged. * @return The CROID node hash of the reverse record. */ function claimWithResolver(address owner, address resolver) public override returns (bytes32) { return claimForAddr(msg.sender, owner, resolver); } /** * @dev Sets the `name()` record for the reverse CROID record associated with * the calling account. First updates the resolver to the default reverse * resolver if necessary. * @param name The name to set for this address. * @return The CROID node hash of the reverse record. */ function setName(string memory name) public override returns (bytes32) { return setNameForAddr( msg.sender, msg.sender, address(defaultResolver), name ); } function setNameOnly( address addr, address resolver, string memory name ) external override authorised(addr) returns (bytes32) { if (resolver == address(0x0)) { resolver = address(defaultResolver); } bytes32 reverseNode = node(addr); IResolver(resolver).setName(reverseNode, name); return reverseNode; } /** * @dev Sets the `name()` record for the reverse CROID record associated with * the account provided. First updates the resolver to the default reverse * resolver if necessary. * Only callable by controllers and authorised users * @param addr The reverse record to set * @param owner The owner of the reverse node * @param name The name to set for this address. * @return The CROID node hash of the reverse record. */ function setNameForAddr( address addr, address owner, address resolver, string memory name ) public override returns (bytes32) { if (resolver == address(0x0)) { resolver = address(defaultResolver); } bytes32 reverseNode = claimForAddr(addr, owner, resolver); IResolver(resolver).setName(reverseNode, name); return reverseNode; } /** * @dev Returns the node hash for a given account's reverse records. * @param addr The address to hash * @return The CROID node hash. */ function node(address addr) public pure override returns (bytes32) { return keccak256( abi.encodePacked(ADDR_REVERSE_NODE, sha3HexAddress(addr)) ); } /** * @dev An optimised function to compute the sha3 of the lower-case * hexadecimal representation of an Cronos address. * @param addr The address to hash * @return ret The SHA3 hash of the lower-case hexadecimal encoding of the * input address. */ function sha3HexAddress(address addr) private pure returns (bytes32 ret) { assembly { for { let i := 40 } gt(i, 0) { } { i := sub(i, 1) mstore8(i, byte(and(addr, 0xf), lookup)) addr := div(addr, 0x10) i := sub(i, 1) mstore8(i, byte(and(addr, 0xf), lookup)) addr := div(addr, 0x10) } ret := keccak256(0, 40) } } function ownsContract(address addr) internal view returns (bool) { try Ownable(addr).owner() returns (address owner) { return owner == msg.sender; } catch { return false; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "../utils/StringUtils.sol"; contract Blocklist is UUPSUpgradeable, OwnableUpgradeable { using StringUtils for *; bool public enabled; mapping(bytes32 => bool) private _list; mapping(address => mapping(bytes32 => bool)) private _allows; mapping(address => bool) private _checkers; mapping(address => uint256) private _chances; event EnabledChange(bool enabled); event CheckerChange(address checker, bool enabled); function initialize() initializer public { __Ownable_init(); __UUPSUpgradeable_init(); enabled = true; } function has(bytes32 label, address user) public view returns (bool) { if (enabled != true) { return false; } if (_list[label] != true) { return false; } if (user == address(0)) { user = msg.sender; } // allow target users if (_allows[user][label] == true) { return false; } return true; } function hasName(string memory name, address user) public view returns (bool result) { uint256 length = name.strlen(); // if all chars are from ASCII if (length == bytes(name).length) { name = name.toLower(); } bytes32 label = keccak256(bytes(name)); result = has(label, user); } function checkChance(string memory, address user) public { require(_checkers[msg.sender], "sender is not authorized to check"); require(_chances[user] > 0, "user has no more chances"); _chances[user] -= 1; } function update(bytes32 label, bool blocked) external onlyOwner() { _list[label] = blocked; } function batchUpdate(bytes32[] calldata labels, bool blocked) external onlyOwner() { for (uint i = 0; i < labels.length; i++) { _list[labels[i]] = blocked; } } function batchDelete(bytes32[] calldata labels) external onlyOwner() { for (uint i = 0; i < labels.length; i++) { delete _list[labels[i]]; } } function allowed(address user, bytes32 label) public view returns (bool) { return _allows[user][label]; } function allow(address user, bytes32[] calldata labels) external onlyOwner() { for (uint i = 0; i < labels.length; i++) { _allows[user][labels[i]] = true; } } function disallow(address user, bytes32[] calldata labels) external onlyOwner() { for (uint i = 0; i < labels.length; i++) { delete _allows[user][labels[i]]; } } function batchAllow(address[] calldata users, bytes32[] calldata labels) external onlyOwner() { for (uint i = 0; i < users.length; i++) { _allows[users[i]][labels[i]] = true; } } function batchDisallow(address[] calldata users, bytes32[] calldata labels) external onlyOwner() { for (uint i = 0; i < users.length; i++) { delete _allows[users[i]][labels[i]]; } } function enable() external onlyOwner() { enabled = true; emit EnabledChange(enabled); } function disable() external onlyOwner() { enabled = false; emit EnabledChange(enabled); } function checker(address _checker) public view returns (bool) { return _checkers[_checker]; } function setChecker(address _checker, bool _enabled) external onlyOwner() { _checkers[_checker] = _enabled; emit CheckerChange(_checker, _enabled); } function updateChance(address user, uint256 number) external onlyOwner() { _chances[user] = number; } function batchUpdateChance(address[] calldata users, uint256 number) external onlyOwner() { for (uint i = 0; i < users.length; i++) { _chances[users[i]] = number; } } function batchSyncChance(address[] calldata users, uint256[] calldata numbers) external onlyOwner() { for (uint i = 0; i < users.length; i++) { _chances[users[i]] = numbers[i]; } } function chance(address user) public view returns (uint256) { return _chances[user]; } function _authorizeUpgrade(address) internal override onlyOwner {} }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; library StringUtils { /** * @dev Returns the length of a given string * * @param s The string to measure the length of * @return The length of the input string */ function strlen(string memory s) internal pure returns (uint) { uint len; uint i = 0; uint bytelength = bytes(s).length; for(len = 0; i < bytelength; len++) { bytes1 b = bytes(s)[i]; if(b < 0x80) { i += 1; } else if (b < 0xE0) { i += 2; } else if (b < 0xF0) { i += 3; } else if (b < 0xF8) { i += 4; } else if (b < 0xFC) { i += 5; } else { i += 6; } } return len; } function toLower(string memory s) internal pure returns (string memory) { bytes memory bstr = bytes(s); bytes memory blower = new bytes(bstr.length); for (uint i = 0; i < bstr.length; i++) { if ((uint8(bstr[i]) >= 65) && (uint8(bstr[i]) <= 90)) { blower[i] = bytes1(uint8(bstr[i]) + 32); } else { blower[i] = bstr[i]; } } return string(blower); } function toUpper(string memory s) internal pure returns (string memory) { bytes memory bstr = bytes(s); bytes memory bupper = new bytes(bstr.length); for (uint i = 0; i < bstr.length; i++) { if ((uint8(bstr[i]) >= 97) && (uint8(bstr[i]) <= 122)) { bupper[i] = bytes1(uint8(bstr[i]) - 32); } else { bupper[i] = bstr[i]; } } return string(bupper); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IRevenueDistributor { function deposit() external payable; function depositToken(uint256 tokenAmount) external; function setRevenueBeneficiary(address _revenueBeneficiary) external; function setStakingDistributor(address _stakingDistributor) external; function setTokenSwapRouter( address _tokenSwapRouter, address[] memory _tokenSwapPaths ) external; function allocatePendingRevenue() external; function allocatePendingStaking() external; function allocatePendingBurning() external; function allocateAllPendings() external; function allocatePendingRevenueToken() external; function allocatePendingStakingToken() external; function allocateAllPendingTokens() external; function getUnlockedStakingAmount() view external returns(uint256); function getUnlockedStakingTokenAmount() view external returns(uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^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() { _transferOwnership(_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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface CROID { // Logged when the owner of a node assigns a new owner to a subnode. event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); // Logged when the owner of a node transfers ownership to a new account. event Transfer(bytes32 indexed node, address owner); // Logged when the resolver for a node changes. event NewResolver(bytes32 indexed node, address resolver); // Logged when the TTL of a node changes event NewTTL(bytes32 indexed node, uint64 ttl); // Logged when an operator is added or removed. event ApprovalForAll( address indexed owner, address indexed operator, bool approved ); function setRecord( bytes32 node, address owner, address resolver, uint64 ttl ) external; function setSubnodeRecord( bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl ) external; function setSubnodeOwner( bytes32 node, bytes32 label, address owner ) external returns (bytes32); function setResolver(bytes32 node, address resolver) external; function setOwner(bytes32 node, address owner) external; function setTTL(bytes32 node, uint64 ttl) external; function setApprovalForAll(address operator, bool approved) external; function owner(bytes32 node) external view returns (address); function resolver(bytes32 node) external view returns (address); function ttl(bytes32 node) external view returns (uint64); function recordExists(bytes32 node) external view returns (bool); function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import "./profiles/IABIResolver.sol"; import "./profiles/IAddressResolver.sol"; import "./profiles/IAddrResolver.sol"; import "./profiles/IContentHashResolver.sol"; import "./profiles/IDNSRecordResolver.sol"; import "./profiles/IDNSZoneResolver.sol"; import "./profiles/IInterfaceResolver.sol"; import "./profiles/INameResolver.sol"; import "./profiles/IPubkeyResolver.sol"; import "./profiles/ITextResolver.sol"; import "./profiles/IExtendedResolver.sol"; /** * A generic resolver interface which includes all the functions including the ones deprecated */ interface IResolver is IERC165, IABIResolver, IAddressResolver, IAddrResolver, IContentHashResolver, IDNSRecordResolver, IDNSZoneResolver, IInterfaceResolver, INameResolver, IPubkeyResolver, ITextResolver, IExtendedResolver { /* Deprecated events */ event ContentChanged(bytes32 indexed node, bytes32 hash); function setABI( bytes32 node, uint256 contentType, bytes calldata data ) external; function setAddr(bytes32 node, address addr) external; function setAddr( bytes32 node, uint256 coinType, bytes calldata a ) external; function setContenthash(bytes32 node, bytes calldata hash) external; function setDnsrr(bytes32 node, bytes calldata data) external; function setName(bytes32 node, string calldata _name) external; function setPubkey( bytes32 node, bytes32 x, bytes32 y ) external; function setText( bytes32 node, string calldata key, string calldata value ) external; function setInterface( bytes32 node, bytes4 interfaceID, address implementer ) external; function multicall(bytes[] calldata data) external returns (bytes[] memory results); /* Deprecated functions */ function content(bytes32 node) external view returns (bytes32); function multihash(bytes32 node) external view returns (bytes memory); function setContent(bytes32 node, bytes32 hash) external; function setMultihash(bytes32 node, bytes calldata hash) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IReverseRegistrar { function setDefaultResolver(address resolver) external; function claim(address owner) external returns (bytes32); function claimForAddr( address addr, address owner, address resolver ) external returns (bytes32); function claimWithResolver(address owner, address resolver) external returns (bytes32); function setName(string memory name) external returns (bytes32); function setNameOnly( address addr, address resolver, string memory name ) external returns (bytes32); function setNameForAddr( address addr, address owner, address resolver, string memory name ) external returns (bytes32); function node(address addr) external pure returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; contract Controllable is Ownable { mapping(address => bool) public controllers; event ControllerChanged(address indexed controller, bool enabled); modifier onlyController { require( controllers[msg.sender], "Controllable: Caller is not a controller" ); _; } function setController(address controller, bool enabled) public onlyOwner { controllers[controller] = enabled; emit ControllerChanged(controller, enabled); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "./IABIResolver.sol"; import "../ResolverBase.sol"; interface IABIResolver { event ABIChanged(bytes32 indexed node, uint256 indexed contentType); /** * Returns the ABI associated with an CROID node. * Defined in EIP205. * @param node The CROID node to query * @param contentTypes A bitwise OR of the ABI formats accepted by the caller. * @return contentType The content type of the return value * @return data The ABI data */ function ABI(bytes32 node, uint256 contentTypes) external view returns (uint256, bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IContentHashResolver { event ContenthashChanged(bytes32 indexed node, bytes hash); /** * Returns the contenthash associated with an CROID node. * @param node The CROID node to query. * @return The associated contenthash. */ function contenthash(bytes32 node) external view returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /** * Interface for the new (multicoin) addr function. */ interface IAddressResolver { event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress); /** * Returns the address associated with an CROID node. * @param node The CROID node to query. * @param coinType The coin type from slip-0044. * @return The associated address in bytes. */ function addr(bytes32 node, uint coinType) external view returns(bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; /** * Interface for the basic addr function. */ interface IAddrResolver { event AddrChanged(bytes32 indexed node, address a); /** * Returns the address associated with an CROID node. * @param node The CROID node to query. * @return The associated address. */ function addr(bytes32 node) external view returns (address payable); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IDNSRecordResolver { // DNSRecordChanged is emitted whenever a given node/name/resource's RRSET is updated. event DNSRecordChanged(bytes32 indexed node, bytes name, uint16 resource, bytes record); // DNSRecordDeleted is emitted whenever a given node/name/resource's RRSET is deleted. event DNSRecordDeleted(bytes32 indexed node, bytes name, uint16 resource); // DNSZoneCleared is emitted whenever a given node's zone information is cleared. event DNSZoneCleared(bytes32 indexed node); /** * Obtain a DNS record. * @param node the namehash of the node for which to fetch the record * @param name the keccak-256 hash of the fully-qualified name for which to fetch the record * @param resource the ID of the resource as per https://en.wikipedia.org/wiki/List_of_DNS_record_types * @return the DNS record in wire format if present, otherwise empty */ function dnsRecord(bytes32 node, bytes32 name, uint16 resource) external view returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IInterfaceResolver { event InterfaceChanged(bytes32 indexed node, bytes4 indexed interfaceID, address implementer); /** * Returns the address of a contract that implements the specified interface for this name. * If an implementer has not been set for this interfaceID and name, the resolver will query * the contract at `addr()`. If `addr()` is set, a contract exists at that address, and that * contract implements EIP165 and returns `true` for the specified interfaceID, its address * will be returned. * @param node The CROID node to query. * @param interfaceID The EIP 165 interface ID to check for. * @return The address that implements this interface, or 0 if the interface is unsupported. */ function interfaceImplementer(bytes32 node, bytes4 interfaceID) external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IDNSZoneResolver { // DNSZonehashChanged is emitted whenever a given node's zone hash is updated. event DNSZonehashChanged(bytes32 indexed node, bytes lastzonehash, bytes zonehash); /** * zonehash obtains the hash for the zone. * @param node The CROID node to query. * @return The associated contenthash. */ function zonehash(bytes32 node) external view returns (bytes memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface INameResolver { event NameChanged(bytes32 indexed node, string name); /** * Returns the name associated with an CROID node, for reverse records. * Defined in EIP181. * @param node The CROID node to query. * @return The associated name. */ function name(bytes32 node) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface IPubkeyResolver { event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y); /** * Returns the SECP256k1 public key associated with an CROID node. * Defined in EIP 619. * @param node The CROID node to query * @return x The X coordinate of the curve point for the public key. * @return y The Y coordinate of the curve point for the public key. */ function pubkey(bytes32 node) external view returns (bytes32 x, bytes32 y); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; interface ITextResolver { event TextChanged(bytes32 indexed node, string indexed indexedKey, string key); /** * Returns the text data associated with an CROID node and key. * @param node The CROID node to query. * @param key The text data key to query. * @return The associated text data. */ function text(bytes32 node, string calldata key) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IExtendedResolver { function resolve(bytes memory name, bytes memory data) external view returns (bytes memory, address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.4; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ResolverBase is ERC165 { function isAuthorised(bytes32 node) internal view virtual returns (bool); modifier authorised(bytes32 node) { require(isAuthorised(node), "Unauthorised resolver operation"); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { 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 { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate that the this implementation remains valid after an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
{ "optimizer": { "enabled": true, "runs": 10000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
[{"inputs":[{"internalType":"contract ICROIDToken","name":"_token","type":"address"},{"internalType":"contract IBaseRegistrar","name":"_registrar","type":"address"},{"internalType":"contract IPriceOracle","name":"_priceOracle","type":"address"},{"internalType":"contract ReverseRegistrar","name":"_reverseRegistrar","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"blocklist","type":"address"}],"name":"BlocklistChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"required","type":"bool"}],"name":"ChanceRequiredChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":true,"internalType":"bytes32","name":"label","type":"bytes32"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"baseCost","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"premium","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expires","type":"uint256"}],"name":"NameRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":true,"internalType":"bytes32","name":"label","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"cost","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expires","type":"uint256"}],"name":"NameRenewed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"priceOracle","type":"address"}],"name":"PriceOracleChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"revenueDistributor","type":"address"}],"name":"RevenueDistributorChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"reverseRegistrar","type":"address"}],"name":"ReverseRegistrarChanged","type":"event"},{"inputs":[],"name":"MAX_COMMITMENT_AGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_COMMITMENT_AGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_REGISTRATION_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"available","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"blocklist","outputs":[{"internalType":"contract Blocklist","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"chanceRequired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"commitment","type":"bytes32"}],"name":"commit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"commitments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributeHeldRevenue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bytes32","name":"secret","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"bytes[]","name":"data","type":"bytes[]"},{"internalType":"bool","name":"reverseRecord","type":"bool"}],"name":"makeCommitment","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"maxCommitmentAge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"minCommitmentAge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"priceOracle","outputs":[{"internalType":"contract IPriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"duration","type":"uint256"},{"internalType":"bytes32","name":"secret","type":"bytes32"},{"internalType":"address","name":"resolver","type":"address"},{"internalType":"bytes[]","name":"data","type":"bytes[]"},{"internalType":"bool","name":"reverseRecord","type":"bool"}],"name":"register","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registrar","outputs":[{"internalType":"contract IBaseRegistrar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"renew","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"rentPrice","outputs":[{"components":[{"internalType":"uint256","name":"base","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"}],"internalType":"struct IPriceOracle.Price","name":"price","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"revenueDistributor","outputs":[{"internalType":"contract IRevenueDistributor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reverseRegistrar","outputs":[{"internalType":"contract ReverseRegistrar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_blocklist","type":"address"}],"name":"setBlocklist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_required","type":"bool"}],"name":"setChanceRequired","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_priceOracle","type":"address"}],"name":"setPriceOracle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_revenueDistributor","type":"address"}],"name":"setRevenueDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_reverseRegistrar","type":"address"}],"name":"setReverseRegistrar","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"strLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceID","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract ICROIDToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"valid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b5060405162002e6e38038062002e6e8339810160408190526200003491620000fb565b828282620000423362000092565b6001600160a01b03928316608052600280549284166001600160a01b031993841617905560018054918416919092161790556004805460ff60a01b191690559390931660a0525062000163915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620000f857600080fd5b50565b600080600080608085870312156200011257600080fd5b84516200011f81620000e2565b60208601519094506200013281620000e2565b60408601519093506200014581620000e2565b60608601519092506200015881620000e2565b939692955090935050565b60805160a051612cad620001c1600039600081816104b70152818161070d0152818161105501528181611e3c01526120bc0152600081816102ca0152818161090801528181610ec0015281816111a801526112c90152612cad6000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c806383e7f6ff1161010f578063aef18ae7116100a2578063eae0a48811610071578063eae0a4881461046c578063f14fcbc81461048c578063f2fde38b1461049f578063fc0c546a146104b257600080fd5b8063aef18ae714610428578063b43494701461043b578063ce1e09c014610443578063d64e53961461044c57600080fd5b80638da5cb5b116100de5780638da5cb5b146103d15780639791c097146103ef578063acf1a84114610402578063aeb8ce9b1461041557600080fd5b806383e7f6ff146103885780638a95b09f146103b65780638ccb9ea6146103c05780638d839ffe146103ca57600080fd5b80632e4f692a11610187578063557499ba11610156578063557499ba1461032d578063715018a6146103405780638086985314610348578063839df9451461036857600080fd5b80632e4f692a146102ec5780633d4aa89e146102f45780634c87400514610307578063530e784f1461031a57600080fd5b806322ecf8b9116101c357806322ecf8b914610248578063237592e81461026d5780632630c12f146102805780632b20e397146102c557600080fd5b806301ffc9a7146101ea578063179f9e65146102125780631f9e051514610227575b600080fd5b6101fd6101f836600461226f565b6104d9565b60405190151581526020015b60405180910390f35b6102256102203660046122da565b610572565b005b61023a6102353660046123cf565b61064d565b604051908152602001610209565b6004546101fd9074010000000000000000000000000000000000000000900460ff1681565b61022561027b3660046124a0565b610658565b6002546102a09073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610209565b6102a07f000000000000000000000000000000000000000000000000000000000000000081565b61023a603c81565b61023a61030236600461255a565b610a45565b61022561031536600461260c565b610b48565b6102256103283660046122da565b610c33565b61022561033b3660046122da565b610d09565b610225610ddf565b6001546102a09073ffffffffffffffffffffffffffffffffffffffff1681565b61023a610376366004612629565b60056020526000908152604090205481565b61039b610396366004612642565b610e52565b60408051825181526020928301519281019290925201610209565b61023a6224ea0081565b61023a6201518081565b603c61023a565b60005473ffffffffffffffffffffffffffffffffffffffff166102a0565b6101fd6103fd3660046123cf565b610f92565b610225610410366004612687565b610fb5565b6101fd6104233660046123cf565b611280565b6102256104363660046122da565b611350565b610225611426565b6201518061023a565b6003546102a09073ffffffffffffffffffffffffffffffffffffffff1681565b6004546102a09073ffffffffffffffffffffffffffffffffffffffff1681565b61022561049a366004612629565b61149d565b6102256104ad3660046122da565b611542565b6102a07f000000000000000000000000000000000000000000000000000000000000000081565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a700000000000000000000000000000000000000000000000000000000148061056c57507fffffffff0000000000000000000000000000000000000000000000000000000082167f8f843aa900000000000000000000000000000000000000000000000000000000145b92915050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f3c966c98aa061771cf735f36563bd7c89979210fa99ae258a068fbf3088f693490600090a250565b600061056c8261163e565b6000898960405161066a9291906126d3565b6040518091039020905060006106b78b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c9250610e52915050565b90506000816020015182600001516106cf9190612712565b6040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481018290529091507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303816000875af115801561076b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078f919061272a565b6108015760405162461bcd60e51b815260206004820152603c60248201527f43524f526567697374726172546f6b656e436f6e74726f6c6c65723a204e6f7460448201527f20656e6f7567682043524f494420746f6b656e2070726f76696465640000000060648201526084016105d5565b6108a38c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508a61089e8f8f8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508e8e8e8e8e8e8e610a45565b611845565b6040517ffee55ef50000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8b81166024830152604482018b90528881166064830152600060848301819052917f00000000000000000000000000000000000000000000000000000000000000009091169063fee55ef59060a4016020604051808303816000875af1158015610953573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109779190612747565b905061098588858989611ae7565b84156109ce576109ce8d8d8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508c9250339150611ccc9050565b6109d782611dcc565b8a73ffffffffffffffffffffffffffffffffffffffff16847f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278f8f8760000151886020015187604051610a2e9594939291906127a9565b60405180910390a350505050505050505050505050565b875160208901206000908315610b045773ffffffffffffffffffffffffffffffffffffffff8616610b045760405162461bcd60e51b815260206004820152604360248201527f42617365526567697374726172436f6e74726f6c6c65723a207265736f6c766560448201527f72206973207265717569726564207768656e206461746120697320737570706c60648201527f6965640000000000000000000000000000000000000000000000000000000000608482015260a4016105d5565b8089898888888c89604051602001610b239897969594939291906127da565b6040516020818303038152906040528051906020012091505098975050505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610baf5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d5565b6004805482151574010000000000000000000000000000000000000000027fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff9091161790556040517fa1eed71828a0ba7faa98d0aa158723bbd5bc22595af360b3c7ac380164242af890610c2890831515815260200190565b60405180910390a150565b60005473ffffffffffffffffffffffffffffffffffffffff163314610c9a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d5565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fb36d86785c7d32b1ad714bb705e00e93eccc37b8cf47549043e61e10908ad25190600090a250565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d705760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d5565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f34a80311cdc56a47d7f1767a6501ac19d9b5fcddd4197476b135e4b887c8c45090600090a250565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e465760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d5565b610e506000611f2f565b565b6040805180820190915260008082526020820152825160208401206002546040517fd6e4fa860000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff918216916350e9a7159187917f0000000000000000000000000000000000000000000000000000000000000000169063d6e4fa8690602401602060405180830381865afa158015610f07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f2b9190612747565b866040518463ffffffff1660e01b8152600401610f4a93929190612973565b6040805180830381865afa158015610f66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8a9190612998565b949350505050565b60006005610f9f8361064d565b10610fac57506000919050565b61056c82611fa4565b60008383604051610fc79291906126d3565b60405180910390209050600061101485858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250879250610e52915050565b80516040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015230602482015260448101829052919250907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906323b872dd906064016020604051808303816000875af11580156110b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d7919061272a565b61116f5760405162461bcd60e51b815260206004820152604860248201527f43524f526567697374726172546f6b656e436f6e74726f6c6c65723a204e6f7460448201527f20656e6f7567682043524f494420746f6b656e2070726f766964656420666f7260648201527f2072656e6577616c000000000000000000000000000000000000000000000000608482015260a4016105d5565b6040517fc475abff00000000000000000000000000000000000000000000000000000000815260048101849052602481018590526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063c475abff906044016020604051808303816000875af1158015611206573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122a9190612747565b905061123582611dcc565b837f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae888886600001518560405161126f94939291906129e7565b60405180910390a250505050505050565b8051602082012060009061129383610f92565b801561134957506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906396e494e890602401602060405180830381865afa158015611325573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611349919061272a565b9392505050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146113b75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d5565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f03198670e18c03d7739e5db8c31ba442a94bfa7e14b89a7ddf7e85fd3fa7c2d990600090a250565b60005473ffffffffffffffffffffffffffffffffffffffff16331461148d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d5565b610e5061149861208b565b611dcc565b60008181526005602052604090205442906114bc906201518090612712565b1061152f5760405162461bcd60e51b815260206004820152602b60248201527f42617365526567697374726172436f6e74726f6c6c65723a20696e76616c696460448201527f20636f6d6d69746d656e7400000000000000000000000000000000000000000060648201526084016105d5565b6000908152600560205260409020429055565b60005473ffffffffffffffffffffffffffffffffffffffff1633146115a95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d5565b73ffffffffffffffffffffffffffffffffffffffff81166116325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105d5565b61163b81611f2f565b50565b8051600090819081905b8082101561183c57600085838151811061166457611664612a0e565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f80000000000000000000000000000000000000000000000000000000000000008110156116c7576116c0600184612712565b9250611829565b7fe0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561171c576116c0600284612712565b7ff0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611771576116c0600384612712565b7ff8000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156117c6576116c0600484612712565b7ffc000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561181b576116c0600584612712565b611826600684612712565b92505b508261183481612a3d565b935050611648565b50909392505050565b600081815260056020526040902054429061186290603c90612712565b11156118d65760405162461bcd60e51b815260206004820152603060248201527f42617365526567697374726172436f6e74726f6c6c65723a20436f6d6d69746d60448201527f656e74206973206e6f742076616c69640000000000000000000000000000000060648201526084016105d5565b60008181526005602052604090205442906118f5906201518090612712565b116119685760405162461bcd60e51b815260206004820152602f60248201527f42617365526567697374726172436f6e74726f6c6c65723a20436f6d6d69746d60448201527f656e74206861732065787069726564000000000000000000000000000000000060648201526084016105d5565b61197183611280565b6119e35760405162461bcd60e51b815260206004820152602c60248201527f42617365526567697374726172436f6e74726f6c6c65723a204e616d6520697360448201527f20756e617661696c61626c65000000000000000000000000000000000000000060648201526084016105d5565b60045474010000000000000000000000000000000000000000900460ff168015611a1557506005611a138461064d565b105b15611ac35760035473ffffffffffffffffffffffffffffffffffffffff1615611ac3576003546040517fbc6f06c900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091169063bc6f06c990611a909086903390600401612a75565b600060405180830381600087803b158015611aaa57600080fd5b505af1158015611abe573d6000803e3d6000fd5b505050505b6000818152600560205260408120556224ea00821015611ae257600080fd5b505050565b604080517f5dfacd0a0764eb7c9351dcd36f63cb5e2757014aa2592f976462be5c38ce9ca8602082015290810184905260009060600160405160208183030381529060405280519060200120905060005b82811015611cc4576000848483818110611b5457611b54612a0e565b9050602002810190611b669190612aad565b611b7591602491600491612b12565b611b7e91612b3c565b9050828114611c1b5760405162461bcd60e51b815260206004820152605260248201527f42617365526567697374726172436f6e74726f6c6c65723a204e616d6568617360448201527f68206f6e207265636f726420646f206e6f74206d6174636820746865206e616d60648201527f65206265696e6720726567697374657265640000000000000000000000000000608482015260a4016105d5565b611caf858584818110611c3057611c30612a0e565b9050602002810190611c429190612aad565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805160608101909152602d8082529092509050612c4b602083013973ffffffffffffffffffffffffffffffffffffffff8a169190612141565b50508080611cbc90612a3d565b915050611b38565b505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637a806d6b338385876040518060400160405280600381526020017f63726f0000000000000000000000000000000000000000000000000000000000815250604051602001611d55929190612b78565b6040516020818303038152906040526040518563ffffffff1660e01b8152600401611d839493929190612bd0565b6020604051808303816000875af1158015611da2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dc69190612747565b50505050565b60045473ffffffffffffffffffffffffffffffffffffffff161561163b57600480546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821692810192909252602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063095ea7b3906044016020604051808303816000875af1158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061272a565b50600480546040517f6215be7700000000000000000000000000000000000000000000000000000000815291820183905273ffffffffffffffffffffffffffffffffffffffff1690636215be7790602401600060405180830381600087803b158015611f1457600080fd5b505af1158015611f28573d6000803e3d6000fd5b5050505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006003611fb18361064d565b1015611fbf57506000919050565b60035473ffffffffffffffffffffffffffffffffffffffff1615612083576003546040517f7621077800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906376210778906120359085903390600401612a75565b602060405180830381865afa158015612052573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612076919061272a565b1561208357506000919050565b506001919050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015612118573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061213c9190612747565b905090565b6060610f8a84846000858573ffffffffffffffffffffffffffffffffffffffff85163b6121b05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105d5565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516121d99190612c1b565b60006040518083038185875af1925050503d8060008114612216576040519150601f19603f3d011682016040523d82523d6000602084013e61221b565b606091505b509150915061222b828286612236565b979650505050505050565b60608315612245575081611349565b8251156122555782518084602001fd5b8160405162461bcd60e51b81526004016105d59190612c37565b60006020828403121561228157600080fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811461134957600080fd5b803573ffffffffffffffffffffffffffffffffffffffff811681146122d557600080fd5b919050565b6000602082840312156122ec57600080fd5b611349826122b1565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261233557600080fd5b813567ffffffffffffffff80821115612350576123506122f5565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f01168101908282118183101715612396576123966122f5565b816040528381528660208588010111156123af57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156123e157600080fd5b813567ffffffffffffffff8111156123f857600080fd5b610f8a84828501612324565b60008083601f84011261241657600080fd5b50813567ffffffffffffffff81111561242e57600080fd5b60208301915083602082850101111561244657600080fd5b9250929050565b60008083601f84011261245f57600080fd5b50813567ffffffffffffffff81111561247757600080fd5b6020830191508360208260051b850101111561244657600080fd5b801515811461163b57600080fd5b600080600080600080600080600060e08a8c0312156124be57600080fd5b893567ffffffffffffffff808211156124d657600080fd5b6124e28d838e01612404565b909b5099508991506124f660208d016122b1565b985060408c0135975060608c0135965061251260808d016122b1565b955060a08c013591508082111561252857600080fd5b506125358c828d0161244d565b90945092505060c08a013561254981612492565b809150509295985092959850929598565b60008060008060008060008060e0898b03121561257657600080fd5b883567ffffffffffffffff8082111561258e57600080fd5b61259a8c838d01612324565b99506125a860208c016122b1565b985060408b0135975060608b013596506125c460808c016122b1565b955060a08b01359150808211156125da57600080fd5b506125e78b828c0161244d565b90945092505060c08901356125fb81612492565b809150509295985092959890939650565b60006020828403121561261e57600080fd5b813561134981612492565b60006020828403121561263b57600080fd5b5035919050565b6000806040838503121561265557600080fd5b823567ffffffffffffffff81111561266c57600080fd5b61267885828601612324565b95602094909401359450505050565b60008060006040848603121561269c57600080fd5b833567ffffffffffffffff8111156126b357600080fd5b6126bf86828701612404565b909790965060209590950135949350505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612725576127256126e3565b500190565b60006020828403121561273c57600080fd5b815161134981612492565b60006020828403121561275957600080fd5b5051919050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6080815260006127bd608083018789612760565b602083019590955250604081019290925260609091015292915050565b600060e082018a8352602073ffffffffffffffffffffffffffffffffffffffff808c16828601528a6040860152808a1660608601525060e060808501528187835261010092508285019050828860051b86010192508860005b898110156128dd577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0087860301835281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18c360301811261289457600080fd5b8b01803567ffffffffffffffff8111156128ad57600080fd5b8036038d13156128bc57600080fd5b6128c98782888501612760565b965050509183019190830190600101612833565b5050505060a08301949094525090151560c0909101529695505050505050565b60005b83811015612918578181015183820152602001612900565b83811115611dc65750506000910152565b600081518084526129418160208601602086016128fd565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6060815260006129866060830186612929565b60208301949094525060400152919050565b6000604082840312156129aa57600080fd5b6040516040810181811067ffffffffffffffff821117156129cd576129cd6122f5565b604052825181526020928301519281019290925250919050565b6060815260006129fb606083018688612760565b6020830194909452506040015292915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612a6e57612a6e6126e3565b5060010190565b604081526000612a886040830185612929565b905073ffffffffffffffffffffffffffffffffffffffff831660208301529392505050565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612ae257600080fd5b83018035915067ffffffffffffffff821115612afd57600080fd5b60200191503681900382131561244657600080fd5b60008085851115612b2257600080fd5b83861115612b2f57600080fd5b5050820193919092039150565b8035602083101561056c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b60008351612b8a8184602088016128fd565b7f2e000000000000000000000000000000000000000000000000000000000000009083019081528351612bc48160018401602088016128fd565b01600101949350505050565b600073ffffffffffffffffffffffffffffffffffffffff8087168352808616602084015280851660408401525060806060830152612c116080830184612929565b9695505050505050565b60008251612c2d8184602087016128fd565b9190910192915050565b602081526000611349602083018461292956fe42617365526567697374726172436f6e74726f6c6c65723a204661696c656420746f20736574205265636f7264a264697066735822122064fd88a602604cb45b0c771665f54bad700fa69aea2e5c6c9b6ef59e3e91d7a364736f6c634300080d0033000000000000000000000000cbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e7000000000000000000000000f884647dfa84696d9373f36ee413ccc48093f924000000000000000000000000c194bf150f458d6f04c135c9ba1ff0e4d10a6d6100000000000000000000000082b28e5a2444d22af36e1bb40cfd1b3e155d9486
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e7000000000000000000000000f884647dfa84696d9373f36ee413ccc48093f924000000000000000000000000c194bf150f458d6f04c135c9ba1ff0e4d10a6d6100000000000000000000000082b28e5a2444d22af36e1bb40cfd1b3e155d9486
-----Decoded View---------------
Arg [0] : _token (address): 0xcbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e7
Arg [1] : _registrar (address): 0xf884647dfa84696d9373f36ee413ccc48093f924
Arg [2] : _priceOracle (address): 0xc194bf150f458d6f04c135c9ba1ff0e4d10a6d61
Arg [3] : _reverseRegistrar (address): 0x82b28e5a2444d22af36e1bb40cfd1b3e155d9486
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000cbf0adea24fd5f32c6e7f0474f0d1b94ace4e2e7
Arg [1] : 000000000000000000000000f884647dfa84696d9373f36ee413ccc48093f924
Arg [2] : 000000000000000000000000c194bf150f458d6f04c135c9ba1ff0e4d10a6d61
Arg [3] : 00000000000000000000000082b28e5a2444d22af36e1bb40cfd1b3e155d9486
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.