ETH Price: $3,075.72 (+3.53%)
Gas: 11 Gwei

Token

Ciel (CIEL)
 

Overview

Max Total Supply

1,000,000,000 CIEL

Holders

606 (0.00%)

Market

Onchain Market Cap

$0.00

Circulating Supply Market Cap

-

Other Info

Token Contract (WITH 18 Decimals)

Balance
3,448.020550440561408158 CIEL

Value
$0.00
0xE3B5C23184a50a3413F51e02eFffe5284f211e5D
Loading...
Loading
Loading...
Loading
Loading...
Loading

OVERVIEW

Ciel Protocol: A DeFi platform offering flexible, multi-asset rewards, with user-driven selection of ERC20 tokens. Focused on off-chain revenue models and a growing ecosystem of dApps.

# Exchange Pair Price  24H Volume % Volume

Contract Source Code Verified (Exact Match)

Contract Name:
Ciel

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 35 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControlUpgradeable.sol";
import "../utils/ContextUpgradeable.sol";
import "../utils/StringsUpgradeable.sol";
import "../utils/introspection/ERC165Upgradeable.sol";
import "../proxy/utils/Initializable.sol";

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

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    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(IAccessControlUpgradeable).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 ",
                        StringsUpgradeable.toHexString(account),
                        " is missing role ",
                        StringsUpgradeable.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());
        }
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 2 of 35 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControlUpgradeable {
    /**
     * @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 3 of 35 : OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    function __Ownable_init() internal onlyInitializing {
        __Ownable_init_unchained();
    }

    function __Ownable_init_unchained() internal onlyInitializing {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 4 of 35 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.1) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     * @custom:oz-retyped-from bool
     */
    uint8 private _initialized;

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint8 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized < type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint8) {
        return _initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _initializing;
    }
}

File 5 of 35 : ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ReentrancyGuardUpgradeable is Initializable {
    // 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;

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        _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 This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[49] private __gap;
}

File 6 of 35 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

File 7 of 35 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 8 of 35 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165Upgradeable.sol";
import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 9 of 35 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

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

File 10 of 35 : MathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/MathUpgradeable.sol";

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

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

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

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

File 12 of 35 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 13 of 35 : MinimalForwarder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (metatx/MinimalForwarder.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Simple minimal forwarder to be used together with an ERC2771 compatible contract. See {ERC2771Context}.
 *
 * MinimalForwarder is mainly meant for testing, as it is missing features to be a good production-ready forwarder. This
 * contract does not intend to have all the properties that are needed for a sound forwarding system. A fully
 * functioning forwarding system with good properties requires more complexity. We suggest you look at other projects
 * such as the GSN which do have the goal of building a system like that.
 */
contract MinimalForwarder is EIP712 {
    using ECDSA for bytes32;

    struct ForwardRequest {
        address from;
        address to;
        uint256 value;
        uint256 gas;
        uint256 nonce;
        bytes data;
    }

    bytes32 private constant _TYPEHASH =
        keccak256("ForwardRequest(address from,address to,uint256 value,uint256 gas,uint256 nonce,bytes data)");

    mapping(address => uint256) private _nonces;

    constructor() EIP712("MinimalForwarder", "0.0.1") {}

    function getNonce(address from) public view returns (uint256) {
        return _nonces[from];
    }

    function verify(ForwardRequest calldata req, bytes calldata signature) public view returns (bool) {
        address signer = _hashTypedDataV4(
            keccak256(abi.encode(_TYPEHASH, req.from, req.to, req.value, req.gas, req.nonce, keccak256(req.data)))
        ).recover(signature);
        return _nonces[req.from] == req.nonce && signer == req.from;
    }

    function execute(ForwardRequest calldata req, bytes calldata signature)
        public
        payable
        returns (bool, bytes memory)
    {
        require(verify(req, signature), "MinimalForwarder: signature does not match request");
        _nonces[req.from] = req.nonce + 1;

        (bool success, bytes memory returndata) = req.to.call{gas: req.gas, value: req.value}(
            abi.encodePacked(req.data, req.from)
        );

        // Validate that the relayer has sent enough gas for the call.
        // See https://ronan.eth.limo/blog/ethereum-gas-dangers/
        if (gasleft() <= req.gas / 63) {
            // We explicitly trigger invalid opcode to consume all gas and bubble-up the effects, since
            // neither revert or assert consume all gas since Solidity 0.8.0
            // https://docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require
            /// @solidity memory-safe-assembly
            assembly {
                invalid()
            }
        }

        return (success, returndata);
    }
}

File 14 of 35 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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;
    }
}

File 15 of 35 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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].
 *
 * 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}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * 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 value {ERC20} uses, unless this function is
     * 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 {}
}

File 16 of 35 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

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

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

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

File 17 of 35 : IERC20Metadata.sol
// 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);
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 19 of 35 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 21 of 35 : Counters.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

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

pragma solidity ^0.8.0;

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

import "./EIP712.sol";

File 23 of 35 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

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

pragma solidity ^0.8.0;

import "./ECDSA.sol";

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

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

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

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

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

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

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

File 25 of 35 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

File 27 of 35 : Ciel.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;

