ERC-721
Overview
Max Total Supply
4,712 APESER
Holders
243
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
2 APESERLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
AmericanApeComics
Compiler Version
v0.8.17+commit.8df45f5f
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.9; import "erc721a/contracts/ERC721A.sol"; import "erc721a/contracts/extensions/ERC721AQueryable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; /* * _____ ___ _____ _____ __ _____ ___ __ * /\/\ /\_/\/__ \/\ /\ / \\_ \/\ /\\_ \/ _\ \_ \/___\/\ \ \ * / \\_ _/ / /\/ /_/ / / /\ / / /\/\ \ / / / /\/\ \ / /\// // \/ / * / /\/\ \/ \ / / / __ / / /_//\/ /_ \ V /\/ /_ _\ \/\/ /_/ \_// /\ / * \/ \/\_/ \/ \/ /_/ /___,'\____/ \_/\____/ \__/\____/\___/\_\ \/ * * _ _ _ * / \ _ __ ___ ___ _ __(_) ___ __ _ _ __ / \ _ __ ___ * / _ \ | '_ ` _ \ / _ \ '__| |/ __/ _` | '_ \ / _ \ | '_ \ / _ \ * / ___ \| | | | | | __/ | | | (_| (_| | | | | / ___ \| |_) | __/ * /_/ \_\_| |_| |_|\___|_| |_|\___\__,_|_| |_| /_/ \_\ .__/ \___| * * * |* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO| * | * * * * * * * * * :::::::::::::::::::::::::| * |* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO| * | * * * * * * * * * :::::::::::::::::::::::::| * |* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO| * | * * * * * * * * * ::::::::::::::::::::;::::| * |* * * * * * * * * * OOOOOOOOOOOOOOOOOOOOOOOOO| * |:::::::::::::::::::::::::::::::::::::::::::::| * |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| * |:::::::::::::::::::::::::::::::::::::::::::::| * |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| * |:::::::::::::::::::::::::::::::::::::::::::::| * |OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO| */ /** * @title Myth Division American Ape Comics ERC-721 Smart Contract */ contract AmericanApeComics is ERC721A, ERC721AQueryable, ERC2981, EIP712, Ownable, ReentrancyGuard { using ECDSA for bytes32; using Counters for Counters.Counter; Counters.Counter private counter; bytes32 constant TICKET_TYPE_HASH = keccak256("Ticket(address minter,uint256 comicId,uint256 qty)"); string private baseURI; uint256 public comicMintId = 0; bool public mintIsActive = false; bool public mintIsActivePresale = false; bool public mintIsActiveBurn = false; mapping(uint256 => Comic) public comics; struct Comic { uint256 tokenPricePublic; uint256 tokenPricePresale; uint256 maxPerTxnPublic; uint256 endTokenId; uint256 startBurnableTokenId; uint256 endBurnableTokenId; bytes32 merkleRoot; address ticketSigner; bytes32 freeClaimMerkleRoot; mapping(address => uint256) claimed; mapping(address => uint256) freeClaimed; } constructor() ERC721A("American Ape Comic Series", "APESER") EIP712("AmericanApeComics", "1.0") {} /* * @dev Calculate remaining mints for a comic via comic._endTokenId - totalMinted() */ function totalMinted() external view returns (uint256) { return _totalMinted(); } function _startTokenId() internal pure override returns (uint256) { return 1; } // SALE SETUP /* * @notice create a new comic */ function addComic( uint256 _tokenPricePublic, uint256 _tokenPricePresale, uint256 _maxPerTxnPublic, uint256 _endTokenId, uint256 _startBurnableTokenId, uint256 _endBurnableTokenId, bytes32 _merkleRoot, address _ticketSigner, bytes32 _freeClaimMerkleRoot ) external onlyOwner { require(_endTokenId > 0, "end token greater than zero"); Comic storage p = comics[counter.current()]; p.tokenPricePublic = _tokenPricePublic; p.tokenPricePresale = _tokenPricePresale; p.maxPerTxnPublic = _maxPerTxnPublic; p.endTokenId = _endTokenId; p.startBurnableTokenId = _startBurnableTokenId; p.endBurnableTokenId = _endBurnableTokenId; p.merkleRoot = _merkleRoot; p.ticketSigner = _ticketSigner; p.freeClaimMerkleRoot = _freeClaimMerkleRoot; counter.increment(); } /* * @notice edit an existing comic */ function editComic( uint256 _comicId, uint256 _tokenPricePublic, uint256 _tokenPricePresale, uint256 _maxPerTxnPublic, uint256 _endTokenId, uint256 _startBurnableTokenId, uint256 _endBurnableTokenId, bytes32 _merkleRoot, address _ticketSigner, bytes32 _freeClaimMerkleRoot ) external onlyOwner { require(comicExists(_comicId), ""); comics[_comicId].tokenPricePublic = _tokenPricePublic; comics[_comicId].tokenPricePresale = _tokenPricePresale; comics[_comicId].maxPerTxnPublic = _maxPerTxnPublic; comics[_comicId].endTokenId = _endTokenId; comics[_comicId].startBurnableTokenId = _startBurnableTokenId; comics[_comicId].endBurnableTokenId = _endBurnableTokenId; comics[_comicId].merkleRoot = _merkleRoot; comics[_comicId].ticketSigner = _ticketSigner; comics[_comicId].freeClaimMerkleRoot = _freeClaimMerkleRoot; } /* * @notice edit an existing comics merkle root */ function setComicMerkleRoot(uint256 _comicId, bytes32 _merkleRoot) external onlyOwner { require(comicExists(_comicId), ""); comics[_comicId].merkleRoot = _merkleRoot; } /* * @notice edit an existing comics ticket signer */ function setComicTicketSigner(uint256 _comicId, address _ticketSigner) external onlyOwner { require(comicExists(_comicId), ""); comics[_comicId].ticketSigner = _ticketSigner; } /* * @notice edit an existing comic with a merkle root for free claims */ function setComicFreeClaimMerkleRoot(uint256 _comicId, bytes32 _merkleRoot) external onlyOwner { require(comicExists(_comicId), ""); comics[_comicId].freeClaimMerkleRoot = _merkleRoot; } /* * @notice Set the comic id to mint */ function setComicMintId(uint256 _id) external onlyOwner { require(_id >= 0, "Must be greater or equal than zero"); comicMintId = _id; } // PUBLIC MINT function flipMintState() external onlyOwner { mintIsActive = !mintIsActive; } /* * @notice public mint function */ function mintComic(uint256 _qty) external payable nonReentrant { require(tx.origin == msg.sender); require(mintIsActive, "Mint is not active"); Comic storage comic = comics[comicMintId]; // common sale checks require( _qty <= comic.maxPerTxnPublic, "You went over max tokens per transaction" ); require( _nextTokenId() + _qty <= comic.endTokenId + 1, "Not enough tokens left to mint that many" ); require( comic.tokenPricePublic * _qty == msg.value, "You sent the incorrect amount of ETH" ); _safeMint(msg.sender, _qty); } // TEAM/OWNER MINT /* * @notice reserve mint n numbers of tokens */ function mintReserveTokens(uint256 _qty) public onlyOwner { require( _nextTokenId() + _qty <= comics[comicMintId].endTokenId + 1, "Not enough tokens left to mint that many" ); _safeMint(msg.sender, _qty); } /* * @notice mint a token id to a wallet */ function mintTokenToWallet(address _toWallet, uint256 _qty) public onlyOwner { require( _nextTokenId() + _qty <= comics[comicMintId].endTokenId + 1, "Not enough tokens left to mint that many" ); _safeMint(_toWallet, _qty); } // PRESALE MINT /* * @notice Turn on/off presale wallet mint */ function flipPresaleMintState() external onlyOwner { mintIsActivePresale = !mintIsActivePresale; } /* * @notice view function to check if a merkleProof is valid before sending presale mint function */ function isOnPresaleMerkle(bytes32[] calldata _merkleProof, uint256 _qty) public view returns (bool) { bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _qty)); return MerkleProof.verify( _merkleProof, comics[comicMintId].merkleRoot, leaf ); } /* * @notice reset a list of addresses to be able to presale mint again. */ function initPresaleMerkleWalletList( address[] memory _walletList, uint256 _qty ) external onlyOwner { for (uint i; i < _walletList.length; i++) { comics[comicMintId].claimed[_walletList[i]] = _qty; } } /* * @notice Check how many tokens a wallet claimed for the current presale */ function claimedPresaleAmount(address _wallet) public view returns (uint256) { return comics[comicMintId].claimed[_wallet]; } /* * @notice Check how many tokens a wallet claimed for a presale */ function claimedPresaleAmountForComic(address _wallet, uint256 _comicId) external view returns (uint256) { require(comicExists(_comicId), "Comic does not exist"); return comics[_comicId].claimed[_wallet]; } /* * @notice Presale wallet list mint via merkle proof */ function mintPresaleMerkle( uint256 _qty, uint256 _maxQty, bytes32[] calldata _merkleProof ) external payable nonReentrant { require(tx.origin == msg.sender); Comic storage comic = comics[comicMintId]; require( mintIsActivePresale && comic.merkleRoot != 0, "Presale mint via allowlist is not active" ); bytes32 node = keccak256(abi.encodePacked(msg.sender, _maxQty)); require( MerkleProof.verify(_merkleProof, comic.merkleRoot, node), "Invalid Merkle Proof" ); // common sale checks require( comic.tokenPricePresale * _qty == msg.value, "You sent the incorrect amount of ETH" ); require( comic.claimed[msg.sender] + _qty <= _maxQty, "Claim: Not allowed to claim given amount" ); require( _nextTokenId() + _qty <= comic.endTokenId + 1, "Not enough tokens left to mint that many" ); comic.claimed[msg.sender] += _qty; _safeMint(msg.sender, _qty); } /* * @notice Presale wallet list mint via signature ("ticket") */ function mintPresaleTicket( uint256 _qty, uint256 _maxQty, bytes calldata _ticket ) external payable nonReentrant { require(tx.origin == msg.sender); Comic storage comic = comics[comicMintId]; require( mintIsActivePresale && comic.ticketSigner != address(0), "Presale mint via ticket is not active" ); bytes32 claimDigest = _hashTypedDataV4( keccak256( abi.encode(TICKET_TYPE_HASH, msg.sender, comicMintId, _maxQty) ) ); address recoveredSigner = ECDSA.recover(claimDigest, _ticket); require(recoveredSigner == comic.ticketSigner, "Invalid Ticket"); // common sale checks require( comic.tokenPricePresale * _qty == msg.value, "You sent the incorrect amount of ETH" ); require( comic.claimed[msg.sender] + _qty <= _maxQty, "Claim: Not allowed to claim given amount" ); require( _nextTokenId() + _qty <= comic.endTokenId + 1, "Not enough tokens left to mint that many" ); comic.claimed[msg.sender] += _qty; _safeMint(msg.sender, _qty); } // FREE CLAIMS DURING PRESALE /* * @notice view function to check if a merkleProof is valid before sending free mint function */ function isOnFreeClaimMerkle(bytes32[] calldata _merkleProof, uint256 _qty) public view returns (bool) { bytes32 leaf = keccak256(abi.encodePacked(msg.sender, _qty)); return MerkleProof.verify( _merkleProof, comics[comicMintId].freeClaimMerkleRoot, leaf ); } /* * @notice reset a list of addresses to be able to free mint again. */ function initFreeClaimMerkleWalletList( address[] memory _walletList, uint256 _qty ) external onlyOwner { for (uint i; i < _walletList.length; i++) { comics[comicMintId].freeClaimed[_walletList[i]] = _qty; } } /* * @notice Check how many free tokens a wallet claimed for the current presale */ function claimedFreeAmount(address _wallet) public view returns (uint256) { return comics[comicMintId].freeClaimed[_wallet]; } /* * @notice Check how many free tokens a wallet claimed for a presale */ function claimedFreeAmountForComic(address _wallet, uint256 _comicId) external view returns (uint256) { require(comicExists(_comicId), "Comic does not exist"); return comics[_comicId].freeClaimed[_wallet]; } /* * @notice Presale free claim wallet list mint via merkle proof */ function mintFreeClaimMerkle( uint256 _qty, uint256 _maxQty, bytes32[] calldata _merkleProof ) external payable nonReentrant { require(tx.origin == msg.sender); Comic storage comic = comics[comicMintId]; require( mintIsActivePresale && comic.freeClaimMerkleRoot != 0, "Presale mint via free claim is not active" ); bytes32 node = keccak256(abi.encodePacked(msg.sender, _maxQty)); require( MerkleProof.verify(_merkleProof, comic.freeClaimMerkleRoot, node), "Invalid Merkle Proof" ); // common sale checks require( comic.freeClaimed[msg.sender] + _qty <= _maxQty, "Claim: Not allowed to claim given amount" ); require( _nextTokenId() + _qty <= comic.endTokenId + 1, "Not enough tokens left to mint that many" ); comic.freeClaimed[msg.sender] += _qty; _safeMint(msg.sender, _qty); } // BURN MINT function flipBurnToMintState() external onlyOwner { mintIsActiveBurn = !mintIsActiveBurn; } /* * @notice burn tokens to mint */ function burnMint(uint256 _burnTokenId) external nonReentrant { require(tx.origin == msg.sender); require(mintIsActiveBurn, "Mint via burn is not active"); Comic storage comic = comics[comicMintId]; require( _nextTokenId() + 1 <= comic.endTokenId + 1, "Not enough tokens left to mint that many" ); require( msg.sender == ownerOf(_burnTokenId), "You do not own the token" ); require( _burnTokenId >= comic.startBurnableTokenId && _burnTokenId <= comic.endBurnableTokenId, "Invalid burnable token id" ); _burn(_burnTokenId); _safeMint(msg.sender, 1); } /* * @notice burn multiple tokens to mint */ function burnMintBatch(uint256[] calldata _burnTokenIds) external nonReentrant { require(tx.origin == msg.sender); require(mintIsActiveBurn, "Mint via burn is not active"); Comic storage comic = comics[comicMintId]; require( _nextTokenId() + _burnTokenIds.length <= comic.endTokenId + 1, "Not enough tokens left to mint that many" ); uint256 amount = _burnTokenIds.length; uint256 startBurnId = comic.startBurnableTokenId; uint256 endBurnId = comic.endBurnableTokenId; for (uint256 i = 0; i < amount; i++) { uint256 _burnTokenId = _burnTokenIds[i]; require( msg.sender == ownerOf(_burnTokenId), "You do not own the token" ); require( _burnTokenId >= startBurnId && _burnTokenId <= endBurnId, "Invalid burnable token id" ); _burn(_burnTokenId); } _safeMint(msg.sender, amount); } // PERSONAL BURN /* * @notice burn token id */ function burn(uint256 _tokenId) public virtual { require(msg.sender == ownerOf(_tokenId), "You do not own the token"); _burn(_tokenId); } /* * @notice burn batch token ids */ function burnBatch(uint256[] memory _tokenIds) external nonReentrant { for (uint256 i = 0; i < _tokenIds.length; i++) { require( msg.sender == ownerOf(_tokenIds[i]), "You do not own the token" ); _burn(_tokenIds[i]); } } // ADMINISTRATIVE FUNCTIONS function withdraw() external onlyOwner { uint256 balance = address(this).balance; Address.sendValue(payable(owner()), balance); } /** * Sets default token royalties. * * @param recipient The recipient of the royalties * @param value The royalties amount expressed as basis points (100 = 1%) */ function setDefaultRoyalty(address recipient, uint96 value) external onlyOwner { require( value <= 1_000, "Cannot set royalties higher than 1000 bps / 10%" ); _setDefaultRoyalty(recipient, value); } /* * @notice base URI to construct `tokenURI` in ERC721A */ function _baseURI() internal view override returns (string memory) { return baseURI; } /* * @notice set base URI of tokens */ function setBaseURI(string memory _uri) external onlyOwner { baseURI = _uri; } /* * @notice indicates weither any comic exists with a given id, or not */ function comicExists(uint256 _tokenId) public view returns (bool) { return comics[_tokenId].endTokenId > 0; } /* * @notice Check how many tokens a wallet claimed amongst all presales */ function claimedAmounts(address _wallet) external view returns (uint256[] memory) { uint256[] memory result = new uint256[](counter.current()); for (uint256 i; i < counter.current(); i++) { result[i] = comics[i].claimed[_wallet]; } return result; } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721A, IERC721A, ERC2981) returns (bool) { // Supports the following `interfaceId`s: // - IERC165: 0x01ffc9a7 // - IERC721: 0x80ac58cd // - IERC721Metadata: 0x5b5e139f // - IERC2981: 0x2a55205a return ERC721A.supportsInterface(interfaceId) || ERC2981.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721A.sol'; /** * @dev Interface of ERC721 token receiver. */ interface ERC721A__IERC721Receiver { function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } /** * @title ERC721A * * @dev Implementation of the [ERC721](https://eips.ethereum.org/EIPS/eip-721) * Non-Fungible Token Standard, including the Metadata extension. * Optimized for lower gas during batch mints. * * Token IDs are minted in sequential order (e.g. 0, 1, 2, 3, ...) * starting from `_startTokenId()`. * * Assumptions: * * - An owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * - The maximum token ID cannot exceed 2**256 - 1 (max value of uint256). */ contract ERC721A is IERC721A { // Bypass for a `--via-ir` bug (https://github.com/chiru-labs/ERC721A/pull/364). struct TokenApprovalRef { address value; } // ============================================================= // CONSTANTS // ============================================================= // Mask of an entry in packed address data. uint256 private constant _BITMASK_ADDRESS_DATA_ENTRY = (1 << 64) - 1; // The bit position of `numberMinted` in packed address data. uint256 private constant _BITPOS_NUMBER_MINTED = 64; // The bit position of `numberBurned` in packed address data. uint256 private constant _BITPOS_NUMBER_BURNED = 128; // The bit position of `aux` in packed address data. uint256 private constant _BITPOS_AUX = 192; // Mask of all 256 bits in packed address data except the 64 bits for `aux`. uint256 private constant _BITMASK_AUX_COMPLEMENT = (1 << 192) - 1; // The bit position of `startTimestamp` in packed ownership. uint256 private constant _BITPOS_START_TIMESTAMP = 160; // The bit mask of the `burned` bit in packed ownership. uint256 private constant _BITMASK_BURNED = 1 << 224; // The bit position of the `nextInitialized` bit in packed ownership. uint256 private constant _BITPOS_NEXT_INITIALIZED = 225; // The bit mask of the `nextInitialized` bit in packed ownership. uint256 private constant _BITMASK_NEXT_INITIALIZED = 1 << 225; // The bit position of `extraData` in packed ownership. uint256 private constant _BITPOS_EXTRA_DATA = 232; // Mask of all 256 bits in a packed ownership except the 24 bits for `extraData`. uint256 private constant _BITMASK_EXTRA_DATA_COMPLEMENT = (1 << 232) - 1; // The mask of the lower 160 bits for addresses. uint256 private constant _BITMASK_ADDRESS = (1 << 160) - 1; // The maximum `quantity` that can be minted with {_mintERC2309}. // This limit is to prevent overflows on the address data entries. // For a limit of 5000, a total of 3.689e15 calls to {_mintERC2309} // is required to cause an overflow, which is unrealistic. uint256 private constant _MAX_MINT_ERC2309_QUANTITY_LIMIT = 5000; // The `Transfer` event signature is given by: // `keccak256(bytes("Transfer(address,address,uint256)"))`. bytes32 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; // ============================================================= // STORAGE // ============================================================= // The next token ID to be minted. uint256 private _currentIndex; // The number of tokens burned. uint256 private _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. // See {_packedOwnershipOf} implementation for details. // // Bits Layout: // - [0..159] `addr` // - [160..223] `startTimestamp` // - [224] `burned` // - [225] `nextInitialized` // - [232..255] `extraData` mapping(uint256 => uint256) private _packedOwnerships; // Mapping owner address to address data. // // Bits Layout: // - [0..63] `balance` // - [64..127] `numberMinted` // - [128..191] `numberBurned` // - [192..255] `aux` mapping(address => uint256) private _packedAddressData; // Mapping from token ID to approved address. mapping(uint256 => TokenApprovalRef) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // ============================================================= // CONSTRUCTOR // ============================================================= constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; _currentIndex = _startTokenId(); } // ============================================================= // TOKEN COUNTING OPERATIONS // ============================================================= /** * @dev Returns the starting token ID. * To change the starting token ID, please override this function. */ function _startTokenId() internal view virtual returns (uint256) { return 0; } /** * @dev Returns the next token ID to be minted. */ function _nextTokenId() internal view virtual returns (uint256) { return _currentIndex; } /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() public view virtual override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than `_currentIndex - _startTokenId()` times. unchecked { return _currentIndex - _burnCounter - _startTokenId(); } } /** * @dev Returns the total amount of tokens minted in the contract. */ function _totalMinted() internal view virtual returns (uint256) { // Counter underflow is impossible as `_currentIndex` does not decrement, // and it is initialized to `_startTokenId()`. unchecked { return _currentIndex - _startTokenId(); } } /** * @dev Returns the total number of tokens burned. */ function _totalBurned() internal view virtual returns (uint256) { return _burnCounter; } // ============================================================= // ADDRESS DATA OPERATIONS // ============================================================= /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) public view virtual override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return _packedAddressData[owner] & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens minted by `owner`. */ function _numberMinted(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_MINTED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the number of tokens burned by or on behalf of `owner`. */ function _numberBurned(address owner) internal view returns (uint256) { return (_packedAddressData[owner] >> _BITPOS_NUMBER_BURNED) & _BITMASK_ADDRESS_DATA_ENTRY; } /** * Returns the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). */ function _getAux(address owner) internal view returns (uint64) { return uint64(_packedAddressData[owner] >> _BITPOS_AUX); } /** * Sets the auxiliary data for `owner`. (e.g. number of whitelist mint slots used). * If there are multiple variables, please pack them into a uint64. */ function _setAux(address owner, uint64 aux) internal virtual { uint256 packed = _packedAddressData[owner]; uint256 auxCasted; // Cast `aux` with assembly to avoid redundant masking. assembly { auxCasted := aux } packed = (packed & _BITMASK_AUX_COMPLEMENT) | (auxCasted << _BITPOS_AUX); _packedAddressData[owner] = packed; } // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { // The interface IDs are constants representing the first 4 bytes // of the XOR of all function selectors in the interface. // See: [ERC165](https://eips.ethereum.org/EIPS/eip-165) // (e.g. `bytes4(i.functionA.selector ^ i.functionB.selector ^ ...)`) return interfaceId == 0x01ffc9a7 || // ERC165 interface ID for ERC165. interfaceId == 0x80ac58cd || // ERC165 interface ID for ERC721. interfaceId == 0x5b5e139f; // ERC165 interface ID for ERC721Metadata. } // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the token collection symbol. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, _toString(tokenId))) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, it can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } // ============================================================= // OWNERSHIPS OPERATIONS // ============================================================= /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { return address(uint160(_packedOwnershipOf(tokenId))); } /** * @dev Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around over time. */ function _ownershipOf(uint256 tokenId) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnershipOf(tokenId)); } /** * @dev Returns the unpacked `TokenOwnership` struct at `index`. */ function _ownershipAt(uint256 index) internal view virtual returns (TokenOwnership memory) { return _unpackedOwnership(_packedOwnerships[index]); } /** * @dev Initializes the ownership slot minted at `index` for efficiency purposes. */ function _initializeOwnershipAt(uint256 index) internal virtual { if (_packedOwnerships[index] == 0) { _packedOwnerships[index] = _packedOwnershipOf(index); } } /** * Returns the packed ownership data of `tokenId`. */ function _packedOwnershipOf(uint256 tokenId) private view returns (uint256) { uint256 curr = tokenId; unchecked { if (_startTokenId() <= curr) if (curr < _currentIndex) { uint256 packed = _packedOwnerships[curr]; // If not burned. if (packed & _BITMASK_BURNED == 0) { // Invariant: // There will always be an initialized ownership slot // (i.e. `ownership.addr != address(0) && ownership.burned == false`) // before an unintialized ownership slot // (i.e. `ownership.addr == address(0) && ownership.burned == false`) // Hence, `curr` will not underflow. // // We can directly compare the packed value. // If the address is zero, packed will be zero. while (packed == 0) { packed = _packedOwnerships[--curr]; } return packed; } } } revert OwnerQueryForNonexistentToken(); } /** * @dev Returns the unpacked `TokenOwnership` struct from `packed`. */ function _unpackedOwnership(uint256 packed) private pure returns (TokenOwnership memory ownership) { ownership.addr = address(uint160(packed)); ownership.startTimestamp = uint64(packed >> _BITPOS_START_TIMESTAMP); ownership.burned = packed & _BITMASK_BURNED != 0; ownership.extraData = uint24(packed >> _BITPOS_EXTRA_DATA); } /** * @dev Packs ownership data into a single uint256. */ function _packOwnershipData(address owner, uint256 flags) private view returns (uint256 result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // `owner | (block.timestamp << _BITPOS_START_TIMESTAMP) | flags`. result := or(owner, or(shl(_BITPOS_START_TIMESTAMP, timestamp()), flags)) } } /** * @dev Returns the `nextInitialized` flag set if `quantity` equals 1. */ function _nextInitializedFlag(uint256 quantity) private pure returns (uint256 result) { // For branchless setting of the `nextInitialized` flag. assembly { // `(quantity == 1) << _BITPOS_NEXT_INITIALIZED`. result := shl(_BITPOS_NEXT_INITIALIZED, eq(quantity, 1)) } } // ============================================================= // APPROVAL OPERATIONS // ============================================================= /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) public payable virtual override { address owner = ownerOf(tokenId); if (_msgSenderERC721A() != owner) if (!isApprovedForAll(owner, _msgSenderERC721A())) { revert ApprovalCallerNotOwnerNorApproved(); } _tokenApprovals[tokenId].value = to; emit Approval(owner, to, tokenId); } /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId].value; } /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) public virtual override { _operatorApprovals[_msgSenderERC721A()][operator] = approved; emit ApprovalForAll(_msgSenderERC721A(), operator, approved); } /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted. See {_mint}. */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _startTokenId() <= tokenId && tokenId < _currentIndex && // If within bounds, _packedOwnerships[tokenId] & _BITMASK_BURNED == 0; // and not burned. } /** * @dev Returns whether `msgSender` is equal to `approvedAddress` or `owner`. */ function _isSenderApprovedOrOwner( address approvedAddress, address owner, address msgSender ) private pure returns (bool result) { assembly { // Mask `owner` to the lower 160 bits, in case the upper bits somehow aren't clean. owner := and(owner, _BITMASK_ADDRESS) // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean. msgSender := and(msgSender, _BITMASK_ADDRESS) // `msgSender == owner || msgSender == approvedAddress`. result := or(eq(msgSender, owner), eq(msgSender, approvedAddress)) } } /** * @dev Returns the storage slot and value for the approved address of `tokenId`. */ function _getApprovedSlotAndAddress(uint256 tokenId) private view returns (uint256 approvedAddressSlot, address approvedAddress) { TokenApprovalRef storage tokenApproval = _tokenApprovals[tokenId]; // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId].value`. assembly { approvedAddressSlot := tokenApproval.slot approvedAddress := sload(approvedAddressSlot) } } // ============================================================= // TRANSFER OPERATIONS // ============================================================= /** * @dev Transfers `tokenId` from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(uint160(prevOwnershipPacked)) != from) revert TransferFromIncorrectOwner(); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // We can directly increment and decrement the balances. --_packedAddressData[from]; // Updates: `balance -= 1`. ++_packedAddressData[to]; // Updates: `balance += 1`. // Updates: // - `address` to the next owner. // - `startTimestamp` to the timestamp of transfering. // - `burned` to `false`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( to, _BITMASK_NEXT_INITIALIZED | _nextExtraData(from, to, prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public payable virtual override { safeTransferFrom(from, to, tokenId, ''); } /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public payable virtual override { transferFrom(from, to, tokenId); if (to.code.length != 0) if (!_checkContractOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @dev Hook that is called before a set of serially-ordered token IDs * are about to be transferred. This includes minting. * And also called before burning one token. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token IDs * have been transferred. This includes minting. * And also called after one token has been burned. * * `startTokenId` - the first token ID to be transferred. * `quantity` - the amount to be transferred. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target contract. * * `from` - Previous owner of the given token ID. * `to` - Target address that will receive the token. * `tokenId` - Token ID to be transferred. * `_data` - Optional data to send along with the call. * * Returns whether the call correctly returned the expected magic value. */ function _checkContractOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { try ERC721A__IERC721Receiver(to).onERC721Received(_msgSenderERC721A(), from, tokenId, _data) returns ( bytes4 retval ) { return retval == ERC721A__IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } // ============================================================= // MINT OPERATIONS // ============================================================= /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event for each mint. */ function _mint(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // `balance` and `numberMinted` have a maximum limit of 2**64. // `tokenId` has a maximum limit of 2**256. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); uint256 toMasked; uint256 end = startTokenId + quantity; // Use assembly to loop and emit the `Transfer` event for gas savings. // The duplicated `log4` removes an extra check and reduces stack juggling. // The assembly, together with the surrounding Solidity code, have been // delicately arranged to nudge the compiler into producing optimized opcodes. assembly { // Mask `to` to the lower 160 bits, in case the upper bits somehow aren't clean. toMasked := and(to, _BITMASK_ADDRESS) // Emit the `Transfer` event. log4( 0, // Start of data (0, since no data). 0, // End of data (0, since no data). _TRANSFER_EVENT_SIGNATURE, // Signature. 0, // `address(0)`. toMasked, // `to`. startTokenId // `tokenId`. ) // The `iszero(eq(,))` check ensures that large values of `quantity` // that overflows uint256 will make the loop run out of gas. // The compiler will optimize the `iszero` away for performance. for { let tokenId := add(startTokenId, 1) } iszero(eq(tokenId, end)) { tokenId := add(tokenId, 1) } { // Emit the `Transfer` event. Similar to above. log4(0, 0, _TRANSFER_EVENT_SIGNATURE, 0, toMasked, tokenId) } } if (toMasked == 0) revert MintToZeroAddress(); _currentIndex = end; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * This function is intended for efficient minting only during contract creation. * * It emits only one {ConsecutiveTransfer} as defined in * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309), * instead of a sequence of {Transfer} event(s). * * Calling this function outside of contract creation WILL make your contract * non-compliant with the ERC721 standard. * For full ERC721 compliance, substituting ERC721 {Transfer} event(s) with the ERC2309 * {ConsecutiveTransfer} event is only permissible during contract creation. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {ConsecutiveTransfer} event. */ function _mintERC2309(address to, uint256 quantity) internal virtual { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (quantity > _MAX_MINT_ERC2309_QUANTITY_LIMIT) revert MintERC2309QuantityExceedsLimit(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are unrealistic due to the above check for `quantity` to be below the limit. unchecked { // Updates: // - `balance += quantity`. // - `numberMinted += quantity`. // // We can directly add to the `balance` and `numberMinted`. _packedAddressData[to] += quantity * ((1 << _BITPOS_NUMBER_MINTED) | 1); // Updates: // - `address` to the owner. // - `startTimestamp` to the timestamp of minting. // - `burned` to `false`. // - `nextInitialized` to `quantity == 1`. _packedOwnerships[startTokenId] = _packOwnershipData( to, _nextInitializedFlag(quantity) | _nextExtraData(address(0), to, 0) ); emit ConsecutiveTransfer(startTokenId, startTokenId + quantity - 1, address(0), to); _currentIndex = startTokenId + quantity; } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * See {_mint}. * * Emits a {Transfer} event for each mint. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal virtual { _mint(to, quantity); unchecked { if (to.code.length != 0) { uint256 end = _currentIndex; uint256 index = end - quantity; do { if (!_checkContractOnERC721Received(address(0), to, index++, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } while (index < end); // Reentrancy protection. if (_currentIndex != end) revert(); } } } /** * @dev Equivalent to `_safeMint(to, quantity, '')`. */ function _safeMint(address to, uint256 quantity) internal virtual { _safeMint(to, quantity, ''); } // ============================================================= // BURN OPERATIONS // ============================================================= /** * @dev Equivalent to `_burn(tokenId, false)`. */ function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId, bool approvalCheck) internal virtual { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); address from = address(uint160(prevOwnershipPacked)); (uint256 approvedAddressSlot, address approvedAddress) = _getApprovedSlotAndAddress(tokenId); if (approvalCheck) { // The nested ifs save around 20+ gas over a compound boolean condition. if (!_isSenderApprovedOrOwner(approvedAddress, from, _msgSenderERC721A())) if (!isApprovedForAll(from, _msgSenderERC721A())) revert TransferCallerNotOwnerNorApproved(); } _beforeTokenTransfers(from, address(0), tokenId, 1); // Clear approvals from the previous owner. assembly { if approvedAddress { // This is equivalent to `delete _tokenApprovals[tokenId]`. sstore(approvedAddressSlot, 0) } } // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as `tokenId` would have to be 2**256. unchecked { // Updates: // - `balance -= 1`. // - `numberBurned += 1`. // // We can directly decrement the balance, and increment the number burned. // This is equivalent to `packed -= 1; packed += 1 << _BITPOS_NUMBER_BURNED;`. _packedAddressData[from] += (1 << _BITPOS_NUMBER_BURNED) - 1; // Updates: // - `address` to the last owner. // - `startTimestamp` to the timestamp of burning. // - `burned` to `true`. // - `nextInitialized` to `true`. _packedOwnerships[tokenId] = _packOwnershipData( from, (_BITMASK_BURNED | _BITMASK_NEXT_INITIALIZED) | _nextExtraData(from, address(0), prevOwnershipPacked) ); // If the next slot may not have been initialized (i.e. `nextInitialized == false`) . if (prevOwnershipPacked & _BITMASK_NEXT_INITIALIZED == 0) { uint256 nextTokenId = tokenId + 1; // If the next slot's address is zero and not burned (i.e. packed value is zero). if (_packedOwnerships[nextTokenId] == 0) { // If the next slot is within bounds. if (nextTokenId != _currentIndex) { // Initialize the next slot to maintain correctness for `ownerOf(tokenId + 1)`. _packedOwnerships[nextTokenId] = prevOwnershipPacked; } } } } emit Transfer(from, address(0), tokenId); _afterTokenTransfers(from, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } // ============================================================= // EXTRA DATA OPERATIONS // ============================================================= /** * @dev Directly sets the extra data for the ownership data `index`. */ function _setExtraDataAt(uint256 index, uint24 extraData) internal virtual { uint256 packed = _packedOwnerships[index]; if (packed == 0) revert OwnershipNotInitializedForExtraData(); uint256 extraDataCasted; // Cast `extraData` with assembly to avoid redundant masking. assembly { extraDataCasted := extraData } packed = (packed & _BITMASK_EXTRA_DATA_COMPLEMENT) | (extraDataCasted << _BITPOS_EXTRA_DATA); _packedOwnerships[index] = packed; } /** * @dev Called during each token transfer to set the 24bit `extraData` field. * Intended to be overridden by the cosumer contract. * * `previousExtraData` - the value of `extraData` before transfer. * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _extraData( address from, address to, uint24 previousExtraData ) internal view virtual returns (uint24) {} /** * @dev Returns the next extra data for the packed ownership data. * The returned result is shifted into position. */ function _nextExtraData( address from, address to, uint256 prevOwnershipPacked ) private view returns (uint256) { uint24 extraData = uint24(prevOwnershipPacked >> _BITPOS_EXTRA_DATA); return uint256(_extraData(from, to, extraData)) << _BITPOS_EXTRA_DATA; } // ============================================================= // OTHER OPERATIONS // ============================================================= /** * @dev Returns the message sender (defaults to `msg.sender`). * * If you are writing GSN compatible contracts, you need to override this function. */ function _msgSenderERC721A() internal view virtual returns (address) { return msg.sender; } /** * @dev Converts a uint256 to its ASCII string decimal representation. */ function _toString(uint256 value) internal pure virtual returns (string memory str) { assembly { // The maximum value of a uint256 contains 78 digits (1 byte per digit), but // we allocate 0xa0 bytes to keep the free memory pointer 32-byte word aligned. // We will need 1 word for the trailing zeros padding, 1 word for the length, // and 3 words for a maximum of 78 digits. Total: 5 * 0x20 = 0xa0. let m := add(mload(0x40), 0xa0) // Update the free memory pointer to allocate. mstore(0x40, m) // Assign the `str` to the end. str := sub(m, 0x20) // Zeroize the slot after the string. mstore(str, 0) // Cache the end of the memory to calculate the length later. let end := str // We write the string from rightmost digit to leftmost digit. // The following is essentially a do-while loop that also handles the zero case. // prettier-ignore for { let temp := value } 1 {} { str := sub(str, 1) // Write the character to the pointer. // The ASCII index of the '0' character is 48. mstore8(str, add(48, mod(temp, 10))) // Keep dividing `temp` until zero. temp := div(temp, 10) // prettier-ignore if iszero(temp) { break } } let length := sub(end, str) // Move the pointer 32 bytes leftwards to make room for the length. str := sub(str, 0x20) // Store the length. mstore(str, length) } } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import './IERC721AQueryable.sol'; import '../ERC721A.sol'; /** * @title ERC721AQueryable. * * @dev ERC721A subclass with convenience query functions. */ abstract contract ERC721AQueryable is ERC721A, IERC721AQueryable { /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) public view virtual override returns (TokenOwnership memory) { TokenOwnership memory ownership; if (tokenId < _startTokenId() || tokenId >= _nextTokenId()) { return ownership; } ownership = _ownershipAt(tokenId); if (ownership.burned) { return ownership; } return _ownershipOf(tokenId); } /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] calldata tokenIds) external view virtual override returns (TokenOwnership[] memory) { unchecked { uint256 tokenIdsLength = tokenIds.length; TokenOwnership[] memory ownerships = new TokenOwnership[](tokenIdsLength); for (uint256 i; i != tokenIdsLength; ++i) { ownerships[i] = explicitOwnershipOf(tokenIds[i]); } return ownerships; } } /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view virtual override returns (uint256[] memory) { unchecked { if (start >= stop) revert InvalidQueryRange(); uint256 tokenIdsIdx; uint256 stopLimit = _nextTokenId(); // Set `start = max(start, _startTokenId())`. if (start < _startTokenId()) { start = _startTokenId(); } // Set `stop = min(stop, stopLimit)`. if (stop > stopLimit) { stop = stopLimit; } uint256 tokenIdsMaxLength = balanceOf(owner); // Set `tokenIdsMaxLength = min(balanceOf(owner), stop - start)`, // to cater for cases where `balanceOf(owner)` is too big. if (start < stop) { uint256 rangeLength = stop - start; if (rangeLength < tokenIdsMaxLength) { tokenIdsMaxLength = rangeLength; } } else { tokenIdsMaxLength = 0; } uint256[] memory tokenIds = new uint256[](tokenIdsMaxLength); if (tokenIdsMaxLength == 0) { return tokenIds; } // We need to call `explicitOwnershipOf(start)`, // because the slot at `start` may not be initialized. TokenOwnership memory ownership = explicitOwnershipOf(start); address currOwnershipAddr; // If the starting slot exists (i.e. not burned), initialize `currOwnershipAddr`. // `ownership.address` will not be zero, as `start` is clamped to the valid token ID range. if (!ownership.burned) { currOwnershipAddr = ownership.addr; } for (uint256 i = start; i != stop && tokenIdsIdx != tokenIdsMaxLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } // Downsize the array to fit. assembly { mstore(tokenIds, tokenIdsIdx) } return tokenIds; } } /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view virtual override returns (uint256[] memory) { unchecked { uint256 tokenIdsIdx; address currOwnershipAddr; uint256 tokenIdsLength = balanceOf(owner); uint256[] memory tokenIds = new uint256[](tokenIdsLength); TokenOwnership memory ownership; for (uint256 i = _startTokenId(); tokenIdsIdx != tokenIdsLength; ++i) { ownership = _ownershipAt(i); if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { tokenIds[tokenIdsIdx++] = i; } } return tokenIds; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; /** * @dev Interface of ERC721A. */ interface IERC721A { /** * The caller must own the token or be an approved operator. */ error ApprovalCallerNotOwnerNorApproved(); /** * The token does not exist. */ error ApprovalQueryForNonexistentToken(); /** * Cannot query the balance for the zero address. */ error BalanceQueryForZeroAddress(); /** * Cannot mint to the zero address. */ error MintToZeroAddress(); /** * The quantity of tokens minted must be more than zero. */ error MintZeroQuantity(); /** * The token does not exist. */ error OwnerQueryForNonexistentToken(); /** * The caller must own the token or be an approved operator. */ error TransferCallerNotOwnerNorApproved(); /** * The token must be owned by `from`. */ error TransferFromIncorrectOwner(); /** * Cannot safely transfer to a contract that does not implement the * ERC721Receiver interface. */ error TransferToNonERC721ReceiverImplementer(); /** * Cannot transfer to the zero address. */ error TransferToZeroAddress(); /** * The token does not exist. */ error URIQueryForNonexistentToken(); /** * The `quantity` minted with ERC2309 exceeds the safety limit. */ error MintERC2309QuantityExceedsLimit(); /** * The `extraData` cannot be set on an unintialized ownership slot. */ error OwnershipNotInitializedForExtraData(); // ============================================================= // STRUCTS // ============================================================= struct TokenOwnership { // The address of the owner. address addr; // Stores the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; // Arbitrary data similar to `startTimestamp` that can be set via {_extraData}. uint24 extraData; } // ============================================================= // TOKEN COUNTERS // ============================================================= /** * @dev Returns the total number of tokens in existence. * Burned tokens will reduce the count. * To get the total number of tokens minted, please see {_totalMinted}. */ function totalSupply() external view returns (uint256); // ============================================================= // IERC165 // ============================================================= /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * [EIP section](https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified) * to learn more about how these ids are created. * * This function call must use less than 30000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); // ============================================================= // IERC721 // ============================================================= /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables * (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in `owner`'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, * checking first that contract recipients are aware of the ERC721 protocol * to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move * this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement * {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external payable; /** * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Transfers `tokenId` from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} * whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token * by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external payable; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the * zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external payable; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} * for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll}. */ function isApprovedForAll(address owner, address operator) external view returns (bool); // ============================================================= // IERC721Metadata // ============================================================= /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); // ============================================================= // IERC2309 // ============================================================= /** * @dev Emitted when tokens in `fromTokenId` to `toTokenId` * (inclusive) is transferred from `from` to `to`, as defined in the * [ERC2309](https://eips.ethereum.org/EIPS/eip-2309) standard. * * See {_mintERC2309} for more details. */ event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to); }
// SPDX-License-Identifier: MIT // ERC721A Contracts v4.2.3 // Creator: Chiru Labs pragma solidity ^0.8.4; import '../IERC721A.sol'; /** * @dev Interface of ERC721AQueryable. */ interface IERC721AQueryable is IERC721A { /** * Invalid query range (`start` >= `stop`). */ error InvalidQueryRange(); /** * @dev Returns the `TokenOwnership` struct at `tokenId` without reverting. * * If the `tokenId` is out of bounds: * * - `addr = address(0)` * - `startTimestamp = 0` * - `burned = false` * - `extraData = 0` * * If the `tokenId` is burned: * * - `addr = <Address of owner before token was burned>` * - `startTimestamp = <Timestamp when token was burned>` * - `burned = true` * - `extraData = <Extra data when token was burned>` * * Otherwise: * * - `addr = <Address of owner>` * - `startTimestamp = <Timestamp of start of ownership>` * - `burned = false` * - `extraData = <Extra data at start of ownership>` */ function explicitOwnershipOf(uint256 tokenId) external view returns (TokenOwnership memory); /** * @dev Returns an array of `TokenOwnership` structs at `tokenIds` in order. * See {ERC721AQueryable-explicitOwnershipOf} */ function explicitOwnershipsOf(uint256[] memory tokenIds) external view returns (TokenOwnership[] memory); /** * @dev Returns an array of token IDs owned by `owner`, * in the range [`start`, `stop`) * (i.e. `start <= tokenId < stop`). * * This function allows for tokens to be queried if the collection * grows too big for a single call of {ERC721AQueryable-tokensOfOwner}. * * Requirements: * * - `start < stop` */ function tokensOfOwnerIn( address owner, uint256 start, uint256 stop ) external view returns (uint256[] memory); /** * @dev Returns an array of token IDs owned by `owner`. * * This function scans the ownership mapping and is O(`totalSupply`) in complexity. * It is meant to be called off-chain. * * See {ERC721AQueryable-tokensOfOwnerIn} for splitting the scan into * multiple smaller scans if the collection is large enough to cause * an out-of-gas error (10K collections should be fine). */ function tokensOfOwner(address owner) external view returns (uint256[] memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"InvalidQueryRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"_tokenPricePublic","type":"uint256"},{"internalType":"uint256","name":"_tokenPricePresale","type":"uint256"},{"internalType":"uint256","name":"_maxPerTxnPublic","type":"uint256"},{"internalType":"uint256","name":"_endTokenId","type":"uint256"},{"internalType":"uint256","name":"_startBurnableTokenId","type":"uint256"},{"internalType":"uint256","name":"_endBurnableTokenId","type":"uint256"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"},{"internalType":"address","name":"_ticketSigner","type":"address"},{"internalType":"bytes32","name":"_freeClaimMerkleRoot","type":"bytes32"}],"name":"addComic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"}],"name":"burnBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_burnTokenId","type":"uint256"}],"name":"burnMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_burnTokenIds","type":"uint256[]"}],"name":"burnMintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"claimedAmounts","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"claimedFreeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_comicId","type":"uint256"}],"name":"claimedFreeAmountForComic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"}],"name":"claimedPresaleAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wallet","type":"address"},{"internalType":"uint256","name":"_comicId","type":"uint256"}],"name":"claimedPresaleAmountForComic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"comicExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"comicMintId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"comics","outputs":[{"internalType":"uint256","name":"tokenPricePublic","type":"uint256"},{"internalType":"uint256","name":"tokenPricePresale","type":"uint256"},{"internalType":"uint256","name":"maxPerTxnPublic","type":"uint256"},{"internalType":"uint256","name":"endTokenId","type":"uint256"},{"internalType":"uint256","name":"startBurnableTokenId","type":"uint256"},{"internalType":"uint256","name":"endBurnableTokenId","type":"uint256"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"address","name":"ticketSigner","type":"address"},{"internalType":"bytes32","name":"freeClaimMerkleRoot","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_comicId","type":"uint256"},{"internalType":"uint256","name":"_tokenPricePublic","type":"uint256"},{"internalType":"uint256","name":"_tokenPricePresale","type":"uint256"},{"internalType":"uint256","name":"_maxPerTxnPublic","type":"uint256"},{"internalType":"uint256","name":"_endTokenId","type":"uint256"},{"internalType":"uint256","name":"_startBurnableTokenId","type":"uint256"},{"internalType":"uint256","name":"_endBurnableTokenId","type":"uint256"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"},{"internalType":"address","name":"_ticketSigner","type":"address"},{"internalType":"bytes32","name":"_freeClaimMerkleRoot","type":"bytes32"}],"name":"editComic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"explicitOwnershipOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"explicitOwnershipsOf","outputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"startTimestamp","type":"uint64"},{"internalType":"bool","name":"burned","type":"bool"},{"internalType":"uint24","name":"extraData","type":"uint24"}],"internalType":"struct IERC721A.TokenOwnership[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flipBurnToMintState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flipMintState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flipPresaleMintState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_walletList","type":"address[]"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"initFreeClaimMerkleWalletList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_walletList","type":"address[]"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"initPresaleMerkleWalletList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"isOnFreeClaimMerkle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"isOnPresaleMerkle","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"mintComic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_qty","type":"uint256"},{"internalType":"uint256","name":"_maxQty","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"mintFreeClaimMerkle","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintIsActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintIsActiveBurn","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintIsActivePresale","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_qty","type":"uint256"},{"internalType":"uint256","name":"_maxQty","type":"uint256"},{"internalType":"bytes32[]","name":"_merkleProof","type":"bytes32[]"}],"name":"mintPresaleMerkle","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_qty","type":"uint256"},{"internalType":"uint256","name":"_maxQty","type":"uint256"},{"internalType":"bytes","name":"_ticket","type":"bytes"}],"name":"mintPresaleTicket","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"mintReserveTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_toWallet","type":"address"},{"internalType":"uint256","name":"_qty","type":"uint256"}],"name":"mintTokenToWallet","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":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","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":"payable","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":"_uri","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_comicId","type":"uint256"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setComicFreeClaimMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_comicId","type":"uint256"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setComicMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"setComicMintId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_comicId","type":"uint256"},{"internalType":"address","name":"_ticketSigner","type":"address"}],"name":"setComicTicketSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint96","name":"value","type":"uint96"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"tokensOfOwner","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"stop","type":"uint256"}],"name":"tokensOfOwnerIn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101406040526000600e55600f805462ffffff191690553480156200002357600080fd5b5060405180604001604052806011815260200170416d65726963616e417065436f6d69637360781b815250604051806040016040528060038152602001620312e360ec1b8152506040518060400160405280601981526020017f416d65726963616e2041706520436f6d696320536572696573000000000000008152506040518060400160405280600681526020016520a822a9a2a960d11b8152508160029081620000d0919062000283565b506003620000df828262000283565b5050600160005550815160209283012081519183019190912060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818801819052818301969096526060810194909452608080850193909352308483018190528151808603909301835260c0948501909152815191909501209052919091526101205262000181336200018c565b6001600b556200034f565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200020957607f821691505b6020821081036200022a57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200027e57600081815260208120601f850160051c81016020861015620002595750805b601f850160051c820191505b818110156200027a5782815560010162000265565b5050505b505050565b81516001600160401b038111156200029f576200029f620001de565b620002b781620002b08454620001f4565b8462000230565b602080601f831160018114620002ef5760008415620002d65750858301515b600019600386901b1c1916600185901b1785556200027a565b600085815260208120601f198616915b828110156200032057888601518255948401946001909101908401620002ff565b50858210156200033f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e051610100516101205161455b6200039f60003960006133f3015260006134420152600061341d01526000613376015260006133a0015260006133ca015261455b6000f3fe6080604052600436106103975760003560e01c80636d178141116101dc578063afb05f7d11610102578063dd75fe93116100a0578063f2fde38b1161006f578063f2fde38b14610b97578063f919583914610bb7578063f931a4c214610bcd578063ff5a70c614610be257600080fd5b8063dd75fe9314610aee578063e4623c1b14610b0e578063e985e9c514610b2e578063ec5787c214610b7757600080fd5b8063c60a2584116100dc578063c60a258414610a7b578063c87b56dd14610a9b578063ca561d6f14610abb578063d96f87f014610ace57600080fd5b8063afb05f7d14610a09578063b88d4fde14610a3b578063c23dc68f14610a4e57600080fd5b80638462151c1161017a57806399a2557a1161014957806399a2557a146109905780639b327408146109b0578063a22cb465146109d0578063a2309ff8146109f057600080fd5b80638462151c1461091d578063864758e81461093d5780638da5cb5b1461095d57806395d89b411461097b57600080fd5b806371417b32116101b657806371417b32146107ff578063715018a61461082c5780637a80dc1d146108415780637c08aabe146108fd57600080fd5b80636d178141146107825780636dee5615146107ca57806370a08231146107df57600080fd5b80633125ac6c116102c15780634cd55f791161025f5780635d90dd141161022e5780635d90dd141461070f5780635e98b51d1461072f5780635ef2fcc2146107425780636352211e1461076257600080fd5b80634cd55f791461069a57806355f804b3146106ad57806359c74f29146106cd5780635bbb2177146106e257600080fd5b806342966c681161029b57806342966c6814610620578063471a429414610640578063478307371461065a5780634ae92cfa1461067a57600080fd5b80633125ac6c146105d85780633ccfd60b146105f857806342842e0e1461060d57600080fd5b8063120b99891161033957806323b872dd1161030857806323b872dd14610553578063288bd8fd146105665780632a55205a146105865780633018184e146105c557600080fd5b8063120b9989146104d6578063149841e9146104f65780631675be861461051657806318160ddd1461053657600080fd5b806306fdde031161037557806306fdde0314610449578063081812fc1461046b578063095ea7b3146104a35780630ec992a1146104b657600080fd5b806301ffc9a71461039c57806304634d8d146103d1578063058b63f4146103f3575b600080fd5b3480156103a857600080fd5b506103bc6103b73660046138d8565b610c01565b60405190151581526020015b60405180910390f35b3480156103dd57600080fd5b506103f16103ec366004613911565b610c21565b005b3480156103ff57600080fd5b5061043b61040e366004613954565b600e5460009081526010602090815260408083206001600160a01b039094168352600a9093019052205490565b6040519081526020016103c8565b34801561045557600080fd5b5061045e610caf565b6040516103c891906139bf565b34801561047757600080fd5b5061048b6104863660046139d2565b610d41565b6040516001600160a01b0390911681526020016103c8565b6103f16104b13660046139eb565b610d85565b3480156104c257600080fd5b5061043b6104d13660046139eb565b610e25565b3480156104e257600080fd5b506103f16104f1366004613a59565b610ea6565b34801561050257600080fd5b506103bc610511366004613a9a565b61107e565b34801561052257600080fd5b506103f1610531366004613ae5565b611107565b34801561054257600080fd5b50600154600054036000190161043b565b6103f1610561366004613b07565b61115c565b34801561057257600080fd5b506103f16105813660046139d2565b6112ed565b34801561059257600080fd5b506105a66105a1366004613ae5565b611354565b604080516001600160a01b0390931683526020830191909152016103c8565b6103f16105d3366004613b43565b611402565b3480156105e457600080fd5b506103f16105f33660046139d2565b61164c565b34801561060457600080fd5b506103f16117da565b6103f161061b366004613b07565b6117fe565b34801561062c57600080fd5b506103f161063b3660046139d2565b61181e565b34801561064c57600080fd5b50600f546103bc9060ff1681565b34801561066657600080fd5b506103f1610675366004613b95565b611860565b34801561068657600080fd5b506103f16106953660046139d2565b611946565b6103f16106a8366004613b43565b611953565b3480156106b957600080fd5b506103f16106c8366004613ca2565b611b60565b3480156106d957600080fd5b506103f1611b74565b3480156106ee57600080fd5b506107026106fd366004613a59565b611b90565b6040516103c89190613d26565b34801561071b57600080fd5b506103f161072a366004613d68565b611c5b565b6103f161073d366004613d94565b611ccc565b34801561074e57600080fd5b506103f161075d366004613e36565b611f79565b34801561076e57600080fd5b5061048b61077d3660046139d2565b611ff9565b34801561078e57600080fd5b5061043b61079d366004613954565b600e5460009081526010602090815260408083206001600160a01b03909416835260099093019052205490565b3480156107d657600080fd5b506103f1612004565b3480156107eb57600080fd5b5061043b6107fa366004613954565b61202b565b34801561080b57600080fd5b5061081f61081a366004613954565b612079565b6040516103c89190613ed8565b34801561083857600080fd5b506103f1612134565b34801561084d57600080fd5b506108b061085c3660046139d2565b60106020526000908152604090208054600182015460028301546003840154600485015460058601546006870154600788015460089098015496979596949593949293919290916001600160a01b03169089565b60408051998a5260208a0198909852968801959095526060870193909352608086019190915260a085015260c08401526001600160a01b031660e0830152610100820152610120016103c8565b34801561090957600080fd5b506103f1610918366004613ae5565b612148565b34801561092957600080fd5b5061081f610938366004613954565b61219d565b34801561094957600080fd5b50600f546103bc9062010000900460ff1681565b34801561096957600080fd5b50600a546001600160a01b031661048b565b34801561098757600080fd5b5061045e6122a5565b34801561099c57600080fd5b5061081f6109ab366004613f10565b6122b4565b3480156109bc57600080fd5b506103f16109cb366004613f43565b612439565b3480156109dc57600080fd5b506103f16109eb366004613fbe565b6124d9565b3480156109fc57600080fd5b506000546000190161043b565b348015610a1557600080fd5b506103bc610a243660046139d2565b600090815260106020526040902060030154151590565b6103f1610a49366004613fef565b612545565b348015610a5a57600080fd5b50610a6e610a693660046139d2565b61258f565b6040516103c8919061406a565b348015610a8757600080fd5b506103f1610a96366004613e36565b612617565b348015610aa757600080fd5b5061045e610ab63660046139d2565b612697565b6103f1610ac93660046139d2565b61271a565b348015610ada57600080fd5b506103bc610ae9366004613a9a565b612882565b348015610afa57600080fd5b5061043b610b093660046139eb565b612900565b348015610b1a57600080fd5b506103f1610b29366004614078565b612981565b348015610b3a57600080fd5b506103bc610b49366004614108565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610b8357600080fd5b506103f1610b923660046139eb565b612a3a565b348015610ba357600080fd5b506103f1610bb2366004613954565b612a9e565b348015610bc357600080fd5b5061043b600e5481565b348015610bd957600080fd5b506103f1612b14565b348015610bee57600080fd5b50600f546103bc90610100900460ff1681565b6000610c0c82612b39565b80610c1b5750610c1b82612b87565b92915050565b610c29612bbc565b6103e8816001600160601b03161115610ca15760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f742073657420726f79616c7469657320686967686572207468616e60448201526e203130303020627073202f2031302560881b60648201526084015b60405180910390fd5b610cab8282612c16565b5050565b606060028054610cbe90614132565b80601f0160208091040260200160405190810160405280929190818152602001828054610cea90614132565b8015610d375780601f10610d0c57610100808354040283529160200191610d37565b820191906000526020600020905b815481529060010190602001808311610d1a57829003601f168201915b5050505050905090565b6000610d4c82612d13565b610d69576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d9082611ff9565b9050336001600160a01b03821614610dc957610dac8133610b49565b610dc9576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600081815260106020526040812060030154610e7a5760405162461bcd60e51b815260206004820152601460248201527310dbdb5a58c8191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610c98565b5060009081526010602090815260408083206001600160a01b03949094168352600a9093019052205490565b6002600b5403610ec85760405162461bcd60e51b8152600401610c989061416c565b6002600b55323314610ed957600080fd5b600f5462010000900460ff16610f315760405162461bcd60e51b815260206004820152601b60248201527f4d696e7420766961206275726e206973206e6f742061637469766500000000006044820152606401610c98565b600e5460009081526010602052604090206003810154610f529060016141b9565b82610f5c60005490565b610f6691906141b9565b1115610f845760405162461bcd60e51b8152600401610c98906141cc565b6004810154600582015483919060005b83811015611066576000878783818110610fb057610fb0614214565b905060200201359050610fc281611ff9565b6001600160a01b0316336001600160a01b031614610ff25760405162461bcd60e51b8152600401610c989061422a565b8381101580156110025750828111155b61104a5760405162461bcd60e51b8152602060048201526019602482015278125b9d985b1a5908189d5c9b98589b19481d1bdad95b881a59603a1b6044820152606401610c98565b61105381612d48565b508061105e81614261565b915050610f94565b506110713384612d53565b50506001600b5550505050565b600080338360405160200161109492919061427a565b6040516020818303038152906040528051906020012090506110fc8585808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250600e548152601060205260409020600601549250859150612d6d9050565b9150505b9392505050565b61110f612bbc565b6000828152601060205260409020600301546111475760405162461bcd60e51b81526020600482015260006024820152604401610c98565b60009182526010602052604090912060080155565b600061116782612d83565b9050836001600160a01b0316816001600160a01b03161461119a5760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546111c68187335b6001600160a01b039081169116811491141790565b6111f1576111d48633610b49565b6111f157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661121857604051633a954ecd60e21b815260040160405180910390fd5b801561122357600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036112b5576001840160008181526004602052604081205490036112b35760005481146112b35760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061450683398151915260405160405180910390a45b505050505050565b6112f5612bbc565b600e546000908152601060205260409020600301546113159060016141b9565b8161131f60005490565b61132991906141b9565b11156113475760405162461bcd60e51b8152600401610c98906141cc565b6113513382612d53565b50565b60008281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916113c95750604080518082019091526008546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906113e8906001600160601b03168761429c565b6113f291906142b3565b91519350909150505b9250929050565b6002600b54036114245760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461143557600080fd5b600e546000908152601060205260409020600f54610100900460ff1680156114605750600681015415155b6114bd5760405162461bcd60e51b815260206004820152602860248201527f50726573616c65206d696e742076696120616c6c6f776c697374206973206e6f604482015267742061637469766560c01b6064820152608401610c98565b600033856040516020016114d292919061427a565b60405160208183030381529060405280519060200120905061152b848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050600684015483612d6d565b61156e5760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610c98565b3486836001015461157f919061429c565b1461159c5760405162461bcd60e51b8152600401610c98906142d5565b33600090815260098301602052604090205485906115bb9088906141b9565b11156115d95760405162461bcd60e51b8152600401610c9890614319565b60038201546115e99060016141b9565b866115f360005490565b6115fd91906141b9565b111561161b5760405162461bcd60e51b8152600401610c98906141cc565b3360009081526009830160205260408120805488929061163c9084906141b9565b9091555061107190503387612d53565b6002600b540361166e5760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461167f57600080fd5b600f5462010000900460ff166116d75760405162461bcd60e51b815260206004820152601b60248201527f4d696e7420766961206275726e206973206e6f742061637469766500000000006044820152606401610c98565b600e54600090815260106020526040902060038101546116f89060016141b9565b6000546117069060016141b9565b11156117245760405162461bcd60e51b8152600401610c98906141cc565b61172d82611ff9565b6001600160a01b0316336001600160a01b03161461175d5760405162461bcd60e51b8152600401610c989061422a565b80600401548210158015611775575080600501548211155b6117bd5760405162461bcd60e51b8152602060048201526019602482015278125b9d985b1a5908189d5c9b98589b19481d1bdad95b881a59603a1b6044820152606401610c98565b6117c682612d48565b6117d1336001612d53565b50506001600b55565b6117e2612bbc565b476113516117f8600a546001600160a01b031690565b82612df2565b61181983838360405180602001604052806000815250612545565b505050565b61182781611ff9565b6001600160a01b0316336001600160a01b0316146118575760405162461bcd60e51b8152600401610c989061422a565b61135181612d48565b611868612bbc565b600086116118b85760405162461bcd60e51b815260206004820152601b60248201527f656e6420746f6b656e2067726561746572207468616e207a65726f00000000006044820152606401610c98565b6000601060006118c7600c5490565b815260208101919091526040016000208a8155600181018a905560028101899055600381018890556004810187905560058101869055600681018590556007810180546001600160a01b0386166001600160a01b031990911617905560088101839055905061193a600c80546001019055565b50505050505050505050565b61194e612bbc565b600e55565b6002600b54036119755760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461198657600080fd5b600e546000908152601060205260409020600f54610100900460ff1680156119b15750600881015415155b611a0f5760405162461bcd60e51b815260206004820152602960248201527f50726573616c65206d696e7420766961206672656520636c61696d206973206e6044820152686f742061637469766560b81b6064820152608401610c98565b60003385604051602001611a2492919061427a565b604051602081830303815290604052805190602001209050611a7d848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050600884015483612d6d565b611ac05760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610c98565b336000908152600a830160205260409020548590611adf9088906141b9565b1115611afd5760405162461bcd60e51b8152600401610c9890614319565b6003820154611b0d9060016141b9565b86611b1760005490565b611b2191906141b9565b1115611b3f5760405162461bcd60e51b8152600401610c98906141cc565b336000908152600a830160205260408120805488929061163c9084906141b9565b611b68612bbc565b600d610cab82826143a7565b611b7c612bbc565b600f805460ff19811660ff90911615179055565b6060816000816001600160401b03811115611bad57611bad613c05565b604051908082528060200260200182016040528015611bff57816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611bcb5790505b50905060005b828114611c5257611c2d868683818110611c2157611c21614214565b9050602002013561258f565b828281518110611c3f57611c3f614214565b6020908102919091010152600101611c05565b50949350505050565b611c63612bbc565b600082815260106020526040902060030154611c9b5760405162461bcd60e51b81526020600482015260006024820152604401610c98565b60009182526010602052604090912060070180546001600160a01b0319166001600160a01b03909216919091179055565b6002600b5403611cee5760405162461bcd60e51b8152600401610c989061416c565b6002600b55323314611cff57600080fd5b600e546000908152601060205260409020600f54610100900460ff168015611d33575060078101546001600160a01b031615155b611d8d5760405162461bcd60e51b815260206004820152602560248201527f50726573616c65206d696e7420766961207469636b6574206973206e6f742061604482015264637469766560d81b6064820152608401610c98565b600e54604080517f3fcdccad810477dde47a433669f78cab5a36dea07b1addc5fbe1584a7d1d814b60208201523391810191909152606081019190915260808101859052600090611df69060a00160405160208183030381529060405280519060200120612f0b565b90506000611e3a8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612f5992505050565b60078401549091506001600160a01b03808316911614611e8d5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908151a58dad95d60921b6044820152606401610c98565b34878460010154611e9e919061429c565b14611ebb5760405162461bcd60e51b8152600401610c98906142d5565b3360009081526009840160205260409020548690611eda9089906141b9565b1115611ef85760405162461bcd60e51b8152600401610c9890614319565b6003830154611f089060016141b9565b87611f1260005490565b611f1c91906141b9565b1115611f3a5760405162461bcd60e51b8152600401610c98906141cc565b33600090815260098401602052604081208054899290611f5b9084906141b9565b90915550611f6b90503388612d53565b50506001600b555050505050565b611f81612bbc565b60005b8251811015611819578160106000600e548152602001908152602001600020600a016000858481518110611fba57611fba614214565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508080611ff190614261565b915050611f84565b6000610c1b82612d83565b61200c612bbc565b600f805462ff0000198116620100009182900460ff1615909102179055565b60006001600160a01b038216612054576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b60606000612086600c5490565b6001600160401b0381111561209d5761209d613c05565b6040519080825280602002602001820160405280156120c6578160200160208202803683370190505b50905060005b600c5481101561212d5760008181526010602090815260408083206001600160a01b0388168452600901909152902054825183908390811061211057612110614214565b60209081029190910101528061212581614261565b9150506120cc565b5092915050565b61213c612bbc565b6121466000612f7d565b565b612150612bbc565b6000828152601060205260409020600301546121885760405162461bcd60e51b81526020600482015260006024820152604401610c98565b60009182526010602052604090912060060155565b606060008060006121ad8561202b565b90506000816001600160401b038111156121c9576121c9613c05565b6040519080825280602002602001820160405280156121f2578160200160208202803683370190505b50905061221f60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b8386146122995761223281612fcf565b915081604001516122915781516001600160a01b03161561225257815194505b876001600160a01b0316856001600160a01b031603612291578083878060010198508151811061228457612284614214565b6020026020010181815250505b600101612222565b50909695505050505050565b606060038054610cbe90614132565b60608183106122d657604051631960ccad60e11b815260040160405180910390fd5b6000806122e260005490565b905060018510156122f257600194505b808411156122fe578093505b60006123098761202b565b9050848610156123285785850381811015612322578091505b5061232c565b5060005b6000816001600160401b0381111561234657612346613c05565b60405190808252806020026020018201604052801561236f578160200160208202803683370190505b5090508160000361238557935061110092505050565b60006123908861258f565b9050600081604001516123a1575080515b885b8881141580156123b35750848714155b15612428576123c181612fcf565b925082604001516124205782516001600160a01b0316156123e157825191505b8a6001600160a01b0316826001600160a01b031603612420578084888060010199508151811061241357612413614214565b6020026020010181815250505b6001016123a3565b505050928352509095945050505050565b612441612bbc565b60008a8152601060205260409020600301546124795760405162461bcd60e51b81526020600482015260006024820152604401610c98565b6000998a52601060205260409099209788556001880196909655600287019490945560038601929092556004850155600584015560068301556007820180546001600160a01b0319166001600160a01b0390921691909117905560080155565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61255084848461115c565b6001600160a01b0383163b156125895761256c8484848461300b565b612589576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806125e857506000548310155b156125f35792915050565b6125fc83612fcf565b905080604001511561260e5792915050565b611100836130f7565b61261f612bbc565b60005b8251811015611819578160106000600e548152602001908152602001600020600901600085848151811061265857612658614214565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061268f90614261565b915050612622565b60606126a282612d13565b6126bf57604051630a14c4b560e41b815260040160405180910390fd5b60006126c961312c565b905080516000036126e95760405180602001604052806000815250611100565b806126f38461313b565b604051602001612704929190614466565b6040516020818303038152906040529392505050565b6002600b540361273c5760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461274d57600080fd5b600f5460ff166127945760405162461bcd60e51b81526020600482015260126024820152714d696e74206973206e6f742061637469766560701b6044820152606401610c98565b600e546000908152601060205260409020600281015482111561280a5760405162461bcd60e51b815260206004820152602860248201527f596f752077656e74206f766572206d617820746f6b656e7320706572207472616044820152673739b0b1ba34b7b760c11b6064820152608401610c98565b600381015461281a9060016141b9565b8261282460005490565b61282e91906141b9565b111561284c5760405162461bcd60e51b8152600401610c98906141cc565b8054349061285b90849061429c565b146128785760405162461bcd60e51b8152600401610c98906142d5565b6117d13383612d53565b600080338360405160200161289892919061427a565b6040516020818303038152906040528051906020012090506110fc8585808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250600e548152601060205260409020600801549250859150612d6d9050565b6000818152601060205260408120600301546129555760405162461bcd60e51b815260206004820152601460248201527310dbdb5a58c8191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610c98565b5060009081526010602090815260408083206001600160a01b0394909416835260099093019052205490565b6002600b54036129a35760405162461bcd60e51b8152600401610c989061416c565b6002600b5560005b81518110156117d1576129d68282815181106129c9576129c9614214565b6020026020010151611ff9565b6001600160a01b0316336001600160a01b031614612a065760405162461bcd60e51b8152600401610c989061422a565b612a28828281518110612a1b57612a1b614214565b6020026020010151612d48565b80612a3281614261565b9150506129ab565b612a42612bbc565b600e54600090815260106020526040902060030154612a629060016141b9565b81612a6c60005490565b612a7691906141b9565b1115612a945760405162461bcd60e51b8152600401610c98906141cc565b610cab8282612d53565b612aa6612bbc565b6001600160a01b038116612b0b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c98565b61135181612f7d565b612b1c612bbc565b600f805461ff001981166101009182900460ff1615909102179055565b60006301ffc9a760e01b6001600160e01b031983161480612b6a57506380ac58cd60e01b6001600160e01b03198316145b80610c1b5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610c1b57506301ffc9a760e01b6001600160e01b0319831614610c1b565b600a546001600160a01b031633146121465760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c98565b6127106001600160601b0382161115612c845760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610c98565b6001600160a01b038216612cda5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610c98565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b600081600111158015612d27575060005482105b8015610c1b575050600090815260046020526040902054600160e01b161590565b61135181600061317f565b610cab8282604051806020016040528060008152506132b7565b600082612d7a8584613324565b14949350505050565b60008180600111612dd957600054811015612dd95760008181526004602052604081205490600160e01b82169003612dd7575b80600003611100575060001901600081815260046020526040902054612db6565b505b604051636f96cda160e11b815260040160405180910390fd5b80471015612e425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c98565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612e8f576040519150601f19603f3d011682016040523d82523d6000602084013e612e94565b606091505b50509050806118195760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c98565b6000610c1b612f18613369565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000612f688585613490565b91509150612f75816134d2565b509392505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610c1b90613688565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613040903390899088908890600401614495565b6020604051808303816000875af192505050801561307b575060408051601f3d908101601f19168201909252613078918101906144d2565b60015b6130d9573d8080156130a9576040519150601f19603f3d011682016040523d82523d6000602084013e6130ae565b606091505b5080516000036130d1576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610c1b61312783612d83565b613688565b6060600d8054610cbe90614132565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806131555750819003601f19909101908152919050565b600061318a83612d83565b9050806000806131a886600090815260066020526040902080549091565b9150915084156131e8576131bd8184336111b1565b6131e8576131cb8333610b49565b6131e857604051632ce44b5f60e11b815260040160405180910390fd5b80156131f357600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036132815760018601600081815260046020526040812054900361327f57600054811461327f5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614506833981519152908390a45050600180548101905550505050565b6132c183836136cf565b6001600160a01b0383163b15611819576000548281035b6132eb600086838060010194508661300b565b613308576040516368d2bf6b60e11b815260040160405180910390fd5b8181106132d857816000541461331d57600080fd5b5050505050565b600081815b8451811015612f75576133558286838151811061334857613348614214565b60200260200101516137a9565b91508061336181614261565b915050613329565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156133c257507f000000000000000000000000000000000000000000000000000000000000000046145b156133ec57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008082516041036134c65760208301516040840151606085015160001a6134ba878285856137d5565b945094505050506113fb565b506000905060026113fb565b60008160048111156134e6576134e66144ef565b036134ee5750565b6001816004811115613502576135026144ef565b0361354f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c98565b6002816004811115613563576135636144ef565b036135b05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c98565b60038160048111156135c4576135c46144ef565b0361361c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610c98565b6004816004811115613630576136306144ef565b036113515760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610c98565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60008054908290036136f45760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083906000805160206145068339815191528180a4600183015b81811461377f5780836000600080516020614506833981519152600080a4600101613759565b50816000036137a057604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008183106137c5576000828152602084905260409020611100565b5060009182526020526040902090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561380c57506000905060036138b9565b8460ff16601b1415801561382457508460ff16601c14155b1561383557506000905060046138b9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613889573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166138b2576000600192509250506138b9565b9150600090505b94509492505050565b6001600160e01b03198116811461135157600080fd5b6000602082840312156138ea57600080fd5b8135611100816138c2565b80356001600160a01b038116811461390c57600080fd5b919050565b6000806040838503121561392457600080fd5b61392d836138f5565b915060208301356001600160601b038116811461394957600080fd5b809150509250929050565b60006020828403121561396657600080fd5b611100826138f5565b60005b8381101561398a578181015183820152602001613972565b50506000910152565b600081518084526139ab81602086016020860161396f565b601f01601f19169290920160200192915050565b6020815260006111006020830184613993565b6000602082840312156139e457600080fd5b5035919050565b600080604083850312156139fe57600080fd5b613a07836138f5565b946020939093013593505050565b60008083601f840112613a2757600080fd5b5081356001600160401b03811115613a3e57600080fd5b6020830191508360208260051b85010111156113fb57600080fd5b60008060208385031215613a6c57600080fd5b82356001600160401b03811115613a8257600080fd5b613a8e85828601613a15565b90969095509350505050565b600080600060408486031215613aaf57600080fd5b83356001600160401b03811115613ac557600080fd5b613ad186828701613a15565b909790965060209590950135949350505050565b60008060408385031215613af857600080fd5b50508035926020909101359150565b600080600060608486031215613b1c57600080fd5b613b25846138f5565b9250613b33602085016138f5565b9150604084013590509250925092565b60008060008060608587031215613b5957600080fd5b843593506020850135925060408501356001600160401b03811115613b7d57600080fd5b613b8987828801613a15565b95989497509550505050565b60008060008060008060008060006101208a8c031215613bb457600080fd5b8935985060208a0135975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a01359250613bee60e08b016138f5565b91506101008a013590509295985092959850929598565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c4357613c43613c05565b604052919050565b60006001600160401b03831115613c6457613c64613c05565b613c77601f8401601f1916602001613c1b565b9050828152838383011115613c8b57600080fd5b828260208301376000602084830101529392505050565b600060208284031215613cb457600080fd5b81356001600160401b03811115613cca57600080fd5b8201601f81018413613cdb57600080fd5b6130ef84823560208401613c4b565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561229957613d55838551613cea565b9284019260809290920191600101613d42565b60008060408385031215613d7b57600080fd5b82359150613d8b602084016138f5565b90509250929050565b60008060008060608587031215613daa57600080fd5b843593506020850135925060408501356001600160401b0380821115613dcf57600080fd5b818701915087601f830112613de357600080fd5b813581811115613df257600080fd5b886020828501011115613e0457600080fd5b95989497505060200194505050565b60006001600160401b03821115613e2c57613e2c613c05565b5060051b60200190565b60008060408385031215613e4957600080fd5b82356001600160401b03811115613e5f57600080fd5b8301601f81018513613e7057600080fd5b80356020613e85613e8083613e13565b613c1b565b82815260059290921b83018101918181019088841115613ea457600080fd5b938201935b83851015613ec957613eba856138f5565b82529382019390820190613ea9565b98969091013596505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561229957835183529284019291840191600101613ef4565b600080600060608486031215613f2557600080fd5b613f2e846138f5565b95602085013595506040909401359392505050565b6000806000806000806000806000806101408b8d031215613f6357600080fd5b8a35995060208b0135985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b01359250613fa56101008c016138f5565b91506101208b013590509295989b9194979a5092959850565b60008060408385031215613fd157600080fd5b613fda836138f5565b91506020830135801515811461394957600080fd5b6000806000806080858703121561400557600080fd5b61400e856138f5565b935061401c602086016138f5565b92506040850135915060608501356001600160401b0381111561403e57600080fd5b8501601f8101871361404f57600080fd5b61405e87823560208401613c4b565b91505092959194509250565b60808101610c1b8284613cea565b6000602080838503121561408b57600080fd5b82356001600160401b038111156140a157600080fd5b8301601f810185136140b257600080fd5b80356140c0613e8082613e13565b81815260059190911b820183019083810190878311156140df57600080fd5b928401925b828410156140fd578335825292840192908401906140e4565b979650505050505050565b6000806040838503121561411b57600080fd5b614124836138f5565b9150613d8b602084016138f5565b600181811c9082168061414657607f821691505b60208210810361416657634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610c1b57610c1b6141a3565b60208082526028908201527f4e6f7420656e6f75676820746f6b656e73206c65667420746f206d696e742074604082015267686174206d616e7960c01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60208082526018908201527f596f7520646f206e6f74206f776e2074686520746f6b656e0000000000000000604082015260600190565b600060018201614273576142736141a3565b5060010190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b8082028115828204841417610c1b57610c1b6141a3565b6000826142d057634e487b7160e01b600052601260045260246000fd5b500490565b60208082526024908201527f596f752073656e742074686520696e636f727265637420616d6f756e74206f666040820152630408aa8960e31b606082015260800190565b60208082526028908201527f436c61696d3a204e6f7420616c6c6f77656420746f20636c61696d20676976656040820152671b88185b5bdd5b9d60c21b606082015260800190565b601f82111561181957600081815260208120601f850160051c810160208610156143885750805b601f850160051c820191505b818110156112e557828155600101614394565b81516001600160401b038111156143c0576143c0613c05565b6143d4816143ce8454614132565b84614361565b602080601f83116001811461440957600084156143f15750858301515b600019600386901b1c1916600185901b1785556112e5565b600085815260208120601f198616915b8281101561443857888601518255948401946001909101908401614419565b50858210156144565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000835161447881846020880161396f565b83519083019061448c81836020880161396f565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906144c890830184613993565b9695505050505050565b6000602082840312156144e457600080fd5b8151611100816138c2565b634e487b7160e01b600052602160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204e7913a1e90e9ba8efbe38f486bf62eb376337334e5087bfd2161890470d653264736f6c63430008110033
Deployed Bytecode
0x6080604052600436106103975760003560e01c80636d178141116101dc578063afb05f7d11610102578063dd75fe93116100a0578063f2fde38b1161006f578063f2fde38b14610b97578063f919583914610bb7578063f931a4c214610bcd578063ff5a70c614610be257600080fd5b8063dd75fe9314610aee578063e4623c1b14610b0e578063e985e9c514610b2e578063ec5787c214610b7757600080fd5b8063c60a2584116100dc578063c60a258414610a7b578063c87b56dd14610a9b578063ca561d6f14610abb578063d96f87f014610ace57600080fd5b8063afb05f7d14610a09578063b88d4fde14610a3b578063c23dc68f14610a4e57600080fd5b80638462151c1161017a57806399a2557a1161014957806399a2557a146109905780639b327408146109b0578063a22cb465146109d0578063a2309ff8146109f057600080fd5b80638462151c1461091d578063864758e81461093d5780638da5cb5b1461095d57806395d89b411461097b57600080fd5b806371417b32116101b657806371417b32146107ff578063715018a61461082c5780637a80dc1d146108415780637c08aabe146108fd57600080fd5b80636d178141146107825780636dee5615146107ca57806370a08231146107df57600080fd5b80633125ac6c116102c15780634cd55f791161025f5780635d90dd141161022e5780635d90dd141461070f5780635e98b51d1461072f5780635ef2fcc2146107425780636352211e1461076257600080fd5b80634cd55f791461069a57806355f804b3146106ad57806359c74f29146106cd5780635bbb2177146106e257600080fd5b806342966c681161029b57806342966c6814610620578063471a429414610640578063478307371461065a5780634ae92cfa1461067a57600080fd5b80633125ac6c146105d85780633ccfd60b146105f857806342842e0e1461060d57600080fd5b8063120b99891161033957806323b872dd1161030857806323b872dd14610553578063288bd8fd146105665780632a55205a146105865780633018184e146105c557600080fd5b8063120b9989146104d6578063149841e9146104f65780631675be861461051657806318160ddd1461053657600080fd5b806306fdde031161037557806306fdde0314610449578063081812fc1461046b578063095ea7b3146104a35780630ec992a1146104b657600080fd5b806301ffc9a71461039c57806304634d8d146103d1578063058b63f4146103f3575b600080fd5b3480156103a857600080fd5b506103bc6103b73660046138d8565b610c01565b60405190151581526020015b60405180910390f35b3480156103dd57600080fd5b506103f16103ec366004613911565b610c21565b005b3480156103ff57600080fd5b5061043b61040e366004613954565b600e5460009081526010602090815260408083206001600160a01b039094168352600a9093019052205490565b6040519081526020016103c8565b34801561045557600080fd5b5061045e610caf565b6040516103c891906139bf565b34801561047757600080fd5b5061048b6104863660046139d2565b610d41565b6040516001600160a01b0390911681526020016103c8565b6103f16104b13660046139eb565b610d85565b3480156104c257600080fd5b5061043b6104d13660046139eb565b610e25565b3480156104e257600080fd5b506103f16104f1366004613a59565b610ea6565b34801561050257600080fd5b506103bc610511366004613a9a565b61107e565b34801561052257600080fd5b506103f1610531366004613ae5565b611107565b34801561054257600080fd5b50600154600054036000190161043b565b6103f1610561366004613b07565b61115c565b34801561057257600080fd5b506103f16105813660046139d2565b6112ed565b34801561059257600080fd5b506105a66105a1366004613ae5565b611354565b604080516001600160a01b0390931683526020830191909152016103c8565b6103f16105d3366004613b43565b611402565b3480156105e457600080fd5b506103f16105f33660046139d2565b61164c565b34801561060457600080fd5b506103f16117da565b6103f161061b366004613b07565b6117fe565b34801561062c57600080fd5b506103f161063b3660046139d2565b61181e565b34801561064c57600080fd5b50600f546103bc9060ff1681565b34801561066657600080fd5b506103f1610675366004613b95565b611860565b34801561068657600080fd5b506103f16106953660046139d2565b611946565b6103f16106a8366004613b43565b611953565b3480156106b957600080fd5b506103f16106c8366004613ca2565b611b60565b3480156106d957600080fd5b506103f1611b74565b3480156106ee57600080fd5b506107026106fd366004613a59565b611b90565b6040516103c89190613d26565b34801561071b57600080fd5b506103f161072a366004613d68565b611c5b565b6103f161073d366004613d94565b611ccc565b34801561074e57600080fd5b506103f161075d366004613e36565b611f79565b34801561076e57600080fd5b5061048b61077d3660046139d2565b611ff9565b34801561078e57600080fd5b5061043b61079d366004613954565b600e5460009081526010602090815260408083206001600160a01b03909416835260099093019052205490565b3480156107d657600080fd5b506103f1612004565b3480156107eb57600080fd5b5061043b6107fa366004613954565b61202b565b34801561080b57600080fd5b5061081f61081a366004613954565b612079565b6040516103c89190613ed8565b34801561083857600080fd5b506103f1612134565b34801561084d57600080fd5b506108b061085c3660046139d2565b60106020526000908152604090208054600182015460028301546003840154600485015460058601546006870154600788015460089098015496979596949593949293919290916001600160a01b03169089565b60408051998a5260208a0198909852968801959095526060870193909352608086019190915260a085015260c08401526001600160a01b031660e0830152610100820152610120016103c8565b34801561090957600080fd5b506103f1610918366004613ae5565b612148565b34801561092957600080fd5b5061081f610938366004613954565b61219d565b34801561094957600080fd5b50600f546103bc9062010000900460ff1681565b34801561096957600080fd5b50600a546001600160a01b031661048b565b34801561098757600080fd5b5061045e6122a5565b34801561099c57600080fd5b5061081f6109ab366004613f10565b6122b4565b3480156109bc57600080fd5b506103f16109cb366004613f43565b612439565b3480156109dc57600080fd5b506103f16109eb366004613fbe565b6124d9565b3480156109fc57600080fd5b506000546000190161043b565b348015610a1557600080fd5b506103bc610a243660046139d2565b600090815260106020526040902060030154151590565b6103f1610a49366004613fef565b612545565b348015610a5a57600080fd5b50610a6e610a693660046139d2565b61258f565b6040516103c8919061406a565b348015610a8757600080fd5b506103f1610a96366004613e36565b612617565b348015610aa757600080fd5b5061045e610ab63660046139d2565b612697565b6103f1610ac93660046139d2565b61271a565b348015610ada57600080fd5b506103bc610ae9366004613a9a565b612882565b348015610afa57600080fd5b5061043b610b093660046139eb565b612900565b348015610b1a57600080fd5b506103f1610b29366004614078565b612981565b348015610b3a57600080fd5b506103bc610b49366004614108565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610b8357600080fd5b506103f1610b923660046139eb565b612a3a565b348015610ba357600080fd5b506103f1610bb2366004613954565b612a9e565b348015610bc357600080fd5b5061043b600e5481565b348015610bd957600080fd5b506103f1612b14565b348015610bee57600080fd5b50600f546103bc90610100900460ff1681565b6000610c0c82612b39565b80610c1b5750610c1b82612b87565b92915050565b610c29612bbc565b6103e8816001600160601b03161115610ca15760405162461bcd60e51b815260206004820152602f60248201527f43616e6e6f742073657420726f79616c7469657320686967686572207468616e60448201526e203130303020627073202f2031302560881b60648201526084015b60405180910390fd5b610cab8282612c16565b5050565b606060028054610cbe90614132565b80601f0160208091040260200160405190810160405280929190818152602001828054610cea90614132565b8015610d375780601f10610d0c57610100808354040283529160200191610d37565b820191906000526020600020905b815481529060010190602001808311610d1a57829003601f168201915b5050505050905090565b6000610d4c82612d13565b610d69576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610d9082611ff9565b9050336001600160a01b03821614610dc957610dac8133610b49565b610dc9576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600081815260106020526040812060030154610e7a5760405162461bcd60e51b815260206004820152601460248201527310dbdb5a58c8191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610c98565b5060009081526010602090815260408083206001600160a01b03949094168352600a9093019052205490565b6002600b5403610ec85760405162461bcd60e51b8152600401610c989061416c565b6002600b55323314610ed957600080fd5b600f5462010000900460ff16610f315760405162461bcd60e51b815260206004820152601b60248201527f4d696e7420766961206275726e206973206e6f742061637469766500000000006044820152606401610c98565b600e5460009081526010602052604090206003810154610f529060016141b9565b82610f5c60005490565b610f6691906141b9565b1115610f845760405162461bcd60e51b8152600401610c98906141cc565b6004810154600582015483919060005b83811015611066576000878783818110610fb057610fb0614214565b905060200201359050610fc281611ff9565b6001600160a01b0316336001600160a01b031614610ff25760405162461bcd60e51b8152600401610c989061422a565b8381101580156110025750828111155b61104a5760405162461bcd60e51b8152602060048201526019602482015278125b9d985b1a5908189d5c9b98589b19481d1bdad95b881a59603a1b6044820152606401610c98565b61105381612d48565b508061105e81614261565b915050610f94565b506110713384612d53565b50506001600b5550505050565b600080338360405160200161109492919061427a565b6040516020818303038152906040528051906020012090506110fc8585808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250600e548152601060205260409020600601549250859150612d6d9050565b9150505b9392505050565b61110f612bbc565b6000828152601060205260409020600301546111475760405162461bcd60e51b81526020600482015260006024820152604401610c98565b60009182526010602052604090912060080155565b600061116782612d83565b9050836001600160a01b0316816001600160a01b03161461119a5760405162a1148160e81b815260040160405180910390fd5b600082815260066020526040902080546111c68187335b6001600160a01b039081169116811491141790565b6111f1576111d48633610b49565b6111f157604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b03851661121857604051633a954ecd60e21b815260040160405180910390fd5b801561122357600082555b6001600160a01b038681166000908152600560205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260046020526040812091909155600160e11b841690036112b5576001840160008181526004602052604081205490036112b35760005481146112b35760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b031660008051602061450683398151915260405160405180910390a45b505050505050565b6112f5612bbc565b600e546000908152601060205260409020600301546113159060016141b9565b8161131f60005490565b61132991906141b9565b11156113475760405162461bcd60e51b8152600401610c98906141cc565b6113513382612d53565b50565b60008281526009602090815260408083208151808301909252546001600160a01b038116808352600160a01b9091046001600160601b03169282019290925282916113c95750604080518082019091526008546001600160a01b0381168252600160a01b90046001600160601b031660208201525b6020810151600090612710906113e8906001600160601b03168761429c565b6113f291906142b3565b91519350909150505b9250929050565b6002600b54036114245760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461143557600080fd5b600e546000908152601060205260409020600f54610100900460ff1680156114605750600681015415155b6114bd5760405162461bcd60e51b815260206004820152602860248201527f50726573616c65206d696e742076696120616c6c6f776c697374206973206e6f604482015267742061637469766560c01b6064820152608401610c98565b600033856040516020016114d292919061427a565b60405160208183030381529060405280519060200120905061152b848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050600684015483612d6d565b61156e5760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610c98565b3486836001015461157f919061429c565b1461159c5760405162461bcd60e51b8152600401610c98906142d5565b33600090815260098301602052604090205485906115bb9088906141b9565b11156115d95760405162461bcd60e51b8152600401610c9890614319565b60038201546115e99060016141b9565b866115f360005490565b6115fd91906141b9565b111561161b5760405162461bcd60e51b8152600401610c98906141cc565b3360009081526009830160205260408120805488929061163c9084906141b9565b9091555061107190503387612d53565b6002600b540361166e5760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461167f57600080fd5b600f5462010000900460ff166116d75760405162461bcd60e51b815260206004820152601b60248201527f4d696e7420766961206275726e206973206e6f742061637469766500000000006044820152606401610c98565b600e54600090815260106020526040902060038101546116f89060016141b9565b6000546117069060016141b9565b11156117245760405162461bcd60e51b8152600401610c98906141cc565b61172d82611ff9565b6001600160a01b0316336001600160a01b03161461175d5760405162461bcd60e51b8152600401610c989061422a565b80600401548210158015611775575080600501548211155b6117bd5760405162461bcd60e51b8152602060048201526019602482015278125b9d985b1a5908189d5c9b98589b19481d1bdad95b881a59603a1b6044820152606401610c98565b6117c682612d48565b6117d1336001612d53565b50506001600b55565b6117e2612bbc565b476113516117f8600a546001600160a01b031690565b82612df2565b61181983838360405180602001604052806000815250612545565b505050565b61182781611ff9565b6001600160a01b0316336001600160a01b0316146118575760405162461bcd60e51b8152600401610c989061422a565b61135181612d48565b611868612bbc565b600086116118b85760405162461bcd60e51b815260206004820152601b60248201527f656e6420746f6b656e2067726561746572207468616e207a65726f00000000006044820152606401610c98565b6000601060006118c7600c5490565b815260208101919091526040016000208a8155600181018a905560028101899055600381018890556004810187905560058101869055600681018590556007810180546001600160a01b0386166001600160a01b031990911617905560088101839055905061193a600c80546001019055565b50505050505050505050565b61194e612bbc565b600e55565b6002600b54036119755760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461198657600080fd5b600e546000908152601060205260409020600f54610100900460ff1680156119b15750600881015415155b611a0f5760405162461bcd60e51b815260206004820152602960248201527f50726573616c65206d696e7420766961206672656520636c61696d206973206e6044820152686f742061637469766560b81b6064820152608401610c98565b60003385604051602001611a2492919061427a565b604051602081830303815290604052805190602001209050611a7d848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250505050600884015483612d6d565b611ac05760405162461bcd60e51b815260206004820152601460248201527324b73b30b634b21026b2b935b63290283937b7b360611b6044820152606401610c98565b336000908152600a830160205260409020548590611adf9088906141b9565b1115611afd5760405162461bcd60e51b8152600401610c9890614319565b6003820154611b0d9060016141b9565b86611b1760005490565b611b2191906141b9565b1115611b3f5760405162461bcd60e51b8152600401610c98906141cc565b336000908152600a830160205260408120805488929061163c9084906141b9565b611b68612bbc565b600d610cab82826143a7565b611b7c612bbc565b600f805460ff19811660ff90911615179055565b6060816000816001600160401b03811115611bad57611bad613c05565b604051908082528060200260200182016040528015611bff57816020015b604080516080810182526000808252602080830182905292820181905260608201528252600019909201910181611bcb5790505b50905060005b828114611c5257611c2d868683818110611c2157611c21614214565b9050602002013561258f565b828281518110611c3f57611c3f614214565b6020908102919091010152600101611c05565b50949350505050565b611c63612bbc565b600082815260106020526040902060030154611c9b5760405162461bcd60e51b81526020600482015260006024820152604401610c98565b60009182526010602052604090912060070180546001600160a01b0319166001600160a01b03909216919091179055565b6002600b5403611cee5760405162461bcd60e51b8152600401610c989061416c565b6002600b55323314611cff57600080fd5b600e546000908152601060205260409020600f54610100900460ff168015611d33575060078101546001600160a01b031615155b611d8d5760405162461bcd60e51b815260206004820152602560248201527f50726573616c65206d696e7420766961207469636b6574206973206e6f742061604482015264637469766560d81b6064820152608401610c98565b600e54604080517f3fcdccad810477dde47a433669f78cab5a36dea07b1addc5fbe1584a7d1d814b60208201523391810191909152606081019190915260808101859052600090611df69060a00160405160208183030381529060405280519060200120612f0b565b90506000611e3a8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612f5992505050565b60078401549091506001600160a01b03808316911614611e8d5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908151a58dad95d60921b6044820152606401610c98565b34878460010154611e9e919061429c565b14611ebb5760405162461bcd60e51b8152600401610c98906142d5565b3360009081526009840160205260409020548690611eda9089906141b9565b1115611ef85760405162461bcd60e51b8152600401610c9890614319565b6003830154611f089060016141b9565b87611f1260005490565b611f1c91906141b9565b1115611f3a5760405162461bcd60e51b8152600401610c98906141cc565b33600090815260098401602052604081208054899290611f5b9084906141b9565b90915550611f6b90503388612d53565b50506001600b555050505050565b611f81612bbc565b60005b8251811015611819578160106000600e548152602001908152602001600020600a016000858481518110611fba57611fba614214565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508080611ff190614261565b915050611f84565b6000610c1b82612d83565b61200c612bbc565b600f805462ff0000198116620100009182900460ff1615909102179055565b60006001600160a01b038216612054576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b60606000612086600c5490565b6001600160401b0381111561209d5761209d613c05565b6040519080825280602002602001820160405280156120c6578160200160208202803683370190505b50905060005b600c5481101561212d5760008181526010602090815260408083206001600160a01b0388168452600901909152902054825183908390811061211057612110614214565b60209081029190910101528061212581614261565b9150506120cc565b5092915050565b61213c612bbc565b6121466000612f7d565b565b612150612bbc565b6000828152601060205260409020600301546121885760405162461bcd60e51b81526020600482015260006024820152604401610c98565b60009182526010602052604090912060060155565b606060008060006121ad8561202b565b90506000816001600160401b038111156121c9576121c9613c05565b6040519080825280602002602001820160405280156121f2578160200160208202803683370190505b50905061221f60408051608081018252600080825260208201819052918101829052606081019190915290565b60015b8386146122995761223281612fcf565b915081604001516122915781516001600160a01b03161561225257815194505b876001600160a01b0316856001600160a01b031603612291578083878060010198508151811061228457612284614214565b6020026020010181815250505b600101612222565b50909695505050505050565b606060038054610cbe90614132565b60608183106122d657604051631960ccad60e11b815260040160405180910390fd5b6000806122e260005490565b905060018510156122f257600194505b808411156122fe578093505b60006123098761202b565b9050848610156123285785850381811015612322578091505b5061232c565b5060005b6000816001600160401b0381111561234657612346613c05565b60405190808252806020026020018201604052801561236f578160200160208202803683370190505b5090508160000361238557935061110092505050565b60006123908861258f565b9050600081604001516123a1575080515b885b8881141580156123b35750848714155b15612428576123c181612fcf565b925082604001516124205782516001600160a01b0316156123e157825191505b8a6001600160a01b0316826001600160a01b031603612420578084888060010199508151811061241357612413614214565b6020026020010181815250505b6001016123a3565b505050928352509095945050505050565b612441612bbc565b60008a8152601060205260409020600301546124795760405162461bcd60e51b81526020600482015260006024820152604401610c98565b6000998a52601060205260409099209788556001880196909655600287019490945560038601929092556004850155600584015560068301556007820180546001600160a01b0319166001600160a01b0390921691909117905560080155565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b61255084848461115c565b6001600160a01b0383163b156125895761256c8484848461300b565b612589576040516368d2bf6b60e11b815260040160405180910390fd5b50505050565b60408051608081018252600080825260208201819052918101829052606081019190915260408051608081018252600080825260208201819052918101829052606081019190915260018310806125e857506000548310155b156125f35792915050565b6125fc83612fcf565b905080604001511561260e5792915050565b611100836130f7565b61261f612bbc565b60005b8251811015611819578160106000600e548152602001908152602001600020600901600085848151811061265857612658614214565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061268f90614261565b915050612622565b60606126a282612d13565b6126bf57604051630a14c4b560e41b815260040160405180910390fd5b60006126c961312c565b905080516000036126e95760405180602001604052806000815250611100565b806126f38461313b565b604051602001612704929190614466565b6040516020818303038152906040529392505050565b6002600b540361273c5760405162461bcd60e51b8152600401610c989061416c565b6002600b5532331461274d57600080fd5b600f5460ff166127945760405162461bcd60e51b81526020600482015260126024820152714d696e74206973206e6f742061637469766560701b6044820152606401610c98565b600e546000908152601060205260409020600281015482111561280a5760405162461bcd60e51b815260206004820152602860248201527f596f752077656e74206f766572206d617820746f6b656e7320706572207472616044820152673739b0b1ba34b7b760c11b6064820152608401610c98565b600381015461281a9060016141b9565b8261282460005490565b61282e91906141b9565b111561284c5760405162461bcd60e51b8152600401610c98906141cc565b8054349061285b90849061429c565b146128785760405162461bcd60e51b8152600401610c98906142d5565b6117d13383612d53565b600080338360405160200161289892919061427a565b6040516020818303038152906040528051906020012090506110fc8585808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250600e548152601060205260409020600801549250859150612d6d9050565b6000818152601060205260408120600301546129555760405162461bcd60e51b815260206004820152601460248201527310dbdb5a58c8191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610c98565b5060009081526010602090815260408083206001600160a01b0394909416835260099093019052205490565b6002600b54036129a35760405162461bcd60e51b8152600401610c989061416c565b6002600b5560005b81518110156117d1576129d68282815181106129c9576129c9614214565b6020026020010151611ff9565b6001600160a01b0316336001600160a01b031614612a065760405162461bcd60e51b8152600401610c989061422a565b612a28828281518110612a1b57612a1b614214565b6020026020010151612d48565b80612a3281614261565b9150506129ab565b612a42612bbc565b600e54600090815260106020526040902060030154612a629060016141b9565b81612a6c60005490565b612a7691906141b9565b1115612a945760405162461bcd60e51b8152600401610c98906141cc565b610cab8282612d53565b612aa6612bbc565b6001600160a01b038116612b0b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c98565b61135181612f7d565b612b1c612bbc565b600f805461ff001981166101009182900460ff1615909102179055565b60006301ffc9a760e01b6001600160e01b031983161480612b6a57506380ac58cd60e01b6001600160e01b03198316145b80610c1b5750506001600160e01b031916635b5e139f60e01b1490565b60006001600160e01b0319821663152a902d60e11b1480610c1b57506301ffc9a760e01b6001600160e01b0319831614610c1b565b600a546001600160a01b031633146121465760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c98565b6127106001600160601b0382161115612c845760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610c98565b6001600160a01b038216612cda5760405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606401610c98565b604080518082019091526001600160a01b039092168083526001600160601b039091166020909201829052600160a01b90910217600855565b600081600111158015612d27575060005482105b8015610c1b575050600090815260046020526040902054600160e01b161590565b61135181600061317f565b610cab8282604051806020016040528060008152506132b7565b600082612d7a8584613324565b14949350505050565b60008180600111612dd957600054811015612dd95760008181526004602052604081205490600160e01b82169003612dd7575b80600003611100575060001901600081815260046020526040902054612db6565b505b604051636f96cda160e11b815260040160405180910390fd5b80471015612e425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610c98565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612e8f576040519150601f19603f3d011682016040523d82523d6000602084013e612e94565b606091505b50509050806118195760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610c98565b6000610c1b612f18613369565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000612f688585613490565b91509150612f75816134d2565b509392505050565b600a80546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260046020526040902054610c1b90613688565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613040903390899088908890600401614495565b6020604051808303816000875af192505050801561307b575060408051601f3d908101601f19168201909252613078918101906144d2565b60015b6130d9573d8080156130a9576040519150601f19603f3d011682016040523d82523d6000602084013e6130ae565b606091505b5080516000036130d1576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610c1b61312783612d83565b613688565b6060600d8054610cbe90614132565b606060a06040510180604052602081039150506000815280825b600183039250600a81066030018353600a9004806131555750819003601f19909101908152919050565b600061318a83612d83565b9050806000806131a886600090815260066020526040902080549091565b9150915084156131e8576131bd8184336111b1565b6131e8576131cb8333610b49565b6131e857604051632ce44b5f60e11b815260040160405180910390fd5b80156131f357600082555b6001600160a01b038316600081815260056020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260046020526040812091909155600160e11b851690036132815760018601600081815260046020526040812054900361327f57600054811461327f5760008181526004602052604090208590555b505b60405186906000906001600160a01b03861690600080516020614506833981519152908390a45050600180548101905550505050565b6132c183836136cf565b6001600160a01b0383163b15611819576000548281035b6132eb600086838060010194508661300b565b613308576040516368d2bf6b60e11b815260040160405180910390fd5b8181106132d857816000541461331d57600080fd5b5050505050565b600081815b8451811015612f75576133558286838151811061334857613348614214565b60200260200101516137a9565b91508061336181614261565b915050613329565b6000306001600160a01b037f0000000000000000000000006197042f048122b60b644fc263e7b49fe40e00ef161480156133c257507f000000000000000000000000000000000000000000000000000000000000000146145b156133ec57507fd60d47bf7789724b1bf9805b43dfdf4fd86c6f7d6e69f1b49455188c335b4b3490565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f0b507b8126f7c10dedc1fce9dfb1e8ec5b062c350310ac1dd1d8af6ab92bf08c828401527fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b360608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008082516041036134c65760208301516040840151606085015160001a6134ba878285856137d5565b945094505050506113fb565b506000905060026113fb565b60008160048111156134e6576134e66144ef565b036134ee5750565b6001816004811115613502576135026144ef565b0361354f5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610c98565b6002816004811115613563576135636144ef565b036135b05760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610c98565b60038160048111156135c4576135c46144ef565b0361361c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610c98565b6004816004811115613630576136306144ef565b036113515760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401610c98565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b60008054908290036136f45760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b03831660008181526005602090815260408083208054680100000000000000018802019055848352600490915281206001851460e11b4260a01b178317905582840190839083906000805160206145068339815191528180a4600183015b81811461377f5780836000600080516020614506833981519152600080a4600101613759565b50816000036137a057604051622e076360e81b815260040160405180910390fd5b60005550505050565b60008183106137c5576000828152602084905260409020611100565b5060009182526020526040902090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561380c57506000905060036138b9565b8460ff16601b1415801561382457508460ff16601c14155b1561383557506000905060046138b9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613889573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166138b2576000600192509250506138b9565b9150600090505b94509492505050565b6001600160e01b03198116811461135157600080fd5b6000602082840312156138ea57600080fd5b8135611100816138c2565b80356001600160a01b038116811461390c57600080fd5b919050565b6000806040838503121561392457600080fd5b61392d836138f5565b915060208301356001600160601b038116811461394957600080fd5b809150509250929050565b60006020828403121561396657600080fd5b611100826138f5565b60005b8381101561398a578181015183820152602001613972565b50506000910152565b600081518084526139ab81602086016020860161396f565b601f01601f19169290920160200192915050565b6020815260006111006020830184613993565b6000602082840312156139e457600080fd5b5035919050565b600080604083850312156139fe57600080fd5b613a07836138f5565b946020939093013593505050565b60008083601f840112613a2757600080fd5b5081356001600160401b03811115613a3e57600080fd5b6020830191508360208260051b85010111156113fb57600080fd5b60008060208385031215613a6c57600080fd5b82356001600160401b03811115613a8257600080fd5b613a8e85828601613a15565b90969095509350505050565b600080600060408486031215613aaf57600080fd5b83356001600160401b03811115613ac557600080fd5b613ad186828701613a15565b909790965060209590950135949350505050565b60008060408385031215613af857600080fd5b50508035926020909101359150565b600080600060608486031215613b1c57600080fd5b613b25846138f5565b9250613b33602085016138f5565b9150604084013590509250925092565b60008060008060608587031215613b5957600080fd5b843593506020850135925060408501356001600160401b03811115613b7d57600080fd5b613b8987828801613a15565b95989497509550505050565b60008060008060008060008060006101208a8c031215613bb457600080fd5b8935985060208a0135975060408a0135965060608a0135955060808a0135945060a08a0135935060c08a01359250613bee60e08b016138f5565b91506101008a013590509295985092959850929598565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613c4357613c43613c05565b604052919050565b60006001600160401b03831115613c6457613c64613c05565b613c77601f8401601f1916602001613c1b565b9050828152838383011115613c8b57600080fd5b828260208301376000602084830101529392505050565b600060208284031215613cb457600080fd5b81356001600160401b03811115613cca57600080fd5b8201601f81018413613cdb57600080fd5b6130ef84823560208401613c4b565b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b8181101561229957613d55838551613cea565b9284019260809290920191600101613d42565b60008060408385031215613d7b57600080fd5b82359150613d8b602084016138f5565b90509250929050565b60008060008060608587031215613daa57600080fd5b843593506020850135925060408501356001600160401b0380821115613dcf57600080fd5b818701915087601f830112613de357600080fd5b813581811115613df257600080fd5b886020828501011115613e0457600080fd5b95989497505060200194505050565b60006001600160401b03821115613e2c57613e2c613c05565b5060051b60200190565b60008060408385031215613e4957600080fd5b82356001600160401b03811115613e5f57600080fd5b8301601f81018513613e7057600080fd5b80356020613e85613e8083613e13565b613c1b565b82815260059290921b83018101918181019088841115613ea457600080fd5b938201935b83851015613ec957613eba856138f5565b82529382019390820190613ea9565b98969091013596505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561229957835183529284019291840191600101613ef4565b600080600060608486031215613f2557600080fd5b613f2e846138f5565b95602085013595506040909401359392505050565b6000806000806000806000806000806101408b8d031215613f6357600080fd5b8a35995060208b0135985060408b0135975060608b0135965060808b0135955060a08b0135945060c08b0135935060e08b01359250613fa56101008c016138f5565b91506101208b013590509295989b9194979a5092959850565b60008060408385031215613fd157600080fd5b613fda836138f5565b91506020830135801515811461394957600080fd5b6000806000806080858703121561400557600080fd5b61400e856138f5565b935061401c602086016138f5565b92506040850135915060608501356001600160401b0381111561403e57600080fd5b8501601f8101871361404f57600080fd5b61405e87823560208401613c4b565b91505092959194509250565b60808101610c1b8284613cea565b6000602080838503121561408b57600080fd5b82356001600160401b038111156140a157600080fd5b8301601f810185136140b257600080fd5b80356140c0613e8082613e13565b81815260059190911b820183019083810190878311156140df57600080fd5b928401925b828410156140fd578335825292840192908401906140e4565b979650505050505050565b6000806040838503121561411b57600080fd5b614124836138f5565b9150613d8b602084016138f5565b600181811c9082168061414657607f821691505b60208210810361416657634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610c1b57610c1b6141a3565b60208082526028908201527f4e6f7420656e6f75676820746f6b656e73206c65667420746f206d696e742074604082015267686174206d616e7960c01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b60208082526018908201527f596f7520646f206e6f74206f776e2074686520746f6b656e0000000000000000604082015260600190565b600060018201614273576142736141a3565b5060010190565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b8082028115828204841417610c1b57610c1b6141a3565b6000826142d057634e487b7160e01b600052601260045260246000fd5b500490565b60208082526024908201527f596f752073656e742074686520696e636f727265637420616d6f756e74206f666040820152630408aa8960e31b606082015260800190565b60208082526028908201527f436c61696d3a204e6f7420616c6c6f77656420746f20636c61696d20676976656040820152671b88185b5bdd5b9d60c21b606082015260800190565b601f82111561181957600081815260208120601f850160051c810160208610156143885750805b601f850160051c820191505b818110156112e557828155600101614394565b81516001600160401b038111156143c0576143c0613c05565b6143d4816143ce8454614132565b84614361565b602080601f83116001811461440957600084156143f15750858301515b600019600386901b1c1916600185901b1785556112e5565b600085815260208120601f198616915b8281101561443857888601518255948401946001909101908401614419565b50858210156144565787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000835161447881846020880161396f565b83519083019061448c81836020880161396f565b01949350505050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906144c890830184613993565b9695505050505050565b6000602082840312156144e457600080fd5b8151611100816138c2565b634e487b7160e01b600052602160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204e7913a1e90e9ba8efbe38f486bf62eb376337334e5087bfd2161890470d653264736f6c63430008110033
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.