Contract 0xDF3eCD77894De650e07582B4A30A892B9Bd95895

Contract Overview

Balance:
0 MATIC
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xcb728424b157267830b6037244bf31ca0e2fa785497c68e9f3db67be4d4aef590x60806040239130182022-01-15 12:58:2013 days 5 hrs ago0x33bcde3da095c1d2681f3167e5696bf5b7d4f321 IN  Create: ERC20HandlerUpgradeable0 MATIC0.007187782 2
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC20HandlerUpgradeable

Compiler Version
v0.8.2+commit.661d1103

Optimization Enabled:
Yes with 125 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 18 : ERC20HandlerUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2;

import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol";

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "../interfaces/IDepositExecute.sol";
import "../interfaces/ILiquidityPool.sol";
import "../interfaces/IOneSplitWrap.sol";
import "../interfaces/IWETH.sol";

import "./HandlerHelpersUpgradeable.sol";

/**
    @title Handles ERC20 deposits and deposit executions.
    @author Router Protocol.
    @notice This contract is intended to be used with the Bridge contract.
 */
contract ERC20HandlerUpgradeable is
    Initializable,
    ContextUpgradeable,
    IDepositExecute,
    HandlerHelpersUpgradeable,
    ILiquidityPool
{
    using SafeMathUpgradeable for uint256;

    struct DepositRecord {
        uint8 _destinationChainID;
        address _srcTokenAddress;
        address _stableTokenAddress;
        uint256 _stableTokenAmount;
        address _destStableTokenAddress;
        uint256 _destStableTokenAmount;
        address _destinationTokenAdress;
        uint256 _destinationTokenAmount;
        bytes32 _resourceID;
        address _destinationRecipientAddress;
        address _depositer;
        uint256 _srcTokenAmount;
        address _feeTokenAddress;
        uint256 _feeAmount;
        uint256 _isDestNative;
    }

    // destId => depositNonce => Deposit Record
    mapping(uint8 => mapping(uint64 => DepositRecord)) private _depositRecords;

    function __ERC20HandlerUpgradeable_init(
        address bridgeAddress,
        address ETH,
        address WETH,
        bytes32[] memory initialResourceIDs,
        address[] memory initialContractAddresses,
        address[] memory burnableContractAddresses
    ) internal initializer {
        __Context_init_unchained();
        __HandlerHelpersUpgradeable_init();

        require(
            initialResourceIDs.length == initialContractAddresses.length,
            "initialResourceIDs & initialContractAddresses len mismatch"
        );

        _bridgeAddress = bridgeAddress;
        _ETH = ETH;
        _WETH = WETH;

        uint256 initialResourceCount = initialResourceIDs.length;
        for (uint256 i = 0; i < initialResourceCount; i++) {
            _setResource(initialResourceIDs[i], initialContractAddresses[i]);
        }

        uint256 burnableCount = burnableContractAddresses.length;
        for (uint256 i = 0; i < burnableCount; i++) {
            _setBurnable(burnableContractAddresses[i]);
        }
    }

    function __ERC20HandlerUpgradeable_init_unchained() internal initializer {}

    /**
        @param bridgeAddress Contract address of previously deployed Bridge.
        // Resource IDs are used to identify a specific contract address.
        // These are the Resource IDs this contract will initially support.
        // These are the addresses the {initialResourceIDs} will point to,
        // and are the contracts that will be called to perform various deposit calls.
        @param burnableContractAddresses These addresses will be set as burnable and when {deposit} is called,
        the deposited token will be burned.
        When {executeProposal} is called, new tokens will be minted.

        @dev {initialResourceIDs} and {initialContractAddresses} must have the same length
        (one resourceID for every address).
        Also, these arrays must be ordered in the way that {initialResourceIDs}[0] is the
        intended resourceID for {initialContractAddresses}[0].
     */
    function initialize(
        address bridgeAddress,
        address ETH,
        address WETH,
        bytes32[] memory initialResourceIDs,
        address[] memory initialContractAddresses,
        address[] memory burnableContractAddresses
    ) external initializer {
        __ERC20HandlerUpgradeable_init(
            bridgeAddress,
            ETH,
            WETH,
            initialResourceIDs,
            initialContractAddresses,
            burnableContractAddresses
        );
    }

    receive() external payable {}

    /**
        @param depositNonce This ID will have been generated by the Bridge contract.
        @param destId ID of chain deposit will be bridged to.
        @return DepositRecord
    */
    function getDepositRecord(uint64 depositNonce, uint8 destId) public view virtual returns (DepositRecord memory) {
        return _depositRecords[destId][depositNonce];
    }

    function setReserve(IHandlerReserve reserve) external onlyRole(DEFAULT_ADMIN_ROLE) {
        _reserve = reserve;
    }

    /**
        @notice A deposit is initiatied by making a deposit in the Bridge contract.
        @param destinationChainID Chain ID of chain tokens are expected to be bridged to.
        @param depositNonce This value is generated as an ID by the Bridge contract.
        @dev Depending if the corresponding {tokenAddress} for the parsed {resourceID} is
        marked true in {_burnList}, deposited tokens will be burned, if not, they will be locked.
     */
    function deposit(
        bytes32 resourceID,
        uint8 destinationChainID,
        uint64 depositNonce,
        SwapInfo memory swapDetails
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        uint256 feeAmount;
        swapDetails.srcStableTokenAddress = _resourceIDToTokenContractAddress[resourceID];
        require(_contractWhitelist[swapDetails.srcStableTokenAddress], "provided tokenAddress is not whitelisted");

        if (address(swapDetails.srcTokenAddress) == swapDetails.srcStableTokenAddress) {
            if (swapDetails.feeTokenAddress == address(0)) {
                swapDetails.feeTokenAddress = swapDetails.srcStableTokenAddress;
            }
            (uint256 transferFee, ) = getBridgeFee(destinationChainID, swapDetails.feeTokenAddress);
            feeAmount = transferFee;
            // Fees of stable token address
            _reserve.deductFee(
                swapDetails.feeTokenAddress,
                swapDetails.depositer,
                // swapDetails.providedFee,
                transferFee,
                // _ETH,
                _isFeeEnabled,
                address(feeManager)
            );
            // just deposit
            handleDepositForReserveToken(swapDetails);
        } else if (_reserve._contractToLP(swapDetails.srcStableTokenAddress) == address(swapDetails.srcTokenAddress)) {
            deductFeeAndHandleDepositForLPToken(swapDetails, destinationChainID);
        } else {
            if (swapDetails.feeTokenAddress != address(0)) {
                (, uint256 exchangeFee) = getBridgeFee(destinationChainID, swapDetails.feeTokenAddress);
                feeAmount = exchangeFee;
                // Fees of stable token address

                _reserve.deductFee(
                    swapDetails.feeTokenAddress,
                    swapDetails.depositer,
                    // swapDetails.providedFee,
                    exchangeFee,
                    // _ETH,
                    _isFeeEnabled,
                    address(feeManager)
                );
            }

            _reserve.lockERC20(
                address(swapDetails.srcTokenAddress),
                swapDetails.depositer,
                _oneSplitAddress,
                swapDetails.srcTokenAmount
            );
            handleDepositForNonReserveToken(swapDetails);
            if (swapDetails.feeTokenAddress == address(0)) {
                (, uint256 exchangeFee) = getBridgeFee(destinationChainID, swapDetails.srcStableTokenAddress);
                feeAmount = exchangeFee;
                swapDetails.feeTokenAddress = swapDetails.srcStableTokenAddress;
                require(
                    swapDetails.srcStableTokenAmount >= exchangeFee,
                    "ERC20handler : provided fee is less than the amount"
                );
                swapDetails.srcStableTokenAmount = swapDetails.srcStableTokenAmount - exchangeFee;
                _reserve.releaseERC20(swapDetails.feeTokenAddress, address(feeManager), exchangeFee);
                if (_burnList[address(swapDetails.srcStableTokenAddress)]) {
                    _reserve.burnERC20(
                        address(swapDetails.srcStableTokenAddress),
                        address(_reserve),
                        swapDetails.srcStableTokenAmount
                    );
                }
            }
        }

        _depositRecords[destinationChainID][depositNonce] = DepositRecord(
            destinationChainID,
            address(swapDetails.srcTokenAddress),
            swapDetails.srcStableTokenAddress,
            swapDetails.srcStableTokenAmount,
            address(swapDetails.destStableTokenAddress),
            swapDetails.srcStableTokenAmount,
            address(swapDetails.destTokenAddress),
            swapDetails.destTokenAmount,
            resourceID,
            swapDetails.recipient,
            swapDetails.depositer,
            swapDetails.srcTokenAmount,
            swapDetails.feeTokenAddress,
            feeAmount,
            swapDetails.isDestNative ? 1 : 0
        );
    }

    /**
        @notice Proposal execution should be initiated when a proposal is finalized in the Bridge contract.
        by a relayer on the deposit's destination chain.
        @notice Data passed into the function should be constructed as follows:
        amount                                 uint256     bytes  0 - 32
        destinationRecipientAddress length     uint256     bytes  32 - 64
        destinationRecipientAddress            bytes       bytes  64 - END
     */
    function executeProposal(SwapInfo memory swapDetails, bytes32 resourceID)
        public
        virtual
        override
        onlyRole(BRIDGE_ROLE)
        returns (address settlementToken, uint256 settlementAmount)
    {
        swapDetails.destStableTokenAddress = _resourceIDToTokenContractAddress[resourceID];
        require(_contractWhitelist[swapDetails.destStableTokenAddress], "provided tokenAddress is not whitelisted");

        if (address(swapDetails.destTokenAddress) == swapDetails.destStableTokenAddress) {
            // just release destStable tokens
            (settlementToken, settlementAmount) = handleExecuteForReserveToken(swapDetails);
        } else if (
            _reserve._contractToLP(swapDetails.destStableTokenAddress) == address(swapDetails.destTokenAddress)
        ) {
            // release LP is destToken is LP of destStableToken
            handleExecuteForLPToken(swapDetails);
            settlementToken = address(swapDetails.destTokenAddress);
            settlementAmount = swapDetails.destStableTokenAmount;
        } else {
            // exchange destStable to destToken and release tokens
            (settlementToken, settlementAmount) = handleExecuteForNonReserveToken(swapDetails);
        }
    }

    /**
        @notice Used to manually release ERC20 tokens from ERC20Safe.
        @param tokenAddress Address of token contract to release.
        @param recipient Address to release tokens to.
        @param amount The amount of ERC20 tokens to release.
     */
    function withdraw(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        _reserve.releaseERC20(tokenAddress, recipient, amount);
    }

    /**
        @notice Used to manually release ERC20 tokens from FeeManager.
        @param tokenAddress Address of token contract to release.
        @param recipient Address to release tokens to.
        @param amount The amount of ERC20 tokens to release.
     */
    function withdrawFees(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        feeManager.withdrawFee(tokenAddress, recipient, amount);
    }

    function stake(
        address depositor,
        address tokenAddress,
        uint256 amount
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        _reserve.stake(depositor, tokenAddress, amount);
    }

    function stakeETH(
        address depositor,
        address tokenAddress,
        uint256 amount
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        assert(IWETH(_WETH).transfer(address(_reserve), amount));
        _reserve.stakeETH(depositor, tokenAddress, amount);
    }

    /**
        @notice Staking should be done by using bridge contract.
        @param unstaker removes liquidity from the pool.
        @param tokenAddress staking token of which liquidity needs to be removed.
        @param amount Amount that needs to be unstaked.
     */

    function unstake(
        address unstaker,
        address tokenAddress,
        uint256 amount
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        _reserve.unstake(unstaker, tokenAddress, amount);
    }

    function unstakeETH(
        address unstaker,
        address tokenAddress,
        uint256 amount
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        _reserve.unstakeETH(unstaker, tokenAddress, amount, _WETH);
    }

    function getStakedRecord(address account, address tokenAddress) public view virtual returns (uint256) {
        return _reserve.getStakedRecord(account, tokenAddress);
    }

    function handleDepositForReserveToken(SwapInfo memory swapDetails) internal {
        if (_burnList[address(swapDetails.srcTokenAddress)]) {
            _reserve.burnERC20(address(swapDetails.srcTokenAddress), swapDetails.depositer, swapDetails.srcTokenAmount);
        } else {
            _reserve.lockERC20(
                address(swapDetails.srcTokenAddress),
                swapDetails.depositer,
                address(_reserve),
                swapDetails.srcTokenAmount
            );
        }
    }

    function deductFeeAndHandleDepositForLPToken(SwapInfo memory swapDetails, uint8 destinationChainID) internal {
        uint256 feeAmount;
        if (swapDetails.feeTokenAddress == address(0)) {
            swapDetails.feeTokenAddress = address(swapDetails.srcTokenAddress);
        }
        (uint256 transferFee, ) = getBridgeFee(destinationChainID, swapDetails.srcStableTokenAddress);
        feeAmount = transferFee;
        // Fees of stable token address
        _reserve.deductFee(
            swapDetails.feeTokenAddress,
            swapDetails.depositer,
            // swapDetails.providedFee,
            transferFee,
            // _ETH,
            _isFeeEnabled,
            address(feeManager)
        );
        _reserve.burnERC20(address(swapDetails.srcTokenAddress), swapDetails.depositer, swapDetails.srcTokenAmount);
    }

    function handleDepositForNonReserveToken(SwapInfo memory swapDetails) internal {
        if (swapDetails.path.length > 2) {
            //swapMulti
            swapDetails.srcStableTokenAmount = _reserve.swapMulti(
                _oneSplitAddress,
                swapDetails.path,
                swapDetails.srcTokenAmount,
                swapDetails.srcStableTokenAmount,
                swapDetails.distribution,
                swapDetails.flags
            );
        } else {
            swapDetails.srcStableTokenAmount = _reserve.swap(
                _oneSplitAddress,
                address(swapDetails.srcTokenAddress),
                swapDetails.srcStableTokenAddress,
                swapDetails.srcTokenAmount,
                swapDetails.srcStableTokenAmount,
                swapDetails.distribution,
                swapDetails.flags[0]
            );
        }
    }

    function handleExecuteForReserveToken(SwapInfo memory swapDetails) internal returns (address, uint256) {
        if (_burnList[address(swapDetails.destTokenAddress)]) {
            _reserve.mintERC20(
                address(swapDetails.destTokenAddress),
                swapDetails.recipient,
                swapDetails.destStableTokenAmount
            );
        } else {
            uint256 reserveBalance = IERC20(address(swapDetails.destStableTokenAddress)).balanceOf(address(_reserve));
            if (reserveBalance < swapDetails.destStableTokenAmount) {
                _reserve.mintWrappedERC20(
                    address(swapDetails.destStableTokenAddress),
                    swapDetails.recipient,
                    swapDetails.destStableTokenAmount
                );
                return (
                    _reserve._contractToLP(address(swapDetails.destStableTokenAddress)),
                    swapDetails.destStableTokenAmount
                );
            } else {
                if (address(swapDetails.destStableTokenAddress) == _WETH && swapDetails.isDestNative) {
                    _reserve.withdrawWETH(_WETH, swapDetails.destStableTokenAmount);
                    _reserve.safeTransferETH(swapDetails.recipient, swapDetails.destStableTokenAmount);
                } else {
                    _reserve.releaseERC20(
                        address(swapDetails.destStableTokenAddress),
                        swapDetails.recipient,
                        swapDetails.destStableTokenAmount
                    );
                }
            }
        }
        return (address(swapDetails.destStableTokenAddress), swapDetails.destStableTokenAmount);
    }

    function handleExecuteForLPToken(SwapInfo memory swapDetails) internal {
        _reserve.mintWrappedERC20(
            address(swapDetails.destStableTokenAddress),
            swapDetails.recipient,
            swapDetails.destStableTokenAmount
        );
    }

    function handleExecuteForNonReserveToken(SwapInfo memory swapDetails) internal returns (address, uint256) {
        if (_burnList[swapDetails.destStableTokenAddress]) {
            _reserve.mintERC20(swapDetails.destStableTokenAddress, _oneSplitAddress, swapDetails.destStableTokenAmount);
        } else {
            uint256 reserveBalance = IERC20(address(swapDetails.destStableTokenAddress)).balanceOf(address(_reserve));
            if (reserveBalance < swapDetails.destStableTokenAmount) {
                _reserve.mintWrappedERC20(
                    address(swapDetails.destStableTokenAddress),
                    swapDetails.recipient,
                    swapDetails.destStableTokenAmount
                );
                return (
                    _reserve._contractToLP(address(swapDetails.destStableTokenAddress)),
                    swapDetails.destStableTokenAmount
                );
            } else {
                _reserve.releaseERC20(
                    swapDetails.destStableTokenAddress,
                    _oneSplitAddress,
                    swapDetails.destStableTokenAmount
                );
            }
        }
        if (swapDetails.path.length > 2) {
            //solhint-disable avoid-low-level-calls
            (bool success, bytes memory returnData) = address(_reserve).call(
                abi.encodeWithSelector(
                    0x8da61307, // swapMulti(address,address[],uint256,uint256,uint256[],uint256[])
                    _oneSplitAddress,
                    swapDetails.path,
                    swapDetails.destStableTokenAmount,
                    swapDetails.destTokenAmount,
                    swapDetails.distribution,
                    swapDetails.flags
                )
            );
            if (success) {
                swapDetails.returnAmount = abi.decode(returnData, (uint256));
            } else {
                require(
                    IOneSplitWrap(_oneSplitAddress).withdraw(
                        swapDetails.destStableTokenAddress,
                        swapDetails.recipient,
                        swapDetails.destStableTokenAmount
                    )
                );
                return (address(swapDetails.destStableTokenAddress), swapDetails.destStableTokenAmount);
            }
        } else {
            (bool success, bytes memory returnData) = address(_reserve).call(
                abi.encodeWithSelector(
                    0x951db637, // swap(address,address,address,uint256,uint256,uint256[],uint256)
                    _oneSplitAddress,
                    swapDetails.destStableTokenAddress,
                    address(swapDetails.destTokenAddress),
                    swapDetails.destStableTokenAmount,
                    swapDetails.destTokenAmount,
                    swapDetails.distribution,
                    swapDetails.flags[0]
                )
            );
            if (success) {
                swapDetails.returnAmount = abi.decode(returnData, (uint256));
            } else {
                require(
                    IOneSplitWrap(_oneSplitAddress).withdraw(
                        swapDetails.destStableTokenAddress,
                        swapDetails.recipient,
                        swapDetails.destStableTokenAmount
                    )
                );
                return (address(swapDetails.destStableTokenAddress), swapDetails.destStableTokenAmount);
            }
        }
        if (address(swapDetails.destTokenAddress) == _WETH && swapDetails.isDestNative) {
            _reserve.withdrawWETH(_WETH, swapDetails.returnAmount);
            _reserve.safeTransferETH(swapDetails.recipient, swapDetails.returnAmount);
        } else {
            _reserve.releaseERC20(
                address(swapDetails.destTokenAddress),
                swapDetails.recipient,
                swapDetails.returnAmount
            );
        }
        return (address(swapDetails.destTokenAddress), swapDetails.returnAmount);
    }
}

