ETH Price: $3,668.34 (+1.88%)

ERC-20: Chimpers Dojo (CHIMPDOJO)
 

Overview

TokenID

10273

Total Transfers

-

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-
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:
Dojo

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 500 runs

Other Settings:
default evmVersion
File 1 of 15 : Dojo.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @artist: Timpers
/// @title: The Dojo
/// @author: manifold.xyz

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                   //
//                                                                                                                   //
//                                                                                                                   //
//                                                                                                                   //
//                                                 :%%%%%%%%%%%%%%%%%*                                               //
//                                           .-----=#################*-----:                                         //
//                                           :@@@@@%                 :@@@@@*                                         //
//                      .%%%%%%%%%%%%%%*  :%%#::::::                  :::::+%%+                                      //
//                   .--=@@@@@@@@@@@@@@#--=##*     .--:     .--:        .--+##+--------:                             //
//                   :@@@%%%%%%%%%%%%%%%@@#        :@@%     -@@#        :@@*  =@@@@@@@@*                             //
//                 %@@%%%%%#.........%%%%%%@@#  :@@%+++@@@@@%++*@@#  :@@#...  =@@@@@@@@@@@*                          //
//             .===@@@%%#++=         ++*%%%@@%==+%%#***%%%%%#**#%%#===**+     -**#@@@@@@@@%==:                       //
//             :@@@%%%%%#              :%%%%%%@@@==+@@@=====*@@%==*@@#           =@@@@@@@@@@@+                       //
//             :@@@%%#...               ..-%%%@@@==+@@@=====*@@%==*@@#     =%%%%%*.....=@@@@@@%%*                    //
//             :@@@%%*                    :%%%@@@==+%%#=====+%%#==*@@#     =@@%**=     :**#@@@@@#                    //
//             :@@@%%*                    :%%%@@@=================*@@#     =@@*           -@@@@@#                    //
//             :@@@%%*                    :%%%@@@**#@@@@@@@@@@@%**#@@#     =@@@%%+        -@@@@@#                    //
//             :@@@%%#--:              .--=%%%@@@%%%@@@@@@@@@@@%%%###+     -#####+--:     -@@@@@#                    //
//             :@@@%%%%%#              :%%%%%%%%%@@@###########%@@#              =@@*     -@@@@@#                    //
//                 @@@%%%%%#         %%%%%%%%%@@%  :@@@@@@@@@@@#                 =@@*  -@@@@@@@@#                    //
//                 +**@%%%%#---------%%%%%%%%@@@%  :********#@@%==-  .=====:     =@@#==*@@@@@%**=                    //
//                   :@@@%%%%%%%%%%%%%%%%%%@@@@@%........   -@@@@@#  :@@@@@*   ..=@@@@@@@@@@@+                       //
//                    ..:@@@@@@@@@@@@%%%@@@@@%......................................=@@@@@#..                        //
//                      .*********@@@%%@@@@@@%......................................=@@%**=                          //
//                               .@@@@@@@@@@@%......................................=@@*                             //
//                                ..:@@@@@%:::.......................................::=@@*                          //
//                                  .**#@@#..............:=================-...........=@@#                          //
//                                     :@@#..............=@@@@@@@@@@@@@@@@@*...........=@@#                          //
//                                     :@@#............................................=@@#                          //
//                                     :@@#............................................=@@#                          //
//                                     :@@#............................................=@@#                          //
//                                     :@@#............................................=@@#                          //
//                                     :@@#............................................=@@#                          //
//                                     :@@#............................................=@@#                          //
//                                     :@@#.......................:==-.................=@@#                          //
//                                     :@@#.......................:==-.........:::.....=@@#                          //
//                                     :@@#.......................:==-........:==-.....=@@#                          //
//                                     :@@#.........===...........:==-........:==-.....=@@#                          //
//                                     :@@#.........===...........:==-........:==-.....=@@#                          //
//                                     :@@#.........===...........:==-........:==-.....=@@#                          //
//                                     :@@#.........===...........:==-........:==-.....=@@#                          //
//                                     :@@#.........===......:::..:==-........:==-...::+@@#                          //
//                                     :@@#.........===.....:==-..:==-........:==-..:==*@@#                          //
//                                     :@@%===......===.....:==-..:==-........:==-..:==*@@#                          //
//                                     :@@%===...::-===.....:===::-==-........:===::-==*@@#                          //
//                                     :@@%===...======.....:========-........:========*@@#                          //
//                                     :@@%===...====================-..:==-..:========*@@#                          //
//                                     :@@%===---=====================---===---========*@@#                          //
//                                     :@@%============================================*@@#                          //
//                                     :@@%============================================*@@#                          //
//                                     .==+############################################*==-                          //
//                                        :@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*                             //
//                                                                                                                   //
//                                                                                                                   //
//                                                                                                                   //
//                                                                                                                   //
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

import "./IDojo.sol";

contract Dojo is IDojo, ERC165, ReentrancyGuard, AdminControl {

    using Strings for uint256;
    using ECDSA for bytes32;

    string constant public override name = "Chimpers Dojo";
    string constant public override symbol = "CHIMPDOJO";

    // Token ID to owner
    mapping(uint256 => StakedOwner) private _owners;

    // Owner address to balance
    mapping(address => uint256) private _balances;

    // Token ID to XP
    mapping(uint256 => XP) private _xp;

    // Message nonces
    mapping(bytes32 => bool) private _usedNonces;

    // Chimpers Genesis contract address
    address private _chimpersGenesis;

    // Chimpers Generative contract address
    address private _chimpersGenerative;

    // Server oracle address
    address private _signingAddress;

    uint32 private _maxDailyXP;
    Bandana[] private _bandanas;
    
    string public baseURI;
    bool public dojoOpen;

    constructor(address chimpersGenesis, address chimpersGenerative) {
        _chimpersGenesis = chimpersGenesis;
        _chimpersGenerative = chimpersGenerative;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(
        bytes4 interfaceId
    ) public view virtual override(AdminControl, ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     */
    function onERC721Received(
        address,
        address from,
        uint256 tokenId,
        bytes calldata
    ) external override nonReentrant returns (bytes4) {
        require(msg.sender == _chimpersGenesis || msg.sender == _chimpersGenerative, "Invalid NFT");
        require(dojoOpen, "The Dojo has not been opened");

        // Genesis Chimpers token id maps 1:1
        uint256 stakedId = tokenId;

        if (msg.sender == _chimpersGenerative) {
            // Staked Generative Chimpers start at token id 10001
            stakedId += 10000;
        }

        _owners[stakedId] = StakedOwner(from, uint48(block.timestamp));
        _balances[from] += 1;

        // Award first bandana on initial deposit
        if (_xp[stakedId].value == 0) {
            _xp[stakedId].value = _bandanas[0].xpThreshold;
        }

        emit Transfer(address(0), from, stakedId);

        return this.onERC721Received.selector;
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) external view override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) external view override returns (address) {
        address owner = _owners[tokenId].ownerAddress;
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) external view override returns (string memory) {
        require(_owners[tokenId].ownerAddress != address(0), "ERC721: invalid token ID");
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev See {IDojo-setSigningAddress}.
     */
    function setSigningAddress(address signingAddress) external override adminRequired {
        _signingAddress = signingAddress;
    }

    /**
     * @dev See {IDojo-setTokenURI}.
     */
    function setTokenURI(string calldata uri) external override adminRequired {
        baseURI = uri;
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address, uint256) external pure override {
        _transferRevert();
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256) external pure override returns (address) {
        return address(0);
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address, bool) external pure override {
        _transferRevert();
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address, address) external pure override returns (bool) {
        return false;
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address,
        address,
        uint256
    ) external pure override {
        _transferRevert();
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address,
        address,
        uint256
    ) external pure override {
        _transferRevert();
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address,
        address,
        uint256,
        bytes memory
    ) external pure override {
        _transferRevert();
    }

    function _transferRevert() private pure {
        revert("Cannot perform transfers on a non-transferable token");
    }

    function _translateTokenId(
        uint256 tokenId,
        bool isGenesisChimp
    ) private pure returns(uint256) {
        require(
            (tokenId >= 1 && tokenId <= 100) || 
            (!isGenesisChimp && tokenId >= 1 && tokenId <= 5555),
            "Invalid token ID"
        );
        return isGenesisChimp ? tokenId : tokenId + 10000;
    }

    function _validateSignature(
        uint256[] calldata tokenIds,
        uint32[] calldata amounts,
        bytes32 message,
        bytes calldata signature,
        bytes32 nonce
    ) private {
        uint256 length = tokenIds.length;
        
        // Verify nonce usage/re-use
        require(!_usedNonces[nonce], "Cannot replay transaction");

        // Verify valid message based on input variables
        bytes32 expectedMessage = keccak256(
            abi.encodePacked(
                "\x19Ethereum Signed Message:\n",
                (52+length*64).toString(),
                msg.sender,
                nonce,
                tokenIds,
                amounts
            )
        );
        require(message == expectedMessage, "Malformed message");

        // Verify signature was performed by the expected signing address
        address signer = message.recover(signature);
        require(signer == _signingAddress, "Invalid signature");

        _usedNonces[nonce] = true;
    }


    /**
     * @dev See {IDojo-chimpXP}.
     */
    function chimpXP(
        uint256 tokenId,
        bool isGenesisChimp
    ) external view override returns(uint208) {
        uint256 stakedId = _translateTokenId(tokenId, isGenesisChimp);
        return _xp[stakedId].value;
    }


    /**
     * @dev See {IDojo-chimpBandana}.
     */
    function chimpBandana(
        uint256 tokenId,
        bool isGenesisChimp
    ) external view override returns(string memory) {
        uint256 stakedId = _translateTokenId(tokenId, isGenesisChimp);

        for (uint256 i = _bandanas.length; i > 0; i--) {
            if (_xp[stakedId].value >= _bandanas[i-1].xpThreshold) {
                return _bandanas[i-1].name;
            }
        }

        return "";
    }

    /**
     * @dev See {IDojo-bandanas}.
     */
    function bandanas() external view override returns(Bandana[] memory) {
        return _bandanas;
    }

    /**
     * @dev See {IDojo-setBandanas}.
     */
    function setBandanas(
        uint32[] calldata xpThresholds,
        string[] calldata bandanaNames
    ) external override adminRequired {
        uint256 numberOfBandanas = xpThresholds.length;

        for (uint256 i = 1; i < numberOfBandanas; i++) {
            require(xpThresholds[i] > xpThresholds[i-1], "Bandanas must be sorted");
        }

        delete _bandanas;

        for (uint256 i = 0; i < numberOfBandanas; i++) {
            _bandanas.push(Bandana({
                xpThreshold: xpThresholds[i],
                name: bandanaNames[i]
            }));
        }
    }

    /**
     * @dev See {IDojo-setMaxDailyXP}.
     */
    function setMaxDailyXP(uint32 xp) external override adminRequired {
        _maxDailyXP = xp;
    }

    /**
     * @dev See {IDojo-openDojo}.
     */
    function openDojo() external override adminRequired {
        dojoOpen = true;
    }

    /**
     * @dev See {IDojo-collectXP}.
     */
    function collectXP(
        uint256[] calldata dojoIds,
        uint32[] calldata amounts,
        bytes32 message,
        bytes calldata signature,
        bytes32 nonce
    ) public override {
        _validateSignature(dojoIds, amounts, message, signature, nonce);

        uint256 length = dojoIds.length;
        
        for (uint256 i = 0; i < length; i++) {
            uint256 id = dojoIds[i];
            require(_owners[id].ownerAddress != address(0), "ERC721: invalid token ID");

            uint256 daysElapsed = (
                block.timestamp - 
                (
                    _xp[id].lastUpdateTime == 0 ?
                    _owners[id].entryTime :
                    _xp[id].lastUpdateTime
                )
            ) / 86400;

            require(amounts[i] <= daysElapsed * _maxDailyXP, "Exceeds daily limit");
            _xp[id].lastUpdateTime = uint48(block.timestamp);
            _xp[id].value += amounts[i];
        }

        emit CollectedXP(msg.sender, dojoIds, amounts);
    }

    /**
     * @dev See {IDojo-enterDojo}.
     */
    function enterDojo(
        uint256[] calldata tokenIds,
        address[] calldata tokenAddresses
    ) external override {
        for (uint256 i = 0; i < tokenIds.length; i++) {
            IERC721(tokenAddresses[i]).safeTransferFrom(msg.sender, address(this), tokenIds[i]);
        }
    }

    /**
     * @dev See {IDojo-exitDojo}.
     */
    function exitDojo(
        uint256[] calldata dojoIds,
        uint32[] calldata xpList,
        bytes32 message,
        bytes calldata signature,
        bytes32 nonce
    ) external override nonReentrant {
        if (xpList.length > 0) {
            collectXP(dojoIds, xpList, message, signature, nonce);
        }

        uint256 length = dojoIds.length;

        for (uint256 i = 0; i < length; i++) {
            uint256 id = dojoIds[i];
            require(msg.sender == _owners[id].ownerAddress, "Address is not owner");

            _owners[id].ownerAddress = address(0);
            _balances[msg.sender] -= 1;
            _xp[id].lastUpdateTime = 0;

            emit Transfer(msg.sender, address(0), id);

            // Return original chimp
            if (id <= 100) {
                IERC721(_chimpersGenesis).transferFrom(address(this), msg.sender, id);
            } else {
                IERC721(_chimpersGenerative).transferFrom(
                    address(this),
                    msg.sender,
                    id - 10000
                );
            }
        }
    }

    /**
     * @dev See {IDojo-returnLostChimp}.
     */
    function returnLostChimp(
        address to,
        bool isGenesisChimp,
        uint256 tokenId
    ) external override adminRequired {
        if (isGenesisChimp && _owners[tokenId].ownerAddress == address(0)) {
            IERC721(_chimpersGenesis).transferFrom(address(this), to, tokenId);
        } else if (!isGenesisChimp && _owners[tokenId+10000].ownerAddress == address(0)) {
            IERC721(_chimpersGenerative).transferFrom(address(this), to, tokenId);
        } else {
            revert("This chimp is not lost");
        }
    }

    /**
     * @dev See {IDojo-nonceUsed}.
     */
    function nonceUsed(bytes32 nonce) external view override returns(bool) {
        return _usedNonces[nonce];
    }
}

File 2 of 15 : IDojo.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";

/**
 * Dojo Interface
 */
interface IDojo is IERC721, IERC721Metadata, IERC721Receiver {

    event CollectedXP(
        address indexed sender,
        uint256[] dojoIds,
        uint32[] amounts
    );

    struct Bandana {
        string name;
        uint208 xpThreshold;
    }

    struct StakedOwner {
        address ownerAddress;
        uint48 entryTime;
    }

    struct XP {
        uint208 value;
        uint48 lastUpdateTime;
    }

    /**
     * @dev Get a chimp's finalized XP
     */
    function chimpXP(uint256 tokenId, bool isGenesisChimp) external view returns(uint208);

    /**
     * @dev Get a chimp's finalized bandana
     */
    function chimpBandana(uint256 tokenId, bool isGenesisChimp) external view returns(string memory);

    /**
     * @dev Get the list of available bandanas
     */
    function bandanas() external view returns(Bandana[] memory);

    /**
     * @dev Set the server oracle signing address
     *
     * Requirements:
     * 
     * - The caller must be an admin
     */
    function setSigningAddress(address signingAddress) external;

    /**
     * @dev Set the base URI for token metadata
     *
     * Requirements:
     * 
     * - The caller must be an admin
     */
    function setTokenURI(string calldata uri) external;

    /**
     * @dev Set the XP thresholds and bandana levels 
     *
     * Requirements:
     * 
     * - The caller must be an admin
     */
    function setBandanas(uint32[] calldata xpThresholds, string[] calldata bandanaNames) external;

    /**
     * @dev Set the maxmimum daily XP a chimp can earn.
     *
     * Requirements:
     * 
     * - The caller must be an admin
     */
    function setMaxDailyXP(uint32 xp) external;

    /**
     * @dev Open the Dojo.
     *
     * Requirements:
     * 
     * - The caller must be an admin
     */
    function openDojo() external;

    /**
     * @dev Collect accumulated XP.
     */
    function collectXP(
        uint256[] calldata dojoIds,
        uint32[] calldata amounts,
        bytes32 message,
        bytes calldata signature,
        bytes32 nonce
    ) external;

    /**
     * @dev Enter the Dojo. Used for sending many chimps to the Dojo in one transaction.
     * 
     * Requirements:
     * 
     * - This contract must be an approved operator for each token
     */
    function enterDojo(
        uint256[] calldata tokenIds,
        address[] calldata tokenAddresses
    ) external;

    /**
     * @dev Leave the Dojo. Returns original chimps to caller and reclaims staked chimps
     * from caller to this contract.
     * 
     * Requirements:
     * 
     * - The caller must own the staked chimps with the provided `dojoIds`
     */
    function exitDojo(
        uint256[] calldata dojoIds,
        uint32[] calldata xpList,
        bytes32 message,
        bytes calldata signature,
        bytes32 nonce
    ) external;

    /**
     * @dev Return a lost chimp to address (if the chimp is sent to this contract with 
     * transferFrom)
     * 
     * Requirements:
     * 
     * - The caller must be an admin
     */
    function returnLostChimp(address to, bool isGenesisChimp, uint256 tokenId) external;

    /**
     * @dev Check if nonce has been used
     */
    function nonceUsed(bytes32 nonce) external view returns(bool);
}

File 3 of 15 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 5 of 15 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else 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.
            /// @solidity memory-safe-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 6 of 15 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 7 of 15 : AdminControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IAdminControl.sol";

abstract contract AdminControl is Ownable, IAdminControl, ERC165 {
    using EnumerableSet for EnumerableSet.AddressSet;

    // Track registered admins
    EnumerableSet.AddressSet private _admins;

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

    /**
     * @dev Only allows approved admins to call the specified function
     */
    modifier adminRequired() {
        require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin");
        _;
    }   

    /**
     * @dev See {IAdminControl-getAdmins}.
     */
    function getAdmins() external view override returns (address[] memory admins) {
        admins = new address[](_admins.length());
        for (uint i = 0; i < _admins.length(); i++) {
            admins[i] = _admins.at(i);
        }
        return admins;
    }

    /**
     * @dev See {IAdminControl-approveAdmin}.
     */
    function approveAdmin(address admin) external override onlyOwner {
        if (!_admins.contains(admin)) {
            emit AdminApproved(admin, msg.sender);
            _admins.add(admin);
        }
    }

    /**
     * @dev See {IAdminControl-revokeAdmin}.
     */
    function revokeAdmin(address admin) external override onlyOwner {
        if (_admins.contains(admin)) {
            emit AdminRevoked(admin, msg.sender);
            _admins.remove(admin);
        }
    }

    /**
     * @dev See {IAdminControl-isAdmin}.
     */
    function isAdmin(address admin) public override view returns (bool) {
        return (owner() == admin || _admins.contains(admin));
    }

}

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @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 9 of 15 : IERC721Receiver.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 IERC721Receiver {
    /**
     * @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 10 of 15 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @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 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 11 of 15 : IERC165.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 IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 12 of 15 : IAdminControl.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/// @author: manifold.xyz

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/**
 * @dev Interface for admin control
 */
interface IAdminControl is IERC165 {

    event AdminApproved(address indexed account, address indexed sender);
    event AdminRevoked(address indexed account, address indexed sender);

    /**
     * @dev gets address of all admins
     */
    function getAdmins() external view returns (address[] memory);

    /**
     * @dev add an admin.  Can only be called by contract owner.
     */
    function approveAdmin(address admin) external;

    /**
     * @dev remove an admin.  Can only be called by contract owner.
     */
    function revokeAdmin(address admin) external;

    /**
     * @dev checks whether or not given address is an admin
     * Returns True if they are
     */
    function isAdmin(address admin) external view returns (bool);

}

File 13 of 15 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 14 of 15 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 *  Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.
 *  See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 *  In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastValue;
                // Update the index for the moved value
                set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

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

pragma solidity ^0.8.0;

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"chimpersGenesis","type":"address"},{"internalType":"address","name":"chimpersGenerative","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"dojoIds","type":"uint256[]"},{"indexed":false,"internalType":"uint32[]","name":"amounts","type":"uint32[]"}],"name":"CollectedXP","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"approveAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bandanas","outputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint208","name":"xpThreshold","type":"uint208"}],"internalType":"struct IDojo.Bandana[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"isGenesisChimp","type":"bool"}],"name":"chimpBandana","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bool","name":"isGenesisChimp","type":"bool"}],"name":"chimpXP","outputs":[{"internalType":"uint208","name":"","type":"uint208"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"dojoIds","type":"uint256[]"},{"internalType":"uint32[]","name":"amounts","type":"uint32[]"},{"internalType":"bytes32","name":"message","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"collectXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dojoOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"address[]","name":"tokenAddresses","type":"address[]"}],"name":"enterDojo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"dojoIds","type":"uint256[]"},{"internalType":"uint32[]","name":"xpList","type":"uint32[]"},{"internalType":"bytes32","name":"message","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"exitDojo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAdmins","outputs":[{"internalType":"address[]","name":"admins","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"nonceUsed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"openDojo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bool","name":"isGenesisChimp","type":"bool"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"returnLostChimp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"revokeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint32[]","name":"xpThresholds","type":"uint32[]"},{"internalType":"string[]","name":"bandanaNames","type":"string[]"}],"name":"setBandanas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"xp","type":"uint32"}],"name":"setMaxDailyXP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"signingAddress","type":"address"}],"name":"setSigningAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b5060405162003256380380620032568339810160408190526200003491620000e2565b6200003f3362000075565b60018055600880546001600160a01b039384166001600160a01b031991821617909155600980549290931691161790556200011a565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620000dd57600080fd5b919050565b60008060408385031215620000f657600080fd5b6200010183620000c5565b91506200011160208401620000c5565b90509250929050565b61312c806200012a6000396000f3fe608060405234801561001057600080fd5b506004361061021c5760003560e01c806370a0823111610125578063aca14487116100ad578063c87b56dd1161007c578063c87b56dd146104f6578063d1d3097914610509578063e0df5b6f14610511578063e985e9c514610524578063f2fde38b1461053a57600080fd5b8063aca14487146104a8578063b7158185146104bb578063b88d4fde146104d0578063becb9969146104e357600080fd5b80638fa10e8f116100f45780638fa10e8f1461042757806395d89b4114610452578063960fc0901461047a5780639f3ce9331461048d578063a22cb4651461049a57600080fd5b806370a08231146103da578063715018a6146103fb5780637c377d15146104035780638da5cb5b1461041657600080fd5b80632cac8520116101a857806342842e0e1161017757806342842e0e1461030257806361a4422b146103895780636352211e146103ac5780636c0360eb146103bf5780636d73e669146103c757600080fd5b80632cac85201461033b5780632d3456701461034e57806331ae450b1461036157806331beb6051461037657600080fd5b8063150b7a02116101ef578063150b7a02146102c3578063162c2a91146102ef57806323b872dd1461030257806324d7806c146103155780632b6c7b9d1461032857600080fd5b806301ffc9a71461022157806306fdde0314610249578063081812fc14610282578063095ea7b3146102ae575b600080fd5b61023461022f366004612aef565b61054d565b60405190151581526020015b60405180910390f35b6102756040518060400160405280600d81526020016c4368696d7065727320446f6a6f60981b81525081565b6040516102409190612e9a565b610296610290366004612ad6565b50600090565b6040516001600160a01b039091168152602001610240565b6102c16102bc366004612995565b610593565b005b6102d66102d13660046127f4565b61059f565b6040516001600160e01b03199091168152602001610240565b6102756102fd366004612b5b565b61080e565b6102c16103103660046127b8565b610967565b61023461032336600461276a565b610974565b6102c1610336366004612b7e565b6109ad565b6102c1610349366004612a2b565b610a1d565b6102c161035c36600461276a565b610ced565b610369610d49565b6040516102409190612d49565b6102c161038436600461276a565b610df8565b610234610397366004612ad6565b60009081526007602052604090205460ff1690565b6102966103ba366004612ad6565b610e64565b610275610ec9565b6102c16103d536600461276a565b610f57565b6103ed6103e836600461276a565b610faf565b604051908152602001610240565b6102c1611035565b6102c1610411366004612a2b565b611049565b6000546001600160a01b0316610296565b61043a610435366004612b5b565b6112f3565b6040516001600160d01b039091168152602001610240565b610275604051806040016040528060098152602001684348494d50444f4a4f60b81b81525081565b6102c16104883660046129bf565b611320565b600d546102349060ff1681565b6102c16102bc36600461293f565b6102c16104b6366004612969565b6113fd565b6104c36115a2565b6040516102409190612d96565b6102c16104de366004612863565b6116a6565b6102c16104f13660046129bf565b6116b4565b610275610504366004612ad6565b6118f2565b6102c16119b5565b6102c161051f366004612b19565b611a0e565b610234610532366004612785565b600092915050565b6102c161054836600461276a565b611a64565b60006001600160e01b031982166380ac58cd60e01b148061057e57506001600160e01b03198216635b5e139f60e01b145b8061058d575061058d82611ada565b92915050565b61059b611b0f565b5050565b6000600260015414156105f95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001556008546001600160a01b031633148061062157506009546001600160a01b031633145b61065b5760405162461bcd60e51b815260206004820152600b60248201526a125b9d985b1a590813919560aa1b60448201526064016105f0565b600d5460ff166106ad5760405162461bcd60e51b815260206004820152601c60248201527f54686520446f6a6f20686173206e6f74206265656e206f70656e65640000000060448201526064016105f0565b60095484906001600160a01b03163314156106d1576106ce61271082612f63565b90505b6040805180820182526001600160a01b0380891680835265ffffffffffff4281166020808601918252600088815260048252878120965187549351909416600160a01b026001600160d01b031990931693909516929092171790935581526005909152908120805460019290610748908490612f63565b90915550506000818152600660205260409020546001600160d01b03166107bf57600b60008154811061077d5761077d6130ca565b60009182526020808320600160029093020191909101548383526006909152604090912080546001600160d01b0319166001600160d01b039092169190911790555b60405181906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450506001805550630a85bd0160e11b949350505050565b6060600061081c8484611b7d565b600b549091505b801561094f57600b610836600183612fae565b81548110610846576108466130ca565b600091825260208083206001600290930201919091015484835260069091526040909120546001600160d01b0391821691161061093d57600b61088a600183612fae565b8154811061089a5761089a6130ca565b906000526020600020906002020160000180546108b690613008565b80601f01602080910402602001604051908101604052809291908181526020018280546108e290613008565b801561092f5780601f106109045761010080835404028352916020019161092f565b820191906000526020600020905b81548152906001019060200180831161091257829003601f168201915b50505050509250505061058d565b8061094781612ff1565b915050610823565b50506040805160208101909152600081529392505050565b61096f611b0f565b505050565b6000816001600160a01b03166109926000546001600160a01b031690565b6001600160a01b0316148061058d575061058d600283611c1f565b336109c06000546001600160a01b031690565b6001600160a01b031614806109db57506109db600233611c1f565b6109f75760405162461bcd60e51b81526004016105f090612ead565b600a805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b610a2d8888888888888888611c41565b8660005b81811015610c9a5760008a8a83818110610a4d57610a4d6130ca565b6020908102929092013560008181526004909352604090922054919250506001600160a01b0316610ac05760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016105f0565b6000818152600660205260408120546201518090600160d01b900465ffffffffffff1615610b0b57600083815260066020526040902054600160d01b900465ffffffffffff16610b2a565b600083815260046020526040902054600160a01b900465ffffffffffff165b610b3c9065ffffffffffff1642612fae565b610b469190612f7b565b600a54909150610b6390600160a01b900463ffffffff1682612f8f565b8a8a85818110610b7557610b756130ca565b9050602002016020810190610b8a9190612b7e565b63ffffffff161115610bde5760405162461bcd60e51b815260206004820152601360248201527f45786365656473206461696c79206c696d69740000000000000000000000000060448201526064016105f0565b600082815260066020526040902080546001600160d01b0316600160d01b4265ffffffffffff1602179055898984818110610c1b57610c1b6130ca565b9050602002016020810190610c309190612b7e565b6000838152600660205260408120805463ffffffff9390931692909190610c619084906001600160d01b0316612f38565b92506101000a8154816001600160d01b0302191690836001600160d01b0316021790555050508080610c9290613043565b915050610a31565b50336001600160a01b03167f9912dab38cc39c5b101322550c4951a498aa2383d4e4427991305d54be0beb408a8a8a8a604051610cda9493929190612e15565b60405180910390a2505050505050505050565b610cf5611e0e565b610d00600282611c1f565b15610d465760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a361059b600282611e68565b50565b6060610d556002611e7d565b67ffffffffffffffff811115610d6d57610d6d6130e0565b604051908082528060200260200182016040528015610d96578160200160208202803683370190505b50905060005b610da66002611e7d565b811015610df457610db8600282611e87565b828281518110610dca57610dca6130ca565b6001600160a01b039092166020928302919091019091015280610dec81613043565b915050610d9c565b5090565b33610e0b6000546001600160a01b031690565b6001600160a01b03161480610e265750610e26600233611c1f565b610e425760405162461bcd60e51b81526004016105f090612ead565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600460205260408120546001600160a01b03168061058d5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016105f0565b600c8054610ed690613008565b80601f0160208091040260200160405190810160405280929190818152602001828054610f0290613008565b8015610f4f5780601f10610f2457610100808354040283529160200191610f4f565b820191906000526020600020905b815481529060010190602001808311610f3257829003601f168201915b505050505081565b610f5f611e0e565b610f6a600282611c1f565b610d465760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a361059b600282611e93565b60006001600160a01b0382166110195760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016105f0565b506001600160a01b031660009081526005602052604090205490565b61103d611e0e565b6110476000611ea8565b565b6002600154141561109c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105f0565b600260015584156110b7576110b78888888888888888610a1d565b8660005b818110156112e35760008a8a838181106110d7576110d76130ca565b6020908102929092013560008181526004909352604090922054919250506001600160a01b0316331461114c5760405162461bcd60e51b815260206004820152601460248201527f41646472657373206973206e6f74206f776e657200000000000000000000000060448201526064016105f0565b600081815260046020908152604080832080546001600160a01b031916905533835260059091528120805460019290611186908490612fae565b909155505060008181526006602052604080822080546001600160d01b031690555182919033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a460648111611249576008546040516323b872dd60e01b8152306004820152336024820152604481018390526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561122c57600080fd5b505af1158015611240573d6000803e3d6000fd5b505050506112d0565b6009546001600160a01b03166323b872dd303361126861271086612fae565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b1580156112b757600080fd5b505af11580156112cb573d6000803e3d6000fd5b505050505b50806112db81613043565b9150506110bb565b5050600180555050505050505050565b6000806113008484611b7d565b6000908152600660205260409020546001600160d01b0316949350505050565b60005b838110156113f65782828281811061133d5761133d6130ca565b9050602002016020810190611352919061276a565b6001600160a01b03166342842e0e3330888886818110611374576113746130ca565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156113cb57600080fd5b505af11580156113df573d6000803e3d6000fd5b5050505080806113ee90613043565b915050611323565b5050505050565b336114106000546001600160a01b031690565b6001600160a01b0316148061142b575061142b600233611c1f565b6114475760405162461bcd60e51b81526004016105f090612ead565b81801561146957506000818152600460205260409020546001600160a01b0316155b156114e0576008546040516323b872dd60e01b81523060048201526001600160a01b03858116602483015260448201849052909116906323b872dd906064015b600060405180830381600087803b1580156114c357600080fd5b505af11580156114d7573d6000803e3d6000fd5b50505050505050565b81158015611516575060006004816114fa84612710612f63565b81526020810191909152604001600020546001600160a01b0316145b1561155a576009546040516323b872dd60e01b81523060048201526001600160a01b03858116602483015260448201849052909116906323b872dd906064016114a9565b60405162461bcd60e51b815260206004820152601660248201527f54686973206368696d70206973206e6f74206c6f73740000000000000000000060448201526064016105f0565b6060600b805480602002602001604051908101604052809291908181526020016000905b8282101561169d57838290600052602060002090600202016040518060400160405290816000820180546115f990613008565b80601f016020809104026020016040519081016040528092919081815260200182805461162590613008565b80156116725780601f1061164757610100808354040283529160200191611672565b820191906000526020600020905b81548152906001019060200180831161165557829003601f168201915b50505091835250506001918201546001600160d01b03166020918201529183529290920191016115c6565b50505050905090565b6116ae611b0f565b50505050565b336116c76000546001600160a01b031690565b6001600160a01b031614806116e257506116e2600233611c1f565b6116fe5760405162461bcd60e51b81526004016105f090612ead565b8260015b818110156117cd578585611717600184612fae565b818110611726576117266130ca565b905060200201602081019061173b9190612b7e565b63ffffffff16868683818110611753576117536130ca565b90506020020160208101906117689190612b7e565b63ffffffff16116117bb5760405162461bcd60e51b815260206004820152601760248201527f42616e64616e6173206d75737420626520736f7274656400000000000000000060448201526064016105f0565b806117c581613043565b915050611702565b506117da600b6000612510565b60005b818110156118ea57600b6040518060400160405280868685818110611804576118046130ca565b90506020028101906118169190612ef1565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001888885818110611862576118626130ca565b90506020020160208101906118779190612b7e565b63ffffffff169052815460018101835560009283526020928390208251805193946002909302909101926118ae9284920190612531565b5060209190910151600190910180546001600160d01b0319166001600160d01b03909216919091179055806118e281613043565b9150506117dd565b505050505050565b6000818152600460205260409020546060906001600160a01b03166119595760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016105f0565b6000600c805461196890613008565b905011611984576040518060200160405280600081525061058d565b600c61198f83611ef8565b6040516020016119a0929190612be1565b60405160208183030381529060405292915050565b336119c86000546001600160a01b031690565b6001600160a01b031614806119e357506119e3600233611c1f565b6119ff5760405162461bcd60e51b81526004016105f090612ead565b600d805460ff19166001179055565b33611a216000546001600160a01b031690565b6001600160a01b03161480611a3c5750611a3c600233611c1f565b611a585760405162461bcd60e51b81526004016105f090612ead565b61096f600c83836125b1565b611a6c611e0e565b6001600160a01b038116611ad15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f0565b610d4681611ea8565b60006001600160e01b03198216632a9f3abf60e11b148061058d57506301ffc9a760e01b6001600160e01b031983161461058d565b60405162461bcd60e51b815260206004820152603460248201527f43616e6e6f7420706572666f726d207472616e7366657273206f6e2061206e6f60448201527f6e2d7472616e7366657261626c6520746f6b656e00000000000000000000000060648201526084016105f0565b600060018310158015611b91575060648311155b80611bb4575081158015611ba6575060018310155b8015611bb457506115b38311155b611c005760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2049440000000000000000000000000000000060448201526064016105f0565b81611c1657611c1183612710612f63565b611c18565b825b9392505050565b6001600160a01b03811660009081526001830160205260408120541515611c18565b600081815260076020526040902054879060ff1615611ca25760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f74207265706c6179207472616e73616374696f6e0000000000000060448201526064016105f0565b6000611cc2611cb2836040612f8f565b611cbd906034612f63565b611ef8565b33848c8c8c8c604051602001611cde9796959493929190612c88565b604051602081830303815290604052805190602001209050808614611d455760405162461bcd60e51b815260206004820152601160248201527f4d616c666f726d6564206d65737361676500000000000000000000000000000060448201526064016105f0565b6000611d8986868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b939250506120169050565b600a549091506001600160a01b03808316911614611de95760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105f0565b5050506000908152600760205260409020805460ff1916600117905550505050505050565b6000546001600160a01b031633146110475760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105f0565b6000611c18836001600160a01b03841661203a565b600061058d825490565b6000611c18838361212d565b6000611c18836001600160a01b038416612157565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081611f1c5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611f465780611f3081613043565b9150611f3f9050600a83612f7b565b9150611f20565b60008167ffffffffffffffff811115611f6157611f616130e0565b6040519080825280601f01601f191660200182016040528015611f8b576020820181803683370190505b5090505b841561200e57611fa0600183612fae565b9150611fad600a8661305e565b611fb8906030612f63565b60f81b818381518110611fcd57611fcd6130ca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612007600a86612f7b565b9450611f8f565b949350505050565b600080600061202585856121a6565b9150915061203281612216565b509392505050565b6000818152600183016020526040812054801561212357600061205e600183612fae565b855490915060009061207290600190612fae565b90508181146120d7576000866000018281548110612092576120926130ca565b90600052602060002001549050808760000184815481106120b5576120b56130ca565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806120e8576120e86130b4565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061058d565b600091505061058d565b6000826000018281548110612144576121446130ca565b9060005260206000200154905092915050565b600081815260018301602052604081205461219e5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561058d565b50600061058d565b6000808251604114156121dd5760208301516040840151606085015160001a6121d1878285856123d1565b9450945050505061220f565b82516040141561220757602083015160408401516121fc8683836124be565b93509350505061220f565b506000905060025b9250929050565b600081600481111561222a5761222a61309e565b14156122335750565b60018160048111156122475761224761309e565b14156122955760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016105f0565b60028160048111156122a9576122a961309e565b14156122f75760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016105f0565b600381600481111561230b5761230b61309e565b14156123645760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016105f0565b60048160048111156123785761237861309e565b1415610d465760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016105f0565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561240857506000905060036124b5565b8460ff16601b1415801561242057508460ff16601c14155b1561243157506000905060046124b5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612485573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124ae576000600192509250506124b5565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816124f460ff86901c601b612f63565b9050612502878288856123d1565b935093505050935093915050565b5080546000825560020290600052602060002090810190610d469190612625565b82805461253d90613008565b90600052602060002090601f01602090048101928261255f57600085556125a5565b82601f1061257857805160ff19168380011785556125a5565b828001600101855582156125a5579182015b828111156125a557825182559160200191906001019061258a565b50610df4929150612654565b8280546125bd90613008565b90600052602060002090601f0160209004810192826125df57600085556125a5565b82601f106125f85782800160ff198235161785556125a5565b828001600101855582156125a5579182015b828111156125a557823582559160200191906001019061260a565b80821115610df45760006126398282612669565b506001810180546001600160d01b0319169055600201612625565b5b80821115610df45760008155600101612655565b50805461267590613008565b6000825580601f10612685575050565b601f016020900490600052602060002090810190610d469190612654565b80356001600160a01b03811681146126ba57600080fd5b919050565b60008083601f8401126126d157600080fd5b50813567ffffffffffffffff8111156126e957600080fd5b6020830191508360208260051b850101111561220f57600080fd5b803580151581146126ba57600080fd5b60008083601f84011261272657600080fd5b50813567ffffffffffffffff81111561273e57600080fd5b60208301915083602082850101111561220f57600080fd5b803563ffffffff811681146126ba57600080fd5b60006020828403121561277c57600080fd5b611c18826126a3565b6000806040838503121561279857600080fd5b6127a1836126a3565b91506127af602084016126a3565b90509250929050565b6000806000606084860312156127cd57600080fd5b6127d6846126a3565b92506127e4602085016126a3565b9150604084013590509250925092565b60008060008060006080868803121561280c57600080fd5b612815866126a3565b9450612823602087016126a3565b935060408601359250606086013567ffffffffffffffff81111561284657600080fd5b61285288828901612714565b969995985093965092949392505050565b6000806000806080858703121561287957600080fd5b612882856126a3565b9350612890602086016126a3565b925060408501359150606085013567ffffffffffffffff808211156128b457600080fd5b818701915087601f8301126128c857600080fd5b8135818111156128da576128da6130e0565b604051601f8201601f19908116603f01168101908382118183101715612902576129026130e0565b816040528281528a602084870101111561291b57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561295257600080fd5b61295b836126a3565b91506127af60208401612704565b60008060006060848603121561297e57600080fd5b612987846126a3565b92506127e460208501612704565b600080604083850312156129a857600080fd5b6129b1836126a3565b946020939093013593505050565b600080600080604085870312156129d557600080fd5b843567ffffffffffffffff808211156129ed57600080fd5b6129f9888389016126bf565b90965094506020870135915080821115612a1257600080fd5b50612a1f878288016126bf565b95989497509550505050565b60008060008060008060008060a0898b031215612a4757600080fd5b883567ffffffffffffffff80821115612a5f57600080fd5b612a6b8c838d016126bf565b909a50985060208b0135915080821115612a8457600080fd5b612a908c838d016126bf565b909850965060408b0135955060608b0135915080821115612ab057600080fd5b50612abd8b828c01612714565b999c989b50969995989497949560800135949350505050565b600060208284031215612ae857600080fd5b5035919050565b600060208284031215612b0157600080fd5b81356001600160e01b031981168114611c1857600080fd5b60008060208385031215612b2c57600080fd5b823567ffffffffffffffff811115612b4357600080fd5b612b4f85828601612714565b90969095509350505050565b60008060408385031215612b6e57600080fd5b823591506127af60208401612704565b600060208284031215612b9057600080fd5b611c1882612756565b60008151808452612bb1816020860160208601612fc5565b601f01601f19169290920160200192915050565b60008151612bd7818560208601612fc5565b9290920192915050565b600080845481600182811c915080831680612bfd57607f831692505b6020808410821415612c1d57634e487b7160e01b86526022600452602486fd5b818015612c315760018114612c4257612c6f565b60ff19861689528489019650612c6f565b60008b81526020902060005b86811015612c675781548b820152908501908301612c4e565b505084890196505b505050505050612c7f8185612bc5565b95945050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600088516020612cc182601a8601838e01612fc5565b81840191506bffffffffffffffffffffffff198a60601b16601a83015288602e8301526001600160fb1b03871115612cf857600080fd5b8660051b8089604e85013760009201604e0182815286925b86811015612d395763ffffffff612d2685612756565b1682529282019290820190600101612d10565b509b9a5050505050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612d8a5783516001600160a01b031683529284019291840191600101612d65565b50909695505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015612e0757888303603f1901855281518051878552612de188860182612b99565b918901516001600160d01b03169489019490945294870194925090860190600101612dbd565b509098975050505050505050565b6040815283604082015260006001600160fb1b03851115612e3557600080fd5b8460051b808760608501376060908301838103820160208086019190915291810185905285916000916080015b86831015612e8d5763ffffffff612e7885612756565b16815292810192600192909201918101612e62565b9998505050505050505050565b602081526000611c186020830184612b99565b60208082526024908201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616040820152633236b4b760e11b606082015260800190565b6000808335601e19843603018112612f0857600080fd5b83018035915067ffffffffffffffff821115612f2357600080fd5b60200191503681900382131561220f57600080fd5b60006001600160d01b03808316818516808303821115612f5a57612f5a613072565b01949350505050565b60008219821115612f7657612f76613072565b500190565b600082612f8a57612f8a613088565b500490565b6000816000190483118215151615612fa957612fa9613072565b500290565b600082821015612fc057612fc0613072565b500390565b60005b83811015612fe0578181015183820152602001612fc8565b838111156116ae5750506000910152565b60008161300057613000613072565b506000190190565b600181811c9082168061301c57607f821691505b6020821081141561303d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561305757613057613072565b5060010190565b60008261306d5761306d613088565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220b616d721218d37978996763a4b610e2a158634fbdec8b656b810ac3fb739e03964736f6c634300080700330000000000000000000000004d55109a17a6914130ace90325dc98cf66ebfa0000000000000000000000000080336ad7a747236ef41f47ed2c7641828a480baa

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061021c5760003560e01c806370a0823111610125578063aca14487116100ad578063c87b56dd1161007c578063c87b56dd146104f6578063d1d3097914610509578063e0df5b6f14610511578063e985e9c514610524578063f2fde38b1461053a57600080fd5b8063aca14487146104a8578063b7158185146104bb578063b88d4fde146104d0578063becb9969146104e357600080fd5b80638fa10e8f116100f45780638fa10e8f1461042757806395d89b4114610452578063960fc0901461047a5780639f3ce9331461048d578063a22cb4651461049a57600080fd5b806370a08231146103da578063715018a6146103fb5780637c377d15146104035780638da5cb5b1461041657600080fd5b80632cac8520116101a857806342842e0e1161017757806342842e0e1461030257806361a4422b146103895780636352211e146103ac5780636c0360eb146103bf5780636d73e669146103c757600080fd5b80632cac85201461033b5780632d3456701461034e57806331ae450b1461036157806331beb6051461037657600080fd5b8063150b7a02116101ef578063150b7a02146102c3578063162c2a91146102ef57806323b872dd1461030257806324d7806c146103155780632b6c7b9d1461032857600080fd5b806301ffc9a71461022157806306fdde0314610249578063081812fc14610282578063095ea7b3146102ae575b600080fd5b61023461022f366004612aef565b61054d565b60405190151581526020015b60405180910390f35b6102756040518060400160405280600d81526020016c4368696d7065727320446f6a6f60981b81525081565b6040516102409190612e9a565b610296610290366004612ad6565b50600090565b6040516001600160a01b039091168152602001610240565b6102c16102bc366004612995565b610593565b005b6102d66102d13660046127f4565b61059f565b6040516001600160e01b03199091168152602001610240565b6102756102fd366004612b5b565b61080e565b6102c16103103660046127b8565b610967565b61023461032336600461276a565b610974565b6102c1610336366004612b7e565b6109ad565b6102c1610349366004612a2b565b610a1d565b6102c161035c36600461276a565b610ced565b610369610d49565b6040516102409190612d49565b6102c161038436600461276a565b610df8565b610234610397366004612ad6565b60009081526007602052604090205460ff1690565b6102966103ba366004612ad6565b610e64565b610275610ec9565b6102c16103d536600461276a565b610f57565b6103ed6103e836600461276a565b610faf565b604051908152602001610240565b6102c1611035565b6102c1610411366004612a2b565b611049565b6000546001600160a01b0316610296565b61043a610435366004612b5b565b6112f3565b6040516001600160d01b039091168152602001610240565b610275604051806040016040528060098152602001684348494d50444f4a4f60b81b81525081565b6102c16104883660046129bf565b611320565b600d546102349060ff1681565b6102c16102bc36600461293f565b6102c16104b6366004612969565b6113fd565b6104c36115a2565b6040516102409190612d96565b6102c16104de366004612863565b6116a6565b6102c16104f13660046129bf565b6116b4565b610275610504366004612ad6565b6118f2565b6102c16119b5565b6102c161051f366004612b19565b611a0e565b610234610532366004612785565b600092915050565b6102c161054836600461276a565b611a64565b60006001600160e01b031982166380ac58cd60e01b148061057e57506001600160e01b03198216635b5e139f60e01b145b8061058d575061058d82611ada565b92915050565b61059b611b0f565b5050565b6000600260015414156105f95760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001556008546001600160a01b031633148061062157506009546001600160a01b031633145b61065b5760405162461bcd60e51b815260206004820152600b60248201526a125b9d985b1a590813919560aa1b60448201526064016105f0565b600d5460ff166106ad5760405162461bcd60e51b815260206004820152601c60248201527f54686520446f6a6f20686173206e6f74206265656e206f70656e65640000000060448201526064016105f0565b60095484906001600160a01b03163314156106d1576106ce61271082612f63565b90505b6040805180820182526001600160a01b0380891680835265ffffffffffff4281166020808601918252600088815260048252878120965187549351909416600160a01b026001600160d01b031990931693909516929092171790935581526005909152908120805460019290610748908490612f63565b90915550506000818152600660205260409020546001600160d01b03166107bf57600b60008154811061077d5761077d6130ca565b60009182526020808320600160029093020191909101548383526006909152604090912080546001600160d01b0319166001600160d01b039092169190911790555b60405181906001600160a01b038816906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a450506001805550630a85bd0160e11b949350505050565b6060600061081c8484611b7d565b600b549091505b801561094f57600b610836600183612fae565b81548110610846576108466130ca565b600091825260208083206001600290930201919091015484835260069091526040909120546001600160d01b0391821691161061093d57600b61088a600183612fae565b8154811061089a5761089a6130ca565b906000526020600020906002020160000180546108b690613008565b80601f01602080910402602001604051908101604052809291908181526020018280546108e290613008565b801561092f5780601f106109045761010080835404028352916020019161092f565b820191906000526020600020905b81548152906001019060200180831161091257829003601f168201915b50505050509250505061058d565b8061094781612ff1565b915050610823565b50506040805160208101909152600081529392505050565b61096f611b0f565b505050565b6000816001600160a01b03166109926000546001600160a01b031690565b6001600160a01b0316148061058d575061058d600283611c1f565b336109c06000546001600160a01b031690565b6001600160a01b031614806109db57506109db600233611c1f565b6109f75760405162461bcd60e51b81526004016105f090612ead565b600a805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b610a2d8888888888888888611c41565b8660005b81811015610c9a5760008a8a83818110610a4d57610a4d6130ca565b6020908102929092013560008181526004909352604090922054919250506001600160a01b0316610ac05760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016105f0565b6000818152600660205260408120546201518090600160d01b900465ffffffffffff1615610b0b57600083815260066020526040902054600160d01b900465ffffffffffff16610b2a565b600083815260046020526040902054600160a01b900465ffffffffffff165b610b3c9065ffffffffffff1642612fae565b610b469190612f7b565b600a54909150610b6390600160a01b900463ffffffff1682612f8f565b8a8a85818110610b7557610b756130ca565b9050602002016020810190610b8a9190612b7e565b63ffffffff161115610bde5760405162461bcd60e51b815260206004820152601360248201527f45786365656473206461696c79206c696d69740000000000000000000000000060448201526064016105f0565b600082815260066020526040902080546001600160d01b0316600160d01b4265ffffffffffff1602179055898984818110610c1b57610c1b6130ca565b9050602002016020810190610c309190612b7e565b6000838152600660205260408120805463ffffffff9390931692909190610c619084906001600160d01b0316612f38565b92506101000a8154816001600160d01b0302191690836001600160d01b0316021790555050508080610c9290613043565b915050610a31565b50336001600160a01b03167f9912dab38cc39c5b101322550c4951a498aa2383d4e4427991305d54be0beb408a8a8a8a604051610cda9493929190612e15565b60405180910390a2505050505050505050565b610cf5611e0e565b610d00600282611c1f565b15610d465760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a361059b600282611e68565b50565b6060610d556002611e7d565b67ffffffffffffffff811115610d6d57610d6d6130e0565b604051908082528060200260200182016040528015610d96578160200160208202803683370190505b50905060005b610da66002611e7d565b811015610df457610db8600282611e87565b828281518110610dca57610dca6130ca565b6001600160a01b039092166020928302919091019091015280610dec81613043565b915050610d9c565b5090565b33610e0b6000546001600160a01b031690565b6001600160a01b03161480610e265750610e26600233611c1f565b610e425760405162461bcd60e51b81526004016105f090612ead565b600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600460205260408120546001600160a01b03168061058d5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016105f0565b600c8054610ed690613008565b80601f0160208091040260200160405190810160405280929190818152602001828054610f0290613008565b8015610f4f5780601f10610f2457610100808354040283529160200191610f4f565b820191906000526020600020905b815481529060010190602001808311610f3257829003601f168201915b505050505081565b610f5f611e0e565b610f6a600282611c1f565b610d465760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a361059b600282611e93565b60006001600160a01b0382166110195760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016105f0565b506001600160a01b031660009081526005602052604090205490565b61103d611e0e565b6110476000611ea8565b565b6002600154141561109c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105f0565b600260015584156110b7576110b78888888888888888610a1d565b8660005b818110156112e35760008a8a838181106110d7576110d76130ca565b6020908102929092013560008181526004909352604090922054919250506001600160a01b0316331461114c5760405162461bcd60e51b815260206004820152601460248201527f41646472657373206973206e6f74206f776e657200000000000000000000000060448201526064016105f0565b600081815260046020908152604080832080546001600160a01b031916905533835260059091528120805460019290611186908490612fae565b909155505060008181526006602052604080822080546001600160d01b031690555182919033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a460648111611249576008546040516323b872dd60e01b8152306004820152336024820152604481018390526001600160a01b03909116906323b872dd90606401600060405180830381600087803b15801561122c57600080fd5b505af1158015611240573d6000803e3d6000fd5b505050506112d0565b6009546001600160a01b03166323b872dd303361126861271086612fae565b6040516001600160e01b031960e086901b1681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b1580156112b757600080fd5b505af11580156112cb573d6000803e3d6000fd5b505050505b50806112db81613043565b9150506110bb565b5050600180555050505050505050565b6000806113008484611b7d565b6000908152600660205260409020546001600160d01b0316949350505050565b60005b838110156113f65782828281811061133d5761133d6130ca565b9050602002016020810190611352919061276a565b6001600160a01b03166342842e0e3330888886818110611374576113746130ca565b6040516001600160e01b031960e088901b1681526001600160a01b03958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b1580156113cb57600080fd5b505af11580156113df573d6000803e3d6000fd5b5050505080806113ee90613043565b915050611323565b5050505050565b336114106000546001600160a01b031690565b6001600160a01b0316148061142b575061142b600233611c1f565b6114475760405162461bcd60e51b81526004016105f090612ead565b81801561146957506000818152600460205260409020546001600160a01b0316155b156114e0576008546040516323b872dd60e01b81523060048201526001600160a01b03858116602483015260448201849052909116906323b872dd906064015b600060405180830381600087803b1580156114c357600080fd5b505af11580156114d7573d6000803e3d6000fd5b50505050505050565b81158015611516575060006004816114fa84612710612f63565b81526020810191909152604001600020546001600160a01b0316145b1561155a576009546040516323b872dd60e01b81523060048201526001600160a01b03858116602483015260448201849052909116906323b872dd906064016114a9565b60405162461bcd60e51b815260206004820152601660248201527f54686973206368696d70206973206e6f74206c6f73740000000000000000000060448201526064016105f0565b6060600b805480602002602001604051908101604052809291908181526020016000905b8282101561169d57838290600052602060002090600202016040518060400160405290816000820180546115f990613008565b80601f016020809104026020016040519081016040528092919081815260200182805461162590613008565b80156116725780601f1061164757610100808354040283529160200191611672565b820191906000526020600020905b81548152906001019060200180831161165557829003601f168201915b50505091835250506001918201546001600160d01b03166020918201529183529290920191016115c6565b50505050905090565b6116ae611b0f565b50505050565b336116c76000546001600160a01b031690565b6001600160a01b031614806116e257506116e2600233611c1f565b6116fe5760405162461bcd60e51b81526004016105f090612ead565b8260015b818110156117cd578585611717600184612fae565b818110611726576117266130ca565b905060200201602081019061173b9190612b7e565b63ffffffff16868683818110611753576117536130ca565b90506020020160208101906117689190612b7e565b63ffffffff16116117bb5760405162461bcd60e51b815260206004820152601760248201527f42616e64616e6173206d75737420626520736f7274656400000000000000000060448201526064016105f0565b806117c581613043565b915050611702565b506117da600b6000612510565b60005b818110156118ea57600b6040518060400160405280868685818110611804576118046130ca565b90506020028101906118169190612ef1565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001888885818110611862576118626130ca565b90506020020160208101906118779190612b7e565b63ffffffff169052815460018101835560009283526020928390208251805193946002909302909101926118ae9284920190612531565b5060209190910151600190910180546001600160d01b0319166001600160d01b03909216919091179055806118e281613043565b9150506117dd565b505050505050565b6000818152600460205260409020546060906001600160a01b03166119595760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e204944000000000000000060448201526064016105f0565b6000600c805461196890613008565b905011611984576040518060200160405280600081525061058d565b600c61198f83611ef8565b6040516020016119a0929190612be1565b60405160208183030381529060405292915050565b336119c86000546001600160a01b031690565b6001600160a01b031614806119e357506119e3600233611c1f565b6119ff5760405162461bcd60e51b81526004016105f090612ead565b600d805460ff19166001179055565b33611a216000546001600160a01b031690565b6001600160a01b03161480611a3c5750611a3c600233611c1f565b611a585760405162461bcd60e51b81526004016105f090612ead565b61096f600c83836125b1565b611a6c611e0e565b6001600160a01b038116611ad15760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016105f0565b610d4681611ea8565b60006001600160e01b03198216632a9f3abf60e11b148061058d57506301ffc9a760e01b6001600160e01b031983161461058d565b60405162461bcd60e51b815260206004820152603460248201527f43616e6e6f7420706572666f726d207472616e7366657273206f6e2061206e6f60448201527f6e2d7472616e7366657261626c6520746f6b656e00000000000000000000000060648201526084016105f0565b600060018310158015611b91575060648311155b80611bb4575081158015611ba6575060018310155b8015611bb457506115b38311155b611c005760405162461bcd60e51b815260206004820152601060248201527f496e76616c696420746f6b656e2049440000000000000000000000000000000060448201526064016105f0565b81611c1657611c1183612710612f63565b611c18565b825b9392505050565b6001600160a01b03811660009081526001830160205260408120541515611c18565b600081815260076020526040902054879060ff1615611ca25760405162461bcd60e51b815260206004820152601960248201527f43616e6e6f74207265706c6179207472616e73616374696f6e0000000000000060448201526064016105f0565b6000611cc2611cb2836040612f8f565b611cbd906034612f63565b611ef8565b33848c8c8c8c604051602001611cde9796959493929190612c88565b604051602081830303815290604052805190602001209050808614611d455760405162461bcd60e51b815260206004820152601160248201527f4d616c666f726d6564206d65737361676500000000000000000000000000000060448201526064016105f0565b6000611d8986868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508b939250506120169050565b600a549091506001600160a01b03808316911614611de95760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016105f0565b5050506000908152600760205260409020805460ff1916600117905550505050505050565b6000546001600160a01b031633146110475760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105f0565b6000611c18836001600160a01b03841661203a565b600061058d825490565b6000611c18838361212d565b6000611c18836001600160a01b038416612157565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b606081611f1c5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115611f465780611f3081613043565b9150611f3f9050600a83612f7b565b9150611f20565b60008167ffffffffffffffff811115611f6157611f616130e0565b6040519080825280601f01601f191660200182016040528015611f8b576020820181803683370190505b5090505b841561200e57611fa0600183612fae565b9150611fad600a8661305e565b611fb8906030612f63565b60f81b818381518110611fcd57611fcd6130ca565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350612007600a86612f7b565b9450611f8f565b949350505050565b600080600061202585856121a6565b9150915061203281612216565b509392505050565b6000818152600183016020526040812054801561212357600061205e600183612fae565b855490915060009061207290600190612fae565b90508181146120d7576000866000018281548110612092576120926130ca565b90600052602060002001549050808760000184815481106120b5576120b56130ca565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806120e8576120e86130b4565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061058d565b600091505061058d565b6000826000018281548110612144576121446130ca565b9060005260206000200154905092915050565b600081815260018301602052604081205461219e5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561058d565b50600061058d565b6000808251604114156121dd5760208301516040840151606085015160001a6121d1878285856123d1565b9450945050505061220f565b82516040141561220757602083015160408401516121fc8683836124be565b93509350505061220f565b506000905060025b9250929050565b600081600481111561222a5761222a61309e565b14156122335750565b60018160048111156122475761224761309e565b14156122955760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016105f0565b60028160048111156122a9576122a961309e565b14156122f75760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016105f0565b600381600481111561230b5761230b61309e565b14156123645760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016105f0565b60048160048111156123785761237861309e565b1415610d465760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016105f0565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561240857506000905060036124b5565b8460ff16601b1415801561242057508460ff16601c14155b1561243157506000905060046124b5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612485573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166124ae576000600192509250506124b5565b9150600090505b94509492505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816124f460ff86901c601b612f63565b9050612502878288856123d1565b935093505050935093915050565b5080546000825560020290600052602060002090810190610d469190612625565b82805461253d90613008565b90600052602060002090601f01602090048101928261255f57600085556125a5565b82601f1061257857805160ff19168380011785556125a5565b828001600101855582156125a5579182015b828111156125a557825182559160200191906001019061258a565b50610df4929150612654565b8280546125bd90613008565b90600052602060002090601f0160209004810192826125df57600085556125a5565b82601f106125f85782800160ff198235161785556125a5565b828001600101855582156125a5579182015b828111156125a557823582559160200191906001019061260a565b80821115610df45760006126398282612669565b506001810180546001600160d01b0319169055600201612625565b5b80821115610df45760008155600101612655565b50805461267590613008565b6000825580601f10612685575050565b601f016020900490600052602060002090810190610d469190612654565b80356001600160a01b03811681146126ba57600080fd5b919050565b60008083601f8401126126d157600080fd5b50813567ffffffffffffffff8111156126e957600080fd5b6020830191508360208260051b850101111561220f57600080fd5b803580151581146126ba57600080fd5b60008083601f84011261272657600080fd5b50813567ffffffffffffffff81111561273e57600080fd5b60208301915083602082850101111561220f57600080fd5b803563ffffffff811681146126ba57600080fd5b60006020828403121561277c57600080fd5b611c18826126a3565b6000806040838503121561279857600080fd5b6127a1836126a3565b91506127af602084016126a3565b90509250929050565b6000806000606084860312156127cd57600080fd5b6127d6846126a3565b92506127e4602085016126a3565b9150604084013590509250925092565b60008060008060006080868803121561280c57600080fd5b612815866126a3565b9450612823602087016126a3565b935060408601359250606086013567ffffffffffffffff81111561284657600080fd5b61285288828901612714565b969995985093965092949392505050565b6000806000806080858703121561287957600080fd5b612882856126a3565b9350612890602086016126a3565b925060408501359150606085013567ffffffffffffffff808211156128b457600080fd5b818701915087601f8301126128c857600080fd5b8135818111156128da576128da6130e0565b604051601f8201601f19908116603f01168101908382118183101715612902576129026130e0565b816040528281528a602084870101111561291b57600080fd5b82602086016020830137600060208483010152809550505050505092959194509250565b6000806040838503121561295257600080fd5b61295b836126a3565b91506127af60208401612704565b60008060006060848603121561297e57600080fd5b612987846126a3565b92506127e460208501612704565b600080604083850312156129a857600080fd5b6129b1836126a3565b946020939093013593505050565b600080600080604085870312156129d557600080fd5b843567ffffffffffffffff808211156129ed57600080fd5b6129f9888389016126bf565b90965094506020870135915080821115612a1257600080fd5b50612a1f878288016126bf565b95989497509550505050565b60008060008060008060008060a0898b031215612a4757600080fd5b883567ffffffffffffffff80821115612a5f57600080fd5b612a6b8c838d016126bf565b909a50985060208b0135915080821115612a8457600080fd5b612a908c838d016126bf565b909850965060408b0135955060608b0135915080821115612ab057600080fd5b50612abd8b828c01612714565b999c989b50969995989497949560800135949350505050565b600060208284031215612ae857600080fd5b5035919050565b600060208284031215612b0157600080fd5b81356001600160e01b031981168114611c1857600080fd5b60008060208385031215612b2c57600080fd5b823567ffffffffffffffff811115612b4357600080fd5b612b4f85828601612714565b90969095509350505050565b60008060408385031215612b6e57600080fd5b823591506127af60208401612704565b600060208284031215612b9057600080fd5b611c1882612756565b60008151808452612bb1816020860160208601612fc5565b601f01601f19169290920160200192915050565b60008151612bd7818560208601612fc5565b9290920192915050565b600080845481600182811c915080831680612bfd57607f831692505b6020808410821415612c1d57634e487b7160e01b86526022600452602486fd5b818015612c315760018114612c4257612c6f565b60ff19861689528489019650612c6f565b60008b81526020902060005b86811015612c675781548b820152908501908301612c4e565b505084890196505b505050505050612c7f8185612bc5565b95945050505050565b7f19457468657265756d205369676e6564204d6573736167653a0a0000000000008152600088516020612cc182601a8601838e01612fc5565b81840191506bffffffffffffffffffffffff198a60601b16601a83015288602e8301526001600160fb1b03871115612cf857600080fd5b8660051b8089604e85013760009201604e0182815286925b86811015612d395763ffffffff612d2685612756565b1682529282019290820190600101612d10565b509b9a5050505050505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612d8a5783516001600160a01b031683529284019291840191600101612d65565b50909695505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015612e0757888303603f1901855281518051878552612de188860182612b99565b918901516001600160d01b03169489019490945294870194925090860190600101612dbd565b509098975050505050505050565b6040815283604082015260006001600160fb1b03851115612e3557600080fd5b8460051b808760608501376060908301838103820160208086019190915291810185905285916000916080015b86831015612e8d5763ffffffff612e7885612756565b16815292810192600192909201918101612e62565b9998505050505050505050565b602081526000611c186020830184612b99565b60208082526024908201527f41646d696e436f6e74726f6c3a204d757374206265206f776e6572206f7220616040820152633236b4b760e11b606082015260800190565b6000808335601e19843603018112612f0857600080fd5b83018035915067ffffffffffffffff821115612f2357600080fd5b60200191503681900382131561220f57600080fd5b60006001600160d01b03808316818516808303821115612f5a57612f5a613072565b01949350505050565b60008219821115612f7657612f76613072565b500190565b600082612f8a57612f8a613088565b500490565b6000816000190483118215151615612fa957612fa9613072565b500290565b600082821015612fc057612fc0613072565b500390565b60005b83811015612fe0578181015183820152602001612fc8565b838111156116ae5750506000910152565b60008161300057613000613072565b506000190190565b600181811c9082168061301c57607f821691505b6020821081141561303d57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561305757613057613072565b5060010190565b60008261306d5761306d613088565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220b616d721218d37978996763a4b610e2a158634fbdec8b656b810ac3fb739e03964736f6c63430008070033

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

0000000000000000000000004d55109a17a6914130ace90325dc98cf66ebfa0000000000000000000000000080336ad7a747236ef41f47ed2c7641828a480baa

-----Decoded View---------------
Arg [0] : chimpersGenesis (address): 0x4D55109A17a6914130aCe90325dc98CF66EBfa00
Arg [1] : chimpersGenerative (address): 0x80336Ad7A747236ef41F47ed2C7641828a480BAA

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004d55109a17a6914130ace90325dc98cf66ebfa00
Arg [1] : 00000000000000000000000080336ad7a747236ef41f47ed2c7641828a480baa


Loading...
Loading
Loading...
Loading
[ 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.