import "./interface/IUniswapV2Factory.sol";
import "./interface/IUniswapV2Router02.sol";
import "./Ham.sol";
import "./interface/IHam.sol";
import "./interface/IOnRye.sol";
import "./ERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/metatx/MinimalForwarder.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract Ciel is
    ERC20Permit,
    Ownable,
    ReentrancyGuard
{
    using Address for address;

    IUniswapV2Router02 public uniswapV2Router;
    address public uniswapV2Pair;

    IHam public ham;

    IOnRye public onRye;

    address public marketingWallet;

    address public developmentWallet;

    uint256 public constant DECIMALS = 10**18;

    uint256 public constant TOTAL_SUPPLY = 10**9 * DECIMALS; //1 billion

    mapping(address => bool) public rewardAddressWhitelisted;

    mapping(address => bool) public _canTransferBeforeOpenTrading;

    mapping(address => bool) public maxWalletExcluded;

    uint256 public maxWalletAmount;

    // Sell Fees
    uint256 private _sellLiquidityFee; // 9%
    uint256 private _sellMarketingFee; // 0%
    uint256 private _sellDevelopmentFee; // 0%
    uint256 private _sellRewardsToHolders; // 5%

    // Sell Total
    uint256 private sellTotalFee;

    //buy total
    uint256 private buyTotalFee;

    // Thresholds
    uint256 public thresholdPercent;
    uint256 public thresholdDivisor;

    // Admin Flags
    bool public tradingOpen;
    bool public antiBotMode;

    bool private inSwap;

    uint256 public launchedAt;
    uint256 private deadBlocks;

    mapping(address => bool) private _isExcludedFromFee;
    mapping(address => bool) private _isSniper;

    // Events
    event OpenTrading(uint256 launchedAt, bool tradingOpen);
    event RewardsTokenChosen(address user, address rewardsToken);
    event SetAutomatedMarketMakerPair(address newPair);
    event ExcludeFromRewards(address acount);
    event UpdateClaimWait(uint256 newTime);
    event SetNewRouter(address newRouter);
    event ExcludeFromFees(address account, bool isExcluded);
    event ManageSnipers(address[] indexed accounts, bool state);
    event SetWallet(address newWallet);
    event SetSwapThreshold(
        uint256 indexed newpercent,
        uint256 indexed newDivisor
    );
    event ProcessedDividendTracker(
        uint256 iterations,
        uint256 claims,
        uint256 lastProcessedIndex,
        bool indexed automatic,
        uint256 gas,
        address indexed processor
    );
    event MaxWalletExcluded(address wallet, bool isExcluded);
    event MaxWalletAmount(uint256 amount);
    event CanTransferBeforeOpenTrading(address user, bool isAllowed);
    event OnRyeSet(address payable onRye);
    event HamSet(address ham);
    event ETHWithdrawn(address to, uint256 amount);
    event RewardTokenRemoved(address rewardTokenAddress);

    modifier swapping(){
        inSwap = true;
        _;
        inSwap = false;
    }

    constructor (address payable _marketingWallet, address payable _developmentWallet) ERC20("Ciel", "CIEL") ERC20Permit("Ciel") {
        require(_marketingWallet != address(0), "Ciel: No null address");
        require(_developmentWallet != address(0), "Ciel: No null address");

        marketingWallet = payable(_marketingWallet);
        developmentWallet = payable(_developmentWallet);

        _sellLiquidityFee = 0; // 9%
        _sellMarketingFee = 0; // 2%
        _sellDevelopmentFee = 0; // 2%
        _sellRewardsToHolders = 0; //5%

        buyTotalFee = 0; //18%

        sellTotalFee = _sellLiquidityFee + _sellMarketingFee + _sellDevelopmentFee + _sellRewardsToHolders;

        thresholdPercent = 20;
        thresholdDivisor = 1000;

        antiBotMode = true;

        IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
            0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
        );
        uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
            .createPair(_uniswapV2Router.WETH(), address(this));

        uniswapV2Router = _uniswapV2Router;

        excludeFromFees(_msgSender(), true);
        excludeFromFees(address(this), true);

        _canTransferBeforeOpenTrading[address(this)] = true;
        _canTransferBeforeOpenTrading[_msgSender()] = true;

        maxWalletAmount = (TOTAL_SUPPLY * 15) / 10000; //.15% of TOTAL_SUPPLY

        maxWalletExcluded[uniswapV2Pair] = true;
        maxWalletExcluded[_msgSender()] = true;
        maxWalletExcluded[address(this)] = true;

        _mint(_msgSender(), TOTAL_SUPPLY);

        emit Transfer(address(0), _msgSender(), TOTAL_SUPPLY);
    }

    function setMaxWalletExcluded(address wallet, bool isExcluded)
        external
        onlyOwner
    {
        maxWalletExcluded[wallet] = isExcluded;
        emit MaxWalletExcluded(wallet, isExcluded);
    }

    function setMaxWalletAmount(uint256 amount) external onlyOwner {
        require(amount > (TOTAL_SUPPLY * 15) / 10000000, "CIEL: too small");  //.00015% of TOTAL_SUPPLY
        maxWalletAmount = amount;
        emit MaxWalletAmount(amount);
    }

    function setCanTransferBeforeOpenTrading(address user, bool isAllowed)
        external
        onlyOwner
    {
        _canTransferBeforeOpenTrading[user] = isAllowed;
        emit CanTransferBeforeOpenTrading(user, isAllowed);
    }

    function setOnRye(address payable _onRye) external onlyOwner {
        require(_onRye != address(0), "No null address");
        onRye = IOnRye(payable(_onRye));
        emit OnRyeSet(_onRye);
    }

    function setHam(address _ham) external onlyOwner {
        require(_ham != address(0), "No null address");
        ham = IHam(_ham);
        emit HamSet(_ham);
    }

    function toggleAntiBot() external onlyOwner {
        if (antiBotMode) {
            antiBotMode = false;
        } else {
            antiBotMode = true;
        }
    }

    function initializeExclusion() external onlyOwner {
        ham.eFR(address(onRye));
        ham.eFR(uniswapV2Pair);
        ham.eFR(address(this));
        ham.eFR(_msgSender());
        ham.eFR(
            address(0xdeaDDeADDEaDdeaDdEAddEADDEAdDeadDEADDEaD)
        );
    }

    function initializeRewardTokens() external onlyOwner {
        addRewardAddress(address(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599), true); // WBTC
        addRewardAddress(address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2), true); // WETH
        addRewardAddress(address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48), true); // USDC
        addRewardAddress(address(0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE), true); // SHIBA
        addRewardAddress(address(0x45804880De22913dAFE09f4980848ECE6EcbAf78), true); // PAXG
        addRewardAddress(address(0x0F5D2fB29fb7d3CFeE444a200298f468908cC942), true); // MANA
        addRewardAddress(address(0x514910771AF9Ca656af840dff83E8264EcF986CA), true); // LINK
        addRewardAddress(address(0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2), true); // MKR
        addRewardAddress(address(0x0D8775F648430679A709E98d2b0Cb6250d2887EF), true); // BAT
        addRewardAddress(address(0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984), true); // UNI
        addRewardAddress(address(this), false); // CIEL
    }


    function isExcludedFromFees(address account) external view returns (bool) {
        return _isExcludedFromFee[account];
    }

    function claim() external {
        require(tradingOpen, "CIEL: Trading not open");
        bool processed = ham.pA(payable(_msgSender()), false);
        require(processed, "Unsuccessful claim");
    }

    function curentSwapThreshold() internal view returns (uint256) {
        return (balanceOf(uniswapV2Pair) * thresholdPercent) / thresholdDivisor;
    }

    function transfer(address recipient, uint256 amount)
        public
        override
        returns (bool)
    {
        _transfer(_msgSender(), recipient, amount);
        return true;
    }

    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal override {
        require(from != address(0), "No null address");
        require(to != address(0), "No null address");
        require(amount > 0, "Amount cannot be zero");
        require(!_isSniper[to] && !_isSniper[from], "NS");
        if (!tradingOpen) {
            require(
                _canTransferBeforeOpenTrading[from] ||
                    _canTransferBeforeOpenTrading[to], 
                    "Cannot transfer"
            );
        }

        if (
            launchedAt > 0 &&
            (launchedAt + 1000) > block.number &&
            !maxWalletExcluded[to]
        ) {
            require(balanceOf(to) + amount <= maxWalletAmount, "CIEL: maxW");
        }

        uint256 currenttotalFee;

        if (to == uniswapV2Pair) {
            //sell
            currenttotalFee = sellTotalFee;
        }

        if(from == uniswapV2Pair) {
            //buy
            currenttotalFee = buyTotalFee;
        }

        //antibot - first X blocks
        if (launchedAt > 0 && (launchedAt + deadBlocks) > block.number) {
            _isSniper[to] = true;
        }

        //high slippage bot txns
        if (
            launchedAt > 0 &&
            from != owner() &&
            block.number <= (launchedAt + deadBlocks) &&
            antiBotMode
        ) {
            currenttotalFee = 950; //95%
        }

        if (
            _isExcludedFromFee[from] ||
            _isExcludedFromFee[to] ||
            from == owner()
        ) {
            //privileged
            currenttotalFee = 0;
        }
        //sell
        if (!inSwap && tradingOpen && to == uniswapV2Pair && currenttotalFee > 0) {
            //add liquidity before opening trading to this doesn't hit
            uint256 contractTokenBalance = balanceOf(address(this));
            uint256 swapThreshold = curentSwapThreshold();

            if ((contractTokenBalance >= swapThreshold)) {
                swapAndsendEth();
            }
        }
        _transferStandard(from, to, amount, currenttotalFee);
    }

    function _transferStandard(
        address sender,
        address recipient,
        uint256 tAmount,
        uint256 curentTotalFee
    ) private nonReentrant {
        if (curentTotalFee == 0) {
            super._transfer(sender, recipient, tAmount);
        } else {
            uint256 calcualatedFee = (tAmount * curentTotalFee) / (10**3);
            uint256 amountForRecipient = tAmount - calcualatedFee;
            super._transfer(sender, address(this), calcualatedFee); //take tax
            super._transfer(sender, recipient, amountForRecipient);

            // Add to total pending dividends
            uint256 calculatedDividends = (tAmount * _sellRewardsToHolders) / (10**3);
            uint256 currentDividends = onRye
                .gTDD();
            onRye.sTPD(
                currentDividends + calculatedDividends
            );
        }
        //update tracker values
        try
            ham.sb(payable(sender), balanceOf(sender))
        {} catch {}
        try
            ham.sb(payable(recipient), balanceOf(recipient))
        {} catch {}
    }

    function swapAndsendEth() private swapping {
        uint256 amountToLiquify;
        if (_sellLiquidityFee > 0) {
            amountToLiquify = (curentSwapThreshold() * _sellLiquidityFee) / sellTotalFee / 2;
            swapTokensForEth(amountToLiquify);
        }

        uint256 amountETH = address(this).balance;

        if (sellTotalFee > 0) {
            uint256 totalETHFee = sellTotalFee - (_sellLiquidityFee / 2); 
            uint256 amountETHLiquidity = amountETH * _sellLiquidityFee / sellTotalFee / 2;

            if (amountETH > 0) {
                if(_sellDevelopmentFee > 0){
                    uint256 developmentAllocation = amountETH * _sellDevelopmentFee / totalETHFee;

                    (bool dSuccess, ) = payable(developmentWallet).call{
                        value: developmentAllocation
                    }("");
                    if (dSuccess) {
                        emit Transfer(
                            address(this),
                            developmentWallet,
                            developmentAllocation
                        );
                    }
                }
                
                if(_sellMarketingFee > 0){
                    uint256 marketingAllocation = amountETH * _sellMarketingFee / totalETHFee;

                    (bool mSuccess, ) = payable(marketingWallet).call{
                        value: marketingAllocation
                    }("");
                    if (mSuccess) {
                        emit Transfer(
                            address(this),
                            marketingWallet,
                            marketingAllocation
                        );
                    }
                }

                if(_sellRewardsToHolders > 0){
                    uint256 rewardETHAllocation = amountETH * _sellRewardsToHolders / totalETHFee;

                    (bool rSuccess, ) = payable(onRye).call{
                        value: rewardETHAllocation
                    }("");
                    if (rSuccess) {
                        emit Transfer(
                            address(this),
                            address(onRye),
                            rewardETHAllocation
                        );
                    }
                }
            }
            if (amountToLiquify > 0) {
                addLiquidity(amountToLiquify, amountETHLiquidity);
            }
        } else {
            if (amountETH > 0) {
                (bool mSuccess, ) = address(marketingWallet).call{
                    value: amountETH
                }("");
                if (mSuccess) {
                    emit Transfer(address(this), marketingWallet, amountETH);
                }
            }
        }
    }

    function swapTokensForEth(uint256 tokenAmount) private {
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapV2Router.WETH();

        super._approve(address(this), address(uniswapV2Router), tokenAmount);

        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
            tokenAmount,
            1,
            path,
            address(this),
            block.timestamp
        );
    }

    function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
        super._approve(address(this), address(uniswapV2Router), tokenAmount);

        uniswapV2Router.addLiquidityETH{value: ethAmount}(
            address(this),
            tokenAmount,
            1,
            1,
            address(this),
            block.timestamp
        );
    }

    function processDividendTracker(uint256 gas) external onlyOwner nonReentrant {
        (
            uint256 iterations,
            uint256 claims,
            uint256 lastProcessedIndex
        ) = ham.p(gas);
        emit ProcessedDividendTracker(
            iterations,
            claims,
            lastProcessedIndex,
            false,
            gas,
            tx.origin
        );
    }

    function setThreshold(uint256 newPercent, uint256 newDivisor)
        external
        onlyOwner
    {
        require(newDivisor > 0 && newPercent > 0, "CIEL: must be < 0");
        thresholdPercent = newPercent;
        thresholdDivisor = newDivisor;
        emit SetSwapThreshold(thresholdPercent, thresholdDivisor);
    }

    function setWallet(address newMarketingWallet) external onlyOwner {
        require(newMarketingWallet != address(0), "CIEL: no null addres");
        marketingWallet = newMarketingWallet;
        emit SetWallet(marketingWallet);
    }

    function openTrading(bool state, uint256 _deadBlocks) external onlyOwner {
        tradingOpen = state;
        if (tradingOpen && launchedAt == 0) {
            launchedAt = block.number;
            deadBlocks = _deadBlocks + 2;
        }
        emit OpenTrading(launchedAt, tradingOpen);
    }

    function setAutomatedMarketMakerPair(address newPair) external onlyOwner nonReentrant {
        require(newPair != address(0), "CIEL: no null address");
        require(newPair != uniswapV2Pair, "CIEL: Same Pair");
        ham.eFR(newPair);
        uniswapV2Pair = newPair;
        emit SetAutomatedMarketMakerPair(uniswapV2Pair);
    }

    function setNewRouter(address newRouter) external onlyOwner nonReentrant {
        require(newRouter != address(0), "No null address");
        IUniswapV2Router02 _newRouter = IUniswapV2Router02(newRouter);
        address getPair = IUniswapV2Factory(_newRouter.factory()).getPair(
            address(this),
            _newRouter.WETH()
        );
        if (getPair == address(0)) {
            uniswapV2Pair = IUniswapV2Factory(_newRouter.factory()).createPair(
                address(this),
                _newRouter.WETH()
            );
        } else {
            uniswapV2Pair = getPair;
        }
        uniswapV2Router = _newRouter;
        emit SetNewRouter(newRouter);
    }

    function excludeFromFees(address account, bool isExcluded) public onlyOwner {
        require(account != address(0), "No null address");
        _isExcludedFromFee[account] = isExcluded;
        emit ExcludeFromFees(account, isExcluded);
    }

    function manageSnipers(address[] memory accounts, bool state)
        external
        onlyOwner
    {
        for (uint256 i; i < accounts.length; ++i) {
            _isSniper[accounts[i]] = state;
        }
        emit ManageSnipers(accounts, state);
    }

    function updateClaimWait(uint256 claimWait) external onlyOwner nonReentrant {
        require(claimWait <= 604800, "CIEL: shorter");
        ham.uCW(claimWait);
        emit UpdateClaimWait(claimWait);
    }

    function withdrawStuckTokens(IERC20 token, address to) external onlyOwner nonReentrant {
        uint256 balance = token.balanceOf(address(this));
        bool success = token.transfer(to, balance);
        require(success, "Failed");
        emit Transfer(address(this), to, balance);
    }

    function withdrawETHFromContract(address to) external onlyOwner nonReentrant {
        require(to != address(0), "CIEL: No null address");
        require(address(this).balance != 0, "CIEL: no ETH");
        uint256 balance = address(this).balance;
        (bool success, ) = to.call{value: balance}("");
        require(success, "Failed");
        emit ETHWithdrawn(to, balance);
    }

    function setUserRewardToken(address holder, address rewardTokenAddress)
        external
        nonReentrant
    {
        require(
            rewardTokenAddress.isContract() && rewardTokenAddress != address(0),
            "CIEL: Address is invalid."
        );
        require(
            holder == payable(_msgSender()),
            "CIEL: can only set for yourself."
        );
        require(
            rewardAddressWhitelisted[rewardTokenAddress] == true,
            "CIEL: not in list"
        );
        onRye.sUCRT(holder, rewardTokenAddress);
        emit RewardsTokenChosen(holder, rewardTokenAddress);
    }

    function addRewardAddress(address rewardTokenAddress, bool shouldSwap)
        public
        onlyOwner
    {
        require(
            rewardTokenAddress.isContract() && rewardTokenAddress != address(0),
            "CIEL: Address is invalid."
        );
        require(rewardAddressWhitelisted[rewardTokenAddress] != true, "CIEL: already in list");
        rewardAddressWhitelisted[rewardTokenAddress] = true;
        onRye.sTA(rewardTokenAddress, true);
        onRye.sTSS(rewardTokenAddress, shouldSwap);
    }

    function removeRewardAddress(address rewardTokenAddress)
        external
        onlyOwner
        nonReentrant
    {
        require(
            rewardAddressWhitelisted[rewardTokenAddress] == true,
            "CIEL: Token not found"
        );
        delete rewardAddressWhitelisted[rewardTokenAddress];
        onRye.dTA(rewardTokenAddress);
        onRye.dTSS(rewardTokenAddress);
        emit RewardTokenRemoved(rewardTokenAddress);
    }

    function excludeFromRewards(address account) external onlyOwner nonReentrant {
        require(account != address(0), "No null address");
        ham.eFR(account);
        emit ExcludeFromRewards(account);
    }

    receive() external payable {}
}

File 28 of 35 : ERC20Permit.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

/**
 * @dev Implementation 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.
 *
 * _Available since v3.4._
 */
abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {
    using Counters for Counters.Counter;

    mapping(address => Counters.Counter) private _nonces;

    // solhint-disable-next-line var-name-mixedcase
    bytes32 private constant _PERMIT_TYPEHASH =
        keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
    /**
     * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.
     * However, to ensure consistency with the upgradeable transpiler, we will continue
     * to reserve a slot.
     * @custom:oz-renamed-from _PERMIT_TYPEHASH
     */
    // solhint-disable-next-line var-name-mixedcase
    bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;

    bytes32 public DOMAIN_SEPARATOR;

    /**
     * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`.
     *
     * It's a good idea to use the same `name` that is defined as the ERC20 token name.
     */
    constructor(string memory name) EIP712(name, "1") {
        uint256 id;
        assembly {
            id := chainid()
        }
        DOMAIN_SEPARATOR = keccak256(
            abi.encode(
                keccak256(
                    "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
                ),
                keccak256(bytes(name)),
                keccak256(bytes("1")),
                id,
                address(this)
            )
        );
    }

    function getMessageHash(
        address _to,
        uint256 _amount,
        string memory _message,
        uint256 _nonce
    ) external pure returns (bytes32) {
        return keccak256(abi.encodePacked(_to, _amount, _message, _nonce));
    }

    /**
     * @dev See {IERC20Permit-permit}.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external virtual override {
        require(block.timestamp <= deadline, "ERC20Permit: expired deadline");

        bytes32 digest = keccak256(
            abi.encodePacked(
                "\x19\x01",
                DOMAIN_SEPARATOR,
                keccak256(
                    abi.encode(
                        _PERMIT_TYPEHASH,
                        owner,
                        spender,
                        value,
                        _useNonce(owner),
                        deadline
                    )
                )
            )
        );

        address signer = ecrecover(digest, v, r, s);

        require(signer == owner, "ERC20Permit: invalid signature");

        _approve(owner, spender, value);
    }

    /**
     * @dev See {IERC20Permit-nonces}.
     */
    function nonces(address owner) external view virtual override returns (uint256) {
        return _nonces[owner].current();
    }

    /**
     * @dev "Consume a nonce": return the current value and increment.
     *
     * _Available since v4.1._
     */
    function _useNonce(address owner) internal virtual returns (uint256 current) {
        Counters.Counter storage nonce = _nonces[owner];
        current = nonce.current();
        nonce.increment();
    }
}

File 29 of 35 : Ham.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./interface/IOnRye.sol";
import "./ItterableMapping.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol";

contract Ham is
    Initializable,
    AccessControlUpgradeable,
    ReentrancyGuardUpgradeable
{
    using IterableMapping for IterableMapping.Map;

    IterableMapping.Map private tokenHoldersMap;
    IOnRye public onRye;

    bytes32 public constant CIEL_ROLE = keccak256("CIEL_ROLE");

    mapping(address => bool) public excludedFromDividends;
    mapping(address => uint256) public lastClaimTimes;

    uint256 public lastProcessedIndex;
    uint256 public claimWait;
    bool public autoProcessAccount;
    uint256 public constant MIN_TOKEN_BALANCE_FOR_DIVIDENDS =
        10000 * (10 ** 18); // Must hold 10000+ tokens.

    event ExcludedFromDividends(address indexed account);
    event GasForTransferUpdated(
        uint256 indexed newValue,
        uint256 indexed oldValue
    );
    event ClaimWaitUpdated(uint256 indexed newValue, uint256 indexed oldValue);
    event Claim(
        address divivdendToken,
        address indexed account,
        uint256 amount,
        bool indexed automatic
    );

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    function initialize(
        address _ciel,
        address payable _onRye
    ) external initializer {
        __AccessControl_init();

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(CIEL_ROLE, _ciel);
        claimWait = 3600; // 1 Hour
        onRye = IOnRye(_onRye);
        autoProcessAccount = true;
    }

    function setAutoProcessAccount(
        bool state
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(state != autoProcessAccount, "TRT: current state");
        autoProcessAccount = state;
    }

    function eFR(address account) external onlyRole(CIEL_ROLE) nonReentrant {
        require(!excludedFromDividends[account], "TRT: already excluded");
        excludedFromDividends[account] = true;
        onRye._setBalance(account, 0);
        tokenHoldersMap.remove(account);
        emit ExcludedFromDividends(account);
    }

    function uCW(uint256 newClaimWait) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            newClaimWait >= 3600 && newClaimWait <= 86400,
            "TRT: claimWait must be updated to between 1 and 24 hours"
        );
        require(
            newClaimWait != claimWait,
            "TRT: Cannot update claimWait to same value"
        );
        emit ClaimWaitUpdated(newClaimWait, claimWait);
        claimWait = newClaimWait;
    }

    function getLastProcessedIndex() external view returns (uint256) {
        return lastProcessedIndex;
    }

    function getClaimWait() external view returns (uint256) {
        return claimWait;
    }

    function getMagnifiedDividendPerShare() external view returns (uint256) {
        return onRye.getMagnifiedDividend();
    }

    function getNumberOfTokenHolders() external view returns (uint256) {
        return tokenHoldersMap.keys.length;
    }

    function getAccount(
        address _account
    )
        external
        view
        returns (
            address account,
            int256 index,
            int256 iterationsUntilProcessed,
            uint256 withdrawableDividends,
            uint256 totalDividends,
            uint256 lastClaimTime,
            uint256 nextClaimTime,
            uint256 secondsUntilAutoClaimAvailable
        )
    {
        account = _account;
        index = tokenHoldersMap.getIndexOfKey(account);
        iterationsUntilProcessed = -1;

        if (index >= 0) {
            if (uint256(index) > lastProcessedIndex) {
                iterationsUntilProcessed = index - int256(lastProcessedIndex);
            } else {
                uint256 processesUntilEndOfArray = tokenHoldersMap.keys.length >
                    lastProcessedIndex
                    ? tokenHoldersMap.keys.length - lastProcessedIndex
                    : 0;
                iterationsUntilProcessed =
                    index +
                    int256(processesUntilEndOfArray);
            }
        }

        withdrawableDividends = onRye.withdrawableDividendOf(account);
        totalDividends = onRye.accumulativeDividendOf(account);

        lastClaimTime = lastClaimTimes[account];
        nextClaimTime = lastClaimTime > 0 ? lastClaimTime + claimWait : 0;
        secondsUntilAutoClaimAvailable = nextClaimTime > block.timestamp
            ? nextClaimTime - block.timestamp
            : 0;
    }

    function canAutoClaim(uint256 lastClaimTime) private view returns (bool) {
        if (lastClaimTime > block.timestamp) {
            return false;
        }
        return block.timestamp - lastClaimTime >= claimWait;
    }

    function sb(
        address payable account,
        uint256 newBalance
    ) external onlyRole(CIEL_ROLE) {
        if (excludedFromDividends[account]) {
            return;
        }
        if (newBalance >= MIN_TOKEN_BALANCE_FOR_DIVIDENDS) {
            onRye._setBalance(account, newBalance);
            tokenHoldersMap.set(account, newBalance);
        } else {
            onRye._setBalance(account, 0);
            tokenHoldersMap.remove(account);
        }
        if (autoProcessAccount) {
            _processAccount(account, true);
        }
    }

    function p(
        uint256 gas
    ) external onlyRole(CIEL_ROLE) returns (uint256, uint256, uint256) {
        //fix
        uint256 numberOfTokenHolders = tokenHoldersMap.keys.length;
        if (numberOfTokenHolders == 0) {
            return (0, 0, lastProcessedIndex);
        }
        uint256 _lastProcessedIndex = lastProcessedIndex;
        uint256 gasUsed = 0;
        uint256 gasLeft = gasleft();
        uint256 iterations = 0;
        uint256 claims = 0;
        while (gasUsed < gas && iterations < numberOfTokenHolders) {
            _lastProcessedIndex++;
            if (_lastProcessedIndex >= tokenHoldersMap.keys.length) {
                _lastProcessedIndex = 0;
            }
            address account = tokenHoldersMap.keys[_lastProcessedIndex];
            if (canAutoClaim(lastClaimTimes[account])) {
                if (_processAccount(payable(account), true)) {
                    claims++;
                }
            }
            iterations++;
            uint256 newGasLeft = gasleft();
            if (gasLeft > newGasLeft) {
                gasUsed = gasUsed + gasLeft - newGasLeft;
            }
            gasLeft = newGasLeft;
        }
        lastProcessedIndex = _lastProcessedIndex;
        return (iterations, claims, lastProcessedIndex);
    }

    function _processAccount(
        address payable account,
        bool automatic
    ) internal nonReentrant returns (bool) {
        uint256 amount = onRye._withdrawDividendOfUser(account);
        if (amount > 0) {
            address token = onRye._userCustomRewardToken(account);
            lastClaimTimes[account] = block.timestamp;
            emit Claim(token, account, amount, automatic);
            return true;
        }
        return false;
    }

    function pA(
        address payable account,
        bool automatic
    ) external onlyRole(CIEL_ROLE) returns (bool) {
        bool os = _processAccount(account, automatic);
        return os;
    }

    function getTotalPendingDividends() external view returns (uint256) {
        return onRye._getTotalPendingDividends();
    }

    function setTotalPendingDividends(
        uint256 newDividends
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        onRye.sTPD(newDividends);
    }
}

File 30 of 35 : IHam.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.4;

interface IHam {
    function rely(address usr) external;
    function deny(address usr) external;
    function eFR(address account) external;
    function updateGasForTransfer(uint256 newGasForTransfer) external;
    function uCW(uint256 newClaimWait) external;
    function getLastProcessedIndex() external view returns(uint256);
    function getMagnifiedDividendPerShare() external view returns(uint256);
    function getNumberOfTokenHolders() external view returns(uint256);
    function getClaimWait() external view returns(uint256);
    function getAccount(address _account)external view returns (
        address account,
        int256 index,
        int256 iterationsUntilProcessed,
        uint256 withdrawableDividends,
        uint256 totalDividends,
        uint256 lastClaimTime,
        uint256 nextClaimTime,
        uint256 secondsUntilAutoClaimAvailable);
    function pA(address payable account, bool automatic) external returns(bool);
    function balanceOf(address account) external returns(uint256);
    function getTotalPendingDividends() external returns(uint256);
    function setTotalPendingDividends(uint256 newPending) external;
    function totalRewardsDistributed() external view returns(uint256);
    function dividendOf(address _owner) external view returns(uint256);
    function sb(address payable account, uint256 newBalance) external;
    function p(uint256 gas) external returns (uint256, uint256, uint256);
    function _setUserHasCustomRewardToken(address user, bool boolean) external;
    function _userCustomRewardToken(address user) external view returns (address);
    function _setUserCustomRewardToken(address user, address rewardToken) external;
    function _userHasCustomRewardToken(address user) external view returns (bool);
    function setBalance(address payable account) external; 
}

File 31 of 35 : IOnRye.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.4;

interface IOnRye {
    event DividendsDistributed(address indexed from, uint256 weiAmount);
    event DividendWithdrawn(address indexed to, uint256 weiAmount);
    event MaxTokenAmountSet(uint256 newAmount);
    event GovTokenSet(address _govToken);
    event GovTokenRateSet(uint256 _govTokenRate);
    event CielSet(address _ciel);
    event CielTokenRateSet(uint256 _cielTokenRate);
    event PromoTokenRateSet(uint256 _promoTokenRate);
    event CielPairSet(address _cielPair);
    event BuyBackAddressSet(address _buyBackAddress);
    event TokenPendingDividendsSet(uint256 _newValue);
    event GasForTransferSet(uint256 _newGas);

    receive() external payable;
    function dividendOf(address _owner) external view returns(uint256);
    function setGovToken(address _govToken) external;
    function setCiel(address _ciel) external;
    function setCielPair(address _cielPair) external;
    function setBuyBackAddress(address payable _buyBackAddress) external;
    function sTPD(uint256 _newValue) external;
    function setGasForTransfer(uint256 _newGas) external;
    function setMaxTokenSendAmount(uint256 _newAmount) external;
    function setGovTokenRate(uint256 _govTokenRate) external;
    function setCielTokenRate(uint256 _cielTokenRate) external;
    function setPromoTokenRate(uint256 _promoTokenRate) external;
    function gTDD() external view returns(uint256);
    function withdrawableDividendOf(address _owner) external view returns(uint256);
    function _withdrawDividendOfUser(address payable user) external returns (uint256);
    function withdrawnDividendOf(address _owner) external view returns(uint256);
    function accumulativeDividendOf(address _owner) external view returns(uint256);
    function getMagnifiedDividend() external view returns(uint256);
    function _getTotalPendingDividends() external view returns(uint256);
    function getMagDiv(address account) external view returns(int256);
    function _setBalance(address account, uint256 newBalance) external;
    function _userCustomRewardToken(address user) external view returns (address);
    function sUCRT(address user, address rewardToken) external;
    function sTA(address rewardToken, bool isAvailable) external;
    function dTA(address rewardToken) external;
    function sTSS(address rewardToken, bool shouldSwap) external;
    function dTSS(address rewardToken) external;
    
}

File 32 of 35 : IUniswapV2Factory.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.4;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);
    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);
    function createPair(address tokenA, address tokenB) external returns (address pair);
    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 33 of 35 : IUniswapV2Router01.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.4;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

File 34 of 35 : IUniswapV2Router02.sol
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.4;

import "./IUniswapV2Router01.sol";

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 35 of 35 : ItterableMapping.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;

library IterableMapping {
    // Iterable mapping from address to uint;
    struct Map {
        address[] keys;
        mapping(address => uint) values;
        mapping(address => uint) indexOf;
        mapping(address => bool) inserted;
    }

    function get(Map storage map, address key) external view returns (uint) {
        return map.values[key];
    }

    function getIndexOfKey(Map storage map, address key) external view returns (int) {
        if(!map.inserted[key]) {
            return -1;
        }
        return int(map.indexOf[key]);
    }

    function getKeyAtIndex(Map storage map, uint index) external view returns (address) {
        return map.keys[index];
    }

    function size(Map storage map) external view returns (uint) {
        return map.keys.length;
    }

    function set(Map storage map, address key, uint val) external {
        if (map.inserted[key]) {
            map.values[key] = val;
        } else {
            map.inserted[key] = true;
            map.values[key] = val;
            map.indexOf[key] = map.keys.length;
            map.keys.push(key);
        }
    }

    function remove(Map storage map, address key) external {
        if (!map.inserted[key]) {
            return;
        }

        delete map.inserted[key];
        delete map.values[key];

        uint index = map.indexOf[key];
        uint lastIndex = map.keys.length - 1;
        address lastKey = map.keys[lastIndex];

        map.indexOf[lastKey] = index;
        delete map.indexOf[key];

        map.keys[index] = lastKey;
        map.keys.pop();
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address payable","name":"_marketingWallet","type":"address"},{"internalType":"address payable","name":"_developmentWallet","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"isAllowed","type":"bool"}],"name":"CanTransferBeforeOpenTrading","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ETHWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"bool","name":"isExcluded","type":"bool"}],"name":"ExcludeFromFees","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"acount","type":"address"}],"name":"ExcludeFromRewards","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"ham","type":"address"}],"name":"HamSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address[]","name":"accounts","type":"address[]"},{"indexed":false,"internalType":"bool","name":"state","type":"bool"}],"name":"ManageSnipers","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MaxWalletAmount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"wallet","type":"address"},{"indexed":false,"internalType":"bool","name":"isExcluded","type":"bool"}],"name":"MaxWalletExcluded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address payable","name":"onRye","type":"address"}],"name":"OnRyeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"launchedAt","type":"uint256"},{"indexed":false,"internalType":"bool","name":"tradingOpen","type":"bool"}],"name":"OpenTrading","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"iterations","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claims","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lastProcessedIndex","type":"uint256"},{"indexed":true,"internalType":"bool","name":"automatic","type":"bool"},{"indexed":false,"internalType":"uint256","name":"gas","type":"uint256"},{"indexed":true,"internalType":"address","name":"processor","type":"address"}],"name":"ProcessedDividendTracker","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"rewardTokenAddress","type":"address"}],"name":"RewardTokenRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"rewardsToken","type":"address"}],"name":"RewardsTokenChosen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newPair","type":"address"}],"name":"SetAutomatedMarketMakerPair","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newRouter","type":"address"}],"name":"SetNewRouter","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"newpercent","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newDivisor","type":"uint256"}],"name":"SetSwapThreshold","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newWallet","type":"address"}],"name":"SetWallet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTime","type":"uint256"}],"name":"UpdateClaimWait","type":"event"},{"inputs":[],"name":"DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOTAL_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_canTransferBeforeOpenTrading","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"rewardTokenAddress","type":"address"},{"internalType":"bool","name":"shouldSwap","type":"bool"}],"name":"addRewardAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"antiBotMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"developmentWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bool","name":"isExcluded","type":"bool"}],"name":"excludeFromFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"excludeFromRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"string","name":"_message","type":"string"},{"internalType":"uint256","name":"_nonce","type":"uint256"}],"name":"getMessageHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"ham","outputs":[{"internalType":"contract IHam","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeExclusion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initializeRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isExcludedFromFees","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"bool","name":"state","type":"bool"}],"name":"manageSnipers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"marketingWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWalletAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxWalletExcluded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onRye","outputs":[{"internalType":"contract IOnRye","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"state","type":"bool"},{"internalType":"uint256","name":"_deadBlocks","type":"uint256"}],"name":"openTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gas","type":"uint256"}],"name":"processDividendTracker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"rewardTokenAddress","type":"address"}],"name":"removeRewardAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewardAddressWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newPair","type":"address"}],"name":"setAutomatedMarketMakerPair","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"bool","name":"isAllowed","type":"bool"}],"name":"setCanTransferBeforeOpenTrading","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ham","type":"address"}],"name":"setHam","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"setMaxWalletAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"wallet","type":"address"},{"internalType":"bool","name":"isExcluded","type":"bool"}],"name":"setMaxWalletExcluded","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRouter","type":"address"}],"name":"setNewRouter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"_onRye","type":"address"}],"name":"setOnRye","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newPercent","type":"uint256"},{"internalType":"uint256","name":"newDivisor","type":"uint256"}],"name":"setThreshold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"holder","type":"address"},{"internalType":"address","name":"rewardTokenAddress","type":"address"}],"name":"setUserRewardToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newMarketingWallet","type":"address"}],"name":"setWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"thresholdDivisor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"thresholdPercent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleAntiBot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tradingOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"claimWait","type":"uint256"}],"name":"updateClaimWait","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawETHFromContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"withdrawStuckTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101406040523480156200001257600080fd5b5060405162004c5738038062004c57833981016040819052620000359162000956565b6040518060400160405280600481526020016310da595b60e21b81525080604051806040016040528060018152602001603160f81b8152506040518060400160405280600481526020016310da595b60e21b8152506040518060400160405280600481526020016310d2515360e21b8152508160039080519060200190620000bf92919062000897565b508051620000d590600490602084019062000897565b5050825160209384012082519284019290922060e08381526101008281524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818b018190528183019990995260608181019790975260808082018590523082850181905283518084038601815260c08085018087528251928f019290922084528281526101208d90528e519e8e019e909e20978401855260019052603160f81b92909701919091528151808b0199909952888201949094527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc69588019590955291860152848101919091528151808503909101815292909401909352805191012060075550620001ef336200067e565b60016009556001600160a01b038216620002505760405162461bcd60e51b815260206004820152601560248201527f4369656c3a204e6f206e756c6c2061646472657373000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b038116620002a85760405162461bcd60e51b815260206004820152601560248201527f4369656c3a204e6f206e756c6c20616464726573730000000000000000000000604482015260640162000247565b600e80546001600160a01b038085166001600160a01b031992831617909255600f80549284169290911691909117905560006014819055601581905560168190556017819055601981905580620003008180620009ab565b6200030c9190620009ab565b620003189190620009ab565b6018556014601a556103e8601b55601c805461ff0019166101001790556040805163c45a015560e01b81529051737a250d5630b4cf539739df2c5dacb4c659f2488d91829163c45a015591600480820192602092909190829003018186803b1580156200038457600080fd5b505afa15801562000399573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003bf9190620009c6565b6001600160a01b031663c9c65396826001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156200040757600080fd5b505afa1580156200041c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004429190620009c6565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604401602060405180830381600087803b1580156200048a57600080fd5b505af11580156200049f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004c59190620009c6565b600b80546001600160a01b03199081166001600160a01b0393841617909155600a805490911691831691909117905562000508620005003390565b6001620006d0565b62000515306001620006d0565b3060009081526011602081905260408220805460ff19166001908117909155916200053d3390565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905561271062000580670de0b6b3a7640000633b9aca00620009ed565b6200058d90600f620009ed565b62000599919062000a0f565b601355600b546001600160a01b031660009081526012602081905260408220805460ff1916600190811790915591620005cf3390565b6001600160a01b0316815260208082019290925260409081016000908120805494151560ff199586161790553081526012909252902080549091166001179055620006396200061b3390565b62000633670de0b6b3a7640000633b9aca00620009ed565b62000787565b33600060008051602062004c3783398151915262000664670de0b6b3a7640000633b9aca00620009ed565b60405190815260200160405180910390a350505062000a6f565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b620006da62000839565b6001600160a01b038216620007245760405162461bcd60e51b815260206004820152600f60248201526e4e6f206e756c6c206164647265737360881b604482015260640162000247565b6001600160a01b0382166000818152601f6020908152604091829020805460ff19168515159081179091558251938452908301527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df7910160405180910390a15050565b6001600160a01b038216620007df5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640162000247565b8060026000828254620007f39190620009ab565b90915550506001600160a01b0382166000818152602081815260408083208054860190555184815260008051602062004c37833981519152910160405180910390a35050565b6008546001600160a01b03163314620008955760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000247565b565b828054620008a59062000a32565b90600052602060002090601f016020900481019282620008c9576000855562000914565b82601f10620008e457805160ff191683800117855562000914565b8280016001018555821562000914579182015b8281111562000914578251825591602001919060010190620008f7565b506200092292915062000926565b5090565b5b8082111562000922576000815560010162000927565b6001600160a01b03811681146200095357600080fd5b50565b600080604083850312156200096a57600080fd5b825162000977816200093d565b60208401519092506200098a816200093d565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b60008219821115620009c157620009c162000995565b500190565b600060208284031215620009d957600080fd5b8151620009e6816200093d565b9392505050565b600081600019048311821515161562000a0a5762000a0a62000995565b500290565b60008262000a2d57634e487b7160e01b600052601260045260246000fd5b500490565b600181811c9082168062000a4757607f821691505b6020821081141562000a6957634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e051610100516101205161418a62000aad60003960005050600050506000505060005050600050506000505061418a6000f3fe60806040526004361061039b5760003560e01c80638da5cb5b116101dc578063c04a541411610102578063deaa59df116100a0578063ed4941891161006f578063ed49418914610ab6578063f2fde38b14610ad6578063f3a5bb6014610af6578063ffb54a9914610b2657600080fd5b8063deaa59df14610a36578063df7713eb14610a56578063e98030c714610a76578063eafb5a3c14610a9657600080fd5b8063cfc16cea116100dc578063cfc16cea146109c0578063d14f9219146109d6578063d505accf146109f6578063dd62ed3e14610a1657600080fd5b8063c04a541414610961578063c55137a814610981578063c616d580146109a057600080fd5b8063aa4bde281161017a578063b0de48c111610149578063b0de48c1146108f6578063b9c362091461090b578063bf56b3711461092b578063c02466681461094157600080fd5b8063aa4bde281461087b578063acd0d98714610891578063ae0f1cc0146108c1578063af74ff5b146108e157600080fd5b80639e99da22116101b65780639e99da22146107fb578063a35f8a401461081b578063a457c2d71461083b578063a9059cbb1461085b57600080fd5b80638da5cb5b146107b3578063902d55a5146107d157806395d89b41146107e657600080fd5b8063349c1f09116102c15780634e71d92d1161025f578063715018a61161022e578063715018a61461072857806371e8554b1461073d57806375f0a8741461075d5780637ecebe001461077d57600080fd5b80634e71d92d146106845780634fbee19314610699578063700bb191146106d257806370a08231146106f257600080fd5b8063395093511161029b578063395093511461060e57806344cbf0541461062e57806348ca4a7b1461064457806349bd5a5e1461066457600080fd5b8063349c1f09146105a85780633644e515146105c857806336e3ca17146105de57600080fd5b80631694505e1161033957806327a14fc21161030857806327a14fc2146105305780632d4103d6146105505780632e0f262514610570578063313ce5671461058c57600080fd5b80631694505e1461049957806318160ddd146104d157806323b872dd146104f057806325b86edf1461051057600080fd5b80630bc592a5116103755780630bc592a51461041957806310274a6e1461043957806310b8075b14610459578063111e03761461047957600080fd5b806306fdde03146103a7578063095ea7b3146103d25780630976f6371461040257600080fd5b366103a257005b600080fd5b3480156103b357600080fd5b506103bc610b40565b6040516103c99190613ab6565b60405180910390f35b3480156103de57600080fd5b506103f26103ed366004613afe565b610bd2565b60405190151581526020016103c9565b34801561040e57600080fd5b50610417610bea565b005b34801561042557600080fd5b50610417610434366004613b48565b610df1565b34801561044557600080fd5b50610417610454366004613b48565b610e5d565b34801561046557600080fd5b50610417610474366004613b81565b611029565b34801561048557600080fd5b50610417610494366004613b81565b6111c1565b3480156104a557600080fd5b50600a546104b9906001600160a01b031681565b6040516001600160a01b0390911681526020016103c9565b3480156104dd57600080fd5b506002545b6040519081526020016103c9565b3480156104fc57600080fd5b506103f261050b366004613ba5565b611290565b34801561051c57600080fd5b5061041761052b366004613be6565b6112b4565b34801561053c57600080fd5b5061041761054b366004613c14565b61143c565b34801561055c57600080fd5b5061041761056b366004613c2d565b6114ef565b34801561057c57600080fd5b506104e2670de0b6b3a764000081565b34801561059857600080fd5b50604051601281526020016103c9565b3480156105b457600080fd5b506104176105c3366004613b81565b611570565b3480156105d457600080fd5b506104e260075481565b3480156105ea57600080fd5b506103f26105f9366004613b81565b60116020526000908152604090205460ff1681565b34801561061a57600080fd5b506103f2610629366004613afe565b6116cc565b34801561063a57600080fd5b506104e2601b5481565b34801561065057600080fd5b5061041761065f366004613b81565b6116ee565b34801561067057600080fd5b50600b546104b9906001600160a01b031681565b34801561069057600080fd5b5061041761176a565b3480156106a557600080fd5b506103f26106b4366004613b81565b6001600160a01b03166000908152601f602052604090205460ff1690565b3480156106de57600080fd5b506104176106ed366004613c14565b61188e565b3480156106fe57600080fd5b506104e261070d366004613b81565b6001600160a01b031660009081526020819052604090205490565b34801561073457600080fd5b50610417611983565b34801561074957600080fd5b50610417610758366004613b81565b611997565b34801561076957600080fd5b50600e546104b9906001600160a01b031681565b34801561078957600080fd5b506104e2610798366004613b81565b6001600160a01b031660009081526005602052604090205490565b3480156107bf57600080fd5b506008546001600160a01b03166104b9565b3480156107dd57600080fd5b506104e2611a13565b3480156107f257600080fd5b506103bc611a2c565b34801561080757600080fd5b50600d546104b9906001600160a01b031681565b34801561082757600080fd5b506104e2610836366004613c92565b611a3b565b34801561084757600080fd5b506103f2610856366004613afe565b611a74565b34801561086757600080fd5b506103f2610876366004613afe565b611aef565b34801561088757600080fd5b506104e260135481565b34801561089d57600080fd5b506103f26108ac366004613b81565b60126020526000908152604090205460ff1681565b3480156108cd57600080fd5b506104176108dc366004613b48565b611b05565b3480156108ed57600080fd5b50610417611b69565b34801561090257600080fd5b50610417611b9f565b34801561091757600080fd5b50610417610926366004613d4b565b611ce8565b34801561093757600080fd5b506104e2601d5481565b34801561094d57600080fd5b5061041761095c366004613b48565b611d7b565b34801561096d57600080fd5b50600f546104b9906001600160a01b031681565b34801561098d57600080fd5b50601c546103f290610100900460ff1681565b3480156109ac57600080fd5b506104176109bb366004613b81565b611e05565b3480156109cc57600080fd5b506104e2601a5481565b3480156109e257600080fd5b50600c546104b9906001600160a01b031681565b348015610a0257600080fd5b50610417610a11366004613d6d565b611f7a565b348015610a2257600080fd5b506104e2610a31366004613be6565b61215f565b348015610a4257600080fd5b50610417610a51366004613b81565b61218a565b348015610a6257600080fd5b50610417610a71366004613be6565b61222d565b348015610a8257600080fd5b50610417610a91366004613c14565b61240c565b348015610aa257600080fd5b50610417610ab1366004613b81565b6124ee565b348015610ac257600080fd5b50610417610ad1366004613de4565b6128ae565b348015610ae257600080fd5b50610417610af1366004613b81565b61296a565b348015610b0257600080fd5b506103f2610b11366004613b81565b60106020526000908152604090205460ff1681565b348015610b3257600080fd5b50601c546103f29060ff1681565b606060038054610b4f90613ea8565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7b90613ea8565b8015610bc85780601f10610b9d57610100808354040283529160200191610bc8565b820191906000526020600020905b815481529060010190602001808311610bab57829003601f168201915b5050505050905090565b600033610be08185856129e0565b5060019392505050565b610bf2612b04565b600c54600d5460405163dd261cc360e01b81526001600160a01b03918216600482015291169063dd261cc390602401600060405180830381600087803b158015610c3b57600080fd5b505af1158015610c4f573d6000803e3d6000fd5b5050600c54600b5460405163dd261cc360e01b81526001600160a01b0391821660048201529116925063dd261cc39150602401600060405180830381600087803b158015610c9c57600080fd5b505af1158015610cb0573d6000803e3d6000fd5b5050600c5460405163dd261cc360e01b81523060048201526001600160a01b03909116925063dd261cc39150602401600060405180830381600087803b158015610cf957600080fd5b505af1158015610d0d573d6000803e3d6000fd5b5050600c546001600160a01b0316915063dd261cc39050336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b158015610d6657600080fd5b505af1158015610d7a573d6000803e3d6000fd5b5050600c5460405163dd261cc360e01b815273deaddeaddeaddeaddeaddeaddeaddeaddeaddead60048201526001600160a01b03909116925063dd261cc39150602401600060405180830381600087803b158015610dd757600080fd5b505af1158015610deb573d6000803e3d6000fd5b50505050565b610df9612b04565b6001600160a01b038216600081815260116020908152604091829020805460ff19168515159081179091558251938452908301527f6e711aeccc7ea41d059235017881b7c3953c8fc73d3dd629a91855bbf51ffe6091015b60405180910390a15050565b610e65612b04565b6001600160a01b0382163b15158015610e8657506001600160a01b03821615155b610ed35760405162461bcd60e51b815260206004820152601960248201527821a4a2a61d1020b2323932b9b99034b99034b73b30b634b21760391b60448201526064015b60405180910390fd5b6001600160a01b03821660009081526010602052604090205460ff16151560011415610f395760405162461bcd60e51b815260206004820152601560248201527410d251530e88185b1c9958591e481a5b881b1a5cdd605a1b6044820152606401610eca565b6001600160a01b0382811660008181526010602052604090819020805460ff19166001908117909155600d549151633bda509960e21b8152600481019390935260248301529091169063ef69426490604401600060405180830381600087803b158015610fa557600080fd5b505af1158015610fb9573d6000803e3d6000fd5b5050600d546040516309392c7760e11b81526001600160a01b0386811660048301528515156024830152909116925063127258ee91506044015b600060405180830381600087803b15801561100d57600080fd5b505af1158015611021573d6000803e3d6000fd5b505050505050565b611031612b04565b611039612b5e565b6001600160a01b03811660009081526010602052604090205460ff16151560011461109e5760405162461bcd60e51b815260206004820152601560248201527410d251530e88151bdad95b881b9bdd08199bdd5b99605a1b6044820152606401610eca565b6001600160a01b0381811660008181526010602052604090819020805460ff19169055600d549051631e18fa1160e11b8152600481019290925290911690633c31f42290602401600060405180830381600087803b1580156110ff57600080fd5b505af1158015611113573d6000803e3d6000fd5b5050600d5460405163edf67eeb60e01b81526001600160a01b038581166004830152909116925063edf67eeb9150602401600060405180830381600087803b15801561115e57600080fd5b505af1158015611172573d6000803e3d6000fd5b50506040516001600160a01b03841681527f66257bcef574219c04f7c05f7a1c78d599da10491294c92a5805c48b4cdf5009925060200190505b60405180910390a16111be6001600955565b50565b6111c9612b04565b6111d1612b5e565b6001600160a01b0381166111f75760405162461bcd60e51b8152600401610eca90613edd565b600c5460405163dd261cc360e01b81526001600160a01b0383811660048301529091169063dd261cc390602401600060405180830381600087803b15801561123e57600080fd5b505af1158015611252573d6000803e3d6000fd5b50506040516001600160a01b03841681527f9dc0c5d829ba95d4a3aa3e40791b3e0ff125f876788532b9f7f6eb543d8dfbd6925060200190506111ac565b60003361129e858285612bb8565b6112a9858585612c2c565b506001949350505050565b6112bc612b04565b6112c4612b5e565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b15801561130657600080fd5b505afa15801561131a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133e9190613f06565b60405163a9059cbb60e01b81526001600160a01b0384811660048301526024820183905291925060009185169063a9059cbb90604401602060405180830381600087803b15801561138e57600080fd5b505af11580156113a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c69190613f1f565b9050806113fe5760405162461bcd60e51b815260206004820152600660248201526511985a5b195960d21b6044820152606401610eca565b6040518281526001600160a01b0384169030906000805160206141358339815191529060200160405180910390a350506114386001600955565b5050565b611444612b04565b6298968061145e670de0b6b3a7640000633b9aca00613f52565b61146990600f613f52565b6114739190613f71565b81116114b35760405162461bcd60e51b815260206004820152600f60248201526e10d251530e881d1bdbc81cdb585b1b608a1b6044820152606401610eca565b60138190556040518181527f22c83a5ec34271153086583a02141e6d8afa47085fffe4f3c546e7011357aa09906020015b60405180910390a150565b6114f7612b04565b601c805460ff191683151590811790915560ff1680156115175750601d54155b1561152f5743601d5561152b816002613f93565b601e555b601d54601c546040805192835260ff909116151560208301527f617c8606af468e56cf5bcb9e5b0c7fdaaf70ece355b61c0720bb21ddbb39b7ca9101610e51565b611578612b04565b611580612b5e565b6001600160a01b0381166115ce5760405162461bcd60e51b81526020600482015260156024820152744349454c3a206e6f206e756c6c206164647265737360581b6044820152606401610eca565b600b546001600160a01b038281169116141561161e5760405162461bcd60e51b815260206004820152600f60248201526e21a4a2a61d1029b0b6b2902830b4b960891b6044820152606401610eca565b600c5460405163dd261cc360e01b81526001600160a01b0383811660048301529091169063dd261cc390602401600060405180830381600087803b15801561166557600080fd5b505af1158015611679573d6000803e3d6000fd5b5050600b80546001600160a01b0319166001600160a01b0385169081179091556040519081527f358f3cb203433a03de149efbff60641f40bcd6fe750981527942877c50b838da925060200190506111ac565b600033610be08185856116df838361215f565b6116e99190613f93565b6129e0565b6116f6612b04565b6001600160a01b03811661171c5760405162461bcd60e51b8152600401610eca90613edd565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f3e4261d437a10fe4eded51408541866fd82bea4423ed6440a31c170d8a1a5ba1906020016114e4565b601c5460ff166117b55760405162461bcd60e51b815260206004820152601660248201527521a4a2a61d102a3930b234b733903737ba1037b832b760511b6044820152606401610eca565b600c546000906001600160a01b031663cc2a04da336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260006024820152604401602060405180830381600087803b15801561181257600080fd5b505af1158015611826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184a9190613f1f565b9050806111be5760405162461bcd60e51b8152602060048201526012602482015271556e7375636365737366756c20636c61696d60701b6044820152606401610eca565b611896612b04565b61189e612b5e565b600c5460405163a969204760e01b815260048101839052600091829182916001600160a01b03169063a969204790602401606060405180830381600087803b1580156118e957600080fd5b505af11580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119219190613fab565b604080518481526020810184905290810182905260608101889052929550909350915032906000907fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a989060800160405180910390a35050506111be6001600955565b61198b612b04565b6119956000613021565b565b61199f612b04565b6001600160a01b0381166119c55760405162461bcd60e51b8152600401610eca90613edd565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527fb83207924c1f42963eb1e5fb59a51b6c5b4cbcd659a9be15593ec3f3d8ec9430906020016114e4565b611a29670de0b6b3a7640000633b9aca00613f52565b81565b606060048054610b4f90613ea8565b600084848484604051602001611a549493929190613fd9565b604051602081830303815290604052805190602001209050949350505050565b60003381611a82828661215f565b905083811015611ae25760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610eca565b6112a982868684036129e0565b6000611afc338484612c2c565b50600192915050565b611b0d612b04565b6001600160a01b038216600081815260126020908152604091829020805460ff19168515159081179091558251938452908301527f6bad460a4857213327743a019dab27190e04974d74986f8d2a9d2777c064ef809101610e51565b611b71612b04565b601c54610100900460ff1615611b8e57601c805461ff0019169055565b601c805461ff001916610100179055565b611ba7612b04565b611bc6732260fac5e5542a773aa44fbcfedf7c193bc2c5996001610e5d565b611be573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001610e5d565b611c0473a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001610e5d565b611c237395ad61b0a150d79219dcf64e1e6cc01f0b64c4ce6001610e5d565b611c427345804880de22913dafe09f4980848ece6ecbaf786001610e5d565b611c61730f5d2fb29fb7d3cfee444a200298f468908cc9426001610e5d565b611c8073514910771af9ca656af840dff83e8264ecf986ca6001610e5d565b611c9f739f8f72aa9304c8b593d555f12ef6589cc3a579a26001610e5d565b611cbe730d8775f648430679a709e98d2b0cb6250d2887ef6001610e5d565b611cdd731f9840a85d5af5bf1d1762f925bdaddc4201f9846001610e5d565b611995306000610e5d565b611cf0612b04565b600081118015611d005750600082115b611d405760405162461bcd60e51b815260206004820152601160248201527004349454c3a206d757374206265203c203607c1b6044820152606401610eca565b601a829055601b819055604051819083907fb7b89c3d5d1358735329a05968ba8aa530205e9ed59cfdbcb6c1ac434cf3145990600090a35050565b611d83612b04565b6001600160a01b038216611da95760405162461bcd60e51b8152600401610eca90613edd565b6001600160a01b0382166000818152601f6020908152604091829020805460ff19168515159081179091558251938452908301527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df79101610e51565b611e0d612b04565b611e15612b5e565b6001600160a01b038116611e635760405162461bcd60e51b81526020600482015260156024820152744349454c3a204e6f206e756c6c206164647265737360581b6044820152606401610eca565b47611e9f5760405162461bcd60e51b815260206004820152600c60248201526b086928a987440dcde408aa8960a31b6044820152606401610eca565b60405147906000906001600160a01b0384169083908381818185875af1925050503d8060008114611eec576040519150601f19603f3d011682016040523d82523d6000602084013e611ef1565b606091505b5050905080611f2b5760405162461bcd60e51b815260206004820152600660248201526511985a5b195960d21b6044820152606401610eca565b604080516001600160a01b0385168152602081018490527f94b2de810873337ed265c5f8cf98c9cffefa06b8607f9a2f1fbaebdfbcfbef1c91015b60405180910390a150506111be6001600955565b83421115611fca5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610eca565b60006007547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9898989611ffc8d613073565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161207192919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156120dc573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b0316146121495760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610eca565b6121548989896129e0565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b612192612b04565b6001600160a01b0381166121df5760405162461bcd60e51b81526020600482015260146024820152734349454c3a206e6f206e756c6c2061646472657360601b6044820152606401610eca565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe80d9383fb35934b174e9a5986b6ec524e533eae802ba534282f7b0c5fdd42cc906020016114e4565b612235612b5e565b6001600160a01b0381163b1515801561225657506001600160a01b03811615155b61229e5760405162461bcd60e51b815260206004820152601960248201527821a4a2a61d1020b2323932b9b99034b99034b73b30b634b21760391b6044820152606401610eca565b6001600160a01b03821633146122f65760405162461bcd60e51b815260206004820181905260248201527f4349454c3a2063616e206f6e6c792073657420666f7220796f757273656c662e6044820152606401610eca565b6001600160a01b03811660009081526010602052604090205460ff1615156001146123575760405162461bcd60e51b815260206004820152601160248201527010d251530e881b9bdd081a5b881b1a5cdd607a1b6044820152606401610eca565b600d5460405163aaff4abb60e01b81526001600160a01b03848116600483015283811660248301529091169063aaff4abb90604401600060405180830381600087803b1580156123a657600080fd5b505af11580156123ba573d6000803e3d6000fd5b5050604080516001600160a01b038087168252851660208201527f3c5d246d9b6265112eac79010e451e0aa5162a429f9aa2b1f9ebcb8dac08955d935001905060405180910390a16114386001600955565b612414612b04565b61241c612b5e565b62093a8081111561245f5760405162461bcd60e51b815260206004820152600d60248201526c21a4a2a61d1039b437b93a32b960991b6044820152606401610eca565b600c54604051636bf30e6560e11b8152600481018390526001600160a01b039091169063d7e61cca90602401600060405180830381600087803b1580156124a557600080fd5b505af11580156124b9573d6000803e3d6000fd5b505050507fcd3b3761216f9fa924ba597d3dd40d6a234292583122b4aafa561889844b7822816040516111ac91815260200190565b6124f6612b04565b6124fe612b5e565b6001600160a01b0381166125245760405162461bcd60e51b8152600401610eca90613edd565b60008190506000816001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561256457600080fd5b505afa158015612578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259c919061401f565b6001600160a01b031663e6a4390530846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125e457600080fd5b505afa1580156125f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061261c919061401f565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b15801561266257600080fd5b505afa158015612676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269a919061401f565b90506001600160a01b03811661284057816001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156126e357600080fd5b505afa1580156126f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271b919061401f565b6001600160a01b031663c9c6539630846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561276357600080fd5b505afa158015612777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279b919061401f565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156127e357600080fd5b505af11580156127f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061281b919061401f565b600b80546001600160a01b0319166001600160a01b039290921691909117905561285c565b600b80546001600160a01b0319166001600160a01b0383161790555b600a80546001600160a01b0319166001600160a01b038481169190911790915560405190841681527f97e78f35fad9b724a4846abe5b7d49dd7526592da5a2568d2c86168e6d7818e490602001611f66565b6128b6612b04565b60005b825181101561291b5781602060008584815181106128d9576128d961403c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905561291481614052565b90506128b9565b508160405161292a919061406d565b6040519081900381208215158252907f044cb865167c193654245a0ea4176658c71cf684ddf6145820c388934e4fb8009060200160405180910390a25050565b612972612b04565b6001600160a01b0381166129d75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610eca565b6111be81613021565b6001600160a01b038316612a425760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610eca565b6001600160a01b038216612aa35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610eca565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6008546001600160a01b031633146119955760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610eca565b60026009541415612bb15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610eca565b6002600955565b6000612bc4848461215f565b90506000198114610deb5781811015612c1f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610eca565b610deb84848484036129e0565b6001600160a01b038316612c525760405162461bcd60e51b8152600401610eca90613edd565b6001600160a01b038216612c785760405162461bcd60e51b8152600401610eca90613edd565b60008111612cc05760405162461bcd60e51b8152602060048201526015602482015274416d6f756e742063616e6e6f74206265207a65726f60581b6044820152606401610eca565b6001600160a01b038216600090815260208052604090205460ff16158015612d0057506001600160a01b038316600090815260208052604090205460ff16155b612d315760405162461bcd60e51b81526020600482015260026024820152614e5360f01b6044820152606401610eca565b601c5460ff16612db8576001600160a01b03831660009081526011602052604090205460ff1680612d7a57506001600160a01b03821660009081526011602052604090205460ff165b612db85760405162461bcd60e51b815260206004820152600f60248201526e21b0b73737ba103a3930b739b332b960891b6044820152606401610eca565b6000601d54118015612dd8575043601d546103e8612dd69190613f93565b115b8015612dfd57506001600160a01b03821660009081526012602052604090205460ff16155b15612e6a5760135481612e25846001600160a01b031660009081526020819052604090205490565b612e2f9190613f93565b1115612e6a5760405162461bcd60e51b815260206004820152600a6024820152694349454c3a206d61785760b01b6044820152606401610eca565b600b546000906001600160a01b0384811691161415612e8857506018545b600b546001600160a01b0385811691161415612ea357506019545b6000601d54118015612ec3575043601e54601d54612ec19190613f93565b115b15612eeb576001600160a01b03831660009081526020805260409020805460ff191660011790555b6000601d54118015612f0b57506008546001600160a01b03858116911614155b8015612f265750601e54601d54612f229190613f93565b4311155b8015612f395750601c54610100900460ff165b15612f4357506103b65b6001600160a01b0384166000908152601f602052604090205460ff1680612f8257506001600160a01b0383166000908152601f602052604090205460ff165b80612f9a57506008546001600160a01b038581169116145b15612fa3575060005b601c5462010000900460ff16158015612fbe5750601c5460ff165b8015612fd75750600b546001600160a01b038481169116145b8015612fe35750600081115b1561301557306000908152602081905260408120549061300161309b565b9050808210613012576130126130d7565b50505b610deb84848484613473565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b601b54601a54600b546001600160a01b03166000908152602081905260408120549092916130c891613f52565b6130d29190613f71565b905090565b601c805462ff00001916620100001790556014546000901561312c57600260185460145461310361309b565b61310d9190613f52565b6131179190613f71565b6131219190613f71565b905061312c81613705565b6018544790156133cc57600060026014546131479190613f71565b60185461315491906140ac565b9050600060026018546014548561316b9190613f52565b6131759190613f71565b61317f9190613f71565b905082156133b5576016541561324157600082601654856131a09190613f52565b6131aa9190613f71565b600f546040519192506000916001600160a01b039091169083908381818185875af1925050503d80600081146131fc576040519150601f19603f3d011682016040523d82523d6000602084013e613201565b606091505b50509050801561323e57600f546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b50505b601554156132fb576000826015548561325a9190613f52565b6132649190613f71565b600e546040519192506000916001600160a01b039091169083908381818185875af1925050503d80600081146132b6576040519150601f19603f3d011682016040523d82523d6000602084013e6132bb565b606091505b5050905080156132f857600e546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b50505b601754156133b557600082601754856133149190613f52565b61331e9190613f71565b600d546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114613370576040519150601f19603f3d011682016040523d82523d6000602084013e613375565b606091505b5050905080156133b257600d546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b50505b83156133c5576133c58482613838565b5050613463565b801561346357600e546040516000916001600160a01b03169083908381818185875af1925050503d806000811461341f576040519150601f19603f3d011682016040523d82523d6000602084013e613424565b606091505b50509050801561346157600e546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b505b5050601c805462ff000019169055565b61347b612b5e565b806134905761348b8484846138f8565b6135e9565b60006103e861349f8385613f52565b6134a99190613f71565b905060006134b782856140ac565b90506134c48630846138f8565b6134cf8686836138f8565b60006103e8601754866134e29190613f52565b6134ec9190613f71565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b031663a8caad476040518163ffffffff1660e01b815260040160206040518083038186803b15801561353e57600080fd5b505afa158015613552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135769190613f06565b600d549091506001600160a01b0316639cc45ee16135948484613f93565b6040518263ffffffff1660e01b81526004016135b291815260200190565b600060405180830381600087803b1580156135cc57600080fd5b505af11580156135e0573d6000803e3d6000fd5b50505050505050505b600c546001600160a01b031663e5b843078561361a816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561366057600080fd5b505af1925050508015613671575060015b50600c546001600160a01b031663e5b84307846136a3816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156136e957600080fd5b505af19250505080156136fa575060015b50610deb6001600955565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061373a5761373a61403c565b6001600160a01b03928316602091820292909201810191909152600a54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561378e57600080fd5b505afa1580156137a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137c6919061401f565b816001815181106137d9576137d961403c565b6001600160a01b039283166020918202929092010152600a546137ff91309116846129e0565b600a5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ff39085906001908690309042906004016140c3565b600a546138509030906001600160a01b0316846129e0565b600a5460405163f305d71960e01b8152306004820181905260248201859052600160448301819052606483015260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b1580156138b857600080fd5b505af11580156138cc573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906138f19190613fab565b5050505050565b6001600160a01b03831661395c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610eca565b6001600160a01b0382166139be5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610eca565b6001600160a01b03831660009081526020819052604090205481811015613a365760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610eca565b6001600160a01b0384811660008181526020818152604080832087870390559387168083529184902080548701905592518581529092600080516020614135833981519152910160405180910390a3610deb565b60005b83811015613aa5578181015183820152602001613a8d565b83811115610deb5750506000910152565b6020815260008251806020840152613ad5816040850160208701613a8a565b601f01601f19169190910160400192915050565b6001600160a01b03811681146111be57600080fd5b60008060408385031215613b1157600080fd5b8235613b1c81613ae9565b946020939093013593505050565b80151581146111be57600080fd5b8035613b4381613b2a565b919050565b60008060408385031215613b5b57600080fd5b8235613b6681613ae9565b91506020830135613b7681613b2a565b809150509250929050565b600060208284031215613b9357600080fd5b8135613b9e81613ae9565b9392505050565b600080600060608486031215613bba57600080fd5b8335613bc581613ae9565b92506020840135613bd581613ae9565b929592945050506040919091013590565b60008060408385031215613bf957600080fd5b8235613c0481613ae9565b91506020830135613b7681613ae9565b600060208284031215613c2657600080fd5b5035919050565b60008060408385031215613c4057600080fd5b8235613b1c81613b2a565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613c8a57613c8a613c4b565b604052919050565b60008060008060808587031215613ca857600080fd5b8435613cb381613ae9565b93506020858101359350604086013567ffffffffffffffff80821115613cd857600080fd5b818801915088601f830112613cec57600080fd5b813581811115613cfe57613cfe613c4b565b613d10601f8201601f19168501613c61565b91508082528984828501011115613d2657600080fd5b8084840185840137600090820190930192909252509396929550929360600135925050565b60008060408385031215613d5e57600080fd5b50508035926020909101359150565b600080600080600080600060e0888a031215613d8857600080fd5b8735613d9381613ae9565b96506020880135613da381613ae9565b95506040880135945060608801359350608088013560ff81168114613dc757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215613df757600080fd5b823567ffffffffffffffff80821115613e0f57600080fd5b818501915085601f830112613e2357600080fd5b8135602082821115613e3757613e37613c4b565b8160051b9250613e48818401613c61565b8281529284018101928181019089851115613e6257600080fd5b948201945b84861015613e8c5785359350613e7c84613ae9565b8382529482019490820190613e67565b9650613e9b9050878201613b38565b9450505050509250929050565b600181811c90821680613ebc57607f821691505b6020821081141561309557634e487b7160e01b600052602260045260246000fd5b6020808252600f908201526e4e6f206e756c6c206164647265737360881b604082015260600190565b600060208284031215613f1857600080fd5b5051919050565b600060208284031215613f3157600080fd5b8151613b9e81613b2a565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613f6c57613f6c613f3c565b500290565b600082613f8e57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115613fa657613fa6613f3c565b500190565b600080600060608486031215613fc057600080fd5b8351925060208401519150604084015190509250925092565b6bffffffffffffffffffffffff198560601b16815283601482015260008351614009816034850160208801613a8a565b6034920191820192909252605401949350505050565b60006020828403121561403157600080fd5b8151613b9e81613ae9565b634e487b7160e01b600052603260045260246000fd5b600060001982141561406657614066613f3c565b5060010190565b815160009082906020808601845b838110156140a05781516001600160a01b03168552938201939082019060010161407b565b50929695505050505050565b6000828210156140be576140be613f3c565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156141135784516001600160a01b0316835293830193918301916001016140ee565b50506001600160a01b0396909616606085015250505060800152939250505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220499d7c9dddcf20c807d59507df191555104e29ff0bfe7457e0edd61b93ea07f664736f6c63430008090033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef0000000000000000000000007f73dc1f159558464db94850e5a33a49fd21a8160000000000000000000000007f73dc1f159558464db94850e5a33a49fd21a816

Deployed Bytecode

0x60806040526004361061039b5760003560e01c80638da5cb5b116101dc578063c04a541411610102578063deaa59df116100a0578063ed4941891161006f578063ed49418914610ab6578063f2fde38b14610ad6578063f3a5bb6014610af6578063ffb54a9914610b2657600080fd5b8063deaa59df14610a36578063df7713eb14610a56578063e98030c714610a76578063eafb5a3c14610a9657600080fd5b8063cfc16cea116100dc578063cfc16cea146109c0578063d14f9219146109d6578063d505accf146109f6578063dd62ed3e14610a1657600080fd5b8063c04a541414610961578063c55137a814610981578063c616d580146109a057600080fd5b8063aa4bde281161017a578063b0de48c111610149578063b0de48c1146108f6578063b9c362091461090b578063bf56b3711461092b578063c02466681461094157600080fd5b8063aa4bde281461087b578063acd0d98714610891578063ae0f1cc0146108c1578063af74ff5b146108e157600080fd5b80639e99da22116101b65780639e99da22146107fb578063a35f8a401461081b578063a457c2d71461083b578063a9059cbb1461085b57600080fd5b80638da5cb5b146107b3578063902d55a5146107d157806395d89b41146107e657600080fd5b8063349c1f09116102c15780634e71d92d1161025f578063715018a61161022e578063715018a61461072857806371e8554b1461073d57806375f0a8741461075d5780637ecebe001461077d57600080fd5b80634e71d92d146106845780634fbee19314610699578063700bb191146106d257806370a08231146106f257600080fd5b8063395093511161029b578063395093511461060e57806344cbf0541461062e57806348ca4a7b1461064457806349bd5a5e1461066457600080fd5b8063349c1f09146105a85780633644e515146105c857806336e3ca17146105de57600080fd5b80631694505e1161033957806327a14fc21161030857806327a14fc2146105305780632d4103d6146105505780632e0f262514610570578063313ce5671461058c57600080fd5b80631694505e1461049957806318160ddd146104d157806323b872dd146104f057806325b86edf1461051057600080fd5b80630bc592a5116103755780630bc592a51461041957806310274a6e1461043957806310b8075b14610459578063111e03761461047957600080fd5b806306fdde03146103a7578063095ea7b3146103d25780630976f6371461040257600080fd5b366103a257005b600080fd5b3480156103b357600080fd5b506103bc610b40565b6040516103c99190613ab6565b60405180910390f35b3480156103de57600080fd5b506103f26103ed366004613afe565b610bd2565b60405190151581526020016103c9565b34801561040e57600080fd5b50610417610bea565b005b34801561042557600080fd5b50610417610434366004613b48565b610df1565b34801561044557600080fd5b50610417610454366004613b48565b610e5d565b34801561046557600080fd5b50610417610474366004613b81565b611029565b34801561048557600080fd5b50610417610494366004613b81565b6111c1565b3480156104a557600080fd5b50600a546104b9906001600160a01b031681565b6040516001600160a01b0390911681526020016103c9565b3480156104dd57600080fd5b506002545b6040519081526020016103c9565b3480156104fc57600080fd5b506103f261050b366004613ba5565b611290565b34801561051c57600080fd5b5061041761052b366004613be6565b6112b4565b34801561053c57600080fd5b5061041761054b366004613c14565b61143c565b34801561055c57600080fd5b5061041761056b366004613c2d565b6114ef565b34801561057c57600080fd5b506104e2670de0b6b3a764000081565b34801561059857600080fd5b50604051601281526020016103c9565b3480156105b457600080fd5b506104176105c3366004613b81565b611570565b3480156105d457600080fd5b506104e260075481565b3480156105ea57600080fd5b506103f26105f9366004613b81565b60116020526000908152604090205460ff1681565b34801561061a57600080fd5b506103f2610629366004613afe565b6116cc565b34801561063a57600080fd5b506104e2601b5481565b34801561065057600080fd5b5061041761065f366004613b81565b6116ee565b34801561067057600080fd5b50600b546104b9906001600160a01b031681565b34801561069057600080fd5b5061041761176a565b3480156106a557600080fd5b506103f26106b4366004613b81565b6001600160a01b03166000908152601f602052604090205460ff1690565b3480156106de57600080fd5b506104176106ed366004613c14565b61188e565b3480156106fe57600080fd5b506104e261070d366004613b81565b6001600160a01b031660009081526020819052604090205490565b34801561073457600080fd5b50610417611983565b34801561074957600080fd5b50610417610758366004613b81565b611997565b34801561076957600080fd5b50600e546104b9906001600160a01b031681565b34801561078957600080fd5b506104e2610798366004613b81565b6001600160a01b031660009081526005602052604090205490565b3480156107bf57600080fd5b506008546001600160a01b03166104b9565b3480156107dd57600080fd5b506104e2611a13565b3480156107f257600080fd5b506103bc611a2c565b34801561080757600080fd5b50600d546104b9906001600160a01b031681565b34801561082757600080fd5b506104e2610836366004613c92565b611a3b565b34801561084757600080fd5b506103f2610856366004613afe565b611a74565b34801561086757600080fd5b506103f2610876366004613afe565b611aef565b34801561088757600080fd5b506104e260135481565b34801561089d57600080fd5b506103f26108ac366004613b81565b60126020526000908152604090205460ff1681565b3480156108cd57600080fd5b506104176108dc366004613b48565b611b05565b3480156108ed57600080fd5b50610417611b69565b34801561090257600080fd5b50610417611b9f565b34801561091757600080fd5b50610417610926366004613d4b565b611ce8565b34801561093757600080fd5b506104e2601d5481565b34801561094d57600080fd5b5061041761095c366004613b48565b611d7b565b34801561096d57600080fd5b50600f546104b9906001600160a01b031681565b34801561098d57600080fd5b50601c546103f290610100900460ff1681565b3480156109ac57600080fd5b506104176109bb366004613b81565b611e05565b3480156109cc57600080fd5b506104e2601a5481565b3480156109e257600080fd5b50600c546104b9906001600160a01b031681565b348015610a0257600080fd5b50610417610a11366004613d6d565b611f7a565b348015610a2257600080fd5b506104e2610a31366004613be6565b61215f565b348015610a4257600080fd5b50610417610a51366004613b81565b61218a565b348015610a6257600080fd5b50610417610a71366004613be6565b61222d565b348015610a8257600080fd5b50610417610a91366004613c14565b61240c565b348015610aa257600080fd5b50610417610ab1366004613b81565b6124ee565b348015610ac257600080fd5b50610417610ad1366004613de4565b6128ae565b348015610ae257600080fd5b50610417610af1366004613b81565b61296a565b348015610b0257600080fd5b506103f2610b11366004613b81565b60106020526000908152604090205460ff1681565b348015610b3257600080fd5b50601c546103f29060ff1681565b606060038054610b4f90613ea8565b80601f0160208091040260200160405190810160405280929190818152602001828054610b7b90613ea8565b8015610bc85780601f10610b9d57610100808354040283529160200191610bc8565b820191906000526020600020905b815481529060010190602001808311610bab57829003601f168201915b5050505050905090565b600033610be08185856129e0565b5060019392505050565b610bf2612b04565b600c54600d5460405163dd261cc360e01b81526001600160a01b03918216600482015291169063dd261cc390602401600060405180830381600087803b158015610c3b57600080fd5b505af1158015610c4f573d6000803e3d6000fd5b5050600c54600b5460405163dd261cc360e01b81526001600160a01b0391821660048201529116925063dd261cc39150602401600060405180830381600087803b158015610c9c57600080fd5b505af1158015610cb0573d6000803e3d6000fd5b5050600c5460405163dd261cc360e01b81523060048201526001600160a01b03909116925063dd261cc39150602401600060405180830381600087803b158015610cf957600080fd5b505af1158015610d0d573d6000803e3d6000fd5b5050600c546001600160a01b0316915063dd261cc39050336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401600060405180830381600087803b158015610d6657600080fd5b505af1158015610d7a573d6000803e3d6000fd5b5050600c5460405163dd261cc360e01b815273deaddeaddeaddeaddeaddeaddeaddeaddeaddead60048201526001600160a01b03909116925063dd261cc39150602401600060405180830381600087803b158015610dd757600080fd5b505af1158015610deb573d6000803e3d6000fd5b50505050565b610df9612b04565b6001600160a01b038216600081815260116020908152604091829020805460ff19168515159081179091558251938452908301527f6e711aeccc7ea41d059235017881b7c3953c8fc73d3dd629a91855bbf51ffe6091015b60405180910390a15050565b610e65612b04565b6001600160a01b0382163b15158015610e8657506001600160a01b03821615155b610ed35760405162461bcd60e51b815260206004820152601960248201527821a4a2a61d1020b2323932b9b99034b99034b73b30b634b21760391b60448201526064015b60405180910390fd5b6001600160a01b03821660009081526010602052604090205460ff16151560011415610f395760405162461bcd60e51b815260206004820152601560248201527410d251530e88185b1c9958591e481a5b881b1a5cdd605a1b6044820152606401610eca565b6001600160a01b0382811660008181526010602052604090819020805460ff19166001908117909155600d549151633bda509960e21b8152600481019390935260248301529091169063ef69426490604401600060405180830381600087803b158015610fa557600080fd5b505af1158015610fb9573d6000803e3d6000fd5b5050600d546040516309392c7760e11b81526001600160a01b0386811660048301528515156024830152909116925063127258ee91506044015b600060405180830381600087803b15801561100d57600080fd5b505af1158015611021573d6000803e3d6000fd5b505050505050565b611031612b04565b611039612b5e565b6001600160a01b03811660009081526010602052604090205460ff16151560011461109e5760405162461bcd60e51b815260206004820152601560248201527410d251530e88151bdad95b881b9bdd08199bdd5b99605a1b6044820152606401610eca565b6001600160a01b0381811660008181526010602052604090819020805460ff19169055600d549051631e18fa1160e11b8152600481019290925290911690633c31f42290602401600060405180830381600087803b1580156110ff57600080fd5b505af1158015611113573d6000803e3d6000fd5b5050600d5460405163edf67eeb60e01b81526001600160a01b038581166004830152909116925063edf67eeb9150602401600060405180830381600087803b15801561115e57600080fd5b505af1158015611172573d6000803e3d6000fd5b50506040516001600160a01b03841681527f66257bcef574219c04f7c05f7a1c78d599da10491294c92a5805c48b4cdf5009925060200190505b60405180910390a16111be6001600955565b50565b6111c9612b04565b6111d1612b5e565b6001600160a01b0381166111f75760405162461bcd60e51b8152600401610eca90613edd565b600c5460405163dd261cc360e01b81526001600160a01b0383811660048301529091169063dd261cc390602401600060405180830381600087803b15801561123e57600080fd5b505af1158015611252573d6000803e3d6000fd5b50506040516001600160a01b03841681527f9dc0c5d829ba95d4a3aa3e40791b3e0ff125f876788532b9f7f6eb543d8dfbd6925060200190506111ac565b60003361129e858285612bb8565b6112a9858585612c2c565b506001949350505050565b6112bc612b04565b6112c4612b5e565b6040516370a0823160e01b81523060048201526000906001600160a01b038416906370a082319060240160206040518083038186803b15801561130657600080fd5b505afa15801561131a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133e9190613f06565b60405163a9059cbb60e01b81526001600160a01b0384811660048301526024820183905291925060009185169063a9059cbb90604401602060405180830381600087803b15801561138e57600080fd5b505af11580156113a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c69190613f1f565b9050806113fe5760405162461bcd60e51b815260206004820152600660248201526511985a5b195960d21b6044820152606401610eca565b6040518281526001600160a01b0384169030906000805160206141358339815191529060200160405180910390a350506114386001600955565b5050565b611444612b04565b6298968061145e670de0b6b3a7640000633b9aca00613f52565b61146990600f613f52565b6114739190613f71565b81116114b35760405162461bcd60e51b815260206004820152600f60248201526e10d251530e881d1bdbc81cdb585b1b608a1b6044820152606401610eca565b60138190556040518181527f22c83a5ec34271153086583a02141e6d8afa47085fffe4f3c546e7011357aa09906020015b60405180910390a150565b6114f7612b04565b601c805460ff191683151590811790915560ff1680156115175750601d54155b1561152f5743601d5561152b816002613f93565b601e555b601d54601c546040805192835260ff909116151560208301527f617c8606af468e56cf5bcb9e5b0c7fdaaf70ece355b61c0720bb21ddbb39b7ca9101610e51565b611578612b04565b611580612b5e565b6001600160a01b0381166115ce5760405162461bcd60e51b81526020600482015260156024820152744349454c3a206e6f206e756c6c206164647265737360581b6044820152606401610eca565b600b546001600160a01b038281169116141561161e5760405162461bcd60e51b815260206004820152600f60248201526e21a4a2a61d1029b0b6b2902830b4b960891b6044820152606401610eca565b600c5460405163dd261cc360e01b81526001600160a01b0383811660048301529091169063dd261cc390602401600060405180830381600087803b15801561166557600080fd5b505af1158015611679573d6000803e3d6000fd5b5050600b80546001600160a01b0319166001600160a01b0385169081179091556040519081527f358f3cb203433a03de149efbff60641f40bcd6fe750981527942877c50b838da925060200190506111ac565b600033610be08185856116df838361215f565b6116e99190613f93565b6129e0565b6116f6612b04565b6001600160a01b03811661171c5760405162461bcd60e51b8152600401610eca90613edd565b600c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f3e4261d437a10fe4eded51408541866fd82bea4423ed6440a31c170d8a1a5ba1906020016114e4565b601c5460ff166117b55760405162461bcd60e51b815260206004820152601660248201527521a4a2a61d102a3930b234b733903737ba1037b832b760511b6044820152606401610eca565b600c546000906001600160a01b031663cc2a04da336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260006024820152604401602060405180830381600087803b15801561181257600080fd5b505af1158015611826573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184a9190613f1f565b9050806111be5760405162461bcd60e51b8152602060048201526012602482015271556e7375636365737366756c20636c61696d60701b6044820152606401610eca565b611896612b04565b61189e612b5e565b600c5460405163a969204760e01b815260048101839052600091829182916001600160a01b03169063a969204790602401606060405180830381600087803b1580156118e957600080fd5b505af11580156118fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119219190613fab565b604080518481526020810184905290810182905260608101889052929550909350915032906000907fc864333d6121033635ab41b29ae52f10a22cf4438c3e4f1c4c68518feb2f8a989060800160405180910390a35050506111be6001600955565b61198b612b04565b6119956000613021565b565b61199f612b04565b6001600160a01b0381166119c55760405162461bcd60e51b8152600401610eca90613edd565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527fb83207924c1f42963eb1e5fb59a51b6c5b4cbcd659a9be15593ec3f3d8ec9430906020016114e4565b611a29670de0b6b3a7640000633b9aca00613f52565b81565b606060048054610b4f90613ea8565b600084848484604051602001611a549493929190613fd9565b604051602081830303815290604052805190602001209050949350505050565b60003381611a82828661215f565b905083811015611ae25760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610eca565b6112a982868684036129e0565b6000611afc338484612c2c565b50600192915050565b611b0d612b04565b6001600160a01b038216600081815260126020908152604091829020805460ff19168515159081179091558251938452908301527f6bad460a4857213327743a019dab27190e04974d74986f8d2a9d2777c064ef809101610e51565b611b71612b04565b601c54610100900460ff1615611b8e57601c805461ff0019169055565b601c805461ff001916610100179055565b611ba7612b04565b611bc6732260fac5e5542a773aa44fbcfedf7c193bc2c5996001610e5d565b611be573c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001610e5d565b611c0473a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001610e5d565b611c237395ad61b0a150d79219dcf64e1e6cc01f0b64c4ce6001610e5d565b611c427345804880de22913dafe09f4980848ece6ecbaf786001610e5d565b611c61730f5d2fb29fb7d3cfee444a200298f468908cc9426001610e5d565b611c8073514910771af9ca656af840dff83e8264ecf986ca6001610e5d565b611c9f739f8f72aa9304c8b593d555f12ef6589cc3a579a26001610e5d565b611cbe730d8775f648430679a709e98d2b0cb6250d2887ef6001610e5d565b611cdd731f9840a85d5af5bf1d1762f925bdaddc4201f9846001610e5d565b611995306000610e5d565b611cf0612b04565b600081118015611d005750600082115b611d405760405162461bcd60e51b815260206004820152601160248201527004349454c3a206d757374206265203c203607c1b6044820152606401610eca565b601a829055601b819055604051819083907fb7b89c3d5d1358735329a05968ba8aa530205e9ed59cfdbcb6c1ac434cf3145990600090a35050565b611d83612b04565b6001600160a01b038216611da95760405162461bcd60e51b8152600401610eca90613edd565b6001600160a01b0382166000818152601f6020908152604091829020805460ff19168515159081179091558251938452908301527f9d8f7706ea1113d1a167b526eca956215946dd36cc7df39eb16180222d8b5df79101610e51565b611e0d612b04565b611e15612b5e565b6001600160a01b038116611e635760405162461bcd60e51b81526020600482015260156024820152744349454c3a204e6f206e756c6c206164647265737360581b6044820152606401610eca565b47611e9f5760405162461bcd60e51b815260206004820152600c60248201526b086928a987440dcde408aa8960a31b6044820152606401610eca565b60405147906000906001600160a01b0384169083908381818185875af1925050503d8060008114611eec576040519150601f19603f3d011682016040523d82523d6000602084013e611ef1565b606091505b5050905080611f2b5760405162461bcd60e51b815260206004820152600660248201526511985a5b195960d21b6044820152606401610eca565b604080516001600160a01b0385168152602081018490527f94b2de810873337ed265c5f8cf98c9cffefa06b8607f9a2f1fbaebdfbcfbef1c91015b60405180910390a150506111be6001600955565b83421115611fca5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610eca565b60006007547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9898989611ffc8d613073565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161207192919061190160f01b81526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156120dc573d6000803e3d6000fd5b505050602060405103519050886001600160a01b0316816001600160a01b0316146121495760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610eca565b6121548989896129e0565b505050505050505050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b612192612b04565b6001600160a01b0381166121df5760405162461bcd60e51b81526020600482015260146024820152734349454c3a206e6f206e756c6c2061646472657360601b6044820152606401610eca565b600e80546001600160a01b0319166001600160a01b0383169081179091556040519081527fe80d9383fb35934b174e9a5986b6ec524e533eae802ba534282f7b0c5fdd42cc906020016114e4565b612235612b5e565b6001600160a01b0381163b1515801561225657506001600160a01b03811615155b61229e5760405162461bcd60e51b815260206004820152601960248201527821a4a2a61d1020b2323932b9b99034b99034b73b30b634b21760391b6044820152606401610eca565b6001600160a01b03821633146122f65760405162461bcd60e51b815260206004820181905260248201527f4349454c3a2063616e206f6e6c792073657420666f7220796f757273656c662e6044820152606401610eca565b6001600160a01b03811660009081526010602052604090205460ff1615156001146123575760405162461bcd60e51b815260206004820152601160248201527010d251530e881b9bdd081a5b881b1a5cdd607a1b6044820152606401610eca565b600d5460405163aaff4abb60e01b81526001600160a01b03848116600483015283811660248301529091169063aaff4abb90604401600060405180830381600087803b1580156123a657600080fd5b505af11580156123ba573d6000803e3d6000fd5b5050604080516001600160a01b038087168252851660208201527f3c5d246d9b6265112eac79010e451e0aa5162a429f9aa2b1f9ebcb8dac08955d935001905060405180910390a16114386001600955565b612414612b04565b61241c612b5e565b62093a8081111561245f5760405162461bcd60e51b815260206004820152600d60248201526c21a4a2a61d1039b437b93a32b960991b6044820152606401610eca565b600c54604051636bf30e6560e11b8152600481018390526001600160a01b039091169063d7e61cca90602401600060405180830381600087803b1580156124a557600080fd5b505af11580156124b9573d6000803e3d6000fd5b505050507fcd3b3761216f9fa924ba597d3dd40d6a234292583122b4aafa561889844b7822816040516111ac91815260200190565b6124f6612b04565b6124fe612b5e565b6001600160a01b0381166125245760405162461bcd60e51b8152600401610eca90613edd565b60008190506000816001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561256457600080fd5b505afa158015612578573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061259c919061401f565b6001600160a01b031663e6a4390530846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156125e457600080fd5b505afa1580156125f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061261c919061401f565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260440160206040518083038186803b15801561266257600080fd5b505afa158015612676573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061269a919061401f565b90506001600160a01b03811661284057816001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156126e357600080fd5b505afa1580156126f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061271b919061401f565b6001600160a01b031663c9c6539630846001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561276357600080fd5b505afa158015612777573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279b919061401f565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156127e357600080fd5b505af11580156127f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061281b919061401f565b600b80546001600160a01b0319166001600160a01b039290921691909117905561285c565b600b80546001600160a01b0319166001600160a01b0383161790555b600a80546001600160a01b0319166001600160a01b038481169190911790915560405190841681527f97e78f35fad9b724a4846abe5b7d49dd7526592da5a2568d2c86168e6d7818e490602001611f66565b6128b6612b04565b60005b825181101561291b5781602060008584815181106128d9576128d961403c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905561291481614052565b90506128b9565b508160405161292a919061406d565b6040519081900381208215158252907f044cb865167c193654245a0ea4176658c71cf684ddf6145820c388934e4fb8009060200160405180910390a25050565b612972612b04565b6001600160a01b0381166129d75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610eca565b6111be81613021565b6001600160a01b038316612a425760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610eca565b6001600160a01b038216612aa35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610eca565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6008546001600160a01b031633146119955760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610eca565b60026009541415612bb15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610eca565b6002600955565b6000612bc4848461215f565b90506000198114610deb5781811015612c1f5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610eca565b610deb84848484036129e0565b6001600160a01b038316612c525760405162461bcd60e51b8152600401610eca90613edd565b6001600160a01b038216612c785760405162461bcd60e51b8152600401610eca90613edd565b60008111612cc05760405162461bcd60e51b8152602060048201526015602482015274416d6f756e742063616e6e6f74206265207a65726f60581b6044820152606401610eca565b6001600160a01b038216600090815260208052604090205460ff16158015612d0057506001600160a01b038316600090815260208052604090205460ff16155b612d315760405162461bcd60e51b81526020600482015260026024820152614e5360f01b6044820152606401610eca565b601c5460ff16612db8576001600160a01b03831660009081526011602052604090205460ff1680612d7a57506001600160a01b03821660009081526011602052604090205460ff165b612db85760405162461bcd60e51b815260206004820152600f60248201526e21b0b73737ba103a3930b739b332b960891b6044820152606401610eca565b6000601d54118015612dd8575043601d546103e8612dd69190613f93565b115b8015612dfd57506001600160a01b03821660009081526012602052604090205460ff16155b15612e6a5760135481612e25846001600160a01b031660009081526020819052604090205490565b612e2f9190613f93565b1115612e6a5760405162461bcd60e51b815260206004820152600a6024820152694349454c3a206d61785760b01b6044820152606401610eca565b600b546000906001600160a01b0384811691161415612e8857506018545b600b546001600160a01b0385811691161415612ea357506019545b6000601d54118015612ec3575043601e54601d54612ec19190613f93565b115b15612eeb576001600160a01b03831660009081526020805260409020805460ff191660011790555b6000601d54118015612f0b57506008546001600160a01b03858116911614155b8015612f265750601e54601d54612f229190613f93565b4311155b8015612f395750601c54610100900460ff165b15612f4357506103b65b6001600160a01b0384166000908152601f602052604090205460ff1680612f8257506001600160a01b0383166000908152601f602052604090205460ff165b80612f9a57506008546001600160a01b038581169116145b15612fa3575060005b601c5462010000900460ff16158015612fbe5750601c5460ff165b8015612fd75750600b546001600160a01b038481169116145b8015612fe35750600081115b1561301557306000908152602081905260408120549061300161309b565b9050808210613012576130126130d7565b50505b610deb84848484613473565b600880546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b601b54601a54600b546001600160a01b03166000908152602081905260408120549092916130c891613f52565b6130d29190613f71565b905090565b601c805462ff00001916620100001790556014546000901561312c57600260185460145461310361309b565b61310d9190613f52565b6131179190613f71565b6131219190613f71565b905061312c81613705565b6018544790156133cc57600060026014546131479190613f71565b60185461315491906140ac565b9050600060026018546014548561316b9190613f52565b6131759190613f71565b61317f9190613f71565b905082156133b5576016541561324157600082601654856131a09190613f52565b6131aa9190613f71565b600f546040519192506000916001600160a01b039091169083908381818185875af1925050503d80600081146131fc576040519150601f19603f3d011682016040523d82523d6000602084013e613201565b606091505b50509050801561323e57600f546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b50505b601554156132fb576000826015548561325a9190613f52565b6132649190613f71565b600e546040519192506000916001600160a01b039091169083908381818185875af1925050503d80600081146132b6576040519150601f19603f3d011682016040523d82523d6000602084013e6132bb565b606091505b5050905080156132f857600e546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b50505b601754156133b557600082601754856133149190613f52565b61331e9190613f71565b600d546040519192506000916001600160a01b039091169083908381818185875af1925050503d8060008114613370576040519150601f19603f3d011682016040523d82523d6000602084013e613375565b606091505b5050905080156133b257600d546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b50505b83156133c5576133c58482613838565b5050613463565b801561346357600e546040516000916001600160a01b03169083908381818185875af1925050503d806000811461341f576040519150601f19603f3d011682016040523d82523d6000602084013e613424565b606091505b50509050801561346157600e546040518381526001600160a01b039091169030906000805160206141358339815191529060200160405180910390a35b505b5050601c805462ff000019169055565b61347b612b5e565b806134905761348b8484846138f8565b6135e9565b60006103e861349f8385613f52565b6134a99190613f71565b905060006134b782856140ac565b90506134c48630846138f8565b6134cf8686836138f8565b60006103e8601754866134e29190613f52565b6134ec9190613f71565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b031663a8caad476040518163ffffffff1660e01b815260040160206040518083038186803b15801561353e57600080fd5b505afa158015613552573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135769190613f06565b600d549091506001600160a01b0316639cc45ee16135948484613f93565b6040518263ffffffff1660e01b81526004016135b291815260200190565b600060405180830381600087803b1580156135cc57600080fd5b505af11580156135e0573d6000803e3d6000fd5b50505050505050505b600c546001600160a01b031663e5b843078561361a816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b15801561366057600080fd5b505af1925050508015613671575060015b50600c546001600160a01b031663e5b84307846136a3816001600160a01b031660009081526020819052604090205490565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b1580156136e957600080fd5b505af19250505080156136fa575060015b50610deb6001600955565b604080516002808252606082018352600092602083019080368337019050509050308160008151811061373a5761373a61403c565b6001600160a01b03928316602091820292909201810191909152600a54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561378e57600080fd5b505afa1580156137a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137c6919061401f565b816001815181106137d9576137d961403c565b6001600160a01b039283166020918202929092010152600a546137ff91309116846129e0565b600a5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610ff39085906001908690309042906004016140c3565b600a546138509030906001600160a01b0316846129e0565b600a5460405163f305d71960e01b8152306004820181905260248201859052600160448301819052606483015260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b1580156138b857600080fd5b505af11580156138cc573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906138f19190613fab565b5050505050565b6001600160a01b03831661395c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610eca565b6001600160a01b0382166139be5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610eca565b6001600160a01b03831660009081526020819052604090205481811015613a365760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610eca565b6001600160a01b0384811660008181526020818152604080832087870390559387168083529184902080548701905592518581529092600080516020614135833981519152910160405180910390a3610deb565b60005b83811015613aa5578181015183820152602001613a8d565b83811115610deb5750506000910152565b6020815260008251806020840152613ad5816040850160208701613a8a565b601f01601f19169190910160400192915050565b6001600160a01b03811681146111be57600080fd5b60008060408385031215613b1157600080fd5b8235613b1c81613ae9565b946020939093013593505050565b80151581146111be57600080fd5b8035613b4381613b2a565b919050565b60008060408385031215613b5b57600080fd5b8235613b6681613ae9565b91506020830135613b7681613b2a565b809150509250929050565b600060208284031215613b9357600080fd5b8135613b9e81613ae9565b9392505050565b600080600060608486031215613bba57600080fd5b8335613bc581613ae9565b92506020840135613bd581613ae9565b929592945050506040919091013590565b60008060408385031215613bf957600080fd5b8235613c0481613ae9565b91506020830135613b7681613ae9565b600060208284031215613c2657600080fd5b5035919050565b60008060408385031215613c4057600080fd5b8235613b1c81613b2a565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613c8a57613c8a613c4b565b604052919050565b60008060008060808587031215613ca857600080fd5b8435613cb381613ae9565b93506020858101359350604086013567ffffffffffffffff80821115613cd857600080fd5b818801915088601f830112613cec57600080fd5b813581811115613cfe57613cfe613c4b565b613d10601f8201601f19168501613c61565b91508082528984828501011115613d2657600080fd5b8084840185840137600090820190930192909252509396929550929360600135925050565b60008060408385031215613d5e57600080fd5b50508035926020909101359150565b600080600080600080600060e0888a031215613d8857600080fd5b8735613d9381613ae9565b96506020880135613da381613ae9565b95506040880135945060608801359350608088013560ff81168114613dc757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215613df757600080fd5b823567ffffffffffffffff80821115613e0f57600080fd5b818501915085601f830112613e2357600080fd5b8135602082821115613e3757613e37613c4b565b8160051b9250613e48818401613c61565b8281529284018101928181019089851115613e6257600080fd5b948201945b84861015613e8c5785359350613e7c84613ae9565b8382529482019490820190613e67565b9650613e9b9050878201613b38565b9450505050509250929050565b600181811c90821680613ebc57607f821691505b6020821081141561309557634e487b7160e01b600052602260045260246000fd5b6020808252600f908201526e4e6f206e756c6c206164647265737360881b604082015260600190565b600060208284031215613f1857600080fd5b5051919050565b600060208284031215613f3157600080fd5b8151613b9e81613b2a565b634e487b7160e01b600052601160045260246000fd5b6000816000190483118215151615613f6c57613f6c613f3c565b500290565b600082613f8e57634e487b7160e01b600052601260045260246000fd5b500490565b60008219821115613fa657613fa6613f3c565b500190565b600080600060608486031215613fc057600080fd5b8351925060208401519150604084015190509250925092565b6bffffffffffffffffffffffff198560601b16815283601482015260008351614009816034850160208801613a8a565b6034920191820192909252605401949350505050565b60006020828403121561403157600080fd5b8151613b9e81613ae9565b634e487b7160e01b600052603260045260246000fd5b600060001982141561406657614066613f3c565b5060010190565b815160009082906020808601845b838110156140a05781516001600160a01b03168552938201939082019060010161407b565b50929695505050505050565b6000828210156140be576140be613f3c565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156141135784516001600160a01b0316835293830193918301916001016140ee565b50506001600160a01b0396909616606085015250505060800152939250505056feddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220499d7c9dddcf20c807d59507df191555104e29ff0bfe7457e0edd61b93ea07f664736f6c63430008090033

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

0000000000000000000000007f73dc1f159558464db94850e5a33a49fd21a8160000000000000000000000007f73dc1f159558464db94850e5a33a49fd21a816

-----Decoded View---------------
Arg [0] : _marketingWallet (address): 0x7f73Dc1f159558464dB94850E5a33A49fd21a816
Arg [1] : _developmentWallet (address): 0x7f73Dc1f159558464dB94850E5a33A49fd21a816

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000007f73dc1f159558464db94850e5a33a49fd21a816
Arg [1] : 0000000000000000000000007f73dc1f159558464db94850e5a33a49fd21a816


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

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