Contract 0xfF5a164082fa4A0d134585ABa913414cb8FdFef8

Contract Overview

Balance:
0 BTT
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x6c943e1f9e6220f5d90a43bd2fee81be11affdf77b3be39f87e1f4395c9f396bAdd Pair149381082022-11-24 15:02:1974 days 3 hrs ago0x31003c2d5685c7d28d7174c3255307eb9a0f3015 IN  0xff5a164082fa4a0d134585aba913414cb8fdfef80 BTT35.5752
0x7931d8661a8090b90bd9f76842f81e7df88c542138a112834f669b8079fcdb360x61014060149380842022-11-24 15:01:3174 days 3 hrs ago0x31003c2d5685c7d28d7174c3255307eb9a0f3015 IN  Create: Periphery0 BTT1,091.4009
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Periphery

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 21 : 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 2 of 21 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 21 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/draft-IERC20Permit.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 5 of 21 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 6 of 21 : 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 21 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

File 8 of 21 : 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 21 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

// EIP-712 is Final as of 2022-08-11. This file is deprecated.

import "./EIP712.sol";

File 10 of 21 : 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 21 : EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 12 of 21 : 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 21 : 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 21 : 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 15 of 21 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

File 16 of 21 : ILoyalty.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
   	@title ILoyalty contract
   	@dev Provide an interface that other contracts can integrate with Loyalty contract
*/
interface ILoyalty {
    /**
       	@notice Update loyalty points of `_account`
       	@dev  Caller must be Operator
        @param _account         Account address will be updated loyalty points
        @param _amount          Amount of points will be updated
        @param _isAdded         Boolean flag (Add = True, Deduct = False)
    */
    function updatePoint(address _account, uint256 _amount, bool _isAdded) external;
}

File 17 of 21 : IMembership.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";

/**
   	@title IMembership contract
   	@dev Provide interfaces that other contracts can integrate with Membership contract
*/
interface IMembership is IERC721Enumerable {

    /**
       	@notice Add new membership
       	@dev  Caller must be Operator
        @param _account          Account address to be added
        @param _memberId         Assigning member id
    */
    function addMembership(address _account, uint256 _memberId) external;

    /**
       	@notice Cancel current membership
       	@dev  Caller must be Operator
        @param _memberId         Assigning member id
    */
    function cancelMembership(uint256 _memberId) external;

    /**
       	@notice Upgrade `_account` to next tier
       	@dev  Caller must be Operator
        @param _account          Account address to be added
        @param _memberId         Current member id
        @param _nextTier         Upcoming tier will be upgraded

        Note: Checking requiring points, as qualification, could either be done off-chain or on-chain 
    */
    function upgrade(address _account, uint256 _memberId, uint256 _nextTier) external;
}

File 18 of 21 : IPeriphery.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
   	@title IPeriphery contract
   	@dev Provide interfaces that other contracts can integrate with Periphery contract
*/
interface IPeriphery {

    struct Redeem {
        address membership;
        uint256 memberId;
        uint256 point;
        address voucher;
        uint256 value;
        uint128 nonce;
        uint128 expiry;
    }

    struct Buy {
        address beneficiary;
        address membership;
        uint256 memberId;
        address paymentToken;
        uint256 point;
        uint256 totalPayment;
        uint128 nonce;
        uint128 expiry;
    }

    struct TopUp {
        address beneficiary;
        address membership;
        uint256 memberId;
        address voucher;
        uint256 value;
        address paymentToken;
        uint256 totalPayment;
        uint128 nonce;
        uint128 expiry;
    }

    /**
       	@notice Return corresponding `_loyalty` contract to `_membership` contract
       	@dev  Caller can be ANY
    */
    function getLoyalty(address _membership) external view returns (address);

    /**
       	@notice Checking whether `_membership` contract is disabled
       	@dev  Caller can be ANY
    */
    function disabled(address _membership) external view returns (bool);

    /**
       	@notice Redeem loyalty points to voucher's value
       	@dev  Caller can be ANY
        @param _invoice             Redeem invoice struct
        - membership (address)          Address of Membership contract
        - memberId (uint256)            Member id of `msg.sender`
        - point (uint256)               Amount of point to redeem
        - voucher (address)             Address of Voucher contract to receive a value
        - value (uint256)               Additional value to receive after redemption
        - nonce (uint128)               Current counter of `msg.sender`
        - expiry (uint128)              Expiring time of authorizing signature   
        @param _signature           Authorizing signature provided by Verifier
    */
    function redeem(
        Redeem calldata _invoice,
        bytes calldata _signature
    ) external;

    /**
       	@notice Purchase/Topup voucher's value
       	@dev  Caller can be ANY
        @param _invoice             Topup invoice struct
        - beneficiary (address)         Address of Beneficiary that receives a voucher's value
        - membership (address)          Address of Membership contract
        - memberId (uint256)            Beneficiary's member id
        - voucher (address)             Address of Voucher contract to receive a value
        - value (uint256)               Additional value to receive after topup request
        - paymentToken (address)        Address of payment token (0x00 for Native coin)
        - totalPayment (uint256)        Total payment amount
        - nonce (uint128)               Current counter of `msg.sender`
        - expiry (uint128)              Expiring time of authorizing signature   
        @param _signature           Authorizing signature provided by Verifier
    */
    function topup(
        TopUp calldata _invoice,
        bytes calldata _signature
    ) external payable;

    /**
       	@notice Buy loyaly points
       	@dev  Caller can be ANY
        @param _invoice             Buy invoice struct
        - beneficiary (address)         Address of Beneficiary that receives additional loyalty points
        - membership (address)          Address of Membership contract
        - memberId (uint256)            Beneficiary's member id
        - paymentToken (address)        Address of payment token (0x00 for Native coin)
        - point (uint256)               Additional value to receive after buy request
        - totalPayment (uint256)        Total payment amount
        - nonce (uint128)               Current counter of `msg.sender`
        - expiry (uint128)              Expiring time of authorizing signature   
        @param _signature           Authorizing signature provided by Verifier
    */
    function buy(
        Buy calldata _invoice,
        bytes calldata _signature
    ) external payable;
}

File 19 of 21 : IVoucher.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
   	@title IVoucher contract
   	@dev Provide interfaces that other contracts can integrate with Voucher contract