File 2 of 18 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

File 3 of 18 : Initializable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 */
abstract contract Initializable {
    /**
     * @dev Indicates that the contract has been initialized.
     */
    bool private _initialized;

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

    /**
     * @dev Modifier to protect an initializer function from being invoked twice.
     */
    modifier initializer() {
        require(_initializing || !_initialized, "Initializable: contract is already initialized");

        bool isTopLevelCall = !_initializing;
        if (isTopLevelCall) {
            _initializing = true;
            _initialized = true;
        }

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }
}

File 4 of 18 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT

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

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

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

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
    uint256[50] private __gap;
}

File 5 of 18 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

File 6 of 18 : IDepositExecute.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

/**
    @title Interface for handler contracts that support deposits and deposit executions.
    @author Router Protocol.
 */
interface IDepositExecute {
    struct SwapInfo {
        address feeTokenAddress;
        uint64 depositNonce;
        uint256 index;
        uint256 returnAmount;
        address recipient;
        address stableTokenAddress;
        address handler;
        uint256 srcTokenAmount;
        uint256 srcStableTokenAmount;
        uint256 destStableTokenAmount;
        uint256 destTokenAmount;
        uint256 lenRecipientAddress;
        uint256 lenSrcTokenAddress;
        uint256 lenDestTokenAddress;
        bytes20 srcTokenAddress;
        address srcStableTokenAddress;
        bytes20 destTokenAddress;
        address destStableTokenAddress;
        uint256[] distribution;
        uint256[] flags;
        address[] path;
        address depositer;
        bool isDestNative;
    }

