creation_sourcecode: {{
    "language": "Solidity",
    "settings": {
      "evmVersion": "london",
      "libraries": {},
      "metadata": {
        "bytecodeHash": "ipfs",
        "useLiteralContent": true
      },
      "optimizer": {
        "enabled": true,
        "runs": 99999
      },
      "remappings": [],
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    },
    "sources": {
      "@animoca/ethereum-contracts/contracts/access/ContractOwnership.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {ContractOwnershipStorage} from \"./libraries/ContractOwnershipStorage.sol\";\nimport {ContractOwnershipBase} from \"./base/ContractOwnershipBase.sol\";\nimport {InterfaceDetection} from \"./../introspection/InterfaceDetection.sol\";\n\n/// @title ERC173 Contract Ownership Standard (immutable version).\n/// @dev See https://eips.ethereum.org/EIPS/eip-173\n/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.\nabstract contract ContractOwnership is ContractOwnershipBase, InterfaceDetection {\n    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;\n\n    /// @notice Initializes the storage with an initial contract owner.\n    /// @notice Marks the following ERC165 interface(s) as supported: ERC173.\n    /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.\n    /// @param initialOwner the initial contract owner.\n    constructor(address initialOwner) {\n        ContractOwnershipStorage.layout().constructorInit(initialOwner);\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/access/base/ContractOwnershipBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {IERC173} from \"./../interfaces/IERC173.sol\";\nimport {ContractOwnershipStorage} from \"./../libraries/ContractOwnershipStorage.sol\";\nimport {Context} from \"@openzeppelin/contracts/utils/Context.sol\";\n\n/// @title ERC173 Contract Ownership Standard (proxiable version).\n/// @dev See https://eips.ethereum.org/EIPS/eip-173\n/// @dev This contract is to be used via inheritance in a proxied implementation.\n/// @dev Note: This contract requires ERC165 (Interface Detection Standard).\nabstract contract ContractOwnershipBase is Context, IERC173 {\n    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;\n\n    /// @inheritdoc IERC173\n    function owner() public view virtual override returns (address) {\n        return ContractOwnershipStorage.layout().owner();\n    }\n\n    /// @inheritdoc IERC173\n    function transferOwnership(address newOwner) public virtual override {\n        ContractOwnershipStorage.layout().transferOwnership(_msgSender(), newOwner);\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/access/interfaces/IERC173.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\n/// @title ERC-173 Contract Ownership Standard\n/// @dev See https://eips.ethereum.org/EIPS/eip-173\n/// @dev Note: the ERC-165 identifier for this interface is 0x7f5828d0\ninterface IERC173 {\n    /// @notice Emitted when the contract ownership changes.\n    /// @param previousOwner the previous contract owner.\n    /// @param newOwner the new contract owner.\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /// @notice Sets the address of the new contract owner.\n    /// @dev Reverts if the sender is not the contract owner.\n    /// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner.\n    /// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership.\n    function transferOwnership(address newOwner) external;\n\n    /// @notice Gets the address of the contract owner.\n    /// @return contractOwner The address of the contract owner.\n    function owner() external view returns (address contractOwner);\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/access/libraries/ContractOwnershipStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {IERC173} from \"./../interfaces/IERC173.sol\";\nimport {ProxyInitialization} from \"./../../proxy/libraries/ProxyInitialization.sol\";\nimport {InterfaceDetectionStorage} from \"./../../introspection/libraries/InterfaceDetectionStorage.sol\";\n\nlibrary ContractOwnershipStorage {\n    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;\n    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;\n\n    struct Layout {\n        address contractOwner;\n    }\n\n    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256(\"animoca.core.access.ContractOwnership.storage\")) - 1);\n    bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256(\"animoca.core.access.ContractOwnership.phase\")) - 1);\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /// @notice Initializes the storage with an initial contract owner (immutable version).\n    /// @notice Marks the following ERC165 interface(s) as supported: ERC173.\n    /// @dev Note: This function should be called ONLY in the constructor of an immutable (non-proxied) contract.\n    /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.\n    /// @param initialOwner The initial contract owner.\n    function constructorInit(Layout storage s, address initialOwner) internal {\n        if (initialOwner != address(0)) {\n            s.contractOwner = initialOwner;\n            emit OwnershipTransferred(address(0), initialOwner);\n        }\n        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC173).interfaceId, true);\n    }\n\n    /// @notice Initializes the storage with an initial contract owner (proxied version).\n    /// @notice Sets the proxy initialization phase to `1`.\n    /// @notice Marks the following ERC165 interface(s) as supported: ERC173.\n    /// @dev Note: This function should be called ONLY in the init function of a proxied contract.\n    /// @dev Reverts if the proxy initialization phase is set to `1` or above.\n    /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.\n    /// @param initialOwner The initial contract owner.\n    function proxyInit(Layout storage s, address initialOwner) internal {\n        ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1);\n        s.constructorInit(initialOwner);\n    }\n\n    /// @notice Sets the address of the new contract owner.\n    /// @dev Reverts if `sender` is not the contract owner.\n    /// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner.\n    /// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership.\n    function transferOwnership(Layout storage s, address sender, address newOwner) internal {\n        address previousOwner = s.contractOwner;\n        require(sender == previousOwner, \"Ownership: not the owner\");\n        if (previousOwner != newOwner) {\n            s.contractOwner = newOwner;\n            emit OwnershipTransferred(previousOwner, newOwner);\n        }\n    }\n\n    /// @notice Gets the address of the contract owner.\n    /// @return contractOwner The address of the contract owner.\n    function owner(Layout storage s) internal view returns (address contractOwner) {\n        return s.contractOwner;\n    }\n\n    /// @notice Ensures that an account is the contract owner.\n    /// @dev Reverts if `account` is not the contract owner.\n    /// @param account The account.\n    function enforceIsContractOwner(Layout storage s, address account) internal view {\n        require(account == s.contractOwner, \"Ownership: not the owner\");\n    }\n\n    function layout() internal pure returns (Layout storage s) {\n        bytes32 position = LAYOUT_STORAGE_SLOT;\n        assembly {\n            s.slot := position\n        }\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/introspection/InterfaceDetection.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {IERC165} from \"./interfaces/IERC165.sol\";\nimport {InterfaceDetectionStorage} from \"./libraries/InterfaceDetectionStorage.sol\";\n\n/// @title ERC165 Interface Detection Standard (immutable or proxiable version).\n/// @dev This contract is to be used via inheritance in an immutable (non-proxied) or proxied implementation.\nabstract contract InterfaceDetection is IERC165 {\n    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;\n\n    /// @inheritdoc IERC165\n    function supportsInterface(bytes4 interfaceId) external view override returns (bool) {\n        return InterfaceDetectionStorage.layout().supportsInterface(interfaceId);\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/introspection/interfaces/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\n/// @title ERC165 Interface Detection Standard.\n/// @dev See https://eips.ethereum.org/EIPS/eip-165.\n/// @dev Note: The ERC-165 identifier for this interface is 0x01ffc9a7.\ninterface IERC165 {\n    /// @notice Returns whether this contract implements a given interface.\n    /// @dev Note: This function call must use less than 30 000 gas.\n    /// @param interfaceId the interface identifier to test.\n    /// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported.\n    function supportsInterface(bytes4 interfaceId) external view returns (bool supported);\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/introspection/libraries/InterfaceDetectionStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {IERC165} from \"./../interfaces/IERC165.sol\";\n\nlibrary InterfaceDetectionStorage {\n    struct Layout {\n        mapping(bytes4 => bool) supportedInterfaces;\n    }\n\n    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256(\"animoca.core.introspection.InterfaceDetection.storage\")) - 1);\n\n    bytes4 internal constant ILLEGAL_INTERFACE_ID = 0xffffffff;\n\n    /// @notice Sets or unsets an ERC165 interface.\n    /// @dev Reverts if `interfaceId` is `0xffffffff`.\n    /// @param interfaceId the interface identifier.\n    /// @param supported True to set the interface, false to unset it.\n    function setSupportedInterface(Layout storage s, bytes4 interfaceId, bool supported) internal {\n        require(interfaceId != ILLEGAL_INTERFACE_ID, \"InterfaceDetection: wrong value\");\n        s.supportedInterfaces[interfaceId] = supported;\n    }\n\n    /// @notice Returns whether this contract implements a given interface.\n    /// @dev Note: This function call must use less than 30 000 gas.\n    /// @param interfaceId The interface identifier to test.\n    /// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported.\n    function supportsInterface(Layout storage s, bytes4 interfaceId) internal view returns (bool supported) {\n        if (interfaceId == ILLEGAL_INTERFACE_ID) {\n            return false;\n        }\n        if (interfaceId == type(IERC165).interfaceId) {\n            return true;\n        }\n        return s.supportedInterfaces[interfaceId];\n    }\n\n    function layout() internal pure returns (Layout storage s) {\n        bytes32 position = LAYOUT_STORAGE_SLOT;\n        assembly {\n            s.slot := position\n        }\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/lifecycle/Pause.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {PauseStorage} from \"./libraries/PauseStorage.sol\";\nimport {PauseBase} from \"./base/PauseBase.sol\";\nimport {ContractOwnership} from \"../access/ContractOwnership.sol\";\n\n/// @title Pausing mechanism (immutable version).\n/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.\nabstract contract Pause is PauseBase, ContractOwnership {\n    using PauseStorage for PauseStorage.Layout;\n\n    /// @notice Initializes the storage with an initial pause state.\n    /// @dev Emits a {Paused} event if `isPaused` is true.\n    /// @param isPaused The initial pause state.\n    constructor(bool isPaused) {\n        PauseStorage.layout().constructorInit(isPaused);\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/lifecycle/base/PauseBase.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {PauseStorage} from \"./../libraries/PauseStorage.sol\";\nimport {ContractOwnershipStorage} from \"./../../access/libraries/ContractOwnershipStorage.sol\";\nimport {Context} from \"@openzeppelin/contracts/utils/Context.sol\";\n\n/// @title Pausing mechanism (proxiable version).\n/// @dev This contract is to be used via inheritance in a proxied implementation.\n/// @dev Note: This contract requires ERC173 (Contract Ownership standard).\nabstract contract PauseBase is Context {\n    using PauseStorage for PauseStorage.Layout;\n    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;\n\n    /// @notice Emitted when the pause is triggered.\n    event Paused();\n\n    /// @notice Emitted when the pause is lifted.\n    event Unpaused();\n\n    /// @notice Pauses the contract.\n    /// @dev Reverts if the sender is not the contract owner.\n    /// @dev Reverts if the contract is paused.\n    /// @dev Emits a {Paused} event.\n    function pause() external {\n        ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());\n        PauseStorage.layout().pause();\n    }\n\n    /// @notice Unpauses the contract.\n    /// @dev Reverts if the sender is not the contract owner.\n    /// @dev Reverts if the contract is not paused.\n    /// @dev Emits an {Unpaused} event.\n    function unpause() external {\n        ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());\n        PauseStorage.layout().unpause();\n    }\n\n    /// @notice Gets the paused state of the contract.\n    /// @return isPaused The paused state of the contract.\n    function paused() external view returns (bool) {\n        return PauseStorage.layout().paused();\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/lifecycle/libraries/PauseStorage.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {ProxyInitialization} from \"./../../proxy/libraries/ProxyInitialization.sol\";\n\nlibrary PauseStorage {\n    using PauseStorage for PauseStorage.Layout;\n\n    struct Layout {\n        bool isPaused;\n    }\n\n    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256(\"animoca.core.lifecycle.Pause.storage\")) - 1);\n    bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256(\"animoca.core.lifecycle.Pause.phase\")) - 1);\n\n    event Paused();\n    event Unpaused();\n\n    /// @notice Initializes the storage with an initial pause state (immutable version).\n    /// @dev Note: This function should be called ONLY in the constructor of an immutable (non-proxied) contract.\n    /// @dev Emits a {Paused} event if `isPaused` is true.\n    /// @param isPaused The initial pause state.\n    function constructorInit(Layout storage s, bool isPaused) internal {\n        if (isPaused) {\n            s.isPaused = true;\n            emit Paused();\n        }\n    }\n\n    /// @notice Initializes the storage with an initial pause state (proxied version).\n    /// @notice Sets the proxy initialization phase to `1`.\n    /// @dev Note: This function should be called ONLY in the init function of a proxied contract.\n    /// @dev Reverts if the proxy initialization phase is set to `1` or above.\n    /// @dev Emits a {Paused} event if `isPaused` is true.\n    /// @param isPaused The initial pause state.\n    function proxyInit(Layout storage s, bool isPaused) internal {\n        ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1);\n        s.constructorInit(isPaused);\n    }\n\n    /// @notice Pauses the contract.\n    /// @dev Reverts if the contract is paused.\n    /// @dev Emits a {Paused} event.\n    function pause(Layout storage s) internal {\n        s.enforceIsNotPaused();\n        s.isPaused = true;\n        emit Paused();\n    }\n\n    /// @notice Unpauses the contract.\n    /// @dev Reverts if the contract is not paused.\n    /// @dev Emits an {Unpaused} event.\n    function unpause(Layout storage s) internal {\n        s.enforceIsPaused();\n        s.isPaused = false;\n        emit Unpaused();\n    }\n\n    /// @notice Gets the paused state of the contract.\n    /// @return isPaused The paused state of the contract.\n    function paused(Layout storage s) internal view returns (bool isPaused) {\n        return s.isPaused;\n    }\n\n    /// @notice Ensures that the contract is paused.\n    /// @dev Reverts if the contract is not paused.\n    function enforceIsPaused(Layout storage s) internal view {\n        require(s.isPaused, \"Pause: not paused\");\n    }\n\n    /// @notice Ensures that the contract is not paused.\n    /// @dev Reverts if the contract is paused.\n    function enforceIsNotPaused(Layout storage s) internal view {\n        require(!s.isPaused, \"Pause: paused\");\n    }\n\n    function layout() internal pure returns (Layout storage s) {\n        bytes32 position = LAYOUT_STORAGE_SLOT;\n        assembly {\n            s.slot := position\n        }\n    }\n}\n"
      },
      "@animoca/ethereum-contracts/contracts/proxy/libraries/ProxyInitialization.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.8;\n\nimport {StorageSlot} from \"@openzeppelin/contracts/utils/StorageSlot.sol\";\n\n/// @notice Multiple calls protection for storage-modifying proxy initialization functions.\nlibrary ProxyInitialization {\n    /// @notice Sets the initialization phase during a storage-modifying proxy initialization function.\n    /// @dev Reverts if `phase` has been reached already.\n    /// @param storageSlot the storage slot where `phase` is stored.\n    /// @param phase the initialization phase.\n    function setPhase(bytes32 storageSlot, uint256 phase) internal {\n        StorageSlot.Uint256Slot storage currentVersion = StorageSlot.getUint256Slot(storageSlot);\n        require(currentVersion.value < phase, \"Storage: phase reached\");\n        currentVersion.value = phase;\n    }\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
      },
      "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    function safeTransfer(\n        IERC20 token,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender) + value;\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            uint256 newAllowance = oldAllowance - value;\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n        }\n    }\n\n    function safePermit(\n        IERC20Permit token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        if (returndata.length > 0) {\n            // Return data is optional\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Address.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/Context.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/StorageSlot.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n *     function _getImplementation() internal view returns (address) {\n *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n *     }\n *\n *     function _setImplementation(address newImplementation) internal {\n *         require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n *     }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n    struct AddressSlot {\n        address value;\n    }\n\n    struct BooleanSlot {\n        bool value;\n    }\n\n    struct Bytes32Slot {\n        bytes32 value;\n    }\n\n    struct Uint256Slot {\n        uint256 value;\n    }\n\n    /**\n     * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n     */\n    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n     */\n    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n     */\n    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n\n    /**\n     * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n     */\n    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            r.slot := slot\n        }\n    }\n}\n"
      },
      "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev These functions deal with verification of Merkle Tree proofs.\n *\n * The tree and the proofs can be generated using our\n * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].\n * You will find a quickstart guide in the readme.\n *\n * WARNING: You should avoid using leaf values that are 64 bytes long prior to\n * hashing, or use a hash function other than keccak256 for hashing leaves.\n * This is because the concatenation of a sorted pair of internal nodes in\n * the merkle tree could be reinterpreted as a leaf value.\n * OpenZeppelin's JavaScript library generates merkle trees that are safe\n * against this attack out of the box.\n */\nlibrary MerkleProof {\n    /**\n     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree\n     * defined by `root`. For this, a `proof` must be provided, containing\n     * sibling hashes on the branch from the leaf to the root of the tree. Each\n     * pair of leaves and each pair of pre-images are assumed to be sorted.\n     */\n    function verify(\n        bytes32[] memory proof,\n        bytes32 root,\n        bytes32 leaf\n    ) internal pure returns (bool) {\n        return processProof(proof, leaf) == root;\n    }\n\n    /**\n     * @dev Calldata version of {verify}\n     *\n     * _Available since v4.7._\n     */\n    function verifyCalldata(\n        bytes32[] calldata proof,\n        bytes32 root,\n        bytes32 leaf\n    ) internal pure returns (bool) {\n        return processProofCalldata(proof, leaf) == root;\n    }\n\n    /**\n     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up\n     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt\n     * hash matches the root of the tree. When processing the proof, the pairs\n     * of leafs & pre-images are assumed to be sorted.\n     *\n     * _Available since v4.4._\n     */\n    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {\n        bytes32 computedHash = leaf;\n        for (uint256 i = 0; i < proof.length; i++) {\n            computedHash = _hashPair(computedHash, proof[i]);\n        }\n        return computedHash;\n    }\n\n    /**\n     * @dev Calldata version of {processProof}\n     *\n     * _Available since v4.7._\n     */\n    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {\n        bytes32 computedHash = leaf;\n        for (uint256 i = 0; i < proof.length; i++) {\n            computedHash = _hashPair(computedHash, proof[i]);\n        }\n        return computedHash;\n    }\n\n    /**\n     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by\n     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.\n     *\n     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n     *\n     * _Available since v4.7._\n     */\n    function multiProofVerify(\n        bytes32[] memory proof,\n        bool[] memory proofFlags,\n        bytes32 root,\n        bytes32[] memory leaves\n    ) internal pure returns (bool) {\n        return processMultiProof(proof, proofFlags, leaves) == root;\n    }\n\n    /**\n     * @dev Calldata version of {multiProofVerify}\n     *\n     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n     *\n     * _Available since v4.7._\n     */\n    function multiProofVerifyCalldata(\n        bytes32[] calldata proof,\n        bool[] calldata proofFlags,\n        bytes32 root,\n        bytes32[] memory leaves\n    ) internal pure returns (bool) {\n        return processMultiProofCalldata(proof, proofFlags, leaves) == root;\n    }\n\n    /**\n     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction\n     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another\n     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false\n     * respectively.\n     *\n     * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree\n     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the\n     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).\n     *\n     * _Available since v4.7._\n     */\n    function processMultiProof(\n        bytes32[] memory proof,\n        bool[] memory proofFlags,\n        bytes32[] memory leaves\n    ) internal pure returns (bytes32 merkleRoot) {\n        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n        // the merkle tree.\n        uint256 leavesLen = leaves.length;\n        uint256 totalHashes = proofFlags.length;\n\n        // Check proof validity.\n        require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n        // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n        bytes32[] memory hashes = new bytes32[](totalHashes);\n        uint256 leafPos = 0;\n        uint256 hashPos = 0;\n        uint256 proofPos = 0;\n        // At each step, we compute the next hash using two values:\n        // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n        //   get the next hash.\n        // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n        //   `proof` array.\n        for (uint256 i = 0; i < totalHashes; i++) {\n            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n            hashes[i] = _hashPair(a, b);\n        }\n\n        if (totalHashes > 0) {\n            return hashes[totalHashes - 1];\n        } else if (leavesLen > 0) {\n            return leaves[0];\n        } else {\n            return proof[0];\n        }\n    }\n\n    /**\n     * @dev Calldata version of {processMultiProof}.\n     *\n     * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details.\n     *\n     * _Available since v4.7._\n     */\n    function processMultiProofCalldata(\n        bytes32[] calldata proof,\n        bool[] calldata proofFlags,\n        bytes32[] memory leaves\n    ) internal pure returns (bytes32 merkleRoot) {\n        // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by\n        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the\n        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of\n        // the merkle tree.\n        uint256 leavesLen = leaves.length;\n        uint256 totalHashes = proofFlags.length;\n\n        // Check proof validity.\n        require(leavesLen + proof.length - 1 == totalHashes, \"MerkleProof: invalid multiproof\");\n\n        // The xxxPos values are \"pointers\" to the next value to consume in each array. All accesses are done using\n        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's \"pop\".\n        bytes32[] memory hashes = new bytes32[](totalHashes);\n        uint256 leafPos = 0;\n        uint256 hashPos = 0;\n        uint256 proofPos = 0;\n        // At each step, we compute the next hash using two values:\n        // - a value from the \"main queue\". If not all leaves have been consumed, we get the next leaf, otherwise we\n        //   get the next hash.\n        // - depending on the flag, either another value for the \"main queue\" (merging branches) or an element from the\n        //   `proof` array.\n        for (uint256 i = 0; i < totalHashes; i++) {\n            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];\n            bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++];\n            hashes[i] = _hashPair(a, b);\n        }\n\n        if (totalHashes > 0) {\n            return hashes[totalHashes - 1];\n        } else if (leavesLen > 0) {\n            return leaves[0];\n        } else {\n            return proof[0];\n        }\n    }\n\n    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {\n        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);\n    }\n\n    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {\n        /// @solidity memory-safe-assembly\n        assembly {\n            mstore(0x00, a)\n            mstore(0x20, b)\n            value := keccak256(0x00, 0x40)\n        }\n    }\n}\n"
      },
      "contracts/claim/GameeClaim.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity 0.8.17;\n\nimport {IERC20} from \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport {SafeERC20} from \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport {MerkleProof} from \"@openzeppelin/contracts/utils/cryptography/MerkleProof.sol\";\nimport {PauseStorage} from \"@animoca/ethereum-contracts/contracts/lifecycle/libraries/PauseStorage.sol\";\nimport {Pause} from \"@animoca/ethereum-contracts/contracts/lifecycle/Pause.sol\";\nimport {ContractOwnership} from \"@animoca/ethereum-contracts/contracts/access/ContractOwnership.sol\";\n\n/**\n * @title GameeClaim\n * @dev A smart contract that allows users to claim Gamee Token on Ethereum based on a pre-generated Merkle tree.\n * @dev Users can claim their share of Gamee Token by providing a valid Merkle proof of their Gamee balance on polygon.\n **/\ncontract GameeClaim is ContractOwnership, Pause {\n    using PauseStorage for PauseStorage.Layout;\n    using MerkleProof for bytes32[];\n\n    event TokenClaimed(address receiver, uint256 amount);\n\n    /// @notice The token to be claimed\n    IERC20 public immutable GAMEE_TOKEN;\n\n    /// @notice The address to send gamee token from\n    address public immutable GAMEE_TREASURY;\n\n    /// @notice The Merkle root used to verify the Merkle proof\n    bytes32 public immutable MERKLE_ROOT;\n\n    /// @notice Mapping of claimed status of a user's token swap\n    mapping(address => bool) public claimed;\n\n    /**\n     * @dev Constructor function for the GameeClaim contract.\n     * @param _gameeToken The address of the token to be claimed.\n     * @param _gameeTreasury The address to send gamee Token from.\n     * @param _owner The address to GameeClaim contract owner.\n     * @param _merkleRoot The Merkle root used to verify the Merkle proof.\n     */\n    constructor(\n        IERC20 _gameeToken, \n        address _gameeTreasury, \n        address _owner, \n        bytes32 _merkleRoot\n    ) Pause(false) ContractOwnership(_owner) {\n        GAMEE_TOKEN = _gameeToken;\n        GAMEE_TREASURY = _gameeTreasury;\n        MERKLE_ROOT = _merkleRoot;\n    }\n\n    /**\n     * @dev Validates a merkle proof for a user based on their address, the amount of tokens they can claim and the merkle root.\n     * @param account The address of the user.\n     * @param amount The amount of tokens the user can claim.\n     * @param merkleProof The merkle proof provided by the user.\n     * @return A boolean indicating whether the proof is valid or not.\n     */\n    function _verifyProof(address account, uint256 amount, bytes32[] memory merkleProof) internal view returns (bool) {\n        bytes32 leafHash = keccak256(abi.encodePacked(account, amount));\n        return merkleProof.verify(MERKLE_ROOT, leafHash);\n    }\n\n    /**\n     * @notice On safely claiming Gamee token.\n     * @dev Reverts if the claim is locked/paused.\n     * @dev Reverts if the tokens have already been claimed.\n     * @dev Reverts if the proof is invalid.\n     * @dev Reverts if the token address is invalid.\n     */\n    function claim(address account, uint256 amount, bytes32[] memory merkleProof) public {\n        PauseStorage.layout().enforceIsNotPaused();\n\n        require(!claimed[account], \"GameeClaim: Already claimed\");\n        require(_verifyProof(account, amount, merkleProof), \"GameeClaim: Invalid proof\");\n\n        claimed[account] = true;\n\n        // Transfer tokens from treasury to user wallet\n        SafeERC20.safeTransferFrom(GAMEE_TOKEN, GAMEE_TREASURY, account, amount);\n\n        emit TokenClaimed(account, amount);\n    }\n}\n"
      }
    }
  }}