ETH Price: $3,278.91 (-1.57%)

Token

Memories of an Automaton (MOAA)
 

Overview

Max Total Supply

189 MOAA

Holders

152

Market

Volume (24H)

N/A

Min Price (24H)

N/A

Max Price (24H)

N/A

Other Info

Filtered by Token Holder
journeyofcuriosity.eth
Balance
1 MOAA
0xFFf2558F75B107eC4a079C70f71288e84AC90Fd5
Loading...
Loading
Loading...
Loading
Loading...
Loading

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

Contract Source Code Verified (Exact Match)

Contract Name:
MOAA

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 26 : MOAA.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "gwei-slim-nft-contracts/contracts/base/ERC721Base.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC721Delegated} from "gwei-slim-nft-contracts/contracts/base/ERC721Delegated.sol";
import "@0xdievardump/signed-allowances/contracts/SignedAllowance.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "base64-sol/base64.sol";

//Memories of an Autómaton
//@creator: nyx // @opusnyx
//@author: secondstate // @sec0ndstate
//
//
//  .............................................................
//  .............................................................
//  .............................................................
//  .............................................................
//  .............................................................
//  .............................................................
//  ._____.______.......________......________......________.....
//  |\..._.\.._...\....|\...__..\....|\...__..\....|\...__..\....
//  \.\..\\\__\.\..\...\.\..\|\..\...\.\..\|\..\...\.\..\|\..\...
//  .\.\..\\|__|.\..\...\.\..\\\..\...\.\...__..\...\.\...__..\..
//  ..\.\..\....\.\..\...\.\..\\\..\...\.\..\.\..\...\.\..\.\..\.
//  ...\.\__\....\.\__\...\.\_______\...\.\__\.\__\...\.\__\.\__\
//  ....\|__|.....\|__|....\|_______|....\|__|\|__|....\|__|\|__|
//  .............................................................
//  .............................................................
//  .............................................................
//  .............................................................
//  .............................................................
//  .............................................................

contract MOAA is ERC721Delegated, SignedAllowance {

    // uint256 internal _currentPMIndex;
    uint256 internal _currentMemoriaIndex;
    uint256 internal _currentAutomatonIndex;
    uint256 internal _saleState;

    constructor(
        address baseFactory,
        address allowanceSigner_
    ) 
     ERC721Delegated(
            baseFactory,
            "Memories of an Automaton",
            "MOAA",
            ConfigSettings({
                royaltyBps: 1000,
                uriBase: "",
                uriExtension: "",
                hasTransferHook: false
            })
        )
    {
            // _currentPMIndex = 0; // 0 is reserved for PuppetMaster - but we do not keep track
            _currentAutomatonIndex = 1; // 1 is the first token id for Automaton
            _currentMemoriaIndex = 101; //101 is the first token id for Memoria
            _saleState = 1; //1 = closed - only admin can mint, 2 = public sale - no checks for WL, 3 = private sale - checks for WL
            _setAllowancesSigner(allowanceSigner_);
    }

    struct UserMinted {
        bool mintedFirst;
        bool mintedSecond;
    }


    struct ConfigStorage {
        string puppetMasterUrl;
        string automatonUrl;
        string memoriaUrl;
        uint256 AutomatonPrice;
        uint256 MemoriaPrice;
        address operator;
    }
    ConfigStorage confStorage;


    mapping(address => UserMinted) private _userMinted;


    address private ash = 0x64D91f12Ece7362F91A6f8E7940Cd55F05060b92;
    address private payout = 0x62799023aD27358DF30516742216DFCa60d427c8;


////////////////////////////////////////
/////////////// SETTERS /////////////////
////////////////////////////////////////

    /// @notice sets allowance signer, this can be used to revoke all unused allowances already out there
    /// @param newSigner the new signer
    function setAllowancesSigner(address newSigner) external onlyOperator {
        _setAllowancesSigner(newSigner);
    }

    function changeSaleState(uint256 newState) external onlyOperator {
        _saleState = newState;
    }

        function setOperator(address newOperator) external onlyOperator {
        confStorage.operator = newOperator;
    }


    function setUrls(string memory _PMUrl, string memory _MemoriaUrl, string memory _AutomatonUrl) external onlyOperator {
        confStorage.puppetMasterUrl = _PMUrl;
        confStorage.memoriaUrl = _MemoriaUrl;
        confStorage.automatonUrl = _AutomatonUrl;
    }


    function setPrice(uint64 _AutomatonPrice, uint64 _MemoriaPrice) external onlyOperator {
        confStorage.AutomatonPrice = _AutomatonPrice;
        confStorage.MemoriaPrice = _MemoriaPrice;
    }


////////////////////////////////////////
/////////////// GETTERS /////////////////
////////////////////////////////////////

    function getSaleState() public view returns (uint256) {
        return _saleState;
    }


////////////////////////////////////////
/////////////// MODIFIERS //////////////
////////////////////////////////////////

    modifier onlyOperator() {
     require(msg.sender == ERC721Delegated._owner() || msg.sender == confStorage.operator, 'Not Authorized');
        _;
    }


////////////////////////////////////////
/////////////// MINTING /////////////////
////////////////////////////////////////
 

    function adminMint(address to, uint256 _selectedToken,uint256 tokenId) public onlyOperator {
        require(_selectedToken == 1 || _selectedToken == 2 || _selectedToken == 0, "Selector must be 1 Automaton 2 for memoria, 0 for PM");
        if (_selectedToken == 0 && tokenId == 0) {
            tokenId = tokenId;
        } else if (_selectedToken == 1 && tokenId == 0) {
            tokenId = _currentAutomatonIndex;
            while(_exists(tokenId)) {
            unchecked {
                tokenId++;
            }
      }
            require(_currentAutomatonIndex < 101, "Exceeds max supply of Automaton.");
            _currentAutomatonIndex = tokenId;
        } else if (_selectedToken == 2 && tokenId == 0) {
            tokenId = _currentMemoriaIndex;
            while(_exists(tokenId)) {
            unchecked {
                tokenId++;
            }
        }
            require(_currentMemoriaIndex < 401, "Exceeds max supply of Memoria.");
            _currentMemoriaIndex = tokenId;
        }
        _mint(to, tokenId);
    }


    /// @notice This function allows `nonce` mint per allowance.
    /// @param _selectedToken the tokenId to mint
    /// @param nonce the nonce, which is also the number of mint allowed for this signature
    /// @param signature the signature by the allowance wallet
    function publicPurchase(uint256 _selectedToken,uint256 nonce, bytes memory signature) external {
        require(_selectedToken == 1 || _selectedToken == 2, "Selector must be 1 Automaton or 2 for Memoria");
        uint256 nonceTier = nonce >> 128;
        UserMinted storage alreadyMinted = _userMinted[msg.sender];
        require(_saleState == 2 || _saleState == 3, "Sale is not open to public/private purchases.");
        uint256 tokenId;
        if (_selectedToken == 1) {
            require(_currentAutomatonIndex < 101, "Exceeds max supply of Automaton.");
            require(IERC20(ash).transferFrom(msg.sender, payout, confStorage.AutomatonPrice * 10 ** 18), "$ASH transfer failed"); 
            if (_saleState == 3) { // check for private sale first
                validateSignature(msg.sender, nonce, signature);
                require (nonceTier == 1 || nonceTier == 3, "Nonce tier must be 1 or 3"); // 1 for Automaton only, 3 for Automaton and Memoria
                require(alreadyMinted.mintedFirst == false, "Already minted Automaton allowance.");
                alreadyMinted.mintedFirst = true;
            }
            tokenId = _currentAutomatonIndex;
            while(_exists(tokenId)) {
            unchecked {
                tokenId++;
            }
      }
            _currentAutomatonIndex = tokenId;

        } else if (_selectedToken == 2) {
            require(_currentMemoriaIndex < 401, "Exceeds max supply of Memoria.");
            require(IERC20(ash).transferFrom(msg.sender, payout, confStorage.MemoriaPrice * 10 ** 18), "$ASH transfer failed"); 
            if (_saleState == 3) { // check for private sale first
                require (nonceTier == 2 || nonceTier == 3, "Nonce tier must be 2 or 3"); // 2 for Memoria only, 3 for Automaton and Memoria
                require(alreadyMinted.mintedSecond == false, "Already minted Memoria allowance.");
                alreadyMinted.mintedSecond = true;
            }
            tokenId = _currentMemoriaIndex;
            while(_exists(tokenId)) {
            unchecked {
                tokenId++;
            }
            }
            _currentMemoriaIndex = tokenId;

        }
            _mint(msg.sender, tokenId);
    }



    function tokenURI(uint256 tokenId) external view returns (string memory) {
        require(_exists(tokenId), "Unknown token");
        string memory MemoriaUrl = string(abi.encodePacked(confStorage.memoriaUrl, Strings.toHexString(uint256(uint160((ERC721Base(address(this)).ownerOf(tokenId)))), 20)));
        string memory AutomatonUrl = string(abi.encodePacked(confStorage.automatonUrl, Strings.toHexString(uint256(uint160((ERC721Base(address(this)).ownerOf(tokenId)))), 20)));
        string memory PMUrl = string(abi.encodePacked(confStorage.puppetMasterUrl, Strings.toHexString(uint256(uint160((ERC721Base(address(this)).ownerOf(tokenId)))), 20)));

        string memory automatonImage = string(abi.encodePacked("https://arweave.net/-5BT4N6nFxExBM-QkrXk44aoxPmUxARFDs5joJcml2s"));
        string memory memoriaImage = string(abi.encodePacked("https://arweave.net/yHDh1K0sE0STZqmMesomaD1p7mkd4_CrWrwTrKsjIME"));
        string memory json;
        if(tokenId == 0) {
            json = string(
            abi.encodePacked( 
                '{"name": "Puppet Master #0/0",',
                '"description": "2501",',
                '"created_by": "nyx x secondstate",',
                '"image": "', automatonImage, '",'
                '"image_url": "', automatonImage, '",',
                '"animation_url": "', PMUrl, '",',
                '"attributes":[',
                '{"trait_type":"Archillect","value":"TV"},{"trait_type":"Artist","value":"Nyx"},{"trait_type":"Artist","value":"secondstate"}',
                "]}"
            )
        );  // tokenId must be between the 1 and 100 range 
        } else if (tokenId > 0 && tokenId < 101) {
            json = string(
            abi.encodePacked( 
                '{"name": "Aut\xC3\xB3maton #', Strings.toString(tokenId), '/100",',
                '"description": "She whispered...",',
                '"created_by": "nyx x secondstate",',
                '"image": "', automatonImage, '",'
                '"image_url": "', automatonImage, '",',
                '"animation_url": "', AutomatonUrl, '",',
                '"attributes":[',
                '{"trait_type":"Artist","value":"Nyx"},{"trait_type":"Artist","value":"secondstate"},{"trait_type":"Extrinsic","value":"DannyWithThreeBrains"}',
                "]}"
            )
        );// tokenId must be between the 101 and 400 range
        } else if (tokenId > 100 && tokenId < 401) {
            json = string(
            abi.encodePacked( 
                '{"name": "Memoria #', Strings.toString(tokenId - 100), '/300",',
                '"description": "Awake but dreaming...",',
                '"created_by": "nyx x secondstate",',
                '"image": "', memoriaImage, '",'
                '"image_url": "', memoriaImage, '",',
                '"animation_url": "', MemoriaUrl, '",',
                '"attributes":[',
                '{"trait_type":"Artist","value":"Nyx"},{"trait_type":"Artist","value":"secondstate"},{"trait_type":"Intrinsic","value":"DannyWithThreeBrains"}',
                "]}"
            )
        );
        }
        return string(abi.encodePacked('data:application/json;base64,', Base64.encode(bytes(json))));
    }
        }

File 2 of 26 : base64.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0;

/// @title Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides functions for encoding/decoding base64
library Base64 {
    string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    bytes  internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
                                            hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000"
                                            hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000"
                                            hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000";

    function encode(bytes memory data) internal pure returns (string memory) {
        if (data.length == 0) return '';

        // load the table into memory
        string memory table = TABLE_ENCODE;

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((data.length + 2) / 3);

        // add some extra buffer at the end required for the writing
        string memory result = new string(encodedLen + 32);

        assembly {
            // set the actual output length
            mstore(result, encodedLen)

            // prepare the lookup table
            let tablePtr := add(table, 1)

            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

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

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

                // write 4 characters
                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F))))
                resultPtr := add(resultPtr, 1)
                mstore8(resultPtr, mload(add(tablePtr, and(        input,  0x3F))))
                resultPtr := add(resultPtr, 1)
            }

            // padding with '='
            switch mod(mload(data), 3)
            case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) }
            case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) }
        }

        return result;
    }

    function decode(string memory _data) internal pure returns (bytes memory) {
        bytes memory data = bytes(_data);

        if (data.length == 0) return new bytes(0);
        require(data.length % 4 == 0, "invalid base64 decoder input");

        // load the table into memory
        bytes memory table = TABLE_DECODE;

        // every 4 characters represent 3 bytes
        uint256 decodedLen = (data.length / 4) * 3;

        // add some extra buffer at the end required for the writing
        bytes memory result = new bytes(decodedLen + 32);

        assembly {
            // padding with '='
            let lastBytes := mload(add(data, mload(data)))
            if eq(and(lastBytes, 0xFF), 0x3d) {
                decodedLen := sub(decodedLen, 1)
                if eq(and(lastBytes, 0xFFFF), 0x3d3d) {
                    decodedLen := sub(decodedLen, 1)
                }
            }

            // set the actual output length
            mstore(result, decodedLen)

            // prepare the lookup table
            let tablePtr := add(table, 1)

            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

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

            // run over the input, 4 characters at a time
            for {} lt(dataPtr, endPtr) {}
            {
               // read 4 characters
               dataPtr := add(dataPtr, 4)
               let input := mload(dataPtr)

               // write 3 bytes
               let output := add(
                   add(
                       shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)),
                       shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))),
                   add(
                       shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)),
                               and(mload(add(tablePtr, and(        input , 0xFF))), 0xFF)
                    )
                )
                mstore(resultPtr, shl(232, output))
                resultPtr := add(resultPtr, 3)
            }
        }

        return result;
    }
}

File 3 of 26 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 4 of 26 : SignedAllowance.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol';

/// @title SignedAllowance
/// @author Simon Fremaux (@dievardump)
contract SignedAllowance {
    using ECDSA for bytes32;

    // list of already used allowances
    mapping(bytes32 => bool) public usedAllowances;

    // address used to sign the allowances
    address private _allowancesSigner;

    /// @notice Helper to know allowancesSigner address
    /// @return the allowance signer address
    function allowancesSigner() public view virtual returns (address) {
        return _allowancesSigner;
    }

    /// @notice Helper that creates the message that signer needs to sign to allow a mint
    ///         this is usually also used when creating the allowances, to ensure "message"
    ///         is the same
    /// @param account the account to allow
    /// @param nonce the nonce
    /// @return the message to sign
    function createMessage(address account, uint256 nonce)
        public
        view
        returns (bytes32)
    {
        return keccak256(abi.encode(account, nonce, address(this)));
    }

    /// @notice Helper that creates a list of messages that signer needs to sign to allow mintings
    /// @param accounts the accounts to allow
    /// @param nonces the corresponding nonces
    /// @return messages the messages to sign
    function createMessages(address[] memory accounts, uint256[] memory nonces)
        external
        view
        returns (bytes32[] memory messages)
    {
        require(accounts.length == nonces.length, '!LENGTH_MISMATCH!');
        messages = new bytes32[](accounts.length);
        for (uint256 i; i < accounts.length; i++) {
            messages[i] = createMessage(accounts[i], nonces[i]);
        }
    }

    /// @notice This function verifies that the current request is valid
    /// @dev It ensures that _allowancesSigner signed a message containing (account, nonce, address(this))
    ///      and that this message was not already used
    /// @param account the account the allowance is associated to
    /// @param nonce the nonce associated to this allowance
    /// @param signature the signature by the allowance signer wallet
    /// @return the message to mark as used
    function validateSignature(
        address account,
        uint256 nonce,
        bytes memory signature
    ) public view returns (bytes32) {
        return
            _validateSignature(account, nonce, signature, allowancesSigner());
    }

    /// @dev It ensures that signer signed a message containing (account, nonce, address(this))
    ///      and that this message was not already used
    /// @param account the account the allowance is associated to
    /// @param nonce the nonce associated to this allowance
    /// @param signature the signature by the allowance signer wallet
    /// @param signer the signer
    /// @return the message to mark as used
    function _validateSignature(
        address account,
        uint256 nonce,
        bytes memory signature,
        address signer
    ) internal view returns (bytes32) {
        bytes32 message = createMessage(account, nonce)
            .toEthSignedMessageHash();

        // verifies that the sha3(account, nonce, address(this)) has been signed by signer
        require(message.recover(signature) == signer, '!INVALID_SIGNATURE!');

        // verifies that the allowances was not already used
        require(usedAllowances[message] == false, '!ALREADY_USED!');

        return message;
    }

    /// @notice internal function that verifies an allowance and marks it as used
    ///         this function throws if signature is wrong or this nonce for this user has already been used
    /// @param account the account the allowance is associated to
    /// @param nonce the nonce
    /// @param signature the signature by the allowance wallet
    function _useAllowance(
        address account,
        uint256 nonce,
        bytes memory signature
    ) internal {
        bytes32 message = validateSignature(account, nonce, signature);
        usedAllowances[message] = true;
    }

    /// @notice Allows to change the allowance signer. This can be used to revoke any signed allowance not already used
    /// @param newSigner the new signer address
    function _setAllowancesSigner(address newSigner) internal {
        _allowancesSigner = newSigner;
    }
}

File 5 of 26 : ERC721Delegated.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;

import {StorageSlotUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/StorageSlotUpgradeable.sol";

import {IBaseERC721Interface, ConfigSettings} from "./ERC721Base.sol";

contract ERC721Delegated {
    uint256[100000] gap;
    bytes32 internal constant _IMPLEMENTATION_SLOT =
        0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    // Reference to base NFT implementation
    function implementation() public view returns (address) {
        return
            StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value;
    }

    function _initImplementation(address _nftImplementation) private {
        StorageSlotUpgradeable
            .getAddressSlot(_IMPLEMENTATION_SLOT)
            .value = _nftImplementation;
    }

    /// Constructor that sets up the
    constructor(
        address _nftImplementation,
        string memory name,
        string memory symbol,
        ConfigSettings memory settings
    ) {
        /// Removed for gas saving reasons, the check below implictly accomplishes this
        // require(
        //     _nftImplementation.supportsInterface(
        //         type(IBaseERC721Interface).interfaceId
        //     )
        // );
        _initImplementation(_nftImplementation);
        (bool success, ) = _nftImplementation.delegatecall(
            abi.encodeWithSignature(
                "initialize(address,string,string,(uint16,string,string,bool))",
                msg.sender,
                name,
                symbol,
                settings
            )
        );
        require(success);
    }

    /// OnlyOwner implemntation that proxies to base ownable contract for info
    modifier onlyOwner() {
        require(msg.sender == base().__owner(), "Not owner");
        _;
    }

    /// Getter to return the base implementation contract to call methods from
    /// Don't expose base contract to parent due to need to call private internal base functions
    function base() private view returns (IBaseERC721Interface) {
        return IBaseERC721Interface(address(this));
    }

    // helpers to mimic Openzeppelin internal functions

    /// Getter for the contract owner
    /// @return address owner address
    function _owner() internal view returns (address) {
        return base().__owner();
    }

    /// Internal burn function, only accessible from within contract
    /// @param id nft id to burn
    function _burn(uint256 id) internal {
        base().__burn(id);
    }

    /// Internal mint function, only accessible from within contract
    /// @param to address to mint NFT to
    /// @param id nft id to mint
    function _mint(address to, uint256 id) internal {
        base().__mint(to, id);
    }

    /// Internal exists function to determine if fn exists
    /// @param id nft id to check if exists
    function _exists(uint256 id) internal view returns (bool) {
        return base().__exists(id);
    }

    /// Internal getter for tokenURI
    /// @param tokenId id of token to get tokenURI for
    function _tokenURI(uint256 tokenId) internal view returns (string memory) {
        return base().__tokenURI(tokenId);
    }

    /// is approved for all getter underlying getter
    /// @param owner to check
    /// @param operator to check
    function _isApprovedForAll(address owner, address operator)
        internal
        view
        returns (bool)
    {
        return base().__isApprovedForAll(owner, operator);
    }

    /// Internal getter for approved or owner for a given operator
    /// @param operator address of operator to check
    /// @param id id of nft to check for
    function _isApprovedOrOwner(address operator, uint256 id)
        internal
        view
        returns (bool)
    {
        return base().__isApprovedOrOwner(operator, id);
    }

    /// Sets the base URI of the contract. Allowed only by parent contract
    /// @param newUri new uri base (http://URI) followed by number string of nft followed by extension string
    /// @param newExtension optional uri extension
    function _setBaseURI(string memory newUri, string memory newExtension)
        internal
    {
        base().__setBaseURI(newUri, newExtension);
    }

    /**
     * @dev Delegates the current call to nftImplementation.
     *
     * This function does not return to its internall call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        address impl = implementation();

        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), impl, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external virtual {
        _fallback();
    }

    /**
     * @dev No base NFT functions receive any value
     */
    receive() external payable {
        revert();
    }
}

File 6 of 26 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC20} uses, unless this function is
     * overridden;
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `sender` to `recipient`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 7 of 26 : ERC721Base.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;

