ETH Price: $3,457.50 (+1.53%)

Contract

0x49994FBB41c6b7C2F3066Ca7301f25305De1234A

Overview

ETH Balance

0.001953000000000001 ETH

ETH Value

$6.75 (@ $3,457.50/ETH)

Token Holdings

Transaction Hash
Method
Block
From
To
Transfer With Sw...305570172022-10-21 8:43:53635 days ago1666341833IN
0x49994FBB...05De1234A
0 ETH0.0002247620260.001
Transfer With Sw...305535682022-10-21 8:30:37635 days ago1666341037IN
0x49994FBB...05De1234A
0 ETH0.0002121745440.001
Transfer With Sw...305518432022-10-21 8:22:21635 days ago1666340541IN
0x49994FBB...05De1234A
0.5235 ETH0.0010124928250.001
Transfer With Sw...305515682022-10-21 8:21:06635 days ago1666340466IN
0x49994FBB...05De1234A
0.524 ETH0.0005578346690.001
Transfer With Sw...305514972022-10-21 8:20:36635 days ago1666340436IN
0x49994FBB...05De1234A
0.0005 ETH0.0002335273730.001
Transfer With Sw...305500912022-10-21 8:14:05635 days ago1666340045IN
0x49994FBB...05De1234A
0 ETH0.0002064357480.001
Transfer With Sw...305495262022-10-21 8:11:18635 days ago1666339878IN
0x49994FBB...05De1234A
0 ETH0.0002025922340.001
Transfer With Sw...305479632022-10-21 8:01:45635 days ago1666339305IN
0x49994FBB...05De1234A
0 ETH0.0002503742590.001
Transfer With Sw...305478212022-10-21 8:01:00635 days ago1666339260IN
0x49994FBB...05De1234A
0.000036308708566 ETH0.0006393336860.001
Transfer With Sw...305471952022-10-21 7:57:14635 days ago1666339034IN
0x49994FBB...05De1234A
0 ETH0.0008550477550.001
Transfer With Sw...305471362022-10-21 7:56:59635 days ago1666339019IN
0x49994FBB...05De1234A
0.001046433595584 ETH0.0009103155310.001
Transfer With Sw...305462302022-10-21 7:51:29635 days ago1666338689IN
0x49994FBB...05De1234A
0 ETH0.0002134524450.001
Transfer With Sw...305459382022-10-21 7:49:43635 days ago1666338583IN
0x49994FBB...05De1234A
0.09 ETH0.0001988454550.001
Transfer With Sw...305450772022-10-21 7:44:42635 days ago1666338282IN
0x49994FBB...05De1234A
0 ETH0.0003913333920.001
Transfer With Sw...305449922022-10-21 7:43:56635 days ago1666338236IN
0x49994FBB...05De1234A
0 ETH0.0005014637860.001
Transfer With Sw...305449622022-10-21 7:43:41635 days ago1666338221IN
0x49994FBB...05De1234A
0 ETH0.0001958261650.001
Transfer With Sw...305445792022-10-21 7:40:56635 days ago1666338056IN
0x49994FBB...05De1234A
0.181845075203105 ETH0.0012329577960.001
Transfer With Sw...305444072022-10-21 7:39:54635 days ago1666337994IN
0x49994FBB...05De1234A
0 ETH0.00062302580.001
Transfer With Sw...305442962022-10-21 7:39:09635 days ago1666337949IN
0x49994FBB...05De1234A
0.0001302 ETH0.0007495806720.001
Transfer With Sw...305439292022-10-21 7:36:39635 days ago1666337799IN
0x49994FBB...05De1234A
0 ETH0.0011463763820.001
Transfer With Sw...305437212022-10-21 7:35:23635 days ago1666337723IN
0x49994FBB...05De1234A
0 ETH0.0002144766860.001
Transfer With Sw...305433532022-10-21 7:32:52635 days ago1666337572IN
0x49994FBB...05De1234A
0.179497759154454 ETH0.0002094143510.001
Transfer With Sw...305428162022-10-21 7:29:04635 days ago1666337344IN
0x49994FBB...05De1234A
0.190969946160344 ETH0.0002180860860.001
Transfer With Sw...305422292022-10-21 7:25:04635 days ago1666337104IN
0x49994FBB...05De1234A
0 ETH0.0014776239850.001
Transfer With Sw...305421222022-10-21 7:24:34635 days ago1666337074IN
0x49994FBB...05De1234A
0.88100135279291 ETH0.0002173225210.001
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
305518432022-10-21 8:22:21635 days ago1666340541
0x49994FBB...05De1234A
0.5235 ETH
305515682022-10-21 8:21:06635 days ago1666340466
0x49994FBB...05De1234A
0.524 ETH
305514972022-10-21 8:20:36635 days ago1666340436
0x49994FBB...05De1234A
0.0005 ETH
305478212022-10-21 8:01:00635 days ago1666339260
0x49994FBB...05De1234A
0.000036308708566 ETH
305471362022-10-21 7:56:59635 days ago1666339019
0x49994FBB...05De1234A
0.001046433595584 ETH
305459382022-10-21 7:49:43635 days ago1666338583
0x49994FBB...05De1234A
0.09 ETH
305449922022-10-21 7:43:56635 days ago1666338236
0x49994FBB...05De1234A
0.155394384123028 ETH
305449922022-10-21 7:43:56635 days ago1666338236
0x49994FBB...05De1234A
0.155394384123028 ETH
305445792022-10-21 7:40:56635 days ago1666338056
0x49994FBB...05De1234A
0.181845075203105 ETH
305442962022-10-21 7:39:09635 days ago1666337949
0x49994FBB...05De1234A
0.0001302 ETH
305433532022-10-21 7:32:52635 days ago1666337572
0x49994FBB...05De1234A
0.179497759154454 ETH
305428162022-10-21 7:29:04635 days ago1666337344
0x49994FBB...05De1234A
0.190969946160344 ETH
305421222022-10-21 7:24:34635 days ago1666337074
0x49994FBB...05De1234A
0.88100135279291 ETH
305419712022-10-21 7:23:49635 days ago1666337029
0x49994FBB...05De1234A
0.200969946160344 ETH
305419712022-10-21 7:23:49635 days ago1666337029
0x49994FBB...05De1234A
0.200969946160344 ETH
305414032022-10-21 7:21:18635 days ago1666336878
0x49994FBB...05De1234A
0.888976152664052 ETH
305277342022-10-21 5:42:34635 days ago1666330954
0x49994FBB...05De1234A
0.0169 ETH
305271062022-10-21 5:37:31635 days ago1666330651
0x49994FBB...05De1234A
1.553050163464529 ETH
305266242022-10-21 5:33:13635 days ago1666330393
0x49994FBB...05De1234A
0.036 ETH
305265952022-10-21 5:33:13635 days ago1666330393
0x49994FBB...05De1234A
1.574845307280457 ETH
305256612022-10-21 5:25:38635 days ago1666329938
0x49994FBB...05De1234A
1.567127964359763 ETH
305242372022-10-21 5:11:42635 days ago1666329102
0x49994FBB...05De1234A
1.569831066729481 ETH
305235112022-10-21 5:04:10635 days ago1666328650
0x49994FBB...05De1234A
1.591760041588727 ETH
305201952022-10-21 4:35:01635 days ago1666326901
0x49994FBB...05De1234A
0.000031006297773 ETH
305199552022-10-21 4:32:44635 days ago1666326764
0x49994FBB...05De1234A
0.52 ETH
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TransferSwapper

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 800 runs

Other Settings:
default evmVersion
File 1 of 31 : TransferSwapper.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 "./lib/Types.sol";
import "./lib/MessageSenderLib.sol";
import "./lib/MessageReceiverApp.sol";
import "./BridgeRegistry.sol";
import "./FeeOperator.sol";
import "./SigVerifier.sol";
import "./Swapper.sol";
import "./interfaces/IBridgeAdapter.sol";
import "./interfaces/ICodec.sol";

/**
 * @author Chainhop Dex Team
 * @author Padoriku
 * @title An app that enables swapping on a chain, transferring to another chain and swapping
 * another time on the destination chain before sending the result tokens to a user
 */
contract TransferSwapper is MessageReceiverApp, Swapper, SigVerifier, FeeOperator, ReentrancyGuard, BridgeRegistry {
    using SafeERC20 for IERC20;
    using ECDSA for bytes32;

    bytes32 public immutable CBRIDGE_PROVIDER_HASH;

    /// @notice erc20 wrap of the gas token of this chain, e.g. WETH
    address public nativeWrap;

    constructor(
        address _messageBus,
        address _nativeWrap,
        address _signer,
        address _feeCollector,
        string[] memory _funcSigs,
        address[] memory _codecs,
        address[] memory _supportedDexList,
        string[] memory _supportedDexFuncs,
        address[] memory _externalSwapDexList,
        bool _testMode
    )
        Swapper(_funcSigs, _codecs, _supportedDexList, _supportedDexFuncs, _externalSwapDexList)
        FeeOperator(_feeCollector)
        SigVerifier(_signer)
    {
        messageBus = _messageBus;
        nativeWrap = _nativeWrap;
        testMode = _testMode;
        CBRIDGE_PROVIDER_HASH = keccak256(bytes("cbridge"));
    }

    event NativeWrapUpdated(address nativeWrap);

    /**
     * @notice Emitted when requested dstChainId == srcChainId, no bridging
     * @param id see _computeId()
     * @param amountIn the input amount approved by the sender
     * @param tokenIn the input token approved by the sender
     * @param amountOut the output amount gained after swapping using the input tokens
     * @param tokenOut the output token gained after swapping using the input tokens
     */
    event DirectSwap(bytes32 id, uint256 amountIn, address tokenIn, uint256 amountOut, address tokenOut);

    /**
     * @notice Emitted when operations on src chain is done, the transfer is sent through the bridge
     * @param id see _computeId()
     * @param bridgeResp arbitrary response data returned by bridge
     * @param dstChainId destination chain id
     * @param srcAmount input amount approved by the sender
     * @param srcToken the input token approved by the sender
     * @param dstToken the final output token (after bridging and swapping) desired by the sender
     * @param bridgeOutReceiver the receiver (user or dst TransferSwapper) of the bridge token
     * @param bridgeToken the token used for bridging
     * @param bridgeAmount the amount of the bridgeToken to bridge
     * @param bridgeProvider the bridge provider
     */
    event RequestSent(
        bytes32 id,
        bytes bridgeResp,
        uint64 dstChainId,
        uint256 srcAmount,
        address srcToken,
        address dstToken,
        address bridgeOutReceiver,
        address bridgeToken,
        uint256 bridgeAmount,
        string bridgeProvider
    );
    // emitted when operations on dst chain is done.
    // dstAmount is denominated by dstToken, refundAmount is denominated by bridge out token.
    // if refundAmount is a non-zero number, it means the "allow partial fill" option is turned on.

    /**
     * @notice Emitted when operations on dst chain is done.
     * @param id see _computeId()
     * @param dstAmount the final output token (after bridging and swapping) desired by the sender
     * @param refundAmount the amount refunded to the receiver in bridge token
     * @dev refundAmount may be fill by either a complete refund or when allowPartialFill is on and
     * some swaps fails in the swap routes
     * @param refundToken bridge out token
     * @param feeCollected the fee chainhop deducts from bridge out token
     * @param status see RequestStatus
     */
    event RequestDone(
        bytes32 id,
        uint256 dstAmount,
        uint256 refundAmount,
        address refundToken,
        uint256 feeCollected,
        Types.RequestStatus status,
        bytes forwardResp
    );

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * Source chain functions
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

    /**
     * @notice swaps if needed, then transfer the token to another chain along with an instruction on how to swap
     * on that chain
     */
    function transferWithSwap(
        Types.TransferDescription calldata _desc,
        ICodec.SwapDescription[] calldata _srcSwaps,
        ICodec.SwapDescription[] calldata _dstSwaps
    ) external payable nonReentrant {
        // a request needs to incur a swap, a transfer, or both. otherwise it's a nop and we revert early to save gas
        require(_srcSwaps.length != 0 || _desc.dstChainId != uint64(block.chainid), "nop");
        require(_srcSwaps.length != 0 || (_desc.amountIn != 0 && _desc.tokenIn != address(0)), "nop");
        // swapping on the dst chain requires message passing. only integrated with cbridge for now
        bytes32 bridgeProviderHash = keccak256(bytes(_desc.bridgeProvider));
        require(
            (_dstSwaps.length == 0 && _desc.forward.length == 0) || bridgeProviderHash == CBRIDGE_PROVIDER_HASH,
            "bridge does not support msg"
        );

        IBridgeAdapter bridge = bridges[bridgeProviderHash];
        // if not DirectSwap, the bridge provider should be a valid one
        require(_desc.dstChainId == uint64(block.chainid) || address(bridge) != address(0), "unsupported bridge");

        uint256 amountIn = _desc.amountIn;
        ICodec[] memory codecs;

        address srcTokenIn = _desc.tokenIn;
        address srcTokenOut = _desc.tokenIn;
        if (_srcSwaps.length != 0) {
            if (isExternalSwap(_srcSwaps[0])) {
                srcTokenOut = _desc.bridgeTokenIn;
            } else {
                (amountIn, srcTokenIn, srcTokenOut, codecs) = sanitizeSwaps(_srcSwaps);
            }
            require(srcTokenIn != srcTokenOut, "token in/out must not equal if exists swaps");
        }
        if (_desc.nativeIn) {
            require(srcTokenIn == nativeWrap, "tkin no nativeWrap");
            require(msg.value >= amountIn, "insfcnt amt"); // insufficient amount
            IWETH(nativeWrap).deposit{value: amountIn}();
        } else {
            IERC20(srcTokenIn).safeTransferFrom(msg.sender, address(this), amountIn);
        }

        _swapAndSend(srcTokenIn, srcTokenOut, amountIn, _desc, _srcSwaps, _dstSwaps, codecs);
    }

    function _swapAndSend(
        address _srcToken,
        address _bridgeToken,
        uint256 _amountIn,
        Types.TransferDescription memory _desc,
        ICodec.SwapDescription[] memory _srcSwaps,
        ICodec.SwapDescription[] memory _dstSwaps,
        ICodec[] memory _codecs
    ) private {
        // swap if needed
        uint256 amountOut = _amountIn;
        if (_srcSwaps.length != 0) {
            bool ok;
            if (isExternalSwap(_srcSwaps[0])) {
                // for external swaps, it is only possible that there is one element in the array
                (ok, amountOut) = executeExternalSwap(_srcToken, _bridgeToken, _amountIn, _srcSwaps[0]);
            } else {
                (ok, amountOut) = executeSwaps(_srcSwaps, _codecs);
            }
            require(ok, "swap fail");
        }

        bytes32 id = _computeId(_desc.receiver, _desc.nonce);
        // direct send if needed
        if (_desc.dstChainId == uint64(block.chainid)) {
            emit DirectSwap(id, _amountIn, _srcToken, amountOut, _bridgeToken);
            _sendToken(_bridgeToken, amountOut, _desc.receiver, _desc.nativeOut);
            return;
        }

        _transfer(id, _srcToken, _bridgeToken, _desc, _dstSwaps, _amountIn, amountOut);
    }

    function _transfer(
        bytes32 _id,
        address srcTokenIn,
        address srcTokenOut,
        Types.TransferDescription memory _desc,
        ICodec.SwapDescription[] memory _dstSwaps,
        uint256 _amountIn,
        uint256 _amountOut
    ) private {
        // fund is directly to user if there is no swaps needed on the destination chain
        address bridgeOutReceiver = (_dstSwaps.length > 0 || _desc.forward.length > 0)
            ? _desc.dstTransferSwapper
            : _desc.receiver;
        bytes memory bridgeResp;
        {
            _verifyFee(_desc, _amountIn, srcTokenIn);
            uint256 msgFee = msg.value;
            if (_desc.nativeIn) {
                msgFee = msg.value - _amountIn;
            }
            IBridgeAdapter bridge = bridges[keccak256(bytes(_desc.bridgeProvider))];
            IERC20(srcTokenOut).safeIncreaseAllowance(address(bridge), _amountOut);
            bytes memory requestMessage = _encodeRequestMessage(_id, _desc, _dstSwaps);
            bridgeResp = bridge.bridge{value: msgFee}(
                _desc.dstChainId,
                bridgeOutReceiver,
                _amountOut,
                srcTokenOut,
                _desc.bridgeParams,
                requestMessage
            );
        }
        emit RequestSent(
            _id,
            bridgeResp,
            _desc.dstChainId,
            _amountIn,
            srcTokenIn,
            _desc.dstTokenOut,
            bridgeOutReceiver,
            srcTokenOut,
            _amountOut,
            _desc.bridgeProvider
        );
    }

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * Destination chain functions
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

    /**
     * @notice Executes a swap if needed, then sends the output token to the receiver
     * @dev If allowPartialFill is off, this function reverts as soon as one swap in swap routes fails
     * @dev This function is called and is only callable by MessageBus. The transaction of such call is triggered by executor.
     * @dev Bridge contract *always* sends native token to its receiver (this contract) even though the _token field is always an ERC20 token
     * @param _token the token received by this contract
     * @param _amount the amount of token received by this contract
     * @return ok whether the processing is successful
     */
    function executeMessageWithTransfer(
        address, // _sender
        address _token,
        uint256 _amount,
        uint64, // _srcChainId
        bytes memory _message,
        address _executor
    ) external payable override onlyMessageBus nonReentrant returns (ExecutionStatus) {
        Types.Request memory m = abi.decode((_message), (Types.Request));

        // handle the case where amount received is not enough to pay fee
        if (_amount < m.fee) {
            m.fee = _amount;
            emit RequestDone(m.id, 0, 0, _token, m.fee, Types.RequestStatus.Succeeded, bytes(""));
            return ExecutionStatus.Success;
        } else {
            _amount = _amount - m.fee;
        }

        uint256 sumAmtOut = _amount;
        uint256 sumAmtFailed;
        bytes memory forwardResp;
        {
            // Note if to wrap, the NATIVE used to convert is from the ones sent by upstream in advance, but not part of the `msg.value`
            // `msg.value` here is only used to pay for msg fee
            _wrapBridgeOutToken(_token, _amount);

            address tokenOut = _token;
            if (m.swaps.length != 0) {
                ICodec[] memory codecs;
                address tokenIn;
                // swap first before sending the token out to user
                (, tokenIn, tokenOut, codecs) = sanitizeSwaps(m.swaps);
                // tokenIn mismatch
                require(tokenIn == _token, "tkin mm");
                // dex raw calling is not allowed for message execution
                (sumAmtOut, sumAmtFailed) = executeSwapsWithOverride(m.swaps, codecs, _amount, m.allowPartialFill);
                // if at this stage the tx is not reverted, it means at least 1 swap in routes succeeded
                if (sumAmtFailed > 0) {
                    _sendToken(_token, sumAmtFailed, m.receiver, false);
                }
            }

            if (m.forward.length > 0) {
                Types.Forward memory f = abi.decode(m.forward, (Types.Forward));
                IBridgeAdapter cBridge = bridges[CBRIDGE_PROVIDER_HASH];
                require(address(cBridge) != address(0), "cbridge not set");
                IERC20(tokenOut).safeIncreaseAllowance(address(cBridge), sumAmtOut);
                bytes memory requestMessage = _encodeRequestMessage(m.id, m.receiver);
                forwardResp = cBridge.bridge{value: msg.value}(
                    f.dstChain,
                    m.receiver,
                    sumAmtOut,
                    tokenOut,
                    f.params,
                    requestMessage
                );
            } else {
                // msg.value is not used in this code branch, pay back to sender
                if (msg.value > 0) {
                    (bool sent, ) = _executor.call{value: msg.value}("");
                    require(sent, "send fail");
                }
                _sendToken(tokenOut, sumAmtOut, m.receiver, m.nativeOut);
            }
        }
        // status is always success as long as this function call doesn't revert. partial fill is also considered success
        emit RequestDone(m.id, sumAmtOut, sumAmtFailed, _token, m.fee, Types.RequestStatus.Succeeded, forwardResp);
        return ExecutionStatus.Success;
    }

    /**
     * @notice Sends the received token to the receiver
     * @dev Only called if executeMessageWithTransfer reverts
     * @dev Bridge contract *always* sends native token to its receiver (this contract) even though the _token field is always an ERC20 token
     * @param _token the token received by this contract
     * @param _amount the amount of token received by this contract
     * @return ok whether the processing is successful
     */
    function executeMessageWithTransferFallback(
        address, // _sender
        address _token,
        uint256 _amount,
        uint64, // _srcChainId
        bytes memory _message,
        address // _executor
    ) external payable override onlyMessageBus nonReentrant returns (ExecutionStatus) {
        Types.Request memory m = abi.decode((_message), (Types.Request));
        _wrapBridgeOutToken(_token, _amount);
        uint256 refundAmount = _amount - m.fee; // no need to check amount >= fee as it's already checked before
        _sendToken(_token, refundAmount, m.receiver, false);

        emit RequestDone(m.id, 0, refundAmount, _token, m.fee, Types.RequestStatus.Fallback, bytes(""));
        return ExecutionStatus.Success;
    }

    /**
     * @notice Used to trigger refund when bridging fails due to large slippage
     * @dev only MessageBus can call this function, this requires the user to get sigs of the message from SGN
     * @dev Bridge contract *always* sends native token to its receiver (this contract) even though the _token field is always an ERC20 token
     * @param _token the token received by this contract
     * @param _amount the amount of token received by this contract
     * @return ok whether the processing is successful
     */
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message,
        address // _executor
    ) external payable override onlyMessageBus nonReentrant returns (ExecutionStatus) {
        return _refund(_token, _amount, _message);
    }

    function _refund(
        address _token,
        uint256 _amount,
        bytes calldata _message
    ) private returns (ExecutionStatus) {
        Types.Request memory m = abi.decode((_message), (Types.Request));
        _wrapBridgeOutToken(_token, _amount);
        _sendToken(_token, _amount, m.receiver, false);
        emit RequestDone(m.id, 0, _amount, _token, m.fee, Types.RequestStatus.Fallback, bytes(""));
        return ExecutionStatus.Success;
    }

    function executeMessageWithTransferRefundFromAdapter(
        address _token,
        uint256 _amount,
        bytes calldata _message,
        address // _executor
    ) external payable nonReentrant returns (ExecutionStatus) {
        if (_token != nativeWrap) {
            IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
        } else {
            require(msg.value >= _amount, "no native transferred in");
        }
        return _refund(_token, _amount, _message);
    }

    /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
     * Misc
     * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
    function _computeId(address _receiver, uint64 _nonce) private view returns (bytes32) {
        return keccak256(abi.encodePacked(msg.sender, _receiver, uint64(block.chainid), _nonce));
    }

    function _encodeRequestMessage(
        bytes32 _id,
        Types.TransferDescription memory _desc,
        ICodec.SwapDescription[] memory _swaps
    ) internal pure returns (bytes memory message) {
        message = abi.encode(
            Types.Request({
                id: _id,
                swaps: _swaps,
                receiver: _desc.receiver,
                nativeOut: _desc.nativeOut,
                fee: _desc.fee,
                allowPartialFill: _desc.allowPartialFill,
                forward: _desc.forward
            })
        );
    }

    function _encodeRequestMessage(bytes32 _id, address _receiver) internal pure returns (bytes memory message) {
        ICodec.SwapDescription[] memory emptySwaps;
        bytes memory empty;
        message = abi.encode(
            Types.Request({
                id: _id,
                swaps: emptySwaps,
                receiver: _receiver,
                nativeOut: false,
                fee: 0,
                allowPartialFill: false,
                forward: empty
            })
        );
    }

    function _wrapBridgeOutToken(address _token, uint256 _amount) private {
        // Wrapping the bridge token before doing anything. There is inefficiency in this function and _sendToken() only if the received the token
        // is native and the user wants native out. The wrapping then unwrapping process could be skipped. This inefficiency is tolerated for logic tidiness
        if (_token == nativeWrap) {
            // If the bridge out token is a native wrap, we need to check whether the actual received token is native token
            // Note Assumption: only the liquidity bridge is capable of sending a native wrap
            address bridge = IMessageBus(messageBus).liquidityBridge();
            // If bridge's nativeWrap is set, then bridge automatically unwraps the token and send it to this contract
            // Otherwise the received token in this contract is ERC20
            if (IBridgeCeler(bridge).nativeWrap() == nativeWrap) {
                IWETH(nativeWrap).deposit{value: _amount}();
            }
        }
    }

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

    function _verifyFee(
        Types.TransferDescription memory _desc,
        uint256 _amountIn,
        address _tokenIn
    ) private view {
        bytes32 hash = keccak256(
            abi.encodePacked(
                "executor fee",
                uint64(block.chainid),
                _desc.dstChainId,
                _amountIn,
                _tokenIn,
                _desc.feeDeadline,
                _desc.fee
            )
        );
        bytes32 signHash = hash.toEthSignedMessageHash();
        verifySig(signHash, _desc.feeSig);
        require(_desc.feeDeadline > block.timestamp, "deadline exceeded");
    }

    function setNativeWrap(address _nativeWrap) external onlyOwner {
        nativeWrap = _nativeWrap;
        emit NativeWrapUpdated(_nativeWrap);
    }

    // This is needed to receive ETH when calling `IWETH.withdraw`
    receive() external payable {}
}

File 2 of 31 : 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 31 : 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 31 : 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 31 : 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 31 : Types.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.15;

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

library Types {
    /**
     * @notice Denotes the status of a cross-chain transfer/swap request
     * @dev Partially filled requests are considered 'Succeeded'. There is no 'Failed' state as
     * it's only possible if everything reverts and there is no successful transaction
     * @param Null An empty status that should never be reached
     * @param Succeeded Transfer/swap has succeeded and funds are received by the receiver
     * @param Fallback Swaps have failed on the dst chain, and bridge tokens are refunded to receiver
     */
    enum RequestStatus {
        Null,
        Succeeded,
        Fallback
    }

    struct Request {
        bytes32 id; // see _computeId()
        ICodec.SwapDescription[] swaps; // the swaps need to happen on the destination chain
        address receiver; // see TransferDescription.receiver
        bool nativeOut; // see TransferDescription.nativeOut
        uint256 fee; // see TransferDescription.fee
        bool allowPartialFill; // see TransferDescription.allowPartialFill
        // sets if another cbridge hop is required on the chain, abi.encode(Forward)
        bytes forward;
    }

    struct Forward {
        uint64 dstChain;
        // abi encoded cbridge params
        bytes params;
    }

    struct TransferDescription {
        address receiver; // The receiving party (the user) of the final output token
        uint64 dstChainId; // Destination chain id
        // The address of the TransferSwapper on the destination chain.
        // Ignored if there is no swaps on the destination chain.
        address dstTransferSwapper;
        // A number unique enough to be used in request ID generation.
        uint64 nonce;
        // 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;
        bool nativeIn; // whether to check msg.value and wrap token before swapping/sending
        bool nativeOut; // whether to unwrap before sending the final token to user
        uint256 fee; // this fee is only executor fee. it does not include msg bridge fee
        uint256 feeDeadline; // the unix timestamp before which the fee is valid
        // sig of sha3("executor fee", srcChainId, dstChainId, amountIn, tokenIn, feeDeadline, fee)
        // see _verifyFee()
        bytes feeSig;
        uint256 amountIn;
        address tokenIn;
        // only used if the swap on the src chain is an external swap
        address bridgeTokenIn;
        address dstTokenOut; // the final output token, emitted in event for display purpose only
        // in case of multi route swaps, whether to allow the successful swaps to go through
        // and sending the amountIn of the failed swaps back to user
        bool allowPartialFill;
        // sets if another cbridge hop is required on the dst chain, abi.encode(Forward)
        bytes forward;
    }
}

File 7 of 31 : MessageSenderLib.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 "../interfaces/IBridgeCeler.sol";
import "../interfaces/IOriginalTokenVault.sol";
import "../interfaces/IOriginalTokenVaultV2.sol";
import "../interfaces/IPeggedTokenBridge.sol";
import "../interfaces/IPeggedTokenBridgeV2.sol";
import "../interfaces/IMessageBus.sol";
import "./MsgDataTypes.sol";

library MessageSenderLib {
    using SafeERC20 for IERC20;

    // ============== Internal library functions called by apps ==============

    /**
     * @notice Sends a message to an app on another chain via MessageBus without an associated transfer.
     * @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.
     * @param _messageBus The address of the MessageBus on this chain.
     * @param _fee The fee amount to pay to MessageBus.
     */
    function sendMessage(
        address _receiver,
        uint64 _dstChainId,
        bytes memory _message,
        address _messageBus,
        uint256 _fee
    ) internal {
        IMessageBus(_messageBus).sendMessage{value: _fee}(_receiver, _dstChainId, _message);
    }

    /**
     * @notice Sends a message to an app on another chain via MessageBus with an associated transfer.
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _maxSlippage The max slippage accepted, given as percentage in point (pip). Eg. 5000 means 0.5%.
     * Must be greater than minimalMaxSlippage. Receiver is guaranteed to receive at least (100% - max slippage percentage) * amount or the
     * transfer can be refunded. Only applicable to the {MsgDataTypes.BridgeSendType.Liquidity}.
     * @param _message Arbitrary message bytes to be decoded by the destination app contract.
     * @param _bridgeSendType One of the {MsgDataTypes.BridgeSendType} enum.
     * @param _messageBus The address of the MessageBus on this chain.
     * @param _fee The fee amount to pay to MessageBus.
     * @return The transfer ID.
     */
    function sendMessageWithTransfer(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        bytes memory _message,
        MsgDataTypes.BridgeSendType _bridgeSendType,
        address _messageBus,
        uint256 _fee
    ) internal returns (bytes32) {
        (bytes32 transferId, address bridge) = sendTokenTransfer(
            _receiver,
            _token,
            _amount,
            _dstChainId,
            _nonce,
            _maxSlippage,
            _bridgeSendType,
            _messageBus
        );
        if (_message.length > 0) {
            IMessageBus(_messageBus).sendMessageWithTransfer{value: _fee}(
                _receiver,
                _dstChainId,
                bridge,
                transferId,
                _message
            );
        }
        return transferId;
    }

    /**
     * @notice Sends a token transfer via a bridge.
     * @param _receiver The address of the destination app contract.
     * @param _token The address of the token to be sent.
     * @param _amount The amount of tokens to be sent.
     * @param _dstChainId The destination chain ID.
     * @param _nonce A number input to guarantee uniqueness of transferId. Can be timestamp in practice.
     * @param _maxSlippage The max slippage accepted, given as percentage in point (pip). Eg. 5000 means 0.5%.
     * Must be greater than minimalMaxSlippage. Receiver is guaranteed to receive at least (100% - max slippage percentage) * amount or the
     * transfer can be refunded.
     * @param _bridgeSendType One of the {MsgDataTypes.BridgeSendType} enum.
     */
    function sendTokenTransfer(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage,
        MsgDataTypes.BridgeSendType _bridgeSendType,
        address _messageBus
    ) internal returns (bytes32 transferId, address bridge) {
        if (_bridgeSendType == MsgDataTypes.BridgeSendType.Liquidity) {
            bridge = IMessageBus(_messageBus).liquidityBridge();
            IERC20(_token).safeIncreaseAllowance(bridge, _amount);
            IBridgeCeler(bridge).send(_receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage);
            transferId = computeLiqBridgeTransferId(_receiver, _token, _amount, _dstChainId, _nonce);
        } else if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegDeposit) {
            bridge = IMessageBus(_messageBus).pegVault();
            IERC20(_token).safeIncreaseAllowance(bridge, _amount);
            IOriginalTokenVault(bridge).deposit(_token, _amount, _dstChainId, _receiver, _nonce);
            transferId = computePegV1DepositId(_receiver, _token, _amount, _dstChainId, _nonce);
        } else if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegBurn) {
            bridge = IMessageBus(_messageBus).pegBridge();
            IERC20(_token).safeIncreaseAllowance(bridge, _amount);
            IPeggedTokenBridge(bridge).burn(_token, _amount, _receiver, _nonce);
            // handle cases where certain tokens do not spend allowance for role-based burn
            IERC20(_token).safeApprove(bridge, 0);
            transferId = computePegV1BurnId(_receiver, _token, _amount, _nonce);
        } else if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Deposit) {
            bridge = IMessageBus(_messageBus).pegVaultV2();
            IERC20(_token).safeIncreaseAllowance(bridge, _amount);
            transferId = IOriginalTokenVaultV2(bridge).deposit(_token, _amount, _dstChainId, _receiver, _nonce);
        } else if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Burn) {
            bridge = IMessageBus(_messageBus).pegBridgeV2();
            IERC20(_token).safeIncreaseAllowance(bridge, _amount);
            transferId = IPeggedTokenBridgeV2(bridge).burn(_token, _amount, _dstChainId, _receiver, _nonce);
            // handle cases where certain tokens do not spend allowance for role-based burn
            IERC20(_token).safeApprove(bridge, 0);
        } else if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegV2BurnFrom) {
            bridge = IMessageBus(_messageBus).pegBridgeV2();
            IERC20(_token).safeIncreaseAllowance(bridge, _amount);
            transferId = IPeggedTokenBridgeV2(bridge).burnFrom(_token, _amount, _dstChainId, _receiver, _nonce);
            // handle cases where certain tokens do not spend allowance for role-based burn
            IERC20(_token).safeApprove(bridge, 0);
        } else {
            revert("bridge type not supported");
        }
    }

    function computeLiqBridgeTransferId(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce
    ) internal view returns (bytes32) {
        return
            keccak256(
                abi.encodePacked(address(this), _receiver, _token, _amount, _dstChainId, _nonce, uint64(block.chainid))
            );
    }

    function computePegV1DepositId(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce
    ) internal view returns (bytes32) {
        return
            keccak256(
                abi.encodePacked(address(this), _token, _amount, _dstChainId, _receiver, _nonce, uint64(block.chainid))
            );
    }

    function computePegV1BurnId(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _nonce
    ) internal view returns (bytes32) {
        return keccak256(abi.encodePacked(address(this), _token, _amount, _receiver, _nonce, uint64(block.chainid)));
    }
}

File 8 of 31 : MessageReceiverApp.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.15;

import "../interfaces/IMessageReceiverApp.sol";
import "./MessageBusAddress.sol";

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

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

    /**
     * @notice Called by MessageBus (MessageBusReceiver) if the process is originated from MessageBus (MessageBusSender)'s
     *         sendMessageWithTransfer it is only called when the tokens are checked to be arrived at this contract's address.
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @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 executeMessageWithTransfer(
        address _sender,
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable virtual override onlyMessageBus returns (ExecutionStatus) {}

    /**
     * @notice Only called by MessageBus (MessageBusReceiver) if
     *         1. executeMessageWithTransfer reverts, or
     *         2. executeMessageWithTransfer returns ExecutionStatus.Fail
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @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 executeMessageWithTransferFallback(
        address _sender,
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable virtual override onlyMessageBus 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
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message,
        address _executor
    ) external payable virtual override onlyMessageBus returns (ExecutionStatus) {}

    /**
     * @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 override onlyMessageBus returns (ExecutionStatus) {}
}

File 9 of 31 : BridgeRegistry.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "./interfaces/IBridgeAdapter.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

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

    mapping(bytes32 => IBridgeAdapter) public bridges;

    // to disable a bridge, set the bridge addr of the corresponding provider to address(0)
    function setSupportedBridges(
        string[] calldata _bridgeProviders,
        address[] calldata _bridgeAdapters
    ) external onlyOwner {
        require(_bridgeProviders.length == _bridgeAdapters.length, "params size mismatch");
        for (uint256 i = 0; i < _bridgeProviders.length; i++) {
            bridges[keccak256(bytes(_bridgeProviders[i]))] = IBridgeAdapter(_bridgeAdapters[i]);
        }
        emit SupportedBridgesUpdated(_bridgeProviders, _bridgeAdapters);
    }
}

File 10 of 31 : 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/access/Ownable.sol";

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

    address public feeCollector;

    event FeeCollectorUpdated(address from, address to);

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

    constructor(address _feeCollector) {
        feeCollector = _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 {
        address oldFeeCollector = feeCollector;
        feeCollector = _feeCollector;
        emit FeeCollectorUpdated(oldFeeCollector, _feeCollector);
    }
}

File 11 of 31 : SigVerifier.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

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

    address public signer;

    event SignerUpdated(address from, address to);

    constructor(address _signer) {
        signer = _signer;
    }

    function setSigner(address _signer) public onlyOwner {
        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 12 of 31 : Swapper.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/access/Ownable.sol";
import "./CodecRegistry.sol";
import "./interfaces/ICodec.sol";
import "./interfaces/IWETH.sol";
import "./DexRegistry.sol";

/**
 * @title Loads codecs for the swaps and performs swap actions
 * @author Padoriku
 */
