ERC-721
Overview
Max Total Supply
9,875 POD
Holders
1,528
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
0 PODLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
PersonalityPodERC721
Compiler Version
v0.8.7+commit.e28d00a7
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./RoyalNFT.sol"; /** * @title Personality Pod, a.k.a. AI Personality * * @notice Personality Pod replaces AI Pod in version 2 release, it doesn't * store any metadata on-chain, all the token related data except URI * (rarity, traits, etc.) is expected to be stored off-chain * * @notice Terms Personality Pod and AI Personality have identical meaning and * used interchangeably all over the code, documentation, scripts, etc. * * @dev Personality Pod is a Tiny ERC721, it supports minting and burning, * its token ID space is limited to 32 bits */ contract PersonalityPodERC721 is RoyalNFT { /** * @inheritdoc TinyERC721 */ uint256 public constant override TOKEN_UID = 0xd9b5d3b66c60255ffa16c57c0f1b2db387997fa02af673da5767f1acb0f345af; /** * @dev Constructs/deploys AI Personality instance * with the name and symbol defined during the deployment */ constructor(string memory _name, string memory _symbol) RoyalNFT(_name, _symbol) {} }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../interfaces/EIP2981Spec.sol"; import "./TinyERC721.sol"; /** * @title Royal NFT * * @dev Supports EIP-2981 royalties on NFT secondary sales * * @dev Supports OpenSea contract metadata royalties * * @dev Introduces "owner" to support OpenSea collections */ abstract contract RoyalNFT is EIP2981, TinyERC721 { /** * @dev OpenSea expects NFTs to be "Ownable", that is having an "owner", * we introduce a fake "owner" here with no authority */ address public owner; /** * @dev Constructs/deploys ERC721 with EIP-2981 instance with the name and symbol specified * * @param _name name of the token to be accessible as `name()`, * ERC-20 compatible descriptive name for a collection of NFTs in this contract * @param _symbol token symbol to be accessible as `symbol()`, * ERC-20 compatible descriptive name for a collection of NFTs in this contract */ constructor(string memory _name, string memory _symbol) TinyERC721(_name, _symbol) { // initialize the "owner" as a deployer account owner = msg.sender; } /** * @dev Fired in setContractURI() * * @param _by an address which executed update * @param _oldVal old contractURI value * @param _newVal new contractURI value */ event ContractURIUpdated(address indexed _by, string _oldVal, string _newVal); /** * @dev Fired in setRoyaltyInfo() * * @param _by an address which executed update * @param _oldReceiver old royaltyReceiver value * @param _newReceiver new royaltyReceiver value * @param _oldPercentage old royaltyPercentage value * @param _newPercentage new royaltyPercentage value */ event RoyaltyInfoUpdated( address indexed _by, address indexed _oldReceiver, address indexed _newReceiver, uint16 _oldPercentage, uint16 _newPercentage ); /** * @dev Fired in setOwner() * * @param _by an address which set the new "owner" * @param _oldVal previous "owner" address * @param _newVal new "owner" address */ event OwnerUpdated(address indexed _by, address indexed _oldVal, address indexed _newVal); /** * @notice Royalty manager is responsible for managing the EIP2981 royalty info * * @dev Role ROLE_ROYALTY_MANAGER allows updating the royalty information * (executing `setRoyaltyInfo` function) */ uint32 public constant ROLE_ROYALTY_MANAGER = 0x0020_0000; /** * @notice Owner manager is responsible for setting/updating an "owner" field * * @dev Role ROLE_OWNER_MANAGER allows updating the "owner" field * (executing `setOwner` function) */ uint32 public constant ROLE_OWNER_MANAGER = 0x0040_0000; /** * @notice Address to receive EIP-2981 royalties from secondary sales * see https://eips.ethereum.org/EIPS/eip-2981 */ address public royaltyReceiver = address(0x379e2119f6e0D6088537da82968e2a7ea178dDcF); /** * @notice Percentage of token sale price to be used for EIP-2981 royalties from secondary sales * see https://eips.ethereum.org/EIPS/eip-2981 * * @dev Has 2 decimal precision. E.g. a value of 500 would result in a 5% royalty fee */ uint16 public royaltyPercentage = 750; /** * @notice Contract level metadata to define collection name, description, and royalty fees. * see https://docs.opensea.io/docs/contract-level-metadata * * @dev Should be overwritten by inheriting contracts. By default only includes royalty information */ string public contractURI = "https://gateway.pinata.cloud/ipfs/QmU92w8iKpcaabCoyHtMg7iivWGqW2gW1hgARDtqCmJUWv"; /** * @dev Restricted access function which updates the contract uri * * @dev Requires executor to have ROLE_URI_MANAGER permission * * @param _contractURI new contract URI to set */ function setContractURI(string memory _contractURI) public { // verify the access permission require(isSenderInRole(ROLE_URI_MANAGER), "access denied"); // emit an event first - to log both old and new values emit ContractURIUpdated(msg.sender, contractURI, _contractURI); // update the contract URI contractURI = _contractURI; } /** * @notice EIP-2981 function to calculate royalties for sales in secondary marketplaces. * see https://eips.ethereum.org/EIPS/eip-2981 * * @param _tokenId the token id to calculate royalty info for * @param _salePrice the price (in any unit, .e.g wei, ERC20 token, et.c.) of the token to be sold * * @return receiver the royalty receiver * @return royaltyAmount royalty amount in the same unit as _salePrice */ function royaltyInfo( uint256 _tokenId, uint256 _salePrice ) external view override returns ( address receiver, uint256 royaltyAmount ) { // simply calculate the values and return the result return (royaltyReceiver, _salePrice * royaltyPercentage / 100_00); } /** * @dev Restricted access function which updates the royalty info * * @dev Requires executor to have ROLE_ROYALTY_MANAGER permission * * @param _royaltyReceiver new royalty receiver to set * @param _royaltyPercentage new royalty percentage to set */ function setRoyaltyInfo( address _royaltyReceiver, uint16 _royaltyPercentage ) public { // verify the access permission require(isSenderInRole(ROLE_ROYALTY_MANAGER), "access denied"); // verify royalty percentage is zero if receiver is also zero require(_royaltyReceiver != address(0) || _royaltyPercentage == 0, "invalid receiver"); // emit an event first - to log both old and new values emit RoyaltyInfoUpdated( msg.sender, royaltyReceiver, _royaltyReceiver, royaltyPercentage, _royaltyPercentage ); // update the values royaltyReceiver = _royaltyReceiver; royaltyPercentage = _royaltyPercentage; } /** * @notice Checks if the address supplied is an "owner" of the smart contract * Note: an "owner" doesn't have any authority on the smart contract and is "nominal" * * @return true if the caller is the current owner. */ function isOwner(address _addr) public view returns(bool) { // just evaluate and return the result return _addr == owner; } /** * @dev Restricted access function to set smart contract "owner" * Note: an "owner" set doesn't have any authority, and cannot even update "owner" * * @dev Requires executor to have ROLE_OWNER_MANAGER permission * * @param _owner new "owner" of the smart contract */ function transferOwnership(address _owner) public { // verify the access permission require(isSenderInRole(ROLE_OWNER_MANAGER), "access denied"); // emit an event first - to log both old and new values emit OwnerUpdated(msg.sender, owner, _owner); // update "owner" owner = _owner; } /** * @inheritdoc ERC165 */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, TinyERC721) returns (bool) { // construct the interface support from EIP-2981 and super interfaces return interfaceId == type(EIP2981).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./ERC165Spec.sol"; /// /// @dev Interface for the NFT Royalty Standard /// interface EIP2981 is ERC165 { /// ERC165 bytes to add to interface array - set in parent contract /// implementing this standard /// /// bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a /// bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a; /// _registerInterface(_INTERFACE_ID_ERC2981); /// @notice Called with the sale price to determine how much royalty // is owed and to whom. /// @param _tokenId - the NFT asset queried for royalty information /// @param _salePrice - the sale price of the NFT asset specified by _tokenId /// @return receiver - address of who should be sent the royalty payment /// @return royaltyAmount - the royalty payment amount for _salePrice function royaltyInfo( uint256 _tokenId, uint256 _salePrice ) external view returns ( address receiver, uint256 royaltyAmount ); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "../interfaces/ERC721Spec.sol"; import "../interfaces/AletheaERC721Spec.sol"; import "../lib/AddressUtils.sol"; import "../lib/ArrayUtils.sol"; import "../lib/StringUtils.sol"; import "../lib/ECDSA.sol"; import "../utils/AccessControl.sol"; /** * @title Tiny ERC721 * * @notice Tiny ERC721 defines an NFT with a very small (up to 32 bits) ID space. * ERC721 enumeration support requires additional writes to the storage: * - when transferring a token in order to update the NFT collections of * the previous and next owners, * - when minting/burning a token in order to update global NFT collection * * @notice Reducing NFT ID space to 32 bits allows * - to eliminate the need to have and to write to two additional storage mappings * (also achievable with the 48 bits ID space) * - for batch minting optimization by writing 8 tokens instead of 5 at once into * global/local collections * * @notice This smart contract is designed to be inherited by concrete implementations, * which are expected to define token metadata, auxiliary functions to access the metadata, * and explicitly define token minting interface, which should be built on top * of current smart contract internal interface * * @notice Fully ERC721-compatible with all optional interfaces implemented (metadata, enumeration), * see https://eips.ethereum.org/EIPS/eip-721 * * @dev ERC721: contract has passed adopted OpenZeppelin ERC721 tests * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/test/token/ERC721/ERC721.behavior.js * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/test/token/ERC721/extensions/ERC721URIStorage.test.js * * @dev A note on token URI: there are major differences on how token URI behaves comparing to Zeppelin impl: * 1. A token URI can be set for non-existing token for pre-allocation purposes, * still the URI will be deleted once token is burnt * 2. If token URI is set, base URI has no affect on the token URI, the two are not concatenated, * base URI is used to construct the token URI only if the latter was not explicitly set * * @dev Supports EIP-712 powered permits - permit() - approve() with signature. * Supports EIP-712 powered operator permits - permitForAll() - setApprovalForAll() with signature. * * @dev EIP712 Domain: * name: AliERC721v1 * version: not in use, omitted (name already contains version) * chainId: EIP-155 chain id * verifyingContract: deployed contract address * salt: permitNonces[owner], where owner is an address which allows operation on their tokens * * @dev Permit type: * owner: address * operator: address * tokenId: uint256 * nonce: uint256 * deadline: uint256 * * @dev Permit typeHash: * keccak256("Permit(address owner,address operator,uint256 tokenId,uint256 nonce,uint256 deadline)") * * @dev PermitForAll type: * owner: address * operator: address * approved: bool * nonce: uint256 * deadline: uint256 * * @dev PermitForAll typeHash: * keccak256("PermitForAll(address owner,address operator,bool approved,uint256 nonce,uint256 deadline)") * * @dev See https://eips.ethereum.org/EIPS/eip-712 * @dev See usage examples in tests: erc721_permits.js */ abstract contract TinyERC721 is ERC721Enumerable, ERC721Metadata, WithBaseURI, MintableERC721, BurnableERC721, AccessControl { // enable push32 optimization for uint32[] using ArrayUtils for uint32[]; /** * @dev Smart contract unique identifier, a random number * * @dev Should be regenerated each time smart contact source code is changed * and changes smart contract itself is to be redeployed * * @dev Generated using https://www.random.org/bytes/ * @dev Example value: 0xdbdd2b4ff38a8516da0b8e7ae93288b5e2fed0c92fb051cee90ccf4e4ec9736e */ function TOKEN_UID() external view virtual returns(uint256); /** * @notice ERC-20 compatible descriptive name for a collection of NFTs in this contract * * @inheritdoc ERC721Metadata */ string public override name; /** * @notice ERC-20 compatible abbreviated name for a collection of NFTs in this contract * * @inheritdoc ERC721Metadata */ string public override symbol; /** * @notice Current implementation includes a function `decimals` that returns uint8(0) * to be more compatible with ERC-20 * * @dev ERC20 compliant token decimals is equal to zero since ERC721 token is non-fungible * and therefore non-divisible */ uint8 public constant decimals = 0; /** * @notice Ownership information for all the tokens in existence * * @dev Maps `Token ID => Token ID Global Index | Token ID Local Index | Token Owner Address`, where * - Token ID Global Index denotes Token ID index in the array of all the tokens, * - Token ID Local Index denotes Token ID index in the array of all the tokens owned by the owner, * - Token ID indexes are 32 bits long, * - `|` denotes bitwise concatenation of the values * @dev Token Owner Address for a given Token ID is lower 160 bits of the mapping value */ mapping(uint256 => uint256) internal tokens; /** * @notice Enumerated collections of the tokens owned by particular owners * * @dev We call these collections "Local" token collections * * @dev Maps `Token Owner Address => Owned Token IDs Array` * * @dev Token owner balance is the length of their token collection: * `balanceOf(owner) = collections[owner].length` */ mapping(address => uint32[]) internal collections; /** * @notice An array of all the tokens in existence * * @dev We call this collection "Global" token collection * * @dev Array with all Token IDs, used for enumeration * * @dev Total token supply `tokenSupply` is the length of this collection: * `totalSupply() = allTokens.length` */ uint32[] internal allTokens; /** * @notice Addresses approved by token owners to transfer their tokens * * @dev `Maps Token ID => Approved Address`, where * Approved Address is an address allowed transfer ownership for the token * defined by Token ID */ mapping(uint256 => address) internal approvals; /** * @notice Addresses approved by token owners to transfer all their tokens * * @dev Maps `Token Owner Address => Operator Address => Approval State` - true/false (approved/not), where * - Token Owner Address is any address which may own tokens or not, * - Operator Address is any other address which may own tokens or not, * - Approval State is a flag indicating if Operator Address is allowed to * transfer tokens owned by Token Owner Address o their behalf */ mapping(address => mapping(address => bool)) internal approvedOperators; /** * @dev A record of nonces for signing/validating signatures in EIP-712 based * `permit` and `permitForAll` functions * * @dev Each time the nonce is used, it is increased by one, meaning reordering * of the EIP-712 transactions is not possible * * @dev Inspired by EIP-2612 extension for ERC20 token standard * * @dev Maps token owner address => token owner nonce */ mapping(address => uint256) public permitNonces; /** * @dev Base URI is used to construct ERC721Metadata.tokenURI as * `base URI + token ID` if token URI is not set (not present in `_tokenURIs` mapping) * * @dev For example, if base URI is https://api.com/token/, then token #1 * will have an URI https://api.com/token/1 * * @dev If token URI is set with `setTokenURI()` it will be returned as is via `tokenURI()` */ string public override baseURI = ""; /** * @dev Optional mapping for token URIs to be returned as is when `tokenURI()` * is called; if mapping doesn't exist for token, the URI is constructed * as `base URI + token ID`, where plus (+) denotes string concatenation */ mapping(uint256 => string) internal _tokenURIs; /** * @dev 32 bit token ID space is optimal for batch minting in batches of size 8 * 8 * 32 = 256 - single storage slot in global/local collection(s) */ uint8 public constant BATCH_SIZE_MULTIPLIER = 8; /** * @notice Enables ERC721 transfers of the tokens * (transfer by the token owner himself) * @dev Feature FEATURE_TRANSFERS must be enabled in order for * `transferFrom()` function to succeed when executed by token owner */ uint32 public constant FEATURE_TRANSFERS = 0x0000_0001; /** * @notice Enables ERC721 transfers on behalf * (transfer by someone else on behalf of token owner) * @dev Feature FEATURE_TRANSFERS_ON_BEHALF must be enabled in order for * `transferFrom()` function to succeed whe executed by approved operator * @dev Token owner must call `approve()` or `setApprovalForAll()` * first to authorize the transfer on behalf */ uint32 public constant FEATURE_TRANSFERS_ON_BEHALF = 0x0000_0002; /** * @notice Enables token owners to burn their own tokens * * @dev Feature FEATURE_OWN_BURNS must be enabled in order for * `burn()` function to succeed when called by token owner */ uint32 public constant FEATURE_OWN_BURNS = 0x0000_0008; /** * @notice Enables approved operators to burn tokens on behalf of their owners * * @dev Feature FEATURE_BURNS_ON_BEHALF must be enabled in order for * `burn()` function to succeed when called by approved operator */ uint32 public constant FEATURE_BURNS_ON_BEHALF = 0x0000_0010; /** * @notice Enables approvals on behalf (permits via an EIP712 signature) * @dev Feature FEATURE_PERMITS must be enabled in order for * `permit()` function to succeed */ uint32 public constant FEATURE_PERMITS = 0x0000_0200; /** * @notice Enables operator approvals on behalf (permits for all via an EIP712 signature) * @dev Feature FEATURE_OPERATOR_PERMITS must be enabled in order for * `permitForAll()` function to succeed */ uint32 public constant FEATURE_OPERATOR_PERMITS = 0x0000_0400; /** * @notice Token creator is responsible for creating (minting) * tokens to an arbitrary address * @dev Role ROLE_TOKEN_CREATOR allows minting tokens * (calling `mint` function) */ uint32 public constant ROLE_TOKEN_CREATOR = 0x0001_0000; /** * @notice Token destroyer is responsible for destroying (burning) * tokens owned by an arbitrary address * @dev Role ROLE_TOKEN_DESTROYER allows burning tokens * (calling `burn` function) */ uint32 public constant ROLE_TOKEN_DESTROYER = 0x0002_0000; /** * @notice URI manager is responsible for managing base URI * part of the token URI ERC721Metadata interface * * @dev Role ROLE_URI_MANAGER allows updating the base URI * (executing `setBaseURI` function) */ uint32 public constant ROLE_URI_MANAGER = 0x0010_0000; /** * @notice EIP-712 contract's domain typeHash, * see https://eips.ethereum.org/EIPS/eip-712#rationale-for-typehash * * @dev Note: we do not include version into the domain typehash/separator, * it is implied version is concatenated to the name field, like "AliERC721v1" */ // keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)") bytes32 public constant DOMAIN_TYPEHASH = 0x8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866; /** * @notice EIP-712 contract's domain separator, * see https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator */ bytes32 public immutable DOMAIN_SEPARATOR; /** * @notice EIP-712 permit (EIP-2612) struct typeHash, * see https://eips.ethereum.org/EIPS/eip-712#rationale-for-typehash */ // keccak256("Permit(address owner,address operator,uint256 tokenId,uint256 nonce,uint256 deadline)") bytes32 public constant PERMIT_TYPEHASH = 0xee2282d7affd5a432b221a559e429129347b0c19a3f102179a5fb1859eef3d29; /** * @notice EIP-712 permitForAll (EIP-2612) struct typeHash, * see https://eips.ethereum.org/EIPS/eip-712#rationale-for-typehash */ // keccak256("PermitForAll(address owner,address operator,bool approved,uint256 nonce,uint256 deadline)") bytes32 public constant PERMIT_FOR_ALL_TYPEHASH = 0x47ab88482c90e4bb94b82a947ae78fa91fb25de1469ab491f4c15b9a0a2677ee; /** * @dev Fired in setBaseURI() * * @param _by an address which executed update * @param _oldVal old _baseURI value * @param _newVal new _baseURI value */ event BaseURIUpdated(address indexed _by, string _oldVal, string _newVal); /** * @dev Fired in setTokenURI() * * @param _by an address which executed update * @param _tokenId token ID which URI was updated * @param _oldVal old _baseURI value * @param _newVal new _baseURI value */ event TokenURIUpdated(address indexed _by, uint256 _tokenId, string _oldVal, string _newVal); /** * @dev Constructs/deploys ERC721 instance with the name and symbol specified * * @param _name name of the token to be accessible as `name()`, * ERC-20 compatible descriptive name for a collection of NFTs in this contract * @param _symbol token symbol to be accessible as `symbol()`, * ERC-20 compatible descriptive name for a collection of NFTs in this contract */ constructor(string memory _name, string memory _symbol) { // set the name name = _name; // set the symbol symbol = _symbol; // build the EIP-712 contract domain separator, see https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator // note: we specify contract version in its name DOMAIN_SEPARATOR = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes("AliERC721v1")), block.chainid, address(this))); } /** * @dev Verifies if token is transferable (i.e. can change ownership, allowed to be transferred); * The default behaviour is to always allow transfer if token exists * * @dev Implementations may modify the default behaviour based on token metadata * if required * * @param _tokenId ID of the token to check if it's transferable * @return true if token is transferable, false otherwise */ function isTransferable(uint256 _tokenId) public view virtual returns(bool) { // validate token existence require(exists(_tokenId), "token doesn't exist"); // generic implementation returns true if token exists return true; } /** * @notice Checks if specified token exists * * @dev Returns whether the specified token ID has an ownership * information associated with it * * @inheritdoc MintableERC721 * * @param _tokenId ID of the token to query existence for * @return whether the token exists (true - exists, false - doesn't exist) */ function exists(uint256 _tokenId) public override view returns(bool) { // read ownership information and return a check if it's not zero (set) return tokens[_tokenId] != 0; } /** * @inheritdoc ERC165 */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // construct the interface support from required and optional ERC721 interfaces return interfaceId == type(ERC165).interfaceId || interfaceId == type(ERC721).interfaceId || interfaceId == type(ERC721Metadata).interfaceId || interfaceId == type(ERC721Enumerable).interfaceId || interfaceId == type(MintableERC721).interfaceId || interfaceId == type(BurnableERC721).interfaceId; } // ===== Start: ERC721 Metadata ===== /** * @dev Restricted access function which updates base URI used to construct * ERC721Metadata.tokenURI * * @dev Requires executor to have ROLE_URI_MANAGER permission * * @param _baseURI new base URI to set */ function setBaseURI(string memory _baseURI) public virtual { // verify the access permission require(isSenderInRole(ROLE_URI_MANAGER), "access denied"); // emit an event first - to log both old and new values emit BaseURIUpdated(msg.sender, baseURI, _baseURI); // and update base URI baseURI = _baseURI; } /** * @dev Returns token URI if it was previously set with `setTokenURI`, * otherwise constructs it as base URI + token ID * * @inheritdoc ERC721Metadata */ function tokenURI(uint256 _tokenId) public view override returns (string memory) { // verify token exists require(exists(_tokenId), "token doesn't exist"); // read the token URI for the token specified string memory _tokenURI = _tokenURIs[_tokenId]; // if token URI is set if(bytes(_tokenURI).length > 0) { // just return it return _tokenURI; } // if base URI is not set if(bytes(baseURI).length == 0) { // return an empty string return ""; } // otherwise concatenate base URI + token ID return StringUtils.concat(baseURI, StringUtils.itoa(_tokenId, 10)); } /** * @dev Sets the token URI for the token defined by its ID * * @param _tokenId an ID of the token to set URI for * @param _tokenURI token URI to set */ function setTokenURI(uint256 _tokenId, string memory _tokenURI) public virtual { // verify the access permission require(isSenderInRole(ROLE_URI_MANAGER), "access denied"); // we do not verify token existence: we want to be able to // preallocate token URIs before tokens are actually minted // emit an event first - to log both old and new values emit TokenURIUpdated(msg.sender, _tokenId, _tokenURIs[_tokenId], _tokenURI); // and update token URI _tokenURIs[_tokenId] = _tokenURI; } // ===== End: ERC721 Metadata ===== // ===== Start: ERC721, ERC721Enumerable Getters (view functions) ===== /** * @inheritdoc ERC721 */ function balanceOf(address _owner) public view override returns (uint256) { // check `_owner` address is set require(_owner != address(0), "zero address"); // derive owner balance for the their owned tokens collection // as the length of that collection return collections[_owner].length; } /** * @inheritdoc ERC721 */ function ownerOf(uint256 _tokenId) public view override returns (address) { // derive ownership information of the token from the ownership mapping // by extracting lower 160 bits of the mapping value as an address address owner = address(uint160(tokens[_tokenId])); // verify owner/token exists require(owner != address(0), "token doesn't exist"); // return owner address return owner; } /** * @inheritdoc ERC721Enumerable */ function totalSupply() public view override returns (uint256) { // derive total supply value from the array of all existing tokens // as the length of this array return allTokens.length; } /** * @inheritdoc ERC721Enumerable */ function tokenByIndex(uint256 _index) public view override returns (uint256) { // index out of bounds check require(_index < totalSupply(), "index out of bounds"); // find the token ID requested and return return allTokens[_index]; } /** * @inheritdoc ERC721Enumerable */ function tokenOfOwnerByIndex(address _owner, uint256 _index) public view override returns (uint256) { // index out of bounds check require(_index < balanceOf(_owner), "index out of bounds"); // find the token ID requested and return return collections[_owner][_index]; } /** * @inheritdoc ERC721 */ function getApproved(uint256 _tokenId) public view override returns (address) { // verify token specified exists require(exists(_tokenId), "token doesn't exist"); // read the approval value and return return approvals[_tokenId]; } /** * @inheritdoc ERC721 */ function isApprovedForAll(address _owner, address _operator) public view override returns (bool) { // read the approval state value and return return approvedOperators[_owner][_operator]; } // ===== End: ERC721, ERC721Enumerable Getters (view functions) ===== // ===== Start: ERC721 mutative functions (transfers, approvals) ===== /** * @inheritdoc ERC721 */ function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes memory _data) public override { // delegate call to unsafe transfer on behalf `transferFrom()` transferFrom(_from, _to, _tokenId); // if receiver `_to` is a smart contract if(AddressUtils.isContract(_to)) { // check it supports ERC721 interface - execute onERC721Received() bytes4 response = ERC721TokenReceiver(_to).onERC721Received(msg.sender, _from, _tokenId, _data); // expected response is ERC721TokenReceiver(_to).onERC721Received.selector // bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")) require(response == ERC721TokenReceiver(_to).onERC721Received.selector, "invalid onERC721Received response"); } } /** * @inheritdoc ERC721 */ function safeTransferFrom(address _from, address _to, uint256 _tokenId) public override { // delegate call to overloaded `safeTransferFrom()`, set data to "" safeTransferFrom(_from, _to, _tokenId, ""); } /** * @inheritdoc ERC721 */ function transferFrom(address _from, address _to, uint256 _tokenId) public override { // if `_from` is equal to sender, require transfers feature to be enabled // otherwise require transfers on behalf feature to be enabled require(_from == msg.sender && isFeatureEnabled(FEATURE_TRANSFERS) || _from != msg.sender && isFeatureEnabled(FEATURE_TRANSFERS_ON_BEHALF), _from == msg.sender? "transfers are disabled": "transfers on behalf are disabled"); // validate destination address is set require(_to != address(0), "zero address"); // validate token ownership, which also // validates token existence under the hood require(_from == ownerOf(_tokenId), "access denied"); // verify operator (transaction sender) is either token owner, // or is approved by the token owner to transfer this particular token, // or is approved by the token owner to transfer any of his tokens require(_from == msg.sender || msg.sender == getApproved(_tokenId) || isApprovedForAll(_from, msg.sender), "access denied"); // transfer is not allowed for a locked token require(isTransferable(_tokenId), "locked token"); // if required, move token ownership, // update old and new owner's token collections accordingly: if(_from != _to) { // remove token from old owner's collection (also clears approval) __removeLocal(_tokenId); // add token to the new owner's collection __addLocal(_tokenId, _to); } // even if no real changes are required, approval needs to be erased else { // clear token approval (also emits an Approval event) __clearApproval(_from, _tokenId); } // fire ERC721 transfer event emit Transfer(_from, _to, _tokenId); } /** * @inheritdoc ERC721 */ function approve(address _approved, uint256 _tokenId) public override { // make an internal approve - delegate to `__approve` __approve(msg.sender, _approved, _tokenId); } /** * @dev Powers the meta transaction for `approve` - EIP-712 signed `permit` * * @dev Approves address called `_operator` to transfer token `_tokenId` * on behalf of the `_owner` * * @dev Zero `_operator` address indicates there is no approved address, * and effectively removes an approval for the token specified * * @dev `_owner` must own token `_tokenId` to grant the permission * @dev Throws if `_operator` is a self address (`_owner`), * or if `_tokenId` doesn't exist * * @param _owner owner of the token `_tokenId` to set approval on behalf of * @param _operator an address approved by the token owner * to spend token `_tokenId` on its behalf * @param _tokenId token ID operator `_approved` is allowed to * transfer on behalf of the token owner */ function __approve(address _owner, address _operator, uint256 _tokenId) private { // get token owner address address owner = ownerOf(_tokenId); // approving owner address itself doesn't make sense and is not allowed require(_operator != owner, "self approval"); // only token owner or/and approved operator can set the approval require(_owner == owner || isApprovedForAll(owner, _owner), "access denied"); // update the approval approvals[_tokenId] = _operator; // emit an event emit Approval(owner, _operator, _tokenId); } /** * @inheritdoc ERC721 */ function setApprovalForAll(address _operator, bool _approved) public override { // make an internal approve - delegate to `__approveForAll` __approveForAll(msg.sender, _operator, _approved); } /** * @dev Powers the meta transaction for `setApprovalForAll` - EIP-712 signed `permitForAll` * * @dev Approves address called `_operator` to transfer any tokens * on behalf of the `_owner` * * @dev `_owner` must not necessarily own any tokens to grant the permission * @dev Throws if `_operator` is a self address (`_owner`) * * @param _owner owner of the tokens to set approval on behalf of * @param _operator an address to add to the set of authorized operators, i.e. * an address approved by the token owner to spend tokens on its behalf * @param _approved true if the operator is approved, false to revoke approval */ function __approveForAll(address _owner, address _operator, bool _approved) private { // approving tx sender address itself doesn't make sense and is not allowed require(_operator != _owner, "self approval"); // update the approval approvedOperators[_owner][_operator] = _approved; // emit an event emit ApprovalForAll(_owner, _operator, _approved); } /** * @dev Clears approval for a given token owned by a given owner, * emits an Approval event * * @dev Unsafe: doesn't check the validity of inputs (must be kept private), * assuming the check is done by the caller * - token existence * - token ownership * * @param _owner token owner to be logged into Approved event as is * @param _tokenId token ID to erase approval for and to log into Approved event as is */ function __clearApproval(address _owner, uint256 _tokenId) internal { // clear token approval delete approvals[_tokenId]; // emit an ERC721 Approval event: // "When a Transfer event emits, this also indicates that the approved // address for that NFT (if any) is reset to none." emit Approval(_owner, address(0), _tokenId); } // ===== End: ERC721 mutative functions (transfers, approvals) ===== // ===== Start: Meta-transactions Support ===== /** * @notice Change or reaffirm the approved address for an NFT on behalf * * @dev Executes approve(_operator, _tokenId) on behalf of the token owner * who EIP-712 signed the transaction, i.e. as if transaction sender is the EIP712 signer * * @dev Sets the `_tokenId` as the allowance of `_operator` over `_owner` token, * given `_owner` EIP-712 signed approval * * @dev Emits `Approval` event in the same way as `approve` does * * @dev Requires: * - `_operator` to be non-zero address * - `_exp` to be a timestamp in the future * - `v`, `r` and `s` to be a valid `secp256k1` signature from `_owner` * over the EIP712-formatted function arguments. * - the signature to use `_owner` current nonce (see `permitNonces`). * * @dev For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification * * @param _owner owner of the token to set approval on behalf of, * an address which signed the EIP-712 message * @param _operator new approved NFT controller * @param _tokenId token ID to approve * @param _exp signature expiration time (unix timestamp) * @param v the recovery byte of the signature * @param r half of the ECDSA signature pair * @param s half of the ECDSA signature pair */ function permit(address _owner, address _operator, uint256 _tokenId, uint256 _exp, uint8 v, bytes32 r, bytes32 s) public { // verify permits are enabled require(isFeatureEnabled(FEATURE_PERMITS), "permits are disabled"); // derive signer of the EIP712 Permit message, and // update the nonce for that particular signer to avoid replay attack!!! ----------->>> ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ address signer = __deriveSigner(abi.encode(PERMIT_TYPEHASH, _owner, _operator, _tokenId, permitNonces[_owner]++, _exp), v, r, s); // perform message integrity and security validations require(signer == _owner, "invalid signature"); require(block.timestamp < _exp, "signature expired"); // delegate call to `__approve` - execute the logic required __approve(_owner, _operator, _tokenId); } /** * @notice Enable or disable approval for a third party ("operator") to manage * all of owner's assets - on behalf * * @dev Executes setApprovalForAll(_operator, _approved) on behalf of the owner * who EIP-712 signed the transaction, i.e. as if transaction sender is the EIP712 signer * * @dev Sets the `_operator` as the token operator for `_owner` tokens, * given `_owner` EIP-712 signed approval * * @dev Emits `ApprovalForAll` event in the same way as `setApprovalForAll` does * * @dev Requires: * - `_operator` to be non-zero address * - `_exp` to be a timestamp in the future * - `v`, `r` and `s` to be a valid `secp256k1` signature from `_owner` * over the EIP712-formatted function arguments. * - the signature to use `_owner` current nonce (see `permitNonces`). * * @dev For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification * * @param _owner owner of the tokens to set approval on behalf of, * an address which signed the EIP-712 message * @param _operator an address to add to the set of authorized operators, i.e. * an address approved by the token owner to spend tokens on its behalf * @param _approved true if the operator is approved, false to revoke approval * @param _exp signature expiration time (unix timestamp) * @param v the recovery byte of the signature * @param r half of the ECDSA signature pair * @param s half of the ECDSA signature pair */ function permitForAll(address _owner, address _operator, bool _approved, uint256 _exp, uint8 v, bytes32 r, bytes32 s) public { // verify permits are enabled require(isFeatureEnabled(FEATURE_OPERATOR_PERMITS), "operator permits are disabled"); // derive signer of the EIP712 PermitForAll message, and // update the nonce for that particular signer to avoid replay attack!!! --------------------->>> ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ address signer = __deriveSigner(abi.encode(PERMIT_FOR_ALL_TYPEHASH, _owner, _operator, _approved, permitNonces[_owner]++, _exp), v, r, s); // perform message integrity and security validations require(signer == _owner, "invalid signature"); require(block.timestamp < _exp, "signature expired"); // delegate call to `__approve` - execute the logic required __approveForAll(_owner, _operator, _approved); } /** * @dev Auxiliary function to verify structured EIP712 message signature and derive its signer * * @param abiEncodedTypehash abi.encode of the message typehash together with all its parameters * @param v the recovery byte of the signature * @param r half of the ECDSA signature pair * @param s half of the ECDSA signature pair */ function __deriveSigner(bytes memory abiEncodedTypehash, uint8 v, bytes32 r, bytes32 s) private view returns(address) { // build the EIP-712 hashStruct of the message bytes32 hashStruct = keccak256(abiEncodedTypehash); // calculate the EIP-712 digest "\x19\x01" ‖ domainSeparator ‖ hashStruct(message) bytes32 digest = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, hashStruct)); // recover the address which signed the message with v, r, s address signer = ECDSA.recover(digest, v, r, s); // return the signer address derived from the signature return signer; } // ===== End: Meta-transactions Support ===== // ===== Start: mint/burn support ===== /** * @dev Creates new token with token ID specified * and assigns an ownership `_to` for this token * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Requires executor to have `ROLE_TOKEN_CREATOR` permission * * @param _to an address to mint token to * @param _tokenId ID of the token to mint * @param _data additional data with no specified format, sent in call to `_to` */ function safeMint(address _to, uint256 _tokenId, bytes memory _data) public override { // delegate to unsafe mint mint(_to, _tokenId); // make it safe: execute `onERC721Received` // if receiver `_to` is a smart contract if(AddressUtils.isContract(_to)) { // check it supports ERC721 interface - execute onERC721Received() bytes4 response = ERC721TokenReceiver(_to).onERC721Received(msg.sender, address(0), _tokenId, _data); // expected response is ERC721TokenReceiver(_to).onERC721Received.selector // bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")) require(response == ERC721TokenReceiver(_to).onERC721Received.selector, "invalid onERC721Received response"); } } /** * @dev Creates new token with token ID specified * and assigns an ownership `_to` for this token * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Requires executor to have `ROLE_TOKEN_CREATOR` permission * * @param _to an address to mint token to * @param _tokenId ID of the token to mint */ function safeMint(address _to, uint256 _tokenId) public override { // delegate to `safeMint` with empty data safeMint(_to, _tokenId, ""); } /** * @dev Creates new tokens starting with token ID specified * and assigns an ownership `_to` for these tokens * * @dev Token IDs to be minted: [_tokenId, _tokenId + n) * * @dev n must be greater or equal 2: `n > 1` * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Requires executor to have `ROLE_TOKEN_CREATOR` permission * * @param _to an address to mint token to * @param _tokenId ID of the token to mint * @param n how many tokens to mint, sequentially increasing the _tokenId * @param _data additional data with no specified format, sent in call to `_to` */ function safeMintBatch(address _to, uint256 _tokenId, uint256 n, bytes memory _data) public override { // delegate to unsafe mint mintBatch(_to, _tokenId, n); // make it safe: execute `onERC721Received` // if receiver `_to` is a smart contract if(AddressUtils.isContract(_to)) { // onERC721Received: for each token minted for(uint256 i = 0; i < n; i++) { // check it supports ERC721 interface - execute onERC721Received() bytes4 response = ERC721TokenReceiver(_to).onERC721Received(msg.sender, address(0), _tokenId + i, _data); // expected response is ERC721TokenReceiver(_to).onERC721Received.selector // bytes4(keccak256("onERC721Received(address,address,uint256,bytes)")) require(response == ERC721TokenReceiver(_to).onERC721Received.selector, "invalid onERC721Received response"); } } } /** * @dev Creates new tokens starting with token ID specified * and assigns an ownership `_to` for these tokens * * @dev Token IDs to be minted: [_tokenId, _tokenId + n) * * @dev n must be greater or equal 2: `n > 1` * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Requires executor to have `ROLE_TOKEN_CREATOR` permission * * @param _to an address to mint token to * @param _tokenId ID of the token to mint * @param n how many tokens to mint, sequentially increasing the _tokenId */ function safeMintBatch(address _to, uint256 _tokenId, uint256 n) public override { // delegate to `safeMint` with empty data safeMintBatch(_to, _tokenId, n, ""); } /** * @dev Creates new token with token ID specified * and assigns an ownership `_to` for this token * * @dev Unsafe: doesn't execute `onERC721Received` on the receiver. * Prefer the use of `saveMint` instead of `mint`. * * @dev Requires executor to have `ROLE_TOKEN_CREATOR` permission * * @param _to an address to mint token to * @param _tokenId ID of the token to mint */ function mint(address _to, uint256 _tokenId) public override { // check if caller has sufficient permissions to mint tokens require(isSenderInRole(ROLE_TOKEN_CREATOR), "access denied"); // verify the inputs // verify destination address is set require(_to != address(0), "zero address"); // verify the token ID is "tiny" (32 bits long at most) require(uint32(_tokenId) == _tokenId, "token ID overflow"); // verify token doesn't yet exist require(!exists(_tokenId), "already minted"); // create token ownership record, // add token to `allTokens` and new owner's collections // add token to both local and global collections (enumerations) __addToken(_tokenId, _to); // fire ERC721 transfer event emit Transfer(address(0), _to, _tokenId); } /** * @dev Creates new tokens starting with token ID specified * and assigns an ownership `_to` for these tokens * * @dev Token IDs to be minted: [_tokenId, _tokenId + n) * * @dev n must be greater or equal 2: `n > 1` * * @dev Unsafe: doesn't execute `onERC721Received` on the receiver. * Prefer the use of `saveMintBatch` instead of `mintBatch`. * * @dev Requires executor to have `ROLE_TOKEN_CREATOR` permission * * @param _to an address to mint tokens to * @param _tokenId ID of the first token to mint * @param n how many tokens to mint, sequentially increasing the _tokenId */ function mintBatch(address _to, uint256 _tokenId, uint256 n) public override { // check if caller has sufficient permissions to mint tokens require(isSenderInRole(ROLE_TOKEN_CREATOR), "access denied"); // verify the inputs // verify destination address is set require(_to != address(0), "zero address"); // verify n is set properly require(n > 1, "n is too small"); // verify the token ID is "tiny" (32 bits long at most) require(uint32(_tokenId) == _tokenId, "token ID overflow"); require(uint32(_tokenId + n - 1) == _tokenId + n - 1, "n-th token ID overflow"); // verification: for each token to be minted for(uint256 i = 0; i < n; i++) { // verify token doesn't yet exist require(!exists(_tokenId + i), "already minted"); } // create token ownership records, // add tokens to `allTokens` and new owner's collections // add tokens to both local and global collections (enumerations) __addTokens(_to, _tokenId, n); // events: for each token minted for(uint256 i = 0; i < n; i++) { // fire ERC721 transfer event emit Transfer(address(0), _to, _tokenId + i); } } /** * @dev Destroys the token with token ID specified * * @dev Requires executor to have `ROLE_TOKEN_DESTROYER` permission * or FEATURE_OWN_BURNS/FEATURE_BURNS_ON_BEHALF features to be enabled * * @dev Can be disabled by the contract creator forever by disabling * FEATURE_OWN_BURNS/FEATURE_BURNS_ON_BEHALF features and then revoking * its own roles to burn tokens and to enable burning features * * @param _tokenId ID of the token to burn */ function burn(uint256 _tokenId) public override { // read token owner data // verifies token exists under the hood address _from = ownerOf(_tokenId); // check if caller has sufficient permissions to burn tokens // and if not - check for possibility to burn own tokens or to burn on behalf if(!isSenderInRole(ROLE_TOKEN_DESTROYER)) { // if `_from` is equal to sender, require own burns feature to be enabled // otherwise require burns on behalf feature to be enabled require(_from == msg.sender && isFeatureEnabled(FEATURE_OWN_BURNS) || _from != msg.sender && isFeatureEnabled(FEATURE_BURNS_ON_BEHALF), _from == msg.sender? "burns are disabled": "burns on behalf are disabled"); // verify sender is either token owner, or approved by the token owner to burn tokens require(_from == msg.sender || msg.sender == getApproved(_tokenId) || isApprovedForAll(_from, msg.sender), "access denied"); } // remove token ownership record (also clears approval), // remove token from both local and global collections __removeToken(_tokenId); // delete token URI mapping delete _tokenURIs[_tokenId]; // fire ERC721 transfer event emit Transfer(_from, address(0), _tokenId); } // ===== End: mint/burn support ===== // ----- Start: auxiliary internal/private functions ----- /** * @dev Adds token to the new owner's collection (local), * used internally to transfer existing tokens, to mint new * * @dev Unsafe: doesn't check for data structures consistency * (token existence, token ownership, etc.) * * @dev Must be kept private at all times. Inheriting smart contracts * may be interested in overriding this function. * * @param _tokenId token ID to add * @param _to new owner address to add token to */ function __addLocal(uint256 _tokenId, address _to) internal virtual { // get a reference to the collection where token goes to uint32[] storage destination = collections[_to]; // update local index and ownership, do not change global index tokens[_tokenId] = tokens[_tokenId] // |unused |global | local | ownership information (address) | & 0x00000000FFFFFFFF000000000000000000000000000000000000000000000000 | uint192(destination.length) << 160 | uint160(_to); // push token into the local collection destination.push(uint32(_tokenId)); } /** * @dev Add token to both local and global collections (enumerations), * used internally to mint new tokens * * @dev Unsafe: doesn't check for data structures consistency * (token existence, token ownership, etc.) * * @dev Must be kept private at all times. Inheriting smart contracts * may be interested in overriding this function. * * @param _tokenId token ID to add * @param _to new owner address to add token to */ function __addToken(uint256 _tokenId, address _to) internal virtual { // get a reference to the collection where token goes to uint32[] storage destination = collections[_to]; // update token global and local indexes, ownership tokens[_tokenId] = uint224(allTokens.length) << 192 | uint192(destination.length) << 160 | uint160(_to); // push token into the collection destination.push(uint32(_tokenId)); // push it into the global `allTokens` collection (enumeration) allTokens.push(uint32(_tokenId)); } /** * @dev Add tokens to both local and global collections (enumerations), * used internally to mint new tokens in batches * * @dev Token IDs to be added: [_tokenId, _tokenId + n) * n is expected to be greater or equal 2, but this is not checked * * @dev Unsafe: doesn't check for data structures consistency * (token existence, token ownership, etc.) * * @dev Must be kept private at all times. Inheriting smart contracts * may be interested in overriding this function. * * @param _to new owner address to add token to * @param _tokenId first token ID to add * @param n how many tokens to add, sequentially increasing the _tokenId */ function __addTokens(address _to, uint256 _tokenId, uint256 n) internal virtual { // get a reference to the collection where tokens go to uint32[] storage destination = collections[_to]; // for each token to be added for(uint256 i = 0; i < n; i++) { // update token global and local indexes, ownership tokens[_tokenId + i] = uint224(allTokens.length + i) << 192 | uint192(destination.length + i) << 160 | uint160(_to); } // push tokens into the local collection destination.push32(uint32(_tokenId), uint32(n)); // push tokens into the global `allTokens` collection (enumeration) allTokens.push32(uint32(_tokenId), uint32(n)); } /** * @dev Removes token from owner's local collection, * used internally to transfer or burn existing tokens * * @dev Unsafe: doesn't check for data structures consistency * (token existence, token ownership, etc.) * * @dev Must be kept private at all times. Inheriting smart contracts * may be interested in overriding this function. * * @param _tokenId token ID to remove */ function __removeLocal(uint256 _tokenId) internal virtual { // read token data, containing global and local indexes, owner address uint256 token = tokens[_tokenId]; // get a reference to the token's owner collection (local) uint32[] storage source = collections[address(uint160(token))]; // token index within the collection uint32 i = uint32(token >> 160); // get an ID of the last token in the collection uint32 sourceId = source[source.length - 1]; // if the token we're to remove from the collection is not the last one, // we need to move last token in the collection into index `i` if(i != source.length - 1) { // we put the last token in the collection to the position released // update last token local index to point to proper place in the collection // preserve global index and ownership info tokens[sourceId] = tokens[sourceId] // |unused |global | local | ownership information (address) | & 0x00000000FFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | uint192(i) << 160; // put it into the position `i` within the collection source[i] = sourceId; } // trim the collection by removing last element source.pop(); // clear token approval (also emits an Approval event) __clearApproval(address(uint160(token)), _tokenId); } /** * @dev Removes token from both local and global collections (enumerations), * used internally to burn existing tokens * * @dev Unsafe: doesn't check for data structures consistency * (token existence, token ownership, etc.) * * @dev Must be kept private at all times. Inheriting smart contracts * may be interested in overriding this function. * * @param _tokenId token ID to remove */ function __removeToken(uint256 _tokenId) internal virtual { // remove token from owner's (local) collection first __removeLocal(_tokenId); // token index within the global collection uint32 i = uint32(tokens[_tokenId] >> 192); // delete the token delete tokens[_tokenId]; // get an ID of the last token in the collection uint32 lastId = allTokens[allTokens.length - 1]; // if the token we're to remove from the collection is not the last one, // we need to move last token in the collection into index `i` if(i != allTokens.length - 1) { // we put the last token in the collection to the position released // update last token global index to point to proper place in the collection // preserve local index and ownership info tokens[lastId] = tokens[lastId] // |unused |global | local | ownership information (address) | & 0x0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF | uint224(i) << 192; // put it into the position `i` within the collection allTokens[i] = lastId; } // trim the collection by removing last element allTokens.pop(); } // ----- End: auxiliary internal/private functions ----- }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @title ERC-165 Standard Interface Detection * * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * @dev Implementers can declare support of contract interfaces, * which can then be queried by others. * * @author Christian Reitwießner, Nick Johnson, Fabian Vogelsteller, Jordi Baylina, Konrad Feldmeier, William Entriken */ interface ERC165 { /** * @notice Query if a contract implements an interface * * @dev Interface identification is specified in ERC-165. * This function uses less than 30,000 gas. * * @param interfaceID The interface identifier, as specified in ERC-165 * @return `true` if the contract implements `interfaceID` and * `interfaceID` is not 0xffffffff, `false` otherwise */ function supportsInterface(bytes4 interfaceID) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; import "./ERC165Spec.sol"; /** * @title ERC-721 Non-Fungible Token Standard * * @notice See https://eips.ethereum.org/EIPS/eip-721 * * @dev Solidity issue #3412: The ERC721 interfaces include explicit mutability guarantees for each function. * Mutability guarantees are, in order weak to strong: payable, implicit nonpayable, view, and pure. * Implementation MUST meet the mutability guarantee in this interface and MAY meet a stronger guarantee. * For example, a payable function in this interface may be implemented as nonpayable * (no state mutability specified) in implementing contract. * It is expected a later Solidity release will allow stricter contract to inherit from this interface, * but current workaround is that we edit this interface to add stricter mutability before inheriting: * we have removed all "payable" modifiers. * * @dev The ERC-165 identifier for this interface is 0x80ac58cd. * * @author William Entriken, Dieter Shirley, Jacob Evans, Nastassia Sachs */ interface ERC721 is ERC165 { /// @dev This emits when ownership of any NFT changes by any mechanism. /// This event emits when NFTs are created (`from` == 0) and destroyed /// (`to` == 0). Exception: during contract creation, any number of NFTs /// may be created and assigned without emitting Transfer. At the time of /// any transfer, the approved address for that NFT (if any) is reset to none. event Transfer(address indexed _from, address indexed _to, uint256 indexed _tokenId); /// @dev This emits when the approved address for an NFT is changed or /// reaffirmed. The zero address indicates there is no approved address. /// When a Transfer event emits, this also indicates that the approved /// address for that NFT (if any) is reset to none. event Approval(address indexed _owner, address indexed _approved, uint256 indexed _tokenId); /// @dev This emits when an operator is enabled or disabled for an owner. /// The operator can manage all NFTs of the owner. event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved); /// @notice Count all NFTs assigned to an owner /// @dev NFTs assigned to the zero address are considered invalid, and this /// function throws for queries about the zero address. /// @param _owner An address for whom to query the balance /// @return The number of NFTs owned by `_owner`, possibly zero function balanceOf(address _owner) external view returns (uint256); /// @notice Find the owner of an NFT /// @dev NFTs assigned to zero address are considered invalid, and queries /// about them do throw. /// @param _tokenId The identifier for an NFT /// @return The address of the owner of the NFT function ownerOf(uint256 _tokenId) external view returns (address); /// @notice Transfers the ownership of an NFT from one address to another address /// @dev Throws unless `msg.sender` is the current owner, an authorized /// operator, or the approved address for this NFT. Throws if `_from` is /// not the current owner. Throws if `_to` is the zero address. Throws if /// `_tokenId` is not a valid NFT. When transfer is complete, this function /// checks if `_to` is a smart contract (code size > 0). If so, it calls /// `onERC721Received` on `_to` and throws if the return value is not /// `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. /// @param _from The current owner of the NFT /// @param _to The new owner /// @param _tokenId The NFT to transfer /// @param _data Additional data with no specified format, sent in call to `_to` function safeTransferFrom(address _from, address _to, uint256 _tokenId, bytes calldata _data) external /*payable*/; /// @notice Transfers the ownership of an NFT from one address to another address /// @dev This works identically to the other function with an extra data parameter, /// except this function just sets data to "". /// @param _from The current owner of the NFT /// @param _to The new owner /// @param _tokenId The NFT to transfer function safeTransferFrom(address _from, address _to, uint256 _tokenId) external /*payable*/; /// @notice Transfer ownership of an NFT -- THE CALLER IS RESPONSIBLE /// TO CONFIRM THAT `_to` IS CAPABLE OF RECEIVING NFTS OR ELSE /// THEY MAY BE PERMANENTLY LOST /// @dev Throws unless `msg.sender` is the current owner, an authorized /// operator, or the approved address for this NFT. Throws if `_from` is /// not the current owner. Throws if `_to` is the zero address. Throws if /// `_tokenId` is not a valid NFT. /// @param _from The current owner of the NFT /// @param _to The new owner /// @param _tokenId The NFT to transfer function transferFrom(address _from, address _to, uint256 _tokenId) external /*payable*/; /// @notice Change or reaffirm the approved address for an NFT /// @dev The zero address indicates there is no approved address. /// Throws unless `msg.sender` is the current NFT owner, or an authorized /// operator of the current owner. /// @param _approved The new approved NFT controller /// @param _tokenId The NFT to approve function approve(address _approved, uint256 _tokenId) external /*payable*/; /// @notice Enable or disable approval for a third party ("operator") to manage /// all of `msg.sender`'s assets /// @dev Emits the ApprovalForAll event. The contract MUST allow /// multiple operators per owner. /// @param _operator Address to add to the set of authorized operators /// @param _approved True if the operator is approved, false to revoke approval function setApprovalForAll(address _operator, bool _approved) external; /// @notice Get the approved address for a single NFT /// @dev Throws if `_tokenId` is not a valid NFT. /// @param _tokenId The NFT to find the approved address for /// @return The approved address for this NFT, or the zero address if there is none function getApproved(uint256 _tokenId) external view returns (address); /// @notice Query if an address is an authorized operator for another address /// @param _owner The address that owns the NFTs /// @param _operator The address that acts on behalf of the owner /// @return True if `_operator` is an approved operator for `_owner`, false otherwise function isApprovedForAll(address _owner, address _operator) external view returns (bool); } /// @dev Note: the ERC-165 identifier for this interface is 0x150b7a02. interface ERC721TokenReceiver { /// @notice Handle the receipt of an NFT /// @dev The ERC721 smart contract calls this function on the recipient /// after a `transfer`. This function MAY throw to revert and reject the /// transfer. Return of other than the magic value MUST result in the /// transaction being reverted. /// Note: the contract address is always the message sender. /// @param _operator The address which called `safeTransferFrom` function /// @param _from The address which previously owned the token /// @param _tokenId The NFT identifier which is being transferred /// @param _data Additional data with no specified format /// @return `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))` /// unless throwing function onERC721Received(address _operator, address _from, uint256 _tokenId, bytes calldata _data) external returns(bytes4); } /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * * @notice See https://eips.ethereum.org/EIPS/eip-721 * * @dev The ERC-165 identifier for this interface is 0x5b5e139f. * * @author William Entriken, Dieter Shirley, Jacob Evans, Nastassia Sachs */ interface ERC721Metadata is ERC721 { /// @notice A descriptive name for a collection of NFTs in this contract function name() external view returns (string memory _name); /// @notice An abbreviated name for NFTs in this contract function symbol() external view returns (string memory _symbol); /// @notice A distinct Uniform Resource Identifier (URI) for a given asset. /// @dev Throws if `_tokenId` is not a valid NFT. URIs are defined in RFC /// 3986. The URI may point to a JSON file that conforms to the "ERC721 /// Metadata JSON Schema". function tokenURI(uint256 _tokenId) external view returns (string memory); } /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * * @notice See https://eips.ethereum.org/EIPS/eip-721 * * @dev The ERC-165 identifier for this interface is 0x780e9d63. * * @author William Entriken, Dieter Shirley, Jacob Evans, Nastassia Sachs */ interface ERC721Enumerable is ERC721 { /// @notice Count NFTs tracked by this contract /// @return A count of valid NFTs tracked by this contract, where each one of /// them has an assigned and queryable owner not equal to the zero address function totalSupply() external view returns (uint256); /// @notice Enumerate valid NFTs /// @dev Throws if `_index` >= `totalSupply()`. /// @param _index A counter less than `totalSupply()` /// @return The token identifier for the `_index`th NFT, /// (sort order not specified) function tokenByIndex(uint256 _index) external view returns (uint256); /// @notice Enumerate NFTs assigned to an owner /// @dev Throws if `_index` >= `balanceOf(_owner)` or if /// `_owner` is the zero address, representing invalid NFTs. /// @param _owner An address where we are interested in NFTs owned by them /// @param _index A counter less than `balanceOf(_owner)` /// @return The token identifier for the `_index`th NFT assigned to `_owner`, /// (sort order not specified) function tokenOfOwnerByIndex(address _owner, uint256 _index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @title Alethea Mintable ERC721 * * @notice Defines mint capabilities for Alethea ERC721 tokens. * This interface should be treated as a definition of what mintable means for ERC721 */ interface MintableERC721 { /** * @notice Checks if specified token exists * * @dev Returns whether the specified token ID has an ownership * information associated with it * * @param _tokenId ID of the token to query existence for * @return whether the token exists (true - exists, false - doesn't exist) */ function exists(uint256 _tokenId) external view returns(bool); /** * @dev Creates new token with token ID specified * and assigns an ownership `_to` for this token * * @dev Unsafe: doesn't execute `onERC721Received` on the receiver. * Prefer the use of `saveMint` instead of `mint`. * * @dev Should have a restricted access handled by the implementation * * @param _to an address to mint token to * @param _tokenId ID of the token to mint */ function mint(address _to, uint256 _tokenId) external; /** * @dev Creates new tokens starting with token ID specified * and assigns an ownership `_to` for these tokens * * @dev Token IDs to be minted: [_tokenId, _tokenId + n) * * @dev n must be greater or equal 2: `n > 1` * * @dev Unsafe: doesn't execute `onERC721Received` on the receiver. * Prefer the use of `saveMintBatch` instead of `mintBatch`. * * @dev Should have a restricted access handled by the implementation * * @param _to an address to mint tokens to * @param _tokenId ID of the first token to mint * @param n how many tokens to mint, sequentially increasing the _tokenId */ function mintBatch(address _to, uint256 _tokenId, uint256 n) external; /** * @dev Creates new token with token ID specified * and assigns an ownership `_to` for this token * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Should have a restricted access handled by the implementation * * @param _to an address to mint token to * @param _tokenId ID of the token to mint */ function safeMint(address _to, uint256 _tokenId) external; /** * @dev Creates new token with token ID specified * and assigns an ownership `_to` for this token * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Should have a restricted access handled by the implementation * * @param _to an address to mint token to * @param _tokenId ID of the token to mint * @param _data additional data with no specified format, sent in call to `_to` */ function safeMint(address _to, uint256 _tokenId, bytes memory _data) external; /** * @dev Creates new tokens starting with token ID specified * and assigns an ownership `_to` for these tokens * * @dev Token IDs to be minted: [_tokenId, _tokenId + n) * * @dev n must be greater or equal 2: `n > 1` * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Should have a restricted access handled by the implementation * * @param _to an address to mint token to * @param _tokenId ID of the token to mint * @param n how many tokens to mint, sequentially increasing the _tokenId */ function safeMintBatch(address _to, uint256 _tokenId, uint256 n) external; /** * @dev Creates new tokens starting with token ID specified * and assigns an ownership `_to` for these tokens * * @dev Token IDs to be minted: [_tokenId, _tokenId + n) * * @dev n must be greater or equal 2: `n > 1` * * @dev Checks if `_to` is a smart contract (code size > 0). If so, it calls * `onERC721Received` on `_to` and throws if the return value is not * `bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))`. * * @dev Should have a restricted access handled by the implementation * * @param _to an address to mint token to * @param _tokenId ID of the token to mint * @param n how many tokens to mint, sequentially increasing the _tokenId * @param _data additional data with no specified format, sent in call to `_to` */ function safeMintBatch(address _to, uint256 _tokenId, uint256 n, bytes memory _data) external; } /** * @title Alethea Burnable ERC721 * * @notice Defines burn capabilities for Alethea ERC721 tokens. * This interface should be treated as a definition of what burnable means for ERC721 */ interface BurnableERC721 { /** * @notice Destroys the token with token ID specified * * @dev Should be accessible publicly by token owners. * May have a restricted access handled by the implementation * * @param _tokenId ID of the token to burn */ function burn(uint256 _tokenId) external; } /** * @title With Base URI * * @notice A marker interface for the contracts having the baseURI() function * or public string variable named baseURI * NFT implementations like TinyERC721, or ShortERC721 are example of such smart contracts */ interface WithBaseURI { /** * @dev Usually used in NFT implementations to construct ERC721Metadata.tokenURI as * `base URI + token ID` if token URI is not set (not present in `_tokenURIs` mapping) * * @dev For example, if base URI is https://api.com/token/, then token #1 * will have an URI https://api.com/token/1 */ function baseURI() external view returns(string memory); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @title Address Utils * * @dev Utility library of inline functions on addresses * * @dev Copy of the Zeppelin's library: * https://github.com/gnosis/openzeppelin-solidity/blob/master/contracts/AddressUtils.sol */ library AddressUtils { /** * @notice Checks if the target address is a contract * * @dev It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * @dev 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 * * @param addr address to check * @return whether the target address is a contract */ function isContract(address addr) internal view returns (bool) { // a variable to load `extcodesize` to uint256 size = 0; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. // See https://ethereum.stackexchange.com/a/14016/36603 for more details about how this works. // TODO: Check this again before the Serenity release, because all addresses will be contracts. // solium-disable-next-line security/no-inline-assembly assembly { // retrieve the size of the code at address `addr` size := extcodesize(addr) } // positive size indicates a smart contract address return size > 0; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @title Array Utils * * @notice Solidity doesn't always work with arrays in an optimal way. * This library collects functions helping to optimize gas usage * when working with arrays in Solidity. * * @dev One of the most important use cases for arrays is "tight" arrays - * arrays which store values significantly less than 256-bits numbers */ library ArrayUtils { /** * @dev Pushes `n` 32-bits values sequentially into storage allocated array `data` * starting from the 32-bits value `v0` * * @dev Optimizations comparing to non-assembly implementation: * - reads+writes to array size slot only once (instead of `n` times) * - reads from the array data slots only once (instead of `7n/8` times) * - writes into array data slots `n/8` times (instead of `n` times) * * @dev Maximum gas saving estimate: ~3n sstore, or 15,000 * n * * @param data storage array pointer to an array of 32-bits elements * @param v0 first number to push into the array * @param n number of values to push, pushes [v0, ..., v0 + n - 1] */ function push32(uint32[] storage data, uint32 v0, uint32 n) internal { // we're going to write 32-bits values into 256-bits storage slots of the array // each 256-slot can store up to 8 32-bits sub-blocks, it can also be partially empty assembly { // for dynamic arrays their slot (array.slot) contains the array length // array data is stored separately in consequent storage slots starting // from the slot with the address keccak256(array.slot) // read the array length into `len` and increase it by `n` let len := sload(data.slot) sstore(data.slot, add(len, n)) // find where to write elements and store this location into `loc` // load array storage slot number into memory onto position 0, // calculate the keccak256 of the slot number (first 32 bytes at position 0) // - this will point to the beginning of the array, // so we add array length divided by 8 to point to the last array slot mstore(0, data.slot) let loc := add(keccak256(0, 32), div(len, 8)) // if we start writing data into already partially occupied slot (`len % 8 != 0`) // we need to modify the contents of that slot: read it and rewrite it let offset := mod(len, 8) if not(iszero(offset)) { // how many 32-bits sub-blocks left in the slot let left := sub(8, offset) // update the `left` value not to exceed `n` if gt(left, n) { left := n } // load the contents of the first slot (partially occupied) let v256 := sload(loc) // write the slot in 32-bits sub-blocks for { let j := 0 } lt(j, left) { j := add(j, 1) } { // write sub-block `j` at offset: `(j + offset) * 32` bits, length: 32-bits // v256 |= (v0 + j) << (j + offset) * 32 v256 := or(v256, shl(mul(add(j, offset), 32), add(v0, j))) } // write first slot back, it can be still partially occupied, it can also be full sstore(loc, v256) // update `loc`: move to the next slot loc := add(loc, 1) // update `v0`: increment by number of values pushed v0 := add(v0, left) // update `n`: decrement by number of values pushed n := sub(n, left) } // rest of the slots (if any) are empty and will be only written to // write the array in 256-bits (8x32) slots // `i` iterates [0, n) with the 256-bits step, which is 8 taken `n` is 32-bits long for { let i := 0 } lt(i, n) { i := add(i, 8) } { // how many 32-bits sub-blocks left in the slot let left := 8 // update the `left` value not to exceed `n` if gt(left, n) { left := n } // init the 256-bits slot value let v256 := 0 // write the slot in 32-bits sub-blocks for { let j := 0 } lt(j, left) { j := add(j, 1) } { // write sub-block `j` at offset: `j * 32` bits, length: 32-bits // v256 |= (v0 + i + j) << j * 32 v256 := or(v256, shl(mul(j, 32), add(v0, add(i, j)))) } // write slot `i / 8` sstore(add(loc, div(i, 8)), v256) } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @title String Utils Library * * @dev Library for working with strings, primarily converting * between strings and integer types */ library StringUtils { /** * @dev Converts a string to unsigned integer using the specified `base` * @dev Throws on invalid input * (wrong characters for a given `base`) * @dev Throws if given `base` is not supported * @param a string to convert * @param base number base, one of 2, 8, 10, 16 * @return i a number representing given string */ function atoi(string memory a, uint8 base) internal pure returns (uint256 i) { // check if the base is valid require(base == 2 || base == 8 || base == 10 || base == 16); // convert string into bytes for convenient iteration bytes memory buf = bytes(a); // iterate over the string (bytes buffer) for(uint256 p = 0; p < buf.length; p++) { // extract the digit uint8 digit = uint8(buf[p]) - 0x30; // if digit is greater then 10 - mind the gap // see `itoa` function for more details if(digit > 10) { // remove the gap digit -= 7; } // check if digit meets the base require(digit < base); // move to the next digit slot i *= base; // add digit to the result i += digit; } // return the result return i; } /** * @dev Converts a integer to a string using the specified `base` * @dev Throws if given `base` is not supported * @param i integer to convert * @param base number base, one of 2, 8, 10, 16 * @return a a string representing given integer */ function itoa(uint256 i, uint8 base) internal pure returns (string memory a) { // check if the base is valid require(base == 2 || base == 8 || base == 10 || base == 16); // for zero input the result is "0" string for any base if(i == 0) { return "0"; } // bytes buffer to put ASCII characters into bytes memory buf = new bytes(256); // position within a buffer to be used in cycle uint256 p = 0; // extract digits one by one in a cycle while(i > 0) { // extract current digit uint8 digit = uint8(i % base); // convert it to an ASCII code // 0x20 is " " // 0x30-0x39 is "0"-"9" // 0x41-0x5A is "A"-"Z" // 0x61-0x7A is "a"-"z" ("A"-"Z" XOR " ") uint8 ascii = digit + 0x30; // if digit is greater then 10, // fix the 0x3A-0x40 gap of punctuation marks // (7 characters in ASCII table) if(digit >= 10) { // jump through the gap ascii += 7; } // write character into the buffer buf[p++] = bytes1(ascii); // move to the next digit i /= base; } // `p` contains real length of the buffer now, // allocate the resulting buffer of that size bytes memory result = new bytes(p); // copy the buffer in the reversed order for(p = 0; p < result.length; p++) { // copy from the beginning of the original buffer // to the end of resulting smaller buffer result[result.length - p - 1] = buf[p]; } // construct string and return return string(result); } /** * @dev Concatenates two strings `s1` and `s2`, for example, if * `s1` == `foo` and `s2` == `bar`, the result `s` == `foobar` * @param s1 first string * @param s2 second string * @return s concatenation result s1 + s2 */ function concat(string memory s1, string memory s2) internal pure returns (string memory s) { // an old way of string concatenation (Solidity 0.4) is commented out /* // convert s1 into buffer 1 bytes memory buf1 = bytes(s1); // convert s2 into buffer 2 bytes memory buf2 = bytes(s2); // create a buffer for concatenation result bytes memory buf = new bytes(buf1.length + buf2.length); // copy buffer 1 into buffer for(uint256 i = 0; i < buf1.length; i++) { buf[i] = buf1[i]; } // copy buffer 2 into buffer for(uint256 j = buf1.length; j < buf2.length; j++) { buf[j] = buf2[j - buf1.length]; } // construct string and return return string(buf); */ // simply use built in function return string(abi.encodePacked(s1, s2)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @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. * * @dev Copy of the Zeppelin's library: * https://github.com/OpenZeppelin/openzeppelin-contracts/blob/b0cf6fbb7a70f31527f36579ad644e1cf12fdf4e/contracts/utils/cryptography/ECDSA.sol */ library ECDSA { /** * @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. * * 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] */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { // Divide the signature in r, s and v variables bytes32 r; bytes32 s; uint8 v; // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } } else if (signature.length == 64) { // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { let vs := mload(add(signature, 0x40)) r := mload(add(signature, 0x20)) s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27) } } else { revert("invalid signature length"); } return recover(hash, v, r, s); } /** * @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) { // 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 (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): 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. require( uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0, "invalid signature 's' value" ); require(v == 27 || v == 28, "invalid signature 'v' value"); // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); require(signer != address(0), "invalid signature"); return signer; } /** * @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 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)); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.7; /** * @title Access Control List * * @notice Access control smart contract provides an API to check * if specific operation is permitted globally and/or * if particular user has a permission to execute it. * * @notice It deals with two main entities: features and roles. * * @notice Features are designed to be used to enable/disable specific * functions (public functions) of the smart contract for everyone. * @notice User roles are designed to restrict access to specific * functions (restricted functions) of the smart contract to some users. * * @notice Terms "role", "permissions" and "set of permissions" have equal meaning * in the documentation text and may be used interchangeably. * @notice Terms "permission", "single permission" implies only one permission bit set. * * @notice Access manager is a special role which allows to grant/revoke other roles. * Access managers can only grant/revoke permissions which they have themselves. * As an example, access manager with no other roles set can only grant/revoke its own * access manager permission and nothing else. * * @notice Access manager permission should be treated carefully, as a super admin permission: * Access manager with even no other permission can interfere with another account by * granting own access manager permission to it and effectively creating more powerful * permission set than its own. * * @dev Both current and OpenZeppelin AccessControl implementations feature a similar API * to check/know "who is allowed to do this thing". * @dev Zeppelin implementation is more flexible: * - it allows setting unlimited number of roles, while current is limited to 256 different roles * - it allows setting an admin for each role, while current allows having only one global admin * @dev Current implementation is more lightweight: * - it uses only 1 bit per role, while Zeppelin uses 256 bits * - it allows setting up to 256 roles at once, in a single transaction, while Zeppelin allows * setting only one role in a single transaction * * @dev This smart contract is designed to be inherited by other * smart contracts which require access control management capabilities. * * @dev Access manager permission has a bit 255 set. * This bit must not be used by inheriting contracts for any other permissions/features. */ contract AccessControl { /** * @notice Access manager is responsible for assigning the roles to users, * enabling/disabling global features of the smart contract * @notice Access manager can add, remove and update user roles, * remove and update global features * * @dev Role ROLE_ACCESS_MANAGER allows modifying user roles and global features * @dev Role ROLE_ACCESS_MANAGER has single bit at position 255 enabled */ uint256 public constant ROLE_ACCESS_MANAGER = 0x8000000000000000000000000000000000000000000000000000000000000000; /** * @dev Bitmask representing all the possible permissions (super admin role) * @dev Has all the bits are enabled (2^256 - 1 value) */ uint256 private constant FULL_PRIVILEGES_MASK = type(uint256).max; // before 0.8.0: uint256(-1) overflows to 0xFFFF... /** * @notice Privileged addresses with defined roles/permissions * @notice In the context of ERC20/ERC721 tokens these can be permissions to * allow minting or burning tokens, transferring on behalf and so on * * @dev Maps user address to the permissions bitmask (role), where each bit * represents a permission * @dev Bitmask 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF * represents all possible permissions * @dev 'This' address mapping represents global features of the smart contract */ mapping(address => uint256) public userRoles; /** * @dev Fired in updateRole() and updateFeatures() * * @param _by operator which called the function * @param _to address which was granted/revoked permissions * @param _requested permissions requested * @param _actual permissions effectively set */ event RoleUpdated(address indexed _by, address indexed _to, uint256 _requested, uint256 _actual); /** * @notice Creates an access control instance, * setting contract creator to have full privileges */ constructor() { // contract creator has full privileges userRoles[msg.sender] = FULL_PRIVILEGES_MASK; } /** * @notice Retrieves globally set of features enabled * * @dev Effectively reads userRoles role for the contract itself * * @return 256-bit bitmask of the features enabled */ function features() public view returns(uint256) { // features are stored in 'this' address mapping of `userRoles` structure return userRoles[address(this)]; } /** * @notice Updates set of the globally enabled features (`features`), * taking into account sender's permissions * * @dev Requires transaction sender to have `ROLE_ACCESS_MANAGER` permission * @dev Function is left for backward compatibility with older versions * * @param _mask bitmask representing a set of features to enable/disable */ function updateFeatures(uint256 _mask) public { // delegate call to `updateRole` updateRole(address(this), _mask); } /** * @notice Updates set of permissions (role) for a given user, * taking into account sender's permissions. * * @dev Setting role to zero is equivalent to removing an all permissions * @dev Setting role to `FULL_PRIVILEGES_MASK` is equivalent to * copying senders' permissions (role) to the user * @dev Requires transaction sender to have `ROLE_ACCESS_MANAGER` permission * * @param operator address of a user to alter permissions for or zero * to alter global features of the smart contract * @param role bitmask representing a set of permissions to * enable/disable for a user specified */ function updateRole(address operator, uint256 role) public { // caller must have a permission to update user roles require(isSenderInRole(ROLE_ACCESS_MANAGER), "access denied"); // evaluate the role and reassign it userRoles[operator] = evaluateBy(msg.sender, userRoles[operator], role); // fire an event emit RoleUpdated(msg.sender, operator, role, userRoles[operator]); } /** * @notice Determines the permission bitmask an operator can set on the * target permission set * @notice Used to calculate the permission bitmask to be set when requested * in `updateRole` and `updateFeatures` functions * * @dev Calculated based on: * 1) operator's own permission set read from userRoles[operator] * 2) target permission set - what is already set on the target * 3) desired permission set - what do we want set target to * * @dev Corner cases: * 1) Operator is super admin and its permission set is `FULL_PRIVILEGES_MASK`: * `desired` bitset is returned regardless of the `target` permission set value * (what operator sets is what they get) * 2) Operator with no permissions (zero bitset): * `target` bitset is returned regardless of the `desired` value * (operator has no authority and cannot modify anything) * * @dev Example: * Consider an operator with the permissions bitmask 00001111 * is about to modify the target permission set 01010101 * Operator wants to set that permission set to 00110011 * Based on their role, an operator has the permissions * to update only lowest 4 bits on the target, meaning that * high 4 bits of the target set in this example is left * unchanged and low 4 bits get changed as desired: 01010011 * * @param operator address of the contract operator which is about to set the permissions * @param target input set of permissions to operator is going to modify * @param desired desired set of permissions operator would like to set * @return resulting set of permissions given operator will set */ function evaluateBy(address operator, uint256 target, uint256 desired) public view returns(uint256) { // read operator's permissions uint256 p = userRoles[operator]; // taking into account operator's permissions, // 1) enable the permissions desired on the `target` target |= p & desired; // 2) disable the permissions desired on the `target` target &= FULL_PRIVILEGES_MASK ^ (p & (FULL_PRIVILEGES_MASK ^ desired)); // return calculated result return target; } /** * @notice Checks if requested set of features is enabled globally on the contract * * @param required set of features to check against * @return true if all the features requested are enabled, false otherwise */ function isFeatureEnabled(uint256 required) public view returns(bool) { // delegate call to `__hasRole`, passing `features` property return __hasRole(features(), required); } /** * @notice Checks if transaction sender `msg.sender` has all the permissions required * * @param required set of permissions (role) to check against * @return true if all the permissions requested are enabled, false otherwise */ function isSenderInRole(uint256 required) public view returns(bool) { // delegate call to `isOperatorInRole`, passing transaction sender return isOperatorInRole(msg.sender, required); } /** * @notice Checks if operator has all the permissions (role) required * * @param operator address of the user to check role for * @param required set of permissions (role) to check * @return true if all the permissions requested are enabled, false otherwise */ function isOperatorInRole(address operator, uint256 required) public view returns(bool) { // delegate call to `__hasRole`, passing operator's permissions (role) return __hasRole(userRoles[operator], required); } /** * @dev Checks if role `actual` contains all the permissions required `required` * * @param actual existent role * @param required required role * @return true if actual has required role (all permissions), false otherwise */ function __hasRole(uint256 actual, uint256 required) internal pure returns(bool) { // check the bitmask for the role required and return the result return actual & required == required; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"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":true,"internalType":"address","name":"_by","type":"address"},{"indexed":false,"internalType":"string","name":"_oldVal","type":"string"},{"indexed":false,"internalType":"string","name":"_newVal","type":"string"}],"name":"BaseURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_by","type":"address"},{"indexed":false,"internalType":"string","name":"_oldVal","type":"string"},{"indexed":false,"internalType":"string","name":"_newVal","type":"string"}],"name":"ContractURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_by","type":"address"},{"indexed":true,"internalType":"address","name":"_oldVal","type":"address"},{"indexed":true,"internalType":"address","name":"_newVal","type":"address"}],"name":"OwnerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_by","type":"address"},{"indexed":true,"internalType":"address","name":"_to","type":"address"},{"indexed":false,"internalType":"uint256","name":"_requested","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_actual","type":"uint256"}],"name":"RoleUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_by","type":"address"},{"indexed":true,"internalType":"address","name":"_oldReceiver","type":"address"},{"indexed":true,"internalType":"address","name":"_newReceiver","type":"address"},{"indexed":false,"internalType":"uint16","name":"_oldPercentage","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_newPercentage","type":"uint16"}],"name":"RoyaltyInfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_by","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"string","name":"_oldVal","type":"string"},{"indexed":false,"internalType":"string","name":"_newVal","type":"string"}],"name":"TokenURIUpdated","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"},{"inputs":[],"name":"BATCH_SIZE_MULTIPLIER","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_BURNS_ON_BEHALF","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_OPERATOR_PERMITS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_OWN_BURNS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_PERMITS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_TRANSFERS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FEATURE_TRANSFERS_ON_BEHALF","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_FOR_ALL_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_ACCESS_MANAGER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_OWNER_MANAGER","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_ROYALTY_MANAGER","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_TOKEN_CREATOR","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_TOKEN_DESTROYER","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ROLE_URI_MANAGER","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_UID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_approved","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":"baseURI","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":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"target","type":"uint256"},{"internalType":"uint256","name":"desired","type":"uint256"}],"name":"evaluateBy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"features","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":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"required","type":"uint256"}],"name":"isFeatureEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"required","type":"uint256"}],"name":"isOperatorInRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_addr","type":"address"}],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"required","type":"uint256"}],"name":"isSenderInRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"isTransferable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"mintBatch","outputs":[],"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":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_exp","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"},{"internalType":"uint256","name":"_exp","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permitForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"permitNonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyPercentage","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"royaltyReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"n","type":"uint256"}],"name":"safeMintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"n","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeMintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"bool","name":"_approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_contractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyReceiver","type":"address"},{"internalType":"uint16","name":"_royaltyPercentage","type":"uint16"}],"name":"setRoyaltyInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"string","name":"_tokenURI","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_mask","type":"uint256"}],"name":"updateFeatures","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"role","type":"uint256"}],"name":"updateRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRoles","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c06040819052600060a08190526200001b91600991620001a9565b50600c80546001600160b01b0319167502ee379e2119f6e0d6088537da82968e2a7ea178ddcf17905560408051608081019091526050808252620039d8602083013980516200007391600d91602090910190620001a9565b503480156200008157600080fd5b5060405162003a2838038062003a28833981016040819052620000a49162000306565b33600090815260208181526040909120600019905582518391839183918391620000d59160019190850190620001a9565b508051620000eb906002906020840190620001a9565b50604080518082018252600b81526a416c69455243373231763160a81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866918101919091527f9db81778f201f995555fc8eeb2867a4c0457608d47c4c8fc0fc8052b03664ff69181019190915246606082015230608082015260a00160408051601f1981840301815291905280516020909101206080525050600b80546001600160a01b0319163317905550620003c392505050565b828054620001b79062000370565b90600052602060002090601f016020900481019282620001db576000855562000226565b82601f10620001f657805160ff191683800117855562000226565b8280016001018555821562000226579182015b828111156200022657825182559160200191906001019062000209565b506200023492915062000238565b5090565b5b8082111562000234576000815560010162000239565b600082601f8301126200026157600080fd5b81516001600160401b03808211156200027e576200027e620003ad565b604051601f8301601f19908116603f01168101908282118183101715620002a957620002a9620003ad565b81604052838152602092508683858801011115620002c657600080fd5b600091505b83821015620002ea5785820183015181830184015290820190620002cb565b83821115620002fc5760008385830101525b9695505050505050565b600080604083850312156200031a57600080fd5b82516001600160401b03808211156200033257600080fd5b62000340868387016200024f565b935060208501519150808211156200035757600080fd5b5062000366858286016200024f565b9150509250929050565b600181811c908216806200038557607f821691505b60208210811415620003a757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b6080516135f2620003e6600039600081816105f7015261268d01526135f26000f3fe608060405234801561001057600080fd5b50600436106103f15760003560e01c806374d5e10011610215578063af65e2a811610125578063d505accf116100b8578063e985e9c511610087578063e985e9c514610918578063f2fde38b1461092b578063f63c2f821461093e578063f822d5aa14610946578063fcc2c0781461095957600080fd5b8063d505accf146108e0578063d5bb7f67146108f3578063e62cac7614610906578063e8a3d4851461091057600080fd5b8063c0d6568d116100f4578063c0d6568d146108a8578063c688d693146108b0578063c87b56dd146108c3578063cc2da7ff146108d657600080fd5b8063af65e2a814610865578063b256456914610878578063b29a2f441461088b578063b88d4fde1461089557600080fd5b80639032c726116101a85780639fbc8713116101775780639fbc87131461080e578063a144819414610821578063a22cb46514610834578063ae5b102e14610847578063ae682e2e1461085a57600080fd5b80639032c726146107d8578063938e3d7b146107eb57806395d89b41146107fe57806398b622a21461080657600080fd5b80638a71bb2d116101e45780638a71bb2d1461078b5780638d4e57e6146107b35780638da5cb5b146107bd5780638f6fba8c146107d057600080fd5b806374d5e10014610728578063768bfc9a146107485780638832e6e3146107515780638a114e131461076457600080fd5b80632f745c59116103105780634f6ccce7116102a35780636352211e116102725780636352211e146106d45780636c0360eb146106e757806370a08231146106ef57806372504a2414610702578063725f36261461071557600080fd5b80634f6ccce71461067457806355f804b314610687578063585956d61461069a57806361587911146106c157600080fd5b806340c10f19116102df57806340c10f191461061957806342842e0e1461062c57806342966c681461063f5780634f558e791461065257600080fd5b80632f745c591461059e57806330adf81f146105b1578063313ce567146105d85780633644e515146105f257600080fd5b8063191d0ffc116103885780632a55205a116103575780632a55205a146105225780632b521416146105545780632e81aaea146105695780632f54bf6e1461057c57600080fd5b8063191d0ffc146104c05780631a0b04ea146104e057806320606b70146104e857806323b872dd1461050f57600080fd5b80630dc5b424116103c45780630dc5b4241461047357806314b7b4e114610491578063162094c41461049b57806318160ddd146104ae57600080fd5b806301ffc9a7146103f657806306fdde031461041e578063081812fc14610433578063095ea7b31461045e575b600080fd5b610409610404366004613081565b61096c565b60405190151581526020015b60405180910390f35b610426610997565b60405161041591906132b2565b6104466104413660046130f8565b610a25565b6040516001600160a01b039091168152602001610415565b61047161046c366004612f84565b610a75565b005b61047c61020081565b60405163ffffffff9091168152602001610415565b61047c6210000081565b6104716104a9366004613111565b610a84565b6005545b604051908152602001610415565b6104b26104ce366004612d6b565b60086020526000908152604090205481565b61047c600881565b6104b27f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b61047161051d366004612e2a565b610b1b565b610535610530366004613158565b610ddd565b604080516001600160a01b039093168352602083019190915201610415565b306000908152602081905260409020546104b2565b610471610577366004613005565b610e1e565b61040961058a366004612d6b565b600b546001600160a01b0391821691161490565b6104b26105ac366004612f84565b611033565b6104b27fee2282d7affd5a432b221a559e429129347b0c19a3f102179a5fb1859eef3d2981565b6105e0600081565b60405160ff9091168152602001610415565b6104b27f000000000000000000000000000000000000000000000000000000000000000081565b610471610627366004612f84565b6110d8565b61047161063a366004612e2a565b6112bf565b61047161064d3660046130f8565b6112da565b6104096106603660046130f8565b600090815260036020526040902054151590565b6104b26106823660046130f8565b611474565b6104716106953660046130bb565b611500565b6104b27f47ab88482c90e4bb94b82a947ae78fa91fb25de1469ab491f4c15b9a0a2677ee81565b6104716106cf366004613005565b61157f565b6104466106e23660046130f8565b61159a565b6104266115cf565b6104b26106fd366004612d6b565b6115dc565b610471610710366004612f46565b611620565b6104096107233660046130f8565b611727565b6104b2610736366004612d6b565b60006020819052908152604090205481565b61047c61040081565b61047161075f366004612fae565b611740565b6104b27fd9b5d3b66c60255ffa16c57c0f1b2db387997fa02af673da5767f1acb0f345af81565b600c546107a090600160a01b900461ffff1681565b60405161ffff9091168152602001610415565b61047c6201000081565b600b54610446906001600160a01b031681565b61047c600281565b6104716107e6366004612db9565b61180a565b6104716107f93660046130bb565b611992565b610426611a11565b6105e0600881565b600c54610446906001600160a01b031681565b61047161082f366004612f84565b611a1e565b610471610842366004612f1c565b611a38565b610471610855366004612f84565b611a43565b6104b2600160ff1b81565b610471610873366004613038565b611aed565b6104096108863660046130f8565b611be5565b61047c6220000081565b6104716108a3366004612e66565b611c18565b61047c600181565b6104096108be366004612f84565b611ce3565b6104266108d13660046130f8565b611d08565b61047c6240000081565b6104716108ee366004612ece565b611ea8565b6104716109013660046130f8565b612008565b61047c6202000081565b610426612015565b610409610926366004612d86565b612022565b610471610939366004612d6b565b612050565b61047c601081565b6104b2610954366004613005565b6120d6565b6104096109673660046130f8565b612101565b60006001600160e01b0319821663152a902d60e11b148061099157506109918261210d565b92915050565b600180546109a4906134ae565b80601f01602080910402602001604051908101604052809291908181526020018280546109d0906134ae565b8015610a1d5780601f106109f257610100808354040283529160200191610a1d565b820191906000526020600020905b815481529060010190602001808311610a0057829003601f168201915b505050505081565b600081815260036020526040812054610a595760405162461bcd60e51b8152600401610a5090613315565b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b610a803383836121af565b5050565b610a9062100000612101565b610aac5760405162461bcd60e51b8152600401610a50906133a9565b6000828152600a602052604090819020905133917f7989fff0ffb34805e8b3574b890ed6157f85a384c69b9a0c04991b24cabb825991610aef91869186906133d0565b60405180910390a26000828152600a602090815260409091208251610b1692840190612bd2565b505050565b6001600160a01b03831633148015610b385750610b386001611727565b80610b5c57506001600160a01b0383163314801590610b5c5750610b5c6002611727565b6001600160a01b0384163314610ba7576040518060400160405280602081526020017f7472616e7366657273206f6e20626568616c66206172652064697361626c6564815250610bd7565b604051806040016040528060168152602001751d1c985b9cd9995c9cc8185c9948191a5cd8589b195960521b8152505b90610bf55760405162461bcd60e51b8152600401610a5091906132b2565b506001600160a01b038216610c1c5760405162461bcd60e51b8152600401610a5090613383565b610c258161159a565b6001600160a01b0316836001600160a01b031614610c555760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038316331480610c855750610c7081610a25565b6001600160a01b0316336001600160a01b0316145b80610c955750610c958333612022565b610cb15760405162461bcd60e51b8152600401610a50906133a9565b610cba81611be5565b610cf55760405162461bcd60e51b815260206004820152600c60248201526b3637b1b5b2b2103a37b5b2b760a11b6044820152606401610a50565b816001600160a01b0316836001600160a01b031614610d9f57610d17816122ac565b6001600160a01b0382166000818152600460208181526040808420805487865260038452918520805460a09390931b63ffffffff60a01b1663ffffffff60c01b90931692909217909517905583546001810185559383529091206008830401805460079093169091026101000a63ffffffff8181021990931692841602919091179055610da9565b610da9838261240a565b80826001600160a01b0316846001600160a01b031660008051602061359d83398151915260405160405180910390a4505050565b600c5460009081906001600160a01b0381169061271090610e0990600160a01b900461ffff168661344c565b610e139190613438565b915091509250929050565b610e2a62010000612101565b610e465760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038316610e6c5760405162461bcd60e51b8152600401610a5090613383565b60018111610ead5760405162461bcd60e51b815260206004820152600e60248201526d1b881a5cc81d1bdbc81cdb585b1b60921b6044820152606401610a50565b818263ffffffff1614610ef65760405162461bcd60e51b8152602060048201526011602482015270746f6b656e204944206f766572666c6f7760781b6044820152606401610a50565b6001610f0282846133fb565b610f0c919061346b565b6001610f1883856133fb565b610f22919061346b565b63ffffffff1614610f6e5760405162461bcd60e51b81526020600482015260166024820152756e2d746820746f6b656e204944206f766572666c6f7760501b6044820152606401610a50565b60005b81811015610fd657610f8661066082856133fb565b15610fc45760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481b5a5b9d195960921b6044820152606401610a50565b80610fce816134e9565b915050610f71565b50610fe283838361245f565b60005b8181101561102d57610ff781846133fb565b6040516001600160a01b0386169060009060008051602061359d833981519152908290a480611025816134e9565b915050610fe5565b50505050565b600061103e836115dc565b82106110825760405162461bcd60e51b8152602060048201526013602482015272696e646578206f7574206f6620626f756e647360681b6044820152606401610a50565b6001600160a01b03831660009081526004602052604090208054839081106110ac576110ac61355a565b6000918252602090912060088204015460079091166004026101000a900463ffffffff16905092915050565b6110e462010000612101565b6111005760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b0382166111265760405162461bcd60e51b8152600401610a5090613383565b808163ffffffff161461116f5760405162461bcd60e51b8152602060048201526011602482015270746f6b656e204944206f766572666c6f7760781b6044820152606401610a50565b600081815260036020526040902054156111bc5760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481b5a5b9d195960921b6044820152606401610a50565b6001600160a01b03821660008181526004602081815260408084208054600580548988526003865293872060a09290921b63ffffffff60a01b1660c09490941b63ffffffff60c01b1693909317909617909555845460018082018755958552918420600880840490910180546007948516860261010090810a63ffffffff81810219909316838c169182021790935584549889018555939096527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db091870491909101805496909316909302900a92830219909316910217905560405181906001600160a01b0384169060009060008051602061359d833981519152908290a45050565b610b1683838360405180602001604052806000815250611c18565b60006112e58261159a565b90506112f362020000612101565b61142a576001600160a01b0381163314801561131457506113146008611727565b8061133857506001600160a01b038116331480159061133857506113386010611727565b6001600160a01b0382163314611383576040518060400160405280601c81526020017f6275726e73206f6e20626568616c66206172652064697361626c6564000000008152506113af565b60405180604001604052806012815260200171189d5c9b9cc8185c9948191a5cd8589b195960721b8152505b906113cd5760405162461bcd60e51b8152600401610a5091906132b2565b506001600160a01b0381163314806113fe57506113e982610a25565b6001600160a01b0316336001600160a01b0316145b8061140e575061140e8133612022565b61142a5760405162461bcd60e51b8152600401610a50906133a9565b61143382612524565b6000828152600a6020526040812061144a91612c56565b60405182906000906001600160a01b0384169060008051602061359d833981519152908390a45050565b600061147f60055490565b82106114c35760405162461bcd60e51b8152602060048201526013602482015272696e646578206f7574206f6620626f756e647360681b6044820152606401610a50565b600582815481106114d6576114d661355a565b6000918252602090912060088204015460079091166004026101000a900463ffffffff1692915050565b61150c62100000612101565b6115285760405162461bcd60e51b8152600401610a50906133a9565b336001600160a01b03167fac455070f26733cc10c09e4389a74bf73bdb676d730ee31215c31d20daa880056009836040516115649291906132c5565b60405180910390a28051610a80906009906020840190612bd2565b610b1683838360405180602001604052806000815250611aed565b6000818152600360205260408120546001600160a01b0381166109915760405162461bcd60e51b8152600401610a5090613315565b600980546109a4906134ae565b60006001600160a01b0382166116045760405162461bcd60e51b8152600401610a5090613383565b506001600160a01b031660009081526004602052604090205490565b61162c62200000612101565b6116485760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038216151580611661575061ffff8116155b6116a05760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2103932b1b2b4bb32b960811b6044820152606401610a50565b600c546040805161ffff600160a01b840481168252841660208201526001600160a01b0385811693169133917f84fb129d2cd99229b2a8776ec84f49fb8c88d15fd4d6062e942d585bedc46632910160405180910390a4600c805461ffff909216600160a01b026001600160b01b03199092166001600160a01b0390931692909217179055565b3060009081526020819052604081205482168214610991565b61174a83836110d8565b823b15610b1657604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611786903390859088908890600401613275565b602060405180830381600087803b1580156117a057600080fd5b505af11580156117b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d8919061309e565b90506001600160e01b03198116630a85bd0160e11b1461102d5760405162461bcd60e51b8152600401610a5090613342565b611815610400611727565b6118615760405162461bcd60e51b815260206004820152601d60248201527f6f70657261746f72207065726d697473206172652064697361626c65640000006044820152606401610a50565b6001600160a01b03871660009081526008602052604081208054611907917f47ab88482c90e4bb94b82a947ae78fa91fb25de1469ab491f4c15b9a0a2677ee918b918b918b91876118b1836134e9565b909155506040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0015b604051602081830303815290604052858585612670565b9050876001600160a01b0316816001600160a01b03161461193a5760405162461bcd60e51b8152600401610a50906132ea565b84421061197d5760405162461bcd60e51b81526020600482015260116024820152701cda59db985d1d5c9948195e1c1a5c9959607a1b6044820152606401610a50565b6119888888886126f2565b5050505050505050565b61199e62100000612101565b6119ba5760405162461bcd60e51b8152600401610a50906133a9565b336001600160a01b03167fcc40349b3e236533ad861f7df3d9177296d1ef695e7026e0f7d744abe60ab000600d836040516119f69291906132c5565b60405180910390a28051610a8090600d906020840190612bd2565b600280546109a4906134ae565b610a80828260405180602001604052806000815250611740565b610a803383836126f2565b611a50600160ff1b612101565b611a6c5760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038216600090815260208190526040902054611a91903390836120d6565b6001600160a01b03831660008181526020818152604091829020849055815185815290810193909352909133917f5a10526456f5116c0b7b80582c217d666243fd51b6a2d92c8011e601c2462e5f910160405180910390a35050565b611af8848484610e1e565b833b1561102d5760005b82811015611bde5760006001600160a01b03861663150b7a023383611b27868a6133fb565b876040518563ffffffff1660e01b8152600401611b479493929190613275565b602060405180830381600087803b158015611b6157600080fd5b505af1158015611b75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b99919061309e565b90506001600160e01b03198116630a85bd0160e11b14611bcb5760405162461bcd60e51b8152600401610a5090613342565b5080611bd6816134e9565b915050611b02565b5050505050565b600081815260036020526040812054611c105760405162461bcd60e51b8152600401610a5090613315565b506001919050565b611c23848484610b1b565b823b1561102d57604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611c5f903390899088908890600401613275565b602060405180830381600087803b158015611c7957600080fd5b505af1158015611c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb1919061309e565b90506001600160e01b03198116630a85bd0160e11b14611bde5760405162461bcd60e51b8152600401610a5090613342565b6001600160a01b038216600090815260208190526040812054821682145b9392505050565b600081815260036020526040902054606090611d365760405162461bcd60e51b8152600401610a5090613315565b6000828152600a602052604081208054611d4f906134ae565b80601f0160208091040260200160405190810160405280929190818152602001828054611d7b906134ae565b8015611dc85780601f10611d9d57610100808354040283529160200191611dc8565b820191906000526020600020905b815481529060010190602001808311611dab57829003601f168201915b50505050509050600081511115611ddf5792915050565b60098054611dec906134ae565b15159050611e0a575050604080516020810190915260008152919050565b611d0160098054611e1a906134ae565b80601f0160208091040260200160405190810160405280929190818152602001828054611e46906134ae565b8015611e935780601f10611e6857610100808354040283529160200191611e93565b820191906000526020600020905b815481529060010190602001808311611e7657829003601f168201915b5050505050611ea385600a6127b1565b612994565b611eb3610200611727565b611ef65760405162461bcd60e51b81526020600482015260146024820152731c195c9b5a5d1cc8185c9948191a5cd8589b195960621b6044820152606401610a50565b6001600160a01b03871660009081526008602052604081208054611f87917fee2282d7affd5a432b221a559e429129347b0c19a3f102179a5fb1859eef3d29918b918b918b9187611f46836134e9565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016118f0565b9050876001600160a01b0316816001600160a01b031614611fba5760405162461bcd60e51b8152600401610a50906132ea565b844210611ffd5760405162461bcd60e51b81526020600482015260116024820152701cda59db985d1d5c9948195e1c1a5c9959607a1b6044820152606401610a50565b6119888888886121af565b6120123082611a43565b50565b600d80546109a4906134ae565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b61205c62400000612101565b6120785760405162461bcd60e51b8152600401610a50906133a9565b600b546040516001600160a01b0380841692169033907fb9312e2100469bd44e3f762c248f4dcc8d7788906fabf34f79db45920c37e26990600090a4600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03929092166000908152602081905260409020546000198084188216189216171690565b60006109913383611ce3565b60006001600160e01b031982166301ffc9a760e01b148061213e57506001600160e01b031982166380ac58cd60e01b145b8061215957506001600160e01b03198216635b5e139f60e01b145b8061217457506001600160e01b0319821663780e9d6360e01b145b8061218f57506001600160e01b03198216633197b5d160e21b145b8061099157506001600160e01b03198216630852cd8d60e31b1492915050565b60006121ba8261159a565b9050806001600160a01b0316836001600160a01b0316141561220e5760405162461bcd60e51b815260206004820152600d60248201526c1cd95b1988185c1c1c9bdd985b609a1b6044820152606401610a50565b806001600160a01b0316846001600160a01b0316148061223357506122338185612022565b61224f5760405162461bcd60e51b8152600401610a50906133a9565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b6000818152600360209081526040808320546001600160a01b03811684526004909252822080549192909160a084901c919083906122ec9060019061346b565b815481106122fc576122fc61355a565b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16905060018380549050612335919061346b565b8263ffffffff16146123c65763ffffffff81811660009081526003602052604090208054600167ffffffff0000000160a01b031663ffffffff60a01b60a086901b161790558354829185919085169081106123925761239261355a565b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff1602179055505b828054806123d6576123d6613544565b600082815260209020600860001990920191820401805463ffffffff600460078516026101000a02191690559055611bde84865b60008181526006602052604080822080546001600160a01b0319169055518291906001600160a01b038516907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908390a45050565b6001600160a01b0383166000908152600460205260408120905b8281101561250c5781546001600160a01b0386169060a09061249c9084906133fb565b6001600160c01b0316901b6001600160c01b031660c0836005805490506124c391906133fb565b6001600160e01b0316901b17176001600160e01b03166003600083876124e991906133fb565b815260208101919091526040016000205580612504816134e9565b915050612479565b506125188184846129c0565b61102d600584846129c0565b61252d816122ac565b60008181526003602052604081208054908290556005805460c09290921c92916125599060019061346b565b815481106125695761256961355a565b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16905060016005805490506125a3919061346b565b8263ffffffff161461262c5763ffffffff818116600090815260036020526040902080546001600160c01b031663ffffffff60c01b60c086901b1617905560058054839285169081106125f8576125f861355a565b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff1602179055505b600580548061263d5761263d613544565b600082815260209020600860001990920191820401805463ffffffff600460078516026101000a02191690559055505050565b835160208086019190912060405161190160f01b928101929092527f0000000000000000000000000000000000000000000000000000000000000000602283015260428201819052600091829060620160405160208183030381529060405280519060200120905060006126e682888888612a78565b98975050505050505050565b826001600160a01b0316826001600160a01b031614156127445760405162461bcd60e51b815260206004820152600d60248201526c1cd95b1988185c1c1c9bdd985b609a1b6044820152606401610a50565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60608160ff16600214806127c857508160ff166008145b806127d657508160ff16600a145b806127e457508160ff166010145b6127ed57600080fd5b8261281057506040805180820190915260018152600360fc1b6020820152610991565b60408051610100808252610120820190925260009160208201818036833701905050905060005b84156128c557600061284c60ff861687613504565b9050600061285b826030613413565b9050600a8260ff161061287657612873600782613413565b90505b8060f81b848480612886906134e9565b9550815181106128985761289861355a565b60200101906001600160f81b031916908160001a9053506128bc60ff871688613438565b96505050612837565b60008167ffffffffffffffff8111156128e0576128e0613570565b6040519080825280601f01601f19166020018201604052801561290a576020820181803683370190505b509050600091505b805182101561298b5782828151811061292d5761292d61355a565b602001015160f81c60f81b816001848451612948919061346b565b612952919061346b565b815181106129625761296261355a565b60200101906001600160f81b031916908160001a90535081612983816134e9565b925050612912565b95945050505050565b606082826040516020016129a9929190613246565b604051602081830303815290604052905092915050565b82548181018455836000526008810460206000200160088206915081151915612a255781600803838111156129f25750825b815460005b82811015612a16578681018582016020021b91909117906001016129f7565b50825593840193909203916001015b600091505b82821015611bde57600883811115612a3f5750825b6000805b82811015612a62578481018701602082021b9190911790600101612a43565b5080600885048401555050600882019150612a2a565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115612aea5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964207369676e6174757265202773272076616c756500000000006044820152606401610a50565b8360ff16601b1480612aff57508360ff16601c145b612b4b5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964207369676e6174757265202776272076616c756500000000006044820152606401610a50565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015612b9f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661298b5760405162461bcd60e51b8152600401610a50906132ea565b828054612bde906134ae565b90600052602060002090601f016020900481019282612c005760008555612c46565b82601f10612c1957805160ff1916838001178555612c46565b82800160010185558215612c46579182015b82811115612c46578251825591602001919060010190612c2b565b50612c52929150612c8c565b5090565b508054612c62906134ae565b6000825580601f10612c72575050565b601f01602090049060005260206000209081019061201291905b5b80821115612c525760008155600101612c8d565b80356001600160a01b0381168114612cb857600080fd5b919050565b80358015158114612cb857600080fd5b600082601f830112612cde57600080fd5b813567ffffffffffffffff80821115612cf957612cf9613570565b604051601f8301601f19908116603f01168101908282118183101715612d2157612d21613570565b81604052838152866020858801011115612d3a57600080fd5b836020870160208301376000602085830101528094505050505092915050565b803560ff81168114612cb857600080fd5b600060208284031215612d7d57600080fd5b611d0182612ca1565b60008060408385031215612d9957600080fd5b612da283612ca1565b9150612db060208401612ca1565b90509250929050565b600080600080600080600060e0888a031215612dd457600080fd5b612ddd88612ca1565b9650612deb60208901612ca1565b9550612df960408901612cbd565b945060608801359350612e0e60808901612d5a565b925060a0880135915060c0880135905092959891949750929550565b600080600060608486031215612e3f57600080fd5b612e4884612ca1565b9250612e5660208501612ca1565b9150604084013590509250925092565b60008060008060808587031215612e7c57600080fd5b612e8585612ca1565b9350612e9360208601612ca1565b925060408501359150606085013567ffffffffffffffff811115612eb657600080fd5b612ec287828801612ccd565b91505092959194509250565b600080600080600080600060e0888a031215612ee957600080fd5b612ef288612ca1565b9650612f0060208901612ca1565b95506040880135945060608801359350612e0e60808901612d5a565b60008060408385031215612f2f57600080fd5b612f3883612ca1565b9150612db060208401612cbd565b60008060408385031215612f5957600080fd5b612f6283612ca1565b9150602083013561ffff81168114612f7957600080fd5b809150509250929050565b60008060408385031215612f9757600080fd5b612fa083612ca1565b946020939093013593505050565b600080600060608486031215612fc357600080fd5b612fcc84612ca1565b925060208401359150604084013567ffffffffffffffff811115612fef57600080fd5b612ffb86828701612ccd565b9150509250925092565b60008060006060848603121561301a57600080fd5b61302384612ca1565b95602085013595506040909401359392505050565b6000806000806080858703121561304e57600080fd5b61305785612ca1565b93506020850135925060408501359150606085013567ffffffffffffffff811115612eb657600080fd5b60006020828403121561309357600080fd5b8135611d0181613586565b6000602082840312156130b057600080fd5b8151611d0181613586565b6000602082840312156130cd57600080fd5b813567ffffffffffffffff8111156130e457600080fd5b6130f084828501612ccd565b949350505050565b60006020828403121561310a57600080fd5b5035919050565b6000806040838503121561312457600080fd5b82359150602083013567ffffffffffffffff81111561314257600080fd5b61314e85828601612ccd565b9150509250929050565b6000806040838503121561316b57600080fd5b50508035926020909101359150565b60008151808452613192816020860160208601613482565b601f01601f19169290920160200192915050565b8054600090600181811c90808316806131c057607f831692505b60208084108214156131e257634e487b7160e01b600052602260045260246000fd5b838852602088018280156131fd576001811461320e57613239565b60ff19871682528282019750613239565b60008981526020902060005b878110156132335781548482015290860190840161321a565b83019850505b5050505050505092915050565b60008351613258818460208801613482565b83519083019061326c818360208801613482565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132a89083018461317a565b9695505050505050565b602081526000611d01602083018461317a565b6040815260006132d860408301856131a6565b828103602084015261298b818561317a565b602080825260119082015270696e76616c6964207369676e617475726560781b604082015260600190565b6020808252601390820152721d1bdad95b88191bd95cdb89dd08195e1a5cdd606a1b604082015260600190565b60208082526021908201527f696e76616c6964206f6e455243373231526563656976656420726573706f6e736040820152606560f81b606082015260800190565b6020808252600c908201526b7a65726f206164647265737360a01b604082015260600190565b6020808252600d908201526c1858d8d95cdcc819195b9a5959609a1b604082015260600190565b8381526060602082015260006133e960608301856131a6565b82810360408401526132a8818561317a565b6000821982111561340e5761340e613518565b500190565b600060ff821660ff84168060ff0382111561343057613430613518565b019392505050565b6000826134475761344761352e565b500490565b600081600019048311821515161561346657613466613518565b500290565b60008282101561347d5761347d613518565b500390565b60005b8381101561349d578181015183820152602001613485565b8381111561102d5750506000910152565b600181811c908216806134c257607f821691505b602082108114156134e357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156134fd576134fd613518565b5060010190565b6000826135135761351361352e565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461201257600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204085e746d9cc4a0f330ae868e5b50cb324de5332b3d4acd8ab1b40f6ee0e1f9564736f6c6343000807003368747470733a2f2f676174657761792e70696e6174612e636c6f75642f697066732f516d5539327738694b7063616162436f7948744d6737696976574771573267573168674152447471436d4a555776000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000014694e465420506572736f6e616c69747920506f640000000000000000000000000000000000000000000000000000000000000000000000000000000000000003504f440000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103f15760003560e01c806374d5e10011610215578063af65e2a811610125578063d505accf116100b8578063e985e9c511610087578063e985e9c514610918578063f2fde38b1461092b578063f63c2f821461093e578063f822d5aa14610946578063fcc2c0781461095957600080fd5b8063d505accf146108e0578063d5bb7f67146108f3578063e62cac7614610906578063e8a3d4851461091057600080fd5b8063c0d6568d116100f4578063c0d6568d146108a8578063c688d693146108b0578063c87b56dd146108c3578063cc2da7ff146108d657600080fd5b8063af65e2a814610865578063b256456914610878578063b29a2f441461088b578063b88d4fde1461089557600080fd5b80639032c726116101a85780639fbc8713116101775780639fbc87131461080e578063a144819414610821578063a22cb46514610834578063ae5b102e14610847578063ae682e2e1461085a57600080fd5b80639032c726146107d8578063938e3d7b146107eb57806395d89b41146107fe57806398b622a21461080657600080fd5b80638a71bb2d116101e45780638a71bb2d1461078b5780638d4e57e6146107b35780638da5cb5b146107bd5780638f6fba8c146107d057600080fd5b806374d5e10014610728578063768bfc9a146107485780638832e6e3146107515780638a114e131461076457600080fd5b80632f745c59116103105780634f6ccce7116102a35780636352211e116102725780636352211e146106d45780636c0360eb146106e757806370a08231146106ef57806372504a2414610702578063725f36261461071557600080fd5b80634f6ccce71461067457806355f804b314610687578063585956d61461069a57806361587911146106c157600080fd5b806340c10f19116102df57806340c10f191461061957806342842e0e1461062c57806342966c681461063f5780634f558e791461065257600080fd5b80632f745c591461059e57806330adf81f146105b1578063313ce567146105d85780633644e515146105f257600080fd5b8063191d0ffc116103885780632a55205a116103575780632a55205a146105225780632b521416146105545780632e81aaea146105695780632f54bf6e1461057c57600080fd5b8063191d0ffc146104c05780631a0b04ea146104e057806320606b70146104e857806323b872dd1461050f57600080fd5b80630dc5b424116103c45780630dc5b4241461047357806314b7b4e114610491578063162094c41461049b57806318160ddd146104ae57600080fd5b806301ffc9a7146103f657806306fdde031461041e578063081812fc14610433578063095ea7b31461045e575b600080fd5b610409610404366004613081565b61096c565b60405190151581526020015b60405180910390f35b610426610997565b60405161041591906132b2565b6104466104413660046130f8565b610a25565b6040516001600160a01b039091168152602001610415565b61047161046c366004612f84565b610a75565b005b61047c61020081565b60405163ffffffff9091168152602001610415565b61047c6210000081565b6104716104a9366004613111565b610a84565b6005545b604051908152602001610415565b6104b26104ce366004612d6b565b60086020526000908152604090205481565b61047c600881565b6104b27f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b61047161051d366004612e2a565b610b1b565b610535610530366004613158565b610ddd565b604080516001600160a01b039093168352602083019190915201610415565b306000908152602081905260409020546104b2565b610471610577366004613005565b610e1e565b61040961058a366004612d6b565b600b546001600160a01b0391821691161490565b6104b26105ac366004612f84565b611033565b6104b27fee2282d7affd5a432b221a559e429129347b0c19a3f102179a5fb1859eef3d2981565b6105e0600081565b60405160ff9091168152602001610415565b6104b27f7f38ced93aa8bd0ebb50b4ac09ced0cafab3a0fe70f45d9f76e489ee309d4ec181565b610471610627366004612f84565b6110d8565b61047161063a366004612e2a565b6112bf565b61047161064d3660046130f8565b6112da565b6104096106603660046130f8565b600090815260036020526040902054151590565b6104b26106823660046130f8565b611474565b6104716106953660046130bb565b611500565b6104b27f47ab88482c90e4bb94b82a947ae78fa91fb25de1469ab491f4c15b9a0a2677ee81565b6104716106cf366004613005565b61157f565b6104466106e23660046130f8565b61159a565b6104266115cf565b6104b26106fd366004612d6b565b6115dc565b610471610710366004612f46565b611620565b6104096107233660046130f8565b611727565b6104b2610736366004612d6b565b60006020819052908152604090205481565b61047c61040081565b61047161075f366004612fae565b611740565b6104b27fd9b5d3b66c60255ffa16c57c0f1b2db387997fa02af673da5767f1acb0f345af81565b600c546107a090600160a01b900461ffff1681565b60405161ffff9091168152602001610415565b61047c6201000081565b600b54610446906001600160a01b031681565b61047c600281565b6104716107e6366004612db9565b61180a565b6104716107f93660046130bb565b611992565b610426611a11565b6105e0600881565b600c54610446906001600160a01b031681565b61047161082f366004612f84565b611a1e565b610471610842366004612f1c565b611a38565b610471610855366004612f84565b611a43565b6104b2600160ff1b81565b610471610873366004613038565b611aed565b6104096108863660046130f8565b611be5565b61047c6220000081565b6104716108a3366004612e66565b611c18565b61047c600181565b6104096108be366004612f84565b611ce3565b6104266108d13660046130f8565b611d08565b61047c6240000081565b6104716108ee366004612ece565b611ea8565b6104716109013660046130f8565b612008565b61047c6202000081565b610426612015565b610409610926366004612d86565b612022565b610471610939366004612d6b565b612050565b61047c601081565b6104b2610954366004613005565b6120d6565b6104096109673660046130f8565b612101565b60006001600160e01b0319821663152a902d60e11b148061099157506109918261210d565b92915050565b600180546109a4906134ae565b80601f01602080910402602001604051908101604052809291908181526020018280546109d0906134ae565b8015610a1d5780601f106109f257610100808354040283529160200191610a1d565b820191906000526020600020905b815481529060010190602001808311610a0057829003601f168201915b505050505081565b600081815260036020526040812054610a595760405162461bcd60e51b8152600401610a5090613315565b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b610a803383836121af565b5050565b610a9062100000612101565b610aac5760405162461bcd60e51b8152600401610a50906133a9565b6000828152600a602052604090819020905133917f7989fff0ffb34805e8b3574b890ed6157f85a384c69b9a0c04991b24cabb825991610aef91869186906133d0565b60405180910390a26000828152600a602090815260409091208251610b1692840190612bd2565b505050565b6001600160a01b03831633148015610b385750610b386001611727565b80610b5c57506001600160a01b0383163314801590610b5c5750610b5c6002611727565b6001600160a01b0384163314610ba7576040518060400160405280602081526020017f7472616e7366657273206f6e20626568616c66206172652064697361626c6564815250610bd7565b604051806040016040528060168152602001751d1c985b9cd9995c9cc8185c9948191a5cd8589b195960521b8152505b90610bf55760405162461bcd60e51b8152600401610a5091906132b2565b506001600160a01b038216610c1c5760405162461bcd60e51b8152600401610a5090613383565b610c258161159a565b6001600160a01b0316836001600160a01b031614610c555760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038316331480610c855750610c7081610a25565b6001600160a01b0316336001600160a01b0316145b80610c955750610c958333612022565b610cb15760405162461bcd60e51b8152600401610a50906133a9565b610cba81611be5565b610cf55760405162461bcd60e51b815260206004820152600c60248201526b3637b1b5b2b2103a37b5b2b760a11b6044820152606401610a50565b816001600160a01b0316836001600160a01b031614610d9f57610d17816122ac565b6001600160a01b0382166000818152600460208181526040808420805487865260038452918520805460a09390931b63ffffffff60a01b1663ffffffff60c01b90931692909217909517905583546001810185559383529091206008830401805460079093169091026101000a63ffffffff8181021990931692841602919091179055610da9565b610da9838261240a565b80826001600160a01b0316846001600160a01b031660008051602061359d83398151915260405160405180910390a4505050565b600c5460009081906001600160a01b0381169061271090610e0990600160a01b900461ffff168661344c565b610e139190613438565b915091509250929050565b610e2a62010000612101565b610e465760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038316610e6c5760405162461bcd60e51b8152600401610a5090613383565b60018111610ead5760405162461bcd60e51b815260206004820152600e60248201526d1b881a5cc81d1bdbc81cdb585b1b60921b6044820152606401610a50565b818263ffffffff1614610ef65760405162461bcd60e51b8152602060048201526011602482015270746f6b656e204944206f766572666c6f7760781b6044820152606401610a50565b6001610f0282846133fb565b610f0c919061346b565b6001610f1883856133fb565b610f22919061346b565b63ffffffff1614610f6e5760405162461bcd60e51b81526020600482015260166024820152756e2d746820746f6b656e204944206f766572666c6f7760501b6044820152606401610a50565b60005b81811015610fd657610f8661066082856133fb565b15610fc45760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481b5a5b9d195960921b6044820152606401610a50565b80610fce816134e9565b915050610f71565b50610fe283838361245f565b60005b8181101561102d57610ff781846133fb565b6040516001600160a01b0386169060009060008051602061359d833981519152908290a480611025816134e9565b915050610fe5565b50505050565b600061103e836115dc565b82106110825760405162461bcd60e51b8152602060048201526013602482015272696e646578206f7574206f6620626f756e647360681b6044820152606401610a50565b6001600160a01b03831660009081526004602052604090208054839081106110ac576110ac61355a565b6000918252602090912060088204015460079091166004026101000a900463ffffffff16905092915050565b6110e462010000612101565b6111005760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b0382166111265760405162461bcd60e51b8152600401610a5090613383565b808163ffffffff161461116f5760405162461bcd60e51b8152602060048201526011602482015270746f6b656e204944206f766572666c6f7760781b6044820152606401610a50565b600081815260036020526040902054156111bc5760405162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e481b5a5b9d195960921b6044820152606401610a50565b6001600160a01b03821660008181526004602081815260408084208054600580548988526003865293872060a09290921b63ffffffff60a01b1660c09490941b63ffffffff60c01b1693909317909617909555845460018082018755958552918420600880840490910180546007948516860261010090810a63ffffffff81810219909316838c169182021790935584549889018555939096527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db091870491909101805496909316909302900a92830219909316910217905560405181906001600160a01b0384169060009060008051602061359d833981519152908290a45050565b610b1683838360405180602001604052806000815250611c18565b60006112e58261159a565b90506112f362020000612101565b61142a576001600160a01b0381163314801561131457506113146008611727565b8061133857506001600160a01b038116331480159061133857506113386010611727565b6001600160a01b0382163314611383576040518060400160405280601c81526020017f6275726e73206f6e20626568616c66206172652064697361626c6564000000008152506113af565b60405180604001604052806012815260200171189d5c9b9cc8185c9948191a5cd8589b195960721b8152505b906113cd5760405162461bcd60e51b8152600401610a5091906132b2565b506001600160a01b0381163314806113fe57506113e982610a25565b6001600160a01b0316336001600160a01b0316145b8061140e575061140e8133612022565b61142a5760405162461bcd60e51b8152600401610a50906133a9565b61143382612524565b6000828152600a6020526040812061144a91612c56565b60405182906000906001600160a01b0384169060008051602061359d833981519152908390a45050565b600061147f60055490565b82106114c35760405162461bcd60e51b8152602060048201526013602482015272696e646578206f7574206f6620626f756e647360681b6044820152606401610a50565b600582815481106114d6576114d661355a565b6000918252602090912060088204015460079091166004026101000a900463ffffffff1692915050565b61150c62100000612101565b6115285760405162461bcd60e51b8152600401610a50906133a9565b336001600160a01b03167fac455070f26733cc10c09e4389a74bf73bdb676d730ee31215c31d20daa880056009836040516115649291906132c5565b60405180910390a28051610a80906009906020840190612bd2565b610b1683838360405180602001604052806000815250611aed565b6000818152600360205260408120546001600160a01b0381166109915760405162461bcd60e51b8152600401610a5090613315565b600980546109a4906134ae565b60006001600160a01b0382166116045760405162461bcd60e51b8152600401610a5090613383565b506001600160a01b031660009081526004602052604090205490565b61162c62200000612101565b6116485760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038216151580611661575061ffff8116155b6116a05760405162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2103932b1b2b4bb32b960811b6044820152606401610a50565b600c546040805161ffff600160a01b840481168252841660208201526001600160a01b0385811693169133917f84fb129d2cd99229b2a8776ec84f49fb8c88d15fd4d6062e942d585bedc46632910160405180910390a4600c805461ffff909216600160a01b026001600160b01b03199092166001600160a01b0390931692909217179055565b3060009081526020819052604081205482168214610991565b61174a83836110d8565b823b15610b1657604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611786903390859088908890600401613275565b602060405180830381600087803b1580156117a057600080fd5b505af11580156117b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117d8919061309e565b90506001600160e01b03198116630a85bd0160e11b1461102d5760405162461bcd60e51b8152600401610a5090613342565b611815610400611727565b6118615760405162461bcd60e51b815260206004820152601d60248201527f6f70657261746f72207065726d697473206172652064697361626c65640000006044820152606401610a50565b6001600160a01b03871660009081526008602052604081208054611907917f47ab88482c90e4bb94b82a947ae78fa91fb25de1469ab491f4c15b9a0a2677ee918b918b918b91876118b1836134e9565b909155506040805160208101969096526001600160a01b03948516908601529290911660608401521515608083015260a082015260c0810187905260e0015b604051602081830303815290604052858585612670565b9050876001600160a01b0316816001600160a01b03161461193a5760405162461bcd60e51b8152600401610a50906132ea565b84421061197d5760405162461bcd60e51b81526020600482015260116024820152701cda59db985d1d5c9948195e1c1a5c9959607a1b6044820152606401610a50565b6119888888886126f2565b5050505050505050565b61199e62100000612101565b6119ba5760405162461bcd60e51b8152600401610a50906133a9565b336001600160a01b03167fcc40349b3e236533ad861f7df3d9177296d1ef695e7026e0f7d744abe60ab000600d836040516119f69291906132c5565b60405180910390a28051610a8090600d906020840190612bd2565b600280546109a4906134ae565b610a80828260405180602001604052806000815250611740565b610a803383836126f2565b611a50600160ff1b612101565b611a6c5760405162461bcd60e51b8152600401610a50906133a9565b6001600160a01b038216600090815260208190526040902054611a91903390836120d6565b6001600160a01b03831660008181526020818152604091829020849055815185815290810193909352909133917f5a10526456f5116c0b7b80582c217d666243fd51b6a2d92c8011e601c2462e5f910160405180910390a35050565b611af8848484610e1e565b833b1561102d5760005b82811015611bde5760006001600160a01b03861663150b7a023383611b27868a6133fb565b876040518563ffffffff1660e01b8152600401611b479493929190613275565b602060405180830381600087803b158015611b6157600080fd5b505af1158015611b75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b99919061309e565b90506001600160e01b03198116630a85bd0160e11b14611bcb5760405162461bcd60e51b8152600401610a5090613342565b5080611bd6816134e9565b915050611b02565b5050505050565b600081815260036020526040812054611c105760405162461bcd60e51b8152600401610a5090613315565b506001919050565b611c23848484610b1b565b823b1561102d57604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290611c5f903390899088908890600401613275565b602060405180830381600087803b158015611c7957600080fd5b505af1158015611c8d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb1919061309e565b90506001600160e01b03198116630a85bd0160e11b14611bde5760405162461bcd60e51b8152600401610a5090613342565b6001600160a01b038216600090815260208190526040812054821682145b9392505050565b600081815260036020526040902054606090611d365760405162461bcd60e51b8152600401610a5090613315565b6000828152600a602052604081208054611d4f906134ae565b80601f0160208091040260200160405190810160405280929190818152602001828054611d7b906134ae565b8015611dc85780601f10611d9d57610100808354040283529160200191611dc8565b820191906000526020600020905b815481529060010190602001808311611dab57829003601f168201915b50505050509050600081511115611ddf5792915050565b60098054611dec906134ae565b15159050611e0a575050604080516020810190915260008152919050565b611d0160098054611e1a906134ae565b80601f0160208091040260200160405190810160405280929190818152602001828054611e46906134ae565b8015611e935780601f10611e6857610100808354040283529160200191611e93565b820191906000526020600020905b815481529060010190602001808311611e7657829003601f168201915b5050505050611ea385600a6127b1565b612994565b611eb3610200611727565b611ef65760405162461bcd60e51b81526020600482015260146024820152731c195c9b5a5d1cc8185c9948191a5cd8589b195960621b6044820152606401610a50565b6001600160a01b03871660009081526008602052604081208054611f87917fee2282d7affd5a432b221a559e429129347b0c19a3f102179a5fb1859eef3d29918b918b918b9187611f46836134e9565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016118f0565b9050876001600160a01b0316816001600160a01b031614611fba5760405162461bcd60e51b8152600401610a50906132ea565b844210611ffd5760405162461bcd60e51b81526020600482015260116024820152701cda59db985d1d5c9948195e1c1a5c9959607a1b6044820152606401610a50565b6119888888886121af565b6120123082611a43565b50565b600d80546109a4906134ae565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b61205c62400000612101565b6120785760405162461bcd60e51b8152600401610a50906133a9565b600b546040516001600160a01b0380841692169033907fb9312e2100469bd44e3f762c248f4dcc8d7788906fabf34f79db45920c37e26990600090a4600b80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b03929092166000908152602081905260409020546000198084188216189216171690565b60006109913383611ce3565b60006001600160e01b031982166301ffc9a760e01b148061213e57506001600160e01b031982166380ac58cd60e01b145b8061215957506001600160e01b03198216635b5e139f60e01b145b8061217457506001600160e01b0319821663780e9d6360e01b145b8061218f57506001600160e01b03198216633197b5d160e21b145b8061099157506001600160e01b03198216630852cd8d60e31b1492915050565b60006121ba8261159a565b9050806001600160a01b0316836001600160a01b0316141561220e5760405162461bcd60e51b815260206004820152600d60248201526c1cd95b1988185c1c1c9bdd985b609a1b6044820152606401610a50565b806001600160a01b0316846001600160a01b0316148061223357506122338185612022565b61224f5760405162461bcd60e51b8152600401610a50906133a9565b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050565b6000818152600360209081526040808320546001600160a01b03811684526004909252822080549192909160a084901c919083906122ec9060019061346b565b815481106122fc576122fc61355a565b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16905060018380549050612335919061346b565b8263ffffffff16146123c65763ffffffff81811660009081526003602052604090208054600167ffffffff0000000160a01b031663ffffffff60a01b60a086901b161790558354829185919085169081106123925761239261355a565b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff1602179055505b828054806123d6576123d6613544565b600082815260209020600860001990920191820401805463ffffffff600460078516026101000a02191690559055611bde84865b60008181526006602052604080822080546001600160a01b0319169055518291906001600160a01b038516907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925908390a45050565b6001600160a01b0383166000908152600460205260408120905b8281101561250c5781546001600160a01b0386169060a09061249c9084906133fb565b6001600160c01b0316901b6001600160c01b031660c0836005805490506124c391906133fb565b6001600160e01b0316901b17176001600160e01b03166003600083876124e991906133fb565b815260208101919091526040016000205580612504816134e9565b915050612479565b506125188184846129c0565b61102d600584846129c0565b61252d816122ac565b60008181526003602052604081208054908290556005805460c09290921c92916125599060019061346b565b815481106125695761256961355a565b90600052602060002090600891828204019190066004029054906101000a900463ffffffff16905060016005805490506125a3919061346b565b8263ffffffff161461262c5763ffffffff818116600090815260036020526040902080546001600160c01b031663ffffffff60c01b60c086901b1617905560058054839285169081106125f8576125f861355a565b90600052602060002090600891828204019190066004026101000a81548163ffffffff021916908363ffffffff1602179055505b600580548061263d5761263d613544565b600082815260209020600860001990920191820401805463ffffffff600460078516026101000a02191690559055505050565b835160208086019190912060405161190160f01b928101929092527f7f38ced93aa8bd0ebb50b4ac09ced0cafab3a0fe70f45d9f76e489ee309d4ec1602283015260428201819052600091829060620160405160208183030381529060405280519060200120905060006126e682888888612a78565b98975050505050505050565b826001600160a01b0316826001600160a01b031614156127445760405162461bcd60e51b815260206004820152600d60248201526c1cd95b1988185c1c1c9bdd985b609a1b6044820152606401610a50565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b60608160ff16600214806127c857508160ff166008145b806127d657508160ff16600a145b806127e457508160ff166010145b6127ed57600080fd5b8261281057506040805180820190915260018152600360fc1b6020820152610991565b60408051610100808252610120820190925260009160208201818036833701905050905060005b84156128c557600061284c60ff861687613504565b9050600061285b826030613413565b9050600a8260ff161061287657612873600782613413565b90505b8060f81b848480612886906134e9565b9550815181106128985761289861355a565b60200101906001600160f81b031916908160001a9053506128bc60ff871688613438565b96505050612837565b60008167ffffffffffffffff8111156128e0576128e0613570565b6040519080825280601f01601f19166020018201604052801561290a576020820181803683370190505b509050600091505b805182101561298b5782828151811061292d5761292d61355a565b602001015160f81c60f81b816001848451612948919061346b565b612952919061346b565b815181106129625761296261355a565b60200101906001600160f81b031916908160001a90535081612983816134e9565b925050612912565b95945050505050565b606082826040516020016129a9929190613246565b604051602081830303815290604052905092915050565b82548181018455836000526008810460206000200160088206915081151915612a255781600803838111156129f25750825b815460005b82811015612a16578681018582016020021b91909117906001016129f7565b50825593840193909203916001015b600091505b82821015611bde57600883811115612a3f5750825b6000805b82811015612a62578481018701602082021b9190911790600101612a43565b5080600885048401555050600882019150612a2a565b60007f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0821115612aea5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964207369676e6174757265202773272076616c756500000000006044820152606401610a50565b8360ff16601b1480612aff57508360ff16601c145b612b4b5760405162461bcd60e51b815260206004820152601b60248201527f696e76616c6964207369676e6174757265202776272076616c756500000000006044820152606401610a50565b6040805160008082526020820180845288905260ff871692820192909252606081018590526080810184905260019060a0016020604051602081039080840390855afa158015612b9f573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661298b5760405162461bcd60e51b8152600401610a50906132ea565b828054612bde906134ae565b90600052602060002090601f016020900481019282612c005760008555612c46565b82601f10612c1957805160ff1916838001178555612c46565b82800160010185558215612c46579182015b82811115612c46578251825591602001919060010190612c2b565b50612c52929150612c8c565b5090565b508054612c62906134ae565b6000825580601f10612c72575050565b601f01602090049060005260206000209081019061201291905b5b80821115612c525760008155600101612c8d565b80356001600160a01b0381168114612cb857600080fd5b919050565b80358015158114612cb857600080fd5b600082601f830112612cde57600080fd5b813567ffffffffffffffff80821115612cf957612cf9613570565b604051601f8301601f19908116603f01168101908282118183101715612d2157612d21613570565b81604052838152866020858801011115612d3a57600080fd5b836020870160208301376000602085830101528094505050505092915050565b803560ff81168114612cb857600080fd5b600060208284031215612d7d57600080fd5b611d0182612ca1565b60008060408385031215612d9957600080fd5b612da283612ca1565b9150612db060208401612ca1565b90509250929050565b600080600080600080600060e0888a031215612dd457600080fd5b612ddd88612ca1565b9650612deb60208901612ca1565b9550612df960408901612cbd565b945060608801359350612e0e60808901612d5a565b925060a0880135915060c0880135905092959891949750929550565b600080600060608486031215612e3f57600080fd5b612e4884612ca1565b9250612e5660208501612ca1565b9150604084013590509250925092565b60008060008060808587031215612e7c57600080fd5b612e8585612ca1565b9350612e9360208601612ca1565b925060408501359150606085013567ffffffffffffffff811115612eb657600080fd5b612ec287828801612ccd565b91505092959194509250565b600080600080600080600060e0888a031215612ee957600080fd5b612ef288612ca1565b9650612f0060208901612ca1565b95506040880135945060608801359350612e0e60808901612d5a565b60008060408385031215612f2f57600080fd5b612f3883612ca1565b9150612db060208401612cbd565b60008060408385031215612f5957600080fd5b612f6283612ca1565b9150602083013561ffff81168114612f7957600080fd5b809150509250929050565b60008060408385031215612f9757600080fd5b612fa083612ca1565b946020939093013593505050565b600080600060608486031215612fc357600080fd5b612fcc84612ca1565b925060208401359150604084013567ffffffffffffffff811115612fef57600080fd5b612ffb86828701612ccd565b9150509250925092565b60008060006060848603121561301a57600080fd5b61302384612ca1565b95602085013595506040909401359392505050565b6000806000806080858703121561304e57600080fd5b61305785612ca1565b93506020850135925060408501359150606085013567ffffffffffffffff811115612eb657600080fd5b60006020828403121561309357600080fd5b8135611d0181613586565b6000602082840312156130b057600080fd5b8151611d0181613586565b6000602082840312156130cd57600080fd5b813567ffffffffffffffff8111156130e457600080fd5b6130f084828501612ccd565b949350505050565b60006020828403121561310a57600080fd5b5035919050565b6000806040838503121561312457600080fd5b82359150602083013567ffffffffffffffff81111561314257600080fd5b61314e85828601612ccd565b9150509250929050565b6000806040838503121561316b57600080fd5b50508035926020909101359150565b60008151808452613192816020860160208601613482565b601f01601f19169290920160200192915050565b8054600090600181811c90808316806131c057607f831692505b60208084108214156131e257634e487b7160e01b600052602260045260246000fd5b838852602088018280156131fd576001811461320e57613239565b60ff19871682528282019750613239565b60008981526020902060005b878110156132335781548482015290860190840161321a565b83019850505b5050505050505092915050565b60008351613258818460208801613482565b83519083019061326c818360208801613482565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906132a89083018461317a565b9695505050505050565b602081526000611d01602083018461317a565b6040815260006132d860408301856131a6565b828103602084015261298b818561317a565b602080825260119082015270696e76616c6964207369676e617475726560781b604082015260600190565b6020808252601390820152721d1bdad95b88191bd95cdb89dd08195e1a5cdd606a1b604082015260600190565b60208082526021908201527f696e76616c6964206f6e455243373231526563656976656420726573706f6e736040820152606560f81b606082015260800190565b6020808252600c908201526b7a65726f206164647265737360a01b604082015260600190565b6020808252600d908201526c1858d8d95cdcc819195b9a5959609a1b604082015260600190565b8381526060602082015260006133e960608301856131a6565b82810360408401526132a8818561317a565b6000821982111561340e5761340e613518565b500190565b600060ff821660ff84168060ff0382111561343057613430613518565b019392505050565b6000826134475761344761352e565b500490565b600081600019048311821515161561346657613466613518565b500290565b60008282101561347d5761347d613518565b500390565b60005b8381101561349d578181015183820152602001613485565b8381111561102d5750506000910152565b600181811c908216806134c257607f821691505b602082108114156134e357634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156134fd576134fd613518565b5060010190565b6000826135135761351361352e565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160e01b03198116811461201257600080fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204085e746d9cc4a0f330ae868e5b50cb324de5332b3d4acd8ab1b40f6ee0e1f9564736f6c63430008070033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000014694e465420506572736f6e616c69747920506f640000000000000000000000000000000000000000000000000000000000000000000000000000000000000003504f440000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _name (string): iNFT Personality Pod
Arg [1] : _symbol (string): POD
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000014
Arg [3] : 694e465420506572736f6e616c69747920506f64000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [5] : 504f440000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.