Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
19164293 | 299 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
NamefiNFT
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Apache-2.0+ // Author: Team Namefi by D3ServeLabs // https://namefi.io // https://d3serve.xyz // Security Contact: [email protected] pragma solidity ^0.8.20; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/interfaces/IERC5267Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol"; import "./ExpirableNFT.sol"; import "./LockableNFT.sol"; import "./IChargeableERC20.sol"; import "./NamefiStruct.sol"; error NamefiNFT_DomainNameNotNomalized(string domainName); error NamefiNFT_EpxirationDateTooEarly(uint256 expirationTime, uint256 currentBlockTime); error NamefiNFT_ServiceCreditContractNotSet(); error NamefiNFT_ServiceCreditFailToCharge(); error NamefiNFT_TransferUnauthorized(address by, address from, address to, uint256 tokenId); error NamefiNFT_SignerUnauthorized(address signer, uint256 tokenId); error NamefiNFT_URIQueryForNonexistentToken(); error NamefiNFT_ExtendTimeNotMultipleOf365Days(); /** * @custom:security-contact [email protected] * @custom:version V1.2.0 * The ABI of this interface in javascript array such as ``` [ "function idToNormalizedDomainName(uint256 tokenId) public view returns (string memory)", "function normalizedDomainNameToId(string memory domainName) public pure returns (uint256)", "function safeMintByNameNoCharge(address to, string memory domainName, uint256 expirationTime) external virtual", "function safeMintByNameWithCharge(address to, string memory domainName, uint256 expirationTime, address chargee, bytes memory extraData) external virtual", "function burnByName(string memory domainName) external", "function safeTransferFromByName(address from, address to, string memory domainName) public", "function setBaseURI(string memory baseUriStr) public", "function setExpiration(uint256 tokenId, uint256 expirationTime) public", "function lock(uint256 tokenId, bytes calldata extra) external payable virtual", "function lockByName(string memory domainName) external", "function unlock(uint256 tokenId, bytes calldata extra) external payable virtual", "function unlockByName(string memory domainName) external", "function setServiceCreditContract(address addr) public" ] ``` */ contract NamefiNFT is Initializable, ERC721Upgradeable, AccessControlUpgradeable, ExpirableNFT, LockableNFT, EIP712Decoder, IERC5267Upgradeable { string private _baseUriStr; // Storage Slot mapping(uint256 id => string) private _idToDomainNameMap; // Storage Slot IChargeableERC20 public _NamefiServiceCreditContract; // Storage Slot // Currently MINTER_ROLE is used for minting, burning and updating expiration time // until we have need more fine-grain control. bytes32 public constant MINTER_ROLE = keccak256("MINTER"); string public constant CONTRACT_NAME = "NamefiNFT"; string public constant CONTRACT_SYMBOL = "NFNFT"; string public constant CURRENT_VERSION = "v1.2.0"; /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } // This is a URI for the contract itself. It is not a tokenURI. // It follows https://docs.opensea.io/docs/contract-level-metadata function contractURI() public pure returns (string memory) { return "https://md.namefi.io/namefi-nft.json"; } function initialize() initializer public { __ERC721_init(CONTRACT_NAME, CONTRACT_SYMBOL); __AccessControl_init(); _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); _baseUriStr = "https://md.namefi.io/"; } function idToNormalizedDomainName(uint256 tokenId) public view returns (string memory) { return _idToDomainNameMap[tokenId]; } // if domainName contains any letter other than lowercase letters, numbers and ".", it is not normalized // in our normalized form it doens't end with "." // The following can be summarized as regex of /^[a-z0-9][a-z0-9\-\.]{1,253}\.$/ // https://regex101.com/r/Sn1S3J/1 function isNormalizedName(string memory domainName) public pure returns (bool) { if (bytes(domainName).length < 3 || bytes(domainName).length > 255) { return false; } // A normalized domain name must NOT end with "." if (bytes(domainName)[bytes(domainName).length - 1] == ".") { return true; } // A nomralized domain name must start with lower case letter or number bytes1 firstChar = bytes(domainName)[0]; if (firstChar < 0x30 || (firstChar > 0x39 && firstChar < 0x61) || firstChar > 0x7a) { return false; } // if domainName contains any letter other than lowercase letters, numbers, dash and ".", it is not normalized for (uint i = 1; i < bytes(domainName).length - 2; i++) { bytes1 char = bytes(domainName)[i]; if ( !(char >= 0x30 && char <= 0x39) // 0-9 && !(char >= 0x61 && char <= 0x7a) // a-z && char != 0x2e // "." && char != 0x2d // "-" ) { return false; } } return true; } function normalizedDomainNameToId(string memory domainName) public pure returns (uint256) { return uint256(keccak256(abi.encodePacked(domainName))); } function _safeMintByName( address to, string memory domainName, uint256 expirationTime // same unit of block.timestamp ) internal virtual onlyRole(MINTER_ROLE) { if (!isNormalizedName(domainName)) revert NamefiNFT_DomainNameNotNomalized(domainName); uint256 tokenId = normalizedDomainNameToId(domainName); _idToDomainNameMap[tokenId] = domainName; if (expirationTime <= block.timestamp) { revert NamefiNFT_EpxirationDateTooEarly(expirationTime, block.timestamp); } _setExpiration(tokenId, expirationTime); _safeMint(to, tokenId); } function safeMintByNameNoCharge( address to, string memory domainName, uint256 expirationTime // unix timestamp ) external virtual onlyRole(MINTER_ROLE) { _safeMintByName(to, domainName, expirationTime); } function _ensureChargeServiceCredit( address chargee, uint256 chageAmount, string memory reason, bytes memory /* extraData */) internal { if (_NamefiServiceCreditContract == IChargeableERC20(address(0))) { revert NamefiNFT_ServiceCreditContractNotSet(); } // TODO: audit to protect from reentry attack bytes32 result = _NamefiServiceCreditContract.charge( address(this), chargee, chageAmount, // add string reason "NamefiNFT: mint" + domainName in one string reason, bytes("") ); if (result != keccak256("SUCCESS")) { revert NamefiNFT_ServiceCreditFailToCharge(); } } // DEPRECATED. TODO: remove after migration. function safeMintByNameWithCharge( address to, string memory domainName, uint256 expirationTime, // same unit of block.timestamp address chargee, bytes memory /*extraData*/ ) external virtual onlyRole(MINTER_ROLE) { _ensureChargeServiceCredit( chargee, 20e18, // HARDCODE for now. TODO: remove after migration. string(abi.encodePacked("NamefiNFT: mint ", domainName)), bytes("")); _safeMintByName(to, domainName, expirationTime); } function safeMintByNameWithChargeAmount( address to, string memory domainName, uint256 expirationTime, // same unit of block.timestamp address chargee, uint256 chargeAmount, bytes memory /*extraData*/ ) external virtual onlyRole(MINTER_ROLE) { _ensureChargeServiceCredit( chargee, chargeAmount, // HARDCODE for now. TODO: remove after migration. string(abi.encodePacked("NamefiNFT: mint ", domainName)), bytes("")); _safeMintByName(to, domainName, expirationTime); } function burnByName(string memory domainName) public onlyRole(MINTER_ROLE) whenLocked(normalizedDomainNameToId(domainName), bytes("")) { uint256 tokenId = normalizedDomainNameToId(domainName); _idToDomainNameMap[tokenId] = ""; _burn(tokenId); } function safeTransferFromByName(address from, address to, string memory domainName) public { uint256 tokenId = normalizedDomainNameToId(domainName); if (!_isApprovedOrOwner(_msgSender(), tokenId)) { revert NamefiNFT_TransferUnauthorized(_msgSender(), from, to, tokenId); } _idToDomainNameMap[tokenId] = domainName; _safeTransfer(from, to, tokenId, ""); } function _transfer(address from, address to, uint256 tokenId) whenNotLocked(tokenId, bytes("")) whenNotExpired(tokenId) internal virtual override { super._transfer(from, to, tokenId); } // URI function _baseURI() internal view override returns (string memory) { return _baseUriStr; } function setBaseURI(string memory baseUriStr) public onlyRole(DEFAULT_ADMIN_ROLE) { _baseUriStr = baseUriStr; } function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) { revert NamefiNFT_URIQueryForNonexistentToken(); } return string(abi.encodePacked(_baseURI(), _idToDomainNameMap[tokenId])); } function setExpiration(uint256 tokenId, uint256 expirationTime) public override onlyRole(MINTER_ROLE) { _setExpiration(tokenId, expirationTime); } // DEPRECATED TODO: remove after migration function extendByNameWithCharge( string memory domainName, uint256 timeToExtend, // Same unit with expirationTime new expiration time shall be expirationTime + timeToExtend address chargee, bytes memory /* extraEata */) external virtual onlyRole(MINTER_ROLE) { if (timeToExtend % 365 days != 0) { revert NamefiNFT_ExtendTimeNotMultipleOf365Days(); } uint256 yearToExtend = timeToExtend / 365 days; uint256 tokenId = normalizedDomainNameToId(domainName); _ensureChargeServiceCredit( chargee, // For simplecity we are using a per-year model. 20e18 * (yearToExtend), string(abi.encodePacked("NamefiNFT: mint ", domainName)), bytes("")); _setExpiration(tokenId, _getExpiration(tokenId) + timeToExtend); } function extendByNameWithChargeAmount( string memory domainName, uint256 timeToExtend, // Same unit with expirationTime new expiration time shall be expirationTime + timeToExtend address chargee, uint256 chargeAmount, bytes memory /* extraEata */) external virtual onlyRole(MINTER_ROLE) { uint256 tokenId = normalizedDomainNameToId(domainName); _ensureChargeServiceCredit( chargee, chargeAmount, string(abi.encodePacked("NamefiNFT: mint ", domainName)), bytes("")); _setExpiration(tokenId, _getExpiration(tokenId) + timeToExtend); } function lock(uint256 tokenId, bytes calldata extra) external payable override onlyRole(MINTER_ROLE) { _lock(tokenId, extra); } function lockByName(string memory domainName) external onlyRole(MINTER_ROLE) { uint256 tokenId = normalizedDomainNameToId(domainName); _lock(tokenId, bytes("")); } function unlock(uint256 tokenId, bytes calldata extra) external payable override onlyRole(MINTER_ROLE) { _unlock(tokenId, extra); } function unlockByName(string memory domainName) external onlyRole(MINTER_ROLE) { uint256 tokenId = normalizedDomainNameToId(domainName); _unlock(tokenId, bytes("")); } function supportsInterface(bytes4 interfaceId) public view override(ERC721Upgradeable, AccessControlUpgradeable) returns (bool) { return super.supportsInterface(interfaceId) || interfaceId == type(IERC5267Upgradeable).interfaceId; } function setServiceCreditContract(address addr) public onlyRole(DEFAULT_ADMIN_ROLE) { _NamefiServiceCreditContract = IChargeableERC20(addr); } function getDomainHash() public view override virtual returns (bytes32) { EIP712Domain memory _input; _input.name = CONTRACT_NAME; _input.version = CURRENT_VERSION; _input.chainId = block.chainid; _input.verifyingContract = address(this); return getEip712DomainPacketHash(_input); } function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 CONTRACT_NAME, CURRENT_VERSION, block.chainid, address(this), bytes32(0), new uint256[](0) ); } bytes32 public constant VALID_SIG_BY_ID_MAGIC_VALUE = keccak256("VALID_SIG_BY_ID_MAGIC_VALUE"); bytes32 public constant VALID_SIG_BY_ID_BAD_VALUE = keccak256("VALID_SIG_BY_ID_BAD_VALUE"); function _isValidSignatureByTokenId( uint256 tokenId, address signer, bytes32 digest, bytes memory siganture, bytes memory /*extraData*/ ) internal view returns (bytes32 magicValue) { if (!_exists(tokenId)) { revert NamefiNFT_URIQueryForNonexistentToken(); } if (!_isApprovedOrOwner(signer, tokenId)) { revert NamefiNFT_SignerUnauthorized(signer, tokenId); } if (SignatureCheckerUpgradeable.isValidSignatureNow(signer, digest, siganture)) { return VALID_SIG_BY_ID_MAGIC_VALUE; } else { return VALID_SIG_BY_ID_BAD_VALUE; } } function isValidSignatureByTokenId( uint256 tokenId, address signer, bytes32 digest, bytes memory siganture, bytes calldata /*extraData*/ ) external view returns (bytes32 magicValue) { return _isValidSignatureByTokenId(tokenId, signer, digest, siganture, bytes("")); } function isValidSignatureByName( string memory name, address signer, bytes32 digest, bytes memory siganture, bytes calldata /*extraData*/ ) external view returns (bytes32 magicValue) { uint256 id = normalizedDomainNameToId(name); return _isValidSignatureByTokenId(id, signer, digest, siganture, bytes("")); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(account), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } /** * @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 v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271Upgradeable { /** * @dev Should return whether the signature provided is valid for the provided data * @param hash Hash of the data to be signed * @param signature Signature byte array associated with _data */ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267Upgradeable { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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] * ```solidity * 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. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ 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. * * 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. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * 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. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ 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. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _safeTransfer(from, to, tokenId, data); } /** * @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. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _ownerOf(tokenId) != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721Upgradeable.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal virtual { require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {} /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such * that `ownerOf(tokenId)` is `a`. */ // solhint-disable-next-line func-name-mixedcase function __unsafe_increaseBalance(address account, uint256 amount) internal { _balances[account] += amount; } /** * @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[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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 // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 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.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol) pragma solidity ^0.8.0; import "./ECDSAUpgradeable.sol"; import "../../interfaces/IERC1271Upgradeable.sol"; /** * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like * Argent and Gnosis Safe. * * _Available since v4.1._ */ library SignatureCheckerUpgradeable { /** * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. * * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) { (address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature); return (error == ECDSAUpgradeable.RecoverError.NoError && recovered == signer) || isValidERC1271SignatureNow(signer, hash, signature); } /** * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated * against the signer smart contract using ERC1271. * * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ function isValidERC1271SignatureNow( address signer, bytes32 hash, bytes memory signature ) internal view returns (bool) { (bool success, bytes memory result) = signer.staticcall( abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature) ); return (success && result.length >= 32 && abi.decode(result, (bytes32)) == bytes32(IERC1271Upgradeable.isValidSignature.selector)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @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/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 IERC165Upgradeable { /** * @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 // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library MathUpgradeable { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMathUpgradeable { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; import "./math/SignedMathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = MathUpgradeable.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMathUpgradeable.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, MathUpgradeable.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: Apache-2.0+ // Author: Team Namefi by D3ServeLabs // https://namefi.io // https://d3serve.xyz // Security Contact: [email protected] pragma solidity ^0.8.20; // ExpirableNFT: expired error ExpirableNFT_Expired(uint256 tokenId); abstract contract ExpirableNFT { mapping(uint256 id => uint256) private _expirations; function _getExpiration(uint256 tokenId) internal view returns (uint256) { return _expirations[tokenId]; } function getExpiration(uint256 tokenId) public view returns (uint256) { return _getExpiration(tokenId); } function isExpired(uint256 tokenId) public view returns (bool) { return _isExpired(tokenId); } function _setExpiration(uint256 tokenId, uint256 expirationTime) internal { _expirations[tokenId] = expirationTime; } function _isExpired(uint256 tokenId) internal view returns (bool) { return _expirations[tokenId] < block.timestamp; } modifier whenNotExpired(uint256 tokenId) { if (_isExpired(tokenId)) revert ExpirableNFT_Expired(tokenId); _; } function setExpiration(uint256 tokenId, uint256 expirationTime) public 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: Apache-2.0+ // Author: Team Namefi by D3ServeLabs // https://namefi.io // https://d3serve.xyz // Security Contact: [email protected] pragma solidity ^0.8.20; interface IChargeableERC20 { event Charge(address charger, address chargee, uint256 amount, string reason, bytes extra); function charge( address charger, address chargee, uint256 amount, string memory reason, bytes memory extra) external returns (bytes32); }
// SPDX-License-Identifier: Apache-2.0+ // Author: Team Namefi by D3ServeLabs // https://namefi.io // https://d3serve.xyz // Security Contact: [email protected] pragma solidity ^0.8.20; error LockableNFT_Locked(uint256 tokenId); error LockableNFT_NotLocked(uint256 tokenId); /** * The ABI of this interface in javascript array such as ``` [ "function isLocked(uint256 tokenId) external view returns (bool)", "function isLocked(uint256 tokenId, bytes calldata extra) external view returns (bool)", "function lock(uint256 tokenId, bytes memory extra) external payable virtual", "function unlock(uint256 tokenId, bytes memory extra) external payable virtual", "event Lock(uint256 indexed tokenId, bytes extra)", "event Unlock(uint256 indexed tokenId, bytes extra)" ] ``` */ abstract contract LockableNFT { mapping(uint256 id => bool) private _locks; event Lock(uint256 indexed tokenId, bytes extra); event Unlock(uint256 indexed tokenId, bytes extra); function isLocked(uint256 tokenId) external view returns (bool) { return _isLocked(tokenId, bytes("")); } function isLocked(uint256 tokenId, bytes calldata extra) external view returns (bool) { return _isLocked(tokenId, extra); } function _isLocked(uint256 tokenId, bytes memory /*extra*/) internal view returns (bool) { return _locks[tokenId]; } function _lock(uint256 tokenId, bytes memory extra) internal { _locks[tokenId] = true; emit Lock(tokenId, extra); } function _unlock(uint256 tokenId, bytes memory extra) internal { _locks[tokenId] = false; emit Unlock(tokenId, extra); } function lock(uint256 tokenId, bytes memory extra) external payable virtual; function unlock(uint256 tokenId, bytes memory extra) external payable virtual; modifier whenNotLocked (uint256 tokenId, bytes memory /*extra*/) { if (_locks[tokenId]) revert LockableNFT_Locked(tokenId); _; } modifier whenLocked (uint256 tokenId, bytes memory /*extra*/) { if (!_locks[tokenId]) revert LockableNFT_NotLocked(tokenId); _; } /** * @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: Apache-2.0+ // Author: Team Namefi by D3ServeLabs // https://namefi.io // https://d3serve.xyz // Security Contact: [email protected] pragma solidity ^0.8.20; // This was generated by eip712-codegen and modified by hand. struct EIP712Domain { string name; string version; uint256 chainId; address verifyingContract; } bytes32 constant eip712DomainTypehash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); struct DnsUpdateRequest { string updateType; DnsRecord record; } bytes32 constant dnsUpdateRequestTypehash = keccak256( "DnsUpdateRequest(string updateType,DnsRecord record)DnsRecord(string name,string dnsType,string value,uint256 ttl)" ); struct DnsRecord { string name; string dnsType; string value; uint256 ttl; } bytes32 constant dnsRecordTypehash = keccak256( "DnsRecord(string name,string dnsType,string value,uint256 ttl)" ); abstract contract ERC1271Contract { /** * @dev Should return whether the signature provided is valid for the provided hash * @param _hash Hash of the data to be signed * @param _signature Signature byte array associated with _hash * * MUST return the bytes4 magic value 0x1626ba7e when function passes. * MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5) * MUST allow external calls */ function isValidSignature( bytes32 _hash, bytes memory _signature ) public view virtual returns (bytes4 magicValue); } abstract contract EIP712Decoder { function getDomainHash() public view virtual returns (bytes32); /** * @dev Recover signer address from a message by using their signature * @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address. * @param sig bytes signature, the signature is generated using web3.eth.sign() */ function recover( bytes32 hash, bytes memory sig ) internal pure returns (address) { bytes32 r; bytes32 s; uint8 v; // Check the signature length if (sig.length != 65) { return (address(0)); } // Divide the signature in r, s and v variables assembly { r := mload(add(sig, 32)) s := mload(add(sig, 64)) v := byte(0, mload(add(sig, 96))) } // Version of signature should be 27 or 28, but 0 and 1 are also possible versions if (v < 27) { v += 27; } // If the version is correct return the signer address if (v != 27 && v != 28) { return (address(0)); } else { return ecrecover(hash, v, r, s); } } function getEip712DomainPacketHash( EIP712Domain memory _input ) public pure returns (bytes32) { bytes memory encoded = abi.encode( eip712DomainTypehash, keccak256(bytes(_input.name)), keccak256(bytes(_input.version)), _input.chainId, _input.verifyingContract ); return keccak256(encoded); } function getDnsUpdateRequestPacketHash( DnsUpdateRequest memory _input ) public pure returns (bytes32) { bytes memory encoded = abi.encode( dnsUpdateRequestTypehash, keccak256(bytes(_input.updateType)), getDnsRecordPacketHash(_input.record) ); return keccak256(encoded); } function getDnsRecordPacketHash( DnsRecord memory _input ) public pure returns (bytes32) { bytes memory encoded = abi.encode( dnsRecordTypehash, keccak256(bytes(_input.name)), keccak256(bytes(_input.dnsType)), keccak256(bytes(_input.value)), _input.ttl ); return keccak256(encoded); } function getDigest( DnsUpdateRequest memory _message ) public view returns (bytes32) { bytes32 packetHash = getDnsUpdateRequestPacketHash(_message); bytes32 digest = keccak256( abi.encodePacked("\x19\x01", getDomainHash(), packetHash) ); return digest; } function verifyDnsUpdateRequest( DnsUpdateRequest memory _message, address _signer, bytes memory _signature ) public view returns (address) { bytes32 digest = getDigest(_message); if (_signer == 0x0000000000000000000000000000000000000000) { address recoveredSigner = recover(digest, _signature); return recoveredSigner; } else { // EIP-1271 signature verification bytes4 result = ERC1271Contract(_signer).isValidSignature( digest, _signature ); require(result == 0x1626ba7e, "INVALID_SIGNATURE"); return _signer; } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ExpirableNFT_Expired","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"LockableNFT_Locked","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"LockableNFT_NotLocked","type":"error"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"}],"name":"NamefiNFT_DomainNameNotNomalized","type":"error"},{"inputs":[{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"uint256","name":"currentBlockTime","type":"uint256"}],"name":"NamefiNFT_EpxirationDateTooEarly","type":"error"},{"inputs":[],"name":"NamefiNFT_ExtendTimeNotMultipleOf365Days","type":"error"},{"inputs":[],"name":"NamefiNFT_ServiceCreditContractNotSet","type":"error"},{"inputs":[],"name":"NamefiNFT_ServiceCreditFailToCharge","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NamefiNFT_SignerUnauthorized","type":"error"},{"inputs":[{"internalType":"address","name":"by","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NamefiNFT_TransferUnauthorized","type":"error"},{"inputs":[],"name":"NamefiNFT_URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"extra","type":"bytes"}],"name":"Lock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"bytes","name":"extra","type":"bytes"}],"name":"Unlock","type":"event"},{"inputs":[],"name":"CONTRACT_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTRACT_SYMBOL","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CURRENT_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VALID_SIG_BY_ID_BAD_VALUE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VALID_SIG_BY_ID_MAGIC_VALUE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_NamefiServiceCreditContract","outputs":[{"internalType":"contract IChargeableERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"}],"name":"burnByName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"},{"internalType":"uint256","name":"timeToExtend","type":"uint256"},{"internalType":"address","name":"chargee","type":"address"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"extendByNameWithCharge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"},{"internalType":"uint256","name":"timeToExtend","type":"uint256"},{"internalType":"address","name":"chargee","type":"address"},{"internalType":"uint256","name":"chargeAmount","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"extendByNameWithChargeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"updateType","type":"string"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"dnsType","type":"string"},{"internalType":"string","name":"value","type":"string"},{"internalType":"uint256","name":"ttl","type":"uint256"}],"internalType":"struct DnsRecord","name":"record","type":"tuple"}],"internalType":"struct DnsUpdateRequest","name":"_message","type":"tuple"}],"name":"getDigest","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"dnsType","type":"string"},{"internalType":"string","name":"value","type":"string"},{"internalType":"uint256","name":"ttl","type":"uint256"}],"internalType":"struct DnsRecord","name":"_input","type":"tuple"}],"name":"getDnsRecordPacketHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"updateType","type":"string"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"dnsType","type":"string"},{"internalType":"string","name":"value","type":"string"},{"internalType":"uint256","name":"ttl","type":"uint256"}],"internalType":"struct DnsRecord","name":"record","type":"tuple"}],"internalType":"struct DnsUpdateRequest","name":"_input","type":"tuple"}],"name":"getDnsUpdateRequestPacketHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getDomainHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"}],"internalType":"struct EIP712Domain","name":"_input","type":"tuple"}],"name":"getEip712DomainPacketHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getExpiration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"idToNormalizedDomainName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isExpired","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"extra","type":"bytes"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"}],"name":"isNormalizedName","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"bytes32","name":"digest","type":"bytes32"},{"internalType":"bytes","name":"siganture","type":"bytes"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"isValidSignatureByName","outputs":[{"internalType":"bytes32","name":"magicValue","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"bytes32","name":"digest","type":"bytes32"},{"internalType":"bytes","name":"siganture","type":"bytes"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"isValidSignatureByTokenId","outputs":[{"internalType":"bytes32","name":"magicValue","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"extra","type":"bytes"}],"name":"lock","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"}],"name":"lockByName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"}],"name":"normalizedDomainNameToId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"domainName","type":"string"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"name":"safeMintByNameNoCharge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"domainName","type":"string"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"address","name":"chargee","type":"address"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeMintByNameWithCharge","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"domainName","type":"string"},{"internalType":"uint256","name":"expirationTime","type":"uint256"},{"internalType":"address","name":"chargee","type":"address"},{"internalType":"uint256","name":"chargeAmount","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeMintByNameWithChargeAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"domainName","type":"string"}],"name":"safeTransferFromByName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"baseUriStr","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"name":"setExpiration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setServiceCreditContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"extra","type":"bytes"}],"name":"unlock","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"domainName","type":"string"}],"name":"unlockByName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"updateType","type":"string"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"dnsType","type":"string"},{"internalType":"string","name":"value","type":"string"},{"internalType":"uint256","name":"ttl","type":"uint256"}],"internalType":"struct DnsRecord","name":"record","type":"tuple"}],"internalType":"struct DnsUpdateRequest","name":"_message","type":"tuple"},{"internalType":"address","name":"_signer","type":"address"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"verifyDnsUpdateRequest","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801562000010575f80fd5b506200001b62000021565b620000df565b5f54610100900460ff16156200008d5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b5f5460ff90811614620000dd575f805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b613f9b80620000ed5f395ff3fe608060405260043610610371575f3560e01c80636352211e116101c8578063a22cb465116100fd578063d53913931161009d578063e8a3d4851161006d578063e8a3d48514610a72578063e985e9c514610a86578063f6aacfb114610acd578063fee5e46314610aec575f80fd5b8063d539139314610a01578063d547741f14610a21578063d8f7c83614610a40578063d9548e5314610a53575f80fd5b8063a49803ff116100d8578063a49803ff14610973578063b88d4fde14610992578063ba412189146109b1578063c87b56dd146109e2575f80fd5b8063a22cb465146108f1578063a27f672414610910578063a3825b8114610943575f80fd5b806384b0196e1161016857806395d89b411161014357806395d89b411461088c5780639f123d22146108a0578063a05b775f146108bf578063a217fddf146108de575f80fd5b806384b0196e14610827578063910e923b1461084e57806391d148541461086d575f80fd5b80637bf1fd16116101a35780637bf1fd16146107c15780638116509b146107e05780638129fc1c146107ff57806383ebb77114610813575f80fd5b80636352211e1461076457806370a08231146107835780637a911eb4146107a2575f80fd5b806323b872dd116102a95780633c88688f11610249578063582a0fed11610219578063582a0fed146106bf57806359372a57146106f25780635f5929c614610711578063614d08f814610730575f80fd5b80633c88688f146106435780633c9f21a01461066257806342842e0e1461068157806355f804b3146106a0575f80fd5b806326ed7f1f1161028457806326ed7f1f146105c75780632ab048c1146105e65780632f2ff15d1461060557806336568abe14610624575f80fd5b806323b872dd1461055b57806323d9b3791461057a578063248a9ca314610599575f80fd5b80630b49d5cb1161031457806314e214e0116102ef57806314e214e0146104ea578063166aa77a146105095780631835beb0146105285780631e10f74a14610548575f80fd5b80630b49d5cb1461047f5780630d676829146104ac578063112b5de9146104cb575f80fd5b806306fdde031161034f57806306fdde03146103e9578063070313051461040a578063081812fc14610429578063095ea7b314610460575f80fd5b806301ffc9a714610375578063036489cf146103a957806305a4c8ee146103ca575b5f80fd5b348015610380575f80fd5b5061039461038f366004612f80565b610b0b565b60405190151581526020015b60405180910390f35b3480156103b4575f80fd5b506103c86103c3366004612fb6565b610b36565b005b3480156103d5575f80fd5b506103c86103e4366004613093565b610b64565b3480156103f4575f80fd5b506103fd610bf6565b6040516103a09190613139565b348015610415575f80fd5b506103c861042436600461314b565b610c86565b348015610434575f80fd5b5061044861044336600461316b565b610cb4565b6040516001600160a01b0390911681526020016103a0565b34801561046b575f80fd5b506103c861047a366004613182565b610cd9565b34801561048a575f80fd5b5061049e6104993660046132c7565b610de8565b6040519081526020016103a0565b3480156104b7575f80fd5b506103c86104c63660046132f8565b610e5d565b3480156104d6575f80fd5b506103946104e5366004613370565b610f40565b3480156104f5575f80fd5b506104486105043660046133a1565b611108565b348015610514575f80fd5b50610394610523366004613442565b61120c565b348015610533575f80fd5b5061013154610448906001600160a01b031681565b6103c8610556366004613442565b611254565b348015610566575f80fd5b506103c8610575366004613489565b6112aa565b348015610585575f80fd5b506103c8610594366004613370565b6112da565b3480156105a4575f80fd5b5061049e6105b336600461316b565b5f9081526097602052604090206001015490565b3480156105d2575f80fd5b5061049e6105e13660046132c7565b611315565b3480156105f1575f80fd5b506103c86106003660046134c2565b61136b565b348015610610575f80fd5b506103c861061f366004613552565b6113a3565b34801561062f575f80fd5b506103c861063e366004613552565b6113c7565b34801561064e575f80fd5b5061049e61065d36600461357c565b611445565b34801561066d575f80fd5b5061049e61067c36600461361d565b611479565b34801561068c575f80fd5b506103c861069b366004613489565b6114f8565b3480156106ab575f80fd5b506103c86106ba366004613370565b611512565b3480156106ca575f80fd5b5061049e7f34fffe935a7dd0aac811292906d600561d350ed6f9d4af50dd939cf301ea907381565b3480156106fd575f80fd5b5061049e61070c366004613370565b611529565b34801561071c575f80fd5b506103fd61072b36600461316b565b611559565b34801561073b575f80fd5b506103fd6040518060400160405280600981526020016813985b59599a53919560ba1b81525081565b34801561076f575f80fd5b5061044861077e36600461316b565b6115f9565b34801561078e575f80fd5b5061049e61079d366004612fb6565b611658565b3480156107ad575f80fd5b506103c86107bc366004613370565b6116dc565b3480156107cc575f80fd5b506103c86107db3660046136c2565b61177f565b3480156107eb575f80fd5b5061049e6107fa366004613714565b6117a1565b34801561080a575f80fd5b506103c861181e565b34801561081e575f80fd5b5061049e6119cd565b348015610832575f80fd5b5061083b611a45565b6040516103a09796959493929190613745565b348015610859575f80fd5b506103c86108683660046137dc565b611aef565b348015610878575f80fd5b50610394610887366004613552565b611b38565b348015610897575f80fd5b506103fd611b62565b3480156108ab575f80fd5b5061049e6108ba366004613864565b611b71565b3480156108ca575f80fd5b5061049e6108d936600461316b565b611b98565b3480156108e9575f80fd5b5061049e5f81565b3480156108fc575f80fd5b506103c861090b3660046138ab565b611bab565b34801561091b575f80fd5b5061049e7f6cfa6a566718927e650e1ba28377415cb87a1c925be906852b1f19537968876a81565b34801561094e575f80fd5b506103fd60405180604001604052806005815260200164139193919560da1b81525081565b34801561097e575f80fd5b506103c861098d366004613370565b611bb6565b34801561099d575f80fd5b506103c86109ac3660046138e4565b611bf1565b3480156109bc575f80fd5b506103fd60405180604001604052806006815260200165076312e322e360d41b81525081565b3480156109ed575f80fd5b506103fd6109fc36600461316b565b611c23565b348015610a0c575f80fd5b5061049e5f80516020613f2283398151915281565b348015610a2c575f80fd5b506103c8610a3b366004613552565b611c98565b6103c8610a4e366004613442565b611cbc565b348015610a5e575f80fd5b50610394610a6d36600461316b565b611d12565b348015610a7d575f80fd5b506103fd611d27565b348015610a91575f80fd5b50610394610aa036600461393b565b6001600160a01b039182165f908152606a6020908152604080832093909416825291909152205460ff1690565b348015610ad8575f80fd5b50610394610ae736600461316b565b611d47565b348015610af7575f80fd5b506103c8610b06366004613963565b611d6a565b5f610b1582611da3565b80610b3057506001600160e01b031982166342580cb760e11b145b92915050565b5f610b4081611dc7565b5061013180546001600160a01b0319166001600160a01b0392909216919091179055565b5f610b6e82611529565b9050610b7b335b82611dd1565b610bbd576040516321e4484160e01b81523360048201526001600160a01b03858116602483015284166044820152606481018290526084015b60405180910390fd5b5f81815261013060205260409020610bd58382613a46565b50610bf084848360405180602001604052805f815250611e4d565b50505050565b606060658054610c05906139ca565b80601f0160208091040260200160405190810160405280929190818152602001828054610c31906139ca565b8015610c7c5780601f10610c5357610100808354040283529160200191610c7c565b820191905f5260205f20905b815481529060010190602001808311610c5f57829003601f168201915b5050505050905090565b5f80516020613f22833981519152610c9d81611dc7565b505f91825260c9602052604090912055565b505050565b5f610cbe82611e80565b505f908152606960205260409020546001600160a01b031690565b5f610ce3826115f9565b9050806001600160a01b0316836001600160a01b031603610d505760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610bb4565b336001600160a01b0382161480610d6c5750610d6c8133610aa0565b610dde5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610bb4565b610caf8383611ede565b5f807fff09b39d251560191eea2d76dc111e0b24afd489949d1430ef29ff9f91548fa4835f015180519060200120610e2385602001516117a1565b60408051602081019490945283019190915260608201526080015b60408051601f1981840301815291905280516020909101209392505050565b5f80516020613f22833981519152610e7481611dc7565b610e826301e1338085613b15565b15610ea0576040516316c48cf760e11b815260040160405180910390fd5b5f610eaf6301e1338086613b3c565b90505f610ebb87611529565b9050610f0285610ed4846801158e460913d00000613b4f565b89604051602001610ee59190613b66565b60408051601f19818403018152602083019091525f825290611f4b565b610f378187610f1c845f90815260c9602052604090205490565b610f269190613b9d565b5f91825260c9602052604090912055565b50505050505050565b5f600382511080610f52575060ff8251115b15610f5e57505f919050565b8160018351610f6d9190613bb0565b81518110610f7d57610f7d613bc3565b01602001516001600160f81b031916601760f91b03610f9e57506001919050565b5f825f81518110610fb157610fb1613bc3565b01602001516001600160f81b0319169050600360fc1b811080610ff95750603960f81b6001600160f81b03198216118015610ff95750606160f81b6001600160f81b03198216105b806110115750603d60f91b6001600160f81b03198216115b1561101e57505f92915050565b60015b6002845161102f9190613bb0565b8110156110fe575f84828151811061104957611049613bc3565b01602001516001600160f81b0319169050600360fc1b811080159061107c5750603960f81b6001600160f81b0319821611155b1580156110b25750606160f81b6001600160f81b03198216108015906110b05750603d60f91b6001600160f81b0319821611155b155b80156110cc5750601760f91b6001600160f81b0319821614155b80156110e65750602d60f81b6001600160f81b0319821614155b156110f557505f949350505050565b50600101611021565b5060019392505050565b5f8061111385611315565b90506001600160a01b0384165f0361113a575f611130828561203b565b9250611205915050565b604051630b135d3f60e11b81525f906001600160a01b03861690631626ba7e9061116a9085908890600401613bd7565b602060405180830381865afa158015611185573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111a99190613bef565b9050630b135d3f60e11b6001600160e01b03198216146111ff5760405162461bcd60e51b8152602060048201526011602482015270494e56414c49445f5349474e415455524560781b6044820152606401610bb4565b84925050505b9392505050565b5f61124c8484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061210a92505050565b949350505050565b5f80516020613f2283398151915261126b81611dc7565b610bf08484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211f92505050565b6112b333610b75565b6112cf5760405162461bcd60e51b8152600401610bb490613c0a565b610caf838383612172565b5f80516020613f228339815191526112f181611dc7565b5f6112fb83611529565b9050610caf8160405180602001604052805f81525061211f565b5f8061132083610de8565b90505f61132b6119cd565b60405161190160f01b602082015260228101919091526042810183905260620160408051601f198184030181529190528051602090910120949350505050565b5f80516020613f2283398151915261138281611dc7565b611398848488604051602001610ee59190613b66565b610f378787876121f3565b5f828152609760205260409020600101546113bd81611dc7565b610caf838361229b565b6001600160a01b03811633146114375760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bb4565b6114418282612320565b5050565b5f8061145088611529565b905061146d8188888860405180602001604052805f815250612386565b98975050505050505050565b5f807f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f835f01518051906020012084602001518051906020012085604001518660600151604051602001610e3e9594939291909485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b610caf83838360405180602001604052805f815250611bf1565b5f61151c81611dc7565b61012f610caf8382613a46565b5f8160405160200161153b9190613c57565b60408051601f19818403018152919052805160209091012092915050565b5f81815261013060205260409020805460609190611576906139ca565b80601f01602080910402602001604051908101604052809291908181526020018280546115a2906139ca565b80156115ed5780601f106115c4576101008083540402835291602001916115ed565b820191905f5260205f20905b8154815290600101906020018083116115d057829003601f168201915b50505050509050919050565b5f818152606760205260408120546001600160a01b031680610b305760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610bb4565b5f6001600160a01b0382166116c15760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610bb4565b506001600160a01b03165f9081526068602052604090205490565b5f80516020613f228339815191526116f381611dc7565b6116fc82611529565b60408051602080820183525f80835284815260fc909152919091205460ff1661173b57604051630a7c4d4f60e41b815260048101839052602401610bb4565b5f61174585611529565b60408051602080820183525f8083528481526101309091529190912091925061176e9082613a46565b5061177881612456565b5050505050565b5f80516020613f2283398151915261179681611dc7565b610bf08484846121f3565b5f807f6fc1526685fc1036c24f2e18f1865f7d0bc54ce2c94565ca1f45e94838d9acc6835f0151805190602001208460200151805190602001208560400151805190602001208660600151604051602001610e3e959493929190948552602085019390935260408401919091526060830152608082015260a00190565b5f54610100900460ff161580801561183c57505f54600160ff909116105b806118555750303b15801561185557505f5460ff166001145b6118b85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bb4565b5f805460ff1916600117905580156118d9575f805461ff0019166101001790555b6119216040518060400160405280600981526020016813985b59599a53919560ba1b81525060405180604001604052806005815260200164139193919560da1b8152506124e8565b611929612518565b6119335f3361229b565b61194a5f80516020613f228339815191523361229b565b60408051808201909152601581527468747470733a2f2f6d642e6e616d6566692e696f2f60581b602082015261012f906119849082613a46565b5080156119ca575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b60408051608081018252606080825260208083018281525f84860181815293850181815286518088018852600981526813985b59599a53919560ba1b81860152865286518088019097526006875265076312e322e360d41b9387019390935294905246909152309052611a3f81611479565b91505090565b5f6060805f805f60606040518060400160405280600981526020016813985b59599a53919560ba1b81525060405180604001604052806006815260200165076312e322e360d41b81525046305f801b5f6001600160401b03811115611aac57611aac612fcf565b604051908082528060200260200182016040528015611ad5578160200160208202803683370190505b50600f60f81b9d959c50939a509198509650945092509050565b5f80516020613f22833981519152611b0681611dc7565b611b25836801158e460913d0000087604051602001610ee59190613b66565b611b308686866121f3565b505050505050565b5f9182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060668054610c05906139ca565b5f611b8d8787878760405180602001604052805f815250612386565b979650505050505050565b5f81815260c96020526040812054610b30565b611441338383612540565b5f80516020613f22833981519152611bcd81611dc7565b5f611bd783611529565b9050610caf8160405180602001604052805f81525061260d565b611bfb3383611dd1565b611c175760405162461bcd60e51b8152600401610bb490613c0a565b610bf084848484611e4d565b5f818152606760205260409020546060906001600160a01b0316611c5a57604051634257897d60e11b815260040160405180910390fd5b611c62612657565b5f83815261013060209081526040918290209151611c8293929101613c72565b6040516020818303038152906040529050919050565b5f82815260976020526040902060010154611cb281611dc7565b610caf8383612320565b5f80516020613f22833981519152611cd381611dc7565b610bf08484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061260d92505050565b5f81815260c960205260408120544211610b30565b6060604051806060016040528060248152602001613f4260249139905090565b60408051602080820183525f9182905283825260fc90529081205460ff16610b30565b5f80516020613f22833981519152611d8181611dc7565b5f611d8b87611529565b9050610f02858589604051602001610ee59190613b66565b5f6001600160e01b03198216637965db0b60e01b1480610b305750610b3082612667565b6119ca81336126b6565b5f80611ddc836115f9565b9050806001600160a01b0316846001600160a01b03161480611e2257506001600160a01b038082165f908152606a602090815260408083209388168352929052205460ff165b8061124c5750836001600160a01b0316611e3b84610cb4565b6001600160a01b031614949350505050565b611e58848484612172565b611e648484848461270f565b610bf05760405162461bcd60e51b8152600401610bb490613cfc565b5f818152606760205260409020546001600160a01b03166119ca5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610bb4565b5f81815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f12826115f9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610131546001600160a01b0316611f755760405163eadcfb6960e01b815260040160405180910390fd5b61013154604080516020810182525f80825291516318638d1360e01b815291926001600160a01b0316916318638d1391611fb99130918a918a918a91600401613d4e565b6020604051808303815f875af1158015611fd5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ff99190613d92565b90507f39bf027dd97f3bae0cf8cfb909695ec63313a9bd61ad52fc7f52cf565b141da8811461177857604051634d552b3160e01b815260040160405180910390fd5b5f805f808451604114612053575f9350505050610b30565b5050506020820151604083015160608401515f1a601b81101561207e5761207b601b82613da9565b90505b8060ff16601b1415801561209657508060ff16601c14155b156120a6575f9350505050610b30565b604080515f81526020810180835288905260ff831691810191909152606081018490526080810183905260019060a0016020604051602081039080840390855afa1580156120f6573d5f803e3d5ffd5b505050602060405103519350505050610b30565b505f90815260fc602052604090205460ff1690565b5f82815260fc602052604090819020805460ff191690555182907f398f375c8a361a482df2c189cdbc2e073d85754e7bd89e9f35b445a0e8e7a6b390612166908490613139565b60405180910390a25050565b60408051602080820183525f80835284815260fc909152919091205482919060ff16156121b55760405163427743a360e11b815260048101839052602401610bb4565b5f83815260c9602052604090205483904211156121e857604051631fdd101f60e31b815260048101829052602401610bb4565b611b3086868661280c565b5f80516020613f2283398151915261220a81611dc7565b61221383610f40565b612232578260405163daa2ee9560e01b8152600401610bb49190613139565b5f61223c84611529565b5f818152610130602052604090209091506122578582613a46565b504283116122815760405163e3ff4c6160e01b815260048101849052426024820152604401610bb4565b5f81815260c960205260409020839055611778858261296e565b6122a58282611b38565b611441575f8281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122dc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61232a8282611b38565b15611441575f8281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b5f858152606760205260408120546001600160a01b03166123ba57604051634257897d60e11b815260040160405180910390fd5b6123c48587611dd1565b6123f3576040516365d09e0560e11b81526001600160a01b038616600482015260248101879052604401610bb4565b6123fe858585612987565b1561242a57507f6cfa6a566718927e650e1ba28377415cb87a1c925be906852b1f19537968876a61244d565b507f34fffe935a7dd0aac811292906d600561d350ed6f9d4af50dd939cf301ea90735b95945050505050565b5f612460826115f9565b905061246b826115f9565b5f83815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080545f190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b5f54610100900460ff1661250e5760405162461bcd60e51b8152600401610bb490613dc2565b61144182826129e5565b5f54610100900460ff1661253e5760405162461bcd60e51b8152600401610bb490613dc2565b565b816001600160a01b0316836001600160a01b0316036125a15760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610bb4565b6001600160a01b038381165f818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b5f82815260fc602052604090819020805460ff191660011790555182907ff892f27a9970007d6d89caa648ee3c2718d347ebfb7a6c21773c66aaf66673c290612166908490613139565b606061012f8054610c05906139ca565b5f6001600160e01b031982166380ac58cd60e01b148061269757506001600160e01b03198216635b5e139f60e01b145b80610b3057506301ffc9a760e01b6001600160e01b0319831614610b30565b6126c08282611b38565b611441576126cd81612a24565b6126d8836020612a36565b6040516020016126e9929190613e0d565b60408051601f198184030181529082905262461bcd60e51b8252610bb491600401613139565b5f6001600160a01b0384163b1561280157604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612752903390899088908890600401613e81565b6020604051808303815f875af192505050801561278c575060408051601f3d908101601f1916820190925261278991810190613bef565b60015b6127e7573d8080156127b9576040519150601f19603f3d011682016040523d82523d5f602084013e6127be565b606091505b5080515f036127df5760405162461bcd60e51b8152600401610bb490613cfc565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061124c565b506001949350505050565b826001600160a01b031661281f826115f9565b6001600160a01b0316146128455760405162461bcd60e51b8152600401610bb490613eb3565b6001600160a01b0382166128a75760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610bb4565b826001600160a01b03166128ba826115f9565b6001600160a01b0316146128e05760405162461bcd60e51b8152600401610bb490613eb3565b5f81815260696020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526068855283862080545f1901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611441828260405180602001604052805f815250612bcb565b5f805f6129948585612bfd565b90925090505f8160048111156129ac576129ac613ef8565b1480156129ca5750856001600160a01b0316826001600160a01b0316145b806129db57506129db868686612c3f565b9695505050505050565b5f54610100900460ff16612a0b5760405162461bcd60e51b8152600401610bb490613dc2565b6065612a178382613a46565b506066610caf8282613a46565b6060610b306001600160a01b03831660145b60605f612a44836002613b4f565b612a4f906002613b9d565b6001600160401b03811115612a6657612a66612fcf565b6040519080825280601f01601f191660200182016040528015612a90576020820181803683370190505b509050600360fc1b815f81518110612aaa57612aaa613bc3565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110612ad857612ad8613bc3565b60200101906001600160f81b03191690815f1a9053505f612afa846002613b4f565b612b05906001613b9d565b90505b6001811115612b7c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612b3957612b39613bc3565b1a60f81b828281518110612b4f57612b4f613bc3565b60200101906001600160f81b03191690815f1a90535060049490941c93612b7581613f0c565b9050612b08565b5083156112055760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bb4565b612bd58383612d26565b612be15f84848461270f565b610caf5760405162461bcd60e51b8152600401610bb490613cfc565b5f808251604103612c31576020830151604084015160608501515f1a612c2587828585612eae565b94509450505050612c38565b505f905060025b9250929050565b5f805f856001600160a01b0316631626ba7e60e01b8686604051602401612c67929190613bd7565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051612ca59190613c57565b5f60405180830381855afa9150503d805f8114612cdd576040519150601f19603f3d011682016040523d82523d5f602084013e612ce2565b606091505b5091509150818015612cf657506020815110155b80156129db57508051630b135d3f60e11b90612d1b9083016020908101908401613d92565b149695505050505050565b6001600160a01b038216612d7c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610bb4565b5f818152606760205260409020546001600160a01b031615612de05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610bb4565b5f818152606760205260409020546001600160a01b031615612e445760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610bb4565b6001600160a01b0382165f81815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612ee357505f90506003612f62565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612f34573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116612f5c575f60019250925050612f62565b91505f90505b94509492505050565b6001600160e01b0319811681146119ca575f80fd5b5f60208284031215612f90575f80fd5b813561120581612f6b565b80356001600160a01b0381168114612fb1575f80fd5b919050565b5f60208284031215612fc6575f80fd5b61120582612f9b565b634e487b7160e01b5f52604160045260245ffd5b604051608081016001600160401b038111828210171561300557613005612fcf565b60405290565b5f82601f83011261301a575f80fd5b81356001600160401b038082111561303457613034612fcf565b604051601f8301601f19908116603f0116810190828211818310171561305c5761305c612fcf565b81604052838152866020858801011115613074575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f805f606084860312156130a5575f80fd5b6130ae84612f9b565b92506130bc60208501612f9b565b915060408401356001600160401b038111156130d6575f80fd5b6130e28682870161300b565b9150509250925092565b5f5b838110156131065781810151838201526020016130ee565b50505f910152565b5f81518084526131258160208601602086016130ec565b601f01601f19169290920160200192915050565b602081525f611205602083018461310e565b5f806040838503121561315c575f80fd5b50508035926020909101359150565b5f6020828403121561317b575f80fd5b5035919050565b5f8060408385031215613193575f80fd5b61319c83612f9b565b946020939093013593505050565b5f608082840312156131ba575f80fd5b6131c2612fe3565b905081356001600160401b03808211156131da575f80fd5b6131e68583860161300b565b835260208401359150808211156131fb575f80fd5b6132078583860161300b565b6020840152604084013591508082111561321f575f80fd5b5061322c8482850161300b565b6040830152506060820135606082015292915050565b5f60408284031215613252575f80fd5b604051604081016001600160401b03828210818311171561327557613275612fcf565b81604052829350843591508082111561328c575f80fd5b6132988683870161300b565b835260208501359150808211156132ad575f80fd5b506132ba858286016131aa565b6020830152505092915050565b5f602082840312156132d7575f80fd5b81356001600160401b038111156132ec575f80fd5b61124c84828501613242565b5f805f806080858703121561330b575f80fd5b84356001600160401b0380821115613321575f80fd5b61332d8883890161300b565b95506020870135945061334260408801612f9b565b93506060870135915080821115613357575f80fd5b506133648782880161300b565b91505092959194509250565b5f60208284031215613380575f80fd5b81356001600160401b03811115613395575f80fd5b61124c8482850161300b565b5f805f606084860312156133b3575f80fd5b83356001600160401b03808211156133c9575f80fd5b6133d587838801613242565b94506133e360208701612f9b565b935060408601359150808211156133f8575f80fd5b506130e28682870161300b565b5f8083601f840112613415575f80fd5b5081356001600160401b0381111561342b575f80fd5b602083019150836020828501011115612c38575f80fd5b5f805f60408486031215613454575f80fd5b8335925060208401356001600160401b03811115613470575f80fd5b61347c86828701613405565b9497909650939450505050565b5f805f6060848603121561349b575f80fd5b6134a484612f9b565b92506134b260208501612f9b565b9150604084013590509250925092565b5f805f805f8060c087890312156134d7575f80fd5b6134e087612f9b565b955060208701356001600160401b03808211156134fb575f80fd5b6135078a838b0161300b565b96506040890135955061351c60608a01612f9b565b94506080890135935060a0890135915080821115613538575f80fd5b5061354589828a0161300b565b9150509295509295509295565b5f8060408385031215613563575f80fd5b8235915061357360208401612f9b565b90509250929050565b5f805f805f8060a08789031215613591575f80fd5b86356001600160401b03808211156135a7575f80fd5b6135b38a838b0161300b565b97506135c160208a01612f9b565b96506040890135955060608901359150808211156135dd575f80fd5b6135e98a838b0161300b565b945060808901359150808211156135fe575f80fd5b5061360b89828a01613405565b979a9699509497509295939492505050565b5f6020828403121561362d575f80fd5b81356001600160401b0380821115613643575f80fd5b9083019060808286031215613656575f80fd5b61365e612fe3565b82358281111561366c575f80fd5b6136788782860161300b565b82525060208301358281111561368c575f80fd5b6136988782860161300b565b602083015250604083013560408201526136b460608401612f9b565b606082015295945050505050565b5f805f606084860312156136d4575f80fd5b6136dd84612f9b565b925060208401356001600160401b038111156136f7575f80fd5b6137038682870161300b565b925050604084013590509250925092565b5f60208284031215613724575f80fd5b81356001600160401b03811115613739575f80fd5b61124c848285016131aa565b60ff60f81b881681525f602060e0602084015261376560e084018a61310e565b8381036040850152613777818a61310e565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b818110156137ca578351835292840192918401916001016137ae565b50909c9b505050505050505050505050565b5f805f805f60a086880312156137f0575f80fd5b6137f986612f9b565b945060208601356001600160401b0380821115613814575f80fd5b61382089838a0161300b565b95506040880135945061383560608901612f9b565b9350608088013591508082111561384a575f80fd5b506138578882890161300b565b9150509295509295909350565b5f805f805f8060a08789031215613879575f80fd5b8635955061388960208801612f9b565b94506040870135935060608701356001600160401b03808211156135dd575f80fd5b5f80604083850312156138bc575f80fd5b6138c583612f9b565b9150602083013580151581146138d9575f80fd5b809150509250929050565b5f805f80608085870312156138f7575f80fd5b61390085612f9b565b935061390e60208601612f9b565b92506040850135915060608501356001600160401b0381111561392f575f80fd5b6133648782880161300b565b5f806040838503121561394c575f80fd5b61395583612f9b565b915061357360208401612f9b565b5f805f805f60a08688031215613977575f80fd5b85356001600160401b038082111561398d575f80fd5b61399989838a0161300b565b9650602088013595506139ae60408901612f9b565b945060608801359350608088013591508082111561384a575f80fd5b600181811c908216806139de57607f821691505b6020821081036139fc57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115610caf57805f5260205f20601f840160051c81016020851015613a275750805b601f840160051c820191505b81811015611778575f8155600101613a33565b81516001600160401b03811115613a5f57613a5f612fcf565b613a7381613a6d84546139ca565b84613a02565b602080601f831160018114613aa6575f8415613a8f5750858301515b5f19600386901b1c1916600185901b178555611b30565b5f85815260208120601f198616915b82811015613ad457888601518255948401946001909101908401613ab5565b5085821015613af157878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601260045260245ffd5b5f82613b2357613b23613b01565b500690565b634e487b7160e01b5f52601160045260245ffd5b5f82613b4a57613b4a613b01565b500490565b8082028115828204841417610b3057610b30613b28565b6f02730b6b2b334a7232a1d1036b4b73a160851b81525f8251613b908160108501602087016130ec565b9190910160100192915050565b80820180821115610b3057610b30613b28565b81810381811115610b3057610b30613b28565b634e487b7160e01b5f52603260045260245ffd5b828152604060208201525f61124c604083018461310e565b5f60208284031215613bff575f80fd5b815161120581612f6b565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b5f8251613c688184602087016130ec565b9190910192915050565b5f83516020613c858285602089016130ec565b81840191505f8554613c96816139ca565b60018281168015613cae5760018114613cc357613ced565b60ff1984168752821515830287019450613ced565b895f5260205f205f5b84811015613ce557815489820152908301908701613ccc565b505082870194505b50929998505050505050505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b038681168252851660208201526040810184905260a0606082018190525f90613d809083018561310e565b828103608084015261146d818561310e565b5f60208284031215613da2575f80fd5b5051919050565b60ff8181168382160190811115610b3057610b30613b28565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351613e448160178501602088016130ec565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613e758160288401602088016130ec565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906129db9083018461310e565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b634e487b7160e01b5f52602160045260245ffd5b5f81613f1a57613f1a613b28565b505f19019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc968747470733a2f2f6d642e6e616d6566692e696f2f6e616d6566692d6e66742e6a736f6ea26469706673582212205f5917d518ae700b45c36ac752a8f93bc51f5c6c74720e15bdb57633c8a083fe64736f6c63430008180033
Deployed Bytecode
0x608060405260043610610371575f3560e01c80636352211e116101c8578063a22cb465116100fd578063d53913931161009d578063e8a3d4851161006d578063e8a3d48514610a72578063e985e9c514610a86578063f6aacfb114610acd578063fee5e46314610aec575f80fd5b8063d539139314610a01578063d547741f14610a21578063d8f7c83614610a40578063d9548e5314610a53575f80fd5b8063a49803ff116100d8578063a49803ff14610973578063b88d4fde14610992578063ba412189146109b1578063c87b56dd146109e2575f80fd5b8063a22cb465146108f1578063a27f672414610910578063a3825b8114610943575f80fd5b806384b0196e1161016857806395d89b411161014357806395d89b411461088c5780639f123d22146108a0578063a05b775f146108bf578063a217fddf146108de575f80fd5b806384b0196e14610827578063910e923b1461084e57806391d148541461086d575f80fd5b80637bf1fd16116101a35780637bf1fd16146107c15780638116509b146107e05780638129fc1c146107ff57806383ebb77114610813575f80fd5b80636352211e1461076457806370a08231146107835780637a911eb4146107a2575f80fd5b806323b872dd116102a95780633c88688f11610249578063582a0fed11610219578063582a0fed146106bf57806359372a57146106f25780635f5929c614610711578063614d08f814610730575f80fd5b80633c88688f146106435780633c9f21a01461066257806342842e0e1461068157806355f804b3146106a0575f80fd5b806326ed7f1f1161028457806326ed7f1f146105c75780632ab048c1146105e65780632f2ff15d1461060557806336568abe14610624575f80fd5b806323b872dd1461055b57806323d9b3791461057a578063248a9ca314610599575f80fd5b80630b49d5cb1161031457806314e214e0116102ef57806314e214e0146104ea578063166aa77a146105095780631835beb0146105285780631e10f74a14610548575f80fd5b80630b49d5cb1461047f5780630d676829146104ac578063112b5de9146104cb575f80fd5b806306fdde031161034f57806306fdde03146103e9578063070313051461040a578063081812fc14610429578063095ea7b314610460575f80fd5b806301ffc9a714610375578063036489cf146103a957806305a4c8ee146103ca575b5f80fd5b348015610380575f80fd5b5061039461038f366004612f80565b610b0b565b60405190151581526020015b60405180910390f35b3480156103b4575f80fd5b506103c86103c3366004612fb6565b610b36565b005b3480156103d5575f80fd5b506103c86103e4366004613093565b610b64565b3480156103f4575f80fd5b506103fd610bf6565b6040516103a09190613139565b348015610415575f80fd5b506103c861042436600461314b565b610c86565b348015610434575f80fd5b5061044861044336600461316b565b610cb4565b6040516001600160a01b0390911681526020016103a0565b34801561046b575f80fd5b506103c861047a366004613182565b610cd9565b34801561048a575f80fd5b5061049e6104993660046132c7565b610de8565b6040519081526020016103a0565b3480156104b7575f80fd5b506103c86104c63660046132f8565b610e5d565b3480156104d6575f80fd5b506103946104e5366004613370565b610f40565b3480156104f5575f80fd5b506104486105043660046133a1565b611108565b348015610514575f80fd5b50610394610523366004613442565b61120c565b348015610533575f80fd5b5061013154610448906001600160a01b031681565b6103c8610556366004613442565b611254565b348015610566575f80fd5b506103c8610575366004613489565b6112aa565b348015610585575f80fd5b506103c8610594366004613370565b6112da565b3480156105a4575f80fd5b5061049e6105b336600461316b565b5f9081526097602052604090206001015490565b3480156105d2575f80fd5b5061049e6105e13660046132c7565b611315565b3480156105f1575f80fd5b506103c86106003660046134c2565b61136b565b348015610610575f80fd5b506103c861061f366004613552565b6113a3565b34801561062f575f80fd5b506103c861063e366004613552565b6113c7565b34801561064e575f80fd5b5061049e61065d36600461357c565b611445565b34801561066d575f80fd5b5061049e61067c36600461361d565b611479565b34801561068c575f80fd5b506103c861069b366004613489565b6114f8565b3480156106ab575f80fd5b506103c86106ba366004613370565b611512565b3480156106ca575f80fd5b5061049e7f34fffe935a7dd0aac811292906d600561d350ed6f9d4af50dd939cf301ea907381565b3480156106fd575f80fd5b5061049e61070c366004613370565b611529565b34801561071c575f80fd5b506103fd61072b36600461316b565b611559565b34801561073b575f80fd5b506103fd6040518060400160405280600981526020016813985b59599a53919560ba1b81525081565b34801561076f575f80fd5b5061044861077e36600461316b565b6115f9565b34801561078e575f80fd5b5061049e61079d366004612fb6565b611658565b3480156107ad575f80fd5b506103c86107bc366004613370565b6116dc565b3480156107cc575f80fd5b506103c86107db3660046136c2565b61177f565b3480156107eb575f80fd5b5061049e6107fa366004613714565b6117a1565b34801561080a575f80fd5b506103c861181e565b34801561081e575f80fd5b5061049e6119cd565b348015610832575f80fd5b5061083b611a45565b6040516103a09796959493929190613745565b348015610859575f80fd5b506103c86108683660046137dc565b611aef565b348015610878575f80fd5b50610394610887366004613552565b611b38565b348015610897575f80fd5b506103fd611b62565b3480156108ab575f80fd5b5061049e6108ba366004613864565b611b71565b3480156108ca575f80fd5b5061049e6108d936600461316b565b611b98565b3480156108e9575f80fd5b5061049e5f81565b3480156108fc575f80fd5b506103c861090b3660046138ab565b611bab565b34801561091b575f80fd5b5061049e7f6cfa6a566718927e650e1ba28377415cb87a1c925be906852b1f19537968876a81565b34801561094e575f80fd5b506103fd60405180604001604052806005815260200164139193919560da1b81525081565b34801561097e575f80fd5b506103c861098d366004613370565b611bb6565b34801561099d575f80fd5b506103c86109ac3660046138e4565b611bf1565b3480156109bc575f80fd5b506103fd60405180604001604052806006815260200165076312e322e360d41b81525081565b3480156109ed575f80fd5b506103fd6109fc36600461316b565b611c23565b348015610a0c575f80fd5b5061049e5f80516020613f2283398151915281565b348015610a2c575f80fd5b506103c8610a3b366004613552565b611c98565b6103c8610a4e366004613442565b611cbc565b348015610a5e575f80fd5b50610394610a6d36600461316b565b611d12565b348015610a7d575f80fd5b506103fd611d27565b348015610a91575f80fd5b50610394610aa036600461393b565b6001600160a01b039182165f908152606a6020908152604080832093909416825291909152205460ff1690565b348015610ad8575f80fd5b50610394610ae736600461316b565b611d47565b348015610af7575f80fd5b506103c8610b06366004613963565b611d6a565b5f610b1582611da3565b80610b3057506001600160e01b031982166342580cb760e11b145b92915050565b5f610b4081611dc7565b5061013180546001600160a01b0319166001600160a01b0392909216919091179055565b5f610b6e82611529565b9050610b7b335b82611dd1565b610bbd576040516321e4484160e01b81523360048201526001600160a01b03858116602483015284166044820152606481018290526084015b60405180910390fd5b5f81815261013060205260409020610bd58382613a46565b50610bf084848360405180602001604052805f815250611e4d565b50505050565b606060658054610c05906139ca565b80601f0160208091040260200160405190810160405280929190818152602001828054610c31906139ca565b8015610c7c5780601f10610c5357610100808354040283529160200191610c7c565b820191905f5260205f20905b815481529060010190602001808311610c5f57829003601f168201915b5050505050905090565b5f80516020613f22833981519152610c9d81611dc7565b505f91825260c9602052604090912055565b505050565b5f610cbe82611e80565b505f908152606960205260409020546001600160a01b031690565b5f610ce3826115f9565b9050806001600160a01b0316836001600160a01b031603610d505760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610bb4565b336001600160a01b0382161480610d6c5750610d6c8133610aa0565b610dde5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610bb4565b610caf8383611ede565b5f807fff09b39d251560191eea2d76dc111e0b24afd489949d1430ef29ff9f91548fa4835f015180519060200120610e2385602001516117a1565b60408051602081019490945283019190915260608201526080015b60408051601f1981840301815291905280516020909101209392505050565b5f80516020613f22833981519152610e7481611dc7565b610e826301e1338085613b15565b15610ea0576040516316c48cf760e11b815260040160405180910390fd5b5f610eaf6301e1338086613b3c565b90505f610ebb87611529565b9050610f0285610ed4846801158e460913d00000613b4f565b89604051602001610ee59190613b66565b60408051601f19818403018152602083019091525f825290611f4b565b610f378187610f1c845f90815260c9602052604090205490565b610f269190613b9d565b5f91825260c9602052604090912055565b50505050505050565b5f600382511080610f52575060ff8251115b15610f5e57505f919050565b8160018351610f6d9190613bb0565b81518110610f7d57610f7d613bc3565b01602001516001600160f81b031916601760f91b03610f9e57506001919050565b5f825f81518110610fb157610fb1613bc3565b01602001516001600160f81b0319169050600360fc1b811080610ff95750603960f81b6001600160f81b03198216118015610ff95750606160f81b6001600160f81b03198216105b806110115750603d60f91b6001600160f81b03198216115b1561101e57505f92915050565b60015b6002845161102f9190613bb0565b8110156110fe575f84828151811061104957611049613bc3565b01602001516001600160f81b0319169050600360fc1b811080159061107c5750603960f81b6001600160f81b0319821611155b1580156110b25750606160f81b6001600160f81b03198216108015906110b05750603d60f91b6001600160f81b0319821611155b155b80156110cc5750601760f91b6001600160f81b0319821614155b80156110e65750602d60f81b6001600160f81b0319821614155b156110f557505f949350505050565b50600101611021565b5060019392505050565b5f8061111385611315565b90506001600160a01b0384165f0361113a575f611130828561203b565b9250611205915050565b604051630b135d3f60e11b81525f906001600160a01b03861690631626ba7e9061116a9085908890600401613bd7565b602060405180830381865afa158015611185573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111a99190613bef565b9050630b135d3f60e11b6001600160e01b03198216146111ff5760405162461bcd60e51b8152602060048201526011602482015270494e56414c49445f5349474e415455524560781b6044820152606401610bb4565b84925050505b9392505050565b5f61124c8484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061210a92505050565b949350505050565b5f80516020613f2283398151915261126b81611dc7565b610bf08484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061211f92505050565b6112b333610b75565b6112cf5760405162461bcd60e51b8152600401610bb490613c0a565b610caf838383612172565b5f80516020613f228339815191526112f181611dc7565b5f6112fb83611529565b9050610caf8160405180602001604052805f81525061211f565b5f8061132083610de8565b90505f61132b6119cd565b60405161190160f01b602082015260228101919091526042810183905260620160408051601f198184030181529190528051602090910120949350505050565b5f80516020613f2283398151915261138281611dc7565b611398848488604051602001610ee59190613b66565b610f378787876121f3565b5f828152609760205260409020600101546113bd81611dc7565b610caf838361229b565b6001600160a01b03811633146114375760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bb4565b6114418282612320565b5050565b5f8061145088611529565b905061146d8188888860405180602001604052805f815250612386565b98975050505050505050565b5f807f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f835f01518051906020012084602001518051906020012085604001518660600151604051602001610e3e9594939291909485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b610caf83838360405180602001604052805f815250611bf1565b5f61151c81611dc7565b61012f610caf8382613a46565b5f8160405160200161153b9190613c57565b60408051601f19818403018152919052805160209091012092915050565b5f81815261013060205260409020805460609190611576906139ca565b80601f01602080910402602001604051908101604052809291908181526020018280546115a2906139ca565b80156115ed5780601f106115c4576101008083540402835291602001916115ed565b820191905f5260205f20905b8154815290600101906020018083116115d057829003601f168201915b50505050509050919050565b5f818152606760205260408120546001600160a01b031680610b305760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610bb4565b5f6001600160a01b0382166116c15760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610bb4565b506001600160a01b03165f9081526068602052604090205490565b5f80516020613f228339815191526116f381611dc7565b6116fc82611529565b60408051602080820183525f80835284815260fc909152919091205460ff1661173b57604051630a7c4d4f60e41b815260048101839052602401610bb4565b5f61174585611529565b60408051602080820183525f8083528481526101309091529190912091925061176e9082613a46565b5061177881612456565b5050505050565b5f80516020613f2283398151915261179681611dc7565b610bf08484846121f3565b5f807f6fc1526685fc1036c24f2e18f1865f7d0bc54ce2c94565ca1f45e94838d9acc6835f0151805190602001208460200151805190602001208560400151805190602001208660600151604051602001610e3e959493929190948552602085019390935260408401919091526060830152608082015260a00190565b5f54610100900460ff161580801561183c57505f54600160ff909116105b806118555750303b15801561185557505f5460ff166001145b6118b85760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610bb4565b5f805460ff1916600117905580156118d9575f805461ff0019166101001790555b6119216040518060400160405280600981526020016813985b59599a53919560ba1b81525060405180604001604052806005815260200164139193919560da1b8152506124e8565b611929612518565b6119335f3361229b565b61194a5f80516020613f228339815191523361229b565b60408051808201909152601581527468747470733a2f2f6d642e6e616d6566692e696f2f60581b602082015261012f906119849082613a46565b5080156119ca575f805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b60408051608081018252606080825260208083018281525f84860181815293850181815286518088018852600981526813985b59599a53919560ba1b81860152865286518088019097526006875265076312e322e360d41b9387019390935294905246909152309052611a3f81611479565b91505090565b5f6060805f805f60606040518060400160405280600981526020016813985b59599a53919560ba1b81525060405180604001604052806006815260200165076312e322e360d41b81525046305f801b5f6001600160401b03811115611aac57611aac612fcf565b604051908082528060200260200182016040528015611ad5578160200160208202803683370190505b50600f60f81b9d959c50939a509198509650945092509050565b5f80516020613f22833981519152611b0681611dc7565b611b25836801158e460913d0000087604051602001610ee59190613b66565b611b308686866121f3565b505050505050565b5f9182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606060668054610c05906139ca565b5f611b8d8787878760405180602001604052805f815250612386565b979650505050505050565b5f81815260c96020526040812054610b30565b611441338383612540565b5f80516020613f22833981519152611bcd81611dc7565b5f611bd783611529565b9050610caf8160405180602001604052805f81525061260d565b611bfb3383611dd1565b611c175760405162461bcd60e51b8152600401610bb490613c0a565b610bf084848484611e4d565b5f818152606760205260409020546060906001600160a01b0316611c5a57604051634257897d60e11b815260040160405180910390fd5b611c62612657565b5f83815261013060209081526040918290209151611c8293929101613c72565b6040516020818303038152906040529050919050565b5f82815260976020526040902060010154611cb281611dc7565b610caf8383612320565b5f80516020613f22833981519152611cd381611dc7565b610bf08484848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061260d92505050565b5f81815260c960205260408120544211610b30565b6060604051806060016040528060248152602001613f4260249139905090565b60408051602080820183525f9182905283825260fc90529081205460ff16610b30565b5f80516020613f22833981519152611d8181611dc7565b5f611d8b87611529565b9050610f02858589604051602001610ee59190613b66565b5f6001600160e01b03198216637965db0b60e01b1480610b305750610b3082612667565b6119ca81336126b6565b5f80611ddc836115f9565b9050806001600160a01b0316846001600160a01b03161480611e2257506001600160a01b038082165f908152606a602090815260408083209388168352929052205460ff165b8061124c5750836001600160a01b0316611e3b84610cb4565b6001600160a01b031614949350505050565b611e58848484612172565b611e648484848461270f565b610bf05760405162461bcd60e51b8152600401610bb490613cfc565b5f818152606760205260409020546001600160a01b03166119ca5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610bb4565b5f81815260696020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611f12826115f9565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610131546001600160a01b0316611f755760405163eadcfb6960e01b815260040160405180910390fd5b61013154604080516020810182525f80825291516318638d1360e01b815291926001600160a01b0316916318638d1391611fb99130918a918a918a91600401613d4e565b6020604051808303815f875af1158015611fd5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ff99190613d92565b90507f39bf027dd97f3bae0cf8cfb909695ec63313a9bd61ad52fc7f52cf565b141da8811461177857604051634d552b3160e01b815260040160405180910390fd5b5f805f808451604114612053575f9350505050610b30565b5050506020820151604083015160608401515f1a601b81101561207e5761207b601b82613da9565b90505b8060ff16601b1415801561209657508060ff16601c14155b156120a6575f9350505050610b30565b604080515f81526020810180835288905260ff831691810191909152606081018490526080810183905260019060a0016020604051602081039080840390855afa1580156120f6573d5f803e3d5ffd5b505050602060405103519350505050610b30565b505f90815260fc602052604090205460ff1690565b5f82815260fc602052604090819020805460ff191690555182907f398f375c8a361a482df2c189cdbc2e073d85754e7bd89e9f35b445a0e8e7a6b390612166908490613139565b60405180910390a25050565b60408051602080820183525f80835284815260fc909152919091205482919060ff16156121b55760405163427743a360e11b815260048101839052602401610bb4565b5f83815260c9602052604090205483904211156121e857604051631fdd101f60e31b815260048101829052602401610bb4565b611b3086868661280c565b5f80516020613f2283398151915261220a81611dc7565b61221383610f40565b612232578260405163daa2ee9560e01b8152600401610bb49190613139565b5f61223c84611529565b5f818152610130602052604090209091506122578582613a46565b504283116122815760405163e3ff4c6160e01b815260048101849052426024820152604401610bb4565b5f81815260c960205260409020839055611778858261296e565b6122a58282611b38565b611441575f8281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556122dc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61232a8282611b38565b15611441575f8281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b5f858152606760205260408120546001600160a01b03166123ba57604051634257897d60e11b815260040160405180910390fd5b6123c48587611dd1565b6123f3576040516365d09e0560e11b81526001600160a01b038616600482015260248101879052604401610bb4565b6123fe858585612987565b1561242a57507f6cfa6a566718927e650e1ba28377415cb87a1c925be906852b1f19537968876a61244d565b507f34fffe935a7dd0aac811292906d600561d350ed6f9d4af50dd939cf301ea90735b95945050505050565b5f612460826115f9565b905061246b826115f9565b5f83815260696020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526068845282852080545f190190558785526067909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b5f54610100900460ff1661250e5760405162461bcd60e51b8152600401610bb490613dc2565b61144182826129e5565b5f54610100900460ff1661253e5760405162461bcd60e51b8152600401610bb490613dc2565b565b816001600160a01b0316836001600160a01b0316036125a15760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610bb4565b6001600160a01b038381165f818152606a6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b5f82815260fc602052604090819020805460ff191660011790555182907ff892f27a9970007d6d89caa648ee3c2718d347ebfb7a6c21773c66aaf66673c290612166908490613139565b606061012f8054610c05906139ca565b5f6001600160e01b031982166380ac58cd60e01b148061269757506001600160e01b03198216635b5e139f60e01b145b80610b3057506301ffc9a760e01b6001600160e01b0319831614610b30565b6126c08282611b38565b611441576126cd81612a24565b6126d8836020612a36565b6040516020016126e9929190613e0d565b60408051601f198184030181529082905262461bcd60e51b8252610bb491600401613139565b5f6001600160a01b0384163b1561280157604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290612752903390899088908890600401613e81565b6020604051808303815f875af192505050801561278c575060408051601f3d908101601f1916820190925261278991810190613bef565b60015b6127e7573d8080156127b9576040519150601f19603f3d011682016040523d82523d5f602084013e6127be565b606091505b5080515f036127df5760405162461bcd60e51b8152600401610bb490613cfc565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061124c565b506001949350505050565b826001600160a01b031661281f826115f9565b6001600160a01b0316146128455760405162461bcd60e51b8152600401610bb490613eb3565b6001600160a01b0382166128a75760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610bb4565b826001600160a01b03166128ba826115f9565b6001600160a01b0316146128e05760405162461bcd60e51b8152600401610bb490613eb3565b5f81815260696020908152604080832080546001600160a01b03199081169091556001600160a01b038781168086526068855283862080545f1901905590871680865283862080546001019055868652606790945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b611441828260405180602001604052805f815250612bcb565b5f805f6129948585612bfd565b90925090505f8160048111156129ac576129ac613ef8565b1480156129ca5750856001600160a01b0316826001600160a01b0316145b806129db57506129db868686612c3f565b9695505050505050565b5f54610100900460ff16612a0b5760405162461bcd60e51b8152600401610bb490613dc2565b6065612a178382613a46565b506066610caf8282613a46565b6060610b306001600160a01b03831660145b60605f612a44836002613b4f565b612a4f906002613b9d565b6001600160401b03811115612a6657612a66612fcf565b6040519080825280601f01601f191660200182016040528015612a90576020820181803683370190505b509050600360fc1b815f81518110612aaa57612aaa613bc3565b60200101906001600160f81b03191690815f1a905350600f60fb1b81600181518110612ad857612ad8613bc3565b60200101906001600160f81b03191690815f1a9053505f612afa846002613b4f565b612b05906001613b9d565b90505b6001811115612b7c576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612b3957612b39613bc3565b1a60f81b828281518110612b4f57612b4f613bc3565b60200101906001600160f81b03191690815f1a90535060049490941c93612b7581613f0c565b9050612b08565b5083156112055760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bb4565b612bd58383612d26565b612be15f84848461270f565b610caf5760405162461bcd60e51b8152600401610bb490613cfc565b5f808251604103612c31576020830151604084015160608501515f1a612c2587828585612eae565b94509450505050612c38565b505f905060025b9250929050565b5f805f856001600160a01b0316631626ba7e60e01b8686604051602401612c67929190613bd7565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051612ca59190613c57565b5f60405180830381855afa9150503d805f8114612cdd576040519150601f19603f3d011682016040523d82523d5f602084013e612ce2565b606091505b5091509150818015612cf657506020815110155b80156129db57508051630b135d3f60e11b90612d1b9083016020908101908401613d92565b149695505050505050565b6001600160a01b038216612d7c5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610bb4565b5f818152606760205260409020546001600160a01b031615612de05760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610bb4565b5f818152606760205260409020546001600160a01b031615612e445760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610bb4565b6001600160a01b0382165f81815260686020908152604080832080546001019055848352606790915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b5f807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115612ee357505f90506003612f62565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612f34573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116612f5c575f60019250925050612f62565b91505f90505b94509492505050565b6001600160e01b0319811681146119ca575f80fd5b5f60208284031215612f90575f80fd5b813561120581612f6b565b80356001600160a01b0381168114612fb1575f80fd5b919050565b5f60208284031215612fc6575f80fd5b61120582612f9b565b634e487b7160e01b5f52604160045260245ffd5b604051608081016001600160401b038111828210171561300557613005612fcf565b60405290565b5f82601f83011261301a575f80fd5b81356001600160401b038082111561303457613034612fcf565b604051601f8301601f19908116603f0116810190828211818310171561305c5761305c612fcf565b81604052838152866020858801011115613074575f80fd5b836020870160208301375f602085830101528094505050505092915050565b5f805f606084860312156130a5575f80fd5b6130ae84612f9b565b92506130bc60208501612f9b565b915060408401356001600160401b038111156130d6575f80fd5b6130e28682870161300b565b9150509250925092565b5f5b838110156131065781810151838201526020016130ee565b50505f910152565b5f81518084526131258160208601602086016130ec565b601f01601f19169290920160200192915050565b602081525f611205602083018461310e565b5f806040838503121561315c575f80fd5b50508035926020909101359150565b5f6020828403121561317b575f80fd5b5035919050565b5f8060408385031215613193575f80fd5b61319c83612f9b565b946020939093013593505050565b5f608082840312156131ba575f80fd5b6131c2612fe3565b905081356001600160401b03808211156131da575f80fd5b6131e68583860161300b565b835260208401359150808211156131fb575f80fd5b6132078583860161300b565b6020840152604084013591508082111561321f575f80fd5b5061322c8482850161300b565b6040830152506060820135606082015292915050565b5f60408284031215613252575f80fd5b604051604081016001600160401b03828210818311171561327557613275612fcf565b81604052829350843591508082111561328c575f80fd5b6132988683870161300b565b835260208501359150808211156132ad575f80fd5b506132ba858286016131aa565b6020830152505092915050565b5f602082840312156132d7575f80fd5b81356001600160401b038111156132ec575f80fd5b61124c84828501613242565b5f805f806080858703121561330b575f80fd5b84356001600160401b0380821115613321575f80fd5b61332d8883890161300b565b95506020870135945061334260408801612f9b565b93506060870135915080821115613357575f80fd5b506133648782880161300b565b91505092959194509250565b5f60208284031215613380575f80fd5b81356001600160401b03811115613395575f80fd5b61124c8482850161300b565b5f805f606084860312156133b3575f80fd5b83356001600160401b03808211156133c9575f80fd5b6133d587838801613242565b94506133e360208701612f9b565b935060408601359150808211156133f8575f80fd5b506130e28682870161300b565b5f8083601f840112613415575f80fd5b5081356001600160401b0381111561342b575f80fd5b602083019150836020828501011115612c38575f80fd5b5f805f60408486031215613454575f80fd5b8335925060208401356001600160401b03811115613470575f80fd5b61347c86828701613405565b9497909650939450505050565b5f805f6060848603121561349b575f80fd5b6134a484612f9b565b92506134b260208501612f9b565b9150604084013590509250925092565b5f805f805f8060c087890312156134d7575f80fd5b6134e087612f9b565b955060208701356001600160401b03808211156134fb575f80fd5b6135078a838b0161300b565b96506040890135955061351c60608a01612f9b565b94506080890135935060a0890135915080821115613538575f80fd5b5061354589828a0161300b565b9150509295509295509295565b5f8060408385031215613563575f80fd5b8235915061357360208401612f9b565b90509250929050565b5f805f805f8060a08789031215613591575f80fd5b86356001600160401b03808211156135a7575f80fd5b6135b38a838b0161300b565b97506135c160208a01612f9b565b96506040890135955060608901359150808211156135dd575f80fd5b6135e98a838b0161300b565b945060808901359150808211156135fe575f80fd5b5061360b89828a01613405565b979a9699509497509295939492505050565b5f6020828403121561362d575f80fd5b81356001600160401b0380821115613643575f80fd5b9083019060808286031215613656575f80fd5b61365e612fe3565b82358281111561366c575f80fd5b6136788782860161300b565b82525060208301358281111561368c575f80fd5b6136988782860161300b565b602083015250604083013560408201526136b460608401612f9b565b606082015295945050505050565b5f805f606084860312156136d4575f80fd5b6136dd84612f9b565b925060208401356001600160401b038111156136f7575f80fd5b6137038682870161300b565b925050604084013590509250925092565b5f60208284031215613724575f80fd5b81356001600160401b03811115613739575f80fd5b61124c848285016131aa565b60ff60f81b881681525f602060e0602084015261376560e084018a61310e565b8381036040850152613777818a61310e565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b818110156137ca578351835292840192918401916001016137ae565b50909c9b505050505050505050505050565b5f805f805f60a086880312156137f0575f80fd5b6137f986612f9b565b945060208601356001600160401b0380821115613814575f80fd5b61382089838a0161300b565b95506040880135945061383560608901612f9b565b9350608088013591508082111561384a575f80fd5b506138578882890161300b565b9150509295509295909350565b5f805f805f8060a08789031215613879575f80fd5b8635955061388960208801612f9b565b94506040870135935060608701356001600160401b03808211156135dd575f80fd5b5f80604083850312156138bc575f80fd5b6138c583612f9b565b9150602083013580151581146138d9575f80fd5b809150509250929050565b5f805f80608085870312156138f7575f80fd5b61390085612f9b565b935061390e60208601612f9b565b92506040850135915060608501356001600160401b0381111561392f575f80fd5b6133648782880161300b565b5f806040838503121561394c575f80fd5b61395583612f9b565b915061357360208401612f9b565b5f805f805f60a08688031215613977575f80fd5b85356001600160401b038082111561398d575f80fd5b61399989838a0161300b565b9650602088013595506139ae60408901612f9b565b945060608801359350608088013591508082111561384a575f80fd5b600181811c908216806139de57607f821691505b6020821081036139fc57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f821115610caf57805f5260205f20601f840160051c81016020851015613a275750805b601f840160051c820191505b81811015611778575f8155600101613a33565b81516001600160401b03811115613a5f57613a5f612fcf565b613a7381613a6d84546139ca565b84613a02565b602080601f831160018114613aa6575f8415613a8f5750858301515b5f19600386901b1c1916600185901b178555611b30565b5f85815260208120601f198616915b82811015613ad457888601518255948401946001909101908401613ab5565b5085821015613af157878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601260045260245ffd5b5f82613b2357613b23613b01565b500690565b634e487b7160e01b5f52601160045260245ffd5b5f82613b4a57613b4a613b01565b500490565b8082028115828204841417610b3057610b30613b28565b6f02730b6b2b334a7232a1d1036b4b73a160851b81525f8251613b908160108501602087016130ec565b9190910160100192915050565b80820180821115610b3057610b30613b28565b81810381811115610b3057610b30613b28565b634e487b7160e01b5f52603260045260245ffd5b828152604060208201525f61124c604083018461310e565b5f60208284031215613bff575f80fd5b815161120581612f6b565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b5f8251613c688184602087016130ec565b9190910192915050565b5f83516020613c858285602089016130ec565b81840191505f8554613c96816139ca565b60018281168015613cae5760018114613cc357613ced565b60ff1984168752821515830287019450613ced565b895f5260205f205f5b84811015613ce557815489820152908301908701613ccc565b505082870194505b50929998505050505050505050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6001600160a01b038681168252851660208201526040810184905260a0606082018190525f90613d809083018561310e565b828103608084015261146d818561310e565b5f60208284031215613da2575f80fd5b5051919050565b60ff8181168382160190811115610b3057610b30613b28565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081525f8351613e448160178501602088016130ec565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613e758160288401602088016130ec565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f906129db9083018461310e565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b634e487b7160e01b5f52602160045260245ffd5b5f81613f1a57613f1a613b28565b505f19019056fef0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc968747470733a2f2f6d642e6e616d6566692e696f2f6e616d6566692d6e66742e6a736f6ea26469706673582212205f5917d518ae700b45c36ac752a8f93bc51f5c6c74720e15bdb57633c8a083fe64736f6c63430008180033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.