contract Swapper is CodecRegistry, DexRegistry {
    using SafeERC20 for IERC20;

    // Externally encoded swaps are not encoded by ChainHop's backend, and are differenciated by the target dex address.
    mapping(address => bool) public externalSwap;

    constructor(
        string[] memory _funcSigs,
        address[] memory _codecs,
        address[] memory _supportedDexList,
        string[] memory _supportedDexFuncs,
        address[] memory _externalSwapDexList
    ) DexRegistry(_supportedDexList, _supportedDexFuncs) CodecRegistry(_funcSigs, _codecs) {
        for (uint256 i = 0; i < _externalSwapDexList.length; i++) {
            _setExternalSwap(_externalSwapDexList[i], true);
        }
    }

    event ExternalSwapUpdated(address dex, bool enabled);

    /**
     * @dev Checks the input swaps for that tokenIn and tokenOut for every swap should be the same
     * @param _swaps the swaps the check
     * @return sumAmtIn the sum of all amountIns in the swaps
     * @return tokenIn the input token of the swaps
     * @return tokenOut the desired output token of the swaps
     * @return codecs a list of codecs which each of them corresponds to a swap
     */
    function sanitizeSwaps(ICodec.SwapDescription[] memory _swaps)
        internal
        view
        returns (
            uint256 sumAmtIn,
            address tokenIn,
            address tokenOut,
            ICodec[] memory codecs // _codecs[i] is for _swaps[i]
        )
    {
        address prevTokenIn;
        address prevTokenOut;
        codecs = loadCodecs(_swaps);

        for (uint256 i = 0; i < _swaps.length; i++) {
            require(dexRegistry[_swaps[i].dex][bytes4(_swaps[i].data)], "unsupported dex");
            (uint256 _amountIn, address _tokenIn, address _tokenOut) = codecs[i].decodeCalldata(_swaps[i]);
            require(prevTokenIn == address(0) || prevTokenIn == _tokenIn, "tkin mismatch");
            prevTokenIn = _tokenIn;
            require(prevTokenOut == address(0) || prevTokenOut == _tokenOut, "tko mismatch");
            prevTokenOut = _tokenOut;

            sumAmtIn += _amountIn;
            tokenIn = _tokenIn;
            tokenOut = _tokenOut;
        }
    }

    /**
     * @notice Executes the swaps, decode their return values and sums the returned amount
     * @dev This function is intended to be used on src chain only
     * @dev This function immediately fails (return false) if any swaps fail. There is no "partial fill" on src chain
     * @param _swaps swaps. this function assumes that the swaps are already sanitized
     * @param _codecs the codecs for each swap
     * @return ok whether the operation is successful
     * @return sumAmtOut the sum of all amounts gained from swapping
     */
    function executeSwaps(
        ICodec.SwapDescription[] memory _swaps,
        ICodec[] memory _codecs // _codecs[i] is for _swaps[i]
    ) internal returns (bool ok, uint256 sumAmtOut) {
        for (uint256 i = 0; i < _swaps.length; i++) {
            (uint256 amountIn, address tokenIn, address tokenOut) = _codecs[i].decodeCalldata(_swaps[i]);
            bytes memory data = _codecs[i].encodeCalldataWithOverride(_swaps[i].data, amountIn, address(this));
            IERC20(tokenIn).safeIncreaseAllowance(_swaps[i].dex, amountIn);
            uint256 balBefore = IERC20(tokenOut).balanceOf(address(this));
            (ok, ) = _swaps[i].dex.call(data);
            if (!ok) {
                return (false, 0);
            }
            uint256 balAfter = IERC20(tokenOut).balanceOf(address(this));
            sumAmtOut += balAfter - balBefore;
        }
    }

    /**
     * @notice Executes the externally encoded swaps
     * @dev This function is intended to be used on src chain only
     * @dev This function immediately fails (return false) if any swaps fail. There is no "partial fill" on src chain
     * @param _swap. this function assumes that the swaps are already sanitized
     * @return ok whether the operation is successful
     * @return amtOut the amount gained from swapping
     */
    function executeExternalSwap(
        address tokenIn,
        address tokenOut,
        uint256 amountIn,
        ICodec.SwapDescription memory _swap
    ) internal returns (bool ok, uint256 amtOut) {
        IERC20(tokenIn).safeIncreaseAllowance(_swap.dex, amountIn);
        uint256 balBefore = IERC20(tokenOut).balanceOf(address(this));
        (ok, ) = _swap.dex.call(_swap.data);
        if (!ok) {
            return (false, 0);
        }
        uint256 balAfter = IERC20(tokenOut).balanceOf(address(this));
        amtOut = balAfter - balBefore;
    }

    /**
     * @notice Executes the swaps with override, redistributes amountIns for each swap route,
     * decode their return values and sums the returned amount
     * @dev This function is intended to be used on dst chain only
     * @param _swaps swaps to execute. this function assumes that the swaps are already sanitized
     * @param _codecs the codecs for each swap
     * @param _amountInOverride the amountIn to substitute the amountIns in swaps for
     * @dev _amountInOverride serves the purpose of correcting the estimated amountIns to actual bridge outs
     * @dev _amountInOverride is also distributed according to the weight of each original amountIn
     * @return sumAmtOut the sum of all amounts gained from swapping
     * @return sumAmtFailed the sum of all amounts that fails to swap
     */
    function executeSwapsWithOverride(
        ICodec.SwapDescription[] memory _swaps,
        ICodec[] memory _codecs, // _codecs[i] is for _swaps[i]
        uint256 _amountInOverride,
        bool _allowPartialFill
    ) internal returns (uint256 sumAmtOut, uint256 sumAmtFailed) {
        (uint256[] memory amountIns, address tokenIn, address tokenOut) = _redistributeAmountIn(
            _swaps,
            _amountInOverride,
            _codecs
        );
        uint256 balBefore = IERC20(tokenOut).balanceOf(address(this));
        // execute the swaps with adjusted amountIns
        for (uint256 i = 0; i < _swaps.length; i++) {
            bytes memory swapCalldata = _codecs[i].encodeCalldataWithOverride(
                _swaps[i].data,
                amountIns[i],
                address(this)
            );
            IERC20(tokenIn).safeIncreaseAllowance(_swaps[i].dex, amountIns[i]);
            (bool ok, ) = _swaps[i].dex.call(swapCalldata);
            require(ok || _allowPartialFill, "swap failed");
            if (!ok) {
                sumAmtFailed += amountIns[i];
            }
        }
        uint256 balAfter = IERC20(tokenOut).balanceOf(address(this));
        sumAmtOut = balAfter - balBefore;
        require(sumAmtOut > 0, "all swaps failed");
    }

    /// @notice distributes the _amountInOverride to the swaps base on how much each original amountIns weight
    function _redistributeAmountIn(
        ICodec.SwapDescription[] memory _swaps,
        uint256 _amountInOverride,
        ICodec[] memory _codecs
    )
        private
        view
        returns (
            uint256[] memory amountIns,
            address tokenIn,
            address tokenOut
        )
    {
        uint256 sumAmtIn;
        amountIns = new uint256[](_swaps.length);

        // compute sumAmtIn and collect amountIns
        for (uint256 i = 0; i < _swaps.length; i++) {
            uint256 amountIn;
            (amountIn, tokenIn, tokenOut) = _codecs[i].decodeCalldata(_swaps[i]);
            sumAmtIn += amountIn;
            amountIns[i] = amountIn;
        }

        // compute adjusted amountIns with regard to the weight of each amountIns in total amountIn
        for (uint256 i = 0; i < amountIns.length; i++) {
            amountIns[i] = (_amountInOverride * amountIns[i]) / sumAmtIn;
        }
    }

    // Checks whether a swap is an "externally encoded swap"
    function isExternalSwap(ICodec.SwapDescription memory _swap) internal view returns (bool ok) {
        require(dexRegistry[_swap.dex][bytes4(_swap.data)], "unsupported dex");
        return externalSwap[_swap.dex];
    }

    function setExternalSwap(address _dex, bool _enabled) external onlyOwner {
        _setExternalSwap(_dex, _enabled);
        emit ExternalSwapUpdated(_dex, _enabled);
    }

    function _setExternalSwap(address _dex, bool _enabled) private {
        bool enabled = externalSwap[_dex];
        require(enabled != _enabled, "nop");
        externalSwap[_dex] = _enabled;
    }
}

File 13 of 31 : 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,
        // The message to be bridged alongside the transfer.
        // Note if the bridge adapter doesn't support message passing, the call should revert when
        // this field is set.
        bytes memory _requestMessage
    ) external payable returns (bytes memory bridgeResp);
}

File 14 of 31 : 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 15 of 31 : 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 16 of 31 : 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 17 of 31 : 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 18 of 31 : 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 19 of 31 : IBridgeCeler.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

interface IBridgeCeler {
    // common
    function delayThresholds(address token) external view returns (uint256);

    function delayPeriod() external view returns (uint256);

    function epochVolumes(address token) external view returns (uint256);

    function epochVolumeCaps(address token) external view returns (uint256);

    // liquidity bridge
    function minSend(address token) external view returns (uint256);

    function maxSend(address token) external view returns (uint256);

    // peg vault v0/v2
    function minDeposit(address token) external view returns (uint256);

    function maxDeposit(address token) external view returns (uint256);

    // peg bridge v0/v2
    function minBurn(address token) external view returns (uint256);

    function maxBurn(address token) external view returns (uint256);

    function nativeWrap() external view returns (address);

    function send(
        address _receiver,
        address _token,
        uint256 _amount,
        uint64 _dstChainId,
        uint64 _nonce,
        uint32 _maxSlippage
    ) external;