*/
interface IVoucher {
    /**
       	@notice Update voucher's value of `_account`
       	@dev  Caller must be Operator
        @param _account         Account address will be updated voucher's value
        @param _amount          Amount of values will be updated
        @param _isAdded         Boolean flag (Add = True, Deduct = False)
    */
    function updateValue(address _account, uint256 _amount, bool _isAdded) external;
}

File 20 of 21 : Periphery.sol
// SPDX-License-Identifier: None

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "./interfaces/IMembership.sol";
import "./interfaces/ILoyalty.sol";
import "./interfaces/IVoucher.sol";
import "./utils/Signer.sol";

/**
   	@title Periphery contract
   	@dev This contract provide additional features and external interfaces on top of Membership, Loyalty and Voucher contracts 
    - Add a method to buy loyalty points using crypto currency
    - Add a method to redeem loyalty points (loyalty points -> voucher's value)
    - Add a method to purchase/topup a voucher/gift card

    Note: Contract using EIP-712 for a signing scheme
*/
contract Periphery is IPeriphery, Signer, Ownable {
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;

    //  Address to receive payments
    address public treasury;

    //  Mapping address of Membership contract to a group/pair id
    mapping(address => address) private membershipToLoyalty;

    //  Mapping Membership to supporting vouchers
    mapping(address => EnumerableSet.AddressSet) private vouchers;

    //  A list of Memberships has been disabled
    mapping(address => bool) public disabled;

    //  A list of Verifiers who sign a request to authorize
    mapping(address => bool) public verifiers;

    //  Counting a number of requests (from each of accounts) that has been proceeded
    mapping(address => uint256) public nonces;

    event Disabled(address indexed membership, address indexed loyalty);
    event Enabled(address indexed membership, address indexed loyalty);
    event Updated(address indexed membership, address indexed voucher, bool isAdded);

    modifier checkStatus(address _membership) {
        require(
            !disabled[_membership] && getLoyalty(_membership) != address(0), "Unable to disable"
        );
        _;
    }

    constructor(address _treasury, address _verifier) Signer("Membership and Loyalty", "Version 1") Ownable() {
        treasury = _treasury;
        verifiers[_verifier] = true;
    }

    /**
       	@notice Return corresponding `_loyalty` contract to `_membership` contract
       	@dev  Caller can be ANY
    */
    function getLoyalty(address _membership) public view returns (address) {
        return membershipToLoyalty[_membership];
    }

    /**
       	@notice Set/Unset `verifier` of the Periphery contract
       	@dev  Caller must be Owner
        @param _verifiers       A list of addresses will be set/unset a verifier role
        @param _isAdded         Boolean flag (Set = True, Unset = False)

        Note: `verifier` is a special role that has authority to provide a request's authorizing signature
    */
    function setVerifiers(address[] calldata _verifiers, bool _isAdded) external onlyOwner {
        uint256 _len = _verifiers.length;

        for (uint256 i; i < _len; i++)
            verifiers[_verifiers[i]] = _isAdded;
    }

    /**
       	@notice Register a pair of `_membership` and `_loyalty` contracts
       	@dev  Caller must be Owner
        @param _membership          Address of `_membership` contract
        @param _loyalty             Address of `_loyalty` contract
        @param _voucher             Address of `_voucher` contract (optional)

        Note: 
        - `_voucher` will be optional. Should leave it 0x00 when it's not set
        - For each pair of Membership and Loyalty, it comes along with a list of `_voucher` contracts
        that are allowed to redeem
    */
    function addPair(address _membership, address _loyalty, address _voucher) external onlyOwner {
        require(_membership != address(0) && _loyalty != address(0), "Zero Address");
        require(getLoyalty(_membership) == address(0), "Membership already paired");

        membershipToLoyalty[_membership] = _loyalty;
        if (_voucher != address(0)) {
            vouchers[_membership].add(_voucher);
            emit Updated(_membership, _voucher, true);
        }
        emit Enabled(_membership, _loyalty);
    }

    /**
       	@notice Disable a pair of `_membership` and `_loyalty` contracts
       	@dev  Caller must be Owner
        @param _membership          Address of `_membership` contract

        Note: 
        - When a pair is disabled, operations relate to `_membership`, `_loyalty` will also be disabled
        - A list of supporting `_voucher` for this pair is set by using EnumerableSet.AddressSet,
        it pretty costs to delete/remove them when a `_membership` contract is disabled. Thus, just mark
        this pair as `disabled`
        - When re-enabling a pair, make sure checking and updating a list of supporting `_voucher`
    */
    function disablePair(address _membership) external onlyOwner checkStatus(_membership) {
        disabled[_membership] = true;

        emit Disabled(_membership, getLoyalty(_membership));
    }

    /**
       	@notice Re-enable a pair of `_membership` and `_loyalty` contracts
       	@dev  Caller must be Owner
        @param _membership          Address of `_membership` contract

        Note: 
        - After disabling a pair, a list of supporting `_voucher` is not deleted
        Thus, make sure checking and updating this list when re-enabling, 
    */
    function enablePair(address _membership) external onlyOwner {
        require(disabled[_membership], "Unable to enable");

        delete disabled[_membership];
        emit Enabled(_membership, getLoyalty(_membership));
    }

    /**
       	@notice Add/Remove support `_voucher` contract for a `_membership`
       	@dev  Caller must be Owner
        @param _membership          Address of `_membership` contract
        @param _vouchers            A list of `_voucher` contracts
        @param _isAdded             Boolean flag (Add = True, Remove = False)

        Note: `_membership` is disabled, `_voucher` list cannot be updated
    */
    function updateVouchers(address _membership, address[] calldata _vouchers, bool _isAdded) external onlyOwner checkStatus(_membership) {
        uint256 _len = _vouchers.length;
        address _voucher;
        for (uint256 i; i < _len; i++) {
            _voucher = _vouchers[i];
            if (_isAdded)
                vouchers[_membership].add(_voucher);   
            else 
                vouchers[_membership].remove(_voucher);

            emit Updated(_membership, _voucher, _isAdded);
        }   
    }

    /**
       	@notice Redeem loyalty points to voucher's value
       	@dev  Caller can be ANY
        @param _invoice             Redeem invoice struct
        - membership (address)          Address of Membership contract
        - memberId (uint256)            Member id of `msg.sender`
        - point (uint256)               Amount of point to redeem
        - voucher (address)             Address of Voucher contract to receive a value
        - value (uint256)               Additional value to receive after redemption
        - nonce (uint128)               Current counter of `msg.sender`
        - expiry (uint128)              Expiring time of authorizing signature   
        @param _signature           Authorizing signature provided by Verifier
    */
    function redeem(Redeem calldata _invoice, bytes calldata _signature) external override {
        address _caller = msg.sender;
        _precheck(_caller, _invoice.expiry, _invoice.nonce);
        address _loyalty = _checkMembership(_caller, _invoice.membership, _invoice.memberId);
        _checkRedeemInvoiceSig(_caller, _invoice, _signature);
        _updatePoint(_loyalty, _caller, _invoice.point, false);
        _validateVoucher(_invoice.membership, _invoice.voucher);
        _topup(_caller, _caller, _invoice.voucher, _invoice.value);
    }

    /**
       	@notice Purchase/Topup voucher's value
       	@dev  Caller can be ANY
        @param _invoice             Topup invoice struct
        - beneficiary (address)         Address of Beneficiary that receives a voucher's value
        - membership (address)          Address of Membership contract
        - memberId (uint256)            Beneficiary's member id
        - voucher (address)             Address of Voucher contract to receive a value
        - value (uint256)               Additional value to receive after topup request
        - paymentToken (address)        Address of payment token (0x00 for Native coin)
        - totalPayment (uint256)        Total payment amount
        - nonce (uint128)               Current counter of `msg.sender`
        - expiry (uint128)              Expiring time of authorizing signature   
        @param _signature           Authorizing signature provided by Verifier
    */
    function topup(TopUp calldata _invoice, bytes calldata _signature) external payable {
        address _caller = msg.sender;
        _precheck(_caller, _invoice.expiry, _invoice.nonce);
        _checkMembership(_invoice.beneficiary, _invoice.membership, _invoice.memberId);
        _checkTopUpInvoiceSig(_caller, _invoice, _signature);
        if (_invoice.paymentToken == address(0))
            require(msg.value == _invoice.totalPayment, "Invalid payment");

        _makePayment(_invoice.paymentToken, _caller, _invoice.totalPayment);
        _validateVoucher(_invoice.membership, _invoice.voucher);
        _topup(_caller, _invoice.beneficiary, _invoice.voucher, _invoice.value);
    }

    /**
       	@notice Buy loyaly points
       	@dev  Caller can be ANY
        @param _invoice             Buy invoice struct
        - beneficiary (address)         Address of Beneficiary that receives additional loyalty points
        - membership (address)          Address of Membership contract
        - memberId (uint256)            Beneficiary's member id
        - paymentToken (address)        Address of payment token (0x00 for Native coin)
        - point (uint256)               Additional value to receive after buy request
        - totalPayment (uint256)        Total payment amount
        - nonce (uint128)               Current counter of `msg.sender`
        - expiry (uint128)              Expiring time of authorizing signature   
        @param _signature           Authorizing signature provided by Verifier
    */
    function buy(
        Buy calldata _invoice,
        bytes calldata _signature
    ) external payable override {
        address _caller = msg.sender;
        _precheck(_caller, _invoice.expiry, _invoice.nonce);
        address _loyalty = _checkMembership(_invoice.beneficiary, _invoice.membership, _invoice.memberId);
        _checkBuyInvoiceSig(_caller, _invoice, _signature);
        if (_invoice.paymentToken == address(0))
            require(msg.value == _invoice.totalPayment, "Invalid payment");

        _makePayment(_invoice.paymentToken, _caller, _invoice.totalPayment);
        nonces[_caller]++;
        _updatePoint(_loyalty, _invoice.beneficiary, _invoice.point, true);
    }

    function _precheck(
        address _caller,
        uint256 _expiry,
        uint256 _nonce
    ) private view {
        require(block.timestamp <= _expiry, "Signature is expired");
        require(_nonce == nonces[_caller], "Invalid nonce");
    }

    function _checkMembership(
        address _beneficiary,
        address _membership,
        uint256 _memberId
    ) private view returns (address _loyalty) {
        _loyalty = getLoyalty(_membership);
        require(
            _loyalty != address(0) && !disabled[_membership], "Unsupport this membership type"
        );
        require(
            IMembership(_membership).ownerOf(_memberId) == _beneficiary,
            "Beneficiary and memberId not match"
        );
    }

    function _validateVoucher(address _membership, address _voucher) private view {
        require(vouchers[_membership].contains(_voucher), "Unsupport this voucher type");
    }

    function _checkRedeemInvoiceSig(
        address _caller,
        Redeem calldata _invoice,
        bytes calldata _signature
    ) private view {
        _isAuthorizer(Signer._getSignerRedeemInvoice(_caller, _invoice, _signature));
    }

    function _checkBuyInvoiceSig(
        address _caller,
        Buy calldata _invoice,
        bytes calldata _signature
    ) private view {
        _isAuthorizer(Signer._getSignerBuyInvoice(_caller, _invoice, _signature));
    }

    function _checkTopUpInvoiceSig(
        address _caller,
        TopUp calldata _invoice,
        bytes calldata _signature
    ) private view {
        _isAuthorizer(Signer._getSignerTopUpInvoice(_caller, _invoice, _signature));
    }

    function _isAuthorizer(address _signer) private view {
        require(verifiers[_signer], "Unauthorized signature");
    }

    function _updatePoint(address _loyalty, address _account, uint256 _point, bool _opt) private {
        ILoyalty(_loyalty).updatePoint(_account, _point, _opt);
    }

    function _topup(
        address _caller,
        address _beneficiary,
        address _voucher,
        uint256 _value
    ) private {
        nonces[_caller]++;
        IVoucher(_voucher).updateValue(_beneficiary, _value, true);
    }

    function _makePayment(address _token, address _from, uint256 _amount) private {
        address _treasury = treasury;
        if (_token == address(0))
            Address.sendValue(payable(_treasury), _amount);
        else IERC20(_token).safeTransferFrom(_from, _treasury, _amount);
    }
}

