ETH Price: $3,318.34 (-4.90%)

Contract

0x707BFa39fb55d5d4534Af2B90FD3fa81995A2940
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Execute195054402024-03-24 15:58:59300 days ago1711295939IN
0x707BFa39...1995A2940
0.11 ETH0.0035547722.3784619
Execute194836872024-03-21 14:39:47303 days ago1711031987IN
0x707BFa39...1995A2940
0.45 ETH0.0119540828.62307177
Execute194600892024-03-18 7:06:23306 days ago1710745583IN
0x707BFa39...1995A2940
0.1066 ETH0.0034505321.74946701
Execute194513462024-03-17 1:36:35307 days ago1710639395IN
0x707BFa39...1995A2940
0.1068 ETH0.0039128524.66546689
Execute194455442024-03-16 5:59:47308 days ago1710568787IN
0x707BFa39...1995A2940
0.107 ETH0.0044288927.91633181
Execute194094032024-03-11 4:14:59313 days ago1710130499IN
0x707BFa39...1995A2940
0.1071 ETH0.0082700138.27982627
Execute194087292024-03-11 1:59:59313 days ago1710122399IN
0x707BFa39...1995A2940
0.0001 ETH0.0064961545.8405759
Execute193864352024-03-07 22:59:59317 days ago1709852399IN
0x707BFa39...1995A2940
3.35 ETH0.0223598353.50907181
Execute193544582024-03-03 11:50:59321 days ago1709466659IN
0x707BFa39...1995A2940
0.1077 ETH0.0090206437.89963346
Execute193515552024-03-03 2:07:35321 days ago1709431655IN
0x707BFa39...1995A2940
0.107 ETH0.007805336.1288035
Execute193454422024-03-02 5:37:35322 days ago1709357855IN
0x707BFa39...1995A2940
0.107 ETH0.0087021340.27999512
Execute193452972024-03-02 5:08:11322 days ago1709356091IN
0x707BFa39...1995A2940
0.107 ETH0.0087980740.72408886
Execute193452192024-03-02 4:52:35322 days ago1709355155IN
0x707BFa39...1995A2940
0.108 ETH0.0083471738.63915184
Execute193114842024-02-26 11:36:11327 days ago1708947371IN
0x707BFa39...1995A2940
0.108 ETH0.0061284528.36868802
Execute193088152024-02-26 2:37:59327 days ago1708915079IN
0x707BFa39...1995A2940
0.107 ETH0.0050100723.19038752
Execute193046942024-02-25 12:47:59328 days ago1708865279IN
0x707BFa39...1995A2940
0.107 ETH0.0046166921.36952883
Execute193037242024-02-25 9:32:59328 days ago1708853579IN
0x707BFa39...1995A2940
0.107 ETH0.0054536625.24365993
Execute193030592024-02-25 7:18:47328 days ago1708845527IN
0x707BFa39...1995A2940
0.102 ETH0.0048491922.44695668
Execute192970982024-02-24 11:18:23329 days ago1708773503IN
0x707BFa39...1995A2940
10 ETH0.0043754522.52230574
Execute192964442024-02-24 9:06:23329 days ago1708765583IN
0x707BFa39...1995A2940
0.005 ETH0.018323329.6284583
Execute192961992024-02-24 8:17:23329 days ago1708762643IN
0x707BFa39...1995A2940
0.01 ETH0.023354637.87292365
Execute192835222024-02-22 13:43:47331 days ago1708609427IN
0x707BFa39...1995A2940
0.001 ETH0.0067408834.49858162
Set Adapter Whit...192820192024-02-22 8:37:59331 days ago1708591079IN
0x707BFa39...1995A2940
0 ETH0.0018543438.14905826
Execute192705312024-02-20 17:55:11333 days ago1708451711IN
0x707BFa39...1995A2940
0.01 ETH0.013024942.22613971
Execute192705012024-02-20 17:48:47333 days ago1708451327IN
0x707BFa39...1995A2940
0.01 ETH0.0079734440.80911352
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block
From
To
196624552024-04-15 17:39:47278 days ago1713202787
0x707BFa39...1995A2940
1,024 ETH
196624552024-04-15 17:39:47278 days ago1713202787
0x707BFa39...1995A2940
1,024 ETH
196152062024-04-09 2:47:23284 days ago1712630843
0x707BFa39...1995A2940
512 ETH
196152062024-04-09 2:47:23284 days ago1712630843
0x707BFa39...1995A2940
512 ETH
196147372024-04-09 1:12:47284 days ago1712625167
0x707BFa39...1995A2940
512 ETH
196147372024-04-09 1:12:47284 days ago1712625167
0x707BFa39...1995A2940
512 ETH
196129932024-04-08 19:20:59285 days ago1712604059
0x707BFa39...1995A2940
512 ETH
196129932024-04-08 19:20:59285 days ago1712604059
0x707BFa39...1995A2940
512 ETH
195087512024-03-25 3:10:59299 days ago1711336259
0x707BFa39...1995A2940
0.05047128 ETH
195087512024-03-25 3:10:59299 days ago1711336259
0x707BFa39...1995A2940
0.05047128 ETH
195054402024-03-24 15:58:59300 days ago1711295939
0x707BFa39...1995A2940
0.11 ETH
195043432024-03-24 12:16:35300 days ago1711282595
0x707BFa39...1995A2940
0.26335603 ETH
195043432024-03-24 12:16:35300 days ago1711282595
0x707BFa39...1995A2940
0.26335603 ETH
194836872024-03-21 14:39:47303 days ago1711031987
0x707BFa39...1995A2940
0.45 ETH
194746252024-03-20 8:07:59304 days ago1710922079
0x707BFa39...1995A2940
0.98990435 ETH
194746252024-03-20 8:07:59304 days ago1710922079
0x707BFa39...1995A2940
0.98990435 ETH
194688192024-03-19 12:33:11305 days ago1710851591
0x707BFa39...1995A2940
0.0002401 ETH
194688192024-03-19 12:33:11305 days ago1710851591
0x707BFa39...1995A2940
0.01325092 ETH
194688192024-03-19 12:33:11305 days ago1710851591
0x707BFa39...1995A2940
0.01349103 ETH
194600892024-03-18 7:06:23306 days ago1710745583
0x707BFa39...1995A2940
0.1066 ETH
194513462024-03-17 1:36:35307 days ago1710639395
0x707BFa39...1995A2940
0.1068 ETH
194455442024-03-16 5:59:47308 days ago1710568787
0x707BFa39...1995A2940
0.107 ETH
194344262024-03-14 16:28:35310 days ago1710433715
0x707BFa39...1995A2940
0.50247345 ETH
194344262024-03-14 16:28:35310 days ago1710433715
0x707BFa39...1995A2940
0.50247345 ETH
194094032024-03-11 4:14:59313 days ago1710130499
0x707BFa39...1995A2940
0.1071 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Multicall

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 1000 runs

Other Settings:
paris EvmVersion
File 1 of 34 : Multicall.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {EoaExecutorWithoutDataProvider} from "@routerprotocol/intents-core/contracts/RouterIntentEoaAdapter.sol";
import {Errors} from "./Errors.sol";
import {CallLib} from "./CallLib.sol";
import {TokenUtils} from "./utils/TokenUtils.sol";
import {INitroMessageHandler} from "./interfaces/INitroMessageHandler.sol";
import {IWETH} from "./interfaces/IWETH.sol";

/**
 * @title Multicall
 * @author StakeEase
 * @notice Multicaller contract.
 */
contract Multicall is TokenUtils, AccessControl, INitroMessageHandler {
    using SafeERC20 for IERC20;

    struct RefundData {
        address[] tokens;
    }

    bytes32 public constant SETTER_ROLE = keccak256("SETTER_ROLE");
    uint256 public constant TEMP_TOKENS_LENGTH = 6;

    mapping(address => bool) private whitelistedAdapters;

    address public immutable assetForwarder;
    address public immutable dexspan;
    IWETH public immutable wnative;

    constructor(
        address _assetForwarder,
        address _dexspan,
        address _wnative,
        address[] memory _whitelistedAdapters
    ) payable {
        assetForwarder = _assetForwarder;
        dexspan = _dexspan;
        wnative = IWETH(_wnative);

        uint256 length = _whitelistedAdapters.length;
        for (uint256 i = 0; i < length; ) {
            require(
                _whitelistedAdapters[i] != address(0),
                Errors.ADAPTER_ADDRESS_CANNOT_BE_ZERO
            );

            whitelistedAdapters[_whitelistedAdapters[i]] = true;

            unchecked {
                ++i;
            }
        }

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

    /**
     * @notice Function to check if a bridge adapter is whitelisted.
     * @param adapter Address of the bridge adapter.
     */
    function isAdapterWhitelisted(address adapter) public view returns (bool) {
        return whitelistedAdapters[adapter];
    }

    /**
     * @notice Function to whitelist an adapter.
     * @notice Can only be called by an address with the SETTER_ROLE.
     * @param adapterAddress Array of addresses ofs adapters.
     * @param shouldWhitelist Array of booleans suggesting whether the adapter should be whitelisted.
     */
    function setAdapterWhitelist(
        address[] memory adapterAddress,
        bool[] memory shouldWhitelist
    ) external onlyRole(SETTER_ROLE) {
        uint256 length = adapterAddress.length;
        require(
            length != 0 && length == shouldWhitelist.length,
            Errors.ARRAY_LENGTH_MISMATCH
        );

        for (uint256 i = 0; i < length; ) {
            require(
                adapterAddress[i] != address(0),
                Errors.ADAPTER_ADDRESS_CANNOT_BE_ZERO
            );
            whitelistedAdapters[adapterAddress[i]] = shouldWhitelist[i];
            unchecked {
                ++i;
            }
        }
    }

    /**
     * @dev function to execute batch calls on the same chain.
     * @param token Addresses of the tokens to fetch from the user.
     * @param amount amounts of the tokens to fetch from the user.
     * @param target Addresses of the contracts to call.
     * @param data Data of the transactions.
     */
    function execute(
        address token,
        uint256 amount,
        address[] calldata target,
        bytes[] calldata data
    ) external payable {
        require(amount > 0, Errors.AMOUNT_CANNOT_BE_ZERO);

        if (token != NATIVE_ADDRESS) {
            IERC20(token).safeTransferFrom(msg.sender, address(this), amount);
        } else
            require(
                msg.value == amount,
                Errors.INSUFFICIENT_NATIVE_FUNDS_PASSED
            );

        address[] memory tempTokens = new address[](TEMP_TOKENS_LENGTH);
        tempTokens[0] = token;

        _executeBatch(msg.sender, target, data, tempTokens);
    }

    /**
     * @dev Function to execute batch calls on the destination chain.
     * @param refundRecipient Address of recipient of refunds of dust at the end.
     * @param target Addresses of the contracts to call.
     * @param data Data of the transactions.
     */
    function executeDest(
        address refundRecipient,
        address[] calldata target,
        bytes[] calldata data
    ) external payable {
        require(msg.sender == address(this), Errors.ONLY_SELF);

        address[] memory tempTokens = new address[](TEMP_TOKENS_LENGTH);
        tempTokens[0] = NATIVE_ADDRESS;

        _executeBatch(refundRecipient, target, data, tempTokens);
    }

    /**
     * @inheritdoc INitroMessageHandler
     */
    function handleMessage(
        address tokenSent,
        uint256 amount,
        bytes memory message
    ) external {
        if (msg.sender != assetForwarder && msg.sender != dexspan)
            revert(Errors.ONLY_NITRO_BRIDGE);
        require(amount != 0, Errors.AMOUNT_CANNOT_BE_ZERO);

        (
            address refundAddress,
            address[] memory target,
            bytes[] memory data
        ) = abi.decode(message, (address, address[], bytes[]));

        if (tokenSent != NATIVE_ADDRESS && tokenSent != address(wnative)) {
            IERC20(tokenSent).safeTransfer(refundAddress, amount);
            return;
        }

        if (tokenSent == address(wnative)) wnative.withdraw(amount);

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, ) = address(this).call(
            abi.encodeWithSelector(
                this.executeDest.selector,
                refundAddress,
                target,
                data
            )
        );

        if (!success) payable(refundAddress).transfer(amount);
    }

    /**
     * @notice Function to withdraw funds from this contract which may be sent due to mistake.
     * @notice Can only be called by the DEFAULT_ADMIN.
     * @param token Address of the token to withdraw.
     * @param recipient Address of the recipient.
     * @param amount Amount of funds to withdraw.
     */
    function emergencyWithdrawFunds(
        address token,
        address recipient,
        uint256 amount
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(recipient != address(0), Errors.RECIPIENT_CANNOT_BE_ZERO);

        if (token == address(0) || token == NATIVE_ADDRESS) {
            if (amount == 0) amount = address(this).balance;
            if (amount == 0) revert(Errors.AMOUNT_CANNOT_BE_ZERO);
            payable(recipient).transfer(amount);
        } else {
            if (amount == 0) amount = IERC20(token).balanceOf(address(this));
            if (amount == 0) revert(Errors.AMOUNT_CANNOT_BE_ZERO);
            IERC20(token).safeTransfer(recipient, amount);
        }
    }

    /**
     * @dev Function to execute batch calls.
     * @param refundRecipient Address of the refund recipient.
     * @param target Addresses of the contracts to call.
     * @param data Data of the transactions.
     */
    function _executeBatch(
        address refundRecipient,
        address[] calldata target,
        bytes[] calldata data,
        address[] memory tempTokens
    ) internal {
        uint256 targetLength = target.length;

        require(
            targetLength != 0 && targetLength == data.length,
            Errors.WRONG_BATCH_PROVIDED
        );

        for (uint256 i = 0; i < targetLength; ) {
            _onlyWhitelistedAdapters(target[i]);

            tempTokens = _execute(i, target[i], data[i], tempTokens);

            unchecked {
                ++i;
            }
        }

        _processRefunds(refundRecipient, tempTokens);
    }

    function _execute(
        uint256 index,
        address target,
        bytes memory data,
        address[] memory tempTokens
    ) internal returns (address[] memory) {
        bytes memory _calldata = abi.encodeWithSelector(
            EoaExecutorWithoutDataProvider.execute.selector,
            data
        );

        bytes memory result = CallLib._delegateCall(target, _calldata);
        address[] memory token = abi.decode(result, (address[]));
        tempTokens[index + 1] = token[0];

        return tempTokens;
    }

    function _processRefunds(
        address user,
        address[] memory tempTokens
    ) internal {
        for (uint256 i = 0; i < TEMP_TOKENS_LENGTH; ) {
            if (tempTokens[i] == address(0)) {
                break;
            }

            withdrawTokens(tempTokens[i], user, type(uint256).max);

            unchecked {
                ++i;
            }
        }
    }

    function _onlyWhitelistedAdapters(address adapter) internal view {
        require(whitelistedAdapters[adapter], Errors.ADAPTER_NOT_WHITELISTED);
    }

    // solhint-disable-next-line no-empty-blocks
    receive() external payable {}
}

File 2 of 34 : AccessControl.sol
// 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());
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 34 : ReentrancyGuard.sol
// 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;
    }
}

File 5 of 34 : IERC20Permit.sol
// 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);
}

File 6 of 34 : IERC20.sol
// 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);
}

File 7 of 34 : SafeERC20.sol
// 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));
    }
}

File 8 of 34 : Address.sol
// 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);
        }
    }
}

File 9 of 34 : Context.sol
// 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;
    }
}

File 10 of 34 : ERC165.sol
// 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;
    }
}

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

pragma solidity ^0.8.0;

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

File 12 of 34 : Math.sol
// 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);
        }
    }
}

File 13 of 34 : SignedMath.sol
// 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);
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 15 of 34 : AdapterDataProvider.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IAdapterDataProvider} from "./interfaces/IAdapterDataProvider.sol";

/**
 * @title AdapterDataProvider
 * @author Router Protocol
 * @notice This contract serves as the data provider for an intent adapter based on Router
 * Cross-Chain Intent Framework.
 */
contract AdapterDataProvider is IAdapterDataProvider {
    address private _owner;
    mapping(address => bool) private _headRegistry;
    mapping(address => bool) private _tailRegistry;
    mapping(address => bool) private _inboundAssetRegistry;
    mapping(address => bool) private _outboundAssetRegistry;

    constructor(address __owner) {
        _owner = __owner;
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function owner() external view returns (address) {
        return _owner;
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function setOwner(address __owner) external onlyOwner {
        _owner = __owner;
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function isAuthorizedPrecedingContract(
        address precedingContract
    ) external view returns (bool) {
        if (precedingContract == address(0)) return true;
        return _headRegistry[precedingContract];
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function isAuthorizedSucceedingContract(
        address succeedingContract
    ) external view returns (bool) {
        if (succeedingContract == address(0)) return true;
        return _tailRegistry[succeedingContract];
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function isValidInboundAsset(address asset) external view returns (bool) {
        return _inboundAssetRegistry[asset];
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function isValidOutboundAsset(address asset) external view returns (bool) {
        return _outboundAssetRegistry[asset];
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function setPrecedingContract(
        address precedingContract,
        bool isValid
    ) external onlyOwner {
        _headRegistry[precedingContract] = isValid;
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function setSucceedingContract(
        address succeedingContract,
        bool isValid
    ) external onlyOwner {
        _tailRegistry[succeedingContract] = isValid;
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function setInboundAsset(address asset, bool isValid) external onlyOwner {
        _inboundAssetRegistry[asset] = isValid;
    }

    /**
     * @inheritdoc IAdapterDataProvider
     */
    function setOutboundAsset(address asset, bool isValid) external onlyOwner {
        _outboundAssetRegistry[asset] = isValid;
    }

    /**
     * @notice modifier to ensure that only owner can call this function
     */
    modifier onlyOwner() {
        _onlyOwner();
        _;
    }

    function _onlyOwner() private view {
        require(msg.sender == _owner, "Only owner");
    }
}

File 16 of 34 : BaseAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {Basic} from "./common/Basic.sol";
import {Errors} from "./utils/Errors.sol";
import {ReentrancyGuard} from "./utils/ReentrancyGuard.sol";
import {AdapterDataProvider} from "./AdapterDataProvider.sol";

/**
 * @title BaseAdapter
 * @author Router Protocol
 * @notice This contract is the base implementation of an intent adapter based on Router
 * Cross-Chain Intent Framework.
 */
abstract contract BaseAdapter is Basic, ReentrancyGuard {
    address private immutable _self;
    address private immutable _native;
    address private immutable _wnative;
    AdapterDataProvider private immutable _adapterDataProvider;

    event ExecutionEvent(string indexed adapterName, bytes data);
    event OperationFailedRefundEvent(
        address token,
        address recipient,
        uint256 amount
    );
    event UnsupportedOperation(
        address token,
        address refundAddress,
        uint256 amount
    );

    constructor(
        address __native,
        address __wnative,
        bool __deployDataProvider,
        address __owner
    ) {
        _self = address(this);
        _native = __native;
        _wnative = __wnative;

        AdapterDataProvider dataProvider;

        if (__deployDataProvider)
            dataProvider = new AdapterDataProvider(__owner);
        else dataProvider = AdapterDataProvider(address(0));

        _adapterDataProvider = dataProvider;
    }

    /**
     * @dev function to get the address of weth
     */
    function wnative() public view override returns (address) {
        return _wnative;
    }

    /**
     * @dev function to get the address of native token
     */
    function native() public view override returns (address) {
        return _native;
    }

    /**
     * @dev function to get the AdapterDataProvider instance for this contract
     */
    function adapterDataProvider() public view returns (AdapterDataProvider) {
        return _adapterDataProvider;
    }

    /**
     * @dev Function to check whether the contract is a valid preceding contract registered in
     * the head registry.
     * @dev This registry governs the initiation of the adapter, exclusively listing authorized
     * preceding adapters.
     * @notice Only the adapters documented in this registry can invoke the current adapter,
     * thereby guaranteeing regulated and secure execution sequences.
     * @param precedingContract Address of preceding contract.
     * @return true if valid, false if invalid.
     */
    function isAuthorizedPrecedingContract(
        address precedingContract
    ) public view returns (bool) {
        return
            _adapterDataProvider.isAuthorizedPrecedingContract(
                precedingContract
            );
    }

    /**
     * @dev Function to check whether the contract is a valid succeeding contract registered in
     * the tail registry.
     * @dev This registry dictates the potential succeeding actions by listing adapters that
     * may be invoked following the current one.
     * @notice Only the adapters documented in this registry can be invoked by the current adapter,
     * thereby guaranteeing regulated and secure execution sequences.
     * @param succeedingContract Address of succeeding contract.
     * @return true if valid, false if invalid.
     */
    function isAuthorizedSucceedingContract(
        address succeedingContract
    ) public view returns (bool) {
        return
            _adapterDataProvider.isAuthorizedSucceedingContract(
                succeedingContract
            );
    }

    /**
     * @dev Function to check whether the asset is a valid inbound asset registered in the inbound
     * asset registry.
     * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the
     * adapter only processes predefined asset types.
     * @param asset Address of the asset.
     * @return true if valid, false if invalid.
     */
    function isValidInboundAsset(address asset) public view returns (bool) {
        return _adapterDataProvider.isValidInboundAsset(asset);
    }

    /**
     * @dev Function to check whether the asset is a valid outbound asset registered in the outbound
     * asset registry.
     * @dev It manages the types of assets that the adapter is allowed to output, thus controlling
     * the flow’s output and maintaining consistency.
     * @param asset Address of the asset.
     * @return true if valid, false if invalid.
     */
    function isValidOutboundAsset(address asset) public view returns (bool) {
        return _adapterDataProvider.isValidOutboundAsset(asset);
    }

    /**
     * @dev function to get the name of the adapter
     */
    function name() public view virtual returns (string memory);

    /**
     * @dev function to get the address of the contract
     */
    function self() public view returns (address) {
        return _self;
    }
}

File 17 of 34 : Basic.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {TokenInterface} from "./Interfaces.sol";
import {TokenUtilsBase} from "./TokenUtilsBase.sol";

abstract contract Basic is TokenUtilsBase {
    function getTokenBal(address token) internal view returns (uint _amt) {
        _amt = address(token) == native()
            ? address(this).balance
            : TokenInterface(token).balanceOf(address(this));
    }

    function approve(address token, address spender, uint256 amount) internal {
        // solhint-disable-next-line no-empty-blocks
        try TokenInterface(token).approve(spender, amount) {} catch {
            TokenInterface(token).approve(spender, 0);
            TokenInterface(token).approve(spender, amount);
        }
    }

    function convertNativeToWnative(uint amount) internal {
        TokenInterface(wnative()).deposit{value: amount}();
    }

    function convertWnativeToNative(uint amount) internal {
        TokenInterface(wnative()).withdraw(amount);
    }
}

File 18 of 34 : Interfaces.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface TokenInterface {
    function approve(address, uint256) external;

    function transfer(address, uint) external;

    function transferFrom(address, address, uint) external;

    function deposit() external payable;

    function withdraw(uint) external;

    function balanceOf(address) external view returns (uint);

    function decimals() external view returns (uint);
}

File 19 of 34 : TokenUtilsBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IWETH} from "../interfaces/IWETH.sol";
import {SafeERC20, IERC20} from "../utils/SafeERC20.sol";

abstract contract TokenUtilsBase {
    using SafeERC20 for IERC20;

    function wnative() public view virtual returns (address);

    function native() public view virtual returns (address);

    function approveToken(
        address _tokenAddr,
        address _to,
        uint256 _amount
    ) internal {
        if (_tokenAddr == native()) return;

        if (IERC20(_tokenAddr).allowance(address(this), _to) < _amount) {
            IERC20(_tokenAddr).safeApprove(_to, _amount);
        }
    }

    function pullTokensIfNeeded(
        address _token,
        address _from,
        uint256 _amount
    ) internal returns (uint256) {
        // handle max uint amount
        if (_amount == type(uint256).max) {
            _amount = getBalance(_token, _from);
        }

        if (
            _from != address(0) &&
            _from != address(this) &&
            _token != native() &&
            _amount != 0
        ) {
            IERC20(_token).safeTransferFrom(_from, address(this), _amount);
        }

        return _amount;
    }

    function withdrawTokens(
        address _token,
        address _to,
        uint256 _amount
    ) internal returns (uint256) {
        if (_amount == type(uint256).max) {
            _amount = getBalance(_token, address(this));
        }

        if (_to != address(0) && _to != address(this) && _amount != 0) {
            if (_token != native()) {
                IERC20(_token).safeTransfer(_to, _amount);
            } else {
                (bool success, ) = _to.call{value: _amount}("");
                require(success, "native send fail");
            }
        }

        return _amount;
    }

    function depositWnative(uint256 _amount) internal {
        IWETH(wnative()).deposit{value: _amount}();
    }

    function withdrawWnative(uint256 _amount) internal {
        IWETH(wnative()).withdraw(_amount);
    }

    function getBalance(
        address _tokenAddr,
        address _acc
    ) internal view returns (uint256) {
        if (_tokenAddr == native()) {
            return _acc.balance;
        } else {
            return IERC20(_tokenAddr).balanceOf(_acc);
        }
    }

    function getTokenDecimals(address _token) internal view returns (uint256) {
        if (_token == native()) return 18;

        return IERC20(_token).decimals();
    }
}

File 20 of 34 : IAdapterDataProvider.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

/**
 * @title Interface for Adapter Data Provider contract for intent adapter.
 * @author Router Protocol.
 */

interface IAdapterDataProvider {
    /**
     * @dev Function to get the address of owner.
     */
    function owner() external view returns (address);

    /**
     * @dev Function to set the address of owner.
     * @dev This function can only be called by the owner of this contract.
     * @param __owner Address of the new owner
     */
    function setOwner(address __owner) external;

    /**
     * @dev Function to check whether the contract is a valid preceding contract registered in
     * the head registry.
     * @dev This registry governs the initiation of the adapter, exclusively listing authorized
     * preceding adapters.
     * @notice Only the adapters documented in this registry can invoke the current adapter,
     * thereby guaranteeing regulated and secure execution sequences.
     * @param precedingContract Address of preceding contract.
     * @return true if valid, false if invalid.
     */
    function isAuthorizedPrecedingContract(
        address precedingContract
    ) external view returns (bool);

    /**
     * @dev Function to check whether the contract is a valid succeeding contract registered in
     * the tail registry.
     * @dev This registry dictates the potential succeeding actions by listing adapters that
     * may be invoked following the current one.
     * @notice Only the adapters documented in this registry can be invoked by the current adapter,
     * thereby guaranteeing regulated and secure execution sequences.
     * @param succeedingContract Address of succeeding contract.
     * @return true if valid, false if invalid.
     */
    function isAuthorizedSucceedingContract(
        address succeedingContract
    ) external view returns (bool);

    /**
     * @dev Function to check whether the asset is a valid inbound asset registered in the inbound
     * asset registry.
     * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the
     * adapter only processes predefined asset types.
     * @param asset Address of the asset.
     * @return true if valid, false if invalid.
     */
    function isValidInboundAsset(address asset) external view returns (bool);

    /**
     * @dev Function to check whether the asset is a valid outbound asset registered in the outbound
     * asset registry.
     * @dev It manages the types of assets that the adapter is allowed to output, thus controlling
     * the flow’s output and maintaining consistency.
     * @param asset Address of the asset.
     * @return true if valid, false if invalid.
     */
    function isValidOutboundAsset(address asset) external view returns (bool);

    /**
     * @dev Function to set preceding contract (head registry) for the adapter.
     * @dev This registry governs the initiation of the adapter, exclusively listing authorized
     * preceding adapters.
     * @notice Only the adapters documented in this registry can invoke the current adapter,
     * thereby guaranteeing regulated and secure execution sequences.
     * @param precedingContract Address of preceding contract.
     * @param isValid Boolean value suggesting if this is a valid preceding contract.
     */
    function setPrecedingContract(
        address precedingContract,
        bool isValid
    ) external;

    /**
     * @dev Function to set succeeding contract (tail registry) for the adapter.
     * @dev This registry dictates the potential succeeding actions by listing adapters that
     * may be invoked following the current one.
     * @notice Only the adapters documented in this registry can be invoked by the current adapter,
     * thereby guaranteeing regulated and secure execution sequences.
     * @param succeedingContract Address of succeeding contract.
     * @param isValid Boolean value suggesting if this is a valid succeeding contract.
     */
    function setSucceedingContract(
        address succeedingContract,
        bool isValid
    ) external;

    /**
     * @dev Function to set inbound asset registry for the adapter.
     * @dev This registry keeps track of all the acceptable incoming assets, ensuring that the
     * adapter only processes predefined asset types.
     * @param asset Address of the asset.
     * @param isValid Boolean value suggesting if this is a valid inbound asset.
     */
    function setInboundAsset(address asset, bool isValid) external;

    /**
     * @dev Function to set outbound asset registry for the adapter.
     * @dev It manages the types of assets that the adapter is allowed to output, thus controlling
     * the flow’s output and maintaining consistency.
     * @param asset Address of the asset.
     * @param isValid Boolean value suggesting if this is a valid inbound asset.
     */
    function setOutboundAsset(address asset, bool isValid) external;
}

File 21 of 34 : IERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IERC20 {
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256 supply);

    function balanceOf(address _owner) external view returns (uint256 balance);

    function transfer(
        address _to,
        uint256 _value
    ) external returns (bool success);

    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) external returns (bool success);

    function approve(
        address _spender,
        uint256 _value
    ) external returns (bool success);

    function allowance(
        address _owner,
        address _spender
    ) external view returns (uint256 remaining);

    event Approval(
        address indexed _owner,
        address indexed _spender,
        uint256 _value
    );
}

File 22 of 34 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IERC20} from "../utils/SafeERC20.sol";

abstract contract IWETH {
    function allowance(address, address) public view virtual returns (uint256);

    function balanceOf(address) public view virtual returns (uint256);

    function approve(address, uint256) public virtual;

    function transfer(address, uint256) public virtual returns (bool);

    function transferFrom(
        address,
        address,
        uint256
    ) public virtual returns (bool);

    function deposit() public payable virtual;

    function withdraw(uint256) public virtual;
}

File 23 of 34 : RouterIntentEoaAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {BaseAdapter} from "./BaseAdapter.sol";
import {EoaExecutorWithDataProvider, EoaExecutorWithoutDataProvider} from "./utils/EoaExecutor.sol";

abstract contract RouterIntentEoaAdapterWithDataProvider is
    BaseAdapter,
    EoaExecutorWithDataProvider
{
    constructor(
        address __native,
        address __wnative,
        address __owner
    )
        BaseAdapter(__native, __wnative, true, __owner)
    // solhint-disable-next-line no-empty-blocks
    {

    }
}

abstract contract RouterIntentEoaAdapterWithoutDataProvider is
    BaseAdapter,
    EoaExecutorWithoutDataProvider
{
    constructor(
        address __native,
        address __wnative
    )
        BaseAdapter(__native, __wnative, false, address(0))
    // solhint-disable-next-line no-empty-blocks
    {

    }
}

File 24 of 34 : Address.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

library Address {
    //insufficient balance
    error InsufficientBalance(uint256 available, uint256 required);
    //unable to send value, recipient may have reverted
    error SendingValueFail();
    //insufficient balance for call
    error InsufficientBalanceForCall(uint256 available, uint256 required);
    //call to non-contract
    error NonContractCall();

    function isContract(address account) internal view returns (bool) {
        // According to EIP-1052, 0x0 is the value returned for not-yet created accounts
        // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
        // for accounts without code, i.e. `keccak256('')`
        bytes32 codehash;
        bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
        // solhint-disable-next-line no-inline-assembly
        assembly {
            codehash := extcodehash(account)
        }
        return (codehash != accountHash && codehash != 0x0);
    }

    function sendValue(address payable recipient, uint256 amount) internal {
        uint256 balance = address(this).balance;
        if (balance < amount) {
            revert InsufficientBalance(balance, amount);
        }

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (bool success, ) = recipient.call{value: amount}("");
        if (!(success)) {
            revert SendingValueFail();
        }
    }

    function functionCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return _functionCallWithValue(target, data, 0, errorMessage);
    }

    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"
            );
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        uint256 balance = address(this).balance;
        if (balance < value) {
            revert InsufficientBalanceForCall(balance, value);
        }
        return _functionCallWithValue(target, data, value, errorMessage);
    }

    function _functionCallWithValue(
        address target,
        bytes memory data,
        uint256 weiValue,
        string memory errorMessage
    ) private returns (bytes memory) {
        if (!(isContract(target))) {
            revert NonContractCall();
        }

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{value: weiValue}(
            data
        );
        if (success) {
            return returndata;
        } else {
            // 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 25 of 34 : EoaExecutor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

abstract contract EoaExecutorWithDataProvider {
    /**
     * @dev function to execute an action on an adapter used in an EOA.
     * @param precedingAdapter Address of the preceding adapter.
     * @param succeedingAdapter Address of the succeeding adapter.
     * @param data inputs data.
     * @return tokens to be refunded to user at the end of tx.
     */
    function execute(
        address precedingAdapter,
        address succeedingAdapter,
        bytes calldata data
    ) external payable virtual returns (address[] memory tokens);
}

abstract contract EoaExecutorWithoutDataProvider {
    /**
     * @dev function to execute an action on an adapter used in an EOA.
     * @param data inputs data.
     * @return tokens to be refunded to user at the end of tx.
     */
    function execute(
        bytes calldata data
    ) external payable virtual returns (address[] memory tokens);
}

File 26 of 34 : Errors.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.18;

/**
 * @title Errors library
 * @author Router Intents Error
 * @notice Defines the error messages emitted by the contracts on Router Intents
 */
library Errors {
    string public constant ARRAY_LENGTH_MISMATCH = "1"; // 'Array lengths mismatch'
    string public constant INSUFFICIENT_NATIVE_FUNDS_PASSED = "2"; // 'Insufficient native tokens passed'
    string public constant WRONG_BATCH_PROVIDED = "3"; // 'The targetLength, valueLength, callTypeLength, funcLength do not match in executeBatch transaction functions in batch transaction contract'
    string public constant INVALID_CALL_TYPE = "4"; // 'The callType value can only be 1 (call)' and 2(delegatecall)'
    string public constant ONLY_NITRO = "5"; // 'Only nitro can call this function'
    string public constant ONLY_SELF = "6"; // 'Only the current contract can call this function'
    string public constant ADAPTER_NOT_WHITELISTED = "7"; // 'Adapter not whitelisted'
}

File 27 of 34 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

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;

    error ReentrantCall();

    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 make it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        if (_status == _ENTERED) {
            revert ReentrantCall();
        }

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

        _;

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

File 28 of 34 : SafeERC20.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {IERC20} from "../interfaces/IERC20.sol";
import {Address} from "./Address.sol";
import {SafeMath} from "./SafeMath.sol";

library SafeERC20 {
    using SafeMath for uint256;
    using Address for address;

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

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

    /// @dev Edited so it always first approves 0 and then the value, because of non standard tokens
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, 0)
        );
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.approve.selector, spender, value)
        );
    }

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

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

    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        bytes memory returndata = address(token).functionCall(
            data,
            "SafeERC20: low-level call failed"
        );
        if (returndata.length > 0) {
            // Return data is optional
            // solhint-disable-next-line max-line-length
            require(
                abi.decode(returndata, (bool)),
                "SafeERC20: operation failed"
            );
        }
    }
}

File 29 of 34 : SafeMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: mul overflow");

        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        uint256 c = a / b;
        // assert(a == b * c + a % b); // There is no case in which this doesn't hold

        return c;
    }

    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

File 30 of 34 : CallLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

library CallLib {
    /**
     * @dev internal method that fecilitates the extenral calls from SmartAccount
     * @dev similar to execute() of Executor.sol
     * @param target destination address contract/non-contract
     * @param value amount of native tokens
     * @param data function singature of destination
     */
    function _call(
        address target,
        uint256 value,
        bytes memory data
    ) internal returns (bytes memory result) {
        // solhint-disable-next-line no-inline-assembly
        assembly {
            let success := call(
                gas(),
                target,
                value,
                add(data, 0x20),
                mload(data),
                0,
                0
            )

            // Get the size of the returned data
            let size := returndatasize()

            // Allocate memory for the return data
            result := mload(0x40)

            // Set the length of the return data
            mstore(result, size)

            // Copy the return data to the allocated memory
            returndatacopy(add(result, 0x20), 0, size)

            // Update the free memory pointer
            mstore(0x40, add(result, add(0x20, size)))

            if iszero(success) {
                revert(result, returndatasize())
            }
        }
    }

    /**
     * @dev internal method that fecilitates the extenral calls from SmartAccount
     * @dev similar to execute() of Executor.sol
     * @param target destination address contract/non-contract
     * @param data function singature of destination
     */
    function _delegateCall(
        address target,
        bytes memory data
    ) internal returns (bytes memory result) {
        require(target != address(this), "delegatecall to self");

        // solhint-disable-next-line no-inline-assembly
        assembly {
            // Perform delegatecall to the target contract
            let success := delegatecall(
                gas(),
                target,
                add(data, 0x20),
                mload(data),
                0,
                0
            )

            // Get the size of the returned data
            let size := returndatasize()

            // Allocate memory for the return data
            result := mload(0x40)

            // Set the length of the return data
            mstore(result, size)

            // Copy the return data to the allocated memory
            returndatacopy(add(result, 0x20), 0, size)

            // Update the free memory pointer
            mstore(0x40, add(result, add(0x20, size)))

            if iszero(success) {
                revert(result, returndatasize())
            }
        }
    }
}

File 31 of 34 : Errors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

library Errors {
    string public constant AMOUNT_CANNOT_BE_ZERO = "1";
    string public constant RECIPIENT_CANNOT_BE_ZERO = "2";
    string public constant AMOUNT_RECEIVED_CANNOT_BE_ZERO = "3";
    string public constant RESTAKED_ETH_RECEIVED_AMOUNT_LESS_THAN_MIN_RETURN =
        "4";
    string public constant ONLY_EMERGENCY_OWNER = "5";
    string public constant EMERGENCY_OWNER_CANNOT_BE_ZERO = "6";
    string public constant WRONG_BATCH_PROVIDED = "7";
    string public constant INSUFFICIENT_NATIVE_FUNDS_PASSED = "8";
    string public constant ONLY_SELF = "9";
    string public constant ARRAY_LENGTH_MISMATCH = "10";
    string public constant INSUFFICIENT_FEE_PASSED = "11";
    string public constant VOLUME_CANNOT_BE_ZERO = "12";
    string public constant ONLY_NATIVE_TOKENS = "13";
    string public constant ONLY_NITRO_BRIDGE = "14";
    string public constant ONLY_WHITELISTED_BRIDGES = "15";
    string public constant BRIDGE_ADAPTER_ADDRESS_CANNOT_BE_ZERO = "16";
    string public constant MULTICALLER_ADDRESS_CANNOT_BE_ZERO = "17";
    string public constant FEE_MANAGER_ADDRESS_CANNOT_BE_ZERO = "18";
    string public constant SWAP_FAILED = "19";
    string public constant ADAPTER_NOT_WHITELISTED = "20";
    string public constant BRIDGE_TX_FAILED_ON_MULTICALL = "21";
    string public constant TOKEN_PASSED_CANNOT_BE_NULL_ADDRESS = "22";
    string public constant ADAPTER_ADDRESS_CANNOT_BE_ZERO = "23";
    string public constant ADAPTER_TYPE_CAN_BE_EITHER_1_OR_2 = "24";
    string public constant FEE_TRANSFER_FAILED = "25";
    string public constant AMOUNT_LESSER_THAN_MIN_DEPOSIT = "26";
    string public constant ARRAY_LENGTH_ZERO = "27";
    string public constant REFUND_AMOUNT_ZERO = "28";
    string public constant INVALID_RESTAKING_PROTOCOL_TYPE = "29";
    string public constant INVALID_PROTOCOL_DATA = "30";
    string public constant BASE_GAS_NOT_IN_RANGE = "31";
    string public constant MARGINAL_GAS_PER_USER_NOT_IN_RANGE = "32";
    string public constant FEE_TOO_LARGE = "33";
    string public constant ZERO_DEPOSIT_FUNDS_FOR_THIS_PROTOCOL_ID = "34";
    string public constant NOT_EXECUTABLE = "35";
    string public constant PROTOCOL_DATA_NOT_SET = "36";
    string public constant CANNOT_EXECUTE_LESSER_THAN_MIN_EXECUTABLE_BATCH =
        "37";
    string public constant MAX_FEE_PERCENTAGE_GREATER_THAN_CEILING = "38";
    string public constant FUSION_TX_BUILDER_CANNOT_BE_ADDRESS_ZERO = "39";
    string public constant PROTOCOL_IS_PAUSED = "40";
    string public constant OPEN_OCEAN_ADDRESS_CANNOT_BE_ZERO = "41";
    string public constant BRIDGE_ADDRESS_CANNOT_BE_ZERO = "42";
    string public constant WNATIVE_ADDRESS_CANNOT_BE_ZERO = "43";
    string public constant CHAIN_LINK_GAS_PRICE_ORACLE_ADDRESS_CANNOT_BE_ZERO =
        "44";
    string public constant STAKE_EASE_FEE_MANAGER_ADDRESS_CANNOT_BE_ZERO = "45";
    string public constant PROTOCOL_GAS_PER_USER_OUT_OF_RANGE = "46";
    string public constant GAS_PRICE_EXCEEDS_FAST_GAS_RANGE = "47";
    string public constant AMOUNT_TO_RESTAKE_CANNOT_BE_ZERO = "48";
    string public constant UNSUPPORTED_OPERATION = "49";
    string public constant CANNOT_SET_ALL_DATA_FOR_PROTOCOL_AGAIN = "50";
    string public constant INVALID_ASSET = "51";
    string public constant CANNOT_SET_NEW_PROTOCOL_DATA_WITH_UPDATE_FUNCTION =
        "52";
}

