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
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
CitiCharacter
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "./base/BaseCitiNFT.sol"; contract CitiCharacter is BaseCitiNFT { /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} function initialize(NFTContractInitializer memory _initializer) initializer public { __BaseCitiNFT_init("CitiCharacter", "CTC", _initializer); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721RoyaltyUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/IERC721MetadataUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; import "./BaseToken.sol"; import "../../contracts-generated/Versioned.sol"; import "../Validator.sol"; import "./Utils.sol"; /** * @dev Parameters required to initialize the NFT contract */ struct NFTContractInitializer { // `adminAddress` receives {DEFAULT_ADMIN_ROLE} and {PAUSER_ROLE}, assumes msg.sender if not specified. address adminAddress; // Dummy owner of the contract (optional) address dummyOwner; // Reference of the token contract (optional) BaseToken tokenContract; // Reference of the validator contract (optional) Validator validatorContract; // Contract level metadata, see https://docs.opensea.io/docs/contract-level-metadata string contractURI; // Default base token URI string baseTokenURI; // Default royalty recipient (optional) address royaltyRecipient; // Default royalty fraction (optional) uint96 royaltyFraction; } /** * @dev Implementation of upgradable NFT contract based on the OpenZeppelin templates. */ contract BaseCitiNFT is ERC721PausableUpgradeable, ERC721BurnableUpgradeable, ERC721RoyaltyUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, Versioned { /// @custom:oz-renamed-from __gap uint256[950] private _gap_; using CountersUpgradeable for CountersUpgradeable.Counter; using StringsUpgradeable for uint256; bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); // Counter for tokenId generation CountersUpgradeable.Counter private _tokenIdCounter; // Reference of a ERC20 token contract BaseToken internal _token; // Mapping from tokenId to nonce mapping(uint256 => uint256) private _tokenNonces; // Mapping from hash to nonce mapping(bytes32 => uint256) private _hashNonces; // Dummy owner address used for claiming contract ownership at Opensea // Should NOT be used for any business logic in the contract address private _dummyOwner; // Contract URI, see https://docs.opensea.io/docs/contract-level-metadata string private _contractURI; // Base URI for used token URI calculation string internal _baseTokenURI; // Reference to the validator contract Validator private _validator; /** * @dev Emitted when `tokenId` token's URI is changed from `oldURI` to `newURI`. */ event TokenURIUpdated(uint256 indexed tokenId, string oldURI, string newURI); /** * @dev Emitted when the ERC20 token contract ref is changed from `oldContract` to `newContract`. */ event TokenContractUpdated(BaseToken indexed oldContract, BaseToken indexed newContract); /** * @dev Emitted when the validator contract ref is changed from `oldContract` to `newContract`. */ event ValidatorContractUpdated(Validator indexed oldContract, Validator indexed newContract); /** * @dev Emitted when `tokenId` token's nonce is changed from `oldNonce` to `newNonce`. */ event TokenNonceUpdated(uint256 indexed tokenId, uint256 oldNonce, uint256 newNonce); /** * @dev Emitted when `tokenId` token is upgraded by using `tokenNonce`, `details`, which is validated by `validatorContract`. */ event TokenUpgradedWithDetails(uint256 indexed tokenId, uint256 tokenNonce, string details, Validator validatorContract); /** * @dev Emitted when `tokenId` token is minted to `to`. The function is called by `from` with `details`, validated by `validatorContract`. */ event TokenMintedWithDetails(uint256 indexed tokenId, address indexed to, address indexed from, string details, Validator validatorContract); /** * @dev Emitted when the dummy owner is changed from `previousOwner` to `newOwner`. */ event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Emitted when the contract URI is changed from `oldURI` to `newURI`. */ event ContractURIUpdated(string oldURI, string newURI); /** * @dev Emitted when the base token URI is changed from `oldURI` to `newURI`. */ event BaseTokenURIUpdated(string oldURI, string newURI); /** * @dev Emitted when the default royalty info is updated */ event DefaultRoyaltyInfoUpdated(address indexed recipient, uint96 royaltyFraction); /** * @dev Initializes the NFT contract from `_initializer` */ function __BaseCitiNFT_init(string memory tokenName, string memory tokenSymbol, NFTContractInitializer memory _initializer) internal onlyInitializing { require(Utils.isKnownNetwork(), "unknown network"); __ERC721_init(tokenName, tokenSymbol); __ERC721Pausable_init(); __ERC721Burnable_init(); __ERC721Royalty_init(); __AccessControl_init(); __ReentrancyGuard_init(); address admin = _initializer.adminAddress; if (admin == address(0)) { admin = _msgSender(); } _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(PAUSER_ROLE, admin); _token = _initializer.tokenContract; _dummyOwner = _initializer.dummyOwner; _validator = _initializer.validatorContract; _contractURI = _initializer.contractURI; _baseTokenURI = _initializer.baseTokenURI; if (_initializer.royaltyRecipient != address(0)) { _setDefaultRoyalty(_initializer.royaltyRecipient, _initializer.royaltyFraction); } } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); if (bytes(_baseTokenURI).length > 0) { // returns <base-uri>/<chain-id>/<contract-address>/<token-id>.json // note that _baseTokenURI is expected to end with "/" return string(abi.encodePacked( _baseTokenURI, Utils.chainID().toString(), "/", Utils.addressToHexString(address(this)), "/", tokenId.toString(), ".json" )); } else { return ""; } } /** * @dev See {ERC721Upgradeable} */ function _baseURI() internal virtual view override(ERC721Upgradeable) returns (string memory) { return _baseTokenURI; } /** * @dev See {ERC721Upgradeable}, {ERC721RoyaltyUpgradeable} */ function _burn(uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721RoyaltyUpgradeable) { ERC721RoyaltyUpgradeable._burn(tokenId); } /** * @dev Pause the contract, requires `PAUSER_ROLE` */ function pause() public onlyRole(PAUSER_ROLE) { _pause(); } /** * @dev Unpause the contract, requires `PAUSER_ROLE` */ function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } /** * @dev Mints a token to `to`, requires `MINTER_ROLE` * * Returns the minted tokenId. */ function safeMint(address to) public virtual onlyRole(MINTER_ROLE) returns (uint256) { return _doSafeMint(to); } /** * @dev See {ERC721PausableUpgradeable} */ function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721PausableUpgradeable) { ERC721PausableUpgradeable._beforeTokenTransfer(from, to, tokenId); } /** * @dev See {ERC721Upgradeable}, {AccessControlUpgradeable} */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC721RoyaltyUpgradeable, AccessControlUpgradeable) returns (bool) { // No need to implement anything from IERC721MetadataUpgradeable return interfaceId == type(IERC721MetadataUpgradeable).interfaceId || ERC721Upgradeable.supportsInterface(interfaceId) || ERC721RoyaltyUpgradeable.supportsInterface(interfaceId) || AccessControlUpgradeable.supportsInterface(interfaceId); } /** * @dev Internal utility function implementing the safe mint logic. */ function _doSafeMint(address to) internal returns (uint256) { uint256 tokenId = _tokenIdCounter.current(); _tokenIdCounter.increment(); _safeMint(to, tokenId); return tokenId; } /** * @dev Returns the ERC20 token contract ref. */ function tokenContract() public view returns (BaseToken) { return _token; } /** * @dev Admin function sets the default royalty info, see {ERC2981Upgradeable} * * Emits {DefaultRoyaltyInfoUpdated} */ function adminSetDefaultRoyaltyInfo(address recipient, uint96 royaltyFraction) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { _setDefaultRoyalty(recipient, royaltyFraction); emit DefaultRoyaltyInfoUpdated(recipient, royaltyFraction); } /** * @dev Admin function sets the ERC20 token contract ref, requires `DEFAULT_ADMIN_ROLE` */ function adminSetTokenContract(BaseToken token) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { require(token != BaseToken(address(0)), "invalid token contract"); BaseToken oldTokenContract = _token; _token = token; emit TokenContractUpdated(oldTokenContract, token); } /** * @dev Admin function sets the validator contract ref, requires `DEFAULT_ADMIN_ROLE` */ function adminSetValidatorContract(Validator validator) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { require(validator != Validator(address(0)), "invalid validator contract"); Validator oldContract = _validator; _validator = validator; emit ValidatorContractUpdated(oldContract, validator); } /** * @dev Returns the validator contract ref. */ function validatorContract() public view returns (Validator) { return _validator; } /** * @dev Returns the next nonce for `tokenId` */ function getTokenNonce(uint256 tokenId) public view returns (uint256) { return _tokenNonces[tokenId]; } /** * @dev Upgrades the `tokenId` token with info specified by `details`. * `tokenNonce`: the token nonce from which the signature is generated. * `numTokensToBurn`: how many tokens to burn from the caller in order to finish the upgrade. * `signature`: signature generated by the offchain validator service in order to verify * (tokenId, details, sender, tokenNonce, numTokensToBurn) with the validator contract. * * Emits {TokenNonceUpdated} and {TokenUpgradedWithDetails} */ function upgradeWithDetails(uint256 tokenId, string calldata details, uint256 tokenNonce, uint256 numTokensToBurn, bytes memory signature) external nonReentrant whenNotPaused whenHasValidator { address sender = _msgSender(); require(tokenNonce == _tokenNonces[tokenId], "invalid nonce"); require(_isApprovedOrOwner(sender, tokenId), "not owner nor approved"); // Don't use encodePacked to avoid hash collision bytes32 messageHash = keccak256(abi.encode( Utils.chainID(), address(this), tokenId, details, sender, tokenNonce, numTokensToBurn )); bool verified = _validator.verifySignature(abi.encodePacked(messageHash), signature); require(verified, "invalid signature"); _tokenNonces[tokenId] = tokenNonce + 1; if (numTokensToBurn > 0) { require(_token != BaseToken(address(0)), "invalid token contract"); _token.burnFrom(sender, numTokensToBurn); } emit TokenNonceUpdated(tokenId, tokenNonce, tokenNonce + 1); emit TokenUpgradedWithDetails(tokenId, tokenNonce, details, _validator); } /** * @dev Mints a token for `to` with info specified by `details`. * `numTokensToBurn`: how many tokens to burn from the caller in order to finish the mint. * `signature`: signature generated by the offchain validator service in order to verify * (to, details, sender, numTokensToBurn) with the validator contract. * * Emits {TokenMintedWithDetails} and {Transfer} */ function mintWithDetails(address to, string calldata details, uint256 numTokensToBurn, bytes memory signature) external nonReentrant whenNotPaused whenHasValidator returns (uint256) { address sender = _msgSender(); // Don't use encodePacked to avoid hash collision bytes32 messageHash = keccak256(abi.encode( Utils.chainID(), address(this), to, details, sender, numTokensToBurn )); require(_hashNonces[messageHash] == 0, "hash already used"); bool verified = _validator.verifySignature(abi.encodePacked(messageHash), signature); require(verified, "invalid signature"); _hashNonces[messageHash] = 1; if (numTokensToBurn > 0) { require(_token != BaseToken(address(0)), "invalid token contract"); _token.burnFrom(sender, numTokensToBurn); } uint256 tokenId = _doSafeMint(to); emit TokenMintedWithDetails(tokenId, to, sender, details, _validator); return tokenId; } /** * @dev Returns the current tokenId counter. */ function currentTokenIdCounter() public view returns (uint256) { return _tokenIdCounter.current(); } /** * @dev Returns the dummy contract owner, used by Opensea. */ function owner() public view returns (address) { return _dummyOwner; } /** * @dev Admin function to set the dummy owner, requires `DEFAULT_ADMIN_ROLE`. * * Emits {OwnershipTransferred} */ function adminSetDummyOwner(address dummyOwner) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { require(dummyOwner != address(0), "invalid owner"); address oldOwner = _dummyOwner; _dummyOwner = dummyOwner; emit OwnershipTransferred(oldOwner, dummyOwner); } /** * @dev Returns the contract URI, used by Opensea. */ function contractURI() public view returns (string memory) { return _contractURI; } /** * @dev Admin function to set the dummy owner, requires `DEFAULT_ADMIN_ROLE`. * * Emits {ContractURIUpdated} */ function adminSetContractURI(string calldata newContractURI) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { string memory oldURI = _contractURI; _contractURI = newContractURI; emit ContractURIUpdated(oldURI, newContractURI); } /** * @dev Returns the base token URI. */ function baseTokenURI() public view returns (string memory) { return _baseTokenURI; } /** * @dev Admin function to set the base token URI, requires `DEFAULT_ADMIN_ROLE`. * * Emits {BaseTokenURIUpdated} */ function adminSetBaseTokenURI(string calldata newBaseTokenURI) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { string memory oldURI = _baseTokenURI; _baseTokenURI = newBaseTokenURI; emit BaseTokenURIUpdated(oldURI, newBaseTokenURI); } /** * @dev Modifier requiring a valid validator contract ref. */ modifier whenHasValidator() { require(_validator != Validator(address(0)), "invalid validator contract"); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../../security/PausableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev ERC721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC721PausableUpgradeable is Initializable, ERC721Upgradeable, PausableUpgradeable { function __ERC721Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __ERC721Pausable_init_unchained() internal onlyInitializing { } /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be burned (destroyed). */ abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable { function __ERC721Burnable_init() internal onlyInitializing { } function __ERC721Burnable_init_unchained() internal onlyInitializing { } /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _burn(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: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/ERC721Royalty.sol) pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../common/ERC2981Upgradeable.sol"; import "../../../utils/introspection/ERC165Upgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of ERC721 with the ERC2981 NFT Royalty Standard, a standardized way to retrieve royalty payment * information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC721RoyaltyUpgradeable is Initializable, ERC2981Upgradeable, ERC721Upgradeable { function __ERC721Royalty_init() internal onlyInitializing { } function __ERC721Royalty_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC2981Upgradeable) returns (bool) { return super.supportsInterface(interfaceId); } /** * @dev See {ERC721-_burn}. This override additionally clears the royalty information for the token. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); _resetTokenRoyalty(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: 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.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_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 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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: * * ``` * 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}: * * ``` * 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. */ 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(uint160(account), 20), " 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 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library CountersUpgradeable { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_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); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./Utils.sol"; import "../../contracts-generated/Versioned.sol"; /** * @dev Implementation of upgradable ERC20 contract based on the OpenZeppelin templates. */ contract BaseToken is ERC20PausableUpgradeable, ERC20BurnableUpgradeable, AccessControlUpgradeable, ReentrancyGuardUpgradeable, Versioned { /// @custom:oz-renamed-from __gap uint256[950] private _gap_; bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE"); /** * @dev Initializes the `name` and `symbol` of the contract. * `admin` receives {DEFAULT_ADMIN_ROLE} and {PAUSER_ROLE}, assumes msg.sender if not specified. */ function __BaseToken_init(string memory tokenName, string memory tokenSymbol, address admin) internal onlyInitializing { require(Utils.isKnownNetwork(), "unknown network"); __ERC20_init(tokenName, tokenSymbol); __ERC20Pausable_init(); __ERC20Burnable_init(); __AccessControl_init(); __ReentrancyGuard_init(); if (admin == address(0)) { admin = _msgSender(); } _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(PAUSER_ROLE, admin); } /** * @dev Pause the contract, requires `PAUSER_ROLE` */ function pause() public onlyRole(PAUSER_ROLE) { _pause(); } /** * @dev Unpause the contract, requires `PAUSER_ROLE` */ function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } /** * @dev Mints `amount` tokens to `to`, requires `MINTER_ROLE` */ function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { _mint(to, amount); } /** * @dev See {ERC20Upgradeable}, {ERC20PausableUpgradeable} */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal override(ERC20Upgradeable, ERC20PausableUpgradeable) { ERC20PausableUpgradeable._beforeTokenTransfer(from, to, amount); } /** * @dev See {ERC20BurnableUpgradeable} * Skips the allowance check if the caller has `BURNER_ROLE` */ function burnFrom(address account, uint256 amount) public virtual override(ERC20BurnableUpgradeable) { // skip allowance check if the caller has BURNER_ROLE if (hasRole(BURNER_ROLE, _msgSender())) { _burn(account, amount); return; } ERC20BurnableUpgradeable.burnFrom(account, amount); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; contract Versioned { string public constant version = "0xf4130cbb6129689ec5b32db1d4a1761a479c9166"; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol"; import "../contracts-generated/Versioned.sol"; import "./base/Utils.sol"; /** * @dev Implementation of a multi-addresses validator contract */ contract Validator is PausableUpgradeable, AccessControlUpgradeable, Versioned { /// @custom:oz-renamed-from __gap uint256[1000] private _gap_; bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); // Mapping from address to enabled flag for all the validators mapping(address => bool) private _validators; // Number of enabled validators uint256 private _numValidators; // Validation threshold uint256 private _validationThreshold; /** * @dev Emitted when `validator` is added */ event ValidatorAdded(address validator); /** * @dev Emitted when `validator` is removed */ event ValidatorRemoved(address validator); /** * @dev Emitted when the validation threshold is changed from `oldThreshold` to `newThreshold` */ event ThresholdUpdated(uint256 oldThreshold, uint256 newThreshold); /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} /** * @dev Initialize the contract * `admin` receives {DEFAULT_ADMIN_ROLE} and {PAUSER_ROLE}, assumes msg.sender if not specified. */ function initialize(address admin) initializer public { require(Utils.isKnownNetwork(), "unknown network"); __Pausable_init(); __AccessControl_init(); if (admin == address(0)) { admin = _msgSender(); } _grantRole(DEFAULT_ADMIN_ROLE, admin); _grantRole(PAUSER_ROLE, admin); _validationThreshold = type(uint256).max; } /** * @dev Pause the contract, requires `PAUSER_ROLE` */ function pause() public onlyRole(PAUSER_ROLE) { _pause(); } /** * @dev Unpause the contract, requires `PAUSER_ROLE` */ function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } /** * @dev Return if `account` is a validator */ function isValidator(address account) public view returns (bool) { return _validators[account]; } /** * @dev Return the number of validators */ function numValidators() public view returns (uint256) { return _numValidators; } /** * @dev Return the validation threshold */ function threshold() public view returns (uint256) { return _validationThreshold; } /** * @dev Admin function to update the validation threshold, requires `DEFAULT_ADMIN_ROLE` * Emits {ThresholdUpdated} */ function adminSetThreshold(uint256 newThreshold) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { require(newThreshold <= _numValidators, "not enough validators"); uint256 old = _validationThreshold; _validationThreshold = newThreshold; emit ThresholdUpdated(old, newThreshold); } /** * @dev Admin function to add `account` as validator, requires `DEFAULT_ADMIN_ROLE` * Emits {ValidatorAdded} */ function adminAddValidator(address account) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { require(account != address(0x0), "bad address"); require(!isValidator(account), "already is"); _validators[account] = true; _numValidators += 1; emit ValidatorAdded(account); } /** * @dev Admin function to remove `account` as validator, requires `DEFAULT_ADMIN_ROLE` * Emits {ValidatorAdded} */ function adminRemoveValidator(address account) public onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused { require(isValidator(account), "not a validator"); require(_numValidators - 1 >= _validationThreshold, "not enough validators"); _validators[account] = false; _numValidators -= 1; emit ValidatorRemoved(account); } /** * @dev Helper function to split `signature` at `offset` into r, s, v components */ function _splitSignature(bytes memory signature, uint256 signatureIndex) internal pure returns (bytes32 r, bytes32 s, uint8 v) { // first 32 bytes is the length of "signature" uint256 offset = 32 + signatureIndex * 65; assembly { r := mload(add(signature, offset)) s := mload(add(add(signature, offset), 32)) v := byte(0, mload(add(add(signature, offset), 64))) } } /** * @dev Verify if `message` is signed by enough validators whose signatures are in `signature` * The length of the signature is expected to be number of validators * 65 */ function verifySignature(bytes memory message, bytes memory signature) public view whenNotPaused returns (bool) { require(_numValidators > 0, "no validator"); bytes32 messageHash = ECDSAUpgradeable.toEthSignedMessageHash(message); uint256 numVerifications = 0; uint256 numSignatures = signature.length / 65; address[] memory usedValidators = new address[](numSignatures); for (uint256 index = 0; index < numSignatures; index++) { (bytes32 r, bytes32 s, uint8 v) = _splitSignature(signature, index); address recovered = ecrecover(messageHash, v, r, s); if (_validators[recovered]) { // check for duplicated validators bool duplicated = false; for (uint256 index2 = 0; index2 < usedValidators.length; index2++) { if (usedValidators[index2] == recovered) { duplicated = true; break; } } if (!duplicated) { numVerifications += 1; usedValidators[index] = recovered; } } } return numVerifications >= _validationThreshold; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.13; import "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol"; library Utils { // See https://chainlist.org/ uint256 private constant Ethereum = 1; uint256 private constant Ropsten = 3; uint256 private constant Rinkeby = 4; uint256 private constant Goerli = 5; uint256 private constant Kovan = 42; uint256 private constant Optimism = 10; uint256 private constant Optimism_Kovan = 69; uint256 private constant Optimism_Goerli = 420; uint256 private constant Arbitrum = 42161; uint256 private constant Arbitrum_Nova = 42170; uint256 private constant Arbitrum_Rinkeby = 421611; uint256 private constant Arbitrum_Goerli = 421613; uint256 private constant Hardhat = 31337; uint256 private constant Kiln = 1337802; uint256 private constant Sepolia = 11155111; /** * @dev Returns the chainID of the network. */ function chainID() internal view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } /** * @dev Returns if the current network is known. */ function isKnownNetwork() internal view returns (bool) { uint256 chainid = chainID(); return chainid == Ethereum || chainid == Ropsten || chainid == Rinkeby || chainid == Goerli || chainid == Kovan || chainid == Optimism || chainid == Optimism_Kovan || chainid == Optimism_Goerli || chainid == Arbitrum || chainid == Arbitrum_Nova || chainid == Arbitrum_Rinkeby || chainid == Arbitrum_Goerli || chainid == Kiln || chainid == Sepolia || chainid == Hardhat; } /** * @dev Returns if the current network is considered mainnet. */ function isMainnet() internal view returns (bool) { uint256 chainid = chainID(); return chainid == Ethereum || chainid == Optimism || chainid == Arbitrum || chainid == Arbitrum_Nova; } /** * @dev Convers the address to the hex string format. */ function addressToHexString(address account) internal pure returns (string memory) { return StringsUpgradeable.toHexString(uint256(uint160(account))); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 = _owners[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 nor 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 nor 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 nor 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 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 _owners[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); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721Upgradeable.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @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); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @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. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[44] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // 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.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 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.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981Upgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981Upgradeable is Initializable, IERC2981Upgradeable, ERC165Upgradeable { function __ERC2981_init() internal onlyInitializing { } function __ERC2981_init_unchained() internal onlyInitializing { } struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165Upgradeable, ERC165Upgradeable) returns (bool) { return interfaceId == type(IERC2981Upgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981Upgradeable */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[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[48] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981Upgradeable is IERC165Upgradeable { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// 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 (token/ERC20/extensions/ERC20Pausable.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../security/PausableUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20PausableUpgradeable is Initializable, ERC20Upgradeable, PausableUpgradeable { function __ERC20Pausable_init() internal onlyInitializing { __Pausable_init_unchained(); } function __ERC20Pausable_init_unchained() internal onlyInitializing { } /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } /** * @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.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20Upgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20BurnableUpgradeable is Initializable, ContextUpgradeable, ERC20Upgradeable { function __ERC20Burnable_init() internal onlyInitializing { } function __ERC20Burnable_init_unchained() internal onlyInitializing { } /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(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[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20Upgradeable.sol"; import "./extensions/IERC20MetadataUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing { __ERC20_init_unchained(name_, symbol_); } function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[45] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20MetadataUpgradeable is IERC20Upgradeable { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (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 } 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"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // 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) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @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) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
{ "optimizer": { "enabled": true, "runs": 100 }, "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"},{"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":[{"indexed":false,"internalType":"string","name":"oldURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"BaseTokenURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"oldURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint96","name":"royaltyFraction","type":"uint96"}],"name":"DefaultRoyaltyInfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","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":"contract BaseToken","name":"oldContract","type":"address"},{"indexed":true,"internalType":"contract BaseToken","name":"newContract","type":"address"}],"name":"TokenContractUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"string","name":"details","type":"string"},{"indexed":false,"internalType":"contract Validator","name":"validatorContract","type":"address"}],"name":"TokenMintedWithDetails","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"oldNonce","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newNonce","type":"uint256"}],"name":"TokenNonceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"oldURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"TokenURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenNonce","type":"uint256"},{"indexed":false,"internalType":"string","name":"details","type":"string"},{"indexed":false,"internalType":"contract Validator","name":"validatorContract","type":"address"}],"name":"TokenUpgradedWithDetails","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract Validator","name":"oldContract","type":"address"},{"indexed":true,"internalType":"contract Validator","name":"newContract","type":"address"}],"name":"ValidatorContractUpdated","type":"event"},{"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":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseTokenURI","type":"string"}],"name":"adminSetBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newContractURI","type":"string"}],"name":"adminSetContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint96","name":"royaltyFraction","type":"uint96"}],"name":"adminSetDefaultRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dummyOwner","type":"address"}],"name":"adminSetDummyOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract BaseToken","name":"token","type":"address"}],"name":"adminSetTokenContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract Validator","name":"validator","type":"address"}],"name":"adminSetValidatorContract","outputs":[],"stateMutability":"nonpayable","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":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentTokenIdCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"getTokenNonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"components":[{"internalType":"address","name":"adminAddress","type":"address"},{"internalType":"address","name":"dummyOwner","type":"address"},{"internalType":"contract BaseToken","name":"tokenContract","type":"address"},{"internalType":"contract Validator","name":"validatorContract","type":"address"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"string","name":"baseTokenURI","type":"string"},{"internalType":"address","name":"royaltyRecipient","type":"address"},{"internalType":"uint96","name":"royaltyFraction","type":"uint96"}],"internalType":"struct NFTContractInitializer","name":"_initializer","type":"tuple"}],"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":"address","name":"to","type":"address"},{"internalType":"string","name":"details","type":"string"},{"internalType":"uint256","name":"numTokensToBurn","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"mintWithDetails","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"safeMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","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":[],"name":"tokenContract","outputs":[{"internalType":"contract BaseToken","name":"","type":"address"}],"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":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"details","type":"string"},{"internalType":"uint256","name":"tokenNonce","type":"uint256"},{"internalType":"uint256","name":"numTokensToBurn","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"upgradeWithDetails","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"validatorContract","outputs":[{"internalType":"contract Validator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b6200186e1760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b6138e7806200015c6000396000f3fe608060405234801561001057600080fd5b50600436106102745760003560e01c80636792626b11610151578063a22cb465116100c3578063d539139311610087578063d53913931461056a578063d547741f14610591578063d547cfb7146105a4578063e63ab1e9146105ac578063e8a3d485146105c1578063e985e9c5146105c957600080fd5b8063a22cb4651461050b578063b88d4fde1461051e578063b947bfa314610531578063bc09308d14610544578063c87b56dd1461055757600080fd5b80638da5cb5b116101155780638da5cb5b146104b157806391d14854146104c357806395d89b41146104d657806399439089146104de578063998133f4146104f0578063a217fddf1461050357600080fd5b80636792626b1461045d57806370751fe91461047057806370a08231146104835780638456cb59146104965780638971fa5a1461049e57600080fd5b806336568abe116101ea57806352229d89116101ae57806352229d89146103fc57806354fd4d501461041d57806355a373d6146104255780635c975abb14610437578063606fe95a146104425780636352211e1461044a57600080fd5b806336568abe146103a85780633f4ba83a146103bb57806340d097c3146103c357806342842e0e146103d657806342966c68146103e957600080fd5b80631565d7271161023c5780631565d7271461030957806323b872dd1461031c578063248a9ca31461032f57806329e75722146103615780632a55205a146103745780632f2ff15d1461039557600080fd5b806301ffc9a714610279578063055b5bb2146102a157806306fdde03146102b6578063081812fc146102cb578063095ea7b3146102f6575b600080fd5b61028c610287366004612bce565b6105dc565b60405190151581526020015b60405180910390f35b6102b46102af366004612c0b565b610625565b005b6102be6106bb565b6040516102989190612c80565b6102de6102d9366004612c93565b61074d565b6040516001600160a01b039091168152602001610298565b6102b4610304366004612cac565b610774565b6102b4610317366004612cef565b610889565b6102b461032a366004612d24565b6108f2565b61035361033d366004612c93565b6000908152610191602052604090206001015490565b604051908152602001610298565b6102b461036f366004612da6565b610924565b610387610382366004612de7565b610a1b565b604051610298929190612e09565b6102b46103a3366004612e22565b610ac9565b6102b46103b6366004612e22565b610aef565b6102b4610b6d565b6103536103d1366004612c0b565b610b90565b6102b46103e4366004612d24565b610bce565b6102b46103f7366004612c93565b610be9565b61035361040a366004612c93565b60009081526105ad602052604090205490565b6102be610c17565b6105ac546001600160a01b03166102de565b60c95460ff1661028c565b610353610c33565b6102de610458366004612c93565b610c44565b61035361046b366004612f1d565b610c79565b6102b461047e366004612c0b565b610f3f565b610353610491366004612c0b565b610fec565b6102b4611072565b6102b46104ac366004612da6565b611092565b6105af546001600160a01b03166102de565b61028c6104d1366004612e22565b61117b565b6102be6111a7565b6105b2546001600160a01b03166102de565b6102b46104fe366004612c0b565b6111b6565b610353600081565b6102b4610519366004612fb0565b611243565b6102b461052c366004612fde565b61124e565b6102b461053f366004613049565b611286565b6102b46105523660046130cd565b6115b8565b6102be610565366004612c93565b611713565b6103537f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102b461059f366004612e22565b6117fa565b6102be611820565b61035360008051602061384883398151915281565b6102be611830565b61028c6105d73660046131c4565b611840565b60006001600160e01b03198216635b5e139f60e01b148061060157506106018261187d565b806106105750610610826118bd565b8061061f575061061f826118c8565b92915050565b6000610630816118ed565b6106386118f7565b6001600160a01b0382166106675760405162461bcd60e51b815260040161065e906131f2565b60405180910390fd5b6105b280546001600160a01b038481166001600160a01b0319831681179093556040519116919082907fdb75680be0282ab08c244ca957483ccdfa5968f147e1a32ce34aac850fb4d46390600090a3505050565b6060609780546106ca90613229565b80601f01602080910402602001604051908101604052809291908181526020018280546106f690613229565b80156107435780601f1061071857610100808354040283529160200191610743565b820191906000526020600020905b81548152906001019060200180831161072657829003601f168201915b5050505050905090565b60006107588261193f565b506000908152609b60205260409020546001600160a01b031690565b600061077f82610c44565b9050806001600160a01b0316836001600160a01b0316036107ec5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161065e565b336001600160a01b038216148061080857506108088133611840565b61087a5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161065e565b6108848383611964565b505050565b6000610894816118ed565b61089c6118f7565b6108a683836119d2565b6040516001600160601b03831681526001600160a01b038416907fb93375bd53507a4530af12b878252da359723d883a3122a1879b4f71d44f1d329060200160405180910390a2505050565b6108fd335b82611acb565b6109195760405162461bcd60e51b815260040161065e9061325d565b610884838383611b2a565b600061092f816118ed565b6109376118f7565b60006105b0805461094790613229565b80601f016020809104026020016040519081016040528092919081815260200182805461097390613229565b80156109c05780601f10610995576101008083540402835291602001916109c0565b820191906000526020600020905b8154815290600101906020018083116109a357829003601f168201915b5050505050905083836105b091906109d9929190612aab565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a16818585604051610a0d939291906132d4565b60405180910390a150505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610a905750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610aaf906001600160601b03168761331a565b610ab9919061334f565b91519350909150505b9250929050565b60008281526101916020526040902060010154610ae5816118ed565b6108848383611cbf565b6001600160a01b0381163314610b5f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161065e565b610b698282611d46565b5050565b600080516020613848833981519152610b85816118ed565b610b8d611dae565b50565b60007f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610bbc816118ed565b610bc583611e00565b91505b50919050565b6108848383836040518060200160405280600081525061124e565b610bf2336108f7565b610c0e5760405162461bcd60e51b815260040161065e9061325d565b610b8d81611e28565b6040518060600160405280602a8152602001613888602a913981565b6000610c3f6105ab5490565b905090565b6000818152609960205260408120546001600160a01b03168061061f5760405162461bcd60e51b815260040161065e90613363565b600060026101c35403610c9e5760405162461bcd60e51b815260040161065e90613395565b60026101c355610cac6118f7565b6105b2546001600160a01b0316610cd55760405162461bcd60e51b815260040161065e906131f2565b6040513390600090610cf790469030908b908b908b9088908c906020016133cc565b60408051601f19818403018152918152815160209283012060008181526105ae90935291205490915015610d615760405162461bcd60e51b81526020600482015260116024820152701a185cda08185b1c9958591e481d5cd959607a1b604482015260640161065e565b6105b25460408051602081018490526000926001600160a01b0316916331f591229101604051602081830303815290604052876040518363ffffffff1660e01b8152600401610db1929190613412565b602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df29190613440565b905080610e115760405162461bcd60e51b815260040161065e9061345d565b60008281526105ae60205260409020600190558515610eb9576105ac546001600160a01b0316610e535760405162461bcd60e51b815260040161065e90613488565b6105ac5460405163079cc67960e41b81526001600160a01b03909116906379cc679090610e869086908a90600401612e09565b600060405180830381600087803b158015610ea057600080fd5b505af1158015610eb4573d6000803e3d6000fd5b505050505b6000610ec48a611e00565b9050836001600160a01b03168a6001600160a01b0316827f57dcb85a18785070cb8704bd172d0289dd1286db97a4adb3860f840fe2756fae8c8c6105b260009054906101000a90046001600160a01b0316604051610f24939291906134b8565b60405180910390a460016101c3559998505050505050505050565b6000610f4a816118ed565b610f526118f7565b6001600160a01b038216610f985760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b21037bbb732b960991b604482015260640161065e565b6105af80546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b60006001600160a01b0382166110565760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161065e565b506001600160a01b03166000908152609a602052604090205490565b60008051602061384883398151915261108a816118ed565b610b8d611e31565b600061109d816118ed565b6110a56118f7565b60006105b180546110b590613229565b80601f01602080910402602001604051908101604052809291908181526020018280546110e190613229565b801561112e5780601f106111035761010080835404028352916020019161112e565b820191906000526020600020905b81548152906001019060200180831161111157829003601f168201915b5050505050905083836105b19190611147929190612aab565b507f19c1a81f34d9a8d208a44017474815e9089aff4b57e461c08509577eea2c3900818585604051610a0d939291906132d4565b6000918252610191602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060609880546106ca90613229565b60006111c1816118ed565b6111c96118f7565b6001600160a01b0382166111ef5760405162461bcd60e51b815260040161065e90613488565b6105ac80546001600160a01b038481166001600160a01b0319831681179093556040519116919082907fc5059a00895c317f836ed9a38f4bf5b953eb08dba43459f81557cf4609cae8ad90600090a3505050565b610b69338383611e6e565b6112583383611acb565b6112745760405162461bcd60e51b815260040161065e9061325d565b61128084848484611f38565b50505050565b60026101c354036112a95760405162461bcd60e51b815260040161065e90613395565b60026101c3556112b76118f7565b6105b2546001600160a01b03166112e05760405162461bcd60e51b815260040161065e906131f2565b60008681526105ad6020526040902054339084146113305760405162461bcd60e51b815260206004820152600d60248201526c696e76616c6964206e6f6e636560981b604482015260640161065e565b61133a8188611acb565b61137f5760405162461bcd60e51b81526020600482015260166024820152751b9bdd081bdddb995c881b9bdc88185c1c1c9bdd995960521b604482015260640161065e565b60004630898989868a8a6040516020016113a09897969594939291906134e4565b60408051601f1981840301815282825280516020918201206105b25482850182905283518086039093018352848401938490526318fac89160e11b90935293506000926001600160a01b03909216916331f5912291611403918890604401613412565b602060405180830381865afa158015611420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114449190613440565b9050806114635760405162461bcd60e51b815260040161065e9061345d565b61146e866001613532565b60008a81526105ad60205260409020558415611513576105ac546001600160a01b03166114ad5760405162461bcd60e51b815260040161065e90613488565b6105ac5460405163079cc67960e41b81526001600160a01b03909116906379cc6790906114e09086908990600401612e09565b600060405180830381600087803b1580156114fa57600080fd5b505af115801561150e573d6000803e3d6000fd5b505050505b887fcd3b6b0b135e09407337318be8b4585d045d2d0e1e9f875b33f98ea0ea3a90cc87611541816001613532565b6040805192835260208301919091520160405180910390a26105b2546040518a917f4070897905202571c22f617454a29aaf4fb6c84355c01936df23ee9aa5b91f8f9161159f918a918d918d916001600160a01b039091169061354a565b60405180910390a2505060016101c35550505050505050565b600054610100900460ff16158080156115d85750600054600160ff909116105b806115f957506115e73061186e565b1580156115f9575060005460ff166001145b61165c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161065e565b6000805460ff19166001179055801561167f576000805461ff0019166101001790555b6116ca6040518060400160405280600d81526020016c21b4ba34a1b430b930b1ba32b960991b8152506040518060400160405280600381526020016243544360e81b81525084611f6b565b8015610b69576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606061171e826120e7565b6117825760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161065e565b60006105b1805461179290613229565b905011156117e1576105b16117a646612104565b6117af30612204565b6117b885612104565b6040516020016117cb9493929190613599565b6040516020818303038152906040529050919050565b505060408051602081019091526000815290565b919050565b60008281526101916020526040902060010154611816816118ed565b6108848383611d46565b60606105b180546106ca90613229565b60606105b080546106ca90613229565b6001600160a01b039182166000908152609c6020908152604080832093909416825291909152205460ff1690565b6001600160a01b03163b151590565b60006001600160e01b031982166380ac58cd60e01b14806118ae57506001600160e01b03198216635b5e139f60e01b145b8061061f575061061f82612218565b600061061f8261187d565b60006001600160e01b03198216637965db0b60e01b148061061f575061061f826118bd565b610b8d813361224d565b60c95460ff161561193d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161065e565b565b611948816120e7565b610b8d5760405162461bcd60e51b815260040161065e90613363565b6000818152609b6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061199982610c44565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6127106001600160601b0382161115611a405760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161065e565b6001600160a01b038216611a925760405162461bcd60e51b815260206004820152601960248201527822a921991c9c189d1034b73b30b634b2103932b1b2b4bb32b960391b604482015260640161065e565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b600080611ad783610c44565b9050806001600160a01b0316846001600160a01b03161480611afe5750611afe8185611840565b80611b225750836001600160a01b0316611b178461074d565b6001600160a01b0316145b949350505050565b826001600160a01b0316611b3d82610c44565b6001600160a01b031614611ba15760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161065e565b6001600160a01b038216611c035760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161065e565b611c0e8383836122b1565b611c19600082611964565b6001600160a01b0383166000908152609a60205260408120805460019290611c4290849061367a565b90915550506001600160a01b0382166000908152609a60205260408120805460019290611c70908490613532565b909155505060008181526099602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061386883398151915291a4505050565b611cc9828261117b565b610b69576000828152610191602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611d023390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611d50828261117b565b15610b69576000828152610191602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611db66122bc565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080611e0d6105ab5490565b9050611e1e6105ab80546001019055565b61061f8382612305565b610b8d8161231f565b611e396118f7565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611de33390565b816001600160a01b0316836001600160a01b031603611ecb5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161065e565b6001600160a01b038381166000818152609c6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611f43848484611b2a565b611f4f84848484612339565b6112805760405162461bcd60e51b815260040161065e90613691565b600054610100900460ff16611f925760405162461bcd60e51b815260040161065e906136e3565b611f9a612441565b611fd85760405162461bcd60e51b815260206004820152600f60248201526e756e6b6e6f776e206e6574776f726b60881b604482015260640161065e565b611fe283836124f4565b611fea612525565b611ff2612554565b611ffa612554565b612002612554565b61200a61257b565b80516001600160a01b03811661201d5750335b612028600082611cbf565b61204060008051602061384883398151915282611cbf565b60408201516105ac80546001600160a01b03199081166001600160a01b03938416179091556020808501516105af8054841691851691909117905560608501516105b280549093169316929092179055608083015180516120a6926105b0920190612b2f565b5060a082015180516120c1916105b191602090910190612b2f565b5060c08201516001600160a01b031615611280576112808260c001518360e001516119d2565b6000908152609960205260409020546001600160a01b0316151590565b60608160000361212b5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612155578061213f8161372e565b915061214e9050600a8361334f565b915061212f565b6000816001600160401b0381111561216f5761216f612e52565b6040519080825280601f01601f191660200182016040528015612199576020820181803683370190505b5090505b8415611b22576121ae60018361367a565b91506121bb600a86613747565b6121c6906030613532565b60f81b8183815181106121db576121db61375b565b60200101906001600160f81b031916908160001a9053506121fd600a8661334f565b945061219d565b606061061f826001600160a01b03166125aa565b60006001600160e01b0319821663152a902d60e11b148061061f57506301ffc9a760e01b6001600160e01b031983161461061f565b612257828261117b565b610b695761226f816001600160a01b031660146125fd565b61227a8360206125fd565b60405160200161228b929190613771565b60408051601f198184030181529082905262461bcd60e51b825261065e91600401612c80565b61088483838361279f565b60c95460ff1661193d5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161065e565b610b69828260405180602001604052806000815250612806565b61232881612839565b600090815260666020526040812055565b600061234d846001600160a01b031661186e565b1561243657604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123849033908990889088906004016137e0565b6020604051808303816000875af19250505080156123bf575060408051601f3d908101601f191682019092526123bc91810190613813565b60015b61241c573d8080156123ed576040519150601f19603f3d011682016040523d82523d6000602084013e6123f2565b606091505b5080516000036124145760405162461bcd60e51b815260040161065e90613691565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611b22565b506001949350505050565b60004660018114806124535750600381145b8061245e5750600481145b806124695750600581145b806124745750602a81145b8061247f5750600a81145b8061248a5750604581145b8061249657506101a481145b806124a2575061a4b181145b806124ae575061a4ba81145b806124bb575062066eeb81145b806124c8575062066eed81145b806124d55750621469ca81145b806124e2575062aa36a781145b806124ee5750617a6981145b91505090565b600054610100900460ff1661251b5760405162461bcd60e51b815260040161065e906136e3565b610b6982826128ce565b600054610100900460ff1661254c5760405162461bcd60e51b815260040161065e906136e3565b61193d61291c565b600054610100900460ff1661193d5760405162461bcd60e51b815260040161065e906136e3565b600054610100900460ff166125a25760405162461bcd60e51b815260040161065e906136e3565b61193d61294f565b6060816000036125d45750506040805180820190915260048152630307830360e41b602082015290565b8160005b81156125f757806125e88161372e565b915050600882901c91506125d8565b611b2284825b6060600061260c83600261331a565b612617906002613532565b6001600160401b0381111561262e5761262e612e52565b6040519080825280601f01601f191660200182016040528015612658576020820181803683370190505b509050600360fc1b816000815181106126735761267361375b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106126a2576126a261375b565b60200101906001600160f81b031916908160001a90535060006126c684600261331a565b6126d1906001613532565b90505b6001811115612749576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106127055761270561375b565b1a60f81b82828151811061271b5761271b61375b565b60200101906001600160f81b031916908160001a90535060049490941c9361274281613830565b90506126d4565b5083156127985760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161065e565b9392505050565b60c95460ff16156108845760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b606482015260840161065e565b612810838361297e565b61281d6000848484612339565b6108845760405162461bcd60e51b815260040161065e90613691565b600061284482610c44565b9050612852816000846122b1565b61285d600083611964565b6001600160a01b0381166000908152609a6020526040812080546001929061288690849061367a565b909155505060008281526099602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020613868833981519152908390a45050565b600054610100900460ff166128f55760405162461bcd60e51b815260040161065e906136e3565b8151612908906097906020850190612b2f565b508051610884906098906020840190612b2f565b600054610100900460ff166129435760405162461bcd60e51b815260040161065e906136e3565b60c9805460ff19169055565b600054610100900460ff166129765760405162461bcd60e51b815260040161065e906136e3565b60016101c355565b6001600160a01b0382166129d45760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161065e565b6129dd816120e7565b15612a2a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161065e565b612a36600083836122b1565b6001600160a01b0382166000908152609a60205260408120805460019290612a5f908490613532565b909155505060008181526099602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020613868833981519152908290a45050565b828054612ab790613229565b90600052602060002090601f016020900481019282612ad95760008555612b1f565b82601f10612af25782800160ff19823516178555612b1f565b82800160010185558215612b1f579182015b82811115612b1f578235825591602001919060010190612b04565b50612b2b929150612ba3565b5090565b828054612b3b90613229565b90600052602060002090601f016020900481019282612b5d5760008555612b1f565b82601f10612b7657805160ff1916838001178555612b1f565b82800160010185558215612b1f579182015b82811115612b1f578251825591602001919060010190612b88565b5b80821115612b2b5760008155600101612ba4565b6001600160e01b031981168114610b8d57600080fd5b600060208284031215612be057600080fd5b813561279881612bb8565b6001600160a01b0381168114610b8d57600080fd5b80356117f581612beb565b600060208284031215612c1d57600080fd5b813561279881612beb565b60005b83811015612c43578181015183820152602001612c2b565b838111156112805750506000910152565b60008151808452612c6c816020860160208601612c28565b601f01601f19169290920160200192915050565b6020815260006127986020830184612c54565b600060208284031215612ca557600080fd5b5035919050565b60008060408385031215612cbf57600080fd5b8235612cca81612beb565b946020939093013593505050565b80356001600160601b03811681146117f557600080fd5b60008060408385031215612d0257600080fd5b8235612d0d81612beb565b9150612d1b60208401612cd8565b90509250929050565b600080600060608486031215612d3957600080fd5b8335612d4481612beb565b92506020840135612d5481612beb565b929592945050506040919091013590565b60008083601f840112612d7757600080fd5b5081356001600160401b03811115612d8e57600080fd5b602083019150836020828501011115610ac257600080fd5b60008060208385031215612db957600080fd5b82356001600160401b03811115612dcf57600080fd5b612ddb85828601612d65565b90969095509350505050565b60008060408385031215612dfa57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215612e3557600080fd5b823591506020830135612e4781612beb565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715612e8b57612e8b612e52565b60405290565b600082601f830112612ea257600080fd5b81356001600160401b0380821115612ebc57612ebc612e52565b604051601f8301601f19908116603f01168101908282118183101715612ee457612ee4612e52565b81604052838152866020858801011115612efd57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600060808688031215612f3557600080fd5b8535612f4081612beb565b945060208601356001600160401b0380821115612f5c57600080fd5b612f6889838a01612d65565b9096509450604088013593506060880135915080821115612f8857600080fd5b50612f9588828901612e91565b9150509295509295909350565b8015158114610b8d57600080fd5b60008060408385031215612fc357600080fd5b8235612fce81612beb565b91506020830135612e4781612fa2565b60008060008060808587031215612ff457600080fd5b8435612fff81612beb565b9350602085013561300f81612beb565b92506040850135915060608501356001600160401b0381111561303157600080fd5b61303d87828801612e91565b91505092959194509250565b60008060008060008060a0878903121561306257600080fd5b8635955060208701356001600160401b038082111561308057600080fd5b61308c8a838b01612d65565b9097509550604089013594506060890135935060808901359150808211156130b357600080fd5b506130c089828a01612e91565b9150509295509295509295565b6000602082840312156130df57600080fd5b81356001600160401b03808211156130f657600080fd5b90830190610100828603121561310b57600080fd5b613113612e68565b61311c83612c00565b815261312a60208401612c00565b602082015261313b60408401612c00565b604082015261314c60608401612c00565b606082015260808301358281111561316357600080fd5b61316f87828601612e91565b60808301525060a08301358281111561318757600080fd5b61319387828601612e91565b60a0830152506131a560c08401612c00565b60c08201526131b660e08401612cd8565b60e082015295945050505050565b600080604083850312156131d757600080fd5b82356131e281612beb565b91506020830135612e4781612beb565b6020808252601a908201527f696e76616c69642076616c696461746f7220636f6e7472616374000000000000604082015260600190565b600181811c9082168061323d57607f821691505b602082108103610bc857634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006132e76040830186612c54565b82810360208401526132fa8185876132ab565b9695505050505050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561333457613334613304565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261335e5761335e613339565b500490565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b878152600060018060a01b038089166020840152808816604084015260c060608401526133fd60c0840187896132ab565b941660808301525060a0015295945050505050565b6040815260006134256040830185612c54565b82810360208401526134378185612c54565b95945050505050565b60006020828403121561345257600080fd5b815161279881612fa2565b602080825260119082015270696e76616c6964207369676e617475726560781b604082015260600190565b6020808252601690820152751a5b9d985b1a59081d1bdad95b8818dbdb9d1c9858dd60521b604082015260600190565b6040815260006134cc6040830185876132ab565b905060018060a01b0383166020830152949350505050565b888152600060018060a01b03808a16602084015288604084015260e0606084015261351360e08401888a6132ab565b951660808301525060a081019290925260c09091015295945050505050565b6000821982111561354557613545613304565b500190565b8481526060602082015260006135646060830185876132ab565b905060018060a01b038316604083015295945050505050565b6000815161358f818560208601612c28565b9290920192915050565b600080865481600182811c9150808316806135b557607f831692505b602080841082036135d457634e487b7160e01b86526022600452602486fd5b8180156135e857600181146135f957613626565b60ff19861689528489019650613626565b60008d81526020902060005b8681101561361e5781548b820152908501908301613605565b505084890196505b50505050505061366f61365e613658613645613652613645868c61357d565b602f60f81b815260010190565b8961357d565b8661357d565b64173539b7b760d91b815260050190565b979650505050505050565b60008282101561368c5761368c613304565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006001820161374057613740613304565b5060010190565b60008261375657613756613339565b500690565b634e487b7160e01b600052603260045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516137a3816017850160208801612c28565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137d4816028840160208801612c28565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132fa90830184612c54565b60006020828403121561382557600080fd5b815161279881612bb8565b60008161383f5761383f613304565b50600019019056fe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862addf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef307866343133306362623631323936383965633562333264623164346131373631613437396339313636a264697066735822122063a2592b6adf16588893fef8fcef1bd127f8a2f374eaefea12dd6d907556f50864736f6c634300080d0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102745760003560e01c80636792626b11610151578063a22cb465116100c3578063d539139311610087578063d53913931461056a578063d547741f14610591578063d547cfb7146105a4578063e63ab1e9146105ac578063e8a3d485146105c1578063e985e9c5146105c957600080fd5b8063a22cb4651461050b578063b88d4fde1461051e578063b947bfa314610531578063bc09308d14610544578063c87b56dd1461055757600080fd5b80638da5cb5b116101155780638da5cb5b146104b157806391d14854146104c357806395d89b41146104d657806399439089146104de578063998133f4146104f0578063a217fddf1461050357600080fd5b80636792626b1461045d57806370751fe91461047057806370a08231146104835780638456cb59146104965780638971fa5a1461049e57600080fd5b806336568abe116101ea57806352229d89116101ae57806352229d89146103fc57806354fd4d501461041d57806355a373d6146104255780635c975abb14610437578063606fe95a146104425780636352211e1461044a57600080fd5b806336568abe146103a85780633f4ba83a146103bb57806340d097c3146103c357806342842e0e146103d657806342966c68146103e957600080fd5b80631565d7271161023c5780631565d7271461030957806323b872dd1461031c578063248a9ca31461032f57806329e75722146103615780632a55205a146103745780632f2ff15d1461039557600080fd5b806301ffc9a714610279578063055b5bb2146102a157806306fdde03146102b6578063081812fc146102cb578063095ea7b3146102f6575b600080fd5b61028c610287366004612bce565b6105dc565b60405190151581526020015b60405180910390f35b6102b46102af366004612c0b565b610625565b005b6102be6106bb565b6040516102989190612c80565b6102de6102d9366004612c93565b61074d565b6040516001600160a01b039091168152602001610298565b6102b4610304366004612cac565b610774565b6102b4610317366004612cef565b610889565b6102b461032a366004612d24565b6108f2565b61035361033d366004612c93565b6000908152610191602052604090206001015490565b604051908152602001610298565b6102b461036f366004612da6565b610924565b610387610382366004612de7565b610a1b565b604051610298929190612e09565b6102b46103a3366004612e22565b610ac9565b6102b46103b6366004612e22565b610aef565b6102b4610b6d565b6103536103d1366004612c0b565b610b90565b6102b46103e4366004612d24565b610bce565b6102b46103f7366004612c93565b610be9565b61035361040a366004612c93565b60009081526105ad602052604090205490565b6102be610c17565b6105ac546001600160a01b03166102de565b60c95460ff1661028c565b610353610c33565b6102de610458366004612c93565b610c44565b61035361046b366004612f1d565b610c79565b6102b461047e366004612c0b565b610f3f565b610353610491366004612c0b565b610fec565b6102b4611072565b6102b46104ac366004612da6565b611092565b6105af546001600160a01b03166102de565b61028c6104d1366004612e22565b61117b565b6102be6111a7565b6105b2546001600160a01b03166102de565b6102b46104fe366004612c0b565b6111b6565b610353600081565b6102b4610519366004612fb0565b611243565b6102b461052c366004612fde565b61124e565b6102b461053f366004613049565b611286565b6102b46105523660046130cd565b6115b8565b6102be610565366004612c93565b611713565b6103537f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a681565b6102b461059f366004612e22565b6117fa565b6102be611820565b61035360008051602061384883398151915281565b6102be611830565b61028c6105d73660046131c4565b611840565b60006001600160e01b03198216635b5e139f60e01b148061060157506106018261187d565b806106105750610610826118bd565b8061061f575061061f826118c8565b92915050565b6000610630816118ed565b6106386118f7565b6001600160a01b0382166106675760405162461bcd60e51b815260040161065e906131f2565b60405180910390fd5b6105b280546001600160a01b038481166001600160a01b0319831681179093556040519116919082907fdb75680be0282ab08c244ca957483ccdfa5968f147e1a32ce34aac850fb4d46390600090a3505050565b6060609780546106ca90613229565b80601f01602080910402602001604051908101604052809291908181526020018280546106f690613229565b80156107435780601f1061071857610100808354040283529160200191610743565b820191906000526020600020905b81548152906001019060200180831161072657829003601f168201915b5050505050905090565b60006107588261193f565b506000908152609b60205260409020546001600160a01b031690565b600061077f82610c44565b9050806001600160a01b0316836001600160a01b0316036107ec5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b606482015260840161065e565b336001600160a01b038216148061080857506108088133611840565b61087a5760405162461bcd60e51b815260206004820152603e60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206e6f7220617070726f76656420666f7220616c6c0000606482015260840161065e565b6108848383611964565b505050565b6000610894816118ed565b61089c6118f7565b6108a683836119d2565b6040516001600160601b03831681526001600160a01b038416907fb93375bd53507a4530af12b878252da359723d883a3122a1879b4f71d44f1d329060200160405180910390a2505050565b6108fd335b82611acb565b6109195760405162461bcd60e51b815260040161065e9061325d565b610884838383611b2a565b600061092f816118ed565b6109376118f7565b60006105b0805461094790613229565b80601f016020809104026020016040519081016040528092919081815260200182805461097390613229565b80156109c05780601f10610995576101008083540402835291602001916109c0565b820191906000526020600020905b8154815290600101906020018083116109a357829003601f168201915b5050505050905083836105b091906109d9929190612aab565b507fc9c7c3fe08b88b4df9d4d47ef47d2c43d55c025a0ba88ca442580ed9e7348a16818585604051610a0d939291906132d4565b60405180910390a150505050565b60008281526066602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b0316928201929092528291610a905750604080518082019091526065546001600160a01b0381168252600160a01b90046001600160601b031660208201525b602081015160009061271090610aaf906001600160601b03168761331a565b610ab9919061334f565b91519350909150505b9250929050565b60008281526101916020526040902060010154610ae5816118ed565b6108848383611cbf565b6001600160a01b0381163314610b5f5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840161065e565b610b698282611d46565b5050565b600080516020613848833981519152610b85816118ed565b610b8d611dae565b50565b60007f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6610bbc816118ed565b610bc583611e00565b91505b50919050565b6108848383836040518060200160405280600081525061124e565b610bf2336108f7565b610c0e5760405162461bcd60e51b815260040161065e9061325d565b610b8d81611e28565b6040518060600160405280602a8152602001613888602a913981565b6000610c3f6105ab5490565b905090565b6000818152609960205260408120546001600160a01b03168061061f5760405162461bcd60e51b815260040161065e90613363565b600060026101c35403610c9e5760405162461bcd60e51b815260040161065e90613395565b60026101c355610cac6118f7565b6105b2546001600160a01b0316610cd55760405162461bcd60e51b815260040161065e906131f2565b6040513390600090610cf790469030908b908b908b9088908c906020016133cc565b60408051601f19818403018152918152815160209283012060008181526105ae90935291205490915015610d615760405162461bcd60e51b81526020600482015260116024820152701a185cda08185b1c9958591e481d5cd959607a1b604482015260640161065e565b6105b25460408051602081018490526000926001600160a01b0316916331f591229101604051602081830303815290604052876040518363ffffffff1660e01b8152600401610db1929190613412565b602060405180830381865afa158015610dce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610df29190613440565b905080610e115760405162461bcd60e51b815260040161065e9061345d565b60008281526105ae60205260409020600190558515610eb9576105ac546001600160a01b0316610e535760405162461bcd60e51b815260040161065e90613488565b6105ac5460405163079cc67960e41b81526001600160a01b03909116906379cc679090610e869086908a90600401612e09565b600060405180830381600087803b158015610ea057600080fd5b505af1158015610eb4573d6000803e3d6000fd5b505050505b6000610ec48a611e00565b9050836001600160a01b03168a6001600160a01b0316827f57dcb85a18785070cb8704bd172d0289dd1286db97a4adb3860f840fe2756fae8c8c6105b260009054906101000a90046001600160a01b0316604051610f24939291906134b8565b60405180910390a460016101c3559998505050505050505050565b6000610f4a816118ed565b610f526118f7565b6001600160a01b038216610f985760405162461bcd60e51b815260206004820152600d60248201526c34b73b30b634b21037bbb732b960991b604482015260640161065e565b6105af80546001600160a01b038481166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b60006001600160a01b0382166110565760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b606482015260840161065e565b506001600160a01b03166000908152609a602052604090205490565b60008051602061384883398151915261108a816118ed565b610b8d611e31565b600061109d816118ed565b6110a56118f7565b60006105b180546110b590613229565b80601f01602080910402602001604051908101604052809291908181526020018280546110e190613229565b801561112e5780601f106111035761010080835404028352916020019161112e565b820191906000526020600020905b81548152906001019060200180831161111157829003601f168201915b5050505050905083836105b19190611147929190612aab565b507f19c1a81f34d9a8d208a44017474815e9089aff4b57e461c08509577eea2c3900818585604051610a0d939291906132d4565b6000918252610191602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060609880546106ca90613229565b60006111c1816118ed565b6111c96118f7565b6001600160a01b0382166111ef5760405162461bcd60e51b815260040161065e90613488565b6105ac80546001600160a01b038481166001600160a01b0319831681179093556040519116919082907fc5059a00895c317f836ed9a38f4bf5b953eb08dba43459f81557cf4609cae8ad90600090a3505050565b610b69338383611e6e565b6112583383611acb565b6112745760405162461bcd60e51b815260040161065e9061325d565b61128084848484611f38565b50505050565b60026101c354036112a95760405162461bcd60e51b815260040161065e90613395565b60026101c3556112b76118f7565b6105b2546001600160a01b03166112e05760405162461bcd60e51b815260040161065e906131f2565b60008681526105ad6020526040902054339084146113305760405162461bcd60e51b815260206004820152600d60248201526c696e76616c6964206e6f6e636560981b604482015260640161065e565b61133a8188611acb565b61137f5760405162461bcd60e51b81526020600482015260166024820152751b9bdd081bdddb995c881b9bdc88185c1c1c9bdd995960521b604482015260640161065e565b60004630898989868a8a6040516020016113a09897969594939291906134e4565b60408051601f1981840301815282825280516020918201206105b25482850182905283518086039093018352848401938490526318fac89160e11b90935293506000926001600160a01b03909216916331f5912291611403918890604401613412565b602060405180830381865afa158015611420573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114449190613440565b9050806114635760405162461bcd60e51b815260040161065e9061345d565b61146e866001613532565b60008a81526105ad60205260409020558415611513576105ac546001600160a01b03166114ad5760405162461bcd60e51b815260040161065e90613488565b6105ac5460405163079cc67960e41b81526001600160a01b03909116906379cc6790906114e09086908990600401612e09565b600060405180830381600087803b1580156114fa57600080fd5b505af115801561150e573d6000803e3d6000fd5b505050505b887fcd3b6b0b135e09407337318be8b4585d045d2d0e1e9f875b33f98ea0ea3a90cc87611541816001613532565b6040805192835260208301919091520160405180910390a26105b2546040518a917f4070897905202571c22f617454a29aaf4fb6c84355c01936df23ee9aa5b91f8f9161159f918a918d918d916001600160a01b039091169061354a565b60405180910390a2505060016101c35550505050505050565b600054610100900460ff16158080156115d85750600054600160ff909116105b806115f957506115e73061186e565b1580156115f9575060005460ff166001145b61165c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161065e565b6000805460ff19166001179055801561167f576000805461ff0019166101001790555b6116ca6040518060400160405280600d81526020016c21b4ba34a1b430b930b1ba32b960991b8152506040518060400160405280600381526020016243544360e81b81525084611f6b565b8015610b69576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b606061171e826120e7565b6117825760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201526e3732bc34b9ba32b73a103a37b5b2b760891b606482015260840161065e565b60006105b1805461179290613229565b905011156117e1576105b16117a646612104565b6117af30612204565b6117b885612104565b6040516020016117cb9493929190613599565b6040516020818303038152906040529050919050565b505060408051602081019091526000815290565b919050565b60008281526101916020526040902060010154611816816118ed565b6108848383611d46565b60606105b180546106ca90613229565b60606105b080546106ca90613229565b6001600160a01b039182166000908152609c6020908152604080832093909416825291909152205460ff1690565b6001600160a01b03163b151590565b60006001600160e01b031982166380ac58cd60e01b14806118ae57506001600160e01b03198216635b5e139f60e01b145b8061061f575061061f82612218565b600061061f8261187d565b60006001600160e01b03198216637965db0b60e01b148061061f575061061f826118bd565b610b8d813361224d565b60c95460ff161561193d5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640161065e565b565b611948816120e7565b610b8d5760405162461bcd60e51b815260040161065e90613363565b6000818152609b6020526040902080546001600160a01b0319166001600160a01b038416908117909155819061199982610c44565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6127106001600160601b0382161115611a405760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b606482015260840161065e565b6001600160a01b038216611a925760405162461bcd60e51b815260206004820152601960248201527822a921991c9c189d1034b73b30b634b2103932b1b2b4bb32b960391b604482015260640161065e565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217606555565b600080611ad783610c44565b9050806001600160a01b0316846001600160a01b03161480611afe5750611afe8185611840565b80611b225750836001600160a01b0316611b178461074d565b6001600160a01b0316145b949350505050565b826001600160a01b0316611b3d82610c44565b6001600160a01b031614611ba15760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b606482015260840161065e565b6001600160a01b038216611c035760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b606482015260840161065e565b611c0e8383836122b1565b611c19600082611964565b6001600160a01b0383166000908152609a60205260408120805460019290611c4290849061367a565b90915550506001600160a01b0382166000908152609a60205260408120805460019290611c70908490613532565b909155505060008181526099602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061386883398151915291a4505050565b611cc9828261117b565b610b69576000828152610191602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611d023390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611d50828261117b565b15610b69576000828152610191602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b611db66122bc565b60c9805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080611e0d6105ab5490565b9050611e1e6105ab80546001019055565b61061f8382612305565b610b8d8161231f565b611e396118f7565b60c9805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611de33390565b816001600160a01b0316836001600160a01b031603611ecb5760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b604482015260640161065e565b6001600160a01b038381166000818152609c6020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611f43848484611b2a565b611f4f84848484612339565b6112805760405162461bcd60e51b815260040161065e90613691565b600054610100900460ff16611f925760405162461bcd60e51b815260040161065e906136e3565b611f9a612441565b611fd85760405162461bcd60e51b815260206004820152600f60248201526e756e6b6e6f776e206e6574776f726b60881b604482015260640161065e565b611fe283836124f4565b611fea612525565b611ff2612554565b611ffa612554565b612002612554565b61200a61257b565b80516001600160a01b03811661201d5750335b612028600082611cbf565b61204060008051602061384883398151915282611cbf565b60408201516105ac80546001600160a01b03199081166001600160a01b03938416179091556020808501516105af8054841691851691909117905560608501516105b280549093169316929092179055608083015180516120a6926105b0920190612b2f565b5060a082015180516120c1916105b191602090910190612b2f565b5060c08201516001600160a01b031615611280576112808260c001518360e001516119d2565b6000908152609960205260409020546001600160a01b0316151590565b60608160000361212b5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612155578061213f8161372e565b915061214e9050600a8361334f565b915061212f565b6000816001600160401b0381111561216f5761216f612e52565b6040519080825280601f01601f191660200182016040528015612199576020820181803683370190505b5090505b8415611b22576121ae60018361367a565b91506121bb600a86613747565b6121c6906030613532565b60f81b8183815181106121db576121db61375b565b60200101906001600160f81b031916908160001a9053506121fd600a8661334f565b945061219d565b606061061f826001600160a01b03166125aa565b60006001600160e01b0319821663152a902d60e11b148061061f57506301ffc9a760e01b6001600160e01b031983161461061f565b612257828261117b565b610b695761226f816001600160a01b031660146125fd565b61227a8360206125fd565b60405160200161228b929190613771565b60408051601f198184030181529082905262461bcd60e51b825261065e91600401612c80565b61088483838361279f565b60c95460ff1661193d5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b604482015260640161065e565b610b69828260405180602001604052806000815250612806565b61232881612839565b600090815260666020526040812055565b600061234d846001600160a01b031661186e565b1561243657604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906123849033908990889088906004016137e0565b6020604051808303816000875af19250505080156123bf575060408051601f3d908101601f191682019092526123bc91810190613813565b60015b61241c573d8080156123ed576040519150601f19603f3d011682016040523d82523d6000602084013e6123f2565b606091505b5080516000036124145760405162461bcd60e51b815260040161065e90613691565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611b22565b506001949350505050565b60004660018114806124535750600381145b8061245e5750600481145b806124695750600581145b806124745750602a81145b8061247f5750600a81145b8061248a5750604581145b8061249657506101a481145b806124a2575061a4b181145b806124ae575061a4ba81145b806124bb575062066eeb81145b806124c8575062066eed81145b806124d55750621469ca81145b806124e2575062aa36a781145b806124ee5750617a6981145b91505090565b600054610100900460ff1661251b5760405162461bcd60e51b815260040161065e906136e3565b610b6982826128ce565b600054610100900460ff1661254c5760405162461bcd60e51b815260040161065e906136e3565b61193d61291c565b600054610100900460ff1661193d5760405162461bcd60e51b815260040161065e906136e3565b600054610100900460ff166125a25760405162461bcd60e51b815260040161065e906136e3565b61193d61294f565b6060816000036125d45750506040805180820190915260048152630307830360e41b602082015290565b8160005b81156125f757806125e88161372e565b915050600882901c91506125d8565b611b2284825b6060600061260c83600261331a565b612617906002613532565b6001600160401b0381111561262e5761262e612e52565b6040519080825280601f01601f191660200182016040528015612658576020820181803683370190505b509050600360fc1b816000815181106126735761267361375b565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106126a2576126a261375b565b60200101906001600160f81b031916908160001a90535060006126c684600261331a565b6126d1906001613532565b90505b6001811115612749576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106127055761270561375b565b1a60f81b82828151811061271b5761271b61375b565b60200101906001600160f81b031916908160001a90535060049490941c9361274281613830565b90506126d4565b5083156127985760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161065e565b9392505050565b60c95460ff16156108845760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b606482015260840161065e565b612810838361297e565b61281d6000848484612339565b6108845760405162461bcd60e51b815260040161065e90613691565b600061284482610c44565b9050612852816000846122b1565b61285d600083611964565b6001600160a01b0381166000908152609a6020526040812080546001929061288690849061367a565b909155505060008281526099602052604080822080546001600160a01b0319169055518391906001600160a01b03841690600080516020613868833981519152908390a45050565b600054610100900460ff166128f55760405162461bcd60e51b815260040161065e906136e3565b8151612908906097906020850190612b2f565b508051610884906098906020840190612b2f565b600054610100900460ff166129435760405162461bcd60e51b815260040161065e906136e3565b60c9805460ff19169055565b600054610100900460ff166129765760405162461bcd60e51b815260040161065e906136e3565b60016101c355565b6001600160a01b0382166129d45760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015260640161065e565b6129dd816120e7565b15612a2a5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015260640161065e565b612a36600083836122b1565b6001600160a01b0382166000908152609a60205260408120805460019290612a5f908490613532565b909155505060008181526099602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020613868833981519152908290a45050565b828054612ab790613229565b90600052602060002090601f016020900481019282612ad95760008555612b1f565b82601f10612af25782800160ff19823516178555612b1f565b82800160010185558215612b1f579182015b82811115612b1f578235825591602001919060010190612b04565b50612b2b929150612ba3565b5090565b828054612b3b90613229565b90600052602060002090601f016020900481019282612b5d5760008555612b1f565b82601f10612b7657805160ff1916838001178555612b1f565b82800160010185558215612b1f579182015b82811115612b1f578251825591602001919060010190612b88565b5b80821115612b2b5760008155600101612ba4565b6001600160e01b031981168114610b8d57600080fd5b600060208284031215612be057600080fd5b813561279881612bb8565b6001600160a01b0381168114610b8d57600080fd5b80356117f581612beb565b600060208284031215612c1d57600080fd5b813561279881612beb565b60005b83811015612c43578181015183820152602001612c2b565b838111156112805750506000910152565b60008151808452612c6c816020860160208601612c28565b601f01601f19169290920160200192915050565b6020815260006127986020830184612c54565b600060208284031215612ca557600080fd5b5035919050565b60008060408385031215612cbf57600080fd5b8235612cca81612beb565b946020939093013593505050565b80356001600160601b03811681146117f557600080fd5b60008060408385031215612d0257600080fd5b8235612d0d81612beb565b9150612d1b60208401612cd8565b90509250929050565b600080600060608486031215612d3957600080fd5b8335612d4481612beb565b92506020840135612d5481612beb565b929592945050506040919091013590565b60008083601f840112612d7757600080fd5b5081356001600160401b03811115612d8e57600080fd5b602083019150836020828501011115610ac257600080fd5b60008060208385031215612db957600080fd5b82356001600160401b03811115612dcf57600080fd5b612ddb85828601612d65565b90969095509350505050565b60008060408385031215612dfa57600080fd5b50508035926020909101359150565b6001600160a01b03929092168252602082015260400190565b60008060408385031215612e3557600080fd5b823591506020830135612e4781612beb565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60405161010081016001600160401b0381118282101715612e8b57612e8b612e52565b60405290565b600082601f830112612ea257600080fd5b81356001600160401b0380821115612ebc57612ebc612e52565b604051601f8301601f19908116603f01168101908282118183101715612ee457612ee4612e52565b81604052838152866020858801011115612efd57600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600060808688031215612f3557600080fd5b8535612f4081612beb565b945060208601356001600160401b0380821115612f5c57600080fd5b612f6889838a01612d65565b9096509450604088013593506060880135915080821115612f8857600080fd5b50612f9588828901612e91565b9150509295509295909350565b8015158114610b8d57600080fd5b60008060408385031215612fc357600080fd5b8235612fce81612beb565b91506020830135612e4781612fa2565b60008060008060808587031215612ff457600080fd5b8435612fff81612beb565b9350602085013561300f81612beb565b92506040850135915060608501356001600160401b0381111561303157600080fd5b61303d87828801612e91565b91505092959194509250565b60008060008060008060a0878903121561306257600080fd5b8635955060208701356001600160401b038082111561308057600080fd5b61308c8a838b01612d65565b9097509550604089013594506060890135935060808901359150808211156130b357600080fd5b506130c089828a01612e91565b9150509295509295509295565b6000602082840312156130df57600080fd5b81356001600160401b03808211156130f657600080fd5b90830190610100828603121561310b57600080fd5b613113612e68565b61311c83612c00565b815261312a60208401612c00565b602082015261313b60408401612c00565b604082015261314c60608401612c00565b606082015260808301358281111561316357600080fd5b61316f87828601612e91565b60808301525060a08301358281111561318757600080fd5b61319387828601612e91565b60a0830152506131a560c08401612c00565b60c08201526131b660e08401612cd8565b60e082015295945050505050565b600080604083850312156131d757600080fd5b82356131e281612beb565b91506020830135612e4781612beb565b6020808252601a908201527f696e76616c69642076616c696461746f7220636f6e7472616374000000000000604082015260600190565b600181811c9082168061323d57607f821691505b602082108103610bc857634e487b7160e01b600052602260045260246000fd5b6020808252602e908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526d1c881b9bdc88185c1c1c9bdd995960921b606082015260800190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6040815260006132e76040830186612c54565b82810360208401526132fa8185876132ab565b9695505050505050565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161561333457613334613304565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261335e5761335e613339565b500490565b602080825260189082015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b878152600060018060a01b038089166020840152808816604084015260c060608401526133fd60c0840187896132ab565b941660808301525060a0015295945050505050565b6040815260006134256040830185612c54565b82810360208401526134378185612c54565b95945050505050565b60006020828403121561345257600080fd5b815161279881612fa2565b602080825260119082015270696e76616c6964207369676e617475726560781b604082015260600190565b6020808252601690820152751a5b9d985b1a59081d1bdad95b8818dbdb9d1c9858dd60521b604082015260600190565b6040815260006134cc6040830185876132ab565b905060018060a01b0383166020830152949350505050565b888152600060018060a01b03808a16602084015288604084015260e0606084015261351360e08401888a6132ab565b951660808301525060a081019290925260c09091015295945050505050565b6000821982111561354557613545613304565b500190565b8481526060602082015260006135646060830185876132ab565b905060018060a01b038316604083015295945050505050565b6000815161358f818560208601612c28565b9290920192915050565b600080865481600182811c9150808316806135b557607f831692505b602080841082036135d457634e487b7160e01b86526022600452602486fd5b8180156135e857600181146135f957613626565b60ff19861689528489019650613626565b60008d81526020902060005b8681101561361e5781548b820152908501908301613605565b505084890196505b50505050505061366f61365e613658613645613652613645868c61357d565b602f60f81b815260010190565b8961357d565b8661357d565b64173539b7b760d91b815260050190565b979650505050505050565b60008282101561368c5761368c613304565b500390565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60006001820161374057613740613304565b5060010190565b60008261375657613756613339565b500690565b634e487b7160e01b600052603260045260246000fd5b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b8152600083516137a3816017850160208801612c28565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516137d4816028840160208801612c28565b01602801949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132fa90830184612c54565b60006020828403121561382557600080fd5b815161279881612bb8565b60008161383f5761383f613304565b50600019019056fe65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862addf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef307866343133306362623631323936383965633562333264623164346131373631613437396339313636a264697066735822122063a2592b6adf16588893fef8fcef1bd127f8a2f374eaefea12dd6d907556f50864736f6c634300080d0033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
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.