File 21 of 21 : Signer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "../interfaces/IPeriphery.sol";

contract Signer is EIP712 {
    using ECDSA for bytes32;
    bytes32 private constant _BUY =
        keccak256("Buy(address beneficiary,address membership,uint256 memberId,address paymentToken,uint256 point,uint256 totalPayment,uint128 nonce,uint128 expiry)");
    bytes32 private constant _BUY_ACTION = 
        keccak256("BuyAction(address caller,Buy data)Buy(address beneficiary,address membership,uint256 memberId,address paymentToken,uint256 point,uint256 totalPayment,uint128 nonce,uint128 expiry)");
    bytes32 private constant _REDEEM =
        keccak256("Redeem(address membership,uint256 memberId,uint256 point,address voucher,uint256 value,uint128 nonce,uint128 expiry)");
    bytes32 private constant _REDEEM_ACTION =
        keccak256("RedeemAction(address caller,Redeem data)Redeem(address membership,uint256 memberId,uint256 point,address voucher,uint256 value,uint128 nonce,uint128 expiry)");
    bytes32 private constant _TOPUP =
        keccak256("TopUp(address beneficiary,address membership,uint256 memberId,address voucher,uint256 value,address paymentToken,uint256 totalPayment,uint128 nonce,uint128 expiry)");
    bytes32 private constant _TOPUP_ACTION =
        keccak256("TopUpAction(address caller,TopUp data)TopUp(address beneficiary,address membership,uint256 memberId,address voucher,uint256 value,address paymentToken,uint256 totalPayment,uint128 nonce,uint128 expiry)");

    constructor(
        string memory name,
        string memory version
    ) EIP712(name, version) {}

    function _getSignerRedeemInvoice(
        address _caller,
        IPeriphery.Redeem calldata _invoice,
        bytes calldata _signature
    ) internal view returns (address _signer) {
        _signer = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    _REDEEM_ACTION, _caller, 
                    keccak256(
                        abi.encode(_REDEEM, _invoice)
                    )
                )
            )
        ).recover(_signature);
    }

    function _getSignerBuyInvoice(
        address _caller,
        IPeriphery.Buy calldata _invoice,
        bytes calldata _signature
    ) internal view returns (address _signer) {
        _signer = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    _BUY_ACTION, _caller, 
                    keccak256(
                        abi.encode(_BUY, _invoice)
                    )
                )
            )
        ).recover(_signature);
    }

    function _getSignerTopUpInvoice(
        address _caller,
        IPeriphery.TopUp calldata _invoice,
        bytes calldata _signature
    ) internal view returns (address _signer) {
        _signer = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    _TOPUP_ACTION, _caller,
                    keccak256(
                        abi.encode(_TOPUP, _invoice)
                    )
                )
            )
        ).recover(_signature);
    }
}

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_verifier","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"membership","type":"address"},{"indexed":true,"internalType":"address","name":"loyalty","type":"address"}],"name":"Disabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"membership","type":"address"},{"indexed":true,"internalType":"address","name":"loyalty","type":"address"}],"name":"Enabled","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":"membership","type":"address"},{"indexed":true,"internalType":"address","name":"voucher","type":"address"},{"indexed":false,"internalType":"bool","name":"isAdded","type":"bool"}],"name":"Updated","type":"event"},{"inputs":[{"internalType":"address","name":"_membership","type":"address"},{"internalType":"address","name":"_loyalty","type":"address"},{"internalType":"address","name":"_voucher","type":"address"}],"name":"addPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"address","name":"membership","type":"address"},{"internalType":"uint256","name":"memberId","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"point","type":"uint256"},{"internalType":"uint256","name":"totalPayment","type":"uint256"},{"internalType":"uint128","name":"nonce","type":"uint128"},{"internalType":"uint128","name":"expiry","type":"uint128"}],"internalType":"struct IPeriphery.Buy","name":"_invoice","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"buy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_membership","type":"address"}],"name":"disablePair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"disabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_membership","type":"address"}],"name":"enablePair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_membership","type":"address"}],"name":"getLoyalty","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"membership","type":"address"},{"internalType":"uint256","name":"memberId","type":"uint256"},{"internalType":"uint256","name":"point","type":"uint256"},{"internalType":"address","name":"voucher","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint128","name":"nonce","type":"uint128"},{"internalType":"uint128","name":"expiry","type":"uint128"}],"internalType":"struct IPeriphery.Redeem","name":"_invoice","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_verifiers","type":"address[]"},{"internalType":"bool","name":"_isAdded","type":"bool"}],"name":"setVerifiers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"beneficiary","type":"address"},{"internalType":"address","name":"membership","type":"address"},{"internalType":"uint256","name":"memberId","type":"uint256"},{"internalType":"address","name":"voucher","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"address","name":"paymentToken","type":"address"},{"internalType":"uint256","name":"totalPayment","type":"uint256"},{"internalType":"uint128","name":"nonce","type":"uint128"},{"internalType":"uint128","name":"expiry","type":"uint128"}],"internalType":"struct IPeriphery.TopUp","name":"_invoice","type":"tuple"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"topup","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_membership","type":"address"},{"internalType":"address[]","name":"_vouchers","type":"address[]"},{"internalType":"bool","name":"_isAdded","type":"bool"}],"name":"updateVouchers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"verifiers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

