ETH Price: $2,939.36 (-0.48%)

Contract

0x4C9Dd12659B0Aed5D36512d268cbf7994566F973

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Deposit218396802025-07-15 14:00:39193 days ago1752588039IN
0x4C9Dd126...94566F973
0 ETH0.000000160.0010012
Deposit218396652025-07-15 14:00:24193 days ago1752588024IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00003618
Deposit218396642025-07-15 14:00:23193 days ago1752588023IN
0x4C9Dd126...94566F973
0 ETH0.000000160.0010011
Deposit218396612025-07-15 14:00:20193 days ago1752588020IN
0x4C9Dd126...94566F973
0 ETH0.000000030.000101
Deposit218396552025-07-15 14:00:14193 days ago1752588014IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00003314
Deposit218396552025-07-15 14:00:14193 days ago1752588014IN
0x4C9Dd126...94566F973
0 ETH0.000146711
Deposit218396542025-07-15 14:00:13193 days ago1752588013IN
0x4C9Dd126...94566F973
0 ETH0.000000030.00010098
Deposit218396532025-07-15 14:00:12193 days ago1752588012IN
0x4C9Dd126...94566F973
0 ETH0.000000030.00010098
Deposit218396532025-07-15 14:00:12193 days ago1752588012IN
0x4C9Dd126...94566F973
0 ETH0.000000030.00010098
Deposit218396512025-07-15 14:00:10193 days ago1752588010IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00003313
Deposit218396512025-07-15 14:00:10193 days ago1752588010IN
0x4C9Dd126...94566F973
0 ETH0.000014830.10100098
Deposit218396502025-07-15 14:00:09193 days ago1752588009IN
0x4C9Dd126...94566F973
0 ETH0.000000030.00010098
Deposit218396492025-07-15 14:00:08193 days ago1752588008IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00000398
Deposit218396492025-07-15 14:00:08193 days ago1752588008IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00003313
Deposit218356132025-07-15 12:52:52193 days ago1752583972IN
0x4C9Dd126...94566F973
0 ETH0.000000180.0010008
Deposit218354162025-07-15 12:49:35193 days ago1752583775IN
0x4C9Dd126...94566F973
0 ETH0.000000030.00010062
Deposit218343362025-07-15 12:31:35193 days ago1752582695IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00010043
Deposit218340902025-07-15 12:27:29193 days ago1752582449IN
0x4C9Dd126...94566F973
0 ETH0.000000180.0010005
Deposit218337582025-07-15 12:21:57193 days ago1752582117IN
0x4C9Dd126...94566F973
0 ETH0.000000020.0001004
Deposit218337582025-07-15 12:21:57193 days ago1752582117IN
0x4C9Dd126...94566F973
0 ETH0.000000180.0010006
Deposit218324812025-07-15 12:00:40193 days ago1752580840IN
0x4C9Dd126...94566F973
0 ETH0.000000170.00100042
Deposit218314992025-07-15 11:44:18193 days ago1752579858IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00010042
Deposit218286492025-07-15 10:56:48193 days ago1752577008IN
0x4C9Dd126...94566F973
0 ETH0.000000210.00120055
Deposit218272152025-07-15 10:32:54193 days ago1752575574IN
0x4C9Dd126...94566F973
0 ETH0.000000020.00010047
Deposit218227262025-07-15 9:18:05193 days ago1752571085IN
0x4C9Dd126...94566F973
0 ETH0.000001770.01000055
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x8e675D8E...9451ddE98 in Polygon Mainnet
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
ProjectSale

Compiler Version
v0.8.16+commit.07a7930e

Optimization Enabled:
Yes with 200 runs

Other Settings:
Default EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 30 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.0;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

    mapping(address => mapping(address => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual override returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual override returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `amount`.
     */
    function transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, amount);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `amount`.
     */
    function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, amount);
        _transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(address from, address to, uint256 amount) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(address owner, address spender, uint256 amount) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `amount`.
     *
     * Does not update the allowance amount in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Might emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 amount) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            require(currentAllowance >= amount, "ERC20: insufficient allowance");
            unchecked {
                _approve(owner, spender, currentAllowance - amount);
            }
        }
    }

    /**
     * @dev Hook that is called before any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * will be transferred to `to`.
     * - when `from` is zero, `amount` tokens will be minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Extension of {ERC20} that allows token holders to destroy both their own
 * tokens and those that they have an allowance for, in a way that can be
 * recognized off-chain (via event analysis).
 */
abstract contract ERC20Burnable is Context, ERC20 {
    /**
     * @dev Destroys `amount` tokens from the caller.
     *
     * See {ERC20-_burn}.
     */
    function burn(uint256 amount) public virtual {
        _burn(_msgSender(), amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, deducting from the caller's
     * allowance.
     *
     * See {ERC20-_burn} and {ERC20-allowance}.
     *
     * Requirements:
     *
     * - the caller must have allowance for ``accounts``'s tokens of at least
     * `amount`.
     */
    function burnFrom(address account, uint256 amount) public virtual {
        _spendAllowance(account, _msgSender(), amount);
        _burn(account, amount);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    /**
     * @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @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.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 15 of 30 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

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

import "./EIP712.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV // Deprecated in v4.8
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        }
    }

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

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

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

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

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

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32")
            mstore(0x1c, hash)
            message := keccak256(0x00, 0x3c)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, "\x19\x01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            data := keccak256(ptr, 0x42)
        }
    }

    /**
     * @dev Returns an Ethereum Signed Data with intended validator, created from a
     * `validator` and `data` according to the version 0 of EIP-191.
     *
     * See {recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x00", validator, data));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.8;

import "./ECDSA.sol";
import "../ShortStrings.sol";
import "../../interfaces/IERC5267.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 *
 * _Available since v3.4._
 *
 * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment
 */
abstract contract EIP712 is IERC5267 {
    using ShortStrings for *;

    bytes32 private constant _TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _cachedDomainSeparator;
    uint256 private immutable _cachedChainId;
    address private immutable _cachedThis;

    bytes32 private immutable _hashedName;
    bytes32 private immutable _hashedVersion;

    ShortString private immutable _name;
    ShortString private immutable _version;
    string private _nameFallback;
    string private _versionFallback;

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        _name = name.toShortStringWithFallback(_nameFallback);
        _version = version.toShortStringWithFallback(_versionFallback);
        _hashedName = keccak256(bytes(name));
        _hashedVersion = keccak256(bytes(version));

        _cachedChainId = block.chainid;
        _cachedDomainSeparator = _buildDomainSeparator();
        _cachedThis = address(this);
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _cachedThis && block.chainid == _cachedChainId) {
            return _cachedDomainSeparator;
        } else {
            return _buildDomainSeparator();
        }
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this)));
    }

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

    /**
     * @dev See {EIP-5267}.
     *
     * _Available since v4.9._
     */
    function eip712Domain()
        public
        view
        virtual
        override
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        return (
            hex"0f", // 01111
            _name.toStringWithFallback(_nameFallback),
            _version.toStringWithFallback(_versionFallback),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol)

pragma solidity ^0.8.8;

import "./StorageSlot.sol";

// | string  | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   |
// | length  | 0x                                                              BB |
type ShortString is bytes32;

/**
 * @dev This library provides functions to convert short memory strings
 * into a `ShortString` type that can be used as an immutable variable.
 *
 * Strings of arbitrary length can be optimized using this library if
 * they are short enough (up to 31 bytes) by packing them with their
 * length (1 byte) in a single EVM word (32 bytes). Additionally, a
 * fallback mechanism can be used for every other case.
 *
 * Usage example:
 *
 * ```solidity
 * contract Named {
 *     using ShortStrings for *;
 *
 *     ShortString private immutable _name;
 *     string private _nameFallback;
 *
 *     constructor(string memory contractName) {
 *         _name = contractName.toShortStringWithFallback(_nameFallback);
 *     }
 *
 *     function name() external view returns (string memory) {
 *         return _name.toStringWithFallback(_nameFallback);
 *     }
 * }
 * ```
 */
library ShortStrings {
    // Used as an identifier for strings longer than 31 bytes.
    bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF;

    error StringTooLong(string str);
    error InvalidShortString();

    /**
     * @dev Encode a string of at most 31 chars into a `ShortString`.
     *
     * This will trigger a `StringTooLong` error is the input string is too long.
     */
    function toShortString(string memory str) internal pure returns (ShortString) {
        bytes memory bstr = bytes(str);
        if (bstr.length > 31) {
            revert StringTooLong(str);
        }
        return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length));
    }

    /**
     * @dev Decode a `ShortString` back to a "normal" string.
     */
    function toString(ShortString sstr) internal pure returns (string memory) {
        uint256 len = byteLength(sstr);
        // using `new string(len)` would work locally but is not memory safe.
        string memory str = new string(32);
        /// @solidity memory-safe-assembly
        assembly {
            mstore(str, len)
            mstore(add(str, 0x20), sstr)
        }
        return str;
    }

    /**
     * @dev Return the length of a `ShortString`.
     */
    function byteLength(ShortString sstr) internal pure returns (uint256) {
        uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF;
        if (result > 31) {
            revert InvalidShortString();
        }
        return result;
    }

    /**
     * @dev Encode a string into a `ShortString`, or write it to storage if it is too long.
     */
    function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) {
        if (bytes(value).length < 32) {
            return toShortString(value);
        } else {
            StorageSlot.getStringSlot(store).value = value;
            return ShortString.wrap(_FALLBACK_SENTINEL);
        }
    }

    /**
     * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     */
    function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return toString(value);
        } else {
            return store;
        }
    }

    /**
     * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}.
     *
     * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of
     * actual characters as the UTF-8 encoding of a single character can span over multiple bytes.
     */
    function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) {
        if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) {
            return byteLength(value);
        } else {
            return bytes(store).length;
        }
    }
}

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

pragma solidity ^0.8.0;

/**
 * @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 ERC1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
 * _Available since v4.9 for `string`, `bytes`._
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 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) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := slot
        }
    }

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

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

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

    /**
     * @dev Returns an `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            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) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        /// @solidity memory-safe-assembly
        assembly {
            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) {
        /// @solidity memory-safe-assembly
        assembly {
            r.slot := store.slot
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

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

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

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

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

File 26 of 30 : EnumerableMap.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableMap.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableMap.js.

pragma solidity ^0.8.0;

import "./EnumerableSet.sol";

/**
 * @dev Library for managing an enumerable variant of Solidity's
 * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`]
 * type.
 *
 * Maps have the following properties:
 *
 * - Entries are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Entries are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableMap for EnumerableMap.UintToAddressMap;
 *
 *     // Declare a set state variable
 *     EnumerableMap.UintToAddressMap private myMap;
 * }
 * ```
 *
 * The following map types are supported:
 *
 * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0
 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0
 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0
 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0
 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableMap.
 * ====
 */
library EnumerableMap {
    using EnumerableSet for EnumerableSet.Bytes32Set;

    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Map type with
    // bytes32 keys and values.
    // The Map implementation uses private functions, and user-facing
    // implementations (such as Uint256ToAddressMap) are just wrappers around
    // the underlying Map.
    // This means that we can only create new EnumerableMaps for types that fit
    // in bytes32.

    struct Bytes32ToBytes32Map {
        // Storage of keys
        EnumerableSet.Bytes32Set _keys;
        mapping(bytes32 => bytes32) _values;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) {
        map._values[key] = value;
        return map._keys.add(key);
    }

    /**
     * @dev Removes a key-value pair from a map. O(1).
     *
     * Returns true if the key was removed from the map, that is if it was present.
     */
    function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) {
        delete map._values[key];
        return map._keys.remove(key);
    }

    /**
     * @dev Returns true if the key is in the map. O(1).
     */
    function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) {
        return map._keys.contains(key);
    }

    /**
     * @dev Returns the number of key-value pairs in the map. O(1).
     */
    function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) {
        return map._keys.length();
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) {
        bytes32 value = map._values[key];
        if (value == bytes32(0)) {
            return (contains(map, key), bytes32(0));
        } else {
            return (true, value);
        }
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key");
        return value;
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToBytes32Map storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (bytes32) {
        bytes32 value = map._values[key];
        require(value != 0 || contains(map, key), errorMessage);
        return value;
    }

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

    // UintToUintMap

    struct UintToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key)));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(UintToUintMap storage map, uint256 key, string memory errorMessage) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(key), errorMessage));
    }

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

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

        return result;
    }

    // UintToAddressMap

    struct UintToAddressMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) {
        return set(map._inner, bytes32(key), bytes32(uint256(uint160(value))));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(UintToAddressMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(key));
        return (success, address(uint160(uint256(value))));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(UintToAddressMap storage map, uint256 key) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        UintToAddressMap storage map,
        uint256 key,
        string memory errorMessage
    ) internal view returns (address) {
        return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage))));
    }

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

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

        return result;
    }

    // AddressToUintMap

    struct AddressToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) {
        return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(AddressToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key))));
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(AddressToUintMap storage map, address key) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key)))));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        AddressToUintMap storage map,
        address key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage));
    }

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

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

        return result;
    }

    // Bytes32ToUintMap

    struct Bytes32ToUintMap {
        Bytes32ToBytes32Map _inner;
    }

    /**
     * @dev Adds a key-value pair to a map, or updates the value for an existing
     * key. O(1).
     *
     * Returns true if the key was added to the map, that is if it was not
     * already present.
     */
    function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) {
        return set(map._inner, key, bytes32(value));
    }

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

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

    /**
     * @dev Returns the number of elements in the map. O(1).
     */
    function length(Bytes32ToUintMap storage map) internal view returns (uint256) {
        return length(map._inner);
    }

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

    /**
     * @dev Tries to returns the value associated with `key`. O(1).
     * Does not revert if `key` is not in the map.
     */
    function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) {
        (bool success, bytes32 value) = tryGet(map._inner, key);
        return (success, uint256(value));
    }

    /**
     * @dev Returns the value associated with `key`. O(1).
     *
     * Requirements:
     *
     * - `key` must be in the map.
     */
    function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) {
        return uint256(get(map._inner, key));
    }

    /**
     * @dev Same as {get}, with a custom error message when `key` is not in the map.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryGet}.
     */
    function get(
        Bytes32ToUintMap storage map,
        bytes32 key,
        string memory errorMessage
    ) internal view returns (uint256) {
        return uint256(get(map._inner, key, errorMessage));
    }

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

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

        return result;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

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

        return result;
    }
}

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.16;

interface IAllocationProvider {
    /**
     * @dev Returns allocation in USD of `_account`
     * @param _account Account to check
     * @return Allocation of `_account`
     */
    function allocationOf(address _account) external view returns (uint256);

    /**
     * @dev Returns total allocation in USD
     * @return Total allocation
     */
    function totalAllocation() external view returns (uint256);
}

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.16;

interface IProjectSale {
    /**
     * @dev Emitted when `_account` registers to sale
     */
    event Registered(address _account);

    /**
     * @dev Emitted when `_account` deposits `_amount` USD pegged coin
     */
    event Deposit(address _account, uint256 _amount);

    /**
     * @dev Register to sale
     *
     * Emits a {Registered} event.
     */
    function register(uint256 _timestamp, bytes memory _signature) external payable;

    /**
     * @dev Returns true if `_account` is registered
     * @param _account Account to check
     */
    function isRegistered(address _account) external view returns (bool);

    /**
     * @dev Returns amount of pegged tokens to be transferred to deposit `_amount` pegged token
     * @param _amount Amount of USD to deposit.
     * @return Amount of pegged tokens to be transferred to deposit `_amount` pegged token
     */
    function depositAmountWithFees(uint256 _amount) external view returns (uint256);

    /**
     * @dev Deposit USD
     * @param _amount Amount of USD to deposit.
     *
     * Emits a {Deposit} event.
     */
    function deposit(uint256 _amount, uint256 _timestamp, bytes memory _signature) external;

    /**
     * @dev Returns USD deposited by `_account`
     * @param _account Account to check
     */
    function depositedOf(address _account) external view returns (uint256);

    /**
     * @dev Returns depositable USD of `_account`
     * @param _account Account to check
     * @return Depositable USD of `_account`
     */
    function depositableOf(address _account) external view returns (uint256);

    /**
     * @dev Returns current sale value in terms of pegged token
     * @return uint256 current sale value
     */
    function totalSaleValue() external view returns (uint256);

    /**
     * @dev Returns total sale value cap in terms of pegged token
     * @return uint256 total sale value
     */
    function totalSaleValueCap() external view returns (uint256);

    /**
     * @notice Function to view the total public sale deposited of a user
     * @param _account is the address to check.
     * @return uint256 is the total public sale deposited.
     */
    function publicSaleDepositedOf(address _account) external view returns (uint256);

    /**
     * @dev Returns staking round allocation of user, excluding credit token allocation
     * @return uint256 staking round allocation of user
     */
    function stakingRoundAllocationOf(address _account) external view returns (uint256);

    function publicRoundAllocationOf(address _account) external view returns (uint256);

    function getSaleNom() external view returns (uint256);
}

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.16;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "contracts/allocation/IAllocationProvider.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableMap.sol";
import "./interface/IProjectSale.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "contracts/staking/IStakingAmounts.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";

/**
 * @title ProjectSale contract
 * @author Finceptor
 * @notice This contract is responsible for the sale of a project' tokens.
 * @dev Used with the following contracts:
 * - KYCProvider
 * - StakingAllocationProvider
 */
