ETH Price: $1,976.22 (+0.71%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Deposit245092302026-02-22 1:50:115 hrs ago1771725011IN
0xA060c439...1086A988E
0 ETH0.000378952.03346631
Lock Config Fore...245089442026-02-22 0:52:356 hrs ago1771721555IN
0xA060c439...1086A988E
0 ETH0.000045971.53336101
Set Model Enable...245089432026-02-22 0:52:236 hrs ago1771721543IN
0xA060c439...1086A988E
0 ETH0.000043881.53118051
Set Model Enable...245089422026-02-22 0:52:116 hrs ago1771721531IN
0xA060c439...1086A988E
0 ETH0.000043891.53149053
Set Model Enable...245089412026-02-22 0:51:596 hrs ago1771721519IN
0xA060c439...1086A988E
0 ETH0.000074481.53347753
Set Model Enable...245089402026-02-22 0:51:476 hrs ago1771721507IN
0xA060c439...1086A988E
0 ETH0.000074471.53328849
Set Model Enable...245089392026-02-22 0:51:356 hrs ago1771721495IN
0xA060c439...1086A988E
0 ETH0.000074331.53039141
Set Model Token245089382026-02-22 0:51:236 hrs ago1771721483IN
0xA060c439...1086A988E
0 ETH0.000074931.53175486
Set Model Token245089372026-02-22 0:51:116 hrs ago1771721471IN
0xA060c439...1086A988E
0 ETH0.000074931.53181196
Set Model Token245089362026-02-22 0:50:596 hrs ago1771721459IN
0xA060c439...1086A988E
0 ETH0.000075041.5339823
Set Model Token245089352026-02-22 0:50:476 hrs ago1771721447IN
0xA060c439...1086A988E
0 ETH0.000075121.53574793
Set Model Token245089342026-02-22 0:50:356 hrs ago1771721435IN
0xA060c439...1086A988E
0 ETH0.000075061.53451246
0x60e06040245089232026-02-22 0:48:236 hrs ago1771721303IN
 Create: SBELMFxCoreVault
0 ETH0.002961681.53220713
VIEW ADVANCED FILTER
Age:24H
Reset Filter

Advanced mode:
Parent Transaction Hash Method Block
From
To

There are no matching entries

Update your filters to view other transactions

View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SBELMFxCoreVault

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";

interface IFxModelToken {
    function mint(address to, uint256 amount) external;
    function burnFrom(address from, uint256 amount) external;
    function decimals() external view returns (uint8);
}

interface IFxTreasury {
    function withdrawUSDC(address to, uint256 amount) external;
    function usdcBalance() external view returns (uint256);
}

interface IFxStakingPool {
    function notifyFee(uint256 amount) external;
}

/**
 * SBELMFxCoreVault
 *
 * Core accounting and execution engine of SBELM FX.
 * Fully deterministic.
 */
contract SBELMFxCoreVault is AccessControl, ReentrancyGuard {
    using SafeERC20 for IERC20Metadata;

    bytes32 public constant ADMIN_ROLE = DEFAULT_ADMIN_ROLE;

    error ZeroAddress();
    error ZeroAmount();
    error ModelDisabled();
    error DecimalsMismatch();
    error InsufficientTreasury();
    error BadFee();
    error ConfigLocked();
    error BadModel();

    event Deposit(
        address indexed user,
        uint8 indexed modelId,
        uint256 usdcIn,
        uint256 sharesOut,
        uint256 feeIn
    );

    event Redeem(
        address indexed user,
        uint8 indexed modelId,
        uint256 sharesIn,
        uint256 usdcOut,
        uint256 feeOut
    );

    event FeesUpdated(uint16 feeBpsIn, uint16 feeBpsOut);
    event FeeRecipientsUpdated(address devWallet, address stakingPool);

    event CashAllocated(uint8 indexed modelId, uint256 eurDelta, uint256 usdDelta);
    event CashDeallocated(uint8 indexed modelId, uint256 eurDelta, uint256 usdDelta);

    event ConfigLockedForever(address indexed locker);

    IERC20Metadata public immutable usdc;
    IFxTreasury public immutable treasury;
    IFxModelToken public immutable feeToken;

    mapping(uint8 => address) public modelToken;
    mapping(uint8 => bool) public modelEnabled;

    uint256 public eurCash;
    uint256 public usdCash;

    uint16 public feeBpsIn;
    uint16 public feeBpsOut;

    address public devWallet;
    address public stakingPool;
    IFxStakingPool private _staking;

    bool public configLocked;

    modifier whenConfigNotLocked() {
        if (configLocked) revert ConfigLocked();
        _;
    }

    constructor(
        address usdc_,
        address treasury_,
        address feeToken_,
        address devWallet_,
        address stakingPool_,
        address admin_
    ) {
        if (
            usdc_ == address(0) ||
            treasury_ == address(0) ||
            feeToken_ == address(0) ||
            devWallet_ == address(0) ||
            stakingPool_ == address(0) ||
            admin_ == address(0)
        ) revert ZeroAddress();

        usdc = IERC20Metadata(usdc_);
        treasury = IFxTreasury(treasury_);
        feeToken = IFxModelToken(feeToken_);

        devWallet = devWallet_;
        stakingPool = stakingPool_;
        _staking = IFxStakingPool(stakingPool_);

        _grantRole(ADMIN_ROLE, admin_);
    }

    // -------- Admin --------

    function lockConfigForever()
        external
        onlyRole(ADMIN_ROLE)
        whenConfigNotLocked
    {
        configLocked = true;
        emit ConfigLockedForever(msg.sender);
    }

    function setModelToken(uint8 modelId, address token)
        external
        onlyRole(ADMIN_ROLE)
        whenConfigNotLocked
    {
        if (token == address(0)) revert ZeroAddress();
        if (modelId < 1 || modelId > 5) revert BadModel();
        modelToken[modelId] = token;
    }

    function setModelEnabled(uint8 modelId, bool enabled)
        external
        onlyRole(ADMIN_ROLE)
        whenConfigNotLocked
    {
        if (modelId < 1 || modelId > 5) revert BadModel();
        modelEnabled[modelId] = enabled;
    }

    function setFees(uint16 feeBpsIn_, uint16 feeBpsOut_)
        external
        onlyRole(ADMIN_ROLE)
        whenConfigNotLocked
    {
        if (feeBpsIn_ > 500 || feeBpsOut_ > 500) revert BadFee();
        feeBpsIn = feeBpsIn_;
        feeBpsOut = feeBpsOut_;
        emit FeesUpdated(feeBpsIn_, feeBpsOut_);
    }

    function setFeeRecipients(address devWallet_, address stakingPool_)
        external
        onlyRole(ADMIN_ROLE)
        whenConfigNotLocked
    {
        if (devWallet_ == address(0) || stakingPool_ == address(0))
            revert ZeroAddress();

        devWallet = devWallet_;
        stakingPool = stakingPool_;
        _staking = IFxStakingPool(stakingPool_);

        emit FeeRecipientsUpdated(devWallet_, stakingPool_);
    }

    // -------- Views --------

    function treasuryUsdc() external view returns (uint256) {
        return treasury.usdcBalance();
    }

    function modelEurWeightBps(uint8 modelId) public pure returns (uint16) {
        if (modelId == 1) return 5000;
        if (modelId == 2) return 2500;
        if (modelId == 3) return 0;
        if (modelId == 4) return 7500;
        if (modelId == 5) return 10000;
        return 0;
    }

    // -------- Core flows --------

    function deposit(uint256 usdcAmount, uint8 modelId, address receiver)
        external
        nonReentrant
        returns (uint256 sharesOut)
    {
        if (!modelEnabled[modelId]) revert ModelDisabled();
        if (usdcAmount == 0) revert ZeroAmount();
        if (receiver == address(0)) revert ZeroAddress();

        address tokenAddr = modelToken[modelId];
        if (tokenAddr == address(0)) revert ZeroAddress();

        if (IFxModelToken(tokenAddr).decimals() != usdc.decimals())
            revert DecimalsMismatch();
        if (feeToken.decimals() != usdc.decimals())
            revert DecimalsMismatch();

        uint256 feeIn = (usdcAmount * feeBpsIn) / 10000;
        sharesOut = usdcAmount - feeIn;

        usdc.safeTransferFrom(msg.sender, address(treasury), usdcAmount);

        uint16 wE = modelEurWeightBps(modelId);
        uint256 allocEur = (sharesOut * wE) / 10000;
        uint256 allocUsd = sharesOut - allocEur;

        eurCash += allocEur;
        usdCash += allocUsd;

        emit CashAllocated(modelId, allocEur, allocUsd);

        IFxModelToken(tokenAddr).mint(receiver, sharesOut);

        if (feeIn > 0) {
            uint256 devCut = (feeIn * 20) / 100;
            uint256 stakersCut = feeIn - devCut;

            feeToken.mint(devWallet, devCut);
            feeToken.mint(stakingPool, stakersCut);
            _staking.notifyFee(stakersCut);
        }

        emit Deposit(receiver, modelId, usdcAmount, sharesOut, feeIn);
    }

    function redeem(uint256 sharesIn, uint8 modelId, address receiver)
        external
        nonReentrant
        returns (uint256 usdcOut)
    {
        if (!modelEnabled[modelId]) revert ModelDisabled();
        if (sharesIn == 0) revert ZeroAmount();
        if (receiver == address(0)) revert ZeroAddress();

        address tokenAddr = modelToken[modelId];
        if (tokenAddr == address(0)) revert ZeroAddress();

        IFxModelToken(tokenAddr).burnFrom(msg.sender, sharesIn);

        uint256 feeOut = (sharesIn * feeBpsOut) / 10000;
        usdcOut = sharesIn - feeOut;

        uint16 wE = modelEurWeightBps(modelId);
        uint256 deallocEur = (sharesIn * wE) / 10000;
        uint256 deallocUsd = sharesIn - deallocEur;

        eurCash -= deallocEur;
        usdCash -= deallocUsd;

        emit CashDeallocated(modelId, deallocEur, deallocUsd);

        if (treasury.usdcBalance() < usdcOut)
            revert InsufficientTreasury();

        treasury.withdrawUSDC(receiver, usdcOut);

        if (feeOut > 0) {
            uint256 devCut = (feeOut * 20) / 100;
            uint256 stakersCut = feeOut - devCut;

            feeToken.mint(devWallet, devCut);
            feeToken.mint(stakingPool, stakersCut);
            _staking.notifyFee(stakersCut);
        }

        emit Redeem(msg.sender, modelId, sharesIn, usdcOut, feeOut);
    }
}

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

pragma solidity ^0.8.0;

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

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

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

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

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

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

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

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

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

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

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

        _revokeRole(role, account);
    }

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "../IERC20.sol";

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
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].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

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

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

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

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

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

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

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

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"usdc_","type":"address"},{"internalType":"address","name":"treasury_","type":"address"},{"internalType":"address","name":"feeToken_","type":"address"},{"internalType":"address","name":"devWallet_","type":"address"},{"internalType":"address","name":"stakingPool_","type":"address"},{"internalType":"address","name":"admin_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BadFee","type":"error"},{"inputs":[],"name":"BadModel","type":"error"},{"inputs":[],"name":"ConfigLocked","type":"error"},{"inputs":[],"name":"DecimalsMismatch","type":"error"},{"inputs":[],"name":"InsufficientTreasury","type":"error"},{"inputs":[],"name":"ModelDisabled","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"modelId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"eurDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdDelta","type":"uint256"}],"name":"CashAllocated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint8","name":"modelId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"eurDelta","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdDelta","type":"uint256"}],"name":"CashDeallocated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"locker","type":"address"}],"name":"ConfigLockedForever","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint8","name":"modelId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"usdcIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sharesOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeIn","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"devWallet","type":"address"},{"indexed":false,"internalType":"address","name":"stakingPool","type":"address"}],"name":"FeeRecipientsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"feeBpsIn","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"feeBpsOut","type":"uint16"}],"name":"FeesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"uint8","name":"modelId","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"sharesIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdcOut","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"feeOut","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"configLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdcAmount","type":"uint256"},{"internalType":"uint8","name":"modelId","type":"uint8"},{"internalType":"address","name":"receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"sharesOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devWallet","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eurCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeBpsIn","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeBpsOut","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeToken","outputs":[{"internalType":"contract IFxModelToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockConfigForever","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"modelEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"modelId","type":"uint8"}],"name":"modelEurWeightBps","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint8","name":"","type":"uint8"}],"name":"modelToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"sharesIn","type":"uint256"},{"internalType":"uint8","name":"modelId","type":"uint8"},{"internalType":"address","name":"receiver","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"usdcOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"devWallet_","type":"address"},{"internalType":"address","name":"stakingPool_","type":"address"}],"name":"setFeeRecipients","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"feeBpsIn_","type":"uint16"},{"internalType":"uint16","name":"feeBpsOut_","type":"uint16"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"modelId","type":"uint8"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setModelEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"modelId","type":"uint8"},{"internalType":"address","name":"token","type":"address"}],"name":"setModelToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"contract IFxTreasury","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryUsdc","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdCash","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdc","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e06040523480156200001157600080fd5b50604051620022c4380380620022c48339810160408190526200003491620001f4565b600180556001600160a01b03861615806200005657506001600160a01b038516155b806200006957506001600160a01b038416155b806200007c57506001600160a01b038316155b806200008f57506001600160a01b038216155b80620000a257506001600160a01b038116155b15620000c15760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b0380871660805285811660a05284811660c0526006805485831664010000000002600160201b600160c01b0319909116179055600780549184166001600160a01b03199283168117909155600880549092161790556200012a60008262000136565b50505050505062000275565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001d3576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001923390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b0381168114620001ef57600080fd5b919050565b60008060008060008060c087890312156200020e57600080fd5b6200021987620001d7565b95506200022960208801620001d7565b94506200023960408801620001d7565b93506200024960608801620001d7565b92506200025960808801620001d7565b91506200026960a08801620001d7565b90509295509295509295565b60805160a05160c051611fcb620002f9600039600081816103b20152818161096f015281816109f201528181610e20015281816110b4015261113701526000818161038b015281816107ea015281816108af01528181610f2101526112c00152600081816102f901528181610c9301528181610d9b0152610efe0152611fcb6000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80634821b0a6116101045780638ea5220f116100a2578063bcd1273011610071578063bcd127301461042d578063c6cabb4014610441578063d547741f14610454578063ffe8e1771461046757600080fd5b80638ea5220f146103ec57806391d14854146104075780639ef833d41461041a578063a217fddf146103dc57600080fd5b8063647846a5116100de578063647846a5146103ad5780636f0caeaf146103d457806375b238fc146103dc5780637e68f8a2146103e457600080fd5b80634821b0a6146103545780635be6bb041461035d57806361d027b31461038657600080fd5b80632f2ff15d116101715780633e413bee1161014b5780633e413bee146102f45780633ee2bc211461031b5780634606e56f1461032e5780634774dc931461034157600080fd5b80632f2ff15d146102c557806332f4703d146102d857806336568abe146102e157600080fd5b80630cafaf7d116101ad5780630cafaf7d1461024a5780631ad780bd1461025f5780631c0f9edd14610273578063248a9ca31461029457600080fd5b806301ffc9a7146101d457806309d543a8146101fc5780630c56ae3b1461021f575b600080fd5b6101e76101e2366004611be2565b61047a565b60405190151581526020015b60405180910390f35b6101e761020a366004611c1b565b60036020526000908152604090205460ff1681565b600754610232906001600160a01b031681565b6040516001600160a01b0390911681526020016101f3565b61025d610258366004611c46565b6104b1565b005b6008546101e790600160a01b900460ff1681565b6006546102819061ffff1681565b60405161ffff90911681526020016101f3565b6102b76102a2366004611c7f565b60009081526020819052604090206001015490565b6040519081526020016101f3565b61025d6102d3366004611cb4565b61053e565b6102b760055481565b61025d6102ef366004611cb4565b610568565b6102327f000000000000000000000000000000000000000000000000000000000000000081565b6102b7610329366004611ce0565b6105eb565b61025d61033c366004611d1e565b610b11565b6102b761034f366004611ce0565b610bd3565b6102b760045481565b61023261036b366004611c1b565b6002602052600090815260409020546001600160a01b031681565b6102327f000000000000000000000000000000000000000000000000000000000000000081565b6102327f000000000000000000000000000000000000000000000000000000000000000081565b61025d611246565b6102b7600081565b6102b76112bc565b6006546102329064010000000090046001600160a01b031681565b6101e7610415366004611cb4565b611345565b61025d610428366004611d5c565b61136e565b6006546102819062010000900461ffff1681565b61025d61044f366004611d86565b61143d565b61025d610462366004611cb4565b611535565b610281610475366004611c1b565b61155a565b60006001600160e01b03198216637965db0b60e01b14806104ab57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006104bc816115c7565b600854600160a01b900460ff16156104e65760405162b5d7e160e81b815260040160405180910390fd5b60018360ff1610806104fb575060058360ff16115b1561051857604051624adfdf60e81b815260040160405180910390fd5b5060ff919091166000908152600360205260409020805460ff1916911515919091179055565b600082815260208190526040902060010154610559816115c7565b61056383836115d4565b505050565b6001600160a01b03811633146105dd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105e78282611658565b5050565b60006105f56116bd565b60ff80841660009081526003602052604090205416610627576040516309c746af60e31b815260040160405180910390fd5b8360000361064857604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b03821661066f5760405163d92e233d60e01b815260040160405180910390fd5b60ff83166000908152600260205260409020546001600160a01b0316806106a95760405163d92e233d60e01b815260040160405180910390fd5b60405163079cc67960e41b8152336004820152602481018690526001600160a01b038216906379cc679090604401600060405180830381600087803b1580156106f157600080fd5b505af1158015610705573d6000803e3d6000fd5b50506006546000925061271091506107279062010000900461ffff1688611db8565b6107319190611dcf565b905061073d8187611df1565b9250600061074a8661155a565b9050600061271061075f61ffff84168a611db8565b6107699190611dcf565b90506000610777828a611df1565b9050816004600082825461078b9190611df1565b9250508190555080600560008282546107a49190611df1565b9091555050604080518381526020810183905260ff8a16917f32ff8bb29e82543f47171492e2c2809dd36031ef25876f64128557f6206efd53910160405180910390a2857f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166373688e566040518163ffffffff1660e01b8152600401602060405180830381865afa158015610846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086a9190611e04565b1015610889576040516310162d2d60e01b815260040160405180910390fd5b6040516344471fd960e01b81526001600160a01b038881166004830152602482018890527f000000000000000000000000000000000000000000000000000000000000000016906344471fd990604401600060405180830381600087803b1580156108f357600080fd5b505af1158015610907573d6000803e3d6000fd5b505050506000841115610ab35760006064610923866014611db8565b61092d9190611dcf565b9050600061093b8287611df1565b6006546040516340c10f1960e01b81526001600160a01b0364010000000090920482166004820152602481018590529192507f000000000000000000000000000000000000000000000000000000000000000016906340c10f1990604401600060405180830381600087803b1580156109b357600080fd5b505af11580156109c7573d6000803e3d6000fd5b50506007546040516340c10f1960e01b81526001600160a01b039182166004820152602481018590527f000000000000000000000000000000000000000000000000000000000000000090911692506340c10f199150604401600060405180830381600087803b158015610a3a57600080fd5b505af1158015610a4e573d6000803e3d6000fd5b505060085460405163fd5773a960e01b8152600481018590526001600160a01b03909116925063fd5773a99150602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050505050505b604080518a81526020810188905290810185905260ff89169033907fee8e4438b231c457f195c8d0f71db6b432535703a94da8cd386146930f303d1e906060015b60405180910390a35050505050610b0a60018055565b9392505050565b6000610b1c816115c7565b600854600160a01b900460ff1615610b465760405162b5d7e160e81b815260040160405180910390fd5b6001600160a01b038216610b6d5760405163d92e233d60e01b815260040160405180910390fd5b60018360ff161080610b82575060058360ff16115b15610b9f57604051624adfdf60e81b815260040160405180910390fd5b5060ff91909116600090815260026020526040902080546001600160a01b0319166001600160a01b03909216919091179055565b6000610bdd6116bd565b60ff80841660009081526003602052604090205416610c0f576040516309c746af60e31b815260040160405180910390fd5b83600003610c3057604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b038216610c575760405163d92e233d60e01b815260040160405180910390fd5b60ff83166000908152600260205260409020546001600160a01b031680610c915760405163d92e233d60e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d139190611e1d565b60ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d789190611e1d565b60ff1614610d9957604051635a8dbaed60e01b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1b9190611e1d565b60ff167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea09190611e1d565b60ff1614610ec157604051635a8dbaed60e01b815260040160405180910390fd5b60065460009061271090610ed99061ffff1688611db8565b610ee39190611dcf565b9050610eef8187611df1565b9250610f466001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016337f000000000000000000000000000000000000000000000000000000000000000089611716565b6000610f518661155a565b90506000612710610f6661ffff841687611db8565b610f709190611dcf565b90506000610f7e8287611df1565b90508160046000828254610f929190611e3a565b925050819055508060056000828254610fab9190611e3a565b9091555050604080518381526020810183905260ff8a16917f1b33862495f315f1faefa11fff5fba976360c903f00195df03fb6fffec2b89cf910160405180910390a26040516340c10f1960e01b81526001600160a01b038881166004830152602482018890528616906340c10f1990604401600060405180830381600087803b15801561103857600080fd5b505af115801561104c573d6000803e3d6000fd5b5050505060008411156111f85760006064611068866014611db8565b6110729190611dcf565b905060006110808287611df1565b6006546040516340c10f1960e01b81526001600160a01b0364010000000090920482166004820152602481018590529192507f000000000000000000000000000000000000000000000000000000000000000016906340c10f1990604401600060405180830381600087803b1580156110f857600080fd5b505af115801561110c573d6000803e3d6000fd5b50506007546040516340c10f1960e01b81526001600160a01b039182166004820152602481018590527f000000000000000000000000000000000000000000000000000000000000000090911692506340c10f199150604401600060405180830381600087803b15801561117f57600080fd5b505af1158015611193573d6000803e3d6000fd5b505060085460405163fd5773a960e01b8152600481018590526001600160a01b03909116925063fd5773a99150602401600060405180830381600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b5050505050505b604080518a81526020810188905290810185905260ff8916906001600160a01b038916907f5c084fd9c2c0176851f61d7bf49ad7be6f0fa0b2ac63296caf7562d0ac8e7aef90606001610af4565b6000611251816115c7565b600854600160a01b900460ff161561127b5760405162b5d7e160e81b815260040160405180910390fd5b6008805460ff60a01b1916600160a01b17905560405133907f82418153e6244307b2178abd59b12dacb714a49f51b79037b82a97fb90d21f2890600090a250565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166373688e566040518163ffffffff1660e01b8152600401602060405180830381865afa15801561131c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113409190611e04565b905090565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611379816115c7565b600854600160a01b900460ff16156113a35760405162b5d7e160e81b815260040160405180910390fd5b6101f48361ffff1611806113bc57506101f48261ffff16115b156113da5760405163917f1a5360e01b815260040160405180910390fd5b6006805461ffff85811663ffffffff19909216821762010000918616918202179092556040805191825260208201929092527f2ac80c14c28700f7b5e36f947d572149fe2e3947bac32c3a8c098f3e03722c1191015b60405180910390a1505050565b6000611448816115c7565b600854600160a01b900460ff16156114725760405162b5d7e160e81b815260040160405180910390fd5b6001600160a01b038316158061148f57506001600160a01b038216155b156114ad5760405163d92e233d60e01b815260040160405180910390fd5b60068054640100000000600160c01b0319166401000000006001600160a01b0386811691820292909217909255600780546001600160a01b031990811692861692831790915560088054909116821790556040805192835260208301919091527f4182300636c495eb36cba32ee090bd595eedf4221699a0481083758fa17293c29101611430565b600082815260208190526040902060010154611550816115c7565b6105638383611658565b60008160ff166001036115705750611388919050565b8160ff1660020361158457506109c4919050565b8160ff1660030361159757506000919050565b8160ff166004036115ab5750611d4c919050565b8160ff166005036115bf5750612710919050565b506000919050565b6115d18133611776565b50565b6115de8282611345565b6105e7576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556116143390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6116628282611345565b156105e7576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60026001540361170f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105d4565b6002600155565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526117709085906117cf565b50505050565b6117808282611345565b6105e75761178d816118a4565b6117988360206118b6565b6040516020016117a9929190611e71565b60408051601f198184030181529082905262461bcd60e51b82526105d491600401611ee6565b6000611824826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a529092919063ffffffff16565b90508051600014806118455750808060200190518101906118459190611f19565b6105635760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105d4565b60606104ab6001600160a01b03831660145b606060006118c5836002611db8565b6118d0906002611e3a565b67ffffffffffffffff8111156118e8576118e8611f36565b6040519080825280601f01601f191660200182016040528015611912576020820181803683370190505b509050600360fc1b8160008151811061192d5761192d611f4c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061195c5761195c611f4c565b60200101906001600160f81b031916908160001a9053506000611980846002611db8565b61198b906001611e3a565b90505b6001811115611a03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106119bf576119bf611f4c565b1a60f81b8282815181106119d5576119d5611f4c565b60200101906001600160f81b031916908160001a90535060049490941c936119fc81611f62565b905061198e565b508315610b0a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d4565b6060611a618484600085611a69565b949350505050565b606082471015611aca5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105d4565b600080866001600160a01b03168587604051611ae69190611f79565b60006040518083038185875af1925050503d8060008114611b23576040519150601f19603f3d011682016040523d82523d6000602084013e611b28565b606091505b5091509150611b3987838387611b44565b979650505050505050565b60608315611bb3578251600003611bac576001600160a01b0385163b611bac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105d4565b5081611a61565b611a618383815115611bc85781518083602001fd5b8060405162461bcd60e51b81526004016105d49190611ee6565b600060208284031215611bf457600080fd5b81356001600160e01b031981168114610b0a57600080fd5b60ff811681146115d157600080fd5b600060208284031215611c2d57600080fd5b8135610b0a81611c0c565b80151581146115d157600080fd5b60008060408385031215611c5957600080fd5b8235611c6481611c0c565b91506020830135611c7481611c38565b809150509250929050565b600060208284031215611c9157600080fd5b5035919050565b80356001600160a01b0381168114611caf57600080fd5b919050565b60008060408385031215611cc757600080fd5b82359150611cd760208401611c98565b90509250929050565b600080600060608486031215611cf557600080fd5b833592506020840135611d0781611c0c565b9150611d1560408501611c98565b90509250925092565b60008060408385031215611d3157600080fd5b8235611d3c81611c0c565b9150611cd760208401611c98565b803561ffff81168114611caf57600080fd5b60008060408385031215611d6f57600080fd5b611d7883611d4a565b9150611cd760208401611d4a565b60008060408385031215611d9957600080fd5b611d3c83611c98565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104ab576104ab611da2565b600082611dec57634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156104ab576104ab611da2565b600060208284031215611e1657600080fd5b5051919050565b600060208284031215611e2f57600080fd5b8151610b0a81611c0c565b808201808211156104ab576104ab611da2565b60005b83811015611e68578181015183820152602001611e50565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611ea9816017850160208801611e4d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611eda816028840160208801611e4d565b01602801949350505050565b6020815260008251806020840152611f05816040850160208701611e4d565b601f01601f19169190910160400192915050565b600060208284031215611f2b57600080fd5b8151610b0a81611c38565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081611f7157611f71611da2565b506000190190565b60008251611f8b818460208701611e4d565b919091019291505056fea2646970667358221220d1914b48feffdefee4b527cc1889543faa9ba6fff970d5dde16e65f23ab749e964736f6c63430008140033000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b7000000000000000000000000218e85a8a2cf4c1cc1208e6402a3dbc4385f79120000000000000000000000003c96944cd401227981f711a4d19924cee25475b8000000000000000000000000b7d9525d777909066b45df9b5cb4c43873bb67f4

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101cf5760003560e01c80634821b0a6116101045780638ea5220f116100a2578063bcd1273011610071578063bcd127301461042d578063c6cabb4014610441578063d547741f14610454578063ffe8e1771461046757600080fd5b80638ea5220f146103ec57806391d14854146104075780639ef833d41461041a578063a217fddf146103dc57600080fd5b8063647846a5116100de578063647846a5146103ad5780636f0caeaf146103d457806375b238fc146103dc5780637e68f8a2146103e457600080fd5b80634821b0a6146103545780635be6bb041461035d57806361d027b31461038657600080fd5b80632f2ff15d116101715780633e413bee1161014b5780633e413bee146102f45780633ee2bc211461031b5780634606e56f1461032e5780634774dc931461034157600080fd5b80632f2ff15d146102c557806332f4703d146102d857806336568abe146102e157600080fd5b80630cafaf7d116101ad5780630cafaf7d1461024a5780631ad780bd1461025f5780631c0f9edd14610273578063248a9ca31461029457600080fd5b806301ffc9a7146101d457806309d543a8146101fc5780630c56ae3b1461021f575b600080fd5b6101e76101e2366004611be2565b61047a565b60405190151581526020015b60405180910390f35b6101e761020a366004611c1b565b60036020526000908152604090205460ff1681565b600754610232906001600160a01b031681565b6040516001600160a01b0390911681526020016101f3565b61025d610258366004611c46565b6104b1565b005b6008546101e790600160a01b900460ff1681565b6006546102819061ffff1681565b60405161ffff90911681526020016101f3565b6102b76102a2366004611c7f565b60009081526020819052604090206001015490565b6040519081526020016101f3565b61025d6102d3366004611cb4565b61053e565b6102b760055481565b61025d6102ef366004611cb4565b610568565b6102327f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6102b7610329366004611ce0565b6105eb565b61025d61033c366004611d1e565b610b11565b6102b761034f366004611ce0565b610bd3565b6102b760045481565b61023261036b366004611c1b565b6002602052600090815260409020546001600160a01b031681565b6102327f000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f81565b6102327f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b781565b61025d611246565b6102b7600081565b6102b76112bc565b6006546102329064010000000090046001600160a01b031681565b6101e7610415366004611cb4565b611345565b61025d610428366004611d5c565b61136e565b6006546102819062010000900461ffff1681565b61025d61044f366004611d86565b61143d565b61025d610462366004611cb4565b611535565b610281610475366004611c1b565b61155a565b60006001600160e01b03198216637965db0b60e01b14806104ab57506301ffc9a760e01b6001600160e01b03198316145b92915050565b60006104bc816115c7565b600854600160a01b900460ff16156104e65760405162b5d7e160e81b815260040160405180910390fd5b60018360ff1610806104fb575060058360ff16115b1561051857604051624adfdf60e81b815260040160405180910390fd5b5060ff919091166000908152600360205260409020805460ff1916911515919091179055565b600082815260208190526040902060010154610559816115c7565b61056383836115d4565b505050565b6001600160a01b03811633146105dd5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6105e78282611658565b5050565b60006105f56116bd565b60ff80841660009081526003602052604090205416610627576040516309c746af60e31b815260040160405180910390fd5b8360000361064857604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b03821661066f5760405163d92e233d60e01b815260040160405180910390fd5b60ff83166000908152600260205260409020546001600160a01b0316806106a95760405163d92e233d60e01b815260040160405180910390fd5b60405163079cc67960e41b8152336004820152602481018690526001600160a01b038216906379cc679090604401600060405180830381600087803b1580156106f157600080fd5b505af1158015610705573d6000803e3d6000fd5b50506006546000925061271091506107279062010000900461ffff1688611db8565b6107319190611dcf565b905061073d8187611df1565b9250600061074a8661155a565b9050600061271061075f61ffff84168a611db8565b6107699190611dcf565b90506000610777828a611df1565b9050816004600082825461078b9190611df1565b9250508190555080600560008282546107a49190611df1565b9091555050604080518381526020810183905260ff8a16917f32ff8bb29e82543f47171492e2c2809dd36031ef25876f64128557f6206efd53910160405180910390a2857f000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f6001600160a01b03166373688e566040518163ffffffff1660e01b8152600401602060405180830381865afa158015610846573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086a9190611e04565b1015610889576040516310162d2d60e01b815260040160405180910390fd5b6040516344471fd960e01b81526001600160a01b038881166004830152602482018890527f000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f16906344471fd990604401600060405180830381600087803b1580156108f357600080fd5b505af1158015610907573d6000803e3d6000fd5b505050506000841115610ab35760006064610923866014611db8565b61092d9190611dcf565b9050600061093b8287611df1565b6006546040516340c10f1960e01b81526001600160a01b0364010000000090920482166004820152602481018590529192507f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b716906340c10f1990604401600060405180830381600087803b1580156109b357600080fd5b505af11580156109c7573d6000803e3d6000fd5b50506007546040516340c10f1960e01b81526001600160a01b039182166004820152602481018590527f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b790911692506340c10f199150604401600060405180830381600087803b158015610a3a57600080fd5b505af1158015610a4e573d6000803e3d6000fd5b505060085460405163fd5773a960e01b8152600481018590526001600160a01b03909116925063fd5773a99150602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050505050505b604080518a81526020810188905290810185905260ff89169033907fee8e4438b231c457f195c8d0f71db6b432535703a94da8cd386146930f303d1e906060015b60405180910390a35050505050610b0a60018055565b9392505050565b6000610b1c816115c7565b600854600160a01b900460ff1615610b465760405162b5d7e160e81b815260040160405180910390fd5b6001600160a01b038216610b6d5760405163d92e233d60e01b815260040160405180910390fd5b60018360ff161080610b82575060058360ff16115b15610b9f57604051624adfdf60e81b815260040160405180910390fd5b5060ff91909116600090815260026020526040902080546001600160a01b0319166001600160a01b03909216919091179055565b6000610bdd6116bd565b60ff80841660009081526003602052604090205416610c0f576040516309c746af60e31b815260040160405180910390fd5b83600003610c3057604051631f2a200560e01b815260040160405180910390fd5b6001600160a01b038216610c575760405163d92e233d60e01b815260040160405180910390fd5b60ff83166000908152600260205260409020546001600160a01b031680610c915760405163d92e233d60e01b815260040160405180910390fd5b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d139190611e1d565b60ff16816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d789190611e1d565b60ff1614610d9957604051635a8dbaed60e01b815260040160405180910390fd5b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610df7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1b9190611e1d565b60ff167f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b76001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ea09190611e1d565b60ff1614610ec157604051635a8dbaed60e01b815260040160405180910390fd5b60065460009061271090610ed99061ffff1688611db8565b610ee39190611dcf565b9050610eef8187611df1565b9250610f466001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816337f000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f89611716565b6000610f518661155a565b90506000612710610f6661ffff841687611db8565b610f709190611dcf565b90506000610f7e8287611df1565b90508160046000828254610f929190611e3a565b925050819055508060056000828254610fab9190611e3a565b9091555050604080518381526020810183905260ff8a16917f1b33862495f315f1faefa11fff5fba976360c903f00195df03fb6fffec2b89cf910160405180910390a26040516340c10f1960e01b81526001600160a01b038881166004830152602482018890528616906340c10f1990604401600060405180830381600087803b15801561103857600080fd5b505af115801561104c573d6000803e3d6000fd5b5050505060008411156111f85760006064611068866014611db8565b6110729190611dcf565b905060006110808287611df1565b6006546040516340c10f1960e01b81526001600160a01b0364010000000090920482166004820152602481018590529192507f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b716906340c10f1990604401600060405180830381600087803b1580156110f857600080fd5b505af115801561110c573d6000803e3d6000fd5b50506007546040516340c10f1960e01b81526001600160a01b039182166004820152602481018590527f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b790911692506340c10f199150604401600060405180830381600087803b15801561117f57600080fd5b505af1158015611193573d6000803e3d6000fd5b505060085460405163fd5773a960e01b8152600481018590526001600160a01b03909116925063fd5773a99150602401600060405180830381600087803b1580156111dd57600080fd5b505af11580156111f1573d6000803e3d6000fd5b5050505050505b604080518a81526020810188905290810185905260ff8916906001600160a01b038916907f5c084fd9c2c0176851f61d7bf49ad7be6f0fa0b2ac63296caf7562d0ac8e7aef90606001610af4565b6000611251816115c7565b600854600160a01b900460ff161561127b5760405162b5d7e160e81b815260040160405180910390fd5b6008805460ff60a01b1916600160a01b17905560405133907f82418153e6244307b2178abd59b12dacb714a49f51b79037b82a97fb90d21f2890600090a250565b60007f000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f6001600160a01b03166373688e566040518163ffffffff1660e01b8152600401602060405180830381865afa15801561131c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113409190611e04565b905090565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000611379816115c7565b600854600160a01b900460ff16156113a35760405162b5d7e160e81b815260040160405180910390fd5b6101f48361ffff1611806113bc57506101f48261ffff16115b156113da5760405163917f1a5360e01b815260040160405180910390fd5b6006805461ffff85811663ffffffff19909216821762010000918616918202179092556040805191825260208201929092527f2ac80c14c28700f7b5e36f947d572149fe2e3947bac32c3a8c098f3e03722c1191015b60405180910390a1505050565b6000611448816115c7565b600854600160a01b900460ff16156114725760405162b5d7e160e81b815260040160405180910390fd5b6001600160a01b038316158061148f57506001600160a01b038216155b156114ad5760405163d92e233d60e01b815260040160405180910390fd5b60068054640100000000600160c01b0319166401000000006001600160a01b0386811691820292909217909255600780546001600160a01b031990811692861692831790915560088054909116821790556040805192835260208301919091527f4182300636c495eb36cba32ee090bd595eedf4221699a0481083758fa17293c29101611430565b600082815260208190526040902060010154611550816115c7565b6105638383611658565b60008160ff166001036115705750611388919050565b8160ff1660020361158457506109c4919050565b8160ff1660030361159757506000919050565b8160ff166004036115ab5750611d4c919050565b8160ff166005036115bf5750612710919050565b506000919050565b6115d18133611776565b50565b6115de8282611345565b6105e7576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556116143390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6116628282611345565b156105e7576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60026001540361170f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105d4565b6002600155565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526117709085906117cf565b50505050565b6117808282611345565b6105e75761178d816118a4565b6117988360206118b6565b6040516020016117a9929190611e71565b60408051601f198184030181529082905262461bcd60e51b82526105d491600401611ee6565b6000611824826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611a529092919063ffffffff16565b90508051600014806118455750808060200190518101906118459190611f19565b6105635760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016105d4565b60606104ab6001600160a01b03831660145b606060006118c5836002611db8565b6118d0906002611e3a565b67ffffffffffffffff8111156118e8576118e8611f36565b6040519080825280601f01601f191660200182016040528015611912576020820181803683370190505b509050600360fc1b8160008151811061192d5761192d611f4c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061195c5761195c611f4c565b60200101906001600160f81b031916908160001a9053506000611980846002611db8565b61198b906001611e3a565b90505b6001811115611a03576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106119bf576119bf611f4c565b1a60f81b8282815181106119d5576119d5611f4c565b60200101906001600160f81b031916908160001a90535060049490941c936119fc81611f62565b905061198e565b508315610b0a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016105d4565b6060611a618484600085611a69565b949350505050565b606082471015611aca5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016105d4565b600080866001600160a01b03168587604051611ae69190611f79565b60006040518083038185875af1925050503d8060008114611b23576040519150601f19603f3d011682016040523d82523d6000602084013e611b28565b606091505b5091509150611b3987838387611b44565b979650505050505050565b60608315611bb3578251600003611bac576001600160a01b0385163b611bac5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016105d4565b5081611a61565b611a618383815115611bc85781518083602001fd5b8060405162461bcd60e51b81526004016105d49190611ee6565b600060208284031215611bf457600080fd5b81356001600160e01b031981168114610b0a57600080fd5b60ff811681146115d157600080fd5b600060208284031215611c2d57600080fd5b8135610b0a81611c0c565b80151581146115d157600080fd5b60008060408385031215611c5957600080fd5b8235611c6481611c0c565b91506020830135611c7481611c38565b809150509250929050565b600060208284031215611c9157600080fd5b5035919050565b80356001600160a01b0381168114611caf57600080fd5b919050565b60008060408385031215611cc757600080fd5b82359150611cd760208401611c98565b90509250929050565b600080600060608486031215611cf557600080fd5b833592506020840135611d0781611c0c565b9150611d1560408501611c98565b90509250925092565b60008060408385031215611d3157600080fd5b8235611d3c81611c0c565b9150611cd760208401611c98565b803561ffff81168114611caf57600080fd5b60008060408385031215611d6f57600080fd5b611d7883611d4a565b9150611cd760208401611d4a565b60008060408385031215611d9957600080fd5b611d3c83611c98565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176104ab576104ab611da2565b600082611dec57634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156104ab576104ab611da2565b600060208284031215611e1657600080fd5b5051919050565b600060208284031215611e2f57600080fd5b8151610b0a81611c0c565b808201808211156104ab576104ab611da2565b60005b83811015611e68578181015183820152602001611e50565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351611ea9816017850160208801611e4d565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351611eda816028840160208801611e4d565b01602801949350505050565b6020815260008251806020840152611f05816040850160208701611e4d565b601f01601f19169190910160400192915050565b600060208284031215611f2b57600080fd5b8151610b0a81611c38565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081611f7157611f71611da2565b506000190190565b60008251611f8b818460208701611e4d565b919091019291505056fea2646970667358221220d1914b48feffdefee4b527cc1889543faa9ba6fff970d5dde16e65f23ab749e964736f6c63430008140033

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

000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b7000000000000000000000000218e85a8a2cf4c1cc1208e6402a3dbc4385f79120000000000000000000000003c96944cd401227981f711a4d19924cee25475b8000000000000000000000000b7d9525d777909066b45df9b5cb4c43873bb67f4

-----Decoded View---------------
Arg [0] : usdc_ (address): 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Arg [1] : treasury_ (address): 0x901C18eE51Abb10913c3761A258dB19a3af6f76F
Arg [2] : feeToken_ (address): 0xaD90A2b98B1bBcA1CBd8C01c12B5f0579377B4b7
Arg [3] : devWallet_ (address): 0x218e85A8A2CF4c1CC1208E6402a3dBc4385F7912
Arg [4] : stakingPool_ (address): 0x3c96944cd401227981F711A4D19924CEe25475B8
Arg [5] : admin_ (address): 0xB7d9525d777909066B45Df9b5cB4c43873BB67f4

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
Arg [1] : 000000000000000000000000901c18ee51abb10913c3761a258db19a3af6f76f
Arg [2] : 000000000000000000000000ad90a2b98b1bbca1cbd8c01c12b5f0579377b4b7
Arg [3] : 000000000000000000000000218e85a8a2cf4c1cc1208e6402a3dbc4385f7912
Arg [4] : 0000000000000000000000003c96944cd401227981f711a4d19924cee25475b8
Arg [5] : 000000000000000000000000b7d9525d777909066b45df9b5cb4c43873bb67f4


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

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