6101406040523480156200001257600080fd5b50604051620044513803806200445183398181016040528101906200003891906200038d565b6040518060400160405280601681526020017f4d656d6265727368697020616e64204c6f79616c7479000000000000000000008152506040518060400160405280600981526020017f56657273696f6e20310000000000000000000000000000000000000000000000815250818160008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a081815250506200010f8184846200021b60201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff1681525050806101208181525050505050505050506200017a6200016e6200025760201b60201c565b6200025f60201b60201c565b81600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550505062000478565b60008383834630604051602001620002389594939291906200041b565b6040516020818303038152906040528051906020012090509392505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003558262000328565b9050919050565b620003678162000348565b81146200037357600080fd5b50565b60008151905062000387816200035c565b92915050565b60008060408385031215620003a757620003a662000323565b5b6000620003b78582860162000376565b9250506020620003ca8582860162000376565b9150509250929050565b6000819050919050565b620003e981620003d4565b82525050565b6000819050919050565b6200040481620003ef565b82525050565b620004158162000348565b82525050565b600060a082019050620004326000830188620003de565b620004416020830187620003de565b620004506040830186620003de565b6200045f6060830185620003f9565b6200046e60808301846200040a565b9695505050505050565b60805160a05160c05160e0516101005161012051613f89620004c8600039600061221f015260006122610152600061224001526000612175015260006121cb015260006121f40152613f896000f3fe6080604052600436106100f35760003560e01c8063ab7a2c071161008a578063d2c83d8a11610059578063d2c83d8a14610319578063f1ec23cf14610335578063f2fde38b1461035e578063fbfb598714610387576100f3565b8063ab7a2c071461026e578063b27f74b314610297578063bdfea0d6146102d4578063ce36a5b8146102fd576100f3565b80636e3d9154116100c65780636e3d9154146101c6578063715018a6146101ef5780637ecebe00146102065780638da5cb5b14610243576100f3565b806309af7d86146100f857806361d027b3146101355780636bf66bc3146101605780636c82448714610189575b600080fd5b34801561010457600080fd5b5061011f600480360381019061011a91906127d1565b6103b0565b60405161012c919061280d565b60405180910390f35b34801561014157600080fd5b5061014a610419565b604051610157919061280d565b60405180910390f35b34801561016c57600080fd5b50610187600480360381019061018291906128c5565b61043f565b005b34801561019557600080fd5b506101b060048036038101906101ab91906127d1565b610686565b6040516101bd9190612948565b60405180910390f35b3480156101d257600080fd5b506101ed60048036038101906101e891906127d1565b6106a6565b005b3480156101fb57600080fd5b506102046107ee565b005b34801561021257600080fd5b5061022d600480360381019061022891906127d1565b610802565b60405161023a919061297c565b60405180910390f35b34801561024f57600080fd5b5061025861081a565b604051610265919061280d565b60405180910390f35b34801561027a57600080fd5b50610295600480360381019061029091906127d1565b610843565b005b3480156102a357600080fd5b506102be60048036038101906102b991906127d1565b6109d8565b6040516102cb9190612948565b60405180910390f35b3480156102e057600080fd5b506102fb60048036038101906102f69190612997565b6109f8565b005b61031760048036038101906103129190612a72565b610aab565b005b610333600480360381019061032e9190612af4565b610c5b565b005b34801561034157600080fd5b5061035c60048036038101906103579190612b56565b610e24565b005b34801561036a57600080fd5b50610385600480360381019061038091906127d1565b611116565b005b34801561039357600080fd5b506103ae60048036038101906103a99190612bc8565b61119a565b005b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b61044761128b565b83600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156104d75750600073ffffffffffffffffffffffffffffffffffffffff166104be826103b0565b73ffffffffffffffffffffffffffffffffffffffff1614155b610516576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050d90612c86565b60405180910390fd5b60008484905090506000805b8281101561067c5786868281811061053d5761053c612ca6565b5b905060200201602081019061055291906127d1565b915084156105b1576105ab82600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061130990919063ffffffff16565b50610604565b61060282600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061133990919063ffffffff16565b505b8173ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167fa3dc6f84978ec45c7aa4a93448811c5c607b9f815af61466a2bedeebdd9f7248876040516106619190612948565b60405180910390a3808061067490612d04565b915050610522565b5050505050505050565b60056020528060005260406000206000915054906101000a900460ff1681565b6106ae61128b565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073190612d99565b60405180910390fd5b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff0219169055610792816103b0565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f2ef82a929ca200bcfdf95dec72ea691570ae7f78d47534fb8a60ca19da7c61f060405160405180910390a350565b6107f661128b565b6108006000611369565b565b60066020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b61084b61128b565b80600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156108db5750600073ffffffffffffffffffffffffffffffffffffffff166108c2826103b0565b73ffffffffffffffffffffffffffffffffffffffff1614155b61091a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091190612c86565b60405180910390fd5b6001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061097b826103b0565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167ff6f1d52d1692e0af84084c6bb2e415a100c41428f61b15106c6361cbf643736760405160405180910390a35050565b60046020528060005260406000206000915054906101000a900460ff1681565b610a0061128b565b600083839050905060005b81811015610aa4578260056000878785818110610a2b57610a2a612ca6565b5b9050602002016020810190610a4091906127d1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610a9c90612d04565b915050610a0b565b5050505050565b6000339050610b048185610100016020810190610ac89190612e01565b6fffffffffffffffffffffffffffffffff168660e0016020810190610aed9190612e01565b6fffffffffffffffffffffffffffffffff1661142d565b610b37846000016020810190610b1a91906127d1565b856020016020810190610b2d91906127d1565b86604001356114f6565b50610b44818585856116c6565b600073ffffffffffffffffffffffffffffffffffffffff168460a0016020810190610b6f91906127d1565b73ffffffffffffffffffffffffffffffffffffffff161415610bd2578360c001353414610bd1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc890612e7a565b60405180910390fd5b5b610bf38460a0016020810190610be891906127d1565b828660c001356116e0565b610c21846020016020810190610c0991906127d1565b856060016020810190610c1c91906127d1565b61177f565b610c5581856000016020810190610c3891906127d1565b866060016020810190610c4b91906127d1565b8760800135611813565b50505050565b6000339050610cb3818560e0016020810190610c779190612e01565b6fffffffffffffffffffffffffffffffff168660c0016020810190610c9c9190612e01565b6fffffffffffffffffffffffffffffffff1661142d565b6000610ce8856000016020810190610ccb91906127d1565b866020016020810190610cde91906127d1565b87604001356114f6565b9050610cf6828686866118de565b600073ffffffffffffffffffffffffffffffffffffffff16856060016020810190610d2191906127d1565b73ffffffffffffffffffffffffffffffffffffffff161415610d84578460a001353414610d83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d7a90612e7a565b60405180910390fd5b5b610da5856060016020810190610d9a91906127d1565b838760a001356116e0565b600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000815480929190610df590612d04565b9190505550610e1d81866000016020810190610e1191906127d1565b876080013560016118f8565b5050505050565b610e2c61128b565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610e965750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b610ed5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ecc90612ee6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16610ef6846103b0565b73ffffffffffffffffffffffffffffffffffffffff1614610f4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4390612f52565b60405180910390fd5b81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146110b75761104f81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002061130990919063ffffffff16565b508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fa3dc6f84978ec45c7aa4a93448811c5c607b9f815af61466a2bedeebdd9f724860016040516110ae9190612948565b60405180910390a35b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f2ef82a929ca200bcfdf95dec72ea691570ae7f78d47534fb8a60ca19da7c61f060405160405180910390a3505050565b61111e61128b565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561118e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118590612fe4565b60405180910390fd5b61119781611369565b50565b60003390506111f2818560c00160208101906111b69190612e01565b6fffffffffffffffffffffffffffffffff168660a00160208101906111db9190612e01565b6fffffffffffffffffffffffffffffffff1661142d565b60006112158286600001602081019061120b91906127d1565b87602001356114f6565b90506112238286868661196d565b6112348183876040013560006118f8565b61126285600001602081019061124a91906127d1565b86606001602081019061125d91906127d1565b61177f565b611284828387606001602081019061127a91906127d1565b8860800135611813565b5050505050565b611293611987565b73ffffffffffffffffffffffffffffffffffffffff166112b161081a565b73ffffffffffffffffffffffffffffffffffffffff1614611307576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fe90613050565b60405180910390fd5b565b6000611331836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61198f565b905092915050565b6000611361836000018373ffffffffffffffffffffffffffffffffffffffff1660001b6119ff565b905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b81421115611470576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611467906130bc565b60405180910390fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481146114f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e890613128565b60405180910390fd5b505050565b6000611501836103b0565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415801561158a5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6115c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c090613194565b60405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16636352211e846040518263ffffffff1660e01b8152600401611619919061297c565b60206040518083038186803b15801561163157600080fd5b505afa158015611645573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166991906131c9565b73ffffffffffffffffffffffffffffffffffffffff16146116bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b690613268565b60405180910390fd5b9392505050565b6116da6116d585858585611b13565b611c10565b50505050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561174b576117468183611c9f565b611779565b6117788382848773ffffffffffffffffffffffffffffffffffffffff16611d93909392919063ffffffff16565b5b50505050565b6117d081600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020611e1c90919063ffffffff16565b61180f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611806906132d4565b60405180910390fd5b5050565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061186390612d04565b91905055508173ffffffffffffffffffffffffffffffffffffffff16637d37eb9d848360016040518463ffffffff1660e01b81526004016118a6939291906132f4565b600060405180830381600087803b1580156118c057600080fd5b505af11580156118d4573d6000803e3d6000fd5b5050505050505050565b6118f26118ed85858585611e4c565b611c10565b50505050565b8373ffffffffffffffffffffffffffffffffffffffff166328a013678484846040518463ffffffff1660e01b8152600401611935939291906132f4565b600060405180830381600087803b15801561194f57600080fd5b505af1158015611963573d6000803e3d6000fd5b5050505050505050565b61198161197c85858585611f49565b611c10565b50505050565b600033905090565b600061199b8383612046565b6119f45782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506119f9565b600090505b92915050565b60008083600101600084815260200190815260200160002054905060008114611b07576000600182611a31919061332b565b9050600060018660000180549050611a49919061332b565b9050818114611ab8576000866000018281548110611a6a57611a69612ca6565b5b9060005260206000200154905080876000018481548110611a8e57611a8d612ca6565b5b90600052602060002001819055508387600101600083815260200190815260200160002081905550505b85600001805480611acc57611acb61335f565b5b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050611b0d565b60009150505b92915050565b6000611c0683838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611bf87f07cd643c6ef499459a0abbff42ac63b0d03dfb4b3868069a3dc87d60076be9db887f07645fc09bdfd4a87ca22cb5b77d9483e01f029e8522513b1c3a1fb7d5d6e92b89604051602001611bb5929190613544565b60405160208183030381529060405280519060200120604051602001611bdd9392919061356e565b60405160208183030381529060405280519060200120612069565b61208390919063ffffffff16565b9050949350505050565b600560008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16611c9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c93906135f1565b60405180910390fd5b50565b80471015611ce2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd99061365d565b60405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff1682604051611d08906136ae565b60006040518083038185875af1925050503d8060008114611d45576040519150601f19603f3d011682016040523d82523d6000602084013e611d4a565b606091505b5050905080611d8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8590613735565b60405180910390fd5b505050565b611e16846323b872dd60e01b858585604051602401611db493929190613755565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506120aa565b50505050565b6000611e44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612046565b905092915050565b6000611f3f83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050611f317f08917af25ea1f7962b17c2e8e0162ba6e8d8a2851605d7dfab0997973a0a1c53887f5466339a37ac2c50ff55d404e4b45c46f3fb2a75de6510d5da1f926bd8543e5d89604051602001611eee92919061386e565b60405160208183030381529060405280519060200120604051602001611f169392919061356e565b60405160208183030381529060405280519060200120612069565b61208390919063ffffffff16565b9050949350505050565b600061203c83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505061202e7f92997c191d098a1729f81748d1d34da63045d7751585942e3e8fbe20f3e8e045887fd18120b3c7a5e5dc9787ce64e906368c973e03b3a00c2fa957bfa4703a7a348089604051602001611feb92919061395e565b604051602081830303815290604052805190602001206040516020016120139392919061356e565b60405160208183030381529060405280519060200120612069565b61208390919063ffffffff16565b9050949350505050565b600080836001016000848152602001908152602001600020541415905092915050565b600061207c612076612171565b8361228b565b9050919050565b600080600061209285856122be565b9150915061209f81612310565b819250505092915050565b600061210c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661247e9092919063ffffffff16565b905060008151111561216c578080602001905181019061212c919061399d565b61216b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216290613a3c565b60405180910390fd5b5b505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff161480156121ed57507f000000000000000000000000000000000000000000000000000000000000000046145b1561221a577f00000000000000000000000000000000000000000000000000000000000000009050612288565b6122857f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000612496565b90505b90565b600082826040516020016122a0929190613ad4565b60405160208183030381529060405280519060200120905092915050565b6000806041835114156123005760008060006020860151925060408601519150606086015160001a90506122f4878285856124d0565b94509450505050612309565b60006002915091505b9250929050565b6000600481111561232457612323613b0b565b5b81600481111561233757612336613b0b565b5b14156123425761247b565b6001600481111561235657612355613b0b565b5b81600481111561236957612368613b0b565b5b14156123aa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123a190613b86565b60405180910390fd5b600260048111156123be576123bd613b0b565b5b8160048111156123d1576123d0613b0b565b5b1415612412576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161240990613bf2565b60405180910390fd5b6003600481111561242657612425613b0b565b5b81600481111561243957612438613b0b565b5b141561247a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161247190613c84565b60405180910390fd5b5b50565b606061248d84846000856125b3565b90509392505050565b600083838346306040516020016124b1959493929190613ca4565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c111561250b5760006003915091506125aa565b6000600187878787604051600081526020016040526040516125309493929190613d13565b6020604051602081039080840390855afa158015612552573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156125a1576000600192509250506125aa565b80600092509250505b94509492505050565b6060824710156125f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125ef90613dca565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516126219190613e59565b60006040518083038185875af1925050503d806000811461265e576040519150601f19603f3d011682016040523d82523d6000602084013e612663565b606091505b509150915061267487838387612680565b92505050949350505050565b606083156126e3576000835114156126db5761269b856126f6565b6126da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126d190613ebc565b60405180910390fd5b5b8290506126ee565b6126ed8383612719565b5b949350505050565b6000808273ffffffffffffffffffffffffffffffffffffffff163b119050919050565b60008251111561272c5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127609190613f31565b60405180910390fd5b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061279e82612773565b9050919050565b6127ae81612793565b81146127b957600080fd5b50565b6000813590506127cb816127a5565b92915050565b6000602082840312156127e7576127e6612769565b5b60006127f5848285016127bc565b91505092915050565b61280781612793565b82525050565b600060208201905061282260008301846127fe565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f84011261284d5761284c612828565b5b8235905067ffffffffffffffff81111561286a5761286961282d565b5b60208301915083602082028301111561288657612885612832565b5b9250929050565b60008115159050919050565b6128a28161288d565b81146128ad57600080fd5b50565b6000813590506128bf81612899565b92915050565b600080600080606085870312156128df576128de612769565b5b60006128ed878288016127bc565b945050602085013567ffffffffffffffff81111561290e5761290d61276e565b5b61291a87828801612837565b9350935050604061292d878288016128b0565b91505092959194509250565b6129428161288d565b82525050565b600060208201905061295d6000830184612939565b92915050565b6000819050919050565b61297681612963565b82525050565b6000602082019050612991600083018461296d565b92915050565b6000806000604084860312156129b0576129af612769565b5b600084013567ffffffffffffffff8111156129ce576129cd61276e565b5b6129da86828701612837565b935093505060206129ed868287016128b0565b9150509250925092565b600080fd5b60006101208284031215612a1357612a126129f7565b5b81905092915050565b60008083601f840112612a3257612a31612828565b5b8235905067ffffffffffffffff811115612a4f57612a4e61282d565b5b602083019150836001820283011115612a6b57612a6a612832565b5b9250929050565b60008060006101408486031215612a8c57612a8b612769565b5b6000612a9a868287016129fc565b93505061012084013567ffffffffffffffff811115612abc57612abb61276e565b5b612ac886828701612a1c565b92509250509250925092565b60006101008284031215612aeb57612aea6129f7565b5b81905092915050565b60008060006101208486031215612b0e57612b0d612769565b5b6000612b1c86828701612ad4565b93505061010084013567ffffffffffffffff811115612b3e57612b3d61276e565b5b612b4a86828701612a1c565b92509250509250925092565b600080600060608486031215612b6f57612b6e612769565b5b6000612b7d868287016127bc565b9350506020612b8e868287016127bc565b9250506040612b9f868287016127bc565b9150509250925092565b600060e08284031215612bbf57612bbe6129f7565b5b81905092915050565b60008060006101008486031215612be257612be1612769565b5b6000612bf086828701612ba9565b93505060e084013567ffffffffffffffff811115612c1157612c1061276e565b5b612c1d86828701612a1c565b92509250509250925092565b600082825260208201905092915050565b7f556e61626c6520746f2064697361626c65000000000000000000000000000000600082015250565b6000612c70601183612c29565b9150612c7b82612c3a565b602082019050919050565b60006020820190508181036000830152612c9f81612c63565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612d0f82612963565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d4257612d41612cd5565b5b600182019050919050565b7f556e61626c6520746f20656e61626c6500000000000000000000000000000000600082015250565b6000612d83601083612c29565b9150612d8e82612d4d565b602082019050919050565b60006020820190508181036000830152612db281612d76565b9050919050565b60006fffffffffffffffffffffffffffffffff82169050919050565b612dde81612db9565b8114612de957600080fd5b50565b600081359050612dfb81612dd5565b92915050565b600060208284031215612e1757612e16612769565b5b6000612e2584828501612dec565b91505092915050565b7f496e76616c6964207061796d656e740000000000000000000000000000000000600082015250565b6000612e64600f83612c29565b9150612e6f82612e2e565b602082019050919050565b60006020820190508181036000830152612e9381612e57565b9050919050565b7f5a65726f20416464726573730000000000000000000000000000000000000000600082015250565b6000612ed0600c83612c29565b9150612edb82612e9a565b602082019050919050565b60006020820190508181036000830152612eff81612ec3565b9050919050565b7f4d656d6265727368697020616c72656164792070616972656400000000000000600082015250565b6000612f3c601983612c29565b9150612f4782612f06565b602082019050919050565b60006020820190508181036000830152612f6b81612f2f565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000612fce602683612c29565b9150612fd982612f72565b604082019050919050565b60006020820190508181036000830152612ffd81612fc1565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061303a602083612c29565b915061304582613004565b602082019050919050565b600060208201905081810360008301526130698161302d565b9050919050565b7f5369676e61747572652069732065787069726564000000000000000000000000600082015250565b60006130a6601483612c29565b91506130b182613070565b602082019050919050565b600060208201905081810360008301526130d581613099565b9050919050565b7f496e76616c6964206e6f6e636500000000000000000000000000000000000000600082015250565b6000613112600d83612c29565b915061311d826130dc565b602082019050919050565b6000602082019050818103600083015261314181613105565b9050919050565b7f556e737570706f72742074686973206d656d6265727368697020747970650000600082015250565b600061317e601e83612c29565b915061318982613148565b602082019050919050565b600060208201905081810360008301526131ad81613171565b9050919050565b6000815190506131c3816127a5565b92915050565b6000602082840312156131df576131de612769565b5b60006131ed848285016131b4565b91505092915050565b7f42656e656669636961727920616e64206d656d6265724964206e6f74206d617460008201527f6368000000000000000000000000000000000000000000000000000000000000602082015250565b6000613252602283612c29565b915061325d826131f6565b604082019050919050565b6000602082019050818103600083015261328181613245565b9050919050565b7f556e737570706f7274207468697320766f756368657220747970650000000000600082015250565b60006132be601b83612c29565b91506132c982613288565b602082019050919050565b600060208201905081810360008301526132ed816132b1565b9050919050565b600060608201905061330960008301866127fe565b613316602083018561296d565b6133236040830184612939565b949350505050565b600061333682612963565b915061334183612963565b92508282101561335457613353612cd5565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b6000819050919050565b6133a18161338e565b82525050565b60006133b660208401846127bc565b905092915050565b6133c781612793565b82525050565b6133d681612963565b81146133e157600080fd5b50565b6000813590506133f3816133cd565b92915050565b600061340860208401846133e4565b905092915050565b61341981612963565b82525050565b600061342e6020840184612dec565b905092915050565b61343f81612db9565b82525050565b610120820161345760008301836133a7565b61346460008501826133be565b5061347260208301836133a7565b61347f60208501826133be565b5061348d60408301836133f9565b61349a6040850182613410565b506134a860608301836133a7565b6134b560608501826133be565b506134c360808301836133f9565b6134d06080850182613410565b506134de60a08301836133a7565b6134eb60a08501826133be565b506134f960c08301836133f9565b61350660c0850182613410565b5061351460e083018361341f565b61352160e0850182613436565b5061353061010083018361341f565b61353e610100850182613436565b50505050565b60006101408201905061355a6000830185613398565b6135676020830184613445565b9392505050565b60006060820190506135836000830186613398565b61359060208301856127fe565b61359d6040830184613398565b949350505050565b7f556e617574686f72697a6564207369676e617475726500000000000000000000600082015250565b60006135db601683612c29565b91506135e6826135a5565b602082019050919050565b6000602082019050818103600083015261360a816135ce565b9050919050565b7f416464726573733a20696e73756666696369656e742062616c616e6365000000600082015250565b6000613647601d83612c29565b915061365282613611565b602082019050919050565b600060208201905081810360008301526136768161363a565b9050919050565b600081905092915050565b50565b600061369860008361367d565b91506136a382613688565b600082019050919050565b60006136b98261368b565b9150819050919050565b7f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260008201527f6563697069656e74206d61792068617665207265766572746564000000000000602082015250565b600061371f603a83612c29565b915061372a826136c3565b604082019050919050565b6000602082019050818103600083015261374e81613712565b9050919050565b600060608201905061376a60008301866127fe565b61377760208301856127fe565b613784604083018461296d565b949350505050565b610100820161379e60008301836133a7565b6137ab60008501826133be565b506137b960208301836133a7565b6137c660208501826133be565b506137d460408301836133f9565b6137e16040850182613410565b506137ef60608301836133a7565b6137fc60608501826133be565b5061380a60808301836133f9565b6138176080850182613410565b5061382560a08301836133f9565b61383260a0850182613410565b5061384060c083018361341f565b61384d60c0850182613436565b5061385b60e083018361341f565b61386860e0850182613436565b50505050565b6000610120820190506138846000830185613398565b613891602083018461378c565b9392505050565b60e082016138a960008301836133a7565b6138b660008501826133be565b506138c460208301836133f9565b6138d16020850182613410565b506138df60408301836133f9565b6138ec6040850182613410565b506138fa60608301836133a7565b61390760608501826133be565b5061391560808301836133f9565b6139226080850182613410565b5061393060a083018361341f565b61393d60a0850182613436565b5061394b60c083018361341f565b61395860c0850182613436565b50505050565b6000610100820190506139746000830185613398565b6139816020830184613898565b9392505050565b60008151905061399781612899565b92915050565b6000602082840312156139b3576139b2612769565b5b60006139c184828501613988565b91505092915050565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b6000613a26602a83612c29565b9150613a31826139ca565b604082019050919050565b60006020820190508181036000830152613a5581613a19565b9050919050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000613a9d600283613a5c565b9150613aa882613a67565b600282019050919050565b6000819050919050565b613ace613ac98261338e565b613ab3565b82525050565b6000613adf82613a90565b9150613aeb8285613abd565b602082019150613afb8284613abd565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000613b70601883612c29565b9150613b7b82613b3a565b602082019050919050565b60006020820190508181036000830152613b9f81613b63565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000613bdc601f83612c29565b9150613be782613ba6565b602082019050919050565b60006020820190508181036000830152613c0b81613bcf565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000613c6e602283612c29565b9150613c7982613c12565b604082019050919050565b60006020820190508181036000830152613c9d81613c61565b9050919050565b600060a082019050613cb96000830188613398565b613cc66020830187613398565b613cd36040830186613398565b613ce0606083018561296d565b613ced60808301846127fe565b9695505050505050565b600060ff82169050919050565b613d0d81613cf7565b82525050565b6000608082019050613d286000830187613398565b613d356020830186613d04565b613d426040830185613398565b613d4f6060830184613398565b95945050505050565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b6000613db4602683612c29565b9150613dbf82613d58565b604082019050919050565b60006020820190508181036000830152613de381613da7565b9050919050565b600081519050919050565b60005b83811015613e13578082015181840152602081019050613df8565b83811115613e22576000848401525b50505050565b6000613e3382613dea565b613e3d818561367d565b9350613e4d818560208601613df5565b80840191505092915050565b6000613e658284613e28565b915081905092915050565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b6000613ea6601d83612c29565b9150613eb182613e70565b602082019050919050565b60006020820190508181036000830152613ed581613e99565b9050919050565b600081519050919050565b6000601f19601f8301169050919050565b6000613f0382613edc565b613f0d8185612c29565b9350613f1d818560208601613df5565b613f2681613ee7565b840191505092915050565b60006020820190508181036000830152613f4b8184613ef8565b90509291505056fea2646970667358221220a34db2a6a479d137512aeaffb6ba3dc8ebc1c1114c231188d24a5094cc4175d664736f6c6343000809003300000000000000000000000031003c2d5685c7d28d7174c3255307eb9a0f301500000000000000000000000031003c2d5685c7d28d7174c3255307eb9a0f3015

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

00000000000000000000000031003c2d5685c7d28d7174c3255307eb9a0f301500000000000000000000000031003c2d5685c7d28d7174c3255307eb9a0f3015

-----Decoded View---------------
Arg [0] : _treasury (address): 0x31003c2d5685c7d28d7174c3255307eb9a0f3015
Arg [1] : _verifier (address): 0x31003c2d5685c7d28d7174c3255307eb9a0f3015

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000031003c2d5685c7d28d7174c3255307eb9a0f3015
Arg [1] : 00000000000000000000000031003c2d5685c7d28d7174c3255307eb9a0f3015


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading