Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
TransferSwapper
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.8.15; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./lib/Types.sol"; import "./lib/MessageSenderLib.sol"; import "./lib/MessageReceiverApp.sol"; import "./BridgeRegistry.sol"; import "./FeeOperator.sol"; import "./SigVerifier.sol"; import "./Swapper.sol"; import "./interfaces/IBridgeAdapter.sol"; import "./interfaces/ICodec.sol"; /** * @author Chainhop Dex Team * @author Padoriku * @title An app that enables swapping on a chain, transferring to another chain and swapping * another time on the destination chain before sending the result tokens to a user */ contract TransferSwapper is MessageReceiverApp, Swapper, SigVerifier, FeeOperator, ReentrancyGuard, BridgeRegistry { using SafeERC20 for IERC20; using ECDSA for bytes32; bytes32 public immutable CBRIDGE_PROVIDER_HASH; /// @notice erc20 wrap of the gas token of this chain, e.g. WETH address public nativeWrap; constructor( address _messageBus, address _nativeWrap, address _signer, address _feeCollector, string[] memory _funcSigs, address[] memory _codecs, address[] memory _supportedDexList, string[] memory _supportedDexFuncs, address[] memory _externalSwapDexList, bool _testMode ) Swapper(_funcSigs, _codecs, _supportedDexList, _supportedDexFuncs, _externalSwapDexList) FeeOperator(_feeCollector) SigVerifier(_signer) { messageBus = _messageBus; nativeWrap = _nativeWrap; testMode = _testMode; CBRIDGE_PROVIDER_HASH = keccak256(bytes("cbridge")); } event NativeWrapUpdated(address nativeWrap); /** * @notice Emitted when requested dstChainId == srcChainId, no bridging * @param id see _computeId() * @param amountIn the input amount approved by the sender * @param tokenIn the input token approved by the sender * @param amountOut the output amount gained after swapping using the input tokens * @param tokenOut the output token gained after swapping using the input tokens */ event DirectSwap(bytes32 id, uint256 amountIn, address tokenIn, uint256 amountOut, address tokenOut); /** * @notice Emitted when operations on src chain is done, the transfer is sent through the bridge * @param id see _computeId() * @param bridgeResp arbitrary response data returned by bridge * @param dstChainId destination chain id * @param srcAmount input amount approved by the sender * @param srcToken the input token approved by the sender * @param dstToken the final output token (after bridging and swapping) desired by the sender * @param bridgeOutReceiver the receiver (user or dst TransferSwapper) of the bridge token * @param bridgeToken the token used for bridging * @param bridgeAmount the amount of the bridgeToken to bridge * @param bridgeProvider the bridge provider */ event RequestSent( bytes32 id, bytes bridgeResp, uint64 dstChainId, uint256 srcAmount, address srcToken, address dstToken, address bridgeOutReceiver, address bridgeToken, uint256 bridgeAmount, string bridgeProvider ); // emitted when operations on dst chain is done. // dstAmount is denominated by dstToken, refundAmount is denominated by bridge out token. // if refundAmount is a non-zero number, it means the "allow partial fill" option is turned on. /** * @notice Emitted when operations on dst chain is done. * @param id see _computeId() * @param dstAmount the final output token (after bridging and swapping) desired by the sender * @param refundAmount the amount refunded to the receiver in bridge token * @dev refundAmount may be fill by either a complete refund or when allowPartialFill is on and * some swaps fails in the swap routes * @param refundToken bridge out token * @param feeCollected the fee chainhop deducts from bridge out token * @param status see RequestStatus */ event RequestDone( bytes32 id, uint256 dstAmount, uint256 refundAmount, address refundToken, uint256 feeCollected, Types.RequestStatus status, bytes forwardResp ); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Source chain functions * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /** * @notice swaps if needed, then transfer the token to another chain along with an instruction on how to swap * on that chain */ function transferWithSwap( Types.TransferDescription calldata _desc, ICodec.SwapDescription[] calldata _srcSwaps, ICodec.SwapDescription[] calldata _dstSwaps ) external payable nonReentrant { // a request needs to incur a swap, a transfer, or both. otherwise it's a nop and we revert early to save gas require(_srcSwaps.length != 0 || _desc.dstChainId != uint64(block.chainid), "nop"); require(_srcSwaps.length != 0 || (_desc.amountIn != 0 && _desc.tokenIn != address(0)), "nop"); // swapping on the dst chain requires message passing. only integrated with cbridge for now bytes32 bridgeProviderHash = keccak256(bytes(_desc.bridgeProvider)); require( (_dstSwaps.length == 0 && _desc.forward.length == 0) || bridgeProviderHash == CBRIDGE_PROVIDER_HASH, "bridge does not support msg" ); IBridgeAdapter bridge = bridges[bridgeProviderHash]; // if not DirectSwap, the bridge provider should be a valid one require(_desc.dstChainId == uint64(block.chainid) || address(bridge) != address(0), "unsupported bridge"); uint256 amountIn = _desc.amountIn; ICodec[] memory codecs; address srcToken = _desc.tokenIn; address bridgeToken = _desc.bridgeTokenIn; if (_srcSwaps.length != 0) { if (!isExternalSwap(_srcSwaps[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; if (isExternalSwap(_srcSwaps[0])) { // if a swap is raw, it is only possible that there is one element in the array (ok, amountOut) = executeExternalSwap(_srcToken, _bridgeToken, _amountIn, _srcSwaps[0]); } else { (ok, amountOut) = executeSwaps(_srcSwaps, _codecs); } require(ok, "swap fail"); } bytes32 id = _computeId(_desc.receiver, _desc.nonce); // direct send if needed if (_desc.dstChainId == uint64(block.chainid)) { emit DirectSwap(id, _amountIn, _srcToken, amountOut, _bridgeToken); _sendToken(_bridgeToken, amountOut, _desc.receiver, _desc.nativeOut); return; } _transfer(id, _srcToken, _bridgeToken, _desc, _dstSwaps, _amountIn, amountOut); } function _transfer( bytes32 _id, address 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 returns (ExecutionStatus) { Types.Request memory m = abi.decode((_message), (Types.Request)); // handle the case where amount received is not enough to pay fee if (_amount < m.fee) { m.fee = _amount; emit RequestDone(m.id, 0, 0, _token, m.fee, Types.RequestStatus.Succeeded, bytes("")); return ExecutionStatus.Success; } else { _amount = _amount - m.fee; } uint256 sumAmtOut = _amount; uint256 sumAmtFailed; bytes memory forwardResp; { // Note if to wrap, the NATIVE used to convert is from the ones sent by upstream in advance, but not part of the `msg.value` // `msg.value` here is only used to pay for msg fee _wrapBridgeOutToken(_token, _amount); address tokenOut = _token; if (m.swaps.length != 0) { ICodec[] memory codecs; address tokenIn; // swap first before sending the token out to user (, tokenIn, tokenOut, codecs) = sanitizeSwaps(m.swaps); // tokenIn mismatch require(tokenIn == _token, "tkin mm"); // dex raw calling is not allowed for message execution (sumAmtOut, sumAmtFailed) = executeSwapsWithOverride(m.swaps, codecs, _amount, m.allowPartialFill); // if at this stage the tx is not reverted, it means at least 1 swap in routes succeeded if (sumAmtFailed > 0) { _sendToken(_token, sumAmtFailed, m.receiver, false); } } if (m.forward.length > 0) { Types.Forward memory f = abi.decode(m.forward, (Types.Forward)); IBridgeAdapter cBridge = bridges[CBRIDGE_PROVIDER_HASH]; require(address(cBridge) != address(0), "cbridge not set"); IERC20(tokenOut).safeIncreaseAllowance(address(cBridge), sumAmtOut); bytes memory requestMessage = _encodeRequestMessage(m.id, m.receiver); forwardResp = cBridge.bridge{value: msg.value}( f.dstChain, m.receiver, sumAmtOut, tokenOut, f.params, requestMessage ); } else { // msg.value is not used in this code branch, pay back to sender if (msg.value > 0) { (bool sent, ) = _executor.call{value: msg.value}(""); require(sent, "send fail"); } _sendToken(tokenOut, sumAmtOut, m.receiver, m.nativeOut); } } // status is always success as long as this function call doesn't revert. partial fill is also considered success emit RequestDone(m.id, sumAmtOut, sumAmtFailed, _token, m.fee, Types.RequestStatus.Succeeded, forwardResp); return ExecutionStatus.Success; } /** * @notice Sends the received token to the receiver * @dev Only called if executeMessageWithTransfer reverts * @dev Bridge contract *always* sends native token to its receiver (this contract) even though the _token field is always an ERC20 token * @param _token the token received by this contract * @param _amount the amount of token received by this contract * @return ok whether the processing is successful */ function executeMessageWithTransferFallback( address, // _sender address _token, uint256 _amount, uint64, // _srcChainId bytes memory _message, address // _executor ) external payable override onlyMessageBus nonReentrant returns (ExecutionStatus) { Types.Request memory m = abi.decode((_message), (Types.Request)); _wrapBridgeOutToken(_token, _amount); uint256 refundAmount = _amount - m.fee; // no need to check amount >= fee as it's already checked before _sendToken(_token, refundAmount, m.receiver, false); emit RequestDone(m.id, 0, refundAmount, _token, m.fee, Types.RequestStatus.Fallback, bytes("")); return ExecutionStatus.Success; } /** * @notice Used to trigger refund when bridging fails due to large slippage * @dev only MessageBus can call this function, this requires the user to get sigs of the message from SGN * @dev Bridge contract *always* sends native token to its receiver (this contract) even though the _token field is always an ERC20 token * @param _token the token received by this contract * @param _amount the amount of token received by this contract * @return ok whether the processing is successful */ function executeMessageWithTransferRefund( address _token, uint256 _amount, bytes calldata _message, address // _executor ) external payable override onlyMessageBus nonReentrant returns (ExecutionStatus) { return _refund(_token, _amount, _message); } function _refund( address _token, uint256 _amount, bytes calldata _message ) private returns (ExecutionStatus) { Types.Request memory m = abi.decode((_message), (Types.Request)); _wrapBridgeOutToken(_token, _amount); _sendToken(_token, _amount, m.receiver, false); emit RequestDone(m.id, 0, _amount, _token, m.fee, Types.RequestStatus.Fallback, bytes("")); return ExecutionStatus.Success; } function executeMessageWithTransferRefundFromAdapter( address _token, uint256 _amount, bytes calldata _message, address // _executor ) external payable nonReentrant returns (ExecutionStatus) { if (_token != nativeWrap) { IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount); } else { require(msg.value >= _amount, "no native transferred in"); } return _refund(_token, _amount, _message); } /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Misc * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ function _computeId(address _receiver, uint64 _nonce) private view returns (bytes32) { return keccak256(abi.encodePacked(msg.sender, _receiver, uint64(block.chainid), _nonce)); } function _encodeRequestMessage( bytes32 _id, Types.TransferDescription memory _desc, ICodec.SwapDescription[] memory _swaps ) internal pure returns (bytes memory message) { message = abi.encode( Types.Request({ id: _id, swaps: _swaps, receiver: _desc.receiver, nativeOut: _desc.nativeOut, fee: _desc.fee, allowPartialFill: _desc.allowPartialFill, forward: _desc.forward }) ); } function _encodeRequestMessage(bytes32 _id, address _receiver) internal pure returns (bytes memory message) { ICodec.SwapDescription[] memory emptySwaps; bytes memory empty; message = abi.encode( Types.Request({ id: _id, swaps: emptySwaps, receiver: _receiver, nativeOut: false, fee: 0, allowPartialFill: false, forward: empty }) ); } function _wrapBridgeOutToken(address _token, uint256 _amount) private { // Wrapping the bridge token before doing anything. There is inefficiency in this function and _sendToken() only if the received the token // is native and the user wants native out. The wrapping then unwrapping process could be skipped. This inefficiency is tolerated for logic tidiness if (_token == nativeWrap) { // If the bridge out token is a native wrap, we need to check whether the actual received token is native token // Note Assumption: only the liquidity bridge is capable of sending a native wrap address bridge = IMessageBus(messageBus).liquidityBridge(); // If bridge's nativeWrap is set, then bridge automatically unwraps the token and send it to this contract // Otherwise the received token in this contract is ERC20 if (IBridgeCeler(bridge).nativeWrap() == nativeWrap) { IWETH(nativeWrap).deposit{value: _amount}(); } } } function _sendToken( address _token, uint256 _amount, address _receiver, bool _nativeOut ) private { if (_nativeOut) { require(_token == nativeWrap, "tk no native"); IWETH(nativeWrap).withdraw(_amount); (bool sent, ) = _receiver.call{value: _amount, gas: 50000}(""); require(sent, "send fail"); } else { IERC20(_token).safeTransfer(_receiver, _amount); } } function _verifyFee( Types.TransferDescription memory _desc, uint256 _amountIn, address _tokenIn ) private view { bytes32 hash = keccak256( abi.encodePacked( "executor fee", uint64(block.chainid), _desc.dstChainId, _amountIn, _tokenIn, _desc.feeDeadline, _desc.fee ) ); bytes32 signHash = hash.toEthSignedMessageHash(); verifySig(signHash, _desc.feeSig); require(_desc.feeDeadline > block.timestamp, "deadline exceeded"); } function setNativeWrap(address _nativeWrap) external onlyOwner { nativeWrap = _nativeWrap; emit NativeWrapUpdated(_nativeWrap); } // This is needed to receive ETH when calling `IWETH.withdraw` receive() external payable {} }
// 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"); } } }
// 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); }
// 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)); } }
// 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; } }
// 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 bridgeTokenIn; address dstTokenOut; // the final output token, emitted in event for display purpose only // in case of multi route swaps, whether to allow the successful swaps to go through // and sending the amountIn of the failed swaps back to user bool allowPartialFill; // sets if another cbridge hop is required on the dst chain, abi.encode(Forward) bytes forward; } }
// 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))); } }
// 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) {} }
// 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); } }
// 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); } }
// 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"); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.8.15; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./CodecRegistry.sol"; import "./interfaces/ICodec.sol"; import "./interfaces/IWETH.sol"; import "./DexRegistry.sol"; /** * @title Loads codecs for the swaps and performs swap actions * @author Padoriku */ contract Swapper is CodecRegistry, DexRegistry { using SafeERC20 for IERC20; // Externally encoded swaps are not encoded by ChainHop's backend, and are differenciated by the target dex address. mapping(address => bool) public externalSwap; constructor( string[] memory _funcSigs, address[] memory _codecs, address[] memory _supportedDexList, string[] memory _supportedDexFuncs, address[] memory _externalSwapDexList ) DexRegistry(_supportedDexList, _supportedDexFuncs) CodecRegistry(_funcSigs, _codecs) { for (uint256 i = 0; i < _externalSwapDexList.length; i++) { _setExternalSwap(_externalSwapDexList[i], true); } } event ExternalSwapUpdated(address dex, bool enabled); /** * @dev Checks the input swaps for that tokenIn and tokenOut for every swap should be the same * @param _swaps the swaps the check * @return sumAmtIn the sum of all amountIns in the swaps * @return tokenIn the input token of the swaps * @return tokenOut the desired output token of the swaps * @return codecs a list of codecs which each of them corresponds to a swap */ function sanitizeSwaps(ICodec.SwapDescription[] memory _swaps) internal view returns ( uint256 sumAmtIn, address tokenIn, address tokenOut, ICodec[] memory codecs // _codecs[i] is for _swaps[i] ) { address prevTokenIn; address prevTokenOut; codecs = loadCodecs(_swaps); for (uint256 i = 0; i < _swaps.length; i++) { require(dexRegistry[_swaps[i].dex][bytes4(_swaps[i].data)], "unsupported dex"); (uint256 _amountIn, address _tokenIn, address _tokenOut) = codecs[i].decodeCalldata(_swaps[i]); require(prevTokenIn == address(0) || prevTokenIn == _tokenIn, "tkin mismatch"); prevTokenIn = _tokenIn; require(prevTokenOut == address(0) || prevTokenOut == _tokenOut, "tko mismatch"); prevTokenOut = _tokenOut; sumAmtIn += _amountIn; tokenIn = _tokenIn; tokenOut = _tokenOut; } } /** * @notice Executes the swaps, decode their return values and sums the returned amount * @dev This function is intended to be used on src chain only * @dev This function immediately fails (return false) if any swaps fail. There is no "partial fill" on src chain * @param _swaps swaps. this function assumes that the swaps are already sanitized * @param _codecs the codecs for each swap * @return ok whether the operation is successful * @return sumAmtOut the sum of all amounts gained from swapping */ function executeSwaps( ICodec.SwapDescription[] memory _swaps, ICodec[] memory _codecs // _codecs[i] is for _swaps[i] ) internal returns (bool ok, uint256 sumAmtOut) { for (uint256 i = 0; i < _swaps.length; i++) { (uint256 amountIn, address tokenIn, address tokenOut) = _codecs[i].decodeCalldata(_swaps[i]); bytes memory data = _codecs[i].encodeCalldataWithOverride(_swaps[i].data, amountIn, address(this)); IERC20(tokenIn).safeIncreaseAllowance(_swaps[i].dex, amountIn); uint256 balBefore = IERC20(tokenOut).balanceOf(address(this)); (ok, ) = _swaps[i].dex.call(data); if (!ok) { return (false, 0); } uint256 balAfter = IERC20(tokenOut).balanceOf(address(this)); sumAmtOut += balAfter - balBefore; } } /** * @notice Executes the externally encoded swaps * @dev This function is intended to be used on src chain only * @dev This function immediately fails (return false) if any swaps fail. There is no "partial fill" on src chain * @param _swap. this function assumes that the swaps are already sanitized * @return ok whether the operation is successful * @return amtOut the amount gained from swapping */ function executeExternalSwap( address tokenIn, address tokenOut, uint256 amountIn, ICodec.SwapDescription memory _swap ) internal returns (bool ok, uint256 amtOut) { IERC20(tokenIn).safeIncreaseAllowance(_swap.dex, amountIn); uint256 balBefore = IERC20(tokenOut).balanceOf(address(this)); (ok, ) = _swap.dex.call(_swap.data); if (!ok) { return (false, 0); } uint256 balAfter = IERC20(tokenOut).balanceOf(address(this)); amtOut = balAfter - balBefore; } /** * @notice Executes the swaps with override, redistributes amountIns for each swap route, * decode their return values and sums the returned amount * @dev This function is intended to be used on dst chain only * @param _swaps swaps to execute. this function assumes that the swaps are already sanitized * @param _codecs the codecs for each swap * @param _amountInOverride the amountIn to substitute the amountIns in swaps for * @dev _amountInOverride serves the purpose of correcting the estimated amountIns to actual bridge outs * @dev _amountInOverride is also distributed according to the weight of each original amountIn * @return sumAmtOut the sum of all amounts gained from swapping * @return sumAmtFailed the sum of all amounts that fails to swap */ function executeSwapsWithOverride( ICodec.SwapDescription[] memory _swaps, ICodec[] memory _codecs, // _codecs[i] is for _swaps[i] uint256 _amountInOverride, bool _allowPartialFill ) internal returns (uint256 sumAmtOut, uint256 sumAmtFailed) { (uint256[] memory amountIns, address tokenIn, address tokenOut) = _redistributeAmountIn( _swaps, _amountInOverride, _codecs ); uint256 balBefore = IERC20(tokenOut).balanceOf(address(this)); // execute the swaps with adjusted amountIns for (uint256 i = 0; i < _swaps.length; i++) { bytes memory swapCalldata = _codecs[i].encodeCalldataWithOverride( _swaps[i].data, amountIns[i], address(this) ); IERC20(tokenIn).safeIncreaseAllowance(_swaps[i].dex, amountIns[i]); (bool ok, ) = _swaps[i].dex.call(swapCalldata); require(ok || _allowPartialFill, "swap failed"); if (!ok) { sumAmtFailed += amountIns[i]; } } uint256 balAfter = IERC20(tokenOut).balanceOf(address(this)); sumAmtOut = balAfter - balBefore; require(sumAmtOut > 0, "all swaps failed"); } /// @notice distributes the _amountInOverride to the swaps base on how much each original amountIns weight function _redistributeAmountIn( ICodec.SwapDescription[] memory _swaps, uint256 _amountInOverride, ICodec[] memory _codecs ) private view returns ( uint256[] memory amountIns, address tokenIn, address tokenOut ) { uint256 sumAmtIn; amountIns = new uint256[](_swaps.length); // compute sumAmtIn and collect amountIns for (uint256 i = 0; i < _swaps.length; i++) { uint256 amountIn; (amountIn, tokenIn, tokenOut) = _codecs[i].decodeCalldata(_swaps[i]); sumAmtIn += amountIn; amountIns[i] = amountIn; } // compute adjusted amountIns with regard to the weight of each amountIns in total amountIn for (uint256 i = 0; i < amountIns.length; i++) { amountIns[i] = (_amountInOverride * amountIns[i]) / sumAmtIn; } } // Checks whether a swap is an "externally encoded swap" function isExternalSwap(ICodec.SwapDescription memory _swap) internal view returns (bool ok) { require(dexRegistry[_swap.dex][bytes4(_swap.data)], "unsupported dex"); return externalSwap[_swap.dex]; } function setExternalSwap(address _dex, bool _enabled) external onlyOwner { _setExternalSwap(_dex, _enabled); emit ExternalSwapUpdated(_dex, _enabled); } function _setExternalSwap(address _dex, bool _enabled) private { bool enabled = externalSwap[_dex]; require(enabled != _enabled, "nop"); externalSwap[_dex] = _enabled; } }
// 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); }
// 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); }
// 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); }
// 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); } } } }
// 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); } }
// 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; } }
// 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; }
// 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); }
// 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); }
// 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); }
// 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); }
// 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; }
// 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); }
// 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); } }
// 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); } }
// 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; } }
// 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"); } }
// 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; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.8.15; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @title Manages a list supported dex * @author Padoriku */ abstract contract DexRegistry is Ownable { event SupportedDexUpdated(address dex, bytes4 selector, bool enabled); // supported swap functions // 0x3df02124 exchange(int128,int128,uint256,uint256) // 0xa6417ed6 exchange_underlying(int128,int128,uint256,uint256) // 0x44ee1986 exchange_underlying(int128,int128,uint256,uint256,address) // 0x38ed1739 swapExactTokensForTokens(uint256,uint256,address[],address,uint256) // 0xc04b8d59 exactInput((bytes,address,uint256,uint256,uint256)) // 0xb0431182 clipperSwap(address,address,uint256,uint256) // 0xe449022e uniswapV3Swap(uint256,uint256,uint256[]) // 0x2e95b6c8 unoswap(address,uint256,uint256,bytes32[]) // 0x7c025200 swap(address,(address,address,address,address,uint256,uint256,uint256,bytes),bytes) mapping(address => mapping(bytes4 => bool)) public dexRegistry; constructor(address[] memory _supportedDexList, string[] memory _supportedFuncs) { for (uint256 i = 0; i < _supportedDexList.length; i++) { bytes4 selector = bytes4(keccak256(bytes(_supportedFuncs[i]))); _setSupportedDex(_supportedDexList[i], selector, true); } } function setSupportedDex( address _dex, bytes4 _selector, bool _enabled ) external onlyOwner { _setSupportedDex(_dex, _selector, _enabled); emit SupportedDexUpdated(_dex, _selector, _enabled); } function _setSupportedDex( address _dex, bytes4 _selector, bool _enabled ) private { bool enabled = dexRegistry[_dex][_selector]; require(enabled != _enabled, "nop"); dexRegistry[_dex][_selector] = _enabled; } }
{ "optimizer": { "enabled": true, "runs": 800, "details": { "yul": false } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_messageBus","type":"address"},{"internalType":"address","name":"_nativeWrap","type":"address"},{"internalType":"address","name":"_signer","type":"address"},{"internalType":"address","name":"_feeCollector","type":"address"},{"internalType":"string[]","name":"_funcSigs","type":"string[]"},{"internalType":"address[]","name":"_codecs","type":"address[]"},{"internalType":"address[]","name":"_supportedDexList","type":"address[]"},{"internalType":"string[]","name":"_supportedDexFuncs","type":"string[]"},{"internalType":"address[]","name":"_externalSwapDexList","type":"address[]"},{"internalType":"bool","name":"_testMode","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"address","name":"codec","type":"address"}],"name":"CodecUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"}],"name":"DirectSwap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"dex","type":"address"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"ExternalSwapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"FeeCollectorUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"messageBus","type":"address"}],"name":"MessageBusUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nativeWrap","type":"address"}],"name":"NativeWrapUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"dstAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"refundAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"refundToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeCollected","type":"uint256"},{"indexed":false,"internalType":"enum Types.RequestStatus","name":"status","type":"uint8"},{"indexed":false,"internalType":"bytes","name":"forwardResp","type":"bytes"}],"name":"RequestDone","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"bytes","name":"bridgeResp","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"srcToken","type":"address"},{"indexed":false,"internalType":"address","name":"dstToken","type":"address"},{"indexed":false,"internalType":"address","name":"bridgeOutReceiver","type":"address"},{"indexed":false,"internalType":"address","name":"bridgeToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"bridgeAmount","type":"uint256"},{"indexed":false,"internalType":"string","name":"bridgeProvider","type":"string"}],"name":"RequestSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"SignerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string[]","name":"_bridgeProviders","type":"string[]"},{"indexed":false,"internalType":"address[]","name":"_bridgeAdapters","type":"address[]"}],"name":"SupportedBridgesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"dex","type":"address"},{"indexed":false,"internalType":"bytes4","name":"selector","type":"bytes4"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"SupportedDexUpdated","type":"event"},{"inputs":[],"name":"CBRIDGE_PROVIDER_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"bridges","outputs":[{"internalType":"contract IBridgeAdapter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"codecs","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address","name":"_to","type":"address"}],"name":"collectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"dexRegistry","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_sender","type":"address"},{"internalType":"uint64","name":"_srcChainId","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"}],"name":"executeMessage","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"}],"name":"executeMessageWithTransfer","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferFallback","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferRefund","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"","type":"address"}],"name":"executeMessageWithTransferRefundFromAdapter","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"externalSwap","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeCollector","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageBus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeWrap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"name":"selector2codec","outputs":[{"internalType":"contract ICodec","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_funcSig","type":"string"},{"internalType":"address","name":"_codec","type":"address"}],"name":"setCodec","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dex","type":"address"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setExternalSwap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeCollector","type":"address"}],"name":"setFeeCollector","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_messageBus","type":"address"}],"name":"setMessageBus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nativeWrap","type":"address"}],"name":"setNativeWrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_signer","type":"address"}],"name":"setSigner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_bridgeProviders","type":"string[]"},{"internalType":"address[]","name":"_bridgeAdapters","type":"address[]"}],"name":"setSupportedBridges","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dex","type":"address"},{"internalType":"bytes4","name":"_selector","type":"bytes4"},{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setSupportedDex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"signer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"testMode","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint64","name":"dstChainId","type":"uint64"},{"internalType":"address","name":"dstTransferSwapper","type":"address"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"internalType":"string","name":"bridgeProvider","type":"string"},{"internalType":"bytes","name":"bridgeParams","type":"bytes"},{"internalType":"bool","name":"nativeIn","type":"bool"},{"internalType":"bool","name":"nativeOut","type":"bool"},{"internalType":"uint256","name":"fee","type":"uint256"},{"internalType":"uint256","name":"feeDeadline","type":"uint256"},{"internalType":"bytes","name":"feeSig","type":"bytes"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"bridgeTokenIn","type":"address"},{"internalType":"address","name":"dstTokenOut","type":"address"},{"internalType":"bool","name":"allowPartialFill","type":"bool"},{"internalType":"bytes","name":"forward","type":"bytes"}],"internalType":"struct Types.TransferDescription","name":"_desc","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ICodec.SwapDescription[]","name":"_srcSwaps","type":"tuple[]"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct ICodec.SwapDescription[]","name":"_dstSwaps","type":"tuple[]"}],"name":"transferWithSwap","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60a06040523480156200001157600080fd5b5060405162005ebf38038062005ebf83398101604081905262000034916200076e565b86888787878787828286866200004a33620002c6565b8051825114620000775760405162461bcd60e51b81526004016200006e906200090c565b60405180910390fd5b60005b8251811015620000f05760008382815181106200009b576200009b6200091e565b6020026020010151805190602001209050620000da81848481518110620000c657620000c66200091e565b60200260200101516200031660201b60201c565b5080620000e7816200094a565b9150506200007a565b50505060005b82518110156200016e5760008282815181106200011757620001176200091e565b6020026020010151805190602001209050620001588483815181106200014157620001416200091e565b60200260200101518260016200038860201b60201c565b508062000165816200094a565b915050620000f6565b50505060005b8151811015620001c257620001ad8282815181106200019757620001976200091e565b602002602001015160016200042160201b60201c565b80620001b9816200094a565b91505062000174565b50505050505080600660006101000a8154816001600160a01b0302191690836001600160a01b031602179055505080600760006101000a8154816001600160a01b0302191690836001600160a01b0316021790555050600160088190555089600160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555088600a60006101000a8154816001600160a01b0302191690836001600160a01b0316021790555080600160146101000a81548160ff021916908315150217905550604051806040016040528060078152602001666362726964676560c81b81525080519060200120608081815250505050505050505050505062000994565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff1681151581151503620003df5760405162461bcd60e51b81526004016200006e9062000982565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b6001600160a01b03821660009081526005602052604090205460ff1681151581151503620004635760405162461bcd60e51b81526004016200006e9062000982565b506001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b60006001600160a01b0382165b92915050565b620004ad816200048f565b8114620004b957600080fd5b50565b80516200049c81620004a2565b634e487b7160e01b600052604160045260246000fd5b601f19601f83011681018181106001600160401b0382111715620005075762000507620004c9565b6040525050565b60006200051a60405190565b9050620005288282620004df565b919050565b60006001600160401b03821115620005495762000549620004c9565b5060209081020190565b60006001600160401b038211156200056f576200056f620004c9565b601f19601f83011660200192915050565b60005b838110156200059d57818101518382015260200162000583565b83811115620005ad576000848401525b50505050565b6000620005ca620005c48462000553565b6200050e565b905082815260208101848484011115620005e757620005e7600080fd5b620005f484828562000580565b509392505050565b600082601f830112620006125762000612600080fd5b815162000624848260208601620005b3565b949350505050565b60006200063d620005c4846200052d565b838152905060208082019084028301858111156200065e576200065e600080fd5b835b81811015620006a45780516001600160401b03811115620006845762000684600080fd5b808601620006938982620005fc565b855250506020928301920162000660565b5050509392505050565b600082601f830112620006c457620006c4600080fd5b8151620006248482602086016200062c565b6000620006e7620005c4846200052d565b83815290506020808201908402830185811115620007085762000708600080fd5b835b81811015620006a45780620007208882620004bc565b845250602092830192016200070a565b600082601f830112620007465762000746600080fd5b815162000624848260208601620006d6565b801515620004ad565b80516200049c8162000758565b6000806000806000806000806000806101408b8d031215620007935762000793600080fd5b6000620007a18d8d620004bc565b9a50506020620007b48d828e01620004bc565b9950506040620007c78d828e01620004bc565b9850506060620007da8d828e01620004bc565b97505060808b01516001600160401b03811115620007fb57620007fb600080fd5b620008098d828e01620006ae565b96505060a08b01516001600160401b038111156200082a576200082a600080fd5b620008388d828e0162000730565b95505060c08b01516001600160401b03811115620008595762000859600080fd5b620008678d828e0162000730565b94505060e08b01516001600160401b03811115620008885762000888600080fd5b620008968d828e01620006ae565b9350506101008b01516001600160401b03811115620008b857620008b8600080fd5b620008c68d828e0162000730565b925050610120620008da8d828e0162000761565b9150509295989b9194979a5092959850565b60068152600060208201656c656e206d6d60d01b815291505b5060200190565b602080825281016200049c81620008ec565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019820362000960576200096062000934565b5060010190565b600381526000602082016206e6f760ec1b8152915062000905565b602080825281016200049c8162000967565b608051615501620009be6000396000818161047301528181610aee0152610ffc01526155016000f3fe6080604052600436106101c65760003560e01c8063918ead76116100f7578063c415b95c11610095578063efcfd8f511610064578063efcfd8f514610546578063f2fde38b14610566578063fb45378714610586578063fbf5d7631461059957600080fd5b8063c415b95c146104a2578063c5bccca3146104c2578063cd9ea342146104e2578063eeaaa6511461050357600080fd5b8063a1a227fa116100d1578063a1a227fa1461040e578063a42dce801461042e578063b8cfdc861461044e578063c04049981461046157600080fd5b8063918ead76146103a057806391ec04b5146103c05780639c649fdf146103fb57600080fd5b80635b5a66a711610164578063715018a61161013e578063715018a61461033a5780637cd2bffc1461034f57806382665a8f146103625780638da5cb5b1461038257600080fd5b80635b5a66a7146102da578063675df759146102fa5780636c19e7831461031a57600080fd5b80632aa5fc7b116101a05780632aa5fc7b14610265578063457bfa2f14610287578063547cad12146102a75780635ab7afc6146102c757600080fd5b806309bd2749146101d25780630bcb498214610218578063238ac9331461023857600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506102026101ed366004613249565b60056020526000908152604090205460ff1681565b60405161020f9190613274565b60405180910390f35b61022b6102263660046132de565b6105cf565b60405161020f91906133ab565b34801561024457600080fd5b50600654610258906001600160a01b031681565b60405161020f91906133c2565b34801561027157600080fd5b506102856102803660046133e3565b610658565b005b34801561029357600080fd5b50600a54610258906001600160a01b031681565b3480156102b357600080fd5b506102856102c2366004613249565b6106a7565b61022b6102d5366004613529565b610706565b3480156102e657600080fd5b506102856102f5366004613249565b61081f565b34801561030657600080fd5b506102856103153660046135e9565b610872565b34801561032657600080fd5b50610285610335366004613249565b6108c5565b34801561034657600080fd5b50610285610920565b61022b61035d366004613529565b610934565b34801561036e57600080fd5b5061025861037d366004613639565b610cfd565b34801561038e57600080fd5b506000546001600160a01b0316610258565b3480156103ac57600080fd5b506102856103bb3660046136a5565b610d27565b3480156103cc57600080fd5b506102026103db36600461371e565b600460209081526000928352604080842090915290825290205460ff1681565b61022b610409366004613751565b610e47565b34801561041a57600080fd5b50600154610258906001600160a01b031681565b34801561043a57600080fd5b50610285610449366004613249565b610e8e565b61028561045c3660046137a5565b610ee9565b34801561046d57600080fd5b506104957f000000000000000000000000000000000000000000000000000000000000000081565b60405161020f9190613855565b3480156104ae57600080fd5b50600754610258906001600160a01b031681565b3480156104ce57600080fd5b506102856104dd366004613863565b61125f565b3480156104ee57600080fd5b5060015461020290600160a01b900460ff1681565b34801561050f57600080fd5b5061053961051e366004613639565b6009602052600090815260409020546001600160a01b031681565b60405161020f91906138f6565b34801561055257600080fd5b50610285610561366004613904565b61132b565b34801561057257600080fd5b50610285610581366004613249565b611511565b61022b6105943660046132de565b61154b565b3480156105a557600080fd5b506105396105b4366004613942565b6002602052600090815260409020546001600160a01b031681565b600154600090600160a01b900460ff16610616576001546001600160a01b031633146106165760405162461bcd60e51b815260040161060d9061399a565b60405180910390fd5b6002600854036106385760405162461bcd60e51b815260040161060d906139de565b6002600855610649868686866115cb565b60016008559695505050505050565b61066061165b565b61066a8282611685565b7f1030ebdffe19ed06839890787ae0344a023e8c553e3fa69b7e74564e8c7965f0828260405161069b9291906139ee565b60405180910390a15050565b6106af61165b565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e916106fb916133c2565b60405180910390a150565b600154600090600160a01b900460ff16610744576001546001600160a01b031633146107445760405162461bcd60e51b815260040161060d9061399a565b6002600854036107665760405162461bcd60e51b815260040161060d906139de565b600260085582516000906107839085016020908101908601613cb7565b905061078f87876116f0565b60008160800151876107a19190613d08565b90506107b4888284604001516000611875565b8151608083015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3946108029490939287928f9291600291613d68565b60405180910390a160019250505060016008559695505050505050565b61082761165b565b600a80546001600160a01b0319166001600160a01b0383161790556040517fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d906106fb9083906133c2565b61087a61165b565b6108858383836119a5565b7f5e20184b00709d9f103306958e9fb9d509f78bec1829ca7080f2c43eb2ff21a88383836040516108b893929190613de6565b60405180910390a1505050565b6108cd61165b565b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb9061069b9083908590613e0e565b61092861165b565b6109326000611a3b565b565b600154600090600160a01b900460ff16610972576001546001600160a01b031633146109725760405162461bcd60e51b815260040161060d9061399a565b6002600854036109945760405162461bcd60e51b815260040161060d906139de565b600260085582516000906109b19085016020908101908601613cb7565b90508060800151861015610a235760808101869052805160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c393610a11939092909182918d918d91600191613e29565b60405180910390a16001915050610649565b6080810151610a329087613d08565b95508560006060610a438a846116f0565b6020840151518a9015610ac75760606000610a618760200151611a8b565b90955093509150506001600160a01b03808216908e1614610a945760405162461bcd60e51b815260040161060d90613e85565b610aa88760200151838e8a60a00151611cb9565b90965094508415610ac457610ac48d8689604001516000611875565b50505b60c08501515115610c015760008560c00151806020019051810190610aec9190613ecd565b7f00000000000000000000000000000000000000000000000000000000000000006000908152600960205260409020549091506001600160a01b031680610b455760405162461bcd60e51b815260040161060d90613f3c565b610b596001600160a01b0384168288611ffc565b6000610b6d886000015189604001516120e5565b83516040808b0151602087015191516341a5e1f560e11b81529394506001600160a01b0386169363834bc3ea933493610bb09391928e918c918a90600401613f5c565b60006040518083038185885af1158015610bce573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610bf79190810190613fc3565b9450505050610c99565b3415610c85576000876001600160a01b031634604051610c2090613ffe565b60006040518083038185875af1925050503d8060008114610c5d576040519150601f19603f3d011682016040523d82523d6000602084013e610c62565b606091505b5050905080610c835760405162461bcd60e51b815260040161060d9061403d565b505b610c99818587604001518860600151611875565b507ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3846000015184848d8860800151600187604051610cde979695949392919061404d565b60405180910390a1600194505050505060016008559695505050505050565b60038181548110610d0d57600080fd5b6000918252602090912001546001600160a01b0316905081565b610d2f61165b565b828114610d4e5760405162461bcd60e51b815260040161060d9061409c565b60005b83811015610e0357828282818110610d6b57610d6b6140ac565b9050602002016020810190610d809190613249565b60096000878785818110610d9657610d966140ac565b9050602002810190610da891906140c2565b604051610db692919061412c565b6040518091039020815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610dfb90614139565b915050610d51565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9684848484604051610e39949392919061429f565b60405180910390a150505050565b600154600090600160a01b900460ff16610e85576001546001600160a01b03163314610e855760405162461bcd60e51b815260040161060d9061399a565b95945050505050565b610e9661165b565b600780546001600160a01b038381166001600160a01b03198316179092556040519116907f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f389061069b9083908590613e0e565b600260085403610f0b5760405162461bcd60e51b815260040161060d906139de565b600260085582151580610f41575067ffffffffffffffff4616610f3460408701602088016142d0565b67ffffffffffffffff1614155b610f5d5760405162461bcd60e51b815260040161060d9061430b565b82151580610f95575061016085013515801590610f9557506000610f896101a087016101808801613249565b6001600160a01b031614155b610fb15760405162461bcd60e51b815260040161060d9061430b565b6000610fc060808701876140c2565b604051610fce92919061412c565b604051908190039020905081158015610ff45750610ff06102008701876140c2565b1590505b8061101e57507f000000000000000000000000000000000000000000000000000000000000000081145b61103a5760405162461bcd60e51b815260040161060d9061434f565b600081815260096020908152604091829020546001600160a01b03169167ffffffffffffffff461691611071918a01908a016142d0565b67ffffffffffffffff16148061108f57506001600160a01b03811615155b6110ab5760405162461bcd60e51b815260040161060d90614393565b610160870135606060006110c76101a08b016101808c01613249565b905060006110dd6101c08c016101a08d01613249565b9050881561113c5761111b8a8a60008181106110fb576110fb6140ac565b905060200281019061110d91906143a3565b61111690614420565b612156565b61113c5761113161112c8a8c61449a565b611a8b565b929650919450925090505b61114c60e08c0160c08d016144a7565b1561120c57600a546001600160a01b0383811691161461117e5760405162461bcd60e51b815260040161060d906144fc565b8334101561119e5760405162461bcd60e51b815260040161060d90614540565b600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156111ee57600080fd5b505af1158015611202573d6000803e3d6000fd5b5050505050611221565b6112216001600160a01b0383163330876121da565b61124d8282866112308f614746565b8e8e9061123d919061449a565b6112478d8f61449a565b896121fb565b50506001600855505050505050505050565b61126761165b565b6000838360405161127992919061412c565b604051809103902090506112fa81836001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b7f58ddcdb40971f55ad1b6a8a28067274a4ffc7e9d77c3ea14a17652faa705e1978183604051610e39929190614752565b6007546001600160a01b031633146113555760405162461bcd60e51b815260040161060d90614794565b60005b8281101561150b576000848483818110611374576113746140ac565b90506020020160208101906113899190613249565b6001600160a01b0316036114245760004790506000836001600160a01b03168261c350906040516113b990613ffe565b600060405180830381858888f193505050503d80600081146113f7576040519150601f19603f3d011682016040523d82523d6000602084013e6113fc565b606091505b505090508061141d5760405162461bcd60e51b815260040161060d906147d8565b50506114f9565b6000848483818110611438576114386140ac565b905060200201602081019061144d9190613249565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161147891906133c2565b602060405180830381865afa158015611495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b991906147e8565b90506114f783828787868181106114d2576114d26140ac565b90506020020160208101906114e79190613249565b6001600160a01b03169190612335565b505b8061150381614139565b915050611358565b50505050565b61151961165b565b6001600160a01b03811661153f5760405162461bcd60e51b815260040161060d90614866565b61154881611a3b565b50565b600060026008540361156f5760405162461bcd60e51b815260040161060d906139de565b6002600855600a546001600160a01b038781169116146115a35761159e6001600160a01b0387163330886121da565b6115c3565b843410156115c35760405162461bcd60e51b815260040161060d906148aa565b610649868686865b6000806115da838501856149b6565b90506115e686866116f0565b6115f7868683604001516000611875565b8051608082015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c394611645949093928b928d9291600291613d68565b60405180910390a160019150505b949350505050565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161060d90614a23565b6001600160a01b03821660009081526005602052604090205460ff16811515811515036116c45760405162461bcd60e51b815260040161060d9061430b565b506001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b600a546001600160a01b039081169083160361187157600154604080516320a6037160e21b815290516000926001600160a01b0316916382980dc49160048083019260209291908290030181865afa158015611750573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117749190614a33565b9050600a60009054906101000a90046001600160a01b03166001600160a01b0316816001600160a01b031663457bfa2f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f79190614a33565b6001600160a01b03160361186f57600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561185557600080fd5b505af1158015611869573d6000803e3d6000fd5b50505050505b505b5050565b801561199157600a546001600160a01b038581169116146118a85760405162461bcd60e51b815260040161060d90614a88565b600a54604051632e1a7d4d60e01b81526001600160a01b0390911690632e1a7d4d906118d8908690600401613855565b600060405180830381600087803b1580156118f257600080fd5b505af1158015611906573d6000803e3d6000fd5b505050506000826001600160a01b03168461c3509060405161192790613ffe565b600060405180830381858888f193505050503d8060008114611965576040519150601f19603f3d011682016040523d82523d6000602084013e61196a565b606091505b505090508061198b5760405162461bcd60e51b815260040161060d9061403d565b5061150b565b61150b6001600160a01b0385168385612335565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff16811515811515036119f95760405162461bcd60e51b815260040161060d9061430b565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006060600080611a9e87612354565b925060005b8751811015611caf5760046000898381518110611ac257611ac26140ac565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000206000898381518110611b0257611b026140ac565b602002602001015160200151611b1790614aac565b6001600160e01b031916815260208101919091526040016000205460ff16611b515760405162461bcd60e51b815260040161060d90614b25565b6000806000868481518110611b6857611b686140ac565b60200260200101516001600160a01b031663358f0e1c8c8681518110611b9057611b906140ac565b60200260200101516040518263ffffffff1660e01b8152600401611bb49190614b61565b606060405180830381865afa158015611bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf59190614b72565b919450925090506001600160a01b0386161580611c235750816001600160a01b0316866001600160a01b0316145b611c3f5760405162461bcd60e51b815260040161060d90614bec565b90945084906001600160a01b0385161580611c6b5750806001600160a01b0316856001600160a01b0316145b611c875760405162461bcd60e51b815260040161060d90614c30565b935083611c94838b614c40565b99509097509550819050611ca781614139565b915050611aa3565b5050509193509193565b6000806000806000611ccc89888a612493565b9250925092506000816001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611d0091906133c2565b602060405180830381865afa158015611d1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4191906147e8565b905060005b8a51811015611f4f5760008a8281518110611d6357611d636140ac565b60200260200101516001600160a01b0316634c6da2698d8481518110611d8b57611d8b6140ac565b602002602001015160200151888581518110611da957611da96140ac565b6020026020010151306040518463ffffffff1660e01b8152600401611dd093929190614c58565b600060405180830381865afa158015611ded573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e159190810190613fc3565b9050611e6b8c8381518110611e2c57611e2c6140ac565b602002602001015160000151878481518110611e4a57611e4a6140ac565b6020026020010151876001600160a01b0316611ffc9092919063ffffffff16565b60008c8381518110611e7f57611e7f6140ac565b6020026020010151600001516001600160a01b031682604051611ea29190614ca7565b6000604051808303816000865af19150503d8060008114611edf576040519150601f19603f3d011682016040523d82523d6000602084013e611ee4565b606091505b505090508080611ef15750895b611f0d5760405162461bcd60e51b815260040161060d90614ce7565b80611f3a57868381518110611f2457611f246140ac565b602002602001015188611f379190614c40565b97505b50508080611f4790614139565b915050611d46565b506040516370a0823160e01b81526000906001600160a01b038416906370a0823190611f7f9030906004016133c2565b602060405180830381865afa158015611f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc091906147e8565b9050611fcc8282613d08565b965060008711611fee5760405162461bcd60e51b815260040161060d90614d2b565b505050505094509492505050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b815260040161202d929190613e0e565b602060405180830381865afa15801561204a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206e91906147e8565b6120789190614c40565b905061150b8463095ea7b360e01b8584604051602401612099929190614d3b565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612648565b60608060606040518060e00160405280868152602001838152602001856001600160a01b03168152602001600015158152602001600081526020016000151581526020018281525060405160200161213d9190614e4d565b6040516020818303038152906040529250505092915050565b80516001600160a01b03166000908152600460209081526040822090830151829061218090614aac565b6001600160e01b031916815260208101919091526040016000205460ff166121ba5760405162461bcd60e51b815260040161060d90614b25565b50516001600160a01b031660009081526005602052604090205460ff1690565b61150b846323b872dd60e01b85858560405160240161209993929190614e5e565b825185901561228b5760006122298560008151811061221c5761221c6140ac565b6020026020010151612156565b1561225d5761225489898988600081518110612247576122476140ac565b60200260200101516126d7565b9250905061226c565b6122678584612869565b925090505b806122895760405162461bcd60e51b815260040161060d90614eba565b505b600061229f86600001518760600151612bb3565b90504667ffffffffffffffff16866020015167ffffffffffffffff160361231a577f0e248ac8be20725176a5f0ab093c5fbb964634d4675012f3d3ad66e69e56d5b781888b858c6040516122f7959493929190614eca565b60405180910390a1612313888388600001518960e00151611875565b505061232c565b612329818a8a89888c88612beb565b50505b50505050505050565b61186f8363a9059cbb60e01b8484604051602401612099929190614d3b565b60606000825167ffffffffffffffff8111156123725761237261343b565b60405190808252806020026020018201604052801561239b578160200160208202803683370190505b50905060005b835181101561248c5760008482815181106123be576123be6140ac565b6020026020010151602001516123d390614aac565b6001600160e01b0319811660009081526002602052604090205484519192506001600160a01b03169084908490811061240e5761240e6140ac565b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b031683838151811061244b5761244b6140ac565b60200260200101516001600160a01b0316036124795760405162461bcd60e51b815260040161060d90614f40565b508061248481614139565b9150506123a1565b5092915050565b60606000806000865167ffffffffffffffff8111156124b4576124b461343b565b6040519080825280602002602001820160405280156124dd578160200160208202803683370190505b50935060005b87518110156125d1576000868281518110612500576125006140ac565b60200260200101516001600160a01b031663358f0e1c8a8481518110612528576125286140ac565b60200260200101516040518263ffffffff1660e01b815260040161254c9190614b61565b606060405180830381865afa158015612569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258d9190614b72565b9096509450905061259e8184614c40565b9250808683815181106125b3576125b36140ac565b602090810291909101015250806125c981614139565b9150506124e3565b5060005b845181101561263d57818582815181106125f1576125f16140ac565b6020026020010151886126049190614f50565b61260e9190614f85565b858281518110612620576126206140ac565b60209081029190910101528061263581614139565b9150506125d5565b505093509350939050565b600061269d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d6b9092919063ffffffff16565b80519091501561186f57808060200190518101906126bb9190614f99565b61186f5760405162461bcd60e51b815260040161060d90615014565b805160009081906126f3906001600160a01b0388169086611ffc565b6040516370a0823160e01b81526000906001600160a01b038716906370a08231906127229030906004016133c2565b602060405180830381865afa15801561273f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276391906147e8565b905083600001516001600160a01b031684602001516040516127859190614ca7565b6000604051808303816000865af19150503d80600081146127c2576040519150601f19603f3d011682016040523d82523d6000602084013e6127c7565b606091505b505080935050826127df576000809250925050612860565b6040516370a0823160e01b81526000906001600160a01b038816906370a082319061280e9030906004016133c2565b602060405180830381865afa15801561282b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284f91906147e8565b905061285b8282613d08565b925050505b94509492505050565b60008060005b8451811015612baa57600080600086848151811061288f5761288f6140ac565b60200260200101516001600160a01b031663358f0e1c8986815181106128b7576128b76140ac565b60200260200101516040518263ffffffff1660e01b81526004016128db9190614b61565b606060405180830381865afa1580156128f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291c9190614b72565b9250925092506000878581518110612936576129366140ac565b60200260200101516001600160a01b0316634c6da2698a878151811061295e5761295e6140ac565b60200260200101516020015186306040518463ffffffff1660e01b815260040161298a93929190614c58565b600060405180830381865afa1580156129a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129cf9190810190613fc3565b9050612a038986815181106129e6576129e66140ac565b6020908102919091010151516001600160a01b0385169086611ffc565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190612a329030906004016133c2565b602060405180830381865afa158015612a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7391906147e8565b9050898681518110612a8757612a876140ac565b6020026020010151600001516001600160a01b031682604051612aaa9190614ca7565b6000604051808303816000865af19150503d8060008114612ae7576040519150601f19603f3d011682016040523d82523d6000602084013e612aec565b606091505b50508098505087612b095760008097509750505050505050612bac565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612b389030906004016133c2565b602060405180830381865afa158015612b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b7991906147e8565b9050612b858282613d08565b612b8f9089614c40565b97505050505050508080612ba290614139565b91505061286f565b505b9250929050565b600033834684604051602001612bcc949392919061506b565b6040516020818303038152906040528051906020012090505b92915050565b60008084511180612c025750600085610200015151115b612c0d578451612c13565b84604001515b90506060612c2286858a612d84565b60c0860151349015612c3b57612c388534613d08565b90505b608087015180516020918201206000908152600990915260409020546001600160a01b0390811690612c70908a168287611ffc565b6000612c7d8c8a8a612e0e565b9050816001600160a01b031663834bc3ea848b60200151888a8f8f60a00151886040518863ffffffff1660e01b8152600401612cbe96959493929190613f5c565b60006040518083038185885af1158015612cdc573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612d059190810190613fc3565b93505050507f082e2f634ceec1af5105aa53f234b7efad94428a54a714e3b7c7115ee549308089828860200151878c8b6101c00151888e8b8f60800151604051612d589a999897969594939291906150b3565b60405180910390a1505050505050505050565b6060612d7a8484600085612e8f565b90505b9392505050565b60004684602001518484876101200151886101000151604051602001612daf96959493929190615155565b6040516020818303038152906040528051906020012090506000612dd282612f51565b9050612de381866101400151612f81565b4285610120015111612e075760405162461bcd60e51b815260040161060d90615219565b5050505050565b60606040518060e0016040528085815260200183815260200184600001516001600160a01b031681526020018460e00151151581526020018461010001518152602001846101e0015115158152602001846102000151815250604051602001612e779190614e4d565b60405160208183030381529060405290509392505050565b606082471015612eb15760405162461bcd60e51b815260040161060d90615283565b6001600160a01b0385163b612ed85760405162461bcd60e51b815260040161060d906152c7565b600080866001600160a01b03168587604051612ef49190614ca7565b60006040518083038185875af1925050503d8060008114612f31576040519150601f19603f3d011682016040523d82523d6000602084013e612f36565b606091505b5091509150612f46828286612fbd565b979650505050505050565b600081604051602001612f6491906152d7565b604051602081830303815290604052805190602001209050919050565b6000612f8d8383612ff6565b6006549091506001600160a01b0380831691161461186f5760405162461bcd60e51b815260040161060d90615346565b60608315612fcc575081612d7d565b825115612fdc5782518084602001fd5b8160405162461bcd60e51b815260040161060d9190615356565b6000806000613005858561301a565b915091506130128161305c565b509392505050565b60008082516041036130505760208301516040840151606085015160001a6130448782858561313c565b94509450505050612bac565b50600090506002612bac565b600081600481111561307057613070613362565b036130785750565b600181600481111561308c5761308c613362565b036130a95760405162461bcd60e51b815260040161060d9061539b565b60028160048111156130bd576130bd613362565b036130da5760405162461bcd60e51b815260040161060d906153df565b60038160048111156130ee576130ee613362565b0361310b5760405162461bcd60e51b815260040161060d9061542e565b600481600481111561311f5761311f613362565b036115485760405162461bcd60e51b815260040161060d9061547d565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131735750600090506003612860565b8460ff16601b1415801561318b57508460ff16601c14155b1561319c5750600090506004612860565b6000600187878787604051600081526020016040526040516131c19493929190615496565b6020604051602081039080840390855afa1580156131e3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661320c57600060019250925050612860565b9660009650945050505050565b60006001600160a01b038216612be5565b61323381613219565b811461154857600080fd5b8035612be58161322a565b60006020828403121561325e5761325e600080fd5b6000611653848461323e565b8015155b82525050565b60208101612be5828461326a565b80613233565b8035612be581613282565b60008083601f8401126132a8576132a8600080fd5b50813567ffffffffffffffff8111156132c3576132c3600080fd5b602083019150836001820283011115612bac57612bac600080fd5b6000806000806000608086880312156132f9576132f9600080fd5b6000613305888861323e565b955050602061331688828901613288565b945050604086013567ffffffffffffffff81111561333657613336600080fd5b61334288828901613293565b935093505060606133558882890161323e565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b6003811061154857611548613362565b8061339281613378565b919050565b6000612be582613388565b61326e81613397565b60208101612be582846133a2565b61326e81613219565b60208101612be582846133b9565b801515613233565b8035612be5816133d0565b600080604083850312156133f9576133f9600080fd5b6000613405858561323e565b9250506020613416858286016133d8565b9150509250929050565b67ffffffffffffffff8116613233565b8035612be581613420565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156134775761347761343b565b6040525050565b600061348960405190565b90506133928282613451565b600067ffffffffffffffff8211156134af576134af61343b565b601f19601f83011660200192915050565b82818337506000910152565b60006134df6134da84613495565b61347e565b9050828152602081018484840111156134fa576134fa600080fd5b6130128482856134c0565b600082601f83011261351957613519600080fd5b81356116538482602086016134cc565b60008060008060008060c0878903121561354557613545600080fd5b6000613551898961323e565b965050602061356289828a0161323e565b955050604061357389828a01613288565b945050606061358489828a01613430565b935050608087013567ffffffffffffffff8111156135a4576135a4600080fd5b6135b089828a01613505565b92505060a06135c189828a0161323e565b9150509295509295509295565b6001600160e01b03198116613233565b8035612be5816135ce565b60008060006060848603121561360157613601600080fd5b600061360d868661323e565b935050602061361e868287016135de565b925050604061362f868287016133d8565b9150509250925092565b60006020828403121561364e5761364e600080fd5b60006116538484613288565b60008083601f84011261366f5761366f600080fd5b50813567ffffffffffffffff81111561368a5761368a600080fd5b602083019150836020820283011115612bac57612bac600080fd5b600080600080604085870312156136be576136be600080fd5b843567ffffffffffffffff8111156136d8576136d8600080fd5b6136e48782880161365a565b9450945050602085013567ffffffffffffffff81111561370657613706600080fd5b6137128782880161365a565b95989497509550505050565b6000806040838503121561373457613734600080fd5b6000613740858561323e565b9250506020613416858286016135de565b60008060008060006080868803121561376c5761376c600080fd5b6000613778888861323e565b955050602061331688828901613430565b6000610220828403121561379f5761379f600080fd5b50919050565b6000806000806000606086880312156137c0576137c0600080fd5b853567ffffffffffffffff8111156137da576137da600080fd5b6137e688828901613789565b955050602086013567ffffffffffffffff81111561380657613806600080fd5b6138128882890161365a565b9450945050604086013567ffffffffffffffff81111561383457613834600080fd5b6138408882890161365a565b92509250509295509295909350565b8061326e565b60208101612be5828461384f565b60008060006040848603121561387b5761387b600080fd5b833567ffffffffffffffff81111561389557613895600080fd5b6138a186828701613293565b9350935050602061362f8682870161323e565b6000612be56001600160a01b0383166138cb565b90565b6001600160a01b031690565b6000612be5826138b4565b6000612be5826138d7565b61326e816138e2565b60208101612be582846138ed565b60008060006040848603121561391c5761391c600080fd5b833567ffffffffffffffff81111561393657613936600080fd5b6138a18682870161365a565b60006020828403121561395757613957600080fd5b600061165384846135de565b601981526000602082017f63616c6c6572206973206e6f74206d6573736167652062757300000000000000815291505b5060200190565b60208082528101612be581613963565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081529150613993565b60208082528101612be5816139aa565b604081016139fc82856133b9565b612d7d602083018461326a565b8051612be581613282565b600067ffffffffffffffff821115613a2e57613a2e61343b565b5060209081020190565b8051612be58161322a565b60005b83811015613a5e578181015183820152602001613a46565b8381111561150b5750506000910152565b6000613a7d6134da84613495565b905082815260208101848484011115613a9857613a98600080fd5b613012848285613a43565b600082601f830112613ab757613ab7600080fd5b8151611653848260208601613a6f565b600060408284031215613adc57613adc600080fd5b613ae6604061347e565b90506000613af48484613a38565b825250602082015167ffffffffffffffff811115613b1457613b14600080fd5b613b2084828501613aa3565b60208301525092915050565b6000613b3a6134da84613a14565b83815290506020808201908402830185811115613b5957613b59600080fd5b835b81811015613b9a57805167ffffffffffffffff811115613b7d57613b7d600080fd5b808601613b8a8982613ac7565b8552505060209283019201613b5b565b5050509392505050565b600082601f830112613bb857613bb8600080fd5b8151611653848260208601613b2c565b8051612be5816133d0565b600060e08284031215613be857613be8600080fd5b613bf260e061347e565b90506000613c008484613a09565b825250602082015167ffffffffffffffff811115613c2057613c20600080fd5b613c2c84828501613ba4565b6020830152506040613c4084828501613a38565b6040830152506060613c5484828501613bc8565b6060830152506080613c6884828501613a09565b60808301525060a0613c7c84828501613bc8565b60a08301525060c082015167ffffffffffffffff811115613c9f57613c9f600080fd5b613cab84828501613aa3565b60c08301525092915050565b600060208284031215613ccc57613ccc600080fd5b815167ffffffffffffffff811115613ce657613ce6600080fd5b61165384828501613bd3565b634e487b7160e01b600052601160045260246000fd5b600082821015613d1a57613d1a613cf2565b500390565b6000612be56138c88381565b61326e81613d1f565b6000613d3e825190565b808452602084019350613d55818560208601613a43565b601f19601f8201165b9093019392505050565b60e08101613d76828a61384f565b613d836020830189613d2b565b613d90604083018861384f565b613d9d60608301876133b9565b613daa608083018661384f565b613db760a08301856133a2565b81810360c0830152613dc98184613d34565b9998505050505050505050565b6001600160e01b0319811661326e565b60608101613df482866133b9565b613e016020830185613dd6565b611653604083018461326a565b60408101613e1c82856133b9565b612d7d60208301846133b9565b60e08101613e37828a61384f565b613e446020830189613d2b565b613d906040830188613d2b565b600781526000602082017f746b696e206d6d0000000000000000000000000000000000000000000000000081529150613993565b60208082528101612be581613e51565b8051612be581613420565b600060408284031215613eb557613eb5600080fd5b613ebf604061347e565b90506000613af48484613e95565b600060208284031215613ee257613ee2600080fd5b815167ffffffffffffffff811115613efc57613efc600080fd5b61165384828501613ea0565b600f81526000602082017f63627269646765206e6f7420736574000000000000000000000000000000000081529150613993565b60208082528101612be581613f08565b67ffffffffffffffff811661326e565b60c08101613f6a8289613f4c565b613f7760208301886133b9565b613f84604083018761384f565b613f9160608301866133b9565b8181036080830152613fa38185613d34565b905081810360a0830152613fb78184613d34565b98975050505050505050565b600060208284031215613fd857613fd8600080fd5b815167ffffffffffffffff811115613ff257613ff2600080fd5b61165384828501613aa3565b6000612be5826138c8565b600981526000602082017f73656e64206661696c000000000000000000000000000000000000000000000081529150613993565b60208082528101612be581614009565b60e0810161405b828a61384f565b613d83602083018961384f565b601481526000602082017f706172616d732073697a65206d69736d6174636800000000000000000000000081529150613993565b60208082528101612be581614068565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19368590030181126140dd576140dd600080fd5b80840192508235915067ffffffffffffffff8211156140fe576140fe600080fd5b602083019250600182023603831315612baa57612baa600080fd5b60006141268385846134c0565b50500190565b6000611653828486614119565b6000600019820361414c5761414c613cf2565b5060010190565b81835260006020840193506141698385846134c0565b601f19601f840116613d5e565b6000612d7a848484614153565b6000808335601e193685900301811261419e5761419e600080fd5b83810160208101935035915067ffffffffffffffff8211156141c2576141c2600080fd5b36829003831315612baa57612baa600080fd5b818352600060208401935083602084028101838060005b878110156142275784840389526142038284614183565b61420e868284614176565b95506020840160209b909b019a935050506001016141ec565b5091979650505050505050565b600061424083836133b9565b505060200190565b6000612d7d602084018461323e565b8183526000602084019350818060005b85811015614294576142798284614248565b6142838882614234565b975060208301925050600101614267565b509495945050505050565b604080825281016142b18186886141d5565b905081810360208301526142c6818486614257565b9695505050505050565b6000602082840312156142e5576142e5600080fd5b60006116538484613430565b600381526000602082016206e6f760ec1b81529150613993565b60208082528101612be5816142f1565b601b81526000602082017f62726964676520646f6573206e6f7420737570706f7274206d7367000000000081529150613993565b60208082528101612be58161431b565b601281526000602082017f756e737570706f7274656420627269646765000000000000000000000000000081529150613993565b60208082528101612be58161435f565b60008235603e19368490030181126143bd576143bd600080fd5b9190910192915050565b6000604082840312156143dc576143dc600080fd5b6143e6604061347e565b905060006143f4848461323e565b825250602082013567ffffffffffffffff81111561441457614414600080fd5b613b2084828501613505565b6000612be536836143c7565b600061443a6134da84613a14565b8381529050602080820190840283018581111561445957614459600080fd5b835b81811015613b9a57803567ffffffffffffffff81111561447d5761447d600080fd5b80860161448a89826143c7565b855250506020928301920161445b565b6000612d7d36848461442c565b6000602082840312156144bc576144bc600080fd5b600061165384846133d8565b601281526000602082017f746b696e206e6f206e617469766557726170000000000000000000000000000081529150613993565b60208082528101612be5816144c8565b600b81526000602082017f696e7366636e7420616d7400000000000000000000000000000000000000000081529150613993565b60208082528101612be58161450c565b6000610220828403121561456657614566600080fd5b61457161022061347e565b9050600061457f848461323e565b825250602061459084848301613430565b60208301525060406145a48482850161323e565b60408301525060606145b884828501613430565b606083015250608082013567ffffffffffffffff8111156145db576145db600080fd5b6145e784828501613505565b60808301525060a082013567ffffffffffffffff81111561460a5761460a600080fd5b61461684828501613505565b60a08301525060c061462a848285016133d8565b60c08301525060e061463e848285016133d8565b60e08301525061010061465384828501613288565b6101008301525061012061466984828501613288565b6101208301525061014082013567ffffffffffffffff81111561468e5761468e600080fd5b61469a84828501613505565b610140830152506101606146b084828501613288565b610160830152506101806146c68482850161323e565b610180830152506101a06146dc8482850161323e565b6101a0830152506101c06146f28482850161323e565b6101c0830152506101e0614708848285016133d8565b6101e08301525061020082013567ffffffffffffffff81111561472d5761472d600080fd5b61473984828501613505565b6102008301525092915050565b6000612be53683614550565b60408101613e1c8285613dd6565b601181526000602082017f6e6f742066656520636f6c6c6563746f7200000000000000000000000000000081529150613993565b60208082528101612be581614760565b601281526000602082017f73656e64206e6174697665206661696c6564000000000000000000000000000081529150613993565b60208082528101612be5816147a4565b6000602082840312156147fd576147fd600080fd5b60006116538484613a09565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015291505b5060400190565b60208082528101612be581614809565b601881526000602082017f6e6f206e6174697665207472616e7366657272656420696e000000000000000081529150613993565b60208082528101612be581614876565b600082601f8301126148ce576148ce600080fd5b813561165384826020860161442c565b600060e082840312156148f3576148f3600080fd5b6148fd60e061347e565b9050600061490b8484613288565b825250602082013567ffffffffffffffff81111561492b5761492b600080fd5b614937848285016148ba565b602083015250604061494b8482850161323e565b604083015250606061495f848285016133d8565b606083015250608061497384828501613288565b60808301525060a0614987848285016133d8565b60a08301525060c082013567ffffffffffffffff8111156149aa576149aa600080fd5b613cab84828501613505565b6000602082840312156149cb576149cb600080fd5b813567ffffffffffffffff8111156149e5576149e5600080fd5b611653848285016148de565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657291019081526000613993565b60208082528101612be5816149f1565b600060208284031215614a4857614a48600080fd5b60006116538484613a38565b600c81526000602082017f746b206e6f206e6174697665000000000000000000000000000000000000000081529150613993565b60208082528101612be581614a54565b6000612be582516001600160e01b03191690565b6000614ab6825190565b60208301614ac381614a98565b92506004821015614aea57614ae56001600160e01b0319836004036008021b90565b831692505b5050919050565b600f81526000602082017f756e737570706f7274656420646578000000000000000000000000000000000081529150613993565b60208082528101612be581614af1565b80516000906040840190614b4985826133b9565b5060208301518482036020860152610e858282613d34565b60208082528101612d7d8184614b35565b600080600060608486031215614b8a57614b8a600080fd5b6000614b968686613a09565b9350506020614ba786828701613a38565b925050604061362f86828701613a38565b600d81526000602082017f746b696e206d69736d617463680000000000000000000000000000000000000081529150613993565b60208082528101612be581614bb8565b600c81526000602082017f746b6f206d69736d61746368000000000000000000000000000000000000000081529150613993565b60208082528101612be581614bfc565b60008219821115614c5357614c53613cf2565b500190565b60608082528101614c698186613d34565b9050614c78602083018561384f565b61165360408301846133b9565b6000614c8f825190565b614c9d818560208601613a43565b9290920192915050565b6000612d7d8284614c85565b600b81526000602082017f73776170206661696c656400000000000000000000000000000000000000000081529150613993565b60208082528101612be581614cb3565b601081526000602082017f616c6c207377617073206661696c65640000000000000000000000000000000081529150613993565b60208082528101612be581614cf7565b60408101614d4982856133b9565b612d7d602083018461384f565b6000612d7d8383614b35565b6000614d6c825190565b80845260208401935083602082028501614d868560200190565b8060005b858110156142275784840389528151614da38582614d56565b94506020830160209a909a0199925050600101614d8a565b805160009060e0840190614dcf858261384f565b5060208301518482036020860152614de78282614d62565b9150506040830151614dfc60408601826133b9565b506060830151614e0f606086018261326a565b506080830151614e22608086018261384f565b5060a0830151614e3560a086018261326a565b5060c083015184820360c0860152610e858282613d34565b60208082528101612d7d8184614dbb565b60608101614e6c82866133b9565b614e7960208301856133b9565b611653604083018461384f565b600981526000602082017f73776170206661696c000000000000000000000000000000000000000000000081529150613993565b60208082528101612be581614e86565b60a08101614ed8828861384f565b614ee5602083018761384f565b614ef260408301866133b9565b614eff606083018561384f565b6142c660808301846133b9565b600c81526000602082017f636463206e6f20666f756e64000000000000000000000000000000000000000081529150613993565b60208082528101612be581614f0c565b6000816000190483118215151615614f6a57614f6a613cf2565b500290565b634e487b7160e01b600052601260045260246000fd5b600082614f9457614f94614f6f565b500490565b600060208284031215614fae57614fae600080fd5b60006116538484613bc8565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f742073756363656564000000000000000000000000000000000000000000006020820152915061485f565b60208082528101612be581614fba565b6000612be58260601b90565b6000612be582615024565b61326e61504782613219565b615030565b6000612be58260c01b90565b61326e67ffffffffffffffff821661504c565b6000615077828761503b565b601482019150615087828661503b565b6014820191506150978285615058565b6008820191506150a78284615058565b50600801949350505050565b61014081016150c2828d61384f565b81810360208301526150d4818c613d34565b90506150e3604083018b613f4c565b6150f0606083018a61384f565b6150fd60808301896133b9565b61510a60a08301886133b9565b61511760c08301876133b9565b61512460e08301866133b9565b61513261010083018561384f565b8181036101208301526151458184613d34565b9c9b505050505050505050505050565b7f6578656375746f722066656500000000000000000000000000000000000000008152600c0160006151878289615058565b6008820191506151978288615058565b6008820191506151a7828761384f565b6020820191506151b7828661503b565b6014820191506151c7828561384f565b6020820191506151d7828461384f565b506020019695505050505050565b601181526000602082017f646561646c696e6520657863656564656400000000000000000000000000000081529150613993565b60208082528101612be5816151e5565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f81527f722063616c6c00000000000000000000000000000000000000000000000000006020820152915061485f565b60208082528101612be581615229565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081529150613993565b60208082528101612be581615293565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c016000615309828461384f565b50602001919050565b600e81526000602082017f696e76616c6964207369676e657200000000000000000000000000000000000081529150613993565b60208082528101612be581615312565b60208082528101612d7d8184613d34565b601881526000602082017f45434453413a20696e76616c6964207369676e6174757265000000000000000081529150613993565b60208082528101612be581615367565b601f81526000602082017f45434453413a20696e76616c6964207369676e6174757265206c656e6774680081529150613993565b60208082528101612be5816153ab565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202773272076616c815261756560f01b6020820152915061485f565b60208082528101612be5816153ef565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202776272076616c815261756560f01b6020820152915061485f565b60208082528101612be58161543e565b60ff811661326e565b608081016154a4828761384f565b6154b1602083018661548d565b6154be604083018561384f565b610e85606083018461384f56fea26469706673582212204c7ec5e04a8a928da0779c2cadac91769a13903936a73c237e44db76ac1e388364736f6c634300080f00330000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d000000000000000000000000420000000000000000000000000000000000000600000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e74323536292900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000056b2ffd01cd39ee34d62b328e07e2cef79a13cf60000000000000000000000000000000000000000000000000000000000000005000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd199000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e7432353629290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000537377617028616464726573732c28616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e743235362c75696e743235362c6279746573292c62797465732900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d2900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Deployed Bytecode
0x6080604052600436106101c65760003560e01c8063918ead76116100f7578063c415b95c11610095578063efcfd8f511610064578063efcfd8f514610546578063f2fde38b14610566578063fb45378714610586578063fbf5d7631461059957600080fd5b8063c415b95c146104a2578063c5bccca3146104c2578063cd9ea342146104e2578063eeaaa6511461050357600080fd5b8063a1a227fa116100d1578063a1a227fa1461040e578063a42dce801461042e578063b8cfdc861461044e578063c04049981461046157600080fd5b8063918ead76146103a057806391ec04b5146103c05780639c649fdf146103fb57600080fd5b80635b5a66a711610164578063715018a61161013e578063715018a61461033a5780637cd2bffc1461034f57806382665a8f146103625780638da5cb5b1461038257600080fd5b80635b5a66a7146102da578063675df759146102fa5780636c19e7831461031a57600080fd5b80632aa5fc7b116101a05780632aa5fc7b14610265578063457bfa2f14610287578063547cad12146102a75780635ab7afc6146102c757600080fd5b806309bd2749146101d25780630bcb498214610218578063238ac9331461023857600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506102026101ed366004613249565b60056020526000908152604090205460ff1681565b60405161020f9190613274565b60405180910390f35b61022b6102263660046132de565b6105cf565b60405161020f91906133ab565b34801561024457600080fd5b50600654610258906001600160a01b031681565b60405161020f91906133c2565b34801561027157600080fd5b506102856102803660046133e3565b610658565b005b34801561029357600080fd5b50600a54610258906001600160a01b031681565b3480156102b357600080fd5b506102856102c2366004613249565b6106a7565b61022b6102d5366004613529565b610706565b3480156102e657600080fd5b506102856102f5366004613249565b61081f565b34801561030657600080fd5b506102856103153660046135e9565b610872565b34801561032657600080fd5b50610285610335366004613249565b6108c5565b34801561034657600080fd5b50610285610920565b61022b61035d366004613529565b610934565b34801561036e57600080fd5b5061025861037d366004613639565b610cfd565b34801561038e57600080fd5b506000546001600160a01b0316610258565b3480156103ac57600080fd5b506102856103bb3660046136a5565b610d27565b3480156103cc57600080fd5b506102026103db36600461371e565b600460209081526000928352604080842090915290825290205460ff1681565b61022b610409366004613751565b610e47565b34801561041a57600080fd5b50600154610258906001600160a01b031681565b34801561043a57600080fd5b50610285610449366004613249565b610e8e565b61028561045c3660046137a5565b610ee9565b34801561046d57600080fd5b506104957f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81565b60405161020f9190613855565b3480156104ae57600080fd5b50600754610258906001600160a01b031681565b3480156104ce57600080fd5b506102856104dd366004613863565b61125f565b3480156104ee57600080fd5b5060015461020290600160a01b900460ff1681565b34801561050f57600080fd5b5061053961051e366004613639565b6009602052600090815260409020546001600160a01b031681565b60405161020f91906138f6565b34801561055257600080fd5b50610285610561366004613904565b61132b565b34801561057257600080fd5b50610285610581366004613249565b611511565b61022b6105943660046132de565b61154b565b3480156105a557600080fd5b506105396105b4366004613942565b6002602052600090815260409020546001600160a01b031681565b600154600090600160a01b900460ff16610616576001546001600160a01b031633146106165760405162461bcd60e51b815260040161060d9061399a565b60405180910390fd5b6002600854036106385760405162461bcd60e51b815260040161060d906139de565b6002600855610649868686866115cb565b60016008559695505050505050565b61066061165b565b61066a8282611685565b7f1030ebdffe19ed06839890787ae0344a023e8c553e3fa69b7e74564e8c7965f0828260405161069b9291906139ee565b60405180910390a15050565b6106af61165b565b600180546001600160a01b0319166001600160a01b0383169081179091556040517f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e916106fb916133c2565b60405180910390a150565b600154600090600160a01b900460ff16610744576001546001600160a01b031633146107445760405162461bcd60e51b815260040161060d9061399a565b6002600854036107665760405162461bcd60e51b815260040161060d906139de565b600260085582516000906107839085016020908101908601613cb7565b905061078f87876116f0565b60008160800151876107a19190613d08565b90506107b4888284604001516000611875565b8151608083015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3946108029490939287928f9291600291613d68565b60405180910390a160019250505060016008559695505050505050565b61082761165b565b600a80546001600160a01b0319166001600160a01b0383161790556040517fb878cd71628ac64b2df1872301925e01164824535b02e8601077749eeeb88c3d906106fb9083906133c2565b61087a61165b565b6108858383836119a5565b7f5e20184b00709d9f103306958e9fb9d509f78bec1829ca7080f2c43eb2ff21a88383836040516108b893929190613de6565b60405180910390a1505050565b6108cd61165b565b600680546001600160a01b038381166001600160a01b03198316179092556040519116907f2d025324f0a785e8c12d0a0d91a9caa49df4ef20ff87e0df7213a1d4f3157beb9061069b9083908590613e0e565b61092861165b565b6109326000611a3b565b565b600154600090600160a01b900460ff16610972576001546001600160a01b031633146109725760405162461bcd60e51b815260040161060d9061399a565b6002600854036109945760405162461bcd60e51b815260040161060d906139de565b600260085582516000906109b19085016020908101908601613cb7565b90508060800151861015610a235760808101869052805160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c393610a11939092909182918d918d91600191613e29565b60405180910390a16001915050610649565b6080810151610a329087613d08565b95508560006060610a438a846116f0565b6020840151518a9015610ac75760606000610a618760200151611a8b565b90955093509150506001600160a01b03808216908e1614610a945760405162461bcd60e51b815260040161060d90613e85565b610aa88760200151838e8a60a00151611cb9565b90965094508415610ac457610ac48d8689604001516000611875565b50505b60c08501515115610c015760008560c00151806020019051810190610aec9190613ecd565b7f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f6000908152600960205260409020549091506001600160a01b031680610b455760405162461bcd60e51b815260040161060d90613f3c565b610b596001600160a01b0384168288611ffc565b6000610b6d886000015189604001516120e5565b83516040808b0151602087015191516341a5e1f560e11b81529394506001600160a01b0386169363834bc3ea933493610bb09391928e918c918a90600401613f5c565b60006040518083038185885af1158015610bce573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610bf79190810190613fc3565b9450505050610c99565b3415610c85576000876001600160a01b031634604051610c2090613ffe565b60006040518083038185875af1925050503d8060008114610c5d576040519150601f19603f3d011682016040523d82523d6000602084013e610c62565b606091505b5050905080610c835760405162461bcd60e51b815260040161060d9061403d565b505b610c99818587604001518860600151611875565b507ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c3846000015184848d8860800151600187604051610cde979695949392919061404d565b60405180910390a1600194505050505060016008559695505050505050565b60038181548110610d0d57600080fd5b6000918252602090912001546001600160a01b0316905081565b610d2f61165b565b828114610d4e5760405162461bcd60e51b815260040161060d9061409c565b60005b83811015610e0357828282818110610d6b57610d6b6140ac565b9050602002016020810190610d809190613249565b60096000878785818110610d9657610d966140ac565b9050602002810190610da891906140c2565b604051610db692919061412c565b6040518091039020815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055508080610dfb90614139565b915050610d51565b507f68d2b5e14eb61b73f2dfa46a255dcba81a3b53259093a83c90da69c3ade70b9684848484604051610e39949392919061429f565b60405180910390a150505050565b600154600090600160a01b900460ff16610e85576001546001600160a01b03163314610e855760405162461bcd60e51b815260040161060d9061399a565b95945050505050565b610e9661165b565b600780546001600160a01b038381166001600160a01b03198316179092556040519116907f5d16ad41baeb009cd23eb8f6c7cde5c2e0cd5acf4a33926ab488875c37c37f389061069b9083908590613e0e565b600260085403610f0b5760405162461bcd60e51b815260040161060d906139de565b600260085582151580610f41575067ffffffffffffffff4616610f3460408701602088016142d0565b67ffffffffffffffff1614155b610f5d5760405162461bcd60e51b815260040161060d9061430b565b82151580610f95575061016085013515801590610f9557506000610f896101a087016101808801613249565b6001600160a01b031614155b610fb15760405162461bcd60e51b815260040161060d9061430b565b6000610fc060808701876140c2565b604051610fce92919061412c565b604051908190039020905081158015610ff45750610ff06102008701876140c2565b1590505b8061101e57507f87d218bfcd262745694c36930f68b5dd697460f1af499de15378f8ddddb1d74f81145b61103a5760405162461bcd60e51b815260040161060d9061434f565b600081815260096020908152604091829020546001600160a01b03169167ffffffffffffffff461691611071918a01908a016142d0565b67ffffffffffffffff16148061108f57506001600160a01b03811615155b6110ab5760405162461bcd60e51b815260040161060d90614393565b610160870135606060006110c76101a08b016101808c01613249565b905060006110dd6101c08c016101a08d01613249565b9050881561113c5761111b8a8a60008181106110fb576110fb6140ac565b905060200281019061110d91906143a3565b61111690614420565b612156565b61113c5761113161112c8a8c61449a565b611a8b565b929650919450925090505b61114c60e08c0160c08d016144a7565b1561120c57600a546001600160a01b0383811691161461117e5760405162461bcd60e51b815260040161060d906144fc565b8334101561119e5760405162461bcd60e51b815260040161060d90614540565b600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156111ee57600080fd5b505af1158015611202573d6000803e3d6000fd5b5050505050611221565b6112216001600160a01b0383163330876121da565b61124d8282866112308f614746565b8e8e9061123d919061449a565b6112478d8f61449a565b896121fb565b50506001600855505050505050505050565b61126761165b565b6000838360405161127992919061412c565b604051809103902090506112fa81836001600160e01b0319909116600090815260026020526040812080546001600160a01b039093166001600160a01b031993841681179091556003805460018101825592527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b9091018054909216179055565b7f58ddcdb40971f55ad1b6a8a28067274a4ffc7e9d77c3ea14a17652faa705e1978183604051610e39929190614752565b6007546001600160a01b031633146113555760405162461bcd60e51b815260040161060d90614794565b60005b8281101561150b576000848483818110611374576113746140ac565b90506020020160208101906113899190613249565b6001600160a01b0316036114245760004790506000836001600160a01b03168261c350906040516113b990613ffe565b600060405180830381858888f193505050503d80600081146113f7576040519150601f19603f3d011682016040523d82523d6000602084013e6113fc565b606091505b505090508061141d5760405162461bcd60e51b815260040161060d906147d8565b50506114f9565b6000848483818110611438576114386140ac565b905060200201602081019061144d9190613249565b6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040161147891906133c2565b602060405180830381865afa158015611495573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b991906147e8565b90506114f783828787868181106114d2576114d26140ac565b90506020020160208101906114e79190613249565b6001600160a01b03169190612335565b505b8061150381614139565b915050611358565b50505050565b61151961165b565b6001600160a01b03811661153f5760405162461bcd60e51b815260040161060d90614866565b61154881611a3b565b50565b600060026008540361156f5760405162461bcd60e51b815260040161060d906139de565b6002600855600a546001600160a01b038781169116146115a35761159e6001600160a01b0387163330886121da565b6115c3565b843410156115c35760405162461bcd60e51b815260040161060d906148aa565b610649868686865b6000806115da838501856149b6565b90506115e686866116f0565b6115f7868683604001516000611875565b8051608082015160408051602081018252600080825291517ffd53a0c19886b8e3b5a497eb3ab7a50cb59734988891978e5f6709e86af805c394611645949093928b928d9291600291613d68565b60405180910390a160019150505b949350505050565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161060d90614a23565b6001600160a01b03821660009081526005602052604090205460ff16811515811515036116c45760405162461bcd60e51b815260040161060d9061430b565b506001600160a01b03919091166000908152600560205260409020805460ff1916911515919091179055565b600a546001600160a01b039081169083160361187157600154604080516320a6037160e21b815290516000926001600160a01b0316916382980dc49160048083019260209291908290030181865afa158015611750573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117749190614a33565b9050600a60009054906101000a90046001600160a01b03166001600160a01b0316816001600160a01b031663457bfa2f6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f79190614a33565b6001600160a01b03160361186f57600a60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561185557600080fd5b505af1158015611869573d6000803e3d6000fd5b50505050505b505b5050565b801561199157600a546001600160a01b038581169116146118a85760405162461bcd60e51b815260040161060d90614a88565b600a54604051632e1a7d4d60e01b81526001600160a01b0390911690632e1a7d4d906118d8908690600401613855565b600060405180830381600087803b1580156118f257600080fd5b505af1158015611906573d6000803e3d6000fd5b505050506000826001600160a01b03168461c3509060405161192790613ffe565b600060405180830381858888f193505050503d8060008114611965576040519150601f19603f3d011682016040523d82523d6000602084013e61196a565b606091505b505090508061198b5760405162461bcd60e51b815260040161060d9061403d565b5061150b565b61150b6001600160a01b0385168385612335565b6001600160a01b03831660009081526004602090815260408083206001600160e01b03198616845290915290205460ff16811515811515036119f95760405162461bcd60e51b815260040161060d9061430b565b506001600160a01b0390921660009081526004602090815260408083206001600160e01b0319909416835292905220805491151560ff19909216919091179055565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060006060600080611a9e87612354565b925060005b8751811015611caf5760046000898381518110611ac257611ac26140ac565b6020026020010151600001516001600160a01b03166001600160a01b031681526020019081526020016000206000898381518110611b0257611b026140ac565b602002602001015160200151611b1790614aac565b6001600160e01b031916815260208101919091526040016000205460ff16611b515760405162461bcd60e51b815260040161060d90614b25565b6000806000868481518110611b6857611b686140ac565b60200260200101516001600160a01b031663358f0e1c8c8681518110611b9057611b906140ac565b60200260200101516040518263ffffffff1660e01b8152600401611bb49190614b61565b606060405180830381865afa158015611bd1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf59190614b72565b919450925090506001600160a01b0386161580611c235750816001600160a01b0316866001600160a01b0316145b611c3f5760405162461bcd60e51b815260040161060d90614bec565b90945084906001600160a01b0385161580611c6b5750806001600160a01b0316856001600160a01b0316145b611c875760405162461bcd60e51b815260040161060d90614c30565b935083611c94838b614c40565b99509097509550819050611ca781614139565b915050611aa3565b5050509193509193565b6000806000806000611ccc89888a612493565b9250925092506000816001600160a01b03166370a08231306040518263ffffffff1660e01b8152600401611d0091906133c2565b602060405180830381865afa158015611d1d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d4191906147e8565b905060005b8a51811015611f4f5760008a8281518110611d6357611d636140ac565b60200260200101516001600160a01b0316634c6da2698d8481518110611d8b57611d8b6140ac565b602002602001015160200151888581518110611da957611da96140ac565b6020026020010151306040518463ffffffff1660e01b8152600401611dd093929190614c58565b600060405180830381865afa158015611ded573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e159190810190613fc3565b9050611e6b8c8381518110611e2c57611e2c6140ac565b602002602001015160000151878481518110611e4a57611e4a6140ac565b6020026020010151876001600160a01b0316611ffc9092919063ffffffff16565b60008c8381518110611e7f57611e7f6140ac565b6020026020010151600001516001600160a01b031682604051611ea29190614ca7565b6000604051808303816000865af19150503d8060008114611edf576040519150601f19603f3d011682016040523d82523d6000602084013e611ee4565b606091505b505090508080611ef15750895b611f0d5760405162461bcd60e51b815260040161060d90614ce7565b80611f3a57868381518110611f2457611f246140ac565b602002602001015188611f379190614c40565b97505b50508080611f4790614139565b915050611d46565b506040516370a0823160e01b81526000906001600160a01b038416906370a0823190611f7f9030906004016133c2565b602060405180830381865afa158015611f9c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc091906147e8565b9050611fcc8282613d08565b965060008711611fee5760405162461bcd60e51b815260040161060d90614d2b565b505050505094509492505050565b600081846001600160a01b031663dd62ed3e30866040518363ffffffff1660e01b815260040161202d929190613e0e565b602060405180830381865afa15801561204a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206e91906147e8565b6120789190614c40565b905061150b8463095ea7b360e01b8584604051602401612099929190614d3b565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152612648565b60608060606040518060e00160405280868152602001838152602001856001600160a01b03168152602001600015158152602001600081526020016000151581526020018281525060405160200161213d9190614e4d565b6040516020818303038152906040529250505092915050565b80516001600160a01b03166000908152600460209081526040822090830151829061218090614aac565b6001600160e01b031916815260208101919091526040016000205460ff166121ba5760405162461bcd60e51b815260040161060d90614b25565b50516001600160a01b031660009081526005602052604090205460ff1690565b61150b846323b872dd60e01b85858560405160240161209993929190614e5e565b825185901561228b5760006122298560008151811061221c5761221c6140ac565b6020026020010151612156565b1561225d5761225489898988600081518110612247576122476140ac565b60200260200101516126d7565b9250905061226c565b6122678584612869565b925090505b806122895760405162461bcd60e51b815260040161060d90614eba565b505b600061229f86600001518760600151612bb3565b90504667ffffffffffffffff16866020015167ffffffffffffffff160361231a577f0e248ac8be20725176a5f0ab093c5fbb964634d4675012f3d3ad66e69e56d5b781888b858c6040516122f7959493929190614eca565b60405180910390a1612313888388600001518960e00151611875565b505061232c565b612329818a8a89888c88612beb565b50505b50505050505050565b61186f8363a9059cbb60e01b8484604051602401612099929190614d3b565b60606000825167ffffffffffffffff8111156123725761237261343b565b60405190808252806020026020018201604052801561239b578160200160208202803683370190505b50905060005b835181101561248c5760008482815181106123be576123be6140ac565b6020026020010151602001516123d390614aac565b6001600160e01b0319811660009081526002602052604090205484519192506001600160a01b03169084908490811061240e5761240e6140ac565b60200260200101906001600160a01b031690816001600160a01b03168152505060006001600160a01b031683838151811061244b5761244b6140ac565b60200260200101516001600160a01b0316036124795760405162461bcd60e51b815260040161060d90614f40565b508061248481614139565b9150506123a1565b5092915050565b60606000806000865167ffffffffffffffff8111156124b4576124b461343b565b6040519080825280602002602001820160405280156124dd578160200160208202803683370190505b50935060005b87518110156125d1576000868281518110612500576125006140ac565b60200260200101516001600160a01b031663358f0e1c8a8481518110612528576125286140ac565b60200260200101516040518263ffffffff1660e01b815260040161254c9190614b61565b606060405180830381865afa158015612569573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258d9190614b72565b9096509450905061259e8184614c40565b9250808683815181106125b3576125b36140ac565b602090810291909101015250806125c981614139565b9150506124e3565b5060005b845181101561263d57818582815181106125f1576125f16140ac565b6020026020010151886126049190614f50565b61260e9190614f85565b858281518110612620576126206140ac565b60209081029190910101528061263581614139565b9150506125d5565b505093509350939050565b600061269d826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d6b9092919063ffffffff16565b80519091501561186f57808060200190518101906126bb9190614f99565b61186f5760405162461bcd60e51b815260040161060d90615014565b805160009081906126f3906001600160a01b0388169086611ffc565b6040516370a0823160e01b81526000906001600160a01b038716906370a08231906127229030906004016133c2565b602060405180830381865afa15801561273f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061276391906147e8565b905083600001516001600160a01b031684602001516040516127859190614ca7565b6000604051808303816000865af19150503d80600081146127c2576040519150601f19603f3d011682016040523d82523d6000602084013e6127c7565b606091505b505080935050826127df576000809250925050612860565b6040516370a0823160e01b81526000906001600160a01b038816906370a082319061280e9030906004016133c2565b602060405180830381865afa15801561282b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284f91906147e8565b905061285b8282613d08565b925050505b94509492505050565b60008060005b8451811015612baa57600080600086848151811061288f5761288f6140ac565b60200260200101516001600160a01b031663358f0e1c8986815181106128b7576128b76140ac565b60200260200101516040518263ffffffff1660e01b81526004016128db9190614b61565b606060405180830381865afa1580156128f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061291c9190614b72565b9250925092506000878581518110612936576129366140ac565b60200260200101516001600160a01b0316634c6da2698a878151811061295e5761295e6140ac565b60200260200101516020015186306040518463ffffffff1660e01b815260040161298a93929190614c58565b600060405180830381865afa1580156129a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526129cf9190810190613fc3565b9050612a038986815181106129e6576129e66140ac565b6020908102919091010151516001600160a01b0385169086611ffc565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190612a329030906004016133c2565b602060405180830381865afa158015612a4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a7391906147e8565b9050898681518110612a8757612a876140ac565b6020026020010151600001516001600160a01b031682604051612aaa9190614ca7565b6000604051808303816000865af19150503d8060008114612ae7576040519150601f19603f3d011682016040523d82523d6000602084013e612aec565b606091505b50508098505087612b095760008097509750505050505050612bac565b6040516370a0823160e01b81526000906001600160a01b038516906370a0823190612b389030906004016133c2565b602060405180830381865afa158015612b55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b7991906147e8565b9050612b858282613d08565b612b8f9089614c40565b97505050505050508080612ba290614139565b91505061286f565b505b9250929050565b600033834684604051602001612bcc949392919061506b565b6040516020818303038152906040528051906020012090505b92915050565b60008084511180612c025750600085610200015151115b612c0d578451612c13565b84604001515b90506060612c2286858a612d84565b60c0860151349015612c3b57612c388534613d08565b90505b608087015180516020918201206000908152600990915260409020546001600160a01b0390811690612c70908a168287611ffc565b6000612c7d8c8a8a612e0e565b9050816001600160a01b031663834bc3ea848b60200151888a8f8f60a00151886040518863ffffffff1660e01b8152600401612cbe96959493929190613f5c565b60006040518083038185885af1158015612cdc573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052612d059190810190613fc3565b93505050507f082e2f634ceec1af5105aa53f234b7efad94428a54a714e3b7c7115ee549308089828860200151878c8b6101c00151888e8b8f60800151604051612d589a999897969594939291906150b3565b60405180910390a1505050505050505050565b6060612d7a8484600085612e8f565b90505b9392505050565b60004684602001518484876101200151886101000151604051602001612daf96959493929190615155565b6040516020818303038152906040528051906020012090506000612dd282612f51565b9050612de381866101400151612f81565b4285610120015111612e075760405162461bcd60e51b815260040161060d90615219565b5050505050565b60606040518060e0016040528085815260200183815260200184600001516001600160a01b031681526020018460e00151151581526020018461010001518152602001846101e0015115158152602001846102000151815250604051602001612e779190614e4d565b60405160208183030381529060405290509392505050565b606082471015612eb15760405162461bcd60e51b815260040161060d90615283565b6001600160a01b0385163b612ed85760405162461bcd60e51b815260040161060d906152c7565b600080866001600160a01b03168587604051612ef49190614ca7565b60006040518083038185875af1925050503d8060008114612f31576040519150601f19603f3d011682016040523d82523d6000602084013e612f36565b606091505b5091509150612f46828286612fbd565b979650505050505050565b600081604051602001612f6491906152d7565b604051602081830303815290604052805190602001209050919050565b6000612f8d8383612ff6565b6006549091506001600160a01b0380831691161461186f5760405162461bcd60e51b815260040161060d90615346565b60608315612fcc575081612d7d565b825115612fdc5782518084602001fd5b8160405162461bcd60e51b815260040161060d9190615356565b6000806000613005858561301a565b915091506130128161305c565b509392505050565b60008082516041036130505760208301516040840151606085015160001a6130448782858561313c565b94509450505050612bac565b50600090506002612bac565b600081600481111561307057613070613362565b036130785750565b600181600481111561308c5761308c613362565b036130a95760405162461bcd60e51b815260040161060d9061539b565b60028160048111156130bd576130bd613362565b036130da5760405162461bcd60e51b815260040161060d906153df565b60038160048111156130ee576130ee613362565b0361310b5760405162461bcd60e51b815260040161060d9061542e565b600481600481111561311f5761311f613362565b036115485760405162461bcd60e51b815260040161060d9061547d565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131735750600090506003612860565b8460ff16601b1415801561318b57508460ff16601c14155b1561319c5750600090506004612860565b6000600187878787604051600081526020016040526040516131c19493929190615496565b6020604051602081039080840390855afa1580156131e3573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661320c57600060019250925050612860565b9660009650945050505050565b60006001600160a01b038216612be5565b61323381613219565b811461154857600080fd5b8035612be58161322a565b60006020828403121561325e5761325e600080fd5b6000611653848461323e565b8015155b82525050565b60208101612be5828461326a565b80613233565b8035612be581613282565b60008083601f8401126132a8576132a8600080fd5b50813567ffffffffffffffff8111156132c3576132c3600080fd5b602083019150836001820283011115612bac57612bac600080fd5b6000806000806000608086880312156132f9576132f9600080fd5b6000613305888861323e565b955050602061331688828901613288565b945050604086013567ffffffffffffffff81111561333657613336600080fd5b61334288828901613293565b935093505060606133558882890161323e565b9150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b6003811061154857611548613362565b8061339281613378565b919050565b6000612be582613388565b61326e81613397565b60208101612be582846133a2565b61326e81613219565b60208101612be582846133b9565b801515613233565b8035612be5816133d0565b600080604083850312156133f9576133f9600080fd5b6000613405858561323e565b9250506020613416858286016133d8565b9150509250929050565b67ffffffffffffffff8116613233565b8035612be581613420565b634e487b7160e01b600052604160045260246000fd5b601f19601f830116810181811067ffffffffffffffff821117156134775761347761343b565b6040525050565b600061348960405190565b90506133928282613451565b600067ffffffffffffffff8211156134af576134af61343b565b601f19601f83011660200192915050565b82818337506000910152565b60006134df6134da84613495565b61347e565b9050828152602081018484840111156134fa576134fa600080fd5b6130128482856134c0565b600082601f83011261351957613519600080fd5b81356116538482602086016134cc565b60008060008060008060c0878903121561354557613545600080fd5b6000613551898961323e565b965050602061356289828a0161323e565b955050604061357389828a01613288565b945050606061358489828a01613430565b935050608087013567ffffffffffffffff8111156135a4576135a4600080fd5b6135b089828a01613505565b92505060a06135c189828a0161323e565b9150509295509295509295565b6001600160e01b03198116613233565b8035612be5816135ce565b60008060006060848603121561360157613601600080fd5b600061360d868661323e565b935050602061361e868287016135de565b925050604061362f868287016133d8565b9150509250925092565b60006020828403121561364e5761364e600080fd5b60006116538484613288565b60008083601f84011261366f5761366f600080fd5b50813567ffffffffffffffff81111561368a5761368a600080fd5b602083019150836020820283011115612bac57612bac600080fd5b600080600080604085870312156136be576136be600080fd5b843567ffffffffffffffff8111156136d8576136d8600080fd5b6136e48782880161365a565b9450945050602085013567ffffffffffffffff81111561370657613706600080fd5b6137128782880161365a565b95989497509550505050565b6000806040838503121561373457613734600080fd5b6000613740858561323e565b9250506020613416858286016135de565b60008060008060006080868803121561376c5761376c600080fd5b6000613778888861323e565b955050602061331688828901613430565b6000610220828403121561379f5761379f600080fd5b50919050565b6000806000806000606086880312156137c0576137c0600080fd5b853567ffffffffffffffff8111156137da576137da600080fd5b6137e688828901613789565b955050602086013567ffffffffffffffff81111561380657613806600080fd5b6138128882890161365a565b9450945050604086013567ffffffffffffffff81111561383457613834600080fd5b6138408882890161365a565b92509250509295509295909350565b8061326e565b60208101612be5828461384f565b60008060006040848603121561387b5761387b600080fd5b833567ffffffffffffffff81111561389557613895600080fd5b6138a186828701613293565b9350935050602061362f8682870161323e565b6000612be56001600160a01b0383166138cb565b90565b6001600160a01b031690565b6000612be5826138b4565b6000612be5826138d7565b61326e816138e2565b60208101612be582846138ed565b60008060006040848603121561391c5761391c600080fd5b833567ffffffffffffffff81111561393657613936600080fd5b6138a18682870161365a565b60006020828403121561395757613957600080fd5b600061165384846135de565b601981526000602082017f63616c6c6572206973206e6f74206d6573736167652062757300000000000000815291505b5060200190565b60208082528101612be581613963565b601f81526000602082017f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0081529150613993565b60208082528101612be5816139aa565b604081016139fc82856133b9565b612d7d602083018461326a565b8051612be581613282565b600067ffffffffffffffff821115613a2e57613a2e61343b565b5060209081020190565b8051612be58161322a565b60005b83811015613a5e578181015183820152602001613a46565b8381111561150b5750506000910152565b6000613a7d6134da84613495565b905082815260208101848484011115613a9857613a98600080fd5b613012848285613a43565b600082601f830112613ab757613ab7600080fd5b8151611653848260208601613a6f565b600060408284031215613adc57613adc600080fd5b613ae6604061347e565b90506000613af48484613a38565b825250602082015167ffffffffffffffff811115613b1457613b14600080fd5b613b2084828501613aa3565b60208301525092915050565b6000613b3a6134da84613a14565b83815290506020808201908402830185811115613b5957613b59600080fd5b835b81811015613b9a57805167ffffffffffffffff811115613b7d57613b7d600080fd5b808601613b8a8982613ac7565b8552505060209283019201613b5b565b5050509392505050565b600082601f830112613bb857613bb8600080fd5b8151611653848260208601613b2c565b8051612be5816133d0565b600060e08284031215613be857613be8600080fd5b613bf260e061347e565b90506000613c008484613a09565b825250602082015167ffffffffffffffff811115613c2057613c20600080fd5b613c2c84828501613ba4565b6020830152506040613c4084828501613a38565b6040830152506060613c5484828501613bc8565b6060830152506080613c6884828501613a09565b60808301525060a0613c7c84828501613bc8565b60a08301525060c082015167ffffffffffffffff811115613c9f57613c9f600080fd5b613cab84828501613aa3565b60c08301525092915050565b600060208284031215613ccc57613ccc600080fd5b815167ffffffffffffffff811115613ce657613ce6600080fd5b61165384828501613bd3565b634e487b7160e01b600052601160045260246000fd5b600082821015613d1a57613d1a613cf2565b500390565b6000612be56138c88381565b61326e81613d1f565b6000613d3e825190565b808452602084019350613d55818560208601613a43565b601f19601f8201165b9093019392505050565b60e08101613d76828a61384f565b613d836020830189613d2b565b613d90604083018861384f565b613d9d60608301876133b9565b613daa608083018661384f565b613db760a08301856133a2565b81810360c0830152613dc98184613d34565b9998505050505050505050565b6001600160e01b0319811661326e565b60608101613df482866133b9565b613e016020830185613dd6565b611653604083018461326a565b60408101613e1c82856133b9565b612d7d60208301846133b9565b60e08101613e37828a61384f565b613e446020830189613d2b565b613d906040830188613d2b565b600781526000602082017f746b696e206d6d0000000000000000000000000000000000000000000000000081529150613993565b60208082528101612be581613e51565b8051612be581613420565b600060408284031215613eb557613eb5600080fd5b613ebf604061347e565b90506000613af48484613e95565b600060208284031215613ee257613ee2600080fd5b815167ffffffffffffffff811115613efc57613efc600080fd5b61165384828501613ea0565b600f81526000602082017f63627269646765206e6f7420736574000000000000000000000000000000000081529150613993565b60208082528101612be581613f08565b67ffffffffffffffff811661326e565b60c08101613f6a8289613f4c565b613f7760208301886133b9565b613f84604083018761384f565b613f9160608301866133b9565b8181036080830152613fa38185613d34565b905081810360a0830152613fb78184613d34565b98975050505050505050565b600060208284031215613fd857613fd8600080fd5b815167ffffffffffffffff811115613ff257613ff2600080fd5b61165384828501613aa3565b6000612be5826138c8565b600981526000602082017f73656e64206661696c000000000000000000000000000000000000000000000081529150613993565b60208082528101612be581614009565b60e0810161405b828a61384f565b613d83602083018961384f565b601481526000602082017f706172616d732073697a65206d69736d6174636800000000000000000000000081529150613993565b60208082528101612be581614068565b634e487b7160e01b600052603260045260246000fd5b6000808335601e19368590030181126140dd576140dd600080fd5b80840192508235915067ffffffffffffffff8211156140fe576140fe600080fd5b602083019250600182023603831315612baa57612baa600080fd5b60006141268385846134c0565b50500190565b6000611653828486614119565b6000600019820361414c5761414c613cf2565b5060010190565b81835260006020840193506141698385846134c0565b601f19601f840116613d5e565b6000612d7a848484614153565b6000808335601e193685900301811261419e5761419e600080fd5b83810160208101935035915067ffffffffffffffff8211156141c2576141c2600080fd5b36829003831315612baa57612baa600080fd5b818352600060208401935083602084028101838060005b878110156142275784840389526142038284614183565b61420e868284614176565b95506020840160209b909b019a935050506001016141ec565b5091979650505050505050565b600061424083836133b9565b505060200190565b6000612d7d602084018461323e565b8183526000602084019350818060005b85811015614294576142798284614248565b6142838882614234565b975060208301925050600101614267565b509495945050505050565b604080825281016142b18186886141d5565b905081810360208301526142c6818486614257565b9695505050505050565b6000602082840312156142e5576142e5600080fd5b60006116538484613430565b600381526000602082016206e6f760ec1b81529150613993565b60208082528101612be5816142f1565b601b81526000602082017f62726964676520646f6573206e6f7420737570706f7274206d7367000000000081529150613993565b60208082528101612be58161431b565b601281526000602082017f756e737570706f7274656420627269646765000000000000000000000000000081529150613993565b60208082528101612be58161435f565b60008235603e19368490030181126143bd576143bd600080fd5b9190910192915050565b6000604082840312156143dc576143dc600080fd5b6143e6604061347e565b905060006143f4848461323e565b825250602082013567ffffffffffffffff81111561441457614414600080fd5b613b2084828501613505565b6000612be536836143c7565b600061443a6134da84613a14565b8381529050602080820190840283018581111561445957614459600080fd5b835b81811015613b9a57803567ffffffffffffffff81111561447d5761447d600080fd5b80860161448a89826143c7565b855250506020928301920161445b565b6000612d7d36848461442c565b6000602082840312156144bc576144bc600080fd5b600061165384846133d8565b601281526000602082017f746b696e206e6f206e617469766557726170000000000000000000000000000081529150613993565b60208082528101612be5816144c8565b600b81526000602082017f696e7366636e7420616d7400000000000000000000000000000000000000000081529150613993565b60208082528101612be58161450c565b6000610220828403121561456657614566600080fd5b61457161022061347e565b9050600061457f848461323e565b825250602061459084848301613430565b60208301525060406145a48482850161323e565b60408301525060606145b884828501613430565b606083015250608082013567ffffffffffffffff8111156145db576145db600080fd5b6145e784828501613505565b60808301525060a082013567ffffffffffffffff81111561460a5761460a600080fd5b61461684828501613505565b60a08301525060c061462a848285016133d8565b60c08301525060e061463e848285016133d8565b60e08301525061010061465384828501613288565b6101008301525061012061466984828501613288565b6101208301525061014082013567ffffffffffffffff81111561468e5761468e600080fd5b61469a84828501613505565b610140830152506101606146b084828501613288565b610160830152506101806146c68482850161323e565b610180830152506101a06146dc8482850161323e565b6101a0830152506101c06146f28482850161323e565b6101c0830152506101e0614708848285016133d8565b6101e08301525061020082013567ffffffffffffffff81111561472d5761472d600080fd5b61473984828501613505565b6102008301525092915050565b6000612be53683614550565b60408101613e1c8285613dd6565b601181526000602082017f6e6f742066656520636f6c6c6563746f7200000000000000000000000000000081529150613993565b60208082528101612be581614760565b601281526000602082017f73656e64206e6174697665206661696c6564000000000000000000000000000081529150613993565b60208082528101612be5816147a4565b6000602082840312156147fd576147fd600080fd5b60006116538484613a09565b602681526000602082017f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206181527f6464726573730000000000000000000000000000000000000000000000000000602082015291505b5060400190565b60208082528101612be581614809565b601881526000602082017f6e6f206e6174697665207472616e7366657272656420696e000000000000000081529150613993565b60208082528101612be581614876565b600082601f8301126148ce576148ce600080fd5b813561165384826020860161442c565b600060e082840312156148f3576148f3600080fd5b6148fd60e061347e565b9050600061490b8484613288565b825250602082013567ffffffffffffffff81111561492b5761492b600080fd5b614937848285016148ba565b602083015250604061494b8482850161323e565b604083015250606061495f848285016133d8565b606083015250608061497384828501613288565b60808301525060a0614987848285016133d8565b60a08301525060c082013567ffffffffffffffff8111156149aa576149aa600080fd5b613cab84828501613505565b6000602082840312156149cb576149cb600080fd5b813567ffffffffffffffff8111156149e5576149e5600080fd5b611653848285016148de565b60208082527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657291019081526000613993565b60208082528101612be5816149f1565b600060208284031215614a4857614a48600080fd5b60006116538484613a38565b600c81526000602082017f746b206e6f206e6174697665000000000000000000000000000000000000000081529150613993565b60208082528101612be581614a54565b6000612be582516001600160e01b03191690565b6000614ab6825190565b60208301614ac381614a98565b92506004821015614aea57614ae56001600160e01b0319836004036008021b90565b831692505b5050919050565b600f81526000602082017f756e737570706f7274656420646578000000000000000000000000000000000081529150613993565b60208082528101612be581614af1565b80516000906040840190614b4985826133b9565b5060208301518482036020860152610e858282613d34565b60208082528101612d7d8184614b35565b600080600060608486031215614b8a57614b8a600080fd5b6000614b968686613a09565b9350506020614ba786828701613a38565b925050604061362f86828701613a38565b600d81526000602082017f746b696e206d69736d617463680000000000000000000000000000000000000081529150613993565b60208082528101612be581614bb8565b600c81526000602082017f746b6f206d69736d61746368000000000000000000000000000000000000000081529150613993565b60208082528101612be581614bfc565b60008219821115614c5357614c53613cf2565b500190565b60608082528101614c698186613d34565b9050614c78602083018561384f565b61165360408301846133b9565b6000614c8f825190565b614c9d818560208601613a43565b9290920192915050565b6000612d7d8284614c85565b600b81526000602082017f73776170206661696c656400000000000000000000000000000000000000000081529150613993565b60208082528101612be581614cb3565b601081526000602082017f616c6c207377617073206661696c65640000000000000000000000000000000081529150613993565b60208082528101612be581614cf7565b60408101614d4982856133b9565b612d7d602083018461384f565b6000612d7d8383614b35565b6000614d6c825190565b80845260208401935083602082028501614d868560200190565b8060005b858110156142275784840389528151614da38582614d56565b94506020830160209a909a0199925050600101614d8a565b805160009060e0840190614dcf858261384f565b5060208301518482036020860152614de78282614d62565b9150506040830151614dfc60408601826133b9565b506060830151614e0f606086018261326a565b506080830151614e22608086018261384f565b5060a0830151614e3560a086018261326a565b5060c083015184820360c0860152610e858282613d34565b60208082528101612d7d8184614dbb565b60608101614e6c82866133b9565b614e7960208301856133b9565b611653604083018461384f565b600981526000602082017f73776170206661696c000000000000000000000000000000000000000000000081529150613993565b60208082528101612be581614e86565b60a08101614ed8828861384f565b614ee5602083018761384f565b614ef260408301866133b9565b614eff606083018561384f565b6142c660808301846133b9565b600c81526000602082017f636463206e6f20666f756e64000000000000000000000000000000000000000081529150613993565b60208082528101612be581614f0c565b6000816000190483118215151615614f6a57614f6a613cf2565b500290565b634e487b7160e01b600052601260045260246000fd5b600082614f9457614f94614f6f565b500490565b600060208284031215614fae57614fae600080fd5b60006116538484613bc8565b602a81526000602082017f5361666545524332303a204552433230206f7065726174696f6e20646964206e81527f6f742073756363656564000000000000000000000000000000000000000000006020820152915061485f565b60208082528101612be581614fba565b6000612be58260601b90565b6000612be582615024565b61326e61504782613219565b615030565b6000612be58260c01b90565b61326e67ffffffffffffffff821661504c565b6000615077828761503b565b601482019150615087828661503b565b6014820191506150978285615058565b6008820191506150a78284615058565b50600801949350505050565b61014081016150c2828d61384f565b81810360208301526150d4818c613d34565b90506150e3604083018b613f4c565b6150f0606083018a61384f565b6150fd60808301896133b9565b61510a60a08301886133b9565b61511760c08301876133b9565b61512460e08301866133b9565b61513261010083018561384f565b8181036101208301526151458184613d34565b9c9b505050505050505050505050565b7f6578656375746f722066656500000000000000000000000000000000000000008152600c0160006151878289615058565b6008820191506151978288615058565b6008820191506151a7828761384f565b6020820191506151b7828661503b565b6014820191506151c7828561384f565b6020820191506151d7828461384f565b506020019695505050505050565b601181526000602082017f646561646c696e6520657863656564656400000000000000000000000000000081529150613993565b60208082528101612be5816151e5565b602681526000602082017f416464726573733a20696e73756666696369656e742062616c616e636520666f81527f722063616c6c00000000000000000000000000000000000000000000000000006020820152915061485f565b60208082528101612be581615229565b601d81526000602082017f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000081529150613993565b60208082528101612be581615293565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c016000615309828461384f565b50602001919050565b600e81526000602082017f696e76616c6964207369676e657200000000000000000000000000000000000081529150613993565b60208082528101612be581615312565b60208082528101612d7d8184613d34565b601881526000602082017f45434453413a20696e76616c6964207369676e6174757265000000000000000081529150613993565b60208082528101612be581615367565b601f81526000602082017f45434453413a20696e76616c6964207369676e6174757265206c656e6774680081529150613993565b60208082528101612be5816153ab565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202773272076616c815261756560f01b6020820152915061485f565b60208082528101612be5816153ef565b602281526000602082017f45434453413a20696e76616c6964207369676e6174757265202776272076616c815261756560f01b6020820152915061485f565b60208082528101612be58161543e565b60ff811661326e565b608081016154a4828761384f565b6154b1602083018661548d565b6154be604083018561384f565b610e85606083018461384f56fea26469706673582212204c7ec5e04a8a928da0779c2cadac91769a13903936a73c237e44db76ac1e388364736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d000000000000000000000000420000000000000000000000000000000000000600000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002e000000000000000000000000000000000000000000000000000000000000005a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e74323536292900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000056b2ffd01cd39ee34d62b328e07e2cef79a13cf60000000000000000000000000000000000000000000000000000000000000005000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd1990000000000000000000000001111111254760f7ab3f16433eea9304126dcd199000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000000336578616374496e707574282862797465732c616464726573732c75696e743235362c75696e743235362c75696e7432353629290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000537377617028616464726573732c28616464726573732c616464726573732c616464726573732c616464726573732c75696e743235362c75696e743235362c75696e743235362c6279746573292c62797465732900000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c636c69707065725377617028616464726573732c616464726573732c75696e743235362c75696e74323536290000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a756e6f7377617028616464726573732c75696e743235362c75696e743235362c627974657333325b5d29000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000028756e69737761705633537761702875696e743235362c75696e743235362c75696e743235365b5d2900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
-----Decoded View---------------
Arg [0] : _messageBus (address): 0x0D71D18126E03646eb09FEc929e2ae87b7CAE69d
Arg [1] : _nativeWrap (address): 0x4200000000000000000000000000000000000006
Arg [2] : _signer (address): 0x26e6eAf3D3C5d4B8290AA7dd896140f383dFf043
Arg [3] : _feeCollector (address): 0xf0761BB438CeFca39A8fd1F27d75ccC7F6Df92d8
Arg [4] : _funcSigs (string[]): exactInput((bytes,address,uint256,uint256,uint256))
Arg [5] : _codecs (address[]): 0x56B2FFd01cd39eE34d62b328e07E2cef79A13cf6
Arg [6] : _supportedDexList (address[]): 0xE592427A0AEce92De3Edee1F18E0157C05861564,0x1111111254760F7ab3F16433eea9304126DCd199,0x1111111254760F7ab3F16433eea9304126DCd199,0x1111111254760F7ab3F16433eea9304126DCd199,0x1111111254760F7ab3F16433eea9304126DCd199
Arg [7] : _supportedDexFuncs (string[]): exactInput((bytes,address,uint256,uint256,uint256)),swap(address,(address,address,address,address,uint256,uint256,uint256,bytes),bytes),clipperSwap(address,address,uint256,uint256),unoswap(address,uint256,uint256,bytes32[]),uniswapV3Swap(uint256,uint256,uint256[])
Arg [8] : _externalSwapDexList (address[]): 0x1111111254760F7ab3F16433eea9304126DCd199
Arg [9] : _testMode (bool): False
-----Encoded View---------------
47 Constructor Arguments found :
Arg [0] : 0000000000000000000000000d71d18126e03646eb09fec929e2ae87b7cae69d
Arg [1] : 0000000000000000000000004200000000000000000000000000000000000006
Arg [2] : 00000000000000000000000026e6eaf3d3c5d4b8290aa7dd896140f383dff043
Arg [3] : 000000000000000000000000f0761bb438cefca39a8fd1f27d75ccc7f6df92d8
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [5] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000220
Arg [7] : 00000000000000000000000000000000000000000000000000000000000002e0
Arg [8] : 00000000000000000000000000000000000000000000000000000000000005a0
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [12] : 0000000000000000000000000000000000000000000000000000000000000033
Arg [13] : 6578616374496e707574282862797465732c616464726573732c75696e743235
Arg [14] : 362c75696e743235362c75696e74323536292900000000000000000000000000
Arg [15] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [16] : 00000000000000000000000056b2ffd01cd39ee34d62b328e07e2cef79a13cf6
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [18] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Arg [19] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [20] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [21] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [22] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Arg [23] : 0000000000000000000000000000000000000000000000000000000000000005
Arg [24] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [25] : 0000000000000000000000000000000000000000000000000000000000000100
Arg [26] : 0000000000000000000000000000000000000000000000000000000000000180
Arg [27] : 00000000000000000000000000000000000000000000000000000000000001e0
Arg [28] : 0000000000000000000000000000000000000000000000000000000000000240
Arg [29] : 0000000000000000000000000000000000000000000000000000000000000033
Arg [30] : 6578616374496e707574282862797465732c616464726573732c75696e743235
Arg [31] : 362c75696e743235362c75696e74323536292900000000000000000000000000
Arg [32] : 0000000000000000000000000000000000000000000000000000000000000053
Arg [33] : 7377617028616464726573732c28616464726573732c616464726573732c6164
Arg [34] : 64726573732c616464726573732c75696e743235362c75696e743235362c7569
Arg [35] : 6e743235362c6279746573292c62797465732900000000000000000000000000
Arg [36] : 000000000000000000000000000000000000000000000000000000000000002c
Arg [37] : 636c69707065725377617028616464726573732c616464726573732c75696e74
Arg [38] : 3235362c75696e74323536290000000000000000000000000000000000000000
Arg [39] : 000000000000000000000000000000000000000000000000000000000000002a
Arg [40] : 756e6f7377617028616464726573732c75696e743235362c75696e743235362c
Arg [41] : 627974657333325b5d2900000000000000000000000000000000000000000000
Arg [42] : 0000000000000000000000000000000000000000000000000000000000000028
Arg [43] : 756e69737761705633537761702875696e743235362c75696e743235362c7569
Arg [44] : 6e743235365b5d29000000000000000000000000000000000000000000000000
Arg [45] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [46] : 0000000000000000000000001111111254760f7ab3f16433eea9304126dcd199
Loading...
Loading
Loading...
Loading
[ 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.