ETH Price: $2,412.90 (+1.25%)

Contract

0xED8877f8536781d2FC40C1E0054cbeB8fD960Ee4

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Sponsored

Transaction Hash
Method
Block
From
To
0x60806040386577902022-11-16 9:20:22688 days ago1668590422IN
 Create: ExecutionNode
0 ETH0.0039896851040.001

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ExecutionNode

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 29 : ExecutionNode.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";

import "./lib/Types.sol";
import "./lib/MessageReceiver.sol";
import "./lib/Pauser.sol";
import "./lib/NativeWrap.sol";
import "./lib/Bytes.sol";

import "./interfaces/IBridgeAdapter.sol";
import "./interfaces/ICodec.sol";
import "./interfaces/IExecutionNodeEvents.sol";
import "./interfaces/IWETH.sol";
import "./interfaces/IMessageBus.sol";

import "./BridgeRegistry.sol";
import "./FeeOperator.sol";
import "./SigVerifier.sol";
import "./Pocket.sol";
import "./DexRegistry.sol";

/**
 * @author Chainhop Dex Team
 * @author Padoriku
 * @title a route execution contract
 * @notice
 * a few key concepts about how the chain of execution works:
 * - a "swap-bridge execution combo" (Types.ExecutionInfo) is a node in the execution chain
 * - a node be swap-only, bridge-only, or swap-bridge
 * - a message is an edge in the execution chain, it carries the remaining swap-bridge combos to the next node
 * - execute() executes a swap-bridge combo and determines if the current node is the final one by looking at Types.DestinationInfo
 * - executeMessage() is called on the intermediate nodes by chainhop's executor. it simply calls execute() to advance the execution chain
 * - a "pocket" is a counterfactual contract of which the address is determined at quote-time by chainhop's pathfinder server with using
 * the id as salt. the actual pocket contract deployment is done at execution time by the the ExecutionNode on that chain
 */
contract ExecutionNode is
    IExecutionNodeEvents,
    MessageReceiver,
    DexRegistry,
    BridgeRegistry,
    SigVerifier,
    FeeOperator,
    NativeWrap,
    ReentrancyGuard,
    Pauser
{
    using SafeERC20 for IERC20;
    using ECDSA for bytes32;
    using Bytes for bytes;

    constructor(
        bool _testMode,
        address _messageBus,
        address _nativeWrap
    ) MessageReceiver(_testMode, _messageBus) NativeWrap(_nativeWrap) {}

    // init() can only be called once during the first deployment of the proxy contract.
    // any subsequent changes to the proxy contract's state must be done through their respective set methods via owner key.
    function init(
        bool _testMode,
        address _messageBus,
        address _nativeWrap,
        address _signer,
        address _feeCollector,
        address[] memory _dexList,
        string[] memory _funcs,
        address[] memory _codecs,
        string[] memory _bridgeProviders,
        address[] memory _bridgeAdapters
    ) external initializer {
        initOwner();
        initMessageReceiver(_testMode, _messageBus);
        initDexRegistry(_dexList, _funcs, _codecs);
        initBridgeRegistry(_bridgeProviders, _bridgeAdapters);
        initSigVerifier(_signer);
        initFeeOperator(_feeCollector);
        initNativeWrap(_nativeWrap);
    }

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * Core
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

    /**
     * @notice executes a swap-bridge combo and relays the next swap-bridge combo to the next chain (if any)
     * @param _id an id that is unique per user-swap. persistent for the entire operation. also used as salt for the pocket contract
     * id = keccak256(abi.encodePacked(sender, receiver, nonce))
     * @param _execs contains info that tells this contract how to collect a part of the bridge token
     * received as fee and how to swap can be omitted on the source chain if there is no swaps to execute
     * @param _src info that is processed on the source chain. only required on the source chain and should not be populated on subsequent hops
     * @param _dst the receiving info of the entire operation
     */
    function execute(
        bytes32 _id,
        Types.ExecutionInfo[] memory _execs,
        Types.SourceInfo memory _src,
        Types.DestinationInfo memory _dst
    ) public payable nonReentrant whenNotPaused returns (uint256 remainingValue) {
        require(_execs.length > 0, "nop");

        Types.ExecutionInfo memory exec;
        (exec, _execs) = _popFirst(_execs);

        remainingValue = msg.value;

        // pull funds
        uint256 amountIn;
        address tokenIn;
        if (_src.chainId == _chainId()) {
            // if there are more executions on other chains, verify sig so that we are sure the fees
            // to be collected will not be tempered with when we run those executions
            // note that quote sig verification is only done on the src chain. the security of each
            // subsequent execution's fee collection is dependant on the security of cbridge's IM
            if (_execs.length > 0) {
                _verify(_execs, _src, _dst);
            }
            (amountIn, tokenIn) = _pullFundFromSender(_src);
            if (_src.nativeIn) {
                remainingValue -= amountIn;
            }
        } else {
            (amountIn, tokenIn) = _pullFundFromPocket(_id, exec);
            // if amountIn is 0 after deducting fee, this contract keeps all amountIn as fee and
            // ends the execution
            if (amountIn == 0) {
                emit StepExecuted(_id, 0, tokenIn);
                return remainingValue;
            }
            // refund immediately if receives bridge out fallback token
            if (tokenIn == exec.bridgeOutFallbackToken) {
                _sendToken(tokenIn, amountIn, _dst.receiver, false);
                emit StepExecuted(_id, amountIn, tokenIn);
                return remainingValue;
            }
        }

        // process swap if any
        uint256 nextAmount = amountIn;
        address nextToken = tokenIn;
        if (exec.swap.dex != address(0)) {
            bool success = true;
            (success, nextAmount, nextToken) = _executeSwap(exec.swap, amountIn, tokenIn);
            if (_src.chainId == _chainId()) require(success, "swap fail");
            // refund immediately if swap fails
            if (!success) {
                _sendToken(tokenIn, amountIn, _dst.receiver, false);
                emit StepExecuted(_id, amountIn, tokenIn);
                return remainingValue;
            }
        }

        // pay receiver if this is the last execution step
        if (_dst.chainId == _chainId()) {
            _sendToken(nextToken, nextAmount, _dst.receiver, _dst.nativeOut);
            emit StepExecuted(_id, nextAmount, nextToken);
            return remainingValue;
        }

        // funds are bridged directly to the receiver if there are no subsequent executions on the destination chain.
        // otherwise, it's sent to a "pocket" contract addr to temporarily hold the fund before it is used for swapping.
        address bridgeOutReceiver = (_execs.length > 0) ? _getPocketAddr(_id, exec.remoteExecutionNode) : _dst.receiver;
        _bridgeSend(exec.bridge, bridgeOutReceiver, nextToken, nextAmount);
        remainingValue -= exec.bridge.nativeFee;

        // if there are more execution steps left, pack them and send to the next chain
        if (_execs.length > 0) {
            bytes memory message = abi.encode(Types.Message({id: _id, execs: _execs, dst: _dst}));
            uint256 msgFee = IMessageBus(messageBus).calcFee(message);
            remainingValue -= msgFee;
            IMessageBus(messageBus).sendMessage{value: msgFee}(
                exec.remoteExecutionNode,
                exec.bridge.toChainId,
                message
            );
        }

        emit StepExecuted(_id, nextAmount, nextToken);
    }

    /**
     * @notice called by cBridge MessageBus and then simply calls execute() to carry on the executions
     * @param _message the message that contains the remaining swap-bridge combos to be executed
     * @return executionStatus always success if no reverts to let the MessageBus know that the message is processed
     */
    function executeMessage(
        address, // _sender
        uint64, // _srcChainId
        bytes memory _message,
        address // _executor
    ) external payable override onlyMessageBus returns (ExecutionStatus) {
        Types.Message memory message = abi.decode((_message), (Types.Message));
        uint256 remainingValue = execute(message.id, message.execs, Types.emptySourceInfo(), message.dst);
        // chainhop executor would always send a set amount of native token when calling messagebus's executeMessage().
        // these tokens cover the fee introduced by chaining another message when there are more bridging.
        // refunding the unspent native tokens back to the executor
        if (remainingValue > 0) {
            (bool ok, ) = tx.origin.call{value: remainingValue}("");
            require(ok, "failed to refund remaining native token");
        }
        return ExecutionStatus.Success;
    }

    // the receiver of a swap is entitled to all the funds in the pocket. as long as someone can prove
    // that they are the receiver of a swap, they can always recreate the pocket contract and claim the
    // funds inside.
    function claimPocketFund(
        address _sender,
        address _receiver,
        uint64 _nonce,
        address _token
    ) external {
        require(msg.sender == _receiver, "only receiver can claim");
        // id ensures that only the designated receiver of a swap can claim funds from the designated pocket of a swap
        bytes32 id = _computeId(_sender, _receiver, _nonce);

        Pocket pocket = new Pocket{salt: id}();
        uint256 erc20Amount = IERC20(_token).balanceOf(address(pocket));
        uint256 nativeAmount = address(pocket).balance;
        require(erc20Amount > 0 || nativeAmount > 0, "pocket is empty");

        // this claims both _token and native
        pocket.claim(_token, erc20Amount);

        if (erc20Amount > 0) {
            IERC20(_token).safeTransfer(_receiver, erc20Amount);
        }
        if (nativeAmount > 0) {
            (bool ok, ) = _receiver.call{value: nativeAmount, gas: 50000}("");
            require(ok, "failed to send native");
        }
        emit PocketFundClaimed(_receiver, erc20Amount, _token, nativeAmount);
    }

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * Misc
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    function _computeId(
        address _sender,
        address _dstReceiver,
        uint64 _nonce
    ) private pure returns (bytes32) {
        // the main purpose of this id is to uniquely identify a user-swap.
        return keccak256(abi.encodePacked(_sender, _dstReceiver, _nonce));
    }

    function _pullFundFromSender(Types.SourceInfo memory _src) private returns (uint256 amount, address token) {
        if (_src.nativeIn) {
            require(_src.tokenIn == nativeWrap, "tokenIn not nativeWrap");
            require(msg.value >= _src.amountIn, "insufficient native amount");
            IWETH(nativeWrap).deposit{value: _src.amountIn}();
        } else {
            IERC20(_src.tokenIn).safeTransferFrom(msg.sender, address(this), _src.amountIn);
        }
        return (_src.amountIn, _src.tokenIn);
    }

    function _pullFundFromPocket(bytes32 _id, Types.ExecutionInfo memory _exec)
        private
        returns (uint256 amount, address token)
    {
        Pocket pocket = new Pocket{salt: _id}();

        uint256 fallbackAmount;
        if (_exec.bridgeOutFallbackToken != address(0)) {
            fallbackAmount = IERC20(_exec.bridgeOutFallbackToken).balanceOf(address(pocket)); // e.g. hToken/anyToken
        }
        uint256 erc20Amount = IERC20(_exec.bridgeOutToken).balanceOf(address(pocket));
        uint256 nativeAmount = address(pocket).balance;

        // if the pocket does not have bridgeOutMin, we consider the transfer not arrived yet. in
        // this case we tell the msgbus to revert the outter tx using the MSG::ABORT: prefix and
        // our executor will retry sending this tx later.
        //
        // this bridgeOutMin is also a counter-measure to a DoS attack vector. if we assume the bridge
        // funds have arrived once we see a balance in the pocket, an attacker can deposit a small
        // amount of fund into the pocket and confuse this contract that the bridged fund has arrived.
        // this triggers the refund logic branch and thus denying the dst swap for the victim.
        // bridgeOutMin is determined by the server before sending out the transfer.
        // bridgeOutMin = R * bridgeAmountIn where R is an arbitrary ratio that we feel effective in
        // raising the attacker's attack cost.
        require(
            erc20Amount > _exec.bridgeOutMin ||
                nativeAmount > _exec.bridgeOutMin ||
                fallbackAmount > _exec.bridgeOutFallbackMin,
            "MSG::ABORT:pocket is empty"
        );
        if (fallbackAmount > 0) {
            pocket.claim(_exec.bridgeOutFallbackToken, fallbackAmount);
            amount = _deductFee(_exec.feeInBridgeOutFallbackToken, fallbackAmount);
            token = _exec.bridgeOutFallbackToken;
        } else {
            pocket.claim(_exec.bridgeOutToken, erc20Amount);
            if (erc20Amount > 0) {
                amount = _deductFee(_exec.feeInBridgeOutToken, erc20Amount);
            } else if (nativeAmount > 0) {
                require(_exec.bridgeOutToken == nativeWrap, "bridgeOutToken not nativeWrap");
                amount = _deductFee(_exec.feeInBridgeOutToken, nativeAmount);
                IWETH(_exec.bridgeOutToken).deposit{value: amount}();
            }
            token = _exec.bridgeOutToken;
        }
    }

    function _getPocketAddr(bytes32 _salt, address _deployer) private pure returns (address) {
        // how to predict a create2 address:
        // https://docs.soliditylang.org/en/v0.8.17/control-structures.html?highlight=create2#salted-contract-creations-create2
        bytes32 hash = keccak256(
            abi.encodePacked(bytes1(0xff), _deployer, _salt, keccak256(type(Pocket).creationCode))
        );
        return address(uint160(uint256(hash)));
    }

    function _deductFee(uint256 _fee, uint256 _amount) private pure returns (uint256 amount) {
        // handle the case where amount received is not enough to pay fee
        if (_amount >= _fee) {
            amount = _amount - _fee;
        }
    }

    function _bridgeSend(
        Types.BridgeInfo memory _bridge,
        address _receiver,
        address _token,
        uint256 _amount
    ) private {
        IBridgeAdapter bridge = bridges[keccak256(bytes(_bridge.bridgeProvider))];
        IERC20(_token).safeIncreaseAllowance(address(bridge), _amount);
        bridge.bridge{value: _bridge.nativeFee}(_bridge.toChainId, _receiver, _amount, _token, _bridge.bridgeParams);
    }

    function _executeSwap(
        ICodec.SwapDescription memory _swap,
        uint256 _amountIn,
        address _tokenIn
    )
        private
        returns (
            bool ok,
            uint256 amountOut,
            address tokenOut
        )
    {
        if (_swap.dex == address(0)) {
            // nop swap
            return (true, _amountIn, _tokenIn);
        }
        bytes4 selector = bytes4(_swap.data);
        ICodec codec = getCodec(_swap.dex, selector);
        address tokenIn;
        (, tokenIn, tokenOut) = codec.decodeCalldata(_swap);
        require(tokenIn == _tokenIn, "swap info mismatch");

        bytes memory data = codec.encodeCalldataWithOverride(_swap.data, _amountIn, address(this));
        IERC20(tokenIn).safeIncreaseAllowance(_swap.dex, _amountIn);
        uint256 balBefore = IERC20(tokenOut).balanceOf(address(this));
        (bool success, ) = _swap.dex.call(data);
        if (!success) {
            return (false, 0, tokenOut);
        }
        uint256 balAfter = IERC20(tokenOut).balanceOf(address(this));
        return (true, balAfter - balBefore, tokenOut);
    }

    function _sendToken(
        address _token,
        uint256 _amount,
        address _receiver,
        bool _nativeOut
    ) private {
        if (_nativeOut) {
            require(_token == nativeWrap, "token is not nativeWrap");
            IWETH(nativeWrap).withdraw(_amount);
            (bool sent, ) = _receiver.call{value: _amount, gas: 50000}("");
            require(sent, "send fail");
        } else {
            IERC20(_token).safeTransfer(_receiver, _amount);
        }
    }

    function _popFirst(Types.ExecutionInfo[] memory _execs)
        private
        pure
        returns (Types.ExecutionInfo memory first, Types.ExecutionInfo[] memory rest)
    {
        require(_execs.length > 0, "empty execs");
        first = _execs[0];
        rest = new Types.ExecutionInfo[](_execs.length - 1);
        for (uint256 i = 1; i < _execs.length; i++) {
            rest[i - 1] = _execs[i];
        }
    }

    function _verify(
        Types.ExecutionInfo[] memory _execs, // all execs except the one on the src chain
        Types.SourceInfo memory _src,
        Types.DestinationInfo memory _dst
    ) private view {
        require(_src.deadline > block.timestamp, "deadline exceeded");
        bytes memory data = abi.encodePacked(
            "chainhop quote",
            uint64(block.chainid),
            _dst.chainId,
            _src.amountIn,
            _src.tokenIn,
            _src.deadline
        );
        for (uint256 i = 0; i < _execs.length; i++) {
            Types.ExecutionInfo memory e = _execs[i];
            // bridged tokens and the chain id of the execution are encoded in the sig data so that
            // no malicious user can temper the fee they have to pay on any execution steps
            bytes memory execData = abi.encodePacked(
                e.chainId,
                e.feeInBridgeOutToken,
                e.bridgeOutToken,
                e.feeInBridgeOutFallbackToken,
                e.bridgeOutFallbackToken,
                // native fee also needs to be agreed upon by chainhop for any subsequent bridge
                // since the fee is provided by chainhop's executor
                e.bridge.nativeFee
            );
            data = data.concat(execData);
        }
        bytes32 signHash = keccak256(data).toEthSignedMessageHash();
        verifySig(signHash, _src.quoteSig);
    }

    function _chainId() private view returns (uint64) {
        return uint64(block.chainid);
    }
}

File 2 of 29 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

File 4 of 29 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

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

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

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

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

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

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

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

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

        return (signer, RecoverError.NoError);
    }

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

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

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

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

File 5 of 29 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 6 of 29 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/Address.sol";

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

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

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

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

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original
     * initialization step. This is essential to configure modules that are added through upgrades and that require
     * initialization.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

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

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

File 7 of 29 : Types.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.15;

import "./MsgDataTypes.sol";
import "../interfaces/ICodec.sol";

library Types {
    struct SourceInfo {
        uint64 chainId;
        // A number unique enough to be used in request ID generation.
        uint64 nonce;
        // the unix timestamp before which the fee is valid
        uint64 deadline;
        // sig of sha3("executor fee", srcChainId, amountIn, tokenIn, deadline, toChainId, feeInBridgeOutToken, bridgeOutToken, feeInBridgeOutFallbackToken, bridgeOutFallbackToken[, toChainId, feeInBridgeOutToken, bridgeOutToken, feeInBridgeOutFallbackToken, bridgeOutFallbackToken]...)
        // see _verifyQuote()
        bytes quoteSig;
        uint256 amountIn;
        address tokenIn;
        bool nativeIn;
    }

    function emptySourceInfo() internal pure returns (SourceInfo memory) {
        return SourceInfo(0, 0, 0, "", 0, address(0), false);
    }

    struct DestinationInfo {
        uint64 chainId;
        // The receiving party (the user) of the final output token
        // note that if an organization user's private key is breached, and if their original receiver is a contract
        // address, the hacker could deploy a malicious contract with the same address on the different chain and hence
        // get access to the user's pocket funds on that chain.
        // WARNING users should make sure their own deployer key's safety or that the receiver is
        // 1. not a reproducable address on any of the chains that chainhop supports
        // 2. a contract that they already deployed on all the chains that chainhop supports
        // 3. an EOA
        address receiver;
        bool nativeOut;
    }

    struct ExecutionInfo {
        uint64 chainId;
        ICodec.SwapDescription swap;
        BridgeInfo bridge;
        address remoteExecutionNode;
        address bridgeOutToken;
        // some bridges utilize a intermediary token (e.g. hToken for Hop and anyToken for Multichain)
        // in cases where there isn't enough underlying token liquidity on the dst chain, the user/pocket
        // could receive this token as a fallback. remote ExecutionNode needs to know what this token is
        // in order to check whether a fallback has happened and refund the user.
        address bridgeOutFallbackToken;
        // the minimum that remote ExecutionNode needs to receive in order to allow the swap message
        // to execute. note that this differs from a normal slippages controlling variable and is
        // purely used to deter DoS attacks (detailed in ExecutionNode).
        uint256 bridgeOutMin;
        uint256 bridgeOutFallbackMin;
        // executor fee
        uint256 feeInBridgeOutToken;
        // in case the bridging result in in fallback tokens, this is the amount of the fee that
        // chainhop charges
        uint256 feeInBridgeOutFallbackToken;
    }

    struct BridgeInfo {
        uint64 toChainId;
        // bridge provider identifier
        string bridgeProvider;
        // Bridge transfers quoted and abi encoded by chainhop backend server.
        // Bridge adapter implementations need to decode this themselves.
        bytes bridgeParams;
        // the native fee required by the bridge provider
        uint256 nativeFee;
    }

    struct Message {
        bytes32 id;
        Types.ExecutionInfo[] execs;
        Types.DestinationInfo dst;
    }
}

File 8 of 29 : MessageReceiver.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.15;

import "./Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";

import "../interfaces/IMessageReceiver.sol";

abstract contract MessageReceiver is IMessageReceiver, Ownable, Initializable {
    event MessageBusUpdated(address messageBus);

    // testMode is used for the ease of testing functions with the "onlyMessageBus" modifier.
    // WARNING: when testMode is true, ANYONE can call executeMessage functions
    // this variable can only be set during contract construction and is always not set on mainnets
    bool public testMode;

    address public messageBus;

    constructor(bool _testMode, address _messageBus) {
        testMode = _testMode;
        messageBus = _messageBus;
    }

    function initMessageReceiver(bool _testMode, address _msgbus) internal onlyInitializing {
        require(!_testMode || block.chainid == 31337); // only allow testMode on hardhat local network
        testMode = _testMode;
        messageBus = _msgbus;
        emit MessageBusUpdated(messageBus);
    }

    function setMessageBus(address _msgbus) public onlyOwner {
        messageBus = _msgbus;
        emit MessageBusUpdated(messageBus);
    }

    modifier onlyMessageBus() {
        if (!testMode) {
            require(msg.sender == messageBus, "caller is not message bus");
        }
        _;
    }

    /**
     * @notice Called by MessageBus (MessageBusReceiver)
     * @param _sender The address of the source app contract
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessage(
        address _sender,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable virtual returns (ExecutionStatus) {}

    /**
     * @notice Called by MessageBus (MessageBusReceiver) to process refund of the original transfer from this contract
     * @param _token The token address of the original transfer
     * @param _amount The amount of the original transfer
     * @param _message The same message associated with the original transfer
     */
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message
    ) external payable virtual returns (bool) {}
}

File 9 of 29 : Pauser.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "@openzeppelin/contracts/security/Pausable.sol";
import "./Ownable.sol";

abstract contract Pauser is Ownable, Pausable {
    mapping(address => bool) public pausers;

    event PauserAdded(address account);
    event PauserRemoved(address account);

    constructor() {
        _addPauser(msg.sender);
    }

    modifier onlyPauser() {
        require(isPauser(msg.sender), "Caller is not pauser");
        _;
    }

    function pause() public onlyPauser {
        _pause();
    }

    function unpause() public onlyPauser {
        _unpause();
    }

    function isPauser(address account) public view returns (bool) {
        return pausers[account];
    }

    function addPauser(address account) public onlyOwner {
        _addPauser(account);
    }

    function removePauser(address account) public onlyOwner {
        _removePauser(account);
    }

    function renouncePauser() public {
        _removePauser(msg.sender);
    }

    function _addPauser(address account) private {
        require(!isPauser(account), "Account is already pauser");
        pausers[account] = true;
        emit PauserAdded(account);
    }

    function _removePauser(address account) private {
        require(isPauser(account), "Account is not pauser");
        pausers[account] = false;
        emit PauserRemoved(account);
    }
}

File 10 of 29 : NativeWrap.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "./Ownable.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";

abstract contract NativeWrap is Ownable, Initializable {
    address public nativeWrap;

    event NativeWrapUpdated(address nativeWrap);

    constructor(address _nativeWrap) {
        nativeWrap = _nativeWrap;
    }

    function initNativeWrap(address _nativeWrap) internal onlyInitializing {
        _setNativeWrap(_nativeWrap);
    }

    function setNativeWrap(address _nativeWrap) external onlyOwner {
        _setNativeWrap(_nativeWrap);
    }

    function _setNativeWrap(address _nativeWrap) private {
        nativeWrap = _nativeWrap;
        emit NativeWrapUpdated(_nativeWrap);
    }

    receive() external payable {}
}

File 11 of 29 : Bytes.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

library Bytes {
    uint256 internal constant WORD_SIZE = 32;

    function concat(bytes memory self, bytes memory other) internal pure returns (bytes memory) {
        bytes memory ret = new bytes(self.length + other.length);
        (uint256 src, uint256 srcLen) = fromBytes(self);
        (uint256 src2, uint256 src2Len) = fromBytes(other);
        (uint256 dest, ) = fromBytes(ret);
        uint256 dest2 = dest + srcLen;
        copy(src, dest, srcLen);
        copy(src2, dest2, src2Len);
        return ret;
    }

    function fromBytes(bytes memory bts) internal pure returns (uint256 addr, uint256 len) {
        len = bts.length;
        assembly {
            addr := add(bts, 32)
        }
    }

    function copy(
        uint256 src,
        uint256 dest,
        uint256 len
    ) internal pure {
        // Copy word-length chunks while possible
        for (; len >= WORD_SIZE; len -= WORD_SIZE) {
            assembly {
                mstore(dest, mload(src))
            }
            dest += WORD_SIZE;
            src += WORD_SIZE;
        }

        if (len == 0) return;

        // Copy remaining bytes
        uint256 mask = 256**(WORD_SIZE - len) - 1;
        assembly {
            let srcpart := and(mload(src), not(mask))
            let destpart := and(mload(dest), mask)
            mstore(dest, or(destpart, srcpart))
        }
    }
}

File 12 of 29 : IBridgeAdapter.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

interface IBridgeAdapter {
    function bridge(
        uint64 _dstChainId,
        // the address that the fund is transfered to on the destination chain
        address _receiver,
        uint256 _amount,
        address _token,
        // Bridge transfers quoted and abi encoded by chainhop backend server.
        // Bridge adapter implementations need to decode this themselves.
        bytes memory _bridgeParams
    ) external payable returns (bytes memory bridgeResp);
}

File 13 of 29 : ICodec.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

interface ICodec {
    struct SwapDescription {
        address dex; // the DEX to use for the swap, zero address implies no swap needed
        bytes data; // the data to call the dex with
    }

    function decodeCalldata(SwapDescription calldata swap)
        external
        view
        returns (
            uint256 amountIn,
            address tokenIn,
            address tokenOut
        );

    function encodeCalldataWithOverride(
        bytes calldata data,
        uint256 amountInOverride,
        address receiverOverride
    ) external pure returns (bytes memory swapCalldata);
}

File 14 of 29 : IExecutionNodeEvents.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.15;

import "../lib/Types.sol";

interface IExecutionNodeEvents {
    /**
     * @notice Emitted when operations on dst chain is done.
     * @param id see _computeId()
     * @param amountOut the amount of tokenOut from this step
     * @param tokenOut the token that is outputted from this step
     */
    event StepExecuted(bytes32 id, uint256 amountOut, address tokenOut);

    event PocketFundClaimed(address receiver, uint256 erc20Amount, address token, uint256 nativeAmount);
}

File 15 of 29 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

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

interface IWETH is IERC20 {
    function deposit() external payable;

    function withdraw(uint256) external;
}

File 16 of 29 : IMessageBus.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

import "../lib/MsgDataTypes.sol";

interface IMessageBus {
    event Executed(
        MsgDataTypes.MsgType msgType,
        bytes32 msgId,
        MsgDataTypes.TxStatus status,
        address indexed receiver,
        uint64 srcChainId,
        bytes32 srcTxHash
    );

    function liquidityBridge() external view returns (address);

    function pegBridge() external view returns (address);

    function pegBridgeV2() external view returns (address);

    function pegVault() external view returns (address);

    function pegVaultV2() external view returns (address);

    function feeBase() external view returns (uint256);

    function feePerByte() external view returns (uint256);

    /**
     * @notice Calculates the required fee for the message.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     @ @return The required fee.
     */
    function calcFee(bytes calldata _message) external view returns (uint256);

    /**
     * @notice Sends a message to an app on another chain via MessageBus without an associated transfer.
     * A fee is charged in the native gas token.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     */
    function sendMessage(
        address _receiver,
        uint256 _dstChainId,
        bytes calldata _message
    ) external payable;

    /**
     * @notice Sends a message associated with a transfer to an app on another chain via MessageBus without an associated transfer.
     * A fee is charged in the native token.
     * @param _receiver The address of the destination app contract.
     * @param _dstChainId The destination chain ID.
     * @param _srcBridge The bridge contract to send the transfer with.
     * @param _srcTransferId The transfer ID.
     * @param _dstChainId The destination chain ID.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     */
    function sendMessageWithTransfer(
        address _receiver,
        uint256 _dstChainId,
        address _srcBridge,
        bytes32 _srcTransferId,
        bytes calldata _message
    ) external payable;

    /**
     * @notice Withdraws message fee in the form of native gas token.
     * @param _account The address receiving the fee.
     * @param _cumulativeFee The cumulative fee credited to the account. Tracked by SGN.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A withdrawal must be
     * signed-off by +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function withdrawFee(
        address _account,
        uint256 _cumulativeFee,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    /**
     * @notice Execute a message with a successful transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _transfer The transfer info.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessageWithTransfer(
        bytes calldata _message,
        MsgDataTypes.TransferInfo calldata _transfer,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;

    /**
     * @notice Execute a message with a refunded transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _transfer The transfer info.
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessageWithTransferRefund(
        bytes calldata _message, // the same message associated with the original transfer
        MsgDataTypes.TransferInfo calldata _transfer,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;

    /**
     * @notice Execute a message not associated with a transfer.
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _sigs The list of signatures sorted by signing addresses in ascending order. A relay must be signed-off by
     * +2/3 of the sigsVerifier's current signing power to be delivered.
     * @param _signers The sorted list of signers.
     * @param _powers The signing powers of the signers.
     */
    function executeMessage(
        bytes calldata _message,
        MsgDataTypes.RouteInfo calldata _route,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external payable;
}

File 17 of 29 : BridgeRegistry.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

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

import "./interfaces/IBridgeAdapter.sol";

import "./lib/Ownable.sol";

/**
 * @title Manages a list of supported bridges
 * @author lionelhoho
 * @author Padoriku
 */
abstract contract BridgeRegistry is Ownable, Initializable {
    event SupportedBridgesUpdated(string[] providers, address[] adapters);

    bytes32 public constant CBRIDGE_PROVIDER_HASH = keccak256(bytes("cbridge"));

    mapping(bytes32 => IBridgeAdapter) public bridges;

    function initBridgeRegistry(string[] memory _providers, address[] memory _adapters) internal onlyInitializing {
        _setSupportedbridges(_providers, _adapters);
    }

    // to disable a bridge, set the bridge addr of the corresponding provider to address(0)
    function setSupportedBridges(string[] memory _providers, address[] memory _adapters) external onlyOwner {
        _setSupportedbridges(_providers, _adapters);
    }

    function _setSupportedbridges(string[] memory _providers, address[] memory _adapters) private {
        require(_providers.length == _adapters.length, "params size mismatch");
        for (uint256 i = 0; i < _providers.length; i++) {
            bridges[keccak256(bytes(_providers[i]))] = IBridgeAdapter(_adapters[i]);
        }
        emit SupportedBridgesUpdated(_providers, _adapters);
    }
}

File 18 of 29 : FeeOperator.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";

import "./lib/Ownable.sol";

/**
 * @title Allows the owner to set fee collector and allows fee collectors to collect fees
 * @author Padoriku
 */
abstract contract FeeOperator is Ownable, Initializable {
    using SafeERC20 for IERC20;

    address public feeCollector;

    event FeeCollectorUpdated(address from, address to);

    modifier onlyFeeCollector() {
        require(msg.sender == feeCollector, "not fee collector");
        _;
    }

    function initFeeOperator(address _feeCollector) internal onlyInitializing {
        _setFeeCollector(_feeCollector);
    }

    function collectFee(address[] calldata _tokens, address _to) external onlyFeeCollector {
        for (uint256 i = 0; i < _tokens.length; i++) {
            // use zero address to denote native token
            if (_tokens[i] == address(0)) {
                uint256 bal = address(this).balance;
                (bool sent, ) = _to.call{value: bal, gas: 50000}("");
                require(sent, "send native failed");
            } else {
                uint256 balance = IERC20(_tokens[i]).balanceOf(address(this));
                IERC20(_tokens[i]).safeTransfer(_to, balance);
            }
        }
    }

    function setFeeCollector(address _feeCollector) external onlyOwner {
        _setFeeCollector(_feeCollector);
    }

    function _setFeeCollector(address _feeCollector) private {
        address oldFeeCollector = feeCollector;
        feeCollector = _feeCollector;
        emit FeeCollectorUpdated(oldFeeCollector, _feeCollector);
    }
}

File 19 of 29 : SigVerifier.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/proxy/utils/Initializable.sol";

import "./lib/Ownable.sol";

/**
 * @title Allows owner to set signer, and verifies signatures
 * @author Padoriku
 */
contract SigVerifier is Ownable, Initializable {
    using ECDSA for bytes32;

    address public signer;

    event SignerUpdated(address from, address to);

    function initSigVerifier(address _signer) internal onlyInitializing {
        _setSigner(_signer);
    }

    function setSigner(address _signer) public onlyOwner {
        _setSigner(_signer);
    }

    function _setSigner(address _signer) private {
        address oldSigner = signer;
        signer = _signer;
        emit SignerUpdated(oldSigner, _signer);
    }

    function verifySig(bytes32 _hash, bytes memory _feeSig) internal view {
        address _signer = _hash.recover(_feeSig);
        require(_signer == signer, "invalid signer");
    }
}

File 20 of 29 : Pocket.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity 0.8.15;

// the pocket is a contract that is to be created conterfactually on the dst chain in the scenario where
// there is a dst swap. the main problem the pocket tries to solve is to gain the ability to know when and
// by how much the bridged tokens are received.
// when chainhop backend builds a cross-chain swap, it calculates a swap id (see _computeSwapId in
// ExecutionNode) and the id is used as the salt in generating a pocket address on the dst chain.
// this address is then assigned as the receiver of the bridge out tokens on the dst chain to temporarily
// hold the funds until the actual pocket contract is deployed at the exact address during the message execution.
contract Pocket {
    function claim(address _token, uint256 _amt) external {
        address sender = msg.sender;
        _token.call(abi.encodeWithSelector(0xa9059cbb, sender, _amt));
        assembly {
            // selfdestruct sends all native balance to sender
            selfdestruct(sender)
        }
    }
}

File 21 of 29 : DexRegistry.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

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

import "./interfaces/ICodec.sol";

import "./lib/Ownable.sol";

/**
 * @title Manages a list supported dex
 * @author Padoriku
 */
abstract contract DexRegistry is Ownable, Initializable {
    event DexCodecUpdated(address dex, bytes4 selector, address codec);

    // supported swap functions
    // 0x3df02124 exchange(int128,int128,uint256,uint256)
    // 0xa6417ed6 exchange_underlying(int128,int128,uint256,uint256)
    // 0x44ee1986 exchange_underlying(int128,int128,uint256,uint256,address)
    // 0x38ed1739 swapExactTokensForTokens(uint256,uint256,address[],address,uint256)
    // 0xc04b8d59 exactInput((bytes,address,uint256,uint256,uint256))
    // 0xb0431182 clipperSwap(address,address,uint256,uint256)
    // 0xe449022e uniswapV3Swap(uint256,uint256,uint256[])
    // 0x2e95b6c8 unoswap(address,uint256,uint256,bytes32[])
    // 0x7c025200 swap(address,(address,address,address,address,uint256,uint256,uint256,bytes),bytes)
    // 0xd0a3b665 fillOrderRFQ((uint256,address,address,address,address,uint256,uint256),bytes,uint256,uint256)
    mapping(address => mapping(bytes4 => address)) public dexFunc2Codec;

    function initDexRegistry(
        address[] memory _dexList,
        string[] memory _funcs,
        address[] memory _codecs
    ) internal onlyInitializing {
        _setDexCodecs(_dexList, _funcs, _codecs);
    }

    function setDexCodecs(
        address[] memory _dexList,
        string[] memory _funcs,
        address[] memory _codecs
    ) external onlyOwner {
        _setDexCodecs(_dexList, _funcs, _codecs);
    }

    function _setDexCodecs(
        address[] memory _dexList,
        string[] memory _funcs,
        address[] memory _codecs
    ) private {
        for (uint256 i = 0; i < _dexList.length; i++) {
            bytes4 selector = bytes4(keccak256(bytes(_funcs[i])));
            _setDexCodec(_dexList[i], selector, _codecs[i]);
        }
    }

    function _setDexCodec(
        address _dex,
        bytes4 _selector,
        address _codec
    ) private {
        address codec = dexFunc2Codec[_dex][_selector];
        require(codec != _codec, "nop");
        dexFunc2Codec[_dex][_selector] = _codec;
        emit DexCodecUpdated(_dex, _selector, _codec);
    }

    function getCodec(address _dex, bytes4 _selector) internal view returns (ICodec) {
        require(dexFunc2Codec[_dex][_selector] != address(0), "unsupported dex");
        return ICodec(dexFunc2Codec[_dex][_selector]);
    }
}

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

pragma solidity ^0.8.0;

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

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

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

File 23 of 29 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

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

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

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

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

        (bool success, bytes memory returndata) = target.delegatecall(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
                /// @solidity memory-safe-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 24 of 29 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

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

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // 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);
    }

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

File 25 of 29 : MsgDataTypes.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.15;

library MsgDataTypes {
    // bridge operation type at the sender side (src chain)
    enum BridgeSendType {
        Null,
        Liquidity,
        PegDeposit,
        PegBurn,
        PegV2Deposit,
        PegV2Burn,
        PegV2BurnFrom
    }

    // bridge operation type at the receiver side (dst chain)
    enum TransferType {
        Null,
        LqRelay, // relay through liquidity bridge
        LqWithdraw, // withdraw from liquidity bridge
        PegMint, // mint through pegged token bridge
        PegWithdraw, // withdraw from original token vault
        PegV2Mint, // mint through pegged token bridge v2
        PegV2Withdraw // withdraw from original token vault v2
    }

    enum MsgType {
        MessageWithTransfer,
        MessageOnly
    }

    enum TxStatus {
        Null,
        Success,
        Fail,
        Fallback,
        Pending // transient state within a transaction
    }

    struct TransferInfo {
        TransferType t;
        address sender;
        address receiver;
        address token;
        uint256 amount;
        uint64 wdseq; // only needed for LqWithdraw (refund)
        uint64 srcChainId;
        bytes32 refId;
        bytes32 srcTxHash; // src chain msg tx hash
    }

    struct RouteInfo {
        address sender;
        address receiver;
        uint64 srcChainId;
        bytes32 srcTxHash; // src chain msg tx hash
    }

    struct MsgWithTransferExecutionParams {
        bytes message;
        TransferInfo transfer;
        bytes[] sigs;
        address[] signers;
        uint256[] powers;
    }

    struct BridgeTransferParams {
        bytes request;
        bytes[] sigs;
        address[] signers;
        uint256[] powers;
    }
}

File 26 of 29 : Ownable.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity ^0.8.0;

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 *
 * This adds a normal func that setOwner if _owner is address(0). So we can't allow
 * renounceOwnership. So we can support Proxy based upgradable contract
 */
abstract contract Ownable {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(msg.sender);
    }

    /**
     * @dev Only to be called by inherit contracts, in their init func called by Proxy
     * we require _owner == address(0), which is only possible when it's a delegateCall
     * because constructor sets _owner in contract state.
     */
    function initOwner() internal {
        require(_owner == address(0), "owner already set");
        _setOwner(msg.sender);
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == msg.sender, "Ownable: caller is not the owner");
        _;
    }

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

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 27 of 29 : IMessageReceiver.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

interface IMessageReceiver {
    enum ExecutionStatus {
        Fail, // execution failed, finalized
        Success, // execution succeeded, finalized
        Retry // execution rejected, can retry later
    }

    /**
     * @notice Called by MessageBus (MessageBusReceiver)
     * @param _sender The address of the source app contract
     * @param _srcChainId The source chain ID where the transfer is originated from
     * @param _message Arbitrary message bytes originated from and encoded by the source app contract
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessage(
        address _sender,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable returns (ExecutionStatus);

    /**
     * @notice Called by MessageBus (MessageBusReceiver) to process refund of the original transfer from this contract
     * @param _token The token address of the original transfer
     * @param _amount The amount of the original transfer
     * @param _message The same message associated with the original transfer
     */
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message
    ) external payable returns (bool);
}

File 28 of 29 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

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