import {ERC721Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol";
import {IERC2981Upgradeable, IERC165Upgradeable} from "@openzeppelin/contracts-upgradeable/interfaces/IERC2981Upgradeable.sol";
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {StringsUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol";
import {CountersUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol";
import {IBaseERC721Interface} from "./IBaseERC721Interface.sol";

struct ConfigSettings {
    uint16 royaltyBps;
    string uriBase;
    string uriExtension;
    bool hasTransferHook;
}

/**
    This smart contract adds features and allows for a ownership only by another smart contract as fallback behavior
    while also implementing all normal ERC721 functions as expected
*/
contract ERC721Base is
    ERC721Upgradeable,
    IBaseERC721Interface,
    IERC2981Upgradeable,
    OwnableUpgradeable
{
    using CountersUpgradeable for CountersUpgradeable.Counter;
    // Minted counter for totalSupply()
    CountersUpgradeable.Counter private mintedCounter;

    modifier onlyInternal() {
        require(msg.sender == address(this), "Only internal");
        _;
    }

    /// on-chain record of when this contract was deployed
    uint256 public immutable deployedBlock;

    ConfigSettings public advancedConfig;

    /// Constructor called once when the base contract is deployed
    constructor() {
        // Can be used to verify contract implementation is correct at address
        deployedBlock = block.number;
    }

    /// Initializer that's called when a new child nft is setup
    /// @param newOwner Owner for the new derived nft
    /// @param _name name of NFT contract
    /// @param _symbol symbol of NFT contract
    /// @param settings configuration settings for uri, royalty, and hooks features
    function initialize(
        address newOwner,
        string memory _name,
        string memory _symbol,
        ConfigSettings memory settings
    ) public initializer {
        __ERC721_init(_name, _symbol);
        __Ownable_init();

        advancedConfig = settings;

        transferOwnership(newOwner);
    }

    /// Getter to expose appoval status to root contract
    function isApprovedForAll(address _owner, address operator)
        public
        view
        override
        returns (bool)
    {
        return
            ERC721Upgradeable.isApprovedForAll(_owner, operator) ||
            operator == address(this);
    }

    /// internal getter for approval by all
    /// When isApprovedForAll is overridden, this can be used to call original impl
    function __isApprovedForAll(address _owner, address operator)
        public
        view
        override
        returns (bool)
    {
        return isApprovedForAll(_owner, operator);
    }

    /// Hook that when enabled manually calls _beforeTokenTransfer on
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal override {
        if (advancedConfig.hasTransferHook) {
            (bool success, ) = address(this).delegatecall(
                abi.encodeWithSignature(
                    "_beforeTokenTransfer(address,address,uint256)",
                    from,
                    to,
                    tokenId
                )
            );
            // Raise error again from result if error exists
            assembly {
                switch success
                // delegatecall returns 0 on error.
                case 0 {
                    returndatacopy(0, 0, returndatasize())
                    revert(0, returndatasize())
                }
            }
        }
    }

    /// Internal-only function to update the base uri
    function __setBaseURI(string memory uriBase, string memory uriExtension)
        public
        override
        onlyInternal
    {
        advancedConfig.uriBase = uriBase;
        advancedConfig.uriExtension = uriExtension;
    }

    /// @dev returns the number of minted tokens
    /// uses some extra gas but makes etherscan and users happy so :shrug:
    /// partial erc721enumerable implemntation
    function totalSupply() public view returns (uint256) {
        return mintedCounter.current();
    }

    /**
      Internal-only
      @param to address to send the newly minted NFT to
      @dev This mints one edition to the given address by an allowed minter on the edition instance.
     */
    function __mint(address to, uint256 tokenId)
        external
        override
        onlyInternal
    {
        _mint(to, tokenId);
        mintedCounter.increment();
    }

    /**
        @param tokenId Token ID to burn
        User burn function for token id 
     */
    function burn(uint256 tokenId) public {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "Not allowed");
        _burn(tokenId);
        mintedCounter.decrement();
    }

    /// Internal only
    function __burn(uint256 tokenId) public onlyInternal {
        _burn(tokenId);
        mintedCounter.decrement();
    }

    /**
        Simple override for owner interface.
     */
    function owner()
        public
        view
        override(OwnableUpgradeable)
        returns (address)
    {
        return super.owner();
    }

    /// internal alias for overrides
    function __owner()
        public
        view
        override(IBaseERC721Interface)
        returns (address)
    {
        return owner();
    }

    /// Get royalty information for token
    /// ignored token id to get royalty info. able to override and set per-token royalties
    /// @param _salePrice sales price for token to determine royalty split
    function royaltyInfo(uint256, uint256 _salePrice)
        external
        view
        override
        returns (address receiver, uint256 royaltyAmount)
    {
        // If ownership is revoked, don't set royalties.
        if (owner() == address(0x0)) {
            return (owner(), 0);
        }
        return (owner(), (_salePrice * advancedConfig.royaltyBps) / 10_000);
    }

    /// Default simple token-uri implementation. works for ipfs folders too
    /// @param tokenId token id ot get uri for
    /// @return default uri getter functionality
    function tokenURI(uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        require(_exists(tokenId), "No token");

        return
            string(
                abi.encodePacked(
                    advancedConfig.uriBase,
                    StringsUpgradeable.toString(tokenId),
                    advancedConfig.uriExtension
                )
            );
    }

    /// internal base override
    function __tokenURI(uint256 tokenId)
        public
        view
        onlyInternal
        returns (string memory)
    {
        return tokenURI(tokenId);
    }

    /// Exposing token exists check for base contract
    function __exists(uint256 tokenId) external view override returns (bool) {
        return _exists(tokenId);
    }

    /// Getter for approved or owner
    function __isApprovedOrOwner(address spender, uint256 tokenId)
        external
        view
        override
        onlyInternal
        returns (bool)
    {
        return _isApprovedOrOwner(spender, tokenId);
    }

    /// IERC165 getter
    /// @param interfaceId interfaceId bytes4 to check support for
    function supportsInterface(bytes4 interfaceId)
        public
        view
        override(ERC721Upgradeable, IERC165Upgradeable)
        returns (bool)
    {
        return
            type(IERC2981Upgradeable).interfaceId == interfaceId ||
            type(IBaseERC721Interface).interfaceId == interfaceId ||
            ERC721Upgradeable.supportsInterface(interfaceId);
    }
}

File 8 of 26 : StorageSlotUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/StorageSlot.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC1967 implementation slot:
 * ```
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._
 */
library StorageSlotUpgradeable {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly {
            r.slot := slot
        }
    }
}

File 9 of 26 : IBaseERC721Interface.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.9;

/// Additional features and functions assigned to the
/// Base721 contract for hooks and overrides
interface IBaseERC721Interface {
    /*
     Exposing common NFT internal functionality for base contract overrides
     To save gas and make API cleaner this is only for new functionality not exposed in
     the core ERC721 contract
    */

    /// Mint an NFT. Allowed to mint by owner, approval or by the parent contract
    /// @param tokenId id to burn
    function __burn(uint256 tokenId) external;

    /// Mint an NFT. Allowed only by the parent contract
    /// @param to address to mint to
    /// @param tokenId token id to mint
    function __mint(address to, uint256 tokenId) external;

    /// Set the base URI of the contract. Allowed only by parent contract
    /// @param base base uri
    /// @param extension extension
    function __setBaseURI(string memory base, string memory extension) external;

    /* Exposes common internal read features for public use */

    /// Token exists
    /// @param tokenId token id to see if it exists
    function __exists(uint256 tokenId) external view returns (bool);

    /// Simple approval for operation check on token for address
    /// @param spender address spending/changing token
    /// @param tokenId tokenID to change / operate on
    function __isApprovedOrOwner(address spender, uint256 tokenId)
        external
        view
        returns (bool);

    function __isApprovedForAll(address owner, address operator)
        external
        view
        returns (bool);

    function __tokenURI(uint256 tokenId) external view returns (string memory);

    function __owner() external view returns (address);
}

File 10 of 26 : CountersUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library CountersUpgradeable {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 11 of 26 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 12 of 26 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _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);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 13 of 26 : IERC2981Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)

pragma solidity ^0.8.0;

import "../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev Interface for the NFT Royalty Standard.
 *
 * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
 * support for royalty payments across all NFT marketplaces and ecosystem participants.
 *
 * _Available since v4.5._
 */
interface IERC2981Upgradeable is IERC165Upgradeable {
    /**
     * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
     * exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
     */
    function royaltyInfo(uint256 tokenId, uint256 salePrice)
        external
        view
        returns (address receiver, uint256 royaltyAmount);
}

File 14 of 26 : ERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721Upgradeable.sol";
import "./IERC721ReceiverUpgradeable.sol";
import "./extensions/IERC721MetadataUpgradeable.sol";
import "../../utils/AddressUpgradeable.sol";
import "../../utils/ContextUpgradeable.sol";
import "../../utils/StringsUpgradeable.sol";
import "../../utils/introspection/ERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable {
    using AddressUpgradeable for address;
    using StringsUpgradeable for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

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

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    function __ERC721_init(string memory name_, string memory symbol_) internal onlyInitializing {
        __ERC721_init_unchained(name_, symbol_);
    }

    function __ERC721_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) {
        return
            interfaceId == type(IERC721Upgradeable).interfaceId ||
            interfaceId == type(IERC721MetadataUpgradeable).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721Upgradeable.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721Upgradeable.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721ReceiverUpgradeable.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[44] private __gap;
}

File 15 of 26 : 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 16 of 26 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 17 of 26 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 18 of 26 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
        uint8 v = uint8((uint256(vs) >> 255) + 27);
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 19 of 26 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.
     */
    modifier initializer() {
        bool isTopLevelCall = _setInitializedVersion(1);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        bool isTopLevelCall = _setInitializedVersion(version);
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(version);
        }
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     */
    function _disableInitializers() internal virtual {
        _setInitializedVersion(type(uint8).max);
    }

    function _setInitializedVersion(uint8 version) private returns (bool) {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level
        // of initializers, because in other contexts the contract may have been reentered.
        if (_initializing) {
            require(
                version == 1 && !AddressUpgradeable.isContract(address(this)),
                "Initializable: contract is already initialized"
            );
            return false;
        } else {
            require(_initialized < version, "Initializable: contract is already initialized");
            _initialized = version;
            return true;
        }
    }
}

File 20 of 26 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 21 of 26 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

File 23 of 26 : IERC721MetadataUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721Upgradeable.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721MetadataUpgradeable is IERC721Upgradeable {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 24 of 26 : IERC721ReceiverUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721ReceiverUpgradeable {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 25 of 26 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

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

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

File 26 of 26 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"baseFactory","type":"address"},{"internalType":"address","name":"allowanceSigner_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"_selectedToken","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"adminMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allowancesSigner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newState","type":"uint256"}],"name":"changeSaleState","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"createMessage","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"nonces","type":"uint256[]"}],"name":"createMessages","outputs":[{"internalType":"bytes32[]","name":"messages","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSaleState","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_selectedToken","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"publicPurchase","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newSigner","type":"address"}],"name":"setAllowancesSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOperator","type":"address"}],"name":"setOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_AutomatonPrice","type":"uint64"},{"internalType":"uint64","name":"_MemoriaPrice","type":"uint64"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_PMUrl","type":"string"},{"internalType":"string","name":"_MemoriaUrl","type":"string"},{"internalType":"string","name":"_AutomatonUrl","type":"string"}],"name":"setUrls","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"usedAllowances","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"validateSignature","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080604052620186ac80546001600160a01b03199081167364d91f12ece7362f91a6f8e7940cd55f05060b9217909155620186ad80549091167362799023ad27358df30516742216dfca60d427c81790553480156200005d57600080fd5b5060405162002eb938038062002eb9833981016040819052620000809162000294565b816040518060400160405280601881526020017f4d656d6f72696573206f6620616e204175746f6d61746f6e0000000000000000815250604051806040016040528060048152602001634d4f414160e01b81525060405180608001604052806103e861ffff168152602001604051806020016040528060008152508152602001604051806020016040528060008152508152602001600015158152506200012d846200021960201b60201c565b6000846001600160a01b0316338585856040516024016200015294939291906200032d565b60408051601f198184030181529181526020820180516001600160e01b031663b1a78e3f60e01b17905251620001899190620003cc565b600060405180830381855af49150503d8060008114620001c6576040519150601f19603f3d011682016040523d82523d6000602084013e620001cb565b606091505b5050905080620001da57600080fd5b50506001620186a38190556065620186a255620186a4555050620186a180546001600160a01b0319166001600160a01b038416179055505050620003ea565b80620002537f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6200027460201b620012b81760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b90565b80516001600160a01b03811681146200028f57600080fd5b919050565b60008060408385031215620002a857600080fd5b620002b38362000277565b9150620002c36020840162000277565b90509250929050565b60005b83811015620002e9578181015183820152602001620002cf565b83811115620002f9576000848401525b50505050565b6000815180845262000319816020860160208601620002cc565b601f01601f19169290920160200192915050565b6001600160a01b03851681526080602082018190526000906200035390830186620002ff565b8281036040840152620003678186620002ff565b9050828103606084015261ffff8451168152602084015160806020830152620003946080830182620002ff565b905060408501518282036040840152620003af8282620002ff565b915050606085015115156060830152809250505095945050505050565b60008251620003e0818460208701620002cc565b9190910192915050565b612abf80620003fa6000396000f3fe6080604052600436106100eb5760003560e01c806376eb71481161008a578063b3ab15fb11610059578063b3ab15fb146102d2578063c87b56dd146102f2578063eae7d2d01461031f578063feff19991461033f576100f5565b806376eb71481461025257806380fdab2a146102725780638838b5c314610292578063890621da146102b2576100f5565b80632073447d116100c65780632073447d1461019357806325bdb2a8146101b35780635c60da1b146101d45780636c4a412c14610225576100f5565b80624a84cb1461010c5780630743dd7d1461012c578063195e87081461014c576100f5565b366100f557600080fd5b34801561010157600080fd5b5061010a61035f565b005b34801561011857600080fd5b5061010a610127366004611d53565b6103bd565b34801561013857600080fd5b5061010a610147366004611da4565b6105d3565b34801561015857600080fd5b5061017e610167366004611dd7565b620186a06020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561019f57600080fd5b5061010a6101ae366004611df0565b61063a565b3480156101bf57600080fd5b50620186a4545b60405190815260200161018a565b3480156101e057600080fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b03165b6040516001600160a01b03909116815260200161018a565b34801561023157600080fd5b50610245610240366004611ee1565b6106ac565b60405161018a9190611fa2565b34801561025e57600080fd5b5061010a61026d366004612055565b6107b6565b34801561027e57600080fd5b5061010a61028d3660046120dc565b61084c565b34801561029e57600080fd5b50620186a1546001600160a01b031661020d565b3480156102be57600080fd5b506101c66102cd366004612121565b610e24565b3480156102de57600080fd5b5061010a6102ed366004611df0565b610e4d565b3480156102fe57600080fd5b5061031261030d366004611dd7565b610ec0565b60405161018a919061218f565b34801561032b57600080fd5b5061010a61033a366004611dd7565b61121f565b34801561034b57600080fd5b506101c661035a3660046121c2565b611275565b60006103927f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b90503660008037600080366000845af43d6000803e8080156103b3573d6000f35b3d6000fd5b505050565b6103c56112bb565b6001600160a01b0316336001600160a01b031614806103f05750620186aa546001600160a01b031633145b6104155760405162461bcd60e51b815260040161040c906121ee565b60405180910390fd5b81600114806104245750816002145b8061042d575081155b6104965760405162461bcd60e51b815260206004820152603460248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e203220666044820152736f72206d656d6f7269612c203020666f7220504d60601b606482015260840161040c565b811580156104a2575080155b156104ac576105c9565b8160011480156104ba575080155b1561053c5750620186a3545b6104cf81611333565b156104dc576001016104c6565b6065620186a354106105305760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e604482015260640161040c565b620186a38190556105c9565b81600214801561054a575080155b156105c95750620186a2545b61055f81611333565b1561056c57600101610556565b610191620186a254106105c15760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e0000604482015260640161040c565b620186a28190555b6103b883826113ab565b6105db6112bb565b6001600160a01b0316336001600160a01b031614806106065750620186aa546001600160a01b031633145b6106225760405162461bcd60e51b815260040161040c906121ee565b6001600160401b03918216620186a85516620186a955565b6106426112bb565b6001600160a01b0316336001600160a01b0316148061066d5750620186aa546001600160a01b031633145b6106895760405162461bcd60e51b815260040161040c906121ee565b620186a180546001600160a01b0319166001600160a01b03831617905550565b50565b606081518351146106f35760405162461bcd60e51b8152602060048201526011602482015270214c454e4754485f4d49534d415443482160781b604482015260640161040c565b82516001600160401b0381111561070c5761070c611e0d565b604051908082528060200260200182016040528015610735578160200160208202803683370190505b50905060005b83518110156107af5761078084828151811061075957610759612216565b602002602001015184838151811061077357610773612216565b6020026020010151611275565b82828151811061079257610792612216565b6020908102919091010152806107a781612242565b91505061073b565b5092915050565b6107be6112bb565b6001600160a01b0316336001600160a01b031614806107e95750620186aa546001600160a01b031633145b6108055760405162461bcd60e51b815260040161040c906121ee565b825161081a90620186a5906020860190611ca5565b50815161083090620186a7906020850190611ca5565b50805161084690620186a6906020840190611ca5565b50505050565b826001148061085b5750826002145b6108bd5760405162461bcd60e51b815260206004820152602d60248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e206f722060448201526c3220666f72204d656d6f72696160981b606482015260840161040c565b336000908152620186ab60205260409020620186a454608084901c9190600214806108ec5750620186a4546003145b61094e5760405162461bcd60e51b815260206004820152602d60248201527f53616c65206973206e6f74206f70656e20746f207075626c69632f707269766160448201526c3a3290383ab931b430b9b2b99760991b606482015260840161040c565b60008560011415610bb6576065620186a354106109ad5760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e604482015260640161040c565b620186ac54620186ad54620186a8546001600160a01b03928316926323b872dd9233929116906109e590670de0b6b3a764000061225d565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b158015610a3457600080fd5b505af1158015610a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6c919061227c565b610aaf5760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b604482015260640161040c565b620186a45460031415610b8d57610ac7338686610e24565b508260011480610ad75750826003145b610b235760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652031206f72203300000000000000604482015260640161040c565b815460ff1615610b815760405162461bcd60e51b815260206004820152602360248201527f416c7265616479206d696e746564204175746f6d61746f6e20616c6c6f77616e60448201526231b29760e91b606482015260840161040c565b815460ff191660011782555b50620186a3545b610b9d81611333565b15610baa57600101610b94565b620186a3819055610e12565b8560021415610e1257610191620186a25410610c145760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e0000604482015260640161040c565b620186ac54620186ad54620186a9546001600160a01b03928316926323b872dd923392911690610c4c90670de0b6b3a764000061225d565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b158015610c9b57600080fd5b505af1158015610caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd3919061227c565b610d165760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b604482015260640161040c565b620186a45460031415610ded578260021480610d325750826003145b610d7e5760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652032206f72203300000000000000604482015260640161040c565b8154610100900460ff1615610ddf5760405162461bcd60e51b815260206004820152602160248201527f416c7265616479206d696e746564204d656d6f72696120616c6c6f77616e63656044820152601760f91b606482015260840161040c565b815461ff0019166101001782555b50620186a2545b610dfd81611333565b15610e0a57600101610df4565b620186a28190555b610e1c33826113ab565b505050505050565b6000610e45848484610e40620186a1546001600160a01b031690565b61140c565b949350505050565b610e556112bb565b6001600160a01b0316336001600160a01b03161480610e805750620186aa546001600160a01b031633145b610e9c5760405162461bcd60e51b815260040161040c906121ee565b620186aa80546001600160a01b0319166001600160a01b0392909216919091179055565b6060610ecb82611333565b610f075760405162461bcd60e51b815260206004820152600d60248201526c2ab735b737bbb7103a37b5b2b760991b604482015260640161040c565b6040516331a9108f60e11b815260048101839052600090620186a790610f93903090636352211e906024015b60206040518083038186803b158015610f4b57600080fd5b505afa158015610f5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f83919061229e565b6001600160a01b0316601461152c565b604051602001610fa4929190612312565b60408051808303601f19018152908290526331a9108f60e11b8252600482018590529150600090620186a690610fe4903090636352211e90602401610f33565b604051602001610ff5929190612312565b60408051808303601f19018152908290526331a9108f60e11b8252600482018690529150600090620186a590611035903090636352211e90602401610f33565b604051602001611046929190612312565b604051602081830303815290604052905060006040516020016110b2907f68747470733a2f2f617277656176652e6e65742f2d354254344e366e4678457881527f424d2d516b72586b3434616f78506d55784152464473356a6f4a636d6c3273006020820152603f0190565b6040516020818303038152906040529050600060405160200161111e907f68747470733a2f2f617277656176652e6e65742f79484468314b30734530535481527f5a716d4d65736f6d61443170376d6b64345f437257727754724b736a494d45006020820152603f0190565b6040516020818303038152906040529050606087600014156111655782838560405160200161114f939291906123e4565b60405160208183030381529060405290506111ea565b6000881180156111755750606588105b1561119957611183886116ce565b83848760405160200161114f94939291906125aa565b6064881180156111aa575061019188105b156111ea576111c26111bd60648a6127b5565b6116ce565b8283886040516020016111d894939291906127cc565b60405160208183030381529060405290505b6111f3816117cb565b6040516020016112039190612981565b6040516020818303038152906040529650505050505050919050565b6112276112bb565b6001600160a01b0316336001600160a01b031614806112525750620186aa546001600160a01b031633145b61126e5760405162461bcd60e51b815260040161040c906121ee565b620186a455565b604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b90565b6000306001600160a01b03166313effa0f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112f657600080fd5b505afa15801561130a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132e919061229e565b905090565b604051638553c3e960e01b8152600481018290526000903090638553c3e99060240160206040518083038186803b15801561136d57600080fd5b505afa158015611381573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a5919061227c565b92915050565b30604051633dc8ded760e01b81526001600160a01b038481166004830152602482018490529190911690633dc8ded790604401600060405180830381600087803b1580156113f857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b60008061146f61141c8787611275565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90506001600160a01b0383166114858286611930565b6001600160a01b0316146114d15760405162461bcd60e51b815260206004820152601360248201527221494e56414c49445f5349474e41545552452160681b604482015260640161040c565b6000818152620186a0602052604090205460ff16156115235760405162461bcd60e51b815260206004820152600e60248201526d21414c52454144595f555345442160901b604482015260640161040c565b95945050505050565b6060600061153b83600261225d565b6115469060026129c6565b6001600160401b0381111561155d5761155d611e0d565b6040519080825280601f01601f191660200182016040528015611587576020820181803683370190505b509050600360fc1b816000815181106115a2576115a2612216565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106115d1576115d1612216565b60200101906001600160f81b031916908160001a90535060006115f584600261225d565b6116009060016129c6565b90505b6001811115611678576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061163457611634612216565b1a60f81b82828151811061164a5761164a612216565b60200101906001600160f81b031916908160001a90535060049490941c93611671816129de565b9050611603565b5083156116c75760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161040c565b9392505050565b6060816116f25750506040805180820190915260018152600360fc1b602082015290565b8160005b811561171c578061170681612242565b91506117159050600a83612a0b565b91506116f6565b6000816001600160401b0381111561173657611736611e0d565b6040519080825280601f01601f191660200182016040528015611760576020820181803683370190505b5090505b8415610e45576117756001836127b5565b9150611782600a86612a1f565b61178d9060306129c6565b60f81b8183815181106117a2576117a2612216565b60200101906001600160f81b031916908160001a9053506117c4600a86612a0b565b9450611764565b60608151600014156117eb57505060408051602081019091526000815290565b6000604051806060016040528060408152602001612a4a604091399050600060038451600261181a91906129c6565b6118249190612a0b565b61182f90600461225d565b9050600061183e8260206129c6565b6001600160401b0381111561185557611855611e0d565b6040519080825280601f01601f19166020018201604052801561187f576020820181803683370190505b509050818152600183018586518101602084015b818310156118eb576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101611893565b600389510660018114611905576002811461191657611922565b613d3d60f01b600119830152611922565b603d60f81b6000198301525b509398975050505050505050565b600080600061193f8585611954565b9150915061194c816119c4565b509392505050565b60008082516041141561198b5760208301516040840151606085015160001a61197f87828585611b7f565b945094505050506119bd565b8251604014156119b557602083015160408401516119aa868383611c6c565b9350935050506119bd565b506000905060025b9250929050565b60008160048111156119d8576119d8612a33565b14156119e15750565b60018160048111156119f5576119f5612a33565b1415611a435760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161040c565b6002816004811115611a5757611a57612a33565b1415611aa55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161040c565b6003816004811115611ab957611ab9612a33565b1415611b125760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161040c565b6004816004811115611b2657611b26612a33565b14156106a95760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161040c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611bb65750600090506003611c63565b8460ff16601b14158015611bce57508460ff16601c14155b15611bdf5750600090506004611c63565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611c33573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611c5c57600060019250925050611c63565b9150600090505b94509492505050565b6000806001600160ff1b03831681611c8960ff86901c601b6129c6565b9050611c9787828885611b7f565b935093505050935093915050565b828054611cb1906122bb565b90600052602060002090601f016020900481019282611cd35760008555611d19565b82601f10611cec57805160ff1916838001178555611d19565b82800160010185558215611d19579182015b82811115611d19578251825591602001919060010190611cfe565b50611d25929150611d29565b5090565b5b80821115611d255760008155600101611d2a565b6001600160a01b03811681146106a957600080fd5b600080600060608486031215611d6857600080fd5b8335611d7381611d3e565b95602085013595506040909401359392505050565b80356001600160401b0381168114611d9f57600080fd5b919050565b60008060408385031215611db757600080fd5b611dc083611d88565b9150611dce60208401611d88565b90509250929050565b600060208284031215611de957600080fd5b5035919050565b600060208284031215611e0257600080fd5b81356116c781611d3e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715611e4b57611e4b611e0d565b604052919050565b60006001600160401b03821115611e6c57611e6c611e0d565b5060051b60200190565b600082601f830112611e8757600080fd5b81356020611e9c611e9783611e53565b611e23565b82815260059290921b84018101918181019086841115611ebb57600080fd5b8286015b84811015611ed65780358352918301918301611ebf565b509695505050505050565b60008060408385031215611ef457600080fd5b82356001600160401b0380821115611f0b57600080fd5b818501915085601f830112611f1f57600080fd5b81356020611f2f611e9783611e53565b82815260059290921b84018101918181019089841115611f4e57600080fd5b948201945b83861015611f75578535611f6681611d3e565b82529482019490820190611f53565b96505086013592505080821115611f8b57600080fd5b50611f9885828601611e76565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015611fda57835183529284019291840191600101611fbe565b50909695505050505050565b600082601f830112611ff757600080fd5b81356001600160401b0381111561201057612010611e0d565b612023601f8201601f1916602001611e23565b81815284602083860101111561203857600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561206a57600080fd5b83356001600160401b038082111561208157600080fd5b61208d87838801611fe6565b945060208601359150808211156120a357600080fd5b6120af87838801611fe6565b935060408601359150808211156120c557600080fd5b506120d286828701611fe6565b9150509250925092565b6000806000606084860312156120f157600080fd5b833592506020840135915060408401356001600160401b0381111561211557600080fd5b6120d286828701611fe6565b60008060006060848603121561213657600080fd5b833561214181611d3e565b92506020840135915060408401356001600160401b0381111561211557600080fd5b60005b8381101561217e578181015183820152602001612166565b838111156108465750506000910152565b60208152600082518060208401526121ae816040850160208701612163565b601f01601f19169190910160400192915050565b600080604083850312156121d557600080fd5b82356121e081611d3e565b946020939093013593505050565b6020808252600e908201526d139bdd08105d5d1a1bdc9a5e995960921b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156122565761225661222c565b5060010190565b60008160001904831182151516156122775761227761222c565b500290565b60006020828403121561228e57600080fd5b815180151581146116c757600080fd5b6000602082840312156122b057600080fd5b81516116c781611d3e565b600181811c908216806122cf57607f821691505b602082108114156122f057634e487b7160e01b600052602260045260246000fd5b50919050565b60008151612308818560208601612163565b9290920192915050565b600080845481600182811c91508083168061232e57607f831692505b602080841082141561234e57634e487b7160e01b86526022600452602486fd5b8180156123625760018114612373576123a0565b60ff198616895284890196506123a0565b60008b81526020902060005b868110156123985781548b82015290850190830161237f565b505084890196505b50505050505061152381856122f6565b7f22637265617465645f6279223a20226e79782078207365636f6e647374617465815261088b60f21b602082015260220190565b7f7b226e616d65223a2022507570706574204d61737465722023302f30222c00008152750899195cd8dc9a5c1d1a5bdb888e88088c8d4c0c488b60521b601e8201526000612434603483016123b0565b691134b6b0b3b2911d101160b11b8152855161245781600a840160208a01612163565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161248881601a840160208901612163565b61088b60f21b601a92909101918201819052711130b734b6b0ba34b7b72fbab936111d101160711b601c83015284516124c881602e850160208901612163565b602e9201918201526125a06125926124f7603084016d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a2241726368696c6c656374222c2276616c7581527f65223a225456227d2c7b2274726169745f74797065223a22417274697374222c60208201527f2276616c7565223a224e7978227d2c7b2274726169745f74797065223a22417260408201527f74697374222c2276616c7565223a227365636f6e647374617465227d000000006060820152607c0190565b615d7d60f01b815260020190565b9695505050505050565b757b226e616d65223a2022417574c3b36d61746f6e202360501b815284516000906125dc816016850160208a01612163565b650bcc4c0c088b60d21b6016918401918201527f226465736372697074696f6e223a2022536865207768697370657265642e2e2e601c82015261088b60f21b603c82015261262c603e82016123b0565b691134b6b0b3b2911d101160b11b8152865190915061265281600a840160208a01612163565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161268381601a840160208901612163565b6127a96125926126f86126de6126d06126ca6126ac601a888a010161088b60f21b815260020190565b711130b734b6b0ba34b7b72fbab936111d101160711b815260120190565b8a6122f6565b61088b60f21b815260020190565b6d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a2245787472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b98975050505050505050565b6000828210156127c7576127c761222c565b500390565b727b226e616d65223a20224d656d6f726961202360681b815284516000906127fb816013850160208a01612163565b650bcccc0c088b60d21b6013918401918201527f226465736372697074696f6e223a20224177616b652062757420647265616d696019820152661b99cb8b8b888b60ca1b6039820152612850604082016123b0565b691134b6b0b3b2911d101160b11b8152865190915061287681600a840160208a01612163565b6f11161134b6b0b3b2afbab936111d101160811b600a929091019182015284516128a781601a840160208901612163565b6127a96125926128d06126de6126d06126ca6126ac601a888a010161088b60f21b815260020190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a22496e7472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516129b981601d850160208701612163565b91909101601d0192915050565b600082198211156129d9576129d961222c565b500190565b6000816129ed576129ed61222c565b506000190190565b634e487b7160e01b600052601260045260246000fd5b600082612a1a57612a1a6129f5565b500490565b600082612a2e57612a2e6129f5565b500690565b634e487b7160e01b600052602160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220727f40b09dfff6596a5e035138a16c9660d2bec9d688813fc7845cabac3b3b3b64736f6c6343000809003300000000000000000000000043955024b1985e2b933a59021500ae5f55b040910000000000000000000000009243638f8329a4ba2ecc76022945f21753eb7198

Deployed Bytecode

0x6080604052600436106100eb5760003560e01c806376eb71481161008a578063b3ab15fb11610059578063b3ab15fb146102d2578063c87b56dd146102f2578063eae7d2d01461031f578063feff19991461033f576100f5565b806376eb71481461025257806380fdab2a146102725780638838b5c314610292578063890621da146102b2576100f5565b80632073447d116100c65780632073447d1461019357806325bdb2a8146101b35780635c60da1b146101d45780636c4a412c14610225576100f5565b80624a84cb1461010c5780630743dd7d1461012c578063195e87081461014c576100f5565b366100f557600080fd5b34801561010157600080fd5b5061010a61035f565b005b34801561011857600080fd5b5061010a610127366004611d53565b6103bd565b34801561013857600080fd5b5061010a610147366004611da4565b6105d3565b34801561015857600080fd5b5061017e610167366004611dd7565b620186a06020526000908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561019f57600080fd5b5061010a6101ae366004611df0565b61063a565b3480156101bf57600080fd5b50620186a4545b60405190815260200161018a565b3480156101e057600080fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b03165b6040516001600160a01b03909116815260200161018a565b34801561023157600080fd5b50610245610240366004611ee1565b6106ac565b60405161018a9190611fa2565b34801561025e57600080fd5b5061010a61026d366004612055565b6107b6565b34801561027e57600080fd5b5061010a61028d3660046120dc565b61084c565b34801561029e57600080fd5b50620186a1546001600160a01b031661020d565b3480156102be57600080fd5b506101c66102cd366004612121565b610e24565b3480156102de57600080fd5b5061010a6102ed366004611df0565b610e4d565b3480156102fe57600080fd5b5061031261030d366004611dd7565b610ec0565b60405161018a919061218f565b34801561032b57600080fd5b5061010a61033a366004611dd7565b61121f565b34801561034b57600080fd5b506101c661035a3660046121c2565b611275565b60006103927f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b90503660008037600080366000845af43d6000803e8080156103b3573d6000f35b3d6000fd5b505050565b6103c56112bb565b6001600160a01b0316336001600160a01b031614806103f05750620186aa546001600160a01b031633145b6104155760405162461bcd60e51b815260040161040c906121ee565b60405180910390fd5b81600114806104245750816002145b8061042d575081155b6104965760405162461bcd60e51b815260206004820152603460248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e203220666044820152736f72206d656d6f7269612c203020666f7220504d60601b606482015260840161040c565b811580156104a2575080155b156104ac576105c9565b8160011480156104ba575080155b1561053c5750620186a3545b6104cf81611333565b156104dc576001016104c6565b6065620186a354106105305760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e604482015260640161040c565b620186a38190556105c9565b81600214801561054a575080155b156105c95750620186a2545b61055f81611333565b1561056c57600101610556565b610191620186a254106105c15760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e0000604482015260640161040c565b620186a28190555b6103b883826113ab565b6105db6112bb565b6001600160a01b0316336001600160a01b031614806106065750620186aa546001600160a01b031633145b6106225760405162461bcd60e51b815260040161040c906121ee565b6001600160401b03918216620186a85516620186a955565b6106426112bb565b6001600160a01b0316336001600160a01b0316148061066d5750620186aa546001600160a01b031633145b6106895760405162461bcd60e51b815260040161040c906121ee565b620186a180546001600160a01b0319166001600160a01b03831617905550565b50565b606081518351146106f35760405162461bcd60e51b8152602060048201526011602482015270214c454e4754485f4d49534d415443482160781b604482015260640161040c565b82516001600160401b0381111561070c5761070c611e0d565b604051908082528060200260200182016040528015610735578160200160208202803683370190505b50905060005b83518110156107af5761078084828151811061075957610759612216565b602002602001015184838151811061077357610773612216565b6020026020010151611275565b82828151811061079257610792612216565b6020908102919091010152806107a781612242565b91505061073b565b5092915050565b6107be6112bb565b6001600160a01b0316336001600160a01b031614806107e95750620186aa546001600160a01b031633145b6108055760405162461bcd60e51b815260040161040c906121ee565b825161081a90620186a5906020860190611ca5565b50815161083090620186a7906020850190611ca5565b50805161084690620186a6906020840190611ca5565b50505050565b826001148061085b5750826002145b6108bd5760405162461bcd60e51b815260206004820152602d60248201527f53656c6563746f72206d7573742062652031204175746f6d61746f6e206f722060448201526c3220666f72204d656d6f72696160981b606482015260840161040c565b336000908152620186ab60205260409020620186a454608084901c9190600214806108ec5750620186a4546003145b61094e5760405162461bcd60e51b815260206004820152602d60248201527f53616c65206973206e6f74206f70656e20746f207075626c69632f707269766160448201526c3a3290383ab931b430b9b2b99760991b606482015260840161040c565b60008560011415610bb6576065620186a354106109ad5760405162461bcd60e51b815260206004820181905260248201527f45786365656473206d617820737570706c79206f66204175746f6d61746f6e2e604482015260640161040c565b620186ac54620186ad54620186a8546001600160a01b03928316926323b872dd9233929116906109e590670de0b6b3a764000061225d565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b158015610a3457600080fd5b505af1158015610a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a6c919061227c565b610aaf5760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b604482015260640161040c565b620186a45460031415610b8d57610ac7338686610e24565b508260011480610ad75750826003145b610b235760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652031206f72203300000000000000604482015260640161040c565b815460ff1615610b815760405162461bcd60e51b815260206004820152602360248201527f416c7265616479206d696e746564204175746f6d61746f6e20616c6c6f77616e60448201526231b29760e91b606482015260840161040c565b815460ff191660011782555b50620186a3545b610b9d81611333565b15610baa57600101610b94565b620186a3819055610e12565b8560021415610e1257610191620186a25410610c145760405162461bcd60e51b815260206004820152601e60248201527f45786365656473206d617820737570706c79206f66204d656d6f7269612e0000604482015260640161040c565b620186ac54620186ad54620186a9546001600160a01b03928316926323b872dd923392911690610c4c90670de0b6b3a764000061225d565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401602060405180830381600087803b158015610c9b57600080fd5b505af1158015610caf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd3919061227c565b610d165760405162461bcd60e51b8152602060048201526014602482015273091054d2081d1c985b9cd9995c8819985a5b195960621b604482015260640161040c565b620186a45460031415610ded578260021480610d325750826003145b610d7e5760405162461bcd60e51b815260206004820152601960248201527f4e6f6e63652074696572206d7573742062652032206f72203300000000000000604482015260640161040c565b8154610100900460ff1615610ddf5760405162461bcd60e51b815260206004820152602160248201527f416c7265616479206d696e746564204d656d6f72696120616c6c6f77616e63656044820152601760f91b606482015260840161040c565b815461ff0019166101001782555b50620186a2545b610dfd81611333565b15610e0a57600101610df4565b620186a28190555b610e1c33826113ab565b505050505050565b6000610e45848484610e40620186a1546001600160a01b031690565b61140c565b949350505050565b610e556112bb565b6001600160a01b0316336001600160a01b03161480610e805750620186aa546001600160a01b031633145b610e9c5760405162461bcd60e51b815260040161040c906121ee565b620186aa80546001600160a01b0319166001600160a01b0392909216919091179055565b6060610ecb82611333565b610f075760405162461bcd60e51b815260206004820152600d60248201526c2ab735b737bbb7103a37b5b2b760991b604482015260640161040c565b6040516331a9108f60e11b815260048101839052600090620186a790610f93903090636352211e906024015b60206040518083038186803b158015610f4b57600080fd5b505afa158015610f5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f83919061229e565b6001600160a01b0316601461152c565b604051602001610fa4929190612312565b60408051808303601f19018152908290526331a9108f60e11b8252600482018590529150600090620186a690610fe4903090636352211e90602401610f33565b604051602001610ff5929190612312565b60408051808303601f19018152908290526331a9108f60e11b8252600482018690529150600090620186a590611035903090636352211e90602401610f33565b604051602001611046929190612312565b604051602081830303815290604052905060006040516020016110b2907f68747470733a2f2f617277656176652e6e65742f2d354254344e366e4678457881527f424d2d516b72586b3434616f78506d55784152464473356a6f4a636d6c3273006020820152603f0190565b6040516020818303038152906040529050600060405160200161111e907f68747470733a2f2f617277656176652e6e65742f79484468314b30734530535481527f5a716d4d65736f6d61443170376d6b64345f437257727754724b736a494d45006020820152603f0190565b6040516020818303038152906040529050606087600014156111655782838560405160200161114f939291906123e4565b60405160208183030381529060405290506111ea565b6000881180156111755750606588105b1561119957611183886116ce565b83848760405160200161114f94939291906125aa565b6064881180156111aa575061019188105b156111ea576111c26111bd60648a6127b5565b6116ce565b8283886040516020016111d894939291906127cc565b60405160208183030381529060405290505b6111f3816117cb565b6040516020016112039190612981565b6040516020818303038152906040529650505050505050919050565b6112276112bb565b6001600160a01b0316336001600160a01b031614806112525750620186aa546001600160a01b031633145b61126e5760405162461bcd60e51b815260040161040c906121ee565b620186a455565b604080516001600160a01b038416602082015290810182905230606082015260009060800160405160208183030381529060405280519060200120905092915050565b90565b6000306001600160a01b03166313effa0f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112f657600080fd5b505afa15801561130a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132e919061229e565b905090565b604051638553c3e960e01b8152600481018290526000903090638553c3e99060240160206040518083038186803b15801561136d57600080fd5b505afa158015611381573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a5919061227c565b92915050565b30604051633dc8ded760e01b81526001600160a01b038481166004830152602482018490529190911690633dc8ded790604401600060405180830381600087803b1580156113f857600080fd5b505af1158015610e1c573d6000803e3d6000fd5b60008061146f61141c8787611275565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b90506001600160a01b0383166114858286611930565b6001600160a01b0316146114d15760405162461bcd60e51b815260206004820152601360248201527221494e56414c49445f5349474e41545552452160681b604482015260640161040c565b6000818152620186a0602052604090205460ff16156115235760405162461bcd60e51b815260206004820152600e60248201526d21414c52454144595f555345442160901b604482015260640161040c565b95945050505050565b6060600061153b83600261225d565b6115469060026129c6565b6001600160401b0381111561155d5761155d611e0d565b6040519080825280601f01601f191660200182016040528015611587576020820181803683370190505b509050600360fc1b816000815181106115a2576115a2612216565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106115d1576115d1612216565b60200101906001600160f81b031916908160001a90535060006115f584600261225d565b6116009060016129c6565b90505b6001811115611678576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061163457611634612216565b1a60f81b82828151811061164a5761164a612216565b60200101906001600160f81b031916908160001a90535060049490941c93611671816129de565b9050611603565b5083156116c75760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161040c565b9392505050565b6060816116f25750506040805180820190915260018152600360fc1b602082015290565b8160005b811561171c578061170681612242565b91506117159050600a83612a0b565b91506116f6565b6000816001600160401b0381111561173657611736611e0d565b6040519080825280601f01601f191660200182016040528015611760576020820181803683370190505b5090505b8415610e45576117756001836127b5565b9150611782600a86612a1f565b61178d9060306129c6565b60f81b8183815181106117a2576117a2612216565b60200101906001600160f81b031916908160001a9053506117c4600a86612a0b565b9450611764565b60608151600014156117eb57505060408051602081019091526000815290565b6000604051806060016040528060408152602001612a4a604091399050600060038451600261181a91906129c6565b6118249190612a0b565b61182f90600461225d565b9050600061183e8260206129c6565b6001600160401b0381111561185557611855611e0d565b6040519080825280601f01601f19166020018201604052801561187f576020820181803683370190505b509050818152600183018586518101602084015b818310156118eb576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101611893565b600389510660018114611905576002811461191657611922565b613d3d60f01b600119830152611922565b603d60f81b6000198301525b509398975050505050505050565b600080600061193f8585611954565b9150915061194c816119c4565b509392505050565b60008082516041141561198b5760208301516040840151606085015160001a61197f87828585611b7f565b945094505050506119bd565b8251604014156119b557602083015160408401516119aa868383611c6c565b9350935050506119bd565b506000905060025b9250929050565b60008160048111156119d8576119d8612a33565b14156119e15750565b60018160048111156119f5576119f5612a33565b1415611a435760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161040c565b6002816004811115611a5757611a57612a33565b1415611aa55760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161040c565b6003816004811115611ab957611ab9612a33565b1415611b125760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161040c565b6004816004811115611b2657611b26612a33565b14156106a95760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161040c565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611bb65750600090506003611c63565b8460ff16601b14158015611bce57508460ff16601c14155b15611bdf5750600090506004611c63565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611c33573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611c5c57600060019250925050611c63565b9150600090505b94509492505050565b6000806001600160ff1b03831681611c8960ff86901c601b6129c6565b9050611c9787828885611b7f565b935093505050935093915050565b828054611cb1906122bb565b90600052602060002090601f016020900481019282611cd35760008555611d19565b82601f10611cec57805160ff1916838001178555611d19565b82800160010185558215611d19579182015b82811115611d19578251825591602001919060010190611cfe565b50611d25929150611d29565b5090565b5b80821115611d255760008155600101611d2a565b6001600160a01b03811681146106a957600080fd5b600080600060608486031215611d6857600080fd5b8335611d7381611d3e565b95602085013595506040909401359392505050565b80356001600160401b0381168114611d9f57600080fd5b919050565b60008060408385031215611db757600080fd5b611dc083611d88565b9150611dce60208401611d88565b90509250929050565b600060208284031215611de957600080fd5b5035919050565b600060208284031215611e0257600080fd5b81356116c781611d3e565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715611e4b57611e4b611e0d565b604052919050565b60006001600160401b03821115611e6c57611e6c611e0d565b5060051b60200190565b600082601f830112611e8757600080fd5b81356020611e9c611e9783611e53565b611e23565b82815260059290921b84018101918181019086841115611ebb57600080fd5b8286015b84811015611ed65780358352918301918301611ebf565b509695505050505050565b60008060408385031215611ef457600080fd5b82356001600160401b0380821115611f0b57600080fd5b818501915085601f830112611f1f57600080fd5b81356020611f2f611e9783611e53565b82815260059290921b84018101918181019089841115611f4e57600080fd5b948201945b83861015611f75578535611f6681611d3e565b82529482019490820190611f53565b96505086013592505080821115611f8b57600080fd5b50611f9885828601611e76565b9150509250929050565b6020808252825182820181905260009190848201906040850190845b81811015611fda57835183529284019291840191600101611fbe565b50909695505050505050565b600082601f830112611ff757600080fd5b81356001600160401b0381111561201057612010611e0d565b612023601f8201601f1916602001611e23565b81815284602083860101111561203857600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561206a57600080fd5b83356001600160401b038082111561208157600080fd5b61208d87838801611fe6565b945060208601359150808211156120a357600080fd5b6120af87838801611fe6565b935060408601359150808211156120c557600080fd5b506120d286828701611fe6565b9150509250925092565b6000806000606084860312156120f157600080fd5b833592506020840135915060408401356001600160401b0381111561211557600080fd5b6120d286828701611fe6565b60008060006060848603121561213657600080fd5b833561214181611d3e565b92506020840135915060408401356001600160401b0381111561211557600080fd5b60005b8381101561217e578181015183820152602001612166565b838111156108465750506000910152565b60208152600082518060208401526121ae816040850160208701612163565b601f01601f19169190910160400192915050565b600080604083850312156121d557600080fd5b82356121e081611d3e565b946020939093013593505050565b6020808252600e908201526d139bdd08105d5d1a1bdc9a5e995960921b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156122565761225661222c565b5060010190565b60008160001904831182151516156122775761227761222c565b500290565b60006020828403121561228e57600080fd5b815180151581146116c757600080fd5b6000602082840312156122b057600080fd5b81516116c781611d3e565b600181811c908216806122cf57607f821691505b602082108114156122f057634e487b7160e01b600052602260045260246000fd5b50919050565b60008151612308818560208601612163565b9290920192915050565b600080845481600182811c91508083168061232e57607f831692505b602080841082141561234e57634e487b7160e01b86526022600452602486fd5b8180156123625760018114612373576123a0565b60ff198616895284890196506123a0565b60008b81526020902060005b868110156123985781548b82015290850190830161237f565b505084890196505b50505050505061152381856122f6565b7f22637265617465645f6279223a20226e79782078207365636f6e647374617465815261088b60f21b602082015260220190565b7f7b226e616d65223a2022507570706574204d61737465722023302f30222c00008152750899195cd8dc9a5c1d1a5bdb888e88088c8d4c0c488b60521b601e8201526000612434603483016123b0565b691134b6b0b3b2911d101160b11b8152855161245781600a840160208a01612163565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161248881601a840160208901612163565b61088b60f21b601a92909101918201819052711130b734b6b0ba34b7b72fbab936111d101160711b601c83015284516124c881602e850160208901612163565b602e9201918201526125a06125926124f7603084016d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a2241726368696c6c656374222c2276616c7581527f65223a225456227d2c7b2274726169745f74797065223a22417274697374222c60208201527f2276616c7565223a224e7978227d2c7b2274726169745f74797065223a22417260408201527f74697374222c2276616c7565223a227365636f6e647374617465227d000000006060820152607c0190565b615d7d60f01b815260020190565b9695505050505050565b757b226e616d65223a2022417574c3b36d61746f6e202360501b815284516000906125dc816016850160208a01612163565b650bcc4c0c088b60d21b6016918401918201527f226465736372697074696f6e223a2022536865207768697370657265642e2e2e601c82015261088b60f21b603c82015261262c603e82016123b0565b691134b6b0b3b2911d101160b11b8152865190915061265281600a840160208a01612163565b6f11161134b6b0b3b2afbab936111d101160811b600a9290910191820152845161268381601a840160208901612163565b6127a96125926126f86126de6126d06126ca6126ac601a888a010161088b60f21b815260020190565b711130b734b6b0ba34b7b72fbab936111d101160711b815260120190565b8a6122f6565b61088b60f21b815260020190565b6d2261747472696275746573223a5b60901b8152600e0190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a2245787472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b98975050505050505050565b6000828210156127c7576127c761222c565b500390565b727b226e616d65223a20224d656d6f726961202360681b815284516000906127fb816013850160208a01612163565b650bcccc0c088b60d21b6013918401918201527f226465736372697074696f6e223a20224177616b652062757420647265616d696019820152661b99cb8b8b888b60ca1b6039820152612850604082016123b0565b691134b6b0b3b2911d101160b11b8152865190915061287681600a840160208a01612163565b6f11161134b6b0b3b2afbab936111d101160811b600a929091019182015284516128a781601a840160208901612163565b6127a96125926128d06126de6126d06126ca6126ac601a888a010161088b60f21b815260020190565b7f7b2274726169745f74797065223a22417274697374222c2276616c7565223a2281527f4e7978227d2c7b2274726169745f74797065223a22417274697374222c22766160208201527f6c7565223a227365636f6e647374617465227d2c7b2274726169745f7479706560408201527f223a22496e7472696e736963222c2276616c7565223a2244616e6e795769746860608201526c5468726565427261696e73227d60981b6080820152608d0190565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516129b981601d850160208701612163565b91909101601d0192915050565b600082198211156129d9576129d961222c565b500190565b6000816129ed576129ed61222c565b506000190190565b634e487b7160e01b600052601260045260246000fd5b600082612a1a57612a1a6129f5565b500490565b600082612a2e57612a2e6129f5565b500690565b634e487b7160e01b600052602160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220727f40b09dfff6596a5e035138a16c9660d2bec9d688813fc7845cabac3b3b3b64736f6c63430008090033

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

00000000000000000000000043955024b1985e2b933a59021500ae5f55b040910000000000000000000000009243638f8329a4ba2ecc76022945f21753eb7198

-----Decoded View---------------
Arg [0] : baseFactory (address): 0x43955024b1985E2b933A59021500aE5f55b04091
Arg [1] : allowanceSigner_ (address): 0x9243638F8329A4bA2Ecc76022945F21753eB7198

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000043955024b1985e2b933a59021500ae5f55b04091
Arg [1] : 0000000000000000000000009243638f8329a4ba2ecc76022945f21753eb7198


Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.