File 32 of 34 : INitroMessageHandler.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

/// @title Handles ERC20 deposits and deposit executions.
/// @author Router Protocol.
/// @notice This contract is intended to be used with the Bridge contract.
interface INitroMessageHandler {
    function handleMessage(
        address tokenSent,
        uint256 amount,
        bytes memory message
    ) external;
}

interface INitroAssetForwarder {
    struct RelayDataMessage {
        uint256 amount;
        bytes32 srcChainId;
        uint256 depositId;
        address destToken;
        address recipient;
        bytes message;
    }

    function iRelayMessage(RelayDataMessage memory relayData) external payable;
}

File 33 of 34 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256 amount) external;

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

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

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

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

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

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

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

File 34 of 34 : TokenUtils.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.18;

import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {SafeERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

contract TokenUtils {
    using SafeERC20 for IERC20;

    address public constant NATIVE_ADDRESS =
        0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

    function withdrawTokens(
        address token,
        address recipient,
        uint256 amount
    ) internal {
        if (token == NATIVE_ADDRESS) {
            if (amount == type(uint256).max) amount = address(this).balance;
            if (amount == 0) return;
            payable(recipient).transfer(amount);
        } else {
            if (amount == type(uint256).max)
                amount = IERC20(token).balanceOf(address(this));
            if (amount == 0) return;

            IERC20(token).safeTransfer(recipient, amount);
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_assetForwarder","type":"address"},{"internalType":"address","name":"_dexspan","type":"address"},{"internalType":"address","name":"_wnative","type":"address"},{"internalType":"address[]","name":"_whitelistedAdapters","type":"address[]"}],"stateMutability":"payable","type":"constructor"},{"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":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NATIVE_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SETTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TEMP_TOKENS_LENGTH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"assetForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dexspan","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"emergencyWithdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address[]","name":"target","type":"address[]"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"refundRecipient","type":"address"},{"internalType":"address[]","name":"target","type":"address[]"},{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"executeDest","outputs":[],"stateMutability":"payable","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":"address","name":"tokenSent","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"message","type":"bytes"}],"name":"handleMessage","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":[{"internalType":"address","name":"adapter","type":"address"}],"name":"isAdapterWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","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":"adapterAddress","type":"address[]"},{"internalType":"bool[]","name":"shouldWhitelist","type":"bool[]"}],"name":"setAdapterWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wnative","outputs":[{"internalType":"contract IWETH","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60e06040526040516200273938038062002739833981016040819052620000269162000234565b6001600160a01b0380851660805283811660a052821660c052805160005b818110156200011b5760006001600160a01b03168382815181106200006d576200006d6200033f565b60200260200101516001600160a01b0316141560405180604001604052806002815260200161323360f01b81525090620000c55760405162461bcd60e51b8152600401620000bc919062000355565b60405180910390fd5b506001806000858481518110620000e057620000e06200033f565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905560010162000044565b506200012960003362000160565b620001557f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda3362000160565b5050505050620003a5565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16620001fd576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001bc3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b03811681146200021957600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080608085870312156200024b57600080fd5b620002568562000201565b935060206200026781870162000201565b9350620002776040870162000201565b60608701519093506001600160401b03808211156200029557600080fd5b818801915088601f830112620002aa57600080fd5b815181811115620002bf57620002bf6200021e565b8060051b604051601f19603f83011681018181108582111715620002e757620002e76200021e565b60405291825284820192508381018501918b8311156200030657600080fd5b938501935b828510156200032f576200031f8562000201565b845293850193928501926200030b565b989b979a50959850505050505050565b634e487b7160e01b600052603260045260246000fd5b600060208083528351808285015260005b81811015620003845785810183015185820160400152820162000366565b506000604082860101526040601f19601f8301168501019250505092915050565b60805160a05160c051612341620003f8600039600081816101d901528181610974015281816109c40152610a2a0152600081816102af01526108800152600081816102e3015261084c01526123416000f3fe6080604052600436106101485760003560e01c80637fe68917116100c0578063d23ebc7d11610074578063d5bcb61011610059578063d5bcb610146103e5578063dfd7cb061461040d578063f6f38e7c1461042d57600080fd5b8063d23ebc7d146103b2578063d547741f146103c557600080fd5b8063a2011b3f116100a5578063a2011b3f14610349578063a217fddf1461037d578063d00a2d5f1461039257600080fd5b80637fe68917146102d157806391d148541461030557600080fd5b806336568abe1161011757806357cf33ff116100fc57806357cf33ff14610275578063602510b51461028a5780636cec044b1461029d57600080fd5b806336568abe14610235578063375d7d2c1461025557600080fd5b806301ffc9a714610154578063248a9ca3146101895780632cebdeb2146101c75780632f2ff15d1461021357600080fd5b3661014f57005b600080fd5b34801561016057600080fd5b5061017461016f366004611a05565b610466565b60405190151581526020015b60405180910390f35b34801561019557600080fd5b506101b96101a4366004611a2f565b60009081526020819052604090206001015490565b604051908152602001610180565b3480156101d357600080fd5b506101fb7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610180565b34801561021f57600080fd5b5061023361022e366004611a5d565b6104cf565b005b34801561024157600080fd5b50610233610250366004611a5d565b6104f9565b34801561026157600080fd5b50610233610270366004611a8d565b61058a565b34801561028157600080fd5b506101b9600681565b610233610298366004611b1a565b61076b565b3480156102a957600080fd5b506101fb7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102dd57600080fd5b506101fb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561031157600080fd5b50610174610320366004611a5d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561035557600080fd5b506101b97f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda81565b34801561038957600080fd5b506101b9600081565b34801561039e57600080fd5b506102336103ad366004611c0c565b610841565b6102336103c0366004611ca8565b610b95565b3480156103d157600080fd5b506102336103e0366004611a5d565b610cc5565b3480156103f157600080fd5b506101fb73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b34801561041957600080fd5b50610233610428366004611dd5565b610cea565b34801561043957600080fd5b50610174610448366004611e97565b6001600160a01b031660009081526001602052604090205460ff1690565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806104c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6000828152602081905260409020600101546104ea81610e7b565b6104f48383610e88565b505050565b6001600160a01b038116331461057c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105868282610f26565b5050565b600061059581610e7b565b60408051808201909152600181527f320000000000000000000000000000000000000000000000000000000000000060208201526001600160a01b0384166105f05760405162461bcd60e51b81526004016105739190611f04565b506001600160a01b038416158061062357506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b156106a75781600003610634574791505b8160000361066b5760408051808201825260018152603160f81b6020820152905162461bcd60e51b81526105739190600401611f04565b6040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156106a1573d6000803e3d6000fd5b50610765565b8160000361071a576040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa1580156106f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107179190611f17565b91505b816000036107515760408051808201825260018152603160f81b6020820152905162461bcd60e51b81526105739190600401611f04565b6107656001600160a01b0385168484610fa5565b50505050565b60408051808201909152600181527f390000000000000000000000000000000000000000000000000000000000000060208201523330146107bf5760405162461bcd60e51b81526004016105739190611f04565b5060408051600680825260e082019092526000916020820160c08036833701905050905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8160008151811061080b5761080b611f30565b60200260200101906001600160a01b031690816001600160a01b031681525050610839868686868686611021565b505050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015906108a35750336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614155b156108f357604080518082018252600281527f31340000000000000000000000000000000000000000000000000000000000006020820152905162461bcd60e51b81526105739190600401611f04565b6040805180820190915260018152603160f81b6020820152826109295760405162461bcd60e51b81526004016105739190611f04565b506000806000838060200190518101906109439190611faa565b919450925090506001600160a01b03861673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148015906109a957507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b031614155b156109c2576108396001600160a01b0387168487610fa5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316866001600160a01b031603610a8f576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018690527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610a7657600080fd5b505af1158015610a8a573d6000803e3d6000fd5b505050505b60405160009030907f602510b50000000000000000000000000000000000000000000000000000000090610acb908790879087906024016120ce565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610b09919061217e565b6000604051808303816000865af19150503d8060008114610b46576040519150601f19603f3d011682016040523d82523d6000602084013e610b4b565b606091505b5050905080610b8c576040516001600160a01b0385169087156108fc029088906000818181858888f19350505050158015610b8a573d6000803e3d6000fd5b505b50505050505050565b6040805180820190915260018152603160f81b602082015285610bcb5760405162461bcd60e51b81526004016105739190611f04565b506001600160a01b03861673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610c0a57610c056001600160a01b03871633308861115f565b610c60565b60408051808201909152600181527f38000000000000000000000000000000000000000000000000000000000000006020820152348614610c5e5760405162461bcd60e51b81526004016105739190611f04565b505b60408051600680825260e082019092526000916020820160c0803683370190505090508681600081518110610c9757610c97611f30565b60200260200101906001600160a01b031690816001600160a01b031681525050610b8c338686868686611021565b600082815260208190526040902060010154610ce081610e7b565b6104f48383610f26565b7f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda610d1481610e7b565b82518015801590610d255750825181145b6040518060400160405280600281526020017f313000000000000000000000000000000000000000000000000000000000000081525090610d795760405162461bcd60e51b81526004016105739190611f04565b5060005b81811015610e745760006001600160a01b0316858281518110610da257610da2611f30565b60200260200101516001600160a01b031614156040518060400160405280600281526020017f323300000000000000000000000000000000000000000000000000000000000081525090610e095760405162461bcd60e51b81526004016105739190611f04565b50838181518110610e1c57610e1c611f30565b602002602001015160016000878481518110610e3a57610e3a611f30565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610d7d565b5050505050565b610e8581336111b0565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610586576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610ee23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610586576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b0383166024820152604481018290526104f49084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611223565b83801580159061103057508083145b6040518060400160405280600181526020017f3700000000000000000000000000000000000000000000000000000000000000815250906110845760405162461bcd60e51b81526004016105739190611f04565b5060005b81811015611154576110bf8787838181106110a5576110a5611f30565b90506020020160208101906110ba9190611e97565b61130b565b61114a818888848181106110d5576110d5611f30565b90506020020160208101906110ea9190611e97565b8787858181106110fc576110fc611f30565b905060200281019061110e919061219a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525089925061137c915050565b9250600101611088565b50610b8c878361145b565b6040516001600160a01b03808516602483015283166044820152606481018290526107659085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610fea565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610586576111e1816114c9565b6111ec8360206114db565b6040516020016111fd9291906121e1565b60408051601f198184030181529082905262461bcd60e51b825261057391600401611f04565b6000611278826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116c39092919063ffffffff16565b90508051600014806112995750808060200190518101906112999190612262565b6104f45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610573565b6001600160a01b038116600090815260016020908152604091829020548251808401909352600283527f32300000000000000000000000000000000000000000000000000000000000009183019190915260ff166105865760405162461bcd60e51b81526004016105739190611f04565b606060006309c5eabe60e01b846040516024016113999190611f04565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905060006113d986836116d2565b90506000818060200190518101906113f1919061227f565b90508060008151811061140657611406611f30565b60200260200101518589600161141c91906122ca565b8151811061142c5761142c611f30565b60200260200101906001600160a01b031690816001600160a01b0316815250508493505050505b949350505050565b60005b60068110156104f45760006001600160a01b031682828151811061148457611484611f30565b60200260200101516001600160a01b031603156104f4576114c18282815181106114b0576114b0611f30565b602002602001015184600019611761565b60010161145e565b60606104c96001600160a01b03831660145b606060006114ea8360026122dd565b6114f59060026122ca565b67ffffffffffffffff81111561150d5761150d611b9d565b6040519080825280601f01601f191660200182016040528015611537576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061156e5761156e611f30565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106115b9576115b9611f30565b60200101906001600160f81b031916908160001a90535060006115dd8460026122dd565b6115e89060016122ca565b90505b600181111561166d577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061162957611629611f30565b1a60f81b82828151811061163f5761163f611f30565b60200101906001600160f81b031916908160001a90535060049490941c93611666816122f4565b90506115eb565b5083156116bc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610573565b9392505050565b60606114538484600085611875565b6060306001600160a01b0384160361172c5760405162461bcd60e51b815260206004820152601460248201527f64656c656761746563616c6c20746f2073656c660000000000000000000000006044820152606401610573565b600080835160208501865af43d6040519250808352806000602085013e82016020016040528061175a573d82fd5b5092915050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016117e057600019810361179d5750475b806000036117aa57505050565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610765573d6000803e3d6000fd5b6000198103611854576040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa15801561182d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118519190611f17565b90505b8060000361186157505050565b6104f46001600160a01b0384168383610fa5565b6060824710156118ed5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610573565b600080866001600160a01b03168587604051611909919061217e565b60006040518083038185875af1925050503d8060008114611946576040519150601f19603f3d011682016040523d82523d6000602084013e61194b565b606091505b509150915061195c87838387611967565b979650505050505050565b606083156119d65782516000036119cf576001600160a01b0385163b6119cf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610573565b5081611453565b61145383838151156119eb5781518083602001fd5b8060405162461bcd60e51b81526004016105739190611f04565b600060208284031215611a1757600080fd5b81356001600160e01b0319811681146116bc57600080fd5b600060208284031215611a4157600080fd5b5035919050565b6001600160a01b0381168114610e8557600080fd5b60008060408385031215611a7057600080fd5b823591506020830135611a8281611a48565b809150509250929050565b600080600060608486031215611aa257600080fd5b8335611aad81611a48565b92506020840135611abd81611a48565b929592945050506040919091013590565b60008083601f840112611ae057600080fd5b50813567ffffffffffffffff811115611af857600080fd5b6020830191508360208260051b8501011115611b1357600080fd5b9250929050565b600080600080600060608688031215611b3257600080fd5b8535611b3d81611a48565b9450602086013567ffffffffffffffff80821115611b5a57600080fd5b611b6689838a01611ace565b90965094506040880135915080821115611b7f57600080fd5b50611b8c88828901611ace565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611bdc57611bdc611b9d565b604052919050565b600067ffffffffffffffff821115611bfe57611bfe611b9d565b50601f01601f191660200190565b600080600060608486031215611c2157600080fd5b8335611c2c81611a48565b925060208401359150604084013567ffffffffffffffff811115611c4f57600080fd5b8401601f81018613611c6057600080fd5b8035611c73611c6e82611be4565b611bb3565b818152876020838501011115611c8857600080fd5b816020840160208301376000602083830101528093505050509250925092565b60008060008060008060808789031215611cc157600080fd5b8635611ccc81611a48565b955060208701359450604087013567ffffffffffffffff80821115611cf057600080fd5b611cfc8a838b01611ace565b90965094506060890135915080821115611d1557600080fd5b50611d2289828a01611ace565b979a9699509497509295939492505050565b600067ffffffffffffffff821115611d4e57611d4e611b9d565b5060051b60200190565b8015158114610e8557600080fd5b600082601f830112611d7757600080fd5b81356020611d87611c6e83611d34565b82815260059290921b84018101918181019086841115611da657600080fd5b8286015b84811015611dca578035611dbd81611d58565b8352918301918301611daa565b509695505050505050565b60008060408385031215611de857600080fd5b823567ffffffffffffffff80821115611e0057600080fd5b818501915085601f830112611e1457600080fd5b81356020611e24611c6e83611d34565b82815260059290921b84018101918181019089841115611e4357600080fd5b948201945b83861015611e6a578535611e5b81611a48565b82529482019490820190611e48565b96505086013592505080821115611e8057600080fd5b50611e8d85828601611d66565b9150509250929050565b600060208284031215611ea957600080fd5b81356116bc81611a48565b60005b83811015611ecf578181015183820152602001611eb7565b50506000910152565b60008151808452611ef0816020860160208601611eb4565b601f01601f19169290920160200192915050565b6020815260006116bc6020830184611ed8565b600060208284031215611f2957600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112611f5757600080fd5b81516020611f67611c6e83611d34565b82815260059290921b84018101918181019086841115611f8657600080fd5b8286015b84811015611dca578051611f9d81611a48565b8352918301918301611f8a565b600080600060608486031215611fbf57600080fd5b8351611fca81611a48565b8093505060208085015167ffffffffffffffff80821115611fea57600080fd5b611ff688838901611f46565b945060409150818701518181111561200d57600080fd5b8701601f8101891361201e57600080fd5b805161202c611c6e82611d34565b81815260059190911b8201850190858101908b83111561204b57600080fd5b8684015b838110156120bc578051868111156120675760008081fd5b8501603f81018e136120795760008081fd5b88810151612089611c6e82611be4565b8181528f8a83850101111561209e5760008081fd5b6120ad828c83018c8601611eb4565b8552505091870191870161204f565b50809750505050505050509250925092565b6000606082016001600160a01b0380871684526020606081860152828751808552608087019150828901945060005b8181101561211b5785518516835294830194918301916001016120fd565b50508581036040870152865180825282820194509250600583901b8101820182880160005b8581101561216e57601f1984840301875261215c838351611ed8565b96850196925090840190600101612140565b50909a9950505050505050505050565b60008251612190818460208701611eb4565b9190910192915050565b6000808335601e198436030181126121b157600080fd5b83018035915067ffffffffffffffff8211156121cc57600080fd5b602001915036819003821315611b1357600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612219816017850160208801611eb4565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612256816028840160208801611eb4565b01602801949350505050565b60006020828403121561227457600080fd5b81516116bc81611d58565b60006020828403121561229157600080fd5b815167ffffffffffffffff8111156122a857600080fd5b61145384828501611f46565b634e487b7160e01b600052601160045260246000fd5b808201808211156104c9576104c96122b4565b80820281158282048414176104c9576104c96122b4565b600081612303576123036122b4565b50600019019056fea26469706673582212208ef2b921e1446238c412e70eb4544aa598b50f6dd6a3ae4ca6d9074e0b49ee7a64736f6c63430008140033000000000000000000000000c21e4ebd1d92036cb467b53fe3258f219d909eb90000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000a5c38cc01d74e5c70d23315df92f07756bee97a10000000000000000000000005227a79495c7c644d76ddb8595366bca1cf921380000000000000000000000005adda1c1ce78e4c38f51a395de79fbc978dc841d000000000000000000000000e6eb33b804958b9bbfafa879090941031f65c681000000000000000000000000f963ac3b6a7ae3e39b1c5e8699fb504c2ffa38890000000000000000000000006470acc20ddf92967fdcac2d669c799cb273f9b60000000000000000000000001b46ad69d8d48cb11b2a1971f6340d6da46d2e2b000000000000000000000000389a0ac03b1fb2e568013290135acb0834e80ac3000000000000000000000000b7298ec182a7a1c18b41f8695e77c9ef8e77eb9a0000000000000000000000005f9f73f07c28b2a7eeb0bf2346b5af59261426820000000000000000000000008f892abc9203357c9ecb4b2c3ec49907fff52260000000000000000000000000e89808045e80f190af23ebe293473ba8dd6691cf000000000000000000000000fd33ef249931b215abdeae7b8275d967cef61d2e000000000000000000000000aa066dd34dde56cf0765f4045939c6c312a96bed

Deployed Bytecode

0x6080604052600436106101485760003560e01c80637fe68917116100c0578063d23ebc7d11610074578063d5bcb61011610059578063d5bcb610146103e5578063dfd7cb061461040d578063f6f38e7c1461042d57600080fd5b8063d23ebc7d146103b2578063d547741f146103c557600080fd5b8063a2011b3f116100a5578063a2011b3f14610349578063a217fddf1461037d578063d00a2d5f1461039257600080fd5b80637fe68917146102d157806391d148541461030557600080fd5b806336568abe1161011757806357cf33ff116100fc57806357cf33ff14610275578063602510b51461028a5780636cec044b1461029d57600080fd5b806336568abe14610235578063375d7d2c1461025557600080fd5b806301ffc9a714610154578063248a9ca3146101895780632cebdeb2146101c75780632f2ff15d1461021357600080fd5b3661014f57005b600080fd5b34801561016057600080fd5b5061017461016f366004611a05565b610466565b60405190151581526020015b60405180910390f35b34801561019557600080fd5b506101b96101a4366004611a2f565b60009081526020819052604090206001015490565b604051908152602001610180565b3480156101d357600080fd5b506101fb7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b6040516001600160a01b039091168152602001610180565b34801561021f57600080fd5b5061023361022e366004611a5d565b6104cf565b005b34801561024157600080fd5b50610233610250366004611a5d565b6104f9565b34801561026157600080fd5b50610233610270366004611a8d565b61058a565b34801561028157600080fd5b506101b9600681565b610233610298366004611b1a565b61076b565b3480156102a957600080fd5b506101fb7f0000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce81565b3480156102dd57600080fd5b506101fb7f000000000000000000000000c21e4ebd1d92036cb467b53fe3258f219d909eb981565b34801561031157600080fd5b50610174610320366004611a5d565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561035557600080fd5b506101b97f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda81565b34801561038957600080fd5b506101b9600081565b34801561039e57600080fd5b506102336103ad366004611c0c565b610841565b6102336103c0366004611ca8565b610b95565b3480156103d157600080fd5b506102336103e0366004611a5d565b610cc5565b3480156103f157600080fd5b506101fb73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b34801561041957600080fd5b50610233610428366004611dd5565b610cea565b34801561043957600080fd5b50610174610448366004611e97565b6001600160a01b031660009081526001602052604090205460ff1690565b60006001600160e01b031982167f7965db0b0000000000000000000000000000000000000000000000000000000014806104c957507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6000828152602081905260409020600101546104ea81610e7b565b6104f48383610e88565b505050565b6001600160a01b038116331461057c5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6105868282610f26565b5050565b600061059581610e7b565b60408051808201909152600181527f320000000000000000000000000000000000000000000000000000000000000060208201526001600160a01b0384166105f05760405162461bcd60e51b81526004016105739190611f04565b506001600160a01b038416158061062357506001600160a01b03841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b156106a75781600003610634574791505b8160000361066b5760408051808201825260018152603160f81b6020820152905162461bcd60e51b81526105739190600401611f04565b6040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156106a1573d6000803e3d6000fd5b50610765565b8160000361071a576040516370a0823160e01b81523060048201526001600160a01b038516906370a0823190602401602060405180830381865afa1580156106f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107179190611f17565b91505b816000036107515760408051808201825260018152603160f81b6020820152905162461bcd60e51b81526105739190600401611f04565b6107656001600160a01b0385168484610fa5565b50505050565b60408051808201909152600181527f390000000000000000000000000000000000000000000000000000000000000060208201523330146107bf5760405162461bcd60e51b81526004016105739190611f04565b5060408051600680825260e082019092526000916020820160c08036833701905050905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8160008151811061080b5761080b611f30565b60200260200101906001600160a01b031690816001600160a01b031681525050610839868686868686611021565b505050505050565b336001600160a01b037f000000000000000000000000c21e4ebd1d92036cb467b53fe3258f219d909eb916148015906108a35750336001600160a01b037f0000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce1614155b156108f357604080518082018252600281527f31340000000000000000000000000000000000000000000000000000000000006020820152905162461bcd60e51b81526105739190600401611f04565b6040805180820190915260018152603160f81b6020820152826109295760405162461bcd60e51b81526004016105739190611f04565b506000806000838060200190518101906109439190611faa565b919450925090506001600160a01b03861673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee148015906109a957507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b031614155b156109c2576108396001600160a01b0387168487610fa5565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316866001600160a01b031603610a8f576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018690527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031690632e1a7d4d90602401600060405180830381600087803b158015610a7657600080fd5b505af1158015610a8a573d6000803e3d6000fd5b505050505b60405160009030907f602510b50000000000000000000000000000000000000000000000000000000090610acb908790879087906024016120ce565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610b09919061217e565b6000604051808303816000865af19150503d8060008114610b46576040519150601f19603f3d011682016040523d82523d6000602084013e610b4b565b606091505b5050905080610b8c576040516001600160a01b0385169087156108fc029088906000818181858888f19350505050158015610b8a573d6000803e3d6000fd5b505b50505050505050565b6040805180820190915260018152603160f81b602082015285610bcb5760405162461bcd60e51b81526004016105739190611f04565b506001600160a01b03861673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14610c0a57610c056001600160a01b03871633308861115f565b610c60565b60408051808201909152600181527f38000000000000000000000000000000000000000000000000000000000000006020820152348614610c5e5760405162461bcd60e51b81526004016105739190611f04565b505b60408051600680825260e082019092526000916020820160c0803683370190505090508681600081518110610c9757610c97611f30565b60200260200101906001600160a01b031690816001600160a01b031681525050610b8c338686868686611021565b600082815260208190526040902060010154610ce081610e7b565b6104f48383610f26565b7f61c92169ef077349011ff0b1383c894d86c5f0b41d986366b58a6cf31e93beda610d1481610e7b565b82518015801590610d255750825181145b6040518060400160405280600281526020017f313000000000000000000000000000000000000000000000000000000000000081525090610d795760405162461bcd60e51b81526004016105739190611f04565b5060005b81811015610e745760006001600160a01b0316858281518110610da257610da2611f30565b60200260200101516001600160a01b031614156040518060400160405280600281526020017f323300000000000000000000000000000000000000000000000000000000000081525090610e095760405162461bcd60e51b81526004016105739190611f04565b50838181518110610e1c57610e1c611f30565b602002602001015160016000878481518110610e3a57610e3a611f30565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101610d7d565b5050505050565b610e8581336111b0565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610586576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610ee23390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1615610586576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6040516001600160a01b0383166024820152604481018290526104f49084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152611223565b83801580159061103057508083145b6040518060400160405280600181526020017f3700000000000000000000000000000000000000000000000000000000000000815250906110845760405162461bcd60e51b81526004016105739190611f04565b5060005b81811015611154576110bf8787838181106110a5576110a5611f30565b90506020020160208101906110ba9190611e97565b61130b565b61114a818888848181106110d5576110d5611f30565b90506020020160208101906110ea9190611e97565b8787858181106110fc576110fc611f30565b905060200281019061110e919061219a565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525089925061137c915050565b9250600101611088565b50610b8c878361145b565b6040516001600160a01b03808516602483015283166044820152606481018290526107659085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401610fea565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610586576111e1816114c9565b6111ec8360206114db565b6040516020016111fd9291906121e1565b60408051601f198184030181529082905262461bcd60e51b825261057391600401611f04565b6000611278826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166116c39092919063ffffffff16565b90508051600014806112995750808060200190518101906112999190612262565b6104f45760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610573565b6001600160a01b038116600090815260016020908152604091829020548251808401909352600283527f32300000000000000000000000000000000000000000000000000000000000009183019190915260ff166105865760405162461bcd60e51b81526004016105739190611f04565b606060006309c5eabe60e01b846040516024016113999190611f04565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905060006113d986836116d2565b90506000818060200190518101906113f1919061227f565b90508060008151811061140657611406611f30565b60200260200101518589600161141c91906122ca565b8151811061142c5761142c611f30565b60200260200101906001600160a01b031690816001600160a01b0316815250508493505050505b949350505050565b60005b60068110156104f45760006001600160a01b031682828151811061148457611484611f30565b60200260200101516001600160a01b031603156104f4576114c18282815181106114b0576114b0611f30565b602002602001015184600019611761565b60010161145e565b60606104c96001600160a01b03831660145b606060006114ea8360026122dd565b6114f59060026122ca565b67ffffffffffffffff81111561150d5761150d611b9d565b6040519080825280601f01601f191660200182016040528015611537576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061156e5761156e611f30565b60200101906001600160f81b031916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106115b9576115b9611f30565b60200101906001600160f81b031916908160001a90535060006115dd8460026122dd565b6115e89060016122ca565b90505b600181111561166d577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061162957611629611f30565b1a60f81b82828151811061163f5761163f611f30565b60200101906001600160f81b031916908160001a90535060049490941c93611666816122f4565b90506115eb565b5083156116bc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610573565b9392505050565b60606114538484600085611875565b6060306001600160a01b0384160361172c5760405162461bcd60e51b815260206004820152601460248201527f64656c656761746563616c6c20746f2073656c660000000000000000000000006044820152606401610573565b600080835160208501865af43d6040519250808352806000602085013e82016020016040528061175a573d82fd5b5092915050565b7fffffffffffffffffffffffff11111111111111111111111111111111111111126001600160a01b038416016117e057600019810361179d5750475b806000036117aa57505050565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610765573d6000803e3d6000fd5b6000198103611854576040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa15801561182d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118519190611f17565b90505b8060000361186157505050565b6104f46001600160a01b0384168383610fa5565b6060824710156118ed5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610573565b600080866001600160a01b03168587604051611909919061217e565b60006040518083038185875af1925050503d8060008114611946576040519150601f19603f3d011682016040523d82523d6000602084013e61194b565b606091505b509150915061195c87838387611967565b979650505050505050565b606083156119d65782516000036119cf576001600160a01b0385163b6119cf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610573565b5081611453565b61145383838151156119eb5781518083602001fd5b8060405162461bcd60e51b81526004016105739190611f04565b600060208284031215611a1757600080fd5b81356001600160e01b0319811681146116bc57600080fd5b600060208284031215611a4157600080fd5b5035919050565b6001600160a01b0381168114610e8557600080fd5b60008060408385031215611a7057600080fd5b823591506020830135611a8281611a48565b809150509250929050565b600080600060608486031215611aa257600080fd5b8335611aad81611a48565b92506020840135611abd81611a48565b929592945050506040919091013590565b60008083601f840112611ae057600080fd5b50813567ffffffffffffffff811115611af857600080fd5b6020830191508360208260051b8501011115611b1357600080fd5b9250929050565b600080600080600060608688031215611b3257600080fd5b8535611b3d81611a48565b9450602086013567ffffffffffffffff80821115611b5a57600080fd5b611b6689838a01611ace565b90965094506040880135915080821115611b7f57600080fd5b50611b8c88828901611ace565b969995985093965092949392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611bdc57611bdc611b9d565b604052919050565b600067ffffffffffffffff821115611bfe57611bfe611b9d565b50601f01601f191660200190565b600080600060608486031215611c2157600080fd5b8335611c2c81611a48565b925060208401359150604084013567ffffffffffffffff811115611c4f57600080fd5b8401601f81018613611c6057600080fd5b8035611c73611c6e82611be4565b611bb3565b818152876020838501011115611c8857600080fd5b816020840160208301376000602083830101528093505050509250925092565b60008060008060008060808789031215611cc157600080fd5b8635611ccc81611a48565b955060208701359450604087013567ffffffffffffffff80821115611cf057600080fd5b611cfc8a838b01611ace565b90965094506060890135915080821115611d1557600080fd5b50611d2289828a01611ace565b979a9699509497509295939492505050565b600067ffffffffffffffff821115611d4e57611d4e611b9d565b5060051b60200190565b8015158114610e8557600080fd5b600082601f830112611d7757600080fd5b81356020611d87611c6e83611d34565b82815260059290921b84018101918181019086841115611da657600080fd5b8286015b84811015611dca578035611dbd81611d58565b8352918301918301611daa565b509695505050505050565b60008060408385031215611de857600080fd5b823567ffffffffffffffff80821115611e0057600080fd5b818501915085601f830112611e1457600080fd5b81356020611e24611c6e83611d34565b82815260059290921b84018101918181019089841115611e4357600080fd5b948201945b83861015611e6a578535611e5b81611a48565b82529482019490820190611e48565b96505086013592505080821115611e8057600080fd5b50611e8d85828601611d66565b9150509250929050565b600060208284031215611ea957600080fd5b81356116bc81611a48565b60005b83811015611ecf578181015183820152602001611eb7565b50506000910152565b60008151808452611ef0816020860160208601611eb4565b601f01601f19169290920160200192915050565b6020815260006116bc6020830184611ed8565b600060208284031215611f2957600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600082601f830112611f5757600080fd5b81516020611f67611c6e83611d34565b82815260059290921b84018101918181019086841115611f8657600080fd5b8286015b84811015611dca578051611f9d81611a48565b8352918301918301611f8a565b600080600060608486031215611fbf57600080fd5b8351611fca81611a48565b8093505060208085015167ffffffffffffffff80821115611fea57600080fd5b611ff688838901611f46565b945060409150818701518181111561200d57600080fd5b8701601f8101891361201e57600080fd5b805161202c611c6e82611d34565b81815260059190911b8201850190858101908b83111561204b57600080fd5b8684015b838110156120bc578051868111156120675760008081fd5b8501603f81018e136120795760008081fd5b88810151612089611c6e82611be4565b8181528f8a83850101111561209e5760008081fd5b6120ad828c83018c8601611eb4565b8552505091870191870161204f565b50809750505050505050509250925092565b6000606082016001600160a01b0380871684526020606081860152828751808552608087019150828901945060005b8181101561211b5785518516835294830194918301916001016120fd565b50508581036040870152865180825282820194509250600583901b8101820182880160005b8581101561216e57601f1984840301875261215c838351611ed8565b96850196925090840190600101612140565b50909a9950505050505050505050565b60008251612190818460208701611eb4565b9190910192915050565b6000808335601e198436030181126121b157600080fd5b83018035915067ffffffffffffffff8211156121cc57600080fd5b602001915036819003821315611b1357600080fd5b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351612219816017850160208801611eb4565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351612256816028840160208801611eb4565b01602801949350505050565b60006020828403121561227457600080fd5b81516116bc81611d58565b60006020828403121561229157600080fd5b815167ffffffffffffffff8111156122a857600080fd5b61145384828501611f46565b634e487b7160e01b600052601160045260246000fd5b808201808211156104c9576104c96122b4565b80820281158282048414176104c9576104c96122b4565b600081612303576123036122b4565b50600019019056fea26469706673582212208ef2b921e1446238c412e70eb4544aa598b50f6dd6a3ae4ca6d9074e0b49ee7a64736f6c63430008140033

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

000000000000000000000000c21e4ebd1d92036cb467b53fe3258f219d909eb90000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000a5c38cc01d74e5c70d23315df92f07756bee97a10000000000000000000000005227a79495c7c644d76ddb8595366bca1cf921380000000000000000000000005adda1c1ce78e4c38f51a395de79fbc978dc841d000000000000000000000000e6eb33b804958b9bbfafa879090941031f65c681000000000000000000000000f963ac3b6a7ae3e39b1c5e8699fb504c2ffa38890000000000000000000000006470acc20ddf92967fdcac2d669c799cb273f9b60000000000000000000000001b46ad69d8d48cb11b2a1971f6340d6da46d2e2b000000000000000000000000389a0ac03b1fb2e568013290135acb0834e80ac3000000000000000000000000b7298ec182a7a1c18b41f8695e77c9ef8e77eb9a0000000000000000000000005f9f73f07c28b2a7eeb0bf2346b5af59261426820000000000000000000000008f892abc9203357c9ecb4b2c3ec49907fff52260000000000000000000000000e89808045e80f190af23ebe293473ba8dd6691cf000000000000000000000000fd33ef249931b215abdeae7b8275d967cef61d2e000000000000000000000000aa066dd34dde56cf0765f4045939c6c312a96bed

-----Decoded View---------------
Arg [0] : _assetForwarder (address): 0xC21e4ebD1d92036Cb467b53fE3258F219d909Eb9
Arg [1] : _dexspan (address): 0x6A0fD5577c540e16A3A49C40b51E0880a2a528ce
Arg [2] : _wnative (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [3] : _whitelistedAdapters (address[]): 0xA5c38cC01d74E5c70D23315df92f07756bee97a1,0x5227a79495c7C644d76ddB8595366bcA1Cf92138,0x5AddA1c1CE78E4c38F51A395de79fBC978dc841D,0xE6EB33B804958B9BbFAFA879090941031F65c681,0xf963Ac3b6A7Ae3e39B1C5E8699fb504C2ffa3889,0x6470ACC20DdF92967fDcAc2D669c799cB273f9b6,0x1b46ad69d8d48cB11B2A1971f6340D6Da46d2e2b,0x389A0AC03b1fb2e568013290135acb0834e80Ac3,0xB7298eC182a7A1c18B41f8695E77c9eF8e77Eb9a,0x5f9F73f07c28b2A7EeB0Bf2346b5aF5926142682,0x8f892Abc9203357C9ECB4B2c3eC49907fff52260,0xE89808045e80F190aF23ebe293473bA8Dd6691Cf,0xFd33Ef249931b215aBDEae7b8275D967CeF61D2e,0xaa066dd34dDE56cF0765f4045939c6c312A96beD

-----Encoded View---------------
19 Constructor Arguments found :
Arg [0] : 000000000000000000000000c21e4ebd1d92036cb467b53fe3258f219d909eb9
Arg [1] : 0000000000000000000000006a0fd5577c540e16a3a49c40b51e0880a2a528ce
Arg [2] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [5] : 000000000000000000000000a5c38cc01d74e5c70d23315df92f07756bee97a1
Arg [6] : 0000000000000000000000005227a79495c7c644d76ddb8595366bca1cf92138
Arg [7] : 0000000000000000000000005adda1c1ce78e4c38f51a395de79fbc978dc841d
Arg [8] : 000000000000000000000000e6eb33b804958b9bbfafa879090941031f65c681
Arg [9] : 000000000000000000000000f963ac3b6a7ae3e39b1c5e8699fb504c2ffa3889
Arg [10] : 0000000000000000000000006470acc20ddf92967fdcac2d669c799cb273f9b6
Arg [11] : 0000000000000000000000001b46ad69d8d48cb11b2a1971f6340d6da46d2e2b
Arg [12] : 000000000000000000000000389a0ac03b1fb2e568013290135acb0834e80ac3
Arg [13] : 000000000000000000000000b7298ec182a7a1c18b41f8695e77c9ef8e77eb9a
Arg [14] : 0000000000000000000000005f9f73f07c28b2a7eeb0bf2346b5af5926142682
Arg [15] : 0000000000000000000000008f892abc9203357c9ecb4b2c3ec49907fff52260
Arg [16] : 000000000000000000000000e89808045e80f190af23ebe293473ba8dd6691cf
Arg [17] : 000000000000000000000000fd33ef249931b215abdeae7b8275d967cef61d2e
Arg [18] : 000000000000000000000000aa066dd34dde56cf0765f4045939c6c312a96bed


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]
[ 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.