Contract 0x70098588622d4C9e511B75a9f96BC346EA85363E 1

 
 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xa76044f8114d810e5a86bdde6d3f2aabe63b7bf7d9215804713fcb66516ec6360x60806040241935242022-01-26 17:18:02249 days 21 hrs ago0xb00b19938346b745ccb3fc4fad946de0caa724a2 IN  Create: ERC20HandlerUpgradeable0 MATIC8.1566482,000
[ 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 320 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 20 : 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 "../interfaces/IERC20Upgradeable.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;

    // token contract address => chainId => decimals
    mapping(address => mapping(uint8 => uint8)) public tokenDecimals;

    mapping(uint256 => mapping(uint64 => uint256)) public executeRecord;

    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], true);
        }
    }

    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 {}

    function setTokenDecimals(
        address tokenAddress, 
        uint8 destinationChainID, 
        uint8 decimals
    ) public onlyRole(BRIDGE_ROLE) {
        require(_contractWhitelist[tokenAddress], "provided contract is not whitelisted");
        tokenDecimals[tokenAddress][destinationChainID] = decimals;
    }

    function changePrecision(
        address token,
        uint8 chainId,
        uint256 tokenAmount
    ) public view returns (uint256) {
        IERC20Upgradeable srcToken = IERC20Upgradeable(token);
        require(tokenDecimals[token][chainId] > 0, "Decimals not set for token and chain id");
        uint8 srcDecimal = srcToken.decimals();
        uint8 destDecimal = tokenDecimals[token][chainId];
        if(srcDecimal == destDecimal)
            return tokenAmount;
        if(srcDecimal > destDecimal){
            uint256 factor = (10 ** (srcDecimal - destDecimal));
            return tokenAmount / factor;
        } else {
            uint256 factor = (10 ** (destDecimal - srcDecimal));
            return tokenAmount * factor;
        }
    }

    function setExecuteRecord(
        uint256 chainId, 
        uint64 nonce
    ) internal {
        executeRecord[chainId][nonce] = block.number;
    }

    /**
        @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) {
            require(swapDetails.srcStableTokenAmount == swapDetails.srcTokenAmount, "Invalid token amount");
            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)) {
            require(swapDetails.srcStableTokenAmount == swapDetails.srcTokenAmount, "Invalid token amount");
            feeAmount = 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
                    );
                }
            }
        }
        uint256 destStableTokenAmount = changePrecision(
            address(swapDetails.srcStableTokenAddress), 
            destinationChainID, 
            swapDetails.srcStableTokenAmount
        );
        require(destStableTokenAmount > 0, "Transfer amount too low");
        _depositRecords[destinationChainID][depositNonce] = DepositRecord(
            destinationChainID,
            address(swapDetails.srcTokenAddress),
            swapDetails.srcStableTokenAddress,
            swapDetails.srcStableTokenAmount,
            address(swapDetails.destStableTokenAddress),
            destStableTokenAmount,
            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);
            setExecuteRecord(swapDetails.index, swapDetails.depositNonce);
        } 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;
            setExecuteRecord(swapDetails.index, swapDetails.depositNonce);
        } else {
            // exchange destStable to destToken and release tokens
            (settlementToken, settlementAmount) = handleExecuteForNonReserveToken(swapDetails);
            setExecuteRecord(swapDetails.index, swapDetails.depositNonce);
        }
    }

    /**
        @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 returns (uint256 transferFee){
        if (swapDetails.feeTokenAddress == address(0)) {
            swapDetails.feeTokenAddress = address(swapDetails.srcTokenAddress);
            (transferFee, ) = getBridgeFee(destinationChainID, swapDetails.srcStableTokenAddress);
        }else{
            (transferFee, ) = getBridgeFee(destinationChainID, swapDetails.feeTokenAddress);
        }
        // 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 20 : SafeMathUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library 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 20 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since 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.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the
 * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() initializer {}
 * ```
 * ====
 */
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() {
        // If the contract is initializing we ignore whether _initialized is set in order to support multiple
        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the
        // contract may have been reentered.
        require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized");

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

        _;

        if (isTopLevelCall) {
            _initializing = false;
        }
    }

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

    function _isConstructor() private view returns (bool) {
        return !AddressUpgradeable.isContract(address(this));
    }
}

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

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

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

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

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

File 5 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)

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 20 : 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 20 : 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 20 : 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 20 : 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 20 : IERC20Upgradeable.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 IERC20Upgradeable {

    function transfer( address, uint256) external;
    function decimals() external view returns (uint8);
}

File 11 of 20 : 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;
    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 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.
        @param status Boolean flag to change burnable status.
     */
    function setBurnable(address contractAddress, bool status) public virtual override onlyRole(BRIDGE_ROLE) {
        _setBurnable(contractAddress, status);
    }

    /**
        @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[newLPAddress] = true;
        _setBurnable(newLPAddress, true);
    }

    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, bool status) internal virtual {
        require(_contractWhitelist[contractAddress], "provided contract is not whitelisted");
        _burnList[contractAddress] = status;
    }

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

File 12 of 20 : AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library AddressUpgradeable {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 13 of 20 : AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol)

pragma solidity ^0.8.0;

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

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

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role, _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 revoked `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}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

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

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

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

File 14 of 20 : 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 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;


    // function setTokenDecimals(address tokenAddress, uint8 destinationChainID, uint8 decimals) 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.
        @param status Boolean flag for burnanble status.
     */
    function setBurnable(address contractAddress, bool status) 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 15 of 20 : 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 16 of 20 : 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 17 of 20 : IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 18 of 20 : StringsUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

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 19 of 20 : ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

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

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

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

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

pragma solidity ^0.8.0;

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

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

Contract Security Audit

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":"address","name":"token","type":"address"},{"internalType":"uint8","name":"chainId","type":"uint8"},{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"changePrecision","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"executeRecord","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":[{"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"},{"internalType":"bool","name":"status","type":"bool"}],"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":"tokenAddress","type":"address"},{"internalType":"uint8","name":"destinationChainID","type":"uint8"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"name":"setTokenDecimals","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":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint8","name":"","type":"uint8"}],"name":"tokenDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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"}]

608060405234801561001057600080fd5b506148d2806100206000396000f3fe6080604052600436106102c65760003560e01c80639680504c1161017f578063c8ba6c87116100e1578063d9caed121161008a578063e7c308fd11610064578063e7c308fd14610aa9578063eae9befc14610ac9578063f4e480e114610ae9576102cd565b8063d9caed1214610a49578063e0af361614610a69578063e55dc4e614610a89576102cd565b8063d3ff209d116100bb578063d3ff209d146109e8578063d547741f14610a09578063d755c34914610a29576102cd565b8063c8ba6c871461097b578063d0fb0203146109a8578063d3fad208146109c8576102cd565b8063a6fd91ee11610143578063b8fa37361161011d578063b8fa3736146107ab578063ba484c09146107cb578063bf6eac2f1461095b576102cd565b8063a6fd91ee1461071c578063ad527b2114610769578063b5bfddea14610789576102cd565b80639680504c1461065a57806397e76aab1461067a5780639cecc80a146106b25780639e601b31146106d2578063a217fddf14610707576102cd565b8063536187d6116102285780636ac6376b116101ec5780637f79bea8116101c65780637f79bea8146105c45780637ffb45fa146105f457806391d1485414610614576102cd565b80636ac6376b146105455780636be1dc2b1461056557806378d92eb014610585576102cd565b8063536187d6146104955780635d92c1ac146104b55780635db99af2146104d557806360829f8a146104f55780636a70d08114610515576102cd565b8063318c136e1161028a57806336568abe1161026457806336568abe14610435578063413ab4a814610455578063472d35b914610475576102cd565b8063318c136e146103bf578063359d8601146103df57806335d0d5dc146103ff576102cd565b806301ffc9a7146102d25780630ab75d3e146103075780631487001b1461033f578063248a9ca3146103615780632f2ff15d1461039f576102cd565b366102cd57005b600080fd5b3480156102de57600080fd5b506102f26102ed36600461404f565b610b09565b60405190151581526020015b60405180910390f35b34801561031357600080fd5b50609854610327906001600160a01b031681565b6040516001600160a01b0390911681526020016102fe565b34801561034b57600080fd5b5061035f61035a36600461420f565b610b42565b005b34801561036d57600080fd5b5061039161037c366004613fab565b60009081526065602052604090206001015490565b6040519081526020016102fe565b3480156103ab57600080fd5b5061035f6103ba366004613fc3565b610be2565b3480156103cb57600080fd5b50609754610327906001600160a01b031681565b3480156103eb57600080fd5b5061035f6103fa366004613f34565b610c0d565b34801561040b57600080fd5b5061032761041a366004613fab565b6000908152609d60205260409020546001600160a01b031690565b34801561044157600080fd5b5061035f610450366004613fc3565b610cd8565b34801561046157600080fd5b50609c54610327906001600160a01b031681565b34801561048157600080fd5b5061035f610490366004613c9e565b610d56565b3480156104a157600080fd5b506103916104b0366004613f05565b610d85565b3480156104c157600080fd5b5061035f6104d0366004613eab565b610f27565b3480156104e157600080fd5b50609954610327906001600160a01b031681565b34801561050157600080fd5b5061035f610510366004613e6b565b610f4a565b34801561052157600080fd5b506102f2610530366004613c9e565b60a06020526000908152604090205460ff1681565b34801561055157600080fd5b5061035f610560366004613fe7565b610fd8565b34801561057157600080fd5b5061035f610580366004613f73565b611899565b34801561059157600080fd5b506105a56105a0366004614112565b6118d1565b604080516001600160a01b0390931683526020830191909152016102fe565b3480156105d057600080fd5b506102f26105df366004613c9e565b609f6020526000908152604090205460ff1681565b34801561060057600080fd5b5061035f61060f366004613d0e565b611b16565b34801561062057600080fd5b506102f261062f366004613fc3565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b34801561066657600080fd5b5061035f610675366004614077565b611b71565b34801561068657600080fd5b50610391610695366004614190565b60a360209081526000928352604080842090915290825290205481565b3480156106be57600080fd5b5061035f6106cd366004613c9e565b611c52565b3480156106de57600080fd5b506106f26106ed3660046141f2565b611c81565b604080519283526020830191909152016102fe565b34801561071357600080fd5b50610391600081565b34801561072857600080fd5b50610757610737366004613ed8565b60a260209081526000928352604080842090915290825290205460ff1681565b60405160ff90911681526020016102fe565b34801561077557600080fd5b50610391610784366004613cd6565b611d15565b34801561079557600080fd5b506103916000805160206148a683398151915281565b3480156107b757600080fd5b5061035f6107c6366004613fc3565b611d9b565b3480156107d757600080fd5b5061094e6107e63660046141bb565b604080516101e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081018290526101a081018290526101c08101919091525060ff908116600090815260a16020908152604080832067ffffffffffffffff9590951683529381529083902083516101e08101855281549384168152610100938490046001600160a01b0390811693820193909352600182015483169481019490945260028101546060850152600381015482166080850152600481015460a08501526005810154821660c0850152600681015460e08501526007810154928401929092526008820154811661012084015260098201548116610140840152600a820154610160840152600b82015416610180830152600c8101546101a0830152600d01546101c082015290565b6040516102fe91906144eb565b34801561096757600080fd5b5061035f610976366004613e6b565b611dbe565b34801561098757600080fd5b50610391610996366004613c9e565b609e6020526000908152604090205481565b3480156109b457600080fd5b50609b54610327906001600160a01b031681565b3480156109d457600080fd5b5061035f6109e3366004613e6b565b611e18565b3480156109f457600080fd5b50609a546102f290600160a01b900460ff1681565b348015610a1557600080fd5b5061035f610a24366004613fc3565b611e7c565b348015610a3557600080fd5b506102f2609a54600160a01b900460ff1690565b348015610a5557600080fd5b5061035f610a64366004613e6b565b611ea2565b348015610a7557600080fd5b50609a54610327906001600160a01b031681565b348015610a9557600080fd5b5061035f610aa4366004613e6b565b611efc565b348015610ab557600080fd5b5061035f610ac4366004613c9e565b611f56565b348015610ad557600080fd5b5061035f610ae4366004613d58565b611f78565b348015610af557600080fd5b5061035f610b04366004613e6b565b612006565b60006001600160e01b03198216637965db0b60e01b1480610b3a57506301ffc9a760e01b6001600160e01b03198316145b90505b919050565b6000805160206148a6833981519152610b5c81335b612102565b609b54604051630fa857f560e31b815260ff881660048201526001600160a01b0387811660248301526044820187905260648201869052841515608483015290911690637d42bfa89060a401600060405180830381600087803b158015610bc257600080fd5b505af1158015610bd6573d6000803e3d6000fd5b50505050505050505050565b600082815260656020526040902060010154610bfe8133610b57565b610c088383612182565b505050565b6000805160206148a6833981519152610c268133610b57565b6001600160a01b0384166000908152609f602052604090205460ff16610c9f5760405162461bcd60e51b8152602060048201526024808201527f70726f766964656420636f6e7472616374206973206e6f742077686974656c696044820152631cdd195960e21b60648201526084015b60405180910390fd5b506001600160a01b0392909216600090815260a26020908152604080832060ff94851684529091529020805460ff191691909216179055565b6001600160a01b0381163314610d485760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c96565b610d528282612224565b5050565b6000610d628133610b57565b50609b80546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316600090815260a26020908152604080832060ff80871685529252822054859116610e0b5760405162461bcd60e51b815260206004820152602760248201527f446563696d616c73206e6f742073657420666f7220746f6b656e20616e6420636044820152661a185a5b881a5960ca1b6064820152608401610c96565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4657600080fd5b505afa158015610e5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7e91906141d6565b6001600160a01b038716600090815260a26020908152604080832060ff808b168552925290912054919250908116908216811415610ec157849350505050610f20565b8060ff168260ff161115610efd576000610edb82846147c2565b610ee690600a6146bb565b9050610ef28187614655565b945050505050610f20565b6000610f0983836147c2565b610f1490600a6146bb565b9050610ef2818761478c565b9392505050565b6000805160206148a6833981519152610f408133610b57565b610c0883836122a7565b6000805160206148a6833981519152610f638133610b57565b609c546040516330414fc560e11b81526001600160a01b038681166004830152858116602483015260448201859052909116906360829f8a906064015b600060405180830381600087803b158015610fba57600080fd5b505af1158015610fce573d6000803e3d6000fd5b5050505050505050565b6000805160206148a6833981519152610ff18133610b57565b6000858152609d60209081526040808320546001600160a01b03166101e086018190528352609f90915281205460ff1661107e5760405162461bcd60e51b815260206004820152602860248201527f70726f766964656420746f6b656e41646472657373206973206e6f74207768696044820152671d195b1a5cdd195960c21b6064820152608401610c96565b826101e001516001600160a01b0316836101c0015160601c6001600160a01b031614156111ce578260e00151836101000151146110f45760405162461bcd60e51b8152602060048201526014602482015273125b9d985b1a59081d1bdad95b88185b5bdd5b9d60621b6044820152606401610c96565b82516001600160a01b0316611115576101e08301516001600160a01b031683525b6000611125868560000151611c81565b50609c5485516102a0870151609a54609b546040516304a1d7f960e01b81526001600160a01b039485166004820152928416602484015260448301869052600160a01b90910460ff16151560648301528216608482015292945084935016906304a1d7f99060a401600060405180830381600087803b1580156111a757600080fd5b505af11580156111bb573d6000803e3d6000fd5b505050506111c884612346565b506115f4565b6101c0830151609c546101e0850151604051635fae924560e01b81526001600160a01b03918216600482015260609390931c92911690635fae924590602401602060405180830381600087803b15801561122757600080fd5b505af115801561123b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125f9190613cba565b6001600160a01b031614156112ce578260e00151836101000151146112bd5760405162461bcd60e51b8152602060048201526014602482015273125b9d985b1a59081d1bdad95b88185b5bdd5b9d60621b6044820152606401610c96565b6112c78386612478565b90506115f4565b82516001600160a01b03161561138a5760006112ee868560000151611c81565b609c5486516102a0880151609a54609b546040516304a1d7f960e01b81526001600160a01b039485166004820152928416602484015260448301869052600160a01b90910460ff1615156064830152821660848201529295508594501691506304a1d7f99060a401600060405180830381600087803b15801561137057600080fd5b505af1158015611384573d6000803e3d6000fd5b50505050505b609c546101c08401516102a085015160985460e0870151604051634c62b25760e01b815260609490941c60048501526001600160a01b0392831660248501529082166044840152606483015290911690634c62b25790608401600060405180830381600087803b1580156113fd57600080fd5b505af1158015611411573d6000803e3d6000fd5b5050505061141e836125da565b82516001600160a01b03166115f457600061143e86856101e00151611c81565b6101e08601516001600160a01b0316865261010086015190935083925082111590506114c85760405162461bcd60e51b815260206004820152603360248201527f455243323068616e646c6572203a2070726f766964656420666565206973206c604482015272195cdcc81d1a185b881d1a1948185b5bdd5b9d606a1b6064820152608401610c96565b808461010001516114d991906147ab565b610100850152609c548451609b54604051630d9aa67b60e31b81526001600160a01b039283166004820152908216602482015260448101849052911690636cd533d890606401600060405180830381600087803b15801561153957600080fd5b505af115801561154d573d6000803e3d6000fd5b505050506101e08401516001600160a01b0316600090815260a0602052604090205460ff16156115f257609c546101e08501516101008601516040516303a4f5ed60e31b81526001600160a01b03928316600482015291909216602482018190526044820192909252631d27af6890606401600060405180830381600087803b1580156115d957600080fd5b505af11580156115ed573d6000803e3d6000fd5b505050505b505b600061160b846101e0015187866101000151610d85565b90506000811161165d5760405162461bcd60e51b815260206004820152601760248201527f5472616e7366657220616d6f756e7420746f6f206c6f770000000000000000006044820152606401610c96565b604051806101e001604052808760ff168152602001856101c0015160601c6001600160a01b03168152602001856101e001516001600160a01b0316815260200185610100015181526020018561022001516001600160a01b0316815260200182815260200185610200015160601c6001600160a01b03168152602001856101400151815260200188815260200185608001516001600160a01b03168152602001856102a001516001600160a01b031681526020018560e00151815260200185600001516001600160a01b03168152602001838152602001856102c00151611745576000611748565b60015b60ff908116909152968716600090815260a16020908152604080832067ffffffffffffffff99909916835297815290879020825181549284015160ff1990931699169890981774ffffffffffffffffffffffffffffffffffffffff0019166101006001600160a01b039283168102919091178955968201516001890180546001600160a01b0319908116928416929092179055606083015160028a0155608083015160038a018054831691841691909117905560a083015160048a015560c083015160058a018054831691841691909117905560e083015160068a015596820151600789015561012082015160088901805489169183169190911790556101408201516009890180548916918316919091179055610160820151600a890155610180820151600b890180549098169116179095555050506101a0820151600c840155506101c00151600d9091015550565b6000805160206148a68339815191526118b28133610b57565b50609a8054911515600160a01b0260ff60a01b19909216919091179055565b6000806000805160206148a68339815191526118ed8133610b57565b6000848152609d60209081526040808320546001600160a01b031661022089018190528352609f90915290205460ff1661197a5760405162461bcd60e51b815260206004820152602860248201527f70726f766964656420746f6b656e41646472657373206973206e6f74207768696044820152671d195b1a5cdd195960c21b6064820152608401610c96565b8461022001516001600160a01b031685610200015160601c6001600160a01b031614156119e1576119aa85612789565b6040878101516020808a0151600092835260a3825283832067ffffffffffffffff909116835290522043905590935091505b611b0e565b610200850151609c54610220870151604051635fae924560e01b81526001600160a01b03918216600482015260609390931c92911690635fae924590602401602060405180830381600087803b158015611a3a57600080fd5b505af1158015611a4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a729190613cba565b6001600160a01b03161415611ad357611a8a85612b79565b84610200015160601c925084610120015191506119dc85604001518660200151600091825260a36020908152604080842067ffffffffffffffff90931684529190529020439055565b611adc85612bc8565b6040878101516020808a0151600092835260a3825283832067ffffffffffffffff909116835290522043905590935091505b509250929050565b6000805160206148a6833981519152611b2f8133610b57565b609c546040516316e9aed760e11b81526001600160a01b0386811660048301528581166024830152848116604483015290911690632dd35dae90606401610fa0565b6000805160206148a6833981519152611b8a8133610b57565b609c54604051631e4a68cf60e11b81526000916001600160a01b031690633c94d19e90611bc3908a908a908a908a908a9060040161444d565b602060405180830381600087803b158015611bdd57600080fd5b505af1158015611bf1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c159190613cba565b6001600160a01b0381166000908152609f60205260409020805460ff19166001908117909155909150611c499082906122a7565b50505050505050565b6000611c5e8133610b57565b50609c80546001600160a01b0319166001600160a01b0392909216919091179055565b609b54604051631eeb344360e21b815260ff841660048201526001600160a01b0383811660248301526000928392911690637bacd10c90604401604080518083038186803b158015611cd257600080fd5b505afa158015611ce6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d0a919061416d565b915091509250929050565b609c5460405163ad527b2160e01b81526001600160a01b0384811660048301528381166024830152600092169063ad527b219060440160206040518083038186803b158015611d6357600080fd5b505afa158015611d77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f209190614155565b6000805160206148a6833981519152611db48133610b57565b610c088383613280565b6000805160206148a6833981519152611dd78133610b57565b609c5460405163bf6eac2f60e01b81526001600160a01b0386811660048301528581166024830152604482018590529091169063bf6eac2f90606401610fa0565b6000805160206148a6833981519152611e318133610b57565b609c54609a54604051636e4b2ac160e11b81526001600160a01b038781166004830152868116602483015260448201869052918216606482015291169063dc96558290608401610fa0565b600082815260656020526040902060010154611e988133610b57565b610c088383612224565b6000805160206148a6833981519152611ebb8133610b57565b609c54604051630d9aa67b60e31b81526001600160a01b03868116600483015285811660248301526044820185905290911690636cd533d890606401610fa0565b6000805160206148a6833981519152611f158133610b57565b609b54604051631095b6d760e01b81526001600160a01b03868116600483015285811660248301526044820185905290911690631095b6d790606401610fa0565b6000805160206148a6833981519152611f6f8133610b57565b610d5282613326565b600054610100900460ff16611f935760005460ff1615611f97565b303b155b611fb35760405162461bcd60e51b8152600401610c969061449d565b600054610100900460ff16158015611fde576000805460ff1961ff0019909116610100171660011790555b611fec8787878787876133b3565b8015611c49576000805461ff001916905550505050505050565b6000805160206148a683398151915261201f8133610b57565b609a54609c5460405163a9059cbb60e01b81526001600160a01b0391821660048201526024810185905291169063a9059cbb90604401602060405180830381600087803b15801561206f57600080fd5b505af1158015612083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120a79190613f8f565b6120c157634e487b7160e01b600052600160045260246000fd5b609c5460405163f4e480e160e01b81526001600160a01b0386811660048301528581166024830152604482018590529091169063f4e480e190606401610fa0565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610d5257612140816001600160a01b031660146135c3565b61214b8360206135c3565b60405160200161215c9291906142e1565b60408051601f198184030181529082905262461bcd60e51b8252610c969160040161443a565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff16610d525760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556121e03390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff1615610d525760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b0382166000908152609f602052604090205460ff1661231b5760405162461bcd60e51b8152602060048201526024808201527f70726f766964656420636f6e7472616374206973206e6f742077686974656c696044820152631cdd195960e21b6064820152608401610c96565b6001600160a01b0391909116600090815260a060205260409020805460ff1916911515919091179055565b6101c081015160601c600090815260a0602052604090205460ff16156123eb57609c546101c08201516102a083015160e08401516040516303a4f5ed60e31b815260609390931c60048401526001600160a01b039182166024840152604483015290911690631d27af6890606401600060405180830381600087803b1580156123ce57600080fd5b505af11580156123e2573d6000803e3d6000fd5b50505050612475565b609c546101c08201516102a083015160e0840151604051634c62b25760e01b815260609390931c60048401526001600160a01b0391821660248401529216604482018190526064820192909252634c62b257906084015b600060405180830381600087803b15801561245c57600080fd5b505af1158015612470573d6000803e3d6000fd5b505050505b50565b81516000906001600160a01b03166124ae576101c083015160601c83526101e08301516124a6908390611c81565b5090506124c0565b6124bc828460000151611c81565b5090505b609c5483516102a0850151609a54609b546040516304a1d7f960e01b81526001600160a01b039485166004820152928416602484015260448301869052600160a01b90910460ff1615156064830152821660848201529116906304a1d7f99060a401600060405180830381600087803b15801561253c57600080fd5b505af1158015612550573d6000803e3d6000fd5b5050609c546101c08601516102a087015160e08801516040516303a4f5ed60e31b815260609390931c60048401526001600160a01b03918216602484015260448301529091169250631d27af689150606401600060405180830381600087803b1580156125bc57600080fd5b505af11580156125d0573d6000803e3d6000fd5b5050505092915050565b600281610280015151111561269f57609c5460985461028083015160e0840151610100850151610240860151610260870151604051638da6130760e01b81526001600160a01b0397881697638da61307976126429791169590949093909290916004016143aa565b602060405180830381600087803b15801561265c57600080fd5b505af1158015612670573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126949190614155565b610100820152612475565b609c546098546101c08301516101e084015160e085015161010086015161024087015161026088015180516001600160a01b039889169863951db63798169660601c95949392919060009061270457634e487b7160e01b600052603260045260246000fd5b60200260200101516040518863ffffffff1660e01b815260040161272e9796959493929190614356565b602060405180830381600087803b15801561274857600080fd5b505af115801561275c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127809190614155565b61010082015250565b61020081015160601c600090815260a06020526040812054819060ff161561283057609c5461020084015160808501516101208601516040516308f80fd160e31b815260609390931c60048401526001600160a01b0391821660248401526044830152909116906347c07e8890606401600060405180830381600087803b15801561281357600080fd5b505af1158015612827573d6000803e3d6000fd5b50505050612b65565b610220830151609c546040516370a0823160e01b81526001600160a01b03918216600482015260009291909116906370a082319060240160206040518083038186803b15801561287f57600080fd5b505afa158015612893573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b79190614155565b90508361012001518110156129d757609c546102208501516080860151610120870151604051632b9cd63d60e11b81526001600160a01b03938416600482015291831660248301526044820152911690635739ac7a906064015b600060405180830381600087803b15801561292b57600080fd5b505af115801561293f573d6000803e3d6000fd5b5050609c54610220870151604051635fae924560e01b81526001600160a01b03918216600482015291169250635fae92459150602401602060405180830381600087803b15801561298f57600080fd5b505af11580156129a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c79190613cba565b8461012001519250925050612b74565b609a546102208501516001600160a01b0390811691161480156129fc5750836102c001515b15612ae657609c54609a546101208601516040516324c44ed760e21b81526001600160a01b03928316600482015260248101919091529116906393113b5c90604401600060405180830381600087803b158015612a5857600080fd5b505af1158015612a6c573d6000803e3d6000fd5b5050609c546080870151610120880151604051637c4368c160e01b81526001600160a01b039283166004820152602481019190915291169250637c4368c19150604401600060405180830381600087803b158015612ac957600080fd5b505af1158015612add573d6000803e3d6000fd5b50505050612b63565b609c546102208501516080860151610120870151604051630d9aa67b60e31b81526001600160a01b03938416600482015291831660248301526044820152911690636cd533d890606401600060405180830381600087803b158015612b4a57600080fd5b505af1158015612b5e573d6000803e3d6000fd5b505050505b505b50506102208101516101208201515b915091565b609c546102208201516080830151610120840151604051632b9cd63d60e11b81526001600160a01b03938416600482015291831660248301526044820152911690635739ac7a90606401612442565b6102208101516001600160a01b0316600090815260a06020526040812054819060ff1615612c6f57609c546102208401516098546101208601516040516308f80fd160e31b81526001600160a01b039384166004820152918316602483015260448201529116906347c07e8890606401600060405180830381600087803b158015612c5257600080fd5b505af1158015612c66573d6000803e3d6000fd5b50505050612dd0565b610220830151609c546040516370a0823160e01b81526001600160a01b03918216600482015260009291909116906370a082319060240160206040518083038186803b158015612cbe57600080fd5b505afa158015612cd2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cf69190614155565b9050836101200151811015612d5457609c546102208501516080860151610120870151604051632b9cd63d60e11b81526001600160a01b03938416600482015291831660248301526044820152911690635739ac7a90606401612911565b609c54610220850151609854610120870151604051630d9aa67b60e31b81526001600160a01b03938416600482015291831660248301526044820152911690636cd533d890606401600060405180830381600087803b158015612db657600080fd5b505af1158015612dca573d6000803e3d6000fd5b50505050505b6002836102800151511115612f9c57609c5460985461028085015161012086015161014087015161024088015161026089015160405160009788976001600160a01b0391821697638da6130797612e35979390921695909491939091906024016143aa565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051612e6e91906142c5565b6000604051808303816000865af19150503d8060008114612eab576040519150601f19603f3d011682016040523d82523d6000602084013e612eb0565b606091505b50915091508115612ed95780806020019051810190612ecf9190614155565b6060860152612f95565b6098546102208601516080870151610120880151604051636ce5768960e11b81526001600160a01b0393841660048201529183166024830152604482015291169063d9caed1290606401602060405180830381600087803b158015612f3d57600080fd5b505af1158015612f51573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f759190613f8f565b612f7e57600080fd5b846102200151856101200151935093505050612b74565b50506130e0565b600080609c60009054906101000a90046001600160a01b03166001600160a01b031663951db637609860009054906101000a90046001600160a01b031687610220015188610200015160601c8961012001518a61014001518b61024001518c610260015160008151811061302057634e487b7160e01b600052603260045260246000fd5b602002602001015160405160240161303e9796959493929190614356565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161307791906142c5565b6000604051808303816000865af19150503d80600081146130b4576040519150601f19603f3d011682016040523d82523d6000602084013e6130b9565b606091505b50915091508115612ed957808060200190518101906130d89190614155565b606086015250505b609a5461020084015160601c6001600160a01b039091161480156131065750826102c001515b156131ee57609c54609a5460608501516040516324c44ed760e21b81526001600160a01b03928316600482015260248101919091529116906393113b5c90604401600060405180830381600087803b15801561316157600080fd5b505af1158015613175573d6000803e3d6000fd5b5050609c5460808601516060870151604051637c4368c160e01b81526001600160a01b039283166004820152602481019190915291169250637c4368c19150604401600060405180830381600087803b1580156131d157600080fd5b505af11580156131e5573d6000803e3d6000fd5b5050505061326d565b609c546102008401516080850151606080870151604051630d9aa67b60e31b81529390911c60048401526001600160a01b039182166024840152604483015290911690636cd533d890606401600060405180830381600087803b15801561325457600080fd5b505af1158015613268573d6000803e3d6000fd5b505050505b5050610200810151606091820151911c91565b6001600160a01b0381166132d65760405162461bcd60e51b815260206004820152601e60248201527f636f6e747261637420616464726573732063616e2774206265207a65726f00006044820152606401610c96565b6000828152609d6020908152604080832080546001600160a01b039095166001600160a01b031990951685179055928252609e815282822093909355609f9092529020805460ff19166001179055565b6001600160a01b0381166133915760405162461bcd60e51b815260206004820152602c60248201527f455243323048616e646c65723a20636f6e74726163744164647265737320636160448201526b1b9b9bdd081899481b9d5b1b60a21b6064820152608401610c96565b609880546001600160a01b0319166001600160a01b0392909216919091179055565b600054610100900460ff166133ce5760005460ff16156133d2565b303b155b6133ee5760405162461bcd60e51b8152600401610c969061449d565b600054610100900460ff16158015613419576000805460ff1961ff0019909116610100171660011790555b6134216137a5565b613429613812565b82518451146134a05760405162461bcd60e51b815260206004820152603a60248201527f696e697469616c5265736f75726365494473202620696e697469616c436f6e7460448201527f72616374416464726573736573206c656e206d69736d617463680000000000006064820152608401610c96565b609780546001600160a01b03808a166001600160a01b03199283161790925560998054898416908316179055609a805492881692909116919091179055835160005b818110156135545761354286828151811061350d57634e487b7160e01b600052603260045260246000fd5b602002602001015186838151811061353557634e487b7160e01b600052603260045260246000fd5b6020026020010151613280565b8061354c8161482c565b9150506134e2565b50825160005b818110156135a65761359485828151811061358557634e487b7160e01b600052603260045260246000fd5b602002602001015160016122a7565b8061359e8161482c565b91505061355a565b5050508015611c49576000805461ff001916905550505050505050565b606060006135d283600261478c565b6135dd90600261463d565b67ffffffffffffffff81111561360357634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f19166020018201604052801561362d576020820181803683370190505b509050600360fc1b8160008151811061365657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061369357634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060006136b784600261478c565b6136c290600161463d565b90505b6001811115613756576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061370457634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811061372857634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9361374f81614815565b90506136c5565b508315610f205760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c96565b600054610100900460ff166138105760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610c96565b565b600054610100900460ff1661382d5760005460ff1615613831565b303b155b61384d5760405162461bcd60e51b8152600401610c969061449d565b600054610100900460ff16158015613878576000805460ff1961ff0019909116610100171660011790555b6138806137a5565b6138886138cc565b61389360003361394f565b6138ab6000805160206148a68339815191523361394f565b609a805460ff60a01b191690558015612475576000805461ff001916905550565b600054610100900460ff166139375760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608401610c96565b61393f6137a5565b6139476137a5565b6138106137a5565b610d528282612182565b8035610b3d81614873565b600082601f830112613974578081fd5b8135602061398961398483614619565b6145e8565b82815281810190858301838502870184018810156139a5578586fd5b855b858110156139cc5781356139ba81614873565b845292840192908401906001016139a7565b5090979650505050505050565b600082601f8301126139e9578081fd5b813560206139f961398483614619565b8281528181019085830183850287018401881015613a15578586fd5b855b858110156139cc57813584529284019290840190600101613a17565b8035610b3d81614888565b80356bffffffffffffffffffffffff1981168114610b3d57600080fd5b600082601f830112613a6b578081fd5b813567ffffffffffffffff811115613a8557613a8561485d565b613a98601f8201601f19166020016145e8565b818152846020838601011115613aac578283fd5b816020850160208301379081016020019190915292915050565b60006102e0808385031215613ad9578182fd5b613ae2816145e8565b915050613aee82613959565b8152613afc60208301613c86565b60208201526040820135604082015260608201356060820152613b2160808301613959565b6080820152613b3260a08301613959565b60a0820152613b4360c08301613959565b60c082015260e08281013590820152610100808301359082015261012080830135908201526101408083013590820152610160808301359082015261018080830135908201526101a080830135908201526101c0613ba2818401613a3e565b908201526101e0613bb4838201613959565b90820152610200613bc6838201613a3e565b90820152610220613bd8838201613959565b908201526102408281013567ffffffffffffffff80821115613bf957600080fd5b613c05868387016139d9565b83850152610260925082850135915080821115613c2157600080fd5b613c2d868387016139d9565b83850152610280925082850135915080821115613c4957600080fd5b50613c5685828601613964565b8284015250506102a0613c6a818401613959565b908201526102c0613c7c838201613a33565b9082015292915050565b803567ffffffffffffffff81168114610b3d57600080fd5b600060208284031215613caf578081fd5b8135610f2081614873565b600060208284031215613ccb578081fd5b8151610f2081614873565b60008060408385031215613ce8578081fd5b8235613cf381614873565b91506020830135613d0381614873565b809150509250929050565b600080600060608486031215613d22578081fd5b8335613d2d81614873565b92506020840135613d3d81614873565b91506040840135613d4d81614873565b809150509250925092565b60008060008060008060c08789031215613d70578384fd5b8635613d7b81614873565b9550602087810135613d8c81614873565b95506040880135613d9c81614873565b9450606088013567ffffffffffffffff80821115613db8578485fd5b818a0191508a601f830112613dcb578485fd5b8135613dd961398482614619565b81815284810190848601868402860187018f1015613df5578889fd5b8895505b83861015613e17578035835260019590950194918601918601613df9565b509750505060808a0135925080831115613e2f578485fd5b613e3b8b848c01613964565b945060a08a0135925080831115613e50578384fd5b5050613e5e89828a01613964565b9150509295509295509295565b600080600060608486031215613e7f578081fd5b8335613e8a81614873565b92506020840135613e9a81614873565b929592945050506040919091013590565b60008060408385031215613ebd578182fd5b8235613ec881614873565b91506020830135613d0381614888565b60008060408385031215613eea578182fd5b8235613ef581614873565b91506020830135613d0381614896565b600080600060608486031215613f19578081fd5b8335613f2481614873565b92506020840135613e9a81614896565b600080600060608486031215613f48578081fd5b8335613f5381614873565b92506020840135613f6381614896565b91506040840135613d4d81614896565b600060208284031215613f84578081fd5b8135610f2081614888565b600060208284031215613fa0578081fd5b8151610f2081614888565b600060208284031215613fbc578081fd5b5035919050565b60008060408385031215613fd5578182fd5b823591506020830135613d0381614873565b60008060008060808587031215613ffc578182fd5b84359350602085013561400e81614896565b925061401c60408601613c86565b9150606085013567ffffffffffffffff811115614037578182fd5b61404387828801613ac6565b91505092959194509250565b600060208284031215614060578081fd5b81356001600160e01b031981168114610f20578182fd5b600080600080600060a0868803121561408e578283fd5b853567ffffffffffffffff808211156140a5578485fd5b6140b189838a01613a5b565b965060208801359150808211156140c6578485fd5b506140d388828901613a5b565b94505060408601356140e481614896565b925060608601356140f481614873565b9150608086013561410481614873565b809150509295509295909350565b60008060408385031215614124578182fd5b823567ffffffffffffffff81111561413a578283fd5b61414685828601613ac6565b95602094909401359450505050565b600060208284031215614166578081fd5b5051919050565b6000806040838503121561417f578182fd5b505080516020909101519092909150565b600080604083850312156141a2578182fd5b823591506141b260208401613c86565b90509250929050565b600080604083850312156141cd578182fd5b613ef583613c86565b6000602082840312156141e7578081fd5b8151610f2081614896565b60008060408385031215614204578182fd5b8235613cf381614896565b600080600080600060a08688031215614226578283fd5b853561423181614896565b9450602086013561424181614873565b93506040860135925060608601359150608086013561410481614888565b6000815180845260208085019450808401835b8381101561428e57815187529582019590820190600101614272565b509495945050505050565b600081518084526142b18160208601602086016147e5565b601f01601f19169290920160200192915050565b600082516142d78184602087016147e5565b9190910192915050565b60007f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000825283516143198160178501602088016147e5565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161434a8160288401602088016147e5565b01602801949350505050565b60006001600160a01b03808a168352808916602084015280881660408401525085606083015284608083015260e060a083015261439660e083018561425f565b90508260c083015298975050505050505050565b600060c082016001600160a01b03808a168452602060c081860152828a5180855260e087019150828c019450855b818110156143f65785518516835294830194918301916001016143d8565b50508960408701528860608701528581036080870152614416818961425f565b935050505082810360a084015261442d818561425f565b9998505050505050505050565b600060208252610f206020830184614299565b600060a0825261446060a0830188614299565b82810360208401526144728188614299565b60ff96909616604084015250506001600160a01b039283166060820152911660809091015292915050565b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b815160ff1681526101e08101602083015161451160208401826001600160a01b03169052565b50604083015161452c60408401826001600160a01b03169052565b5060608301516060830152608083015161455160808401826001600160a01b03169052565b5060a083015160a083015260c083015161457660c08401826001600160a01b03169052565b5060e083810151908301526101008084015190830152610120808401516001600160a01b039081169184019190915261014080850151821690840152610160808501519084015261018080850151909116908301526101a080840151908301526101c092830151929091019190915290565b604051601f8201601f1916810167ffffffffffffffff811182821017156146115761461161485d565b604052919050565b600067ffffffffffffffff8211156146335761463361485d565b5060209081020190565b6000821982111561465057614650614847565b500190565b60008261467057634e487b7160e01b81526012600452602481fd5b500490565b80825b600180861161468757506146b2565b81870482111561469957614699614847565b808616156146a657918102915b9490941c938002614678565b94509492505050565b6000610f2060001960ff8516846000826146d757506001610f20565b816146e457506000610f20565b81600181146146fa576002811461470457614731565b6001915050610f20565b60ff84111561471557614715614847565b6001841b91508482111561472b5761472b614847565b50610f20565b5060208310610133831016604e8410600b8410161715614764575081810a8381111561475f5761475f614847565b610f20565b6147718484846001614675565b80860482111561478357614783614847565b02949350505050565b60008160001904831182151516156147a6576147a6614847565b500290565b6000828210156147bd576147bd614847565b500390565b600060ff821660ff8416808210156147dc576147dc614847565b90039392505050565b60005b838110156148005781810151838201526020016147e8565b8381111561480f576000848401525b50505050565b60008161482457614824614847565b506000190190565b600060001982141561484057614840614847565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461247557600080fd5b801515811461247557600080fd5b60ff8116811461247557600080fdfe52ba824bfabc2bcfcdf7f0edbb486ebb05e1836c90e78047efeb949990f72e5fa164736f6c6343000802000a

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.