contract ProjectSale is IProjectSale, ReentrancyGuard, Pausable, AccessControl, EIP712 {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;
    using SafeERC20 for IERC20Metadata;
    using EnumerableMap for EnumerableMap.AddressToUintMap;
    using EnumerableSet for EnumerableSet.AddressSet;

    bytes32 public constant SIGNER = keccak256("SIGNER");
    string private constant SIGNING_DOMAIN = "ProjectSale";
    string private constant SIGNATURE_VERSION = "1";
    uint256 public max_signature_delay = 180;

    struct SaleDetails {
        /// @notice Total value of tokens to be sold
        uint256 totalSaleValueCap;
        /// @notice Price of the project token
        uint256 projectTokenPrice;
        /// @notice Amount of project tokens to be sold
        uint256 projectTokenAmount;
        /// @notice Address to claim deposited funds
        address saleClaimAddress;
        /// @notice Address to claim fees
        address feeClaimAddress;
        /// @notice Total current value of tokens sold
        uint256 totalSaleValue;
        /// @notice Total guaranteed sale value
        uint256 totalGuaranteedSaleValue;
        /// @notice Total current public sale value
        uint256 totalPublicSaleValue;
        /// @notice Pubic sale deposit cap per user
        uint256 publicSaleDepositCap;
        /// @notice The Staking Amounts holder contract
        IStakingAmounts stakingAmounts;
        /// @notice Minimum stake amount to participate in the public sale
        uint256 minStake;
        /// @notice The fee taken on registers
        uint256 registerFee;
        /// @notice The nominator of the allocation multiplier on public round
        uint8 nom;
        /// @notice The denominator of the allocation multiplier on public round
        uint8 denom;
    }

    struct SaleTimes {
        uint256 registerStart;
        uint256 registerEnd;
        uint256 stakingRoundStart;
        uint256 stakingRoundEnd;
        uint256 publicRoundStart;
        uint256 publicRoundEnd;
    }

    /**
     * @notice Sale status enum
     * @dev `NOT_FINALIZED` sale has not been finalized yet
     * @dev `FINALIZED` sale has been finalized
     */
    enum SaleStatus {
        NOT_FINALIZED,
        FINALIZED
    }

    /// @notice Sale status
    SaleStatus private _saleStatus;
    /// @notice Fee to be taken on public round deposits
    uint8 public FCFS_ROUND_FEE = 0;
    uint8 public PUBLIC_ROUND_FEE = 0;
    uint8 public STAKING_ROUND_FEE = 0;

    bool public isFcfs = false;

    /// @notice External provider for allocation
    address public allocationProvider;
    /// @notice Sale details
    SaleDetails public saleDetails;
    /// @notice Sale times
    SaleTimes public saleTimes;

    /// @notice USD token to be used for staking and public round deposits
    IERC20Metadata public immutable usdToken;

    /// @notice Address to claim deposited funds
    address public saleClaimAddress;
    /// @notice Address to claim fees
    address public feeClaimAddress;

    /// @notice Mapping of deposited values of addresses
    EnumerableMap.AddressToUintMap private _depositBalances;
    /// @notice Mapping of credit deposited values of addresses
    EnumerableMap.AddressToUintMap private _creditDepositBalances;
    /// @notice Public sale deposit balances
    mapping(address => uint256) private _publicSaleDepositBalances;

    /// @notice Mapping of registered addresses
    EnumerableSet.AddressSet private _participants;

    /**
     * @dev Throws if block time isn't between `registerStart` and `registerEnd`
     */
    modifier onlyDuringRegisteration() {
        require(
            block.timestamp >= saleTimes.registerStart,
            "ProjectSale: registration period has not started yet"
        );
        require(
            block.timestamp <= saleTimes.registerEnd,
            "ProjectSale: registration period has ended"
        );
        _;
    }

    /**
     * @notice Constructor for ProjectSale contract that initializes the sale.
     * @param _saleTimes Sale times
     * @param _allocationProvider External provider for allocation
     * @param _usdToken Address of USD token
     * @param _projectTokenPrice Price of project token
     * @param _projectTokenAmount Amount of project tokens to be sold
     * @param _totalSaleValueCap Total value of tokens to be sold
     * @param _saleClaimAddress Address to claim deposited funds
     * @param _feeClaimAddress Address to claim fees
     * @dev _projectTokenPrice * _projectTokenAmount == _totalSaleValueCap
     */
    constructor(
        SaleTimes memory _saleTimes,
        address _allocationProvider,
        address _usdToken,
        uint256 _projectTokenPrice,
        uint256 _projectTokenAmount,
        uint256 _totalSaleValueCap,
        address _saleClaimAddress,
        address _feeClaimAddress,
        address _stakingAmounts
    ) EIP712(SIGNING_DOMAIN, SIGNATURE_VERSION) {
        require(
            _saleTimes.registerStart < _saleTimes.registerEnd,
            "ProjectSale: registerStart must be before registerEnd"
        );
        require(
            _saleTimes.registerEnd < _saleTimes.stakingRoundStart,
            "ProjectSale: registerEnd must be before stakingRoundStart"
        );
        require(
            _saleTimes.stakingRoundStart < _saleTimes.stakingRoundEnd,
            "ProjectSale: stakingRoundStart must be before stakingRoundEnd"
        );
        require(
            _saleTimes.stakingRoundEnd < _saleTimes.publicRoundStart,
            "ProjectSale: stakingRoundEnd must be before publicRoundStart"
        );
        require(
            _saleTimes.publicRoundStart < _saleTimes.publicRoundEnd,
            "ProjectSale: publicRoundStart must be before publicRoundEnd"
        );
        require(
            (_projectTokenPrice * _projectTokenAmount) / (10 ** 18) == _totalSaleValueCap,
            "ProjectSale: invalid sale value"
        );
        require(
            address(_allocationProvider) != address(0),
            "ProjectSale: allocation provider cannot be zero address"
        );
        require(
            _stakingAmounts != address(0),
            "ProjectSale: staking amounts cannot be zero address"
        );

        // Sale Details
        saleTimes = _saleTimes;
        usdToken = IERC20Metadata(_usdToken);
        saleDetails.totalSaleValueCap = _totalSaleValueCap;
        saleDetails.projectTokenPrice = _projectTokenPrice;
        saleDetails.projectTokenAmount = _projectTokenAmount;
        saleDetails.publicSaleDepositCap = 15000 * (10 ** usdToken.decimals());
        saleDetails.stakingAmounts = IStakingAmounts(_stakingAmounts);
        _saleStatus = SaleStatus.NOT_FINALIZED;

        // External provider for allocation
        allocationProvider = _allocationProvider;

        feeClaimAddress = _feeClaimAddress;
        saleClaimAddress = _saleClaimAddress;
        saleDetails.nom = 10;
        saleDetails.denom = 40;

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(SIGNER, msg.sender);
    }

    function setSaleCap(uint256 _totalSaleValueCap) external onlyRole(DEFAULT_ADMIN_ROLE) {
        saleDetails.totalSaleValueCap = _totalSaleValueCap;
    }

    function setFees(
        uint8 _stakingRoundFee,
        uint8 _publicRoundFee,
        uint8 _fcsfRoundFee
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        STAKING_ROUND_FEE = _stakingRoundFee;
        PUBLIC_ROUND_FEE = _publicRoundFee;
        FCFS_ROUND_FEE = _fcsfRoundFee;
    }

    function setPublicRoundMultiplier(
        uint8 _nom,
        uint8 _denom
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        saleDetails.nom = _nom;
        saleDetails.denom = _denom;
    }

    function activateFCFS() external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(!isFcfs, "ProjectSale: FCFS is already active");
        require(
            saleTimes.publicRoundStart < block.timestamp,
            "ProjectSale: Public round has not started yet"
        );
        isFcfs = true;
    }

    function deactivateFCFS() external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(isFcfs, "ProjectSale: FCFS is already inactive");
        isFcfs = false;
    }

    function pause() external onlyRole(DEFAULT_ADMIN_ROLE) {
        _pause();
    }

    function unpause() external onlyRole(DEFAULT_ADMIN_ROLE) {
        _unpause();
    }

    function setRegisterFee(uint256 _registerFee) external onlyRole(DEFAULT_ADMIN_ROLE) {
        saleDetails.registerFee = _registerFee;
    }

    function setStakingAmounts(
        address _stakingAmounts,
        uint256 _minStake
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            address(_stakingAmounts) != address(0),
            "ProjectSale: staking amounts cannot be zero address"
        );
        saleDetails.stakingAmounts = IStakingAmounts(_stakingAmounts);
        saleDetails.minStake = _minStake;
    }

    function updateAllocationProvider(
        address _allocationProvider
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            _allocationProvider != address(0),
            "ProjectSale: allocation provider cannot be zero address"
        );
        allocationProvider = _allocationProvider;
    }

    /**
     * @notice Fuction to update sale times.
     * @dev Can only be called by the owner. And when sale is not finalized.
     * @param _saleTimes New sale times.
     */
    function updateTimes(SaleTimes memory _saleTimes) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_saleStatus == SaleStatus.NOT_FINALIZED, "ProjectSale: sale is finalized");
        require(
            _saleTimes.registerStart < _saleTimes.registerEnd &&
                _saleTimes.stakingRoundStart < _saleTimes.stakingRoundEnd &&
                _saleTimes.publicRoundStart < _saleTimes.publicRoundEnd,
            "ProjectSale: invalid time"
        );
        require(
            _saleTimes.registerEnd < _saleTimes.stakingRoundStart &&
                _saleTimes.stakingRoundEnd < _saleTimes.publicRoundStart,
            "ProjectSale: invalid time"
        );

        saleTimes = _saleTimes;
    }

    /**
     * @notice Fuction to update public sale deposit cap.
     * @dev Can only be called by the owner.
     * @param _publicSaleDepositCap New public sale deposit cap.
     */
    function setPublicSaleCap(uint256 _publicSaleDepositCap) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_publicSaleDepositCap > 0, "ProjectSale: cap cannot be zero");
        saleDetails.publicSaleDepositCap = _publicSaleDepositCap;
    }

    /**
     * @notice Fuction to update sale funds receiver address.
     * @dev Can only be called by the owner.
     * @param _newAddress New sale funds receiver address.
     */
    function updateSaleClaimAddress(address _newAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_newAddress != address(0), "ProjectSale: address cannot be zero");
        saleClaimAddress = _newAddress;
    }

    /**
     * @notice Fuction to update fee funds receiver address.
     * @dev Can only be called by the owner.
     * @param _newAddress New fee funds receiver address.
     */
    function updateFeeClaimAddress(address _newAddress) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(_newAddress != address(0), "ProjectSale: address cannot be zero");
        feeClaimAddress = _newAddress;
    }

    /**
     * @notice Registers the sender to the sale.
     * @dev Only allowed during registeration period.
     */
    function register(
        uint256 _timestamp,
        bytes memory _signature
    ) external payable override whenNotPaused onlyDuringRegisteration {
        require(
            block.timestamp <= _timestamp + max_signature_delay,
            "ProjectSalePro: signature expired"
        );
        require(verify(msg.sender, _timestamp, _signature), "ProjectSalePro: Invalid signature");
        require(!isRegistered(msg.sender), "ProjectSale: already registered");
        require(msg.value >= saleDetails.registerFee, "ProjectSale: insufficient fee");

        _participants.add(msg.sender);
        if (saleDetails.registerFee > 0) {
            (bool sent, ) = payable(feeClaimAddress).call{value: saleDetails.registerFee}("");
            require(sent, "Failed to send fee");
        }

        // Refund any excess Ether sent
        uint256 refundAmount = msg.value - saleDetails.registerFee;
        if (refundAmount > 0) {
            (bool refundSuccess, ) = msg.sender.call{value: refundAmount}("");
            require(refundSuccess, "Refund failed");
        }
        emit Registered(msg.sender);
    }

    /**
     * @notice Registers the given address to the sale.
     * @dev Only allowed before staking period start and by the contract owner.
     * @param _user Address to be registered.
     */
    function adminRegister(address _user) external onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused {
        require(!isRegistered(_user), "ProjectSale: already registered");
        _participants.add(_user);
        emit Registered(_user);
    }

    /**
     * @notice Registers the given addresses to the sale.
     * @dev Only allowed before staking period start and by the contract owner.
     * @param _users Addresses to be registered.
     */
    function batchAdminRegister(
        address[] memory _users
    ) external onlyRole(DEFAULT_ADMIN_ROLE) whenNotPaused {
        for (uint256 i = 0; i < _users.length; i++) {
            //require(!isRegistered(_users[i]), "ProjectSale: already registered");
            if (!isRegistered(_users[i])) {
                _participants.add(_users[i]);
                emit Registered(_users[i]);
            }
        }
    }

    /**
     * @notice Function to deposit tokens to the sale.
     * Deposits from whitelisted account are allowed
     * if it is during the staking round and the account is registered or
     * if it is during the public round.
     * @dev Also includes depositable amount from credit token,
     * `creditDeposit()` should be used first if user has credit.
     * @param _amount is the amount of tokens to be deposited
     */
    function deposit(
        uint256 _amount,
        uint256 _timestamp,
        bytes memory _signature
    ) external override nonReentrant whenNotPaused {
        require(
            block.timestamp <= _timestamp + max_signature_delay,
            "ProjectSalePro: signature expired"
        );
        require(verify(msg.sender, _timestamp, _signature), "ProjectSalePro: Invalid signature");
        require(_amount > 0, "ProjectSale: amount is zero");
        require(
            (isStakingRound() && isRegistered(msg.sender)) || isPublicRound(),
            "ProjectSale: not allowed to deposit"
        );
        uint256 depositableAmount = depositableOf(msg.sender);
        require(depositableAmount > 0, "ProjectSale: depositable amount is zero");

        uint256 fee;
        if (isPublicRound()) {
            require(
                _publicSaleDepositBalances[msg.sender] + _amount <=
                    saleDetails.publicSaleDepositCap,
                "ProjectSale: amount exceeds depositable amount"
            );
            if (_amount > depositableAmount) {
                _amount = depositableAmount;
            }
            if (isFcfs) {
                require(
                    saleDetails.stakingAmounts.stakedOf(msg.sender) >= saleDetails.minStake,
                    "ProjectSale: You do not have enough Staked FINC to participate in the Public Sale"
                );
                fee = (_amount * FCFS_ROUND_FEE) / 100;
            } else {
                fee = (_amount * PUBLIC_ROUND_FEE) / 100;
            }
            _publicSaleDepositBalances[msg.sender] += _amount;
            saleDetails.totalPublicSaleValue += _amount;
        } else {
            require(_amount <= depositableAmount, "ProjectSale: amount exceeds depositable amount");
            fee = (_amount * STAKING_ROUND_FEE) / 100;
        }

        (bool found, uint256 _deposited) = _depositBalances.tryGet(msg.sender);
        if (found) {
            _depositBalances.set(msg.sender, _deposited + _amount);
        } else {
            _depositBalances.set(msg.sender, _amount);
        }

        saleDetails.totalSaleValue += _amount;
        if (isStakingRound()) {
            saleDetails.totalGuaranteedSaleValue += _amount;
        }
        usdToken.safeTransferFrom(msg.sender, saleClaimAddress, _amount);
        if (fee > 0) {
            require(
                usdToken.balanceOf(msg.sender) >= fee,
                "ProjectSale: insufficient balance for fee"
            );
            usdToken.safeTransferFrom(msg.sender, feeClaimAddress, fee);
        }
        emit Deposit(msg.sender, _amount);
    }

    /**
     * @notice Function to get the total number of participants.
     * @return uint256 is the total number of participants.
     */
    function participantCount() external view returns (uint256) {
        return _participants.length();
    }

    /**
     * @notice Function to get the participant at the given index.
     * @param index is the index of the participant.
     * @return address is the participant.
     */
    function participantAt(uint256 index) external view returns (address) {
        require(index < _participants.length(), "ProjectSale: index out of bounds");
        return _participants.at(index);
    }

    /**
     * @notice Function to get participants between the given indexes.
     * @param start is the start index.
     * @param end is the end index.
     * @return address[] is the array of participants.
     */
    function participantsBetween(
        uint256 start,
        uint256 end
    ) external view returns (address[] memory) {
        require(start <= end, "ProjectSale: start > end");
        require(end <= _participants.length(), "ProjectSale: index out of bounds");
        address[] memory _participantsArray = new address[](end - start);
        for (uint256 i = start; i < end; i++) {
            _participantsArray[i - start] = _participants.at(i);
        }
        return _participantsArray;
    }

    /**
     * @notice Function to view the total sale value
     * @return uint256 is the total sale value.
     */
    function totalSaleValue() external view returns (uint256) {
        return saleDetails.totalSaleValue;
    }

    /**
     * @notice Function to view the total sale value cap
     * @return uint256 is the total sale value cap.
     */
    function totalSaleValueCap() external view returns (uint256) {
        return saleDetails.totalSaleValueCap;
    }

    /**
     * @notice Function to view the total public sale deposited of a user
     * @param _account is the address to check.
     * @return uint256 is the total public sale deposited.
     */
    function publicSaleDepositedOf(address _account) external view returns (uint256) {
        return _publicSaleDepositBalances[_account];
    }

    /**
     * @notice Function to view the final deposit value of any given amount with fees included.
     * @param _amount is the amount to check.
     * @return uint256 is the final deposit value with fees.
     */
    function depositAmountWithFees(uint256 _amount) external view override returns (uint256) {
        if (
            block.timestamp >= saleTimes.stakingRoundStart &&
            block.timestamp <= saleTimes.stakingRoundEnd
        ) {
            return (_amount * (100 + STAKING_ROUND_FEE)) / 100;
        }
        if (
            block.timestamp >= saleTimes.publicRoundStart &&
            block.timestamp <= saleTimes.publicRoundEnd
        ) {
            if (isFcfs) {
                return (_amount * (100 + FCFS_ROUND_FEE)) / 100;
            } else {
                return (_amount * (100 + PUBLIC_ROUND_FEE)) / 100;
            }
        }
        return _amount;
    }

    function getDepositAmounts(
        uint256 _start,
        uint256 _end
    ) external view returns (address[] memory, uint256[] memory) {
        if (_end > _depositBalances.length()) {
            _end = _depositBalances.length();
        }
        require(_start < _end, "Invalid start index");

        address[] memory addresses = new address[](_end - _start);
        uint256[] memory amounts = new uint256[](_end - _start);

        for (uint256 i = _start; i < _end; i++) {
            (address _address, uint256 _amount) = _depositBalances.at(i);
            addresses[i - _start] = _address;
            amounts[i - _start] = _amount;
        }

        return (addresses, amounts);
    }

    /**
     * @dev Returns true if time is between staking round
     * @return True if time is between staking round
     */
    function isStakingRound() public view returns (bool) {
        return
            block.timestamp >= saleTimes.stakingRoundStart &&
            block.timestamp <= saleTimes.stakingRoundEnd;
    }

    /**
     * @dev Returns true if time is between public round
     * @return True if time is between public round
     */
    function isPublicRound() public view returns (bool) {
        return
            block.timestamp >= saleTimes.publicRoundStart &&
            block.timestamp <= saleTimes.publicRoundEnd;
    }

    /**
     * @notice Function to see if an address is registered or not.
     * @param _account is the address to check.
     * @return bool is if the address is registered or not.
     */
    function isRegistered(address _account) public view override returns (bool) {
        return _participants.contains(_account);
    }

    /**
     * @notice Function to see total deposited amount of an address.
     * @param _account is the address to check.
     * @return uint256 is the total deposited amount.
     */
    function depositedOf(address _account) public view override returns (uint256) {
        (bool success, uint256 _deposited) = _depositBalances.tryGet(_account);
        if (success) {
            return _deposited;
        }
        return 0;
    }

    /**
     * @notice Function to see remaining depositable amount from direct and staking alloction of an address.
     * @dev If its the public round, every address gets the same amount.
     * @param _account is the address to check.
     * @return uint256 is the remaining depositable amount.
     */
    function depositableOf(address _account) public view override returns (uint256) {
        if (
            (isRegistered(_account) && isStakingRound()) ||
            (block.timestamp < saleTimes.stakingRoundStart)
        ) {
            return stakingRoundAllocationOf(_account);
        } else if (isPublicRound() && !isFcfs) {
            return publicRoundAllocationOf(_account);
        } else if (isPublicRound() && isFcfs) {
            return
                saleDetails.publicSaleDepositCap - _publicSaleDepositBalances[_account] <
                    saleDetails.totalSaleValueCap - saleDetails.totalSaleValue
                    ? saleDetails.publicSaleDepositCap - _publicSaleDepositBalances[_account]
                    : saleDetails.totalSaleValueCap - saleDetails.totalSaleValue;
        } else {
            return 0;
        }
    }

    /**
     * @notice Function to see remaining depositable amount from direct and staking alloction of an address.
     * @dev Only relevant in the staking round.
     * @param _account is the address to check.
     * @return uint256 is the remaining depositable amount.
     */
    function stakingRoundAllocationOf(address _account) public view override returns (uint256) {
        return
            IAllocationProvider(allocationProvider).allocationOf(_account) - depositedOf(_account);
    }

    function getSaleNom() public view returns (uint256) {
        if (saleDetails.nom != 10) {
            return saleDetails.nom;
        } else {
            // Calculte percentage left of sale
            uint256 percentageSold = (saleDetails.totalGuaranteedSaleValue * 100) /
                saleDetails.totalSaleValueCap;

            return 100 - percentageSold;
        }
    }

    function publicRoundAllocationOf(address _account) public view override returns (uint256) {
        uint256 alloc = (IAllocationProvider(allocationProvider).allocationOf(_account) *
            getSaleNom()) / saleDetails.denom;
        if (alloc > saleDetails.publicSaleDepositCap) {
            alloc = saleDetails.publicSaleDepositCap;
        }
        alloc = alloc - _publicSaleDepositBalances[_account];

        if (alloc > saleDetails.totalSaleValueCap - saleDetails.totalSaleValue) {
            alloc = saleDetails.totalSaleValueCap - saleDetails.totalSaleValue;
        }
        return alloc;
    }

    function verify(
        address _address,
        uint256 _timestamp,
        bytes memory _signature
    ) internal view returns (bool) {
        bytes32 digest = _hashTypedDataV4(
            keccak256(
                abi.encode(
                    keccak256("Verify(address address,uint256 timestamp)"),
                    _address,
                    _timestamp
                )
            )
        );
        address signer = ECDSA.recover(digest, _signature);
        return hasRole(SIGNER, signer);
    }
}

// SPDX-License-Identifier: BSD-3-Clause
pragma solidity 0.8.16;

/**
 * @dev Interface of Staking Amounts .
 */
interface IStakingAmounts {
    /**
     * @dev Returns the total staked amount for a user
     * @param _user Address of the user
     * @return uint256 Total staked amount for the user
     *
     */
    function stakedOf(address _user) external view returns (uint256);

    /**
     * @dev Returns the total staked amount for all users
     * @return uint256 Total staked amount for all users
     *
     */
    function totalStaked() external view returns (uint256);
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"components":[{"internalType":"uint256","name":"registerStart","type":"uint256"},{"internalType":"uint256","name":"registerEnd","type":"uint256"},{"internalType":"uint256","name":"stakingRoundStart","type":"uint256"},{"internalType":"uint256","name":"stakingRoundEnd","type":"uint256"},{"internalType":"uint256","name":"publicRoundStart","type":"uint256"},{"internalType":"uint256","name":"publicRoundEnd","type":"uint256"}],"internalType":"struct ProjectSale.SaleTimes","name":"_saleTimes","type":"tuple"},{"internalType":"address","name":"_allocationProvider","type":"address"},{"internalType":"address","name":"_usdToken","type":"address"},{"internalType":"uint256","name":"_projectTokenPrice","type":"uint256"},{"internalType":"uint256","name":"_projectTokenAmount","type":"uint256"},{"internalType":"uint256","name":"_totalSaleValueCap","type":"uint256"},{"internalType":"address","name":"_saleClaimAddress","type":"address"},{"internalType":"address","name":"_feeClaimAddress","type":"address"},{"internalType":"address","name":"_stakingAmounts","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_account","type":"address"}],"name":"Registered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FCFS_ROUND_FEE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PUBLIC_ROUND_FEE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIGNER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"STAKING_ROUND_FEE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activateFCFS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"}],"name":"adminRegister","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allocationProvider","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_users","type":"address[]"}],"name":"batchAdminRegister","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"deactivateFCFS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_timestamp","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"depositAmountWithFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"depositableOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"depositedOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeClaimAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"getDepositAmounts","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSaleNom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isFcfs","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isPublicRound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"isRegistered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isStakingRound","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"max_signature_delay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"participantAt","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"participantCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"participantsBetween","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"publicRoundAllocationOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"publicSaleDepositedOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timestamp","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"register","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"saleClaimAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"saleDetails","outputs":[{"internalType":"uint256","name":"totalSaleValueCap","type":"uint256"},{"internalType":"uint256","name":"projectTokenPrice","type":"uint256"},{"internalType":"uint256","name":"projectTokenAmount","type":"uint256"},{"internalType":"address","name":"saleClaimAddress","type":"address"},{"internalType":"address","name":"feeClaimAddress","type":"address"},{"internalType":"uint256","name":"totalSaleValue","type":"uint256"},{"internalType":"uint256","name":"totalGuaranteedSaleValue","type":"uint256"},{"internalType":"uint256","name":"totalPublicSaleValue","type":"uint256"},{"internalType":"uint256","name":"publicSaleDepositCap","type":"uint256"},{"internalType":"contract IStakingAmounts","name":"stakingAmounts","type":"address"},{"internalType":"uint256","name":"minStake","type":"uint256"},{"internalType":"uint256","name":"registerFee","type":"uint256"},{"internalType":"uint8","name":"nom","type":"uint8"},{"internalType":"uint8","name":"denom","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"saleTimes","outputs":[{"internalType":"uint256","name":"registerStart","type":"uint256"},{"internalType":"uint256","name":"registerEnd","type":"uint256"},{"internalType":"uint256","name":"stakingRoundStart","type":"uint256"},{"internalType":"uint256","name":"stakingRoundEnd","type":"uint256"},{"internalType":"uint256","name":"publicRoundStart","type":"uint256"},{"internalType":"uint256","name":"publicRoundEnd","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_stakingRoundFee","type":"uint8"},{"internalType":"uint8","name":"_publicRoundFee","type":"uint8"},{"internalType":"uint8","name":"_fcsfRoundFee","type":"uint8"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_nom","type":"uint8"},{"internalType":"uint8","name":"_denom","type":"uint8"}],"name":"setPublicRoundMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicSaleDepositCap","type":"uint256"}],"name":"setPublicSaleCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_registerFee","type":"uint256"}],"name":"setRegisterFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_totalSaleValueCap","type":"uint256"}],"name":"setSaleCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_stakingAmounts","type":"address"},{"internalType":"uint256","name":"_minStake","type":"uint256"}],"name":"setStakingAmounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"stakingRoundAllocationOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSaleValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSaleValueCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_allocationProvider","type":"address"}],"name":"updateAllocationProvider","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAddress","type":"address"}],"name":"updateFeeClaimAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAddress","type":"address"}],"name":"updateSaleClaimAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"registerStart","type":"uint256"},{"internalType":"uint256","name":"registerEnd","type":"uint256"},{"internalType":"uint256","name":"stakingRoundStart","type":"uint256"},{"internalType":"uint256","name":"stakingRoundEnd","type":"uint256"},{"internalType":"uint256","name":"publicRoundStart","type":"uint256"},{"internalType":"uint256","name":"publicRoundEnd","type":"uint256"}],"internalType":"struct ProjectSale.SaleTimes","name":"_saleTimes","type":"tuple"}],"name":"updateTimes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"usdToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

0x61018060405260b46005556006805464ffffffff00191690553480156200002557600080fd5b5060405162004bae38038062004bae833981016040819052620000489162000835565b604080518082018252600b81526a50726f6a65637453616c6560a81b60208083019190915282518084019093526001808452603160f81b848301526000819055805460ff19169055909190620000ac908390600390620025b1620006c7821b17901c565b61012052620000c9816004620006c7602090811b620025b117901c565b61014052815160208084019190912060e052815190820120610100524660a0526200015760e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c0526020890151895110620001e05760405162461bcd60e51b815260206004820152603560248201527f50726f6a65637453616c653a2072656769737465725374617274206d7573742060448201527f6265206265666f7265207265676973746572456e64000000000000000000000060648201526084015b60405180910390fd5b88604001518960200151106200025f5760405162461bcd60e51b815260206004820152603960248201527f50726f6a65637453616c653a207265676973746572456e64206d75737420626560448201527f206265666f7265207374616b696e67526f756e645374617274000000000000006064820152608401620001d7565b8860600151896040015110620002de5760405162461bcd60e51b815260206004820152603d60248201527f50726f6a65637453616c653a207374616b696e67526f756e645374617274206d60448201527f757374206265206265666f7265207374616b696e67526f756e64456e640000006064820152608401620001d7565b88608001518960600151106200035d5760405162461bcd60e51b815260206004820152603c60248201527f50726f6a65637453616c653a207374616b696e67526f756e64456e64206d757360448201527f74206265206265666f7265207075626c6963526f756e645374617274000000006064820152608401620001d7565b8860a00151896080015110620003dc5760405162461bcd60e51b815260206004820152603b60248201527f50726f6a65637453616c653a207075626c6963526f756e645374617274206d7560448201527f7374206265206265666f7265207075626c6963526f756e64456e6400000000006064820152608401620001d7565b83670de0b6b3a7640000620003f2878962000958565b620003fe91906200097a565b146200044d5760405162461bcd60e51b815260206004820152601f60248201527f50726f6a65637453616c653a20696e76616c69642073616c652076616c7565006044820152606401620001d7565b6001600160a01b038816620004cb5760405162461bcd60e51b815260206004820152603760248201527f50726f6a65637453616c653a20616c6c6f636174696f6e2070726f766964657260448201527f2063616e6e6f74206265207a65726f20616464726573730000000000000000006064820152608401620001d7565b6001600160a01b038116620005495760405162461bcd60e51b815260206004820152603360248201527f50726f6a65637453616c653a207374616b696e6720616d6f756e74732063616e60448201527f6e6f74206265207a65726f2061646472657373000000000000000000000000006064820152608401620001d7565b88516014556020808a01516015556040808b015160165560608b015160175560808b015160185560a08b01516019556001600160a01b038916610160819052600787905560088990556009889055815163313ce56760e01b81529151909263313ce56792600481810193918290030181865afa158015620005ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005f491906200099d565b6200060190600a62000ac6565b6200060f90613a9862000958565b600f55601080546001600160a01b03199081166001600160a01b03848116919091179092556006805464ffffffff01600160c81b031916650100000000008c851602179055601b80548216858416179055601a80549091169185169190911790556013805461ffff191661280a1790556200068c60003362000717565b620006b87f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca403362000717565b50505050505050505062000ca7565b6000602083511015620006e757620006df83620007bc565b905062000711565b82620006fe83620007ff60201b620025e21760201c565b906200070b908262000b66565b5060ff90505b92915050565b60008281526002602090815260408083206001600160a01b038516845290915290205460ff16620007b85760008281526002602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620007773390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b600080829050601f81511115620007ea578260405163305a27a960e01b8152600401620001d7919062000c32565b8051620007f78262000c82565b179392505050565b90565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b03811681146200083057600080fd5b919050565b6000806000806000806000806000898b036101c08112156200085657600080fd5b60c08112156200086557600080fd5b5060405160c081016001600160401b03811182821017156200088b576200088b62000802565b80604052508a51815260208b0151602082015260408b0151604082015260608b0151606082015260808b0151608082015260a08b015160a082015280995050620008d860c08b0162000818565b9750620008e860e08b0162000818565b96506101008a015195506101208a015194506101408a01519350620009116101608b0162000818565b9250620009226101808b0162000818565b9150620009336101a08b0162000818565b90509295985092959850929598565b634e487b7160e01b600052601160045260246000fd5b600081600019048311821515161562000975576200097562000942565b500290565b6000826200099857634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215620009b057600080fd5b815160ff81168114620009c257600080fd5b9392505050565b600181815b8085111562000a0a578160001904821115620009ee57620009ee62000942565b80851615620009fc57918102915b93841c9390800290620009ce565b509250929050565b60008262000a235750600162000711565b8162000a325750600062000711565b816001811462000a4b576002811462000a565762000a76565b600191505062000711565b60ff84111562000a6a5762000a6a62000942565b50506001821b62000711565b5060208310610133831016604e8410600b841016171562000a9b575081810a62000711565b62000aa78383620009c9565b806000190482111562000abe5762000abe62000942565b029392505050565b6000620009c260ff84168362000a12565b600181811c9082168062000aec57607f821691505b60208210810362000b0d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000b6157600081815260208120601f850160051c8101602086101562000b3c5750805b601f850160051c820191505b8181101562000b5d5782815560010162000b48565b5050505b505050565b81516001600160401b0381111562000b825762000b8262000802565b62000b9a8162000b93845462000ad7565b8462000b13565b602080601f83116001811462000bd2576000841562000bb95750858301515b600019600386901b1c1916600185901b17855562000b5d565b600085815260208120601f198616915b8281101562000c035788860151825594840194600190910190840162000be2565b508582101562000c225787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083528351808285015260005b8181101562000c615785810183015185820160400152820162000c43565b506000604082860101526040601f19601f8301168501019250505092915050565b8051602080830151919081101562000b0d5760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051613e8c62000d2260003960008181610b0d01528181611cc401528181611d0c0152611df0015260006117c3015260006117980152600061303c0152600061301401526000612f6f01526000612f9901526000612fc30152613e8c6000f3fe6080604052600436106103505760003560e01c80636f6a46b1116101c6578063aa8af221116100f7578063e230712811610095578063e729ccd91161006f578063e729ccd914610abb578063f6794fdb14610adb578063f897a22b14610afb578063fd8dd42c14610b2f57600080fd5b8063e230712814610a5b578063e31964f914610a7b578063e5daeecd14610a9b57600080fd5b8063d3d37a31116100d1578063d3d37a31146109e6578063d3dd9f7414610a06578063d547741f14610a1b578063d776965114610a3b57600080fd5b8063aa8af22114610991578063c090746f146109a6578063c3c5a547146109c657600080fd5b80638456cb591161016457806392be2ab81161013e57806392be2ab81461091b5780639c75bd301461093b578063a217fddf1461095c578063aa0b7db71461097157600080fd5b80638456cb59146108be57806384b0196e146108d357806391d14854146108fb57600080fd5b806375cd11ad116101a057806375cd11ad1461084b578063765718d71461086b57806377f405641461087e57806382cf4bc41461089e57600080fd5b80636f6a46b1146107f65780636fdcbef41461081657806374288f721461082b57600080fd5b80633474a4a6116102a057806351c6476b1161023e5780635c975abb116102185780635c975abb146107885780635c99d8cc146107a05780636da518de146107c05780636f12bbe7146107d657600080fd5b806351c6476b1461070957806352f230111461073f578063582abd121461075457600080fd5b806336568abe1161027a57806336568abe1461068c5780633f4ba83a146106ac5780634a36fdb4146106c15780634e36ee6a146106e857600080fd5b80633474a4a61461058257806334f95dd514610662578063362f04c01461067757600080fd5b80630b5d000c1161030d578063238041a9116102e7578063238041a9146104f2578063248a9ca3146105125780632f2ff15d146105425780632f91926e1461056257600080fd5b80630b5d000c1461048e578063128e1d2f146104bb5780631f5b9d3b146104dd57600080fd5b806301ffc9a7146103555780630232ebc11461038a57806302fcc998146103bb578063065bab2d1461041357806307d7d9231461044b5780630a276c7514610479575b600080fd5b34801561036157600080fd5b506103756103703660046134b1565b610b5d565b60405190151581526020015b60405180910390f35b34801561039657600080fd5b506006546103a990610100900460ff1681565b60405160ff9091168152602001610381565b3480156103c757600080fd5b506014546015546016546017546018546019546103e695949392919086565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610381565b34801561041f57600080fd5b5061043361042e3660046134db565b610b94565b6040516001600160a01b039091168152602001610381565b34801561045757600080fd5b5061046b6104663660046134db565b610bfe565b604051908152602001610381565b34801561048557600080fd5b5060075461046b565b34801561049a57600080fd5b506104ae6104a93660046134f4565b610cab565b604051610381919061355a565b3480156104c757600080fd5b506104db6104d6366004613584565b610e08565b005b3480156104e957600080fd5b50600c5461046b565b3480156104fe57600080fd5b5061046b61050d366004613584565b610e5c565b34801561051e57600080fd5b5061046b61052d3660046134db565b60009081526002602052604090206001015490565b34801561054e57600080fd5b506104db61055d36600461359f565b610ee7565b34801561056e57600080fd5b50601a54610433906001600160a01b031681565b34801561058e57600080fd5b50600754600854600954600a54600b54600c54600d54600e54600f546010546011546012546013546105e39c9b9a996001600160a01b0390811699811698979695941692919060ff808216916101009004168e565b604080519e8f5260208f019d909d529b8d019a909a526001600160a01b0398891660608d015296881660808c015260a08b019590955260c08a019390935260e089019190915261010088015290921661012086015261014085019190915261016084015260ff908116610180840152166101a08201526101c001610381565b34801561066e57600080fd5b5061046b610f11565b34801561068357600080fd5b5061046b610f5d565b34801561069857600080fd5b506104db6106a736600461359f565b610f6e565b3480156106b857600080fd5b506104db610fec565b3480156106cd57600080fd5b5060065461043390600160281b90046001600160a01b031681565b3480156106f457600080fd5b506006546103a9906301000000900460ff1681565b34801561071557600080fd5b5061046b610724366004613584565b6001600160a01b031660009081526022602052604090205490565b34801561074b57600080fd5b50610375611002565b34801561076057600080fd5b5061046b7f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4081565b34801561079457600080fd5b5060015460ff16610375565b3480156107ac57600080fd5b5061046b6107bb366004613584565b61101c565b3480156107cc57600080fd5b5061046b60055481565b3480156107e257600080fd5b506104db6107f1366004613584565b611046565b34801561080257600080fd5b506104db610811366004613612565b6110fc565b34801561082257600080fd5b506103756111e1565b34801561083757600080fd5b5061046b610846366004613584565b6111fb565b34801561085757600080fd5b50601b54610433906001600160a01b031681565b6104db61087936600461372f565b611300565b34801561088a57600080fd5b506104db610899366004613584565b611661565b3480156108aa57600080fd5b506104db6108b93660046134db565b611716565b3480156108ca57600080fd5b506104db611777565b3480156108df57600080fd5b506108e861178a565b60405161038197969594939291906137f6565b34801561090757600080fd5b5061037561091636600461359f565b611813565b34801561092757600080fd5b506104db6109363660046134db565b61183e565b34801561094757600080fd5b5060065461037590600160201b900460ff1681565b34801561096857600080fd5b5061046b600081565b34801561097d57600080fd5b506104db61098c366004613866565b61184f565b34801561099d57600080fd5b506104db611e62565b3480156109b257600080fd5b506104db6109c13660046138b6565b611ee5565b3480156109d257600080fd5b506103756109e1366004613584565b611f89565b3480156109f257600080fd5b506104db610a013660046134db565b611f96565b348015610a1257600080fd5b506104db611fa7565b348015610a2757600080fd5b506104db610a3636600461359f565b612096565b348015610a4757600080fd5b506104db610a563660046138e0565b6120bb565b348015610a6757600080fd5b5061046b610a76366004613584565b612237565b348015610a8757600080fd5b506104db610a9636600461396b565b61233e565b348015610aa757600080fd5b506006546103a99062010000900460ff1681565b348015610ac757600080fd5b506104db610ad6366004613584565b61236e565b348015610ae757600080fd5b506104db610af6366004613995565b6123c2565b348015610b0757600080fd5b506104337f000000000000000000000000000000000000000000000000000000000000000081565b348015610b3b57600080fd5b50610b4f610b4a3660046134f4565b61240f565b6040516103819291906139d8565b60006001600160e01b03198216637965db0b60e01b1480610b8e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000610ba060236125e5565b8210610bf35760405162461bcd60e51b815260206004820181905260248201527f50726f6a65637453616c653a20696e646578206f7574206f6620626f756e647360448201526064015b60405180910390fd5b610b8e6023836125ef565b6016546000904210801590610c1557506017544211155b15610c4b57600654606490610c34906301000000900460ff1682613a1c565b610c419060ff1684613a35565b610b8e9190613a54565b6018544210801590610c5f57506019544211155b15610ca757600654600160201b900460ff1615610c8e57600654606490610c3490610100900460ff1682613a1c565b600654606490610c349062010000900460ff1682613a1c565b5090565b606081831115610cfd5760405162461bcd60e51b815260206004820152601860248201527f50726f6a65637453616c653a207374617274203e20656e6400000000000000006044820152606401610bea565b610d0760236125e5565b821115610d565760405162461bcd60e51b815260206004820181905260248201527f50726f6a65637453616c653a20696e646578206f7574206f6620626f756e64736044820152606401610bea565b6000610d628484613a76565b67ffffffffffffffff811115610d7a57610d7a6135cb565b604051908082528060200260200182016040528015610da3578160200160208202803683370190505b509050835b83811015610e0057610dbb6023826125ef565b82610dc68784613a76565b81518110610dd657610dd6613a89565b6001600160a01b039092166020928302919091019091015280610df881613a9f565b915050610da8565b509392505050565b6000610e13816125fb565b6001600160a01b038216610e395760405162461bcd60e51b8152600401610bea90613ab8565b50601a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e678261101c565b60065460405163a4f82f2760e01b81526001600160a01b038581166004830152600160281b9092049091169063a4f82f2790602401602060405180830381865afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd9190613afb565b610b8e9190613a76565b600082815260026020526040902060010154610f02816125fb565b610f0c8383612605565b505050565b60135460009060ff16600a14610f2b575060135460ff1690565b600754600d5460009190610f40906064613a35565b610f4a9190613a54565b9050610f57816064613a76565b91505090565b6000610f6960236125e5565b905090565b6001600160a01b0381163314610fde5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bea565b610fe8828261268b565b5050565b6000610ff7816125fb565b610fff6126f2565b50565b6016546000904210801590610f6957505060175442111590565b6000808061102b601c85612744565b91509150811561103c579392505050565b5060009392505050565b6000611051816125fb565b6001600160a01b0382166110cd5760405162461bcd60e51b815260206004820152603760248201527f50726f6a65637453616c653a20616c6c6f636174696f6e2070726f766964657260448201527f2063616e6e6f74206265207a65726f20616464726573730000000000000000006064820152608401610bea565b50600680546001600160a01b03909216600160281b0265010000000000600160c81b0319909216919091179055565b6000611107816125fb565b61110f612769565b60005b8251811015610f0c5761113d83828151811061113057611130613a89565b6020026020010151611f89565b6111cf5761116e83828151811061115657611156613a89565b602002602001015160236127b190919063ffffffff16565b507f2d3734a8e47ac8316e500ac231c90a6e1848ca2285f40d07eaa52005e4b3a0e98382815181106111a2576111a2613a89565b60200260200101516040516111c691906001600160a01b0391909116815260200190565b60405180910390a15b806111d981613a9f565b915050611112565b6018546000904210801590610f6957505060195442111590565b600061120682611f89565b80156112155750611215611002565b80611221575060165442105b1561122f57610b8e82610e5c565b6112376111e1565b801561124d5750600654600160201b900460ff16155b1561125b57610b8e82612237565b6112636111e1565b80156112785750600654600160201b900460ff165b156112f357600c5460075461128d9190613a76565b6001600160a01b038316600090815260226020526040902054600f546112b39190613a76565b106112cd57600c546007546112c89190613a76565b610b8e565b6001600160a01b038216600090815260226020526040902054600f54610b8e9190613a76565b506000919050565b919050565b611308612769565b6014544210156113775760405162461bcd60e51b815260206004820152603460248201527f50726f6a65637453616c653a20726567697374726174696f6e20706572696f64604482015273081a185cc81b9bdd081cdd185c9d1959081e595d60621b6064820152608401610bea565b6015544211156113dc5760405162461bcd60e51b815260206004820152602a60248201527f50726f6a65637453616c653a20726567697374726174696f6e20706572696f64604482015269081a185cc8195b99195960b21b6064820152608401610bea565b6005546113e99083613b14565b4211156114085760405162461bcd60e51b8152600401610bea90613b27565b6114133383836127c6565b61142f5760405162461bcd60e51b8152600401610bea90613b68565b61143833611f89565b156114855760405162461bcd60e51b815260206004820152601f60248201527f50726f6a65637453616c653a20616c72656164792072656769737465726564006044820152606401610bea565b6012543410156114d75760405162461bcd60e51b815260206004820152601d60248201527f50726f6a65637453616c653a20696e73756666696369656e74206665650000006044820152606401610bea565b6114e26023336127b1565b506012541561158757601b546012546040516000926001600160a01b031691908381818185875af1925050503d806000811461153a576040519150601f19603f3d011682016040523d82523d6000602084013e61153f565b606091505b50509050806115855760405162461bcd60e51b81526020600482015260126024820152714661696c656420746f2073656e642066656560701b6044820152606401610bea565b505b6012546000906115979034613a76565b9050801561162957604051600090339083908381818185875af1925050503d80600081146115e1576040519150601f19603f3d011682016040523d82523d6000602084013e6115e6565b606091505b50509050806116275760405162461bcd60e51b815260206004820152600d60248201526c1499599d5b990819985a5b1959609a1b6044820152606401610bea565b505b6040513381527f2d3734a8e47ac8316e500ac231c90a6e1848ca2285f40d07eaa52005e4b3a0e99060200160405180910390a1505050565b600061166c816125fb565b611674612769565b61167d82611f89565b156116ca5760405162461bcd60e51b815260206004820152601f60248201527f50726f6a65637453616c653a20616c72656164792072656769737465726564006044820152606401610bea565b6116d56023836127b1565b506040516001600160a01b03831681527f2d3734a8e47ac8316e500ac231c90a6e1848ca2285f40d07eaa52005e4b3a0e99060200160405180910390a15050565b6000611721816125fb565b600082116117715760405162461bcd60e51b815260206004820152601f60248201527f50726f6a65637453616c653a206361702063616e6e6f74206265207a65726f006044820152606401610bea565b50600f55565b6000611782816125fb565b610fff612873565b6000606080828080836117be7f000000000000000000000000000000000000000000000000000000000000000060036128ae565b6117e97f000000000000000000000000000000000000000000000000000000000000000060046128ae565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611849816125fb565b50601255565b611857612952565b61185f612769565b60055461186c9083613b14565b42111561188b5760405162461bcd60e51b8152600401610bea90613b27565b6118963383836127c6565b6118b25760405162461bcd60e51b8152600401610bea90613b68565b600083116119025760405162461bcd60e51b815260206004820152601b60248201527f50726f6a65637453616c653a20616d6f756e74206973207a65726f00000000006044820152606401610bea565b61190a611002565b801561191a575061191a33611f89565b8061192857506119286111e1565b6119805760405162461bcd60e51b815260206004820152602360248201527f50726f6a65637453616c653a206e6f7420616c6c6f77656420746f206465706f6044820152621cda5d60ea1b6064820152608401610bea565b600061198b336111fb565b9050600081116119ed5760405162461bcd60e51b815260206004820152602760248201527f50726f6a65637453616c653a206465706f73697461626c6520616d6f756e74206044820152666973207a65726f60c81b6064820152608401610bea565b60006119f76111e1565b15611be657600f5433600090815260226020526040902054611a1a908790613b14565b1115611a385760405162461bcd60e51b8152600401610bea90613ba9565b81851115611a44578194505b600654600160201b900460ff1615611b7c5760115460105460405163af500ba360e01b81523360048201526001600160a01b039091169063af500ba390602401602060405180830381865afa158015611aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac59190613afb565b1015611b535760405162461bcd60e51b815260206004820152605160248201527f50726f6a65637453616c653a20596f7520646f206e6f74206861766520656e6f60448201527f756768205374616b65642046494e4320746f20706172746963697061746520696064820152706e20746865205075626c69632053616c6560781b608482015260a401610bea565b600654606490611b6b90610100900460ff1687613a35565b611b759190613a54565b9050611ba2565b600654606490611b959062010000900460ff1687613a35565b611b9f9190613a54565b90505b3360009081526022602052604081208054879290611bc1908490613b14565b9091555050600e8054869190600090611bdb908490613b14565b90915550611c2d9050565b81851115611c065760405162461bcd60e51b8152600401610bea90613ba9565b600654606490611c20906301000000900460ff1687613a35565b611c2a9190613a54565b90505b600080611c3b601c33612744565b915091508115611c6257611c5c33611c538984613b14565b601c91906129ab565b50611c70565b611c6e601c33896129ab565b505b8660076005016000828254611c859190613b14565b90915550611c939050611002565b15611cb3578660076006016000828254611cad9190613b14565b90915550505b601a54611cef906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116913391168a6129c9565b8215611e1b576040516370a0823160e01b815233600482015283907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611d5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7f9190613afb565b1015611ddf5760405162461bcd60e51b815260206004820152602960248201527f50726f6a65637453616c653a20696e73756666696369656e742062616c616e636044820152686520666f722066656560b81b6064820152608401610bea565b601b54611e1b906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811691339116866129c9565b60408051338152602081018990527fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c910160405180910390a150505050610f0c6001600055565b6000611e6d816125fb565b600654600160201b900460ff16611ed45760405162461bcd60e51b815260206004820152602560248201527f50726f6a65637453616c653a204643465320697320616c726561647920696e61604482015264637469766560d81b6064820152608401610bea565b506006805464ff0000000019169055565b6000611ef0816125fb565b6001600160a01b038316611f625760405162461bcd60e51b815260206004820152603360248201527f50726f6a65637453616c653a207374616b696e6720616d6f756e74732063616e6044820152726e6f74206265207a65726f206164647265737360681b6064820152608401610bea565b50601080546001600160a01b0319166001600160a01b039390931692909217909155601155565b6000610b8e602383612a29565b6000611fa1816125fb565b50600755565b6000611fb2816125fb565b600654600160201b900460ff16156120185760405162461bcd60e51b815260206004820152602360248201527f50726f6a65637453616c653a204643465320697320616c72656164792061637460448201526269766560e81b6064820152608401610bea565b601854421161207f5760405162461bcd60e51b815260206004820152602d60248201527f50726f6a65637453616c653a205075626c696320726f756e6420686173206e6f60448201526c1d081cdd185c9d1959081e595d609a1b6064820152608401610bea565b506006805464ff000000001916600160201b179055565b6000828152600260205260409020600101546120b1816125fb565b610f0c838361268b565b60006120c6816125fb565b600060065460ff1660018111156120df576120df613bf7565b1461212c5760405162461bcd60e51b815260206004820152601e60248201527f50726f6a65637453616c653a2073616c652069732066696e616c697a656400006044820152606401610bea565b60208201518251108015612147575081606001518260400151105b801561215a57508160a001518260800151105b6121a25760405162461bcd60e51b815260206004820152601960248201527850726f6a65637453616c653a20696e76616c69642074696d6560381b6044820152606401610bea565b816040015182602001511080156121c0575081608001518260600151105b6122085760405162461bcd60e51b815260206004820152601960248201527850726f6a65637453616c653a20696e76616c69642074696d6560381b6044820152606401610bea565b508051601455602081015160155560408101516016556060810151601755608081015160185560a00151601955565b6013546000908190610100900460ff1661224f610f11565b60065460405163a4f82f2760e01b81526001600160a01b038781166004830152600160281b9092049091169063a4f82f2790602401602060405180830381865afa1580156122a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c59190613afb565b6122cf9190613a35565b6122d99190613a54565b600f549091508111156122eb5750600f545b6001600160a01b03831660009081526022602052604090205461230e9082613a76565b600c5460075491925061232091613a76565b811115610b8e57600c546007546123379190613a76565b9392505050565b6000612349816125fb565b506013805460ff9283166101000261ffff199091169290931691909117919091179055565b6000612379816125fb565b6001600160a01b03821661239f5760405162461bcd60e51b8152600401610bea90613ab8565b50601b80546001600160a01b0319166001600160a01b0392909216919091179055565b60006123cd816125fb565b506006805463ffff00001916630100000060ff9586160262ff000019161762010000938516939093029290921761ff0019166101009190931602919091179055565b60608061241c601c612a4b565b8311156124305761242d601c612a4b565b92505b8284106124755760405162461bcd60e51b8152602060048201526013602482015272092dcecc2d8d2c840e6e8c2e4e840d2dcc8caf606b1b6044820152606401610bea565b60006124818585613a76565b67ffffffffffffffff811115612499576124996135cb565b6040519080825280602002602001820160405280156124c2578160200160208202803683370190505b50905060006124d18686613a76565b67ffffffffffffffff8111156124e9576124e96135cb565b604051908082528060200260200182016040528015612512578160200160208202803683370190505b509050855b858110156125a35760008061252d601c84612a56565b9092509050818561253e8b86613a76565b8151811061254e5761254e613a89565b6001600160a01b039092166020928302919091019091015280846125728b86613a76565b8151811061258257612582613a89565b6020026020010181815250505050808061259b90613a9f565b915050612517565b5090925090505b9250929050565b60006020835110156125cd576125c683612a65565b9050610b8e565b816125d88482613c95565b5060ff9050610b8e565b90565b6000610b8e825490565b60006123378383612aa3565b610fff8133612acd565b61260f8282611813565b610fe85760008281526002602090815260408083206001600160a01b03851684529091529020805460ff191660011790556126473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6126958282611813565b15610fe85760008281526002602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6126fa612b26565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080808061275c866001600160a01b038716612b6f565b9097909650945050505050565b60015460ff16156127af5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bea565b565b6000612337836001600160a01b038416612ba9565b604080517f555de473c0691dad2578fac0f47ae8a743879daacb183338392f580610fa666460208201526001600160a01b0385169181019190915260608101839052600090819061282f9060800160405160208183030381529060405280519060200120612bf8565b9050600061283d8285612c25565b90506128697f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4082611813565b9695505050505050565b61287b612769565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833612727565b606060ff83146128c1576125c683612c41565b8180546128cd90613c0d565b80601f01602080910402602001604051908101604052809291908181526020018280546128f990613c0d565b80156129465780601f1061291b57610100808354040283529160200191612946565b820191906000526020600020905b81548152906001019060200180831161292957829003601f168201915b50505050509050610b8e565b6002600054036129a45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610bea565b6002600055565b60006129c1846001600160a01b03851684612c80565b949350505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612a23908590612c9d565b50505050565b6001600160a01b03811660009081526001830160205260408120541515612337565b6000610b8e82612d72565b600080808061275c8686612d7d565b600080829050601f81511115612a90578260405163305a27a960e01b8152600401610bea9190613d55565b8051612a9b82613d68565b179392505050565b6000826000018281548110612aba57612aba613a89565b9060005260206000200154905092915050565b612ad78282611813565b610fe857612ae481612da8565b612aef836020612dba565b604051602001612b00929190613d8c565b60408051601f198184030181529082905262461bcd60e51b8252610bea91600401613d55565b60015460ff166127af5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bea565b6000818152600283016020526040812054819080612b9e57612b918585612f56565b9250600091506125aa9050565b6001925090506125aa565b6000818152600183016020526040812054612bf057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b8e565b506000610b8e565b6000610b8e612c05612f62565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612c34858561308d565b91509150610e00816130cf565b60606000612c4e83613219565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600082815260028401602052604081208290556129c18484613241565b6000612cf2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661324d9092919063ffffffff16565b9050805160001480612d13575080806020019051810190612d139190613e01565b610f0c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610bea565b6000610b8e826125e5565b60008080612d8b85856125ef565b600081815260029690960160205260409095205494959350505050565b6060610b8e6001600160a01b03831660145b60606000612dc9836002613a35565b612dd4906002613b14565b67ffffffffffffffff811115612dec57612dec6135cb565b6040519080825280601f01601f191660200182016040528015612e16576020820181803683370190505b509050600360fc1b81600081518110612e3157612e31613a89565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612e6057612e60613a89565b60200101906001600160f81b031916908160001a9053506000612e84846002613a35565b612e8f906001613b14565b90505b6001811115612f07576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612ec357612ec3613a89565b1a60f81b828281518110612ed957612ed9613a89565b60200101906001600160f81b031916908160001a90535060049490941c93612f0081613e23565b9050612e92565b5083156123375760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bea565b6000612337838361325c565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015612fbb57507f000000000000000000000000000000000000000000000000000000000000000046145b15612fe557507f000000000000000000000000000000000000000000000000000000000000000090565b610f69604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60008082516041036130c35760208301516040840151606085015160001a6130b787828585613274565b945094505050506125aa565b506000905060026125aa565b60008160048111156130e3576130e3613bf7565b036130eb5750565b60018160048111156130ff576130ff613bf7565b0361314c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610bea565b600281600481111561316057613160613bf7565b036131ad5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610bea565b60038160048111156131c1576131c1613bf7565b03610fff5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610bea565b600060ff8216601f811115610b8e57604051632cd44ac360e21b815260040160405180910390fd5b60006123378383612ba9565b60606129c18484600085613338565b60008181526001830160205260408120541515612337565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132ab575060009050600361332f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156132ff573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166133285760006001925092505061332f565b9150600090505b94509492505050565b6060824710156133995760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610bea565b600080866001600160a01b031685876040516133b59190613e3a565b60006040518083038185875af1925050503d80600081146133f2576040519150601f19603f3d011682016040523d82523d6000602084013e6133f7565b606091505b509150915061340887838387613413565b979650505050505050565b6060831561348257825160000361347b576001600160a01b0385163b61347b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610bea565b50816129c1565b6129c183838151156134975781518083602001fd5b8060405162461bcd60e51b8152600401610bea9190613d55565b6000602082840312156134c357600080fd5b81356001600160e01b03198116811461233757600080fd5b6000602082840312156134ed57600080fd5b5035919050565b6000806040838503121561350757600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b8381101561354f5781516001600160a01b03168752958201959082019060010161352a565b509495945050505050565b6020815260006123376020830184613516565b80356001600160a01b03811681146112fb57600080fd5b60006020828403121561359657600080fd5b6123378261356d565b600080604083850312156135b257600080fd5b823591506135c26020840161356d565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561360a5761360a6135cb565b604052919050565b6000602080838503121561362557600080fd5b823567ffffffffffffffff8082111561363d57600080fd5b818501915085601f83011261365157600080fd5b813581811115613663576136636135cb565b8060051b91506136748483016135e1565b818152918301840191848101908884111561368e57600080fd5b938501935b838510156136b3576136a48561356d565b82529385019390850190613693565b98975050505050505050565b600082601f8301126136d057600080fd5b813567ffffffffffffffff8111156136ea576136ea6135cb565b6136fd601f8201601f19166020016135e1565b81815284602083860101111561371257600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561374257600080fd5b82359150602083013567ffffffffffffffff81111561376057600080fd5b61376c858286016136bf565b9150509250929050565b60005b83811015613791578181015183820152602001613779565b50506000910152565b600081518084526137b2816020860160208601613776565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b8381101561354f578151875295820195908201906001016137da565b60ff60f81b8816815260e06020820152600061381560e083018961379a565b8281036040840152613827818961379a565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152905061385881856137c6565b9a9950505050505050505050565b60008060006060848603121561387b57600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156138a057600080fd5b6138ac868287016136bf565b9150509250925092565b600080604083850312156138c957600080fd5b6138d28361356d565b946020939093013593505050565b600060c082840312156138f257600080fd5b60405160c0810181811067ffffffffffffffff82111715613915576139156135cb565b8060405250823581526020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201528091505092915050565b803560ff811681146112fb57600080fd5b6000806040838503121561397e57600080fd5b6139878361395a565b91506135c26020840161395a565b6000806000606084860312156139aa57600080fd5b6139b38461395a565b92506139c16020850161395a565b91506139cf6040850161395a565b90509250925092565b6040815260006139eb6040830185613516565b82810360208401526139fd81856137c6565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60ff8181168382160190811115610b8e57610b8e613a06565b6000816000190483118215151615613a4f57613a4f613a06565b500290565b600082613a7157634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610b8e57610b8e613a06565b634e487b7160e01b600052603260045260246000fd5b600060018201613ab157613ab1613a06565b5060010190565b60208082526023908201527f50726f6a65637453616c653a20616464726573732063616e6e6f74206265207a60408201526265726f60e81b606082015260800190565b600060208284031215613b0d57600080fd5b5051919050565b80820180821115610b8e57610b8e613a06565b60208082526021908201527f50726f6a65637453616c6550726f3a207369676e6174757265206578706972656040820152601960fa1b606082015260800190565b60208082526021908201527f50726f6a65637453616c6550726f3a20496e76616c6964207369676e617475726040820152606560f81b606082015260800190565b6020808252602e908201527f50726f6a65637453616c653a20616d6f756e742065786365656473206465706f60408201526d1cda5d18589b1948185b5bdd5b9d60921b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b600181811c90821680613c2157607f821691505b602082108103613c4157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610f0c57600081815260208120601f850160051c81016020861015613c6e5750805b601f850160051c820191505b81811015613c8d57828155600101613c7a565b505050505050565b815167ffffffffffffffff811115613caf57613caf6135cb565b613cc381613cbd8454613c0d565b84613c47565b602080601f831160018114613cf85760008415613ce05750858301515b600019600386901b1c1916600185901b178555613c8d565b600085815260208120601f198616915b82811015613d2757888601518255948401946001909101908401613d08565b5085821015613d455787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b602081526000612337602083018461379a565b80516020808301519190811015613c415760001960209190910360031b1b16919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613dc4816017850160208801613776565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613df5816028840160208801613776565b01602801949350505050565b600060208284031215613e1357600080fd5b8151801515811461233757600080fd5b600081613e3257613e32613a06565b506000190190565b60008251613e4c818460208701613776565b919091019291505056fea2646970667358221220d2b0882e056d9591064cf2a1d8c13debdee3fc3c4d7c0a131cfebe77e6b9b55c64736f6c634300081000330000000000000000000000000000000000000000000000000000000068555b5000000000000000000000000000000000000000000000000000000000686138d0000000000000000000000000000000000000000000000000000000006863dbd00000000000000000000000000000000000000000000000000000000068652d500000000000000000000000000000000000000000000000000000000068653b600000000000000000000000000000000000000000000000000000000068659dd00000000000000000000000000a34fd87dc83fdf7bab3f95575bdc2d28389ff58000000000000000000000000078d782b760474a361dda0af3839290b0ef57ad600000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000001a784379d99db420000000000000000000000000000000000000000000000000000000000002e90edd0000000000000000000000000006f06d14897f7756ef476fedb51ddcb4ddb28299c0000000000000000000000006f06d14897f7756ef476fedb51ddcb4ddb28299c00000000000000000000000050f83e6b367f3f8fc68dfef3d5bc2cdf8ca56b94

Deployed Bytecode

0x6080604052600436106103505760003560e01c80636f6a46b1116101c6578063aa8af221116100f7578063e230712811610095578063e729ccd91161006f578063e729ccd914610abb578063f6794fdb14610adb578063f897a22b14610afb578063fd8dd42c14610b2f57600080fd5b8063e230712814610a5b578063e31964f914610a7b578063e5daeecd14610a9b57600080fd5b8063d3d37a31116100d1578063d3d37a31146109e6578063d3dd9f7414610a06578063d547741f14610a1b578063d776965114610a3b57600080fd5b8063aa8af22114610991578063c090746f146109a6578063c3c5a547146109c657600080fd5b80638456cb591161016457806392be2ab81161013e57806392be2ab81461091b5780639c75bd301461093b578063a217fddf1461095c578063aa0b7db71461097157600080fd5b80638456cb59146108be57806384b0196e146108d357806391d14854146108fb57600080fd5b806375cd11ad116101a057806375cd11ad1461084b578063765718d71461086b57806377f405641461087e57806382cf4bc41461089e57600080fd5b80636f6a46b1146107f65780636fdcbef41461081657806374288f721461082b57600080fd5b80633474a4a6116102a057806351c6476b1161023e5780635c975abb116102185780635c975abb146107885780635c99d8cc146107a05780636da518de146107c05780636f12bbe7146107d657600080fd5b806351c6476b1461070957806352f230111461073f578063582abd121461075457600080fd5b806336568abe1161027a57806336568abe1461068c5780633f4ba83a146106ac5780634a36fdb4146106c15780634e36ee6a146106e857600080fd5b80633474a4a61461058257806334f95dd514610662578063362f04c01461067757600080fd5b80630b5d000c1161030d578063238041a9116102e7578063238041a9146104f2578063248a9ca3146105125780632f2ff15d146105425780632f91926e1461056257600080fd5b80630b5d000c1461048e578063128e1d2f146104bb5780631f5b9d3b146104dd57600080fd5b806301ffc9a7146103555780630232ebc11461038a57806302fcc998146103bb578063065bab2d1461041357806307d7d9231461044b5780630a276c7514610479575b600080fd5b34801561036157600080fd5b506103756103703660046134b1565b610b5d565b60405190151581526020015b60405180910390f35b34801561039657600080fd5b506006546103a990610100900460ff1681565b60405160ff9091168152602001610381565b3480156103c757600080fd5b506014546015546016546017546018546019546103e695949392919086565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001610381565b34801561041f57600080fd5b5061043361042e3660046134db565b610b94565b6040516001600160a01b039091168152602001610381565b34801561045757600080fd5b5061046b6104663660046134db565b610bfe565b604051908152602001610381565b34801561048557600080fd5b5060075461046b565b34801561049a57600080fd5b506104ae6104a93660046134f4565b610cab565b604051610381919061355a565b3480156104c757600080fd5b506104db6104d6366004613584565b610e08565b005b3480156104e957600080fd5b50600c5461046b565b3480156104fe57600080fd5b5061046b61050d366004613584565b610e5c565b34801561051e57600080fd5b5061046b61052d3660046134db565b60009081526002602052604090206001015490565b34801561054e57600080fd5b506104db61055d36600461359f565b610ee7565b34801561056e57600080fd5b50601a54610433906001600160a01b031681565b34801561058e57600080fd5b50600754600854600954600a54600b54600c54600d54600e54600f546010546011546012546013546105e39c9b9a996001600160a01b0390811699811698979695941692919060ff808216916101009004168e565b604080519e8f5260208f019d909d529b8d019a909a526001600160a01b0398891660608d015296881660808c015260a08b019590955260c08a019390935260e089019190915261010088015290921661012086015261014085019190915261016084015260ff908116610180840152166101a08201526101c001610381565b34801561066e57600080fd5b5061046b610f11565b34801561068357600080fd5b5061046b610f5d565b34801561069857600080fd5b506104db6106a736600461359f565b610f6e565b3480156106b857600080fd5b506104db610fec565b3480156106cd57600080fd5b5060065461043390600160281b90046001600160a01b031681565b3480156106f457600080fd5b506006546103a9906301000000900460ff1681565b34801561071557600080fd5b5061046b610724366004613584565b6001600160a01b031660009081526022602052604090205490565b34801561074b57600080fd5b50610375611002565b34801561076057600080fd5b5061046b7f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4081565b34801561079457600080fd5b5060015460ff16610375565b3480156107ac57600080fd5b5061046b6107bb366004613584565b61101c565b3480156107cc57600080fd5b5061046b60055481565b3480156107e257600080fd5b506104db6107f1366004613584565b611046565b34801561080257600080fd5b506104db610811366004613612565b6110fc565b34801561082257600080fd5b506103756111e1565b34801561083757600080fd5b5061046b610846366004613584565b6111fb565b34801561085757600080fd5b50601b54610433906001600160a01b031681565b6104db61087936600461372f565b611300565b34801561088a57600080fd5b506104db610899366004613584565b611661565b3480156108aa57600080fd5b506104db6108b93660046134db565b611716565b3480156108ca57600080fd5b506104db611777565b3480156108df57600080fd5b506108e861178a565b60405161038197969594939291906137f6565b34801561090757600080fd5b5061037561091636600461359f565b611813565b34801561092757600080fd5b506104db6109363660046134db565b61183e565b34801561094757600080fd5b5060065461037590600160201b900460ff1681565b34801561096857600080fd5b5061046b600081565b34801561097d57600080fd5b506104db61098c366004613866565b61184f565b34801561099d57600080fd5b506104db611e62565b3480156109b257600080fd5b506104db6109c13660046138b6565b611ee5565b3480156109d257600080fd5b506103756109e1366004613584565b611f89565b3480156109f257600080fd5b506104db610a013660046134db565b611f96565b348015610a1257600080fd5b506104db611fa7565b348015610a2757600080fd5b506104db610a3636600461359f565b612096565b348015610a4757600080fd5b506104db610a563660046138e0565b6120bb565b348015610a6757600080fd5b5061046b610a76366004613584565b612237565b348015610a8757600080fd5b506104db610a9636600461396b565b61233e565b348015610aa757600080fd5b506006546103a99062010000900460ff1681565b348015610ac757600080fd5b506104db610ad6366004613584565b61236e565b348015610ae757600080fd5b506104db610af6366004613995565b6123c2565b348015610b0757600080fd5b506104337f000000000000000000000000078d782b760474a361dda0af3839290b0ef57ad681565b348015610b3b57600080fd5b50610b4f610b4a3660046134f4565b61240f565b6040516103819291906139d8565b60006001600160e01b03198216637965db0b60e01b1480610b8e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000610ba060236125e5565b8210610bf35760405162461bcd60e51b815260206004820181905260248201527f50726f6a65637453616c653a20696e646578206f7574206f6620626f756e647360448201526064015b60405180910390fd5b610b8e6023836125ef565b6016546000904210801590610c1557506017544211155b15610c4b57600654606490610c34906301000000900460ff1682613a1c565b610c419060ff1684613a35565b610b8e9190613a54565b6018544210801590610c5f57506019544211155b15610ca757600654600160201b900460ff1615610c8e57600654606490610c3490610100900460ff1682613a1c565b600654606490610c349062010000900460ff1682613a1c565b5090565b606081831115610cfd5760405162461bcd60e51b815260206004820152601860248201527f50726f6a65637453616c653a207374617274203e20656e6400000000000000006044820152606401610bea565b610d0760236125e5565b821115610d565760405162461bcd60e51b815260206004820181905260248201527f50726f6a65637453616c653a20696e646578206f7574206f6620626f756e64736044820152606401610bea565b6000610d628484613a76565b67ffffffffffffffff811115610d7a57610d7a6135cb565b604051908082528060200260200182016040528015610da3578160200160208202803683370190505b509050835b83811015610e0057610dbb6023826125ef565b82610dc68784613a76565b81518110610dd657610dd6613a89565b6001600160a01b039092166020928302919091019091015280610df881613a9f565b915050610da8565b509392505050565b6000610e13816125fb565b6001600160a01b038216610e395760405162461bcd60e51b8152600401610bea90613ab8565b50601a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e678261101c565b60065460405163a4f82f2760e01b81526001600160a01b038581166004830152600160281b9092049091169063a4f82f2790602401602060405180830381865afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd9190613afb565b610b8e9190613a76565b600082815260026020526040902060010154610f02816125fb565b610f0c8383612605565b505050565b60135460009060ff16600a14610f2b575060135460ff1690565b600754600d5460009190610f40906064613a35565b610f4a9190613a54565b9050610f57816064613a76565b91505090565b6000610f6960236125e5565b905090565b6001600160a01b0381163314610fde5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610bea565b610fe8828261268b565b5050565b6000610ff7816125fb565b610fff6126f2565b50565b6016546000904210801590610f6957505060175442111590565b6000808061102b601c85612744565b91509150811561103c579392505050565b5060009392505050565b6000611051816125fb565b6001600160a01b0382166110cd5760405162461bcd60e51b815260206004820152603760248201527f50726f6a65637453616c653a20616c6c6f636174696f6e2070726f766964657260448201527f2063616e6e6f74206265207a65726f20616464726573730000000000000000006064820152608401610bea565b50600680546001600160a01b03909216600160281b0265010000000000600160c81b0319909216919091179055565b6000611107816125fb565b61110f612769565b60005b8251811015610f0c5761113d83828151811061113057611130613a89565b6020026020010151611f89565b6111cf5761116e83828151811061115657611156613a89565b602002602001015160236127b190919063ffffffff16565b507f2d3734a8e47ac8316e500ac231c90a6e1848ca2285f40d07eaa52005e4b3a0e98382815181106111a2576111a2613a89565b60200260200101516040516111c691906001600160a01b0391909116815260200190565b60405180910390a15b806111d981613a9f565b915050611112565b6018546000904210801590610f6957505060195442111590565b600061120682611f89565b80156112155750611215611002565b80611221575060165442105b1561122f57610b8e82610e5c565b6112376111e1565b801561124d5750600654600160201b900460ff16155b1561125b57610b8e82612237565b6112636111e1565b80156112785750600654600160201b900460ff165b156112f357600c5460075461128d9190613a76565b6001600160a01b038316600090815260226020526040902054600f546112b39190613a76565b106112cd57600c546007546112c89190613a76565b610b8e565b6001600160a01b038216600090815260226020526040902054600f54610b8e9190613a76565b506000919050565b919050565b611308612769565b6014544210156113775760405162461bcd60e51b815260206004820152603460248201527f50726f6a65637453616c653a20726567697374726174696f6e20706572696f64604482015273081a185cc81b9bdd081cdd185c9d1959081e595d60621b6064820152608401610bea565b6015544211156113dc5760405162461bcd60e51b815260206004820152602a60248201527f50726f6a65637453616c653a20726567697374726174696f6e20706572696f64604482015269081a185cc8195b99195960b21b6064820152608401610bea565b6005546113e99083613b14565b4211156114085760405162461bcd60e51b8152600401610bea90613b27565b6114133383836127c6565b61142f5760405162461bcd60e51b8152600401610bea90613b68565b61143833611f89565b156114855760405162461bcd60e51b815260206004820152601f60248201527f50726f6a65637453616c653a20616c72656164792072656769737465726564006044820152606401610bea565b6012543410156114d75760405162461bcd60e51b815260206004820152601d60248201527f50726f6a65637453616c653a20696e73756666696369656e74206665650000006044820152606401610bea565b6114e26023336127b1565b506012541561158757601b546012546040516000926001600160a01b031691908381818185875af1925050503d806000811461153a576040519150601f19603f3d011682016040523d82523d6000602084013e61153f565b606091505b50509050806115855760405162461bcd60e51b81526020600482015260126024820152714661696c656420746f2073656e642066656560701b6044820152606401610bea565b505b6012546000906115979034613a76565b9050801561162957604051600090339083908381818185875af1925050503d80600081146115e1576040519150601f19603f3d011682016040523d82523d6000602084013e6115e6565b606091505b50509050806116275760405162461bcd60e51b815260206004820152600d60248201526c1499599d5b990819985a5b1959609a1b6044820152606401610bea565b505b6040513381527f2d3734a8e47ac8316e500ac231c90a6e1848ca2285f40d07eaa52005e4b3a0e99060200160405180910390a1505050565b600061166c816125fb565b611674612769565b61167d82611f89565b156116ca5760405162461bcd60e51b815260206004820152601f60248201527f50726f6a65637453616c653a20616c72656164792072656769737465726564006044820152606401610bea565b6116d56023836127b1565b506040516001600160a01b03831681527f2d3734a8e47ac8316e500ac231c90a6e1848ca2285f40d07eaa52005e4b3a0e99060200160405180910390a15050565b6000611721816125fb565b600082116117715760405162461bcd60e51b815260206004820152601f60248201527f50726f6a65637453616c653a206361702063616e6e6f74206265207a65726f006044820152606401610bea565b50600f55565b6000611782816125fb565b610fff612873565b6000606080828080836117be7f50726f6a65637453616c6500000000000000000000000000000000000000000b60036128ae565b6117e97f310000000000000000000000000000000000000000000000000000000000000160046128ae565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60009182526002602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611849816125fb565b50601255565b611857612952565b61185f612769565b60055461186c9083613b14565b42111561188b5760405162461bcd60e51b8152600401610bea90613b27565b6118963383836127c6565b6118b25760405162461bcd60e51b8152600401610bea90613b68565b600083116119025760405162461bcd60e51b815260206004820152601b60248201527f50726f6a65637453616c653a20616d6f756e74206973207a65726f00000000006044820152606401610bea565b61190a611002565b801561191a575061191a33611f89565b8061192857506119286111e1565b6119805760405162461bcd60e51b815260206004820152602360248201527f50726f6a65637453616c653a206e6f7420616c6c6f77656420746f206465706f6044820152621cda5d60ea1b6064820152608401610bea565b600061198b336111fb565b9050600081116119ed5760405162461bcd60e51b815260206004820152602760248201527f50726f6a65637453616c653a206465706f73697461626c6520616d6f756e74206044820152666973207a65726f60c81b6064820152608401610bea565b60006119f76111e1565b15611be657600f5433600090815260226020526040902054611a1a908790613b14565b1115611a385760405162461bcd60e51b8152600401610bea90613ba9565b81851115611a44578194505b600654600160201b900460ff1615611b7c5760115460105460405163af500ba360e01b81523360048201526001600160a01b039091169063af500ba390602401602060405180830381865afa158015611aa1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ac59190613afb565b1015611b535760405162461bcd60e51b815260206004820152605160248201527f50726f6a65637453616c653a20596f7520646f206e6f74206861766520656e6f60448201527f756768205374616b65642046494e4320746f20706172746963697061746520696064820152706e20746865205075626c69632053616c6560781b608482015260a401610bea565b600654606490611b6b90610100900460ff1687613a35565b611b759190613a54565b9050611ba2565b600654606490611b959062010000900460ff1687613a35565b611b9f9190613a54565b90505b3360009081526022602052604081208054879290611bc1908490613b14565b9091555050600e8054869190600090611bdb908490613b14565b90915550611c2d9050565b81851115611c065760405162461bcd60e51b8152600401610bea90613ba9565b600654606490611c20906301000000900460ff1687613a35565b611c2a9190613a54565b90505b600080611c3b601c33612744565b915091508115611c6257611c5c33611c538984613b14565b601c91906129ab565b50611c70565b611c6e601c33896129ab565b505b8660076005016000828254611c859190613b14565b90915550611c939050611002565b15611cb3578660076006016000828254611cad9190613b14565b90915550505b601a54611cef906001600160a01b037f000000000000000000000000078d782b760474a361dda0af3839290b0ef57ad68116913391168a6129c9565b8215611e1b576040516370a0823160e01b815233600482015283907f000000000000000000000000078d782b760474a361dda0af3839290b0ef57ad66001600160a01b0316906370a0823190602401602060405180830381865afa158015611d5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d7f9190613afb565b1015611ddf5760405162461bcd60e51b815260206004820152602960248201527f50726f6a65637453616c653a20696e73756666696369656e742062616c616e636044820152686520666f722066656560b81b6064820152608401610bea565b601b54611e1b906001600160a01b037f000000000000000000000000078d782b760474a361dda0af3839290b0ef57ad6811691339116866129c9565b60408051338152602081018990527fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c910160405180910390a150505050610f0c6001600055565b6000611e6d816125fb565b600654600160201b900460ff16611ed45760405162461bcd60e51b815260206004820152602560248201527f50726f6a65637453616c653a204643465320697320616c726561647920696e61604482015264637469766560d81b6064820152608401610bea565b506006805464ff0000000019169055565b6000611ef0816125fb565b6001600160a01b038316611f625760405162461bcd60e51b815260206004820152603360248201527f50726f6a65637453616c653a207374616b696e6720616d6f756e74732063616e6044820152726e6f74206265207a65726f206164647265737360681b6064820152608401610bea565b50601080546001600160a01b0319166001600160a01b039390931692909217909155601155565b6000610b8e602383612a29565b6000611fa1816125fb565b50600755565b6000611fb2816125fb565b600654600160201b900460ff16156120185760405162461bcd60e51b815260206004820152602360248201527f50726f6a65637453616c653a204643465320697320616c72656164792061637460448201526269766560e81b6064820152608401610bea565b601854421161207f5760405162461bcd60e51b815260206004820152602d60248201527f50726f6a65637453616c653a205075626c696320726f756e6420686173206e6f60448201526c1d081cdd185c9d1959081e595d609a1b6064820152608401610bea565b506006805464ff000000001916600160201b179055565b6000828152600260205260409020600101546120b1816125fb565b610f0c838361268b565b60006120c6816125fb565b600060065460ff1660018111156120df576120df613bf7565b1461212c5760405162461bcd60e51b815260206004820152601e60248201527f50726f6a65637453616c653a2073616c652069732066696e616c697a656400006044820152606401610bea565b60208201518251108015612147575081606001518260400151105b801561215a57508160a001518260800151105b6121a25760405162461bcd60e51b815260206004820152601960248201527850726f6a65637453616c653a20696e76616c69642074696d6560381b6044820152606401610bea565b816040015182602001511080156121c0575081608001518260600151105b6122085760405162461bcd60e51b815260206004820152601960248201527850726f6a65637453616c653a20696e76616c69642074696d6560381b6044820152606401610bea565b508051601455602081015160155560408101516016556060810151601755608081015160185560a00151601955565b6013546000908190610100900460ff1661224f610f11565b60065460405163a4f82f2760e01b81526001600160a01b038781166004830152600160281b9092049091169063a4f82f2790602401602060405180830381865afa1580156122a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122c59190613afb565b6122cf9190613a35565b6122d99190613a54565b600f549091508111156122eb5750600f545b6001600160a01b03831660009081526022602052604090205461230e9082613a76565b600c5460075491925061232091613a76565b811115610b8e57600c546007546123379190613a76565b9392505050565b6000612349816125fb565b506013805460ff9283166101000261ffff199091169290931691909117919091179055565b6000612379816125fb565b6001600160a01b03821661239f5760405162461bcd60e51b8152600401610bea90613ab8565b50601b80546001600160a01b0319166001600160a01b0392909216919091179055565b60006123cd816125fb565b506006805463ffff00001916630100000060ff9586160262ff000019161762010000938516939093029290921761ff0019166101009190931602919091179055565b60608061241c601c612a4b565b8311156124305761242d601c612a4b565b92505b8284106124755760405162461bcd60e51b8152602060048201526013602482015272092dcecc2d8d2c840e6e8c2e4e840d2dcc8caf606b1b6044820152606401610bea565b60006124818585613a76565b67ffffffffffffffff811115612499576124996135cb565b6040519080825280602002602001820160405280156124c2578160200160208202803683370190505b50905060006124d18686613a76565b67ffffffffffffffff8111156124e9576124e96135cb565b604051908082528060200260200182016040528015612512578160200160208202803683370190505b509050855b858110156125a35760008061252d601c84612a56565b9092509050818561253e8b86613a76565b8151811061254e5761254e613a89565b6001600160a01b039092166020928302919091019091015280846125728b86613a76565b8151811061258257612582613a89565b6020026020010181815250505050808061259b90613a9f565b915050612517565b5090925090505b9250929050565b60006020835110156125cd576125c683612a65565b9050610b8e565b816125d88482613c95565b5060ff9050610b8e565b90565b6000610b8e825490565b60006123378383612aa3565b610fff8133612acd565b61260f8282611813565b610fe85760008281526002602090815260408083206001600160a01b03851684529091529020805460ff191660011790556126473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6126958282611813565b15610fe85760008281526002602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6126fa612b26565b6001805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600080808061275c866001600160a01b038716612b6f565b9097909650945050505050565b60015460ff16156127af5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610bea565b565b6000612337836001600160a01b038416612ba9565b604080517f555de473c0691dad2578fac0f47ae8a743879daacb183338392f580610fa666460208201526001600160a01b0385169181019190915260608101839052600090819061282f9060800160405160208183030381529060405280519060200120612bf8565b9050600061283d8285612c25565b90506128697f2aeb38be3df14d720aeb10a2de6df09b0fb3cd5c5ec256283a22d4593110ca4082611813565b9695505050505050565b61287b612769565b6001805460ff1916811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833612727565b606060ff83146128c1576125c683612c41565b8180546128cd90613c0d565b80601f01602080910402602001604051908101604052809291908181526020018280546128f990613c0d565b80156129465780601f1061291b57610100808354040283529160200191612946565b820191906000526020600020905b81548152906001019060200180831161292957829003601f168201915b50505050509050610b8e565b6002600054036129a45760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610bea565b6002600055565b60006129c1846001600160a01b03851684612c80565b949350505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612a23908590612c9d565b50505050565b6001600160a01b03811660009081526001830160205260408120541515612337565b6000610b8e82612d72565b600080808061275c8686612d7d565b600080829050601f81511115612a90578260405163305a27a960e01b8152600401610bea9190613d55565b8051612a9b82613d68565b179392505050565b6000826000018281548110612aba57612aba613a89565b9060005260206000200154905092915050565b612ad78282611813565b610fe857612ae481612da8565b612aef836020612dba565b604051602001612b00929190613d8c565b60408051601f198184030181529082905262461bcd60e51b8252610bea91600401613d55565b60015460ff166127af5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610bea565b6000818152600283016020526040812054819080612b9e57612b918585612f56565b9250600091506125aa9050565b6001925090506125aa565b6000818152600183016020526040812054612bf057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b8e565b506000610b8e565b6000610b8e612c05612f62565b8360405161190160f01b8152600281019290925260228201526042902090565b6000806000612c34858561308d565b91509150610e00816130cf565b60606000612c4e83613219565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b600082815260028401602052604081208290556129c18484613241565b6000612cf2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661324d9092919063ffffffff16565b9050805160001480612d13575080806020019051810190612d139190613e01565b610f0c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610bea565b6000610b8e826125e5565b60008080612d8b85856125ef565b600081815260029690960160205260409095205494959350505050565b6060610b8e6001600160a01b03831660145b60606000612dc9836002613a35565b612dd4906002613b14565b67ffffffffffffffff811115612dec57612dec6135cb565b6040519080825280601f01601f191660200182016040528015612e16576020820181803683370190505b509050600360fc1b81600081518110612e3157612e31613a89565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612e6057612e60613a89565b60200101906001600160f81b031916908160001a9053506000612e84846002613a35565b612e8f906001613b14565b90505b6001811115612f07576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612ec357612ec3613a89565b1a60f81b828281518110612ed957612ed9613a89565b60200101906001600160f81b031916908160001a90535060049490941c93612f0081613e23565b9050612e92565b5083156123375760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610bea565b6000612337838361325c565b6000306001600160a01b037f0000000000000000000000004c9dd12659b0aed5d36512d268cbf7994566f97316148015612fbb57507f000000000000000000000000000000000000000000000000000000000000008246145b15612fe557507f7a0d55a0a9b0a869d4e7a808465efae774bffc71f94de0b47f3f8275aed91f2b90565b610f69604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0ef68212635000780554926d488a6167ab6c47637a572d6e637a83a54d54a7e5918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60008082516041036130c35760208301516040840151606085015160001a6130b787828585613274565b945094505050506125aa565b506000905060026125aa565b60008160048111156130e3576130e3613bf7565b036130eb5750565b60018160048111156130ff576130ff613bf7565b0361314c5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610bea565b600281600481111561316057613160613bf7565b036131ad5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610bea565b60038160048111156131c1576131c1613bf7565b03610fff5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610bea565b600060ff8216601f811115610b8e57604051632cd44ac360e21b815260040160405180910390fd5b60006123378383612ba9565b60606129c18484600085613338565b60008181526001830160205260408120541515612337565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156132ab575060009050600361332f565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156132ff573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166133285760006001925092505061332f565b9150600090505b94509492505050565b6060824710156133995760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610bea565b600080866001600160a01b031685876040516133b59190613e3a565b60006040518083038185875af1925050503d80600081146133f2576040519150601f19603f3d011682016040523d82523d6000602084013e6133f7565b606091505b509150915061340887838387613413565b979650505050505050565b6060831561348257825160000361347b576001600160a01b0385163b61347b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610bea565b50816129c1565b6129c183838151156134975781518083602001fd5b8060405162461bcd60e51b8152600401610bea9190613d55565b6000602082840312156134c357600080fd5b81356001600160e01b03198116811461233757600080fd5b6000602082840312156134ed57600080fd5b5035919050565b6000806040838503121561350757600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b8381101561354f5781516001600160a01b03168752958201959082019060010161352a565b509495945050505050565b6020815260006123376020830184613516565b80356001600160a01b03811681146112fb57600080fd5b60006020828403121561359657600080fd5b6123378261356d565b600080604083850312156135b257600080fd5b823591506135c26020840161356d565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561360a5761360a6135cb565b604052919050565b6000602080838503121561362557600080fd5b823567ffffffffffffffff8082111561363d57600080fd5b818501915085601f83011261365157600080fd5b813581811115613663576136636135cb565b8060051b91506136748483016135e1565b818152918301840191848101908884111561368e57600080fd5b938501935b838510156136b3576136a48561356d565b82529385019390850190613693565b98975050505050505050565b600082601f8301126136d057600080fd5b813567ffffffffffffffff8111156136ea576136ea6135cb565b6136fd601f8201601f19166020016135e1565b81815284602083860101111561371257600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561374257600080fd5b82359150602083013567ffffffffffffffff81111561376057600080fd5b61376c858286016136bf565b9150509250929050565b60005b83811015613791578181015183820152602001613779565b50506000910152565b600081518084526137b2816020860160208601613776565b601f01601f19169290920160200192915050565b600081518084526020808501945080840160005b8381101561354f578151875295820195908201906001016137da565b60ff60f81b8816815260e06020820152600061381560e083018961379a565b8281036040840152613827818961379a565b606084018890526001600160a01b038716608085015260a0840186905283810360c0850152905061385881856137c6565b9a9950505050505050505050565b60008060006060848603121561387b57600080fd5b8335925060208401359150604084013567ffffffffffffffff8111156138a057600080fd5b6138ac868287016136bf565b9150509250925092565b600080604083850312156138c957600080fd5b6138d28361356d565b946020939093013593505050565b600060c082840312156138f257600080fd5b60405160c0810181811067ffffffffffffffff82111715613915576139156135cb565b8060405250823581526020830135602082015260408301356040820152606083013560608201526080830135608082015260a083013560a08201528091505092915050565b803560ff811681146112fb57600080fd5b6000806040838503121561397e57600080fd5b6139878361395a565b91506135c26020840161395a565b6000806000606084860312156139aa57600080fd5b6139b38461395a565b92506139c16020850161395a565b91506139cf6040850161395a565b90509250925092565b6040815260006139eb6040830185613516565b82810360208401526139fd81856137c6565b95945050505050565b634e487b7160e01b600052601160045260246000fd5b60ff8181168382160190811115610b8e57610b8e613a06565b6000816000190483118215151615613a4f57613a4f613a06565b500290565b600082613a7157634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115610b8e57610b8e613a06565b634e487b7160e01b600052603260045260246000fd5b600060018201613ab157613ab1613a06565b5060010190565b60208082526023908201527f50726f6a65637453616c653a20616464726573732063616e6e6f74206265207a60408201526265726f60e81b606082015260800190565b600060208284031215613b0d57600080fd5b5051919050565b80820180821115610b8e57610b8e613a06565b60208082526021908201527f50726f6a65637453616c6550726f3a207369676e6174757265206578706972656040820152601960fa1b606082015260800190565b60208082526021908201527f50726f6a65637453616c6550726f3a20496e76616c6964207369676e617475726040820152606560f81b606082015260800190565b6020808252602e908201527f50726f6a65637453616c653a20616d6f756e742065786365656473206465706f60408201526d1cda5d18589b1948185b5bdd5b9d60921b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b600181811c90821680613c2157607f821691505b602082108103613c4157634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610f0c57600081815260208120601f850160051c81016020861015613c6e5750805b601f850160051c820191505b81811015613c8d57828155600101613c7a565b505050505050565b815167ffffffffffffffff811115613caf57613caf6135cb565b613cc381613cbd8454613c0d565b84613c47565b602080601f831160018114613cf85760008415613ce05750858301515b600019600386901b1c1916600185901b178555613c8d565b600085815260208120601f198616915b82811015613d2757888601518255948401946001909101908401613d08565b5085821015613d455787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b602081526000612337602083018461379a565b80516020808301519190811015613c415760001960209190910360031b1b16919050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613dc4816017850160208801613776565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613df5816028840160208801613776565b01602801949350505050565b600060208284031215613e1357600080fd5b8151801515811461233757600080fd5b600081613e3257613e32613a06565b506000190190565b60008251613e4c818460208701613776565b919091019291505056fea2646970667358221220d2b0882e056d9591064cf2a1d8c13debdee3fc3c4d7c0a131cfebe77e6b9b55c64736f6c63430008100033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.