ETH Price: $2,426.15 (-1.99%)
 

Overview

Max Total Supply

2,219 KEYCARD

Holders

1,333

Market

Volume (24H)

0.039 ETH

Min Price (24H)

$94.62 @ 0.039000 ETH

Max Price (24H)

$94.62 @ 0.039000 ETH
Balance
1 KEYCARD
0x6175242396b7e0647c5820c7f408ffe805f3668f
Loading...
Loading
Loading...
Loading
Loading...
Loading

Click here to update the token information / general information
# Exchange Pair Price  24H Volume % Volume
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.

Contract Source Code Verified (Exact Match)

Contract Name:
AppliedPrimateEngineering

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 18 : AppliedPrimateEngineering.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import "solmate/tokens/ERC721.sol";

import "openzeppelin/access/Ownable.sol";
import "openzeppelin/interfaces/IERC721.sol";

import "./SignatureValidator.sol";
import "./MetadataComposer.sol";

error InvalidTokenId();
error RequiresTokenOwner();
error OwnerMetadataFunctionLocked();
error IncorrectMetadataNonce();
error InvalidMigrationCaller();
error TokenAlreadyMigrated();

contract AppliedPrimateEngineering is ERC721, SignatureValidator, Ownable {
    uint256 public constant MAX_SUPPLY = 2222;
    uint256 public constant OG_MAX = 222;

    bytes32 public constant OG_KEY = keccak256("OG");
    bytes32 public constant ONBOARDING_KEY = keccak256("ONBOARDING");

    mapping(uint256 => bytes32[]) private tokenMetadataKeys;
    mapping(uint256 => bytes32) private imageKeys;

    address private metadataStore;
    bool public ownerMetadataFunctionLocked;

    IERC721 private migration;

    constructor(address metadataStore_, address signer_, address migration_)
        ERC721("Applied Primate Engineering", "KEYCARD")
        SignatureValidator(signer_)
        Ownable()
    {
        migration = IERC721(migration_);
        metadataStore = metadataStore_;
    }

    function tokenURI(uint256 id) public view override returns (string memory) {
        return MetadataComposer.tokenURI(id, metadataKeys(id), imageKey(id), metadataStore);
    }

    function metadataKeys(uint256 id) public view returns (bytes32[] memory) {
        if (id <= OG_MAX) {
            return _constructKeys(id, OG_KEY);
        }
        return _constructKeys(id, ONBOARDING_KEY);
    }

    function imageKey(uint256 id) public view returns (bytes32) {
        bytes32 key = imageKeys[id];
        if (key == 0) {
            if (id <= OG_MAX) {
                return OG_KEY;
            } else {
                return ONBOARDING_KEY;
            }
        }
        return key;
    }

    function metadataNonce(uint256 id) public view returns (bytes32) {
        bytes32[] memory keys = metadataKeys(id);
        if (keys.length == 0) {
            return keccak256("NO_METADATA");
        }
        return keccak256(abi.encode(keys));
    }

    function applyMetadata(uint256 id, bytes32 metadataKey, bytes memory signature) public {
        if (msg.sender != ownerOf[id]) revert RequiresTokenOwner();
        _validateAttributeSignature(signature, msg.sender, metadataKey, id, metadataNonce(id));
        tokenMetadataKeys[id].push(metadataKey);
    }

    function applyImage(uint256 id, bytes32 imageKey_, bytes memory signature) public {
        if (msg.sender != ownerOf[id]) revert RequiresTokenOwner();
        _validateAttributeSignature(signature, msg.sender, imageKey_, id, imageKey(id));
        imageKeys[id] = imageKey_;
    }

    function mint(address to, uint256 id) public onlyOwner {
        if (id > MAX_SUPPLY || id < 1) revert InvalidTokenId();
        _safeMint(to, id);
    }

    function migrate(address to, uint256[] memory ids) public {
        if (msg.sender != address(migration)) revert InvalidMigrationCaller();
        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            if (id > OG_MAX || id < 1) revert InvalidTokenId();
            if (ownerOf[id] != address(0)) revert TokenAlreadyMigrated();

            _safeMint(to, id);
        }
    }

    function ownerApplyImage(uint256 id, bytes32 imageKey_) public onlyOwner {
        if (ownerMetadataFunctionLocked) revert OwnerMetadataFunctionLocked();
        _validateToken(id);
        imageKeys[id] = imageKey_;
    }

    function ownerApplyMetadata(uint256 id, bytes32 metadataKey, bytes32 nonce) public onlyOwner {
        if (ownerMetadataFunctionLocked) revert OwnerMetadataFunctionLocked();
        _validateToken(id);

        if (metadataNonce(id) != nonce) revert IncorrectMetadataNonce();
        tokenMetadataKeys[id].push(metadataKey);
    }

    function _validateToken(uint256 id) private pure {
        if (id > MAX_SUPPLY || id < 1) revert InvalidTokenId();
    }

    function lockOwnerMetadataFunction() public onlyOwner {
        ownerMetadataFunctionLocked = true;
    }

    function _validateAttributeSignature(
        bytes memory signature,
        address owner,
        bytes32 key,
        uint256 tokenId,
        bytes32 nonce
    ) private view {
        bytes memory message = abi.encodePacked(owner, key, tokenId, nonce);
        _validateSignature(signature, message);
    }

    function _constructKeys(uint256 id, bytes32 addedKey) private view returns (bytes32[] memory) {
        bytes32[] memory keys = tokenMetadataKeys[id];
        bytes32[] memory constructed = new bytes32[](keys.length + 1);
        for (uint256 i = 0; i < keys.length; i++) {
            constructed[i] = keys[i];
        }
        constructed[keys.length] = addedKey;
        return constructed;
    }
}

File 2 of 18 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

File 3 of 18 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}

File 4 of 18 : 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 5 of 18 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)

pragma solidity ^0.8.0;

import "../token/ERC721/IERC721.sol";

File 6 of 18 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 7 of 18 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return result;
    }
}

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

pragma solidity ^0.8.0;

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

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