    /**
        @notice It is intended that deposit are made using the Bridge contract.
        @param destinationChainID Chain ID deposit is expected to be bridged to.
        @param depositNonce This value is generated as an ID by the Bridge contract.
        @param swapDetails Swap details

     */
    function deposit(
        bytes32 resourceID,
        uint8 destinationChainID,
        uint64 depositNonce,
        SwapInfo calldata swapDetails
    ) external;

    /**
        @notice It is intended that proposals are executed by the Bridge contract.
     */
    function executeProposal(SwapInfo calldata swapDetails, bytes32 resourceID) external returns (address, uint256);
}

File 7 of 18 : ILiquidityPool.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2;

/**
    @title Interface for handler contracts that support deposits and deposit executions.
    @author Router Protocol.
 */
interface ILiquidityPool {
    /**
        @notice Staking should be done by using bridge contract.
        @param depositor stakes liquidity in the pool .
        @param tokenAddress staking token for which liquidity needs to be added.
        @param amount Amount that needs to be staked.
     */
    function stake(
        address depositor,
        address tokenAddress,
        uint256 amount
    ) external;

    /**
        @notice Staking should be done by using bridge contract.
        @param depositor stakes liquidity in the pool .
        @param tokenAddress staking token for which liquidity needs to be added.
        @param amount Amount that needs to be staked.
     */
    function stakeETH(
        address depositor,
        address tokenAddress,
        uint256 amount
    ) external;

    /**
        @notice Staking should be done by using bridge contract.
        @param unstaker removes liquidity from the pool.
        @param tokenAddress staking token of which liquidity needs to be removed.
        @param amount Amount that needs to be unstaked.
     */
    function unstake(
        address unstaker,
        address tokenAddress,
        uint256 amount
    ) external;

    /**
        @notice Staking should be done by using bridge contract.
        @param unstaker removes liquidity from the pool.
        @param tokenAddress staking token of which liquidity needs to be removed.
        @param amount Amount that needs to be unstaked.
     */
    function unstakeETH(
        address unstaker,
        address tokenAddress,
        uint256 amount
    ) external;
}

File 8 of 18 : IOneSplitWrap.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2;

interface IOneSplitWrap {
    function withdraw(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) external returns (bool);

    function getExpectedReturn(
        address fromToken,
        address destToken,
        uint256 amount,
        uint256 parts,
        uint256 flags
    ) external view returns (uint256 returnAmount, uint256[] memory distribution);

    function getExpectedReturnWithGas(
        address fromToken,
        address destToken,
        uint256 amount,
        uint256 parts,
        uint256 flags,
        uint256 destTokenEthPriceTimesGasPrice
    )
        external
        view
        returns (
            uint256 returnAmount,
            uint256 estimateGasAmount,
            uint256[] memory distribution
        );

    function getExpectedReturnWithGasMulti(
        address[] memory tokens,
        uint256 amount,
        uint256[] memory parts,
        uint256[] memory flags,
        uint256[] memory destTokenEthPriceTimesGasPrices
    )
        external
        view
        returns (
            uint256[] memory returnAmounts,
            uint256 estimateGasAmount,
            uint256[] memory distribution
        );

    function swap(
        address fromToken,
        address destToken,
        uint256 amount,
        uint256 minReturn,
        uint256[] memory distribution,
        uint256 flags,
        bool isWrapper
    ) external payable returns (uint256 returnAmount);

    function swapMulti(
        address[] memory tokens,
        uint256 amount,
        uint256 minReturn,
        uint256[] memory distribution,
        uint256[] memory flags,
        bool isWrapper
    ) external payable returns (uint256 returnAmount);
}

File 9 of 18 : IWETH.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2;

interface IWETH {
    function deposit() external payable;

    function transfer(address to, uint256 value) external returns (bool);

    function withdraw(uint256) external;

    function transferFrom(
        address src,
        address dst,
        uint256 wad
    ) external returns (bool);

    function approve(address guy, uint256 wad) external returns (bool);
}

File 10 of 18 : HandlerHelpersUpgradeable.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";

import "../interfaces/IERCHandler.sol";
import "../interfaces/IFeeManager.sol";
import "../interfaces/IHandlerReserve.sol";

/**
    @title Function used across handler contracts.
    @author Router Protocol.
    @notice This contract is intended to be used with the Bridge contract.
 */
contract HandlerHelpersUpgradeable is Initializable, ContextUpgradeable, AccessControlUpgradeable, IERCHandler {
    address public _bridgeAddress;
    address public _oneSplitAddress;
    address public override _ETH;
    address public override _WETH;
    bool public _isFeeEnabled;
    uint256 public totalFeeSetters;
    bytes32 public constant BRIDGE_ROLE = keccak256("BRIDGE_ROLE");

    IFeeManagerUpgradeable public feeManager;
    IHandlerReserve public _reserve;

    // resourceID => token contract address
    mapping(bytes32 => address) internal _resourceIDToTokenContractAddress;

    // token contract address => resourceID
    mapping(address => bytes32) public _tokenContractAddressToResourceID;

    // token contract address => is whitelisted
    mapping(address => bool) public _contractWhitelist;

    // token contract address => is burnable
    mapping(address => bool) public _burnList;

    // bytes32 public constant FEE_SETTER_ROLE = keccak256("FEE_SETTER_ROLE");

    function __HandlerHelpersUpgradeable_init() internal initializer {
        __Context_init_unchained();
        __AccessControl_init();

        _setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _setupRole(BRIDGE_ROLE, _msgSender());
        _isFeeEnabled = false;
    }

    function __HandlerHelpersUpgradeable_init_unchained() internal initializer {}

    function getTotalFeeSetters() public view override returns (uint256) {
        return totalFeeSetters;
    }

    // function grantFeeRole(address account) public virtual override onlyRole(BRIDGE_ROLE) {
    //     grantRole(FEE_SETTER_ROLE, account);
    //     totalFeeSetters = totalFeeSetters + 1;
    // }

    // function revokeFeeRole(address account) public virtual override onlyRole(BRIDGE_ROLE) {
    //     revokeRole(FEE_SETTER_ROLE, account);
    //     totalFeeSetters = totalFeeSetters - 1;
    // }

    function setFeeManager(IFeeManagerUpgradeable _feeManager) public onlyRole(DEFAULT_ADMIN_ROLE) {
        feeManager = _feeManager;
    }

    function getBridgeFee(uint8 destinationChainID, address feeTokenAddress)
        public
        view
        virtual
        override
        returns (uint256, uint256)
    {
        return feeManager.getFee(destinationChainID, feeTokenAddress);
    }

    function setBridgeFee(
        uint8 destinationChainID,
        address feeTokenAddress,
        uint256 transferFee,
        uint256 exchangeFee,
        bool accepted
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        feeManager.setFee(destinationChainID, feeTokenAddress, transferFee, exchangeFee, accepted);
    }

    function toggleFeeStatus(bool status) public virtual override onlyRole(BRIDGE_ROLE) {
        _isFeeEnabled = status;
    }

    function getFeeStatus() public view virtual override returns (bool) {
        return _isFeeEnabled;
    }

    function resourceIDToTokenContractAddress(bytes32 resourceID) public view virtual override returns (address) {
        return _resourceIDToTokenContractAddress[resourceID];
    }

    /**
        @notice First verifies {_resourceIDToContractAddress}[{resourceID}] and
        {_contractAddressToResourceID}[{contractAddress}] are not already set,
        then sets {_resourceIDToContractAddress} with {contractAddress},
        {_contractAddressToResourceID} with {resourceID},
        and {_contractWhitelist} to true for {contractAddress}.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function setResource(bytes32 resourceID, address contractAddress) public virtual override onlyRole(BRIDGE_ROLE) {
        _setResource(resourceID, contractAddress);
    }

    /**
        @notice First verifies {contractAddress} is whitelisted, then sets {_burnList}[{contractAddress}]
        to true.
        @param contractAddress Address of contract to be used when making or executing deposits.
     */
    function setBurnable(address contractAddress) public virtual override onlyRole(BRIDGE_ROLE) {
        _setBurnable(contractAddress);
    }

    /**
        @notice Used to manually release funds from ERC safes.
        @param tokenAddress Address of token contract to release.
        @param recipient Address to release tokens to.
        @param amount the amount of ERC20 tokens to release.
     */
    function withdraw(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) public virtual override {}

    function withdrawFees(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) public virtual override {}

    /**
        @notice Sets oneSplitAddress for the handler
        @param contractAddress Address of oneSplit contract
     */
    function setOneSplitAddress(address contractAddress) public virtual override onlyRole(BRIDGE_ROLE) {
        _setOneSplitAddress(contractAddress);
    }

    /**
        @notice Sets liquidity pool for given ERC20 address. These pools will be used to
        stake and unstake liqudity.
        @param contractAddress Address of contract for which LP contract should be created.
     */
    function setLiquidityPool(
        string memory name,
        string memory symbol,
        uint8 decimals,
        address contractAddress,
        address lpAddress
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        address newLPAddress = _reserve._setLiquidityPool(name, symbol, decimals, contractAddress, lpAddress);
        _contractWhitelist[contractAddress] = true;
        _setBurnable(newLPAddress);
    }

    function setLiquidityPoolOwner(
        address newOwner,
        address tokenAddress,
        address lpAddress
    ) public virtual override onlyRole(BRIDGE_ROLE) {
        _reserve._setLiquidityPoolOwner(newOwner, tokenAddress, lpAddress);
    }

    function _setResource(bytes32 resourceID, address contractAddress) internal virtual {
        require(contractAddress != address(0), "contract address can't be zero");
        _resourceIDToTokenContractAddress[resourceID] = contractAddress;
        _tokenContractAddressToResourceID[contractAddress] = resourceID;
        _contractWhitelist[contractAddress] = true;
    }

    function _setBurnable(address contractAddress) internal virtual {
        require(_contractWhitelist[contractAddress], "provided contract is not whitelisted");
        _burnList[contractAddress] = true;
    }

    function _setOneSplitAddress(address contractAddress) internal virtual {
        require(contractAddress != address(0), "ERC20Handler: contractAddress cannot be null");
        _oneSplitAddress = address(contractAddress);
    }
}

File 11 of 18 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    function __AccessControl_init_unchained() internal initializer {
    }
    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, _msgSender());
        _;
    }

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

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

    /**
     * @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 {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        StringsUpgradeable.toHexString(uint160(account), 20),
                        " is missing role ",
                        StringsUpgradeable.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view 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.
     */
    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.
     */
    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 granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    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.
     *
     * [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}.
     * ====
     */
    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);
    }

    function _grantRole(bytes32 role, address account) private {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    function _revokeRole(bytes32 role, address account) private {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
    uint256[49] private __gap;
}

File 12 of 18 : IERCHandler.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.2;

/**
    @title Interface to be used with handlers that support ERC20s and ERC721s.
    @author Router Protocol.
 */
interface IERCHandler {
    function getTotalFeeSetters() external view returns (uint256);

    // function grantFeeRole(address account) external;

    // function revokeFeeRole(address account) external;
    function withdrawFees(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) external;

    function getBridgeFee(uint8 destinationChainID, address feeTokenAddress) external view returns (uint256, uint256);

    function setBridgeFee(
        uint8 destinationChainID,
        address feeTokenAddress,
        uint256 transferFee,
        uint256 exchangeFee,
        bool accepted
    ) external;

    function toggleFeeStatus(bool status) external;

    function getFeeStatus() external view returns (bool);

    function _ETH() external view returns (address);

    function _WETH() external view returns (address);

    function resourceIDToTokenContractAddress(bytes32 resourceID) external view returns (address);

    /**
        @notice Correlates {resourceID} with {contractAddress}.
        @param resourceID ResourceID to be used when making deposits.
        @param contractAddress Address of contract to be called when a deposit is made and a deposited is executed.
     */
    function setResource(bytes32 resourceID, address contractAddress) external;

    /**
        @notice Sets oneSplitAddress for the handler
        @param contractAddress Address of oneSplit contract
     */
    function setOneSplitAddress(address contractAddress) external;

    /**
        @notice Correlates {resourceID} with {contractAddress}.
        @param contractAddress Address of contract for qhich liquidity pool needs to be created.
     */
    function setLiquidityPool(
        string memory name,
        string memory symbol,
        uint8 decimals,
        address contractAddress,
        address lpAddress
    ) external;

    function setLiquidityPoolOwner(
        address newOwner,
        address tokenAddress,
        address lpAddress
    ) external;

    /**
        @notice Marks {contractAddress} as mintable/burnable.
        @param contractAddress Address of contract to be used when making or executing deposits.
     */
    function setBurnable(address contractAddress) external;

    /**
        @notice Used to manually release funds from ERC safes.
        @param tokenAddress Address of token contract to release.
        @param recipient Address to release tokens to.
        @param amountOrTokenID Either the amount of ERC20 tokens or the ERC721 token ID to release.
     */
    function withdraw(
        address tokenAddress,
        address recipient,
        uint256 amountOrTokenID
    ) external;
}

File 13 of 18 : IFeeManager.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2;

interface IFeeManagerUpgradeable {
    function setFees(
        uint8 destinationChainID,
        address[] calldata feeTokenAddrs,
        uint256[] calldata transferFees,
        uint256[] calldata exchangeFees,
        bool[] calldata accepted
    ) external;

    function withdrawFee(address tokenAddress, address recipient, uint256 amount) external;
    function setFee(
        uint8 destinationChainID,
        address feeTokenAddress,
        uint256 transferFee,
        uint256 exchangeFee,
        bool accepted
    ) external;

    function getFee(uint8 destinationChainID, address feeTokenAddress) external view returns (uint256, uint256);
}

File 14 of 18 : IHandlerReserve.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.2;

interface IHandlerReserve {
    function fundERC20(
        address tokenAddress,
        address owner,
        uint256 amount
    ) external;

    function lockERC20(
        address tokenAddress,
        address owner,
        address recipient,
        uint256 amount
    ) external;

    function releaseERC20(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) external;

    function mintERC20(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) external;

    function burnERC20(
        address tokenAddress,
        address owner,
        uint256 amount
    ) external;

    function safeTransferETH(address to, uint256 value) external;

    function deductFee(
        address feeTokenAddress,
        address depositor,
        // uint256 providedFee,
        uint256 requiredFee,
        // address _ETH,
        bool _isFeeEnabled,
        address _feeManager
    ) external;

    function mintWrappedERC20(
        address tokenAddress,
        address recipient,
        uint256 amount
    ) external;

    function stake(
        address depositor,
        address tokenAddress,
        uint256 amount
    ) external;

    function stakeETH(
        address depositor,
        address tokenAddress,
        uint256 amount
    ) external;

    function unstake(
        address unstaker,
        address tokenAddress,
        uint256 amount
    ) external;

    function unstakeETH(
        address unstaker,
        address tokenAddress,
        uint256 amount,
        address WETH
    ) external;

    function getStakedRecord(address account, address tokenAddress) external view returns (uint256);

    function withdrawWETH(address WETH, uint256 amount) external;

    function _setLiquidityPoolOwner(
        address newOwner,
        address tokenAddress,
        address lpAddress
    ) external;

    function _setLiquidityPool(
        string memory name,
        string memory symbol,
        uint8 decimals,
        address contractAddress,
        address lpAddress
    ) external returns (address);

    function swapMulti(
        address oneSplitAddress,
        address[] memory tokens,
        uint256 amount,
        uint256 minReturn,
        uint256[] memory distribution,
        uint256[] memory flags
    ) external returns (uint256 returnAmount);

    function swap(
        address oneSplitAddress,
        address fromToken,
        address destToken,
        uint256 amount,
        uint256 minReturn,
        uint256[] memory distribution,
        uint256 flags
    ) external returns (uint256 returnAmount);

    function feeManager() external returns (address);
    function _lpToContract(address token) external returns (address);
    function _contractToLP(address token) external returns (address);

    
}

File 15 of 18 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 16 of 18 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library StringsUpgradeable {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @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] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 17 of 18 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    function __ERC165_init_unchained() internal initializer {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165Upgradeable).interfaceId;
    }
    uint256[50] private __gap;
}

File 18 of 18 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

Settings
{
  "evmVersion": "berlin",
  "metadata": {
    "bytecodeHash": "none",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 125
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract ABI

[{"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":"BRIDGE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_bridgeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_burnList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_contractWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_isFeeEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_oneSplitAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_reserve","outputs":[{"internalType":"contract IHandlerReserve","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"_tokenContractAddressToResourceID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"uint8","name":"destinationChainID","type":"uint8"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"components":[{"internalType":"address","name":"feeTokenAddress","type":"address"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"stableTokenAddress","type":"address"},{"internalType":"address","name":"handler","type":"address"},{"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"internalType":"uint256","name":"srcStableTokenAmount","type":"uint256"},{"internalType":"uint256","name":"destStableTokenAmount","type":"uint256"},{"internalType":"uint256","name":"destTokenAmount","type":"uint256"},{"internalType":"uint256","name":"lenRecipientAddress","type":"uint256"},{"internalType":"uint256","name":"lenSrcTokenAddress","type":"uint256"},{"internalType":"uint256","name":"lenDestTokenAddress","type":"uint256"},{"internalType":"bytes20","name":"srcTokenAddress","type":"bytes20"},{"internalType":"address","name":"srcStableTokenAddress","type":"address"},{"internalType":"bytes20","name":"destTokenAddress","type":"bytes20"},{"internalType":"address","name":"destStableTokenAddress","type":"address"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"},{"internalType":"uint256[]","name":"flags","type":"uint256[]"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"depositer","type":"address"},{"internalType":"bool","name":"isDestNative","type":"bool"}],"internalType":"struct IDepositExecute.SwapInfo","name":"swapDetails","type":"tuple"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"feeTokenAddress","type":"address"},{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"stableTokenAddress","type":"address"},{"internalType":"address","name":"handler","type":"address"},{"internalType":"uint256","name":"srcTokenAmount","type":"uint256"},{"internalType":"uint256","name":"srcStableTokenAmount","type":"uint256"},{"internalType":"uint256","name":"destStableTokenAmount","type":"uint256"},{"internalType":"uint256","name":"destTokenAmount","type":"uint256"},{"internalType":"uint256","name":"lenRecipientAddress","type":"uint256"},{"internalType":"uint256","name":"lenSrcTokenAddress","type":"uint256"},{"internalType":"uint256","name":"lenDestTokenAddress","type":"uint256"},{"internalType":"bytes20","name":"srcTokenAddress","type":"bytes20"},{"internalType":"address","name":"srcStableTokenAddress","type":"address"},{"internalType":"bytes20","name":"destTokenAddress","type":"bytes20"},{"internalType":"address","name":"destStableTokenAddress","type":"address"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"},{"internalType":"uint256[]","name":"flags","type":"uint256[]"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"address","name":"depositer","type":"address"},{"internalType":"bool","name":"isDestNative","type":"bool"}],"internalType":"struct IDepositExecute.SwapInfo","name":"swapDetails","type":"tuple"},{"internalType":"bytes32","name":"resourceID","type":"bytes32"}],"name":"executeProposal","outputs":[{"internalType":"address","name":"settlementToken","type":"address"},{"internalType":"uint256","name":"settlementAmount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"feeManager","outputs":[{"internalType":"contract IFeeManagerUpgradeable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"destinationChainID","type":"uint8"},{"internalType":"address","name":"feeTokenAddress","type":"address"}],"name":"getBridgeFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"depositNonce","type":"uint64"},{"internalType":"uint8","name":"destId","type":"uint8"}],"name":"getDepositRecord","outputs":[{"components":[{"internalType":"uint8","name":"_destinationChainID","type":"uint8"},{"internalType":"address","name":"_srcTokenAddress","type":"address"},{"internalType":"address","name":"_stableTokenAddress","type":"address"},{"internalType":"uint256","name":"_stableTokenAmount","type":"uint256"},{"internalType":"address","name":"_destStableTokenAddress","type":"address"},{"internalType":"uint256","name":"_destStableTokenAmount","type":"uint256"},{"internalType":"address","name":"_destinationTokenAdress","type":"address"},{"internalType":"uint256","name":"_destinationTokenAmount","type":"uint256"},{"internalType":"bytes32","name":"_resourceID","type":"bytes32"},{"internalType":"address","name":"_destinationRecipientAddress","type":"address"},{"internalType":"address","name":"_depositer","type":"address"},{"internalType":"uint256","name":"_srcTokenAmount","type":"uint256"},{"internalType":"address","name":"_feeTokenAddress","type":"address"},{"internalType":"uint256","name":"_feeAmount","type":"uint256"},{"internalType":"uint256","name":"_isDestNative","type":"uint256"}],"internalType":"struct ERC20HandlerUpgradeable.DepositRecord","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFeeStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"}],"name":"getStakedRecord","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTotalFeeSetters","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"bridgeAddress","type":"address"},{"internalType":"address","name":"ETH","type":"address"},{"internalType":"address","name":"WETH","type":"address"},{"internalType":"bytes32[]","name":"initialResourceIDs","type":"bytes32[]"},{"internalType":"address[]","name":"initialContractAddresses","type":"address[]"},{"internalType":"address[]","name":"burnableContractAddresses","type":"address[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"}],"name":"resourceIDToTokenContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"destinationChainID","type":"uint8"},{"internalType":"address","name":"feeTokenAddress","type":"address"},{"internalType":"uint256","name":"transferFee","type":"uint256"},{"internalType":"uint256","name":"exchangeFee","type":"uint256"},{"internalType":"bool","name":"accepted","type":"bool"}],"name":"setBridgeFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setBurnable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IFeeManagerUpgradeable","name":"_feeManager","type":"address"}],"name":"setFeeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"address","name":"contractAddress","type":"address"},{"internalType":"address","name":"lpAddress","type":"address"}],"name":"setLiquidityPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"lpAddress","type":"address"}],"name":"setLiquidityPoolOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setOneSplitAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IHandlerReserve","name":"reserve","type":"address"}],"name":"setReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"resourceID","type":"bytes32"},{"internalType":"address","name":"contractAddress","type":"address"}],"name":"setResource","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"depositor","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeETH","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":[{"internalType":"bool","name":"status","type":"bool"}],"name":"toggleFeeStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalFeeSetters","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"unstaker","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"unstaker","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstakeETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b5061400f806100206000396000f3fe6080604052600436106102605760003560e01c806391d1485411610144578063d0fb0203116100b6578063d9caed121161007a578063d9caed1214610906578063e0af361614610926578063e55dc4e614610946578063e7c308fd14610966578063eae9befc14610986578063f4e480e1146109a657610267565b8063d0fb020314610865578063d3fad20814610885578063d3ff209d146108a5578063d547741f146108c6578063d755c349146108e657610267565b8063ad527b2111610108578063ad527b2114610627578063b5bfddea14610647578063b8fa373614610669578063ba484c0914610689578063bf6eac2f14610818578063c8ba6c871461083857610267565b806391d148541461057d5780639680504c1461059d5780639cecc80a146105bd5780639e601b31146105dd578063a217fddf1461061257610267565b8063413ab4a8116101dd5780636a70d081116101a15780636a70d0811461048f5780636ac6376b146104bf5780636be1dc2b146104df57806378d92eb0146104ff5780637f79bea81461052d5780637ffb45fa1461055d57610267565b8063413ab4a8146103fa578063472d35b91461041a5780635db99af21461043a57806360829f8a1461045a578063640eb8701461047a57610267565b80632f2ff15d116102245780632f2ff15d1461034e578063318c136e1461036e57806335d0d5dc1461038e57806336568abe146103c45780633b0603ed146103e457610267565b806301ffc9a71461026c57806307b7ed99146102a15780630ab75d3e146102c35780631487001b146102f0578063248a9ca31461031057610267565b3661026757005b600080fd5b34801561027857600080fd5b5061028c61028736600461383c565b6109c6565b60405190151581526020015b60405180910390f35b3480156102ad57600080fd5b506102c16102bc366004613557565b6109ff565b005b3480156102cf57600080fd5b506098546102e3906001600160a01b031681565b6040516102989190613b05565b3480156102fc57600080fd5b506102c161030b3660046139c6565b610a26565b34801561031c57600080fd5b5061034061032b36600461379b565b60009081526065602052604090206001015490565b604051908152602001610298565b34801561035a57600080fd5b506102c16103693660046137b3565b610ac5565b34801561037a57600080fd5b506097546102e3906001600160a01b031681565b34801561039a57600080fd5b506102e36103a936600461379b565b6000908152609e60205260409020546001600160a01b031690565b3480156103d057600080fd5b506102c16103df3660046137b3565b610af0565b3480156103f057600080fd5b50610340609b5481565b34801561040657600080fd5b50609d546102e3906001600160a01b031681565b34801561042657600080fd5b506102c1610435366004613557565b610b6f565b34801561044657600080fd5b506099546102e3906001600160a01b031681565b34801561046657600080fd5b506102c1610475366004613723565b610b9e565b34801561048657600080fd5b50609b54610340565b34801561049b57600080fd5b5061028c6104aa366004613557565b60a16020526000908152604090205460ff1681565b3480156104cb57600080fd5b506102c16104da3660046137d7565b610c23565b3480156104eb57600080fd5b506102c16104fa366004613763565b611350565b34801561050b57600080fd5b5061051f61051a3660046138fc565b611388565b604051610298929190613c81565b34801561053957600080fd5b5061028c610548366004613557565b60a06020526000908152604090205460ff1681565b34801561056957600080fd5b506102c16105783660046135c7565b611504565b34801561058957600080fd5b5061028c6105983660046137b3565b61155f565b3480156105a957600080fd5b506102c16105b8366004613864565b61158a565b3480156105c957600080fd5b506102c16105d8366004613557565b611665565b3480156105e957600080fd5b506105fd6105f83660046139ab565b611694565b60408051928352602083019190915201610298565b34801561061e57600080fd5b50610340600081565b34801561063357600080fd5b5061034061064236600461358f565b611728565b34801561065357600080fd5b50610340600080516020613fe383398151915281565b34801561067557600080fd5b506102c16106843660046137b3565b6117b5565b34801561069557600080fd5b5061080b6106a4366004613979565b604080516101e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081018290526101c08101919091525060ff908116600090815260a2602090815260408083206001600160401b039590951683529381529083902083516101e08101855281549384168152610100938490046001600160a01b0390811693820193909352600182015483169481019490945260028101546060850152600381015482166080850152600481015460a08501526005810154821660c0850152600681015460e08501526007810154928401929092526008820154811661012084015260098201548116610140840152600a820154610160840152600b82015416610180830152600c8101546101a0830152600d01546101c082015290565b6040516102989190613d93565b34801561082457600080fd5b506102c1610833366004613723565b6117d8565b34801561084457600080fd5b50610340610853366004613557565b609f6020526000908152604090205481565b34801561087157600080fd5b50609c546102e3906001600160a01b031681565b34801561089157600080fd5b506102c16108a0366004613723565b611825565b3480156108b157600080fd5b50609a5461028c90600160a01b900460ff1681565b3480156108d257600080fd5b506102c16108e13660046137b3565b611889565b3480156108f257600080fd5b5061028c609a54600160a01b900460ff1690565b34801561091257600080fd5b506102c1610921366004613723565b6118af565b34801561093257600080fd5b50609a546102e3906001600160a01b031681565b34801561095257600080fd5b506102c1610961366004613723565b6118fc565b34801561097257600080fd5b506102c1610981366004613557565b611949565b34801561099257600080fd5b506102c16109a1366004613611565b61196b565b3480156109b257600080fd5b506102c16109c1366004613723565b6119f3565b60006001600160e01b03198216637965db0b60e01b14806109f757506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b600080516020613fe3833981519152610a1981335b611ae2565b610a2282611b46565b5050565b600080516020613fe3833981519152610a3f8133610a14565b609c54604051630fa857f560e31b815260ff881660048201526001600160a01b0387811660248301526044820187905260648201869052841515608483015290911690637d42bfa89060a401600060405180830381600087803b158015610aa557600080fd5b505af1158015610ab9573d6000803e3d6000fd5b50505050505050505050565b600082815260656020526040902060010154610ae18133610a14565b610aeb8383611bde565b505050565b6001600160a01b0381163314610b655760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610a228282611c64565b6000610b7b8133610a14565b50609c80546001600160a01b0319166001600160a01b0392909216919091179055565b600080516020613fe3833981519152610bb78133610a14565b609d546040516330414fc560e11b81526001600160a01b03909116906360829f8a90610beb90879087908790600401613b99565b600060405180830381600087803b158015610c0557600080fd5b505af1158015610c19573d6000803e3d6000fd5b5050505050505050565b600080516020613fe3833981519152610c3c8133610a14565b6000858152609e60209081526040808320546001600160a01b03166101e08601819052835260a090915281205460ff16610c885760405162461bcd60e51b8152600401610b5c90613d4b565b826101e001516001600160a01b0316836101c0015160601c6001600160a01b03161415610d775782516001600160a01b0316610cd0576101e08301516001600160a01b031683525b6000610ce0868560000151611694565b50609d5485516102a0870151609a54609c546040516304a1d7f960e01b81529597508796506001600160a01b03948516956304a1d7f995610d369594938993600160a01b90910460ff1692911690600401613bbd565b600060405180830381600087803b158015610d5057600080fd5b505af1158015610d64573d6000803e3d6000fd5b50505050610d7184611ccb565b5061111e565b6101c0830151609d546101e0850151604051635fae924560e01b815260609390931c926001600160a01b0390921691635fae924591610db891600401613b05565b602060405180830381600087803b158015610dd257600080fd5b505af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190613573565b6001600160a01b03161415610e2857610e238386611deb565b61111e565b82516001600160a01b031615610ece576000610e48868560000151611694565b609d5486516102a0880151609a54609c546040516304a1d7f960e01b81529598508897506001600160a01b0394851696506304a1d7f995610e9a958993600160a01b900460ff16921690600401613bbd565b600060405180830381600087803b158015610eb457600080fd5b505af1158015610ec8573d6000803e3d6000fd5b50505050505b609d546101c08401516102a085015160985460e0870151604051634c62b25760e01b81526001600160a01b0395861695634c62b25795610f1c9560609190911c949093911691600401613b19565b600060405180830381600087803b158015610f3657600080fd5b505af1158015610f4a573d6000803e3d6000fd5b50505050610f5783611ee8565b82516001600160a01b031661111e576000610f7786856101e00151611694565b6101e08601516001600160a01b0316865261010086015190935083925082111590506110015760405162461bcd60e51b815260206004820152603360248201527f455243323068616e646c6572203a2070726f766964656420666565206973206c604482015272195cdcc81d1a185b881d1a1948185b5bdd5b9d606a1b6064820152608401610b5c565b808461010001516110129190613f1a565b610100850152609d548451609c54604051630d9aa67b60e31b81526001600160a01b0393841693636cd533d8936110529390929116908690600401613b99565b600060405180830381600087803b15801561106c57600080fd5b505af1158015611080573d6000803e3d6000fd5b505050506101e08401516001600160a01b0316600090815260a1602052604090205460ff161561111c57609d546101e08501516101008601516040516303a4f5ed60e31b81526001600160a01b0390931692631d27af68926110e9929091859190600401613b99565b600060405180830381600087803b15801561110357600080fd5b505af1158015611117573d6000803e3d6000fd5b505050505b505b604051806101e001604052808660ff168152602001846101c0015160601c6001600160a01b03168152602001846101e001516001600160a01b0316815260200184610100015181526020018461022001516001600160a01b03168152602001846101000151815260200184610200015160601c6001600160a01b03168152602001846101400151815260200187815260200184608001516001600160a01b03168152602001846102a001516001600160a01b031681526020018460e00151815260200184600001516001600160a01b03168152602001828152602001846102c0015161120b57600061120e565b60015b60ff908116909152958616600090815260a2602090815260408083206001600160401b0398909816835296815290869020825181549284015160ff19909316981697909717610100600160a81b0319166101006001600160a01b039283168102919091178855958201516001880180546001600160a01b0319908116928416929092179055606083015160028901556080830151600389018054831691841691909117905560a0830151600489015560c0830151600589018054831691841691909117905560e0830151600689015595820151600788015561012082015160088801805488169183169190911790556101408201516009880180548816918316919091179055610160820151600a880155610180820151600b880180549097169116179094555050506101a0810151600c8301556101c00151600d9091015550565b600080516020613fe38339815191526113698133610a14565b50609a8054911515600160a01b0260ff60a01b19909216919091179055565b600080600080516020613fe38339815191526113a48133610a14565b6000848152609e60209081526040808320546001600160a01b03166102208901819052835260a090915290205460ff166113f05760405162461bcd60e51b8152600401610b5c90613d4b565b8461022001516001600160a01b031685610200015160601c6001600160a01b0316141561142a5761142085612097565b90935091506114fc565b610200850151609d54610220870151604051635fae924560e01b815260609390931c926001600160a01b0390921691635fae92459161146b91600401613b05565b602060405180830381600087803b15801561148557600080fd5b505af1158015611499573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bd9190613573565b6001600160a01b031614156114ed576114d58561246f565b84610200015160601c925084610120015191506114fc565b6114f6856124b2565b90935091505b509250929050565b600080516020613fe383398151915261151d8133610a14565b609d546040516316e9aed760e11b81526001600160a01b0386811660048301528581166024830152848116604483015290911690632dd35dae90606401610beb565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020613fe38339815191526115a38133610a14565b609d54604051631e4a68cf60e11b81526000916001600160a01b031690633c94d19e906115dc908a908a908a908a908a90600401613cad565b602060405180830381600087803b1580156115f657600080fd5b505af115801561160a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162e9190613573565b6001600160a01b038516600090815260a060205260409020805460ff19166001179055905061165c81611b46565b50505050505050565b60006116718133610a14565b50609d80546001600160a01b0319166001600160a01b0392909216919091179055565b609c54604051631eeb344360e21b815260ff841660048201526001600160a01b0383811660248301526000928392911690637bacd10c90604401604080518083038186803b1580156116e557600080fd5b505afa1580156116f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171d9190613956565b915091509250929050565b609d5460405163ad527b2160e01b81526001600160a01b0384811660048301528381166024830152600092169063ad527b219060440160206040518083038186803b15801561177657600080fd5b505afa15801561178a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ae919061393e565b9392505050565b600080516020613fe38339815191526117ce8133610a14565b610aeb8383612b3e565b600080516020613fe38339815191526117f18133610a14565b609d5460405163bf6eac2f60e01b81526001600160a01b039091169063bf6eac2f90610beb90879087908790600401613b99565b600080516020613fe383398151915261183e8133610a14565b609d54609a54604051636e4b2ac160e11b81526001600160a01b038781166004830152868116602483015260448201869052918216606482015291169063dc96558290608401610beb565b6000828152606560205260409020600101546118a58133610a14565b610aeb8383611c64565b600080516020613fe38339815191526118c88133610a14565b609d54604051630d9aa67b60e31b81526001600160a01b0390911690636cd533d890610beb90879087908790600401613b99565b600080516020613fe38339815191526119158133610a14565b609c54604051631095b6d760e01b81526001600160a01b0390911690631095b6d790610beb90879087908790600401613b99565b600080516020613fe38339815191526119628133610a14565b610a2282612be4565b600054610100900460ff1680611984575060005460ff16155b6119a05760405162461bcd60e51b8152600401610b5c90613cfd565b600054610100900460ff161580156119cb576000805460ff1961ff0019909116610100171660011790555b6119d9878787878787612c71565b801561165c576000805461ff001916905550505050505050565b600080516020613fe3833981519152611a0c8133610a14565b609a54609d5460405163a9059cbb60e01b81526001600160a01b039283169263a9059cbb92611a42929116908690600401613c81565b602060405180830381600087803b158015611a5c57600080fd5b505af1158015611a70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a94919061377f565b611aae57634e487b7160e01b600052600160045260246000fd5b609d5460405163f4e480e160e01b81526001600160a01b039091169063f4e480e190610beb90879087908790600401613b99565b611aec828261155f565b610a2257611b04816001600160a01b03166014612e79565b611b0f836020612e79565b604051602001611b20929190613a96565b60408051601f198184030181529082905262461bcd60e51b8252610b5c91600401613c9a565b6001600160a01b038116600090815260a0602052604090205460ff16611bba5760405162461bcd60e51b8152602060048201526024808201527f70726f766964656420636f6e7472616374206973206e6f742077686974656c696044820152631cdd195960e21b6064820152608401610b5c565b6001600160a01b0316600090815260a160205260409020805460ff19166001179055565b611be8828261155f565b610a225760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055611c203390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b611c6e828261155f565b15610a225760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6101c081015160601c600090815260a1602052604090205460ff1615611d6a57609d546101c08201516102a083015160e08401516040516303a4f5ed60e31b81526001600160a01b0390941693631d27af6893611d339360609190911c929091600401613b99565b600060405180830381600087803b158015611d4d57600080fd5b505af1158015611d61573d6000803e3d6000fd5b50505050611de8565b609d546101c08201516102a083015160e0840151604051634c62b25760e01b81526001600160a01b0390941693634c62b25793611db59360609190911c929091869190600401613b19565b600060405180830381600087803b158015611dcf57600080fd5b505af1158015611de3573d6000803e3d6000fd5b505050505b50565b81516000906001600160a01b0316611e09576101c083015160601c83525b6000611e1a83856101e00151611694565b50609d5485516102a0870151609a54609c546040516304a1d7f960e01b81529597508796506001600160a01b03948516956304a1d7f995611e709594938993600160a01b90910460ff1692911690600401613bbd565b600060405180830381600087803b158015611e8a57600080fd5b505af1158015611e9e573d6000803e3d6000fd5b5050609d546101c08701516102a088015160e08901516040516303a4f5ed60e31b81526001600160a01b039094169550631d27af689450610beb9360609390931c92600401613b99565b6002816102800151511115611fad57609d5460985461028083015160e0840151610100850151610240860151610260870151604051638da6130760e01b81526001600160a01b0397881697638da6130797611f50979116959094909390929091600401613bef565b602060405180830381600087803b158015611f6a57600080fd5b505af1158015611f7e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa2919061393e565b610100820152611de8565b609d546098546101c08301516101e084015160e085015161010086015161024087015161026088015180516001600160a01b039889169863951db63798169660601c95949392919060009061201257634e487b7160e01b600052603260045260246000fd5b60200260200101516040518863ffffffff1660e01b815260040161203c9796959493929190613b43565b602060405180830381600087803b15801561205657600080fd5b505af115801561206a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061208e919061393e565b61010082015250565b61020081015160601c600090815260a16020526040812054819060ff161561213857609d5461020084015160808501516101208601516040516308f80fd160e31b81526001600160a01b03909416936347c07e88936121019360609190911c929091600401613b99565b600060405180830381600087803b15801561211b57600080fd5b505af115801561212f573d6000803e3d6000fd5b5050505061245b565b610220830151609d546040516370a0823160e01b81526000926001600160a01b03908116926370a08231926121739290911690600401613b05565b60206040518083038186803b15801561218b57600080fd5b505afa15801561219f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121c3919061393e565b90508361012001518110156122dd57609d546102208501516080860151610120870151604051632b9cd63d60e11b81526001600160a01b0390941693635739ac7a936122159390929091600401613b99565b600060405180830381600087803b15801561222f57600080fd5b505af1158015612243573d6000803e3d6000fd5b5050609d54610220870151604051635fae924560e01b81526001600160a01b039092169350635fae9245925061227b91600401613b05565b602060405180830381600087803b15801561229557600080fd5b505af11580156122a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122cd9190613573565b846101200151925092505061246a565b609a546102208501516001600160a01b0390811691161480156123025750836102c001515b156123e357609d54609a546101208601516040516324c44ed760e21b81526001600160a01b03938416936393113b5c9361234193911691600401613c81565b600060405180830381600087803b15801561235b57600080fd5b505af115801561236f573d6000803e3d6000fd5b5050609d546080870151610120880151604051637c4368c160e01b81526001600160a01b039093169450637c4368c193506123ac92600401613c81565b600060405180830381600087803b1580156123c657600080fd5b505af11580156123da573d6000803e3d6000fd5b50505050612459565b609d546102208501516080860151610120870151604051630d9aa67b60e31b81526001600160a01b0390941693636cd533d8936124269390929091600401613b99565b600060405180830381600087803b15801561244057600080fd5b505af1158015612454573d6000803e3d6000fd5b505050505b505b50506102208101516101208201515b915091565b609d546102208201516080830151610120840151604051632b9cd63d60e11b81526001600160a01b0390941693635739ac7a93611db59390929091600401613b99565b6102208101516001600160a01b0316600090815260a16020526040812054819060ff161561255357609d546102208401516098546101208601516040516308f80fd160e31b81526001600160a01b03948516946347c07e889461251c949093911691600401613b99565b600060405180830381600087803b15801561253657600080fd5b505af115801561254a573d6000803e3d6000fd5b505050506126a6565b610220830151609d546040516370a0823160e01b81526000926001600160a01b03908116926370a082319261258e9290911690600401613b05565b60206040518083038186803b1580156125a657600080fd5b505afa1580156125ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125de919061393e565b905083610120015181101561263057609d546102208501516080860151610120870151604051632b9cd63d60e11b81526001600160a01b0390941693635739ac7a936122159390929091600401613b99565b609d54610220850151609854610120870151604051630d9aa67b60e31b81526001600160a01b0394851694636cd533d894612672949093911691600401613b99565b600060405180830381600087803b15801561268c57600080fd5b505af11580156126a0573d6000803e3d6000fd5b50505050505b600283610280015151111561286b57609d5460985461028085015161012086015161014087015161024088015161026089015160405160009788976001600160a01b0391821697638da613079761270b97939092169590949193909190602401613bef565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516127449190613a7a565b6000604051808303816000865af19150503d8060008114612781576040519150601f19603f3d011682016040523d82523d6000602084013e612786565b606091505b509150915081156127af57808060200190518101906127a5919061393e565b6060860152612864565b6098546102208601516080870151610120880151604051636ce5768960e11b81526001600160a01b039094169363d9caed12936127f29390929091600401613b99565b602060405180830381600087803b15801561280c57600080fd5b505af1158015612820573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612844919061377f565b61284d57600080fd5b84610220015185610120015193509350505061246a565b50506129af565b600080609d60009054906101000a90046001600160a01b03166001600160a01b031663951db637609860009054906101000a90046001600160a01b031687610220015188610200015160601c8961012001518a61014001518b61024001518c61026001516000815181106128ef57634e487b7160e01b600052603260045260246000fd5b602002602001015160405160240161290d9796959493929190613b43565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516129469190613a7a565b6000604051808303816000865af19150503d8060008114612983576040519150601f19603f3d011682016040523d82523d6000602084013e612988565b606091505b509150915081156127af57808060200190518101906129a7919061393e565b606086015250505b609a5461020084015160601c6001600160a01b039091161480156129d55750826102c001515b15612ab457609d54609a5460608501516040516324c44ed760e21b81526001600160a01b03938416936393113b5c93612a1393911691600401613c81565b600060405180830381600087803b158015612a2d57600080fd5b505af1158015612a41573d6000803e3d6000fd5b5050609d5460808601516060870151604051637c4368c160e01b81526001600160a01b039093169450637c4368c19350612a7d92600401613c81565b600060405180830381600087803b158015612a9757600080fd5b505af1158015612aab573d6000803e3d6000fd5b50505050612b2b565b609d546102008401516080850151606080870151604051630d9aa67b60e31b81526001600160a01b0390951694636cd533d894612af894931c929190600401613b99565b600060405180830381600087803b158015612b1257600080fd5b505af1158015612b26573d6000803e3d6000fd5b505050505b5050610200810151606091820151911c91565b6001600160a01b038116612b945760405162461bcd60e51b815260206004820152601e60248201527f636f6e747261637420616464726573732063616e2774206265207a65726f00006044820152606401610b5c565b6000828152609e6020908152604080832080546001600160a01b039095166001600160a01b031990951685179055928252609f81528282209390935560a09092529020805460ff19166001179055565b6001600160a01b038116612c4f5760405162461bcd60e51b815260206004820152602c60248201527f455243323048616e646c65723a20636f6e74726163744164647265737320636160448201526b1b9b9bdd081899481b9d5b1b60a21b6064820152608401610b5c565b609880546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff1680612c8a575060005460ff16155b612ca65760405162461bcd60e51b8152600401610b5c90613cfd565b600054610100900460ff16158015612cd1576000805460ff1961ff0019909116610100171660011790555b612cd961305a565b612ce16130ce565b8251845114612d585760405162461bcd60e51b815260206004820152603a60248201527f696e697469616c5265736f75726365494473202620696e697469616c436f6e7460448201527f72616374416464726573736573206c656e206d69736d617463680000000000006064820152608401610b5c565b609780546001600160a01b03808a166001600160a01b03199283161790925560998054898416908316179055609a805492881692909116919091179055835160005b81811015612e0c57612dfa868281518110612dc557634e487b7160e01b600052603260045260246000fd5b6020026020010151868381518110612ded57634e487b7160e01b600052603260045260246000fd5b6020026020010151612b3e565b80612e0481613f78565b915050612d9a565b50825160005b81811015612e5c57612e4a858281518110612e3d57634e487b7160e01b600052603260045260246000fd5b6020026020010151611b46565b80612e5481613f78565b915050612e12565b505050801561165c576000805461ff001916905550505050505050565b60606000612e88836002613efb565b612e93906002613ee3565b6001600160401b03811115612eb857634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015612ee2576020820181803683370190505b509050600360fc1b81600081518110612f0b57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110612f4857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000612f6c846002613efb565b612f77906001613ee3565b90505b600181111561300b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110612fb957634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110612fdd57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361300481613f61565b9050612f7a565b5083156117ae5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b5c565b600054610100900460ff1680613073575060005460ff16155b61308f5760405162461bcd60e51b8152600401610b5c90613cfd565b600054610100900460ff161580156130ba576000805460ff1961ff0019909116610100171660011790555b8015611de8576000805461ff001916905550565b600054610100900460ff16806130e7575060005460ff16155b6131035760405162461bcd60e51b8152600401610b5c90613cfd565b600054610100900460ff1615801561312e576000805460ff1961ff0019909116610100171660011790555b61313661305a565b61313e613182565b6131496000336131fa565b613161600080516020613fe3833981519152336131fa565b609a805460ff60a01b191690558015611de8576000805461ff001916905550565b600054610100900460ff168061319b575060005460ff16155b6131b75760405162461bcd60e51b8152600401610b5c90613cfd565b600054610100900460ff161580156131e2576000805460ff1961ff0019909116610100171660011790555b6131ea61305a565b6131f261305a565b6130ba61305a565b610a228282611bde565b80356109fa81613fbf565b600082601f83011261321f578081fd5b8135602061323461322f83613ec0565b613e90565b8281528181019085830183850287018401881015613250578586fd5b855b8581101561327757813561326581613fbf565b84529284019290840190600101613252565b5090979650505050505050565b600082601f830112613294578081fd5b813560206132a461322f83613ec0565b82815281810190858301838502870184018810156132c0578586fd5b855b85811015613277578135845292840192908401906001016132c2565b80356109fa81613fd4565b80356bffffffffffffffffffffffff19811681146109fa57600080fd5b600082601f830112613316578081fd5b81356001600160401b0381111561332f5761332f613fa9565b613342601f8201601f1916602001613e90565b818152846020838601011115613356578283fd5b816020850160208301379081016020019190915292915050565b60006102e0808385031215613383578182fd5b61338c81613e90565b91505061339882613204565b81526133a66020830161352f565b602082015260408201356040820152606082013560608201526133cb60808301613204565b60808201526133dc60a08301613204565b60a08201526133ed60c08301613204565b60c082015260e08281013590820152610100808301359082015261012080830135908201526101408083013590820152610160808301359082015261018080830135908201526101a080830135908201526101c061344c8184016132e9565b908201526101e061345e838201613204565b908201526102006134708382016132e9565b90820152610220613482838201613204565b90820152610240828101356001600160401b03808211156134a257600080fd5b6134ae86838701613284565b838501526102609250828501359150808211156134ca57600080fd5b6134d686838701613284565b838501526102809250828501359150808211156134f257600080fd5b506134ff8582860161320f565b8284015250506102a0613513818401613204565b908201526102c06135258382016132de565b9082015292915050565b80356001600160401b03811681146109fa57600080fd5b803560ff811681146109fa57600080fd5b600060208284031215613568578081fd5b81356117ae81613fbf565b600060208284031215613584578081fd5b81516117ae81613fbf565b600080604083850312156135a1578081fd5b82356135ac81613fbf565b915060208301356135bc81613fbf565b809150509250929050565b6000806000606084860312156135db578081fd5b83356135e681613fbf565b925060208401356135f681613fbf565b9150604084013561360681613fbf565b809150509250925092565b60008060008060008060c08789031215613629578384fd5b863561363481613fbf565b955060208781013561364581613fbf565b9550604088013561365581613fbf565b945060608801356001600160401b0380821115613670578485fd5b818a0191508a601f830112613683578485fd5b813561369161322f82613ec0565b81815284810190848601868402860187018f10156136ad578889fd5b8895505b838610156136cf5780358352600195909501949186019186016136b1565b509750505060808a01359250808311156136e7578485fd5b6136f38b848c0161320f565b945060a08a0135925080831115613708578384fd5b505061371689828a0161320f565b9150509295509295509295565b600080600060608486031215613737578081fd5b833561374281613fbf565b9250602084013561375281613fbf565b929592945050506040919091013590565b600060208284031215613774578081fd5b81356117ae81613fd4565b600060208284031215613790578081fd5b81516117ae81613fd4565b6000602082840312156137ac578081fd5b5035919050565b600080604083850312156137c5578182fd5b8235915060208301356135bc81613fbf565b600080600080608085870312156137ec578182fd5b843593506137fc60208601613546565b925061380a6040860161352f565b915060608501356001600160401b03811115613824578182fd5b61383087828801613370565b91505092959194509250565b60006020828403121561384d578081fd5b81356001600160e01b0319811681146117ae578182fd5b600080600080600060a0868803121561387b578283fd5b85356001600160401b0380821115613891578485fd5b61389d89838a01613306565b965060208801359150808211156138b2578485fd5b506138bf88828901613306565b9450506138ce60408701613546565b925060608601356138de81613fbf565b915060808601356138ee81613fbf565b809150509295509295909350565b6000806040838503121561390e578182fd5b82356001600160401b03811115613923578283fd5b61392f85828601613370565b95602094909401359450505050565b60006020828403121561394f578081fd5b5051919050565b60008060408385031215613968578182fd5b505080516020909101519092909150565b6000806040838503121561398b578182fd5b6139948361352f565b91506139a260208401613546565b90509250929050565b600080604083850312156139bd578182fd5b6135ac83613546565b600080600080600060a086880312156139dd578283fd5b6139e686613546565b945060208601356139f681613fbf565b9350604086013592506060860135915060808601356138ee81613fd4565b6000815180845260208085019450808401835b83811015613a4357815187529582019590820190600101613a27565b509495945050505050565b60008151808452613a66816020860160208601613f31565b601f01601f19169290920160200192915050565b60008251613a8c818460208701613f31565b9190910192915050565b600076020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b82528351613ac8816017850160208801613f31565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613af9816028840160208801613f31565b01602801949350505050565b6001600160a01b0391909116815260200190565b6001600160a01b039485168152928416602084015292166040820152606081019190915260800190565b6001600160a01b038881168252878116602083015286166040820152606081018590526080810184905260e060a08201819052600090613b8590830185613a14565b90508260c083015298975050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0395861681529385166020850152604084019290925215156060830152909116608082015260a00190565b6001600160a01b03878116825260c0602080840182905288519184018290526000928982019290919060e0860190855b81811015613c3d578551851683529483019491830191600101613c1f565b50508960408701528860608701528581036080870152613c5d8189613a14565b935050505082810360a0840152613c748185613a14565b9998505050505050505050565b6001600160a01b03929092168252602082015260400190565b6000602082526117ae6020830184613a4e565b600060a08252613cc060a0830188613a4e565b8281036020840152613cd28188613a4e565b60ff96909616604084015250506001600160a01b039283166060820152911660809091015292915050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b60208082526028908201527f70726f766964656420746f6b656e41646472657373206973206e6f74207768696040820152671d195b1a5cdd195960c21b606082015260800190565b815160ff1681526101e081016020830151613db960208401826001600160a01b03169052565b506040830151613dd460408401826001600160a01b03169052565b50606083015160608301526080830151613df960808401826001600160a01b03169052565b5060a083015160a083015260c0830151613e1e60c08401826001600160a01b03169052565b5060e083810151908301526101008084015190830152610120808401516001600160a01b039081169184019190915261014080850151821690840152610160808501519084015261018080850151909116908301526101a080840151908301526101c092830151929091019190915290565b604051601f8201601f191681016001600160401b0381118282101715613eb857613eb8613fa9565b604052919050565b60006001600160401b03821115613ed957613ed9613fa9565b5060209081020190565b60008219821115613ef657613ef6613f93565b500190565b6000816000190483118215151615613f1557613f15613f93565b500290565b600082821015613f2c57613f2c613f93565b500390565b60005b83811015613f4c578181015183820152602001613f34565b83811115613f5b576000848401525b50505050565b600081613f7057613f70613f93565b506000190190565b6000600019821415613f8c57613f8c613f93565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114611de857600080fd5b8015158114611de857600080fdfe52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5fa164736f6c6343000802000a

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading