ETH Price: $2,418.05 (+0.59%)

Contract

0xA7b2Ff8EAff742B4E543d72033880D5445e1f3be

Overview

ETH Balance

0 ETH

ETH Value

$0.00

Token Holdings

Sponsored

Transaction Hash
Method
Block
From
To
Transfer With Sw...300039232022-10-18 5:53:03724 days ago1666072383IN
0xA7b2Ff8E...445e1f3be
0.0303654 ETH0.0006568760730.001
Transfer With Sw...299888242022-10-18 3:57:27724 days ago1666065447IN
0xA7b2Ff8E...445e1f3be
0 ETH0.0001736522020.001
Transfer With Sw...298642622022-10-17 10:09:05725 days ago1666001345IN
0xA7b2Ff8E...445e1f3be
0.000327 ETH0.0002477053650.001
Transfer With Sw...298601482022-10-17 9:43:44725 days ago1665999824IN
0xA7b2Ff8E...445e1f3be
0.020243527180774 ETH0.000499234620.001
Set Codec288187822022-10-12 8:27:45730 days ago1665563265IN
0xA7b2Ff8E...445e1f3be
0 ETH0.000078288490.001
Set Supported Br...286782602022-10-11 12:51:58730 days ago1665492718IN
0xA7b2Ff8E...445e1f3be
0 ETH0.0002436451410.001
Set Supported Br...286777102022-10-11 12:47:58730 days ago1665492478IN
0xA7b2Ff8E...445e1f3be
0 ETH0.0001964648090.001
0x60a06040286771752022-10-11 12:44:43730 days ago1665492283IN
 Create: TransferSwapper
0 ETH0.0088315138490.001

Latest 9 internal transactions

Advanced mode:
Parent Transaction Hash Block From To
300039232022-10-18 5:53:03724 days ago1666072383
0xA7b2Ff8E...445e1f3be
0.0003654 ETH
300039232022-10-18 5:53:03724 days ago1666072383
0xA7b2Ff8E...445e1f3be
0.03 ETH
300015512022-10-18 5:34:13724 days ago1666071253
0xA7b2Ff8E...445e1f3be
0.040885724409604 ETH
300015512022-10-18 5:34:13724 days ago1666071253
0xA7b2Ff8E...445e1f3be
0.040885724409604 ETH
298642622022-10-17 10:09:05725 days ago1666001345
0xA7b2Ff8E...445e1f3be
0.000327 ETH
298601482022-10-17 9:43:44725 days ago1665999824
0xA7b2Ff8E...445e1f3be
0.000243527180774 ETH
298601482022-10-17 9:43:44725 days ago1665999824
0xA7b2Ff8E...445e1f3be
0.02 ETH
298586522022-10-17 9:34:56725 days ago1665999296
0xA7b2Ff8E...445e1f3be
0.027798399954313 ETH
298586522022-10-17 9:34:56725 days ago1665999296
0xA7b2Ff8E...445e1f3be
0.027798399954313 ETH

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 33 : 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 "./lib/Pauser.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,
    Pauser
{
    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,
        bool _testMode
    )
        Swapper(_funcSigs, _codecs, _supportedDexList, _supportedDexFuncs)
        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 whenNotPaused {
        // 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 srcToken = _desc.tokenIn;
        address bridgeToken = _desc.tokenIn;
        if (_srcSwaps.length != 0) {
            (amountIn, srcToken, bridgeToken, codecs) = sanitizeSwaps(_srcSwaps);
        }
        if (_desc.nativeIn) {
            require(srcToken == nativeWrap, "tkin no nativeWrap");
            require(msg.value >= amountIn, "insfcnt amt"); // insufficient amount
            IWETH(nativeWrap).deposit{value: amountIn}();
        } else {
            IERC20(srcToken).safeTransferFrom(msg.sender, address(this), amountIn);
        }

        _swapAndSend(srcToken, bridgeToken, 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;
            (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 srcToken,
        address bridgeToken,
        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, srcToken);
            uint256 msgFee = msg.value;
            if (_desc.nativeIn) {
                msgFee = msg.value - _amountIn;
            }
            IBridgeAdapter bridge = bridges[keccak256(bytes(_desc.bridgeProvider))];
            IERC20(bridgeToken).safeIncreaseAllowance(address(bridge), _amountOut);
            bytes memory requestMessage = _encodeRequestMessage(_id, _desc, _dstSwaps);
            bridgeResp = bridge.bridge{value: msgFee}(
                _desc.dstChainId,
                bridgeOutReceiver,
                _amountOut,
                bridgeToken,
                _desc.bridgeParams,
                requestMessage
            );
        }
        emit RequestSent(
            _id,
            bridgeResp,
            _desc.dstChainId,
            _amountIn,
            srcToken,
            _desc.dstTokenOut,
            bridgeOutReceiver,
            bridgeToken,
            _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 whenNotPaused 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);
                require(tokenIn == _token, "tkin mm"); // tokenIn mismatch
                (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 whenNotPaused 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 whenNotPaused 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 33 : 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 33 : 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 33 : 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 33 : 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 33 : 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;
        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 33 : 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 33 : 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 33 : Pauser.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.8.15;

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

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

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

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

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

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

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

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

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

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

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

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

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

File 10 of 33 : 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 11 of 33 : 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 12 of 33 : 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 13 of 33 : 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;

    constructor(
        string[] memory _funcSigs,
        address[] memory _codecs,
        address[] memory _supportedDexList,
        string[] memory _supportedDexFuncs
    ) DexRegistry(_supportedDexList, _supportedDexFuncs) CodecRegistry(_funcSigs, _codecs) {}

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

File 14 of 33 : 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 15 of 33 : 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 16 of 33 : 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 17 of 33 : 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 18 of 33 : 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 19 of 33 : 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 20 of 33 : 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 21 of 33 : 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 22 of 33 : 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 23 of 33 : 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 24 of 33 : 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 25 of 33 : 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 26 of 33 : 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 27 of 33 : 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 28 of 33 : 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 29 of 33 : 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 30 of 33 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

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

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

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

    bool private _paused;

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

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

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

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

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

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

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

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

File 31 of 33 : 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 32 of 33 : 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 33 of 33 : 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)
    // 0xd0a3b665 fillOrderRFQ((uint256,address,address,address,address,uint256,uint256),bytes,uint256,uint256)
    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":"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":"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":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"PauserAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"PauserRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"CBRIDGE_PROVIDER_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"addPauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridges","outputs":[{"internalType":"contract IBridgeAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"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":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isPauser","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageBus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeWrap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pausers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"removePauser","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renouncePauser","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":"_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":"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"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b5060405162005fd338038062005fd383398101604081905262000034916200072b565b85878686868681818585620000493362000255565b8051825114620000765760405162461bcd60e51b81526004016200006d9062000896565b60405180910390fd5b60005b8251811015620000ef5760008382815181106200009a576200009a620008a8565b6020026020010151805190602001209050620000d981848481518110620000c557620000c5620008a8565b6020026020010151620002a560201b60201c565b5080620000e681620008d4565b91505062000079565b50505060005b82518110156200016d576000828281518110620001165762000116620008a8565b602002602001015180519060200120905062000157848381518110620001405762000140620008a8565b60200260200101518260016200031760201b60201c565b50806200016481620008d4565b915050620000f5565b5050600580546001600160a01b039788166001600160a01b03199182161790915560068054989097169716969096179094555050600160075550506009805460ff1916905550620001be33620003b0565b60018054600b80546001600160a01b039b8c166001600160a01b031991909116179055911515600160a01b026001600160a81b031990921698909916979097179690961790965550506040805180820190915260078152666362726964676560c81b60209091015250507f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f60805250620009869050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff16811515811515036200036e5760405162461bcd60e51b81526004016200006d906200090c565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b6001600160a01b0381166000908152600a602052604090205460ff1615620003ec5760405162461bcd60e51b81526004016200006d9062000953565b6001600160a01b0381166000908152600a602052604090819020805460ff19166001179055517f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f8906200044190839062000976565b60405180910390a150565b60006001600160a01b0382165b92915050565b6200046a816200044c565b81146200047657600080fd5b50565b805162000459816200045f565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681018181106001600160401b0382111715620004c457620004c462000486565b6040525050565b6000620004d760405190565b9050620004e582826200049c565b919050565b60006001600160401b0382111562000506576200050662000486565b5060209081020190565b60006001600160401b038211156200052c576200052c62000486565b601f19601f83011660200192915050565b60005b838110156200055a57818101518382015260200162000540565b838111156200056a576000848401525b50505050565b600062000587620005818462000510565b620004cb565b905082815260208101848484011115620005a457620005a4600080fd5b620005b18482856200053d565b509392505050565b600082601f830112620005cf57620005cf600080fd5b8151620005e184826020860162000570565b949350505050565b6000620005fa6200058184620004ea565b838152905060208082019084028301858111156200061b576200061b600080fd5b835b81811015620006615780516001600160401b03811115620006415762000641600080fd5b808601620006508982620005b9565b85525050602092830192016200061d565b5050509392505050565b600082601f830112620006815762000681600080fd5b8151620005e1848260208601620005e9565b6000620006a46200058184620004ea565b83815290506020808201908402830185811115620006c557620006c5600080fd5b835b81811015620006615780620006dd888262000479565b84525060209283019201620006c7565b600082601f830112620007035762000703600080fd5b8151620005e184826020860162000693565b8015156200046a565b8051620004598162000715565b60008060008060008060008060006101208a8c0312156200074f576200074f600080fd5b60006200075d8c8c62000479565b9950506020620007708c828d0162000479565b9850506040620007838c828d0162000479565b9750506060620007968c828d0162000479565b96505060808a01516001600160401b03811115620007b757620007b7600080fd5b620007c58c828d016200066b565b95505060a08a01516001600160401b03811115620007e657620007e6600080fd5b620007f48c828d01620006ed565b94505060c08a01516001600160401b03811115620008155762000815600080fd5b620008238c828d01620006ed565b93505060e08a01516001600160401b03811115620008445762000844600080fd5b620008528c828d016200066b565b925050610100620008668c828d016200071e565b9150509295985092959850929598565b60068152600060208201656c656e206d6d60d01b815291505b5060200190565b60208082528101620004598162000876565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198203620008ea57620008ea620008be565b5060010190565b600381526000602082016206e6f760ec1b815291506200088f565b602080825281016200045981620008f1565b601981526000602082017f4163636f756e7420697320616c72656164792070617573657200000000000000815291506200088f565b6020808252810162000459816200091e565b62000970816200044c565b82525050565b6020810162000459828462000965565b608051615623620009b06000396000818161059501528181610c35015261119301526156236000f3fe6080604052600436106102385760003560e01c806382dc1ec411610138578063c0404998116100b0578063eeaaa6511161007f578063f2fde38b11610064578063f2fde38b14610688578063fb453787146106a8578063fbf5d763146106bb57600080fd5b8063eeaaa65114610625578063efcfd8f51461066857600080fd5b8063c040499814610583578063c415b95c146105c4578063c5bccca3146105e4578063cd9ea3421461060457600080fd5b806391ec04b511610107578063a1a227fa116100ec578063a1a227fa14610530578063a42dce8014610550578063a6131ca01461057057600080fd5b806391ec04b5146104e25780639c649fdf1461051d57600080fd5b806382dc1ec41461046f5780638456cb591461048f5780638da5cb5b146104a4578063918ead76146104c257600080fd5b80635c975abb116101cb5780636ef8d66d1161019a5780637cd2bffc1161017f5780637cd2bffc1461040c57806380f51c121461041f57806382665a8f1461044f57600080fd5b80636ef8d66d146103e2578063715018a6146103f757600080fd5b80635c975abb1461036a578063675df759146103825780636b2c0f55146103a25780636c19e783146103c257600080fd5b806346fbf68e1161020757806346fbf68e146102d1578063547cad12146103175780635ab7afc6146103375780635b5a66a71461034a57600080fd5b80630bcb498214610244578063238ac9331461026d5780633f4ba83a1461029a578063457bfa2f146102b157600080fd5b3661023f57005b600080fd5b610257610252366004613303565b6106f1565b60405161026491906133d6565b60405180910390f35b34801561027957600080fd5b5060055461028d906001600160a01b031681565b60405161026491906133ed565b3480156102a657600080fd5b506102af610782565b005b3480156102bd57600080fd5b50600b5461028d906001600160a01b031681565b3480156102dd57600080fd5b5061030a6102ec3660046133fb565b6001600160a01b03166000908152600a602052604090205460ff1690565b6040516102649190613424565b34801561032357600080fd5b506102af6103323660046133fb565b6107bb565b61025761034536600461353b565b61081a565b34801561035657600080fd5b506102af6103653660046133fb565b610939565b34801561037657600080fd5b5060095460ff1661030a565b34801561038e57600080fd5b506102af61039d36600461360e565b61098c565b3480156103ae57600080fd5b506102af6103bd3660046133fb565b6109df565b3480156103ce57600080fd5b506102af6103dd3660046133fb565b6109f3565b3480156103ee57600080fd5b506102af610a5a565b34801561040357600080fd5b506102af610a63565b61025761041a36600461353b565b610a75565b34801561042b57600080fd5b5061030a61043a3660046133fb565b600a6020526000908152604090205460ff1681565b34801561045b57600080fd5b5061028d61046a36600461365e565b610e44565b34801561047b57600080fd5b506102af61048a3660046133fb565b610e6e565b34801561049b57600080fd5b506102af610e7f565b3480156104b057600080fd5b506000546001600160a01b031661028d565b3480156104ce57600080fd5b506102af6104dd3660046136ca565b610eb6565b3480156104ee57600080fd5b5061030a6104fd366004613743565b600460209081526000928352604080842090915290825290205460ff1681565b61025761052b366004613780565b610fd6565b34801561053c57600080fd5b5060015461028d906001600160a01b031681565b34801561055c57600080fd5b506102af61056b3660046133fb565b61101d565b6102af61057e3660046137d4565b611078565b34801561058f57600080fd5b506105b77f000000000000000000000000000000000000000000000000000000000000000081565b6040516102649190613884565b3480156105d057600080fd5b5060065461028d906001600160a01b031681565b3480156105f057600080fd5b506102af6105ff366004613892565b6113bc565b34801561061057600080fd5b5060015461030a90600160a01b900460ff1681565b34801561063157600080fd5b5061065b61064036600461365e565b6008602052600090815260409020546001600160a01b031681565b6040516102649190613925565b34801561067457600080fd5b506102af610683366004613933565b611488565b34801561069457600080fd5b506102af6106a33660046133fb565b61166e565b6102576106b6366004613303565b6116a5565b3480156106c757600080fd5b5061065b6106d6366004613971565b6002602052600090815260409020546001600160a01b031681565b600154600090600160a01b900460ff16610738576001546001600160a01b031633146107385760405162461bcd60e51b815260040161072f906139c9565b60405180910390fd5b60026007540361075a5760405162461bcd60e51b815260040161072f90613a0d565b600260075561076761171d565b61077386868686611740565b60016007559695505050505050565b336000908152600a602052604090205460ff166107b15760405162461bcd60e51b815260040161072f90613a51565b6107b96117d0565b565b6107c361181c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e9161080f916133ed565b60405180910390a150565b600154600090600160a01b900460ff16610858576001546001600160a01b031633146108585760405162461bcd60e51b815260040161072f906139c9565b60026007540361087a5760405162461bcd60e51b815260040161072f90613a0d565b600260075561088761171d565b60008380602001905181019061089d9190613d0f565b90506108a98787611846565b60008160800151876108bb9190613d60565b90506108ce8882846040015160006119cb565b8151608083015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c39461091c9490939287928f9291600291613dc0565b60405180910390a160019250505060016007559695505050505050565b61094161181c565b600b80546001600160a01b0319166001600160a01b0383161790556040517fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d9061080f9083906133ed565b61099461181c565b61099f838383611afb565b7f5e20184b00709d9f103306958e9fb9d509f78bec1829ca7080f2c43eb2ff21a88383836040516109d293929190613e3e565b60405180910390a1505050565b6109e761181c565b6109f081611b91565b50565b6109fb61181c565b600580546001600160a01b038381166001600160a01b03198316179092556040519116907f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb90610a4e9083908590613e66565b60405180910390a15050565b6107b933611b91565b610a6b61181c565b6107b96000611c19565b600154600090600160a01b900460ff16610ab3576001546001600160a01b03163314610ab35760405162461bcd60e51b815260040161072f906139c9565b600260075403610ad55760405162461bcd60e51b815260040161072f90613a0d565b6002600755610ae261171d565b600083806020019051810190610af89190613d0f565b90508060800151861015610b6a5760808101869052805160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c393610b58939092909182918d918d91600191613e81565b60405180910390a16001915050610773565b6080810151610b799087613d60565b95508560006060610b8a8a84611846565b6020840151518a9015610c0e5760606000610ba88760200151611c69565b90955093509150506001600160a01b03808216908e1614610bdb5760405162461bcd60e51b815260040161072f90613edd565b610bef8760200151838e8a60a00151611e97565b90965094508415610c0b57610c0b8d86896040015160006119cb565b50505b60c08501515115610d485760008560c00151806020019051810190610c339190613f25565b7f00000000000000000000000000000000000000000000000000000000000000006000908152600860205260409020549091506001600160a01b031680610c8c5760405162461bcd60e51b815260040161072f90613f94565b610ca06001600160a01b03841682886121da565b6000610cb4886000015189604001516122c3565b83516040808b0151602087015191516341a5e1f560e11b81529394506001600160a01b0386169363834bc3ea933493610cf79391928e918c918a90600401613fb4565b60006040518083038185885af1158015610d15573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d3e919081019061401b565b9450505050610de0565b3415610dcc576000876001600160a01b031634604051610d6790614056565b60006040518083038185875af1925050503d8060008114610da4576040519150601f19603f3d011682016040523d82523d6000602084013e610da9565b606091505b5050905080610dca5760405162461bcd60e51b815260040161072f90614095565b505b610de08185876040015188606001516119cb565b507ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3846000015184848d8860800151600187604051610e2597969594939291906140a5565b60405180910390a1600194505050505060016007559695505050505050565b60038181548110610e5457600080fd5b6000918252602090912001546001600160a01b0316905081565b610e7661181c565b6109f081612334565b336000908152600a602052604090205460ff16610eae5760405162461bcd60e51b815260040161072f90613a51565b6107b96123c0565b610ebe61181c565b828114610edd5760405162461bcd60e51b815260040161072f906140f4565b60005b83811015610f9257828282818110610efa57610efa614104565b9050602002016020810190610f0f91906133fb565b60086000878785818110610f2557610f25614104565b9050602002810190610f37919061411a565b604051610f45929190614184565b6040518091039020815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610f8a90614191565b915050610ee0565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9684848484604051610fc894939291906142f7565b60405180910390a150505050565b600154600090600160a01b900460ff16611014576001546001600160a01b031633146110145760405162461bcd60e51b815260040161072f906139c9565b95945050505050565b61102561181c565b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f3890610a4e9083908590613e66565b60026007540361109a5760405162461bcd60e51b815260040161072f90613a0d565b60026007556110a761171d565b821515806110d8575067ffffffffffffffff46166110cb6040870160208801614328565b67ffffffffffffffff1614155b6110f45760405162461bcd60e51b815260040161072f90614363565b8215158061112c57506101608501351580159061112c575060006111206101a0870161018088016133fb565b6001600160a01b031614155b6111485760405162461bcd60e51b815260040161072f90614363565b6000611157608087018761411a565b604051611165929190614184565b60405190819003902090508115801561118b57506111876101e087018761411a565b1590505b806111b557507f000000000000000000000000000000000000000000000000000000000000000081145b6111d15760405162461bcd60e51b815260040161072f906143a7565b600081815260086020908152604091829020546001600160a01b03169167ffffffffffffffff461691611208918a01908a01614328565b67ffffffffffffffff16148061122657506001600160a01b03811615155b6112425760405162461bcd60e51b815260040161072f906143eb565b6101608701356060600061125e6101a08b016101808c016133fb565b905060006112746101a08c016101808d016133fb565b905088156112995761128e6112898a8c6144c2565b611c69565b929650919450925090505b6112a960e08c0160c08d016144cf565b1561136957600b546001600160a01b038381169116146112db5760405162461bcd60e51b815260040161072f90614524565b833410156112fb5760405162461bcd60e51b815260040161072f90614568565b600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561134b57600080fd5b505af115801561135f573d6000803e3d6000fd5b505050505061137e565b61137e6001600160a01b0383163330876123fd565b6113aa82828661138d8f614758565b8e8e9061139a91906144c2565b6113a48d8f6144c2565b8961241e565b50506001600755505050505050505050565b6113c461181c565b600083836040516113d6929190614184565b6040518091039020905061145781836001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b7f58ddcdb40971f55ad1b6a8a28067274a4ffc7e9d77c3ea14a17652faa705e1978183604051610fc8929190614764565b6006546001600160a01b031633146114b25760405162461bcd60e51b815260040161072f906147a6565b60005b828110156116685760008484838181106114d1576114d1614104565b90506020020160208101906114e691906133fb565b6001600160a01b0316036115815760004790506000836001600160a01b03168261c3509060405161151690614056565b600060405180830381858888f193505050503d8060008114611554576040519150601f19603f3d011682016040523d82523d6000602084013e611559565b606091505b505090508061157a5760405162461bcd60e51b815260040161072f906147ea565b5050611656565b600084848381811061159557611595614104565b90506020020160208101906115aa91906133fb565b6001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016115d591906133ed565b602060405180830381865afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161691906147fa565b9050611654838287878681811061162f5761162f614104565b905060200201602081019061164491906133fb565b6001600160a01b03169190612500565b505b8061166081614191565b9150506114b5565b50505050565b61167661181c565b6001600160a01b03811661169c5760405162461bcd60e51b815260040161072f90614878565b6109f081611c19565b60006002600754036116c95760405162461bcd60e51b815260040161072f90613a0d565b6002600755600b546001600160a01b038781169116146116fd576116f86001600160a01b0387163330886123fd565b610767565b843410156107675760405162461bcd60e51b815260040161072f906148bc565b60095460ff16156107b95760405162461bcd60e51b815260040161072f90614900565b60008061174f83850185614a0c565b905061175b8686611846565b61176c8686836040015160006119cb565b8051608082015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3946117ba949093928b928d9291600291613dc0565b60405180910390a160019150505b949350505050565b6117d861251f565b6009805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161181291906133ed565b60405180910390a1565b6000546001600160a01b031633146107b95760405162461bcd60e51b815260040161072f90614a79565b600b546001600160a01b03908116908316036119c757600154604080516320a6037160e21b815290516000926001600160a01b0316916382980dc49160048083019260209291908290030181865afa1580156118a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ca9190614a89565b9050600b60009054906101000a90046001600160a01b03166001600160a01b0316816001600160a01b031663457bfa2f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611929573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194d9190614a89565b6001600160a01b0316036119c557600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156119ab57600080fd5b505af11580156119bf573d6000803e3d6000fd5b50505050505b505b5050565b8015611ae757600b546001600160a01b038581169116146119fe5760405162461bcd60e51b815260040161072f90614ade565b600b54604051632e1a7d4d60e01b81526001600160a01b0390911690632e1a7d4d90611a2e908690600401613884565b600060405180830381600087803b158015611a4857600080fd5b505af1158015611a5c573d6000803e3d6000fd5b505050506000826001600160a01b03168461c35090604051611a7d90614056565b600060405180830381858888f193505050503d8060008114611abb576040519150601f19603f3d011682016040523d82523d6000602084013e611ac0565b606091505b5050905080611ae15760405162461bcd60e51b815260040161072f90614095565b50611668565b6116686001600160a01b0385168385612500565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff1681151581151503611b4f5760405162461bcd60e51b815260040161072f90614363565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b6001600160a01b0381166000908152600a602052604090205460ff16611bc95760405162461bcd60e51b815260040161072f90614b22565b6001600160a01b0381166000908152600a602052604090819020805460ff19169055517fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e9061080f9083906133ed565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006060600080611c7c87612541565b925060005b8751811015611e8d5760046000898381518110611ca057611ca0614104565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000206000898381518110611ce057611ce0614104565b602002602001015160200151611cf590614b46565b6001600160e01b031916815260208101919091526040016000205460ff16611d2f5760405162461bcd60e51b815260040161072f90614bbf565b6000806000868481518110611d4657611d46614104565b60200260200101516001600160a01b031663358f0e1c8c8681518110611d6e57611d6e614104565b60200260200101516040518263ffffffff1660e01b8152600401611d929190614bfb565b606060405180830381865afa158015611daf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd39190614c0c565b919450925090506001600160a01b0386161580611e015750816001600160a01b0316866001600160a01b0316145b611e1d5760405162461bcd60e51b815260040161072f90614c86565b90945084906001600160a01b0385161580611e495750806001600160a01b0316856001600160a01b0316145b611e655760405162461bcd60e51b815260040161072f90614cca565b935083611e72838b614cda565b99509097509550819050611e8581614191565b915050611c81565b5050509193509193565b6000806000806000611eaa89888a612680565b9250925092506000816001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611ede91906133ed565b602060405180830381865afa158015611efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1f91906147fa565b905060005b8a5181101561212d5760008a8281518110611f4157611f41614104565b60200260200101516001600160a01b0316634c6da2698d8481518110611f6957611f69614104565b602002602001015160200151888581518110611f8757611f87614104565b6020026020010151306040518463ffffffff1660e01b8152600401611fae93929190614cf2565b600060405180830381865afa158015611fcb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ff3919081019061401b565b90506120498c838151811061200a5761200a614104565b60200260200101516000015187848151811061202857612028614104565b6020026020010151876001600160a01b03166121da9092919063ffffffff16565b60008c838151811061205d5761205d614104565b6020026020010151600001516001600160a01b0316826040516120809190614d41565b6000604051808303816000865af19150503d80600081146120bd576040519150601f19603f3d011682016040523d82523d6000602084013e6120c2565b606091505b5050905080806120cf5750895b6120eb5760405162461bcd60e51b815260040161072f90614d81565b806121185786838151811061210257612102614104565b6020026020010151886121159190614cda565b97505b5050808061212590614191565b915050611f24565b506040516370a0823160e01b81526000906001600160a01b038416906370a082319061215d9030906004016133ed565b602060405180830381865afa15801561217a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219e91906147fa565b90506121aa8282613d60565b9650600087116121cc5760405162461bcd60e51b815260040161072f90614dc5565b505050505094509492505050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b815260040161220b929190613e66565b602060405180830381865afa158015612228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224c91906147fa565b6122569190614cda565b90506116688463095ea7b360e01b8584604051602401612277929190614dd5565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612835565b60608060606040518060e00160405280868152602001838152602001856001600160a01b03168152602001600015158152602001600081526020016000151581526020018281525060405160200161231b9190614ee7565b6040516020818303038152906040529250505092915050565b6001600160a01b0381166000908152600a602052604090205460ff161561236d5760405162461bcd60e51b815260040161072f90614f2c565b6001600160a01b0381166000908152600a602052604090819020805460ff19166001179055517f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f89061080f9083906133ed565b6123c861171d565b6009805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118053390565b611668846323b872dd60e01b85858560405160240161227793929190614f3c565b825185901561245657600061243385846128c4565b92509050806124545760405162461bcd60e51b815260040161072f90614f98565b505b600061246a86600001518760600151612c0e565b90504667ffffffffffffffff16866020015167ffffffffffffffff16036124e5577f0e248ac8be20725176a5f0ab093c5fbb964634d4675012f3d3ad66e69e56d5b781888b858c6040516124c2959493929190614fa8565b60405180910390a16124de888388600001518960e001516119cb565b50506124f7565b6124f4818a8a89888c88612c46565b50505b50505050505050565b6119c58363a9059cbb60e01b8484604051602401612277929190614dd5565b60095460ff166107b95760405162461bcd60e51b815260040161072f9061501e565b60606000825167ffffffffffffffff81111561255f5761255f61344d565b604051908082528060200260200182016040528015612588578160200160208202803683370190505b50905060005b83518110156126795760008482815181106125ab576125ab614104565b6020026020010151602001516125c090614b46565b6001600160e01b0319811660009081526002602052604090205484519192506001600160a01b0316908490849081106125fb576125fb614104565b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b031683838151811061263857612638614104565b60200260200101516001600160a01b0316036126665760405162461bcd60e51b815260040161072f90615062565b508061267181614191565b91505061258e565b5092915050565b60606000806000865167ffffffffffffffff8111156126a1576126a161344d565b6040519080825280602002602001820160405280156126ca578160200160208202803683370190505b50935060005b87518110156127be5760008682815181106126ed576126ed614104565b60200260200101516001600160a01b031663358f0e1c8a848151811061271557612715614104565b60200260200101516040518263ffffffff1660e01b81526004016127399190614bfb565b606060405180830381865afa158015612756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061277a9190614c0c565b9096509450905061278b8184614cda565b9250808683815181106127a0576127a0614104565b602090810291909101015250806127b681614191565b9150506126d0565b5060005b845181101561282a57818582815181106127de576127de614104565b6020026020010151886127f19190615072565b6127fb91906150a7565b85828151811061280d5761280d614104565b60209081029190910101528061282281614191565b9150506127c2565b505093509350939050565b600061288a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612dc69092919063ffffffff16565b8051909150156119c557808060200190518101906128a891906150bb565b6119c55760405162461bcd60e51b815260040161072f90615136565b60008060005b8451811015612c055760008060008684815181106128ea576128ea614104565b60200260200101516001600160a01b031663358f0e1c89868151811061291257612912614104565b60200260200101516040518263ffffffff1660e01b81526004016129369190614bfb565b606060405180830381865afa158015612953573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129779190614c0c565b925092509250600087858151811061299157612991614104565b60200260200101516001600160a01b0316634c6da2698a87815181106129b9576129b9614104565b60200260200101516020015186306040518463ffffffff1660e01b81526004016129e593929190614cf2565b600060405180830381865afa158015612a02573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a2a919081019061401b565b9050612a5e898681518110612a4157612a41614104565b6020908102919091010151516001600160a01b03851690866121da565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190612a8d9030906004016133ed565b602060405180830381865afa158015612aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ace91906147fa565b9050898681518110612ae257612ae2614104565b6020026020010151600001516001600160a01b031682604051612b059190614d41565b6000604051808303816000865af19150503d8060008114612b42576040519150601f19603f3d011682016040523d82523d6000602084013e612b47565b606091505b50508098505087612b645760008097509750505050505050612c07565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612b939030906004016133ed565b602060405180830381865afa158015612bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd491906147fa565b9050612be08282613d60565b612bea9089614cda565b97505050505050508080612bfd90614191565b9150506128ca565b505b9250929050565b600033834684604051602001612c27949392919061518d565b6040516020818303038152906040528051906020012090505b92915050565b60008084511180612c5d57506000856101e0015151115b612c68578451612c6e565b84604001515b90506060612c7d86858a612ddf565b60c0860151349015612c9657612c938534613d60565b90505b608087015180516020918201206000908152600890915260409020546001600160a01b0390811690612ccb908a1682876121da565b6000612cd88c8a8a612e69565b9050816001600160a01b031663834bc3ea848b60200151888a8f8f60a00151886040518863ffffffff1660e01b8152600401612d1996959493929190613fb4565b60006040518083038185885af1158015612d37573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612d60919081019061401b565b93505050507f082e2f634ceec1af5105aa53f234b7efad94428a54a714e3b7c7115ee549308089828860200151878c8b6101a00151888e8b8f60800151604051612db39a999897969594939291906151d5565b60405180910390a1505050505050505050565b6060612dd58484600085612eea565b90505b9392505050565b60004684602001518484876101200151886101000151604051602001612e0a96959493929190615277565b6040516020818303038152906040528051906020012090506000612e2d82612fac565b9050612e3e81866101400151612fdc565b4285610120015111612e625760405162461bcd60e51b815260040161072f9061533b565b5050505050565b60606040518060e0016040528085815260200183815260200184600001516001600160a01b031681526020018460e00151151581526020018461010001518152602001846101c0015115158152602001846101e00151815250604051602001612ed29190614ee7565b60405160208183030381529060405290509392505050565b606082471015612f0c5760405162461bcd60e51b815260040161072f906153a5565b6001600160a01b0385163b612f335760405162461bcd60e51b815260040161072f906153e9565b600080866001600160a01b03168587604051612f4f9190614d41565b60006040518083038185875af1925050503d8060008114612f8c576040519150601f19603f3d011682016040523d82523d6000602084013e612f91565b606091505b5091509150612fa1828286613018565b979650505050505050565b600081604051602001612fbf91906153f9565b604051602081830303815290604052805190602001209050919050565b6000612fe88383613051565b6005549091506001600160a01b038083169116146119c55760405162461bcd60e51b815260040161072f90615468565b60608315613027575081612dd8565b8251156130375782518084602001fd5b8160405162461bcd60e51b815260040161072f9190615478565b60008060006130608585613075565b9150915061306d816130b7565b509392505050565b60008082516041036130ab5760208301516040840151606085015160001a61309f87828585613197565b94509450505050612c07565b50600090506002612c07565b60008160048111156130cb576130cb613387565b036130d35750565b60018160048111156130e7576130e7613387565b036131045760405162461bcd60e51b815260040161072f906154bd565b600281600481111561311857613118613387565b036131355760405162461bcd60e51b815260040161072f90615501565b600381600481111561314957613149613387565b036131665760405162461bcd60e51b815260040161072f90615550565b600481600481111561317a5761317a613387565b036109f05760405162461bcd60e51b815260040161072f9061559f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131ce575060009050600361326e565b8460ff16601b141580156131e657508460ff16601c14155b156131f7575060009050600461326e565b60006001878787876040516000815260200160405260405161321c94939291906155b8565b6020604051602081039080840390855afa15801561323e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166132675760006001925092505061326e565b9150600090505b94509492505050565b60006001600160a01b038216612c40565b61329181613277565b81146109f057600080fd5b8035612c4081613288565b80613291565b8035612c40816132a7565b60008083601f8401126132cd576132cd600080fd5b50813567ffffffffffffffff8111156132e8576132e8600080fd5b602083019150836001820283011115612c0757612c07600080fd5b60008060008060006080868803121561331e5761331e600080fd5b600061332a888861329c565b955050602061333b888289016132ad565b945050604086013567ffffffffffffffff81111561335b5761335b600080fd5b613367888289016132b8565b9350935050606061337a8882890161329c565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600381106109f0576109f0613387565b806133b78161339d565b919050565b6000612c40826133ad565b6133d0816133bc565b82525050565b60208101612c4082846133c7565b6133d081613277565b60208101612c4082846133e4565b60006020828403121561341057613410600080fd5b60006117c8848461329c565b8015156133d0565b60208101612c40828461341c565b67ffffffffffffffff8116613291565b8035612c4081613432565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156134895761348961344d565b6040525050565b600061349b60405190565b90506133b78282613463565b600067ffffffffffffffff8211156134c1576134c161344d565b601f19601f83011660200192915050565b82818337506000910152565b60006134f16134ec846134a7565b613490565b90508281526020810184848401111561350c5761350c600080fd5b61306d8482856134d2565b600082601f83011261352b5761352b600080fd5b81356117c88482602086016134de565b60008060008060008060c0878903121561355757613557600080fd5b6000613563898961329c565b965050602061357489828a0161329c565b955050604061358589828a016132ad565b945050606061359689828a01613442565b935050608087013567ffffffffffffffff8111156135b6576135b6600080fd5b6135c289828a01613517565b92505060a06135d389828a0161329c565b9150509295509295509295565b6001600160e01b03198116613291565b8035612c40816135e0565b801515613291565b8035612c40816135fb565b60008060006060848603121561362657613626600080fd5b6000613632868661329c565b9350506020613643868287016135f0565b925050604061365486828701613603565b9150509250925092565b60006020828403121561367357613673600080fd5b60006117c884846132ad565b60008083601f84011261369457613694600080fd5b50813567ffffffffffffffff8111156136af576136af600080fd5b602083019150836020820283011115612c0757612c07600080fd5b600080600080604085870312156136e3576136e3600080fd5b843567ffffffffffffffff8111156136fd576136fd600080fd5b6137098782880161367f565b9450945050602085013567ffffffffffffffff81111561372b5761372b600080fd5b6137378782880161367f565b95989497509550505050565b6000806040838503121561375957613759600080fd5b6000613765858561329c565b9250506020613776858286016135f0565b9150509250929050565b60008060008060006080868803121561379b5761379b600080fd5b60006137a7888861329c565b955050602061333b88828901613442565b600061020082840312156137ce576137ce600080fd5b50919050565b6000806000806000606086880312156137ef576137ef600080fd5b853567ffffffffffffffff81111561380957613809600080fd5b613815888289016137b8565b955050602086013567ffffffffffffffff81111561383557613835600080fd5b6138418882890161367f565b9450945050604086013567ffffffffffffffff81111561386357613863600080fd5b61386f8882890161367f565b92509250509295509295909350565b806133d0565b60208101612c40828461387e565b6000806000604084860312156138aa576138aa600080fd5b833567ffffffffffffffff8111156138c4576138c4600080fd5b6138d0868287016132b8565b935093505060206136548682870161329c565b6000612c406001600160a01b0383166138fa565b90565b6001600160a01b031690565b6000612c40826138e3565b6000612c4082613906565b6133d081613911565b60208101612c40828461391c565b60008060006040848603121561394b5761394b600080fd5b833567ffffffffffffffff81111561396557613965600080fd5b6138d08682870161367f565b60006020828403121561398657613986600080fd5b60006117c884846135f0565b601981526000602082017f63616c6c6572206973206e6f74206d6573736167652062757300000000000000815291505b5060200190565b60208082528101612c4081613992565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291506139c2565b60208082528101612c40816139d9565b601481526000602082017f43616c6c6572206973206e6f7420706175736572000000000000000000000000815291506139c2565b60208082528101612c4081613a1d565b8051612c40816132a7565b600067ffffffffffffffff821115613a8657613a8661344d565b5060209081020190565b8051612c4081613288565b60005b83811015613ab6578181015183820152602001613a9e565b838111156116685750506000910152565b6000613ad56134ec846134a7565b905082815260208101848484011115613af057613af0600080fd5b61306d848285613a9b565b600082601f830112613b0f57613b0f600080fd5b81516117c8848260208601613ac7565b600060408284031215613b3457613b34600080fd5b613b3e6040613490565b90506000613b4c8484613a90565b825250602082015167ffffffffffffffff811115613b6c57613b6c600080fd5b613b7884828501613afb565b60208301525092915050565b6000613b926134ec84613a6c565b83815290506020808201908402830185811115613bb157613bb1600080fd5b835b81811015613bf257805167ffffffffffffffff811115613bd557613bd5600080fd5b808601613be28982613b1f565b8552505060209283019201613bb3565b5050509392505050565b600082601f830112613c1057613c10600080fd5b81516117c8848260208601613b84565b8051612c40816135fb565b600060e08284031215613c4057613c40600080fd5b613c4a60e0613490565b90506000613c588484613a61565b825250602082015167ffffffffffffffff811115613c7857613c78600080fd5b613c8484828501613bfc565b6020830152506040613c9884828501613a90565b6040830152506060613cac84828501613c20565b6060830152506080613cc084828501613a61565b60808301525060a0613cd484828501613c20565b60a08301525060c082015167ffffffffffffffff811115613cf757613cf7600080fd5b613d0384828501613afb565b60c08301525092915050565b600060208284031215613d2457613d24600080fd5b815167ffffffffffffffff811115613d3e57613d3e600080fd5b6117c884828501613c2b565b634e487b7160e01b600052601160045260246000fd5b600082821015613d7257613d72613d4a565b500390565b6000612c406138f78381565b6133d081613d77565b6000613d96825190565b808452602084019350613dad818560208601613a9b565b601f19601f8201165b9093019392505050565b60e08101613dce828a61387e565b613ddb6020830189613d83565b613de8604083018861387e565b613df560608301876133e4565b613e02608083018661387e565b613e0f60a08301856133c7565b81810360c0830152613e218184613d8c565b9998505050505050505050565b6001600160e01b031981166133d0565b60608101613e4c82866133e4565b613e596020830185613e2e565b6117c8604083018461341c565b60408101613e7482856133e4565b612dd860208301846133e4565b60e08101613e8f828a61387e565b613e9c6020830189613d83565b613de86040830188613d83565b600781526000602082017f746b696e206d6d00000000000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081613ea9565b8051612c4081613432565b600060408284031215613f0d57613f0d600080fd5b613f176040613490565b90506000613b4c8484613eed565b600060208284031215613f3a57613f3a600080fd5b815167ffffffffffffffff811115613f5457613f54600080fd5b6117c884828501613ef8565b600f81526000602082017f63627269646765206e6f74207365740000000000000000000000000000000000815291506139c2565b60208082528101612c4081613f60565b67ffffffffffffffff81166133d0565b60c08101613fc28289613fa4565b613fcf60208301886133e4565b613fdc604083018761387e565b613fe960608301866133e4565b8181036080830152613ffb8185613d8c565b905081810360a083015261400f8184613d8c565b98975050505050505050565b60006020828403121561403057614030600080fd5b815167ffffffffffffffff81111561404a5761404a600080fd5b6117c884828501613afb565b6000612c40826138f7565b600981526000602082017f73656e64206661696c0000000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614061565b60e081016140b3828a61387e565b613ddb602083018961387e565b601481526000602082017f706172616d732073697a65206d69736d61746368000000000000000000000000815291506139c2565b60208082528101612c40816140c0565b634e487b7160e01b600052603260045260246000fd5b6000808335601e193685900301811261413557614135600080fd5b80840192508235915067ffffffffffffffff82111561415657614156600080fd5b602083019250600182023603831315612c0557612c05600080fd5b600061417e8385846134d2565b50500190565b60006117c8828486614171565b600060001982036141a4576141a4613d4a565b5060010190565b81835260006020840193506141c18385846134d2565b601f19601f840116613db6565b6000612dd58484846141ab565b6000808335601e19368590030181126141f6576141f6600080fd5b83810160208101935035915067ffffffffffffffff82111561421a5761421a600080fd5b36829003831315612c0557612c05600080fd5b818352600060208401935083602084028101838060005b8781101561427f57848403895261425b82846141db565b6142668682846141ce565b95506020840160209b909b019a93505050600101614244565b5091979650505050505050565b600061429883836133e4565b505060200190565b6000612dd8602084018461329c565b8183526000602084019350818060005b858110156142ec576142d182846142a0565b6142db888261428c565b9750602083019250506001016142bf565b509495945050505050565b6040808252810161430981868861422d565b9050818103602083015261431e8184866142af565b9695505050505050565b60006020828403121561433d5761433d600080fd5b60006117c88484613442565b600381526000602082016206e6f760ec1b815291506139c2565b60208082528101612c4081614349565b601b81526000602082017f62726964676520646f6573206e6f7420737570706f7274206d73670000000000815291506139c2565b60208082528101612c4081614373565b601281526000602082017f756e737570706f72746564206272696467650000000000000000000000000000815291506139c2565b60208082528101612c40816143b7565b60006040828403121561441057614410600080fd5b61441a6040613490565b90506000614428848461329c565b825250602082013567ffffffffffffffff81111561444857614448600080fd5b613b7884828501613517565b60006144626134ec84613a6c565b8381529050602080820190840283018581111561448157614481600080fd5b835b81811015613bf257803567ffffffffffffffff8111156144a5576144a5600080fd5b8086016144b289826143fb565b8552505060209283019201614483565b6000612dd8368484614454565b6000602082840312156144e4576144e4600080fd5b60006117c88484613603565b601281526000602082017f746b696e206e6f206e6174697665577261700000000000000000000000000000815291506139c2565b60208082528101612c40816144f0565b600b81526000602082017f696e7366636e7420616d74000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614534565b6000610200828403121561458e5761458e600080fd5b614599610200613490565b905060006145a7848461329c565b82525060206145b884848301613442565b60208301525060406145cc8482850161329c565b60408301525060606145e084828501613442565b606083015250608082013567ffffffffffffffff81111561460357614603600080fd5b61460f84828501613517565b60808301525060a082013567ffffffffffffffff81111561463257614632600080fd5b61463e84828501613517565b60a08301525060c061465284828501613603565b60c08301525060e061466684828501613603565b60e08301525061010061467b848285016132ad565b61010083015250610120614691848285016132ad565b6101208301525061014082013567ffffffffffffffff8111156146b6576146b6600080fd5b6146c284828501613517565b610140830152506101606146d8848285016132ad565b610160830152506101806146ee8482850161329c565b610180830152506101a06147048482850161329c565b6101a0830152506101c061471a84828501613603565b6101c0830152506101e082013567ffffffffffffffff81111561473f5761473f600080fd5b61474b84828501613517565b6101e08301525092915050565b6000612c403683614578565b60408101613e748285613e2e565b601181526000602082017f6e6f742066656520636f6c6c6563746f72000000000000000000000000000000815291506139c2565b60208082528101612c4081614772565b601281526000602082017f73656e64206e6174697665206661696c65640000000000000000000000000000815291506139c2565b60208082528101612c40816147b6565b60006020828403121561480f5761480f600080fd5b60006117c88484613a61565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015291505b5060400190565b60208082528101612c408161481b565b601881526000602082017f6e6f206e6174697665207472616e7366657272656420696e0000000000000000815291506139c2565b60208082528101612c4081614888565b601081526000602082017f5061757361626c653a2070617573656400000000000000000000000000000000815291506139c2565b60208082528101612c40816148cc565b600082601f83011261492457614924600080fd5b81356117c8848260208601614454565b600060e0828403121561494957614949600080fd5b61495360e0613490565b9050600061496184846132ad565b825250602082013567ffffffffffffffff81111561498157614981600080fd5b61498d84828501614910565b60208301525060406149a18482850161329c565b60408301525060606149b584828501613603565b60608301525060806149c9848285016132ad565b60808301525060a06149dd84828501613603565b60a08301525060c082013567ffffffffffffffff811115614a0057614a00600080fd5b613d0384828501613517565b600060208284031215614a2157614a21600080fd5b813567ffffffffffffffff811115614a3b57614a3b600080fd5b6117c884828501614934565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260006139c2565b60208082528101612c4081614a47565b600060208284031215614a9e57614a9e600080fd5b60006117c88484613a90565b600c81526000602082017f746b206e6f206e61746976650000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614aaa565b601581526000602082017f4163636f756e74206973206e6f74207061757365720000000000000000000000815291506139c2565b60208082528101612c4081614aee565b6000612c4082516001600160e01b03191690565b6000614b50825190565b60208301614b5d81614b32565b92506004821015614b8457614b7f6001600160e01b0319836004036008021b90565b831692505b5050919050565b600f81526000602082017f756e737570706f72746564206465780000000000000000000000000000000000815291506139c2565b60208082528101612c4081614b8b565b80516000906040840190614be385826133e4565b50602083015184820360208601526110148282613d8c565b60208082528101612dd88184614bcf565b600080600060608486031215614c2457614c24600080fd5b6000614c308686613a61565b9350506020614c4186828701613a90565b925050604061365486828701613a90565b600d81526000602082017f746b696e206d69736d6174636800000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614c52565b600c81526000602082017f746b6f206d69736d617463680000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614c96565b60008219821115614ced57614ced613d4a565b500190565b60608082528101614d038186613d8c565b9050614d12602083018561387e565b6117c860408301846133e4565b6000614d29825190565b614d37818560208601613a9b565b9290920192915050565b6000612dd88284614d1f565b600b81526000602082017f73776170206661696c6564000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614d4d565b601081526000602082017f616c6c207377617073206661696c656400000000000000000000000000000000815291506139c2565b60208082528101612c4081614d91565b60408101614de382856133e4565b612dd8602083018461387e565b6000612dd88383614bcf565b6000614e06825190565b80845260208401935083602082028501614e208560200190565b8060005b8581101561427f5784840389528151614e3d8582614df0565b94506020830160209a909a0199925050600101614e24565b805160009060e0840190614e69858261387e565b5060208301518482036020860152614e818282614dfc565b9150506040830151614e9660408601826133e4565b506060830151614ea9606086018261341c565b506080830151614ebc608086018261387e565b5060a0830151614ecf60a086018261341c565b5060c083015184820360c08601526110148282613d8c565b60208082528101612dd88184614e55565b601981526000602082017f4163636f756e7420697320616c72656164792070617573657200000000000000815291506139c2565b60208082528101612c4081614ef8565b60608101614f4a82866133e4565b614f5760208301856133e4565b6117c8604083018461387e565b600981526000602082017f73776170206661696c0000000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614f64565b60a08101614fb6828861387e565b614fc3602083018761387e565b614fd060408301866133e4565b614fdd606083018561387e565b61431e60808301846133e4565b601481526000602082017f5061757361626c653a206e6f7420706175736564000000000000000000000000815291506139c2565b60208082528101612c4081614fea565b600c81526000602082017f636463206e6f20666f756e640000000000000000000000000000000000000000815291506139c2565b60208082528101612c408161502e565b600081600019048311821515161561508c5761508c613d4a565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826150b6576150b6615091565b500490565b6000602082840312156150d0576150d0600080fd5b60006117c88484613c20565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f7420737563636565640000000000000000000000000000000000000000000060208201529150614871565b60208082528101612c40816150dc565b6000612c408260601b90565b6000612c4082615146565b6133d061516982613277565b615152565b6000612c408260c01b90565b6133d067ffffffffffffffff821661516e565b6000615199828761515d565b6014820191506151a9828661515d565b6014820191506151b9828561517a565b6008820191506151c9828461517a565b50600801949350505050565b61014081016151e4828d61387e565b81810360208301526151f6818c613d8c565b9050615205604083018b613fa4565b615212606083018a61387e565b61521f60808301896133e4565b61522c60a08301886133e4565b61523960c08301876133e4565b61524660e08301866133e4565b61525461010083018561387e565b8181036101208301526152678184613d8c565b9c9b505050505050505050505050565b7f6578656375746f722066656500000000000000000000000000000000000000008152600c0160006152a9828961517a565b6008820191506152b9828861517a565b6008820191506152c9828761387e565b6020820191506152d9828661515d565b6014820191506152e9828561387e565b6020820191506152f9828461387e565b506020019695505050505050565b601181526000602082017f646561646c696e65206578636565646564000000000000000000000000000000815291506139c2565b60208082528101612c4081615307565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f81527f722063616c6c000000000000000000000000000000000000000000000000000060208201529150614871565b60208082528101612c408161534b565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815291506139c2565b60208082528101612c40816153b5565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c01600061542b828461387e565b50602001919050565b600e81526000602082017f696e76616c6964207369676e6572000000000000000000000000000000000000815291506139c2565b60208082528101612c4081615434565b60208082528101612dd88184613d8c565b601881526000602082017f45434453413a20696e76616c6964207369676e61747572650000000000000000815291506139c2565b60208082528101612c4081615489565b601f81526000602082017f45434453413a20696e76616c6964207369676e6174757265206c656e67746800815291506139c2565b60208082528101612c40816154cd565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202773272076616c815261756560f01b60208201529150614871565b60208082528101612c4081615511565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202776272076616c815261756560f01b60208201529150614871565b60208082528101612c4081615560565b60ff81166133d0565b608081016155c6828761387e565b6155d360208301866155af565b6155e0604083018561387e565b611014606083018461387e56fea26469706673582212208e065e420a4604dbe5b18c5c270273ff9d8c10203999b426a97d2593dc2d493e64736f6c634300080f00330000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d000000000000000000000000420000000000000000000000000000000000000600000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e74323536292900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d66696c6c4f72646572524651282875696e743235362c616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e74323536292c62797465732c75696e743235362c75696e743235362900000000000000000000000000000000000000000000000000000000000000000000050000000000000000000000009780f24a4696c59fe935f33dd307884b1f05a56d000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd199000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e7432353629290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000537377617028616464726573732c28616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e743235362c75696e743235362c6279746573292c62797465732900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d66696c6c4f72646572524651282875696e743235362c616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e74323536292c62797465732c75696e743235362c75696e7432353629000000

Deployed Bytecode

0x6080604052600436106102385760003560e01c806382dc1ec411610138578063c0404998116100b0578063eeaaa6511161007f578063f2fde38b11610064578063f2fde38b14610688578063fb453787146106a8578063fbf5d763146106bb57600080fd5b8063eeaaa65114610625578063efcfd8f51461066857600080fd5b8063c040499814610583578063c415b95c146105c4578063c5bccca3146105e4578063cd9ea3421461060457600080fd5b806391ec04b511610107578063a1a227fa116100ec578063a1a227fa14610530578063a42dce8014610550578063a6131ca01461057057600080fd5b806391ec04b5146104e25780639c649fdf1461051d57600080fd5b806382dc1ec41461046f5780638456cb591461048f5780638da5cb5b146104a4578063918ead76146104c257600080fd5b80635c975abb116101cb5780636ef8d66d1161019a5780637cd2bffc1161017f5780637cd2bffc1461040c57806380f51c121461041f57806382665a8f1461044f57600080fd5b80636ef8d66d146103e2578063715018a6146103f757600080fd5b80635c975abb1461036a578063675df759146103825780636b2c0f55146103a25780636c19e783146103c257600080fd5b806346fbf68e1161020757806346fbf68e146102d1578063547cad12146103175780635ab7afc6146103375780635b5a66a71461034a57600080fd5b80630bcb498214610244578063238ac9331461026d5780633f4ba83a1461029a578063457bfa2f146102b157600080fd5b3661023f57005b600080fd5b610257610252366004613303565b6106f1565b60405161026491906133d6565b60405180910390f35b34801561027957600080fd5b5060055461028d906001600160a01b031681565b60405161026491906133ed565b3480156102a657600080fd5b506102af610782565b005b3480156102bd57600080fd5b50600b5461028d906001600160a01b031681565b3480156102dd57600080fd5b5061030a6102ec3660046133fb565b6001600160a01b03166000908152600a602052604090205460ff1690565b6040516102649190613424565b34801561032357600080fd5b506102af6103323660046133fb565b6107bb565b61025761034536600461353b565b61081a565b34801561035657600080fd5b506102af6103653660046133fb565b610939565b34801561037657600080fd5b5060095460ff1661030a565b34801561038e57600080fd5b506102af61039d36600461360e565b61098c565b3480156103ae57600080fd5b506102af6103bd3660046133fb565b6109df565b3480156103ce57600080fd5b506102af6103dd3660046133fb565b6109f3565b3480156103ee57600080fd5b506102af610a5a565b34801561040357600080fd5b506102af610a63565b61025761041a36600461353b565b610a75565b34801561042b57600080fd5b5061030a61043a3660046133fb565b600a6020526000908152604090205460ff1681565b34801561045b57600080fd5b5061028d61046a36600461365e565b610e44565b34801561047b57600080fd5b506102af61048a3660046133fb565b610e6e565b34801561049b57600080fd5b506102af610e7f565b3480156104b057600080fd5b506000546001600160a01b031661028d565b3480156104ce57600080fd5b506102af6104dd3660046136ca565b610eb6565b3480156104ee57600080fd5b5061030a6104fd366004613743565b600460209081526000928352604080842090915290825290205460ff1681565b61025761052b366004613780565b610fd6565b34801561053c57600080fd5b5060015461028d906001600160a01b031681565b34801561055c57600080fd5b506102af61056b3660046133fb565b61101d565b6102af61057e3660046137d4565b611078565b34801561058f57600080fd5b506105b77f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81565b6040516102649190613884565b3480156105d057600080fd5b5060065461028d906001600160a01b031681565b3480156105f057600080fd5b506102af6105ff366004613892565b6113bc565b34801561061057600080fd5b5060015461030a90600160a01b900460ff1681565b34801561063157600080fd5b5061065b61064036600461365e565b6008602052600090815260409020546001600160a01b031681565b6040516102649190613925565b34801561067457600080fd5b506102af610683366004613933565b611488565b34801561069457600080fd5b506102af6106a33660046133fb565b61166e565b6102576106b6366004613303565b6116a5565b3480156106c757600080fd5b5061065b6106d6366004613971565b6002602052600090815260409020546001600160a01b031681565b600154600090600160a01b900460ff16610738576001546001600160a01b031633146107385760405162461bcd60e51b815260040161072f906139c9565b60405180910390fd5b60026007540361075a5760405162461bcd60e51b815260040161072f90613a0d565b600260075561076761171d565b61077386868686611740565b60016007559695505050505050565b336000908152600a602052604090205460ff166107b15760405162461bcd60e51b815260040161072f90613a51565b6107b96117d0565b565b6107c361181c565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e9161080f916133ed565b60405180910390a150565b600154600090600160a01b900460ff16610858576001546001600160a01b031633146108585760405162461bcd60e51b815260040161072f906139c9565b60026007540361087a5760405162461bcd60e51b815260040161072f90613a0d565b600260075561088761171d565b60008380602001905181019061089d9190613d0f565b90506108a98787611846565b60008160800151876108bb9190613d60565b90506108ce8882846040015160006119cb565b8151608083015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c39461091c9490939287928f9291600291613dc0565b60405180910390a160019250505060016007559695505050505050565b61094161181c565b600b80546001600160a01b0319166001600160a01b0383161790556040517fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d9061080f9083906133ed565b61099461181c565b61099f838383611afb565b7f5e20184b00709d9f103306958e9fb9d509f78bec1829ca7080f2c43eb2ff21a88383836040516109d293929190613e3e565b60405180910390a1505050565b6109e761181c565b6109f081611b91565b50565b6109fb61181c565b600580546001600160a01b038381166001600160a01b03198316179092556040519116907f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb90610a4e9083908590613e66565b60405180910390a15050565b6107b933611b91565b610a6b61181c565b6107b96000611c19565b600154600090600160a01b900460ff16610ab3576001546001600160a01b03163314610ab35760405162461bcd60e51b815260040161072f906139c9565b600260075403610ad55760405162461bcd60e51b815260040161072f90613a0d565b6002600755610ae261171d565b600083806020019051810190610af89190613d0f565b90508060800151861015610b6a5760808101869052805160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c393610b58939092909182918d918d91600191613e81565b60405180910390a16001915050610773565b6080810151610b799087613d60565b95508560006060610b8a8a84611846565b6020840151518a9015610c0e5760606000610ba88760200151611c69565b90955093509150506001600160a01b03808216908e1614610bdb5760405162461bcd60e51b815260040161072f90613edd565b610bef8760200151838e8a60a00151611e97565b90965094508415610c0b57610c0b8d86896040015160006119cb565b50505b60c08501515115610d485760008560c00151806020019051810190610c339190613f25565b7f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f6000908152600860205260409020549091506001600160a01b031680610c8c5760405162461bcd60e51b815260040161072f90613f94565b610ca06001600160a01b03841682886121da565b6000610cb4886000015189604001516122c3565b83516040808b0151602087015191516341a5e1f560e11b81529394506001600160a01b0386169363834bc3ea933493610cf79391928e918c918a90600401613fb4565b60006040518083038185885af1158015610d15573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610d3e919081019061401b565b9450505050610de0565b3415610dcc576000876001600160a01b031634604051610d6790614056565b60006040518083038185875af1925050503d8060008114610da4576040519150601f19603f3d011682016040523d82523d6000602084013e610da9565b606091505b5050905080610dca5760405162461bcd60e51b815260040161072f90614095565b505b610de08185876040015188606001516119cb565b507ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3846000015184848d8860800151600187604051610e2597969594939291906140a5565b60405180910390a1600194505050505060016007559695505050505050565b60038181548110610e5457600080fd5b6000918252602090912001546001600160a01b0316905081565b610e7661181c565b6109f081612334565b336000908152600a602052604090205460ff16610eae5760405162461bcd60e51b815260040161072f90613a51565b6107b96123c0565b610ebe61181c565b828114610edd5760405162461bcd60e51b815260040161072f906140f4565b60005b83811015610f9257828282818110610efa57610efa614104565b9050602002016020810190610f0f91906133fb565b60086000878785818110610f2557610f25614104565b9050602002810190610f37919061411a565b604051610f45929190614184565b6040518091039020815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610f8a90614191565b915050610ee0565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9684848484604051610fc894939291906142f7565b60405180910390a150505050565b600154600090600160a01b900460ff16611014576001546001600160a01b031633146110145760405162461bcd60e51b815260040161072f906139c9565b95945050505050565b61102561181c565b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f3890610a4e9083908590613e66565b60026007540361109a5760405162461bcd60e51b815260040161072f90613a0d565b60026007556110a761171d565b821515806110d8575067ffffffffffffffff46166110cb6040870160208801614328565b67ffffffffffffffff1614155b6110f45760405162461bcd60e51b815260040161072f90614363565b8215158061112c57506101608501351580159061112c575060006111206101a0870161018088016133fb565b6001600160a01b031614155b6111485760405162461bcd60e51b815260040161072f90614363565b6000611157608087018761411a565b604051611165929190614184565b60405190819003902090508115801561118b57506111876101e087018761411a565b1590505b806111b557507f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81145b6111d15760405162461bcd60e51b815260040161072f906143a7565b600081815260086020908152604091829020546001600160a01b03169167ffffffffffffffff461691611208918a01908a01614328565b67ffffffffffffffff16148061122657506001600160a01b03811615155b6112425760405162461bcd60e51b815260040161072f906143eb565b6101608701356060600061125e6101a08b016101808c016133fb565b905060006112746101a08c016101808d016133fb565b905088156112995761128e6112898a8c6144c2565b611c69565b929650919450925090505b6112a960e08c0160c08d016144cf565b1561136957600b546001600160a01b038381169116146112db5760405162461bcd60e51b815260040161072f90614524565b833410156112fb5760405162461bcd60e51b815260040161072f90614568565b600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b15801561134b57600080fd5b505af115801561135f573d6000803e3d6000fd5b505050505061137e565b61137e6001600160a01b0383163330876123fd565b6113aa82828661138d8f614758565b8e8e9061139a91906144c2565b6113a48d8f6144c2565b8961241e565b50506001600755505050505050505050565b6113c461181c565b600083836040516113d6929190614184565b6040518091039020905061145781836001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b7f58ddcdb40971f55ad1b6a8a28067274a4ffc7e9d77c3ea14a17652faa705e1978183604051610fc8929190614764565b6006546001600160a01b031633146114b25760405162461bcd60e51b815260040161072f906147a6565b60005b828110156116685760008484838181106114d1576114d1614104565b90506020020160208101906114e691906133fb565b6001600160a01b0316036115815760004790506000836001600160a01b03168261c3509060405161151690614056565b600060405180830381858888f193505050503d8060008114611554576040519150601f19603f3d011682016040523d82523d6000602084013e611559565b606091505b505090508061157a5760405162461bcd60e51b815260040161072f906147ea565b5050611656565b600084848381811061159557611595614104565b90506020020160208101906115aa91906133fb565b6001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016115d591906133ed565b602060405180830381865afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161691906147fa565b9050611654838287878681811061162f5761162f614104565b905060200201602081019061164491906133fb565b6001600160a01b03169190612500565b505b8061166081614191565b9150506114b5565b50505050565b61167661181c565b6001600160a01b03811661169c5760405162461bcd60e51b815260040161072f90614878565b6109f081611c19565b60006002600754036116c95760405162461bcd60e51b815260040161072f90613a0d565b6002600755600b546001600160a01b038781169116146116fd576116f86001600160a01b0387163330886123fd565b610767565b843410156107675760405162461bcd60e51b815260040161072f906148bc565b60095460ff16156107b95760405162461bcd60e51b815260040161072f90614900565b60008061174f83850185614a0c565b905061175b8686611846565b61176c8686836040015160006119cb565b8051608082015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3946117ba949093928b928d9291600291613dc0565b60405180910390a160019150505b949350505050565b6117d861251f565b6009805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161181291906133ed565b60405180910390a1565b6000546001600160a01b031633146107b95760405162461bcd60e51b815260040161072f90614a79565b600b546001600160a01b03908116908316036119c757600154604080516320a6037160e21b815290516000926001600160a01b0316916382980dc49160048083019260209291908290030181865afa1580156118a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ca9190614a89565b9050600b60009054906101000a90046001600160a01b03166001600160a01b0316816001600160a01b031663457bfa2f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611929573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061194d9190614a89565b6001600160a01b0316036119c557600b60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b1580156119ab57600080fd5b505af11580156119bf573d6000803e3d6000fd5b50505050505b505b5050565b8015611ae757600b546001600160a01b038581169116146119fe5760405162461bcd60e51b815260040161072f90614ade565b600b54604051632e1a7d4d60e01b81526001600160a01b0390911690632e1a7d4d90611a2e908690600401613884565b600060405180830381600087803b158015611a4857600080fd5b505af1158015611a5c573d6000803e3d6000fd5b505050506000826001600160a01b03168461c35090604051611a7d90614056565b600060405180830381858888f193505050503d8060008114611abb576040519150601f19603f3d011682016040523d82523d6000602084013e611ac0565b606091505b5050905080611ae15760405162461bcd60e51b815260040161072f90614095565b50611668565b6116686001600160a01b0385168385612500565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff1681151581151503611b4f5760405162461bcd60e51b815260040161072f90614363565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b6001600160a01b0381166000908152600a602052604090205460ff16611bc95760405162461bcd60e51b815260040161072f90614b22565b6001600160a01b0381166000908152600a602052604090819020805460ff19169055517fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e9061080f9083906133ed565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006060600080611c7c87612541565b925060005b8751811015611e8d5760046000898381518110611ca057611ca0614104565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000206000898381518110611ce057611ce0614104565b602002602001015160200151611cf590614b46565b6001600160e01b031916815260208101919091526040016000205460ff16611d2f5760405162461bcd60e51b815260040161072f90614bbf565b6000806000868481518110611d4657611d46614104565b60200260200101516001600160a01b031663358f0e1c8c8681518110611d6e57611d6e614104565b60200260200101516040518263ffffffff1660e01b8152600401611d929190614bfb565b606060405180830381865afa158015611daf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd39190614c0c565b919450925090506001600160a01b0386161580611e015750816001600160a01b0316866001600160a01b0316145b611e1d5760405162461bcd60e51b815260040161072f90614c86565b90945084906001600160a01b0385161580611e495750806001600160a01b0316856001600160a01b0316145b611e655760405162461bcd60e51b815260040161072f90614cca565b935083611e72838b614cda565b99509097509550819050611e8581614191565b915050611c81565b5050509193509193565b6000806000806000611eaa89888a612680565b9250925092506000816001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611ede91906133ed565b602060405180830381865afa158015611efb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1f91906147fa565b905060005b8a5181101561212d5760008a8281518110611f4157611f41614104565b60200260200101516001600160a01b0316634c6da2698d8481518110611f6957611f69614104565b602002602001015160200151888581518110611f8757611f87614104565b6020026020010151306040518463ffffffff1660e01b8152600401611fae93929190614cf2565b600060405180830381865afa158015611fcb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ff3919081019061401b565b90506120498c838151811061200a5761200a614104565b60200260200101516000015187848151811061202857612028614104565b6020026020010151876001600160a01b03166121da9092919063ffffffff16565b60008c838151811061205d5761205d614104565b6020026020010151600001516001600160a01b0316826040516120809190614d41565b6000604051808303816000865af19150503d80600081146120bd576040519150601f19603f3d011682016040523d82523d6000602084013e6120c2565b606091505b5050905080806120cf5750895b6120eb5760405162461bcd60e51b815260040161072f90614d81565b806121185786838151811061210257612102614104565b6020026020010151886121159190614cda565b97505b5050808061212590614191565b915050611f24565b506040516370a0823160e01b81526000906001600160a01b038416906370a082319061215d9030906004016133ed565b602060405180830381865afa15801561217a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219e91906147fa565b90506121aa8282613d60565b9650600087116121cc5760405162461bcd60e51b815260040161072f90614dc5565b505050505094509492505050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b815260040161220b929190613e66565b602060405180830381865afa158015612228573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224c91906147fa565b6122569190614cda565b90506116688463095ea7b360e01b8584604051602401612277929190614dd5565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612835565b60608060606040518060e00160405280868152602001838152602001856001600160a01b03168152602001600015158152602001600081526020016000151581526020018281525060405160200161231b9190614ee7565b6040516020818303038152906040529250505092915050565b6001600160a01b0381166000908152600a602052604090205460ff161561236d5760405162461bcd60e51b815260040161072f90614f2c565b6001600160a01b0381166000908152600a602052604090819020805460ff19166001179055517f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f89061080f9083906133ed565b6123c861171d565b6009805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586118053390565b611668846323b872dd60e01b85858560405160240161227793929190614f3c565b825185901561245657600061243385846128c4565b92509050806124545760405162461bcd60e51b815260040161072f90614f98565b505b600061246a86600001518760600151612c0e565b90504667ffffffffffffffff16866020015167ffffffffffffffff16036124e5577f0e248ac8be20725176a5f0ab093c5fbb964634d4675012f3d3ad66e69e56d5b781888b858c6040516124c2959493929190614fa8565b60405180910390a16124de888388600001518960e001516119cb565b50506124f7565b6124f4818a8a89888c88612c46565b50505b50505050505050565b6119c58363a9059cbb60e01b8484604051602401612277929190614dd5565b60095460ff166107b95760405162461bcd60e51b815260040161072f9061501e565b60606000825167ffffffffffffffff81111561255f5761255f61344d565b604051908082528060200260200182016040528015612588578160200160208202803683370190505b50905060005b83518110156126795760008482815181106125ab576125ab614104565b6020026020010151602001516125c090614b46565b6001600160e01b0319811660009081526002602052604090205484519192506001600160a01b0316908490849081106125fb576125fb614104565b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b031683838151811061263857612638614104565b60200260200101516001600160a01b0316036126665760405162461bcd60e51b815260040161072f90615062565b508061267181614191565b91505061258e565b5092915050565b60606000806000865167ffffffffffffffff8111156126a1576126a161344d565b6040519080825280602002602001820160405280156126ca578160200160208202803683370190505b50935060005b87518110156127be5760008682815181106126ed576126ed614104565b60200260200101516001600160a01b031663358f0e1c8a848151811061271557612715614104565b60200260200101516040518263ffffffff1660e01b81526004016127399190614bfb565b606060405180830381865afa158015612756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061277a9190614c0c565b9096509450905061278b8184614cda565b9250808683815181106127a0576127a0614104565b602090810291909101015250806127b681614191565b9150506126d0565b5060005b845181101561282a57818582815181106127de576127de614104565b6020026020010151886127f19190615072565b6127fb91906150a7565b85828151811061280d5761280d614104565b60209081029190910101528061282281614191565b9150506127c2565b505093509350939050565b600061288a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612dc69092919063ffffffff16565b8051909150156119c557808060200190518101906128a891906150bb565b6119c55760405162461bcd60e51b815260040161072f90615136565b60008060005b8451811015612c055760008060008684815181106128ea576128ea614104565b60200260200101516001600160a01b031663358f0e1c89868151811061291257612912614104565b60200260200101516040518263ffffffff1660e01b81526004016129369190614bfb565b606060405180830381865afa158015612953573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129779190614c0c565b925092509250600087858151811061299157612991614104565b60200260200101516001600160a01b0316634c6da2698a87815181106129b9576129b9614104565b60200260200101516020015186306040518463ffffffff1660e01b81526004016129e593929190614cf2565b600060405180830381865afa158015612a02573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612a2a919081019061401b565b9050612a5e898681518110612a4157612a41614104565b6020908102919091010151516001600160a01b03851690866121da565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190612a8d9030906004016133ed565b602060405180830381865afa158015612aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ace91906147fa565b9050898681518110612ae257612ae2614104565b6020026020010151600001516001600160a01b031682604051612b059190614d41565b6000604051808303816000865af19150503d8060008114612b42576040519150601f19603f3d011682016040523d82523d6000602084013e612b47565b606091505b50508098505087612b645760008097509750505050505050612c07565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612b939030906004016133ed565b602060405180830381865afa158015612bb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bd491906147fa565b9050612be08282613d60565b612bea9089614cda565b97505050505050508080612bfd90614191565b9150506128ca565b505b9250929050565b600033834684604051602001612c27949392919061518d565b6040516020818303038152906040528051906020012090505b92915050565b60008084511180612c5d57506000856101e0015151115b612c68578451612c6e565b84604001515b90506060612c7d86858a612ddf565b60c0860151349015612c9657612c938534613d60565b90505b608087015180516020918201206000908152600890915260409020546001600160a01b0390811690612ccb908a1682876121da565b6000612cd88c8a8a612e69565b9050816001600160a01b031663834bc3ea848b60200151888a8f8f60a00151886040518863ffffffff1660e01b8152600401612d1996959493929190613fb4565b60006040518083038185885af1158015612d37573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612d60919081019061401b565b93505050507f082e2f634ceec1af5105aa53f234b7efad94428a54a714e3b7c7115ee549308089828860200151878c8b6101a00151888e8b8f60800151604051612db39a999897969594939291906151d5565b60405180910390a1505050505050505050565b6060612dd58484600085612eea565b90505b9392505050565b60004684602001518484876101200151886101000151604051602001612e0a96959493929190615277565b6040516020818303038152906040528051906020012090506000612e2d82612fac565b9050612e3e81866101400151612fdc565b4285610120015111612e625760405162461bcd60e51b815260040161072f9061533b565b5050505050565b60606040518060e0016040528085815260200183815260200184600001516001600160a01b031681526020018460e00151151581526020018461010001518152602001846101c0015115158152602001846101e00151815250604051602001612ed29190614ee7565b60405160208183030381529060405290509392505050565b606082471015612f0c5760405162461bcd60e51b815260040161072f906153a5565b6001600160a01b0385163b612f335760405162461bcd60e51b815260040161072f906153e9565b600080866001600160a01b03168587604051612f4f9190614d41565b60006040518083038185875af1925050503d8060008114612f8c576040519150601f19603f3d011682016040523d82523d6000602084013e612f91565b606091505b5091509150612fa1828286613018565b979650505050505050565b600081604051602001612fbf91906153f9565b604051602081830303815290604052805190602001209050919050565b6000612fe88383613051565b6005549091506001600160a01b038083169116146119c55760405162461bcd60e51b815260040161072f90615468565b60608315613027575081612dd8565b8251156130375782518084602001fd5b8160405162461bcd60e51b815260040161072f9190615478565b60008060006130608585613075565b9150915061306d816130b7565b509392505050565b60008082516041036130ab5760208301516040840151606085015160001a61309f87828585613197565b94509450505050612c07565b50600090506002612c07565b60008160048111156130cb576130cb613387565b036130d35750565b60018160048111156130e7576130e7613387565b036131045760405162461bcd60e51b815260040161072f906154bd565b600281600481111561311857613118613387565b036131355760405162461bcd60e51b815260040161072f90615501565b600381600481111561314957613149613387565b036131665760405162461bcd60e51b815260040161072f90615550565b600481600481111561317a5761317a613387565b036109f05760405162461bcd60e51b815260040161072f9061559f565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131ce575060009050600361326e565b8460ff16601b141580156131e657508460ff16601c14155b156131f7575060009050600461326e565b60006001878787876040516000815260200160405260405161321c94939291906155b8565b6020604051602081039080840390855afa15801561323e573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166132675760006001925092505061326e565b9150600090505b94509492505050565b60006001600160a01b038216612c40565b61329181613277565b81146109f057600080fd5b8035612c4081613288565b80613291565b8035612c40816132a7565b60008083601f8401126132cd576132cd600080fd5b50813567ffffffffffffffff8111156132e8576132e8600080fd5b602083019150836001820283011115612c0757612c07600080fd5b60008060008060006080868803121561331e5761331e600080fd5b600061332a888861329c565b955050602061333b888289016132ad565b945050604086013567ffffffffffffffff81111561335b5761335b600080fd5b613367888289016132b8565b9350935050606061337a8882890161329c565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600381106109f0576109f0613387565b806133b78161339d565b919050565b6000612c40826133ad565b6133d0816133bc565b82525050565b60208101612c4082846133c7565b6133d081613277565b60208101612c4082846133e4565b60006020828403121561341057613410600080fd5b60006117c8848461329c565b8015156133d0565b60208101612c40828461341c565b67ffffffffffffffff8116613291565b8035612c4081613432565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156134895761348961344d565b6040525050565b600061349b60405190565b90506133b78282613463565b600067ffffffffffffffff8211156134c1576134c161344d565b601f19601f83011660200192915050565b82818337506000910152565b60006134f16134ec846134a7565b613490565b90508281526020810184848401111561350c5761350c600080fd5b61306d8482856134d2565b600082601f83011261352b5761352b600080fd5b81356117c88482602086016134de565b60008060008060008060c0878903121561355757613557600080fd5b6000613563898961329c565b965050602061357489828a0161329c565b955050604061358589828a016132ad565b945050606061359689828a01613442565b935050608087013567ffffffffffffffff8111156135b6576135b6600080fd5b6135c289828a01613517565b92505060a06135d389828a0161329c565b9150509295509295509295565b6001600160e01b03198116613291565b8035612c40816135e0565b801515613291565b8035612c40816135fb565b60008060006060848603121561362657613626600080fd5b6000613632868661329c565b9350506020613643868287016135f0565b925050604061365486828701613603565b9150509250925092565b60006020828403121561367357613673600080fd5b60006117c884846132ad565b60008083601f84011261369457613694600080fd5b50813567ffffffffffffffff8111156136af576136af600080fd5b602083019150836020820283011115612c0757612c07600080fd5b600080600080604085870312156136e3576136e3600080fd5b843567ffffffffffffffff8111156136fd576136fd600080fd5b6137098782880161367f565b9450945050602085013567ffffffffffffffff81111561372b5761372b600080fd5b6137378782880161367f565b95989497509550505050565b6000806040838503121561375957613759600080fd5b6000613765858561329c565b9250506020613776858286016135f0565b9150509250929050565b60008060008060006080868803121561379b5761379b600080fd5b60006137a7888861329c565b955050602061333b88828901613442565b600061020082840312156137ce576137ce600080fd5b50919050565b6000806000806000606086880312156137ef576137ef600080fd5b853567ffffffffffffffff81111561380957613809600080fd5b613815888289016137b8565b955050602086013567ffffffffffffffff81111561383557613835600080fd5b6138418882890161367f565b9450945050604086013567ffffffffffffffff81111561386357613863600080fd5b61386f8882890161367f565b92509250509295509295909350565b806133d0565b60208101612c40828461387e565b6000806000604084860312156138aa576138aa600080fd5b833567ffffffffffffffff8111156138c4576138c4600080fd5b6138d0868287016132b8565b935093505060206136548682870161329c565b6000612c406001600160a01b0383166138fa565b90565b6001600160a01b031690565b6000612c40826138e3565b6000612c4082613906565b6133d081613911565b60208101612c40828461391c565b60008060006040848603121561394b5761394b600080fd5b833567ffffffffffffffff81111561396557613965600080fd5b6138d08682870161367f565b60006020828403121561398657613986600080fd5b60006117c884846135f0565b601981526000602082017f63616c6c6572206973206e6f74206d6573736167652062757300000000000000815291505b5060200190565b60208082528101612c4081613992565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00815291506139c2565b60208082528101612c40816139d9565b601481526000602082017f43616c6c6572206973206e6f7420706175736572000000000000000000000000815291506139c2565b60208082528101612c4081613a1d565b8051612c40816132a7565b600067ffffffffffffffff821115613a8657613a8661344d565b5060209081020190565b8051612c4081613288565b60005b83811015613ab6578181015183820152602001613a9e565b838111156116685750506000910152565b6000613ad56134ec846134a7565b905082815260208101848484011115613af057613af0600080fd5b61306d848285613a9b565b600082601f830112613b0f57613b0f600080fd5b81516117c8848260208601613ac7565b600060408284031215613b3457613b34600080fd5b613b3e6040613490565b90506000613b4c8484613a90565b825250602082015167ffffffffffffffff811115613b6c57613b6c600080fd5b613b7884828501613afb565b60208301525092915050565b6000613b926134ec84613a6c565b83815290506020808201908402830185811115613bb157613bb1600080fd5b835b81811015613bf257805167ffffffffffffffff811115613bd557613bd5600080fd5b808601613be28982613b1f565b8552505060209283019201613bb3565b5050509392505050565b600082601f830112613c1057613c10600080fd5b81516117c8848260208601613b84565b8051612c40816135fb565b600060e08284031215613c4057613c40600080fd5b613c4a60e0613490565b90506000613c588484613a61565b825250602082015167ffffffffffffffff811115613c7857613c78600080fd5b613c8484828501613bfc565b6020830152506040613c9884828501613a90565b6040830152506060613cac84828501613c20565b6060830152506080613cc084828501613a61565b60808301525060a0613cd484828501613c20565b60a08301525060c082015167ffffffffffffffff811115613cf757613cf7600080fd5b613d0384828501613afb565b60c08301525092915050565b600060208284031215613d2457613d24600080fd5b815167ffffffffffffffff811115613d3e57613d3e600080fd5b6117c884828501613c2b565b634e487b7160e01b600052601160045260246000fd5b600082821015613d7257613d72613d4a565b500390565b6000612c406138f78381565b6133d081613d77565b6000613d96825190565b808452602084019350613dad818560208601613a9b565b601f19601f8201165b9093019392505050565b60e08101613dce828a61387e565b613ddb6020830189613d83565b613de8604083018861387e565b613df560608301876133e4565b613e02608083018661387e565b613e0f60a08301856133c7565b81810360c0830152613e218184613d8c565b9998505050505050505050565b6001600160e01b031981166133d0565b60608101613e4c82866133e4565b613e596020830185613e2e565b6117c8604083018461341c565b60408101613e7482856133e4565b612dd860208301846133e4565b60e08101613e8f828a61387e565b613e9c6020830189613d83565b613de86040830188613d83565b600781526000602082017f746b696e206d6d00000000000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081613ea9565b8051612c4081613432565b600060408284031215613f0d57613f0d600080fd5b613f176040613490565b90506000613b4c8484613eed565b600060208284031215613f3a57613f3a600080fd5b815167ffffffffffffffff811115613f5457613f54600080fd5b6117c884828501613ef8565b600f81526000602082017f63627269646765206e6f74207365740000000000000000000000000000000000815291506139c2565b60208082528101612c4081613f60565b67ffffffffffffffff81166133d0565b60c08101613fc28289613fa4565b613fcf60208301886133e4565b613fdc604083018761387e565b613fe960608301866133e4565b8181036080830152613ffb8185613d8c565b905081810360a083015261400f8184613d8c565b98975050505050505050565b60006020828403121561403057614030600080fd5b815167ffffffffffffffff81111561404a5761404a600080fd5b6117c884828501613afb565b6000612c40826138f7565b600981526000602082017f73656e64206661696c0000000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614061565b60e081016140b3828a61387e565b613ddb602083018961387e565b601481526000602082017f706172616d732073697a65206d69736d61746368000000000000000000000000815291506139c2565b60208082528101612c40816140c0565b634e487b7160e01b600052603260045260246000fd5b6000808335601e193685900301811261413557614135600080fd5b80840192508235915067ffffffffffffffff82111561415657614156600080fd5b602083019250600182023603831315612c0557612c05600080fd5b600061417e8385846134d2565b50500190565b60006117c8828486614171565b600060001982036141a4576141a4613d4a565b5060010190565b81835260006020840193506141c18385846134d2565b601f19601f840116613db6565b6000612dd58484846141ab565b6000808335601e19368590030181126141f6576141f6600080fd5b83810160208101935035915067ffffffffffffffff82111561421a5761421a600080fd5b36829003831315612c0557612c05600080fd5b818352600060208401935083602084028101838060005b8781101561427f57848403895261425b82846141db565b6142668682846141ce565b95506020840160209b909b019a93505050600101614244565b5091979650505050505050565b600061429883836133e4565b505060200190565b6000612dd8602084018461329c565b8183526000602084019350818060005b858110156142ec576142d182846142a0565b6142db888261428c565b9750602083019250506001016142bf565b509495945050505050565b6040808252810161430981868861422d565b9050818103602083015261431e8184866142af565b9695505050505050565b60006020828403121561433d5761433d600080fd5b60006117c88484613442565b600381526000602082016206e6f760ec1b815291506139c2565b60208082528101612c4081614349565b601b81526000602082017f62726964676520646f6573206e6f7420737570706f7274206d73670000000000815291506139c2565b60208082528101612c4081614373565b601281526000602082017f756e737570706f72746564206272696467650000000000000000000000000000815291506139c2565b60208082528101612c40816143b7565b60006040828403121561441057614410600080fd5b61441a6040613490565b90506000614428848461329c565b825250602082013567ffffffffffffffff81111561444857614448600080fd5b613b7884828501613517565b60006144626134ec84613a6c565b8381529050602080820190840283018581111561448157614481600080fd5b835b81811015613bf257803567ffffffffffffffff8111156144a5576144a5600080fd5b8086016144b289826143fb565b8552505060209283019201614483565b6000612dd8368484614454565b6000602082840312156144e4576144e4600080fd5b60006117c88484613603565b601281526000602082017f746b696e206e6f206e6174697665577261700000000000000000000000000000815291506139c2565b60208082528101612c40816144f0565b600b81526000602082017f696e7366636e7420616d74000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614534565b6000610200828403121561458e5761458e600080fd5b614599610200613490565b905060006145a7848461329c565b82525060206145b884848301613442565b60208301525060406145cc8482850161329c565b60408301525060606145e084828501613442565b606083015250608082013567ffffffffffffffff81111561460357614603600080fd5b61460f84828501613517565b60808301525060a082013567ffffffffffffffff81111561463257614632600080fd5b61463e84828501613517565b60a08301525060c061465284828501613603565b60c08301525060e061466684828501613603565b60e08301525061010061467b848285016132ad565b61010083015250610120614691848285016132ad565b6101208301525061014082013567ffffffffffffffff8111156146b6576146b6600080fd5b6146c284828501613517565b610140830152506101606146d8848285016132ad565b610160830152506101806146ee8482850161329c565b610180830152506101a06147048482850161329c565b6101a0830152506101c061471a84828501613603565b6101c0830152506101e082013567ffffffffffffffff81111561473f5761473f600080fd5b61474b84828501613517565b6101e08301525092915050565b6000612c403683614578565b60408101613e748285613e2e565b601181526000602082017f6e6f742066656520636f6c6c6563746f72000000000000000000000000000000815291506139c2565b60208082528101612c4081614772565b601281526000602082017f73656e64206e6174697665206661696c65640000000000000000000000000000815291506139c2565b60208082528101612c40816147b6565b60006020828403121561480f5761480f600080fd5b60006117c88484613a61565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015291505b5060400190565b60208082528101612c408161481b565b601881526000602082017f6e6f206e6174697665207472616e7366657272656420696e0000000000000000815291506139c2565b60208082528101612c4081614888565b601081526000602082017f5061757361626c653a2070617573656400000000000000000000000000000000815291506139c2565b60208082528101612c40816148cc565b600082601f83011261492457614924600080fd5b81356117c8848260208601614454565b600060e0828403121561494957614949600080fd5b61495360e0613490565b9050600061496184846132ad565b825250602082013567ffffffffffffffff81111561498157614981600080fd5b61498d84828501614910565b60208301525060406149a18482850161329c565b60408301525060606149b584828501613603565b60608301525060806149c9848285016132ad565b60808301525060a06149dd84828501613603565b60a08301525060c082013567ffffffffffffffff811115614a0057614a00600080fd5b613d0384828501613517565b600060208284031215614a2157614a21600080fd5b813567ffffffffffffffff811115614a3b57614a3b600080fd5b6117c884828501614934565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572910190815260006139c2565b60208082528101612c4081614a47565b600060208284031215614a9e57614a9e600080fd5b60006117c88484613a90565b600c81526000602082017f746b206e6f206e61746976650000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614aaa565b601581526000602082017f4163636f756e74206973206e6f74207061757365720000000000000000000000815291506139c2565b60208082528101612c4081614aee565b6000612c4082516001600160e01b03191690565b6000614b50825190565b60208301614b5d81614b32565b92506004821015614b8457614b7f6001600160e01b0319836004036008021b90565b831692505b5050919050565b600f81526000602082017f756e737570706f72746564206465780000000000000000000000000000000000815291506139c2565b60208082528101612c4081614b8b565b80516000906040840190614be385826133e4565b50602083015184820360208601526110148282613d8c565b60208082528101612dd88184614bcf565b600080600060608486031215614c2457614c24600080fd5b6000614c308686613a61565b9350506020614c4186828701613a90565b925050604061365486828701613a90565b600d81526000602082017f746b696e206d69736d6174636800000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614c52565b600c81526000602082017f746b6f206d69736d617463680000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614c96565b60008219821115614ced57614ced613d4a565b500190565b60608082528101614d038186613d8c565b9050614d12602083018561387e565b6117c860408301846133e4565b6000614d29825190565b614d37818560208601613a9b565b9290920192915050565b6000612dd88284614d1f565b600b81526000602082017f73776170206661696c6564000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614d4d565b601081526000602082017f616c6c207377617073206661696c656400000000000000000000000000000000815291506139c2565b60208082528101612c4081614d91565b60408101614de382856133e4565b612dd8602083018461387e565b6000612dd88383614bcf565b6000614e06825190565b80845260208401935083602082028501614e208560200190565b8060005b8581101561427f5784840389528151614e3d8582614df0565b94506020830160209a909a0199925050600101614e24565b805160009060e0840190614e69858261387e565b5060208301518482036020860152614e818282614dfc565b9150506040830151614e9660408601826133e4565b506060830151614ea9606086018261341c565b506080830151614ebc608086018261387e565b5060a0830151614ecf60a086018261341c565b5060c083015184820360c08601526110148282613d8c565b60208082528101612dd88184614e55565b601981526000602082017f4163636f756e7420697320616c72656164792070617573657200000000000000815291506139c2565b60208082528101612c4081614ef8565b60608101614f4a82866133e4565b614f5760208301856133e4565b6117c8604083018461387e565b600981526000602082017f73776170206661696c0000000000000000000000000000000000000000000000815291506139c2565b60208082528101612c4081614f64565b60a08101614fb6828861387e565b614fc3602083018761387e565b614fd060408301866133e4565b614fdd606083018561387e565b61431e60808301846133e4565b601481526000602082017f5061757361626c653a206e6f7420706175736564000000000000000000000000815291506139c2565b60208082528101612c4081614fea565b600c81526000602082017f636463206e6f20666f756e640000000000000000000000000000000000000000815291506139c2565b60208082528101612c408161502e565b600081600019048311821515161561508c5761508c613d4a565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826150b6576150b6615091565b500490565b6000602082840312156150d0576150d0600080fd5b60006117c88484613c20565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f7420737563636565640000000000000000000000000000000000000000000060208201529150614871565b60208082528101612c40816150dc565b6000612c408260601b90565b6000612c4082615146565b6133d061516982613277565b615152565b6000612c408260c01b90565b6133d067ffffffffffffffff821661516e565b6000615199828761515d565b6014820191506151a9828661515d565b6014820191506151b9828561517a565b6008820191506151c9828461517a565b50600801949350505050565b61014081016151e4828d61387e565b81810360208301526151f6818c613d8c565b9050615205604083018b613fa4565b615212606083018a61387e565b61521f60808301896133e4565b61522c60a08301886133e4565b61523960c08301876133e4565b61524660e08301866133e4565b61525461010083018561387e565b8181036101208301526152678184613d8c565b9c9b505050505050505050505050565b7f6578656375746f722066656500000000000000000000000000000000000000008152600c0160006152a9828961517a565b6008820191506152b9828861517a565b6008820191506152c9828761387e565b6020820191506152d9828661515d565b6014820191506152e9828561387e565b6020820191506152f9828461387e565b506020019695505050505050565b601181526000602082017f646561646c696e65206578636565646564000000000000000000000000000000815291506139c2565b60208082528101612c4081615307565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f81527f722063616c6c000000000000000000000000000000000000000000000000000060208201529150614871565b60208082528101612c408161534b565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000815291506139c2565b60208082528101612c40816153b5565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c01600061542b828461387e565b50602001919050565b600e81526000602082017f696e76616c6964207369676e6572000000000000000000000000000000000000815291506139c2565b60208082528101612c4081615434565b60208082528101612dd88184613d8c565b601881526000602082017f45434453413a20696e76616c6964207369676e61747572650000000000000000815291506139c2565b60208082528101612c4081615489565b601f81526000602082017f45434453413a20696e76616c6964207369676e6174757265206c656e67746800815291506139c2565b60208082528101612c40816154cd565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202773272076616c815261756560f01b60208201529150614871565b60208082528101612c4081615511565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202776272076616c815261756560f01b60208201529150614871565b60208082528101612c4081615560565b60ff81166133d0565b608081016155c6828761387e565b6155d360208301866155af565b6155e0604083018561387e565b611014606083018461387e56fea26469706673582212208e065e420a4604dbe5b18c5c270273ff9d8c10203999b426a97d2593dc2d493e64736f6c634300080f0033

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

0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d000000000000000000000000420000000000000000000000000000000000000600000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004a000000000000000000000000000000000000000000000000000000000000005800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e74323536292900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d66696c6c4f72646572524651282875696e743235362c616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e74323536292c62797465732c75696e743235362c75696e743235362900000000000000000000000000000000000000000000000000000000000000000000050000000000000000000000009780f24a4696c59fe935f33dd307884b1f05a56d000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e0000000000000000000000000000000000000000000000000000000000000006000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd199000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e7432353629290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000537377617028616464726573732c28616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e743235362c75696e743235362c6279746573292c62797465732900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005d66696c6c4f72646572524651282875696e743235362c616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e74323536292c62797465732c75696e743235362c75696e7432353629000000

-----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)),clipperSwap(address,address,uint256,uint256),unoswap(address,uint256,uint256,bytes32[]),uniswapV3Swap(uint256,uint256,uint256[]),fillOrderRFQ((uint256,address,address,address,address,uint256,uint256),bytes,uint256,uint256)
Arg [5] : _codecs (address[]): 0x9780F24a4696c59FE935f33Dd307884B1F05A56d,0xd1261634ef4255beb11ed38a35eBDE5897b8532e,0xd1261634ef4255beb11ed38a35eBDE5897b8532e,0xd1261634ef4255beb11ed38a35eBDE5897b8532e,0xd1261634ef4255beb11ed38a35eBDE5897b8532e
Arg [6] : _supportedDexList (address[]): 0xE592427A0AEce92De3Edee1F18E0157C05861564,0x1111111254760F7ab3F16433eea9304126DCd199,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[]),fillOrderRFQ((uint256,address,address,address,address,uint256,uint256),bytes,uint256,uint256)
Arg [8] : _testMode (bool): False

-----Encoded View---------------
71 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d
Arg [1] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [2] : 00000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043
Arg [3] : 000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [5] : 00000000000000000000000000000000000000000000000000000000000003e0
Arg [6] : 00000000000000000000000000000000000000000000000000000000000004a0
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000580
Arg [8] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [10] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [13] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000033
Arg [16] : 6578616374496e707574282862797465732c616464726573732c75696e743235
Arg [17] : 362c75696e743235362c75696e74323536292900000000000000000000000000
Arg [18] : 000000000000000000000000000000000000000000000000000000000000002c
Arg [19] : 636c69707065725377617028616464726573732c616464726573732c75696e74
Arg [20] : 3235362c75696e74323536290000000000000000000000000000000000000000
Arg [21] : 000000000000000000000000000000000000000000000000000000000000002a
Arg [22] : 756e6f7377617028616464726573732c75696e743235362c75696e743235362c
Arg [23] : 627974657333325b5d2900000000000000000000000000000000000000000000
Arg [24] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [25] : 756e69737761705633537761702875696e743235362c75696e743235362c7569
Arg [26] : 6e743235365b5d29000000000000000000000000000000000000000000000000
Arg [27] : 000000000000000000000000000000000000000000000000000000000000005d
Arg [28] : 66696c6c4f72646572524651282875696e743235362c616464726573732c6164
Arg [29] : 64726573732c616464726573732c616464726573732c75696e743235362c7569
Arg [30] : 6e74323536292c62797465732c75696e743235362c75696e7432353629000000
Arg [31] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [32] : 0000000000000000000000009780f24a4696c59fe935f33dd307884b1f05a56d
Arg [33] : 000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e
Arg [34] : 000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e
Arg [35] : 000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e
Arg [36] : 000000000000000000000000d1261634ef4255beb11ed38a35ebde5897b8532e
Arg [37] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [38] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Arg [39] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [40] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [41] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [42] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [43] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [44] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [45] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [46] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [47] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [48] : 0000000000000000000000000000000000000000000000000000000000000200
Arg [49] : 0000000000000000000000000000000000000000000000000000000000000260
Arg [50] : 00000000000000000000000000000000000000000000000000000000000002c0
Arg [51] : 0000000000000000000000000000000000000000000000000000000000000033
Arg [52] : 6578616374496e707574282862797465732c616464726573732c75696e743235
Arg [53] : 362c75696e743235362c75696e74323536292900000000000000000000000000
Arg [54] : 0000000000000000000000000000000000000000000000000000000000000053
Arg [55] : 7377617028616464726573732c28616464726573732c616464726573732c6164
Arg [56] : 64726573732c616464726573732c75696e743235362c75696e743235362c7569
Arg [57] : 6e743235362c6279746573292c62797465732900000000000000000000000000
Arg [58] : 000000000000000000000000000000000000000000000000000000000000002c
Arg [59] : 636c69707065725377617028616464726573732c616464726573732c75696e74
Arg [60] : 3235362c75696e74323536290000000000000000000000000000000000000000
Arg [61] : 000000000000000000000000000000000000000000000000000000000000002a
Arg [62] : 756e6f7377617028616464726573732c75696e743235362c75696e743235362c
Arg [63] : 627974657333325b5d2900000000000000000000000000000000000000000000
Arg [64] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [65] : 756e69737761705633537761702875696e743235362c75696e743235362c7569
Arg [66] : 6e743235365b5d29000000000000000000000000000000000000000000000000
Arg [67] : 000000000000000000000000000000000000000000000000000000000000005d
Arg [68] : 66696c6c4f72646572524651282875696e743235362c616464726573732c6164
Arg [69] : 64726573732c616464726573732c616464726573732c75696e743235362c7569
Arg [70] : 6e74323536292c62797465732c75696e743235362c75696e7432353629000000


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.