Contract 0x9B66D03fC1EEE61A512341058e95F1a68Dc3a913 3

Token Contract 
 
 
Txn Hash
Method
Block
From
To
Value
0xe43163631a50587bcb8092f5da789f421412dfd05a343a0caa8e978b85c8b667Set Approval For...165476652023-02-03 10:29:5912 hrs 26 mins ago0xa1163cbf7c3cca1a1014a2310be3d6a09b95ef5a IN  Phunk APE Origins: PAO Token0 Ether0.00082599 17.91365512
0xa0eb9cea4d55fd106d005eb1ce035215ba56fa4ef0f5a7650ef6bd72c69ee215Set Approval For...165418072023-02-02 14:47:471 day 8 hrs ago0x9f097bdbb32093da623bbceb0ab4d20bfdb6954b IN  Phunk APE Origins: PAO Token0 Ether0.00140125 30.38940435
0x1342ecc7dc846043944e3b2854115c4d8a0269d5c978866466bf6b5aff56273aSet Approval For...165413672023-02-02 13:19:111 day 9 hrs agoENS Name cointweet.eth IN  Phunk APE Origins: PAO Token0 Ether0.00143737 31.17267167
0x38e1486221ee715afb75b0e82d40ad9848bd3c79c842fd4d13338c7a0dfdd1f6Set Approval For...165332842023-02-01 10:10:472 days 12 hrs ago0xc7e547634d28a33e74e1961d8bd39cc64ebbdce4 IN  Phunk APE Origins: PAO Token0 Ether0.00076744 16.64374628
0x03c57de098a3bd1b3e439bb9abb22d301871c56f58a23f53ed37bf00d026c091Set Approval For...165260892023-01-31 10:04:113 days 12 hrs ago0x653efa8a01b7e8ad4c8ba04183714246974059d5 IN  Phunk APE Origins: PAO Token0 Ether0.0004788 19.78698998
0x346566e0e02a8e1bd234557d50eca048c4465d27da75b391c9bef7ed1e56a431Set Approval For...165248732023-01-31 5:59:353 days 16 hrs agoENS Name devisded.eth IN  Phunk APE Origins: PAO Token0 Ether0.00035818 14.80207838
0x42ecc176d02560c0707c4f8e08e316d9dd150c18296431f6517d020c8c311b6cSet Approval For...165247452023-01-31 5:33:593 days 17 hrs ago0xda556f7c448806d6d445547f5991c4c161d9a3c6 IN  Phunk APE Origins: PAO Token0 Ether0.00066258 14.36969995
0x4468565f18b14ea3ffdce54cee62c67ee6ead71da8cb3dcea88542772d460009Set Approval For...165232622023-01-31 0:35:473 days 22 hrs agoENS Name boredyachtapeclub.eth IN  Phunk APE Origins: PAO Token0 Ether0.0007751 16.8100043
0x87ac10d205691796713ae847876730e0967a7169e853eb09c28eb382a3dfa3b6Set Approval For...165219632023-01-30 20:15:114 days 2 hrs ago0xf19aed29a6cd4f5a1b3c8ed79d987e3fc1dca853 IN  Phunk APE Origins: PAO Token0 Ether0.00065131 26.82305537
0xdf32e7dfd9b3e89895edfb5d1ac23e90a180d51dcecf3b2586a98133bd8d9749Set Approval For...165193572023-01-30 11:31:234 days 11 hrs agoENS Name *.eth IN  Phunk APE Origins: PAO Token0 Ether0.00074254 16.10378467
0xf2be096d042c297495db4abf2dd29d6473c6313ec1c2e9d4862f2cfe88b0f397Set Approval For...165162972023-01-30 1:16:354 days 21 hrs ago0xd8b21d76303f111a5470aacd07b4e46a304bcb0e IN  Phunk APE Origins: PAO Token0 Ether0.000757 16.41728637
0x2c4f8458fa7d77ef2554c9bd8d9db49ab5e357d7d2634defce0db31bf2674e74Set Approval For...165129552023-01-29 14:04:355 days 8 hrs ago0x5a9d901146dcf8d1ccf5bb2abd24437de533c8d5 IN  Phunk APE Origins: PAO Token0 Ether0.00078955 17.12339893
0xf2f02256189be8cf9c26794e3ee527a819203c0dd58b91097e997c89202582ceSet Approval For...165092372023-01-29 1:36:355 days 21 hrs ago0x9ba855365d2cd25009a570f246acf645da469d1c IN  Phunk APE Origins: PAO Token0 Ether0.00067196 14.54655227
0x75d4267c4454213bd5783606111fe6ab25b7434d9cde20a174d1573faae19109Safe Transfer Fr...165073752023-01-28 19:22:116 days 3 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00319346 16.33976848
0xf9ddbe5623c58747474b8792493aeac13ca265d567fb1cb47b1814904ecf9588Safe Transfer Fr...165073602023-01-28 19:19:116 days 3 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00293752 15.03023646
0xa8fca4f4ab18eea87dacc3da41ec22db1483d9cc15abcfccedce51367988f6f4Safe Transfer Fr...165073512023-01-28 19:17:116 days 3 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00296643 15.17818355
0xcd3596e8a2f69f9a9082e857dfb4b46d85fb55e7f6fbb46ac1a54d2b457764e6Safe Transfer Fr...165073392023-01-28 19:14:476 days 3 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00314307 16.0819578
0xd43e9499cf3f15f9eb29bdd89af985a4749bae8057331ac99ef69645fc6d0989Safe Transfer Fr...165073352023-01-28 19:13:596 days 3 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00305585 15.63665246
0x01ba2a28daa764606df9da1cfaab7f1d6fbbff9e11d2599342160fd173fcb10eSafe Transfer Fr...165073202023-01-28 19:10:596 days 3 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00304385 15.57431126
0x19a9887e3d9062a48c3c1b49e920b511cc6da735bbf1fbcbd6cc015b7fa3be2cSet Approval For...165057422023-01-28 13:54:236 days 9 hrs ago0x312c88f77ab5958c9e67c6cd6518e4e7aff22f8e IN  Phunk APE Origins: PAO Token0 Ether0.00076054 16.4856116
0xc4aa81df56995bfff7e5869953379070ab4a5ed3d15cc26119b492c7036f3c19Set Approval For...165053292023-01-28 12:31:116 days 10 hrs agoENS Name mattdncgrs.eth IN  Phunk APE Origins: PAO Token0 Ether0.00072889 15.7994387
0x1f1c33ce297eb83b7cde2dd9709e63ab47616b7cf474fec13b3c38acb7304920Set Approval For...165051812023-01-28 12:00:596 days 10 hrs ago0x7b55e0397ba9d5e32a1e57f4dd38f5999707a8cf IN  Phunk APE Origins: PAO Token0 Ether0.00074738 16.2087808
0x0ae45616947dbcbf8338459328b60e1a41bbfc15d56e809bfa0b89ae3e68e43fSafe Transfer Fr...165029252023-01-28 4:28:356 days 18 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00296246 15.15782841
0x640d0da340fe337c9c5085fc005dc19cdb9d8e4f0fe01c671c4ceca545a1a1ffSafe Transfer Fr...165029172023-01-28 4:26:596 days 18 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00310734 15.89913378
0xb84dd7180635fcc41d03d378a3f3b2913ca2d2e53648c38e3eb8c4f615f65689Safe Transfer Fr...165028412023-01-28 4:11:476 days 18 hrs agoENS Name sbvault.eth IN  Phunk APE Origins: PAO Token0 Ether0.00297479 15.2209496
[ Download CSV Export 

OVERVIEW

5000 On-Chain Phunks, reimagined, APES only. CC0 - 0% Royalties, in true Phunk phashion, this project is for the community. Phunk Ape Origins pays homage to the CryptoPhunk culture as well as to the Great Apes.

Latest 25 internal transaction
Parent Txn Hash Block From To Value
0xbab5c431a216716b0f09b4a97d936316140bc81f8cd5fe14af38710d1d4cea2a156441152022-09-30 5:38:23126 days 17 hrs ago Phunk APE Origins: PAO Token0xea208da933c43857683c04bc76e3fd331d7bfdf70.1736 Ether
0xbab5c431a216716b0f09b4a97d936316140bc81f8cd5fe14af38710d1d4cea2a156441152022-09-30 5:38:23126 days 17 hrs ago Phunk APE Origins: PAO TokenPhunk APE Origins: Deployer6.7704 Ether
0x0c259b3f0cc68e7c1b4a2ac874a20cee4515c93426c6cbef462b459cd74f277d155941462022-09-23 6:06:23133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x16dab6c9a08b44e7bc240d887bb0425f8299f06588d2de4022ce5f84adbcfb5e155941442022-09-23 6:05:59133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x16dab6c9a08b44e7bc240d887bb0425f8299f06588d2de4022ce5f84adbcfb5e155941442022-09-23 6:05:59133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x16dab6c9a08b44e7bc240d887bb0425f8299f06588d2de4022ce5f84adbcfb5e155941442022-09-23 6:05:59133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x16dab6c9a08b44e7bc240d887bb0425f8299f06588d2de4022ce5f84adbcfb5e155941442022-09-23 6:05:59133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x16dab6c9a08b44e7bc240d887bb0425f8299f06588d2de4022ce5f84adbcfb5e155941442022-09-23 6:05:59133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0xbac55dee7477f2f02d9789a1431e525a66a9053463dc93c4d04c00a2a7319af6155941432022-09-23 6:05:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x80d472c5c85323d5d439ec6009470f3163f4e06c475d9272653e7dfbb0222b77155941182022-09-23 6:00:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x80d472c5c85323d5d439ec6009470f3163f4e06c475d9272653e7dfbb0222b77155941182022-09-23 6:00:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x80d472c5c85323d5d439ec6009470f3163f4e06c475d9272653e7dfbb0222b77155941182022-09-23 6:00:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
0x80d472c5c85323d5d439ec6009470f3163f4e06c475d9272653e7dfbb0222b77155941182022-09-23 6:00:47133 days 16 hrs ago Phunk APE Origins: PAO Token  Contract Creation0 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Indelible

Compiler Version
v0.8.14+commit.80d49f37

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, MIT license
File 1 of 13 : Indelible.sol
// SPDX-License-Identifier: MIT
    pragma solidity ^0.8.4;

    import "erc721a/contracts/ERC721A.sol";
    import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
    import "@openzeppelin/contracts/access/Ownable.sol";
    import "@openzeppelin/contracts/utils/Base64.sol";
    import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
    import "@openzeppelin/contracts/utils/Address.sol";
    import "./SSTORE2.sol";
    import "./DynamicBuffer.sol";
    import "./HelperLib.sol";

    contract Indelible is ERC721A, ReentrancyGuard, Ownable {
        using HelperLib for uint;
        using DynamicBuffer for bytes;

        struct LinkedTraitDTO {
            uint[] traitA;
            uint[] traitB;
        }

        struct TraitDTO {
            string name;
            string mimetype;
            bytes data;
            bool useExistingData;
            uint existingDataIndex;
        }
        
        struct Trait {
            string name;
            string mimetype;
        }

        struct ContractData {
            string name;
            string description;
            string image;
            string banner;
            string website;
            uint royalties;
            string royaltiesRecipient;
        }

        mapping(uint => address[]) internal _traitDataPointers;
        mapping(uint => mapping(uint => Trait)) internal _traitDetails;
        mapping(uint => bool) internal _renderTokenOffChain;
        mapping(uint => mapping(uint => uint[])) internal _linkedTraits;

        uint private constant DEVELOPER_FEE = 250; // of 10,000 = 2.5%
        uint private constant NUM_LAYERS = 8;
        uint private constant MAX_BATCH_MINT = 20;
        uint[][NUM_LAYERS] private TIERS;
        string[] private LAYER_NAMES = [unicode"Mouth", unicode"Neck", unicode"Earring", unicode"Eyes", unicode"Head", unicode"Ape", unicode"Background", unicode"Future Origin"];
        bool private shouldWrapSVG = true;
        string private backgroundColor = "transparent";

        bool public isContractSealed;
        uint public constant maxSupply = 5000;
        uint public maxPerAddress = 30;
        uint public publicMintPrice = 0.008 ether;
        string public baseURI = "";
        bool public isPublicMintActive;
        
        bytes32 private merkleRoot;
        uint public allowListPrice = 0.0 ether;
        uint public maxPerAllowList = 1;
        bool public isAllowListActive;
        
        ContractData public contractData = ContractData(unicode"Phunk APE Origins", unicode"5000 On-Chain Phunks, reimagined, APES only.   CC0   -   0% Royalties, in true Phunk phashion, this project is for the community. Phunk Ape Origins pays homage to the CryptoPhunk culture as well as to the Great Apes.", "https://indeliblelabs-prod.s3.us-east-2.amazonaws.com/profile/fcfba559-6a07-4784-af02-dda7bcabbad1", "https://indeliblelabs-prod.s3.us-east-2.amazonaws.com/banner/fcfba559-6a07-4784-af02-dda7bcabbad1", "", 0, "0xD503B89b39E5d820399e94Ba6250b90fA22B9812");

        constructor() ERC721A(unicode"Phunk APE Origins", unicode"PAO") {
            TIERS[0] = [210,250,300,300,380,390,400,435,435,1900];
TIERS[1] = [260,420,420,570,610,640,640,1440];
TIERS[2] = [300,400,600,650,700,750,750,850];
TIERS[3] = [90,90,90,90,90,100,110,110,180,200,240,240,240,240,240,250,390,390,660,960];
TIERS[4] = [20,30,40,50,60,60,61,61,80,80,80,80,80,80,80,80,90,90,90,90,90,90,90,90,160,160,160,160,160,160,160,160,160,170,170,170,170,286,286,566];
TIERS[5] = [35,65,95,125,180,410,530,550,590,590,610,610,610];
TIERS[6] = [800,950,950,1100,1200];
TIERS[7] = [275,675,675,675,675,675,675,675];
        }

        modifier whenMintActive() {
            require(isMintActive(), "Minting is not active");
            _;
        }

        modifier whenUnsealed() {
            require(!isContractSealed, "Contract is sealed");
            _;
        }

        receive() external payable {
            require(isPublicMintActive, "Public minting is not active");
            handleMint(msg.value / publicMintPrice);
        }

        function rarityGen(uint _randinput, uint _rarityTier)
            internal
            view
            returns (uint)
        {
            uint currentLowerBound = 0;
            for (uint i = 0; i < TIERS[_rarityTier].length; i++) {
                uint thisPercentage = TIERS[_rarityTier][i];
                if (
                    _randinput >= currentLowerBound &&
                    _randinput < currentLowerBound + thisPercentage
                ) return i;
                currentLowerBound = currentLowerBound + thisPercentage;
            }

            revert();
        }
        
        function entropyForExtraData() internal view returns (uint24) {
            uint randomNumber = uint(
                keccak256(
                    abi.encodePacked(
                        tx.gasprice,
                        block.number,
                        block.timestamp,
                        block.difficulty,
                        blockhash(block.number - 1),
                        msg.sender
                    )
                )
            );
            return uint24(randomNumber);
        }
        
        function stringCompare(string memory a, string memory b) internal pure returns (bool) {
            return keccak256(abi.encodePacked(a)) == keccak256(abi.encodePacked(b));
        }

        function tokensAreDuplicates(uint tokenIdA, uint tokenIdB) public view returns (bool) {
            return stringCompare(
                tokenIdToHash(tokenIdA),
                tokenIdToHash(tokenIdB)
            );
        }
        
        function reRollDuplicate(
            uint tokenIdA,
            uint tokenIdB
        ) public whenUnsealed {
            require(tokensAreDuplicates(tokenIdA, tokenIdB), "All tokens must be duplicates");

            uint largerTokenId = tokenIdA > tokenIdB ? tokenIdA : tokenIdB;

            if (msg.sender != owner()) {
                require(msg.sender == ownerOf(largerTokenId), "Only the token owner or contract owner can re-roll");
            }
            
            _initializeOwnershipAt(largerTokenId);
            if (_exists(largerTokenId + 1)) {
                _initializeOwnershipAt(largerTokenId + 1);
            }

            _setExtraDataAt(largerTokenId, entropyForExtraData());
        }
        
        function _extraData(
            address from,
            address to,
            uint24 previousExtraData
        ) internal view virtual override returns (uint24) {
            return from == address(0) ? entropyForExtraData() : previousExtraData;
        }

        function getTokenSeed(uint _tokenId) internal view returns (uint24) {
            return _ownershipOf(_tokenId).extraData;
        }

        function tokenIdToHash(
            uint _tokenId
        ) public view returns (string memory) {
            require(_exists(_tokenId), "Invalid token");
            // This will generate a NUM_LAYERS * 3 character string.
            bytes memory hashBytes = DynamicBuffer.allocate(NUM_LAYERS * 4);

            uint[] memory hash = new uint[](NUM_LAYERS);
            bool[] memory modifiedLayers = new bool[](NUM_LAYERS);

            for (uint i = 0; i < NUM_LAYERS; i++) {
                uint traitIndex = hash[i];
                if (modifiedLayers[i] == false) {
                    uint _randinput = uint(
                        uint(
                            keccak256(
                                abi.encodePacked(
                                    getTokenSeed(_tokenId),
                                    _tokenId,
                                    _tokenId + i
                                )
                            )
                        ) % maxSupply
                    );
    
                    traitIndex = rarityGen(_randinput, i);
                    hash[i] = traitIndex;
                }

                if (_linkedTraits[i][traitIndex].length > 0) {
                    hash[_linkedTraits[i][traitIndex][0]] = _linkedTraits[i][traitIndex][1];
                    modifiedLayers[_linkedTraits[i][traitIndex][0]] = true;
                }
            }

            for (uint i = 0; i < hash.length; i++) {
                if (hash[i] < 10) {
                    hashBytes.appendSafe("00");
                } else if (hash[i] < 100) {
                    hashBytes.appendSafe("0");
                }
                if (hash[i] > 999) {
                    hashBytes.appendSafe("999");
                } else {
                    hashBytes.appendSafe(bytes(_toString(hash[i])));
                }
            }

            return string(hashBytes);
        }

        function handleMint(uint256 _count) internal whenMintActive returns (uint256) {
            uint256 totalMinted = _totalMinted();
            require(_count > 0, "Invalid token count");
            require(totalMinted + _count <= maxSupply, "All tokens are gone");

            
            if (isPublicMintActive) {
                if (msg.sender != owner()) {
                    require(_numberMinted(msg.sender) + _count <= maxPerAddress, "Exceeded max mints allowed");
                }
                require(msg.sender == tx.origin, "EOAs only");
                require(_count * publicMintPrice == msg.value, "Incorrect amount of ether sent");
            }
            
            uint256 batchCount = _count / MAX_BATCH_MINT;
            uint256 remainder = _count % MAX_BATCH_MINT;

            for (uint256 i = 0; i < batchCount; i++) {
                _mint(msg.sender, MAX_BATCH_MINT);
            }

            if (remainder > 0) {
                _mint(msg.sender, remainder);
            }

            return totalMinted;
        }

        function mint(uint256 _count, bytes32[] calldata merkleProof)
            external
            payable
            nonReentrant
            whenMintActive
            returns (uint)
        {
            
                if (!isPublicMintActive) {
                    if (msg.sender != owner()) {
                        require(onAllowList(msg.sender, merkleProof), "Not on allow list");
                        require(_numberMinted(msg.sender) + _count <= maxPerAllowList, "Exceeded max mints allowed");
                    }
                    require(_count * allowListPrice == msg.value, "Incorrect amount of ether sent");
                }
                
                uint256 totalMinted = handleMint(_count);
    
                return totalMinted;
        }

        function isMintActive() public view returns (bool) {
            return _totalMinted() < maxSupply && (isPublicMintActive || isAllowListActive);
        }

        function hashToSVG(string memory _hash)
            public
            view
            returns (string memory)
        {
            uint thisTraitIndex;
            
            bytes memory svgBytes = DynamicBuffer.allocate(1024 * 128);
            svgBytes.appendSafe('<svg width="1200" height="1200" viewBox="0 0 1200 1200" version="1.2" xmlns="http://www.w3.org/2000/svg" style="background-color:');
            svgBytes.appendSafe(
                abi.encodePacked(
                    backgroundColor,
                    ";background-image:url("
                )
            );

            for (uint i = 0; i < NUM_LAYERS - 1; i++) {
                thisTraitIndex = HelperLib.parseInt(
                    HelperLib._substring(_hash, (i * 3), (i * 3) + 3)
                );
                svgBytes.appendSafe(
                    abi.encodePacked(
                        "data:",
                        _traitDetails[i][thisTraitIndex].mimetype,
                        ";base64,",
                        Base64.encode(SSTORE2.read(_traitDataPointers[i][thisTraitIndex])),
                        "),url("
                    )
                );
            }

            thisTraitIndex = HelperLib.parseInt(
                HelperLib._substring(_hash, (NUM_LAYERS * 3) - 3, NUM_LAYERS * 3)
            );

            svgBytes.appendSafe(
                abi.encodePacked(
                    "data:",
                    _traitDetails[NUM_LAYERS - 1][thisTraitIndex].mimetype,
                    ";base64,",
                    Base64.encode(SSTORE2.read(_traitDataPointers[NUM_LAYERS - 1][thisTraitIndex])),
                    ');background-repeat:no-repeat;background-size:contain;background-position:center;image-rendering:-webkit-optimize-contrast;-ms-interpolation-mode:nearest-neighbor;image-rendering:-moz-crisp-edges;image-rendering:pixelated;"></svg>'
                )
            );

            return string(
                abi.encodePacked(
                    "data:image/svg+xml;base64,",
                    Base64.encode(svgBytes)
                )
            );
        }

        function hashToMetadata(string memory _hash)
            public
            view
            returns (string memory)
        {
            bytes memory metadataBytes = DynamicBuffer.allocate(1024 * 128);
            metadataBytes.appendSafe("[");

            for (uint i = 0; i < NUM_LAYERS; i++) {
                uint thisTraitIndex = HelperLib.parseInt(
                    HelperLib._substring(_hash, (i * 3), (i * 3) + 3)
                );
                metadataBytes.appendSafe(
                    abi.encodePacked(
                        '{"trait_type":"',
                        LAYER_NAMES[i],
                        '","value":"',
                        _traitDetails[i][thisTraitIndex].name,
                        '"}'
                    )
                );
                
                if (i == NUM_LAYERS - 1) {
                    metadataBytes.appendSafe("]");
                } else {
                    metadataBytes.appendSafe(",");
                }
            }

            return string(metadataBytes);
        }

        
        function onAllowList(address addr, bytes32[] calldata merkleProof) public view returns (bool) {
            return MerkleProof.verify(merkleProof, merkleRoot, keccak256(abi.encodePacked(addr)));
        }
        

        function tokenURI(uint _tokenId)
            public
            view
            override
            returns (string memory)
        {
            require(_exists(_tokenId), "Invalid token");
            require(_traitDataPointers[0].length > 0,  "Traits have not been added");

            string memory tokenHash = tokenIdToHash(_tokenId);

            bytes memory jsonBytes = DynamicBuffer.allocate(1024 * 128);
            jsonBytes.appendSafe(unicode"{\"name\":\"Phunk APE Origins #");

            jsonBytes.appendSafe(
                abi.encodePacked(
                    _toString(_tokenId),
                    "\",\"description\":\"",
                    contractData.description,
                    "\","
                )
            );

            if (bytes(baseURI).length > 0 && _renderTokenOffChain[_tokenId]) {
                jsonBytes.appendSafe(
                    abi.encodePacked(
                        '"image":"',
                        baseURI,
                        _toString(_tokenId),
                        "?dna=",
                        tokenHash,
                        '&network=mainnet",'
                    )
                );
            } else {
                string memory svgCode = "";
                if (shouldWrapSVG) {
                    string memory svgString = hashToSVG(tokenHash);
                    svgCode = string(
                        abi.encodePacked(
                            "data:image/svg+xml;base64,",
                            Base64.encode(
                                abi.encodePacked(
                                    '<svg width="100%" height="100%" viewBox="0 0 1200 1200" version="1.2" xmlns="http://www.w3.org/2000/svg"><image width="1200" height="1200" href="',
                                    svgString,
                                    '"></image></svg>'
                                )
                            )
                        )
                    );
                    jsonBytes.appendSafe(
                        abi.encodePacked(
                            '"svg_image_data":"',
                            svgString,
                            '",'
                        )
                    );
                } else {
                    svgCode = hashToSVG(tokenHash);
                }

                jsonBytes.appendSafe(
                    abi.encodePacked(
                        '"image_data":"',
                        svgCode,
                        '",'
                    )
                );
            }

            jsonBytes.appendSafe(
                abi.encodePacked(
                    '"attributes":',
                    hashToMetadata(tokenHash),
                    "}"
                )
            );

            return string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(jsonBytes)
                )
            );
        }

        function contractURI()
            public
            view
            returns (string memory)
        {
            return string(
                abi.encodePacked(
                    "data:application/json;base64,",
                    Base64.encode(
                        abi.encodePacked(
                            '{"name":"',
                            contractData.name,
                            '","description":"',
                            contractData.description,
                            '","image":"',
                            contractData.image,
                            '","banner":"',
                            contractData.banner,
                            '","external_link":"',
                            contractData.website,
                            '","seller_fee_basis_points":',
                            _toString(contractData.royalties),
                            ',"fee_recipient":"',
                            contractData.royaltiesRecipient,
                            '"}'
                        )
                    )
                )
            );
        }

        function tokenIdToSVG(uint _tokenId)
            public
            view
            returns (string memory)
        {
            return hashToSVG(tokenIdToHash(_tokenId));
        }

        function traitDetails(uint _layerIndex, uint _traitIndex)
            public
            view
            returns (Trait memory)
        {
            return _traitDetails[_layerIndex][_traitIndex];
        }

        function traitData(uint _layerIndex, uint _traitIndex)
            public
            view
            returns (string memory)
        {
            return string(SSTORE2.read(_traitDataPointers[_layerIndex][_traitIndex]));
        }

        function getLinkedTraits(uint _layerIndex, uint _traitIndex)
            public
            view
            returns (uint[] memory)
        {
            return _linkedTraits[_layerIndex][_traitIndex];
        }

        function addLayer(uint _layerIndex, TraitDTO[] memory traits)
            public
            onlyOwner
            whenUnsealed
        {
            require(TIERS[_layerIndex].length == traits.length, "Traits size does not match tiers for this index");
            address[] memory dataPointers = new address[](traits.length);
            for (uint i = 0; i < traits.length; i++) {
                if (traits[i].useExistingData) {
                    dataPointers[i] = dataPointers[traits[i].existingDataIndex];
                } else {
                    dataPointers[i] = SSTORE2.write(traits[i].data);
                }
                _traitDetails[_layerIndex][i] = Trait(traits[i].name, traits[i].mimetype);
            }
            _traitDataPointers[_layerIndex] = dataPointers;
            return;
        }

        function addTrait(uint _layerIndex, uint _traitIndex, TraitDTO memory trait)
            public
            onlyOwner
            whenUnsealed
        {
            _traitDetails[_layerIndex][_traitIndex] = Trait(trait.name, trait.mimetype);
            address[] memory dataPointers = _traitDataPointers[_layerIndex];
            if (trait.useExistingData) {
                dataPointers[_traitIndex] = dataPointers[trait.existingDataIndex];
            } else {
                dataPointers[_traitIndex] = SSTORE2.write(trait.data);
            }
            _traitDataPointers[_layerIndex] = dataPointers;
            return;
        }

        function setLinkedTraits(LinkedTraitDTO[] memory linkedTraits)
            public
            onlyOwner
            whenUnsealed
        {
            for (uint i = 0; i < linkedTraits.length; i++) {
                _linkedTraits[linkedTraits[i].traitA[0]][linkedTraits[i].traitA[1]] = [linkedTraits[i].traitB[0],linkedTraits[i].traitB[1]];
            }
        }

        function setContractData(ContractData memory _contractData) external onlyOwner whenUnsealed {
            contractData = _contractData;
        }

        function setMaxPerAddress(uint _maxPerAddress) external onlyOwner {
            maxPerAddress = _maxPerAddress;
        }

        function setBaseURI(string memory _baseURI) external onlyOwner {
            baseURI = _baseURI;
        }

        function setBackgroundColor(string memory _backgroundColor) external onlyOwner whenUnsealed {
            backgroundColor = _backgroundColor;
        }

        function setRenderOfTokenId(uint _tokenId, bool _renderOffChain) external {
            require(msg.sender == ownerOf(_tokenId), "Only the token owner can set the render method");
            _renderTokenOffChain[_tokenId] = _renderOffChain;
        }

        
        function setMerkleRoot(bytes32 newMerkleRoot) external onlyOwner {
            merkleRoot = newMerkleRoot;
        }

        function setMaxPerAllowList(uint _maxPerAllowList) external onlyOwner {
            maxPerAllowList = _maxPerAllowList;
        }

        function setAllowListPrice(uint _allowListPrice) external onlyOwner {
            allowListPrice = _allowListPrice;
        }

        function toggleAllowListMint() external onlyOwner {
            isAllowListActive = !isAllowListActive;
        }
        

        function toggleWrapSVG() external onlyOwner {
            shouldWrapSVG = !shouldWrapSVG;
        }

        function togglePublicMint() external onlyOwner {
            isPublicMintActive = !isPublicMintActive;
        }

        function sealContract() external whenUnsealed onlyOwner {
            isContractSealed = true;
        }

        function withdraw() external onlyOwner nonReentrant {
            uint balance = address(this).balance;
            uint amount = (balance * (10000 - DEVELOPER_FEE)) / 10000;
    
            address payable receiver = payable(owner());
            address payable dev = payable(0xEA208Da933C43857683C04BC76e3FD331D7bfdf7);
    
            Address.sendValue(receiver, amount);
            Address.sendValue(dev, balance - amount);
        }
    }

File 2 of 13 : DynamicBuffer.sol
// SPDX-License-Identifier: MIT
// Copyright (c) 2021 the ethier authors (github.com/divergencetech/ethier)

pragma solidity >=0.8.0;

/// @title DynamicBuffer
/// @author David Huber (@cxkoda) and Simon Fremaux (@dievardump). See also
///         https://raw.githubusercontent.com/dievardump/solidity-dynamic-buffer
/// @notice This library is used to allocate a big amount of container memory
//          which will be subsequently filled without needing to reallocate
///         memory.
/// @dev First, allocate memory.
///      Then use `buffer.appendUnchecked(theBytes)` or `appendSafe()` if
///      bounds checking is required.
library DynamicBuffer {
    /// @notice Allocates container space for the DynamicBuffer
    /// @param capacity The intended max amount of bytes in the buffer
    /// @return buffer The memory location of the buffer
    /// @dev Allocates `capacity + 0x60` bytes of space
    ///      The buffer array starts at the first container data position,
    ///      (i.e. `buffer = container + 0x20`)
    function allocate(uint256 capacity)
        internal
        pure
        returns (bytes memory buffer)
    {
        assembly {
            // Get next-free memory address
            let container := mload(0x40)

            // Allocate memory by setting a new next-free address
            {
                // Add 2 x 32 bytes in size for the two length fields
                // Add 32 bytes safety space for 32B chunked copy
                let size := add(capacity, 0x60)
                let newNextFree := add(container, size)
                mstore(0x40, newNextFree)
            }

            // Set the correct container length
            {
                let length := add(capacity, 0x40)
                mstore(container, length)
            }

            // The buffer starts at idx 1 in the container (0 is length)
            buffer := add(container, 0x20)

            // Init content with length 0
            mstore(buffer, 0)
        }

        return buffer;
    }

    /// @notice Appends data to buffer, and update buffer length
    /// @param buffer the buffer to append the data to
    /// @param data the data to append
    /// @dev Does not perform out-of-bound checks (container capacity)
    ///      for efficiency.
    function appendUnchecked(bytes memory buffer, bytes memory data)
        internal
        pure
    {
        assembly {
            let length := mload(data)
            for {
                data := add(data, 0x20)
                let dataEnd := add(data, length)
                let copyTo := add(buffer, add(mload(buffer), 0x20))
            } lt(data, dataEnd) {
                data := add(data, 0x20)
                copyTo := add(copyTo, 0x20)
            } {
                // Copy 32B chunks from data to buffer.
                // This may read over data array boundaries and copy invalid
                // bytes, which doesn't matter in the end since we will
                // later set the correct buffer length, and have allocated an
                // additional word to avoid buffer overflow.
                mstore(copyTo, mload(data))
            }

            // Update buffer length
            mstore(buffer, add(mload(buffer), length))
        }
    }

    /// @notice Appends data to buffer, and update buffer length
    /// @param buffer the buffer to append the data to
    /// @param data the data to append
    /// @dev Performs out-of-bound checks and calls `appendUnchecked`.
    function appendSafe(bytes memory buffer, bytes memory data) internal pure {
        uint256 capacity;
        uint256 length;
        assembly {
            capacity := sub(mload(sub(buffer, 0x20)), 0x40)
            length := mload(buffer)
        }

        require(
            length + data.length <= capacity,
            "DynamicBuffer: Appending out of bounds."
        );
        appendUnchecked(buffer, data);
    }
}

File 3 of 13 : HelperLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;

library HelperLib {
    function parseInt(string memory _a)
        internal
        pure
        returns (uint8 _parsedInt)
    {
        bytes memory bresult = bytes(_a);
        uint8 mint = 0;
        for (uint8 i = 0; i < bresult.length; i++) {
            if (
                (uint8(uint8(bresult[i])) >= 48) &&
                (uint8(uint8(bresult[i])) <= 57)
            ) {
                mint *= 10;
                mint += uint8(bresult[i]) - 48;
            }
        }
        return mint;
    }

    function _substring(
        string memory str,
        uint256 startIndex,
        uint256 endIndex
    ) internal pure returns (string memory) {
        bytes memory strBytes = bytes(str);
        bytes memory result = new bytes(endIndex - startIndex);
        for (uint256 i = startIndex; i < endIndex; i++) {
            result[i - startIndex] = strBytes[i];
        }
        return string(result);
    }
}

File 4 of 13 : SSTORE2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./utils/Bytecode.sol";

/**
  @title A key-value storage with auto-generated keys for storing chunks of data with a lower write & read cost.
  @author Agustin Aguilar <[email protected]>

  Readme: https://github.com/0xsequence/sstore2#readme
*/
library SSTORE2 {
  error WriteError();

  /**
    @notice Stores `_data` and returns `pointer` as key for later retrieval
    @dev The pointer is a contract address with `_data` as code
    @param _data to be written
    @return pointer Pointer to the written `_data`
  */
  function write(bytes memory _data) internal returns (address pointer) {
    // Append 00 to _data so contract can't be called
    // Build init code
    bytes memory code = Bytecode.creationCodeFor(
      abi.encodePacked(
        hex'00',
        _data
      )
    );

    // Deploy contract using create
    assembly { pointer := create(0, add(code, 32), mload(code)) }

    // Address MUST be non-zero
    if (pointer == address(0)) revert WriteError();
  }

  /**
    @notice Reads the contents of the `_pointer` code as data, skips the first byte 
    @dev The function is intended for reading pointers generated by `write`
    @param _pointer to be read
    @return data read from `_pointer` contract
  */
  function read(address _pointer) internal view returns (bytes memory) {
    return Bytecode.codeAt(_pointer, 1, type(uint256).max);
  }

  /**
    @notice Reads the contents of the `_pointer` code as data, skips the first byte 
    @dev The function is intended for reading pointers generated by `write`
    @param _pointer to be read
    @param _start number of bytes to skip
    @return data read from `_pointer` contract
  */
  function read(address _pointer, uint256 _start) internal view returns (bytes memory) {
    return Bytecode.codeAt(_pointer, _start + 1, type(uint256).max);
  }

  /**
    @notice Reads the contents of the `_pointer` code as data, skips the first byte 
    @dev The function is intended for reading pointers generated by `write`
    @param _pointer to be read
    @param _start number of bytes to skip
    @param _end index before which to end extraction
    @return data read from `_pointer` contract
  */
  function read(address _pointer, uint256 _start, uint256 _end) internal view returns (bytes memory) {
    return Bytecode.codeAt(_pointer, _start + 1, _end + 1);
  }
}

File 5 of 13 : Bytecode.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;


library Bytecode {
  error InvalidCodeAtRange(uint256 _size, uint256 _start, uint256 _end);

  /**
    @notice Generate a creation code that results on a contract with `_code` as bytecode
    @param _code The returning value of the resulting `creationCode`
    @return creationCode (constructor) for new contract
  */
  function creationCodeFor(bytes memory _code) internal pure returns (bytes memory) {
    /*
      0x00    0x63         0x63XXXXXX  PUSH4 _code.length  size
      0x01    0x80         0x80        DUP1                size size
      0x02    0x60         0x600e      PUSH1 14            14 size size
      0x03    0x60         0x6000      PUSH1 00            0 14 size size
      0x04    0x39         0x39        CODECOPY            size
      0x05    0x60         0x6000      PUSH1 00            0 size
      0x06    0xf3         0xf3        RETURN
      <CODE>
    */

    return abi.encodePacked(
      hex"63",
      uint32(_code.length),
      hex"80_60_0E_60_00_39_60_00_F3",
      _code
    );
  }

  /**
    @notice Returns the size of the code on a given address
    @param _addr Address that may or may not contain code
    @return size of the code on the given `_addr`
  */
  function codeSize(address _addr) internal view returns (uint256 size) {
    assembly { size := extcodesize(_addr) }
  }

  /**
    @notice Returns the code of a given address
    @dev It will fail if `_end < _start`
    @param _addr Address that may or may not contain code
    @param _start number of bytes of code to skip on read
    @param _end index before which to end extraction
    @return oCode read from `_addr` deployed bytecode

    Forked from: https://gist.github.com/KardanovIR/fe98661df9338c842b4a30306d507fbd
  */
  function codeAt(address _addr, uint256 _start, uint256 _end) internal view returns (bytes memory oCode) {
    uint256 csize = codeSize(_addr);
    if (csize == 0) return bytes("");

    if (_start > csize) return bytes("");
    if (_end < _start) revert InvalidCodeAtRange(csize, _start, _end); 

    unchecked {
      uint256 reqSize = _end - _start;
      uint256 maxSize = csize - _start;

      uint256 size = maxSize < reqSize ? maxSize : reqSize;

      assembly {
        // allocate output byte array - this could also be done without assembly
        // by using o_code = new bytes(size)
        oCode := mload(0x40)
        // new "memory end" including padding
        mstore(0x40, add(oCode, and(add(add(size, 0x20), 0x1f), not(0x1f))))
        // store length in memory
        mstore(oCode, size)
        // actually retrieve the code, this needs assembly
        extcodecopy(_addr, add(oCode, 0x20), _start, size)
      }
    }
  }
}

File 6 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        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 13 : 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 8 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 9 of 13 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

File 10 of 13 : 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;
    }
}

File 11 of 13 : MerkleProof.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the merkle tree could be reinterpreted as a leaf value.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

File 12 of 13 : ERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

import './IERC721A.sol';

/**
 * @dev ERC721 token receiver interface.
 */
interface ERC721A__IERC721Receiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard,
 * including the Metadata extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at `_startTokenId()`
 * (defaults to 0, e.g. 0, 1, 2, 3..).
 *
 * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply.
 *
 * Assumes that the maximum token id cannot exceed 2**256 - 1 (max value of uint256).
 */