    function relay(
        bytes calldata _relayRequest,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    function transfers(bytes32 transferId) external view returns (bool);

    function withdraws(bytes32 withdrawId) external view returns (bool);

    function withdraw(
        bytes calldata _wdmsg,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external;

    /**
     * @notice Verifies that a message is signed by a quorum among the signers.
     * @param _msg signed message
     * @param _sigs list of signatures sorted by signer addresses in ascending order
     * @param _signers sorted list of current signers
     * @param _powers powers of current signers
     */
    function verifySigs(
        bytes memory _msg,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external view;
}

File 20 of 31 : IOriginalTokenVault.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

interface IOriginalTokenVault {
    /**
     * @notice Lock original tokens to trigger mint at a remote chain's PeggedTokenBridge
     * @param _token local token address
     * @param _amount locked token amount
     * @param _mintChainId destination chainId to mint tokens
     * @param _mintAccount destination account to receive minted tokens
     * @param _nonce user input to guarantee unique depositId
     */
    function deposit(
        address _token,
        uint256 _amount,
        uint64 _mintChainId,
        address _mintAccount,
        uint64 _nonce
    ) external;

    function records(bytes32 recordId) external view returns (bool);
}

File 21 of 31 : IOriginalTokenVaultV2.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

interface IOriginalTokenVaultV2 {
    /**
     * @notice Lock original tokens to trigger mint at a remote chain's PeggedTokenBridge
     * @param _token local token address
     * @param _amount locked token amount
     * @param _mintChainId destination chainId to mint tokens
     * @param _mintAccount destination account to receive minted tokens
     * @param _nonce user input to guarantee unique depositId
     */
    function deposit(
        address _token,
        uint256 _amount,
        uint64 _mintChainId,
        address _mintAccount,
        uint64 _nonce
    ) external returns (bytes32);

    function records(bytes32 recordId) external view returns (bool);
}

File 22 of 31 : IPeggedTokenBridge.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

interface IPeggedTokenBridge {
    /**
     * @notice Burn tokens to trigger withdrawal at a remote chain's OriginalTokenVault
     * @param _token local token address
     * @param _amount locked token amount
     * @param _withdrawAccount account who withdraw original tokens on the remote chain
     * @param _nonce user input to guarantee unique depositId
     */
    function burn(
        address _token,
        uint256 _amount,
        address _withdrawAccount,
        uint64 _nonce
    ) external;

    function records(bytes32 recordId) external view returns (bool);
}

File 23 of 31 : IPeggedTokenBridgeV2.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

interface IPeggedTokenBridgeV2 {
    /**
     * @notice Burn pegged tokens to trigger a cross-chain withdrawal of the original tokens at a remote chain's
     * OriginalTokenVault, or mint at another remote chain
     * @param _token The pegged token address.
     * @param _amount The amount to burn.
     * @param _toChainId If zero, withdraw from original vault; otherwise, the remote chain to mint tokens.
     * @param _toAccount The account to receive tokens on the remote chain
     * @param _nonce A number to guarantee unique depositId. Can be timestamp in practice.
     */
    function burn(
        address _token,
        uint256 _amount,
        uint64 _toChainId,
        address _toAccount,
        uint64 _nonce
    ) external returns (bytes32);

    // same with `burn` above, use openzeppelin ERC20Burnable interface
    function burnFrom(
        address _token,
        uint256 _amount,
        uint64 _toChainId,
        address _toAccount,
        uint64 _nonce
    ) external returns (bytes32);

    /**
     * @notice Mint tokens triggered by deposit at a remote chain's OriginalTokenVault.
     * @param _request The serialized Mint protobuf.
     * @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 mint(
        bytes calldata _request,
        bytes[] calldata _sigs,
        address[] calldata _signers,
        uint256[] calldata _powers
    ) external returns (bytes32);

    function records(bytes32 recordId) external view returns (bool);
}

File 24 of 31 : IMessageBus.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

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

interface IMessageBus {
    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 25 of 31 : IMessageReceiverApp.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.0;

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

    /**
     * @notice Called by MessageBus (MessageBusReceiver) if the process is originated from MessageBus (MessageBusSender)'s
     *         sendMessageWithTransfer it is only called when the tokens are checked to be arrived at this contract's address.
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @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 executeMessageWithTransfer(
        address _sender,
        address _token,
        uint256 _amount,
        uint64 _srcChainId,
        bytes calldata _message,
        address _executor
    ) external payable returns (ExecutionStatus);

    /**
     * @notice Only called by MessageBus (MessageBusReceiver) if
     *         1. executeMessageWithTransfer reverts, or
     *         2. executeMessageWithTransfer returns ExecutionStatus.Fail
     * @param _sender The address of the source app contract
     * @param _token The address of the token that comes out of the bridge
     * @param _amount The amount of tokens received at this contract through the cross-chain bridge.
     *        the contract that implements this contract can safely assume that the tokens will arrive before this
     *        function is called.
     * @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 executeMessageWithTransferFallback(
        address _sender,
        address _token,
        uint256 _amount,
        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
     * @param _executor Address who called the MessageBus execution function
     */
    function executeMessageWithTransferRefund(
        address _token,
        uint256 _amount,
        bytes calldata _message,
        address _executor
    ) external payable returns (ExecutionStatus);

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

File 26 of 31 : MessageBusAddress.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity 0.8.15;

import "@openzeppelin/contracts/access/Ownable.sol";

abstract contract MessageBusAddress is Ownable {
    event MessageBusUpdated(address messageBus);

    address public messageBus;

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

File 27 of 31 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @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.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @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");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 28 of 31 : 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;
    }
}

File 29 of 31 : CodecRegistry.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "@openzeppelin/contracts/access/Ownable.sol";
import "./interfaces/ICodec.sol";

/**
 * @title A codec registry that maps swap function selectors to corresponding codec addresses
 * @author Padoriku
 */
abstract contract CodecRegistry is Ownable {
    mapping(bytes4 => ICodec) public selector2codec;

    // not used programmatically, but added for contract transparency
    address[] public codecs;

    event CodecUpdated(bytes4 selector, address codec);

    constructor(string[] memory _funcSigs, address[] memory _codecs) {
        require(_funcSigs.length == _codecs.length, "len mm");
        for (uint256 i = 0; i < _funcSigs.length; i++) {
            bytes4 selector = bytes4(keccak256(bytes(_funcSigs[i])));
            _setCodec(selector, _codecs[i]);
        }
    }

    function setCodec(string calldata _funcSig, address _codec) public onlyOwner {
        bytes4 selector = bytes4(keccak256(bytes(_funcSig)));
        _setCodec(selector, _codec);
        emit CodecUpdated(selector, _codec);
    }

    function _setCodec(bytes4 _selector, address _codec) private {
        selector2codec[_selector] = ICodec(_codec);
        codecs.push(_codec);
    }

    function loadCodecs(ICodec.SwapDescription[] memory _swaps) internal view returns (ICodec[] memory) {
        ICodec[] memory _codecs = new ICodec[](_swaps.length);
        for (uint256 i = 0; i < _swaps.length; i++) {
            bytes4 selector = bytes4(_swaps[i].data);
            _codecs[i] = selector2codec[selector];
            require(address(_codecs[i]) != address(0), "cdc no found");
        }
        return (_codecs);
    }

    function getCodec(
        bytes4[] memory _selectors,
        ICodec[] memory _codecs,
        bytes4 _selector
    ) internal pure returns (ICodec) {
        for (uint256 i = 0; i < _codecs.length; i++) {
            if (_selector == _selectors[i]) {
                return _codecs[i];
            }
        }
        revert("cdc no found");
    }
}

File 30 of 31 : 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 31 of 31 : DexRegistry.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

import "@openzeppelin/contracts/access/Ownable.sol";

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

    // 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)
    mapping(address => mapping(bytes4 => bool)) public dexRegistry;

    constructor(address[] memory _supportedDexList, string[] memory _supportedFuncs) {
        for (uint256 i = 0; i < _supportedDexList.length; i++) {
            bytes4 selector = bytes4(keccak256(bytes(_supportedFuncs[i])));
            _setSupportedDex(_supportedDexList[i], selector, true);
        }
    }

    function setSupportedDex(
        address _dex,
        bytes4 _selector,
        bool _enabled
    ) external onlyOwner {
        _setSupportedDex(_dex, _selector, _enabled);
        emit SupportedDexUpdated(_dex, _selector, _enabled);
    }

    function _setSupportedDex(
        address _dex,
        bytes4 _selector,
        bool _enabled
    ) private {
        bool enabled = dexRegistry[_dex][_selector];
        require(enabled != _enabled, "nop");
        dexRegistry[_dex][_selector] = _enabled;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"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":"string[]","name":"_funcSigs","type":"string[]"},{"internalType":"address[]","name":"_codecs","type":"address[]"},{"internalType":"address[]","name":"_supportedDexList","type":"address[]"},{"internalType":"string[]","name":"_supportedDexFuncs","type":"string[]"},{"internalType":"address[]","name":"_externalSwapDexList","type":"address[]"},{"internalType":"bool","name":"_testMode","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"address","name":"codec","type":"address"}],"name":"CodecUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"}],"name":"DirectSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"dex","type":"address"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"ExternalSwapUpdated","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":"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":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"dstAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"refundToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeCollected","type":"uint256"},{"indexed":false,"internalType":"enum Types.RequestStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"forwardResp","type":"bytes"}],"name":"RequestDone","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"bridgeResp","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"srcToken","type":"address"},{"indexed":false,"internalType":"address","name":"dstToken","type":"address"},{"indexed":false,"internalType":"address","name":"bridgeOutReceiver","type":"address"},{"indexed":false,"internalType":"address","name":"bridgeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"bridgeAmount","type":"uint256"},{"indexed":false,"internalType":"string","name":"bridgeProvider","type":"string"}],"name":"RequestSent","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":"string[]","name":"_bridgeProviders","type":"string[]"},{"indexed":false,"internalType":"address[]","name":"_bridgeAdapters","type":"address[]"}],"name":"SupportedBridgesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"dex","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"SupportedDexUpdated","type":"event"},{"inputs":[],"name":"CBRIDGE_PROVIDER_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridges","outputs":[{"internalType":"contract IBridgeAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"codecs","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"dexRegistry","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint64","name":"_srcChainId","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"}],"name":"executeMessage","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"}],"name":"executeMessageWithTransfer","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferFallback","outputs":[{"internalType":"enum IMessageReceiverApp.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"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferRefund","outputs":[{"internalType":"enum IMessageReceiverApp.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"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferRefundFromAdapter","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"externalSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"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":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"selector2codec","outputs":[{"internalType":"contract ICodec","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_funcSig","type":"string"},{"internalType":"address","name":"_codec","type":"address"}],"name":"setCodec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dex","type":"address"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setExternalSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_messageBus","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":"_bridgeProviders","type":"string[]"},{"internalType":"address[]","name":"_bridgeAdapters","type":"address[]"}],"name":"setSupportedBridges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dex","type":"address"},{"internalType":"bytes4","name":"_selector","type":"bytes4"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setSupportedDex","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":[{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"internalType":"address","name":"dstTransferSwapper","type":"address"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"string","name":"bridgeProvider","type":"string"},{"internalType":"bytes","name":"bridgeParams","type":"bytes"},{"internalType":"bool","name":"nativeIn","type":"bool"},{"internalType":"bool","name":"nativeOut","type":"bool"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeDeadline","type":"uint256"},{"internalType":"bytes","name":"feeSig","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"bridgeTokenIn","type":"address"},{"internalType":"address","name":"dstTokenOut","type":"address"},{"internalType":"bool","name":"allowPartialFill","type":"bool"},{"internalType":"bytes","name":"forward","type":"bytes"}],"internalType":"struct Types.TransferDescription","name":"_desc","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ICodec.SwapDescription[]","name":"_srcSwaps","type":"tuple[]"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ICodec.SwapDescription[]","name":"_dstSwaps","type":"tuple[]"}],"name":"transferWithSwap","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b5060405162005f7438038062005f7483398101604081905262000034916200076e565b86888787878787828286866200004a33620002c6565b8051825114620000775760405162461bcd60e51b81526004016200006e906200090c565b60405180910390fd5b60005b8251811015620000f05760008382815181106200009b576200009b6200091e565b6020026020010151805190602001209050620000da81848481518110620000c657620000c66200091e565b60200260200101516200031660201b60201c565b5080620000e7816200094a565b9150506200007a565b50505060005b82518110156200016e5760008282815181106200011757620001176200091e565b6020026020010151805190602001209050620001588483815181106200014157620001416200091e565b60200260200101518260016200038860201b60201c565b508062000165816200094a565b915050620000f6565b50505060005b8151811015620001c257620001ad8282815181106200019757620001976200091e565b602002602001015160016200042160201b60201c565b80620001b9816200094a565b91505062000174565b50505050505080600660006101000a8154816001600160a01b0302191690836001600160a01b031602179055505080600760006101000a8154816001600160a01b0302191690836001600160a01b0316021790555050600160088190555089600160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555088600a60006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600160146101000a81548160ff021916908315150217905550604051806040016040528060078152602001666362726964676560c81b81525080519060200120608081815250505050505050505050505062000994565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff1681151581151503620003df5760405162461bcd60e51b81526004016200006e9062000982565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b6001600160a01b03821660009081526005602052604090205460ff1681151581151503620004635760405162461bcd60e51b81526004016200006e9062000982565b506001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b60006001600160a01b0382165b92915050565b620004ad816200048f565b8114620004b957600080fd5b50565b80516200049c81620004a2565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681018181106001600160401b0382111715620005075762000507620004c9565b6040525050565b60006200051a60405190565b9050620005288282620004df565b919050565b60006001600160401b03821115620005495762000549620004c9565b5060209081020190565b60006001600160401b038211156200056f576200056f620004c9565b601f19601f83011660200192915050565b60005b838110156200059d57818101518382015260200162000583565b83811115620005ad576000848401525b50505050565b6000620005ca620005c48462000553565b6200050e565b905082815260208101848484011115620005e757620005e7600080fd5b620005f484828562000580565b509392505050565b600082601f830112620006125762000612600080fd5b815162000624848260208601620005b3565b949350505050565b60006200063d620005c4846200052d565b838152905060208082019084028301858111156200065e576200065e600080fd5b835b81811015620006a45780516001600160401b03811115620006845762000684600080fd5b808601620006938982620005fc565b855250506020928301920162000660565b5050509392505050565b600082601f830112620006c457620006c4600080fd5b8151620006248482602086016200062c565b6000620006e7620005c4846200052d565b83815290506020808201908402830185811115620007085762000708600080fd5b835b81811015620006a45780620007208882620004bc565b845250602092830192016200070a565b600082601f830112620007465762000746600080fd5b815162000624848260208601620006d6565b801515620004ad565b80516200049c8162000758565b6000806000806000806000806000806101408b8d031215620007935762000793600080fd5b6000620007a18d8d620004bc565b9a50506020620007b48d828e01620004bc565b9950506040620007c78d828e01620004bc565b9850506060620007da8d828e01620004bc565b97505060808b01516001600160401b03811115620007fb57620007fb600080fd5b620008098d828e01620006ae565b96505060a08b01516001600160401b038111156200082a576200082a600080fd5b620008388d828e0162000730565b95505060c08b01516001600160401b03811115620008595762000859600080fd5b620008678d828e0162000730565b94505060e08b01516001600160401b03811115620008885762000888600080fd5b620008968d828e01620006ae565b9350506101008b01516001600160401b03811115620008b857620008b8600080fd5b620008c68d828e0162000730565b925050610120620008da8d828e0162000761565b9150509295989b9194979a5092959850565b60068152600060208201656c656e206d6d60d01b815291505b5060200190565b602080825281016200049c81620008ec565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019820362000960576200096062000934565b5060010190565b600381526000602082016206e6f760ec1b8152915062000905565b602080825281016200049c8162000967565b6080516155b6620009be6000396000818161047301528181610aee0152610ffc01526155b66000f3fe6080604052600436106101c65760003560e01c8063918ead76116100f7578063c415b95c11610095578063efcfd8f511610064578063efcfd8f514610546578063f2fde38b14610566578063fb45378714610586578063fbf5d7631461059957600080fd5b8063c415b95c146104a2578063c5bccca3146104c2578063cd9ea342146104e2578063eeaaa6511461050357600080fd5b8063a1a227fa116100d1578063a1a227fa1461040e578063a42dce801461042e578063b8cfdc861461044e578063c04049981461046157600080fd5b8063918ead76146103a057806391ec04b5146103c05780639c649fdf146103fb57600080fd5b80635b5a66a711610164578063715018a61161013e578063715018a61461033a5780637cd2bffc1461034f57806382665a8f146103625780638da5cb5b1461038257600080fd5b80635b5a66a7146102da578063675df759146102fa5780636c19e7831461031a57600080fd5b80632aa5fc7b116101a05780632aa5fc7b14610265578063457bfa2f14610287578063547cad12146102a75780635ab7afc6146102c757600080fd5b806309bd2749146101d25780630bcb498214610218578063238ac9331461023857600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506102026101ed366004613294565b60056020526000908152604090205460ff1681565b60405161020f91906132bf565b60405180910390f35b61022b610226366004613329565b6105cf565b60405161020f91906133f6565b34801561024457600080fd5b50600654610258906001600160a01b031681565b60405161020f919061340d565b34801561027157600080fd5b5061028561028036600461342e565b610658565b005b34801561029357600080fd5b50600a54610258906001600160a01b031681565b3480156102b357600080fd5b506102856102c2366004613294565b6106a7565b61022b6102d5366004613574565b610706565b3480156102e657600080fd5b506102856102f5366004613294565b61081f565b34801561030657600080fd5b50610285610315366004613634565b610872565b34801561032657600080fd5b50610285610335366004613294565b6108c5565b34801561034657600080fd5b50610285610920565b61022b61035d366004613574565b610934565b34801561036e57600080fd5b5061025861037d366004613684565b610cfd565b34801561038e57600080fd5b506000546001600160a01b0316610258565b3480156103ac57600080fd5b506102856103bb3660046136f0565b610d27565b3480156103cc57600080fd5b506102026103db366004613769565b600460209081526000928352604080842090915290825290205460ff1681565b61022b61040936600461379c565b610e47565b34801561041a57600080fd5b50600154610258906001600160a01b031681565b34801561043a57600080fd5b50610285610449366004613294565b610e8e565b61028561045c3660046137f0565b610ee9565b34801561046d57600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b60405161020f91906138a0565b3480156104ae57600080fd5b50600754610258906001600160a01b031681565b3480156104ce57600080fd5b506102856104dd3660046138ae565b6112aa565b3480156104ee57600080fd5b5060015461020290600160a01b900460ff1681565b34801561050f57600080fd5b5061053961051e366004613684565b6009602052600090815260409020546001600160a01b031681565b60405161020f9190613941565b34801561055257600080fd5b5061028561056136600461394f565b611376565b34801561057257600080fd5b50610285610581366004613294565b61155c565b61022b610594366004613329565b611596565b3480156105a557600080fd5b506105396105b436600461398d565b6002602052600090815260409020546001600160a01b031681565b600154600090600160a01b900460ff16610616576001546001600160a01b031633146106165760405162461bcd60e51b815260040161060d906139e5565b60405180910390fd5b6002600854036106385760405162461bcd60e51b815260040161060d90613a29565b600260085561064986868686611616565b60016008559695505050505050565b6106606116a6565b61066a82826116d0565b7f1030ebdffe19ed06839890787ae0344a023e8c553e3fa69b7e74564e8c7965f0828260405161069b929190613a39565b60405180910390a15050565b6106af6116a6565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e916106fb9161340d565b60405180910390a150565b600154600090600160a01b900460ff16610744576001546001600160a01b031633146107445760405162461bcd60e51b815260040161060d906139e5565b6002600854036107665760405162461bcd60e51b815260040161060d90613a29565b600260085582516000906107839085016020908101908601613d02565b905061078f878761173b565b60008160800151876107a19190613d53565b90506107b48882846040015160006118c0565b8151608083015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3946108029490939287928f9291600291613db3565b60405180910390a160019250505060016008559695505050505050565b6108276116a6565b600a80546001600160a01b0319166001600160a01b0383161790556040517fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d906106fb90839061340d565b61087a6116a6565b6108858383836119f0565b7f5e20184b00709d9f103306958e9fb9d509f78bec1829ca7080f2c43eb2ff21a88383836040516108b893929190613e31565b60405180910390a1505050565b6108cd6116a6565b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb9061069b9083908590613e59565b6109286116a6565b6109326000611a86565b565b600154600090600160a01b900460ff16610972576001546001600160a01b031633146109725760405162461bcd60e51b815260040161060d906139e5565b6002600854036109945760405162461bcd60e51b815260040161060d90613a29565b600260085582516000906109b19085016020908101908601613d02565b90508060800151861015610a235760808101869052805160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c393610a11939092909182918d918d91600191613e74565b60405180910390a16001915050610649565b6080810151610a329087613d53565b95508560006060610a438a8461173b565b6020840151518a9015610ac75760606000610a618760200151611ad6565b90955093509150506001600160a01b03808216908e1614610a945760405162461bcd60e51b815260040161060d90613ed0565b610aa88760200151838e8a60a00151611d04565b90965094508415610ac457610ac48d86896040015160006118c0565b50505b60c08501515115610c015760008560c00151806020019051810190610aec9190613f18565b7f00000000000000000000000000000000000000000000000000000000000000006000908152600960205260409020549091506001600160a01b031680610b455760405162461bcd60e51b815260040161060d90613f87565b610b596001600160a01b0384168288612047565b6000610b6d88600001518960400151612130565b83516040808b0151602087015191516341a5e1f560e11b81529394506001600160a01b0386169363834bc3ea933493610bb09391928e918c918a90600401613fa7565b60006040518083038185885af1158015610bce573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610bf7919081019061400e565b9450505050610c99565b3415610c85576000876001600160a01b031634604051610c2090614049565b60006040518083038185875af1925050503d8060008114610c5d576040519150601f19603f3d011682016040523d82523d6000602084013e610c62565b606091505b5050905080610c835760405162461bcd60e51b815260040161060d90614088565b505b610c998185876040015188606001516118c0565b507ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3846000015184848d8860800151600187604051610cde9796959493929190614098565b60405180910390a1600194505050505060016008559695505050505050565b60038181548110610d0d57600080fd5b6000918252602090912001546001600160a01b0316905081565b610d2f6116a6565b828114610d4e5760405162461bcd60e51b815260040161060d906140e7565b60005b83811015610e0357828282818110610d6b57610d6b6140f7565b9050602002016020810190610d809190613294565b60096000878785818110610d9657610d966140f7565b9050602002810190610da8919061410d565b604051610db6929190614177565b6040518091039020815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610dfb90614184565b915050610d51565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9684848484604051610e3994939291906142ea565b60405180910390a150505050565b600154600090600160a01b900460ff16610e85576001546001600160a01b03163314610e855760405162461bcd60e51b815260040161060d906139e5565b95945050505050565b610e966116a6565b600780546001600160a01b038381166001600160a01b03198316179092556040519116907f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f389061069b9083908590613e59565b600260085403610f0b5760405162461bcd60e51b815260040161060d90613a29565b600260085582151580610f41575067ffffffffffffffff4616610f34604087016020880161431b565b67ffffffffffffffff1614155b610f5d5760405162461bcd60e51b815260040161060d90614356565b82151580610f95575061016085013515801590610f9557506000610f896101a087016101808801613294565b6001600160a01b031614155b610fb15760405162461bcd60e51b815260040161060d90614356565b6000610fc0608087018761410d565b604051610fce929190614177565b604051908190039020905081158015610ff45750610ff061020087018761410d565b1590505b8061101e57507f000000000000000000000000000000000000000000000000000000000000000081145b61103a5760405162461bcd60e51b815260040161060d9061439a565b600081815260096020908152604091829020546001600160a01b03169167ffffffffffffffff461691611071918a01908a0161431b565b67ffffffffffffffff16148061108f57506001600160a01b03811615155b6110ab5760405162461bcd60e51b815260040161060d906143de565b610160870135606060006110c76101a08b016101808c01613294565b905060006110dd6101a08c016101808d01613294565b905088156111875761111b8a8a60008181106110fb576110fb6140f7565b905060200281019061110d91906143ee565b6111169061446b565b6121a1565b15611139576111326101c08c016101a08d01613294565b9050611156565b61114b6111468a8c6144e5565b611ad6565b929650919450925090505b806001600160a01b0316826001600160a01b0316036111875760405162461bcd60e51b815260040161060d9061454f565b61119760e08c0160c08d0161455f565b1561125757600a546001600160a01b038381169116146111c95760405162461bcd60e51b815260040161060d906145b4565b833410156111e95760405162461bcd60e51b815260040161060d906145f8565b600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561123957600080fd5b505af115801561124d573d6000803e3d6000fd5b505050505061126c565b61126c6001600160a01b038316333087612225565b61129882828661127b8f6147fe565b8e8e9061128891906144e5565b6112928d8f6144e5565b89612246565b50506001600855505050505050505050565b6112b26116a6565b600083836040516112c4929190614177565b6040518091039020905061134581836001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b7f58ddcdb40971f55ad1b6a8a28067274a4ffc7e9d77c3ea14a17652faa705e1978183604051610e3992919061480a565b6007546001600160a01b031633146113a05760405162461bcd60e51b815260040161060d9061484c565b60005b828110156115565760008484838181106113bf576113bf6140f7565b90506020020160208101906113d49190613294565b6001600160a01b03160361146f5760004790506000836001600160a01b03168261c3509060405161140490614049565b600060405180830381858888f193505050503d8060008114611442576040519150601f19603f3d011682016040523d82523d6000602084013e611447565b606091505b50509050806114685760405162461bcd60e51b815260040161060d90614890565b5050611544565b6000848483818110611483576114836140f7565b90506020020160208101906114989190613294565b6001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016114c3919061340d565b602060405180830381865afa1580156114e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150491906148a0565b9050611542838287878681811061151d5761151d6140f7565b90506020020160208101906115329190613294565b6001600160a01b03169190612380565b505b8061154e81614184565b9150506113a3565b50505050565b6115646116a6565b6001600160a01b03811661158a5760405162461bcd60e51b815260040161060d9061491b565b61159381611a86565b50565b60006002600854036115ba5760405162461bcd60e51b815260040161060d90613a29565b6002600855600a546001600160a01b038781169116146115ee576115e96001600160a01b038716333088612225565b61160e565b8434101561160e5760405162461bcd60e51b815260040161060d9061495f565b610649868686865b60008061162583850185614a6b565b9050611631868661173b565b6116428686836040015160006118c0565b8051608082015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c394611690949093928b928d9291600291613db3565b60405180910390a160019150505b949350505050565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161060d90614ad8565b6001600160a01b03821660009081526005602052604090205460ff168115158115150361170f5760405162461bcd60e51b815260040161060d90614356565b506001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b600a546001600160a01b03908116908316036118bc57600154604080516320a6037160e21b815290516000926001600160a01b0316916382980dc49160048083019260209291908290030181865afa15801561179b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117bf9190614ae8565b9050600a60009054906101000a90046001600160a01b03166001600160a01b0316816001600160a01b031663457bfa2f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561181e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118429190614ae8565b6001600160a01b0316036118ba57600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156118a057600080fd5b505af11580156118b4573d6000803e3d6000fd5b50505050505b505b5050565b80156119dc57600a546001600160a01b038581169116146118f35760405162461bcd60e51b815260040161060d90614b3d565b600a54604051632e1a7d4d60e01b81526001600160a01b0390911690632e1a7d4d906119239086906004016138a0565b600060405180830381600087803b15801561193d57600080fd5b505af1158015611951573d6000803e3d6000fd5b505050506000826001600160a01b03168461c3509060405161197290614049565b600060405180830381858888f193505050503d80600081146119b0576040519150601f19603f3d011682016040523d82523d6000602084013e6119b5565b606091505b50509050806119d65760405162461bcd60e51b815260040161060d90614088565b50611556565b6115566001600160a01b0385168385612380565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff1681151581151503611a445760405162461bcd60e51b815260040161060d90614356565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006060600080611ae98761239f565b925060005b8751811015611cfa5760046000898381518110611b0d57611b0d6140f7565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000206000898381518110611b4d57611b4d6140f7565b602002602001015160200151611b6290614b61565b6001600160e01b031916815260208101919091526040016000205460ff16611b9c5760405162461bcd60e51b815260040161060d90614bda565b6000806000868481518110611bb357611bb36140f7565b60200260200101516001600160a01b031663358f0e1c8c8681518110611bdb57611bdb6140f7565b60200260200101516040518263ffffffff1660e01b8152600401611bff9190614c16565b606060405180830381865afa158015611c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c409190614c27565b919450925090506001600160a01b0386161580611c6e5750816001600160a01b0316866001600160a01b0316145b611c8a5760405162461bcd60e51b815260040161060d90614ca1565b90945084906001600160a01b0385161580611cb65750806001600160a01b0316856001600160a01b0316145b611cd25760405162461bcd60e51b815260040161060d90614ce5565b935083611cdf838b614cf5565b99509097509550819050611cf281614184565b915050611aee565b5050509193509193565b6000806000806000611d1789888a6124de565b9250925092506000816001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611d4b919061340d565b602060405180830381865afa158015611d68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8c91906148a0565b905060005b8a51811015611f9a5760008a8281518110611dae57611dae6140f7565b60200260200101516001600160a01b0316634c6da2698d8481518110611dd657611dd66140f7565b602002602001015160200151888581518110611df457611df46140f7565b6020026020010151306040518463ffffffff1660e01b8152600401611e1b93929190614d0d565b600060405180830381865afa158015611e38573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e60919081019061400e565b9050611eb68c8381518110611e7757611e776140f7565b602002602001015160000151878481518110611e9557611e956140f7565b6020026020010151876001600160a01b03166120479092919063ffffffff16565b60008c8381518110611eca57611eca6140f7565b6020026020010151600001516001600160a01b031682604051611eed9190614d5c565b6000604051808303816000865af19150503d8060008114611f2a576040519150601f19603f3d011682016040523d82523d6000602084013e611f2f565b606091505b505090508080611f3c5750895b611f585760405162461bcd60e51b815260040161060d90614d9c565b80611f8557868381518110611f6f57611f6f6140f7565b602002602001015188611f829190614cf5565b97505b50508080611f9290614184565b915050611d91565b506040516370a0823160e01b81526000906001600160a01b038416906370a0823190611fca90309060040161340d565b602060405180830381865afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b91906148a0565b90506120178282613d53565b9650600087116120395760405162461bcd60e51b815260040161060d90614de0565b505050505094509492505050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b8152600401612078929190613e59565b602060405180830381865afa158015612095573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120b991906148a0565b6120c39190614cf5565b90506115568463095ea7b360e01b85846040516024016120e4929190614df0565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612693565b60608060606040518060e00160405280868152602001838152602001856001600160a01b0316815260200160001515815260200160008152602001600015158152602001828152506040516020016121889190614f02565b6040516020818303038152906040529250505092915050565b80516001600160a01b0316600090815260046020908152604082209083015182906121cb90614b61565b6001600160e01b031916815260208101919091526040016000205460ff166122055760405162461bcd60e51b815260040161060d90614bda565b50516001600160a01b031660009081526005602052604090205460ff1690565b611556846323b872dd60e01b8585856040516024016120e493929190614f13565b82518590156122d657600061227485600081518110612267576122676140f7565b60200260200101516121a1565b156122a85761229f89898988600081518110612292576122926140f7565b6020026020010151612722565b925090506122b7565b6122b285846128b4565b925090505b806122d45760405162461bcd60e51b815260040161060d90614f6f565b505b60006122ea86600001518760600151612bfe565b90504667ffffffffffffffff16866020015167ffffffffffffffff1603612365577f0e248ac8be20725176a5f0ab093c5fbb964634d4675012f3d3ad66e69e56d5b781888b858c604051612342959493929190614f7f565b60405180910390a161235e888388600001518960e001516118c0565b5050612377565b612374818a8a89888c88612c36565b50505b50505050505050565b6118ba8363a9059cbb60e01b84846040516024016120e4929190614df0565b60606000825167ffffffffffffffff8111156123bd576123bd613486565b6040519080825280602002602001820160405280156123e6578160200160208202803683370190505b50905060005b83518110156124d7576000848281518110612409576124096140f7565b60200260200101516020015161241e90614b61565b6001600160e01b0319811660009081526002602052604090205484519192506001600160a01b031690849084908110612459576124596140f7565b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b0316838381518110612496576124966140f7565b60200260200101516001600160a01b0316036124c45760405162461bcd60e51b815260040161060d90614ff5565b50806124cf81614184565b9150506123ec565b5092915050565b60606000806000865167ffffffffffffffff8111156124ff576124ff613486565b604051908082528060200260200182016040528015612528578160200160208202803683370190505b50935060005b875181101561261c57600086828151811061254b5761254b6140f7565b60200260200101516001600160a01b031663358f0e1c8a8481518110612573576125736140f7565b60200260200101516040518263ffffffff1660e01b81526004016125979190614c16565b606060405180830381865afa1580156125b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d89190614c27565b909650945090506125e98184614cf5565b9250808683815181106125fe576125fe6140f7565b6020908102919091010152508061261481614184565b91505061252e565b5060005b8451811015612688578185828151811061263c5761263c6140f7565b60200260200101518861264f9190615005565b612659919061503a565b85828151811061266b5761266b6140f7565b60209081029190910101528061268081614184565b915050612620565b505093509350939050565b60006126e8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612db69092919063ffffffff16565b8051909150156118ba5780806020019051810190612706919061504e565b6118ba5760405162461bcd60e51b815260040161060d906150c9565b8051600090819061273e906001600160a01b0388169086612047565b6040516370a0823160e01b81526000906001600160a01b038716906370a082319061276d90309060040161340d565b602060405180830381865afa15801561278a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ae91906148a0565b905083600001516001600160a01b031684602001516040516127d09190614d5c565b6000604051808303816000865af19150503d806000811461280d576040519150601f19603f3d011682016040523d82523d6000602084013e612812565b606091505b5050809350508261282a5760008092509250506128ab565b6040516370a0823160e01b81526000906001600160a01b038816906370a082319061285990309060040161340d565b602060405180830381865afa158015612876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289a91906148a0565b90506128a68282613d53565b925050505b94509492505050565b60008060005b8451811015612bf55760008060008684815181106128da576128da6140f7565b60200260200101516001600160a01b031663358f0e1c898681518110612902576129026140f7565b60200260200101516040518263ffffffff1660e01b81526004016129269190614c16565b606060405180830381865afa158015612943573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129679190614c27565b9250925092506000878581518110612981576129816140f7565b60200260200101516001600160a01b0316634c6da2698a87815181106129a9576129a96140f7565b60200260200101516020015186306040518463ffffffff1660e01b81526004016129d593929190614d0d565b600060405180830381865afa1580156129f2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a1a919081019061400e565b9050612a4e898681518110612a3157612a316140f7565b6020908102919091010151516001600160a01b0385169086612047565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190612a7d90309060040161340d565b602060405180830381865afa158015612a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612abe91906148a0565b9050898681518110612ad257612ad26140f7565b6020026020010151600001516001600160a01b031682604051612af59190614d5c565b6000604051808303816000865af19150503d8060008114612b32576040519150601f19603f3d011682016040523d82523d6000602084013e612b37565b606091505b50508098505087612b545760008097509750505050505050612bf7565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612b8390309060040161340d565b602060405180830381865afa158015612ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc491906148a0565b9050612bd08282613d53565b612bda9089614cf5565b97505050505050508080612bed90614184565b9150506128ba565b505b9250929050565b600033834684604051602001612c179493929190615120565b6040516020818303038152906040528051906020012090505b92915050565b60008084511180612c4d5750600085610200015151115b612c58578451612c5e565b84604001515b90506060612c6d86858a612dcf565b60c0860151349015612c8657612c838534613d53565b90505b608087015180516020918201206000908152600990915260409020546001600160a01b0390811690612cbb908a168287612047565b6000612cc88c8a8a612e59565b9050816001600160a01b031663834bc3ea848b60200151888a8f8f60a00151886040518863ffffffff1660e01b8152600401612d0996959493929190613fa7565b60006040518083038185885af1158015612d27573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612d50919081019061400e565b93505050507f082e2f634ceec1af5105aa53f234b7efad94428a54a714e3b7c7115ee549308089828860200151878c8b6101c00151888e8b8f60800151604051612da39a99989796959493929190615168565b60405180910390a1505050505050505050565b6060612dc58484600085612eda565b90505b9392505050565b60004684602001518484876101200151886101000151604051602001612dfa9695949392919061520a565b6040516020818303038152906040528051906020012090506000612e1d82612f9c565b9050612e2e81866101400151612fcc565b4285610120015111612e525760405162461bcd60e51b815260040161060d906152ce565b5050505050565b60606040518060e0016040528085815260200183815260200184600001516001600160a01b031681526020018460e00151151581526020018461010001518152602001846101e0015115158152602001846102000151815250604051602001612ec29190614f02565b60405160208183030381529060405290509392505050565b606082471015612efc5760405162461bcd60e51b815260040161060d90615338565b6001600160a01b0385163b612f235760405162461bcd60e51b815260040161060d9061537c565b600080866001600160a01b03168587604051612f3f9190614d5c565b60006040518083038185875af1925050503d8060008114612f7c576040519150601f19603f3d011682016040523d82523d6000602084013e612f81565b606091505b5091509150612f91828286613008565b979650505050505050565b600081604051602001612faf919061538c565b604051602081830303815290604052805190602001209050919050565b6000612fd88383613041565b6006549091506001600160a01b038083169116146118ba5760405162461bcd60e51b815260040161060d906153fb565b60608315613017575081612dc8565b8251156130275782518084602001fd5b8160405162461bcd60e51b815260040161060d919061540b565b60008060006130508585613065565b9150915061305d816130a7565b509392505050565b600080825160410361309b5760208301516040840151606085015160001a61308f87828585613187565b94509450505050612bf7565b50600090506002612bf7565b60008160048111156130bb576130bb6133ad565b036130c35750565b60018160048111156130d7576130d76133ad565b036130f45760405162461bcd60e51b815260040161060d90615450565b6002816004811115613108576131086133ad565b036131255760405162461bcd60e51b815260040161060d90615494565b6003816004811115613139576131396133ad565b036131565760405162461bcd60e51b815260040161060d906154e3565b600481600481111561316a5761316a6133ad565b036115935760405162461bcd60e51b815260040161060d90615532565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131be57506000905060036128ab565b8460ff16601b141580156131d657508460ff16601c14155b156131e757506000905060046128ab565b60006001878787876040516000815260200160405260405161320c949392919061554b565b6020604051602081039080840390855afa15801561322e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613257576000600192509250506128ab565b9660009650945050505050565b60006001600160a01b038216612c30565b61327e81613264565b811461159357600080fd5b8035612c3081613275565b6000602082840312156132a9576132a9600080fd5b600061169e8484613289565b8015155b82525050565b60208101612c3082846132b5565b8061327e565b8035612c30816132cd565b60008083601f8401126132f3576132f3600080fd5b50813567ffffffffffffffff81111561330e5761330e600080fd5b602083019150836001820283011115612bf757612bf7600080fd5b60008060008060006080868803121561334457613344600080fd5b60006133508888613289565b9550506020613361888289016132d3565b945050604086013567ffffffffffffffff81111561338157613381600080fd5b61338d888289016132de565b935093505060606133a088828901613289565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60038110611593576115936133ad565b806133dd816133c3565b919050565b6000612c30826133d3565b6132b9816133e2565b60208101612c3082846133ed565b6132b981613264565b60208101612c308284613404565b80151561327e565b8035612c308161341b565b6000806040838503121561344457613444600080fd5b60006134508585613289565b925050602061346185828601613423565b9150509250929050565b67ffffffffffffffff811661327e565b8035612c308161346b565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156134c2576134c2613486565b6040525050565b60006134d460405190565b90506133dd828261349c565b600067ffffffffffffffff8211156134fa576134fa613486565b601f19601f83011660200192915050565b82818337506000910152565b600061352a613525846134e0565b6134c9565b90508281526020810184848401111561354557613545600080fd5b61305d84828561350b565b600082601f83011261356457613564600080fd5b813561169e848260208601613517565b60008060008060008060c0878903121561359057613590600080fd5b600061359c8989613289565b96505060206135ad89828a01613289565b95505060406135be89828a016132d3565b94505060606135cf89828a0161347b565b935050608087013567ffffffffffffffff8111156135ef576135ef600080fd5b6135fb89828a01613550565b92505060a061360c89828a01613289565b9150509295509295509295565b6001600160e01b0319811661327e565b8035612c3081613619565b60008060006060848603121561364c5761364c600080fd5b60006136588686613289565b935050602061366986828701613629565b925050604061367a86828701613423565b9150509250925092565b60006020828403121561369957613699600080fd5b600061169e84846132d3565b60008083601f8401126136ba576136ba600080fd5b50813567ffffffffffffffff8111156136d5576136d5600080fd5b602083019150836020820283011115612bf757612bf7600080fd5b6000806000806040858703121561370957613709600080fd5b843567ffffffffffffffff81111561372357613723600080fd5b61372f878288016136a5565b9450945050602085013567ffffffffffffffff81111561375157613751600080fd5b61375d878288016136a5565b95989497509550505050565b6000806040838503121561377f5761377f600080fd5b600061378b8585613289565b925050602061346185828601613629565b6000806000806000608086880312156137b7576137b7600080fd5b60006137c38888613289565b95505060206133618882890161347b565b600061022082840312156137ea576137ea600080fd5b50919050565b60008060008060006060868803121561380b5761380b600080fd5b853567ffffffffffffffff81111561382557613825600080fd5b613831888289016137d4565b955050602086013567ffffffffffffffff81111561385157613851600080fd5b61385d888289016136a5565b9450945050604086013567ffffffffffffffff81111561387f5761387f600080fd5b61388b888289016136a5565b92509250509295509295909350565b806132b9565b60208101612c30828461389a565b6000806000604084860312156138c6576138c6600080fd5b833567ffffffffffffffff8111156138e0576138e0600080fd5b6138ec868287016132de565b9350935050602061367a86828701613289565b6000612c306001600160a01b038316613916565b90565b6001600160a01b031690565b6000612c30826138ff565b6000612c3082613922565b6132b98161392d565b60208101612c308284613938565b60008060006040848603121561396757613967600080fd5b833567ffffffffffffffff81111561398157613981600080fd5b6138ec868287016136a5565b6000602082840312156139a2576139a2600080fd5b600061169e8484613629565b601981526000602082017f63616c6c6572206973206e6f74206d6573736167652062757300000000000000815291505b5060200190565b60208082528101612c30816139ae565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291506139de565b60208082528101612c30816139f5565b60408101613a478285613404565b612dc860208301846132b5565b8051612c30816132cd565b600067ffffffffffffffff821115613a7957613a79613486565b5060209081020190565b8051612c3081613275565b60005b83811015613aa9578181015183820152602001613a91565b838111156115565750506000910152565b6000613ac8613525846134e0565b905082815260208101848484011115613ae357613ae3600080fd5b61305d848285613a8e565b600082601f830112613b0257613b02600080fd5b815161169e848260208601613aba565b600060408284031215613b2757613b27600080fd5b613b3160406134c9565b90506000613b3f8484613a83565b825250602082015167ffffffffffffffff811115613b5f57613b5f600080fd5b613b6b84828501613aee565b60208301525092915050565b6000613b8561352584613a5f565b83815290506020808201908402830185811115613ba457613ba4600080fd5b835b81811015613be557805167ffffffffffffffff811115613bc857613bc8600080fd5b808601613bd58982613b12565b8552505060209283019201613ba6565b5050509392505050565b600082601f830112613c0357613c03600080fd5b815161169e848260208601613b77565b8051612c308161341b565b600060e08284031215613c3357613c33600080fd5b613c3d60e06134c9565b90506000613c4b8484613a54565b825250602082015167ffffffffffffffff811115613c6b57613c6b600080fd5b613c7784828501613bef565b6020830152506040613c8b84828501613a83565b6040830152506060613c9f84828501613c13565b6060830152506080613cb384828501613a54565b60808301525060a0613cc784828501613c13565b60a08301525060c082015167ffffffffffffffff811115613cea57613cea600080fd5b613cf684828501613aee565b60c08301525092915050565b600060208284031215613d1757613d17600080fd5b815167ffffffffffffffff811115613d3157613d31600080fd5b61169e84828501613c1e565b634e487b7160e01b600052601160045260246000fd5b600082821015613d6557613d65613d3d565b500390565b6000612c306139138381565b6132b981613d6a565b6000613d89825190565b808452602084019350613da0818560208601613a8e565b601f19601f8201165b9093019392505050565b60e08101613dc1828a61389a565b613dce6020830189613d76565b613ddb604083018861389a565b613de86060830187613404565b613df5608083018661389a565b613e0260a08301856133ed565b81810360c0830152613e148184613d7f565b9998505050505050505050565b6001600160e01b031981166132b9565b60608101613e3f8286613404565b613e4c6020830185613e21565b61169e60408301846132b5565b60408101613e678285613404565b612dc86020830184613404565b60e08101613e82828a61389a565b613e8f6020830189613d76565b613ddb6040830188613d76565b600781526000602082017f746b696e206d6d00000000000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081613e9c565b8051612c308161346b565b600060408284031215613f0057613f00600080fd5b613f0a60406134c9565b90506000613b3f8484613ee0565b600060208284031215613f2d57613f2d600080fd5b815167ffffffffffffffff811115613f4757613f47600080fd5b61169e84828501613eeb565b600f81526000602082017f63627269646765206e6f74207365740000000000000000000000000000000000815291506139de565b60208082528101612c3081613f53565b67ffffffffffffffff81166132b9565b60c08101613fb58289613f97565b613fc26020830188613404565b613fcf604083018761389a565b613fdc6060830186613404565b8181036080830152613fee8185613d7f565b905081810360a08301526140028184613d7f565b98975050505050505050565b60006020828403121561402357614023600080fd5b815167ffffffffffffffff81111561403d5761403d600080fd5b61169e84828501613aee565b6000612c3082613913565b600981526000602082017f73656e64206661696c0000000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614054565b60e081016140a6828a61389a565b613dce602083018961389a565b601481526000602082017f706172616d732073697a65206d69736d61746368000000000000000000000000815291506139de565b60208082528101612c30816140b3565b634e487b7160e01b600052603260045260246000fd5b6000808335601e193685900301811261412857614128600080fd5b80840192508235915067ffffffffffffffff82111561414957614149600080fd5b602083019250600182023603831315612bf557612bf5600080fd5b600061417183858461350b565b50500190565b600061169e828486614164565b6000600019820361419757614197613d3d565b5060010190565b81835260006020840193506141b483858461350b565b601f19601f840116613da9565b6000612dc584848461419e565b6000808335601e19368590030181126141e9576141e9600080fd5b83810160208101935035915067ffffffffffffffff82111561420d5761420d600080fd5b36829003831315612bf557612bf5600080fd5b818352600060208401935083602084028101838060005b8781101561427257848403895261424e82846141ce565b6142598682846141c1565b95506020840160209b909b019a93505050600101614237565b5091979650505050505050565b600061428b8383613404565b505060200190565b6000612dc86020840184613289565b8183526000602084019350818060005b858110156142df576142c48284614293565b6142ce888261427f565b9750602083019250506001016142b2565b509495945050505050565b604080825281016142fc818688614220565b905081810360208301526143118184866142a2565b9695505050505050565b60006020828403121561433057614330600080fd5b600061169e848461347b565b600381526000602082016206e6f760ec1b815291506139de565b60208082528101612c308161433c565b601b81526000602082017f62726964676520646f6573206e6f7420737570706f7274206d73670000000000815291506139de565b60208082528101612c3081614366565b601281526000602082017f756e737570706f72746564206272696467650000000000000000000000000000815291506139de565b60208082528101612c30816143aa565b60008235603e193684900301811261440857614408600080fd5b9190910192915050565b60006040828403121561442757614427600080fd5b61443160406134c9565b9050600061443f8484613289565b825250602082013567ffffffffffffffff81111561445f5761445f600080fd5b613b6b84828501613550565b6000612c303683614412565b600061448561352584613a5f565b838152905060208082019084028301858111156144a4576144a4600080fd5b835b81811015613be557803567ffffffffffffffff8111156144c8576144c8600080fd5b8086016144d58982614412565b85525050602092830192016144a6565b6000612dc8368484614477565b602b81526000602082017f746f6b656e20696e2f6f7574206d757374206e6f7420657175616c206966206581527f7869737473207377617073000000000000000000000000000000000000000000602082015291505b5060400190565b60208082528101612c30816144f2565b60006020828403121561457457614574600080fd5b600061169e8484613423565b601281526000602082017f746b696e206e6f206e6174697665577261700000000000000000000000000000815291506139de565b60208082528101612c3081614580565b600b81526000602082017f696e7366636e7420616d74000000000000000000000000000000000000000000815291506139de565b60208082528101612c30816145c4565b6000610220828403121561461e5761461e600080fd5b6146296102206134c9565b905060006146378484613289565b82525060206146488484830161347b565b602083015250604061465c84828501613289565b60408301525060606146708482850161347b565b606083015250608082013567ffffffffffffffff81111561469357614693600080fd5b61469f84828501613550565b60808301525060a082013567ffffffffffffffff8111156146c2576146c2600080fd5b6146ce84828501613550565b60a08301525060c06146e284828501613423565b60c08301525060e06146f684828501613423565b60e08301525061010061470b848285016132d3565b61010083015250610120614721848285016132d3565b6101208301525061014082013567ffffffffffffffff81111561474657614746600080fd5b61475284828501613550565b61014083015250610160614768848285016132d3565b6101608301525061018061477e84828501613289565b610180830152506101a061479484828501613289565b6101a0830152506101c06147aa84828501613289565b6101c0830152506101e06147c084828501613423565b6101e08301525061020082013567ffffffffffffffff8111156147e5576147e5600080fd5b6147f184828501613550565b6102008301525092915050565b6000612c303683614608565b60408101613e678285613e21565b601181526000602082017f6e6f742066656520636f6c6c6563746f72000000000000000000000000000000815291506139de565b60208082528101612c3081614818565b601281526000602082017f73656e64206e6174697665206661696c65640000000000000000000000000000815291506139de565b60208082528101612c308161485c565b6000602082840312156148b5576148b5600080fd5b600061169e8484613a54565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f646472657373000000000000000000000000000000000000000000000000000060208201529150614548565b60208082528101612c30816148c1565b601881526000602082017f6e6f206e6174697665207472616e7366657272656420696e0000000000000000815291506139de565b60208082528101612c308161492b565b600082601f83011261498357614983600080fd5b813561169e848260208601614477565b600060e082840312156149a8576149a8600080fd5b6149b260e06134c9565b905060006149c084846132d3565b825250602082013567ffffffffffffffff8111156149e0576149e0600080fd5b6149ec8482850161496f565b6020830152506040614a0084828501613289565b6040830152506060614a1484828501613423565b6060830152506080614a28848285016132d3565b60808301525060a0614a3c84828501613423565b60a08301525060c082013567ffffffffffffffff811115614a5f57614a5f600080fd5b613cf684828501613550565b600060208284031215614a8057614a80600080fd5b813567ffffffffffffffff811115614a9a57614a9a600080fd5b61169e84828501614993565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260006139de565b60208082528101612c3081614aa6565b600060208284031215614afd57614afd600080fd5b600061169e8484613a83565b600c81526000602082017f746b206e6f206e61746976650000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614b09565b6000612c3082516001600160e01b03191690565b6000614b6b825190565b60208301614b7881614b4d565b92506004821015614b9f57614b9a6001600160e01b0319836004036008021b90565b831692505b5050919050565b600f81526000602082017f756e737570706f72746564206465780000000000000000000000000000000000815291506139de565b60208082528101612c3081614ba6565b80516000906040840190614bfe8582613404565b5060208301518482036020860152610e858282613d7f565b60208082528101612dc88184614bea565b600080600060608486031215614c3f57614c3f600080fd5b6000614c4b8686613a54565b9350506020614c5c86828701613a83565b925050604061367a86828701613a83565b600d81526000602082017f746b696e206d69736d6174636800000000000000000000000000000000000000815291506139de565b60208082528101612c3081614c6d565b600c81526000602082017f746b6f206d69736d617463680000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614cb1565b60008219821115614d0857614d08613d3d565b500190565b60608082528101614d1e8186613d7f565b9050614d2d602083018561389a565b61169e6040830184613404565b6000614d44825190565b614d52818560208601613a8e565b9290920192915050565b6000612dc88284614d3a565b600b81526000602082017f73776170206661696c6564000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614d68565b601081526000602082017f616c6c207377617073206661696c656400000000000000000000000000000000815291506139de565b60208082528101612c3081614dac565b60408101614dfe8285613404565b612dc8602083018461389a565b6000612dc88383614bea565b6000614e21825190565b80845260208401935083602082028501614e3b8560200190565b8060005b858110156142725784840389528151614e588582614e0b565b94506020830160209a909a0199925050600101614e3f565b805160009060e0840190614e84858261389a565b5060208301518482036020860152614e9c8282614e17565b9150506040830151614eb16040860182613404565b506060830151614ec460608601826132b5565b506080830151614ed7608086018261389a565b5060a0830151614eea60a08601826132b5565b5060c083015184820360c0860152610e858282613d7f565b60208082528101612dc88184614e70565b60608101614f218286613404565b614f2e6020830185613404565b61169e604083018461389a565b600981526000602082017f73776170206661696c0000000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614f3b565b60a08101614f8d828861389a565b614f9a602083018761389a565b614fa76040830186613404565b614fb4606083018561389a565b6143116080830184613404565b600c81526000602082017f636463206e6f20666f756e640000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614fc1565b600081600019048311821515161561501f5761501f613d3d565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261504957615049615024565b500490565b60006020828403121561506357615063600080fd5b600061169e8484613c13565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f7420737563636565640000000000000000000000000000000000000000000060208201529150614548565b60208082528101612c308161506f565b6000612c308260601b90565b6000612c30826150d9565b6132b96150fc82613264565b6150e5565b6000612c308260c01b90565b6132b967ffffffffffffffff8216615101565b600061512c82876150f0565b60148201915061513c82866150f0565b60148201915061514c828561510d565b60088201915061515c828461510d565b50600801949350505050565b6101408101615177828d61389a565b8181036020830152615189818c613d7f565b9050615198604083018b613f97565b6151a5606083018a61389a565b6151b26080830189613404565b6151bf60a0830188613404565b6151cc60c0830187613404565b6151d960e0830186613404565b6151e761010083018561389a565b8181036101208301526151fa8184613d7f565b9c9b505050505050505050505050565b7f6578656375746f722066656500000000000000000000000000000000000000008152600c01600061523c828961510d565b60088201915061524c828861510d565b60088201915061525c828761389a565b60208201915061526c82866150f0565b60148201915061527c828561389a565b60208201915061528c828461389a565b506020019695505050505050565b601181526000602082017f646561646c696e65206578636565646564000000000000000000000000000000815291506139de565b60208082528101612c308161529a565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f81527f722063616c6c000000000000000000000000000000000000000000000000000060208201529150614548565b60208082528101612c30816152de565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815291506139de565b60208082528101612c3081615348565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c0160006153be828461389a565b50602001919050565b600e81526000602082017f696e76616c6964207369676e6572000000000000000000000000000000000000815291506139de565b60208082528101612c30816153c7565b60208082528101612dc88184613d7f565b601881526000602082017f45434453413a20696e76616c6964207369676e61747572650000000000000000815291506139de565b60208082528101612c308161541c565b601f81526000602082017f45434453413a20696e76616c6964207369676e6174757265206c656e67746800815291506139de565b60208082528101612c3081615460565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202773272076616c815261756560f01b60208201529150614548565b60208082528101612c30816154a4565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202776272076616c815261756560f01b60208201529150614548565b60208082528101612c30816154f3565b60ff81166132b9565b60808101615559828761389a565b6155666020830186615542565b615573604083018561389a565b610e85606083018461389a56fea2646970667358221220817cb2cfee1a808d9f231e9263ed336fb57e08b611df4ac975bb01b6293c7f5f64736f6c634300080f00330000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d000000000000000000000000420000000000000000000000000000000000000600000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e74323536292900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000056b2ffd01cd39ee34d62b328e07e2cef79a13cf60000000000000000000000000000000000000000000000000000000000000005000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd199000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e7432353629290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000537377617028616464726573732c28616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e743235362c75696e743235362c6279746573292c62797465732900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d2900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001111111254760f7ab3f16433eea9304126dcd199

Deployed Bytecode

0x6080604052600436106101c65760003560e01c8063918ead76116100f7578063c415b95c11610095578063efcfd8f511610064578063efcfd8f514610546578063f2fde38b14610566578063fb45378714610586578063fbf5d7631461059957600080fd5b8063c415b95c146104a2578063c5bccca3146104c2578063cd9ea342146104e2578063eeaaa6511461050357600080fd5b8063a1a227fa116100d1578063a1a227fa1461040e578063a42dce801461042e578063b8cfdc861461044e578063c04049981461046157600080fd5b8063918ead76146103a057806391ec04b5146103c05780639c649fdf146103fb57600080fd5b80635b5a66a711610164578063715018a61161013e578063715018a61461033a5780637cd2bffc1461034f57806382665a8f146103625780638da5cb5b1461038257600080fd5b80635b5a66a7146102da578063675df759146102fa5780636c19e7831461031a57600080fd5b80632aa5fc7b116101a05780632aa5fc7b14610265578063457bfa2f14610287578063547cad12146102a75780635ab7afc6146102c757600080fd5b806309bd2749146101d25780630bcb498214610218578063238ac9331461023857600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506102026101ed366004613294565b60056020526000908152604090205460ff1681565b60405161020f91906132bf565b60405180910390f35b61022b610226366004613329565b6105cf565b60405161020f91906133f6565b34801561024457600080fd5b50600654610258906001600160a01b031681565b60405161020f919061340d565b34801561027157600080fd5b5061028561028036600461342e565b610658565b005b34801561029357600080fd5b50600a54610258906001600160a01b031681565b3480156102b357600080fd5b506102856102c2366004613294565b6106a7565b61022b6102d5366004613574565b610706565b3480156102e657600080fd5b506102856102f5366004613294565b61081f565b34801561030657600080fd5b50610285610315366004613634565b610872565b34801561032657600080fd5b50610285610335366004613294565b6108c5565b34801561034657600080fd5b50610285610920565b61022b61035d366004613574565b610934565b34801561036e57600080fd5b5061025861037d366004613684565b610cfd565b34801561038e57600080fd5b506000546001600160a01b0316610258565b3480156103ac57600080fd5b506102856103bb3660046136f0565b610d27565b3480156103cc57600080fd5b506102026103db366004613769565b600460209081526000928352604080842090915290825290205460ff1681565b61022b61040936600461379c565b610e47565b34801561041a57600080fd5b50600154610258906001600160a01b031681565b34801561043a57600080fd5b50610285610449366004613294565b610e8e565b61028561045c3660046137f0565b610ee9565b34801561046d57600080fd5b506104957f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81565b60405161020f91906138a0565b3480156104ae57600080fd5b50600754610258906001600160a01b031681565b3480156104ce57600080fd5b506102856104dd3660046138ae565b6112aa565b3480156104ee57600080fd5b5060015461020290600160a01b900460ff1681565b34801561050f57600080fd5b5061053961051e366004613684565b6009602052600090815260409020546001600160a01b031681565b60405161020f9190613941565b34801561055257600080fd5b5061028561056136600461394f565b611376565b34801561057257600080fd5b50610285610581366004613294565b61155c565b61022b610594366004613329565b611596565b3480156105a557600080fd5b506105396105b436600461398d565b6002602052600090815260409020546001600160a01b031681565b600154600090600160a01b900460ff16610616576001546001600160a01b031633146106165760405162461bcd60e51b815260040161060d906139e5565b60405180910390fd5b6002600854036106385760405162461bcd60e51b815260040161060d90613a29565b600260085561064986868686611616565b60016008559695505050505050565b6106606116a6565b61066a82826116d0565b7f1030ebdffe19ed06839890787ae0344a023e8c553e3fa69b7e74564e8c7965f0828260405161069b929190613a39565b60405180910390a15050565b6106af6116a6565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e916106fb9161340d565b60405180910390a150565b600154600090600160a01b900460ff16610744576001546001600160a01b031633146107445760405162461bcd60e51b815260040161060d906139e5565b6002600854036107665760405162461bcd60e51b815260040161060d90613a29565b600260085582516000906107839085016020908101908601613d02565b905061078f878761173b565b60008160800151876107a19190613d53565b90506107b48882846040015160006118c0565b8151608083015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3946108029490939287928f9291600291613db3565b60405180910390a160019250505060016008559695505050505050565b6108276116a6565b600a80546001600160a01b0319166001600160a01b0383161790556040517fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d906106fb90839061340d565b61087a6116a6565b6108858383836119f0565b7f5e20184b00709d9f103306958e9fb9d509f78bec1829ca7080f2c43eb2ff21a88383836040516108b893929190613e31565b60405180910390a1505050565b6108cd6116a6565b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb9061069b9083908590613e59565b6109286116a6565b6109326000611a86565b565b600154600090600160a01b900460ff16610972576001546001600160a01b031633146109725760405162461bcd60e51b815260040161060d906139e5565b6002600854036109945760405162461bcd60e51b815260040161060d90613a29565b600260085582516000906109b19085016020908101908601613d02565b90508060800151861015610a235760808101869052805160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c393610a11939092909182918d918d91600191613e74565b60405180910390a16001915050610649565b6080810151610a329087613d53565b95508560006060610a438a8461173b565b6020840151518a9015610ac75760606000610a618760200151611ad6565b90955093509150506001600160a01b03808216908e1614610a945760405162461bcd60e51b815260040161060d90613ed0565b610aa88760200151838e8a60a00151611d04565b90965094508415610ac457610ac48d86896040015160006118c0565b50505b60c08501515115610c015760008560c00151806020019051810190610aec9190613f18565b7f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f6000908152600960205260409020549091506001600160a01b031680610b455760405162461bcd60e51b815260040161060d90613f87565b610b596001600160a01b0384168288612047565b6000610b6d88600001518960400151612130565b83516040808b0151602087015191516341a5e1f560e11b81529394506001600160a01b0386169363834bc3ea933493610bb09391928e918c918a90600401613fa7565b60006040518083038185885af1158015610bce573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610bf7919081019061400e565b9450505050610c99565b3415610c85576000876001600160a01b031634604051610c2090614049565b60006040518083038185875af1925050503d8060008114610c5d576040519150601f19603f3d011682016040523d82523d6000602084013e610c62565b606091505b5050905080610c835760405162461bcd60e51b815260040161060d90614088565b505b610c998185876040015188606001516118c0565b507ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3846000015184848d8860800151600187604051610cde9796959493929190614098565b60405180910390a1600194505050505060016008559695505050505050565b60038181548110610d0d57600080fd5b6000918252602090912001546001600160a01b0316905081565b610d2f6116a6565b828114610d4e5760405162461bcd60e51b815260040161060d906140e7565b60005b83811015610e0357828282818110610d6b57610d6b6140f7565b9050602002016020810190610d809190613294565b60096000878785818110610d9657610d966140f7565b9050602002810190610da8919061410d565b604051610db6929190614177565b6040518091039020815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610dfb90614184565b915050610d51565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9684848484604051610e3994939291906142ea565b60405180910390a150505050565b600154600090600160a01b900460ff16610e85576001546001600160a01b03163314610e855760405162461bcd60e51b815260040161060d906139e5565b95945050505050565b610e966116a6565b600780546001600160a01b038381166001600160a01b03198316179092556040519116907f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f389061069b9083908590613e59565b600260085403610f0b5760405162461bcd60e51b815260040161060d90613a29565b600260085582151580610f41575067ffffffffffffffff4616610f34604087016020880161431b565b67ffffffffffffffff1614155b610f5d5760405162461bcd60e51b815260040161060d90614356565b82151580610f95575061016085013515801590610f9557506000610f896101a087016101808801613294565b6001600160a01b031614155b610fb15760405162461bcd60e51b815260040161060d90614356565b6000610fc0608087018761410d565b604051610fce929190614177565b604051908190039020905081158015610ff45750610ff061020087018761410d565b1590505b8061101e57507f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81145b61103a5760405162461bcd60e51b815260040161060d9061439a565b600081815260096020908152604091829020546001600160a01b03169167ffffffffffffffff461691611071918a01908a0161431b565b67ffffffffffffffff16148061108f57506001600160a01b03811615155b6110ab5760405162461bcd60e51b815260040161060d906143de565b610160870135606060006110c76101a08b016101808c01613294565b905060006110dd6101a08c016101808d01613294565b905088156111875761111b8a8a60008181106110fb576110fb6140f7565b905060200281019061110d91906143ee565b6111169061446b565b6121a1565b15611139576111326101c08c016101a08d01613294565b9050611156565b61114b6111468a8c6144e5565b611ad6565b929650919450925090505b806001600160a01b0316826001600160a01b0316036111875760405162461bcd60e51b815260040161060d9061454f565b61119760e08c0160c08d0161455f565b1561125757600a546001600160a01b038381169116146111c95760405162461bcd60e51b815260040161060d906145b4565b833410156111e95760405162461bcd60e51b815260040161060d906145f8565b600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561123957600080fd5b505af115801561124d573d6000803e3d6000fd5b505050505061126c565b61126c6001600160a01b038316333087612225565b61129882828661127b8f6147fe565b8e8e9061128891906144e5565b6112928d8f6144e5565b89612246565b50506001600855505050505050505050565b6112b26116a6565b600083836040516112c4929190614177565b6040518091039020905061134581836001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b7f58ddcdb40971f55ad1b6a8a28067274a4ffc7e9d77c3ea14a17652faa705e1978183604051610e3992919061480a565b6007546001600160a01b031633146113a05760405162461bcd60e51b815260040161060d9061484c565b60005b828110156115565760008484838181106113bf576113bf6140f7565b90506020020160208101906113d49190613294565b6001600160a01b03160361146f5760004790506000836001600160a01b03168261c3509060405161140490614049565b600060405180830381858888f193505050503d8060008114611442576040519150601f19603f3d011682016040523d82523d6000602084013e611447565b606091505b50509050806114685760405162461bcd60e51b815260040161060d90614890565b5050611544565b6000848483818110611483576114836140f7565b90506020020160208101906114989190613294565b6001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016114c3919061340d565b602060405180830381865afa1580156114e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150491906148a0565b9050611542838287878681811061151d5761151d6140f7565b90506020020160208101906115329190613294565b6001600160a01b03169190612380565b505b8061154e81614184565b9150506113a3565b50505050565b6115646116a6565b6001600160a01b03811661158a5760405162461bcd60e51b815260040161060d9061491b565b61159381611a86565b50565b60006002600854036115ba5760405162461bcd60e51b815260040161060d90613a29565b6002600855600a546001600160a01b038781169116146115ee576115e96001600160a01b038716333088612225565b61160e565b8434101561160e5760405162461bcd60e51b815260040161060d9061495f565b610649868686865b60008061162583850185614a6b565b9050611631868661173b565b6116428686836040015160006118c0565b8051608082015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c394611690949093928b928d9291600291613db3565b60405180910390a160019150505b949350505050565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161060d90614ad8565b6001600160a01b03821660009081526005602052604090205460ff168115158115150361170f5760405162461bcd60e51b815260040161060d90614356565b506001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b600a546001600160a01b03908116908316036118bc57600154604080516320a6037160e21b815290516000926001600160a01b0316916382980dc49160048083019260209291908290030181865afa15801561179b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117bf9190614ae8565b9050600a60009054906101000a90046001600160a01b03166001600160a01b0316816001600160a01b031663457bfa2f6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561181e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118429190614ae8565b6001600160a01b0316036118ba57600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156118a057600080fd5b505af11580156118b4573d6000803e3d6000fd5b50505050505b505b5050565b80156119dc57600a546001600160a01b038581169116146118f35760405162461bcd60e51b815260040161060d90614b3d565b600a54604051632e1a7d4d60e01b81526001600160a01b0390911690632e1a7d4d906119239086906004016138a0565b600060405180830381600087803b15801561193d57600080fd5b505af1158015611951573d6000803e3d6000fd5b505050506000826001600160a01b03168461c3509060405161197290614049565b600060405180830381858888f193505050503d80600081146119b0576040519150601f19603f3d011682016040523d82523d6000602084013e6119b5565b606091505b50509050806119d65760405162461bcd60e51b815260040161060d90614088565b50611556565b6115566001600160a01b0385168385612380565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff1681151581151503611a445760405162461bcd60e51b815260040161060d90614356565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006060600080611ae98761239f565b925060005b8751811015611cfa5760046000898381518110611b0d57611b0d6140f7565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000206000898381518110611b4d57611b4d6140f7565b602002602001015160200151611b6290614b61565b6001600160e01b031916815260208101919091526040016000205460ff16611b9c5760405162461bcd60e51b815260040161060d90614bda565b6000806000868481518110611bb357611bb36140f7565b60200260200101516001600160a01b031663358f0e1c8c8681518110611bdb57611bdb6140f7565b60200260200101516040518263ffffffff1660e01b8152600401611bff9190614c16565b606060405180830381865afa158015611c1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c409190614c27565b919450925090506001600160a01b0386161580611c6e5750816001600160a01b0316866001600160a01b0316145b611c8a5760405162461bcd60e51b815260040161060d90614ca1565b90945084906001600160a01b0385161580611cb65750806001600160a01b0316856001600160a01b0316145b611cd25760405162461bcd60e51b815260040161060d90614ce5565b935083611cdf838b614cf5565b99509097509550819050611cf281614184565b915050611aee565b5050509193509193565b6000806000806000611d1789888a6124de565b9250925092506000816001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611d4b919061340d565b602060405180830381865afa158015611d68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d8c91906148a0565b905060005b8a51811015611f9a5760008a8281518110611dae57611dae6140f7565b60200260200101516001600160a01b0316634c6da2698d8481518110611dd657611dd66140f7565b602002602001015160200151888581518110611df457611df46140f7565b6020026020010151306040518463ffffffff1660e01b8152600401611e1b93929190614d0d565b600060405180830381865afa158015611e38573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e60919081019061400e565b9050611eb68c8381518110611e7757611e776140f7565b602002602001015160000151878481518110611e9557611e956140f7565b6020026020010151876001600160a01b03166120479092919063ffffffff16565b60008c8381518110611eca57611eca6140f7565b6020026020010151600001516001600160a01b031682604051611eed9190614d5c565b6000604051808303816000865af19150503d8060008114611f2a576040519150601f19603f3d011682016040523d82523d6000602084013e611f2f565b606091505b505090508080611f3c5750895b611f585760405162461bcd60e51b815260040161060d90614d9c565b80611f8557868381518110611f6f57611f6f6140f7565b602002602001015188611f829190614cf5565b97505b50508080611f9290614184565b915050611d91565b506040516370a0823160e01b81526000906001600160a01b038416906370a0823190611fca90309060040161340d565b602060405180830381865afa158015611fe7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061200b91906148a0565b90506120178282613d53565b9650600087116120395760405162461bcd60e51b815260040161060d90614de0565b505050505094509492505050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b8152600401612078929190613e59565b602060405180830381865afa158015612095573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120b991906148a0565b6120c39190614cf5565b90506115568463095ea7b360e01b85846040516024016120e4929190614df0565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612693565b60608060606040518060e00160405280868152602001838152602001856001600160a01b0316815260200160001515815260200160008152602001600015158152602001828152506040516020016121889190614f02565b6040516020818303038152906040529250505092915050565b80516001600160a01b0316600090815260046020908152604082209083015182906121cb90614b61565b6001600160e01b031916815260208101919091526040016000205460ff166122055760405162461bcd60e51b815260040161060d90614bda565b50516001600160a01b031660009081526005602052604090205460ff1690565b611556846323b872dd60e01b8585856040516024016120e493929190614f13565b82518590156122d657600061227485600081518110612267576122676140f7565b60200260200101516121a1565b156122a85761229f89898988600081518110612292576122926140f7565b6020026020010151612722565b925090506122b7565b6122b285846128b4565b925090505b806122d45760405162461bcd60e51b815260040161060d90614f6f565b505b60006122ea86600001518760600151612bfe565b90504667ffffffffffffffff16866020015167ffffffffffffffff1603612365577f0e248ac8be20725176a5f0ab093c5fbb964634d4675012f3d3ad66e69e56d5b781888b858c604051612342959493929190614f7f565b60405180910390a161235e888388600001518960e001516118c0565b5050612377565b612374818a8a89888c88612c36565b50505b50505050505050565b6118ba8363a9059cbb60e01b84846040516024016120e4929190614df0565b60606000825167ffffffffffffffff8111156123bd576123bd613486565b6040519080825280602002602001820160405280156123e6578160200160208202803683370190505b50905060005b83518110156124d7576000848281518110612409576124096140f7565b60200260200101516020015161241e90614b61565b6001600160e01b0319811660009081526002602052604090205484519192506001600160a01b031690849084908110612459576124596140f7565b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b0316838381518110612496576124966140f7565b60200260200101516001600160a01b0316036124c45760405162461bcd60e51b815260040161060d90614ff5565b50806124cf81614184565b9150506123ec565b5092915050565b60606000806000865167ffffffffffffffff8111156124ff576124ff613486565b604051908082528060200260200182016040528015612528578160200160208202803683370190505b50935060005b875181101561261c57600086828151811061254b5761254b6140f7565b60200260200101516001600160a01b031663358f0e1c8a8481518110612573576125736140f7565b60200260200101516040518263ffffffff1660e01b81526004016125979190614c16565b606060405180830381865afa1580156125b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d89190614c27565b909650945090506125e98184614cf5565b9250808683815181106125fe576125fe6140f7565b6020908102919091010152508061261481614184565b91505061252e565b5060005b8451811015612688578185828151811061263c5761263c6140f7565b60200260200101518861264f9190615005565b612659919061503a565b85828151811061266b5761266b6140f7565b60209081029190910101528061268081614184565b915050612620565b505093509350939050565b60006126e8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612db69092919063ffffffff16565b8051909150156118ba5780806020019051810190612706919061504e565b6118ba5760405162461bcd60e51b815260040161060d906150c9565b8051600090819061273e906001600160a01b0388169086612047565b6040516370a0823160e01b81526000906001600160a01b038716906370a082319061276d90309060040161340d565b602060405180830381865afa15801561278a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ae91906148a0565b905083600001516001600160a01b031684602001516040516127d09190614d5c565b6000604051808303816000865af19150503d806000811461280d576040519150601f19603f3d011682016040523d82523d6000602084013e612812565b606091505b5050809350508261282a5760008092509250506128ab565b6040516370a0823160e01b81526000906001600160a01b038816906370a082319061285990309060040161340d565b602060405180830381865afa158015612876573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061289a91906148a0565b90506128a68282613d53565b925050505b94509492505050565b60008060005b8451811015612bf55760008060008684815181106128da576128da6140f7565b60200260200101516001600160a01b031663358f0e1c898681518110612902576129026140f7565b60200260200101516040518263ffffffff1660e01b81526004016129269190614c16565b606060405180830381865afa158015612943573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129679190614c27565b9250925092506000878581518110612981576129816140f7565b60200260200101516001600160a01b0316634c6da2698a87815181106129a9576129a96140f7565b60200260200101516020015186306040518463ffffffff1660e01b81526004016129d593929190614d0d565b600060405180830381865afa1580156129f2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a1a919081019061400e565b9050612a4e898681518110612a3157612a316140f7565b6020908102919091010151516001600160a01b0385169086612047565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190612a7d90309060040161340d565b602060405180830381865afa158015612a9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612abe91906148a0565b9050898681518110612ad257612ad26140f7565b6020026020010151600001516001600160a01b031682604051612af59190614d5c565b6000604051808303816000865af19150503d8060008114612b32576040519150601f19603f3d011682016040523d82523d6000602084013e612b37565b606091505b50508098505087612b545760008097509750505050505050612bf7565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612b8390309060040161340d565b602060405180830381865afa158015612ba0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bc491906148a0565b9050612bd08282613d53565b612bda9089614cf5565b97505050505050508080612bed90614184565b9150506128ba565b505b9250929050565b600033834684604051602001612c179493929190615120565b6040516020818303038152906040528051906020012090505b92915050565b60008084511180612c4d5750600085610200015151115b612c58578451612c5e565b84604001515b90506060612c6d86858a612dcf565b60c0860151349015612c8657612c838534613d53565b90505b608087015180516020918201206000908152600990915260409020546001600160a01b0390811690612cbb908a168287612047565b6000612cc88c8a8a612e59565b9050816001600160a01b031663834bc3ea848b60200151888a8f8f60a00151886040518863ffffffff1660e01b8152600401612d0996959493929190613fa7565b60006040518083038185885af1158015612d27573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612d50919081019061400e565b93505050507f082e2f634ceec1af5105aa53f234b7efad94428a54a714e3b7c7115ee549308089828860200151878c8b6101c00151888e8b8f60800151604051612da39a99989796959493929190615168565b60405180910390a1505050505050505050565b6060612dc58484600085612eda565b90505b9392505050565b60004684602001518484876101200151886101000151604051602001612dfa9695949392919061520a565b6040516020818303038152906040528051906020012090506000612e1d82612f9c565b9050612e2e81866101400151612fcc565b4285610120015111612e525760405162461bcd60e51b815260040161060d906152ce565b5050505050565b60606040518060e0016040528085815260200183815260200184600001516001600160a01b031681526020018460e00151151581526020018461010001518152602001846101e0015115158152602001846102000151815250604051602001612ec29190614f02565b60405160208183030381529060405290509392505050565b606082471015612efc5760405162461bcd60e51b815260040161060d90615338565b6001600160a01b0385163b612f235760405162461bcd60e51b815260040161060d9061537c565b600080866001600160a01b03168587604051612f3f9190614d5c565b60006040518083038185875af1925050503d8060008114612f7c576040519150601f19603f3d011682016040523d82523d6000602084013e612f81565b606091505b5091509150612f91828286613008565b979650505050505050565b600081604051602001612faf919061538c565b604051602081830303815290604052805190602001209050919050565b6000612fd88383613041565b6006549091506001600160a01b038083169116146118ba5760405162461bcd60e51b815260040161060d906153fb565b60608315613017575081612dc8565b8251156130275782518084602001fd5b8160405162461bcd60e51b815260040161060d919061540b565b60008060006130508585613065565b9150915061305d816130a7565b509392505050565b600080825160410361309b5760208301516040840151606085015160001a61308f87828585613187565b94509450505050612bf7565b50600090506002612bf7565b60008160048111156130bb576130bb6133ad565b036130c35750565b60018160048111156130d7576130d76133ad565b036130f45760405162461bcd60e51b815260040161060d90615450565b6002816004811115613108576131086133ad565b036131255760405162461bcd60e51b815260040161060d90615494565b6003816004811115613139576131396133ad565b036131565760405162461bcd60e51b815260040161060d906154e3565b600481600481111561316a5761316a6133ad565b036115935760405162461bcd60e51b815260040161060d90615532565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131be57506000905060036128ab565b8460ff16601b141580156131d657508460ff16601c14155b156131e757506000905060046128ab565b60006001878787876040516000815260200160405260405161320c949392919061554b565b6020604051602081039080840390855afa15801561322e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613257576000600192509250506128ab565b9660009650945050505050565b60006001600160a01b038216612c30565b61327e81613264565b811461159357600080fd5b8035612c3081613275565b6000602082840312156132a9576132a9600080fd5b600061169e8484613289565b8015155b82525050565b60208101612c3082846132b5565b8061327e565b8035612c30816132cd565b60008083601f8401126132f3576132f3600080fd5b50813567ffffffffffffffff81111561330e5761330e600080fd5b602083019150836001820283011115612bf757612bf7600080fd5b60008060008060006080868803121561334457613344600080fd5b60006133508888613289565b9550506020613361888289016132d3565b945050604086013567ffffffffffffffff81111561338157613381600080fd5b61338d888289016132de565b935093505060606133a088828901613289565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b60038110611593576115936133ad565b806133dd816133c3565b919050565b6000612c30826133d3565b6132b9816133e2565b60208101612c3082846133ed565b6132b981613264565b60208101612c308284613404565b80151561327e565b8035612c308161341b565b6000806040838503121561344457613444600080fd5b60006134508585613289565b925050602061346185828601613423565b9150509250929050565b67ffffffffffffffff811661327e565b8035612c308161346b565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156134c2576134c2613486565b6040525050565b60006134d460405190565b90506133dd828261349c565b600067ffffffffffffffff8211156134fa576134fa613486565b601f19601f83011660200192915050565b82818337506000910152565b600061352a613525846134e0565b6134c9565b90508281526020810184848401111561354557613545600080fd5b61305d84828561350b565b600082601f83011261356457613564600080fd5b813561169e848260208601613517565b60008060008060008060c0878903121561359057613590600080fd5b600061359c8989613289565b96505060206135ad89828a01613289565b95505060406135be89828a016132d3565b94505060606135cf89828a0161347b565b935050608087013567ffffffffffffffff8111156135ef576135ef600080fd5b6135fb89828a01613550565b92505060a061360c89828a01613289565b9150509295509295509295565b6001600160e01b0319811661327e565b8035612c3081613619565b60008060006060848603121561364c5761364c600080fd5b60006136588686613289565b935050602061366986828701613629565b925050604061367a86828701613423565b9150509250925092565b60006020828403121561369957613699600080fd5b600061169e84846132d3565b60008083601f8401126136ba576136ba600080fd5b50813567ffffffffffffffff8111156136d5576136d5600080fd5b602083019150836020820283011115612bf757612bf7600080fd5b6000806000806040858703121561370957613709600080fd5b843567ffffffffffffffff81111561372357613723600080fd5b61372f878288016136a5565b9450945050602085013567ffffffffffffffff81111561375157613751600080fd5b61375d878288016136a5565b95989497509550505050565b6000806040838503121561377f5761377f600080fd5b600061378b8585613289565b925050602061346185828601613629565b6000806000806000608086880312156137b7576137b7600080fd5b60006137c38888613289565b95505060206133618882890161347b565b600061022082840312156137ea576137ea600080fd5b50919050565b60008060008060006060868803121561380b5761380b600080fd5b853567ffffffffffffffff81111561382557613825600080fd5b613831888289016137d4565b955050602086013567ffffffffffffffff81111561385157613851600080fd5b61385d888289016136a5565b9450945050604086013567ffffffffffffffff81111561387f5761387f600080fd5b61388b888289016136a5565b92509250509295509295909350565b806132b9565b60208101612c30828461389a565b6000806000604084860312156138c6576138c6600080fd5b833567ffffffffffffffff8111156138e0576138e0600080fd5b6138ec868287016132de565b9350935050602061367a86828701613289565b6000612c306001600160a01b038316613916565b90565b6001600160a01b031690565b6000612c30826138ff565b6000612c3082613922565b6132b98161392d565b60208101612c308284613938565b60008060006040848603121561396757613967600080fd5b833567ffffffffffffffff81111561398157613981600080fd5b6138ec868287016136a5565b6000602082840312156139a2576139a2600080fd5b600061169e8484613629565b601981526000602082017f63616c6c6572206973206e6f74206d6573736167652062757300000000000000815291505b5060200190565b60208082528101612c30816139ae565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291506139de565b60208082528101612c30816139f5565b60408101613a478285613404565b612dc860208301846132b5565b8051612c30816132cd565b600067ffffffffffffffff821115613a7957613a79613486565b5060209081020190565b8051612c3081613275565b60005b83811015613aa9578181015183820152602001613a91565b838111156115565750506000910152565b6000613ac8613525846134e0565b905082815260208101848484011115613ae357613ae3600080fd5b61305d848285613a8e565b600082601f830112613b0257613b02600080fd5b815161169e848260208601613aba565b600060408284031215613b2757613b27600080fd5b613b3160406134c9565b90506000613b3f8484613a83565b825250602082015167ffffffffffffffff811115613b5f57613b5f600080fd5b613b6b84828501613aee565b60208301525092915050565b6000613b8561352584613a5f565b83815290506020808201908402830185811115613ba457613ba4600080fd5b835b81811015613be557805167ffffffffffffffff811115613bc857613bc8600080fd5b808601613bd58982613b12565b8552505060209283019201613ba6565b5050509392505050565b600082601f830112613c0357613c03600080fd5b815161169e848260208601613b77565b8051612c308161341b565b600060e08284031215613c3357613c33600080fd5b613c3d60e06134c9565b90506000613c4b8484613a54565b825250602082015167ffffffffffffffff811115613c6b57613c6b600080fd5b613c7784828501613bef565b6020830152506040613c8b84828501613a83565b6040830152506060613c9f84828501613c13565b6060830152506080613cb384828501613a54565b60808301525060a0613cc784828501613c13565b60a08301525060c082015167ffffffffffffffff811115613cea57613cea600080fd5b613cf684828501613aee565b60c08301525092915050565b600060208284031215613d1757613d17600080fd5b815167ffffffffffffffff811115613d3157613d31600080fd5b61169e84828501613c1e565b634e487b7160e01b600052601160045260246000fd5b600082821015613d6557613d65613d3d565b500390565b6000612c306139138381565b6132b981613d6a565b6000613d89825190565b808452602084019350613da0818560208601613a8e565b601f19601f8201165b9093019392505050565b60e08101613dc1828a61389a565b613dce6020830189613d76565b613ddb604083018861389a565b613de86060830187613404565b613df5608083018661389a565b613e0260a08301856133ed565b81810360c0830152613e148184613d7f565b9998505050505050505050565b6001600160e01b031981166132b9565b60608101613e3f8286613404565b613e4c6020830185613e21565b61169e60408301846132b5565b60408101613e678285613404565b612dc86020830184613404565b60e08101613e82828a61389a565b613e8f6020830189613d76565b613ddb6040830188613d76565b600781526000602082017f746b696e206d6d00000000000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081613e9c565b8051612c308161346b565b600060408284031215613f0057613f00600080fd5b613f0a60406134c9565b90506000613b3f8484613ee0565b600060208284031215613f2d57613f2d600080fd5b815167ffffffffffffffff811115613f4757613f47600080fd5b61169e84828501613eeb565b600f81526000602082017f63627269646765206e6f74207365740000000000000000000000000000000000815291506139de565b60208082528101612c3081613f53565b67ffffffffffffffff81166132b9565b60c08101613fb58289613f97565b613fc26020830188613404565b613fcf604083018761389a565b613fdc6060830186613404565b8181036080830152613fee8185613d7f565b905081810360a08301526140028184613d7f565b98975050505050505050565b60006020828403121561402357614023600080fd5b815167ffffffffffffffff81111561403d5761403d600080fd5b61169e84828501613aee565b6000612c3082613913565b600981526000602082017f73656e64206661696c0000000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614054565b60e081016140a6828a61389a565b613dce602083018961389a565b601481526000602082017f706172616d732073697a65206d69736d61746368000000000000000000000000815291506139de565b60208082528101612c30816140b3565b634e487b7160e01b600052603260045260246000fd5b6000808335601e193685900301811261412857614128600080fd5b80840192508235915067ffffffffffffffff82111561414957614149600080fd5b602083019250600182023603831315612bf557612bf5600080fd5b600061417183858461350b565b50500190565b600061169e828486614164565b6000600019820361419757614197613d3d565b5060010190565b81835260006020840193506141b483858461350b565b601f19601f840116613da9565b6000612dc584848461419e565b6000808335601e19368590030181126141e9576141e9600080fd5b83810160208101935035915067ffffffffffffffff82111561420d5761420d600080fd5b36829003831315612bf557612bf5600080fd5b818352600060208401935083602084028101838060005b8781101561427257848403895261424e82846141ce565b6142598682846141c1565b95506020840160209b909b019a93505050600101614237565b5091979650505050505050565b600061428b8383613404565b505060200190565b6000612dc86020840184613289565b8183526000602084019350818060005b858110156142df576142c48284614293565b6142ce888261427f565b9750602083019250506001016142b2565b509495945050505050565b604080825281016142fc818688614220565b905081810360208301526143118184866142a2565b9695505050505050565b60006020828403121561433057614330600080fd5b600061169e848461347b565b600381526000602082016206e6f760ec1b815291506139de565b60208082528101612c308161433c565b601b81526000602082017f62726964676520646f6573206e6f7420737570706f7274206d73670000000000815291506139de565b60208082528101612c3081614366565b601281526000602082017f756e737570706f72746564206272696467650000000000000000000000000000815291506139de565b60208082528101612c30816143aa565b60008235603e193684900301811261440857614408600080fd5b9190910192915050565b60006040828403121561442757614427600080fd5b61443160406134c9565b9050600061443f8484613289565b825250602082013567ffffffffffffffff81111561445f5761445f600080fd5b613b6b84828501613550565b6000612c303683614412565b600061448561352584613a5f565b838152905060208082019084028301858111156144a4576144a4600080fd5b835b81811015613be557803567ffffffffffffffff8111156144c8576144c8600080fd5b8086016144d58982614412565b85525050602092830192016144a6565b6000612dc8368484614477565b602b81526000602082017f746f6b656e20696e2f6f7574206d757374206e6f7420657175616c206966206581527f7869737473207377617073000000000000000000000000000000000000000000602082015291505b5060400190565b60208082528101612c30816144f2565b60006020828403121561457457614574600080fd5b600061169e8484613423565b601281526000602082017f746b696e206e6f206e6174697665577261700000000000000000000000000000815291506139de565b60208082528101612c3081614580565b600b81526000602082017f696e7366636e7420616d74000000000000000000000000000000000000000000815291506139de565b60208082528101612c30816145c4565b6000610220828403121561461e5761461e600080fd5b6146296102206134c9565b905060006146378484613289565b82525060206146488484830161347b565b602083015250604061465c84828501613289565b60408301525060606146708482850161347b565b606083015250608082013567ffffffffffffffff81111561469357614693600080fd5b61469f84828501613550565b60808301525060a082013567ffffffffffffffff8111156146c2576146c2600080fd5b6146ce84828501613550565b60a08301525060c06146e284828501613423565b60c08301525060e06146f684828501613423565b60e08301525061010061470b848285016132d3565b61010083015250610120614721848285016132d3565b6101208301525061014082013567ffffffffffffffff81111561474657614746600080fd5b61475284828501613550565b61014083015250610160614768848285016132d3565b6101608301525061018061477e84828501613289565b610180830152506101a061479484828501613289565b6101a0830152506101c06147aa84828501613289565b6101c0830152506101e06147c084828501613423565b6101e08301525061020082013567ffffffffffffffff8111156147e5576147e5600080fd5b6147f184828501613550565b6102008301525092915050565b6000612c303683614608565b60408101613e678285613e21565b601181526000602082017f6e6f742066656520636f6c6c6563746f72000000000000000000000000000000815291506139de565b60208082528101612c3081614818565b601281526000602082017f73656e64206e6174697665206661696c65640000000000000000000000000000815291506139de565b60208082528101612c308161485c565b6000602082840312156148b5576148b5600080fd5b600061169e8484613a54565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f646472657373000000000000000000000000000000000000000000000000000060208201529150614548565b60208082528101612c30816148c1565b601881526000602082017f6e6f206e6174697665207472616e7366657272656420696e0000000000000000815291506139de565b60208082528101612c308161492b565b600082601f83011261498357614983600080fd5b813561169e848260208601614477565b600060e082840312156149a8576149a8600080fd5b6149b260e06134c9565b905060006149c084846132d3565b825250602082013567ffffffffffffffff8111156149e0576149e0600080fd5b6149ec8482850161496f565b6020830152506040614a0084828501613289565b6040830152506060614a1484828501613423565b6060830152506080614a28848285016132d3565b60808301525060a0614a3c84828501613423565b60a08301525060c082013567ffffffffffffffff811115614a5f57614a5f600080fd5b613cf684828501613550565b600060208284031215614a8057614a80600080fd5b813567ffffffffffffffff811115614a9a57614a9a600080fd5b61169e84828501614993565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260006139de565b60208082528101612c3081614aa6565b600060208284031215614afd57614afd600080fd5b600061169e8484613a83565b600c81526000602082017f746b206e6f206e61746976650000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614b09565b6000612c3082516001600160e01b03191690565b6000614b6b825190565b60208301614b7881614b4d565b92506004821015614b9f57614b9a6001600160e01b0319836004036008021b90565b831692505b5050919050565b600f81526000602082017f756e737570706f72746564206465780000000000000000000000000000000000815291506139de565b60208082528101612c3081614ba6565b80516000906040840190614bfe8582613404565b5060208301518482036020860152610e858282613d7f565b60208082528101612dc88184614bea565b600080600060608486031215614c3f57614c3f600080fd5b6000614c4b8686613a54565b9350506020614c5c86828701613a83565b925050604061367a86828701613a83565b600d81526000602082017f746b696e206d69736d6174636800000000000000000000000000000000000000815291506139de565b60208082528101612c3081614c6d565b600c81526000602082017f746b6f206d69736d617463680000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614cb1565b60008219821115614d0857614d08613d3d565b500190565b60608082528101614d1e8186613d7f565b9050614d2d602083018561389a565b61169e6040830184613404565b6000614d44825190565b614d52818560208601613a8e565b9290920192915050565b6000612dc88284614d3a565b600b81526000602082017f73776170206661696c6564000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614d68565b601081526000602082017f616c6c207377617073206661696c656400000000000000000000000000000000815291506139de565b60208082528101612c3081614dac565b60408101614dfe8285613404565b612dc8602083018461389a565b6000612dc88383614bea565b6000614e21825190565b80845260208401935083602082028501614e3b8560200190565b8060005b858110156142725784840389528151614e588582614e0b565b94506020830160209a909a0199925050600101614e3f565b805160009060e0840190614e84858261389a565b5060208301518482036020860152614e9c8282614e17565b9150506040830151614eb16040860182613404565b506060830151614ec460608601826132b5565b506080830151614ed7608086018261389a565b5060a0830151614eea60a08601826132b5565b5060c083015184820360c0860152610e858282613d7f565b60208082528101612dc88184614e70565b60608101614f218286613404565b614f2e6020830185613404565b61169e604083018461389a565b600981526000602082017f73776170206661696c0000000000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614f3b565b60a08101614f8d828861389a565b614f9a602083018761389a565b614fa76040830186613404565b614fb4606083018561389a565b6143116080830184613404565b600c81526000602082017f636463206e6f20666f756e640000000000000000000000000000000000000000815291506139de565b60208082528101612c3081614fc1565b600081600019048311821515161561501f5761501f613d3d565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261504957615049615024565b500490565b60006020828403121561506357615063600080fd5b600061169e8484613c13565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f7420737563636565640000000000000000000000000000000000000000000060208201529150614548565b60208082528101612c308161506f565b6000612c308260601b90565b6000612c30826150d9565b6132b96150fc82613264565b6150e5565b6000612c308260c01b90565b6132b967ffffffffffffffff8216615101565b600061512c82876150f0565b60148201915061513c82866150f0565b60148201915061514c828561510d565b60088201915061515c828461510d565b50600801949350505050565b6101408101615177828d61389a565b8181036020830152615189818c613d7f565b9050615198604083018b613f97565b6151a5606083018a61389a565b6151b26080830189613404565b6151bf60a0830188613404565b6151cc60c0830187613404565b6151d960e0830186613404565b6151e761010083018561389a565b8181036101208301526151fa8184613d7f565b9c9b505050505050505050505050565b7f6578656375746f722066656500000000000000000000000000000000000000008152600c01600061523c828961510d565b60088201915061524c828861510d565b60088201915061525c828761389a565b60208201915061526c82866150f0565b60148201915061527c828561389a565b60208201915061528c828461389a565b506020019695505050505050565b601181526000602082017f646561646c696e65206578636565646564000000000000000000000000000000815291506139de565b60208082528101612c308161529a565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f81527f722063616c6c000000000000000000000000000000000000000000000000000060208201529150614548565b60208082528101612c30816152de565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815291506139de565b60208082528101612c3081615348565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c0160006153be828461389a565b50602001919050565b600e81526000602082017f696e76616c6964207369676e6572000000000000000000000000000000000000815291506139de565b60208082528101612c30816153c7565b60208082528101612dc88184613d7f565b601881526000602082017f45434453413a20696e76616c6964207369676e61747572650000000000000000815291506139de565b60208082528101612c308161541c565b601f81526000602082017f45434453413a20696e76616c6964207369676e6174757265206c656e67746800815291506139de565b60208082528101612c3081615460565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202773272076616c815261756560f01b60208201529150614548565b60208082528101612c30816154a4565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202776272076616c815261756560f01b60208201529150614548565b60208082528101612c30816154f3565b60ff81166132b9565b60808101615559828761389a565b6155666020830186615542565b615573604083018561389a565b610e85606083018461389a56fea2646970667358221220817cb2cfee1a808d9f231e9263ed336fb57e08b611df4ac975bb01b6293c7f5f64736f6c634300080f0033

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

0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d000000000000000000000000420000000000000000000000000000000000000600000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e74323536292900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000056b2ffd01cd39ee34d62b328e07e2cef79a13cf60000000000000000000000000000000000000000000000000000000000000005000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd199000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e7432353629290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000537377617028616464726573732c28616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e743235362c75696e743235362c6279746573292c62797465732900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d2900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001111111254760f7ab3f16433eea9304126dcd199

-----Decoded View---------------
Arg [0] : _messageBus (address): 0x0D71D18126E03646eb09FEc929e2ae87b7CAE69d
Arg [1] : _nativeWrap (address): 0x4200000000000000000000000000000000000006
Arg [2] : _signer (address): 0x26e6eAf3D3C5d4B8290AA7dd896140f383dFf043
Arg [3] : _feeCollector (address): 0xf0761BB438CeFca39A8fd1F27d75ccC7F6Df92d8
Arg [4] : _funcSigs (string[]): exactInput((bytes,address,uint256,uint256,uint256))
Arg [5] : _codecs (address[]): 0x56B2FFd01cd39eE34d62b328e07E2cef79A13cf6
Arg [6] : _supportedDexList (address[]): 0xE592427A0AEce92De3Edee1F18E0157C05861564,0x1111111254760F7ab3F16433eea9304126DCd199,0x1111111254760F7ab3F16433eea9304126DCd199,0x1111111254760F7ab3F16433eea9304126DCd199,0x1111111254760F7ab3F16433eea9304126DCd199
Arg [7] : _supportedDexFuncs (string[]): exactInput((bytes,address,uint256,uint256,uint256)),swap(address,(address,address,address,address,uint256,uint256,uint256,bytes),bytes),clipperSwap(address,address,uint256,uint256),unoswap(address,uint256,uint256,bytes32[]),uniswapV3Swap(uint256,uint256,uint256[])
Arg [8] : _externalSwapDexList (address[]): 0x1111111254760F7ab3F16433eea9304126DCd199
Arg [9] : _testMode (bool): False

-----Encoded View---------------
47 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d
Arg [1] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [2] : 00000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043
Arg [3] : 000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [7] : 00000000000000000000000000000000000000000000000000000000000002e0
Arg [8] : 00000000000000000000000000000000000000000000000000000000000005a0
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000033
Arg [13] : 6578616374496e707574282862797465732c616464726573732c75696e743235
Arg [14] : 362c75696e743235362c75696e74323536292900000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [16] : 00000000000000000000000056b2ffd01cd39ee34d62b328e07e2cef79a13cf6
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [18] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Arg [19] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [20] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [21] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [22] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [24] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [25] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [26] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [27] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [28] : 0000000000000000000000000000000000000000000000000000000000000240
Arg [29] : 0000000000000000000000000000000000000000000000000000000000000033
Arg [30] : 6578616374496e707574282862797465732c616464726573732c75696e743235
Arg [31] : 362c75696e743235362c75696e74323536292900000000000000000000000000
Arg [32] : 0000000000000000000000000000000000000000000000000000000000000053
Arg [33] : 7377617028616464726573732c28616464726573732c616464726573732c6164
Arg [34] : 64726573732c616464726573732c75696e743235362c75696e743235362c7569
Arg [35] : 6e743235362c6279746573292c62797465732900000000000000000000000000
Arg [36] : 000000000000000000000000000000000000000000000000000000000000002c
Arg [37] : 636c69707065725377617028616464726573732c616464726573732c75696e74
Arg [38] : 3235362c75696e74323536290000000000000000000000000000000000000000
Arg [39] : 000000000000000000000000000000000000000000000000000000000000002a
Arg [40] : 756e6f7377617028616464726573732c75696e743235362c75696e743235362c
Arg [41] : 627974657333325b5d2900000000000000000000000000000000000000000000
Arg [42] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [43] : 756e69737761705633537761702875696e743235362c75696e743235362c7569
Arg [44] : 6e743235365b5d29000000000000000000000000000000000000000000000000
Arg [45] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [46] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199


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  ]
[ 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.