ETH Price: $2,956.61 (+0.00%)
 

Overview

Max Total Supply

1,000,000,000 CHECK

Holders

8,955 (0.00%)

Market

Price

$0.0808 @ 0.000027 ETH (-7.66%)

Onchain Market Cap

$80,838,000.00

Circulating Supply Market Cap

$16,230,138.00

Other Info

Token Contract (WITH 18 Decimals)

Balance
5.125563846376403459 CHECK

Value
$0.41 ( ~0.000138672368776523 ETH) [0.0000%]
0xd97c3d4e6f36d0aed73cf3bc83d38b9ce4ba91bc
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Checkmate Ecosystem—a multi-game network unifying community, rewards, and governance. The upcoming $CHECK token will power multiple titles.

Market

Volume (24H):$7,679,667.00
Market Capitalization:$16,230,138.00
Circulating Supply:200,862,403.00 CHECK
Market Data Source: Coinmarketcap

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x0C2B0f8A...769e32ACD
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ERC20FixedSupply

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 99999 runs

Other Settings:
paris EvmVersion, MIT license
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;

import {IForwarderRegistry} from "./../../../metatx/interfaces/IForwarderRegistry.sol";
import {ERC20Storage} from "./../../../token/ERC20/libraries/ERC20Storage.sol";
import {ERC20} from "./../ERC20.sol";
import {ERC20Detailed} from "./../ERC20Detailed.sol";
import {ERC20Metadata} from "./../ERC20Metadata.sol";
import {ERC20Permit} from "./../ERC20Permit.sol";
import {ERC20SafeTransfers} from "./../ERC20SafeTransfers.sol";
import {ERC20BatchTransfers} from "./../ERC20BatchTransfers.sol";
import {TokenRecovery} from "./../../../security/TokenRecovery.sol";
import {ContractOwnership} from "./../../../access/ContractOwnership.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
import {ForwarderRegistryContextBase} from "./../../../metatx/base/ForwarderRegistryContextBase.sol";
import {ForwarderRegistryContext} from "./../../../metatx/ForwarderRegistryContext.sol";

/// @title ERC20 Fungible Token Standard, fixed supply preset contract (immutable version).
contract ERC20FixedSupply is
    ERC20,
    ERC20Detailed,
    ERC20Metadata,
    ERC20Permit,
    ERC20SafeTransfers,
    ERC20BatchTransfers,
    TokenRecovery,
    ForwarderRegistryContext
{
    using ERC20Storage for ERC20Storage.Layout;

    constructor(
        string memory tokenName,
        string memory tokenSymbol,
        uint8 tokenDecimals,
        address[] memory holders,
        uint256[] memory allocations,
        IForwarderRegistry forwarderRegistry
    ) ERC20Detailed(tokenName, tokenSymbol, tokenDecimals) ForwarderRegistryContext(forwarderRegistry) ContractOwnership(msg.sender) {
        ERC20Storage.layout().batchMint(holders, allocations);
    }

    /// @inheritdoc ForwarderRegistryContextBase
    function _msgSender() internal view virtual override(Context, ForwarderRegistryContextBase) returns (address) {
        return ForwarderRegistryContextBase._msgSender();
    }

    /// @inheritdoc ForwarderRegistryContextBase
    function _msgData() internal view virtual override(Context, ForwarderRegistryContextBase) returns (bytes calldata) {
        return ForwarderRegistryContextBase._msgData();
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 3 of 69 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 4 of 69 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.2.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @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://consensys.net/diligence/blog/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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert Errors.InsufficientBalance(address(this).balance, amount);
        }

        (bool success, bytes memory returndata) = recipient.call{value: amount}("");
        if (!success) {
            _revert(returndata);
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {Errors.FailedCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
     * of an unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {Errors.FailedCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
     */
    function _revert(bytes memory returndata) 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
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 9 of 69 : Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedCall();

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {SlotDerivation}.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct Int256Slot {
        int256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

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

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

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

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

    /**
     * @dev Returns a `Int256Slot` with member `value` located at `slot`.
     */
    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns a `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 12 of 69 : CommonErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when trying to transfer tokens without calldata to the contract.
error EtherReceptionDisabled();

/// @notice Thrown when the multiple related arrays have different lengths.
error InconsistentArrayLengths();

/// @notice Thrown when an ETH transfer has failed.
error TransferFailed();

File 13 of 69 : ContractOwnership.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ContractOwnershipStorage} from "./libraries/ContractOwnershipStorage.sol";
import {ContractOwnershipBase} from "./base/ContractOwnershipBase.sol";
import {InterfaceDetection} from "./../introspection/InterfaceDetection.sol";

/// @title ERC173 Contract Ownership Standard (immutable version).
/// @dev See https://eips.ethereum.org/EIPS/eip-173
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ContractOwnership is ContractOwnershipBase, InterfaceDetection {
    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;

    /// @notice Initializes the storage with an initial contract owner.
    /// @notice Marks the following ERC165 interface(s) as supported: ERC173.
    /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.
    /// @param initialOwner the initial contract owner.
    constructor(address initialOwner) {
        ContractOwnershipStorage.layout().constructorInit(initialOwner);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC173} from "./../interfaces/IERC173.sol";
import {ContractOwnershipStorage} from "./../libraries/ContractOwnershipStorage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";

/// @title ERC173 Contract Ownership Standard (proxiable version).
/// @dev See https://eips.ethereum.org/EIPS/eip-173
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC165 (Interface Detection Standard).
abstract contract ContractOwnershipBase is IERC173, Context {
    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;

    /// @inheritdoc IERC173
    function owner() public view virtual returns (address) {
        return ContractOwnershipStorage.layout().owner();
    }

    /// @inheritdoc IERC173
    function transferOwnership(address newOwner) public virtual {
        ContractOwnershipStorage.layout().transferOwnership(_msgSender(), newOwner);
    }
}

File 15 of 69 : Common.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when the target contract is actually not a contract.
/// @param targetContract The contract that was checked
error TargetIsNotAContract(address targetContract);

File 16 of 69 : ContractOwnershipErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when an account is not the contract owner but is required to.
/// @param account The account that was checked.
error NotContractOwner(address account);

/// @notice Thrown when an account is not the pending contract owner but is required to.
/// @param account The account that was checked.
error NotPendingContractOwner(address account);

/// @notice Thrown when an account is not the target contract owner but is required to.
/// @param targetContract The contract that was checked.
/// @param account The account that was checked.
error NotTargetContractOwner(address targetContract, address account);

File 17 of 69 : ERC173Events.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Emitted when the contract ownership changes.
/// @param previousOwner the previous contract owner.
/// @param newOwner the new contract owner.
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

/// @notice Emitted when a new contract owner is pending.
/// @param pendingOwner the address of the new contract owner.
event OwnershipTransferPending(address indexed pendingOwner);

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC-173 Contract Ownership Standard (functions)
/// @dev See https://eips.ethereum.org/EIPS/eip-173
/// @dev Note: the ERC-165 identifier for this interface is 0x7f5828d0
interface IERC173 {
    /// @notice Sets the address of the new contract owner.
    /// @dev Reverts if the sender is not the contract owner.
    /// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner.
    /// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership.
    function transferOwnership(address newOwner) external;

    /// @notice Gets the address of the contract owner.
    /// @return contractOwner The address of the contract owner.
    function owner() external view returns (address contractOwner);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {NotContractOwner, NotTargetContractOwner} from "./../errors/ContractOwnershipErrors.sol";
import {TargetIsNotAContract} from "./../errors/Common.sol";
import {OwnershipTransferred} from "./../events/ERC173Events.sol";
import {IERC173} from "./../interfaces/IERC173.sol";
import {Address} from "./../../utils/libraries/Address.sol";
import {ProxyInitialization} from "./../../proxy/libraries/ProxyInitialization.sol";
import {InterfaceDetectionStorage} from "./../../introspection/libraries/InterfaceDetectionStorage.sol";

library ContractOwnershipStorage {
    using Address for address;
    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;
    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;

    struct Layout {
        address contractOwner;
    }

    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.access.ContractOwnership.storage")) - 1);
    bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256("animoca.core.access.ContractOwnership.phase")) - 1);

    /// @notice Initializes the storage with an initial contract owner (immutable version).
    /// @notice Marks the following ERC165 interface(s) as supported: ERC173.
    /// @dev Note: This function should be called ONLY in the constructor of an immutable (non-proxied) contract.
    /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.
    /// @param initialOwner The initial contract owner.
    function constructorInit(Layout storage s, address initialOwner) internal {
        if (initialOwner != address(0)) {
            s.contractOwner = initialOwner;
            emit OwnershipTransferred(address(0), initialOwner);
        }
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC173).interfaceId, true);
    }

    /// @notice Initializes the storage with an initial contract owner (proxied version).
    /// @notice Sets the proxy initialization phase to `1`.
    /// @notice Marks the following ERC165 interface(s) as supported: ERC173.
    /// @dev Note: This function should be called ONLY in the init function of a proxied contract.
    /// @dev Reverts with {InitializationPhaseAlreadyReached} if the proxy initialization phase is set to `1` or above.
    /// @dev Emits an {OwnershipTransferred} if `initialOwner` is not the zero address.
    /// @param initialOwner The initial contract owner.
    function proxyInit(Layout storage s, address initialOwner) internal {
        ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1);
        s.constructorInit(initialOwner);
    }

    /// @notice Sets the address of the new contract owner.
    /// @dev Reverts with {NotContractOwner} if `sender` is not the contract owner.
    /// @dev Emits an {OwnershipTransferred} event if `newOwner` is different from the current contract owner.
    /// @param newOwner The address of the new contract owner. Using the zero address means renouncing ownership.
    function transferOwnership(Layout storage s, address sender, address newOwner) internal {
        address previousOwner = s.contractOwner;
        if (sender != previousOwner) revert NotContractOwner(sender);
        if (previousOwner != newOwner) {
            s.contractOwner = newOwner;
            emit OwnershipTransferred(previousOwner, newOwner);
        }
    }

    /// @notice Gets the address of the contract owner.
    /// @return contractOwner The address of the contract owner.
    function owner(Layout storage s) internal view returns (address contractOwner) {
        return s.contractOwner;
    }

    /// @notice Checks whether an account is the owner of a target contract.
    /// @param targetContract The contract to check.
    /// @param account The account to check.
    /// @return isTargetContractOwner_ Whether `account` is the owner of `targetContract`.
    function isTargetContractOwner(address targetContract, address account) internal view returns (bool isTargetContractOwner_) {
        if (!targetContract.hasBytecode()) revert TargetIsNotAContract(targetContract);
        return IERC173(targetContract).owner() == account;
    }

    /// @notice Ensures that an account is the contract owner.
    /// @dev Reverts with {NotContractOwner} if `account` is not the contract owner.
    /// @param account The account.
    function enforceIsContractOwner(Layout storage s, address account) internal view {
        if (account != s.contractOwner) revert NotContractOwner(account);
    }

    /// @notice Enforces that an account is the owner of a target contract.
    /// @dev Reverts with {NotTheTargetContractOwner} if the account is not the owner.
    /// @param targetContract The contract to check.
    /// @param account The account to check.
    function enforceIsTargetContractOwner(address targetContract, address account) internal view {
        if (!isTargetContractOwner(targetContract, account)) revert NotTargetContractOwner(targetContract, account);
    }

    function layout() internal pure returns (Layout storage s) {
        bytes32 position = LAYOUT_STORAGE_SLOT;
        assembly {
            s.slot := position
        }
    }
}

File 20 of 69 : InterfaceDetection.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC165} from "./interfaces/IERC165.sol";
import {InterfaceDetectionStorage} from "./libraries/InterfaceDetectionStorage.sol";

/// @title ERC165 Interface Detection Standard (immutable or proxiable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) or proxied implementation.
abstract contract InterfaceDetection is IERC165 {
    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) external view returns (bool) {
        return InterfaceDetectionStorage.layout().supportsInterface(interfaceId);
    }
}

File 21 of 69 : InterfaceDetectionErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when setting the illegal interfaceId 0xffffffff.
error IllegalInterfaceId();

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC165 Interface Detection Standard.
/// @dev See https://eips.ethereum.org/EIPS/eip-165.
/// @dev Note: The ERC-165 identifier for this interface is 0x01ffc9a7.
interface IERC165 {
    /// @notice Returns whether this contract implements a given interface.
    /// @dev Note: This function call must use less than 30 000 gas.
    /// @param interfaceId the interface identifier to test.
    /// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported.
    function supportsInterface(bytes4 interfaceId) external view returns (bool supported);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IllegalInterfaceId} from "./../errors/InterfaceDetectionErrors.sol";
import {IERC165} from "./../interfaces/IERC165.sol";

library InterfaceDetectionStorage {
    struct Layout {
        mapping(bytes4 => bool) supportedInterfaces;
    }

    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.introspection.InterfaceDetection.storage")) - 1);

    bytes4 internal constant ILLEGAL_INTERFACE_ID = 0xffffffff;

    /// @notice Sets or unsets an ERC165 interface.
    /// @dev Revertswith {IllegalInterfaceId} if `interfaceId` is `0xffffffff`.
    /// @param interfaceId the interface identifier.
    /// @param supported True to set the interface, false to unset it.
    function setSupportedInterface(Layout storage s, bytes4 interfaceId, bool supported) internal {
        if (interfaceId == ILLEGAL_INTERFACE_ID) revert IllegalInterfaceId();
        s.supportedInterfaces[interfaceId] = supported;
    }

    /// @notice Returns whether this contract implements a given interface.
    /// @dev Note: This function call must use less than 30 000 gas.
    /// @param interfaceId The interface identifier to test.
    /// @return supported True if the interface is supported, false if `interfaceId` is `0xffffffff` or if the interface is not supported.
    function supportsInterface(Layout storage s, bytes4 interfaceId) internal view returns (bool supported) {
        if (interfaceId == ILLEGAL_INTERFACE_ID) {
            return false;
        }
        if (interfaceId == type(IERC165).interfaceId) {
            return true;
        }
        return s.supportedInterfaces[interfaceId];
    }

    function layout() internal pure returns (Layout storage s) {
        bytes32 position = LAYOUT_STORAGE_SLOT;
        assembly {
            s.slot := position
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IForwarderRegistry} from "./interfaces/IForwarderRegistry.sol";
import {IERC2771} from "./interfaces/IERC2771.sol";
import {ForwarderRegistryContextBase} from "./base/ForwarderRegistryContextBase.sol";

/// @title Meta-Transactions Forwarder Registry Context (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
/// @dev Derived from https://github.com/wighawag/universal-forwarder (MIT licence)
abstract contract ForwarderRegistryContext is ForwarderRegistryContextBase, IERC2771 {
    constructor(IForwarderRegistry forwarderRegistry_) ForwarderRegistryContextBase(forwarderRegistry_) {}

    function forwarderRegistry() external view returns (IForwarderRegistry) {
        return _FORWARDER_REGISTRY;
    }

    /// @inheritdoc IERC2771
    function isTrustedForwarder(address forwarder) external view virtual returns (bool) {
        return forwarder == address(_FORWARDER_REGISTRY);
    }
}

File 25 of 69 : ForwarderRegistryContextBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IForwarderRegistry} from "./../interfaces/IForwarderRegistry.sol";
import {ERC2771Calldata} from "./../libraries/ERC2771Calldata.sol";

/// @title Meta-Transactions Forwarder Registry Context (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Derived from https://github.com/wighawag/universal-forwarder (MIT licence)
abstract contract ForwarderRegistryContextBase {
    IForwarderRegistry internal immutable _FORWARDER_REGISTRY;

    constructor(IForwarderRegistry forwarderRegistry) {
        _FORWARDER_REGISTRY = forwarderRegistry;
    }

    /// @notice Returns the message sender depending on the ForwarderRegistry-based meta-transaction context.
    function _msgSender() internal view virtual returns (address) {
        // Optimised path in case of an EOA-initiated direct tx to the contract or a call from a contract not complying with EIP-2771
        // solhint-disable-next-line avoid-tx-origin
        if (msg.sender == tx.origin || msg.data.length < 24) {
            return msg.sender;
        }

        address sender = ERC2771Calldata.msgSender();

        // Return the EIP-2771 calldata-appended sender address if the message was forwarded by the ForwarderRegistry or an approved forwarder
        if (msg.sender == address(_FORWARDER_REGISTRY) || _FORWARDER_REGISTRY.isApprovedForwarder(sender, msg.sender, address(this))) {
            return sender;
        }

        return msg.sender;
    }

    /// @notice Returns the message data depending on the ForwarderRegistry-based meta-transaction context.
    function _msgData() internal view virtual returns (bytes calldata) {
        // Optimised path in case of an EOA-initiated direct tx to the contract or a call from a contract not complying with EIP-2771
        // solhint-disable-next-line avoid-tx-origin
        if (msg.sender == tx.origin || msg.data.length < 24) {
            return msg.data;
        }

        // Return the EIP-2771 calldata (minus the appended sender) if the message was forwarded by the ForwarderRegistry or an approved forwarder
        if (
            msg.sender == address(_FORWARDER_REGISTRY) ||
            _FORWARDER_REGISTRY.isApprovedForwarder(ERC2771Calldata.msgSender(), msg.sender, address(this))
        ) {
            return ERC2771Calldata.msgData();
        }

        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title Secure Protocol for Native Meta Transactions.
/// @dev See https://eips.ethereum.org/EIPS/eip-2771
interface IERC2771 {
    /// @notice Checks whether a forwarder is trusted.
    /// @param forwarder The forwarder to check.
    /// @return isTrusted True if `forwarder` is trusted, false if not.
    function isTrustedForwarder(address forwarder) external view returns (bool isTrusted);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title Meta-Transactions Forwarder Registry.
interface IForwarderRegistry {
    /// @notice Checks whether an account is as an approved meta-transaction forwarder for a sender account to a target contract.
    /// @param sender The sender account.
    /// @param forwarder The forwarder account.
    /// @param target The target contract.
    /// @return isApproved True if `forwarder` is an approved meta-transaction forwarder for `sender` to `target`, false otherwise.
    function isApprovedForwarder(address sender, address forwarder, address target) external view returns (bool isApproved);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @dev Derived from https://github.com/OpenZeppelin/openzeppelin-contracts (MIT licence)
/// @dev See https://eips.ethereum.org/EIPS/eip-2771
library ERC2771Calldata {
    /// @notice Returns the sender address appended at the end of the calldata, as specified in EIP-2771.
    function msgSender() internal pure returns (address sender) {
        assembly {
            sender := shr(96, calldataload(sub(calldatasize(), 20)))
        }
    }

    /// @notice Returns the calldata while omitting the appended sender address, as specified in EIP-2771.
    function msgData() internal pure returns (bytes calldata data) {
        unchecked {
            return msg.data[:msg.data.length - 20];
        }
    }
}

File 29 of 69 : ProxyInitializationErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Emitted when trying to set a phase value that has already been reached.
/// @param currentPhase The current phase.
/// @param newPhase The new phase trying to be set.
error InitializationPhaseAlreadyReached(uint256 currentPhase, uint256 newPhase);

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {InitializationPhaseAlreadyReached} from "./../errors/ProxyInitializationErrors.sol";
import {StorageSlot} from "@openzeppelin/contracts/utils/StorageSlot.sol";

/// @notice Multiple calls protection for storage-modifying proxy initialization functions.
library ProxyInitialization {
    /// @notice Sets the initialization phase during a storage-modifying proxy initialization function.
    /// @dev Reverts with {InitializationPhaseAlreadyReached} if `phase` has been reached already.
    /// @param storageSlot the storage slot where `phase` is stored.
    /// @param phase the initialization phase.
    function setPhase(bytes32 storageSlot, uint256 phase) internal {
        StorageSlot.Uint256Slot storage currentVersion = StorageSlot.getUint256Slot(storageSlot);
        uint256 currentPhase = currentVersion.value;
        if (currentPhase >= phase) revert InitializationPhaseAlreadyReached(currentPhase, phase);
        currentVersion.value = phase;
    }
}

File 31 of 69 : TokenRecovery.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {TokenRecoveryBase} from "./base/TokenRecoveryBase.sol";
import {ContractOwnership} from "./../access/ContractOwnership.sol";

/// @title Recovery mechanism for ETH/ERC20/ERC721 tokens accidentally sent to this contract (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract TokenRecovery is TokenRecoveryBase, ContractOwnership {}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC721} from "./../../token/ERC721/interfaces/IERC721.sol";
import {ITokenRecovery} from "./../interfaces/ITokenRecovery.sol";
import {ContractOwnershipStorage} from "./../../access/libraries/ContractOwnershipStorage.sol";
import {TokenRecoveryLibrary} from "./../libraries/TokenRecoveryLibrary.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";

/// @title Recovery mechanism for ETH/ERC20/ERC721 tokens accidentally sent to this contract (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC173 (Contract Ownership standard).
abstract contract TokenRecoveryBase is ITokenRecovery, Context {
    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;

    /// @inheritdoc ITokenRecovery
    /// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
    /// @dev Reverts with {InconsistentArrayLengths} `accounts` and `amounts` do not have the same length.
    /// @dev Reverts if one of the ETH transfers fails for any reason.
    function recoverETH(address payable[] calldata accounts, uint256[] calldata amounts) public virtual {
        ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
        TokenRecoveryLibrary.recoverETH(accounts, amounts);
    }

    /// @inheritdoc ITokenRecovery
    /// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
    /// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `tokens` and `amounts` do not have the same length.
    /// @dev Reverts if one of the ERC20 transfers fails for any reason.
    function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) public virtual {
        ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
        TokenRecoveryLibrary.recoverERC20s(accounts, tokens, amounts);
    }

    /// @inheritdoc ITokenRecovery
    /// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
    /// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `contracts` and `amounts` do not have the same length.
    /// @dev Reverts if one of the ERC721 transfers fails for any reason.
    function recoverERC721s(address[] calldata accounts, IERC721[] calldata contracts, uint256[] calldata tokenIds) public virtual {
        ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
        TokenRecoveryLibrary.recoverERC721s(accounts, contracts, tokenIds);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC721} from "./../../token/ERC721/interfaces/IERC721.sol";

/// @title Uniquely identified seals management.
interface ITokenRecovery {
    /// @notice Extract ETH tokens which were accidentally sent to the contract to a list of accounts.
    /// @dev Note: While contracts can generally prevent accidental ETH transfer by implementating a reverting
    ///  `receive()` function, this can still be bypassed in a `selfdestruct(address)` scenario.
    /// @dev Warning: this function should be overriden for contracts which are supposed to hold ETH tokens
    ///  so that the extraction is limited to only amounts sent accidentally.
    /// @param accounts the list of accounts to transfer the tokens to.
    /// @param amounts the list of token amounts to transfer.
    function recoverETH(address payable[] calldata accounts, uint256[] calldata amounts) external;

    /// @notice Extract ERC20 tokens which were accidentally sent to the contract to a list of accounts.
    /// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC20 tokens
    ///  so that the extraction is limited to only amounts sent accidentally.
    /// @param accounts the list of accounts to transfer the tokens to.
    /// @param tokens the list of ERC20 token addresses.
    /// @param amounts the list of token amounts to transfer.
    function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) external;

    /// @notice Extract ERC721 tokens which were accidentally sent to the contract to a list of accounts.
    /// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC721 tokens
    ///  so that the extraction is limited to only tokens sent accidentally.
    /// @param accounts the list of accounts to transfer the tokens to.
    /// @param contracts the list of ERC721 contract addresses.
    /// @param tokenIds the list of token ids to transfer.
    function recoverERC721s(address[] calldata accounts, IERC721[] calldata contracts, uint256[] calldata tokenIds) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {InconsistentArrayLengths} from "./../../CommonErrors.sol";
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {IERC721} from "./../../token/ERC721/interfaces/IERC721.sol";
import {IERC165} from "./../../introspection/interfaces/IERC165.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

library TokenRecoveryLibrary {
    using SafeERC20 for IERC20;
    using Address for address payable;

    /// @notice Thrown when trying to recover a token of the wrong contract type.
    /// @param tokenContract The token contract being recovered.
    error IncorrectTokenContractType(address tokenContract);

    /// @notice Extract ETH tokens which were accidentally sent to the contract to a list of accounts.
    /// @dev Note: While contracts can generally prevent accidental ETH transfer by implementating a reverting
    ///  `receive()` function, this can still be bypassed in a `selfdestruct(address)` scenario.
    /// @dev Warning: this function should be overriden for contracts which are supposed to hold ETH tokens
    ///  so that the extraction is limited to only amounts sent accidentally.
    /// @dev Reverts with {InconsistentArrayLengths} `accounts` and `amounts` do not have the same length.
    /// @dev Reverts if one of the ETH transfers fails for any reason.
    /// @param accounts the list of accounts to transfer the tokens to.
    /// @param amounts the list of token amounts to transfer.
    function recoverETH(address payable[] calldata accounts, uint256[] calldata amounts) internal {
        uint256 length = accounts.length;
        if (length != amounts.length) revert InconsistentArrayLengths();
        for (uint256 i; i < length; ++i) {
            accounts[i].sendValue(amounts[i]);
        }
    }

    /// @notice Extract ERC20 tokens which were accidentally sent to the contract to a list of accounts.
    /// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC20 tokens
    ///  so that the extraction is limited to only amounts sent accidentally.
    /// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `tokens` and `amounts` do not have the same length.
    /// @dev Reverts if one of the ERC20 transfers fails for any reason.
    /// @param accounts the list of accounts to transfer the tokens to.
    /// @param tokens the list of ERC20 token addresses.
    /// @param amounts the list of token amounts to transfer.
    function recoverERC20s(address[] calldata accounts, IERC20[] calldata tokens, uint256[] calldata amounts) internal {
        uint256 length = accounts.length;
        if (length != tokens.length || length != amounts.length) revert InconsistentArrayLengths();
        for (uint256 i; i < length; ++i) {
            tokens[i].safeTransfer(accounts[i], amounts[i]);
        }
    }

    /// @notice Extract ERC721 tokens which were accidentally sent to the contract to a list of accounts.
    /// @dev Warning: this function should be overriden for contracts which are supposed to hold ERC721 tokens
    ///  so that the extraction is limited to only tokens sent accidentally.
    /// @dev Reverts with {InconsistentArrayLengths} if `accounts`, `contracts` and `amounts` do not have the same length.
    /// @dev Reverts if one of the ERC721 transfers fails for any reason.
    /// @param accounts the list of accounts to transfer the tokens to.
    /// @param contracts the list of ERC721 contract addresses.
    /// @param tokenIds the list of token ids to transfer.
    function recoverERC721s(address[] calldata accounts, IERC721[] calldata contracts, uint256[] calldata tokenIds) internal {
        uint256 length = accounts.length;
        if (length != contracts.length || length != tokenIds.length) revert InconsistentArrayLengths();
        for (uint256 i; i < length; ++i) {
            IERC721 tokenContract = contracts[i];
            if (!IERC165(address(tokenContract)).supportsInterface(type(IERC721).interfaceId)) {
                revert IncorrectTokenContractType(address(tokenContract));
            }
            contracts[i].safeTransferFrom(address(this), accounts[i], tokenIds[i]);
        }
    }
}

File 35 of 69 : ERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20Storage} from "./libraries/ERC20Storage.sol";
import {ERC20Base} from "./base/ERC20Base.sol";
import {InterfaceDetection} from "./../../introspection/InterfaceDetection.sol";

/// @title ERC20 Fungible Token Standard (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ERC20 is ERC20Base, InterfaceDetection {
    /// @notice Marks the following ERC165 interface(s) as supported: ERC20, ERC20Allowance.
    constructor() {
        ERC20Storage.init();
    }
}

File 36 of 69 : ERC20BatchTransfers.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20Storage} from "./libraries/ERC20Storage.sol";
import {ERC20BatchTransfersBase} from "./base/ERC20BatchTransfersBase.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Batch Transfers (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ERC20BatchTransfers is ERC20BatchTransfersBase {
    /// @notice Marks the following ERC165 interface(s) as supported: ERC20BatchTransfers.
    constructor() {
        ERC20Storage.initERC20BatchTransfers();
    }
}

File 37 of 69 : ERC20Detailed.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20DetailedStorage} from "./libraries/ERC20DetailedStorage.sol";
import {ERC20DetailedBase} from "./base/ERC20DetailedBase.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Detailed (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ERC20Detailed is ERC20DetailedBase {
    using ERC20DetailedStorage for ERC20DetailedStorage.Layout;

    /// @notice Initializes the storage with the token details.
    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Detailed.
    /// @param tokenName The token name.
    /// @param tokenSymbol The token symbol.
    /// @param tokenDecimals The token decimals.
    constructor(string memory tokenName, string memory tokenSymbol, uint8 tokenDecimals) {
        ERC20DetailedStorage.layout().constructorInit(tokenName, tokenSymbol, tokenDecimals);
    }
}

File 38 of 69 : ERC20Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20MetadataStorage} from "./libraries/ERC20MetadataStorage.sol";
import {ERC20MetadataBase} from "./base/ERC20MetadataBase.sol";
import {ContractOwnership} from "./../../access/ContractOwnership.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Metadata (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ERC20Metadata is ERC20MetadataBase, ContractOwnership {
    using ERC20MetadataStorage for ERC20MetadataStorage.Layout;

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Metadata.
    constructor() {
        ERC20MetadataStorage.init();
    }
}

File 39 of 69 : ERC20Permit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20PermitStorage} from "./libraries/ERC20PermitStorage.sol";
import {ERC20PermitBase} from "./base/ERC20PermitBase.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Permit (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
/// @dev Note: This contract requires ERC20Detailed.
abstract contract ERC20Permit is ERC20PermitBase {
    using ERC20PermitStorage for ERC20PermitStorage.Layout;

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Permit.
    constructor() {
        ERC20PermitStorage.init();
    }
}

File 40 of 69 : ERC20SafeTransfers.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20Storage} from "./libraries/ERC20Storage.sol";
import {ERC20SafeTransfersBase} from "./base/ERC20SafeTransfersBase.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Safe Transfers (immutable version).
/// @dev This contract is to be used via inheritance in an immutable (non-proxied) implementation.
abstract contract ERC20SafeTransfers is ERC20SafeTransfersBase {
    /// @notice Marks the following ERC165 interface(s) as supported: ERC20SafeTransfers.
    constructor() {
        ERC20Storage.initERC20SafeTransfers();
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20} from "./../interfaces/IERC20.sol";
import {IERC20Allowance} from "./../interfaces/IERC20Allowance.sol";
import {ERC20Storage} from "./../libraries/ERC20Storage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";

/// @title ERC20 Fungible Token Standard (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC165 (Interface Detection Standard).
abstract contract ERC20Base is IERC20, IERC20Allowance, Context {
    using ERC20Storage for ERC20Storage.Layout;

    /// @inheritdoc IERC20
    function approve(address spender, uint256 value) external virtual returns (bool result) {
        ERC20Storage.layout().approve(_msgSender(), spender, value);
        return true;
    }

    /// @inheritdoc IERC20
    function transfer(address to, uint256 value) external virtual returns (bool result) {
        ERC20Storage.layout().transfer(_msgSender(), to, value);
        return true;
    }

    /// @inheritdoc IERC20
    function transferFrom(address from, address to, uint256 value) external virtual returns (bool result) {
        ERC20Storage.layout().transferFrom(_msgSender(), from, to, value);
        return true;
    }

    /// @inheritdoc IERC20Allowance
    function increaseAllowance(address spender, uint256 addedValue) external virtual returns (bool result) {
        ERC20Storage.layout().increaseAllowance(_msgSender(), spender, addedValue);
        return true;
    }

    /// @inheritdoc IERC20Allowance
    function decreaseAllowance(address spender, uint256 subtractedValue) external virtual returns (bool result) {
        ERC20Storage.layout().decreaseAllowance(_msgSender(), spender, subtractedValue);
        return true;
    }

    /// @inheritdoc IERC20
    function totalSupply() external view returns (uint256 supply) {
        return ERC20Storage.layout().totalSupply();
    }

    /// @inheritdoc IERC20
    function balanceOf(address owner) external view returns (uint256 balance) {
        return ERC20Storage.layout().balanceOf(owner);
    }

    /// @inheritdoc IERC20
    function allowance(address owner, address spender) public view virtual returns (uint256 value) {
        return ERC20Storage.layout().allowance(owner, spender);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20BatchTransfers} from "./../interfaces/IERC20BatchTransfers.sol";
import {ERC20Storage} from "./../libraries/ERC20Storage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Batch Transfers (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC20 (Fungible Token Standard).
abstract contract ERC20BatchTransfersBase is IERC20BatchTransfers, Context {
    using ERC20Storage for ERC20Storage.Layout;

    /// @inheritdoc IERC20BatchTransfers
    function batchTransfer(address[] calldata recipients, uint256[] calldata values) external virtual returns (bool) {
        ERC20Storage.layout().batchTransfer(_msgSender(), recipients, values);
        return true;
    }

    /// @inheritdoc IERC20BatchTransfers
    function batchTransferFrom(address from, address[] calldata recipients, uint256[] calldata values) external virtual returns (bool) {
        ERC20Storage.layout().batchTransferFrom(_msgSender(), from, recipients, values);
        return true;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20Detailed} from "./../interfaces/IERC20Detailed.sol";
import {ERC20DetailedStorage} from "./../libraries/ERC20DetailedStorage.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Detailed (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC20 (Fungible Token Standard).
abstract contract ERC20DetailedBase is IERC20Detailed {
    using ERC20DetailedStorage for ERC20DetailedStorage.Layout;

    /// @inheritdoc IERC20Detailed
    function name() external view returns (string memory) {
        return ERC20DetailedStorage.layout().name();
    }

    /// @inheritdoc IERC20Detailed
    function symbol() external view returns (string memory) {
        return ERC20DetailedStorage.layout().symbol();
    }

    /// @inheritdoc IERC20Detailed
    function decimals() external view returns (uint8) {
        return ERC20DetailedStorage.layout().decimals();
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20Metadata} from "./../interfaces/IERC20Metadata.sol";
import {ERC20MetadataStorage} from "./../libraries/ERC20MetadataStorage.sol";
import {ContractOwnershipStorage} from "./../../../access/libraries/ContractOwnershipStorage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Metadata (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC20 (Fungible Token Standard).
/// @dev Note: This contract requires ERC173 (Contract Ownership standard).
abstract contract ERC20MetadataBase is IERC20Metadata, Context {
    using ERC20MetadataStorage for ERC20MetadataStorage.Layout;
    using ContractOwnershipStorage for ContractOwnershipStorage.Layout;

    /// @notice Sets the token URI.
    /// @dev Reverts with {NotContractOwner} if the sender is not the contract owner.
    /// @param uri The token URI.
    function setTokenURI(string calldata uri) external {
        ContractOwnershipStorage.layout().enforceIsContractOwner(_msgSender());
        ERC20MetadataStorage.layout().setTokenURI(uri);
    }

    /// @inheritdoc IERC20Metadata
    function tokenURI() external view returns (string memory) {
        return ERC20MetadataStorage.layout().tokenURI();
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20Permit} from "./../interfaces/IERC20Permit.sol";
import {ERC20PermitStorage} from "./../libraries/ERC20PermitStorage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Permit (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC20 (Fungible Token Standard).
/// @dev Note: This contract requires ERC20Detailed.
abstract contract ERC20PermitBase is IERC20Permit, Context {
    using ERC20PermitStorage for ERC20PermitStorage.Layout;

    /// @inheritdoc IERC20Permit
    function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external {
        ERC20PermitStorage.layout().permit(owner, spender, value, deadline, v, r, s);
    }

    /// @inheritdoc IERC20Permit
    function nonces(address owner) external view returns (uint256) {
        return ERC20PermitStorage.layout().nonces(owner);
    }

    /// @inheritdoc IERC20Permit
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32) {
        return ERC20PermitStorage.DOMAIN_SEPARATOR();
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20SafeTransfers} from "./../interfaces/IERC20SafeTransfers.sol";
import {ERC20Storage} from "./../libraries/ERC20Storage.sol";
import {Context} from "@openzeppelin/contracts/utils/Context.sol";

/// @title ERC20 Fungible Token Standard, optional extension: Safe Transfers (proxiable version).
/// @dev This contract is to be used via inheritance in a proxied implementation.
/// @dev Note: This contract requires ERC20 (Fungible Token Standard).
abstract contract ERC20SafeTransfersBase is IERC20SafeTransfers, Context {
    using ERC20Storage for ERC20Storage.Layout;

    /// @inheritdoc IERC20SafeTransfers
    function safeTransfer(address to, uint256 value, bytes calldata data) external virtual returns (bool) {
        ERC20Storage.layout().safeTransfer(_msgSender(), to, value, data);
        return true;
    }

    /// @inheritdoc IERC20SafeTransfers
    function safeTransferFrom(address from, address to, uint256 value, bytes calldata data) external virtual returns (bool) {
        ERC20Storage.layout().safeTransferFrom(_msgSender(), from, to, value, data);
        return true;
    }
}

File 47 of 69 : ERC20AllowanceErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when the allowance increase creates an overflow.
/// @param owner The owner of the tokens.
/// @param spender The spender of the tokens.
/// @param allowance The current allowance.
/// @param increment The allowance increase.
error ERC20AllowanceOverflow(address owner, address spender, uint256 allowance, uint256 increment);

File 48 of 69 : ERC20BatchTransfersErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when the `values` array sum overflows on a batch transfer operation.
error ERC20BatchTransferValuesOverflow();

File 49 of 69 : ERC20Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when setting an allowance to the the zero address.
/// @param owner The owner of the tokens.
error ERC20ApprovalToAddressZero(address owner);

/// @notice Thrown when the allowance decreases below the current alowance set.
/// @param owner The owner of the tokens.
/// @param spender The spender of the tokens.
/// @param allowance The current allowance.
/// @param decrement The allowance decrease.
error ERC20InsufficientAllowance(address owner, address spender, uint256 allowance, uint256 decrement);

/// @notice Thrown when transferring tokens to the zero address.
/// @param owner The account from which the tokens are transferred.
error ERC20TransferToAddressZero(address owner);

/// @notice Thrown when transferring an amount of tokens greater than the current balance.
/// @param owner The owner of the tokens.
/// @param balance The current balance.
/// @param value The amount of tokens being transferred.
error ERC20InsufficientBalance(address owner, uint256 balance, uint256 value);

File 50 of 69 : ERC20MintableErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when the minting tokens to the zero address.
error ERC20MintToAddressZero();

/// @notice Thrown when the `values` array sum overflows on a batch mint operation.
error ERC20BatchMintValuesOverflow();

/// @notice Thrown when the minting tokens overflows the supply.
/// @param supply The current supply.
/// @param value The amount of tokens being minted.
error ERC20TotalSupplyOverflow(uint256 supply, uint256 value);

File 51 of 69 : ERC20PermitErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when the permit is from the zero address.
error ERC20PermitFromAddressZero();

/// @notice Thrown when the permit is expired.
/// @param deadline The permit deadline.
error ERC20PermitExpired(uint256 deadline);

/// @notice Thrown when the permit signature cannot be verified.
error ERC20PermitInvalidSignature();

File 52 of 69 : ERC20SafeTransfersErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Thrown when a safe transfer is rejected by the recipient contract.
/// @param recipient The recipient contract.
error ERC20SafeTransferRejected(address recipient);

File 53 of 69 : ERC20Events.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @notice Emitted when tokens are transferred, including zero value transfers.
/// @param from The account where the transferred tokens are withdrawn from.
/// @param to The account where the transferred tokens are deposited to.
/// @param value The amount of tokens being transferred.
event Transfer(address indexed from, address indexed to, uint256 value);

/// @notice Emitted when an approval is set.
/// @param owner The account granting an allowance to `spender`.
/// @param spender The account being granted an allowance from `owner`.
/// @param value The allowance amount being granted.
event Approval(address indexed owner, address indexed spender, uint256 value);

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, basic interface (functions).
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: The ERC-165 identifier for this interface is 0x36372b07.
interface IERC20 {
    /// @notice Sets the allowance to an account from the sender.
    /// @notice Warning: 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
    /// @dev Reverts if `spender` is the zero address.
    /// @dev Emits an {Approval} event.
    /// @param spender The account being granted the allowance by the message caller.
    /// @param value The allowance amount to grant.
    /// @return result Whether the operation succeeded.
    function approve(address spender, uint256 value) external returns (bool result);

    /// @notice Transfers an amount of tokens to a recipient from the sender.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if the sender does not have at least `value` of balance.
    /// @dev Emits a {Transfer} event.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    /// @return result Whether the operation succeeded.
    function transfer(address to, uint256 value) external returns (bool result);

    /// @notice Transfers an amount of tokens to a recipient from a specified address.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if `from` does not have at least `value` of balance.
    /// @dev Reverts if the sender is not `from` and does not have at least `value` of allowance by `from`.
    /// @dev Emits a {Transfer} event.
    /// @dev Optionally emits an {Approval} event if the sender is not `from` (non-standard).
    /// @param from The account which owns the tokens to transfer.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    /// @return result Whether the operation succeeded.
    function transferFrom(address from, address to, uint256 value) external returns (bool result);

    /// @notice Gets the total token supply.
    /// @return supply The total token supply.
    function totalSupply() external view returns (uint256 supply);

    /// @notice Gets an account balance.
    /// @param owner The account whose balance will be returned.
    /// @return balance The account balance.
    function balanceOf(address owner) external view returns (uint256 balance);

    /// @notice Gets the amount that an account is allowed to spend on behalf of another.
    /// @param owner The account that has granted an allowance to `spender`.
    /// @param spender The account that was granted an allowance by `owner`.
    /// @return value The amount which `spender` is allowed to spend on behalf of `owner`.
    function allowance(address owner, address spender) external view returns (uint256 value);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, optional extension: Allowance.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0x9d075186.
interface IERC20Allowance {
    /// @notice Increases the allowance granted to an account by the sender.
    /// @notice This is an alternative to {approve} that can be used as a mitigation for transaction ordering problems.
    /// @dev Reverts if `spender` is the zero address.
    /// @dev Reverts if `spender`'s allowance by the sender overflows.
    /// @dev Emits an {IERC20-Approval} event with an updated allowance for `spender` by the sender.
    /// @param spender The account whose allowance is being increased.
    /// @param value The allowance amount increase.
    /// @return result Whether the operation succeeded.
    function increaseAllowance(address spender, uint256 value) external returns (bool result);

    /// @notice Decreases the allowance granted to an account by the sender.
    /// @notice This is an alternative to {approve} that can be used as a mitigation for transaction ordering problems.
    /// @dev Reverts if `spender` is the zero address.
    /// @dev Reverts if `spender` does not have at least `value` of allowance by the sender.
    /// @dev Emits an {IERC20-Approval} event with an updated allowance for `spender` by the sender.
    /// @param spender The account whose allowance is being decreased.
    /// @param value The allowance amount decrease.
    /// @return result Whether the operation succeeded.
    function decreaseAllowance(address spender, uint256 value) external returns (bool result);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, optional extension: Batch Transfers.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0xc05327e6.
interface IERC20BatchTransfers {
    /// @notice Transfers multiple amounts of tokens to multiple recipients from the sender.
    /// @dev Reverts if `recipients` and `values` have different lengths.
    /// @dev Reverts if one of `recipients` is the zero address.
    /// @dev Reverts if the sender does not have at least `sum(values)` of balance.
    /// @dev Emits an {IERC20-Transfer} event for each transfer.
    /// @param recipients The list of accounts to transfer the tokens to.
    /// @param values The list of amounts of tokens to transfer to each of `recipients`.
    /// @return result Whether the operation succeeded.
    function batchTransfer(address[] calldata recipients, uint256[] calldata values) external returns (bool result);

    /// @notice Transfers multiple amounts of tokens to multiple recipients from a specified address.
    /// @dev Reverts if `recipients` and `values` have different lengths.
    /// @dev Reverts if one of `recipients` is the zero address.
    /// @dev Reverts if `from` does not have at least `sum(values)` of balance.
    /// @dev Reverts if the sender is not `from` and does not have at least `sum(values)` of allowance by `from`.
    /// @dev Emits an {IERC20-Transfer} event for each transfer.
    /// @dev Optionally emits an {IERC20-Approval} event if the sender is not `from` (non-standard).
    /// @param from The account which owns the tokens to be transferred.
    /// @param recipients The list of accounts to transfer the tokens to.
    /// @param values The list of amounts of tokens to transfer to each of `recipients`.
    /// @return result Whether the operation succeeded.
    function batchTransferFrom(address from, address[] calldata recipients, uint256[] calldata values) external returns (bool result);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, optional extension: Burnable.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0x3b5a0bf8.
interface IERC20Burnable {
    /// @notice Burns an amount of tokens from the sender, decreasing the total supply.
    /// @dev Reverts if the sender does not have at least `value` of balance.
    /// @dev Emits an {IERC20-Transfer} event with `to` set to the zero address.
    /// @param value The amount of tokens to burn.
    /// @return result Whether the operation succeeded.
    function burn(uint256 value) external returns (bool result);

    /// @notice Burns an amount of tokens from a specified address, decreasing the total supply.
    /// @dev Reverts if `from` does not have at least `value` of balance.
    /// @dev Reverts if the sender is not `from` and does not have at least `value` of allowance by `from`.
    /// @dev Emits an {IERC20-Transfer} event with `to` set to the zero address.
    /// @dev Optionally emits an {Approval} event if the sender is not `from` (non-standard).
    /// @param from The account to burn the tokens from.
    /// @param value The amount of tokens to burn.
    /// @return result Whether the operation succeeded.
    function burnFrom(address from, uint256 value) external returns (bool result);

    /// @notice Burns multiple amounts of tokens from multiple owners, decreasing the total supply.
    /// @dev Reverts if `owners` and `values` have different lengths.
    /// @dev Reverts if an `owner` does not have at least the corresponding `value` of balance.
    /// @dev Reverts if the sender is not an `owner` and does not have at least the corresponding `value` of allowance by this `owner`.
    /// @dev Emits an {IERC20-Transfer} event for each transfer with `to` set to the zero address.
    /// @dev Optionally emits an {Approval} event for each transfer if the sender is not this `owner` (non-standard).
    /// @param owners The list of accounts to burn the tokens from.
    /// @param values The list of amounts of tokens to burn.
    /// @return result Whether the operation succeeded.
    function batchBurnFrom(address[] calldata owners, uint256[] calldata values) external returns (bool result);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, optional extension: Detailed.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0xa219a025.
interface IERC20Detailed {
    /// @notice Gets the name of the token. E.g. "My Token".
    /// @return tokenName The name of the token.
    function name() external view returns (string memory tokenName);

    /// @notice Gets the symbol of the token. E.g. "TOK".
    /// @return tokenSymbol The symbol of the token.
    function symbol() external view returns (string memory tokenSymbol);

    /// @notice Gets the number of decimals used to display the balances.
    /// @notice For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`).
    /// @notice Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei.
    /// @dev Note: This information is only used for display purposes: it does  not impact the arithmetic of the contract.
    /// @return nbDecimals The number of decimals used to display the balances.
    function decimals() external view returns (uint8 nbDecimals);
}

File 59 of 69 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, ERC1046 optional extension: Metadata.
/// @dev See https://eips.ethereum.org/EIPS/eip-1046
/// @dev Note: the ERC-165 identifier for this interface is 0x3c130d90.
interface IERC20Metadata {
    /// @notice Gets the token metadata URI.
    /// @return uri The token metadata URI.
    function tokenURI() external view returns (string memory uri);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, optional extension: Mintable.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0x28963e1e.
interface IERC20Mintable {
    /// @notice Mints an amount of tokens to a recipient, increasing the total supply.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if the total supply overflows.
    /// @dev Emits an {IERC20-Transfer} event with `from` set to the zero address.
    /// @param to The account to mint the tokens to.
    /// @param value The amount of tokens to mint.
    function mint(address to, uint256 value) external;

    /// @notice Mints multiple amounts of tokens to multiple recipients, increasing the total supply.
    /// @dev Reverts if `recipients` and `values` have different lengths.
    /// @dev Reverts if one of `recipients` is the zero address.
    /// @dev Reverts if the total supply overflows.
    /// @dev Emits an {IERC20-Transfer} event for each transfer with `from` set to the zero address.
    /// @param recipients The list of accounts to mint the tokens to.
    /// @param values The list of amounts of tokens to mint to each of `recipients`.
    function batchMint(address[] calldata recipients, uint256[] calldata values) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, ERC2612 optional extension: permit – 712-signed approvals
/// @notice Interface for allowing ERC20 approvals to be made via ECDSA `secp256k1` signatures.
/// @dev See https://eips.ethereum.org/EIPS/eip-2612
/// @dev Note: the ERC-165 identifier for this interface is 0x9d8ff7da.
interface IERC20Permit {
    /// @notice Sets the allowance to an account from another account using a signed permit.
    /// @notice Warning: The standard ERC20 race condition for approvals applies to `permit()` as well: https://swcregistry.io/docs/SWC-114
    /// @dev Reverts if `owner` is the zero address.
    /// @dev Reverts if the current blocktime is greather than `deadline`.
    /// @dev Reverts if `r`, `s`, and `v` do not represent a valid `secp256k1` signature from `owner`.
    /// @dev Emits an {IERC20-Approval} event.
    /// @param owner The token owner granting the allowance to `spender`.
    /// @param spender The token spender being granted the allowance by `owner`.
    /// @param value The allowance amount to grant.
    /// @param deadline The deadline from which the permit signature is no longer valid.
    /// @param v Permit signature v parameter
    /// @param r Permit signature r parameter.
    /// @param s Permit signature s parameter.
    function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;

    /// @notice Gets the current permit nonce of an account.
    /// @param owner The account to check the nonce of.
    /// @return nonce The current permit nonce of `owner`.
    function nonces(address owner) external view returns (uint256 nonce);

    /// @notice Returns the EIP-712 encoded hash struct of the domain-specific information for permits.
    /// @dev A common ERC-20 permit implementation choice for the `DOMAIN_SEPARATOR` is:
    ///  keccak256(
    ///      abi.encode(
    ///          keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
    ///          keccak256(bytes(name)),
    ///          keccak256(bytes(version)),
    ///          chainId,
    ///          address(this)))
    ///
    ///  where
    ///   - `name` (string) is the ERC-20 token name.
    ///   - `version` (string) refers to the ERC-20 token contract version.
    ///   - `chainId` (uint256) is the chain ID to which the ERC-20 token contract is deployed to.
    ///   - `verifyingContract` (address) is the ERC-20 token contract address.
    ///
    /// @return domainSeparator The EIP-712 encoded hash struct of the domain-specific information for permits.
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32 domainSeparator);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, Tokens Receiver.
/// @notice Interface for supporting safe transfers from ERC20 contracts with the Safe Transfers extension.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0x4fc35859.
interface IERC20Receiver {
    /// @notice Handles the receipt of ERC20 tokens.
    /// @dev Note: this function is called by an {ERC20SafeTransfer} contract after a safe transfer.
    /// @param operator The initiator of the safe transfer.
    /// @param from The previous tokens owner.
    /// @param value The amount of tokens transferred.
    /// @param data Optional additional data with no specified format.
    /// @return magicValue `bytes4(keccak256("onERC20Received(address,address,uint256,bytes)"))` (`0x4fc35859`) to accept, any other value to refuse.
    function onERC20Received(address operator, address from, uint256 value, bytes calldata data) external returns (bytes4 magicValue);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC20 Token Standard, optional extension: Safe Transfers.
/// @dev See https://eips.ethereum.org/EIPS/eip-20
/// @dev Note: the ERC-165 identifier for this interface is 0x53f41a97.
interface IERC20SafeTransfers {
    /// @notice Transfers an amount of tokens to a recipient from the sender. If the recipient is a contract, calls `onERC20Received` on it.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if the sender does not have at least `value` of balance.
    /// @dev Reverts if `to` is a contract and the call to `onERC20Received` fails, reverts or is rejected.
    /// @dev Emits an {IERC20-Transfer} event.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    /// @param data Optional additional data with no specified format, to be passed to the receiver contract.
    /// @return result Whether the operation succeeded.
    function safeTransfer(address to, uint256 value, bytes calldata data) external returns (bool result);

    /// @notice Transfers an amount of tokens to a recipient from a specified address. If the recipient is a contract, calls `onERC20Received` on it.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if `from` does not have at least `value` of balance.
    /// @dev Reverts if the sender is not `from` and does not have at least `value` of allowance by `from`.
    /// @dev Reverts if `to` is a contract and the call to `onERC20Received(address,address,uint256,bytes)` fails, reverts or is rejected.
    /// @dev Emits an {IERC20-Transfer} event.
    /// @dev Optionally emits an {IERC20-Approval} event if the sender is not `from` (non-standard).
    /// @param from The account which owns the tokens to transfer.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    /// @param data Optional additional data with no specified format, to be passed to the receiver contract.
    /// @return result Whether the operation succeeded.
    function safeTransferFrom(address from, address to, uint256 value, bytes calldata data) external returns (bool result);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20Detailed} from "./../interfaces/IERC20Detailed.sol";
import {ProxyInitialization} from "./../../../proxy/libraries/ProxyInitialization.sol";
import {InterfaceDetectionStorage} from "./../../../introspection/libraries/InterfaceDetectionStorage.sol";

library ERC20DetailedStorage {
    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;
    using ERC20DetailedStorage for ERC20DetailedStorage.Layout;

    struct Layout {
        string tokenName;
        string tokenSymbol;
        uint8 tokenDecimals;
    }

    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.token.ERC20.ERC20Detailed.storage")) - 1);
    bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256("animoca.core.token.ERC20.ERC20Detailed.phase")) - 1);

    /// @notice Initializes the storage with the token details (immutable version).
    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Detailed.
    /// @dev Note: This function should be called ONLY in the constructor of an immutable (non-proxied) contract.
    /// @param tokenName The token name.
    /// @param tokenSymbol The token symbol.
    /// @param tokenDecimals The token decimals.
    function constructorInit(Layout storage s, string memory tokenName, string memory tokenSymbol, uint8 tokenDecimals) internal {
        s.tokenName = tokenName;
        s.tokenSymbol = tokenSymbol;
        s.tokenDecimals = tokenDecimals;
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20Detailed).interfaceId, true);
    }

    /// @notice Initializes the storage with the token details (proxied version).
    /// @notice Sets the proxy initialization phase to `1`.
    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Detailed.
    /// @dev Note: This function should be called ONLY in the init function of a proxied contract.
    /// @dev Reverts with {InitializationPhaseAlreadyReached} if the proxy initialization phase is set to `1` or above.
    /// @param tokenName The token name.
    /// @param tokenSymbol The token symbol.
    /// @param tokenDecimals The token decimals.
    function proxyInit(Layout storage s, string calldata tokenName, string calldata tokenSymbol, uint8 tokenDecimals) internal {
        ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1);
        s.tokenName = tokenName;
        s.tokenSymbol = tokenSymbol;
        s.tokenDecimals = tokenDecimals;
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20Detailed).interfaceId, true);
    }

    /// @notice Gets the name of the token. E.g. "My Token".
    /// @return tokenName The name of the token.
    function name(Layout storage s) internal view returns (string memory tokenName) {
        return s.tokenName;
    }

    /// @notice Gets the symbol of the token. E.g. "TOK".
    /// @return tokenSymbol The symbol of the token.
    function symbol(Layout storage s) internal view returns (string memory tokenSymbol) {
        return s.tokenSymbol;
    }

    /// @notice Gets the number of decimals used to display the balances.
    /// @notice For example, if `decimals` equals `2`, a balance of `505` tokens should be displayed to a user as `5,05` (`505 / 10 ** 2`).
    /// @notice Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei.
    /// @dev Note: This information is only used for display purposes: it does  not impact the arithmetic of the contract.
    /// @return nbDecimals The number of decimals used to display the balances.
    function decimals(Layout storage s) internal view returns (uint8 nbDecimals) {
        return s.tokenDecimals;
    }

    function layout() internal pure returns (Layout storage s) {
        bytes32 position = LAYOUT_STORAGE_SLOT;
        assembly {
            s.slot := position
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {IERC20Metadata} from "./../interfaces/IERC20Metadata.sol";
import {InterfaceDetectionStorage} from "./../../../introspection/libraries/InterfaceDetectionStorage.sol";

library ERC20MetadataStorage {
    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;
    using ERC20MetadataStorage for ERC20MetadataStorage.Layout;

    struct Layout {
        string uri;
    }

    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.token.ERC20.ERC20Metadata.storage")) - 1);

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Metadata.
    function init() internal {
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20Metadata).interfaceId, true);
    }

    /// @notice Sets the token URI.
    /// @param uri The token URI.
    function setTokenURI(Layout storage s, string calldata uri) internal {
        s.uri = uri;
    }

    /// @notice Gets the token metadata URI.
    /// @return uri The token metadata URI.
    function tokenURI(Layout storage s) internal view returns (string memory uri) {
        return s.uri;
    }

    function layout() internal pure returns (Layout storage s) {
        bytes32 position = LAYOUT_STORAGE_SLOT;
        assembly {
            s.slot := position
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20PermitFromAddressZero, ERC20PermitExpired, ERC20PermitInvalidSignature} from "./../errors/ERC20PermitErrors.sol";
import {IERC20Permit} from "./../interfaces/IERC20Permit.sol";
import {ERC20Storage} from "./ERC20Storage.sol";
import {ERC20DetailedStorage} from "./ERC20DetailedStorage.sol";
import {InterfaceDetectionStorage} from "./../../../introspection/libraries/InterfaceDetectionStorage.sol";

library ERC20PermitStorage {
    using ERC20Storage for ERC20Storage.Layout;
    using ERC20DetailedStorage for ERC20DetailedStorage.Layout;
    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;

    struct Layout {
        mapping(address => uint256) accountNonces;
    }

    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.token.ERC20.ERC20Permit.storage")) - 1);

    // 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9
    bytes32 internal constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Permit.
    function init() internal {
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20Permit).interfaceId, true);
    }

    /// @notice Sets the allowance to an account from another account using a signed permit.
    /// @dev Reverts with {ERC20PermitFromZeroAddress} if `owner` is the zero address.
    /// @dev Reverts with {ERC20PermitExpired} if the current blocktime is greather than `deadline`.
    /// @dev Reverts with {ERC20PermitInvalidSignature} if `r`, `s`, and `v` do not represent a valid `secp256k1` signature from `owner`.
    /// @dev Emits an {IERC20-Approval} event.
    /// @param owner The token owner granting the allowance to `spender`.
    /// @param spender The token spender being granted the allowance by `owner`.
    /// @param value The allowance amount to grant.
    /// @param deadline The deadline from which the permit signature is no longer valid.
    /// @param v Permit signature v parameter
    /// @param r Permit signature r parameter.
    /// @param s Permit signature s parameter.
    function permit(Layout storage st, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) internal {
        if (owner == address(0)) revert ERC20PermitFromAddressZero();
        if (block.timestamp > deadline) revert ERC20PermitExpired(deadline);
        unchecked {
            bytes32 hashStruct = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, st.accountNonces[owner]++, deadline));
            bytes32 hash = keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR(), hashStruct));
            address signer = ecrecover(hash, v, r, s);
            if (signer != owner) revert ERC20PermitInvalidSignature();
        }
        ERC20Storage.layout().approve(owner, spender, value);
    }

    /// @notice Gets the current permit nonce of an account.
    /// @param owner The account to check the nonce of.
    /// @return nonce The current permit nonce of `owner`.
    function nonces(Layout storage s, address owner) internal view returns (uint256 nonce) {
        return s.accountNonces[owner];
    }

    /// @notice Returns the EIP-712 encoded hash struct of the domain-specific information for permits.
    /// @dev A common ERC-20 permit implementation choice for the `DOMAIN_SEPARATOR` is:
    ///  keccak256(
    ///      abi.encode(
    ///          keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
    ///          keccak256(bytes(name)),
    ///          keccak256(bytes(version)),
    ///          chainId,
    ///          address(this)))
    ///
    ///  where
    ///   - `name` (string) is the ERC-20 token name.
    ///   - `version` (string) refers to the ERC-20 token contract version.
    ///   - `chainId` (uint256) is the chain ID to which the ERC-20 token contract is deployed to.
    ///   - `verifyingContract` (address) is the ERC-20 token contract address.
    ///
    /// @return domainSeparator The EIP-712 encoded hash struct of the domain-specific information for permits.
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() internal view returns (bytes32) {
        uint256 chainId;
        assembly {
            chainId := chainid()
        }
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(ERC20DetailedStorage.layout().name())),
                    keccak256("1"),
                    chainId,
                    address(this)
                )
            );
    }

    function layout() internal pure returns (Layout storage s) {
        bytes32 position = LAYOUT_STORAGE_SLOT;
        assembly {
            s.slot := position
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

// solhint-disable-next-line max-line-length
import {ERC20ApprovalToAddressZero, ERC20InsufficientAllowance, ERC20TransferToAddressZero, ERC20InsufficientBalance} from "./../errors/ERC20Errors.sol";
import {ERC20AllowanceOverflow} from "./../errors/ERC20AllowanceErrors.sol";
import {ERC20BatchTransferValuesOverflow} from "./../errors/ERC20BatchTransfersErrors.sol";
import {ERC20SafeTransferRejected} from "./../errors/ERC20SafeTransfersErrors.sol";
import {ERC20MintToAddressZero, ERC20BatchMintValuesOverflow, ERC20TotalSupplyOverflow} from "./../errors/ERC20MintableErrors.sol";
import {InconsistentArrayLengths} from "./../../../CommonErrors.sol";
import {Transfer, Approval} from "./../events/ERC20Events.sol";
import {IERC20} from "./../interfaces/IERC20.sol";
import {IERC20Allowance} from "./../interfaces/IERC20Allowance.sol";
import {IERC20BatchTransfers} from "./../interfaces/IERC20BatchTransfers.sol";
import {IERC20SafeTransfers} from "./../interfaces/IERC20SafeTransfers.sol";
import {IERC20Mintable} from "./../interfaces/IERC20Mintable.sol";
import {IERC20Burnable} from "./../interfaces/IERC20Burnable.sol";
import {IERC20Receiver} from "./../interfaces/IERC20Receiver.sol";
import {Address} from "./../../../utils/libraries/Address.sol";
import {ProxyInitialization} from "./../../../proxy/libraries/ProxyInitialization.sol";
import {InterfaceDetectionStorage} from "./../../../introspection/libraries/InterfaceDetectionStorage.sol";

library ERC20Storage {
    using Address for address;
    using ERC20Storage for ERC20Storage.Layout;
    using InterfaceDetectionStorage for InterfaceDetectionStorage.Layout;

    struct Layout {
        mapping(address => uint256) balances;
        mapping(address => mapping(address => uint256)) allowances;
        uint256 supply;
    }

    bytes32 internal constant LAYOUT_STORAGE_SLOT = bytes32(uint256(keccak256("animoca.core.token.ERC20.ERC20.storage")) - 1);
    bytes32 internal constant PROXY_INIT_PHASE_SLOT = bytes32(uint256(keccak256("animoca.core.token.ERC20.ERC20.phase")) - 1);

    bytes4 internal constant ERC20_RECEIVED = IERC20Receiver.onERC20Received.selector;

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20, ERC20Allowance.
    function init() internal {
        InterfaceDetectionStorage.Layout storage erc165Layout = InterfaceDetectionStorage.layout();
        erc165Layout.setSupportedInterface(type(IERC20).interfaceId, true);
        erc165Layout.setSupportedInterface(type(IERC20Allowance).interfaceId, true);
    }

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20, ERC20Allowance.
    function initWithAllocations(address[] memory initialHolders, uint256[] memory initialAllocations) internal {
        ProxyInitialization.setPhase(PROXY_INIT_PHASE_SLOT, 1);
        init();
        layout().batchMint(initialHolders, initialAllocations);
    }

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20BatchTransfers.
    function initERC20BatchTransfers() internal {
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20BatchTransfers).interfaceId, true);
    }

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20SafeTransfers.
    function initERC20SafeTransfers() internal {
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20SafeTransfers).interfaceId, true);
    }

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Mintable.
    function initERC20Mintable() internal {
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20Mintable).interfaceId, true);
    }

    /// @notice Marks the following ERC165 interface(s) as supported: ERC20Burnable.
    function initERC20Burnable() internal {
        InterfaceDetectionStorage.layout().setSupportedInterface(type(IERC20Burnable).interfaceId, true);
    }

    /// @notice Sets the allowance to an account by an owner.
    /// @dev Note: This function implements {ERC20-approve(address,uint256)}.
    /// @dev Reverts with {ERC20ApprovalToAddressZero} if `spender` is the zero address.
    /// @dev Emits an {Approval} event.
    /// @param owner The account to set the allowance from.
    /// @param spender The account being granted the allowance by `owner`.
    /// @param value The allowance amount to grant.
    function approve(Layout storage s, address owner, address spender, uint256 value) internal {
        if (spender == address(0)) revert ERC20ApprovalToAddressZero(owner);
        s.allowances[owner][spender] = value;
        emit Approval(owner, spender, value);
    }

    /// @notice Increases the allowance granted to an account by an owner.
    /// @dev Note: This function implements {ERC20Allowance-increaseAllowance(address,uint256)}.
    /// @dev Reverts with {ERC20ApprovalToAddressZero} if `spender` is the zero address.
    /// @dev Reverts with {ERC20AllowanceOverflow} if `spender`'s allowance by `owner` overflows.
    /// @dev Emits an {IERC20-Approval} event with an updated allowance for `spender` by `owner`.
    /// @param owner The account increasing the allowance.
    /// @param spender The account whose allowance is being increased.
    /// @param value The allowance amount increase.
    function increaseAllowance(Layout storage s, address owner, address spender, uint256 value) internal {
        if (spender == address(0)) revert ERC20ApprovalToAddressZero(owner);
        uint256 currentAllowance = s.allowances[owner][spender];
        if (value != 0) {
            unchecked {
                uint256 newAllowance = currentAllowance + value;
                if (newAllowance <= currentAllowance) revert ERC20AllowanceOverflow(owner, spender, currentAllowance, value);
                s.allowances[owner][spender] = newAllowance;
                currentAllowance = newAllowance;
            }
        }
        emit Approval(owner, spender, currentAllowance);
    }

    /// @notice Decreases the allowance granted to an account by an owner.
    /// @dev Note: This function implements {ERC20Allowance-decreaseAllowance(address,uint256)}.
    /// @dev Reverts with {ERC20ApprovalToAddressZero} if `spender` is the zero address.
    /// @dev Reverts with {ERC20InsufficientAllowance} if `spender` does not have at least `value` of allowance by `owner`.
    /// @dev Emits an {IERC20-Approval} event with an updated allowance for `spender` by `owner`.
    /// @param owner The account decreasing the allowance.
    /// @param spender The account whose allowance is being decreased.
    /// @param value The allowance amount decrease.
    function decreaseAllowance(Layout storage s, address owner, address spender, uint256 value) internal {
        if (spender == address(0)) revert ERC20ApprovalToAddressZero(owner);
        uint256 currentAllowance = s.allowances[owner][spender];

        if (currentAllowance != type(uint256).max && value != 0) {
            unchecked {
                // save gas when allowance is maximal by not reducing it (see https://github.com/ethereum/EIPs/issues/717)
                uint256 newAllowance = currentAllowance - value;
                if (newAllowance >= currentAllowance) revert ERC20InsufficientAllowance(owner, spender, currentAllowance, value);
                s.allowances[owner][spender] = newAllowance;
                currentAllowance = newAllowance;
            }
        }
        emit Approval(owner, spender, currentAllowance);
    }

    /// @notice Transfers an amount of tokens from an account to a recipient.
    /// @dev Note: This function implements {ERC20-transfer(address,uint256)}.
    /// @dev Reverts with {ERC20TransferToAddressZero} if `to` is the zero address.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `value` of balance.
    /// @dev Emits a {Transfer} event.
    /// @param from The account transferring the tokens.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    function transfer(Layout storage s, address from, address to, uint256 value) internal {
        if (to == address(0)) revert ERC20TransferToAddressZero(from);

        if (value != 0) {
            uint256 balance = s.balances[from];
            unchecked {
                uint256 newBalance = balance - value;
                if (newBalance >= balance) revert ERC20InsufficientBalance(from, balance, value);
                if (from != to) {
                    s.balances[from] = newBalance;
                    s.balances[to] += value;
                }
            }
        }

        emit Transfer(from, to, value);
    }

    /// @notice Transfers an amount of tokens from an account to a recipient by a sender.
    /// @dev Note: This function implements {ERC20-transferFrom(address,address,uint256)}.
    /// @dev Reverts with {ERC20TransferToAddressZero} if `to` is the zero address.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `value` of balance.
    /// @dev Reverts with {ERC20InsufficientAllowance} if `sender` is not `from` and does not have at least `value` of allowance by `from`.
    /// @dev Emits a {Transfer} event.
    /// @dev Optionally emits an {Approval} event if `sender` is not `from`.
    /// @param sender The message sender.
    /// @param from The account which owns the tokens to transfer.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    function transferFrom(Layout storage s, address sender, address from, address to, uint256 value) internal {
        if (from != sender) {
            s.decreaseAllowance(from, sender, value);
        }
        s.transfer(from, to, value);
    }

    //================================================= Batch Transfers ==================================================//

    /// @notice Transfers multiple amounts of tokens from an account to multiple recipients.
    /// @dev Note: This function implements {ERC20BatchTransfers-batchTransfer(address[],uint256[])}.
    /// @dev Reverts with {InconsistentArrayLengths} if `recipients` and `values` have different lengths.
    /// @dev Reverts with {ERC20TransferToAddressZero} if one of `recipients` is the zero address.
    /// @dev Reverts with {ERC20BatchTransferValuesOverflow} if the total sum of `values` overflows.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `sum(values)` of balance.
    /// @dev Emits a {Transfer} event for each transfer.
    /// @param from The account transferring the tokens.
    /// @param recipients The list of accounts to transfer the tokens to.
    /// @param values The list of amounts of tokens to transfer to each of `recipients`.
    function batchTransfer(Layout storage s, address from, address[] calldata recipients, uint256[] calldata values) internal {
        uint256 length = recipients.length;
        if (length != values.length) revert InconsistentArrayLengths();

        if (length == 0) return;

        uint256 balance = s.balances[from];

        uint256 totalValue;
        uint256 selfTransferTotalValue;
        for (uint256 i; i < length; ++i) {
            address to = recipients[i];
            if (to == address(0)) revert ERC20TransferToAddressZero(from);

            uint256 value = values[i];
            if (value != 0) {
                unchecked {
                    uint256 newTotalValue = totalValue + value;
                    if (newTotalValue <= totalValue) revert ERC20BatchTransferValuesOverflow();
                    totalValue = newTotalValue;
                    if (from != to) {
                        s.balances[to] += value;
                    } else {
                        if (value > balance) revert ERC20InsufficientBalance(from, balance, value);
                        selfTransferTotalValue += value; // cannot overflow as 'selfTransferTotalValue <= totalValue' is always true
                    }
                }
            }
            emit Transfer(from, to, value);
        }

        if (totalValue != 0 && totalValue != selfTransferTotalValue) {
            unchecked {
                uint256 newBalance = balance - totalValue;
                // balance must be sufficient, including self-transfers
                if (newBalance >= balance) revert ERC20InsufficientBalance(from, balance, totalValue);
                s.balances[from] = newBalance + selfTransferTotalValue; // do not deduct self-transfers from the sender balance
            }
        }
    }

    /// @notice Transfers multiple amounts of tokens from an account to multiple recipients by a sender.
    /// @dev Note: This function implements {ERC20BatchTransfers-batchTransferFrom(address,address[],uint256[])}.
    /// @dev Reverts with {InconsistentArrayLengths} if `recipients` and `values` have different lengths.
    /// @dev Reverts with {ERC20TransferToAddressZero} if one of `recipients` is the zero address.
    /// @dev Reverts with {ERC20BatchTransferValuesOverflow} if the total sum of `values` overflows.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `sum(values)` of balance.
    /// @dev Reverts with {ERC20InsufficientAllowance} if `sender` is not `from` and does not have at least `sum(values)` of allowance by `from`.
    /// @dev Emits a {Transfer} event for each transfer.
    /// @dev Optionally emits an {Approval} event if `sender` is not `from` (non-standard).
    /// @param sender The message sender.
    /// @param from The account transferring the tokens.
    /// @param recipients The list of accounts to transfer the tokens to.
    /// @param values The list of amounts of tokens to transfer to each of `recipients`.
    function batchTransferFrom(Layout storage s, address sender, address from, address[] calldata recipients, uint256[] calldata values) internal {
        uint256 length = recipients.length;
        if (length != values.length) revert InconsistentArrayLengths();

        if (length == 0) return;

        uint256 balance = s.balances[from];

        uint256 totalValue;
        uint256 selfTransferTotalValue;
        for (uint256 i; i < length; ++i) {
            address to = recipients[i];
            if (to == address(0)) revert ERC20TransferToAddressZero(from);

            uint256 value = values[i];

            if (value != 0) {
                unchecked {
                    uint256 newTotalValue = totalValue + value;
                    if (newTotalValue <= totalValue) revert ERC20BatchTransferValuesOverflow();
                    totalValue = newTotalValue;
                    if (from != to) {
                        s.balances[to] += value;
                    } else {
                        if (value > balance) revert ERC20InsufficientBalance(from, balance, value);
                        selfTransferTotalValue += value; // cannot overflow as 'selfTransferTotalValue <= totalValue' is always true
                    }
                }
            }

            emit Transfer(from, to, value);

            if (totalValue != 0 && totalValue != selfTransferTotalValue) {
                unchecked {
                    uint256 newBalance = balance - totalValue;
                    // balance must be sufficient, including self-transfers
                    if (newBalance >= balance) revert ERC20InsufficientBalance(from, balance, totalValue);
                    s.balances[from] = newBalance + selfTransferTotalValue; // do not deduct self-transfers from the sender balance
                }
            }
        }

        if (from != sender) {
            s.decreaseAllowance(from, sender, totalValue);
        }
    }

    //================================================= Safe Transfers ==================================================//

    /// @notice Transfers an amount of tokens from an account to a recipient. If the recipient is a contract, calls `onERC20Received` on it.
    /// @dev Note: This function implements {ERC20SafeTransfers-safeTransfer(address,uint256,bytes)}.
    /// @dev Warning: Since a `to` contract can run arbitrary code, developers should be aware of potential re-entrancy attacks.
    /// @dev Reverts with {ERC20TransferToAddressZero} if `to` is the zero address.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `value` of balance.
    /// @dev Reverts with {ERC20SafeTransferRejected} if `to` is a contract and the call to `onERC20Received` fails, reverts or is rejected.
    /// @dev Emits a {Transfer} event.
    /// @param from The account transferring the tokens.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    /// @param data Optional additional data with no specified format, to be passed to the receiver contract.
    function safeTransfer(Layout storage s, address from, address to, uint256 value, bytes calldata data) internal {
        s.transfer(from, to, value);
        if (to.hasBytecode()) {
            _callOnERC20Received(from, from, to, value, data);
        }
    }

    /// @notice Transfers an amount of tokens to a recipient from a specified address. If the recipient is a contract, calls `onERC20Received` on it.
    /// @dev Note: This function implements {ERC20SafeTransfers-safeTransferFrom(address,address,uint256,bytes)}.
    /// @dev Warning: Since a `to` contract can run arbitrary code, developers should be aware of potential re-entrancy attacks.
    /// @dev Reverts with {ERC20TransferToAddressZero} if `to` is the zero address.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `value` of balance.
    /// @dev Reverts with {ERC20InsufficientAllowance} if `sender` is not `from` and does not have at least `value` of allowance by `from`.
    /// @dev Reverts with {ERC20SafeTransferRejected} if `to` is a contract and the call to `onERC20Received` fails, reverts or is rejected.
    /// @dev Emits a {Transfer} event.
    /// @dev Optionally emits an {Approval} event if `sender` is not `from` (non-standard).
    /// @param sender The message sender.
    /// @param from The account transferring the tokens.
    /// @param to The account to transfer the tokens to.
    /// @param value The amount of tokens to transfer.
    /// @param data Optional additional data with no specified format, to be passed to the receiver contract.
    function safeTransferFrom(Layout storage s, address sender, address from, address to, uint256 value, bytes calldata data) internal {
        s.transferFrom(sender, from, to, value);
        if (to.hasBytecode()) {
            _callOnERC20Received(sender, from, to, value, data);
        }
    }

    //================================================= Minting ==================================================//

    /// @notice Mints an amount of tokens to a recipient, increasing the total supply.
    /// @dev Note: This function implements {ERC20Mintable-mint(address,uint256)}.
    /// @dev Reverts with {ERC20MintToAddressZero} if `to` is the zero address.
    /// @dev Reverts with {ERC20TotalSupplyOverflow} if the total supply overflows.
    /// @dev Emits a {Transfer} event with `from` set to the zero address.
    /// @param to The account to mint the tokens to.
    /// @param value The amount of tokens to mint.
    function mint(Layout storage s, address to, uint256 value) internal {
        if (to == address(0)) revert ERC20MintToAddressZero();
        if (value != 0) {
            uint256 supply = s.supply;
            unchecked {
                uint256 newSupply = supply + value;
                if (newSupply <= supply) revert ERC20TotalSupplyOverflow(supply, value);
                s.supply = newSupply;
                s.balances[to] += value; // balance cannot overflow if supply does not
            }
        }
        emit Transfer(address(0), to, value);
    }

    /// @notice Mints multiple amounts of tokens to multiple recipients, increasing the total supply.
    /// @dev Note: This function implements {ERC20Mintable-batchMint(address[],uint256[])}.
    /// @dev Reverts with {InconsistentArrayLengths} if `recipients` and `values` have different lengths.
    /// @dev Reverts with {ERC20MintToAddressZero} if one of `recipients` is the zero address.
    /// @dev Reverts with {ERC20BatchMintValuesOverflow} if the total sum of `values` overflows.
    /// @dev Reverts with {ERC20TotalSupplyOverflow} if the total supply overflows.
    /// @dev Emits a {Transfer} event for each transfer with `from` set to the zero address.
    /// @param recipients The list of accounts to mint the tokens to.
    /// @param values The list of amounts of tokens to mint to each of `recipients`.
    function batchMint(Layout storage s, address[] memory recipients, uint256[] memory values) internal {
        uint256 length = recipients.length;
        if (length != values.length) revert InconsistentArrayLengths();

        if (length == 0) return;

        uint256 totalValue;
        for (uint256 i; i < length; ++i) {
            address to = recipients[i];
            if (to == address(0)) revert ERC20MintToAddressZero();

            uint256 value = values[i];
            if (value != 0) {
                unchecked {
                    uint256 newTotalValue = totalValue + value;
                    if (newTotalValue <= totalValue) revert ERC20BatchMintValuesOverflow();
                    totalValue = newTotalValue;
                    s.balances[to] += value; // balance cannot overflow if supply does not
                }
            }
            emit Transfer(address(0), to, value);
        }

        if (totalValue != 0) {
            unchecked {
                uint256 supply = s.supply;
                uint256 newSupply = supply + totalValue;
                if (newSupply <= supply) revert ERC20TotalSupplyOverflow(supply, totalValue);
                s.supply = newSupply;
            }
        }
    }

    //================================================= Burning ==================================================//

    /// @notice Burns an amount of tokens from an account, decreasing the total supply.
    /// @dev Note: This function implements {ERC20Burnable-burn(uint256)}.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `value` of balance.
    /// @dev Emits a {Transfer} event with `to` set to the zero address.
    /// @param from The account burning the tokens.
    /// @param value The amount of tokens to burn.
    function burn(Layout storage s, address from, uint256 value) internal {
        if (value != 0) {
            uint256 balance = s.balances[from];
            unchecked {
                uint256 newBalance = balance - value;
                if (newBalance >= balance) revert ERC20InsufficientBalance(from, balance, value);
                s.balances[from] = newBalance;
                s.supply -= value; // will not underflow if balance does not
            }
        }

        emit Transfer(from, address(0), value);
    }

    /// @notice Burns an amount of tokens from an account by a sender, decreasing the total supply.
    /// @dev Note: This function implements {ERC20Burnable-burnFrom(address,uint256)}.
    /// @dev Reverts with {ERC20InsufficientBalance} if `from` does not have at least `value` of balance.
    /// @dev Reverts with {ERC20InsufficientAllowance} if `sender` is not `from` and does not have at least `value` of allowance by `from`.
    /// @dev Emits a {Transfer} event with `to` set to the zero address.
    /// @dev Optionally emits an {Approval} event if `sender` is not `from` (non-standard).
    /// @param sender The message sender.
    /// @param from The account to burn the tokens from.
    /// @param value The amount of tokens to burn.
    function burnFrom(Layout storage s, address sender, address from, uint256 value) internal {
        if (from != sender) {
            s.decreaseAllowance(from, sender, value);
        }
        s.burn(from, value);
    }

    /// @notice Burns multiple amounts of tokens from multiple owners, decreasing the total supply.
    /// @dev Note: This function implements {ERC20Burnable-batchBurnFrom(address,address[],uint256[])}.
    /// @dev Reverts with {InconsistentArrayLengths} if `owners` and `values` have different lengths.
    /// @dev Reverts with {ERC20InsufficientBalance} if an `owner` does not have at least the corresponding `value` of balance.
    /// @dev Reverts with {ERC20InsufficientAllowance} if `sender` is not an `owner` and does not have
    ///  at least the corresponding `value` of allowance by this `owner`.
    /// @dev Emits a {Transfer} event for each transfer with `to` set to the zero address.
    /// @dev Optionally emits an {Approval} event for each transfer if `sender` is not this `owner` (non-standard).
    /// @param sender The message sender.
    /// @param owners The list of accounts to burn the tokens from.
    /// @param values The list of amounts of tokens to burn.
    function batchBurnFrom(Layout storage s, address sender, address[] calldata owners, uint256[] calldata values) internal {
        uint256 length = owners.length;
        if (length != values.length) revert InconsistentArrayLengths();

        if (length == 0) return;

        uint256 totalValue;
        for (uint256 i; i < length; ++i) {
            address from = owners[i];
            uint256 value = values[i];

            if (from != sender) {
                s.decreaseAllowance(from, sender, value);
            }

            if (value != 0) {
                uint256 balance = s.balances[from];
                unchecked {
                    uint256 newBalance = balance - value;
                    if (newBalance >= balance) revert ERC20InsufficientBalance(from, balance, value);
                    s.balances[from] = newBalance;
                    totalValue += value; // totalValue cannot overflow if the individual balances do not underflow
                }
            }

            emit Transfer(from, address(0), value);
        }

        if (totalValue != 0) {
            unchecked {
                s.supply -= totalValue; // _totalSupply cannot underfow as balances do not underflow
            }
        }
    }

    /// @notice Gets the total token supply.
    /// @dev Note: This function implements {ERC20-totalSupply()}.
    /// @return supply The total token supply.
    function totalSupply(Layout storage s) internal view returns (uint256 supply) {
        return s.supply;
    }

    /// @notice Gets an account balance.
    /// @dev Note: This function implements {ERC20-balanceOf(address)}.
    /// @param owner The account whose balance will be returned.
    /// @return balance The account balance.
    function balanceOf(Layout storage s, address owner) internal view returns (uint256 balance) {
        return s.balances[owner];
    }

    /// @notice Gets the amount that an account is allowed to spend on behalf of another.
    /// @dev Note: This function implements {ERC20-allowance(address,address)}.
    /// @param owner The account that has granted an allowance to `spender`.
    /// @param spender The account that was granted an allowance by `owner`.
    /// @return value The amount which `spender` is allowed to spend on behalf of `owner`.
    function allowance(Layout storage s, address owner, address spender) internal view returns (uint256 value) {
        return s.allowances[owner][spender];
    }

    function layout() internal pure returns (Layout storage s) {
        bytes32 position = LAYOUT_STORAGE_SLOT;
        assembly {
            s.slot := position
        }
    }

    /// @notice Calls {IERC20Receiver-onERC20Received} on a target contract.
    /// @dev Reverts with {ERC20SafeTransferRejected} if the call to the target fails, reverts or is rejected.
    /// @param sender The message sender.
    /// @param from Previous token owner.
    /// @param to New token owner.
    /// @param value The value transferred.
    /// @param data Optional data to send along with the receiver contract call.
    function _callOnERC20Received(address sender, address from, address to, uint256 value, bytes memory data) private {
        if (IERC20Receiver(to).onERC20Received(sender, from, value, data) != ERC20_RECEIVED) revert ERC20SafeTransferRejected(to);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

/// @title ERC721 Non-Fungible Token Standard, basic interface (functions).
/// @dev See https://eips.ethereum.org/EIPS/eip-721
/// @dev This interface only contains the standard functions. See IERC721Events for the events.
/// @dev Note: The ERC-165 identifier for this interface is 0x80ac58cd.
interface IERC721 {
    /// @notice Sets or unsets an approval to transfer a single token on behalf of its owner.
    /// @dev Note: There can only be one approved address per token at a given time.
    /// @dev Note: A token approval gets reset when this token is transferred, including a self-transfer.
    /// @dev Reverts if `tokenId` does not exist.
    /// @dev Reverts if `to` is the token owner.
    /// @dev Reverts if the sender is not the token owner and has not been approved by the token owner.
    /// @dev Emits an {Approval} event.
    /// @param to The address to approve, or the zero address to remove any existing approval.
    /// @param tokenId The token identifier to give approval for.
    function approve(address to, uint256 tokenId) external;

    /// @notice Sets or unsets an approval to transfer all tokens on behalf of their owner.
    /// @dev Reverts if the sender is the same as `operator`.
    /// @dev Emits an {ApprovalForAll} event.
    /// @param operator The address to approve for all tokens.
    /// @param approved True to set an approval for all tokens, false to unset it.
    function setApprovalForAll(address operator, bool approved) external;

    /// @notice Unsafely transfers the ownership of a token to a recipient.
    /// @dev Note: Usage of this method is discouraged, use `safeTransferFrom` whenever possible.
    /// @dev Resets the token approval for `tokenId`.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if `from` is not the owner of `tokenId`.
    /// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`.
    /// @dev Emits a {Transfer} event.
    /// @param from The current token owner.
    /// @param to The recipient of the token transfer. Self-transfers are possible.
    /// @param tokenId The identifier of the token to transfer.
    function transferFrom(address from, address to, uint256 tokenId) external;

    /// @notice Safely transfers the ownership of a token to a recipient.
    /// @dev Resets the token approval for `tokenId`.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if `from` is not the owner of `tokenId`.
    /// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`.
    /// @dev Reverts if `to` is a contract and the call to {IERC721Receiver-onERC721Received} fails, reverts or is rejected.
    /// @dev Emits a {Transfer} event.
    /// @param from The current token owner.
    /// @param to The recipient of the token transfer.
    /// @param tokenId The identifier of the token to transfer.
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /// @notice Safely transfers the ownership of a token to a recipient.
    /// @dev Resets the token approval for `tokenId`.
    /// @dev Reverts if `to` is the zero address.
    /// @dev Reverts if `from` is not the owner of `tokenId`.
    /// @dev Reverts if the sender is not `from` and has not been approved by `from` for `tokenId`.
    /// @dev Reverts if `to` is a contract and the call to {IERC721Receiver-onERC721Received} fails, reverts or is rejected.
    /// @dev Emits a {Transfer} event.
    /// @param from The current token owner.
    /// @param to The recipient of the token transfer.
    /// @param tokenId The identifier of the token to transfer.
    /// @param data Optional data to send along to a receiver contract.
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /// @notice Gets the balance of an address.
    /// @dev Reverts if `owner` is the zero address.
    /// @param owner The address to query the balance of.
    /// @return balance The amount owned by the owner.
    function balanceOf(address owner) external view returns (uint256 balance);

    /// @notice Gets the owner of a token.
    /// @dev Reverts if `tokenId` does not exist.
    /// @param tokenId The token identifier to query the owner of.
    /// @return tokenOwner The owner of the token identifier.
    function ownerOf(uint256 tokenId) external view returns (address tokenOwner);

    /// @notice Gets the approved address for a token.
    /// @dev Reverts if `tokenId` does not exist.
    /// @param tokenId The token identifier to query the approval of.
    /// @return approved The approved address for the token identifier, or the zero address if no approval is set.
    function getApproved(uint256 tokenId) external view returns (address approved);

    /// @notice Gets whether an operator is approved for all tokens by an owner.
    /// @param owner The address which gives the approval for all tokens.
    /// @param operator The address which receives the approval for all tokens.
    /// @return approvedForAll Whether the operator is approved for all tokens by the owner.
    function isApprovedForAll(address owner, address operator) external view returns (bool approvedForAll);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

library Address {
    /// @notice Checks if the address is a deployed smart contract.
    /// @param addr The address to check.
    /// @return hasBytecode True if `addr` is a deployed smart contract, false otherwise.
    function hasBytecode(address addr) internal view returns (bool) {
        uint256 size;
        assembly {
            size := extcodesize(addr)
        }
        return size != 0;
    }
}

Settings
{
  "evmVersion": "paris",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 99999
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"string","name":"tokenName","type":"string"},{"internalType":"string","name":"tokenSymbol","type":"string"},{"internalType":"uint8","name":"tokenDecimals","type":"uint8"},{"internalType":"address[]","name":"holders","type":"address[]"},{"internalType":"uint256[]","name":"allocations","type":"uint256[]"},{"internalType":"contract IForwarderRegistry","name":"forwarderRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"increment","type":"uint256"}],"name":"ERC20AllowanceOverflow","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC20ApprovalToAddressZero","type":"error"},{"inputs":[],"name":"ERC20BatchMintValuesOverflow","type":"error"},{"inputs":[],"name":"ERC20BatchTransferValuesOverflow","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"decrement","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[],"name":"ERC20MintToAddressZero","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"ERC20PermitExpired","type":"error"},{"inputs":[],"name":"ERC20PermitFromAddressZero","type":"error"},{"inputs":[],"name":"ERC20PermitInvalidSignature","type":"error"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"}],"name":"ERC20SafeTransferRejected","type":"error"},{"inputs":[{"internalType":"uint256","name":"supply","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"ERC20TotalSupplyOverflow","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC20TransferToAddressZero","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[],"name":"IllegalInterfaceId","type":"error"},{"inputs":[],"name":"InconsistentArrayLengths","type":"error"},{"inputs":[{"internalType":"address","name":"tokenContract","type":"address"}],"name":"IncorrectTokenContractType","type":"error"},{"inputs":[{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"NotContractOwner","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"batchTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address[]","name":"recipients","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"batchTransferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"forwarderRegistry","outputs":[{"internalType":"contract IForwarderRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","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":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"contract IERC20[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"recoverERC20s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"contract IERC721[]","name":"contracts","type":"address[]"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"recoverERC721s","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"recoverETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"supply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

0x60a060405234801561001057600080fd5b506040516136ff3803806136ff83398101604081905261002f916106a3565b80803388888861003d6100bb565b61005383838361004b6100f0565b929190610124565b50505061006e8161006861017260201b60201c565b906101a0565b5061007761020f565b61007f610226565b61008761023b565b61008f610250565b6001600160a01b0316608052506100b083836100a9610265565b9190610293565b5050505050506108ff565b60006100c5610421565b90506100da816336372b0760e01b600161044f565b6100ed81634e83a8c360e11b600161044f565b50565b60008061011e60017f335df4119bbb04f056b33eba33b826d3529129e458faf6daa9924b5a8f3b6a82610784565b92915050565b8361012f848261082b565b506001840161013e838261082b565b5060028401805460ff191660ff831617905561016c63a219a02560e01b6001610165610421565b919061044f565b50505050565b60008061011e60017fc9ed16f33ab3a66c84bfd83099ccb2a8845871e2e1c1928f63797152f0fd54cd610784565b6001600160a01b038116156101f65781546001600160a01b0319166001600160a01b03821690811783556040516000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a35b61020b6307f5828d60e41b6001610165610421565b5050565b6102246303c130d960e41b6001610165610421565b565b610224634ec7fbed60e11b6001610165610421565b6102246353f41a9760e01b6001610165610421565b61022463602993f360e11b6001610165610421565b60008061011e60017f1da92899d3da68bf9787824388a37ea2bfa79780bcef91b9716c390eec8ecbef610784565b8151815181146102b6576040516332c1299b60e11b815260040160405180910390fd5b806000036102c45750505050565b6000805b828110156103d65760008582815181106102e4576102e46108e9565b6020026020010151905060006001600160a01b0316816001600160a01b031603610321576040516392fd9c8f60e01b815260040160405180910390fd5b6000858381518110610335576103356108e9565b602002602001015190508060001461038b5783810184811161036a57604051631550ab9f60e21b815260040160405180910390fd5b6001600160a01b038316600090815260208a90526040902080548301905593505b6040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a350506001016102c8565b50801561041a576002850154818101818111610413576040516301b352fb60e11b8152600481018390526024810184905260440160405180910390fd5b6002870155505b5050505050565b60008061011e60017fca9d3e17f264b0f3984e2634e94adb37fa3e6a8103f06aeae6fa59e21c769f5e610784565b600160e01b6001600160e01b031983160161047d576040516372c683bb60e01b815260040160405180910390fd5b6001600160e01b03199190911660009081526020929092526040909120805460ff1916911515919091179055565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156104e9576104e96104ab565b604052919050565b600082601f83011261050257600080fd5b81516001600160401b0381111561051b5761051b6104ab565b61052e601f8201601f19166020016104c1565b81815284602083860101111561054357600080fd5b60005b8281101561056257602081860181015183830182015201610546565b506000918101602001919091529392505050565b805160ff8116811461058757600080fd5b919050565b60006001600160401b038211156105a5576105a56104ab565b5060051b60200190565b6001600160a01b03811681146100ed57600080fd5b600082601f8301126105d557600080fd5b81516105e86105e38261058c565b6104c1565b8082825260208201915060208360051b86010192508583111561060a57600080fd5b602085015b83811015610630578051610622816105af565b83526020928301920161060f565b5095945050505050565b600082601f83011261064b57600080fd5b81516106596105e38261058c565b8082825260208201915060208360051b86010192508583111561067b57600080fd5b602085015b83811015610630578051835260209283019201610680565b8051610587816105af565b60008060008060008060c087890312156106bc57600080fd5b86516001600160401b038111156106d257600080fd5b6106de89828a016104f1565b602089015190975090506001600160401b038111156106fc57600080fd5b61070889828a016104f1565b95505061071760408801610576565b60608801519094506001600160401b0381111561073357600080fd5b61073f89828a016105c4565b608089015190945090506001600160401b0381111561075d57600080fd5b61076989828a0161063a565b92505061077860a08801610698565b90509295509295509295565b8181038181111561011e57634e487b7160e01b600052601160045260246000fd5b600181811c908216806107b957607f821691505b6020821081036107d957634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111561082657806000526020600020601f840160051c810160208510156108065750805b601f840160051c820191505b8181101561041a5760008155600101610812565b505050565b81516001600160401b03811115610844576108446104ab565b6108588161085284546107a5565b846107df565b6020601f82116001811461088c57600083156108745750848201515b600019600385901b1c1916600184901b17845561041a565b600084815260208120601f198516915b828110156108bc578785015182556020948501946001909201910161089c565b50848210156108da5786840151600019600387901b60f8161c191681555b50505050600190811b01905550565b634e487b7160e01b600052603260045260246000fd5b608051612dd061092f60003960008181610244015281816102e90152818161212f01526121bd0152612dd06000f3fe608060405234801561001057600080fd5b50600436106101c45760003560e01c80637ecebe00116100f9578063c3666c3611610097578063e0df5b6f11610071578063e0df5b6f146103f6578063eb79554914610409578063f2fde38b1461041c578063f7ba94bd1461042f57600080fd5b8063c3666c36146103bd578063d505accf146103d0578063dd62ed3e146103e357600080fd5b806395d89b41116100d357806395d89b411461037c578063a457c2d714610384578063a9059cbb14610397578063b88d4fde146103aa57600080fd5b80637ecebe001461034e57806388d695b2146103615780638da5cb5b1461037457600080fd5b80633644e515116101665780634885b254116101405780634885b254146102c6578063572b6c05146102d957806370a082311461032657806373c8a9581461033957600080fd5b80633644e515146102a357806339509351146102ab5780633c130d90146102be57600080fd5b806318160ddd116101a257806318160ddd1461021957806323b872dd1461022f5780632b4c9f1614610242578063313ce5671461028957600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063095ea7b314610206575b600080fd5b6101dc6101d73660046125a3565b610442565b60405190151581526020015b60405180910390f35b6101f961045c565b6040516101e89190612624565b6101dc610214366004612659565b610473565b61022161049b565b6040519081526020016101e8565b6101dc61023d366004612685565b6104af565b7f00000000000000000000000000000000000000000000000000000000000000005b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e8565b6102916104da565b60405160ff90911681526020016101e8565b6102216104f1565b6101dc6102b9366004612659565b6104fb565b6101f961051a565b6101dc6102d4366004612712565b610527565b6101dc6102e736600461279a565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff90811691161490565b61022161033436600461279a565b610558565b61034c6103473660046127b7565b610590565b005b61022161035c36600461279a565b6105bf565b6101dc61036f36600461285d565b6105cd565b6102646105fb565b6101f9610622565b6101dc610392366004612659565b610634565b6101dc6103a5366004612659565b610653565b6101dc6103b8366004612910565b610672565b61034c6103cb3660046127b7565b610697565b61034c6103de366004612972565b6106b0565b6102216103f13660046129e9565b6106d7565b61034c610404366004612a22565b610729565b6101dc610417366004612a64565b61074c565b61034c61042a36600461279a565b61076f565b61034c61043d36600461285d565b61078d565b6000610456826104506107aa565b906107d8565b92915050565b606061046e6104696108b2565b6108e0565b905090565b6000610492610480610976565b848461048a610980565b9291906109ae565b50600192915050565b600061046e6104a8610980565b6002015490565b60006104d06104bc610976565b8585856104c7610980565b93929190610a8a565b5060019392505050565b600061046e6104e76108b2565b6002015460ff1690565b600061046e610adc565b6000610492610508610976565b8484610512610980565b929190610b77565b606061046e610469610d29565b600061054c610534610976565b8787878787610541610980565b959493929190610d57565b50600195945050505050565b600061045682610566610980565b9073ffffffffffffffffffffffffffffffffffffffff166000908152602091909152604090205490565b6105a961059b610976565b6105a3611131565b9061115f565b6105b78686868686866111ca565b505050505050565b6000610456826105666112b5565b60006105f06105da610976565b868686866105e6610980565b94939291906112e3565b506001949350505050565b600061046e610608611131565b5473ffffffffffffffffffffffffffffffffffffffff1690565b606061046e61062f6108b2565b61163a565b6000610492610641610976565b848461064b610980565b92919061164b565b6000610492610660610976565b848461066a610980565b929190611783565b600061054c61067f610976565b878787878761068c610980565b959493929190611942565b6106a261059b610976565b6105b78686868686866119af565b6106ce878787878787876106c26112b5565b96959493929190611c45565b50505050505050565b600061072283836106e6610980565b919073ffffffffffffffffffffffffffffffffffffffff9182166000908152600193909301602090815260408085209290931684525290205490565b9392505050565b61073461059b610976565b6107488282610741610d29565b9190611eb4565b5050565b60006105f0610759610976565b86868686610765610980565b9493929190611ec0565b61078a61077a610976565b82610783611131565b9190611f2c565b50565b61079861059b610976565b6107a484848484612040565b50505050565b60008061045660017fca9d3e17f264b0f3984e2634e94adb37fa3e6a8103f06aeae6fa59e21c769f5e612ab4565b60007c01000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083160161082857506000610456565b7ffe003659000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083160161087957506001610456565b507fffffffff00000000000000000000000000000000000000000000000000000000166000908152602091909152604090205460ff1690565b60008061045660017f335df4119bbb04f056b33eba33b826d3529129e458faf6daa9924b5a8f3b6a82612ab4565b60608160000180546108f190612aee565b80601f016020809104026020016040519081016040528092919081815260200182805461091d90612aee565b801561096a5780601f1061093f5761010080835404028352916020019161096a565b820191906000526020600020905b81548152906001019060200180831161094d57829003601f168201915b50505050509050919050565b600061046e6120ec565b60008061045660017f1da92899d3da68bf9787824388a37ea2bfa79780bcef91b9716c390eec8ecbef612ab4565b73ffffffffffffffffffffffffffffffffffffffff8216610a18576040517ff7e1ac0f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff838116600081815260018701602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a350505050565b8373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610ac957610ac98584868461164b565b610ad585848484611783565b5050505050565b6000467f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610b0b6104696108b2565b80516020918201206040805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018290523060a082015260c0016040516020818303038152906040528051906020012091505090565b73ffffffffffffffffffffffffffffffffffffffff8216610bdc576040517ff7e1ac0f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001860160209081526040808320938616835292905220548115610cbb57808201818111610c81576040517f93bc2ff100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8087166004830152851660248201526044810183905260648101849052608401610a0f565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600188016020908152604080832093881683529290522081905590505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610d1a91815260200190565b60405180910390a35050505050565b60008061045660017ff41bf6a5db26bffdfab174dcf66b31fbba8fdb7e3db040721ce1e62d61839ceb612ab4565b82818114610d91576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610d9f57506106ce565b73ffffffffffffffffffffffffffffffffffffffff86166000908152602089905260408120549080805b848110156110e4576000898983818110610de557610de5612b41565b9050602002016020810190610dfa919061279a565b905073ffffffffffffffffffffffffffffffffffffffff8116610e61576040517f754f425b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c166004820152602401610a0f565b6000888884818110610e7557610e75612b41565b90506020020135905080600014610fb357848101858111610ec2576040517fdedd834100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8095508273ffffffffffffffffffffffffffffffffffffffff168d73ffffffffffffffffffffffffffffffffffffffff1614610f4c57818f60000160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550610fb1565b86821115610fac576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e1660048201526024810188905260448101839052606401610a0f565b938101935b505b8173ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161101291815260200190565b60405180910390a384158015906110295750838514155b156110da57848603868110611090576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e1660048201526024810188905260448101879052606401610a0f565b8481018f60000160008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b5050600101610dc9565b508973ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614611124576111248b8a8c8561164b565b5050505050505050505050565b60008061045660017fc9ed16f33ab3a66c84bfd83099ccb2a8845871e2e1c1928f63797152f0fd54cd612ab4565b815473ffffffffffffffffffffffffffffffffffffffff828116911614610748576040517f2ef4875e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610a0f565b8483811415806111da5750808214155b15611211576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156112ab576112a388888381811061123157611231612b41565b9050602002016020810190611246919061279a565b85858481811061125857611258612b41565b9050602002013588888581811061127157611271612b41565b9050602002016020810190611286919061279a565b73ffffffffffffffffffffffffffffffffffffffff169190612239565b600101611214565b5050505050505050565b60008061045660017f93fe0ff7226b064a4a8f0b09910762afb4bc2441835792c021ffd78cd513011e612ab4565b8281811461131d576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060000361132b57506105b7565b73ffffffffffffffffffffffffffffffffffffffff86166000908152602088905260408120549080805b8481101561158c57600089898381811061137157611371612b41565b9050602002016020810190611386919061279a565b905073ffffffffffffffffffffffffffffffffffffffff81166113ed576040517f754f425b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c166004820152602401610a0f565b600088888481811061140157611401612b41565b9050602002013590508060001461151b5784810185811161144e576040517fdedd834100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8095508273ffffffffffffffffffffffffffffffffffffffff168d73ffffffffffffffffffffffffffffffffffffffff16146114b45773ffffffffffffffffffffffffffffffffffffffff8316600090815260208f905260409020805483019055611519565b86821115611514576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e1660048201526024810188905260448101839052606401610a0f565b938101935b505b8173ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161157a91815260200190565b60405180910390a35050600101611355565b50811580159061159c5750808214155b1561162e57818303838110611603576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b1660048201526024810185905260448101849052606401610a0f565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260208c90526040902090820190555b50505050505050505050565b60608160010180546108f190612aee565b73ffffffffffffffffffffffffffffffffffffffff82166116b0576040517ff7e1ac0f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001860160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811480159061171457508115155b15610cbb57818103818110610c81576040517f137ad6ab00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8087166004830152851660248201526044810183905260648101849052608401610a0f565b73ffffffffffffffffffffffffffffffffffffffff82166117e8576040517f754f425b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b80156118e35773ffffffffffffffffffffffffffffffffffffffff8316600090815260208590526040902054818103818110611876576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024810183905260448101849052606401610a0f565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16146118e05773ffffffffffffffffffffffffffffffffffffffff8086166000908152602088905260408082208490559186168152208054840190555b50505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a7c91815260200190565b61194f8787878787610a8a565b73ffffffffffffffffffffffffffffffffffffffff84163b156106ce576106ce8686868686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506122cb92505050565b8483811415806119bf5750808214155b156119f6576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156112ab576000868683818110611a1557611a15612b41565b9050602002016020810190611a2a919061279a565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f80ac58cd00000000000000000000000000000000000000000000000000000000600482015290915073ffffffffffffffffffffffffffffffffffffffff8216906301ffc9a790602401602060405180830381865afa158015611ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611adb9190612b70565b611b29576040517f986b9f1f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610a0f565b868683818110611b3b57611b3b612b41565b9050602002016020810190611b50919061279a565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e308b8b86818110611b7e57611b7e612b41565b9050602002016020810190611b93919061279a565b888887818110611ba557611ba5612b41565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b16815273ffffffffffffffffffffffffffffffffffffffff958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015611c2157600080fd5b505af1158015611c35573d6000803e3d6000fd5b50505050508060010190506119f9565b73ffffffffffffffffffffffffffffffffffffffff8716611c92576040517fa974697600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83421115611ccf576040517fea2b6f5800000000000000000000000000000000000000000000000000000000815260048101859052602401610a0f565b73ffffffffffffffffffffffffffffffffffffffff878116600081815260208b8152604080832080546001810190915581517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98185015280830195909552948b166060850152608084018a905260a084019490945260c08084018990528451808503909101815260e09093019093528151919092012090611d6e610adc565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015611e32573d6000803e3d6000fd5b5050506020604051035190508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611ea3576040517f822a64c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050506112ab87878761048a610980565b826107a4828483612c08565b611ecc86868686611783565b73ffffffffffffffffffffffffffffffffffffffff84163b156105b7576105b78586868686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506122cb92505050565b825473ffffffffffffffffffffffffffffffffffffffff9081169083168114611f99576040517f2ef4875e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146107a45783547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182178655604051908316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350505050565b8281811461207a576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156105b7576120e484848381811061209a5761209a612b41565b905060200201358787848181106120b3576120b3612b41565b90506020020160208101906120c8919061279a565b73ffffffffffffffffffffffffffffffffffffffff16906123d9565b60010161207d565b6000333214806120fc5750601836105b1561210657503390565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1633148061222857506040517f019a202800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301523360248301523060448301527f0000000000000000000000000000000000000000000000000000000000000000169063019a202890606401602060405180830381865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190612b70565b1561223257919050565b3391505090565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526122c690849061248f565b505050565b6040517f4fc35859000000000000000000000000000000000000000000000000000000008082529073ffffffffffffffffffffffffffffffffffffffff851690634fc3585990612325908990899088908890600401612d22565b6020604051808303816000875af1158015612344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123689190612d7d565b7fffffffff000000000000000000000000000000000000000000000000000000001614610ad5576040517f6d44973600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b8047101561241c576040517fcf47918100000000000000000000000000000000000000000000000000000000815247600482015260248101829052604401610a0f565b6000808373ffffffffffffffffffffffffffffffffffffffff168360405160006040518083038185875af1925050503d8060008114612477576040519150601f19603f3d011682016040523d82523d6000602084013e61247c565b606091505b5091509150816107a4576107a481612533565b600080602060008451602086016000885af1806124b2576040513d6000823e3d81fd5b50506000513d915081156124ca5780600114156124e4565b73ffffffffffffffffffffffffffffffffffffffff84163b155b156107a4576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610a0f565b8051156125435780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffff000000000000000000000000000000000000000000000000000000008116811461078a57600080fd5b6000602082840312156125b557600080fd5b813561072281612575565b6000815180845260005b818110156125e6576020818501810151868301820152016125ca565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061072260208301846125c0565b73ffffffffffffffffffffffffffffffffffffffff8116811461078a57600080fd5b6000806040838503121561266c57600080fd5b823561267781612637565b946020939093013593505050565b60008060006060848603121561269a57600080fd5b83356126a581612637565b925060208401356126b581612637565b929592945050506040919091013590565b60008083601f8401126126d857600080fd5b50813567ffffffffffffffff8111156126f057600080fd5b6020830191508360208260051b850101111561270b57600080fd5b9250929050565b60008060008060006060868803121561272a57600080fd5b853561273581612637565b9450602086013567ffffffffffffffff81111561275157600080fd5b61275d888289016126c6565b909550935050604086013567ffffffffffffffff81111561277d57600080fd5b612789888289016126c6565b969995985093965092949392505050565b6000602082840312156127ac57600080fd5b813561072281612637565b600080600080600080606087890312156127d057600080fd5b863567ffffffffffffffff8111156127e757600080fd5b6127f389828a016126c6565b909750955050602087013567ffffffffffffffff81111561281357600080fd5b61281f89828a016126c6565b909550935050604087013567ffffffffffffffff81111561283f57600080fd5b61284b89828a016126c6565b979a9699509497509295939492505050565b6000806000806040858703121561287357600080fd5b843567ffffffffffffffff81111561288a57600080fd5b612896878288016126c6565b909550935050602085013567ffffffffffffffff8111156128b657600080fd5b6128c2878288016126c6565b95989497509550505050565b60008083601f8401126128e057600080fd5b50813567ffffffffffffffff8111156128f857600080fd5b60208301915083602082850101111561270b57600080fd5b60008060008060006080868803121561292857600080fd5b853561293381612637565b9450602086013561294381612637565b935060408601359250606086013567ffffffffffffffff81111561296657600080fd5b612789888289016128ce565b600080600080600080600060e0888a03121561298d57600080fd5b873561299881612637565b965060208801356129a881612637565b95506040880135945060608801359350608088013560ff811681146129cc57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156129fc57600080fd5b8235612a0781612637565b91506020830135612a1781612637565b809150509250929050565b60008060208385031215612a3557600080fd5b823567ffffffffffffffff811115612a4c57600080fd5b612a58858286016128ce565b90969095509350505050565b60008060008060608587031215612a7a57600080fd5b8435612a8581612637565b935060208501359250604085013567ffffffffffffffff811115612aa857600080fd5b6128c2878288016128ce565b81810381811115610456577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600181811c90821680612b0257607f821691505b602082108103612b3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b8257600080fd5b8151801515811461072257600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f8211156122c657806000526020600020601f840160051c81016020851015612be85750805b601f840160051c820191505b81811015610ad55760008155600101612bf4565b67ffffffffffffffff831115612c2057612c20612b92565b612c3483612c2e8354612aee565b83612bc1565b6000601f841160018114612c865760008515612c505750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355610ad5565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b82811015612cd55786850135825560209485019460019092019101612cb5565b5086821015612d10577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b73ffffffffffffffffffffffffffffffffffffffff8516815273ffffffffffffffffffffffffffffffffffffffff84166020820152826040820152608060608201526000612d7360808301846125c0565b9695505050505050565b600060208284031215612d8f57600080fd5b81516107228161257556fea2646970667358221220ca839d033f97481444a0f1f911e0126c308e70abfb469f67f5e8c5a78ac5ad2c64736f6c634300081c003300000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000180000000000000000000000000316a472d084489cb6d4c66e5eb62ae3ada17521e0000000000000000000000000000000000000000000000000000000000000009436865636b6d61746500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005434845434b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000008ec6bfdb22690b9a57320f1661487bcc72fbfb7d00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000033b2e3c9fd0803ce8000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101c45760003560e01c80637ecebe00116100f9578063c3666c3611610097578063e0df5b6f11610071578063e0df5b6f146103f6578063eb79554914610409578063f2fde38b1461041c578063f7ba94bd1461042f57600080fd5b8063c3666c36146103bd578063d505accf146103d0578063dd62ed3e146103e357600080fd5b806395d89b41116100d357806395d89b411461037c578063a457c2d714610384578063a9059cbb14610397578063b88d4fde146103aa57600080fd5b80637ecebe001461034e57806388d695b2146103615780638da5cb5b1461037457600080fd5b80633644e515116101665780634885b254116101405780634885b254146102c6578063572b6c05146102d957806370a082311461032657806373c8a9581461033957600080fd5b80633644e515146102a357806339509351146102ab5780633c130d90146102be57600080fd5b806318160ddd116101a257806318160ddd1461021957806323b872dd1461022f5780632b4c9f1614610242578063313ce5671461028957600080fd5b806301ffc9a7146101c957806306fdde03146101f1578063095ea7b314610206575b600080fd5b6101dc6101d73660046125a3565b610442565b60405190151581526020015b60405180910390f35b6101f961045c565b6040516101e89190612624565b6101dc610214366004612659565b610473565b61022161049b565b6040519081526020016101e8565b6101dc61023d366004612685565b6104af565b7f000000000000000000000000316a472d084489cb6d4c66e5eb62ae3ada17521e5b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101e8565b6102916104da565b60405160ff90911681526020016101e8565b6102216104f1565b6101dc6102b9366004612659565b6104fb565b6101f961051a565b6101dc6102d4366004612712565b610527565b6101dc6102e736600461279a565b7f000000000000000000000000316a472d084489cb6d4c66e5eb62ae3ada17521e73ffffffffffffffffffffffffffffffffffffffff90811691161490565b61022161033436600461279a565b610558565b61034c6103473660046127b7565b610590565b005b61022161035c36600461279a565b6105bf565b6101dc61036f36600461285d565b6105cd565b6102646105fb565b6101f9610622565b6101dc610392366004612659565b610634565b6101dc6103a5366004612659565b610653565b6101dc6103b8366004612910565b610672565b61034c6103cb3660046127b7565b610697565b61034c6103de366004612972565b6106b0565b6102216103f13660046129e9565b6106d7565b61034c610404366004612a22565b610729565b6101dc610417366004612a64565b61074c565b61034c61042a36600461279a565b61076f565b61034c61043d36600461285d565b61078d565b6000610456826104506107aa565b906107d8565b92915050565b606061046e6104696108b2565b6108e0565b905090565b6000610492610480610976565b848461048a610980565b9291906109ae565b50600192915050565b600061046e6104a8610980565b6002015490565b60006104d06104bc610976565b8585856104c7610980565b93929190610a8a565b5060019392505050565b600061046e6104e76108b2565b6002015460ff1690565b600061046e610adc565b6000610492610508610976565b8484610512610980565b929190610b77565b606061046e610469610d29565b600061054c610534610976565b8787878787610541610980565b959493929190610d57565b50600195945050505050565b600061045682610566610980565b9073ffffffffffffffffffffffffffffffffffffffff166000908152602091909152604090205490565b6105a961059b610976565b6105a3611131565b9061115f565b6105b78686868686866111ca565b505050505050565b6000610456826105666112b5565b60006105f06105da610976565b868686866105e6610980565b94939291906112e3565b506001949350505050565b600061046e610608611131565b5473ffffffffffffffffffffffffffffffffffffffff1690565b606061046e61062f6108b2565b61163a565b6000610492610641610976565b848461064b610980565b92919061164b565b6000610492610660610976565b848461066a610980565b929190611783565b600061054c61067f610976565b878787878761068c610980565b959493929190611942565b6106a261059b610976565b6105b78686868686866119af565b6106ce878787878787876106c26112b5565b96959493929190611c45565b50505050505050565b600061072283836106e6610980565b919073ffffffffffffffffffffffffffffffffffffffff9182166000908152600193909301602090815260408085209290931684525290205490565b9392505050565b61073461059b610976565b6107488282610741610d29565b9190611eb4565b5050565b60006105f0610759610976565b86868686610765610980565b9493929190611ec0565b61078a61077a610976565b82610783611131565b9190611f2c565b50565b61079861059b610976565b6107a484848484612040565b50505050565b60008061045660017fca9d3e17f264b0f3984e2634e94adb37fa3e6a8103f06aeae6fa59e21c769f5e612ab4565b60007c01000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083160161082857506000610456565b7ffe003659000000000000000000000000000000000000000000000000000000007fffffffff0000000000000000000000000000000000000000000000000000000083160161087957506001610456565b507fffffffff00000000000000000000000000000000000000000000000000000000166000908152602091909152604090205460ff1690565b60008061045660017f335df4119bbb04f056b33eba33b826d3529129e458faf6daa9924b5a8f3b6a82612ab4565b60608160000180546108f190612aee565b80601f016020809104026020016040519081016040528092919081815260200182805461091d90612aee565b801561096a5780601f1061093f5761010080835404028352916020019161096a565b820191906000526020600020905b81548152906001019060200180831161094d57829003601f168201915b50505050509050919050565b600061046e6120ec565b60008061045660017f1da92899d3da68bf9787824388a37ea2bfa79780bcef91b9716c390eec8ecbef612ab4565b73ffffffffffffffffffffffffffffffffffffffff8216610a18576040517ff7e1ac0f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff838116600081815260018701602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a350505050565b8373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610ac957610ac98584868461164b565b610ad585848484611783565b5050505050565b6000467f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f610b0b6104696108b2565b80516020918201206040805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018290523060a082015260c0016040516020818303038152906040528051906020012091505090565b73ffffffffffffffffffffffffffffffffffffffff8216610bdc576040517ff7e1ac0f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001860160209081526040808320938616835292905220548115610cbb57808201818111610c81576040517f93bc2ff100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8087166004830152851660248201526044810183905260648101849052608401610a0f565b73ffffffffffffffffffffffffffffffffffffffff8086166000908152600188016020908152604080832093881683529290522081905590505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610d1a91815260200190565b60405180910390a35050505050565b60008061045660017ff41bf6a5db26bffdfab174dcf66b31fbba8fdb7e3db040721ce1e62d61839ceb612ab4565b82818114610d91576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003610d9f57506106ce565b73ffffffffffffffffffffffffffffffffffffffff86166000908152602089905260408120549080805b848110156110e4576000898983818110610de557610de5612b41565b9050602002016020810190610dfa919061279a565b905073ffffffffffffffffffffffffffffffffffffffff8116610e61576040517f754f425b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c166004820152602401610a0f565b6000888884818110610e7557610e75612b41565b90506020020135905080600014610fb357848101858111610ec2576040517fdedd834100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8095508273ffffffffffffffffffffffffffffffffffffffff168d73ffffffffffffffffffffffffffffffffffffffff1614610f4c57818f60000160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550610fb1565b86821115610fac576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e1660048201526024810188905260448101839052606401610a0f565b938101935b505b8173ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161101291815260200190565b60405180910390a384158015906110295750838514155b156110da57848603868110611090576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e1660048201526024810188905260448101879052606401610a0f565b8481018f60000160008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b5050600101610dc9565b508973ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614611124576111248b8a8c8561164b565b5050505050505050505050565b60008061045660017fc9ed16f33ab3a66c84bfd83099ccb2a8845871e2e1c1928f63797152f0fd54cd612ab4565b815473ffffffffffffffffffffffffffffffffffffffff828116911614610748576040517f2ef4875e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610a0f565b8483811415806111da5750808214155b15611211576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156112ab576112a388888381811061123157611231612b41565b9050602002016020810190611246919061279a565b85858481811061125857611258612b41565b9050602002013588888581811061127157611271612b41565b9050602002016020810190611286919061279a565b73ffffffffffffffffffffffffffffffffffffffff169190612239565b600101611214565b5050505050505050565b60008061045660017f93fe0ff7226b064a4a8f0b09910762afb4bc2441835792c021ffd78cd513011e612ab4565b8281811461131d576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060000361132b57506105b7565b73ffffffffffffffffffffffffffffffffffffffff86166000908152602088905260408120549080805b8481101561158c57600089898381811061137157611371612b41565b9050602002016020810190611386919061279a565b905073ffffffffffffffffffffffffffffffffffffffff81166113ed576040517f754f425b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c166004820152602401610a0f565b600088888481811061140157611401612b41565b9050602002013590508060001461151b5784810185811161144e576040517fdedd834100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8095508273ffffffffffffffffffffffffffffffffffffffff168d73ffffffffffffffffffffffffffffffffffffffff16146114b45773ffffffffffffffffffffffffffffffffffffffff8316600090815260208f905260409020805483019055611519565b86821115611514576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8e1660048201526024810188905260448101839052606401610a0f565b938101935b505b8173ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161157a91815260200190565b60405180910390a35050600101611355565b50811580159061159c5750808214155b1561162e57818303838110611603576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8b1660048201526024810185905260448101849052606401610a0f565b73ffffffffffffffffffffffffffffffffffffffff8a16600090815260208c90526040902090820190555b50505050505050505050565b60608160010180546108f190612aee565b73ffffffffffffffffffffffffffffffffffffffff82166116b0576040517ff7e1ac0f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b73ffffffffffffffffffffffffffffffffffffffff80841660009081526001860160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811480159061171457508115155b15610cbb57818103818110610c81576040517f137ad6ab00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8087166004830152851660248201526044810183905260648101849052608401610a0f565b73ffffffffffffffffffffffffffffffffffffffff82166117e8576040517f754f425b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b80156118e35773ffffffffffffffffffffffffffffffffffffffff8316600090815260208590526040902054818103818110611876576040517fe450d38c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861660048201526024810183905260448101849052606401610a0f565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16146118e05773ffffffffffffffffffffffffffffffffffffffff8086166000908152602088905260408082208490559186168152208054840190555b50505b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610a7c91815260200190565b61194f8787878787610a8a565b73ffffffffffffffffffffffffffffffffffffffff84163b156106ce576106ce8686868686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506122cb92505050565b8483811415806119bf5750808214155b156119f6576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156112ab576000868683818110611a1557611a15612b41565b9050602002016020810190611a2a919061279a565b6040517f01ffc9a70000000000000000000000000000000000000000000000000000000081527f80ac58cd00000000000000000000000000000000000000000000000000000000600482015290915073ffffffffffffffffffffffffffffffffffffffff8216906301ffc9a790602401602060405180830381865afa158015611ab7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611adb9190612b70565b611b29576040517f986b9f1f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401610a0f565b868683818110611b3b57611b3b612b41565b9050602002016020810190611b50919061279a565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e308b8b86818110611b7e57611b7e612b41565b9050602002016020810190611b93919061279a565b888887818110611ba557611ba5612b41565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e088901b16815273ffffffffffffffffffffffffffffffffffffffff958616600482015294909316602485015250602090910201356044820152606401600060405180830381600087803b158015611c2157600080fd5b505af1158015611c35573d6000803e3d6000fd5b50505050508060010190506119f9565b73ffffffffffffffffffffffffffffffffffffffff8716611c92576040517fa974697600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83421115611ccf576040517fea2b6f5800000000000000000000000000000000000000000000000000000000815260048101859052602401610a0f565b73ffffffffffffffffffffffffffffffffffffffff878116600081815260208b8152604080832080546001810190915581517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98185015280830195909552948b166060850152608084018a905260a084019490945260c08084018990528451808503909101815260e09093019093528151919092012090611d6e610adc565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015611e32573d6000803e3d6000fd5b5050506020604051035190508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611ea3576040517f822a64c800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050506112ab87878761048a610980565b826107a4828483612c08565b611ecc86868686611783565b73ffffffffffffffffffffffffffffffffffffffff84163b156105b7576105b78586868686868080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506122cb92505050565b825473ffffffffffffffffffffffffffffffffffffffff9081169083168114611f99576040517f2ef4875e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b8173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146107a45783547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8381169182178655604051908316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a350505050565b8281811461207a576040517f6582533600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156105b7576120e484848381811061209a5761209a612b41565b905060200201358787848181106120b3576120b3612b41565b90506020020160208101906120c8919061279a565b73ffffffffffffffffffffffffffffffffffffffff16906123d9565b60010161207d565b6000333214806120fc5750601836105b1561210657503390565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec36013560601c7f000000000000000000000000316a472d084489cb6d4c66e5eb62ae3ada17521e73ffffffffffffffffffffffffffffffffffffffff1633148061222857506040517f019a202800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301523360248301523060448301527f000000000000000000000000316a472d084489cb6d4c66e5eb62ae3ada17521e169063019a202890606401602060405180830381865afa158015612204573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122289190612b70565b1561223257919050565b3391505090565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526122c690849061248f565b505050565b6040517f4fc35859000000000000000000000000000000000000000000000000000000008082529073ffffffffffffffffffffffffffffffffffffffff851690634fc3585990612325908990899088908890600401612d22565b6020604051808303816000875af1158015612344573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123689190612d7d565b7fffffffff000000000000000000000000000000000000000000000000000000001614610ad5576040517f6d44973600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610a0f565b8047101561241c576040517fcf47918100000000000000000000000000000000000000000000000000000000815247600482015260248101829052604401610a0f565b6000808373ffffffffffffffffffffffffffffffffffffffff168360405160006040518083038185875af1925050503d8060008114612477576040519150601f19603f3d011682016040523d82523d6000602084013e61247c565b606091505b5091509150816107a4576107a481612533565b600080602060008451602086016000885af1806124b2576040513d6000823e3d81fd5b50506000513d915081156124ca5780600114156124e4565b73ffffffffffffffffffffffffffffffffffffffff84163b155b156107a4576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610a0f565b8051156125435780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffff000000000000000000000000000000000000000000000000000000008116811461078a57600080fd5b6000602082840312156125b557600080fd5b813561072281612575565b6000815180845260005b818110156125e6576020818501810151868301820152016125ca565b5060006020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b60208152600061072260208301846125c0565b73ffffffffffffffffffffffffffffffffffffffff8116811461078a57600080fd5b6000806040838503121561266c57600080fd5b823561267781612637565b946020939093013593505050565b60008060006060848603121561269a57600080fd5b83356126a581612637565b925060208401356126b581612637565b929592945050506040919091013590565b60008083601f8401126126d857600080fd5b50813567ffffffffffffffff8111156126f057600080fd5b6020830191508360208260051b850101111561270b57600080fd5b9250929050565b60008060008060006060868803121561272a57600080fd5b853561273581612637565b9450602086013567ffffffffffffffff81111561275157600080fd5b61275d888289016126c6565b909550935050604086013567ffffffffffffffff81111561277d57600080fd5b612789888289016126c6565b969995985093965092949392505050565b6000602082840312156127ac57600080fd5b813561072281612637565b600080600080600080606087890312156127d057600080fd5b863567ffffffffffffffff8111156127e757600080fd5b6127f389828a016126c6565b909750955050602087013567ffffffffffffffff81111561281357600080fd5b61281f89828a016126c6565b909550935050604087013567ffffffffffffffff81111561283f57600080fd5b61284b89828a016126c6565b979a9699509497509295939492505050565b6000806000806040858703121561287357600080fd5b843567ffffffffffffffff81111561288a57600080fd5b612896878288016126c6565b909550935050602085013567ffffffffffffffff8111156128b657600080fd5b6128c2878288016126c6565b95989497509550505050565b60008083601f8401126128e057600080fd5b50813567ffffffffffffffff8111156128f857600080fd5b60208301915083602082850101111561270b57600080fd5b60008060008060006080868803121561292857600080fd5b853561293381612637565b9450602086013561294381612637565b935060408601359250606086013567ffffffffffffffff81111561296657600080fd5b612789888289016128ce565b600080600080600080600060e0888a03121561298d57600080fd5b873561299881612637565b965060208801356129a881612637565b95506040880135945060608801359350608088013560ff811681146129cc57600080fd5b9699959850939692959460a0840135945060c09093013592915050565b600080604083850312156129fc57600080fd5b8235612a0781612637565b91506020830135612a1781612637565b809150509250929050565b60008060208385031215612a3557600080fd5b823567ffffffffffffffff811115612a4c57600080fd5b612a58858286016128ce565b90969095509350505050565b60008060008060608587031215612a7a57600080fd5b8435612a8581612637565b935060208501359250604085013567ffffffffffffffff811115612aa857600080fd5b6128c2878288016128ce565b81810381811115610456577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600181811c90821680612b0257607f821691505b602082108103612b3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600060208284031215612b8257600080fd5b8151801515811461072257600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b601f8211156122c657806000526020600020601f840160051c81016020851015612be85750805b601f840160051c820191505b81811015610ad55760008155600101612bf4565b67ffffffffffffffff831115612c2057612c20612b92565b612c3483612c2e8354612aee565b83612bc1565b6000601f841160018114612c865760008515612c505750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b178355610ad5565b6000838152602090207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0861690835b82811015612cd55786850135825560209485019460019092019101612cb5565b5086821015612d10577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b73ffffffffffffffffffffffffffffffffffffffff8516815273ffffffffffffffffffffffffffffffffffffffff84166020820152826040820152608060608201526000612d7360808301846125c0565b9695505050505050565b600060208284031215612d8f57600080fd5b81516107228161257556fea2646970667358221220ca839d033f97481444a0f1f911e0126c308e70abfb469f67f5e8c5a78ac5ad2c64736f6c634300081c0033

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

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