File 9 of 18 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _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) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _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 10 of 18 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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 // Deprecated in v4.8
    }

    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");
        }
    }

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

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

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

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

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

        // If 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 11 of 18 : 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 12 of 18 : 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 13 of 18 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 14 of 18 : ERC721.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern, minimalist, and gas efficient ERC-721 implementation.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)
/// @dev Note that balanceOf does not revert if passed the zero address, in defiance of the ERC.
abstract contract ERC721 {
    /*///////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 indexed id);

    event Approval(address indexed owner, address indexed spender, uint256 indexed id);

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /*///////////////////////////////////////////////////////////////
                          METADATA STORAGE/LOGIC
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    function tokenURI(uint256 id) public view virtual returns (string memory);

    /*///////////////////////////////////////////////////////////////
                            ERC721 STORAGE                        
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(uint256 => address) public ownerOf;

    mapping(uint256 => address) public getApproved;

    mapping(address => mapping(address => bool)) public isApprovedForAll;

    /*///////////////////////////////////////////////////////////////
                              CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(string memory _name, string memory _symbol) {
        name = _name;
        symbol = _symbol;
    }

    /*///////////////////////////////////////////////////////////////
                              ERC721 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 id) public virtual {
        address owner = ownerOf[id];

        require(msg.sender == owner || isApprovedForAll[owner][msg.sender], "NOT_AUTHORIZED");

        getApproved[id] = spender;

        emit Approval(owner, spender, id);
    }

    function setApprovalForAll(address operator, bool approved) public virtual {
        isApprovedForAll[msg.sender][operator] = approved;

        emit ApprovalForAll(msg.sender, operator, approved);
    }

    function transferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        require(from == ownerOf[id], "WRONG_FROM");

        require(to != address(0), "INVALID_RECIPIENT");

        require(
            msg.sender == from || msg.sender == getApproved[id] || isApprovedForAll[from][msg.sender],
            "NOT_AUTHORIZED"
        );

        // Underflow of the sender's balance is impossible because we check for
        // ownership above and the recipient's balance can't realistically overflow.
        unchecked {
            balanceOf[from]--;

            balanceOf[to]++;
        }

        delete getApproved[id];

        ownerOf[id] = to;

        emit Transfer(from, to, id);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        bytes memory data
    ) public virtual {
        transferFrom(from, to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, from, id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    /*///////////////////////////////////////////////////////////////
                              ERC165 LOGIC
    //////////////////////////////////////////////////////////////*/

    function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool) {
        return
            interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165
            interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721
            interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata
    }

    /*///////////////////////////////////////////////////////////////
                       INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 id) internal virtual {
        require(to != address(0), "INVALID_RECIPIENT");

        require(ownerOf[id] == address(0), "ALREADY_MINTED");

        // Counter overflow is incredibly unrealistic.
        unchecked {
            totalSupply++;

            balanceOf[to]++;
        }

        ownerOf[id] = to;

        emit Transfer(address(0), to, id);
    }

    function _burn(uint256 id) internal virtual {
        address owner = ownerOf[id];

        require(ownerOf[id] != address(0), "NOT_MINTED");

        // Ownership check above ensures no underflow.
        unchecked {
            totalSupply--;

            balanceOf[owner]--;
        }

        delete ownerOf[id];

        emit Transfer(owner, address(0), id);
    }

    /*///////////////////////////////////////////////////////////////
                       INTERNAL SAFE MINT LOGIC
    //////////////////////////////////////////////////////////////*/

    function _safeMint(address to, uint256 id) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, "") ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }

    function _safeMint(
        address to,
        uint256 id,
        bytes memory data
    ) internal virtual {
        _mint(to, id);

        require(
            to.code.length == 0 ||
                ERC721TokenReceiver(to).onERC721Received(msg.sender, address(0), id, data) ==
                ERC721TokenReceiver.onERC721Received.selector,
            "UNSAFE_RECIPIENT"
        );
    }
}

/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)
interface ERC721TokenReceiver {
    function onERC721Received(
        address operator,
        address from,
        uint256 id,
        bytes calldata data
    ) external returns (bytes4);
}

File 15 of 18 : SSTORE2.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Read and write to persistent storage at a fraction of the cost.
/// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/utils/SSTORE2.sol)
/// @author Modified from 0xSequence (https://github.com/0xSequence/sstore2/blob/master/contracts/SSTORE2.sol)
library SSTORE2 {
    uint256 internal constant DATA_OFFSET = 1; // We skip the first byte as it's a STOP opcode to ensure the contract can't be called.

    /*///////////////////////////////////////////////////////////////
                               WRITE LOGIC
    //////////////////////////////////////////////////////////////*/

    function write(bytes memory data) internal returns (address pointer) {
        // Prefix the bytecode with a STOP opcode to ensure it cannot be called.
        bytes memory runtimeCode = abi.encodePacked(hex"00", data);

        bytes memory creationCode = abi.encodePacked(
            //---------------------------------------------------------------------------------------------------------------//
            // Opcode  | Opcode + Arguments  | Description  | Stack View                                                     //
            //---------------------------------------------------------------------------------------------------------------//
            // 0x60    |  0x600B             | PUSH1 11     | codeOffset                                                     //
            // 0x59    |  0x59               | MSIZE        | 0 codeOffset                                                   //
            // 0x81    |  0x81               | DUP2         | codeOffset 0 codeOffset                                        //
            // 0x38    |  0x38               | CODESIZE     | codeSize codeOffset 0 codeOffset                               //
            // 0x03    |  0x03               | SUB          | (codeSize - codeOffset) 0 codeOffset                           //
            // 0x80    |  0x80               | DUP          | (codeSize - codeOffset) (codeSize - codeOffset) 0 codeOffset   //
            // 0x92    |  0x92               | SWAP3        | codeOffset (codeSize - codeOffset) 0 (codeSize - codeOffset)   //
            // 0x59    |  0x59               | MSIZE        | 0 codeOffset (codeSize - codeOffset) 0 (codeSize - codeOffset) //
            // 0x39    |  0x39               | CODECOPY     | 0 (codeSize - codeOffset)                                      //
            // 0xf3    |  0xf3               | RETURN       |                                                                //
            //---------------------------------------------------------------------------------------------------------------//
            hex"60_0B_59_81_38_03_80_92_59_39_F3", // Returns all code in the contract except for the first 11 (0B in hex) bytes.
            runtimeCode // The bytecode we want the contract to have after deployment. Capped at 1 byte less than the code size limit.
        );

        assembly {
            // Deploy a new contract with the generated creation code.
            // We start 32 bytes into the code to avoid copying the byte length.
            pointer := create(0, add(creationCode, 32), mload(creationCode))
        }

        require(pointer != address(0), "DEPLOYMENT_FAILED");
    }

    /*///////////////////////////////////////////////////////////////
                               READ LOGIC
    //////////////////////////////////////////////////////////////*/

    function read(address pointer) internal view returns (bytes memory) {
        return readBytecode(pointer, DATA_OFFSET, pointer.code.length - DATA_OFFSET);
    }

    function read(address pointer, uint256 start) internal view returns (bytes memory) {
        start += DATA_OFFSET;

        return readBytecode(pointer, start, pointer.code.length - start);
    }

    function read(
        address pointer,
        uint256 start,
        uint256 end
    ) internal view returns (bytes memory) {
        start += DATA_OFFSET;
        end += DATA_OFFSET;

        require(pointer.code.length >= end, "OUT_OF_BOUNDS");

        return readBytecode(pointer, start, end - start);
    }

    /*///////////////////////////////////////////////////////////////
                         INTERNAL HELPER LOGIC
    //////////////////////////////////////////////////////////////*/

    function readBytecode(
        address pointer,
        uint256 start,
        uint256 size
    ) private view returns (bytes memory data) {
        assembly {
            // Get a pointer to some free memory.
            data := mload(0x40)

            // Update the free memory pointer to prevent overriding our data.
            // We use and(x, not(31)) as a cheaper equivalent to sub(x, mod(x, 32)).
            // Adding 31 to size and running the result through the logic above ensures
            // the memory pointer remains word-aligned, following the Solidity convention.
            mstore(0x40, add(data, and(add(add(size, 32), 31), not(31))))

            // Store the size of the data in the first 32 byte chunk of free memory.
            mstore(data, size)

            // Copy the code into memory right after the 32 bytes we used to store the size.
            extcodecopy(pointer, add(data, 32), start, size)
        }
    }
}

File 16 of 18 : IMetadataStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

struct MetadataAttribute {
    bytes trait;
    bytes value;
}

interface IMetadataStore {
    function addAttribute(bytes32 key, bytes memory trait, bytes memory value) external;
    function readAttribute(bytes32 key) external view returns (MetadataAttribute memory);
    function addImage(bytes32 key, bytes memory image, bytes memory animation) external;
    function readImage(bytes32 key) external view returns (bytes memory, bytes memory);
}

File 17 of 18 : MetadataComposer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import "solmate/utils/SSTORE2.sol";

import "openzeppelin/access/AccessControl.sol";
import "openzeppelin/utils/Base64.sol";
import "openzeppelin/utils/Strings.sol";

import "./IMetadataStore.sol";

library MetadataComposer {
    using Strings for uint256;
    using Base64 for string;

    string constant NAME = "Keycard";
    string constant DESCRIPTION = "Applied Primate Engineering, Maximum Security Clearance";

    function tokenURI(uint256 tokenId, bytes32[] memory metadataKeys, bytes32 imageKey, address metadataStore_)
        public
        view
        returns (string memory)
    {
        IMetadataStore metadataStore = IMetadataStore(metadataStore_);
        (bytes memory image, bytes memory animation) = metadataStore.readImage(imageKey);
        bytes memory json = abi.encodePacked("{", _jsonify("image", image), ",");
        json = abi.encodePacked(json, _jsonify("animation_url", animation), ",");
        json = abi.encodePacked(json, _jsonify("name", abi.encodePacked(NAME, " #", tokenId.toString())), ",");
        json = abi.encodePacked(json, _jsonify("description", bytes(DESCRIPTION)), ",");
        json = abi.encodePacked(json, '"attributes" : [');
        for (uint256 i = 0; i < metadataKeys.length; i++) {
            MetadataAttribute memory attribute = metadataStore.readAttribute(metadataKeys[i]);
            if (bytes(attribute.value).length > 0) {
                json = abi.encodePacked(json, _jsonifyAttribute(attribute));
                if (i != (metadataKeys.length - 1)) json = abi.encodePacked(json, ",");
            }
        }
        json = abi.encodePacked(json, "]}");

        string memory uri = string(abi.encodePacked("data:application/json;base64,", Base64.encode(bytes(json))));
        return uri;
    }

    function _jsonifyAttribute(MetadataAttribute memory attribute) private pure returns (bytes memory) {
        bytes memory value = abi.encodePacked('"value":"', attribute.value, '"');
        if (bytes(attribute.trait).length == 0) {
            return abi.encodePacked("{", value, "}");
        }
        bytes memory trait = abi.encodePacked('"trait_type":"', attribute.trait, '"');
        return abi.encodePacked("{", trait, ",", value, "}");
    }

    function _jsonify(string memory key, bytes memory value) private pure returns (bytes memory) {
        return abi.encodePacked('"', key, '":"', value, '"');
    }
}

File 18 of 18 : SignatureValidator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import "openzeppelin/utils/cryptography/ECDSA.sol";

contract SignatureValidator {
    error InvalidSignature();

    using ECDSA for bytes32;

    address public signer;

    constructor(address signer_) {
        signer = signer_;
    }

    function _validateSignature(bytes memory signature, bytes memory message) internal view {
        bytes32 messageHash = ECDSA.toEthSignedMessageHash(keccak256(message));
        address recovered = messageHash.recover(signature);
        if (signer != recovered) revert InvalidSignature();
    }

    function _setSigner(address signer_) internal {
        signer = signer_;
    }
}

Settings
{
  "remappings": [
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {
    "src/MetadataComposer.sol": {
      "MetadataComposer": "0xf77151bd0fdaa81acd3a9f3ed4c06278f0a474c9"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"metadataStore_","type":"address"},{"internalType":"address","name":"signer_","type":"address"},{"internalType":"address","name":"migration_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"IncorrectMetadataNonce","type":"error"},{"inputs":[],"name":"InvalidMigrationCaller","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidTokenId","type":"error"},{"inputs":[],"name":"OwnerMetadataFunctionLocked","type":"error"},{"inputs":[],"name":"RequiresTokenOwner","type":"error"},{"inputs":[],"name":"TokenAlreadyMigrated","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","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":"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":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OG_KEY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OG_MAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONBOARDING_KEY","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes32","name":"imageKey_","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"applyImage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes32","name":"metadataKey","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"applyMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"imageKey","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockOwnerMetadataFunction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"metadataKeys","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"metadataNonce","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"migrate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes32","name":"imageKey_","type":"bytes32"}],"name":"ownerApplyImage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes32","name":"metadataKey","type":"bytes32"},{"internalType":"bytes32","name":"nonce","type":"bytes32"}],"name":"ownerApplyMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ownerMetadataFunctionLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","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":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040523480156200001157600080fd5b506040516200211938038062002119833981016040819052620000349162000187565b816040518060400160405280601b81526020017f4170706c696564205072696d61746520456e67696e656572696e6700000000008152506040518060400160405280600781526020016612d15650d0549160ca1b81525081600090816200009c919062000276565b506001620000ab828262000276565b5050600780546001600160a01b0319166001600160a01b03939093169290921790915550620000e1620000db3390565b62000118565b600c80546001600160a01b039283166001600160a01b031991821617909155600b8054949092169316929092179091555062000342565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200018257600080fd5b919050565b6000806000606084860312156200019d57600080fd5b620001a8846200016a565b9250620001b8602085016200016a565b9150620001c8604085016200016a565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c90821680620001fc57607f821691505b6020821081036200021d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200027157600081815260208120601f850160051c810160208610156200024c5750805b601f850160051c820191505b818110156200026d5782815560010162000258565b5050505b505050565b81516001600160401b03811115620002925762000292620001d1565b620002aa81620002a38454620001e7565b8462000223565b602080601f831160018114620002e25760008415620002c95750858301515b600019600386901b1c1916600185901b1785556200026d565b600085815260208120601f198616915b828110156200031357888601518255948401946001909101908401620002f2565b5085821015620003325787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b611dc780620003526000396000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c80636946f55a1161011a578063ae08649c116100ad578063c030b0cd1161007c578063c030b0cd1461046c578063c87b56dd14610493578063d9f65281146104a6578063e985e9c5146104b9578063f2fde38b146104e757600080fd5b8063ae08649c1461042b578063b331000314610433578063b79b65fc14610446578063b88d4fde1461045957600080fd5b80638da5cb5b116100e95780638da5cb5b146103d85780639047ab9c146103e957806395d89b4114610410578063a22cb4651461041857600080fd5b80636946f55a1461037d578063703caa531461039d57806370a08231146103b0578063715018a6146103d057600080fd5b80632c9880b01161019257806342842e0e1161016157806342842e0e1461031b578063564f29631461032e5780636352211e1461034157806365847f211461036a57600080fd5b80632c9880b0146102e357806332cb6b0c146102f75780633e7e54b71461030057806340c10f191461030857600080fd5b8063095ea7b3116101ce578063095ea7b31461029f57806318160ddd146102b4578063238ac933146102bd57806323b872dd146102d057600080fd5b806301ffc9a714610200578063023e2b711461022857806306fdde0314610249578063081812fc1461025e575b600080fd5b61021361020e366004611714565b6104fa565b60405190151581526020015b60405180910390f35b61023b610236366004611738565b61054c565b60405190815260200161021f565b6102516105ba565b60405161021f91906117a1565b61028761026c366004611738565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b6102b26102ad3660046117d0565b610648565b005b61023b60025481565b600754610287906001600160a01b031681565b6102b26102de3660046117fa565b61072f565b600b5461021390600160a01b900460ff1681565b61023b6108ae81565b6102b26108f6565b6102b26103163660046117d0565b610913565b6102b26103293660046117fa565b610957565b6102b261033c3660046118fb565b610a2c565b61028761034f366004611738565b6004602052600090815260409020546001600160a01b031681565b6102b261037836600461194b565b610a8b565b61039061038b366004611738565b610b60565b60405161021f9190611a04565b6102b26103ab366004611a48565b610bbe565b61023b6103be366004611a6a565b60036020526000908152604090205481565b6102b2610c0c565b6008546001600160a01b0316610287565b61023b7f18faeb62567926f4805bd005d2fb3f6c3fbde33b2c11982a0ff1e730b321511481565b610251610c20565b6102b2610426366004611a85565b610c2d565b61023b60de81565b6102b2610441366004611ac1565b610c99565b61023b610454366004611738565b610d21565b6102b2610467366004611aed565b610d8f565b61023b7ff8e4cf2271ec3c91a8e7eec89b6cad96e5bfa4f28bd0ae1d3564206fa8c10c3d81565b6102516104a1366004611738565b610e51565b6102b26104b43660046118fb565b610ef5565b6102136104c7366004611b55565b600660209081526000928352604080842090915290825290205460ff1681565b6102b26104f5366004611a6a565b610f3c565b60006301ffc9a760e01b6001600160e01b03198316148061052b57506380ac58cd60e01b6001600160e01b03198316145b806105465750635b5e139f60e01b6001600160e01b03198316145b92915050565b60008061055883610b60565b9050805160000361058b57507f246cf37f4feeac51350ffecdca750e0ecac952afce78e3ed15bfe8a2fd63576892915050565b8060405160200161059c9190611a04565b60405160208183030381529060405280519060200120915050919050565b600080546105c790611b88565b80601f01602080910402602001604051908101604052809291908181526020018280546105f390611b88565b80156106405780601f1061061557610100808354040283529160200191610640565b820191906000526020600020905b81548152906001019060200180831161062357829003601f168201915b505050505081565b6000818152600460205260409020546001600160a01b03163381148061069157506001600160a01b038116600090815260066020908152604080832033845290915290205460ff165b6106d35760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064015b60405180910390fd5b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000818152600460205260409020546001600160a01b038481169116146107855760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b60448201526064016106ca565b6001600160a01b0382166107cf5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b60448201526064016106ca565b336001600160a01b03841614806107fc57506000818152600560205260409020546001600160a01b031633145b8061082a57506001600160a01b038316600090815260066020908152604080832033845290915290205460ff165b6108675760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064016106ca565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526005825284832080546001600160a01b03199081169091556004909252848320805490921681179091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6108fe610fb5565b600b805460ff60a01b1916600160a01b179055565b61091b610fb5565b6108ae81118061092b5750600181105b15610949576040516307ed98ed60e31b815260040160405180910390fd5b610953828261100f565b5050565b61096283838361072f565b6001600160a01b0382163b1580610a0b5750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af11580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff9190611bc2565b6001600160e01b031916145b610a275760405162461bcd60e51b81526004016106ca90611bdf565b505050565b6000838152600460205260409020546001600160a01b03163314610a6357604051633f8f9a0760e01b815260040160405180910390fd5b610a7881338486610a7388610d21565b6110db565b506000918252600a602052604090912055565b600c546001600160a01b03163314610ab657604051630dd2403160e21b815260040160405180910390fd5b60005b8151811015610a27576000828281518110610ad657610ad6611c09565b6020026020010151905060de811180610aef5750600181105b15610b0d576040516307ed98ed60e31b815260040160405180910390fd5b6000818152600460205260409020546001600160a01b031615610b435760405163fc8553fb60e01b815260040160405180910390fd5b610b4d848261100f565b5080610b5881611c35565b915050610ab9565b606060de8211610b9457610546827ff8e4cf2271ec3c91a8e7eec89b6cad96e5bfa4f28bd0ae1d3564206fa8c10c3d611135565b610546827f18faeb62567926f4805bd005d2fb3f6c3fbde33b2c11982a0ff1e730b3215114611135565b610bc6610fb5565b600b54600160a01b900460ff1615610bf15760405163e4b24d8360e01b815260040160405180910390fd5b610bfa82611262565b6000918252600a602052604090912055565b610c14610fb5565b610c1e6000611290565b565b600180546105c790611b88565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610ca1610fb5565b600b54600160a01b900460ff1615610ccc5760405163e4b24d8360e01b815260040160405180910390fd5b610cd583611262565b80610cdf8461054c565b14610cfd57604051636dfd018360e11b815260040160405180910390fd5b50600091825260096020908152604083208054600181018255908452922090910155565b6000818152600a60205260408120548082036105465760de8311610d6757507ff8e4cf2271ec3c91a8e7eec89b6cad96e5bfa4f28bd0ae1d3564206fa8c10c3d92915050565b507f18faeb62567926f4805bd005d2fb3f6c3fbde33b2c11982a0ff1e730b321511492915050565b610d9a84848461072f565b6001600160a01b0383163b1580610e2f5750604051630a85bd0160e11b808252906001600160a01b0385169063150b7a0290610de0903390899088908890600401611c4e565b6020604051808303816000875af1158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e239190611bc2565b6001600160e01b031916145b610e4b5760405162461bcd60e51b81526004016106ca90611bdf565b50505050565b606073f77151bd0fdaa81acd3a9f3ed4c06278f0a474c9639b077e2f83610e7785610b60565b610e8086610d21565b600b546040516001600160e01b031960e087901b168152610eb0949392916001600160a01b031690600401611c8b565b600060405180830381865af4158015610ecd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105469190810190611cf1565b6000838152600460205260409020546001600160a01b03163314610f2c57604051633f8f9a0760e01b815260040160405180910390fd5b610cfd81338486610a738861054c565b610f44610fb5565b6001600160a01b038116610fa95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ca565b610fb281611290565b50565b6008546001600160a01b03163314610c1e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106ca565b61101982826112e2565b6001600160a01b0382163b15806110bf5750604051630a85bd0160e11b80825233600483015260006024830181905260448301849052608060648401526084830152906001600160a01b0384169063150b7a029060a4016020604051808303816000875af115801561108f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b39190611bc2565b6001600160e01b031916145b6109535760405162461bcd60e51b81526004016106ca90611bdf565b6040516bffffffffffffffffffffffff19606086901b166020820152603481018490526054810183905260748101829052600090609401604051602081830303815290604052905061112d86826113f9565b505050505050565b600082815260096020908152604080832080548251818502810185019093528083526060949383018282801561118a57602002820191906000526020600020905b815481526020019060010190808311611176575b505050505090506000815160016111a19190611d68565b67ffffffffffffffff8111156111b9576111b9611836565b6040519080825280602002602001820160405280156111e2578160200160208202803683370190505b50905060005b825181101561123a5782818151811061120357611203611c09565b602002602001015182828151811061121d5761121d611c09565b60209081029190910101528061123281611c35565b9150506111e8565b50838183518151811061124f5761124f611c09565b6020908102919091010152949350505050565b6108ae8111806112725750600181105b15610fb2576040516307ed98ed60e31b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03821661132c5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b60448201526064016106ca565b6000818152600460205260409020546001600160a01b0316156113825760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b60448201526064016106ca565b6002805460019081019091556001600160a01b038316600081815260036020908152604080832080549095019094558482526004905282812080546001600160a01b0319168317905591518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8051602080830191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c019052805191012060006114568285611487565b6007549091506001600160a01b03808316911614610e4b57604051638baa579f60e01b815260040160405180910390fd5b600080600061149685856114ab565b915091506114a3816114f0565b509392505050565b60008082516041036114e15760208301516040840151606085015160001a6114d58782858561163a565b945094505050506114e9565b506000905060025b9250929050565b600081600481111561150457611504611d7b565b0361150c5750565b600181600481111561152057611520611d7b565b0361156d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106ca565b600281600481111561158157611581611d7b565b036115ce5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106ca565b60038160048111156115e2576115e2611d7b565b03610fb25760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016106ca565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561167157506000905060036116f5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156116c5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166116ee576000600192509250506116f5565b9150600090505b94509492505050565b6001600160e01b031981168114610fb257600080fd5b60006020828403121561172657600080fd5b8135611731816116fe565b9392505050565b60006020828403121561174a57600080fd5b5035919050565b60005b8381101561176c578181015183820152602001611754565b50506000910152565b6000815180845261178d816020860160208601611751565b601f01601f19169290920160200192915050565b6020815260006117316020830184611775565b80356001600160a01b03811681146117cb57600080fd5b919050565b600080604083850312156117e357600080fd5b6117ec836117b4565b946020939093013593505050565b60008060006060848603121561180f57600080fd5b611818846117b4565b9250611826602085016117b4565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561187557611875611836565b604052919050565b600067ffffffffffffffff82111561189757611897611836565b50601f01601f191660200190565b600082601f8301126118b657600080fd5b81356118c96118c48261187d565b61184c565b8181528460208386010111156118de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561191057600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561193557600080fd5b611941868287016118a5565b9150509250925092565b6000806040838503121561195e57600080fd5b611967836117b4565b915060208084013567ffffffffffffffff8082111561198557600080fd5b818601915086601f83011261199957600080fd5b8135818111156119ab576119ab611836565b8060051b91506119bc84830161184c565b81815291830184019184810190898411156119d657600080fd5b938501935b838510156119f4578435825293850193908501906119db565b8096505050505050509250929050565b6020808252825182820181905260009190848201906040850190845b81811015611a3c57835183529284019291840191600101611a20565b50909695505050505050565b60008060408385031215611a5b57600080fd5b50508035926020909101359150565b600060208284031215611a7c57600080fd5b611731826117b4565b60008060408385031215611a9857600080fd5b611aa1836117b4565b915060208301358015158114611ab657600080fd5b809150509250929050565b600080600060608486031215611ad657600080fd5b505081359360208301359350604090920135919050565b60008060008060808587031215611b0357600080fd5b611b0c856117b4565b9350611b1a602086016117b4565b925060408501359150606085013567ffffffffffffffff811115611b3d57600080fd5b611b49878288016118a5565b91505092959194509250565b60008060408385031215611b6857600080fd5b611b71836117b4565b9150611b7f602084016117b4565b90509250929050565b600181811c90821680611b9c57607f821691505b602082108103611bbc57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611bd457600080fd5b8151611731816116fe565b60208082526010908201526f155394d0519157d49150d2541251539560821b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c4757611c47611c1f565b5060010190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611c8190830184611775565b9695505050505050565b600060808201868352602060808185015281875180845260a086019150828901935060005b81811015611ccc57845183529383019391830191600101611cb0565b505060408501969096525050506001600160a01b039190911660609091015292915050565b600060208284031215611d0357600080fd5b815167ffffffffffffffff811115611d1a57600080fd5b8201601f81018413611d2b57600080fd5b8051611d396118c48261187d565b818152856020838501011115611d4e57600080fd5b611d5f826020830160208601611751565b95945050505050565b8082018082111561054657610546611c1f565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220d3a6e86313f50103b7175ee2a6fe947cb63a6fcd512f37ce2e7ef5c33be5987c64736f6c63430008110033000000000000000000000000440c23f293229653fff397c8e2f13fe47c1f957f000000000000000000000000e60a93436e1de9fbecda516b5e10e842b5b7f4a1000000000000000000000000388f9aca5a35c1c3b7d27910055216ce5f422568

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c80636946f55a1161011a578063ae08649c116100ad578063c030b0cd1161007c578063c030b0cd1461046c578063c87b56dd14610493578063d9f65281146104a6578063e985e9c5146104b9578063f2fde38b146104e757600080fd5b8063ae08649c1461042b578063b331000314610433578063b79b65fc14610446578063b88d4fde1461045957600080fd5b80638da5cb5b116100e95780638da5cb5b146103d85780639047ab9c146103e957806395d89b4114610410578063a22cb4651461041857600080fd5b80636946f55a1461037d578063703caa531461039d57806370a08231146103b0578063715018a6146103d057600080fd5b80632c9880b01161019257806342842e0e1161016157806342842e0e1461031b578063564f29631461032e5780636352211e1461034157806365847f211461036a57600080fd5b80632c9880b0146102e357806332cb6b0c146102f75780633e7e54b71461030057806340c10f191461030857600080fd5b8063095ea7b3116101ce578063095ea7b31461029f57806318160ddd146102b4578063238ac933146102bd57806323b872dd146102d057600080fd5b806301ffc9a714610200578063023e2b711461022857806306fdde0314610249578063081812fc1461025e575b600080fd5b61021361020e366004611714565b6104fa565b60405190151581526020015b60405180910390f35b61023b610236366004611738565b61054c565b60405190815260200161021f565b6102516105ba565b60405161021f91906117a1565b61028761026c366004611738565b6005602052600090815260409020546001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b6102b26102ad3660046117d0565b610648565b005b61023b60025481565b600754610287906001600160a01b031681565b6102b26102de3660046117fa565b61072f565b600b5461021390600160a01b900460ff1681565b61023b6108ae81565b6102b26108f6565b6102b26103163660046117d0565b610913565b6102b26103293660046117fa565b610957565b6102b261033c3660046118fb565b610a2c565b61028761034f366004611738565b6004602052600090815260409020546001600160a01b031681565b6102b261037836600461194b565b610a8b565b61039061038b366004611738565b610b60565b60405161021f9190611a04565b6102b26103ab366004611a48565b610bbe565b61023b6103be366004611a6a565b60036020526000908152604090205481565b6102b2610c0c565b6008546001600160a01b0316610287565b61023b7f18faeb62567926f4805bd005d2fb3f6c3fbde33b2c11982a0ff1e730b321511481565b610251610c20565b6102b2610426366004611a85565b610c2d565b61023b60de81565b6102b2610441366004611ac1565b610c99565b61023b610454366004611738565b610d21565b6102b2610467366004611aed565b610d8f565b61023b7ff8e4cf2271ec3c91a8e7eec89b6cad96e5bfa4f28bd0ae1d3564206fa8c10c3d81565b6102516104a1366004611738565b610e51565b6102b26104b43660046118fb565b610ef5565b6102136104c7366004611b55565b600660209081526000928352604080842090915290825290205460ff1681565b6102b26104f5366004611a6a565b610f3c565b60006301ffc9a760e01b6001600160e01b03198316148061052b57506380ac58cd60e01b6001600160e01b03198316145b806105465750635b5e139f60e01b6001600160e01b03198316145b92915050565b60008061055883610b60565b9050805160000361058b57507f246cf37f4feeac51350ffecdca750e0ecac952afce78e3ed15bfe8a2fd63576892915050565b8060405160200161059c9190611a04565b60405160208183030381529060405280519060200120915050919050565b600080546105c790611b88565b80601f01602080910402602001604051908101604052809291908181526020018280546105f390611b88565b80156106405780601f1061061557610100808354040283529160200191610640565b820191906000526020600020905b81548152906001019060200180831161062357829003601f168201915b505050505081565b6000818152600460205260409020546001600160a01b03163381148061069157506001600160a01b038116600090815260066020908152604080832033845290915290205460ff165b6106d35760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064015b60405180910390fd5b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000818152600460205260409020546001600160a01b038481169116146107855760405162461bcd60e51b815260206004820152600a60248201526957524f4e475f46524f4d60b01b60448201526064016106ca565b6001600160a01b0382166107cf5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b60448201526064016106ca565b336001600160a01b03841614806107fc57506000818152600560205260409020546001600160a01b031633145b8061082a57506001600160a01b038316600090815260066020908152604080832033845290915290205460ff165b6108675760405162461bcd60e51b815260206004820152600e60248201526d1393d517d055551213d49256915160921b60448201526064016106ca565b6001600160a01b0380841660008181526003602090815260408083208054600019019055938616808352848320805460010190558583526005825284832080546001600160a01b03199081169091556004909252848320805490921681179091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6108fe610fb5565b600b805460ff60a01b1916600160a01b179055565b61091b610fb5565b6108ae81118061092b5750600181105b15610949576040516307ed98ed60e31b815260040160405180910390fd5b610953828261100f565b5050565b61096283838361072f565b6001600160a01b0382163b1580610a0b5750604051630a85bd0160e11b8082523360048301526001600160a01b03858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af11580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff9190611bc2565b6001600160e01b031916145b610a275760405162461bcd60e51b81526004016106ca90611bdf565b505050565b6000838152600460205260409020546001600160a01b03163314610a6357604051633f8f9a0760e01b815260040160405180910390fd5b610a7881338486610a7388610d21565b6110db565b506000918252600a602052604090912055565b600c546001600160a01b03163314610ab657604051630dd2403160e21b815260040160405180910390fd5b60005b8151811015610a27576000828281518110610ad657610ad6611c09565b6020026020010151905060de811180610aef5750600181105b15610b0d576040516307ed98ed60e31b815260040160405180910390fd5b6000818152600460205260409020546001600160a01b031615610b435760405163fc8553fb60e01b815260040160405180910390fd5b610b4d848261100f565b5080610b5881611c35565b915050610ab9565b606060de8211610b9457610546827ff8e4cf2271ec3c91a8e7eec89b6cad96e5bfa4f28bd0ae1d3564206fa8c10c3d611135565b610546827f18faeb62567926f4805bd005d2fb3f6c3fbde33b2c11982a0ff1e730b3215114611135565b610bc6610fb5565b600b54600160a01b900460ff1615610bf15760405163e4b24d8360e01b815260040160405180910390fd5b610bfa82611262565b6000918252600a602052604090912055565b610c14610fb5565b610c1e6000611290565b565b600180546105c790611b88565b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b610ca1610fb5565b600b54600160a01b900460ff1615610ccc5760405163e4b24d8360e01b815260040160405180910390fd5b610cd583611262565b80610cdf8461054c565b14610cfd57604051636dfd018360e11b815260040160405180910390fd5b50600091825260096020908152604083208054600181018255908452922090910155565b6000818152600a60205260408120548082036105465760de8311610d6757507ff8e4cf2271ec3c91a8e7eec89b6cad96e5bfa4f28bd0ae1d3564206fa8c10c3d92915050565b507f18faeb62567926f4805bd005d2fb3f6c3fbde33b2c11982a0ff1e730b321511492915050565b610d9a84848461072f565b6001600160a01b0383163b1580610e2f5750604051630a85bd0160e11b808252906001600160a01b0385169063150b7a0290610de0903390899088908890600401611c4e565b6020604051808303816000875af1158015610dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e239190611bc2565b6001600160e01b031916145b610e4b5760405162461bcd60e51b81526004016106ca90611bdf565b50505050565b606073f77151bd0fdaa81acd3a9f3ed4c06278f0a474c9639b077e2f83610e7785610b60565b610e8086610d21565b600b546040516001600160e01b031960e087901b168152610eb0949392916001600160a01b031690600401611c8b565b600060405180830381865af4158015610ecd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526105469190810190611cf1565b6000838152600460205260409020546001600160a01b03163314610f2c57604051633f8f9a0760e01b815260040160405180910390fd5b610cfd81338486610a738861054c565b610f44610fb5565b6001600160a01b038116610fa95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016106ca565b610fb281611290565b50565b6008546001600160a01b03163314610c1e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016106ca565b61101982826112e2565b6001600160a01b0382163b15806110bf5750604051630a85bd0160e11b80825233600483015260006024830181905260448301849052608060648401526084830152906001600160a01b0384169063150b7a029060a4016020604051808303816000875af115801561108f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b39190611bc2565b6001600160e01b031916145b6109535760405162461bcd60e51b81526004016106ca90611bdf565b6040516bffffffffffffffffffffffff19606086901b166020820152603481018490526054810183905260748101829052600090609401604051602081830303815290604052905061112d86826113f9565b505050505050565b600082815260096020908152604080832080548251818502810185019093528083526060949383018282801561118a57602002820191906000526020600020905b815481526020019060010190808311611176575b505050505090506000815160016111a19190611d68565b67ffffffffffffffff8111156111b9576111b9611836565b6040519080825280602002602001820160405280156111e2578160200160208202803683370190505b50905060005b825181101561123a5782818151811061120357611203611c09565b602002602001015182828151811061121d5761121d611c09565b60209081029190910101528061123281611c35565b9150506111e8565b50838183518151811061124f5761124f611c09565b6020908102919091010152949350505050565b6108ae8111806112725750600181105b15610fb2576040516307ed98ed60e31b815260040160405180910390fd5b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03821661132c5760405162461bcd60e51b81526020600482015260116024820152701253959053125117d49150d25412515395607a1b60448201526064016106ca565b6000818152600460205260409020546001600160a01b0316156113825760405162461bcd60e51b815260206004820152600e60248201526d1053149150511657d3525395115160921b60448201526064016106ca565b6002805460019081019091556001600160a01b038316600081815260036020908152604080832080549095019094558482526004905282812080546001600160a01b0319168317905591518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8051602080830191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c019052805191012060006114568285611487565b6007549091506001600160a01b03808316911614610e4b57604051638baa579f60e01b815260040160405180910390fd5b600080600061149685856114ab565b915091506114a3816114f0565b509392505050565b60008082516041036114e15760208301516040840151606085015160001a6114d58782858561163a565b945094505050506114e9565b506000905060025b9250929050565b600081600481111561150457611504611d7b565b0361150c5750565b600181600481111561152057611520611d7b565b0361156d5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016106ca565b600281600481111561158157611581611d7b565b036115ce5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016106ca565b60038160048111156115e2576115e2611d7b565b03610fb25760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016106ca565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561167157506000905060036116f5565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156116c5573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166116ee576000600192509250506116f5565b9150600090505b94509492505050565b6001600160e01b031981168114610fb257600080fd5b60006020828403121561172657600080fd5b8135611731816116fe565b9392505050565b60006020828403121561174a57600080fd5b5035919050565b60005b8381101561176c578181015183820152602001611754565b50506000910152565b6000815180845261178d816020860160208601611751565b601f01601f19169290920160200192915050565b6020815260006117316020830184611775565b80356001600160a01b03811681146117cb57600080fd5b919050565b600080604083850312156117e357600080fd5b6117ec836117b4565b946020939093013593505050565b60008060006060848603121561180f57600080fd5b611818846117b4565b9250611826602085016117b4565b9150604084013590509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561187557611875611836565b604052919050565b600067ffffffffffffffff82111561189757611897611836565b50601f01601f191660200190565b600082601f8301126118b657600080fd5b81356118c96118c48261187d565b61184c565b8181528460208386010111156118de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561191057600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561193557600080fd5b611941868287016118a5565b9150509250925092565b6000806040838503121561195e57600080fd5b611967836117b4565b915060208084013567ffffffffffffffff8082111561198557600080fd5b818601915086601f83011261199957600080fd5b8135818111156119ab576119ab611836565b8060051b91506119bc84830161184c565b81815291830184019184810190898411156119d657600080fd5b938501935b838510156119f4578435825293850193908501906119db565b8096505050505050509250929050565b6020808252825182820181905260009190848201906040850190845b81811015611a3c57835183529284019291840191600101611a20565b50909695505050505050565b60008060408385031215611a5b57600080fd5b50508035926020909101359150565b600060208284031215611a7c57600080fd5b611731826117b4565b60008060408385031215611a9857600080fd5b611aa1836117b4565b915060208301358015158114611ab657600080fd5b809150509250929050565b600080600060608486031215611ad657600080fd5b505081359360208301359350604090920135919050565b60008060008060808587031215611b0357600080fd5b611b0c856117b4565b9350611b1a602086016117b4565b925060408501359150606085013567ffffffffffffffff811115611b3d57600080fd5b611b49878288016118a5565b91505092959194509250565b60008060408385031215611b6857600080fd5b611b71836117b4565b9150611b7f602084016117b4565b90509250929050565b600181811c90821680611b9c57607f821691505b602082108103611bbc57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215611bd457600080fd5b8151611731816116fe565b60208082526010908201526f155394d0519157d49150d2541251539560821b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611c4757611c47611c1f565b5060010190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090611c8190830184611775565b9695505050505050565b600060808201868352602060808185015281875180845260a086019150828901935060005b81811015611ccc57845183529383019391830191600101611cb0565b505060408501969096525050506001600160a01b039190911660609091015292915050565b600060208284031215611d0357600080fd5b815167ffffffffffffffff811115611d1a57600080fd5b8201601f81018413611d2b57600080fd5b8051611d396118c48261187d565b818152856020838501011115611d4e57600080fd5b611d5f826020830160208601611751565b95945050505050565b8082018082111561054657610546611c1f565b634e487b7160e01b600052602160045260246000fdfea2646970667358221220d3a6e86313f50103b7175ee2a6fe947cb63a6fcd512f37ce2e7ef5c33be5987c64736f6c63430008110033

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

000000000000000000000000440c23f293229653fff397c8e2f13fe47c1f957f000000000000000000000000e60a93436e1de9fbecda516b5e10e842b5b7f4a1000000000000000000000000388f9aca5a35c1c3b7d27910055216ce5f422568

-----Decoded View---------------
Arg [0] : metadataStore_ (address): 0x440C23F293229653FFf397C8E2F13fE47C1F957F
Arg [1] : signer_ (address): 0xE60a93436e1DE9fBecDa516B5e10E842b5b7f4A1
Arg [2] : migration_ (address): 0x388f9acA5a35c1c3B7d27910055216Ce5F422568

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000440c23f293229653fff397c8e2f13fe47c1f957f
Arg [1] : 000000000000000000000000e60a93436e1de9fbecda516b5e10e842b5b7f4a1
Arg [2] : 000000000000000000000000388f9aca5a35c1c3b7d27910055216ce5f422568


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

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