contract ERC721A is IERC721A {
    // 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 tokenId of the next token 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 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
        _currentIndex = _startTokenId();
    }

    /**
     * @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 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 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 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 returns (uint256) {
        return _burnCounter;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    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: 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.
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view 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 {
        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;
    }

    /**
     * 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 ownership that has an address and is not burned
                        // before an ownership that does not have an address and is not burned.
                        // Hence, curr will not underflow.
                        //
                        // We can directly compare the packed value.
                        // If the address is zero, packed is zero.
                        while (packed == 0) {
                            packed = _packedOwnerships[--curr];
                        }
                        return packed;
                    }
                }
        }
        revert OwnerQueryForNonexistentToken();
    }

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

    /**
     * Returns the unpacked `TokenOwnership` struct at `index`.
     */
    function _ownershipAt(uint256 index) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnerships[index]);
    }

    /**
     * @dev Initializes the ownership slot minted at `index` for efficiency purposes.
     */
    function _initializeOwnershipAt(uint256 index) internal {
        if (_packedOwnerships[index] == 0) {
            _packedOwnerships[index] = _packedOwnershipOf(index);
        }
    }

    /**
     * Gas spent here starts off proportional to the maximum mint batch size.
     * It gradually moves to O(1) as tokens get transferred around in the collection over time.
     */
    function _ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
        return _unpackedOwnership(_packedOwnershipOf(tokenId));
    }

    /**
     * @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 See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view override returns (address) {
        return address(uint160(_packedOwnershipOf(tokenId)));
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        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 '';
    }

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

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public override {
        address owner = ownerOf(tokenId);

        if (_msgSenderERC721A() != owner)
            if (!isApprovedForAll(owner, _msgSenderERC721A())) {
                revert ApprovalCallerNotOwnerNorApproved();
            }

        _tokenApprovals[tokenId] = to;
        emit Approval(owner, to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view override returns (address) {
        if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        if (operator == _msgSenderERC721A()) revert ApproveToCaller();

        _operatorApprovals[_msgSenderERC721A()][operator] = approved;
        emit ApprovalForAll(_msgSenderERC721A(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, '');
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        transferFrom(from, to, tokenId);
        if (to.code.length != 0)
            if (!_checkContractOnERC721Received(from, to, tokenId, _data)) {
                revert TransferToNonERC721ReceiverImplementer();
            }
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     */
    function _exists(uint256 tokenId) internal view returns (bool) {
        return
            _startTokenId() <= tokenId &&
            tokenId < _currentIndex && // If within bounds,
            _packedOwnerships[tokenId] & BITMASK_BURNED == 0; // and not burned.
    }

    /**
     * @dev Equivalent to `_safeMint(to, quantity, '')`.
     */
    function _safeMint(address to, uint256 quantity) internal {
        _safeMint(to, 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 {
        _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 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 {
        uint256 startTokenId = _currentIndex;
        if (to == address(0)) revert MintToZeroAddress();
        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 tokenId = startTokenId;
            uint256 end = startTokenId + quantity;
            do {
                emit Transfer(address(0), to, tokenId++);
            } while (tokenId < end);

            _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 {
        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 Returns the storage slot and value for the approved address of `tokenId`.
     */
    function _getApprovedAddress(uint256 tokenId)
        private
        view
        returns (uint256 approvedAddressSlot, address approvedAddress)
    {
        mapping(uint256 => address) storage tokenApprovalsPtr = _tokenApprovals;
        // The following is equivalent to `approvedAddress = _tokenApprovals[tokenId]`.
        assembly {
            // Compute the slot.
            mstore(0x00, tokenId)
            mstore(0x20, tokenApprovalsPtr.slot)
            approvedAddressSlot := keccak256(0x00, 0x40)
            // Load the slot's value from storage.
            approvedAddress := sload(approvedAddressSlot)
        }
    }

    /**
     * @dev Returns whether the `approvedAddress` is equals to `from` or `msgSender`.
     */
    function _isOwnerOrApproved(
        address approvedAddress,
        address from,
        address msgSender
    ) private pure returns (bool result) {
        assembly {
            // Mask `from` to the lower 160 bits, in case the upper bits somehow aren't clean.
            from := and(from, BITMASK_ADDRESS)
            // Mask `msgSender` to the lower 160 bits, in case the upper bits somehow aren't clean.
            msgSender := and(msgSender, BITMASK_ADDRESS)
            // `msgSender == from || msgSender == approvedAddress`.
            result := or(eq(msgSender, from), eq(msgSender, approvedAddress))
        }
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * 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) = _getApprovedAddress(tokenId);

        // The nested ifs save around 20+ gas over a compound boolean condition.
        if (!_isOwnerOrApproved(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 `_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) = _getApprovedAddress(tokenId);

        if (approvalCheck) {
            // The nested ifs save around 20+ gas over a compound boolean condition.
            if (!_isOwnerOrApproved(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++;
        }
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _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))
                }
            }
        }
    }

    /**
     * @dev Directly sets the extra data for the ownership data `index`.
     */
    function _setExtraDataAt(uint256 index, uint24 extraData) internal {
        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 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;
    }

    /**
     * @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 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 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 returns (string memory ptr) {
        assembly {
            // The maximum value of a uint256 contains 78 digits (1 byte per digit),
            // but we allocate 128 bytes to keep the free memory pointer 32-byte word aliged.
            // We will need 1 32-byte word to store the length,
            // and 3 32-byte words to store a maximum of 78 digits. Total: 32 + 3 * 32 = 128.
            ptr := add(mload(0x40), 128)
            // Update the free memory pointer to allocate.
            mstore(0x40, ptr)

            // Cache the end of the memory to calculate the length later.
            let end := ptr

            // We write the string from the rightmost digit to the leftmost digit.
            // The following is essentially a do-while loop that also handles the zero case.
            // Costs a bit more than early returning for the zero case,
            // but cheaper in terms of deployment and overall runtime costs.
            for {
                // Initialize and perform the first pass without check.
                let temp := value
                // Move the pointer 1 byte leftwards to point to an empty character slot.
                ptr := sub(ptr, 1)
                // Write the character to the pointer. 48 is the ASCII index of '0'.
                mstore8(ptr, add(48, mod(temp, 10)))
                temp := div(temp, 10)
            } temp {
                // Keep dividing `temp` until zero.
                temp := div(temp, 10)
            } {
                // Body of the for loop.
                ptr := sub(ptr, 1)
                mstore8(ptr, add(48, mod(temp, 10)))
            }

            let length := sub(end, ptr)
            // Move the pointer 32 bytes leftwards to make room for the length.
            ptr := sub(ptr, 32)
            // Store the length.
            mstore(ptr, length)
        }
    }
}

File 13 of 13 : IERC721A.sol
// SPDX-License-Identifier: MIT
// ERC721A Contracts v4.1.0
// Creator: Chiru Labs

pragma solidity ^0.8.4;

/**
 * @dev Interface of an ERC721A compliant contract.
 */
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();

    struct TokenOwnership {
        // The address of the owner.
        address addr;
        // Keeps track of 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 through `_extraData`.
        uint24 extraData;
    }

    /**
     * @dev Returns the total amount of tokens stored by the contract.
     *
     * Burned tokens are calculated here, use `_totalMinted()` if you want to count just minted tokens.
     */
    function totalSupply() external view returns (uint256);

    // ==============================
    //            IERC165
    // ==============================

    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);

    // ==============================
    //            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`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must 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
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

    // ==============================
    //        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 standard. See `_mintERC2309` for more details.
     */
    event ConsecutiveTransfer(uint256 indexed fromTokenId, uint256 toTokenId, address indexed from, address indexed to);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"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":[{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"InvalidCodeAtRange","type":"error"},{"inputs":[],"name":"MintERC2309QuantityExceedsLimit","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"OwnershipNotInitializedForExtraData","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"WriteError","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"fromTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"ConsecutiveTransfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"_layerIndex","type":"uint256"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"mimetype","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"useExistingData","type":"bool"},{"internalType":"uint256","name":"existingDataIndex","type":"uint256"}],"internalType":"struct Indelible.TraitDTO[]","name":"traits","type":"tuple[]"}],"name":"addLayer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_layerIndex","type":"uint256"},{"internalType":"uint256","name":"_traitIndex","type":"uint256"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"mimetype","type":"string"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bool","name":"useExistingData","type":"bool"},{"internalType":"uint256","name":"existingDataIndex","type":"uint256"}],"internalType":"struct Indelible.TraitDTO","name":"trait","type":"tuple"}],"name":"addTrait","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allowListPrice","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":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractData","outputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"image","type":"string"},{"internalType":"string","name":"banner","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"uint256","name":"royalties","type":"uint256"},{"internalType":"string","name":"royaltiesRecipient","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"_layerIndex","type":"uint256"},{"internalType":"uint256","name":"_traitIndex","type":"uint256"}],"name":"getLinkedTraits","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_hash","type":"string"}],"name":"hashToMetadata","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_hash","type":"string"}],"name":"hashToSVG","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isAllowListActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"isContractSealed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isMintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicMintActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPerAllowList","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_count","type":"uint256"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"}],"name":"onAllowList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenIdA","type":"uint256"},{"internalType":"uint256","name":"tokenIdB","type":"uint256"}],"name":"reRollDuplicate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","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":[],"name":"sealContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allowListPrice","type":"uint256"}],"name":"setAllowListPrice","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":"_backgroundColor","type":"string"}],"name":"setBackgroundColor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"string","name":"image","type":"string"},{"internalType":"string","name":"banner","type":"string"},{"internalType":"string","name":"website","type":"string"},{"internalType":"uint256","name":"royalties","type":"uint256"},{"internalType":"string","name":"royaltiesRecipient","type":"string"}],"internalType":"struct Indelible.ContractData","name":"_contractData","type":"tuple"}],"name":"setContractData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256[]","name":"traitA","type":"uint256[]"},{"internalType":"uint256[]","name":"traitB","type":"uint256[]"}],"internalType":"struct Indelible.LinkedTraitDTO[]","name":"linkedTraits","type":"tuple[]"}],"name":"setLinkedTraits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPerAddress","type":"uint256"}],"name":"setMaxPerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxPerAllowList","type":"uint256"}],"name":"setMaxPerAllowList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_renderOffChain","type":"bool"}],"name":"setRenderOfTokenId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleAllowListMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"togglePublicMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleWrapSVG","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenIdToHash","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenIdToSVG","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenIdA","type":"uint256"},{"internalType":"uint256","name":"tokenIdB","type":"uint256"}],"name":"tokensAreDuplicates","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_layerIndex","type":"uint256"},{"internalType":"uint256","name":"_traitIndex","type":"uint256"}],"name":"traitData","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_layerIndex","type":"uint256"},{"internalType":"uint256","name":"_traitIndex","type":"uint256"}],"name":"traitDetails","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"mimetype","type":"string"}],"internalType":"struct Indelible.Trait","name":"","type":"tuple"}],"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":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60056101809081526409adeeae8d60db1b6101a052608090815260046101c0818152634e65636b60e01b6101e05260a05260076102009081526645617272696e6760c81b6102205260c052610240818152634579657360e01b6102605260e052610280908152631219585960e21b6102a0526101005260036102c09081526241706560e81b6102e05261012052600a61030090815269109858dad9dc9bdd5b9960b21b6103205261014052610380604052600d6103409081526c233aba3ab9329027b934b3b4b760991b6103605261016052620000e19060169060086200080a565b506017805460ff1916600117905560408051808201909152600b8082526a1d1c985b9cdc185c995b9d60aa1b602090920191825262000123916018916200086e565b50601e601a55661c6bf526340000601b556040805160208101918290526000908190526200015491601c916200086e565b506000601f5560016020556040518060e00160405280604051806040016040528060118152602001705068756e6b20415045204f726967696e7360781b815250815260200160405180610100016040528060d881526020016200601f60d8913981526020016040518060a001604052806062815260200162005f326062913981526020016040518060a001604052806061815260200162005f94606191398152602001604051806020016040528060008152508152602001600081526020016040518060600160405280602a815260200162005ff5602a913990528051805160229162000247918391602001906200086e565b5060208281015180516200026292600185019201906200086e565b5060408201518051620002809160028401916020909101906200086e565b50606082015180516200029e9160038401916020909101906200086e565b5060808201518051620002bc9160048401916020909101906200086e565b5060a0820151600582015560c08201518051620002e49160068401916020909101906200086e565b505050348015620002f457600080fd5b5060408051808201825260118152705068756e6b20415045204f726967696e7360781b60208083019182528351808501909452600384526250414f60e81b90840152815191929162000349916002916200086e565b5080516200035f9060039060208401906200086e565b5060008055505060016008556200037633620007b8565b604080516101408101825260d2815260fa602082015261012c918101829052606081019190915261017c608082015261018660a082015261019060c08201526101b360e0820181905261010082015261076c610120820152620003de90600e90600a620008f9565b50604080516101008101825261010481526101a4602082018190529181019190915261023a6060820152610262608082015261028060a0820181905260c08201526105a060e08201526200043790600f906008620008f9565b50604080516101008101825261012c815261019060208201526102589181019190915261028a60608201526102bc60808201526102ee60a0820181905260c082015261035260e082015262000491906010906008620008f9565b506040805161028081018252605a80825260208201819052918101829052606081018290526080810191909152606460a0820152606e60c0820181905260e082015260b461010082015260c861012082015260f06101408201819052610160820181905261018082018190526101a082018190526101c082015260fa6101e082015261018661020082018190526102208201526102946102408201526103c061026082015262000546906011906014620008f9565b50604080516105008101825260148152601e6020820152602891810182905260326060820152603c6080820181905260a080830191909152603d60c0830181905260e08301526050610100830181905261012083018190526101408301819052610160830181905261018083018190526101a083018190526101c083018190526101e0830152605a610200830181905261022083018190526102408301819052610260830181905261028083018190526102a083018190526102c083018190526102e0830152610300820181905261032082018190526103408201819052610360820181905261038082018190526103a082018190526103c082018190526103e0820181905261040082015260aa61042082018190526104408201819052610460820181905261048082015261011e6104a082018190526104c08201526102366104e08201526200069b9160129190620008f9565b50604080516101a0810182526023815260416020820152605f91810191909152607d606082015260b4608082015261019a60a082015261021260c082015261022660e082015261024e6101008201819052610120820152610262610140820181905261016082018190526101808201526200071b90601390600d620008f9565b506040805160a08101825261032081526103b6602082018190529181019190915261044c60608201526104b060808201526200075c906014906005620008f9565b50604080516101008101825261011381526102a360208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810191909152620007b1906015906008620008f9565b50620009f3565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8280548282559060005260206000209081019282156200085c579160200282015b828111156200085c57825180516200084b9184916020909101906200086e565b50916020019190600101906200082b565b506200086a9291506200093d565b5090565b8280546200087c90620009b7565b90600052602060002090601f016020900481019282620008a05760008555620008eb565b82601f10620008bb57805160ff1916838001178555620008eb565b82800160010185558215620008eb579182015b82811115620008eb578251825591602001919060010190620008ce565b506200086a9291506200095e565b828054828255906000526020600020908101928215620008eb579160200282015b82811115620008eb578251829061ffff169055916020019190600101906200091a565b808211156200086a57600062000954828262000975565b506001016200093d565b5b808211156200086a57600081556001016200095f565b5080546200098390620009b7565b6000825580601f1062000994575050565b601f016020900490600052602060002090810190620009b491906200095e565b50565b600181811c90821680620009cc57607f821691505b602082108103620009ed57634e487b7160e01b600052602260045260246000fd5b50919050565b61552f8062000a036000396000f3fe60806040526004361061036f5760003560e01c80636cced73a116101c6578063b88d4fde116100f7578063dc53fd9211610095578063e985e9c51161006f578063e985e9c5146109ee578063ea84b59b14610a37578063f2fde38b14610a64578063fd6b3cf514610a8457600080fd5b8063dc53fd9214610996578063dc9867ce146109ac578063e8a3d485146109d957600080fd5b8063c87b56dd116100d1578063c87b56dd14610920578063d36c2f2614610940578063d5abeb0114610960578063dbe9875f1461097657600080fd5b8063b88d4fde146108cd578063ba41b0c6146108ed578063c11feac11461090057600080fd5b80638da5cb5b11610164578063a22cb4651161013e578063a22cb46514610857578063a24e515314610877578063b32c56801461088d578063b4568066146108ad57600080fd5b80638da5cb5b1461080f5780638fb4e8a91461082d57806395d89b411461084257600080fd5b8063715018a6116101a0578063715018a61461079a5780637bddd65b146107af5780637cb64759146107cf57806389ce3074146107ef57600080fd5b80636cced73a1461073a5780636df9fa881461075a57806370a082311461077a57600080fd5b806342842e0e116102a057806361ab9d0c1161023e578063639814e011610218578063639814e0146106da57806366e33870146106f057806368bd580e146107105780636c0360eb1461072557600080fd5b806361ab9d0c1461067a578063621a1f741461069a5780636352211e146106ba57600080fd5b8063542d50411161027a578063542d50411461060b57806355f804b3146106255780635b92ac0d146106455780636190e1da1461065a57600080fd5b806342842e0e146105b65780634920154b146105d65780634ca1a0f2146105eb57600080fd5b806323b872dd1161030d57806336cd2edd116102e757806336cd2edd1461054e5780633cca2420146105645780633ccfd60b1461058c5780634047638d146105a157600080fd5b806323b872dd146104fa57806329fc6bae1461051a5780632d6b62241461053457600080fd5b8063095ea7b311610349578063095ea7b31461047757806309dbabca146104975780630f3debbe146104b757806318160ddd146104d757600080fd5b806301ffc9a7146103e857806306fdde031461041d578063081812fc1461043f57600080fd5b366103e357601d5460ff166103cb5760405162461bcd60e51b815260206004820152601c60248201527f5075626c6963206d696e74696e67206973206e6f74206163746976650000000060448201526064015b60405180910390fd5b6103e1601b54346103dc9190614059565b610aa4565b005b600080fd5b3480156103f457600080fd5b50610408610403366004614083565b610d18565b60405190151581526020015b60405180910390f35b34801561042957600080fd5b50610432610d6a565b60405161041491906140f8565b34801561044b57600080fd5b5061045f61045a36600461410b565b610dfc565b6040516001600160a01b039091168152602001610414565b34801561048357600080fd5b506103e161049236600461413b565b610e40565b3480156104a357600080fd5b506104326104b2366004614165565b610ee0565b3480156104c357600080fd5b506103e16104d23660046142a8565b610f28565b3480156104e357600080fd5b50600154600054035b604051908152602001610414565b34801561050657600080fd5b506103e16105153660046143d2565b611028565b34801561052657600080fd5b506021546104089060ff1681565b34801561054057600080fd5b50601d546104089060ff1681565b34801561055a57600080fd5b506104ec60205481565b34801561057057600080fd5b506105796111dc565b604051610414979695949392919061440e565b34801561059857600080fd5b506103e161153a565b3480156105ad57600080fd5b506103e1611635565b3480156105c257600080fd5b506103e16105d13660046143d2565b611673565b3480156105e257600080fd5b506103e1611693565b3480156105f757600080fd5b506103e161060636600461410b565b6116d1565b34801561061757600080fd5b506019546104089060ff1681565b34801561063157600080fd5b506103e1610640366004614497565b611700565b34801561065157600080fd5b50610408611741565b34801561066657600080fd5b506103e1610675366004614497565b61176f565b34801561068657600080fd5b506103e16106953660046145ac565b6117cf565b3480156106a657600080fd5b506104326106b536600461410b565b611aa1565b3480156106c657600080fd5b5061045f6106d536600461410b565b611e8d565b3480156106e657600080fd5b506104ec601a5481565b3480156106fc57600080fd5b5061043261070b366004614497565b611e98565b34801561071c57600080fd5b506103e1611ff4565b34801561073157600080fd5b50610432612050565b34801561074657600080fd5b50610408610755366004614165565b6120de565b34801561076657600080fd5b506103e161077536600461410b565b6120fa565b34801561078657600080fd5b506104ec61079536600461466d565b612129565b3480156107a657600080fd5b506103e1612177565b3480156107bb57600080fd5b506103e16107ca36600461410b565b6121ad565b3480156107db57600080fd5b506103e16107ea36600461410b565b6121dc565b3480156107fb57600080fd5b5061043261080a366004614497565b61220b565b34801561081b57600080fd5b506009546001600160a01b031661045f565b34801561083957600080fd5b506103e1612424565b34801561084e57600080fd5b50610432612462565b34801561086357600080fd5b506103e1610872366004614688565b612471565b34801561088357600080fd5b506104ec601f5481565b34801561089957600080fd5b506104086108a8366004614706565b612506565b3480156108b957600080fd5b506103e16108c83660046147be565b612586565b3480156108d957600080fd5b506103e16108e83660046148c9565b612715565b6104ec6108fb366004614930565b612759565b34801561090c57600080fd5b5061043261091b36600461410b565b612962565b34801561092c57600080fd5b5061043261093b36600461410b565b612970565b34801561094c57600080fd5b506103e161095b366004614962565b612bee565b34801561096c57600080fd5b506104ec61138881565b34801561098257600080fd5b506103e16109913660046149b1565b612dc4565b3480156109a257600080fd5b506104ec601b5481565b3480156109b857600080fd5b506109cc6109c7366004614165565b612e64565b60405161041491906149d4565b3480156109e557600080fd5b50610432612ecf565b3480156109fa57600080fd5b50610408610a09366004614a18565b6001600160a01b03918216600090815260076020908152604080832093909416825291909152205460ff1690565b348015610a4357600080fd5b50610a57610a52366004614165565b612f2d565b6040516104149190614a42565b348015610a7057600080fd5b506103e1610a7f36600461466d565b61308f565b348015610a9057600080fd5b506103e1610a9f366004614165565b61312a565b6000610aae611741565b610af25760405162461bcd60e51b81526020600482015260156024820152744d696e74696e67206973206e6f742061637469766560581b60448201526064016103c2565b60005482610b385760405162461bcd60e51b8152602060048201526013602482015272125b9d985b1a59081d1bdad95b8818dbdd5b9d606a1b60448201526064016103c2565b611388610b458483614a84565b1115610b895760405162461bcd60e51b8152602060048201526013602482015272416c6c20746f6b656e732061726520676f6e6560681b60448201526064016103c2565b601d5460ff1615610cb6576009546001600160a01b03163314610c1f57601a5433600090815260056020526040908190205485911c6001600160401b0316610bd19190614a84565b1115610c1f5760405162461bcd60e51b815260206004820152601a60248201527f4578636565646564206d6178206d696e747320616c6c6f77656400000000000060448201526064016103c2565b333214610c5a5760405162461bcd60e51b8152602060048201526009602482015268454f4173206f6e6c7960b81b60448201526064016103c2565b34601b5484610c699190614a9c565b14610cb65760405162461bcd60e51b815260206004820152601e60248201527f496e636f727265637420616d6f756e74206f662065746865722073656e74000060448201526064016103c2565b6000610cc3601485614059565b90506000610cd2601486614abb565b905060005b82811015610cfc57610cea3360146132a9565b80610cf481614acf565b915050610cd7565b508015610d0d57610d0d33826132a9565b50909150505b919050565b60006301ffc9a760e01b6001600160e01b031983161480610d4957506380ac58cd60e01b6001600160e01b03198316145b80610d645750635b5e139f60e01b6001600160e01b03198316145b92915050565b606060028054610d7990614ae8565b80601f0160208091040260200160405190810160405280929190818152602001828054610da590614ae8565b8015610df25780601f10610dc757610100808354040283529160200191610df2565b820191906000526020600020905b815481529060010190602001808311610dd557829003601f168201915b5050505050905090565b6000610e07826133aa565b610e24576040516333d1c03960e21b815260040160405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610e4b82611e8d565b9050336001600160a01b03821614610e8457610e678133610a09565b610e84576040516367d9dca160e11b815260040160405180910390fd5b60008281526006602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000828152600a602052604090208054606091610f219184908110610f0757610f07614b1c565b6000918252602090912001546001600160a01b03166133d1565b9392505050565b6009546001600160a01b03163314610f525760405162461bcd60e51b81526004016103c290614b32565b60195460ff1615610f755760405162461bcd60e51b81526004016103c290614b67565b805180518291602291610f8f918391602090910190613f05565b506020828101518051610fa89260018501920190613f05565b5060408201518051610fc4916002840191602090910190613f05565b5060608201518051610fe0916003840191602090910190613f05565b5060808201518051610ffc916004840191602090910190613f05565b5060a0820151600582015560c08201518051611022916006840191602090910190613f05565b50505050565b6000611033826133e1565b9050836001600160a01b0316816001600160a01b0316146110665760405162a1148160e81b815260040160405180910390fd5b60008281526006602052604090208054338082146001600160a01b038816909114176110b3576110968633610a09565b6110b357604051632ce44b5f60e11b815260040160405180910390fd5b6001600160a01b0385166110da57604051633a954ecd60e21b815260040160405180910390fd5b80156110e557600082555b6001600160a01b0380871660009081526005602052604080822080546000190190559187168152208054600101905561113e85611123888287613448565b600160e11b174260a01b176001600160a01b03919091161790565b600085815260046020526040812091909155600160e11b84169003611193576001840160008181526004602052604081205490036111915760005481146111915760008181526004602052604090208490555b505b83856001600160a01b0316876001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050505050565b6022805481906111eb90614ae8565b80601f016020809104026020016040519081016040528092919081815260200182805461121790614ae8565b80156112645780601f1061123957610100808354040283529160200191611264565b820191906000526020600020905b81548152906001019060200180831161124757829003601f168201915b50505050509080600101805461127990614ae8565b80601f01602080910402602001604051908101604052809291908181526020018280546112a590614ae8565b80156112f25780601f106112c7576101008083540402835291602001916112f2565b820191906000526020600020905b8154815290600101906020018083116112d557829003601f168201915b50505050509080600201805461130790614ae8565b80601f016020809104026020016040519081016040528092919081815260200182805461133390614ae8565b80156113805780601f1061135557610100808354040283529160200191611380565b820191906000526020600020905b81548152906001019060200180831161136357829003601f168201915b50505050509080600301805461139590614ae8565b80601f01602080910402602001604051908101604052809291908181526020018280546113c190614ae8565b801561140e5780601f106113e35761010080835404028352916020019161140e565b820191906000526020600020905b8154815290600101906020018083116113f157829003601f168201915b50505050509080600401805461142390614ae8565b80601f016020809104026020016040519081016040528092919081815260200182805461144f90614ae8565b801561149c5780601f106114715761010080835404028352916020019161149c565b820191906000526020600020905b81548152906001019060200180831161147f57829003601f168201915b5050505050908060050154908060060180546114b790614ae8565b80601f01602080910402602001604051908101604052809291908181526020018280546114e390614ae8565b80156115305780601f1061150557610100808354040283529160200191611530565b820191906000526020600020905b81548152906001019060200180831161151357829003601f168201915b5050505050905087565b6009546001600160a01b031633146115645760405162461bcd60e51b81526004016103c290614b32565b6002600854036115b65760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103c2565b60026008554760006127106115cc60fa82614b93565b6115d69084614a9c565b6115e09190614059565b905060006115f66009546001600160a01b031690565b905073ea208da933c43857683c04bc76e3fd331d7bfdf7611617828461346b565b61162a816116258587614b93565b61346b565b505060016008555050565b6009546001600160a01b0316331461165f5760405162461bcd60e51b81526004016103c290614b32565b601d805460ff19811660ff90911615179055565b61168e83838360405180602001604052806000815250612715565b505050565b6009546001600160a01b031633146116bd5760405162461bcd60e51b81526004016103c290614b32565b6017805460ff19811660ff90911615179055565b6009546001600160a01b031633146116fb5760405162461bcd60e51b81526004016103c290614b32565b602055565b6009546001600160a01b0316331461172a5760405162461bcd60e51b81526004016103c290614b32565b805161173d90601c906020840190613f05565b5050565b600061138861174f60005490565b10801561176a5750601d5460ff168061176a575060215460ff165b905090565b6009546001600160a01b031633146117995760405162461bcd60e51b81526004016103c290614b32565b60195460ff16156117bc5760405162461bcd60e51b81526004016103c290614b67565b805161173d906018906020840190613f05565b6009546001600160a01b031633146117f95760405162461bcd60e51b81526004016103c290614b32565b60195460ff161561181c5760405162461bcd60e51b81526004016103c290614b67565b8051600e836008811061183157611831614b1c565b0154146118985760405162461bcd60e51b815260206004820152602f60248201527f5472616974732073697a6520646f6573206e6f74206d6174636820746965727360448201526e040ccdee440e8d0d2e640d2dcc8caf608b1b60648201526084016103c2565b600081516001600160401b038111156118b3576118b3614187565b6040519080825280602002602001820160405280156118dc578160200160208202803683370190505b50905060005b8251811015611a81578281815181106118fd576118fd614b1c565b6020026020010151606001511561197c578183828151811061192157611921614b1c565b6020026020010151608001518151811061193d5761193d614b1c565b602002602001015182828151811061195757611957614b1c565b60200260200101906001600160a01b031690816001600160a01b0316815250506119d5565b6119a283828151811061199157611991614b1c565b602002602001015160400151613584565b8282815181106119b4576119b4614b1c565b60200260200101906001600160a01b031690816001600160a01b0316815250505b60405180604001604052808483815181106119f2576119f2614b1c565b6020026020010151600001518152602001848381518110611a1557611a15614b1c565b6020908102919091018101518101519091526000868152600b8252604080822085835283529020825180519192611a5192849290910190613f05565b506020828101518051611a6a9260018501920190613f05565b509050508080611a7990614acf565b9150506118e2565b506000838152600a60209081526040909120825161102292840190613f89565b6060611aac826133aa565b611ae85760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b60448201526064016103c2565b6000611b16611af960086004614a9c565b604080518281016060018252910181526000602090910190815290565b6040805160088082526101208201909252919250600091906020820161010080368337505060408051600880825261012082019092529293506000929150602082016101008036833701905050905060005b6008811015611d5b576000838281518110611b8557611b85614b1c565b60200260200101519050828281518110611ba157611ba1614b1c565b602002602001015115156000151503611c47576000611388611bc2896135e9565b89611bcd8682614a84565b60405160e89390931b6001600160e81b0319166020840152602383019190915260438201526063016040516020818303038152906040528051906020012060001c611c189190614abb565b9050611c2481846135fe565b915081858481518110611c3957611c39614b1c565b602002602001018181525050505b6000828152600d6020908152604080832084845290915290205415611d48576000828152600d60209081526040808320848452909152902080546001908110611c9257611c92614b1c565b6000918252602080832090910154848352600d82526040808420858552909252908220805491928792611cc757611cc7614b1c565b906000526020600020015481518110611ce257611ce2614b1c565b6020908102919091018101919091526000838152600d825260408082208483529092529081208054600192869291611d1c57611d1c614b1c565b906000526020600020015481518110611d3757611d37614b1c565b911515602092830291909101909101525b5080611d5381614acf565b915050611b68565b5060005b8251811015611e8357600a838281518110611d7c57611d7c614b1c565b60200260200101511015611db357604080518082019091526002815261030360f41b6020820152611dae90859061369a565b611df8565b6064838281518110611dc757611dc7614b1c565b60200260200101511015611df8576040805180820190915260018152600360fc1b6020820152611df890859061369a565b6103e7838281518110611e0d57611e0d614b1c565b60200260200101511115611e455760408051808201909152600381526239393960e81b6020820152611e4090859061369a565b611e71565b611e71611e6a848381518110611e5d57611e5d614b1c565b602002602001015161371f565b859061369a565b80611e7b81614acf565b915050611d5f565b5091949350505050565b6000610d64826133e1565b60408051620200608101825262020040815260006020918201908152825180840190935260018352605b60f81b91830191909152606091611eda90829061369a565b60005b6008811015611fed576000611f1a611f1586611efa856003614a9c565b611f05866003614a9c565b611f10906003614a84565b61376e565b61383a565b60ff169050611f7d60168381548110611f3557611f35614b1c565b60009182526020808320868452600b825260408085208786528352938490209351611f669493909101929101614c43565b60408051601f19818403018152919052849061369a565b611f8960016008614b93565b8203611fb7576040805180820190915260018152605d60f81b6020820152611fb290849061369a565b611fda565b6040805180820190915260018152600b60fa1b6020820152611fda90849061369a565b5080611fe581614acf565b915050611edd565b5092915050565b60195460ff16156120175760405162461bcd60e51b81526004016103c290614b67565b6009546001600160a01b031633146120415760405162461bcd60e51b81526004016103c290614b32565b6019805460ff19166001179055565b601c805461205d90614ae8565b80601f016020809104026020016040519081016040528092919081815260200182805461208990614ae8565b80156120d65780601f106120ab576101008083540402835291602001916120d6565b820191906000526020600020905b8154815290600101906020018083116120b957829003601f168201915b505050505081565b6000610f216120ec84611aa1565b6120f584611aa1565b6138f8565b6009546001600160a01b031633146121245760405162461bcd60e51b81526004016103c290614b32565b601f55565b60006001600160a01b038216612152576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600560205260409020546001600160401b031690565b6009546001600160a01b031633146121a15760405162461bcd60e51b81526004016103c290614b32565b6121ab6000613951565b565b6009546001600160a01b031633146121d75760405162461bcd60e51b81526004016103c290614b32565b601a55565b6009546001600160a01b031633146122065760405162461bcd60e51b81526004016103c290614b32565b601e55565b60408051620200608101909152620200408152600060209091018181526060919061224f6040518060c001604052806081815260200161543960819139829061369a565b61227b60186040516020016122649190614c99565b60408051601f19818403018152919052829061369a565b60005b61228a60016008614b93565b811015612346576122ae611f15866122a3846003614a9c565b611f05856003614a9c565b60ff169250612334600b6000838152602001908152602001600020600085815260200190815260200160002060010161230c612307600a60008681526020019081526020016000208781548110610f0757610f07614b1c565b6139a3565b60405160200161231d929190614ccb565b60408051601f19818403018152919052839061369a565b8061233e81614acf565b91505061227e565b50612371611f1585600361235b600882614a9c565b6123659190614b93565b611f1060086003614a9c565b60ff1691506123f3600b600061238960016008614b93565b815260200190815260200160002060008481526020019081526020016000206001016123e2612307600a6000600160086123c39190614b93565b81526020019081526020016000208681548110610f0757610f07614b1c565b604051602001612264929190614d25565b6123fc816139a3565b60405160200161240c9190614e89565b60405160208183030381529060405292505050919050565b6009546001600160a01b0316331461244e5760405162461bcd60e51b81526004016103c290614b32565b6021805460ff19811660ff90911615179055565b606060038054610d7990614ae8565b336001600160a01b0383160361249a5760405163b06307db60e01b815260040160405180910390fd5b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600061257e83838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050601e546040516bffffffffffffffffffffffff1960608b901b166020820152909250603401905060405160208183030381529060405280519060200120613af5565b949350505050565b6009546001600160a01b031633146125b05760405162461bcd60e51b81526004016103c290614b32565b60195460ff16156125d35760405162461bcd60e51b81526004016103c290614b67565b60005b815181101561173d5760405180604001604052808383815181106125fc576125fc614b1c565b60200260200101516020015160008151811061261a5761261a614b1c565b6020026020010151815260200183838151811061263957612639614b1c565b60200260200101516020015160018151811061265757612657614b1c565b6020026020010151815250600d600084848151811061267857612678614b1c565b60200260200101516000015160008151811061269657612696614b1c565b6020026020010151815260200190815260200160002060008484815181106126c0576126c0614b1c565b6020026020010151600001516001815181106126de576126de614b1c565b60200260200101518152602001908152602001600020906002612702929190613fde565b508061270d81614acf565b9150506125d6565b612720848484611028565b6001600160a01b0383163b156110225761273c84848484613b0b565b611022576040516368d2bf6b60e11b815260040160405180910390fd5b60006002600854036127ad5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016103c2565b60026008556127ba611741565b6127fe5760405162461bcd60e51b81526020600482015260156024820152744d696e74696e67206973206e6f742061637469766560581b60448201526064016103c2565b601d5460ff16612949576009546001600160a01b031633146128ed57612825338484612506565b6128655760405162461bcd60e51b8152602060048201526011602482015270139bdd081bdb88185b1b1bddc81b1a5cdd607a1b60448201526064016103c2565b60205484612895336001600160a01b03166000908152600560205260409081902054901c6001600160401b031690565b61289f9190614a84565b11156128ed5760405162461bcd60e51b815260206004820152601a60248201527f4578636565646564206d6178206d696e747320616c6c6f77656400000000000060448201526064016103c2565b34601f54856128fc9190614a9c565b146129495760405162461bcd60e51b815260206004820152601e60248201527f496e636f727265637420616d6f756e74206f662065746865722073656e74000060448201526064016103c2565b600061295485610aa4565b600160085595945050505050565b6060610d6461080a83611aa1565b606061297b826133aa565b6129b75760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b2103a37b5b2b760991b60448201526064016103c2565b60008052600a6020527f13da86008ba1c6922daee3e07db95305ef49ebced9f5467a0b8613fcc6b343e354612a2e5760405162461bcd60e51b815260206004820152601a60248201527f5472616974732068617665206e6f74206265656e20616464656400000000000060448201526064016103c2565b6000612a3983611aa1565b604080516202006081018252620200408152600060209182019081528251808401909352601c83527f7b226e616d65223a225068756e6b20415045204f726967696e7320230000000091830191909152919250612a9790829061369a565b612ab6612aa38561371f565b6040516122649190602390602001614ece565b6000601c8054612ac590614ae8565b9050118015612ae257506000848152600c602052604090205460ff165b15612b0d57612b08601c612af58661371f565b8460405160200161226493929190614f1c565b612bb9565b60408051602081019091526000815260175460ff1615612b97576000612b328461220b565b9050612b5c81604051602001612b489190614f97565b6040516020818303038152906040526139a3565b604051602001612b6c9190614e89565b6040516020818303038152906040529150612b9181604051602001611f669190615082565b50612ba3565b612ba08361220b565b90505b612bb78160405160200161231d91906150c9565b505b612bd5612bc583611e98565b604051602001612264919061510c565b612bde816139a3565b60405160200161240c919061514d565b6009546001600160a01b03163314612c185760405162461bcd60e51b81526004016103c290614b32565b60195460ff1615612c3b5760405162461bcd60e51b81526004016103c290614b67565b60408051808201825282518152602080840151818301526000868152600b82528381208682528252929092208151805192939192612c7c9284920190613f05565b506020828101518051612c959260018501920190613f05565b5050506000838152600a6020908152604080832080548251818502810185019093528083529192909190830182828015612cf857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612cda575b50505050509050816060015115612d5e5780826080015181518110612d1f57612d1f614b1c565b6020026020010151818481518110612d3957612d39614b1c565b60200260200101906001600160a01b031690816001600160a01b031681525050612d9e565b612d6b8260400151613584565b818481518110612d7d57612d7d614b1c565b60200260200101906001600160a01b031690816001600160a01b0316815250505b6000848152600a602090815260409091208251612dbd92840190613f89565b5050505050565b612dcd82611e8d565b6001600160a01b0316336001600160a01b031614612e445760405162461bcd60e51b815260206004820152602e60248201527f4f6e6c792074686520746f6b656e206f776e65722063616e207365742074686560448201526d081c995b99195c881b595d1a1bd960921b60648201526084016103c2565b6000918252600c6020526040909120805460ff1916911515919091179055565b6000828152600d60209081526040808320848452825291829020805483518184028101840190945280845260609392830182828015612ec257602002820191906000526020600020905b815481526020019060010190808311612eae575b5050505050905092915050565b602754606090612f0990602290602390602490602590602690612ef19061371f565b604051612b4896959493929190602890602001615192565b604051602001612f19919061514d565b604051602081830303815290604052905090565b60408051808201909152606080825260208201526000838152600b60209081526040808320858452909152908190208151808301909252805482908290612f7390614ae8565b80601f0160208091040260200160405190810160405280929190818152602001828054612f9f90614ae8565b8015612fec5780601f10612fc157610100808354040283529160200191612fec565b820191906000526020600020905b815481529060010190602001808311612fcf57829003601f168201915b5050505050815260200160018201805461300590614ae8565b80601f016020809104026020016040519081016040528092919081815260200182805461303190614ae8565b801561307e5780601f106130535761010080835404028352916020019161307e565b820191906000526020600020905b81548152906001019060200180831161306157829003601f168201915b505050505081525050905092915050565b6009546001600160a01b031633146130b95760405162461bcd60e51b81526004016103c290614b32565b6001600160a01b03811661311e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103c2565b61312781613951565b50565b60195460ff161561314d5760405162461bcd60e51b81526004016103c290614b67565b61315782826120de565b6131a35760405162461bcd60e51b815260206004820152601d60248201527f416c6c20746f6b656e73206d757374206265206475706c69636174657300000060448201526064016103c2565b60008183116131b257816131b4565b825b90506131c86009546001600160a01b031690565b6001600160a01b0316336001600160a01b031614613264576131e981611e8d565b6001600160a01b0316336001600160a01b0316146132645760405162461bcd60e51b815260206004820152603260248201527f4f6e6c792074686520746f6b656e206f776e6572206f7220636f6e7472616374604482015271081bdddb995c8818d85b881c994b5c9bdb1b60721b60648201526084016103c2565b61326d81613bf6565b61328061327b826001614a84565b6133aa565b1561329857613298613293826001614a84565b613bf6565b61168e816132a4613c26565b613c97565b6000546001600160a01b0383166132d257604051622e076360e81b815260040160405180910390fd5b816000036132f35760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b0383166000908152600560205260408120805468010000000000000001850201905561334a90849061332d908281613448565b6001851460e11b174260a01b176001600160a01b03919091161790565b600082815260046020526040902055808281015b6040516001830192906001600160a01b038716906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a480821061335e5760005550505050565b6000805482108015610d64575050600090815260046020526040902054600160e01b161590565b6060610d64826001600019613cec565b60008160005481101561342f5760008181526004602052604081205490600160e01b8216900361342d575b80600003610f2157506000190160008181526004602052604090205461340c565b505b604051636f96cda160e11b815260040160405180910390fd5b600060e882811c9061345b868684613da1565b62ffffff16901b95945050505050565b804710156134bb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016103c2565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613508576040519150601f19603f3d011682016040523d82523d6000602084013e61350d565b606091505b505090508061168e5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016103c2565b6000806135af8360405160200161359b91906152bb565b604051602081830303815290604052613dc0565b90508051602082016000f091506001600160a01b0382166135e35760405163046a55db60e11b815260040160405180910390fd5b50919050565b60006135f482613dec565b6060015192915050565b600080805b600e846008811061361657613616614b1c565b01548110156103e3576000600e856008811061363457613634614b1c565b01828154811061364657613646614b1c565b9060005260206000200154905082861015801561366b57506136688184614a84565b86105b1561367a57509150610d649050565b6136848184614a84565b925050808061369290614acf565b915050613603565b601f1982015182518251603f199092019182906136b79083614a84565b11156137155760405162461bcd60e51b815260206004820152602760248201527f44796e616d69634275666665723a20417070656e64696e67206f7574206f66206044820152663137bab732399760c91b60648201526084016103c2565b6110228484613e63565b604080516080810191829052607f0190826030600a8206018353600a90045b801561375c57600183039250600a81066030018353600a900461373e565b50819003601f19909101908152919050565b606083600061377d8585614b93565b6001600160401b0381111561379457613794614187565b6040519080825280601f01601f1916602001820160405280156137be576020820181803683370190505b509050845b84811015613830578281815181106137dd576137dd614b1c565b01602001516001600160f81b031916826137f78884614b93565b8151811061380757613807614b1c565b60200101906001600160f81b031916908160001a9053508061382881614acf565b9150506137c3565b5095945050505050565b60008181805b82518160ff1610156138f0576030838260ff168151811061386357613863614b1c565b016020015160f81c1080159061389657506039838260ff168151811061388b5761388b614b1c565b016020015160f81c11155b156138de576138a6600a836152e1565b91506030838260ff16815181106138bf576138bf614b1c565b01602001516138d1919060f81c61530a565b6138db908361532d565b91505b806138e881615352565b915050613840565b509392505050565b60008160405160200161390b9190615371565b60405160208183030381529060405280519060200120836040516020016139329190615371565b6040516020818303038152906040528051906020012014905092915050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b606081516000036139c257505060408051602081019091526000815290565b60006040518060600160405280604081526020016154ba60409139905060006003845160026139f19190614a84565b6139fb9190614059565b613a06906004614a9c565b6001600160401b03811115613a1d57613a1d614187565b6040519080825280601f01601f191660200182016040528015613a47576020820181803683370190505b509050600182016020820185865187015b80821015613ab3576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250613a58565b5050600386510660018114613acf5760028114613ae257613aea565b603d6001830353603d6002830353613aea565b603d60018303535b509195945050505050565b600082613b028584613e99565b14949350505050565b604051630a85bd0160e11b81526000906001600160a01b0385169063150b7a0290613b4090339089908890889060040161538d565b6020604051808303816000875af1925050508015613b7b575060408051601f3d908101601f19168201909252613b78918101906153ca565b60015b613bd9573d808015613ba9576040519150601f19603f3d011682016040523d82523d6000602084013e613bae565b606091505b508051600003613bd1576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050949350505050565b600081815260046020526040812054900361312757613c14816133e1565b60008281526004602052604090205550565b6000803a434244613c38600184614b93565b6040805160208101969096528501939093526060808501929092526080840152904060a083015233901b6bffffffffffffffffffffffff191660c082015260d40160408051601f19818403018152919052805160209091012092915050565b60008281526004602052604081205490819003613cc65760405162d5815360e01b815260040160405180910390fd5b6000928352600460205260409092206001600160e81b039290921660e89190911b179055565b6060833b6000819003613d0f575050604080516020810190915260008152610f21565b80841115613d2d575050604080516020810190915260008152610f21565b83831015613d5f5760405163162544fd60e11b81526004810182905260248101859052604481018490526064016103c2565b8383038482036000828210613d745782613d76565b815b60408051603f8301601f19168101909152818152955090508087602087018a3c505050509392505050565b60006001600160a01b03841615613db8578161257e565b61257e613c26565b6060815182604051602001613dd69291906153e7565b6040516020818303038152906040529050919050565b604080516080810182526000808252602082018190529181018290526060810191909152610d64613e1c836133e1565b604080516080810182526001600160a01b038316815260a083901c6001600160401b03166020820152600160e01b831615159181019190915260e89190911c606082015290565b8051602082019150808201602084510184015b81841015613e8e578351815260209384019301613e76565b505082510190915250565b600081815b84518110156138f0576000858281518110613ebb57613ebb614b1c565b60200260200101519050808311613ee15760008381526020829052604090209250613ef2565b600081815260208490526040902092505b5080613efd81614acf565b915050613e9e565b828054613f1190614ae8565b90600052602060002090601f016020900481019282613f335760008555613f79565b82601f10613f4c57805160ff1916838001178555613f79565b82800160010185558215613f79579182015b82811115613f79578251825591602001919060010190613f5e565b50613f85929150614018565b5090565b828054828255906000526020600020908101928215613f79579160200282015b82811115613f7957825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190613fa9565b828054828255906000526020600020908101928215613f795791602002820182811115613f79578251825591602001919060010190613f5e565b5b80821115613f855760008155600101614019565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000826140685761406861402d565b500490565b6001600160e01b03198116811461312757600080fd5b60006020828403121561409557600080fd5b8135610f218161406d565b60005b838110156140bb5781810151838201526020016140a3565b838111156110225750506000910152565b600081518084526140e48160208601602086016140a0565b601f01601f19169290920160200192915050565b602081526000610f2160208301846140cc565b60006020828403121561411d57600080fd5b5035919050565b80356001600160a01b0381168114610d1357600080fd5b6000806040838503121561414e57600080fd5b61415783614124565b946020939093013593505050565b6000806040838503121561417857600080fd5b50508035926020909101359150565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156141bf576141bf614187565b60405290565b60405160a081016001600160401b03811182821017156141bf576141bf614187565b604080519081016001600160401b03811182821017156141bf576141bf614187565b604051601f8201601f191681016001600160401b038111828210171561423157614231614187565b604052919050565b600082601f83011261424a57600080fd5b81356001600160401b0381111561426357614263614187565b614276601f8201601f1916602001614209565b81815284602083860101111561428b57600080fd5b816020850160208301376000918101602001919091529392505050565b6000602082840312156142ba57600080fd5b81356001600160401b03808211156142d157600080fd5b9083019060e082860312156142e557600080fd5b6142ed61419d565b8235828111156142fc57600080fd5b61430887828601614239565b82525060208301358281111561431d57600080fd5b61432987828601614239565b60208301525060408301358281111561434157600080fd5b61434d87828601614239565b60408301525060608301358281111561436557600080fd5b61437187828601614239565b60608301525060808301358281111561438957600080fd5b61439587828601614239565b60808301525060a083013560a082015260c0830135828111156143b757600080fd5b6143c387828601614239565b60c08301525095945050505050565b6000806000606084860312156143e757600080fd5b6143f084614124565b92506143fe60208501614124565b9150604084013590509250925092565b60e08152600061442160e083018a6140cc565b8281036020840152614433818a6140cc565b9050828103604084015261444781896140cc565b9050828103606084015261445b81886140cc565b9050828103608084015261446f81876140cc565b90508460a084015282810360c084015261448981856140cc565b9a9950505050505050505050565b6000602082840312156144a957600080fd5b81356001600160401b038111156144bf57600080fd5b61257e84828501614239565b60006001600160401b038211156144e4576144e4614187565b5060051b60200190565b80358015158114610d1357600080fd5b600060a0828403121561451057600080fd5b6145186141c5565b905081356001600160401b038082111561453157600080fd5b61453d85838601614239565b8352602084013591508082111561455357600080fd5b61455f85838601614239565b6020840152604084013591508082111561457857600080fd5b5061458584828501614239565b604083015250614597606083016144ee565b60608201526080820135608082015292915050565b600080604083850312156145bf57600080fd5b823591506020808401356001600160401b03808211156145de57600080fd5b818601915086601f8301126145f257600080fd5b8135614605614600826144cb565b614209565b81815260059190911b8301840190848101908983111561462457600080fd5b8585015b8381101561465c578035858111156146405760008081fd5b61464e8c89838a01016144fe565b845250918601918601614628565b508096505050505050509250929050565b60006020828403121561467f57600080fd5b610f2182614124565b6000806040838503121561469b57600080fd5b6146a483614124565b91506146b2602084016144ee565b90509250929050565b60008083601f8401126146cd57600080fd5b5081356001600160401b038111156146e457600080fd5b6020830191508360208260051b85010111156146ff57600080fd5b9250929050565b60008060006040848603121561471b57600080fd5b61472484614124565b925060208401356001600160401b0381111561473f57600080fd5b61474b868287016146bb565b9497909650939450505050565b600082601f83011261476957600080fd5b81356020614779614600836144cb565b82815260059290921b8401810191818101908684111561479857600080fd5b8286015b848110156147b3578035835291830191830161479c565b509695505050505050565b600060208083850312156147d157600080fd5b82356001600160401b03808211156147e857600080fd5b818501915085601f8301126147fc57600080fd5b813561480a614600826144cb565b81815260059190911b8301840190848101908883111561482957600080fd5b8585015b838110156148bc578035858111156148455760008081fd5b86016040818c03601f190181131561485d5760008081fd5b6148656141e7565b89830135888111156148775760008081fd5b6148858e8c83870101614758565b82525090820135908782111561489b5760008081fd5b6148a98d8b84860101614758565b818b01528552505091860191860161482d565b5098975050505050505050565b600080600080608085870312156148df57600080fd5b6148e885614124565b93506148f660208601614124565b92506040850135915060608501356001600160401b0381111561491857600080fd5b61492487828801614239565b91505092959194509250565b60008060006040848603121561494557600080fd5b8335925060208401356001600160401b0381111561473f57600080fd5b60008060006060848603121561497757600080fd5b833592506020840135915060408401356001600160401b0381111561499b57600080fd5b6149a7868287016144fe565b9150509250925092565b600080604083850312156149c457600080fd5b823591506146b2602084016144ee565b6020808252825182820181905260009190848201906040850190845b81811015614a0c578351835292840192918401916001016149f0565b50909695505050505050565b60008060408385031215614a2b57600080fd5b614a3483614124565b91506146b260208401614124565b602081526000825160406020840152614a5e60608401826140cc565b90506020840151601f19848303016040850152614a7b82826140cc565b95945050505050565b60008219821115614a9757614a97614043565b500190565b6000816000190483118215151615614ab657614ab6614043565b500290565b600082614aca57614aca61402d565b500690565b600060018201614ae157614ae1614043565b5060010190565b600181811c90821680614afc57607f821691505b6020821081036135e357634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526012908201527110dbdb9d1c9858dd081a5cc81cd9585b195960721b604082015260600190565b600082821015614ba557614ba5614043565b500390565b8054600090600181811c9080831680614bc457607f831692505b60208084108203614be557634e487b7160e01b600052602260045260246000fd5b818015614bf95760018114614c0a57614c37565b60ff19861689528489019650614c37565b60008881526020902060005b86811015614c2f5781548b820152908501908301614c16565b505084890196505b50505050505092915050565b6e3d913a3930b4ba2fba3cb832911d1160891b81526000614c67600f830185614baa565b6a1116113b30b63ab2911d1160a91b8152614c85600b820185614baa565b61227d60f01b815260020195945050505050565b6000614ca58284614baa565b75076c4c2c6d6cee4deeadcc85ad2dac2ceca74eae4d8560531b81526016019392505050565b643230ba309d60d91b81526000614ce56005830185614baa565b670ed8985cd94d8d0b60c21b81528351614d068160088401602088016140a0565b6505258eae4d8560d31b60089290910191820152600e01949350505050565b643230ba309d60d91b81526000614d3f6005830185614baa565b670ed8985cd94d8d0b60c21b81528351614d608160088401602088016140a0565b7f293b6261636b67726f756e642d7265706561743a6e6f2d7265706561743b6261600892909101918201527f636b67726f756e642d73697a653a636f6e7461696e3b6261636b67726f756e6460288201527f2d706f736974696f6e3a63656e7465723b696d6167652d72656e646572696e6760488201527f3a2d7765626b69742d6f7074696d697a652d636f6e74726173743b2d6d732d6960688201527f6e746572706f6c6174696f6e2d6d6f64653a6e6561726573742d6e656967686260888201527f6f723b696d6167652d72656e646572696e673a2d6d6f7a2d63726973702d656460a88201527f6765733b696d6167652d72656e646572696e673a706978656c617465643b223e60c8820152651e17b9bb339f60d11b60e882015260ee01949350505050565b7f646174613a696d6167652f7376672b786d6c3b6261736536342c000000000000815260008251614ec181601a8501602087016140a0565b91909101601a0192915050565b60008351614ee08184602088016140a0565b701116113232b9b1b934b83a34b7b7111d1160791b908301908152614f086011820185614baa565b61088b60f21b815260020195945050505050565b681134b6b0b3b2911d1160b91b81526000614f3a6009830186614baa565b8451614f4a8183602089016140a0565b643f646e613d60d81b91019081528351614f6b8160058401602088016140a0565b71099b995d1ddbdc9acf5b585a5b9b995d088b60721b6005929091019182015260170195945050505050565b7f3c7376672077696474683d223130302522206865696768743d2231303025222081527f76696577426f783d2230203020313230302031323030222076657273696f6e3d60208201527f22312e322220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f3260408201527f3030302f737667223e3c696d6167652077696474683d2231323030222068656960608201527033b43a1e91189918181110343932b31e9160791b60808201526000825161505b8160918501602087016140a0565b6f111f1e17b4b6b0b3b29f1e17b9bb339f60811b609193909101928301525060a101919050565b711139bb33afb4b6b0b3b2afb230ba30911d1160711b815281516000906150b08160128501602087016140a0565b61088b60f21b6012939091019283015250601401919050565b6d1134b6b0b3b2afb230ba30911d1160911b815281516000906150f381600e8501602087016140a0565b61088b60f21b600e939091019283015250601001919050565b6c1130ba3a3934b13aba32b9911d60991b8152815160009061513581600d8501602087016140a0565b607d60f81b600d939091019283015250600e01919050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c00000081526000825161518581601d8501602087016140a0565b91909101601d0192915050565b683d913730b6b2911d1160b91b815260006151b0600983018a614baa565b701116113232b9b1b934b83a34b7b7111d1160791b81526151d4601182018a614baa565b6a11161134b6b0b3b2911d1160a91b815290506151f4600b820189614baa565b6b1116113130b73732b9111d1160a11b81529050615215600c820188614baa565b7211161132bc3a32b93730b62fb634b735911d1160691b8152905061523d6013820187614baa565b90507f222c2273656c6c65725f6665655f62617369735f706f696e7473223a000000008152845161527581601c8401602089016140a0565b7116113332b2afb932b1b4b834b2b73a111d1160711b601c92909101918201526152a2602e820185614baa565b61227d60f01b81526002019a9950505050505050505050565b60008152600082516152d48160018501602087016140a0565b9190910160010192915050565b600060ff821660ff84168160ff048111821515161561530257615302614043565b029392505050565b600060ff821660ff84168082101561532457615324614043565b90039392505050565b600060ff821660ff84168060ff0382111561534a5761534a614043565b019392505050565b600060ff821660ff810361536857615368614043565b60010192915050565b600082516153838184602087016140a0565b9190910192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906153c0908301846140cc565b9695505050505050565b6000602082840312156153dc57600080fd5b8151610f218161406d565b606360f81b815260e083901b6001600160e01b03191660018201526880600e6000396000f360b81b6005820152815160009061542a81600e8501602087016140a0565b91909101600e01939250505056fe3c7376672077696474683d223132303022206865696768743d2231323030222076696577426f783d2230203020313230302031323030222076657273696f6e3d22312e322220786d6c6e733d22687474703a2f2f7777772e77332e6f72672f323030302f73766722207374796c653d226261636b67726f756e642d636f6c6f723a4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212208cc1d68d903b214b2a9d3cce9573f98f441eebc402deb9f1a7a3b06444a296eb64736f6c634300080e003368747470733a2f2f696e64656c69626c656c6162732d70726f642e73332e75732d656173742d322e616d617a6f6e6177732e636f6d2f70726f66696c652f66636662613535392d366130372d343738342d616630322d64646137626361626261643168747470733a2f2f696e64656c69626c656c6162732d70726f642e73332e75732d656173742d322e616d617a6f6e6177732e636f6d2f62616e6e65722f66636662613535392d366130372d343738342d616630322d64646137626361626261643130784435303342383962333945356438323033393965393442613632353062393066413232423938313235303030204f6e2d436861696e205068756e6b732c207265696d6167696e65642c2041504553206f6e6c792e2020204343302020202d202020302520526f79616c746965732c20696e2074727565205068756e6b207068617368696f6e2c20746869732070726f6a65637420697320666f722074686520636f6d6d756e6974792e205068756e6b20417065204f726967696e73207061797320686f6d61676520746f207468652043727970746f5068756e6b2063756c747572652061732077656c6c20617320746f2074686520477265617420417065732e

Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.