pragma solidity ^0.8.0;

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"bool","name":"_testMode","type":"bool"},{"internalType":"address","name":"_messageBus","type":"address"},{"internalType":"address","name":"_nativeWrap","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"dex","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"address","name":"codec","type":"address"}],"name":"DexCodecUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FeeCollectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"messageBus","type":"address"}],"name":"MessageBusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nativeWrap","type":"address"}],"name":"NativeWrapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"erc20Amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"nativeAmount","type":"uint256"}],"name":"PocketFundClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"}],"name":"StepExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string[]","name":"providers","type":"string[]"},{"indexed":false,"internalType":"address[]","name":"adapters","type":"address[]"}],"name":"SupportedBridgesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"CBRIDGE_PROVIDER_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addPauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridges","outputs":[{"internalType":"contract IBridgeAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"address","name":"_token","type":"address"}],"name":"claimPocketFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address","name":"_to","type":"address"}],"name":"collectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"dexFunc2Codec","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_id","type":"bytes32"},{"components":[{"internalType":"uint64","name":"chainId","type":"uint64"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ICodec.SwapDescription","name":"swap","type":"tuple"},{"components":[{"internalType":"uint64","name":"toChainId","type":"uint64"},{"internalType":"string","name":"bridgeProvider","type":"string"},{"internalType":"bytes","name":"bridgeParams","type":"bytes"},{"internalType":"uint256","name":"nativeFee","type":"uint256"}],"internalType":"struct Types.BridgeInfo","name":"bridge","type":"tuple"},{"internalType":"address","name":"remoteExecutionNode","type":"address"},{"internalType":"address","name":"bridgeOutToken","type":"address"},{"internalType":"address","name":"bridgeOutFallbackToken","type":"address"},{"internalType":"uint256","name":"bridgeOutMin","type":"uint256"},{"internalType":"uint256","name":"bridgeOutFallbackMin","type":"uint256"},{"internalType":"uint256","name":"feeInBridgeOutToken","type":"uint256"},{"internalType":"uint256","name":"feeInBridgeOutFallbackToken","type":"uint256"}],"internalType":"struct Types.ExecutionInfo[]","name":"_execs","type":"tuple[]"},{"components":[{"internalType":"uint64","name":"chainId","type":"uint64"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"uint64","name":"deadline","type":"uint64"},{"internalType":"bytes","name":"quoteSig","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"bool","name":"nativeIn","type":"bool"}],"internalType":"struct Types.SourceInfo","name":"_src","type":"tuple"},{"components":[{"internalType":"uint64","name":"chainId","type":"uint64"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"bool","name":"nativeOut","type":"bool"}],"internalType":"struct Types.DestinationInfo","name":"_dst","type":"tuple"}],"name":"execute","outputs":[{"internalType":"uint256","name":"remainingValue","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessage","outputs":[{"internalType":"enum IMessageReceiver.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_message","type":"bytes"}],"name":"executeMessageWithTransferRefund","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_testMode","type":"bool"},{"internalType":"address","name":"_messageBus","type":"address"},{"internalType":"address","name":"_nativeWrap","type":"address"},{"internalType":"address","name":"_signer","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"},{"internalType":"address[]","name":"_dexList","type":"address[]"},{"internalType":"string[]","name":"_funcs","type":"string[]"},{"internalType":"address[]","name":"_codecs","type":"address[]"},{"internalType":"string[]","name":"_bridgeProviders","type":"string[]"},{"internalType":"address[]","name":"_bridgeAdapters","type":"address[]"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageBus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeWrap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pausers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removePauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renouncePauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_dexList","type":"address[]"},{"internalType":"string[]","name":"_funcs","type":"string[]"},{"internalType":"address[]","name":"_codecs","type":"address[]"}],"name":"setDexCodecs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_msgbus","type":"address"}],"name":"setMessageBus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nativeWrap","type":"address"}],"name":"setNativeWrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_providers","type":"string[]"},{"internalType":"address[]","name":"_adapters","type":"address[]"}],"name":"setSupportedBridges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"testMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60806040523480156200001157600080fd5b50604051620055d6380380620055d68339810160408190526200003491620001e3565b8083836200004233620000ae565b60008054921515600160b01b0260ff60b01b1990931692909217909155600180546001600160a01b039283166001600160a01b0319918216178255600680549490931693169290921790556007556008805460ff19169055620000a533620000fe565b50505062000233565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811660009081526009602052604090205460ff16156200016c5760405162461bcd60e51b815260206004820152601960248201527f4163636f756e7420697320616c72656164792070617573657200000000000000604482015260640160405180910390fd5b6001600160a01b038116600081815260096020908152604091829020805460ff1916600117905590519182527f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f8910160405180910390a150565b80516001600160a01b0381168114620001de57600080fd5b919050565b600080600060608486031215620001f957600080fd5b835180151581146200020a57600080fd5b92506200021a60208501620001c6565b91506200022a60408501620001c6565b90509250925092565b61539380620002436000396000f3fe6080604052600436106101d15760003560e01c80638456cb59116100f7578063c040499811610095578063e9c193c211610064578063e9c193c2146105bb578063eeaaa651146105ce578063efcfd8f514610604578063f2fde38b1461062457600080fd5b8063c0404998146104e3578063c415b95c1461055a578063cd9ea3421461057a578063d3ac0fbc1461059b57600080fd5b80639c649fdf116100d15780639c649fdf146104425780639e02c9f914610462578063a1a227fa146104a3578063a42dce80146104c357600080fd5b80638456cb59146103ef5780638da5cb5b14610404578063918ead761461042257600080fd5b80635c975abb1161016f5780637228e5c41161013e5780637228e5c41461035f5780637a0f93561461037f57806380f51c121461039f57806382dc1ec4146103cf57600080fd5b80635c975abb146102f25780636b2c0f551461030a5780636c19e7831461032a5780636ef8d66d1461034a57600080fd5b8063457bfa2f116101ab578063457bfa2f1461025957806346fbf68e14610279578063547cad12146102b25780635b5a66a7146102d257600080fd5b806320be95f2146101dd578063238ac9331461020a5780633f4ba83a1461024257600080fd5b366101d857005b600080fd5b6101f56101eb366004613cf2565b6000949350505050565b60405190151581526020015b60405180910390f35b34801561021657600080fd5b5060045461022a906001600160a01b031681565b6040516001600160a01b039091168152602001610201565b34801561024e57600080fd5b50610257610644565b005b34801561026557600080fd5b5060065461022a906001600160a01b031681565b34801561028557600080fd5b506101f5610294366004613d7b565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102be57600080fd5b506102576102cd366004613d7b565b6106b2565b3480156102de57600080fd5b506102576102ed366004613d7b565b61075e565b3480156102fe57600080fd5b5060085460ff166101f5565b34801561031657600080fd5b50610257610325366004613d7b565b6107c1565b34801561033657600080fd5b50610257610345366004613d7b565b610821565b34801561035657600080fd5b50610257610881565b34801561036b57600080fd5b5061025761037a366004614026565b61088a565b34801561038b57600080fd5b5061025761039a3660046140cf565b6108f1565b3480156103ab57600080fd5b506101f56103ba366004613d7b565b60096020526000908152604090205460ff1681565b3480156103db57600080fd5b506102576103ea366004613d7b565b610be9565b3480156103fb57600080fd5b50610257610c49565b34801561041057600080fd5b506000546001600160a01b031661022a565b34801561042e57600080fd5b5061025761043d36600461412b565b610cb0565b61045561045036600461418f565b610d15565b604051610201919061420f565b34801561046e57600080fd5b5061022a61047d366004614237565b60026020908152600092835260408084209091529082529020546001600160a01b031681565b3480156104af57600080fd5b5060015461022a906001600160a01b031681565b3480156104cf57600080fd5b506102576104de366004613d7b565b610f0c565b3480156104ef57600080fd5b5060408051808201909152600781527f636272696467650000000000000000000000000000000000000000000000000060209091015261054c7f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81565b604051908152602001610201565b34801561056657600080fd5b5060055461022a906001600160a01b031681565b34801561058657600080fd5b506000546101f590600160b01b900460ff1681565b3480156105a757600080fd5b506102576105b6366004614296565b610f6c565b61054c6105c93660046145a0565b611106565b3480156105da57600080fd5b5061022a6105e9366004614765565b6003602052600090815260409020546001600160a01b031681565b34801561061057600080fd5b5061025761061f36600461477e565b61165f565b34801561063057600080fd5b5061025761063f366004613d7b565b611895565b3360009081526009602052604090205460ff166106a85760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f742070617573657200000000000000000000000060448201526064015b60405180910390fd5b6106b0611971565b565b336106c56000546001600160a01b031690565b6001600160a01b0316146107095760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e906020015b60405180910390a150565b336107716000546001600160a01b031690565b6001600160a01b0316146107b55760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be816119c3565b50565b336107d46000546001600160a01b031690565b6001600160a01b0316146108185760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611a11565b336108346000546001600160a01b031690565b6001600160a01b0316146108785760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611aca565b6106b033611a11565b3361089d6000546001600160a01b031690565b6001600160a01b0316146108e15760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6108ec838383611b2c565b505050565b336001600160a01b038416146109495760405162461bcd60e51b815260206004820152601760248201527f6f6e6c792072656365697665722063616e20636c61696d000000000000000000604482015260640161069f565b6000610956858585611bad565b905060008160405161096790613bf1565b8190604051809103906000f5905080158015610987573d6000803e3d6000fd5b506040516370a0823160e01b81526001600160a01b0380831660048301529192506000918516906370a0823190602401602060405180830381865afa1580156109d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f89190614804565b90506001600160a01b0382163181151580610a135750600081115b610a5f5760405162461bcd60e51b815260206004820152600f60248201527f706f636b657420697320656d7074790000000000000000000000000000000000604482015260640161069f565b604051635569f64b60e11b81526001600160a01b0386811660048301526024820184905284169063aad3ec9690604401600060405180830381600087803b158015610aa957600080fd5b505af1158015610abd573d6000803e3d6000fd5b505050506000821115610ade57610ade6001600160a01b0386168884611c0d565b8015610b8e576000876001600160a01b03168261c35090604051600060405180830381858888f193505050503d8060008114610b36576040519150601f19603f3d011682016040523d82523d6000602084013e610b3b565b606091505b5050905080610b8c5760405162461bcd60e51b815260206004820152601560248201527f6661696c656420746f2073656e64206e61746976650000000000000000000000604482015260640161069f565b505b604080516001600160a01b038981168252602082018590528716818301526060810183905290517f93792cbd2b72fa0c2850634d3177263b6f8dbe5c2245b5ad2522ef65b5a9b8d59181900360800190a15050505050505050565b33610bfc6000546001600160a01b031690565b6001600160a01b031614610c405760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611c85565b3360009081526009602052604090205460ff16610ca85760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f7420706175736572000000000000000000000000604482015260640161069f565b6106b0611d42565b33610cc36000546001600160a01b031690565b6001600160a01b031614610d075760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b610d118282611d7f565b5050565b60008054600160b01b900460ff16610d81576001546001600160a01b03163314610d815760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206973206e6f74206d6573736167652062757300000000000000604482015260640161069f565b600083806020019051810190610d9791906149eb565b90506000610e3782600001518360200151610e2d6040805160e0810182526000808252602082018190529181018290526060808201526080810182905260a0810182905260c0810191909152506040805160e08101825260008082526020808301829052828401829052835190810190935280835260608201929092526080810182905260a0810182905260c081019190915290565b8560400151611106565b90508015610eff57604051600090329083908381818185875af1925050503d8060008114610e81576040519150601f19603f3d011682016040523d82523d6000602084013e610e86565b606091505b5050905080610efd5760405162461bcd60e51b815260206004820152602760248201527f6661696c656420746f20726566756e642072656d61696e696e67206e6174697660448201527f6520746f6b656e00000000000000000000000000000000000000000000000000606482015260840161069f565b505b5060019695505050505050565b33610f1f6000546001600160a01b031690565b6001600160a01b031614610f635760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611e92565b600054600160a81b900460ff1615808015610f9457506000546001600160a01b90910460ff16105b80610fb55750303b158015610fb55750600054600160a01b900460ff166001145b6110275760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161069f565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b179055801561106f576000805460ff60a81b1916600160a81b1790555b611077611eec565b6110818b8b611f4e565b61108c868686612052565b61109683836120bf565b61109f8861212c565b6110a887612199565b6110b189612206565b80156110f9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b600060026007540361115a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161069f565b6002600755611167612273565b600084511161119e5760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b604482015260640161069f565b6111a6613bfe565b6111af856122c6565b955034925090506000804667ffffffffffffffff16866000015167ffffffffffffffff1603611214578651156111ea576111ea878787612408565b6111f386612644565b60c088015191935091501561120f5761120c8285614bc7565b93505b6112f8565b61121e88846127b2565b909250905060008290036112815760408051898152600060208201526001600160a01b038316918101919091527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299906060015b60405180910390a1505050611652565b8260a001516001600160a01b0316816001600160a01b0316036112f8576112af818387602001516000612b57565b60408051898152602081018490526001600160a01b038316918101919091527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c29990606001611271565b602083015151829082906001600160a01b031615611401576020850151600190611323908686612cda565b909450925090504667ffffffffffffffff16896000015167ffffffffffffffff160361139657806113965760405162461bcd60e51b815260206004820152600960248201527f73776170206661696c0000000000000000000000000000000000000000000000604482015260640161069f565b806113ff576113ac84868a602001516000612b57565b604080518c8152602081018790526001600160a01b0386168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a1505050505050611652565b505b865167ffffffffffffffff46811691160361147c5761142a818389602001518a60400151612b57565b604080518b8152602081018490526001600160a01b0383168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a15050505050611652565b6000808a511161149057876020015161149e565b61149e8b8760600151612ffc565b90506114b086604001518284866130b2565b6040860151606001516114c39088614bc7565b8a519097501561160357600060405180606001604052808d81526020018c81526020018a8152506040516020016114fa9190614c8b565b60408051601f198184030181529082905260015463299aee5160e11b83529092506000916001600160a01b0390911690635335dca29061153e908590600401614dd6565b602060405180830381865afa15801561155b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157f9190614804565b905061158b818a614bc7565b60015460608a01516040808c0151519051634f9e72ad60e11b8152939c506001600160a01b0390921692639f3ce55a9285926115ce929091908890600401614de9565b6000604051808303818588803b1580156115e757600080fd5b505af11580156115fb573d6000803e3d6000fd5b505050505050505b604080518c8152602081018590526001600160a01b0384168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a15050505050505b6001600755949350505050565b6005546001600160a01b031633146116b95760405162461bcd60e51b815260206004820152601160248201527f6e6f742066656520636f6c6c6563746f72000000000000000000000000000000604482015260640161069f565b60005b8281101561188f5760008484838181106116d8576116d8614e24565b90506020020160208101906116ed9190613d7b565b6001600160a01b0316036117aa5760405147906000906001600160a01b0385169061c35090849084818181858888f193505050503d806000811461174d576040519150601f19603f3d011682016040523d82523d6000602084013e611752565b606091505b50509050806117a35760405162461bcd60e51b815260206004820152601260248201527f73656e64206e6174697665206661696c65640000000000000000000000000000604482015260640161069f565b505061187d565b60008484838181106117be576117be614e24565b90506020020160208101906117d39190613d7b565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183d9190614804565b905061187b838287878681811061185657611856614e24565b905060200201602081019061186b9190613d7b565b6001600160a01b03169190611c0d565b505b8061188781614e3a565b9150506116bc565b50505050565b336118a86000546001600160a01b031690565b6001600160a01b0316146118ec5760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6001600160a01b0381166119685760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161069f565b6107be81613174565b6119796131c4565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d90602001610753565b6001600160a01b03811660009081526009602052604090205460ff16611a795760405162461bcd60e51b815260206004820152601560248201527f4163636f756e74206973206e6f74207061757365720000000000000000000000604482015260640161069f565b6001600160a01b038116600081815260096020908152604091829020805460ff1916905590519182527fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e9101610753565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb91015b60405180910390a15050565b60005b835181101561188f576000838281518110611b4c57611b4c614e24565b6020026020010151805190602001209050611b9a858381518110611b7257611b72614e24565b602002602001015182858581518110611b8d57611b8d614e24565b6020026020010151613216565b5080611ba581614e3a565b915050611b2f565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b1660348201526001600160c01b031960c083901b1660488201526000906050016040516020818303038152906040528051906020012090505b9392505050565b6040516001600160a01b0383166024820152604481018290526108ec90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152613308565b6001600160a01b03811660009081526009602052604090205460ff1615611cee5760405162461bcd60e51b815260206004820152601960248201527f4163636f756e7420697320616c72656164792070617573657200000000000000604482015260640161069f565b6001600160a01b038116600081815260096020908152604091829020805460ff1916600117905590519182527f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f89101610753565b611d4a612273565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119a63390565b8051825114611dd05760405162461bcd60e51b815260206004820152601460248201527f706172616d732073697a65206d69736d61746368000000000000000000000000604482015260640161069f565b60005b8251811015611e6057818181518110611dee57611dee614e24565b602002602001015160036000858481518110611e0c57611e0c614e24565b602002602001015180519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080611e5890614e3a565b915050611dd3565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b968282604051611b20929190614e53565b600580546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f389101611b20565b6000546001600160a01b031615611f455760405162461bcd60e51b815260206004820152601160248201527f6f776e657220616c726561647920736574000000000000000000000000000000604482015260640161069f565b6106b033613174565b600054600160a81b900460ff16611fbb5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b811580611fc9575046617a69145b611fd257600080fd5b600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16600160b01b84151502179055600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e90602001611b20565b600054600160a81b900460ff166108e15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff16610d075760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff166108785760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff16610f635760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff166107b55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b60085460ff16156106b05760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161069f565b6122ce613bfe565b606060008351116123215760405162461bcd60e51b815260206004820152600b60248201527f656d707479206578656373000000000000000000000000000000000000000000604482015260640161069f565b8260008151811061233457612334614e24565b602002602001015191506001835161234c9190614bc7565b67ffffffffffffffff81111561236457612364613d98565b60405190808252806020026020018201604052801561239d57816020015b61238a613bfe565b8152602001906001900390816123825790505b50905060015b8351811015612402578381815181106123be576123be614e24565b6020026020010151826001836123d49190614bc7565b815181106123e4576123e4614e24565b602002602001018190525080806123fa90614e3a565b9150506123a3565b50915091565b42826040015167ffffffffffffffff16116124655760405162461bcd60e51b815260206004820152601160248201527f646561646c696e65206578636565646564000000000000000000000000000000604482015260640161069f565b8051608083015160a084015160408086015181517f636861696e686f702071756f746500000000000000000000000000000000000060208201524660c090811b6001600160c01b0319908116602e84015296811b87166036830152603e82019590955260609390931b6bffffffffffffffffffffffff1916605e84015290921b90921660728301528051605a818403018152607a909201905260005b84518110156125dd57600085828151811061251e5761251e614e24565b6020908102919091018101518051610100820151608083015161012084015160a08501516040808701516060015190519698506000976125aa970160c09690961b6001600160c01b03191686526008860194909452606092831b6bffffffffffffffffffffffff199081166028870152603c86019290925290911b16605c830152607082015260900190565b60408051601f1981840301815291905290506125c684826133ed565b9350505080806125d590614e3a565b915050612501565b508051602080830191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c019052805191012061263d8185606001516134b3565b5050505050565b6000808260c00151156127795760065460a08401516001600160a01b039081169116146126b35760405162461bcd60e51b815260206004820152601660248201527f746f6b656e496e206e6f74206e61746976655772617000000000000000000000604482015260640161069f565b82608001513410156127075760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e74206e617469766520616d6f756e74000000000000604482015260640161069f565b600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db084608001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561275b57600080fd5b505af115801561276f573d6000803e3d6000fd5b50505050506127a1565b6127a1333085608001518660a001516001600160a01b031661351f909392919063ffffffff16565b5050608081015160a0909101519091565b6000806000846040516127c490613bf1565b8190604051809103906000f59050801580156127e4573d6000803e3d6000fd5b5060a08501519091506000906001600160a01b0316156128715760a08501516040516370a0823160e01b81526001600160a01b038481166004830152909116906370a0823190602401602060405180830381865afa15801561284a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286e9190614804565b90505b60808501516040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a0823190602401602060405180830381865afa1580156128be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e29190614804565b60c08701519091506001600160a01b038416319082118061290657508660c0015181115b8061291457508660e0015183115b6129605760405162461bcd60e51b815260206004820152601a60248201527f4d53473a3a41424f52543a706f636b657420697320656d707479000000000000604482015260640161069f565b82156129eb5760a0870151604051635569f64b60e11b81526001600160a01b039182166004820152602481018590529085169063aad3ec9690604401600060405180830381600087803b1580156129b657600080fd5b505af11580156129ca573d6000803e3d6000fd5b505050506129dd87610120015184613557565b95508660a001519450612b4c565b6080870151604051635569f64b60e11b81526001600160a01b039182166004820152602481018490529085169063aad3ec9690604401600060405180830381600087803b158015612a3b57600080fd5b505af1158015612a4f573d6000803e3d6000fd5b505050506000821115612a7257612a6b87610100015183613557565b9550612b44565b8015612b445760065460808801516001600160a01b03908116911614612ada5760405162461bcd60e51b815260206004820152601d60248201527f6272696467654f7574546f6b656e206e6f74206e617469766557726170000000604482015260640161069f565b612ae987610100015182613557565b955086608001516001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015612b2a57600080fd5b505af1158015612b3e573d6000803e3d6000fd5b50505050505b866080015194505b505050509250929050565b8015612cc6576006546001600160a01b03858116911614612bba5760405162461bcd60e51b815260206004820152601760248201527f746f6b656e206973206e6f74206e617469766557726170000000000000000000604482015260640161069f565b600654604051632e1a7d4d60e01b8152600481018590526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015612c0057600080fd5b505af1158015612c14573d6000803e3d6000fd5b505050506000826001600160a01b03168461c35090604051600060405180830381858888f193505050503d8060008114612c6a576040519150601f19603f3d011682016040523d82523d6000602084013e612c6f565b606091505b5050905080612cc05760405162461bcd60e51b815260206004820152600960248201527f73656e64206661696c0000000000000000000000000000000000000000000000604482015260640161069f565b5061188f565b61188f6001600160a01b0385168385611c0d565b8251600090819081906001600160a01b0316612cfe57506001915083905082612ff3565b60008660200151612d0e90614ef7565b90506000612d2088600001518361356a565b90506000816001600160a01b031663358f0e1c8a6040518263ffffffff1660e01b8152600401612d509190614f2e565b606060405180830381865afa158015612d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d919190614f41565b95509150506001600160a01b0380821690881614612df15760405162461bcd60e51b815260206004820152601260248201527f7377617020696e666f206d69736d617463680000000000000000000000000000604482015260640161069f565b6020890151604051634c6da26960e01b81526000916001600160a01b03851691634c6da26991612e27918d903090600401614f79565b600060405180830381865afa158015612e44573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612e6c9190810190614fab565b8a51909150612e86906001600160a01b038416908b61361d565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa158015612ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ef19190614804565b905060008b600001516001600160a01b031683604051612f119190614fe0565b6000604051808303816000865af19150503d8060008114612f4e576040519150601f19603f3d011682016040523d82523d6000602084013e612f53565b606091505b5050905080612f6e5760008098509850505050505050612ff3565b6040516370a0823160e01b81523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa158015612fb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd99190614804565b90506001612fe78483614bc7565b99509950505050505050505b93509350939050565b60008060ff60f81b83856040518060200161301690613bf1565b6020820181038252601f19601f820116604052508051906020012060405160200161309094939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051601f1981840301815291905280516020909101209150505b92915050565b6020808501518051908201206000908152600390915260409020546001600160a01b03908116906130e6908416828461361d565b6060850151855160408088015190516324c9401b60e01b81526001600160a01b038516936324c9401b939092613125928a9189918b9190600401614ffc565b60006040518083038185885af1158015613143573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261316c9190810190614fab565b505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60085460ff166106b05760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161069f565b6001600160a01b0380841660009081526002602090815260408083206001600160e01b0319871684529091529020548116908216810361327e5760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b604482015260640161069f565b6001600160a01b0384811660008181526002602090815260408083206001600160e01b031989168085529083529281902080546001600160a01b03191695881695861790558051938452908301919091528101919091527f454003ca28aca3b395ad1720eedfe6ee23b22ae10af0a8bb39c206ca1ca5679b9060600160405180910390a150505050565b600061335d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136cf9092919063ffffffff16565b8051909150156108ec578080602001905181019061337b919061503e565b6108ec5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161069f565b60606000825184516133ff919061505b565b67ffffffffffffffff81111561341757613417613d98565b6040519080825280601f01601f191660200182016040528015613441576020820181803683370190505b509050600080613455868051602090910191565b9150915060008061346a878051602090910191565b91509150600061347e868051602090910191565b509050600061348d858361505b565b905061349a8683876136e6565b6134a58482856136e6565b509498975050505050505050565b60006134bf8383613764565b6004549091506001600160a01b038083169116146108ec5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c6964207369676e6572000000000000000000000000000000000000604482015260640161069f565b6040516001600160a01b038085166024830152831660448201526064810182905261188f9085906323b872dd60e01b90608401611c39565b60008282106130ac57611c068383614bc7565b6001600160a01b0382811660009081526002602090815260408083206001600160e01b0319861684529091528120549091166135e85760405162461bcd60e51b815260206004820152600f60248201527f756e737570706f72746564206465780000000000000000000000000000000000604482015260640161069f565b506001600160a01b0391821660009081526002602090815260408083206001600160e01b031994909416835292905220541690565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561366e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136929190614804565b61369c919061505b565b6040516001600160a01b03851660248201526044810182905290915061188f90859063095ea7b360e01b90606401611c39565b60606136de8484600085613788565b949350505050565b6020811061371e57825182526136fd60208361505b565b915061370a60208461505b565b9250613717602082614bc7565b90506136e6565b8060000361372b57505050565b6000600161373a836020614bc7565b61374690610100615157565b6137509190614bc7565b935183518516941916939093179091525050565b600080600061377385856138d0565b9150915061378081613915565b509392505050565b6060824710156138005760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161069f565b6001600160a01b0385163b6138575760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161069f565b600080866001600160a01b031685876040516138739190614fe0565b60006040518083038185875af1925050503d80600081146138b0576040519150601f19603f3d011682016040523d82523d6000602084013e6138b5565b606091505b50915091506138c5828286613acb565b979650505050505050565b60008082516041036139065760208301516040840151606085015160001a6138fa87828585613b04565b9450945050505061390e565b506000905060025b9250929050565b6000816004811115613929576139296141f9565b036139315750565b6001816004811115613945576139456141f9565b036139925760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161069f565b60028160048111156139a6576139a66141f9565b036139f35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161069f565b6003816004811115613a0757613a076141f9565b03613a5f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161069f565b6004816004811115613a7357613a736141f9565b036107be5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161069f565b60608315613ada575081611c06565b825115613aea5782518084602001fd5b8160405162461bcd60e51b815260040161069f9190614dd6565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613b3b5750600090506003613be8565b8460ff16601b14158015613b5357508460ff16601c14155b15613b645750600090506004613be8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613bb8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613be157600060019250925050613be8565b9150600090505b94509492505050565b6101da8061516483390190565b604051806101400160405280600067ffffffffffffffff168152602001613c41604051806040016040528060006001600160a01b03168152602001606081525090565b8152602001613c7b6040518060800160405280600067ffffffffffffffff1681526020016060815260200160608152602001600081525090565b815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b03811681146107be57600080fd5b8035613ced81613ccd565b919050565b60008060008060608587031215613d0857600080fd5b8435613d1381613ccd565b935060208501359250604085013567ffffffffffffffff80821115613d3757600080fd5b818701915087601f830112613d4b57600080fd5b813581811115613d5a57600080fd5b886020828501011115613d6c57600080fd5b95989497505060200194505050565b600060208284031215613d8d57600080fd5b8135611c0681613ccd565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715613dd157613dd1613d98565b60405290565b6040516080810167ffffffffffffffff81118282101715613dd157613dd1613d98565b60405160e0810167ffffffffffffffff81118282101715613dd157613dd1613d98565b6040516060810167ffffffffffffffff81118282101715613dd157613dd1613d98565b604051610140810167ffffffffffffffff81118282101715613dd157613dd1613d98565b604051601f8201601f1916810167ffffffffffffffff81118282101715613e8d57613e8d613d98565b604052919050565b600067ffffffffffffffff821115613eaf57613eaf613d98565b5060051b60200190565b600082601f830112613eca57600080fd5b81356020613edf613eda83613e95565b613e64565b82815260059290921b84018101918181019086841115613efe57600080fd5b8286015b84811015613f22578035613f1581613ccd565b8352918301918301613f02565b509695505050505050565b600067ffffffffffffffff821115613f4757613f47613d98565b50601f01601f191660200190565b600082601f830112613f6657600080fd5b8135613f74613eda82613f2d565b818152846020838601011115613f8957600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613fb757600080fd5b81356020613fc7613eda83613e95565b82815260059290921b84018101918181019086841115613fe657600080fd5b8286015b84811015613f2257803567ffffffffffffffff81111561400a5760008081fd5b6140188986838b0101613f55565b845250918301918301613fea565b60008060006060848603121561403b57600080fd5b833567ffffffffffffffff8082111561405357600080fd5b61405f87838801613eb9565b9450602086013591508082111561407557600080fd5b61408187838801613fa6565b9350604086013591508082111561409757600080fd5b506140a486828701613eb9565b9150509250925092565b67ffffffffffffffff811681146107be57600080fd5b8035613ced816140ae565b600080600080608085870312156140e557600080fd5b84356140f081613ccd565b9350602085013561410081613ccd565b92506040850135614110816140ae565b9150606085013561412081613ccd565b939692955090935050565b6000806040838503121561413e57600080fd5b823567ffffffffffffffff8082111561415657600080fd5b61416286838701613fa6565b9350602085013591508082111561417857600080fd5b5061418585828601613eb9565b9150509250929050565b600080600080608085870312156141a557600080fd5b84356141b081613ccd565b935060208501356141c0816140ae565b9250604085013567ffffffffffffffff8111156141dc57600080fd5b6141e887828801613f55565b925050606085013561412081613ccd565b634e487b7160e01b600052602160045260246000fd5b602081016003831061423157634e487b7160e01b600052602160045260246000fd5b91905290565b6000806040838503121561424a57600080fd5b823561425581613ccd565b915060208301356001600160e01b03198116811461427257600080fd5b809150509250929050565b80151581146107be57600080fd5b8035613ced8161427d565b6000806000806000806000806000806101408b8d0312156142b657600080fd5b6142bf8b61428b565b99506142cd60208c01613ce2565b98506142db60408c01613ce2565b97506142e960608c01613ce2565b96506142f760808c01613ce2565b955060a08b013567ffffffffffffffff8082111561431457600080fd5b6143208e838f01613eb9565b965060c08d013591508082111561433657600080fd5b6143428e838f01613fa6565b955060e08d013591508082111561435857600080fd5b6143648e838f01613eb9565b94506101008d013591508082111561437b57600080fd5b6143878e838f01613fa6565b93506101208d013591508082111561439e57600080fd5b506143ab8d828e01613eb9565b9150509295989b9194979a5092959850565b6000604082840312156143cf57600080fd5b6143d7613dae565b905081356143e481613ccd565b8152602082013567ffffffffffffffff81111561440057600080fd5b61440c84828501613f55565b60208301525092915050565b60006080828403121561442a57600080fd5b614432613dd7565b9050813561443f816140ae565b8152602082013567ffffffffffffffff8082111561445c57600080fd5b61446885838601613f55565b6020840152604084013591508082111561448157600080fd5b5061448e84828501613f55565b6040830152506060820135606082015292915050565b600060e082840312156144b657600080fd5b6144be613dfa565b90506144c9826140c4565b81526144d7602083016140c4565b60208201526144e8604083016140c4565b6040820152606082013567ffffffffffffffff81111561450757600080fd5b61451384828501613f55565b6060830152506080820135608082015261452f60a08301613ce2565b60a082015261454060c0830161428b565b60c082015292915050565b60006060828403121561455d57600080fd5b614565613e1d565b90508135614572816140ae565b8152602082013561458281613ccd565b602082015260408201356145958161427d565b604082015292915050565b60008060008060c085870312156145b657600080fd5b84359350602085013567ffffffffffffffff808211156145d557600080fd5b818701915087601f8301126145e957600080fd5b6145f6613eda8335613e95565b82358082526020808301929160051b8501018a81111561461557600080fd5b602085015b8181101561472357848135111561463057600080fd5b80358601610140818e03601f1901121561464957600080fd5b614651613e40565b61465d602083016140c4565b815260408201358781111561467157600080fd5b6146808f6020838601016143bd565b60208301525060608201358781111561469857600080fd5b6146a78f602083860101614418565b6040830152506146b960808301613ce2565b60608201526146ca60a08301613ce2565b60808201526146db60c08301613ce2565b60a082015260e082013560c082015261010082013560e0820152610120820135610100820152610140820135610120820152808652505060208401935060208101905061461a565b509096505050604087013591508082111561473d57600080fd5b5061474a878288016144a4565b92505061475a866060870161454b565b905092959194509250565b60006020828403121561477757600080fd5b5035919050565b60008060006040848603121561479357600080fd5b833567ffffffffffffffff808211156147ab57600080fd5b818601915086601f8301126147bf57600080fd5b8135818111156147ce57600080fd5b8760208260051b85010111156147e357600080fd5b602092830195509350508401356147f981613ccd565b809150509250925092565b60006020828403121561481657600080fd5b5051919050565b8051613ced816140ae565b8051613ced81613ccd565b60005b8381101561484e578181015183820152602001614836565b8381111561188f5750506000910152565b600061486d613eda84613f2d565b905082815283838301111561488157600080fd5b611c06836020830184614833565b600082601f8301126148a057600080fd5b611c068383516020850161485f565b6000604082840312156148c157600080fd5b6148c9613dae565b905081516148d681613ccd565b8152602082015167ffffffffffffffff8111156148f257600080fd5b61440c8482850161488f565b60006080828403121561491057600080fd5b614918613dd7565b90508151614925816140ae565b8152602082015167ffffffffffffffff8082111561494257600080fd5b818401915084601f83011261495657600080fd5b6149658583516020850161485f565b6020840152604084015191508082111561497e57600080fd5b5061498b8482850161488f565b6040830152506060820151606082015292915050565b6000606082840312156149b357600080fd5b6149bb613e1d565b905081516149c8816140ae565b815260208201516149d881613ccd565b602082015260408201516145958161427d565b600060208083850312156149fe57600080fd5b825167ffffffffffffffff80821115614a1657600080fd5b9084019060a08287031215614a2a57600080fd5b614a32613e1d565b825181528383015182811115614a4757600080fd5b8301601f81018813614a5857600080fd5b8051614a66613eda82613e95565b81815260059190911b8201860190868101908a831115614a8557600080fd5b8784015b83811015614b8b57805187811115614aa057600080fd5b8501610140818e03601f19011215614ab757600080fd5b614abf613e40565b614aca8b830161481d565b8152604082015189811115614ade57600080fd5b614aec8f8d838601016148af565b8c83015250606082015189811115614b0357600080fd5b614b118f8d838601016148fe565b604083015250614b2360808301614828565b6060820152614b3460a08301614828565b6080820152614b4560c08301614828565b60a082015260e082015160c08201526101008083015160e08301526101208084015182840152610140840151818401525050808552505088830192508881019050614a89565b50808886015250505050614ba287604085016149a1565b60408201529695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015614bd957614bd9614bb1565b500390565b60008151808452614bf6816020860160208601614833565b601f01601f19169290920160200192915050565b6001600160a01b03815116825260006020820151604060208501526136de6040850182614bde565b67ffffffffffffffff81511682526000602082015160806020850152614c5b6080850182614bde565b905060408301518482036040860152614c748282614bde565b915050606083015160608501528091505092915050565b6000602080835260c08084018551838601528286015160a06040818189015283835180865260e09550858a019150858160051b8b0101888601955060005b82811015614d91578b820360df190184528651805167ffffffffffffffff1683526101408b820151818d860152614d0282860182614c0a565b9150508682015184820388860152614d1a8282614c32565b915050606080830151614d37828701826001600160a01b03169052565b50506080828101516001600160a01b03908116918601919091528883015116888501528a8201518b850152898201518a85015261010080830151908501526101209182015191909301529589019592890192600101614cc9565b5092909a0151805167ffffffffffffffff1660608b015260208101516001600160a01b031660808b015260400151151560a09099019890985298975050505050505050565b602081526000611c066020830184614bde565b6001600160a01b038416815267ffffffffffffffff83166020820152606060408201526000614e1b6060830184614bde565b95945050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201614e4c57614e4c614bb1565b5060010190565b6000604082016040835280855180835260608501915060608160051b8601019250602080880160005b83811015614eaa57605f19888703018552614e98868351614bde565b95509382019390820190600101614e7c565b50508584038187015286518085528782019482019350915060005b82811015614eea5784516001600160a01b031684529381019392810192600101614ec5565b5091979650505050505050565b805160208201516001600160e01b03198082169291906004831015614f265780818460040360031b1b83161693505b505050919050565b602081526000611c066020830184614c0a565b600080600060608486031215614f5657600080fd5b835192506020840151614f6881613ccd565b60408501519092506147f981613ccd565b606081526000614f8c6060830186614bde565b90508360208301526001600160a01b0383166040830152949350505050565b600060208284031215614fbd57600080fd5b815167ffffffffffffffff811115614fd457600080fd5b6136de8482850161488f565b60008251614ff2818460208701614833565b9190910192915050565b67ffffffffffffffff8616815260006001600160a01b03808716602084015285604084015280851660608401525060a060808301526138c560a0830184614bde565b60006020828403121561505057600080fd5b8151611c068161427d565b6000821982111561506e5761506e614bb1565b500190565b600181815b808511156150ae57816000190482111561509457615094614bb1565b808516156150a157918102915b93841c9390800290615078565b509250929050565b6000826150c5575060016130ac565b816150d2575060006130ac565b81600181146150e857600281146150f25761510e565b60019150506130ac565b60ff84111561510357615103614bb1565b50506001821b6130ac565b5060208310610133831016604e8410600b8410161715615131575081810a6130ac565b61513b8383615073565b806000190482111561514f5761514f614bb1565b029392505050565b6000611c0683836150b656fe608060405234801561001057600080fd5b506101ba806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063aad3ec9614610030575b600080fd5b61004361003e366004610104565b610045565b005b604080513360248201819052604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052915173ffffffffffffffffffffffffffffffffffffffff8516916100bc91610149565b6000604051808303816000865af19150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b50505080ff5b6000806040838503121561011757600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461013b57600080fd5b946020939093013593505050565b6000825160005b8181101561016a5760208186018101518583015201610150565b81811115610179576000828501525b50919091019291505056fea2646970667358221220596a029e19ba353d69291cd33136a82a60ef181cd9690abbbe3fe4a98c3c68c064736f6c634300080f00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220245cd74749ba43a9dbf8e5638e1bdefd2f91ef48fc4508eef54cbc5e1f94662664736f6c634300080f003300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d0000000000000000000000004200000000000000000000000000000000000006

Deployed Bytecode

0x6080604052600436106101d15760003560e01c80638456cb59116100f7578063c040499811610095578063e9c193c211610064578063e9c193c2146105bb578063eeaaa651146105ce578063efcfd8f514610604578063f2fde38b1461062457600080fd5b8063c0404998146104e3578063c415b95c1461055a578063cd9ea3421461057a578063d3ac0fbc1461059b57600080fd5b80639c649fdf116100d15780639c649fdf146104425780639e02c9f914610462578063a1a227fa146104a3578063a42dce80146104c357600080fd5b80638456cb59146103ef5780638da5cb5b14610404578063918ead761461042257600080fd5b80635c975abb1161016f5780637228e5c41161013e5780637228e5c41461035f5780637a0f93561461037f57806380f51c121461039f57806382dc1ec4146103cf57600080fd5b80635c975abb146102f25780636b2c0f551461030a5780636c19e7831461032a5780636ef8d66d1461034a57600080fd5b8063457bfa2f116101ab578063457bfa2f1461025957806346fbf68e14610279578063547cad12146102b25780635b5a66a7146102d257600080fd5b806320be95f2146101dd578063238ac9331461020a5780633f4ba83a1461024257600080fd5b366101d857005b600080fd5b6101f56101eb366004613cf2565b6000949350505050565b60405190151581526020015b60405180910390f35b34801561021657600080fd5b5060045461022a906001600160a01b031681565b6040516001600160a01b039091168152602001610201565b34801561024e57600080fd5b50610257610644565b005b34801561026557600080fd5b5060065461022a906001600160a01b031681565b34801561028557600080fd5b506101f5610294366004613d7b565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102be57600080fd5b506102576102cd366004613d7b565b6106b2565b3480156102de57600080fd5b506102576102ed366004613d7b565b61075e565b3480156102fe57600080fd5b5060085460ff166101f5565b34801561031657600080fd5b50610257610325366004613d7b565b6107c1565b34801561033657600080fd5b50610257610345366004613d7b565b610821565b34801561035657600080fd5b50610257610881565b34801561036b57600080fd5b5061025761037a366004614026565b61088a565b34801561038b57600080fd5b5061025761039a3660046140cf565b6108f1565b3480156103ab57600080fd5b506101f56103ba366004613d7b565b60096020526000908152604090205460ff1681565b3480156103db57600080fd5b506102576103ea366004613d7b565b610be9565b3480156103fb57600080fd5b50610257610c49565b34801561041057600080fd5b506000546001600160a01b031661022a565b34801561042e57600080fd5b5061025761043d36600461412b565b610cb0565b61045561045036600461418f565b610d15565b604051610201919061420f565b34801561046e57600080fd5b5061022a61047d366004614237565b60026020908152600092835260408084209091529082529020546001600160a01b031681565b3480156104af57600080fd5b5060015461022a906001600160a01b031681565b3480156104cf57600080fd5b506102576104de366004613d7b565b610f0c565b3480156104ef57600080fd5b5060408051808201909152600781527f636272696467650000000000000000000000000000000000000000000000000060209091015261054c7f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81565b604051908152602001610201565b34801561056657600080fd5b5060055461022a906001600160a01b031681565b34801561058657600080fd5b506000546101f590600160b01b900460ff1681565b3480156105a757600080fd5b506102576105b6366004614296565b610f6c565b61054c6105c93660046145a0565b611106565b3480156105da57600080fd5b5061022a6105e9366004614765565b6003602052600090815260409020546001600160a01b031681565b34801561061057600080fd5b5061025761061f36600461477e565b61165f565b34801561063057600080fd5b5061025761063f366004613d7b565b611895565b3360009081526009602052604090205460ff166106a85760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f742070617573657200000000000000000000000060448201526064015b60405180910390fd5b6106b0611971565b565b336106c56000546001600160a01b031690565b6001600160a01b0316146107095760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e906020015b60405180910390a150565b336107716000546001600160a01b031690565b6001600160a01b0316146107b55760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be816119c3565b50565b336107d46000546001600160a01b031690565b6001600160a01b0316146108185760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611a11565b336108346000546001600160a01b031690565b6001600160a01b0316146108785760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611aca565b6106b033611a11565b3361089d6000546001600160a01b031690565b6001600160a01b0316146108e15760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6108ec838383611b2c565b505050565b336001600160a01b038416146109495760405162461bcd60e51b815260206004820152601760248201527f6f6e6c792072656365697665722063616e20636c61696d000000000000000000604482015260640161069f565b6000610956858585611bad565b905060008160405161096790613bf1565b8190604051809103906000f5905080158015610987573d6000803e3d6000fd5b506040516370a0823160e01b81526001600160a01b0380831660048301529192506000918516906370a0823190602401602060405180830381865afa1580156109d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f89190614804565b90506001600160a01b0382163181151580610a135750600081115b610a5f5760405162461bcd60e51b815260206004820152600f60248201527f706f636b657420697320656d7074790000000000000000000000000000000000604482015260640161069f565b604051635569f64b60e11b81526001600160a01b0386811660048301526024820184905284169063aad3ec9690604401600060405180830381600087803b158015610aa957600080fd5b505af1158015610abd573d6000803e3d6000fd5b505050506000821115610ade57610ade6001600160a01b0386168884611c0d565b8015610b8e576000876001600160a01b03168261c35090604051600060405180830381858888f193505050503d8060008114610b36576040519150601f19603f3d011682016040523d82523d6000602084013e610b3b565b606091505b5050905080610b8c5760405162461bcd60e51b815260206004820152601560248201527f6661696c656420746f2073656e64206e61746976650000000000000000000000604482015260640161069f565b505b604080516001600160a01b038981168252602082018590528716818301526060810183905290517f93792cbd2b72fa0c2850634d3177263b6f8dbe5c2245b5ad2522ef65b5a9b8d59181900360800190a15050505050505050565b33610bfc6000546001600160a01b031690565b6001600160a01b031614610c405760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611c85565b3360009081526009602052604090205460ff16610ca85760405162461bcd60e51b815260206004820152601460248201527f43616c6c6572206973206e6f7420706175736572000000000000000000000000604482015260640161069f565b6106b0611d42565b33610cc36000546001600160a01b031690565b6001600160a01b031614610d075760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b610d118282611d7f565b5050565b60008054600160b01b900460ff16610d81576001546001600160a01b03163314610d815760405162461bcd60e51b815260206004820152601960248201527f63616c6c6572206973206e6f74206d6573736167652062757300000000000000604482015260640161069f565b600083806020019051810190610d9791906149eb565b90506000610e3782600001518360200151610e2d6040805160e0810182526000808252602082018190529181018290526060808201526080810182905260a0810182905260c0810191909152506040805160e08101825260008082526020808301829052828401829052835190810190935280835260608201929092526080810182905260a0810182905260c081019190915290565b8560400151611106565b90508015610eff57604051600090329083908381818185875af1925050503d8060008114610e81576040519150601f19603f3d011682016040523d82523d6000602084013e610e86565b606091505b5050905080610efd5760405162461bcd60e51b815260206004820152602760248201527f6661696c656420746f20726566756e642072656d61696e696e67206e6174697660448201527f6520746f6b656e00000000000000000000000000000000000000000000000000606482015260840161069f565b505b5060019695505050505050565b33610f1f6000546001600160a01b031690565b6001600160a01b031614610f635760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6107be81611e92565b600054600160a81b900460ff1615808015610f9457506000546001600160a01b90910460ff16105b80610fb55750303b158015610fb55750600054600160a01b900460ff166001145b6110275760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a6564000000000000000000000000000000000000606482015260840161069f565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b179055801561106f576000805460ff60a81b1916600160a81b1790555b611077611eec565b6110818b8b611f4e565b61108c868686612052565b61109683836120bf565b61109f8861212c565b6110a887612199565b6110b189612206565b80156110f9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050505050565b600060026007540361115a5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161069f565b6002600755611167612273565b600084511161119e5760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b604482015260640161069f565b6111a6613bfe565b6111af856122c6565b955034925090506000804667ffffffffffffffff16866000015167ffffffffffffffff1603611214578651156111ea576111ea878787612408565b6111f386612644565b60c088015191935091501561120f5761120c8285614bc7565b93505b6112f8565b61121e88846127b2565b909250905060008290036112815760408051898152600060208201526001600160a01b038316918101919091527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c299906060015b60405180910390a1505050611652565b8260a001516001600160a01b0316816001600160a01b0316036112f8576112af818387602001516000612b57565b60408051898152602081018490526001600160a01b038316918101919091527f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c29990606001611271565b602083015151829082906001600160a01b031615611401576020850151600190611323908686612cda565b909450925090504667ffffffffffffffff16896000015167ffffffffffffffff160361139657806113965760405162461bcd60e51b815260206004820152600960248201527f73776170206661696c0000000000000000000000000000000000000000000000604482015260640161069f565b806113ff576113ac84868a602001516000612b57565b604080518c8152602081018790526001600160a01b0386168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a1505050505050611652565b505b865167ffffffffffffffff46811691160361147c5761142a818389602001518a60400151612b57565b604080518b8152602081018490526001600160a01b0383168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a15050505050611652565b6000808a511161149057876020015161149e565b61149e8b8760600151612ffc565b90506114b086604001518284866130b2565b6040860151606001516114c39088614bc7565b8a519097501561160357600060405180606001604052808d81526020018c81526020018a8152506040516020016114fa9190614c8b565b60408051601f198184030181529082905260015463299aee5160e11b83529092506000916001600160a01b0390911690635335dca29061153e908590600401614dd6565b602060405180830381865afa15801561155b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157f9190614804565b905061158b818a614bc7565b60015460608a01516040808c0151519051634f9e72ad60e11b8152939c506001600160a01b0390921692639f3ce55a9285926115ce929091908890600401614de9565b6000604051808303818588803b1580156115e757600080fd5b505af11580156115fb573d6000803e3d6000fd5b505050505050505b604080518c8152602081018590526001600160a01b0384168183015290517f295612f9c20f128efb8df333990658b0f1b8083bc7b6dcf90750348cede4c2999181900360600190a15050505050505b6001600755949350505050565b6005546001600160a01b031633146116b95760405162461bcd60e51b815260206004820152601160248201527f6e6f742066656520636f6c6c6563746f72000000000000000000000000000000604482015260640161069f565b60005b8281101561188f5760008484838181106116d8576116d8614e24565b90506020020160208101906116ed9190613d7b565b6001600160a01b0316036117aa5760405147906000906001600160a01b0385169061c35090849084818181858888f193505050503d806000811461174d576040519150601f19603f3d011682016040523d82523d6000602084013e611752565b606091505b50509050806117a35760405162461bcd60e51b815260206004820152601260248201527f73656e64206e6174697665206661696c65640000000000000000000000000000604482015260640161069f565b505061187d565b60008484838181106117be576117be614e24565b90506020020160208101906117d39190613d7b565b6040516370a0823160e01b81523060048201526001600160a01b0391909116906370a0823190602401602060405180830381865afa158015611819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061183d9190614804565b905061187b838287878681811061185657611856614e24565b905060200201602081019061186b9190613d7b565b6001600160a01b03169190611c0d565b505b8061188781614e3a565b9150506116bc565b50505050565b336118a86000546001600160a01b031690565b6001600160a01b0316146118ec5760405162461bcd60e51b8152602060048201819052602482015260008051602061533e833981519152604482015260640161069f565b6001600160a01b0381166119685760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161069f565b6107be81613174565b6119796131c4565b6008805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b600680546001600160a01b0319166001600160a01b0383169081179091556040519081527fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d90602001610753565b6001600160a01b03811660009081526009602052604090205460ff16611a795760405162461bcd60e51b815260206004820152601560248201527f4163636f756e74206973206e6f74207061757365720000000000000000000000604482015260640161069f565b6001600160a01b038116600081815260096020908152604091829020805460ff1916905590519182527fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e9101610753565b600480546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb91015b60405180910390a15050565b60005b835181101561188f576000838281518110611b4c57611b4c614e24565b6020026020010151805190602001209050611b9a858381518110611b7257611b72614e24565b602002602001015182858581518110611b8d57611b8d614e24565b6020026020010151613216565b5080611ba581614e3a565b915050611b2f565b6040516bffffffffffffffffffffffff19606085811b8216602084015284901b1660348201526001600160c01b031960c083901b1660488201526000906050016040516020818303038152906040528051906020012090505b9392505050565b6040516001600160a01b0383166024820152604481018290526108ec90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152613308565b6001600160a01b03811660009081526009602052604090205460ff1615611cee5760405162461bcd60e51b815260206004820152601960248201527f4163636f756e7420697320616c72656164792070617573657200000000000000604482015260640161069f565b6001600160a01b038116600081815260096020908152604091829020805460ff1916600117905590519182527f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f89101610753565b611d4a612273565b6008805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586119a63390565b8051825114611dd05760405162461bcd60e51b815260206004820152601460248201527f706172616d732073697a65206d69736d61746368000000000000000000000000604482015260640161069f565b60005b8251811015611e6057818181518110611dee57611dee614e24565b602002602001015160036000858481518110611e0c57611e0c614e24565b602002602001015180519060200120815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080611e5890614e3a565b915050611dd3565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b968282604051611b20929190614e53565b600580546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f389101611b20565b6000546001600160a01b031615611f455760405162461bcd60e51b815260206004820152601160248201527f6f776e657220616c726561647920736574000000000000000000000000000000604482015260640161069f565b6106b033613174565b600054600160a81b900460ff16611fbb5760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b811580611fc9575046617a69145b611fd257600080fd5b600080547fffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffff16600160b01b84151502179055600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e90602001611b20565b600054600160a81b900460ff166108e15760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff16610d075760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff166108785760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff16610f635760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b600054600160a81b900460ff166107b55760405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b606482015260840161069f565b60085460ff16156106b05760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a2070617573656400000000000000000000000000000000604482015260640161069f565b6122ce613bfe565b606060008351116123215760405162461bcd60e51b815260206004820152600b60248201527f656d707479206578656373000000000000000000000000000000000000000000604482015260640161069f565b8260008151811061233457612334614e24565b602002602001015191506001835161234c9190614bc7565b67ffffffffffffffff81111561236457612364613d98565b60405190808252806020026020018201604052801561239d57816020015b61238a613bfe565b8152602001906001900390816123825790505b50905060015b8351811015612402578381815181106123be576123be614e24565b6020026020010151826001836123d49190614bc7565b815181106123e4576123e4614e24565b602002602001018190525080806123fa90614e3a565b9150506123a3565b50915091565b42826040015167ffffffffffffffff16116124655760405162461bcd60e51b815260206004820152601160248201527f646561646c696e65206578636565646564000000000000000000000000000000604482015260640161069f565b8051608083015160a084015160408086015181517f636861696e686f702071756f746500000000000000000000000000000000000060208201524660c090811b6001600160c01b0319908116602e84015296811b87166036830152603e82019590955260609390931b6bffffffffffffffffffffffff1916605e84015290921b90921660728301528051605a818403018152607a909201905260005b84518110156125dd57600085828151811061251e5761251e614e24565b6020908102919091018101518051610100820151608083015161012084015160a08501516040808701516060015190519698506000976125aa970160c09690961b6001600160c01b03191686526008860194909452606092831b6bffffffffffffffffffffffff199081166028870152603c86019290925290911b16605c830152607082015260900190565b60408051601f1981840301815291905290506125c684826133ed565b9350505080806125d590614e3a565b915050612501565b508051602080830191909120604080517f19457468657265756d205369676e6564204d6573736167653a0a33320000000081850152603c8082019390935281518082039093018352605c019052805191012061263d8185606001516134b3565b5050505050565b6000808260c00151156127795760065460a08401516001600160a01b039081169116146126b35760405162461bcd60e51b815260206004820152601660248201527f746f6b656e496e206e6f74206e61746976655772617000000000000000000000604482015260640161069f565b82608001513410156127075760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e74206e617469766520616d6f756e74000000000000604482015260640161069f565b600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db084608001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561275b57600080fd5b505af115801561276f573d6000803e3d6000fd5b50505050506127a1565b6127a1333085608001518660a001516001600160a01b031661351f909392919063ffffffff16565b5050608081015160a0909101519091565b6000806000846040516127c490613bf1565b8190604051809103906000f59050801580156127e4573d6000803e3d6000fd5b5060a08501519091506000906001600160a01b0316156128715760a08501516040516370a0823160e01b81526001600160a01b038481166004830152909116906370a0823190602401602060405180830381865afa15801561284a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061286e9190614804565b90505b60808501516040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a0823190602401602060405180830381865afa1580156128be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e29190614804565b60c08701519091506001600160a01b038416319082118061290657508660c0015181115b8061291457508660e0015183115b6129605760405162461bcd60e51b815260206004820152601a60248201527f4d53473a3a41424f52543a706f636b657420697320656d707479000000000000604482015260640161069f565b82156129eb5760a0870151604051635569f64b60e11b81526001600160a01b039182166004820152602481018590529085169063aad3ec9690604401600060405180830381600087803b1580156129b657600080fd5b505af11580156129ca573d6000803e3d6000fd5b505050506129dd87610120015184613557565b95508660a001519450612b4c565b6080870151604051635569f64b60e11b81526001600160a01b039182166004820152602481018490529085169063aad3ec9690604401600060405180830381600087803b158015612a3b57600080fd5b505af1158015612a4f573d6000803e3d6000fd5b505050506000821115612a7257612a6b87610100015183613557565b9550612b44565b8015612b445760065460808801516001600160a01b03908116911614612ada5760405162461bcd60e51b815260206004820152601d60248201527f6272696467654f7574546f6b656e206e6f74206e617469766557726170000000604482015260640161069f565b612ae987610100015182613557565b955086608001516001600160a01b031663d0e30db0876040518263ffffffff1660e01b81526004016000604051808303818588803b158015612b2a57600080fd5b505af1158015612b3e573d6000803e3d6000fd5b50505050505b866080015194505b505050509250929050565b8015612cc6576006546001600160a01b03858116911614612bba5760405162461bcd60e51b815260206004820152601760248201527f746f6b656e206973206e6f74206e617469766557726170000000000000000000604482015260640161069f565b600654604051632e1a7d4d60e01b8152600481018590526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015612c0057600080fd5b505af1158015612c14573d6000803e3d6000fd5b505050506000826001600160a01b03168461c35090604051600060405180830381858888f193505050503d8060008114612c6a576040519150601f19603f3d011682016040523d82523d6000602084013e612c6f565b606091505b5050905080612cc05760405162461bcd60e51b815260206004820152600960248201527f73656e64206661696c0000000000000000000000000000000000000000000000604482015260640161069f565b5061188f565b61188f6001600160a01b0385168385611c0d565b8251600090819081906001600160a01b0316612cfe57506001915083905082612ff3565b60008660200151612d0e90614ef7565b90506000612d2088600001518361356a565b90506000816001600160a01b031663358f0e1c8a6040518263ffffffff1660e01b8152600401612d509190614f2e565b606060405180830381865afa158015612d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d919190614f41565b95509150506001600160a01b0380821690881614612df15760405162461bcd60e51b815260206004820152601260248201527f7377617020696e666f206d69736d617463680000000000000000000000000000604482015260640161069f565b6020890151604051634c6da26960e01b81526000916001600160a01b03851691634c6da26991612e27918d903090600401614f79565b600060405180830381865afa158015612e44573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612e6c9190810190614fab565b8a51909150612e86906001600160a01b038416908b61361d565b6040516370a0823160e01b81523060048201526000906001600160a01b038716906370a0823190602401602060405180830381865afa158015612ecd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ef19190614804565b905060008b600001516001600160a01b031683604051612f119190614fe0565b6000604051808303816000865af19150503d8060008114612f4e576040519150601f19603f3d011682016040523d82523d6000602084013e612f53565b606091505b5050905080612f6e5760008098509850505050505050612ff3565b6040516370a0823160e01b81523060048201526000906001600160a01b038916906370a0823190602401602060405180830381865afa158015612fb5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fd99190614804565b90506001612fe78483614bc7565b99509950505050505050505b93509350939050565b60008060ff60f81b83856040518060200161301690613bf1565b6020820181038252601f19601f820116604052508051906020012060405160200161309094939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b6bffffffffffffffffffffffff191660018401526015830152603582015260550190565b60408051601f1981840301815291905280516020909101209150505b92915050565b6020808501518051908201206000908152600390915260409020546001600160a01b03908116906130e6908416828461361d565b6060850151855160408088015190516324c9401b60e01b81526001600160a01b038516936324c9401b939092613125928a9189918b9190600401614ffc565b60006040518083038185885af1158015613143573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261316c9190810190614fab565b505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60085460ff166106b05760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f7420706175736564000000000000000000000000604482015260640161069f565b6001600160a01b0380841660009081526002602090815260408083206001600160e01b0319871684529091529020548116908216810361327e5760405162461bcd60e51b815260206004820152600360248201526206e6f760ec1b604482015260640161069f565b6001600160a01b0384811660008181526002602090815260408083206001600160e01b031989168085529083529281902080546001600160a01b03191695881695861790558051938452908301919091528101919091527f454003ca28aca3b395ad1720eedfe6ee23b22ae10af0a8bb39c206ca1ca5679b9060600160405180910390a150505050565b600061335d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136cf9092919063ffffffff16565b8051909150156108ec578080602001905181019061337b919061503e565b6108ec5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161069f565b60606000825184516133ff919061505b565b67ffffffffffffffff81111561341757613417613d98565b6040519080825280601f01601f191660200182016040528015613441576020820181803683370190505b509050600080613455868051602090910191565b9150915060008061346a878051602090910191565b91509150600061347e868051602090910191565b509050600061348d858361505b565b905061349a8683876136e6565b6134a58482856136e6565b509498975050505050505050565b60006134bf8383613764565b6004549091506001600160a01b038083169116146108ec5760405162461bcd60e51b815260206004820152600e60248201527f696e76616c6964207369676e6572000000000000000000000000000000000000604482015260640161069f565b6040516001600160a01b038085166024830152831660448201526064810182905261188f9085906323b872dd60e01b90608401611c39565b60008282106130ac57611c068383614bc7565b6001600160a01b0382811660009081526002602090815260408083206001600160e01b0319861684529091528120549091166135e85760405162461bcd60e51b815260206004820152600f60248201527f756e737570706f72746564206465780000000000000000000000000000000000604482015260640161069f565b506001600160a01b0391821660009081526002602090815260408083206001600160e01b031994909416835292905220541690565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa15801561366e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136929190614804565b61369c919061505b565b6040516001600160a01b03851660248201526044810182905290915061188f90859063095ea7b360e01b90606401611c39565b60606136de8484600085613788565b949350505050565b6020811061371e57825182526136fd60208361505b565b915061370a60208461505b565b9250613717602082614bc7565b90506136e6565b8060000361372b57505050565b6000600161373a836020614bc7565b61374690610100615157565b6137509190614bc7565b935183518516941916939093179091525050565b600080600061377385856138d0565b9150915061378081613915565b509392505050565b6060824710156138005760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161069f565b6001600160a01b0385163b6138575760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161069f565b600080866001600160a01b031685876040516138739190614fe0565b60006040518083038185875af1925050503d80600081146138b0576040519150601f19603f3d011682016040523d82523d6000602084013e6138b5565b606091505b50915091506138c5828286613acb565b979650505050505050565b60008082516041036139065760208301516040840151606085015160001a6138fa87828585613b04565b9450945050505061390e565b506000905060025b9250929050565b6000816004811115613929576139296141f9565b036139315750565b6001816004811115613945576139456141f9565b036139925760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161069f565b60028160048111156139a6576139a66141f9565b036139f35760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161069f565b6003816004811115613a0757613a076141f9565b03613a5f5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161069f565b6004816004811115613a7357613a736141f9565b036107be5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b606482015260840161069f565b60608315613ada575081611c06565b825115613aea5782518084602001fd5b8160405162461bcd60e51b815260040161069f9190614dd6565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115613b3b5750600090506003613be8565b8460ff16601b14158015613b5357508460ff16601c14155b15613b645750600090506004613be8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613bb8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613be157600060019250925050613be8565b9150600090505b94509492505050565b6101da8061516483390190565b604051806101400160405280600067ffffffffffffffff168152602001613c41604051806040016040528060006001600160a01b03168152602001606081525090565b8152602001613c7b6040518060800160405280600067ffffffffffffffff1681526020016060815260200160608152602001600081525090565b815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6001600160a01b03811681146107be57600080fd5b8035613ced81613ccd565b919050565b60008060008060608587031215613d0857600080fd5b8435613d1381613ccd565b935060208501359250604085013567ffffffffffffffff80821115613d3757600080fd5b818701915087601f830112613d4b57600080fd5b813581811115613d5a57600080fd5b886020828501011115613d6c57600080fd5b95989497505060200194505050565b600060208284031215613d8d57600080fd5b8135611c0681613ccd565b634e487b7160e01b600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715613dd157613dd1613d98565b60405290565b6040516080810167ffffffffffffffff81118282101715613dd157613dd1613d98565b60405160e0810167ffffffffffffffff81118282101715613dd157613dd1613d98565b6040516060810167ffffffffffffffff81118282101715613dd157613dd1613d98565b604051610140810167ffffffffffffffff81118282101715613dd157613dd1613d98565b604051601f8201601f1916810167ffffffffffffffff81118282101715613e8d57613e8d613d98565b604052919050565b600067ffffffffffffffff821115613eaf57613eaf613d98565b5060051b60200190565b600082601f830112613eca57600080fd5b81356020613edf613eda83613e95565b613e64565b82815260059290921b84018101918181019086841115613efe57600080fd5b8286015b84811015613f22578035613f1581613ccd565b8352918301918301613f02565b509695505050505050565b600067ffffffffffffffff821115613f4757613f47613d98565b50601f01601f191660200190565b600082601f830112613f6657600080fd5b8135613f74613eda82613f2d565b818152846020838601011115613f8957600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112613fb757600080fd5b81356020613fc7613eda83613e95565b82815260059290921b84018101918181019086841115613fe657600080fd5b8286015b84811015613f2257803567ffffffffffffffff81111561400a5760008081fd5b6140188986838b0101613f55565b845250918301918301613fea565b60008060006060848603121561403b57600080fd5b833567ffffffffffffffff8082111561405357600080fd5b61405f87838801613eb9565b9450602086013591508082111561407557600080fd5b61408187838801613fa6565b9350604086013591508082111561409757600080fd5b506140a486828701613eb9565b9150509250925092565b67ffffffffffffffff811681146107be57600080fd5b8035613ced816140ae565b600080600080608085870312156140e557600080fd5b84356140f081613ccd565b9350602085013561410081613ccd565b92506040850135614110816140ae565b9150606085013561412081613ccd565b939692955090935050565b6000806040838503121561413e57600080fd5b823567ffffffffffffffff8082111561415657600080fd5b61416286838701613fa6565b9350602085013591508082111561417857600080fd5b5061418585828601613eb9565b9150509250929050565b600080600080608085870312156141a557600080fd5b84356141b081613ccd565b935060208501356141c0816140ae565b9250604085013567ffffffffffffffff8111156141dc57600080fd5b6141e887828801613f55565b925050606085013561412081613ccd565b634e487b7160e01b600052602160045260246000fd5b602081016003831061423157634e487b7160e01b600052602160045260246000fd5b91905290565b6000806040838503121561424a57600080fd5b823561425581613ccd565b915060208301356001600160e01b03198116811461427257600080fd5b809150509250929050565b80151581146107be57600080fd5b8035613ced8161427d565b6000806000806000806000806000806101408b8d0312156142b657600080fd5b6142bf8b61428b565b99506142cd60208c01613ce2565b98506142db60408c01613ce2565b97506142e960608c01613ce2565b96506142f760808c01613ce2565b955060a08b013567ffffffffffffffff8082111561431457600080fd5b6143208e838f01613eb9565b965060c08d013591508082111561433657600080fd5b6143428e838f01613fa6565b955060e08d013591508082111561435857600080fd5b6143648e838f01613eb9565b94506101008d013591508082111561437b57600080fd5b6143878e838f01613fa6565b93506101208d013591508082111561439e57600080fd5b506143ab8d828e01613eb9565b9150509295989b9194979a5092959850565b6000604082840312156143cf57600080fd5b6143d7613dae565b905081356143e481613ccd565b8152602082013567ffffffffffffffff81111561440057600080fd5b61440c84828501613f55565b60208301525092915050565b60006080828403121561442a57600080fd5b614432613dd7565b9050813561443f816140ae565b8152602082013567ffffffffffffffff8082111561445c57600080fd5b61446885838601613f55565b6020840152604084013591508082111561448157600080fd5b5061448e84828501613f55565b6040830152506060820135606082015292915050565b600060e082840312156144b657600080fd5b6144be613dfa565b90506144c9826140c4565b81526144d7602083016140c4565b60208201526144e8604083016140c4565b6040820152606082013567ffffffffffffffff81111561450757600080fd5b61451384828501613f55565b6060830152506080820135608082015261452f60a08301613ce2565b60a082015261454060c0830161428b565b60c082015292915050565b60006060828403121561455d57600080fd5b614565613e1d565b90508135614572816140ae565b8152602082013561458281613ccd565b602082015260408201356145958161427d565b604082015292915050565b60008060008060c085870312156145b657600080fd5b84359350602085013567ffffffffffffffff808211156145d557600080fd5b818701915087601f8301126145e957600080fd5b6145f6613eda8335613e95565b82358082526020808301929160051b8501018a81111561461557600080fd5b602085015b8181101561472357848135111561463057600080fd5b80358601610140818e03601f1901121561464957600080fd5b614651613e40565b61465d602083016140c4565b815260408201358781111561467157600080fd5b6146808f6020838601016143bd565b60208301525060608201358781111561469857600080fd5b6146a78f602083860101614418565b6040830152506146b960808301613ce2565b60608201526146ca60a08301613ce2565b60808201526146db60c08301613ce2565b60a082015260e082013560c082015261010082013560e0820152610120820135610100820152610140820135610120820152808652505060208401935060208101905061461a565b509096505050604087013591508082111561473d57600080fd5b5061474a878288016144a4565b92505061475a866060870161454b565b905092959194509250565b60006020828403121561477757600080fd5b5035919050565b60008060006040848603121561479357600080fd5b833567ffffffffffffffff808211156147ab57600080fd5b818601915086601f8301126147bf57600080fd5b8135818111156147ce57600080fd5b8760208260051b85010111156147e357600080fd5b602092830195509350508401356147f981613ccd565b809150509250925092565b60006020828403121561481657600080fd5b5051919050565b8051613ced816140ae565b8051613ced81613ccd565b60005b8381101561484e578181015183820152602001614836565b8381111561188f5750506000910152565b600061486d613eda84613f2d565b905082815283838301111561488157600080fd5b611c06836020830184614833565b600082601f8301126148a057600080fd5b611c068383516020850161485f565b6000604082840312156148c157600080fd5b6148c9613dae565b905081516148d681613ccd565b8152602082015167ffffffffffffffff8111156148f257600080fd5b61440c8482850161488f565b60006080828403121561491057600080fd5b614918613dd7565b90508151614925816140ae565b8152602082015167ffffffffffffffff8082111561494257600080fd5b818401915084601f83011261495657600080fd5b6149658583516020850161485f565b6020840152604084015191508082111561497e57600080fd5b5061498b8482850161488f565b6040830152506060820151606082015292915050565b6000606082840312156149b357600080fd5b6149bb613e1d565b905081516149c8816140ae565b815260208201516149d881613ccd565b602082015260408201516145958161427d565b600060208083850312156149fe57600080fd5b825167ffffffffffffffff80821115614a1657600080fd5b9084019060a08287031215614a2a57600080fd5b614a32613e1d565b825181528383015182811115614a4757600080fd5b8301601f81018813614a5857600080fd5b8051614a66613eda82613e95565b81815260059190911b8201860190868101908a831115614a8557600080fd5b8784015b83811015614b8b57805187811115614aa057600080fd5b8501610140818e03601f19011215614ab757600080fd5b614abf613e40565b614aca8b830161481d565b8152604082015189811115614ade57600080fd5b614aec8f8d838601016148af565b8c83015250606082015189811115614b0357600080fd5b614b118f8d838601016148fe565b604083015250614b2360808301614828565b6060820152614b3460a08301614828565b6080820152614b4560c08301614828565b60a082015260e082015160c08201526101008083015160e08301526101208084015182840152610140840151818401525050808552505088830192508881019050614a89565b50808886015250505050614ba287604085016149a1565b60408201529695505050505050565b634e487b7160e01b600052601160045260246000fd5b600082821015614bd957614bd9614bb1565b500390565b60008151808452614bf6816020860160208601614833565b601f01601f19169290920160200192915050565b6001600160a01b03815116825260006020820151604060208501526136de6040850182614bde565b67ffffffffffffffff81511682526000602082015160806020850152614c5b6080850182614bde565b905060408301518482036040860152614c748282614bde565b915050606083015160608501528091505092915050565b6000602080835260c08084018551838601528286015160a06040818189015283835180865260e09550858a019150858160051b8b0101888601955060005b82811015614d91578b820360df190184528651805167ffffffffffffffff1683526101408b820151818d860152614d0282860182614c0a565b9150508682015184820388860152614d1a8282614c32565b915050606080830151614d37828701826001600160a01b03169052565b50506080828101516001600160a01b03908116918601919091528883015116888501528a8201518b850152898201518a85015261010080830151908501526101209182015191909301529589019592890192600101614cc9565b5092909a0151805167ffffffffffffffff1660608b015260208101516001600160a01b031660808b015260400151151560a09099019890985298975050505050505050565b602081526000611c066020830184614bde565b6001600160a01b038416815267ffffffffffffffff83166020820152606060408201526000614e1b6060830184614bde565b95945050505050565b634e487b7160e01b600052603260045260246000fd5b600060018201614e4c57614e4c614bb1565b5060010190565b6000604082016040835280855180835260608501915060608160051b8601019250602080880160005b83811015614eaa57605f19888703018552614e98868351614bde565b95509382019390820190600101614e7c565b50508584038187015286518085528782019482019350915060005b82811015614eea5784516001600160a01b031684529381019392810192600101614ec5565b5091979650505050505050565b805160208201516001600160e01b03198082169291906004831015614f265780818460040360031b1b83161693505b505050919050565b602081526000611c066020830184614c0a565b600080600060608486031215614f5657600080fd5b835192506020840151614f6881613ccd565b60408501519092506147f981613ccd565b606081526000614f8c6060830186614bde565b90508360208301526001600160a01b0383166040830152949350505050565b600060208284031215614fbd57600080fd5b815167ffffffffffffffff811115614fd457600080fd5b6136de8482850161488f565b60008251614ff2818460208701614833565b9190910192915050565b67ffffffffffffffff8616815260006001600160a01b03808716602084015285604084015280851660608401525060a060808301526138c560a0830184614bde565b60006020828403121561505057600080fd5b8151611c068161427d565b6000821982111561506e5761506e614bb1565b500190565b600181815b808511156150ae57816000190482111561509457615094614bb1565b808516156150a157918102915b93841c9390800290615078565b509250929050565b6000826150c5575060016130ac565b816150d2575060006130ac565b81600181146150e857600281146150f25761510e565b60019150506130ac565b60ff84111561510357615103614bb1565b50506001821b6130ac565b5060208310610133831016604e8410600b8410161715615131575081810a6130ac565b61513b8383615073565b806000190482111561514f5761514f614bb1565b029392505050565b6000611c0683836150b656fe608060405234801561001057600080fd5b506101ba806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063aad3ec9614610030575b600080fd5b61004361003e366004610104565b610045565b005b604080513360248201819052604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b179052915173ffffffffffffffffffffffffffffffffffffffff8516916100bc91610149565b6000604051808303816000865af19150503d80600081146100f9576040519150601f19603f3d011682016040523d82523d6000602084013e6100fe565b606091505b50505080ff5b6000806040838503121561011757600080fd5b823573ffffffffffffffffffffffffffffffffffffffff8116811461013b57600080fd5b946020939093013593505050565b6000825160005b8181101561016a5760208186018101518583015201610150565b81811115610179576000828501525b50919091019291505056fea2646970667358221220596a029e19ba353d69291cd33136a82a60ef181cd9690abbbe3fe4a98c3c68c064736f6c634300080f00334f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220245cd74749ba43a9dbf8e5638e1bdefd2f91ef48fc4508eef54cbc5e1f94662664736f6c634300080f0033

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

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d0000000000000000000000004200000000000000000000000000000000000006

-----Decoded View---------------
Arg [0] : _testMode (bool): False
Arg [1] : _messageBus (address): 0x0D71D18126E03646eb09FEc929e2ae87b7CAE69d
Arg [2] : _nativeWrap (address): 0x4200000000000000000000000000000000000006

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d
Arg [2] : 0000000000000000000000004200000000000000000000000000000000000006


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

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