ETH Price: $3,863.07 (-1.94%)

Token

CF EchoStone (ECHOSTONE)
 

Overview

Max Total Supply

4,635 ECHOSTONE

Holders

820

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A
Filtered by Token Holder
ql-crypto.eth
Balance
1 ECHOSTONE
0x765E406Eb1Bb0909F4Eae2fe5B52c21C9E61b498
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Echostone

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 12 : Echostone.sol
// SPDX-License-Identifier: MIT
// Creator: twitter.com/0xNox_ETH

//               .;::::::::::::::::::::::::::::::;.
//               ;XMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN:
//               ;XWMMMMMMMMMMMMMMMMMMMMMMMMMMMMMX;
//               ;KNNNWMMWMMMMMMWWNNNNNNNNNWMMMMMN:
//                .',oXMMMMMMMNk:''''''''';OMMMMMN:
//                 ,xNMMMMMMNk;            l00000k,
//               .lNMMMMMMNk;               .....  
//                'dXMMWNO;                ....... 
//                  'd0k;.                .dXXXXX0;
//               .,;;:lc;;;;;;;;;;;;;;;;;;c0MMMMMN:
//               ;XMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMX:
//               ;XMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN:
//               ;XWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWX:
//               .,;,;;;;;;;;;;;;;;;;;;;;;;;,;;,;,.
//               'dkxkkxxkkkkkkkkkkkkkkkkkkxxxkxkd'
//               ;XMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN:
//               ;XMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMN:
//               'xkkkOOkkkkkkkkkkkkkkkkkkkkkkkkkx'
//                          .,,,,,,,,,,,,,,,,,,,,,.
//                        .lKNWWWWWWWWWWWWWWWWWWWX;
//                      .lKWMMMMMMMMMMMMMMMMMMMMMX;
//                    .lKWMMMMMMMMMMMMMMMMMMMMMMMN:
//                  .lKWMMMMMWKo:::::::::::::::::;.
//                .lKWMMMMMWKl.
//               .lNMMMMMWKl.
//                 ;kNMWKl.
//                   ;dl.
//
//               We vow to Protect
//               Against the powers of Darkness
//               To rain down Justice
//               Against all who seek to cause Harm
//               To heed the call of those in Need
//               To offer up our Arms
//               In body and name we give our Code
//               
//               FOR THE BLOCKCHAIN ⚔️

pragma solidity ^0.8.16;

import "./extensions/IERC721ABurnable.sol";
import "./extensions/ERC721AQueryable.sol";
import "./ICloneforceAirdropManager.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";

contract Echostone is Ownable, ReentrancyGuard, VRFConsumerBaseV2, ERC721AQueryable, IERC721ABurnable {
    event PermanentURI(string _value, uint256 indexed _id);

    VRFCoordinatorV2Interface private VRF_COORDINATOR;
    uint64 private _chainlinkSubscriptionId;
    bytes32 private _vrfKeyHash = 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef;
    address private constant VRF_COORDINATOR_ADDR = 0x271682DEB8C4E0901D1a1550aD2e64D568E69909;
    uint32 private constant CHAINLINK_CALLBACK_GAS_LIMIT = 100000;
    uint16 private constant CHAINLINK_REQ_CONFIRMATIONS = 3;

    uint256 public constant MAX_SUPPLY = 5928;
    uint256 public constant PRICE = 0.05 ether;
    
    // Holds the # of remaining tokens for each DNA
    mapping(uint256 => uint256) public dnaToRemainingSupply;

    // Holds the # of remaining gold tokens for each DNA
    mapping(uint256 => uint256) public dnaToRemainingGoldSupply;

    // Holds the # of remaining tokens available for migration
    uint256 public remainingSupply = 5928;

    mapping(uint256 => uint256) private _randomnessRequestIdToTokenId;

    // 0: Migration still in progress or token not minted
    // 1: Human
    // 2: Robot
    // 3: Demon
    // 4: Angel
    // 5: Reptile
    // 6: Undead
    // 7: Alien
    // 8: XXXX
    mapping(uint256 => uint256) public tokenIdToDna;

    // 0: Migration still in progress or token not minted
    // 1: Not gold
    // 2: Gold
    mapping(uint256 => uint256) public tokenIdToIsGold;


    bool public mintstoneMigrationPaused;
    bool public contractPaused;

    string private _baseTokenURI;
    bool public baseURILocked;

    ICloneforceAirdropManager private AIRDROP_MANAGER;
    Mintstone2Contract private USED_MINTSTONE;
    MintstoneContract private MINTSTONE;
    address private _burnAuthorizedContract;
    
    address private _admin;

    constructor(
        string memory baseTokenURI,
        address admin,
        address mintstoneContract,
        address usedMintstoneContract,
        address airdropManagerContract,
        uint64 chainlinkSubscriptionId)
    VRFConsumerBaseV2(VRF_COORDINATOR_ADDR)
    ERC721A("CF EchoStone", "ECHOSTONE") {
        _chainlinkSubscriptionId = chainlinkSubscriptionId;
        _admin = admin;
        _baseTokenURI = baseTokenURI;
        mintstoneMigrationPaused = true;

        VRF_COORDINATOR = VRFCoordinatorV2Interface(VRF_COORDINATOR_ADDR);
        MINTSTONE = MintstoneContract(mintstoneContract);
        USED_MINTSTONE = Mintstone2Contract(usedMintstoneContract);
        AIRDROP_MANAGER = ICloneforceAirdropManager(airdropManagerContract);
        
        _initializeSupplies();

        _safeMint(msg.sender, 1);
        _setTokenMetadata(0, 1, 1); // Human - Not gold
    }

    modifier callerIsUser() {
        require(tx.origin == msg.sender, "Caller is another contract");
        _;
    }
    
    modifier onlyOwnerOrAdmin() {
        require(msg.sender == owner() || msg.sender == _admin, "Not owner or admin");
        _;
    }

    function _initializeSupplies() private {
        dnaToRemainingSupply[1] = 1500;
        dnaToRemainingGoldSupply[1] = 150;

        dnaToRemainingSupply[2] = 1188;
        dnaToRemainingGoldSupply[2] = 118;

        dnaToRemainingSupply[3] = 960;
        dnaToRemainingGoldSupply[3] = 50;

        dnaToRemainingSupply[4] = 960;
        dnaToRemainingGoldSupply[4] = 50;

        dnaToRemainingSupply[5] = 650;
        dnaToRemainingGoldSupply[5] = 35;

        dnaToRemainingSupply[6] = 450;
        dnaToRemainingGoldSupply[6] = 25;

        dnaToRemainingSupply[7] = 220;
        dnaToRemainingGoldSupply[7] = 10;
    }

    // Starts the migration process of given Mintstones.
    // Note that migration is asynchronous; the Echostone will be minted but its metadata
    // will be assigned later (see `fulfillRandomWords`) when the on-chain randomness is produced.
    function startMintstoneMigration(uint256[] memory mintstoneIds)
        external
        payable
        nonReentrant
        callerIsUser
    {
        require(!mintstoneMigrationPaused && !contractPaused, "Migration is paused");

        uint256 price = PRICE * mintstoneIds.length;
        require(msg.value >= price, "Not enough ETH");

        uint256 i;
        for (i = 0; i < mintstoneIds.length;) {
            uint256 mintstoneId = mintstoneIds[i];
            // check if the msg sender is the owner
            require(MINTSTONE.ownerOf(mintstoneId) == msg.sender, "You don't own the given mintstone");

            // burn Mintstone
            MINTSTONE.burn(mintstoneId);

            // mint Mintstone 2 with the same id
            USED_MINTSTONE.mint(msg.sender, mintstoneId);

            unchecked { i++; }
        }

        // mint Echostones
        uint256 firstEchostoneId = _nextTokenId();
        _safeMint(msg.sender, mintstoneIds.length);

        // request random metadata for Echostones
        i = firstEchostoneId;
        unchecked {
            while (true) {
                if (i >= firstEchostoneId + mintstoneIds.length) { break; }
                
                _requestRandomMetadata(i);

                if (AIRDROP_MANAGER.hasAirdrops()) {
                    AIRDROP_MANAGER.claimAll(msg.sender, i);
                }

                i++;
            }
        }

        // refund excess ETH
        if (msg.value > price) {
            payable(msg.sender).transfer(msg.value - price);
        }
    }

    function _requestRandomMetadata(uint256 tokenId) private {
        // request a random number from Chainlink to give a random metadata to the token
        uint256 requestId = VRF_COORDINATOR.requestRandomWords(
            _vrfKeyHash,
            _chainlinkSubscriptionId,
            CHAINLINK_REQ_CONFIRMATIONS,
            CHAINLINK_CALLBACK_GAS_LIMIT,
            1);
        _randomnessRequestIdToTokenId[requestId] = tokenId;
    }

    // Will be used by an admin, only if Chainlink VRF request fails and needs a retry
    function retryMintstoneMigration(uint256 tokenId) external onlyOwnerOrAdmin {
        // request a random number from Chainlink to give a random DNA to the minted Echostone
        uint256 requestId = VRF_COORDINATOR.requestRandomWords(
            _vrfKeyHash,
            _chainlinkSubscriptionId,
            CHAINLINK_REQ_CONFIRMATIONS,
            CHAINLINK_CALLBACK_GAS_LIMIT,
            1);
        _randomnessRequestIdToTokenId[requestId] = tokenId;
    }

    // Called by Chainlink when requested randomness is ready
    function fulfillRandomWords(
        uint256 requestId,
        uint256[] memory randomWords
    ) internal override {
        uint256 tokenId = _randomnessRequestIdToTokenId[requestId];
        require(tokenId > 0, "Invalid request id");
 
        unchecked {
            uint256 rand = randomWords[0];
            uint256 randForDna = rand % remainingSupply;

            uint256 j = 0;
            for (uint256 dna = 1; dna < 8; dna++) {
                uint256 remDnaSupply = dnaToRemainingSupply[dna];
                if (remDnaSupply <= 0) {
                    // DNA is completely minted
                    continue;
                }

                j += remDnaSupply;
                if (randForDna < j) {
                    // found the DNA to assign, check if it's gold or not
                    uint256 remGoldSupply = dnaToRemainingGoldSupply[dna];
                    uint256 randForGold = (rand / 10000) % remDnaSupply;
                    uint256 gold = randForGold < remGoldSupply ? 2 : 1;

                    // assign the metadata
                    _setTokenMetadata(tokenId, dna, gold);
                    break;
                }
            }
        }
    }

    function _setTokenMetadata(uint256 tokenId, uint256 dna, uint256 gold) private {
        require(tokenIdToDna[tokenId] == 0, "Token already has a DNA");

        tokenIdToDna[tokenId] = dna;
        tokenIdToIsGold[tokenId] = gold;

        unchecked {
            if (dna > 0 && dna < 8) {
                // regular DNA, adjust supplies

                dnaToRemainingSupply[dna]--;

                if (gold == 2) {
                    dnaToRemainingGoldSupply[dna]--;
                }

                remainingSupply--;
            }
        }
    }

    // Will be used by an admin, only if Chainlink VRF totally fails and we need to assign a metadata manually
    function setTokenMetadata(uint256 tokenId, uint256 dna, uint256 gold) external onlyOwnerOrAdmin {
        _setTokenMetadata(tokenId, dna, gold);
    }
    
    function getDna(uint256 tokenId) external view returns (uint256) {
        return tokenIdToDna[tokenId];
    }

    function isGold(uint256 tokenId) external view returns (uint256) {
        return tokenIdToIsGold[tokenId];
    }

    // Only the owner of the token and its approved operators, and the authorized contract
    // can call this function.
    function burn(uint256 tokenId) public virtual override {
        // Avoid unnecessary approvals for the authorized contract
        bool approvalCheck = msg.sender != _burnAuthorizedContract;
        _burn(tokenId, approvalCheck);
    }

    // Mints a secret Echostone ;)
    function mintSecret(uint256[] calldata tokenIds)
        external
        nonReentrant
        callerIsUser
    {
        require(tokenIds.length == 7, "Invalid tokens");

        unchecked {
            bool[] memory dnaSeen = new bool[](9);
            bool allGold = true;
            
            for (uint256 i = 0; i < tokenIds.length; i++) {
                uint256 tokenId = tokenIds[i];
                require(ownerOf(tokenId) == msg.sender, "You don't own the given token");

                uint256 dna = tokenIdToDna[tokenId];
                require(dna > 0 && dna < 8 && !dnaSeen[dna], "Invalid tokens");

                dnaSeen[dna] = true;
                if (tokenIdToIsGold[tokenId] < 2) {
                    allGold = false;
                }

                _burn(tokenId, false);
            }

            uint256 newId = _nextTokenId();
            _safeMint(msg.sender, 1);
            _setTokenMetadata(newId, 8, allGold ? 2 : 1);
        }
    }

    function pauseMintstoneMigration(bool paused) external onlyOwnerOrAdmin {
        mintstoneMigrationPaused = paused;
    }

    function pauseContract(bool paused) external onlyOwnerOrAdmin {
        contractPaused = paused;
    }

    function _beforeTokenTransfers(
        address /* from */,
        address /* to */,
        uint256 /* startTokenId */,
        uint256 /* quantity */
    ) internal virtual override {
        require(!contractPaused, "Contract is paused");
    }

    // Locks base token URI forever and emits PermanentURI for marketplaces (e.g. OpenSea)
    function lockBaseURI() external onlyOwnerOrAdmin {
        baseURILocked = true;
        for (uint256 i = 0; i < _nextTokenId(); i++) {
            if (_exists(i)) {
                emit PermanentURI(tokenURI(i), i);
            }
        }
    }

    function ownerMint(address to, uint256 quantity) external onlyOwnerOrAdmin {
        require(_totalMinted() + quantity <= MAX_SUPPLY, "Quantity exceeds supply");

        uint256 firstEchostoneId = _nextTokenId();
        _safeMint(to, quantity);
        
        for (uint256 i = firstEchostoneId; i < firstEchostoneId + quantity; i++) {
            _requestRandomMetadata(i);
        }
    }

    function setBaseURI(string calldata newBaseURI) external onlyOwnerOrAdmin {
        require(!baseURILocked, "Base URI is locked");
        _baseTokenURI = newBaseURI;
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return _baseTokenURI;
    }

    function totalMinted() external view returns (uint256) {
        return _totalMinted();
    }

    function setAdmin(address admin) external onlyOwner {
        _admin = admin;
    }
    
    function setMintstoneContract(address addr) external onlyOwnerOrAdmin {
        MINTSTONE = MintstoneContract(addr);
    }

    function setUsedMintstoneContract(address addr) external onlyOwnerOrAdmin {
        USED_MINTSTONE = Mintstone2Contract(addr);
    }

    function setAirdropManagerContract(address addr) external onlyOwnerOrAdmin {
        AIRDROP_MANAGER = ICloneforceAirdropManager(addr);
    }

    function setBurnAuthorizedContract(address authorizedContract) external onlyOwnerOrAdmin {
        _burnAuthorizedContract = authorizedContract;
    }
    
    function withdrawMoney(address to) external onlyOwnerOrAdmin {
        (bool success, ) = to.call{value: address(this).balance}("");
        require(success, "Transfer failed.");
    }

    // Sets the Chainlink subscription id
    function setChainlinkSubscriptionId(uint64 id) external onlyOwnerOrAdmin {
        _chainlinkSubscriptionId = id;
    }

    // Marketplace blocklist functions
    mapping(address => bool) private _marketplaceBlocklist;

    function approve(address to, uint256 tokenId) public virtual override(ERC721A, IERC721A) {
        require(_marketplaceBlocklist[to] == false, "Marketplace is blocked");
        super.approve(to, tokenId);
    }

    function setApprovalForAll(address operator, bool approved) public virtual override(ERC721A, IERC721A) {
        require(_marketplaceBlocklist[operator] == false, "Marketplace is blocked");
        super.setApprovalForAll(operator, approved);
    }

    function blockMarketplace(address addr, bool blocked) public onlyOwnerOrAdmin {
        _marketplaceBlocklist[addr] = blocked;
    }

    // OpenSea metadata initialization
    function contractURI() public pure returns (string memory) {
        return "https://cloneforce.xyz/api/echostone/marketplace-metadata";
    }
}

interface MintstoneContract {
    function burn(uint256 tokenId) external;
    function ownerOf(uint256 tokenId) external view returns (address owner);
}

interface Mintstone2Contract {
    function mint(address to, uint256 tokenId) external;
}

File 2 of 12 : IERC721ABurnable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import '../IERC721A.sol';

/**
 * @dev Interface of ERC721ABurnable.
 */
interface IERC721ABurnable is IERC721A {
    /**
     * @dev Burns `tokenId`. See {ERC721A-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) external;
}

File 3 of 12 : ERC721AQueryable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// 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;
        }
    }
}

File 4 of 12 : ICloneforceAirdropManager.sol
// SPDX-License-Identifier: MIT
// Creator: twitter.com/0xNox_ETH

pragma solidity ^0.8.16;

interface ICloneforceAirdropManager {
    function hasAirdrops() external view returns (bool value);
    function remainingClaims(address baseContract, uint256 tokenId, address airdropContract) external view returns (uint256 count);
    function claim(address to, uint256 baseTokenId, address airdropContract, uint256 count) external;
    function claimAll(address to, uint256 baseTokenId) external;
}

File 5 of 12 : ReentrancyGuard.sol
// 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;
    }
}

File 6 of 12 : Ownable.sol
// 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);
    }
}

File 7 of 12 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFCoordinatorV2Interface {
  /**
   * @notice Get configuration relevant for making requests
   * @return minimumRequestConfirmations global min for request confirmations
   * @return maxGasLimit global max for request gas limit
   * @return s_provingKeyHashes list of registered key hashes
   */
  function getRequestConfig()
    external
    view
    returns (
      uint16,
      uint32,
      bytes32[] memory
    );

  /**
   * @notice Request a set of random words.
   * @param keyHash - Corresponds to a particular oracle job which uses
   * that key for generating the VRF proof. Different keyHash's have different gas price
   * ceilings, so you can select a specific one to bound your maximum per request cost.
   * @param subId  - The ID of the VRF subscription. Must be funded
   * with the minimum subscription balance required for the selected keyHash.
   * @param minimumRequestConfirmations - How many blocks you'd like the
   * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
   * for why you may want to request more. The acceptable range is
   * [minimumRequestBlockConfirmations, 200].
   * @param callbackGasLimit - How much gas you'd like to receive in your
   * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
   * may be slightly less than this amount because of gas used calling the function
   * (argument decoding etc.), so you may need to request slightly more than you expect
   * to have inside fulfillRandomWords. The acceptable range is
   * [0, maxGasLimit]
   * @param numWords - The number of uint256 random values you'd like to receive
   * in your fulfillRandomWords callback. Note these numbers are expanded in a
   * secure way by the VRFCoordinator from a single random value supplied by the oracle.
   * @return requestId - A unique identifier of the request. Can be used to match
   * a request to a response in fulfillRandomWords.
   */
  function requestRandomWords(
    bytes32 keyHash,
    uint64 subId,
    uint16 minimumRequestConfirmations,
    uint32 callbackGasLimit,
    uint32 numWords
  ) external returns (uint256 requestId);

  /**
   * @notice Create a VRF subscription.
   * @return subId - A unique subscription id.
   * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
   * @dev Note to fund the subscription, use transferAndCall. For example
   * @dev  LINKTOKEN.transferAndCall(
   * @dev    address(COORDINATOR),
   * @dev    amount,
   * @dev    abi.encode(subId));
   */
  function createSubscription() external returns (uint64 subId);

  /**
   * @notice Get a VRF subscription.
   * @param subId - ID of the subscription
   * @return balance - LINK balance of the subscription in juels.
   * @return reqCount - number of requests for this subscription, determines fee tier.
   * @return owner - owner of the subscription.
   * @return consumers - list of consumer address which are able to use this subscription.
   */
  function getSubscription(uint64 subId)
    external
    view
    returns (
      uint96 balance,
      uint64 reqCount,
      address owner,
      address[] memory consumers
    );

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @param newOwner - proposed new owner of the subscription
   */
  function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @dev will revert if original owner of subId has
   * not requested that msg.sender become the new owner.
   */
  function acceptSubscriptionOwnerTransfer(uint64 subId) external;

  /**
   * @notice Add a consumer to a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - New consumer which can use the subscription
   */
  function addConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Remove a consumer from a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - Consumer to remove from the subscription
   */
  function removeConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Cancel a subscription
   * @param subId - ID of the subscription
   * @param to - Where to send the remaining LINK to
   */
  function cancelSubscription(uint64 subId, address to) external;
}

File 8 of 12 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness. It ensures 2 things:
 * @dev 1. The fulfillment came from the VRFCoordinator
 * @dev 2. The consumer contract implements fulfillRandomWords.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constructor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash). Create subscription, fund it
 * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface
 * @dev subscription management functions).
 * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations,
 * @dev callbackGasLimit, numWords),
 * @dev see (VRFCoordinatorInterface for a description of the arguments).
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomWords method.
 *
 * @dev The randomness argument to fulfillRandomWords is a set of random words
 * @dev generated from your requestId and the blockHash of the request.
 *
 * @dev If your contract could have concurrent requests open, you can use the
 * @dev requestId returned from requestRandomWords to track which response is associated
 * @dev with which randomness request.
 * @dev See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ.
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request. It is for this reason that
 * @dev that you can signal to an oracle you'd like them to wait longer before
 * @dev responding to the request (however this is not enforced in the contract
 * @dev and so remains effective only in the case of unmodified oracle software).
 */
abstract contract VRFConsumerBaseV2 {
  error OnlyCoordinatorCanFulfill(address have, address want);
  address private immutable vrfCoordinator;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   */
  constructor(address _vrfCoordinator) {
    vrfCoordinator = _vrfCoordinator;
  }

  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBaseV2 expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomWords the VRF output expanded to the requested number of words
   */
  function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
    if (msg.sender != vrfCoordinator) {
      revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
    }
    fulfillRandomWords(requestId, randomWords);
  }
}

File 9 of 12 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// 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();

    /**
     * The caller cannot approve to their own address.
     */
    error ApproveToCaller();

    /**
     * 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;

    /**
     * @dev Equivalent to `safeTransferFrom(from, to, tokenId, '')`.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @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;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the
     * zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom}
     * for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    // =============================================================
    //                        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);
}

File 10 of 12 : IERC721AQueryable.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// 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);
}

File 11 of 12 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.2.2
// 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 {
    // Reference type for token approval.
    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 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 {
        if (operator == _msgSenderERC721A()) revert ApproveToCaller();

        _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 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 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 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`.
                )

                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 0x80 bytes to keep the free memory pointer 32-byte word aligned.
            // We will need 1 32-byte word to store the length,
            // and 3 32-byte words to store a maximum of 78 digits. Total: 0x20 + 3 * 0x20 = 0x80.
            str := add(mload(0x40), 0x80)
            // Update the free memory pointer to allocate.
            mstore(0x40, str)

            // 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)
        }
    }
}

File 12 of 12 : Context.sol
// 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;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"baseTokenURI","type":"string"},{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"mintstoneContract","type":"address"},{"internalType":"address","name":"usedMintstoneContract","type":"address"},{"internalType":"address","name":"airdropManagerContract","type":"address"},{"internalType":"uint64","name":"chainlinkSubscriptionId","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApproveToCaller","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":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","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":false,"internalType":"string","name":"_value","type":"string"},{"indexed":true,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"PermanentURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURILocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"blocked","type":"bool"}],"name":"blockMarketplace","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dnaToRemainingGoldSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"dnaToRemainingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getDna","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"isGold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"mintSecret","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mintstoneMigrationPaused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"address","name":"to","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"paused","type":"bool"}],"name":"pauseContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"paused","type":"bool"}],"name":"pauseMintstoneMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"remainingSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"retryMintstoneMigration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setAirdropManagerContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newBaseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"authorizedContract","type":"address"}],"name":"setBurnAuthorizedContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"id","type":"uint64"}],"name":"setChainlinkSubscriptionId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setMintstoneContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"dna","type":"uint256"},{"internalType":"uint256","name":"gold","type":"uint256"}],"name":"setTokenMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setUsedMintstoneContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"mintstoneIds","type":"uint256[]"}],"name":"startMintstoneMigration","outputs":[],"stateMutability":"payable","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":"","type":"uint256"}],"name":"tokenIdToDna","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenIdToIsGold","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"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":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawMoney","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60a06040527f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef600b55611728600e553480156200003b57600080fd5b50604051620041b8380380620041b88339810160408190526200005e9162000879565b6040518060400160405280600c81526020016b4346204563686f53746f6e6560a01b815250604051806040016040528060098152602001684543484f53544f4e4560b81b81525073271682deb8c4e0901d1a1550ad2e64d568e69909620000d4620000ce6200040360201b60201c565b62000407565b600180556001600160a01b03166080526004620000f2838262000a1d565b50600562000101828262000a1d565b5060006002555050600a8054600160a01b600160e01b031916600160a01b6001600160401b03841602179055601880546001600160a01b0319166001600160a01b038716179055601362000156878262000a1d565b5060128054600160ff19909116179055600a805473271682deb8c4e0901d1a1550ad2e64d568e699096001600160a01b03199182161782556016805482166001600160a01b0388811691909117909155601580549092168682161790915560148054610100600160a81b031916610100928616929092029190911790556105dc7fd421a5181c571bba3f01190c922c3b2a896fc1d84e86c9f17ac10e67ebef8b5c5560967ffd54ff1ed53f34a900b24c5ba64f85761163b5d82d98a47b9bd80e45466993c5556104a47f5d6016397a73f5e079297ac5a36fef17b4d9c3831618e63ab105738020ddd7205560767f10a81eed9d63d16face5e76357905348e6253d3394086026bb2bf2145d7cc249556103c07fc0da782485e77ae272268ae0a3ff44c1552ecb60b3743924de17a815e0a3cfd781905560327f26b4a10d0f0b04925c23bd4480ee147c916e5e87a7d68206a533dad160ac81e28190557f5b84bb9e0f5aa9cc45a8bb66468db5d4816d1e75ff86b5e1f1dd8d144dab8097919091557fafafe8948a4ed9d478b1e9a5780b119b5edd00ea7d07bc35bef7c814824eb94b5561028a7f2cd9ebf6ff19cdd7ffcc447d7c7d47b5991f5c7392a04512134e765802361fa65560237fa5049387d9cb649c59f4bda666105ba636c2a103d8e2b232ba4d125737cd2149556101c27f980f427e00e74f6d338adfccc7468518c8c8ea00836d0dce98c5fe154e17bf2b5560197fa48544818c2c710afa9849c61ec9c60e8acdb3eaa2885f33b37e118cc8fd04ac55600760005260dc7fdae089abd7155aa13ce498edb0d7a7156b783d015031f10c9a3d4f5fcb51897155600d6020527fb91432bedff11256dbe14161d3606a2657bc9dacf8742f6b817d871dd53fb97655620003e833600162000457565b620003f760006001806200047d565b50505050505062000b72565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b620004798282604051806020016040528060008152506200055a60201b60201c565b5050565b60008381526010602052604090205415620004df5760405162461bcd60e51b815260206004820152601760248201527f546f6b656e20616c726561647920686173206120444e4100000000000000000060448201526064015b60405180910390fd5b60008381526010602090815260408083208590556011909152902081905581158015906200050d5750600882105b1562000555576000828152600c60205260409020805460001901905560028190036200054a576000828152600d6020526040902080546000190190555b600e80546000190190555b505050565b620005668383620005d0565b6001600160a01b0383163b1562000555576002548281035b60018101906200059490600090879086620006bf565b620005b2576040516368d2bf6b60e11b815260040160405180910390fd5b8181106200057e578160025414620005c957600080fd5b5050505050565b6002546000829003620005f65760405163b562e8dd60e01b815260040160405180910390fd5b620006056000848385620007b3565b6001600160a01b03831660008181526007602090815260408083208054680100000000000000018802019055848352600690915281206001851460e11b4260a01b17831790558284019083908390600080516020620041988339815191528180a4600183015b81811462000694578083600060008051602062004198833981519152600080a46001016200066b565b5081600003620006b657604051622e076360e81b815260040160405180910390fd5b60025550505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290620006f690339089908890889060040162000ae9565b6020604051808303816000875af192505050801562000734575060408051601f3d908101601f19168201909252620007319181019062000b3f565b60015b62000796573d80801562000765576040519150601f19603f3d011682016040523d82523d6000602084013e6200076a565b606091505b5080516000036200078e576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b601254610100900460ff1615620008025760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b6044820152606401620004d6565b50505050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200083b57818101518382015260200162000821565b50506000910152565b80516001600160a01b03811681146200085c57600080fd5b919050565b80516001600160401b03811681146200085c57600080fd5b60008060008060008060c087890312156200089357600080fd5b86516001600160401b0380821115620008ab57600080fd5b818901915089601f830112620008c057600080fd5b815181811115620008d557620008d562000808565b604051601f8201601f19908116603f0116810190838211818310171562000900576200090062000808565b816040528281528c60208487010111156200091a57600080fd5b6200092d8360208301602088016200081e565b809a505050505050620009436020880162000844565b9450620009536040880162000844565b9350620009636060880162000844565b9250620009736080880162000844565b91506200098360a0880162000861565b90509295509295509295565b600181811c90821680620009a457607f821691505b602082108103620009c557634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200055557600081815260208120601f850160051c81016020861015620009f45750805b601f850160051c820191505b8181101562000a155782815560010162000a00565b505050505050565b81516001600160401b0381111562000a395762000a3962000808565b62000a518162000a4a84546200098f565b84620009cb565b602080601f83116001811462000a89576000841562000a705750858301515b600019600386901b1c1916600185901b17855562000a15565b600085815260208120601f198616915b8281101562000aba5788860151825594840194600190910190840162000a99565b508582101562000ad95787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060018060a01b03808716835280861660208401525083604083015260806060830152825180608084015262000b288160a08501602087016200081e565b601f01601f19169190910160a00195945050505050565b60006020828403121562000b5257600080fd5b81516001600160e01b03198116811462000b6b57600080fd5b9392505050565b60805161360362000b9560003960008181610cc10152610d0301526136036000f3fe6080604052600436106103355760003560e01c80636352211e116101ab578063a22cb465116100f7578063da0239a611610095578063e8a3d4851161006f578063e8a3d485146109b5578063e985e9c5146109ca578063f2fde38b14610a13578063f68b0c1214610a3357600080fd5b8063da0239a61461095f578063e272b89214610975578063e73488ed1461099557600080fd5b8063b88d4fde116100d1578063b88d4fde146108d2578063c23dc68f146108f2578063c87b56dd1461091f578063d667ed831461093f57600080fd5b8063a22cb4651461087d578063a2309ff81461089d578063b51a0953146108b257600080fd5b8063715018a6116101645780638d859f3e1161013e5780638d859f3e1461080f5780638da5cb5b1461082a57806395d89b411461084857806399a2557a1461085d57600080fd5b8063715018a6146107ae5780638462151c146107c35780638a67456a146107f057600080fd5b80636352211e146106ee57806366da57ff1461070e578063692ad3531461072e5780636eea010d1461074e578063704b6c021461076e57806370a082311461078e57600080fd5b8063422627c3116102855780634878f78f1161022357806355f804b3116101fd57806355f804b314610674578063595d81a5146106945780635bbb2177146106a75780635d148e5c146106d457600080fd5b80634878f78f146106055780634c466d111461063257806353df5c7c1461065f57600080fd5b8063451e35661161025f578063451e35661461057e57806346b800ff1461059857806347a04f21146105b8578063484b973c146105e557600080fd5b8063422627c31461051157806342842e0e1461053e57806342966c681461055e57600080fd5b80631f0e330b116102f25780632f971029116102cc5780632f9710291461048e57806332cb6b0c146104ae57806338df9bde146104c45780633c3c77ef146104f157600080fd5b80631f0e330b1461042e5780631fe543e31461044e57806323b872dd1461046e57600080fd5b806301ffc9a71461033a57806306fdde031461036f578063081812fc14610391578063095ea7b3146103c95780630b4f2e56146103eb57806318160ddd1461040b575b600080fd5b34801561034657600080fd5b5061035a610355366004612ca0565b610a60565b60405190151581526020015b60405180910390f35b34801561037b57600080fd5b50610384610ab2565b6040516103669190612d0d565b34801561039d57600080fd5b506103b16103ac366004612d20565b610b44565b6040516001600160a01b039091168152602001610366565b3480156103d557600080fd5b506103e96103e4366004612d4e565b610b88565b005b3480156103f757600080fd5b506103e9610406366004612d7a565b610bfd565b34801561041757600080fd5b50600354600254035b604051908152602001610366565b34801561043a57600080fd5b506103e9610449366004612db4565b610c4c565b34801561045a57600080fd5b506103e9610469366004612eb2565b610cb6565b34801561047a57600080fd5b506103e9610489366004612ef8565b610d3a565b34801561049a57600080fd5b506103e96104a9366004612f39565b610ed8565b3480156104ba57600080fd5b5061042061172881565b3480156104d057600080fd5b506104206104df366004612d20565b60106020526000908152604090205481565b3480156104fd57600080fd5b506103e961050c366004612d20565b610fad565b34801561051d57600080fd5b5061042061052c366004612d20565b60009081526010602052604090205490565b34801561054a57600080fd5b506103e9610559366004612ef8565b6110a1565b34801561056a57600080fd5b506103e9610579366004612d20565b6110bc565b34801561058a57600080fd5b5060125461035a9060ff1681565b3480156105a457600080fd5b506103e96105b3366004612f39565b6110d5565b3480156105c457600080fd5b506104206105d3366004612d20565b600d6020526000908152604090205481565b3480156105f157600080fd5b506103e9610600366004612d4e565b611136565b34801561061157600080fd5b50610420610620366004612d20565b60009081526011602052604090205490565b34801561063e57600080fd5b5061042061064d366004612d20565b60116020526000908152604090205481565b34801561066b57600080fd5b506103e9611225565b34801561068057600080fd5b506103e961068f366004612f56565b6112e2565b6103e96106a2366004612fc7565b611376565b3480156106b357600080fd5b506106c76106c2366004612ffb565b611808565b6040516103669190613099565b3480156106e057600080fd5b5060145461035a9060ff1681565b3480156106fa57600080fd5b506103b1610709366004612d20565b6118d3565b34801561071a57600080fd5b506103e9610729366004612f39565b6118de565b34801561073a57600080fd5b506103e96107493660046130db565b61193f565b34801561075a57600080fd5b506103e9610769366004613104565b6119ab565b34801561077a57600080fd5b506103e9610789366004612f39565b6119fd565b34801561079a57600080fd5b506104206107a9366004612f39565b611a27565b3480156107ba57600080fd5b506103e9611a75565b3480156107cf57600080fd5b506107e36107de366004612f39565b611a89565b6040516103669190613121565b3480156107fc57600080fd5b5060125461035a90610100900460ff1681565b34801561081b57600080fd5b5061042066b1a2bc2ec5000081565b34801561083657600080fd5b506000546001600160a01b03166103b1565b34801561085457600080fd5b50610384611b91565b34801561086957600080fd5b506107e3610878366004613159565b611ba0565b34801561088957600080fd5b506103e9610898366004612db4565b611d19565b3480156108a957600080fd5b50610420611d85565b3480156108be57600080fd5b506103e96108cd366004612ffb565b611d95565b3480156108de57600080fd5b506103e96108ed36600461318e565b612047565b3480156108fe57600080fd5b5061091261090d366004612d20565b61208b565b6040516103669190613251565b34801561092b57600080fd5b5061038461093a366004612d20565b612103565b34801561094b57600080fd5b506103e961095a366004612f39565b612186565b34801561096b57600080fd5b50610420600e5481565b34801561098157600080fd5b506103e9610990366004613104565b6121e7565b3480156109a157600080fd5b506103e96109b0366004612f39565b612240565b3480156109c157600080fd5b506103846122a7565b3480156109d657600080fd5b5061035a6109e536600461325f565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205460ff1690565b348015610a1f57600080fd5b506103e9610a2e366004612f39565b6122c7565b348015610a3f57600080fd5b50610420610a4e366004612d20565b600c6020526000908152604090205481565b60006301ffc9a760e01b6001600160e01b031983161480610a9157506380ac58cd60e01b6001600160e01b03198316145b80610aac5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606060048054610ac19061328d565b80601f0160208091040260200160405190810160405280929190818152602001828054610aed9061328d565b8015610b3a5780601f10610b0f57610100808354040283529160200191610b3a565b820191906000526020600020905b815481529060010190602001808311610b1d57829003601f168201915b5050505050905090565b6000610b4f8261233d565b610b6c576040516333d1c03960e21b815260040160405180910390fd5b506000908152600860205260409020546001600160a01b031690565b6001600160a01b03821660009081526019602052604090205460ff1615610bef5760405162461bcd60e51b815260206004820152601660248201527513585c9ad95d1c1b1858d9481a5cc8189b1bd8dad95960521b60448201526064015b60405180910390fd5b610bf98282612365565b5050565b6000546001600160a01b0316331480610c2057506018546001600160a01b031633145b610c3c5760405162461bcd60e51b8152600401610be6906132c7565b610c47838383612405565b505050565b6000546001600160a01b0316331480610c6f57506018546001600160a01b031633145b610c8b5760405162461bcd60e51b8152600401610be6906132c7565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d305760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610be6565b610bf982826124d8565b6000610d45826125f7565b9050836001600160a01b0316816001600160a01b031614610d785760405162a1148160e81b815260040160405180910390fd5b60008281526008602052604090208054610da48187335b6001600160a01b039081169116811491141790565b610dcf57610db286336109e5565b610dcf57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610df657604051633a954ecd60e21b815260040160405180910390fd5b610e03868686600161265e565b8015610e0e57600082555b6001600160a01b038681166000908152600760205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260066020526040812091909155600160e11b84169003610ea057600184016000818152600660205260408120549003610e9e576002548114610e9e5760008181526006602052604090208490555b505b83856001600160a01b0316876001600160a01b03166000805160206135ae83398151915260405160405180910390a45b505050505050565b6000546001600160a01b0316331480610efb57506018546001600160a01b031633145b610f175760405162461bcd60e51b8152600401610be6906132c7565b6000816001600160a01b03164760405160006040518083038185875af1925050503d8060008114610f64576040519150601f19603f3d011682016040523d82523d6000602084013e610f69565b606091505b5050905080610bf95760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610be6565b6000546001600160a01b0316331480610fd057506018546001600160a01b031633145b610fec5760405162461bcd60e51b8152600401610be6906132c7565b600a54600b546040516305d3b1d360e41b81526004810191909152600160a01b82046001600160401b0316602482015260036044820152620186a06064820152600160848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611068573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108c91906132f3565b6000908152600f602052604090209190915550565b610c4783838360405180602001604052806000815250612047565b6017546001600160a01b0316331415610bf982826126ab565b6000546001600160a01b03163314806110f857506018546001600160a01b031633145b6111145760405162461bcd60e51b8152600401610be6906132c7565b601780546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633148061115957506018546001600160a01b031633145b6111755760405162461bcd60e51b8152600401610be6906132c7565b6117288161118260025490565b61118c9190613322565b11156111da5760405162461bcd60e51b815260206004820152601760248201527f5175616e74697479206578636565647320737570706c790000000000000000006044820152606401610be6565b60006111e560025490565b90506111f183836127f2565b805b6111fd8383613322565b81101561121f5761120d81610fec565b8061121781613335565b9150506111f3565b50505050565b6000546001600160a01b031633148061124857506018546001600160a01b031633145b6112645760405162461bcd60e51b8152600401610be6906132c7565b6014805460ff1916600117905560005b6002548110156112df576112878161233d565b156112cd57807fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b556572076112b783612103565b6040516112c49190612d0d565b60405180910390a25b806112d781613335565b915050611274565b50565b6000546001600160a01b031633148061130557506018546001600160a01b031633145b6113215760405162461bcd60e51b8152600401610be6906132c7565b60145460ff16156113695760405162461bcd60e51b815260206004820152601260248201527110985cd948155492481a5cc81b1bd8dad95960721b6044820152606401610be6565b6013610c47828483613394565b6002600154036113c85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be6565b600260015532331461141c5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c657220697320616e6f7468657220636f6e74726163740000000000006044820152606401610be6565b60125460ff161580156114375750601254610100900460ff16155b6114795760405162461bcd60e51b8152602060048201526013602482015272135a59dc985d1a5bdb881a5cc81c185d5cd959606a1b6044820152606401610be6565b6000815166b1a2bc2ec5000061148f9190613453565b9050803410156114d25760405162461bcd60e51b815260206004820152600e60248201526d09cdee840cadcdeeaced0408aa8960931b6044820152606401610be6565b60005b825181101561169e5760008382815181106114f2576114f2613472565b60209081029190910101516016546040516331a9108f60e11b81526004810183905291925033916001600160a01b0390911690636352211e90602401602060405180830381865afa15801561154b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156f9190613488565b6001600160a01b0316146115cf5760405162461bcd60e51b815260206004820152602160248201527f596f7520646f6e2774206f776e2074686520676976656e206d696e7473746f6e6044820152606560f81b6064820152608401610be6565b601654604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561161557600080fd5b505af1158015611629573d6000803e3d6000fd5b50506015546040516340c10f1960e01b8152336004820152602481018590526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b15801561167957600080fd5b505af115801561168d573d6000803e3d6000fd5b5050600190930192506114d5915050565b60006116a960025490565b90506116b63385516127f2565b8091505b835181018210156117be576116ce82610fec565b601460019054906101000a90046001600160a01b03166001600160a01b031663f459da356040518163ffffffff1660e01b8152600401602060405180830381865afa158015611721573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174591906134a5565b156117b357601454604051635cf20c7b60e01b8152336004820152602481018490526101009091046001600160a01b031690635cf20c7b90604401600060405180830381600087803b15801561179a57600080fd5b505af11580156117ae573d6000803e3d6000fd5b505050505b6001909101906116ba565b823411156117fe57336108fc6117d485346134c2565b6040518115909202916000818181858888f193505050501580156117fc573d6000803e3d6000fd5b505b5050600180555050565b6060816000816001600160401b0381111561182557611825612ded565b60405190808252806020026020018201604052801561187757816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816118435790505b50905060005b8281146118ca576118a586868381811061189957611899613472565b9050602002013561208b565b8282815181106118b7576118b7613472565b602090810291909101015260010161187d565b50949350505050565b6000610aac826125f7565b6000546001600160a01b031633148061190157506018546001600160a01b031633145b61191d5760405162461bcd60e51b8152600401610be6906132c7565b601580546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633148061196257506018546001600160a01b031633145b61197e5760405162461bcd60e51b8152600401610be6906132c7565b600a80546001600160401b03909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b6000546001600160a01b03163314806119ce57506018546001600160a01b031633145b6119ea5760405162461bcd60e51b8152600401610be6906132c7565b6012805460ff1916911515919091179055565b611a0561280c565b601880546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b038216611a50576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600760205260409020546001600160401b031690565b611a7d61280c565b611a876000612866565b565b60606000806000611a9985611a27565b90506000816001600160401b03811115611ab557611ab5612ded565b604051908082528060200260200182016040528015611ade578160200160208202803683370190505b509050611b0b60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b838614611b8557611b1e816128b6565b91508160400151611b7d5781516001600160a01b031615611b3e57815194505b876001600160a01b0316856001600160a01b031603611b7d5780838780600101985081518110611b7057611b70613472565b6020026020010181815250505b600101611b0e565b50909695505050505050565b606060058054610ac19061328d565b6060818310611bc257604051631960ccad60e11b815260040160405180910390fd5b600080611bce60025490565b905080841115611bdc578093505b6000611be787611a27565b905084861015611c065785850381811015611c00578091505b50611c0a565b5060005b6000816001600160401b03811115611c2457611c24612ded565b604051908082528060200260200182016040528015611c4d578160200160208202803683370190505b50905081600003611c63579350611d1292505050565b6000611c6e8861208b565b905060008160400151611c7f575080515b885b888114158015611c915750848714155b15611d0657611c9f816128b6565b92508260400151611cfe5782516001600160a01b031615611cbf57825191505b8a6001600160a01b0316826001600160a01b031603611cfe5780848880600101995081518110611cf157611cf1613472565b6020026020010181815250505b600101611c81565b50505092835250909150505b9392505050565b6001600160a01b03821660009081526019602052604090205460ff1615611d7b5760405162461bcd60e51b815260206004820152601660248201527513585c9ad95d1c1b1858d9481a5cc8189b1bd8dad95960521b6044820152606401610be6565b610bf982826128f2565b6000611d9060025490565b905090565b600260015403611de75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be6565b6002600155323314611e3b5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c657220697320616e6f7468657220636f6e74726163740000000000006044820152606401610be6565b60078114611e7c5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420746f6b656e7360901b6044820152606401610be6565b60408051600980825261014082019092526000916020820161012080368337019050509050600160005b83811015612006576000858583818110611ec257611ec2613472565b905060200201359050336001600160a01b0316611ede826118d3565b6001600160a01b031614611f345760405162461bcd60e51b815260206004820152601d60248201527f596f7520646f6e2774206f776e2074686520676976656e20746f6b656e0000006044820152606401610be6565b6000818152601060205260409020548015801590611f525750600881105b8015611f755750848181518110611f6b57611f6b613472565b6020026020010151155b611fb25760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420746f6b656e7360901b6044820152606401610be6565b6001858281518110611fc657611fc6613472565b91151560209283029190910182015260008381526011909152604090205460021115611ff157600093505b611ffc8260006126ab565b5050600101611ea6565b50600061201260025490565b905061201f3360016127f2565b61203c81600884612031576001612034565b60025b60ff16612405565b505060018055505050565b612052848484610d3a565b6001600160a01b0383163b1561121f5761206e84848484612987565b61121f576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060025483106120df5792915050565b6120e8836128b6565b90508060400151156120fa5792915050565b611d1283612a73565b606061210e8261233d565b61212b57604051630a14c4b560e41b815260040160405180910390fd5b6000612135612aa8565b905080516000036121555760405180602001604052806000815250611d12565b8061215f84612ab7565b6040516020016121709291906134d5565b6040516020818303038152906040529392505050565b6000546001600160a01b03163314806121a957506018546001600160a01b031633145b6121c55760405162461bcd60e51b8152600401610be6906132c7565b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633148061220a57506018546001600160a01b031633145b6122265760405162461bcd60e51b8152600401610be6906132c7565b601280549115156101000261ff0019909216919091179055565b6000546001600160a01b031633148061226357506018546001600160a01b031633145b61227f5760405162461bcd60e51b8152600401610be6906132c7565b601480546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b606060405180606001604052806039815260200161357560399139905090565b6122cf61280c565b6001600160a01b0381166123345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610be6565b6112df81612866565b600060025482108015610aac575050600090815260066020526040902054600160e01b161590565b6000612370826118d3565b9050336001600160a01b038216146123a95761238c81336109e5565b6123a9576040516367d9dca160e11b815260040160405180910390fd5b60008281526008602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600083815260106020526040902054156124615760405162461bcd60e51b815260206004820152601760248201527f546f6b656e20616c726561647920686173206120444e410000000000000000006044820152606401610be6565b600083815260106020908152604080832085905560119091529020819055811580159061248e5750600882105b15610c47576000828152600c60205260409020805460001901905560028190036124c9576000828152600d6020526040902080546000190190555b600e8054600019019055505050565b6000828152600f6020526040902054806125295760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081c995c5d595cdd081a5960721b6044820152606401610be6565b60008260008151811061253e5761253e613472565b602002602001015190506000600e54828161255b5761255b613504565b069050600060015b60088110156125ee576000818152600c60205260409020548061258657506125e6565b91820191828410156125e4576000828152600d602052604081205490826127108804816125b5576125b5613504565b06905060008282106125c85760016125cb565b60025b60ff1690506125db898683612405565b505050506125ee565b505b600101612563565b50505050505050565b6000816002548110156126455760008181526006602052604081205490600160e01b82169003612643575b80600003611d12575060001901600081815260066020526040902054612622565b505b604051636f96cda160e11b815260040160405180910390fd5b601254610100900460ff161561121f5760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b6044820152606401610be6565b60006126b6836125f7565b9050806000806126d486600090815260086020526040902080549091565b915091508415612714576126e9818433610d8f565b612714576126f783336109e5565b61271457604051632ce44b5f60e11b815260040160405180910390fd5b61272283600088600161265e565b801561272d57600082555b6001600160a01b038316600081815260076020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260066020526040812091909155600160e11b851690036127bb576001860160008181526006602052604081205490036127b95760025481146127b95760008181526006602052604090208590555b505b60405186906000906001600160a01b038616906000805160206135ae833981519152908390a4505060038054600101905550505050565b610bf9828260405180602001604052806000815250612aef565b6000546001600160a01b03163314611a875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610be6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260066020526040902054610aac90612b5c565b336001600160a01b0383160361291b5760405163b06307db60e01b815260040160405180910390fd5b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906129bc90339089908890889060040161351a565b6020604051808303816000875af19250505080156129f7575060408051601f3d908101601f191682019092526129f491810190613557565b60015b612a55573d808015612a25576040519150601f19603f3d011682016040523d82523d6000602084013e612a2a565b606091505b508051600003612a4d576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610aac612aa3836125f7565b612b5c565b606060138054610ac19061328d565b604080516080019081905280825b600183039250600a81066030018353600a900480612ac55750819003601f19909101908152919050565b612af98383612ba3565b6001600160a01b0383163b15610c47576002548281035b612b236000868380600101945086612987565b612b40576040516368d2bf6b60e11b815260040160405180910390fd5b818110612b10578160025414612b5557600080fd5b5050505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6002546000829003612bc85760405163b562e8dd60e01b815260040160405180910390fd5b612bd5600084838561265e565b6001600160a01b03831660008181526007602090815260408083208054680100000000000000018802019055848352600690915281206001851460e11b4260a01b178317905582840190839083906000805160206135ae8339815191528180a4600183015b818114612c6057808360006000805160206135ae833981519152600080a4600101612c3a565b5081600003612c8157604051622e076360e81b815260040160405180910390fd5b60025550505050565b6001600160e01b0319811681146112df57600080fd5b600060208284031215612cb257600080fd5b8135611d1281612c8a565b60005b83811015612cd8578181015183820152602001612cc0565b50506000910152565b60008151808452612cf9816020860160208601612cbd565b601f01601f19169290920160200192915050565b602081526000611d126020830184612ce1565b600060208284031215612d3257600080fd5b5035919050565b6001600160a01b03811681146112df57600080fd5b60008060408385031215612d6157600080fd5b8235612d6c81612d39565b946020939093013593505050565b600080600060608486031215612d8f57600080fd5b505081359360208301359350604090920135919050565b80151581146112df57600080fd5b60008060408385031215612dc757600080fd5b8235612dd281612d39565b91506020830135612de281612da6565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e2b57612e2b612ded565b604052919050565b600082601f830112612e4457600080fd5b813560206001600160401b03821115612e5f57612e5f612ded565b8160051b612e6e828201612e03565b9283528481018201928281019087851115612e8857600080fd5b83870192505b84831015612ea757823582529183019190830190612e8e565b979650505050505050565b60008060408385031215612ec557600080fd5b8235915060208301356001600160401b03811115612ee257600080fd5b612eee85828601612e33565b9150509250929050565b600080600060608486031215612f0d57600080fd5b8335612f1881612d39565b92506020840135612f2881612d39565b929592945050506040919091013590565b600060208284031215612f4b57600080fd5b8135611d1281612d39565b60008060208385031215612f6957600080fd5b82356001600160401b0380821115612f8057600080fd5b818501915085601f830112612f9457600080fd5b813581811115612fa357600080fd5b866020828501011115612fb557600080fd5b60209290920196919550909350505050565b600060208284031215612fd957600080fd5b81356001600160401b03811115612fef57600080fd5b612a6b84828501612e33565b6000806020838503121561300e57600080fd5b82356001600160401b038082111561302557600080fd5b818501915085601f83011261303957600080fd5b81358181111561304857600080fd5b8660208260051b8501011115612fb557600080fd5b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611b85576130c883855161305d565b92840192608092909201916001016130b5565b6000602082840312156130ed57600080fd5b81356001600160401b0381168114611d1257600080fd5b60006020828403121561311657600080fd5b8135611d1281612da6565b6020808252825182820181905260009190848201906040850190845b81811015611b855783518352928401929184019160010161313d565b60008060006060848603121561316e57600080fd5b833561317981612d39565b95602085013595506040909401359392505050565b600080600080608085870312156131a457600080fd5b84356131af81612d39565b93506020858101356131c081612d39565b93506040860135925060608601356001600160401b03808211156131e357600080fd5b818801915088601f8301126131f757600080fd5b81358181111561320957613209612ded565b61321b601f8201601f19168501612e03565b9150808252898482850101111561323157600080fd5b808484018584013760008482840101525080935050505092959194509250565b60808101610aac828461305d565b6000806040838503121561327257600080fd5b823561327d81612d39565b91506020830135612de281612d39565b600181811c908216806132a157607f821691505b6020821081036132c157634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601290820152712737ba1037bbb732b91037b91030b236b4b760711b604082015260600190565b60006020828403121561330557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610aac57610aac61330c565b6000600182016133475761334761330c565b5060010190565b601f821115610c4757600081815260208120601f850160051c810160208610156133755750805b601f850160051c820191505b81811015610ed057828155600101613381565b6001600160401b038311156133ab576133ab612ded565b6133bf836133b9835461328d565b8361334e565b6000601f8411600181146133f357600085156133db5750838201355b600019600387901b1c1916600186901b178355612b55565b600083815260209020601f19861690835b828110156134245786850135825560209485019460019092019101613404565b50868210156134415760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600081600019048311821515161561346d5761346d61330c565b500290565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561349a57600080fd5b8151611d1281612d39565b6000602082840312156134b757600080fd5b8151611d1281612da6565b81810381811115610aac57610aac61330c565b600083516134e7818460208801612cbd565b8351908301906134fb818360208801612cbd565b01949350505050565b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061354d90830184612ce1565b9695505050505050565b60006020828403121561356957600080fd5b8151611d1281612c8a56fe68747470733a2f2f636c6f6e65666f7263652e78797a2f6170692f6563686f73746f6e652f6d61726b6574706c6163652d6d65746164617461ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220e9fc976810ffbdbbb21d08f514ee6e123656ccea831551c885bf8894d6ac152664736f6c63430008100033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000003be3a8613dc18554a73773a5bfb8e9819d360dc00000000000000000000000000c684b8c37bbd3e58dfde822025591d15c030cd9000000000000000000000000c400c734b19c42a9bd7f96716b43e818127629880000000000000000000000003bb87ba2e741ebd85180d7550b286763692cd7e30000000000000000000000000000000000000000000000000000000000000174000000000000000000000000000000000000000000000000000000000000002e68747470733a2f2f636c6f6e65666f7263652e78797a2f6170692f6563686f73746f6e652f6d657461646174612f000000000000000000000000000000000000

Deployed Bytecode

0x6080604052600436106103355760003560e01c80636352211e116101ab578063a22cb465116100f7578063da0239a611610095578063e8a3d4851161006f578063e8a3d485146109b5578063e985e9c5146109ca578063f2fde38b14610a13578063f68b0c1214610a3357600080fd5b8063da0239a61461095f578063e272b89214610975578063e73488ed1461099557600080fd5b8063b88d4fde116100d1578063b88d4fde146108d2578063c23dc68f146108f2578063c87b56dd1461091f578063d667ed831461093f57600080fd5b8063a22cb4651461087d578063a2309ff81461089d578063b51a0953146108b257600080fd5b8063715018a6116101645780638d859f3e1161013e5780638d859f3e1461080f5780638da5cb5b1461082a57806395d89b411461084857806399a2557a1461085d57600080fd5b8063715018a6146107ae5780638462151c146107c35780638a67456a146107f057600080fd5b80636352211e146106ee57806366da57ff1461070e578063692ad3531461072e5780636eea010d1461074e578063704b6c021461076e57806370a082311461078e57600080fd5b8063422627c3116102855780634878f78f1161022357806355f804b3116101fd57806355f804b314610674578063595d81a5146106945780635bbb2177146106a75780635d148e5c146106d457600080fd5b80634878f78f146106055780634c466d111461063257806353df5c7c1461065f57600080fd5b8063451e35661161025f578063451e35661461057e57806346b800ff1461059857806347a04f21146105b8578063484b973c146105e557600080fd5b8063422627c31461051157806342842e0e1461053e57806342966c681461055e57600080fd5b80631f0e330b116102f25780632f971029116102cc5780632f9710291461048e57806332cb6b0c146104ae57806338df9bde146104c45780633c3c77ef146104f157600080fd5b80631f0e330b1461042e5780631fe543e31461044e57806323b872dd1461046e57600080fd5b806301ffc9a71461033a57806306fdde031461036f578063081812fc14610391578063095ea7b3146103c95780630b4f2e56146103eb57806318160ddd1461040b575b600080fd5b34801561034657600080fd5b5061035a610355366004612ca0565b610a60565b60405190151581526020015b60405180910390f35b34801561037b57600080fd5b50610384610ab2565b6040516103669190612d0d565b34801561039d57600080fd5b506103b16103ac366004612d20565b610b44565b6040516001600160a01b039091168152602001610366565b3480156103d557600080fd5b506103e96103e4366004612d4e565b610b88565b005b3480156103f757600080fd5b506103e9610406366004612d7a565b610bfd565b34801561041757600080fd5b50600354600254035b604051908152602001610366565b34801561043a57600080fd5b506103e9610449366004612db4565b610c4c565b34801561045a57600080fd5b506103e9610469366004612eb2565b610cb6565b34801561047a57600080fd5b506103e9610489366004612ef8565b610d3a565b34801561049a57600080fd5b506103e96104a9366004612f39565b610ed8565b3480156104ba57600080fd5b5061042061172881565b3480156104d057600080fd5b506104206104df366004612d20565b60106020526000908152604090205481565b3480156104fd57600080fd5b506103e961050c366004612d20565b610fad565b34801561051d57600080fd5b5061042061052c366004612d20565b60009081526010602052604090205490565b34801561054a57600080fd5b506103e9610559366004612ef8565b6110a1565b34801561056a57600080fd5b506103e9610579366004612d20565b6110bc565b34801561058a57600080fd5b5060125461035a9060ff1681565b3480156105a457600080fd5b506103e96105b3366004612f39565b6110d5565b3480156105c457600080fd5b506104206105d3366004612d20565b600d6020526000908152604090205481565b3480156105f157600080fd5b506103e9610600366004612d4e565b611136565b34801561061157600080fd5b50610420610620366004612d20565b60009081526011602052604090205490565b34801561063e57600080fd5b5061042061064d366004612d20565b60116020526000908152604090205481565b34801561066b57600080fd5b506103e9611225565b34801561068057600080fd5b506103e961068f366004612f56565b6112e2565b6103e96106a2366004612fc7565b611376565b3480156106b357600080fd5b506106c76106c2366004612ffb565b611808565b6040516103669190613099565b3480156106e057600080fd5b5060145461035a9060ff1681565b3480156106fa57600080fd5b506103b1610709366004612d20565b6118d3565b34801561071a57600080fd5b506103e9610729366004612f39565b6118de565b34801561073a57600080fd5b506103e96107493660046130db565b61193f565b34801561075a57600080fd5b506103e9610769366004613104565b6119ab565b34801561077a57600080fd5b506103e9610789366004612f39565b6119fd565b34801561079a57600080fd5b506104206107a9366004612f39565b611a27565b3480156107ba57600080fd5b506103e9611a75565b3480156107cf57600080fd5b506107e36107de366004612f39565b611a89565b6040516103669190613121565b3480156107fc57600080fd5b5060125461035a90610100900460ff1681565b34801561081b57600080fd5b5061042066b1a2bc2ec5000081565b34801561083657600080fd5b506000546001600160a01b03166103b1565b34801561085457600080fd5b50610384611b91565b34801561086957600080fd5b506107e3610878366004613159565b611ba0565b34801561088957600080fd5b506103e9610898366004612db4565b611d19565b3480156108a957600080fd5b50610420611d85565b3480156108be57600080fd5b506103e96108cd366004612ffb565b611d95565b3480156108de57600080fd5b506103e96108ed36600461318e565b612047565b3480156108fe57600080fd5b5061091261090d366004612d20565b61208b565b6040516103669190613251565b34801561092b57600080fd5b5061038461093a366004612d20565b612103565b34801561094b57600080fd5b506103e961095a366004612f39565b612186565b34801561096b57600080fd5b50610420600e5481565b34801561098157600080fd5b506103e9610990366004613104565b6121e7565b3480156109a157600080fd5b506103e96109b0366004612f39565b612240565b3480156109c157600080fd5b506103846122a7565b3480156109d657600080fd5b5061035a6109e536600461325f565b6001600160a01b03918216600090815260096020908152604080832093909416825291909152205460ff1690565b348015610a1f57600080fd5b506103e9610a2e366004612f39565b6122c7565b348015610a3f57600080fd5b50610420610a4e366004612d20565b600c6020526000908152604090205481565b60006301ffc9a760e01b6001600160e01b031983161480610a9157506380ac58cd60e01b6001600160e01b03198316145b80610aac5750635b5e139f60e01b6001600160e01b03198316145b92915050565b606060048054610ac19061328d565b80601f0160208091040260200160405190810160405280929190818152602001828054610aed9061328d565b8015610b3a5780601f10610b0f57610100808354040283529160200191610b3a565b820191906000526020600020905b815481529060010190602001808311610b1d57829003601f168201915b5050505050905090565b6000610b4f8261233d565b610b6c576040516333d1c03960e21b815260040160405180910390fd5b506000908152600860205260409020546001600160a01b031690565b6001600160a01b03821660009081526019602052604090205460ff1615610bef5760405162461bcd60e51b815260206004820152601660248201527513585c9ad95d1c1b1858d9481a5cc8189b1bd8dad95960521b60448201526064015b60405180910390fd5b610bf98282612365565b5050565b6000546001600160a01b0316331480610c2057506018546001600160a01b031633145b610c3c5760405162461bcd60e51b8152600401610be6906132c7565b610c47838383612405565b505050565b6000546001600160a01b0316331480610c6f57506018546001600160a01b031633145b610c8b5760405162461bcd60e51b8152600401610be6906132c7565b6001600160a01b03919091166000908152601960205260409020805460ff1916911515919091179055565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091614610d305760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909166024820152604401610be6565b610bf982826124d8565b6000610d45826125f7565b9050836001600160a01b0316816001600160a01b031614610d785760405162a1148160e81b815260040160405180910390fd5b60008281526008602052604090208054610da48187335b6001600160a01b039081169116811491141790565b610dcf57610db286336109e5565b610dcf57604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b038516610df657604051633a954ecd60e21b815260040160405180910390fd5b610e03868686600161265e565b8015610e0e57600082555b6001600160a01b038681166000908152600760205260408082208054600019019055918716808252919020805460010190554260a01b17600160e11b17600085815260066020526040812091909155600160e11b84169003610ea057600184016000818152600660205260408120549003610e9e576002548114610e9e5760008181526006602052604090208490555b505b83856001600160a01b0316876001600160a01b03166000805160206135ae83398151915260405160405180910390a45b505050505050565b6000546001600160a01b0316331480610efb57506018546001600160a01b031633145b610f175760405162461bcd60e51b8152600401610be6906132c7565b6000816001600160a01b03164760405160006040518083038185875af1925050503d8060008114610f64576040519150601f19603f3d011682016040523d82523d6000602084013e610f69565b606091505b5050905080610bf95760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610be6565b6000546001600160a01b0316331480610fd057506018546001600160a01b031633145b610fec5760405162461bcd60e51b8152600401610be6906132c7565b600a54600b546040516305d3b1d360e41b81526004810191909152600160a01b82046001600160401b0316602482015260036044820152620186a06064820152600160848201526000916001600160a01b031690635d3b1d309060a4016020604051808303816000875af1158015611068573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108c91906132f3565b6000908152600f602052604090209190915550565b610c4783838360405180602001604052806000815250612047565b6017546001600160a01b0316331415610bf982826126ab565b6000546001600160a01b03163314806110f857506018546001600160a01b031633145b6111145760405162461bcd60e51b8152600401610be6906132c7565b601780546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633148061115957506018546001600160a01b031633145b6111755760405162461bcd60e51b8152600401610be6906132c7565b6117288161118260025490565b61118c9190613322565b11156111da5760405162461bcd60e51b815260206004820152601760248201527f5175616e74697479206578636565647320737570706c790000000000000000006044820152606401610be6565b60006111e560025490565b90506111f183836127f2565b805b6111fd8383613322565b81101561121f5761120d81610fec565b8061121781613335565b9150506111f3565b50505050565b6000546001600160a01b031633148061124857506018546001600160a01b031633145b6112645760405162461bcd60e51b8152600401610be6906132c7565b6014805460ff1916600117905560005b6002548110156112df576112878161233d565b156112cd57807fa109ba539900bf1b633f956d63c96fc89b814c7287f7aa50a9216d0b556572076112b783612103565b6040516112c49190612d0d565b60405180910390a25b806112d781613335565b915050611274565b50565b6000546001600160a01b031633148061130557506018546001600160a01b031633145b6113215760405162461bcd60e51b8152600401610be6906132c7565b60145460ff16156113695760405162461bcd60e51b815260206004820152601260248201527110985cd948155492481a5cc81b1bd8dad95960721b6044820152606401610be6565b6013610c47828483613394565b6002600154036113c85760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be6565b600260015532331461141c5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c657220697320616e6f7468657220636f6e74726163740000000000006044820152606401610be6565b60125460ff161580156114375750601254610100900460ff16155b6114795760405162461bcd60e51b8152602060048201526013602482015272135a59dc985d1a5bdb881a5cc81c185d5cd959606a1b6044820152606401610be6565b6000815166b1a2bc2ec5000061148f9190613453565b9050803410156114d25760405162461bcd60e51b815260206004820152600e60248201526d09cdee840cadcdeeaced0408aa8960931b6044820152606401610be6565b60005b825181101561169e5760008382815181106114f2576114f2613472565b60209081029190910101516016546040516331a9108f60e11b81526004810183905291925033916001600160a01b0390911690636352211e90602401602060405180830381865afa15801561154b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061156f9190613488565b6001600160a01b0316146115cf5760405162461bcd60e51b815260206004820152602160248201527f596f7520646f6e2774206f776e2074686520676976656e206d696e7473746f6e6044820152606560f81b6064820152608401610be6565b601654604051630852cd8d60e31b8152600481018390526001600160a01b03909116906342966c6890602401600060405180830381600087803b15801561161557600080fd5b505af1158015611629573d6000803e3d6000fd5b50506015546040516340c10f1960e01b8152336004820152602481018590526001600160a01b0390911692506340c10f199150604401600060405180830381600087803b15801561167957600080fd5b505af115801561168d573d6000803e3d6000fd5b5050600190930192506114d5915050565b60006116a960025490565b90506116b63385516127f2565b8091505b835181018210156117be576116ce82610fec565b601460019054906101000a90046001600160a01b03166001600160a01b031663f459da356040518163ffffffff1660e01b8152600401602060405180830381865afa158015611721573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061174591906134a5565b156117b357601454604051635cf20c7b60e01b8152336004820152602481018490526101009091046001600160a01b031690635cf20c7b90604401600060405180830381600087803b15801561179a57600080fd5b505af11580156117ae573d6000803e3d6000fd5b505050505b6001909101906116ba565b823411156117fe57336108fc6117d485346134c2565b6040518115909202916000818181858888f193505050501580156117fc573d6000803e3d6000fd5b505b5050600180555050565b6060816000816001600160401b0381111561182557611825612ded565b60405190808252806020026020018201604052801561187757816020015b6040805160808101825260008082526020808301829052928201819052606082015282526000199092019101816118435790505b50905060005b8281146118ca576118a586868381811061189957611899613472565b9050602002013561208b565b8282815181106118b7576118b7613472565b602090810291909101015260010161187d565b50949350505050565b6000610aac826125f7565b6000546001600160a01b031633148061190157506018546001600160a01b031633145b61191d5760405162461bcd60e51b8152600401610be6906132c7565b601580546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633148061196257506018546001600160a01b031633145b61197e5760405162461bcd60e51b8152600401610be6906132c7565b600a80546001600160401b03909216600160a01b0267ffffffffffffffff60a01b19909216919091179055565b6000546001600160a01b03163314806119ce57506018546001600160a01b031633145b6119ea5760405162461bcd60e51b8152600401610be6906132c7565b6012805460ff1916911515919091179055565b611a0561280c565b601880546001600160a01b0319166001600160a01b0392909216919091179055565b60006001600160a01b038216611a50576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600760205260409020546001600160401b031690565b611a7d61280c565b611a876000612866565b565b60606000806000611a9985611a27565b90506000816001600160401b03811115611ab557611ab5612ded565b604051908082528060200260200182016040528015611ade578160200160208202803683370190505b509050611b0b60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b838614611b8557611b1e816128b6565b91508160400151611b7d5781516001600160a01b031615611b3e57815194505b876001600160a01b0316856001600160a01b031603611b7d5780838780600101985081518110611b7057611b70613472565b6020026020010181815250505b600101611b0e565b50909695505050505050565b606060058054610ac19061328d565b6060818310611bc257604051631960ccad60e11b815260040160405180910390fd5b600080611bce60025490565b905080841115611bdc578093505b6000611be787611a27565b905084861015611c065785850381811015611c00578091505b50611c0a565b5060005b6000816001600160401b03811115611c2457611c24612ded565b604051908082528060200260200182016040528015611c4d578160200160208202803683370190505b50905081600003611c63579350611d1292505050565b6000611c6e8861208b565b905060008160400151611c7f575080515b885b888114158015611c915750848714155b15611d0657611c9f816128b6565b92508260400151611cfe5782516001600160a01b031615611cbf57825191505b8a6001600160a01b0316826001600160a01b031603611cfe5780848880600101995081518110611cf157611cf1613472565b6020026020010181815250505b600101611c81565b50505092835250909150505b9392505050565b6001600160a01b03821660009081526019602052604090205460ff1615611d7b5760405162461bcd60e51b815260206004820152601660248201527513585c9ad95d1c1b1858d9481a5cc8189b1bd8dad95960521b6044820152606401610be6565b610bf982826128f2565b6000611d9060025490565b905090565b600260015403611de75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610be6565b6002600155323314611e3b5760405162461bcd60e51b815260206004820152601a60248201527f43616c6c657220697320616e6f7468657220636f6e74726163740000000000006044820152606401610be6565b60078114611e7c5760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420746f6b656e7360901b6044820152606401610be6565b60408051600980825261014082019092526000916020820161012080368337019050509050600160005b83811015612006576000858583818110611ec257611ec2613472565b905060200201359050336001600160a01b0316611ede826118d3565b6001600160a01b031614611f345760405162461bcd60e51b815260206004820152601d60248201527f596f7520646f6e2774206f776e2074686520676976656e20746f6b656e0000006044820152606401610be6565b6000818152601060205260409020548015801590611f525750600881105b8015611f755750848181518110611f6b57611f6b613472565b6020026020010151155b611fb25760405162461bcd60e51b815260206004820152600e60248201526d496e76616c696420746f6b656e7360901b6044820152606401610be6565b6001858281518110611fc657611fc6613472565b91151560209283029190910182015260008381526011909152604090205460021115611ff157600093505b611ffc8260006126ab565b5050600101611ea6565b50600061201260025490565b905061201f3360016127f2565b61203c81600884612031576001612034565b60025b60ff16612405565b505060018055505050565b612052848484610d3a565b6001600160a01b0383163b1561121f5761206e84848484612987565b61121f576040516368d2bf6b60e11b815260040160405180910390fd5b60408051608080820183526000808352602080840182905283850182905260608085018390528551938401865282845290830182905293820181905292810183905290915060025483106120df5792915050565b6120e8836128b6565b90508060400151156120fa5792915050565b611d1283612a73565b606061210e8261233d565b61212b57604051630a14c4b560e41b815260040160405180910390fd5b6000612135612aa8565b905080516000036121555760405180602001604052806000815250611d12565b8061215f84612ab7565b6040516020016121709291906134d5565b6040516020818303038152906040529392505050565b6000546001600160a01b03163314806121a957506018546001600160a01b031633145b6121c55760405162461bcd60e51b8152600401610be6906132c7565b601680546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633148061220a57506018546001600160a01b031633145b6122265760405162461bcd60e51b8152600401610be6906132c7565b601280549115156101000261ff0019909216919091179055565b6000546001600160a01b031633148061226357506018546001600160a01b031633145b61227f5760405162461bcd60e51b8152600401610be6906132c7565b601480546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b606060405180606001604052806039815260200161357560399139905090565b6122cf61280c565b6001600160a01b0381166123345760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610be6565b6112df81612866565b600060025482108015610aac575050600090815260066020526040902054600160e01b161590565b6000612370826118d3565b9050336001600160a01b038216146123a95761238c81336109e5565b6123a9576040516367d9dca160e11b815260040160405180910390fd5b60008281526008602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b600083815260106020526040902054156124615760405162461bcd60e51b815260206004820152601760248201527f546f6b656e20616c726561647920686173206120444e410000000000000000006044820152606401610be6565b600083815260106020908152604080832085905560119091529020819055811580159061248e5750600882105b15610c47576000828152600c60205260409020805460001901905560028190036124c9576000828152600d6020526040902080546000190190555b600e8054600019019055505050565b6000828152600f6020526040902054806125295760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a59081c995c5d595cdd081a5960721b6044820152606401610be6565b60008260008151811061253e5761253e613472565b602002602001015190506000600e54828161255b5761255b613504565b069050600060015b60088110156125ee576000818152600c60205260409020548061258657506125e6565b91820191828410156125e4576000828152600d602052604081205490826127108804816125b5576125b5613504565b06905060008282106125c85760016125cb565b60025b60ff1690506125db898683612405565b505050506125ee565b505b600101612563565b50505050505050565b6000816002548110156126455760008181526006602052604081205490600160e01b82169003612643575b80600003611d12575060001901600081815260066020526040902054612622565b505b604051636f96cda160e11b815260040160405180910390fd5b601254610100900460ff161561121f5760405162461bcd60e51b815260206004820152601260248201527110dbdb9d1c9858dd081a5cc81c185d5cd95960721b6044820152606401610be6565b60006126b6836125f7565b9050806000806126d486600090815260086020526040902080549091565b915091508415612714576126e9818433610d8f565b612714576126f783336109e5565b61271457604051632ce44b5f60e11b815260040160405180910390fd5b61272283600088600161265e565b801561272d57600082555b6001600160a01b038316600081815260076020526040902080546fffffffffffffffffffffffffffffffff0190554260a01b17600360e01b17600087815260066020526040812091909155600160e11b851690036127bb576001860160008181526006602052604081205490036127b95760025481146127b95760008181526006602052604090208590555b505b60405186906000906001600160a01b038616906000805160206135ae833981519152908390a4505060038054600101905550505050565b610bf9828260405180602001604052806000815250612aef565b6000546001600160a01b03163314611a875760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610be6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b604080516080810182526000808252602082018190529181018290526060810191909152600082815260066020526040902054610aac90612b5c565b336001600160a01b0383160361291b5760405163b06307db60e01b815260040160405180910390fd5b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a02906129bc90339089908890889060040161351a565b6020604051808303816000875af19250505080156129f7575060408051601f3d908101601f191682019092526129f491810190613557565b60015b612a55573d808015612a25576040519150601f19603f3d011682016040523d82523d6000602084013e612a2a565b606091505b508051600003612a4d576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490505b949350505050565b604080516080810182526000808252602082018190529181018290526060810191909152610aac612aa3836125f7565b612b5c565b606060138054610ac19061328d565b604080516080019081905280825b600183039250600a81066030018353600a900480612ac55750819003601f19909101908152919050565b612af98383612ba3565b6001600160a01b0383163b15610c47576002548281035b612b236000868380600101945086612987565b612b40576040516368d2bf6b60e11b815260040160405180910390fd5b818110612b10578160025414612b5557600080fd5b5050505050565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b6002546000829003612bc85760405163b562e8dd60e01b815260040160405180910390fd5b612bd5600084838561265e565b6001600160a01b03831660008181526007602090815260408083208054680100000000000000018802019055848352600690915281206001851460e11b4260a01b178317905582840190839083906000805160206135ae8339815191528180a4600183015b818114612c6057808360006000805160206135ae833981519152600080a4600101612c3a565b5081600003612c8157604051622e076360e81b815260040160405180910390fd5b60025550505050565b6001600160e01b0319811681146112df57600080fd5b600060208284031215612cb257600080fd5b8135611d1281612c8a565b60005b83811015612cd8578181015183820152602001612cc0565b50506000910152565b60008151808452612cf9816020860160208601612cbd565b601f01601f19169290920160200192915050565b602081526000611d126020830184612ce1565b600060208284031215612d3257600080fd5b5035919050565b6001600160a01b03811681146112df57600080fd5b60008060408385031215612d6157600080fd5b8235612d6c81612d39565b946020939093013593505050565b600080600060608486031215612d8f57600080fd5b505081359360208301359350604090920135919050565b80151581146112df57600080fd5b60008060408385031215612dc757600080fd5b8235612dd281612d39565b91506020830135612de281612da6565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e2b57612e2b612ded565b604052919050565b600082601f830112612e4457600080fd5b813560206001600160401b03821115612e5f57612e5f612ded565b8160051b612e6e828201612e03565b9283528481018201928281019087851115612e8857600080fd5b83870192505b84831015612ea757823582529183019190830190612e8e565b979650505050505050565b60008060408385031215612ec557600080fd5b8235915060208301356001600160401b03811115612ee257600080fd5b612eee85828601612e33565b9150509250929050565b600080600060608486031215612f0d57600080fd5b8335612f1881612d39565b92506020840135612f2881612d39565b929592945050506040919091013590565b600060208284031215612f4b57600080fd5b8135611d1281612d39565b60008060208385031215612f6957600080fd5b82356001600160401b0380821115612f8057600080fd5b818501915085601f830112612f9457600080fd5b813581811115612fa357600080fd5b866020828501011115612fb557600080fd5b60209290920196919550909350505050565b600060208284031215612fd957600080fd5b81356001600160401b03811115612fef57600080fd5b612a6b84828501612e33565b6000806020838503121561300e57600080fd5b82356001600160401b038082111561302557600080fd5b818501915085601f83011261303957600080fd5b81358181111561304857600080fd5b8660208260051b8501011115612fb557600080fd5b80516001600160a01b031682526020808201516001600160401b03169083015260408082015115159083015260609081015162ffffff16910152565b6020808252825182820181905260009190848201906040850190845b81811015611b85576130c883855161305d565b92840192608092909201916001016130b5565b6000602082840312156130ed57600080fd5b81356001600160401b0381168114611d1257600080fd5b60006020828403121561311657600080fd5b8135611d1281612da6565b6020808252825182820181905260009190848201906040850190845b81811015611b855783518352928401929184019160010161313d565b60008060006060848603121561316e57600080fd5b833561317981612d39565b95602085013595506040909401359392505050565b600080600080608085870312156131a457600080fd5b84356131af81612d39565b93506020858101356131c081612d39565b93506040860135925060608601356001600160401b03808211156131e357600080fd5b818801915088601f8301126131f757600080fd5b81358181111561320957613209612ded565b61321b601f8201601f19168501612e03565b9150808252898482850101111561323157600080fd5b808484018584013760008482840101525080935050505092959194509250565b60808101610aac828461305d565b6000806040838503121561327257600080fd5b823561327d81612d39565b91506020830135612de281612d39565b600181811c908216806132a157607f821691505b6020821081036132c157634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601290820152712737ba1037bbb732b91037b91030b236b4b760711b604082015260600190565b60006020828403121561330557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820180821115610aac57610aac61330c565b6000600182016133475761334761330c565b5060010190565b601f821115610c4757600081815260208120601f850160051c810160208610156133755750805b601f850160051c820191505b81811015610ed057828155600101613381565b6001600160401b038311156133ab576133ab612ded565b6133bf836133b9835461328d565b8361334e565b6000601f8411600181146133f357600085156133db5750838201355b600019600387901b1c1916600186901b178355612b55565b600083815260209020601f19861690835b828110156134245786850135825560209485019460019092019101613404565b50868210156134415760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600081600019048311821515161561346d5761346d61330c565b500290565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561349a57600080fd5b8151611d1281612d39565b6000602082840312156134b757600080fd5b8151611d1281612da6565b81810381811115610aac57610aac61330c565b600083516134e7818460208801612cbd565b8351908301906134fb818360208801612cbd565b01949350505050565b634e487b7160e01b600052601260045260246000fd5b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061354d90830184612ce1565b9695505050505050565b60006020828403121561356957600080fd5b8151611d1281612c8a56fe68747470733a2f2f636c6f6e65666f7263652e78797a2f6170692f6563686f73746f6e652f6d61726b6574706c6163652d6d65746164617461ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220e9fc976810ffbdbbb21d08f514ee6e123656ccea831551c885bf8894d6ac152664736f6c63430008100033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000003be3a8613dc18554a73773a5bfb8e9819d360dc00000000000000000000000000c684b8c37bbd3e58dfde822025591d15c030cd9000000000000000000000000c400c734b19c42a9bd7f96716b43e818127629880000000000000000000000003bb87ba2e741ebd85180d7550b286763692cd7e30000000000000000000000000000000000000000000000000000000000000174000000000000000000000000000000000000000000000000000000000000002e68747470733a2f2f636c6f6e65666f7263652e78797a2f6170692f6563686f73746f6e652f6d657461646174612f000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : baseTokenURI (string): https://cloneforce.xyz/api/echostone/metadata/
Arg [1] : admin (address): 0x3be3A8613dC18554a73773a5Bfb8E9819d360Dc0
Arg [2] : mintstoneContract (address): 0x0C684b8c37bbd3e58dFde822025591d15c030CD9
Arg [3] : usedMintstoneContract (address): 0xC400C734b19c42a9bD7F96716B43E81812762988
Arg [4] : airdropManagerContract (address): 0x3bb87Ba2E741eBD85180d7550B286763692Cd7E3
Arg [5] : chainlinkSubscriptionId (uint64): 372

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [1] : 0000000000000000000000003be3a8613dc18554a73773a5bfb8e9819d360dc0
Arg [2] : 0000000000000000000000000c684b8c37bbd3e58dfde822025591d15c030cd9
Arg [3] : 000000000000000000000000c400c734b19c42a9bd7f96716b43e81812762988
Arg [4] : 0000000000000000000000003bb87ba2e741ebd85180d7550b286763692cd7e3
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000174
Arg [6] : 000000000000000000000000000000000000000000000000000000000000002e
Arg [7] : 68747470733a2f2f636c6f6e65666f7263652e78797a2f6170692f6563686f73
Arg [8] : 746f6e652f6d657461646174612f000000000000000000000000000000000000


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.