Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,083 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Rubic Collect Cr... | 15905924 | 813 days ago | IN | 0 ETH | 0.00034091 | ||||
Sweep Tokens | 15879118 | 816 days ago | IN | 0 ETH | 0.00061268 | ||||
Sweep Tokens | 15879115 | 816 days ago | IN | 0 ETH | 0.00063911 | ||||
Integrator Colle... | 15423182 | 883 days ago | IN | 0 ETH | 0.00057368 | ||||
Pause Rubic | 15301689 | 902 days ago | IN | 0 ETH | 0.00077723 | ||||
Transfer With Sw... | 15295188 | 903 days ago | IN | 0.12498035 ETH | 0.00147255 | ||||
Transfer With Sw... | 15292923 | 903 days ago | IN | 0.80105125 ETH | 0.00195159 | ||||
Transfer With Sw... | 15292478 | 903 days ago | IN | 0.0010577 ETH | 0.00115824 | ||||
Transfer With Sw... | 15291517 | 903 days ago | IN | 0.0010577 ETH | 0.00228757 | ||||
Transfer With Sw... | 15290862 | 904 days ago | IN | 0.12105095 ETH | 0.00242426 | ||||
Transfer With Sw... | 15290000 | 904 days ago | IN | 0.4180571 ETH | 0.00715353 | ||||
Transfer With Sw... | 15289140 | 904 days ago | IN | 0.00109835 ETH | 0.00196477 | ||||
Transfer With Sw... | 15284728 | 905 days ago | IN | 0.05105695 ETH | 0.00442904 | ||||
Transfer With Sw... | 15284527 | 905 days ago | IN | 0.0506137 ETH | 0.00514796 | ||||
Bridge With Swap | 15281879 | 905 days ago | IN | 0.0010607 ETH | 0.00123505 | ||||
Transfer With Sw... | 15280061 | 905 days ago | IN | 0.10105725 ETH | 0.00499908 | ||||
Transfer With Sw... | 15280020 | 905 days ago | IN | 0.26109925 ETH | 0.00163772 | ||||
Transfer With Sw... | 15279024 | 905 days ago | IN | 0.50105035 ETH | 0.0021464 | ||||
Transfer With Sw... | 15278169 | 906 days ago | IN | 0.63088725 ETH | 0.00293418 | ||||
Bridge With Swap | 15276616 | 906 days ago | IN | 0.00106115 ETH | 0.00359802 | ||||
Transfer With Sw... | 15275335 | 906 days ago | IN | 0.0209905 ETH | 0.00269374 | ||||
Transfer With Sw... | 15270808 | 907 days ago | IN | 0.0011504 ETH | 0.00354852 | ||||
Transfer With Sw... | 15266573 | 907 days ago | IN | 0.0422771 ETH | 0.00389203 | ||||
Transfer With Sw... | 15264009 | 908 days ago | IN | 0.0221602 ETH | 0.00604466 | ||||
Transfer With Sw... | 15263674 | 908 days ago | IN | 1.2610514 ETH | 0.00434463 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
15905924 | 813 days ago | 0.04724312 ETH | ||||
15295188 | 903 days ago | 0.00010035 ETH | ||||
15295188 | 903 days ago | 0.12393 ETH | ||||
15292923 | 903 days ago | 0.00010125 ETH | ||||
15292923 | 903 days ago | 0.8 ETH | ||||
15292478 | 903 days ago | 0.0001077 ETH | ||||
15291517 | 903 days ago | 0.0001077 ETH | ||||
15290862 | 904 days ago | 0.00010095 ETH | ||||
15290862 | 904 days ago | 0.12 ETH | ||||
15290000 | 904 days ago | 0.0001071 ETH | ||||
15290000 | 904 days ago | 0.417 ETH | ||||
15289140 | 904 days ago | 0.00014835 ETH | ||||
15284728 | 905 days ago | 0.00010695 ETH | ||||
15284728 | 905 days ago | 0.05 ETH | ||||
15284527 | 905 days ago | 0.0001137 ETH | ||||
15284527 | 905 days ago | 0.05 ETH | ||||
15281879 | 905 days ago | 0.0001107 ETH | ||||
15280061 | 905 days ago | 0.00010725 ETH | ||||
15280061 | 905 days ago | 0.1 ETH | ||||
15280020 | 905 days ago | 0.00014925 ETH | ||||
15280020 | 905 days ago | 0.26 ETH | ||||
15279777 | 905 days ago | 0.7309167 ETH | ||||
15279777 | 905 days ago | 0.7309167 ETH | ||||
15279777 | 905 days ago | 0.00000002 ETH | ||||
15279024 | 905 days ago | 0.00010035 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
RubicRouterV2
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import './TransferSwapV2.sol'; import './TransferSwapV3.sol'; import './TransferSwapInch.sol'; import './BridgeSwap.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; contract RubicRouterV2 is TransferSwapV2, TransferSwapV3, TransferSwapInch, BridgeSwap, ReentrancyGuard { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; event SwapRequestDone(bytes32 id, uint256 dstAmount, SwapStatus status); constructor( address _messageBus, address[] memory _supportedDEXes, address _nativeWrap ) public { messageBus = _messageBus; for (uint256 i = 0; i < _supportedDEXes.length; i++) { supportedDEXes.add(_supportedDEXes[i]); } nativeWrap = _nativeWrap; feeRubic = 3000; _setupRole(DEFAULT_ADMIN_ROLE, 0x105A3BA3637A29D36F61c7F03f55Da44B4591Cd1); _setupRole(MANAGER, 0x105A3BA3637A29D36F61c7F03f55Da44B4591Cd1); _setupRole(MANAGER, msg.sender); _setupRole(EXECUTOR, 0xfe99d38697e107FDAc6e4bFEf876564f70041594); } /** * @notice called by MessageBus when the tokens are checked to be arrived at this contract's address. sends the amount received to the receiver. swaps beforehand if swap behavior is defined in message * NOTE: if the swap fails, it sends the tokens received directly to the receiver as fallback behavior * @param _token the address of the token sent through the bridge * @param _amount the amount of tokens received at this contract through the cross-chain bridge * @param _srcChainId source chain ID * @param _message SwapRequestV2 message that defines the swap behavior on this destination chain */ function executeMessageWithTransfer( address, address _token, uint256 _amount, uint64 _srcChainId, bytes calldata _message, address _executor ) external payable override onlyMessageBus nonReentrant whenNotPaused onlyExecutor(_executor) returns (ExecutionStatus) { SwapRequestDest memory m = abi.decode((_message), (SwapRequestDest)); bytes32 id = _computeSwapRequestId(m.receiver, _srcChainId, uint64(block.chainid), _message); _amount = _calculatePlatformFee(m.swap.integrator, _token, _amount); if (m.swap.version == SwapVersion.v3) { _executeDstSwapV3(_token, _amount, id, m); } else if (m.swap.version == SwapVersion.bridge) { _executeDstBridge(_token, _amount, id, m); } else { _executeDstSwapV2(_token, _amount, id, m); } // always return true since swap failure is already handled in-place return ExecutionStatus.Success; } /** * @notice called by MessageBus when the executeMessageWithTransfer call fails. does nothing but emitting a "fail" event * @param _srcChainId source chain ID * @param _message SwapRequest message that defines the swap behavior on this destination chain * execution on dst chain */ function executeMessageWithTransferFallback( address, // _sender address _token, uint256 _amount, uint64 _srcChainId, bytes calldata _message, address _executor ) external payable override onlyMessageBus nonReentrant whenNotPaused onlyExecutor(_executor) returns (ExecutionStatus) { SwapRequestDest memory m = abi.decode((_message), (SwapRequestDest)); bytes32 id = _computeSwapRequestId(m.receiver, _srcChainId, uint64(block.chainid), _message); _sendToken(_token, _amount, m.receiver); SwapStatus status = SwapStatus.Fallback; txStatusById[id] = status; emit SwapRequestDone(id, _amount, status); // always return Fail to mark this transfer as failed since if this function is called then there nothing more // we can do in this app as the swap failures are already handled in executeMessageWithTransfer return ExecutionStatus.Fail; } // called on source chain for handling of bridge failures (bad liquidity, bad slippage, etc...) function executeMessageWithTransferRefund( address _token, uint256 _amount, bytes calldata _message, address _executor ) external payable override onlyMessageBus nonReentrant whenNotPaused onlyExecutor(_executor) returns (ExecutionStatus) { SwapRequestDest memory m = abi.decode((_message), (SwapRequestDest)); bytes32 id = _computeSwapRequestId(m.receiver, uint64(block.chainid), m.dstChainId, _message); _sendToken(_token, _amount, m.receiver); SwapStatus status = SwapStatus.Failed; txStatusById[id] = status; emit SwapRequestDone(id, _amount, status); return ExecutionStatus.Success; } // no need to swap, directly send the bridged token to user function _executeDstBridge( address _token, uint256 _amount, bytes32 _id, SwapRequestDest memory _msgDst ) private { require( _token == _msgDst.swap.path[0], 'bridged token must be the same as the first token in destination swap path' ); require(_msgDst.swap.path.length == 1, 'dst bridge expected'); _sendToken(_msgDst.swap.path[0], _amount, _msgDst.receiver); SwapStatus status; txStatusById[_id] = status; emit SwapRequestDone(_id, _amount, status); } function _executeDstSwapV2( address _token, uint256 _amount, bytes32 _id, SwapRequestDest memory _msgDst ) private { require( _token == _msgDst.swap.path[0], 'bridged token must be the same as the first token in destination swap path' ); require(_msgDst.swap.path.length > 1, 'dst swap expected'); uint256 dstAmount; SwapStatus status; SwapInfoV2 memory _dstSwap = SwapInfoV2({ dex: _msgDst.swap.dex, path: _msgDst.swap.path, deadline: _msgDst.swap.deadline, amountOutMinimum: _msgDst.swap.amountOutMinimum }); bool success; (success, dstAmount) = _trySwapV2(_dstSwap, _amount); if (success) { _sendToken(_dstSwap.path[_dstSwap.path.length - 1], dstAmount, _msgDst.receiver); status = SwapStatus.Succeeded; txStatusById[_id] = status; } else { // handle swap failure, send the received token directly to receiver _sendToken(_token, _amount, _msgDst.receiver); dstAmount = _amount; status = SwapStatus.Fallback; txStatusById[_id] = status; } emit SwapRequestDone(_id, dstAmount, status); } function _executeDstSwapV3( address _token, uint256 _amount, bytes32 _id, SwapRequestDest memory _msgDst ) private { require( _token == address(_getFirstBytes20(_msgDst.swap.pathV3)), 'bridged token must be the same as the first token in destination swap path' ); require(_msgDst.swap.pathV3.length > 20, 'dst swap expected'); uint256 dstAmount; SwapStatus status; SwapInfoV3 memory _dstSwap = SwapInfoV3({ dex: _msgDst.swap.dex, path: _msgDst.swap.pathV3, deadline: _msgDst.swap.deadline, amountOutMinimum: _msgDst.swap.amountOutMinimum }); bool success; (success, dstAmount) = _trySwapV3(_dstSwap, _amount); if (success) { _sendToken(address(_getLastBytes20(_dstSwap.path)), dstAmount, _msgDst.receiver); status = SwapStatus.Succeeded; txStatusById[_id] = status; } else { // handle swap failure, send the received token directly to receiver _sendToken(_token, _amount, _msgDst.receiver); dstAmount = _amount; status = SwapStatus.Fallback; txStatusById[_id] = status; } emit SwapRequestDone(_id, dstAmount, status); } function _sendToken( address _token, uint256 _amount, address _receiver ) private { if (_token == nativeWrap) { IWETH(nativeWrap).withdraw(_amount); (bool sent, ) = _receiver.call{value: _amount, gas: 50000}(''); require(sent, 'failed to send native'); } else { IERC20(_token).safeTransfer(_receiver, _amount); } } function setRubicFee(uint256 _feeRubic) external onlyManager { require(_feeRubic <= 1000000, 'incorrect fee amount'); feeRubic = _feeRubic; } function setRubicShare(address _integrator, uint256 _percent) external onlyManager { require(_percent <= 1000000, 'incorrect fee amount'); require(_integrator != address(0)); platformShare[_integrator] = _percent; } // set to 0 to remove integrator function setIntegrator(address _integrator, uint256 _percent) external onlyManager { require(_percent <= 1000000, 'incorrect fee amount'); require(_integrator != address(0)); integratorFee[_integrator] = _percent; } function pauseRubic() external onlyManager { _pause(); } function unPauseRubic() external onlyManager { _unpause(); } function setCryptoFee(uint64 _networkID, uint256 _amount) external onlyManager { dstCryptoFee[_networkID] = _amount; } function addSupportedDex(address[] memory _dexes) external onlyManager { for (uint256 i = 0; i < _dexes.length; i++) { supportedDEXes.add(_dexes[i]); } } function removeSupportedDex(address[] memory _dexes) external onlyManager { for (uint256 i = 0; i < _dexes.length; i++) { supportedDEXes.remove(_dexes[i]); } } function getSupportedDEXes() public view returns (address[] memory dexes) { return supportedDEXes.values(); } function sweepTokens(address _token, uint256 _amount) external onlyManager { _sendToken(_token, _amount, msg.sender); } function integratorCollectFee(address _token, uint256 _amount) external nonReentrant { require(integratorFee[msg.sender] > 0, 'not an integrator'); require(integratorCollectedFee[msg.sender][_token] >= _amount, 'not enough fees'); _sendToken(_token, _amount, msg.sender); integratorCollectedFee[msg.sender][_token] -= _amount; } function rubicCollectPlatformFee(address _token, uint256 _amount) external onlyManager { require(collectedFee[_token] >= _amount, 'amount too big'); _sendToken(_token, _amount, msg.sender); collectedFee[_token] -= _amount; } function rubicCollectCryptoFee(uint256 _amount) external onlyManager { (bool sent, ) = msg.sender.call{value: _amount, gas: 50000}(''); require(sent, 'failed to send native'); } function setNativeWrap(address _nativeWrap) external onlyManager { nativeWrap = _nativeWrap; } function setMinSwapAmount(address _token, uint256 _amount) external onlyManager { minSwapAmount[_token] = _amount; } function setMaxSwapAmount(address _token, uint256 _amount) external onlyManager { maxSwapAmount[_token] = _amount; } function setMessageBus(address _messageBus) public onlyManager { messageBus = _messageBus; emit MessageBusUpdated(messageBus); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import './SwapBase.sol'; import '@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol'; contract TransferSwapV2 is SwapBase { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; event SwapRequestSentV2(bytes32 id, uint64 dstChainId, uint256 srcAmount, address srcToken); function transferWithSwapV2Native( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoV2 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA whenNotPaused { require(_srcSwap.path[0] == nativeWrap, 'token mismatch'); require(msg.value >= _amountIn, 'Amount insufficient'); IWETH(nativeWrap).deposit{value: _amountIn}(); uint256 _fee = _calculateCryptoFee(msg.value - _amountIn, _dstChainId); _transferWithSwapV2( _receiver, _amountIn, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, _fee ); } function transferWithSwapV2( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoV2 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA whenNotPaused { IERC20(_srcSwap.path[0]).safeTransferFrom(msg.sender, address(this), _amountIn); uint256 _fee = _calculateCryptoFee(msg.value, _dstChainId); _transferWithSwapV2( _receiver, _amountIn, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, _fee ); } /** * @notice Sends a cross-chain transfer via the liquidity pool-based bridge and sends a message specifying a wanted swap action on the destination chain via the message bus * @param _receiver the app contract that implements the MessageReceiver abstract contract * NOTE not to be confused with the receiver field in SwapInfoV2 which is an EOA address of a user * @param _amountIn the input amount that the user wants to swap and/or bridge * @param _dstChainId destination chain ID * @param _srcSwap a struct containing swap related requirements * @param _dstSwap a struct containing swap related requirements * @param _maxBridgeSlippage the max acceptable slippage at bridge, 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 _fee the fee to pay to MessageBus. */ function _transferWithSwapV2( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoV2 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage, uint256 _fee ) private { nonce += 1; uint64 chainId = uint64(block.chainid); require(_srcSwap.path.length > 1 && _dstChainId != chainId, 'empty src swap path or same chain id'); address srcTokenOut = _srcSwap.path[_srcSwap.path.length - 1]; uint256 srcAmtOut = _amountIn; // swap source token for transit token on the source DEX bool success; (success, srcAmtOut) = _trySwapV2(_srcSwap, _amountIn); if (!success) revert('src swap failed'); require(srcAmtOut >= minSwapAmount[srcTokenOut], 'amount must be greater than min swap amount'); require(srcAmtOut <= maxSwapAmount[srcTokenOut], 'amount must be lower than max swap amount'); _crossChainTransferWithSwapV2( _receiver, _amountIn, chainId, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, nonce, _fee, srcTokenOut, srcAmtOut ); } function _crossChainTransferWithSwapV2( address _receiver, uint256 _amountIn, uint64 _chainId, uint64 _dstChainId, SwapInfoV2 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage, uint64 _nonce, uint256 _fee, address srcTokenOut, uint256 srcAmtOut ) private { require(_dstSwap.path.length > 0, 'empty dst swap path'); bytes memory message = abi.encode( SwapRequestDest({ swap: _dstSwap, receiver: msg.sender, nonce: nonce, dstChainId: _dstChainId }) ); bytes32 id = _computeSwapRequestId(msg.sender, _chainId, _dstChainId, message); sendMessageWithTransfer( _receiver, srcTokenOut, srcAmtOut, _dstChainId, _nonce, _maxBridgeSlippage, message, MsgDataTypes.BridgeSendType.Liquidity, _fee ); emit SwapRequestSentV2(id, _dstChainId, _amountIn, _srcSwap.path[0]); } function _trySwapV2(SwapInfoV2 memory _swap, uint256 _amount) internal returns (bool ok, uint256 amountOut) { if (!supportedDEXes.contains(_swap.dex)) { return (false, 0); } smartApprove(IERC20(_swap.path[0]), _amount, _swap.dex); try IUniswapV2Router02(_swap.dex).swapExactTokensForTokens( _amount, _swap.amountOutMinimum, _swap.path, address(this), _swap.deadline ) returns (uint256[] memory amounts) { return (true, amounts[amounts.length - 1]); } catch { return (false, 0); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import './SwapBase.sol'; import '../../interfaces/ISwapRouter.sol'; contract TransferSwapV3 is SwapBase { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; event SwapRequestSentV3(bytes32 id, uint64 dstChainId, uint256 srcAmount, address srcToken); function transferWithSwapV3Native( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoV3 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA whenNotPaused { require(address(_getFirstBytes20(_srcSwap.path)) == nativeWrap, 'token mismatch'); require(msg.value >= _amountIn, 'Amount insufficient'); IWETH(nativeWrap).deposit{value: _amountIn}(); uint256 _fee = _calculateCryptoFee(msg.value - _amountIn, _dstChainId); _transferWithSwapV3( _receiver, _amountIn, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, _fee ); } function transferWithSwapV3( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoV3 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA whenNotPaused { IERC20(address(_getFirstBytes20(_srcSwap.path))).safeTransferFrom(msg.sender, address(this), _amountIn); uint256 _fee = _calculateCryptoFee(msg.value, _dstChainId); _transferWithSwapV3( _receiver, _amountIn, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, _fee ); } /** * @notice Sends a cross-chain transfer via the liquidity pool-based bridge and sends a message specifying a wanted swap action on the destination chain via the message bus * @param _receiver the app contract that implements the MessageReceiver abstract contract * NOTE not to be confused with the receiver field in SwapInfoV2 which is an EOA address of a user * @param _amountIn the input amount that the user wants to swap and/or bridge * @param _dstChainId destination chain ID * @param _srcSwap a struct containing swap related requirements * @param _dstSwap a struct containing swap related requirements * @param _maxBridgeSlippage the max acceptable slippage at bridge, 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 _fee the fee to pay to MessageBus. */ function _transferWithSwapV3( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoV3 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage, uint256 _fee ) private { nonce += 1; uint64 chainId = uint64(block.chainid); require(_srcSwap.path.length > 20 && _dstChainId != chainId, 'empty src swap path or same chain id'); address srcTokenOut = address(_getLastBytes20(_srcSwap.path)); uint256 srcAmtOut = _amountIn; // swap source token for transit token on the source DEX bool success; (success, srcAmtOut) = _trySwapV3(_srcSwap, _amountIn); if (!success) revert('src swap failed'); require(srcAmtOut >= minSwapAmount[srcTokenOut], 'amount must be greater than min swap amount'); require(srcAmtOut <= maxSwapAmount[srcTokenOut], 'amount must be lower than max swap amount'); _crossChainTransferWithSwapV3( _receiver, _amountIn, chainId, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, nonce, _fee, srcTokenOut, srcAmtOut ); } function _crossChainTransferWithSwapV3( address _receiver, uint256 _amountIn, uint64 _chainId, uint64 _dstChainId, SwapInfoV3 calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage, uint64 _nonce, uint256 _fee, address srcTokenOut, uint256 srcAmtOut ) private { require(_dstSwap.path.length > 0, 'empty dst swap path'); bytes memory message = abi.encode( SwapRequestDest({ swap: _dstSwap, receiver: msg.sender, nonce: nonce, dstChainId: _dstChainId }) ); bytes32 id = _computeSwapRequestId(msg.sender, _chainId, _dstChainId, message); sendMessageWithTransfer( _receiver, srcTokenOut, srcAmtOut, _dstChainId, _nonce, _maxBridgeSlippage, message, MsgDataTypes.BridgeSendType.Liquidity, _fee ); emit SwapRequestSentV3(id, _dstChainId, _amountIn, address(_getFirstBytes20(_srcSwap.path))); } function _trySwapV3(SwapInfoV3 memory _swap, uint256 _amount) internal returns (bool ok, uint256 amountOut) { uint256 zero; if (!supportedDEXes.contains(_swap.dex)) { return (false, 0); } smartApprove(IERC20(address(_getFirstBytes20(_swap.path))), _amount, _swap.dex); IUniswapRouterV3.ExactInputParams memory paramsV3 = IUniswapRouterV3.ExactInputParams( _swap.path, address(this), _swap.deadline, _amount, _swap.amountOutMinimum ); try IUniswapRouterV3(_swap.dex).exactInput(paramsV3) returns (uint256 _amountOut) { return (true, _amountOut); } catch { return (false, zero); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import './SwapBase.sol'; contract TransferSwapInch is SwapBase { using Address for address payable; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; event SwapRequestSentInch(bytes32 id, uint64 dstChainId, uint256 srcAmount, address srcToken); function transferWithSwapInchNative( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoInch calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA whenNotPaused { require(_srcSwap.path[0] == nativeWrap, 'token mismatch'); require(msg.value >= _amountIn, 'Amount insufficient'); IWETH(nativeWrap).deposit{value: _amountIn}(); uint256 _fee = _calculateCryptoFee(msg.value - _amountIn, _dstChainId); _transferWithSwapInch( _receiver, _amountIn, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, _fee ); } function transferWithSwapInch( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoInch calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA whenNotPaused { IERC20(_srcSwap.path[0]).safeTransferFrom(msg.sender, address(this), _amountIn); uint256 _fee = _calculateCryptoFee(msg.value, _dstChainId); _transferWithSwapInch( _receiver, _amountIn, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, _fee ); } /** * @notice Sends a cross-chain transfer via the liquidity pool-based bridge and sends a message specifying a wanted swap action on the destination chain via the message bus * @param _receiver the app contract that implements the MessageReceiver abstract contract * NOTE not to be confused with the receiver field in SwapInfoV2 which is an EOA address of a user * @param _amountIn the input amount that the user wants to swap and/or bridge * @param _dstChainId destination chain ID * @param _srcSwap a struct containing swap related requirements * @param _dstSwap a struct containing swap related requirements * @param _maxBridgeSlippage the max acceptable slippage at bridge, 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 _fee the fee to pay to MessageBus. */ function _transferWithSwapInch( address _receiver, uint256 _amountIn, uint64 _dstChainId, SwapInfoInch calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage, uint256 _fee ) private { nonce += 1; uint64 chainId = uint64(block.chainid); require(_srcSwap.path.length > 1 && _dstChainId != chainId, 'empty src swap path or same chain id'); address srcTokenOut = _srcSwap.path[_srcSwap.path.length - 1]; uint256 srcAmtOut = _amountIn; // swap source token for transit token on the source DEX bool success; (success, srcAmtOut) = _trySwapInch(_srcSwap, _amountIn); if (!success) revert('src swap failed'); require(srcAmtOut >= minSwapAmount[srcTokenOut], 'amount must be greater than min swap amount'); require(srcAmtOut <= maxSwapAmount[srcTokenOut], 'amount must be lower than max swap amount'); _crossChainTransferWithSwapInch( _receiver, _amountIn, chainId, _dstChainId, _srcSwap, _dstSwap, _maxBridgeSlippage, nonce, _fee, srcTokenOut, srcAmtOut ); } function _crossChainTransferWithSwapInch( address _receiver, uint256 _amountIn, uint64 _chainId, uint64 _dstChainId, SwapInfoInch calldata _srcSwap, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage, uint64 _nonce, uint256 _fee, address srcTokenOut, uint256 srcAmtOut ) private { require(_dstSwap.path.length > 0, 'empty dst swap path'); bytes memory message = abi.encode( SwapRequestDest({ swap: _dstSwap, receiver: msg.sender, nonce: nonce, dstChainId: _dstChainId }) ); bytes32 id = _computeSwapRequestId(msg.sender, _chainId, _dstChainId, message); sendMessageWithTransfer( _receiver, srcTokenOut, srcAmtOut, _dstChainId, _nonce, _maxBridgeSlippage, message, MsgDataTypes.BridgeSendType.Liquidity, _fee ); emit SwapRequestSentInch(id, _dstChainId, _amountIn, _srcSwap.path[0]); } function _trySwapInch(SwapInfoInch memory _swap, uint256 _amount) internal returns (bool ok, uint256 amountOut) { if (!supportedDEXes.contains(_swap.dex)) { return (false, 0); } smartApprove(IERC20(_swap.path[0]), _amount, _swap.dex); IERC20 Transit = IERC20(_swap.path[_swap.path.length - 1]); uint256 transitBalanceBefore = Transit.balanceOf(address(this)); Address.functionCall(_swap.dex, _swap.data); uint256 balanceDif = Transit.balanceOf(address(this)) - transitBalanceBefore; if (balanceDif >= _swap.amountOutMinimum) { return (true, balanceDif); } return (false, 0); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.9; import './SwapBase.sol'; contract BridgeSwap is SwapBase { using SafeERC20 for IERC20; event BridgeRequestSent(bytes32 id, uint64 dstChainId, uint256 srcAmount, address srcToken); function bridgeWithSwap( address _receiver, uint256 _amountIn, uint64 _dstChainId, address _srcBridgeToken, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA { IERC20(_srcBridgeToken).safeTransferFrom(msg.sender, address(this), _amountIn); uint256 _fee = _calculateCryptoFee(msg.value, _dstChainId); _crossChainBridgeWithSwap( _receiver, _amountIn, _dstChainId, _srcBridgeToken, _dstSwap, _maxBridgeSlippage, _fee ); } function bridgeWithSwapNative( address _receiver, uint256 _amountIn, uint64 _dstChainId, address _srcBridgeToken, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage ) external payable onlyEOA { require(_srcBridgeToken == nativeWrap, 'token mismatch'); require(msg.value >= _amountIn, 'Amount insufficient'); IWETH(nativeWrap).deposit{value: _amountIn}(); uint256 _fee = _calculateCryptoFee(msg.value - _amountIn, _dstChainId); _crossChainBridgeWithSwap( _receiver, _amountIn, _dstChainId, _srcBridgeToken, _dstSwap, _maxBridgeSlippage, _fee ); } function _crossChainBridgeWithSwap( address _receiver, uint256 _amountIn, uint64 _dstChainId, address _srcBridgeToken, SwapInfoDest calldata _dstSwap, uint32 _maxBridgeSlippage, uint256 _fee ) private { nonce += 1; uint64 _chainId = uint64(block.chainid); require(_dstChainId != _chainId, 'same chain id'); require(_amountIn >= minSwapAmount[_srcBridgeToken], 'amount must be greater than min swap amount'); require(_amountIn <= maxSwapAmount[_srcBridgeToken], 'amount must be lower than max swap amount'); require(_dstSwap.path.length > 0, 'empty dst swap path'); bytes memory message = abi.encode( SwapRequestDest({ swap: _dstSwap, receiver: msg.sender, nonce: nonce, dstChainId: _dstChainId }) ); bytes32 id = _computeSwapRequestId(msg.sender, _chainId, _dstChainId, message); sendMessageWithTransfer( _receiver, _srcBridgeToken, _amountIn, _dstChainId, nonce, _maxBridgeSlippage, message, MsgDataTypes.BridgeSendType.Liquidity, _fee ); emit BridgeRequestSent(id, _dstChainId, _amountIn, _srcBridgeToken); } }
// 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: MIT pragma solidity >=0.8.9; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol'; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/security/Pausable.sol'; import '../framework/MessageSenderApp.sol'; import '../framework/MessageReceiverApp.sol'; import '../../interfaces/IWETH.sol'; import '../libraries/FullMath.sol'; contract SwapBase is MessageSenderApp, MessageReceiverApp, AccessControl, Pausable { using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.AddressSet; EnumerableSet.AddressSet internal supportedDEXes; // Collected fee amount for Rubic and integrators // token -> amount of collected fees mapping(address => uint256) public collectedFee; // integrator -> token -> amount of collected fees mapping(address => mapping(address => uint256)) public integratorCollectedFee; // integrator -> percent for integrators mapping(address => uint256) public integratorFee; // integrator -> percent for Rubic mapping(address => uint256) public platformShare; // Crypto fee amount blockchainId -> fee amount mapping(uint64 => uint256) public dstCryptoFee; /** Shows tx status with transfer id * Null, - tx hasnt arrived yet * Succeeded, - tx successfully executed on dst chain * Failed, - tx failed on src chain, transfer transit token back to EOA * Fallback - tx failed on dst chain, transfer transit token back to EOA */ mapping(bytes32 => SwapStatus) public txStatusById; // minimal amount of bridged token mapping(address => uint256) public minSwapAmount; // maximum amount of bridged token mapping(address => uint256) public maxSwapAmount; // platform Rubic fee uint256 public feeRubic; // erc20 wrap of gas token of this chain, eg. WETH address public nativeWrap; uint64 public nonce; // Role of the manager bytes32 public constant MANAGER = keccak256('MANAGER'); // Role of the executor bytes32 public constant EXECUTOR = keccak256('EXECUTOR'); /// @dev This modifier prevents using manager functions modifier onlyManager() { require(hasRole(MANAGER, msg.sender), 'Caller is not a manager'); _; } /// @dev This modifier prevents using executor functions modifier onlyExecutor(address _executor) { require(hasRole(EXECUTOR, _executor), 'Caller is not an executor'); _; } modifier onlyEOA() { require(msg.sender == tx.origin, 'Not EOA'); _; } // ============== struct for V2 like dexes ============== struct SwapInfoV2 { address dex; // the DEX to use for the swap // if this array has only one element, it means no need to swap address[] path; // the following fields are only needed if path.length > 1 uint256 deadline; // deadline for the swap uint256 amountOutMinimum; // minimum receive amount for the swap } // ============== struct for V3 like dexes ============== struct SwapInfoV3 { address dex; // the DEX to use for the swap bytes path; uint256 deadline; uint256 amountOutMinimum; } // ============== struct for inch swap ============== struct SwapInfoInch { address dex; // path is tokenIn, tokenOut address[] path; bytes data; uint256 amountOutMinimum; } // ============== struct dstSwap ============== // This is needed to make v2 -> SGN -> v3 swaps and etc. struct SwapInfoDest { address dex; // dex address address integrator; SwapVersion version; // identifies swap type address[] path; // path address for v2 and inch bytes pathV3; // path address for v3 uint256 deadline; // for v2 and v3 uint256 amountOutMinimum; } struct SwapRequestDest { SwapInfoDest swap; address receiver; // EOA uint64 nonce; uint64 dstChainId; } enum SwapVersion { v2, v3, bridge } enum SwapStatus { Null, Succeeded, Failed, Fallback } // returns address of first token for V3 function _getFirstBytes20(bytes memory input) internal pure returns (bytes20 result) { assembly { result := mload(add(input, 32)) } } // returns address of tokenOut for V3 function _getLastBytes20(bytes memory input) internal pure returns (bytes20 result) { uint256 offset = input.length + 12; assembly { result := mload(add(input, offset)) } } function _computeSwapRequestId( address _sender, uint64 _srcChainId, uint64 _dstChainId, bytes memory _message ) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_sender, _srcChainId, _dstChainId, _message)); } // ============== fee logic ============== function _calculateCryptoFee(uint256 _fee, uint64 _dstChainId) internal view returns (uint256 updatedFee) { require(_fee >= dstCryptoFee[_dstChainId], 'too few crypto fee'); uint256 _updatedFee = _fee - dstCryptoFee[_dstChainId]; return (_updatedFee); } function _calculatePlatformFee( address _integrator, address _token, uint256 _amountWithFee ) internal returns (uint256 amountWithoutFee) { uint256 _integratorPercent = integratorFee[_integrator]; // integrator fee is supposed not to be zero if (_integratorPercent > 0) { uint256 _platformPercent = platformShare[_integrator]; uint256 _integratorAndPlatformFee = FullMath.mulDiv(_amountWithFee, _integratorPercent, 1e6); uint256 _platformFee = FullMath.mulDiv(_integratorAndPlatformFee, _platformPercent, 1e6); integratorCollectedFee[_integrator][_token] += _integratorAndPlatformFee - _platformFee; collectedFee[_token] += _platformFee; amountWithoutFee = _amountWithFee - _integratorAndPlatformFee; } else { amountWithoutFee = FullMath.mulDiv(_amountWithFee, 1e6 - feeRubic, 1e6); collectedFee[_token] += _amountWithFee - amountWithoutFee; } } function smartApprove( IERC20 tokenIn, uint256 amount, address to ) internal { uint256 _allowance = tokenIn.allowance(address(this), to); if (_allowance < amount) { if (_allowance == 0) { tokenIn.safeApprove(to, type(uint256).max); } else { try tokenIn.approve(to, type(uint256).max) returns (bool res) { require(res == true, 'approve failed'); } catch { tokenIn.safeApprove(to, 0); tokenIn.safeApprove(to, type(uint256).max); } } } } // This is needed to receive ETH when calling `IWETH.withdraw` fallback() external payable {} }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { function removeLiquidityETHSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountETH); function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountETH); function swapExactTokensForTokensSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; function swapExactETHForTokensSupportingFeeOnTransferTokens( uint amountOutMin, address[] calldata path, address to, uint deadline ) external payable; function swapExactTokensForETHSupportingFeeOnTransferTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.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)); } } /** * @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.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `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); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.9; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '../libraries/MsgDataTypes.sol'; import '../libraries/MessageSenderLib.sol'; import './MessageBusAddress.sol'; abstract contract MessageSenderApp is MessageBusAddress { using SafeERC20 for IERC20; // ============== Utility functions called by apps ============== /** * @notice Sends a message to a contract on another chain. * Sender needs to make sure the uniqueness of the message Id, which is computed as * hash(type.MessageOnly, sender, receiver, srcChainId, srcTxHash, dstChainId, message). * If messages with the same Id are sent, only one of them will succeed at dst chain. * @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 _fee The fee amount to pay to MessageBus. */ function sendMessage( address _receiver, uint64 _dstChainId, bytes memory _message, uint256 _fee ) internal { MessageSenderLib.sendMessage(_receiver, _dstChainId, _message, messageBus, _fee); } /** * @notice Sends a message associated with a transfer to a contract on another chain. * @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. * If message is empty, only the token transfer will be sent * @param _bridgeSendType One of the {BridgeSendType} enum. * @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, uint256 _fee ) internal returns (bytes32) { return MessageSenderLib.sendMessageWithTransfer( _receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage, _message, _bridgeSendType, messageBus, _fee ); } /** * @notice Sends a token transfer via a bridge. * @dev sendMessageWithTransfer with empty message * @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 _bridgeSendType One of the {BridgeSendType} enum. */ function sendTokenTransfer( address _receiver, address _token, uint256 _amount, uint64 _dstChainId, uint64 _nonce, uint32 _maxSlippage, MsgDataTypes.BridgeSendType _bridgeSendType ) internal returns (bytes32) { return MessageSenderLib.sendMessageWithTransfer( _receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage, '', // empty message, which will not trigger sendMessage _bridgeSendType, messageBus, 0 ); } }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity 0.8.9; import '../../interfaces/IMessageReceiverApp.sol'; import './MessageBusAddress.sol'; abstract contract MessageReceiverApp is IMessageReceiverApp, MessageBusAddress { modifier onlyMessageBus() { 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.0; interface IWETH { function deposit() external payable; function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = (type(uint256).max - denominator + 1) & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// 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: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.8.0; 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.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '../../interfaces/IBridge.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 a contract on another chain. * Sender needs to make sure the uniqueness of the message Id, which is computed as * hash(type.MessageOnly, sender, receiver, srcChainId, srcTxHash, dstChainId, message). * If messages with the same Id are sent, only one of them will succeed at dst chain. * @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 associated with a transfer to a contract on another chain. * @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. * If message is empty, only the token transfer will be sent * @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) { if (_bridgeSendType == MsgDataTypes.BridgeSendType.Liquidity) { return sendMessageWithLiquidityBridgeTransfer( _receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage, _message, _messageBus, _fee ); } else if ( _bridgeSendType == MsgDataTypes.BridgeSendType.PegDeposit || _bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Deposit ) { return sendMessageWithPegVaultDeposit( _bridgeSendType, _receiver, _token, _amount, _dstChainId, _nonce, _message, _messageBus, _fee ); } else if ( _bridgeSendType == MsgDataTypes.BridgeSendType.PegBurn || _bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Burn || _bridgeSendType == MsgDataTypes.BridgeSendType.PegV2BurnFrom ) { return sendMessageWithPegBridgeBurn( _bridgeSendType, _receiver, _token, _amount, _dstChainId, _nonce, _message, _messageBus, _fee ); } else { revert('bridge type not supported'); } } /** * @notice Sends a message to an app on another chain via MessageBus with an associated liquidity bridge 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. * @param _message Arbitrary message bytes to be decoded by the destination app contract. * If message is empty, only the token transfer will be sent * @param _messageBus The address of the MessageBus on this chain. * @param _fee The fee amount to pay to MessageBus. * @return The transfer ID. */ function sendMessageWithLiquidityBridgeTransfer( address _receiver, address _token, uint256 _amount, uint64 _dstChainId, uint64 _nonce, uint32 _maxSlippage, bytes memory _message, address _messageBus, uint256 _fee ) internal returns (bytes32) { address bridge = IMessageBus(_messageBus).liquidityBridge(); IERC20(_token).safeIncreaseAllowance(bridge, _amount); IBridge(bridge).send(_receiver, _token, _amount, _dstChainId, _nonce, _maxSlippage); bytes32 transferId = keccak256( abi.encodePacked(address(this), _receiver, _token, _amount, _dstChainId, _nonce, uint64(block.chainid)) ); if (_message.length > 0) { IMessageBus(_messageBus).sendMessageWithTransfer{value: _fee}( _receiver, _dstChainId, bridge, transferId, _message ); } return transferId; } /** * @notice Sends a message to an app on another chain via MessageBus with an associated OriginalTokenVault deposit. * @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 _message Arbitrary message bytes to be decoded by the destination app contract. * If message is empty, only the token transfer will be sent * @param _messageBus The address of the MessageBus on this chain. * @param _fee The fee amount to pay to MessageBus. * @return transferId The transfer ID. */ // function sendMessageWithPegVaultDeposit( // MsgDataTypes.BridgeSendType _bridgeSendType, // address _receiver, // address _token, // uint256 _amount, // uint64 _dstChainId, // uint64 _nonce, // bytes memory _message, // address _messageBus, // uint256 _fee // ) internal returns (bytes32) { // address pegVault; // if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegDeposit) { // pegVault = IMessageBus(_messageBus).pegVault(); // } else { // pegVault = IMessageBus(_messageBus).pegVaultV2(); // } // IERC20(_token).safeIncreaseAllowance(pegVault, _amount); // bytes32 transferId; // if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegDeposit) { // IOriginalTokenVault(pegVault).deposit(_token, _amount, _dstChainId, _receiver, _nonce); // transferId = keccak256( // abi.encodePacked(address(this), _token, _amount, _dstChainId, _receiver, _nonce, uint64(block.chainid)) // ); // } else { // transferId = IOriginalTokenVaultV2(pegVault).deposit(_token, _amount, _dstChainId, _receiver, _nonce); // } // if (_message.length > 0) { // IMessageBus(_messageBus).sendMessageWithTransfer{value: _fee}( // _receiver, // _dstChainId, // pegVault, // transferId, // _message // ); // } // return transferId; // } function sendMessageWithPegVaultDeposit( MsgDataTypes.BridgeSendType _bridgeSendType, address _receiver, address _token, uint256 _amount, uint64 _dstChainId, uint64 _nonce, bytes memory _message, address _messageBus, uint256 _fee ) internal returns (bytes32 transferId) {} /** * @notice Sends a message to an app on another chain via MessageBus with an associated PeggedTokenBridge burn. * @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 _message Arbitrary message bytes to be decoded by the destination app contract. * If message is empty, only the token transfer will be sent * @param _messageBus The address of the MessageBus on this chain. * @param _fee The fee amount to pay to MessageBus. * @return transferId The transfer ID. */ // function sendMessageWithPegBridgeBurn( // MsgDataTypes.BridgeSendType _bridgeSendType, // address _receiver, // address _token, // uint256 _amount, // uint64 _dstChainId, // uint64 _nonce, // bytes memory _message, // address _messageBus, // uint256 _fee // ) internal returns (bytes32) { // address pegBridge; // if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegBurn) { // pegBridge = IMessageBus(_messageBus).pegBridge(); // } else { // pegBridge = IMessageBus(_messageBus).pegBridgeV2(); // } // IERC20(_token).safeIncreaseAllowance(pegBridge, _amount); // bytes32 transferId; // if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegBurn) { // IPeggedTokenBridge(pegBridge).burn(_token, _amount, _receiver, _nonce); // transferId = keccak256( // abi.encodePacked(address(this), _token, _amount, _receiver, _nonce, uint64(block.chainid)) // ); // } else if (_bridgeSendType == MsgDataTypes.BridgeSendType.PegV2Burn) { // transferId = IPeggedTokenBridgeV2(pegBridge).burn(_token, _amount, _dstChainId, _receiver, _nonce); // } else { // // PegV2BurnFrom // transferId = IPeggedTokenBridgeV2(pegBridge).burnFrom(_token, _amount, _dstChainId, _receiver, _nonce); // } // // handle cases where certain tokens do not spend allowance for role-based burn // IERC20(_token).safeApprove(pegBridge, 0); // if (_message.length > 0) { // IMessageBus(_messageBus).sendMessageWithTransfer{value: _fee}( // _receiver, // _dstChainId, // pegBridge, // transferId, // _message // ); // } // return transferId; // } function sendMessageWithPegBridgeBurn( MsgDataTypes.BridgeSendType _bridgeSendType, address _receiver, address _token, uint256 _amount, uint64 _dstChainId, uint64 _nonce, bytes memory _message, address _messageBus, uint256 _fee ) internal returns (bytes32 transferId) {} }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.8.0; abstract contract MessageBusAddress { event MessageBusUpdated(address messageBus); address public messageBus; }
// SPDX-License-Identifier: GPL-3.0-only pragma solidity >=0.8.0; interface IBridge { 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; /** * @notice Withdraw locked original tokens triggered by a burn at a remote chain's PeggedTokenBridge. * @param _request The serialized Withdraw 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 bridge's current signing power to be delivered. * @param _signers The sorted list of signers. * @param _powers The signing powers of the signers. */ function withdraw( bytes calldata _request, bytes[] calldata _sigs, address[] calldata _signers, uint256[] calldata _powers ) 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); /** * @notice Withdraw locked original tokens triggered by a burn at a remote chain's PeggedTokenBridge. * @param _request The serialized Withdraw 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 bridge's current signing power to be delivered. * @param _signers The sorted list of signers. * @param _powers The signing powers of the signers. */ function withdraw( 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; 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; /** * @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; 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 '../message/libraries/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); /** * @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 a contract on another chain. * Sender needs to make sure the uniqueness of the message Id, which is computed as * hash(type.MessageOnly, sender, receiver, srcChainId, srcTxHash, dstChainId, message). * If messages with the same Id are sent, only one of them will succeed at dst chain.. * 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 a contract on another chain. * If messages with the same srcTransferId are sent, only one of them will succeed at dst chain.. * 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); }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure returns (address); function addLiquidity( address tokenA, address tokenB, uint amountADesired, uint amountBDesired, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB, uint liquidity); function addLiquidityETH( address token, uint amountTokenDesired, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external payable returns (uint amountToken, uint amountETH, uint liquidity); function removeLiquidity( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline ) external returns (uint amountA, uint amountB); function removeLiquidityETH( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline ) external returns (uint amountToken, uint amountETH); function removeLiquidityWithPermit( address tokenA, address tokenB, uint liquidity, uint amountAMin, uint amountBMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountA, uint amountB); function removeLiquidityETHWithPermit( address token, uint liquidity, uint amountTokenMin, uint amountETHMin, address to, uint deadline, bool approveMax, uint8 v, bytes32 r, bytes32 s ) external returns (uint amountToken, uint amountETH); function swapExactTokensForTokens( uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapTokensForExactTokens( uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline ) external returns (uint[] memory amounts); function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline) external returns (uint[] memory amounts); function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline) external payable returns (uint[] memory amounts); function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB); function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut); function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn); function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts); function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap Algebra interface IUniswapRouterV3 { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); function WETH9() external view returns (address); function WNativeToken() external view returns (address); function refundETH() external payable; function refundNativeToken() external payable; function unwrapWETH9(uint256 amountMinimum, address recipient) external payable; function unwrapWNativeToken(uint256 amountMinimum, address recipient) external payable; }
{ "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "none" }, "evmVersion": "istanbul", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_messageBus","type":"address"},{"internalType":"address[]","name":"_supportedDEXes","type":"address[]"},{"internalType":"address","name":"_nativeWrap","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"srcToken","type":"address"}],"name":"BridgeRequestSent","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":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"dstAmount","type":"uint256"},{"indexed":false,"internalType":"enum SwapBase.SwapStatus","name":"status","type":"uint8"}],"name":"SwapRequestDone","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"srcToken","type":"address"}],"name":"SwapRequestSentInch","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"srcToken","type":"address"}],"name":"SwapRequestSentV2","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"id","type":"bytes32"},{"indexed":false,"internalType":"uint64","name":"dstChainId","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"srcAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"srcToken","type":"address"}],"name":"SwapRequestSentV3","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"EXECUTOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_dexes","type":"address[]"}],"name":"addSupportedDex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"internalType":"address","name":"_srcBridgeToken","type":"address"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"bridgeWithSwap","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"internalType":"address","name":"_srcBridgeToken","type":"address"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"bridgeWithSwapNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collectedFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint64","name":"","type":"uint64"}],"name":"dstCryptoFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":"_srcChainId","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":"_srcChainId","type":"uint64"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","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":"_executor","type":"address"}],"name":"executeMessageWithTransferRefund","outputs":[{"internalType":"enum IMessageReceiverApp.ExecutionStatus","name":"","type":"uint8"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"feeRubic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSupportedDEXes","outputs":[{"internalType":"address[]","name":"dexes","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"integratorCollectFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"integratorCollectedFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"integratorFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxSwapAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageBus","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minSwapAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeWrap","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pauseRubic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"platformShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_dexes","type":"address[]"}],"name":"removeSupportedDex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rubicCollectCryptoFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"rubicCollectPlatformFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_networkID","type":"uint64"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setCryptoFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_integrator","type":"address"},{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"setIntegrator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setMaxSwapAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_messageBus","type":"address"}],"name":"setMessageBus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"setMinSwapAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nativeWrap","type":"address"}],"name":"setNativeWrap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_feeRubic","type":"uint256"}],"name":"setRubicFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_integrator","type":"address"},{"internalType":"uint256","name":"_percent","type":"uint256"}],"name":"setRubicShare","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"sweepTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoInch","name":"_srcSwap","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"transferWithSwapInch","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoInch","name":"_srcSwap","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"transferWithSwapInchNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoV2","name":"_srcSwap","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"transferWithSwapV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoV2","name":"_srcSwap","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"transferWithSwapV2Native","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoV3","name":"_srcSwap","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"transferWithSwapV3","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"uint64","name":"_dstChainId","type":"uint64"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"bytes","name":"path","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoV3","name":"_srcSwap","type":"tuple"},{"components":[{"internalType":"address","name":"dex","type":"address"},{"internalType":"address","name":"integrator","type":"address"},{"internalType":"enum SwapBase.SwapVersion","name":"version","type":"uint8"},{"internalType":"address[]","name":"path","type":"address[]"},{"internalType":"bytes","name":"pathV3","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"internalType":"struct SwapBase.SwapInfoDest","name":"_dstSwap","type":"tuple"},{"internalType":"uint32","name":"_maxBridgeSlippage","type":"uint32"}],"name":"transferWithSwapV3Native","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"txStatusById","outputs":[{"internalType":"enum SwapBase.SwapStatus","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unPauseRubic","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162005bf238038062005bf28339810160408190526200003491620002c9565b6002805460ff191690556001600f55600080546001600160a01b0319166001600160a01b0385161781555b8251811015620000b657620000a0838281518110620000825762000082620003c4565b602002602001015160036200018c60201b62001dca1790919060201c565b5080620000ad81620003da565b9150506200005f565b50600e80546001600160a01b0319166001600160a01b038316179055610bb8600d55620000f9600073105a3ba3637a29d36f61c7f03f55da44b4591cd1620001ac565b6200012860008051602062005bd283398151915273105a3ba3637a29d36f61c7f03f55da44b4591cd1620001ac565b6200014360008051602062005bd283398151915233620001ac565b620001837f9cf85f95575c3af1e116e3d37fd41e7f36a8a373623f51ffaaa87fdd032fa76773fe99d38697e107fdac6e4bfef876564f70041594620001ac565b50505062000404565b6000620001a3836001600160a01b038416620001bc565b90505b92915050565b620001b882826200020e565b5050565b60008181526001830160205260408120546200020557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620001a6565b506000620001a6565b60008281526001602090815260408083206001600160a01b038516845290915290205460ff16620001b85760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b80516001600160a01b0381168114620002ae57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620002df57600080fd5b620002ea8462000296565b602085810151919450906001600160401b03808211156200030a57600080fd5b818701915087601f8301126200031f57600080fd5b815181811115620003345762000334620002b3565b8060051b604051601f19603f830116810181811085821117156200035c576200035c620002b3565b60405291825284820192508381018501918a8311156200037b57600080fd5b938501935b82851015620003a457620003948562000296565b8452938501939285019262000380565b809750505050505050620003bb6040850162000296565b90509250925092565b634e487b7160e01b600052603260045260246000fd5b6000600019821415620003fd57634e487b7160e01b600052601160045260246000fd5b5060010190565b6157be80620004146000396000f3fe6080604052600436106102c55760003560e01c8063815661661161017e578063a8a39d70116100d3578063c9f8b5d21161008f578063dec660361161006c578063dec66036146108bf578063e469020b146108df578063e7881011146108ff578063edffe8e61461092c57005b8063c9f8b5d21461086c578063cf19d8b11461088c578063d547741f1461089f57005b8063a8a39d7014610775578063aaa55fb4146107ad578063affed0e0146107da578063b9a2490c14610819578063ba138e7a1461082c578063bed5919c1461084c57005b8063941acab91161013a578063a1a227fa11610117578063a1a227fa1461070b578063a217fddf1461072b578063a589d31914610740578063a7b2d4ff1461076057005b8063941acab9146106c55780639c649fdf146106e55780639cf96b7f146106f857005b806381566166146106345780638620e7fa1461064757806387d234151461065d578063900ba8841461067057806391d148541461068557806392955b24146106a557005b8063386e07bf116102345780635ab7afc6116101f0578063630dc7cb116101cd578063630dc7cb146105a557806366843590146105c757806379ec8cc7146105f45780637cd2bffc1461062157005b80635ab7afc61461055a5780635b5a66a71461056d5780635c975abb1461058d57005b8063386e07bf1461049a578063457bfa2f146104bc57806348440dee146104f4578063496dbfd914610507578063547cad121461052757806359ce54cb1461054757005b80631b2df850116102835780631b2df850146103c75780631efe4063146103e9578063248a9ca3146104095780632f2ff15d1461043a5780633211dae91461045a57806336568abe1461047a57005b80624aa320146102c757806301ffc9a7146103075780630bcb4982146103375780630c1ed6501461035757806315de3f9d1461036a5780631ace492b1461038a575b005b3480156102d357600080fd5b506102f46102e2366004614511565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561031357600080fd5b5061032761032236600461452e565b610959565b60405190151581526020016102fe565b61034a610345366004614599565b610990565b6040516102fe9190614632565b6102c5610365366004614688565b610b14565b34801561037657600080fd5b506102c5610385366004614713565b610b6e565b34801561039657600080fd5b506103ba6103a536600461473f565b600a6020526000908152604090205460ff1681565b6040516102fe919061476c565b3480156103d357600080fd5b506102f460008051602061575283398151915281565b3480156103f557600080fd5b506102c561040436600461477a565b610c97565b34801561041557600080fd5b506102f461042436600461473f565b6000908152600160208190526040909120015490565b34801561044657600080fd5b506102c5610455366004614796565b610ce7565b34801561046657600080fd5b506102c56104753660046148ed565b610d13565b34801561048657600080fd5b506102c5610495366004614796565b610d97565b3480156104a657600080fd5b506104af610e11565b6040516102fe9190614965565b3480156104c857600080fd5b50600e546104dc906001600160a01b031681565b6040516001600160a01b0390911681526020016102fe565b6102c561050236600461498a565b610e22565b34801561051357600080fd5b506102c5610522366004614713565b610ecb565b34801561053357600080fd5b506102c5610542366004614511565b610f1b565b6102c561055536600461498a565b610fa3565b61034a610568366004614a0e565b61105d565b34801561057957600080fd5b506102c5610588366004614511565b6111d5565b34801561059957600080fd5b5060025460ff16610327565b3480156105b157600080fd5b506102f460008051602061579283398151915281565b3480156105d357600080fd5b506102f46105e2366004614511565b600b6020526000908152604090205481565b34801561060057600080fd5b506102f461060f366004614511565b60086020526000908152604090205481565b61034a61062f366004614a0e565b61122b565b6102c561064236600461498a565b6113c9565b34801561065357600080fd5b506102f4600d5481565b6102c561066b36600461498a565b61143b565b34801561067c57600080fd5b506102c5611582565b34801561069157600080fd5b506103276106a0366004614796565b6115c0565b3480156106b157600080fd5b506102c56106c0366004614713565b6115eb565b3480156106d157600080fd5b506102c56106e0366004614713565b6116b4565b61034a6106f3366004614aa4565b61173a565b6102c561070636600461498a565b61176e565b34801561071757600080fd5b506000546104dc906001600160a01b031681565b34801561073757600080fd5b506102f4600081565b34801561074c57600080fd5b506102c561075b366004614713565b611886565b34801561076c57600080fd5b506102c56118d6565b34801561078157600080fd5b506102f4610790366004614af0565b600660209081526000928352604080842090915290825290205481565b3480156107b957600080fd5b506102f46107c8366004614511565b60076020526000908152604090205481565b3480156107e657600080fd5b50600e5461080190600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016102fe565b6102c5610827366004614688565b611912565b34801561083857600080fd5b506102c56108473660046148ed565b6119f8565b34801561085857600080fd5b506102c561086736600461473f565b611a78565b34801561087857600080fd5b506102c5610887366004614713565b611b41565b6102c561089a36600461498a565b611bc7565b3480156108ab57600080fd5b506102c56108ba366004614796565b611d08565b3480156108cb57600080fd5b506102c56108da366004614713565b611d2f565b3480156108eb57600080fd5b506102c56108fa36600461473f565b611d6e565b34801561090b57600080fd5b506102f461091a366004614511565b600c6020526000908152604090205481565b34801561093857600080fd5b506102f4610947366004614b1e565b60096020526000908152604090205481565b60006001600160e01b03198216637965db0b60e01b148061098a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080546001600160a01b031633146109c45760405162461bcd60e51b81526004016109bb90614b39565b60405180910390fd5b6002600f5414156109e75760405162461bcd60e51b81526004016109bb90614b70565b6002600f556109f860025460ff1690565b15610a155760405162461bcd60e51b81526004016109bb90614ba7565b81610a2e600080516020615792833981519152826115c0565b610a4a5760405162461bcd60e51b81526004016109bb90614bd1565b6000610a5885870187614d3b565b90506000610aa682602001514684606001518a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611de692505050565b9050610ab789898460200151611e20565b6000818152600a602052604090819020805460ff19166002908117909155905160008051602061577283398151915290610af69084908c908590614ddf565b60405180910390a160019450505050506001600f5595945050505050565b333214610b335760405162461bcd60e51b81526004016109bb90614dfa565b610b486001600160a01b038416333088611f4e565b6000610b543486611fb9565b9050610b6587878787878787612039565b50505050505050565b6002600f541415610b915760405162461bcd60e51b81526004016109bb90614b70565b6002600f5533600090815260076020526040902054610be65760405162461bcd60e51b81526020600482015260116024820152703737ba1030b71034b73a32b3b930ba37b960791b60448201526064016109bb565b3360009081526006602090815260408083206001600160a01b0386168452909152902054811115610c4b5760405162461bcd60e51b815260206004820152600f60248201526e6e6f7420656e6f756768206665657360881b60448201526064016109bb565b610c56828233611e20565b3360009081526006602090815260408083206001600160a01b038616845290915281208054839290610c89908490614e31565b90915550506001600f555050565b610caf600080516020615752833981519152336115c0565b610ccb5760405162461bcd60e51b81526004016109bb90614e48565b6001600160401b03909116600090815260096020526040902055565b60008281526001602081905260409091200154610d048133612275565b610d0e83836122d9565b505050565b610d2b600080516020615752833981519152336115c0565b610d475760405162461bcd60e51b81526004016109bb90614e48565b60005b8151811015610d9357610d80828281518110610d6857610d68614e7f565b6020026020010151600361234490919063ffffffff16565b5080610d8b81614e95565b915050610d4a565b5050565b6001600160a01b0381163314610e075760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109bb565b610d938282612359565b6060610e1d60036123c0565b905090565b333214610e415760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff1615610e645760405162461bcd60e51b81526004016109bb90614ba7565b610eae333087610e776020880188614eb0565b6000818110610e8857610e88614e7f565b9050602002016020810190610e9d9190614511565b6001600160a01b0316929190611f4e565b6000610eba3486611fb9565b9050610b65878787878787876123cd565b610ee3600080516020615752833981519152336115c0565b610eff5760405162461bcd60e51b81526004016109bb90614e48565b6001600160a01b039091166000908152600b6020526040902055565b610f33600080516020615752833981519152336115c0565b610f4f5760405162461bcd60e51b81526004016109bb90614e48565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e9060200160405180910390a150565b333214610fc25760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff1615610fe55760405162461bcd60e51b81526004016109bb90614ba7565b611040333087611035610ffb6020890189614ef9565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061259492505050565b60601c929190611f4e565b600061104c3486611fb9565b9050610b658787878787878761259b565b600080546001600160a01b031633146110885760405162461bcd60e51b81526004016109bb90614b39565b6002600f5414156110ab5760405162461bcd60e51b81526004016109bb90614b70565b6002600f556110bc60025460ff1690565b156110d95760405162461bcd60e51b81526004016109bb90614ba7565b816110f2600080516020615792833981519152826115c0565b61110e5760405162461bcd60e51b81526004016109bb90614bd1565b600061111c85870187614d3b565b90506000611166826020015189468a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611de692505050565b90506111778a8a8460200151611e20565b6000818152600a602052604090819020805460ff191660039081179091559051600080516020615772833981519152906111b69084908d908590614ddf565b60405180910390a150506001600f555060009998505050505050505050565b6111ed600080516020615752833981519152336115c0565b6112095760405162461bcd60e51b81526004016109bb90614e48565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b031633146112565760405162461bcd60e51b81526004016109bb90614b39565b6002600f5414156112795760405162461bcd60e51b81526004016109bb90614b70565b6002600f5561128a60025460ff1690565b156112a75760405162461bcd60e51b81526004016109bb90614ba7565b816112c0600080516020615792833981519152826115c0565b6112dc5760405162461bcd60e51b81526004016109bb90614bd1565b60006112ea85870187614d3b565b90506000611334826020015189468a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611de692505050565b90506113498260000151602001518b8b612757565b9850600182516040015160028111156113645761136461460c565b141561137b576113768a8a838561289a565b6113b2565b600282516040015160028111156113945761139461460c565b14156113a6576113768a8a8385612a1a565b6113b28a8a8385612b2c565b600193505050506001600f55979650505050505050565b3332146113e85760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff161561140b5760405162461bcd60e51b81526004016109bb90614ba7565b61141e333087610e776020880188614eb0565b600061142a3486611fb9565b9050610b6587878787878787612c59565b33321461145a5760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff161561147d5760405162461bcd60e51b81526004016109bb90614ba7565b600e546001600160a01b03166114966020850185614eb0565b60008181106114a7576114a7614e7f565b90506020020160208101906114bc9190614511565b6001600160a01b0316146114e25760405162461bcd60e51b81526004016109bb90614f3f565b843410156115025760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b15801561155257600080fd5b505af1158015611566573d6000803e3d6000fd5b50505050506000610eba863461157c9190614e31565b86611fb9565b61159a600080516020615752833981519152336115c0565b6115b65760405162461bcd60e51b81526004016109bb90614e48565b6115be612e13565b565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611603600080516020615752833981519152336115c0565b61161f5760405162461bcd60e51b81526004016109bb90614e48565b6001600160a01b0382166000908152600560205260409020548111156116785760405162461bcd60e51b815260206004820152600e60248201526d616d6f756e7420746f6f2062696760901b60448201526064016109bb565b611683828233611e20565b6001600160a01b038216600090815260056020526040812080548392906116ab908490614e31565b90915550505050565b6116cc600080516020615752833981519152336115c0565b6116e85760405162461bcd60e51b81526004016109bb90614e48565b620f424081111561170b5760405162461bcd60e51b81526004016109bb90614f94565b6001600160a01b03821661171e57600080fd5b6001600160a01b03909116600090815260076020526040902055565b600080546001600160a01b031633146117655760405162461bcd60e51b81526004016109bb90614b39565b95945050505050565b33321461178d5760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff16156117b05760405162461bcd60e51b81526004016109bb90614ba7565b600e546001600160a01b03166117cc610ffb6020860186614ef9565b60601c146117ec5760405162461bcd60e51b81526004016109bb90614f3f565b8434101561180c5760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b15801561185c57600080fd5b505af1158015611870573d6000803e3d6000fd5b5050505050600061104c863461157c9190614e31565b61189e600080516020615752833981519152336115c0565b6118ba5760405162461bcd60e51b81526004016109bb90614e48565b6001600160a01b039091166000908152600c6020526040902055565b6118ee600080516020615752833981519152336115c0565b61190a5760405162461bcd60e51b81526004016109bb90614e48565b6115be612e88565b3332146119315760405162461bcd60e51b81526004016109bb90614dfa565b600e546001600160a01b0384811691161461195e5760405162461bcd60e51b81526004016109bb90614f3f565b8434101561197e5760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b1580156119ce57600080fd5b505af11580156119e2573d6000803e3d6000fd5b50505050506000610b54863461157c9190614e31565b611a10600080516020615752833981519152336115c0565b611a2c5760405162461bcd60e51b81526004016109bb90614e48565b60005b8151811015610d9357611a65828281518110611a4d57611a4d614e7f565b60200260200101516003611dca90919063ffffffff16565b5080611a7081614e95565b915050611a2f565b611a90600080516020615752833981519152336115c0565b611aac5760405162461bcd60e51b81526004016109bb90614e48565b604051600090339061c35090849084818181858888f193505050503d8060008114611af3576040519150601f19603f3d011682016040523d82523d6000602084013e611af8565b606091505b5050905080610d935760405162461bcd60e51b81526020600482015260156024820152746661696c656420746f2073656e64206e617469766560581b60448201526064016109bb565b611b59600080516020615752833981519152336115c0565b611b755760405162461bcd60e51b81526004016109bb90614e48565b620f4240811115611b985760405162461bcd60e51b81526004016109bb90614f94565b6001600160a01b038216611bab57600080fd5b6001600160a01b03909116600090815260086020526040902055565b333214611be65760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff1615611c095760405162461bcd60e51b81526004016109bb90614ba7565b600e546001600160a01b0316611c226020850185614eb0565b6000818110611c3357611c33614e7f565b9050602002016020810190611c489190614511565b6001600160a01b031614611c6e5760405162461bcd60e51b81526004016109bb90614f3f565b84341015611c8e5760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015611cde57600080fd5b505af1158015611cf2573d6000803e3d6000fd5b5050505050600061142a863461157c9190614e31565b60008281526001602081905260409091200154611d258133612275565b610d0e8383612359565b611d47600080516020615752833981519152336115c0565b611d635760405162461bcd60e51b81526004016109bb90614e48565b610d93828233611e20565b611d86600080516020615752833981519152336115c0565b611da25760405162461bcd60e51b81526004016109bb90614e48565b620f4240811115611dc55760405162461bcd60e51b81526004016109bb90614f94565b600d55565b6000611ddf836001600160a01b038416612f02565b9392505050565b600084848484604051602001611dff9493929190614fee565b6040516020818303038152906040528051906020012090505b949350505050565b600e546001600160a01b0384811691161415611f3a57600e54604051632e1a7d4d60e01b8152600481018490526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015611e7c57600080fd5b505af1158015611e90573d6000803e3d6000fd5b505050506000816001600160a01b03168361c35090604051600060405180830381858888f193505050503d8060008114611ee6576040519150601f19603f3d011682016040523d82523d6000602084013e611eeb565b606091505b5050905080611f345760405162461bcd60e51b81526020600482015260156024820152746661696c656420746f2073656e64206e617469766560581b60448201526064016109bb565b50505050565b610d0e6001600160a01b0384168284612f51565b6040516001600160a01b0380851660248301528316604482015260648101829052611f349085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612f81565b6001600160401b0381166000908152600960205260408120548310156120165760405162461bcd60e51b8152602060048201526012602482015271746f6f206665772063727970746f2066656560701b60448201526064016109bb565b6001600160401b038216600090815260096020526040812054611e189085614e31565b6001600e60148282829054906101000a90046001600160401b031661205e919061504a565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506000469050806001600160401b0316866001600160401b031614156120d95760405162461bcd60e51b815260206004820152600d60248201526c1cd85b594818da185a5b881a59609a1b60448201526064016109bb565b6001600160a01b0385166000908152600b60205260409020548710156121115760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0385166000908152600c60205260409020548711156121495760405162461bcd60e51b81526004016109bb906150c0565b60006121586060860186614eb0565b9050116121775760405162461bcd60e51b81526004016109bb90615109565b600060405180608001604052808661218e90615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b03168152602001886001600160401b03168152506040516020016121e3919061516e565b6040516020818303038152906040529050600061220233848a85611de6565b905061222b8a888b8b600e60149054906101000a90046001600160401b03168a8860018c613053565b507f072d004cb42c4f14203ea1fc0d4504116cab7bf0c0bcd417b96d645ab9a8671781898b8a6040516122619493929190615247565b60405180910390a150505050505050505050565b61227f82826115c0565b610d9357612297816001600160a01b03166014613088565b6122a2836020613088565b6040516020016122b3929190615274565b60408051601f198184030181529082905262461bcd60e51b82526109bb916004016152e9565b6122e382826115c0565b610d935760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000611ddf836001600160a01b038416613223565b61236382826115c0565b15610d935760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000611ddf83613316565b6001600e60148282829054906101000a90046001600160401b03166123f2919061504a565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506000469050600185806020019061242d9190614eb0565b905011801561244e5750806001600160401b0316866001600160401b031614155b61246a5760405162461bcd60e51b81526004016109bb906152fc565b60006124796020870187614eb0565b600161248860208a018a614eb0565b612493929150614e31565b8181106124a2576124a2614e7f565b90506020020160208101906124b79190614511565b90508760006124ce6124c889615340565b8b613372565b92509050806124ef5760405162461bcd60e51b81526004016109bb906153af565b6001600160a01b0383166000908152600b60205260409020548210156125275760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0383166000908152600c602052604090205482111561255f5760405162461bcd60e51b81526004016109bb906150c0565b6125878b8b868c8c8c8c600e60149054906101000a90046001600160401b03168d8c8c613499565b5050505050505050505050565b6020015190565b6001600e60148282829054906101000a90046001600160401b03166125c0919061504a565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550600046905060148580602001906125fb9190614ef9565b905011801561261c5750806001600160401b0316866001600160401b031614155b6126385760405162461bcd60e51b81526004016109bb906152fc565b600061268461264a6020880188614ef9565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506135e592505050565b60601c905087600061269e612698896153d8565b8b613601565b92509050806126bf5760405162461bcd60e51b81526004016109bb906153af565b6001600160a01b0383166000908152600b60205260409020548210156126f75760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0383166000908152600c602052604090205482111561272f5760405162461bcd60e51b81526004016109bb906150c0565b6125878b8b868c8c8c8c600e60149054906101000a90046001600160401b03168d8c8c613714565b6001600160a01b038316600090815260076020526040812054801561283a576001600160a01b0385166000908152600860205260408120549061279e8584620f4240613829565b905060006127b08284620f4240613829565b90506127bc8183614e31565b6001600160a01b03808a166000908152600660209081526040808320938c16835292905290812080549091906127f3908490615424565b90915550506001600160a01b03871660009081526005602052604081208054839290612820908490615424565b9091555061283090508287614e31565b9450505050612892565b61285883600d54620f424061284f9190614e31565b620f4240613829565b91506128648284614e31565b6001600160a01b0385166000908152600560205260408120805490919061288c908490615424565b90915550505b509392505050565b8051608001516020015160601c6001600160a01b0316846001600160a01b0316146128d75760405162461bcd60e51b81526004016109bb9061543c565b805160800151516014106129215760405162461bcd60e51b8152602060048201526011602482015270191cdd081cddd85c08195e1c1958dd1959607a1b60448201526064016109bb565b60408051608080820183528351516001600160a01b03168252835101516020820152825160a0015191810191909152815160c00151606082015260009081908161296b8288613601565b9450905080156129b65761299361298583602001516135e5565b60601c858760200151611e20565b6000868152600a60205260409020805460ff1916600190811790915592506129e7565b6129c588888760200151611e20565b6000868152600a60205260409020805460ff1916600390811790915587945092505b600080516020615772833981519152868585604051612a0893929190614ddf565b60405180910390a15050505050505050565b8051606001518051600090612a3157612a31614e7f565b60200260200101516001600160a01b0316846001600160a01b031614612a695760405162461bcd60e51b81526004016109bb9061543c565b80516060015151600114612ab55760405162461bcd60e51b8152602060048201526013602482015272191cdd08189c9a5919d948195e1c1958dd1959606a1b60448201526064016109bb565b612ae6816000015160600151600081518110612ad357612ad3614e7f565b6020026020010151848360200151611e20565b6000828152600a6020526040808220805460ff191690555160008051602061577283398151915290612b1d90859087908590614ddf565b60405180910390a15050505050565b8051606001518051600090612b4357612b43614e7f565b60200260200101516001600160a01b0316846001600160a01b031614612b7b5760405162461bcd60e51b81526004016109bb9061543c565b80516060015151600110612bc55760405162461bcd60e51b8152602060048201526011602482015270191cdd081cddd85c08195e1c1958dd1959607a1b60448201526064016109bb565b604080516080810182528251516001600160a01b0316815282516060908101516020830152835160a0015192820192909252825160c0015191810191909152600090819081612c148288613372565b9450905080156129b657602082015180516129939190612c3690600190614e31565b81518110612c4657612c46614e7f565b6020026020010151858760200151611e20565b6001600e60148282829054906101000a90046001600160401b0316612c7e919061504a565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555060004690506001858060200190612cb99190614eb0565b9050118015612cda5750806001600160401b0316866001600160401b031614155b612cf65760405162461bcd60e51b81526004016109bb906152fc565b6000612d056020870187614eb0565b6001612d1460208a018a614eb0565b612d1f929150614e31565b818110612d2e57612d2e614e7f565b9050602002016020810190612d439190614511565b9050876000612d5a612d54896154ac565b8b6139ae565b9250905080612d7b5760405162461bcd60e51b81526004016109bb906153af565b6001600160a01b0383166000908152600b6020526040902054821015612db35760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0383166000908152600c6020526040902054821115612deb5760405162461bcd60e51b81526004016109bb906150c0565b6125878b8b868c8c8c8c600e60149054906101000a90046001600160401b03168d8c8c613b5e565b60025460ff1615612e365760405162461bcd60e51b81526004016109bb90614ba7565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612e6b3390565b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff16612ed15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109bb565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612e6b565b6000818152600183016020526040812054612f495750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561098a565b50600061098a565b6040516001600160a01b038316602482015260448101829052610d0e90849063a9059cbb60e01b90606401611f82565b6000612fd6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613c5d9092919063ffffffff16565b805190915015610d0e5780806020019051810190612ff49190615536565b610d0e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109bb565b600061307a8a8a8a8a8a8a8a8a60008054906101000a90046001600160a01b03168b613c6c565b9a9950505050505050505050565b60606000613097836002615558565b6130a2906002615424565b6001600160401b038111156130b9576130b96147c6565b6040519080825280601f01601f1916602001820160405280156130e3576020820181803683370190505b509050600360fc1b816000815181106130fe576130fe614e7f565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061312d5761312d614e7f565b60200101906001600160f81b031916908160001a9053506000613151846002615558565b61315c906001615424565b90505b60018111156131d4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061319057613190614e7f565b1a60f81b8282815181106131a6576131a6614e7f565b60200101906001600160f81b031916908160001a90535060049490941c936131cd81615577565b905061315f565b508315611ddf5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109bb565b6000818152600183016020526040812054801561330c576000613247600183614e31565b855490915060009061325b90600190614e31565b90508181146132c057600086600001828154811061327b5761327b614e7f565b906000526020600020015490508087600001848154811061329e5761329e614e7f565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806132d1576132d161558e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061098a565b600091505061098a565b60608160000180548060200260200160405190810160405280929190818152602001828054801561336657602002820191906000526020600020905b815481526020019060010190808311613352575b50505050509050919050565b8151600090819061338590600390613d7e565b61339457506000905080613492565b6133c184602001516000815181106133ae576133ae614e7f565b6020026020010151848660000151613da0565b83600001516001600160a01b03166338ed173984866060015187602001513089604001516040518663ffffffff1660e01b81526004016134059594939291906155a4565b600060405180830381600087803b15801561341f57600080fd5b505af192505050801561345457506040513d6000823e601f3d908101601f1916820160405261345191908101906155e0565b60015b61346357506000905080613492565b600181600183516134749190614e31565b8151811061348457613484614e7f565b602002602001015192509250505b9250929050565b60006134a86060880188614eb0565b9050116134c75760405162461bcd60e51b81526004016109bb90615109565b60006040518060800160405280886134de90615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b031681526020018a6001600160401b0316815250604051602001613533919061516e565b60405160208183030381529060405290506000613552338c8c85611de6565b90506135668d85858d8a8c8860018d613053565b507f9031eabb05761a3180d68e266249876dcaf832f476e41feefe97c19d7826445e818b8e61359860208e018e614eb0565b60008181106135a9576135a9614e7f565b90506020020160208101906135be9190614511565b6040516135ce9493929190615247565b60405180910390a150505050505050505050505050565b6000808251600c6135f69190615424565b929092015192915050565b600080600061361e85600001516003613d7e90919063ffffffff16565b61362f576000809250925050613492565b61364f61364186602001516020015190565b60601c858760000151613da0565b6040805160a081018252602080880151825230908201528682015181830152606080820187905287015160808201528651915163c04b8d5960e01b815290916001600160a01b03169063c04b8d59906136ac908490600401615665565b602060405180830381600087803b1580156136c657600080fd5b505af19250505080156136f6575060408051601f3d908101601f191682019092526136f3918101906156bd565b60015b6137065750600092509050613492565b600194509250613492915050565b60006137236060880188614eb0565b9050116137425760405162461bcd60e51b81526004016109bb90615109565b600060405180608001604052808861375990615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b031681526020018a6001600160401b03168152506040516020016137ae919061516e565b604051602081830303815290604052905060006137cd338c8c85611de6565b90506137e18d85858d8a8c8860018d613053565b507f4eb5d441f9e6755d5c8841ba146efcc9927c88c3a96f5b7f4a2fc08a4c75fcd7818b8e613816610ffb60208f018f614ef9565b60601c6040516135ce9493929190615247565b600080806000198587098587029250828110838203039150508060001415613863576000841161385857600080fd5b508290049050611ddf565b80841161386f57600080fd5b60008486880980840393811190920391905060008561389081600019614e31565b61389b906001615424565b169586900495938490049360008190030460010190506138bb8184615558565b9093179260006138cc876003615558565b60021890506138db8188615558565b6138e6906002614e31565b6138f09082615558565b90506138fc8188615558565b613907906002614e31565b6139119082615558565b905061391d8188615558565b613928906002614e31565b6139329082615558565b905061393e8188615558565b613949906002614e31565b6139539082615558565b905061395f8188615558565b61396a906002614e31565b6139749082615558565b90506139808188615558565b61398b906002614e31565b6139959082615558565b90506139a18186615558565b9998505050505050505050565b815160009081906139c190600390613d7e565b6139d057506000905080613492565b6139ea84602001516000815181106133ae576133ae614e7f565b6020840151805160009190613a0190600190614e31565b81518110613a1157613a11614e7f565b60209081029190910101516040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b158015613a6157600080fd5b505afa158015613a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a9991906156bd565b9050613aad86600001518760400151613f41565b506040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b158015613af257600080fd5b505afa158015613b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b2a91906156bd565b613b349190614e31565b905086606001518110613b4f57600194509250613492915050565b50600096879650945050505050565b6000613b6d6060880188614eb0565b905011613b8c5760405162461bcd60e51b81526004016109bb90615109565b6000604051806080016040528088613ba390615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b031681526020018a6001600160401b0316815250604051602001613bf8919061516e565b60405160208183030381529060405290506000613c17338c8c85611de6565b9050613c2b8d85858d8a8c8860018d613053565b507f8fc041fb1bcb4ef7c4232fc09dc11530c94a59fca667a6f99d04a1329e214eae818b8e61359860208e018e614eb0565b6060611e188484600085613f83565b60006001846006811115613c8257613c8261460c565b1415613ca057613c998b8b8b8b8b8b8b8a8a6140b4565b905061307a565b6002846006811115613cb457613cb461460c565b1480613cd157506004846006811115613ccf57613ccf61460c565b145b15613cdd576000613c99565b6003846006811115613cf157613cf161460c565b1480613d0e57506005846006811115613d0c57613d0c61460c565b145b80613d2a57506006846006811115613d2857613d2861460c565b145b15613d36576000613c99565b60405162461bcd60e51b815260206004820152601960248201527f6272696467652074797065206e6f7420737570706f727465640000000000000060448201526064016109bb565b6001600160a01b03811660009081526001830160205260408120541515611ddf565b604051636eb1769f60e11b81523060048201526001600160a01b0382811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015613deb57600080fd5b505afa158015613dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e2391906156bd565b905082811015611f345780613e4d57613e486001600160a01b038516836000196142cb565b611f34565b60405163095ea7b360e01b81526001600160a01b038381166004830152600019602483015285169063095ea7b390604401602060405180830381600087803b158015613e9857600080fd5b505af1925050508015613ec8575060408051601f3d908101601f19168201909252613ec591810190615536565b60015b613ef757613ee16001600160a01b0385168360006142cb565b613e486001600160a01b038516836000196142cb565b600181151514613f3a5760405162461bcd60e51b815260206004820152600e60248201526d185c1c1c9bdd994819985a5b195960921b60448201526064016109bb565b5050505050565b6060611ddf83836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250613c5d565b606082471015613fe45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109bb565b6001600160a01b0385163b61403b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109bb565b600080866001600160a01b0316858760405161405791906156d6565b60006040518083038185875af1925050503d8060008114614094576040519150601f19603f3d011682016040523d82523d6000602084013e614099565b606091505b50915091506140a98282866143ef565b979650505050505050565b600080836001600160a01b03166382980dc46040518163ffffffff1660e01b815260040160206040518083038186803b1580156140f057600080fd5b505afa158015614104573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061412891906156f2565b905061413e6001600160a01b038b16828b614428565b60405163a5977fbb60e01b81526001600160a01b038c811660048301528b81166024830152604482018b90526001600160401b03808b1660648401528916608483015263ffffffff881660a483015282169063a5977fbb9060c401600060405180830381600087803b1580156141b357600080fd5b505af11580156141c7573d6000803e3d6000fd5b50506040516bffffffffffffffffffffffff1930606090811b821660208401528f811b821660348401528e901b166048820152605c81018c90526001600160c01b031960c08c811b8216607c8401528b811b8216608484015246901b16608c8201526000925060940190506040516020818303038152906040528051906020012090506000865111156142bc57846001600160a01b0316634289fbb3858e8c86868c6040518763ffffffff1660e01b815260040161428995949392919061570f565b6000604051808303818588803b1580156142a257600080fd5b505af11580156142b6573d6000803e3d6000fd5b50505050505b9b9a5050505050505050505050565b8015806143545750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561431a57600080fd5b505afa15801561432e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061435291906156bd565b155b6143bf5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016109bb565b6040516001600160a01b038316602482015260448101829052610d0e90849063095ea7b360e01b90606401611f82565b606083156143fe575081611ddf565b82511561440e5782518084602001fd5b8160405162461bcd60e51b81526004016109bb91906152e9565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561447457600080fd5b505afa158015614488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144ac91906156bd565b6144b69190615424565b6040516001600160a01b038516602482015260448101829052909150611f3490859063095ea7b360e01b90606401611f82565b6001600160a01b03811681146144fe57600080fd5b50565b803561450c816144e9565b919050565b60006020828403121561452357600080fd5b8135611ddf816144e9565b60006020828403121561454057600080fd5b81356001600160e01b031981168114611ddf57600080fd5b60008083601f84011261456a57600080fd5b5081356001600160401b0381111561458157600080fd5b60208301915083602082850101111561349257600080fd5b6000806000806000608086880312156145b157600080fd5b85356145bc816144e9565b94506020860135935060408601356001600160401b038111156145de57600080fd5b6145ea88828901614558565b90945092505060608601356145fe816144e9565b809150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600381106144fe576144fe61460c565b6020810161463f83614622565b91905290565b80356001600160401b038116811461450c57600080fd5b600060e0828403121561466e57600080fd5b50919050565b803563ffffffff8116811461450c57600080fd5b60008060008060008060c087890312156146a157600080fd5b86356146ac816144e9565b9550602087013594506146c160408801614645565b935060608701356146d1816144e9565b925060808701356001600160401b038111156146ec57600080fd5b6146f889828a0161465c565b92505061470760a08801614674565b90509295509295509295565b6000806040838503121561472657600080fd5b8235614731816144e9565b946020939093013593505050565b60006020828403121561475157600080fd5b5035919050565b600481106147685761476861460c565b9052565b6020810161098a8284614758565b6000806040838503121561478d57600080fd5b61473183614645565b600080604083850312156147a957600080fd5b8235915060208301356147bb816144e9565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156147fe576147fe6147c6565b60405290565b604051608081016001600160401b03811182821017156147fe576147fe6147c6565b604051601f8201601f191681016001600160401b038111828210171561484e5761484e6147c6565b604052919050565b60006001600160401b0382111561486f5761486f6147c6565b5060051b60200190565b600082601f83011261488a57600080fd5b8135602061489f61489a83614856565b614826565b82815260059290921b840181019181810190868411156148be57600080fd5b8286015b848110156148e25780356148d5816144e9565b83529183019183016148c2565b509695505050505050565b6000602082840312156148ff57600080fd5b81356001600160401b0381111561491557600080fd5b611e1884828501614879565b600081518084526020808501945080840160005b8381101561495a5781516001600160a01b031687529582019590820190600101614935565b509495945050505050565b602081526000611ddf6020830184614921565b60006080828403121561466e57600080fd5b60008060008060008060c087890312156149a357600080fd5b86356149ae816144e9565b9550602087013594506149c360408801614645565b935060608701356001600160401b03808211156149df57600080fd5b6149eb8a838b01614978565b94506080890135915080821115614a0157600080fd5b506146f889828a0161465c565b600080600080600080600060c0888a031215614a2957600080fd5b8735614a34816144e9565b96506020880135614a44816144e9565b955060408801359450614a5960608901614645565b935060808801356001600160401b03811115614a7457600080fd5b614a808a828b01614558565b90945092505060a0880135614a94816144e9565b8091505092959891949750929550565b600080600080600060808688031215614abc57600080fd5b8535614ac7816144e9565b9450614ad560208701614645565b935060408601356001600160401b038111156145de57600080fd5b60008060408385031215614b0357600080fd5b8235614b0e816144e9565b915060208301356147bb816144e9565b600060208284031215614b3057600080fd5b611ddf82614645565b60208082526019908201527f63616c6c6572206973206e6f74206d6573736167652062757300000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526019908201527f43616c6c6572206973206e6f7420616e206578656375746f7200000000000000604082015260600190565b80356003811061450c57600080fd5b600082601f830112614c2857600080fd5b81356001600160401b03811115614c4157614c416147c6565b614c54601f8201601f1916602001614826565b818152846020838601011115614c6957600080fd5b816020850160208301376000918101602001919091529392505050565b600060e08284031215614c9857600080fd5b614ca06147dc565b9050614cab82614501565b8152614cb960208301614501565b6020820152614cca60408301614c08565b604082015260608201356001600160401b0380821115614ce957600080fd5b614cf585838601614879565b60608401526080840135915080821115614d0e57600080fd5b50614d1b84828501614c17565b60808301525060a082013560a082015260c082013560c082015292915050565b600060208284031215614d4d57600080fd5b81356001600160401b0380821115614d6457600080fd5b9083019060808286031215614d7857600080fd5b614d80614804565b823582811115614d8f57600080fd5b614d9b87828601614c86565b82525060208301359150614dae826144e9565b816020820152614dc060408401614645565b6040820152614dd160608401614645565b606082015295945050505050565b8381526020810183905260608101611e186040830184614758565b6020808252600790820152664e6f7420454f4160c81b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015614e4357614e43614e1b565b500390565b60208082526017908201527f43616c6c6572206973206e6f742061206d616e61676572000000000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415614ea957614ea9614e1b565b5060010190565b6000808335601e19843603018112614ec757600080fd5b8301803591506001600160401b03821115614ee157600080fd5b6020019150600581901b360382131561349257600080fd5b6000808335601e19843603018112614f1057600080fd5b8301803591506001600160401b03821115614f2a57600080fd5b60200191503681900382131561349257600080fd5b6020808252600e908201526d0e8ded6cadc40dad2e6dac2e8c6d60931b604082015260600190565b602080825260139082015272105b5bdd5b9d081a5b9cdd59999a58da595b9d606a1b604082015260600190565b6020808252601490820152731a5b98dbdc9c9958dd0819995948185b5bdd5b9d60621b604082015260600190565b60005b83811015614fdd578181015183820152602001614fc5565b83811115611f345750506000910152565b6bffffffffffffffffffffffff198560601b16815260006001600160401b0360c01b808660c01b166014840152808560c01b16601c84015250825161503a816024850160208701614fc2565b9190910160240195945050505050565b60006001600160401b0380831681851680830382111561506c5761506c614e1b565b01949350505050565b6020808252602b908201527f616d6f756e74206d7573742062652067726561746572207468616e206d696e2060408201526a1cddd85c08185b5bdd5b9d60aa1b606082015260800190565b60208082526029908201527f616d6f756e74206d757374206265206c6f776572207468616e206d6178207377604082015268185c08185b5bdd5b9d60ba1b606082015260800190565b6020808252601390820152720cadae0e8f240c8e6e840e6eec2e040e0c2e8d606b1b604082015260600190565b600061098a3683614c86565b6000815180845261515a816020860160208601614fc2565b601f01601f19169290920160200192915050565b60208152600082516080602084015260018060a01b038082511660a08501528060208301511660c08501525060408101516151a881614622565b8060e085015250606081015160e06101008501526151ca610180850182614921565b90506080820151609f19858303016101208601526151e88282615142565b60a084015161014087015260c090930151610160860152505060208401516001600160a01b03811660408501529060408501516001600160401b0381166060860152915060608501516001600160401b03811660808601529150611e18565b9384526001600160401b0392909216602084015260408301526001600160a01b0316606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516152ac816017850160208801614fc2565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516152dd816028840160208801614fc2565b01602801949350505050565b602081526000611ddf6020830184615142565b60208082526024908201527f656d7074792073726320737761702070617468206f722073616d6520636861696040820152631b881a5960e21b606082015260800190565b60006080823603121561535257600080fd5b61535a614804565b8235615365816144e9565b815260208301356001600160401b0381111561538057600080fd5b61538c36828601614879565b602083015250604083013560408201526060830135606082015280915050919050565b6020808252600f908201526e1cdc98c81cddd85c0819985a5b1959608a1b604082015260600190565b6000608082360312156153ea57600080fd5b6153f2614804565b82356153fd816144e9565b815260208301356001600160401b0381111561541857600080fd5b61538c36828601614c17565b6000821982111561543757615437614e1b565b500190565b6020808252604a908201527f6272696467656420746f6b656e206d757374206265207468652073616d65206160408201527f732074686520666972737420746f6b656e20696e2064657374696e6174696f6e606082015269040e6eec2e040e0c2e8d60b31b608082015260a00190565b6000608082360312156154be57600080fd5b6154c6614804565b82356154d1816144e9565b815260208301356001600160401b03808211156154ed57600080fd5b6154f936838701614879565b6020840152604085013591508082111561551257600080fd5b5061551f36828601614c17565b604083015250606092830135928101929092525090565b60006020828403121561554857600080fd5b81518015158114611ddf57600080fd5b600081600019048311821515161561557257615572614e1b565b500290565b60008161558657615586614e1b565b506000190190565b634e487b7160e01b600052603160045260246000fd5b85815284602082015260a0604082015260006155c360a0830186614921565b6001600160a01b0394909416606083015250608001529392505050565b600060208083850312156155f357600080fd5b82516001600160401b0381111561560957600080fd5b8301601f8101851361561a57600080fd5b805161562861489a82614856565b81815260059190911b8201830190838101908783111561564757600080fd5b928401925b828410156140a95783518252928401929084019061564c565b602081526000825160a0602084015261568160c0840182615142565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b6000602082840312156156cf57600080fd5b5051919050565b600082516156e8818460208701614fc2565b9190910192915050565b60006020828403121561570457600080fd5b8151611ddf816144e9565b6001600160a01b0386811682526001600160401b0386166020830152841660408201526060810183905260a0608082018190526000906140a99083018461514256feaf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02cccbb695db2dfb79e3f69bcf724d11b850c79b0ae358e62d60ed94044f38a2b9c9cf85f95575c3af1e116e3d37fd41e7f36a8a373623f51ffaaa87fdd032fa767a164736f6c6343000809000aaf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02c0000000000000000000000004066d196a423b2b3b8b054f4f40efb47a74e200c0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000040000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d
Deployed Bytecode
0x6080604052600436106102c55760003560e01c8063815661661161017e578063a8a39d70116100d3578063c9f8b5d21161008f578063dec660361161006c578063dec66036146108bf578063e469020b146108df578063e7881011146108ff578063edffe8e61461092c57005b8063c9f8b5d21461086c578063cf19d8b11461088c578063d547741f1461089f57005b8063a8a39d7014610775578063aaa55fb4146107ad578063affed0e0146107da578063b9a2490c14610819578063ba138e7a1461082c578063bed5919c1461084c57005b8063941acab91161013a578063a1a227fa11610117578063a1a227fa1461070b578063a217fddf1461072b578063a589d31914610740578063a7b2d4ff1461076057005b8063941acab9146106c55780639c649fdf146106e55780639cf96b7f146106f857005b806381566166146106345780638620e7fa1461064757806387d234151461065d578063900ba8841461067057806391d148541461068557806392955b24146106a557005b8063386e07bf116102345780635ab7afc6116101f0578063630dc7cb116101cd578063630dc7cb146105a557806366843590146105c757806379ec8cc7146105f45780637cd2bffc1461062157005b80635ab7afc61461055a5780635b5a66a71461056d5780635c975abb1461058d57005b8063386e07bf1461049a578063457bfa2f146104bc57806348440dee146104f4578063496dbfd914610507578063547cad121461052757806359ce54cb1461054757005b80631b2df850116102835780631b2df850146103c75780631efe4063146103e9578063248a9ca3146104095780632f2ff15d1461043a5780633211dae91461045a57806336568abe1461047a57005b80624aa320146102c757806301ffc9a7146103075780630bcb4982146103375780630c1ed6501461035757806315de3f9d1461036a5780631ace492b1461038a575b005b3480156102d357600080fd5b506102f46102e2366004614511565b60056020526000908152604090205481565b6040519081526020015b60405180910390f35b34801561031357600080fd5b5061032761032236600461452e565b610959565b60405190151581526020016102fe565b61034a610345366004614599565b610990565b6040516102fe9190614632565b6102c5610365366004614688565b610b14565b34801561037657600080fd5b506102c5610385366004614713565b610b6e565b34801561039657600080fd5b506103ba6103a536600461473f565b600a6020526000908152604090205460ff1681565b6040516102fe919061476c565b3480156103d357600080fd5b506102f460008051602061575283398151915281565b3480156103f557600080fd5b506102c561040436600461477a565b610c97565b34801561041557600080fd5b506102f461042436600461473f565b6000908152600160208190526040909120015490565b34801561044657600080fd5b506102c5610455366004614796565b610ce7565b34801561046657600080fd5b506102c56104753660046148ed565b610d13565b34801561048657600080fd5b506102c5610495366004614796565b610d97565b3480156104a657600080fd5b506104af610e11565b6040516102fe9190614965565b3480156104c857600080fd5b50600e546104dc906001600160a01b031681565b6040516001600160a01b0390911681526020016102fe565b6102c561050236600461498a565b610e22565b34801561051357600080fd5b506102c5610522366004614713565b610ecb565b34801561053357600080fd5b506102c5610542366004614511565b610f1b565b6102c561055536600461498a565b610fa3565b61034a610568366004614a0e565b61105d565b34801561057957600080fd5b506102c5610588366004614511565b6111d5565b34801561059957600080fd5b5060025460ff16610327565b3480156105b157600080fd5b506102f460008051602061579283398151915281565b3480156105d357600080fd5b506102f46105e2366004614511565b600b6020526000908152604090205481565b34801561060057600080fd5b506102f461060f366004614511565b60086020526000908152604090205481565b61034a61062f366004614a0e565b61122b565b6102c561064236600461498a565b6113c9565b34801561065357600080fd5b506102f4600d5481565b6102c561066b36600461498a565b61143b565b34801561067c57600080fd5b506102c5611582565b34801561069157600080fd5b506103276106a0366004614796565b6115c0565b3480156106b157600080fd5b506102c56106c0366004614713565b6115eb565b3480156106d157600080fd5b506102c56106e0366004614713565b6116b4565b61034a6106f3366004614aa4565b61173a565b6102c561070636600461498a565b61176e565b34801561071757600080fd5b506000546104dc906001600160a01b031681565b34801561073757600080fd5b506102f4600081565b34801561074c57600080fd5b506102c561075b366004614713565b611886565b34801561076c57600080fd5b506102c56118d6565b34801561078157600080fd5b506102f4610790366004614af0565b600660209081526000928352604080842090915290825290205481565b3480156107b957600080fd5b506102f46107c8366004614511565b60076020526000908152604090205481565b3480156107e657600080fd5b50600e5461080190600160a01b90046001600160401b031681565b6040516001600160401b0390911681526020016102fe565b6102c5610827366004614688565b611912565b34801561083857600080fd5b506102c56108473660046148ed565b6119f8565b34801561085857600080fd5b506102c561086736600461473f565b611a78565b34801561087857600080fd5b506102c5610887366004614713565b611b41565b6102c561089a36600461498a565b611bc7565b3480156108ab57600080fd5b506102c56108ba366004614796565b611d08565b3480156108cb57600080fd5b506102c56108da366004614713565b611d2f565b3480156108eb57600080fd5b506102c56108fa36600461473f565b611d6e565b34801561090b57600080fd5b506102f461091a366004614511565b600c6020526000908152604090205481565b34801561093857600080fd5b506102f4610947366004614b1e565b60096020526000908152604090205481565b60006001600160e01b03198216637965db0b60e01b148061098a57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600080546001600160a01b031633146109c45760405162461bcd60e51b81526004016109bb90614b39565b60405180910390fd5b6002600f5414156109e75760405162461bcd60e51b81526004016109bb90614b70565b6002600f556109f860025460ff1690565b15610a155760405162461bcd60e51b81526004016109bb90614ba7565b81610a2e600080516020615792833981519152826115c0565b610a4a5760405162461bcd60e51b81526004016109bb90614bd1565b6000610a5885870187614d3b565b90506000610aa682602001514684606001518a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611de692505050565b9050610ab789898460200151611e20565b6000818152600a602052604090819020805460ff19166002908117909155905160008051602061577283398151915290610af69084908c908590614ddf565b60405180910390a160019450505050506001600f5595945050505050565b333214610b335760405162461bcd60e51b81526004016109bb90614dfa565b610b486001600160a01b038416333088611f4e565b6000610b543486611fb9565b9050610b6587878787878787612039565b50505050505050565b6002600f541415610b915760405162461bcd60e51b81526004016109bb90614b70565b6002600f5533600090815260076020526040902054610be65760405162461bcd60e51b81526020600482015260116024820152703737ba1030b71034b73a32b3b930ba37b960791b60448201526064016109bb565b3360009081526006602090815260408083206001600160a01b0386168452909152902054811115610c4b5760405162461bcd60e51b815260206004820152600f60248201526e6e6f7420656e6f756768206665657360881b60448201526064016109bb565b610c56828233611e20565b3360009081526006602090815260408083206001600160a01b038616845290915281208054839290610c89908490614e31565b90915550506001600f555050565b610caf600080516020615752833981519152336115c0565b610ccb5760405162461bcd60e51b81526004016109bb90614e48565b6001600160401b03909116600090815260096020526040902055565b60008281526001602081905260409091200154610d048133612275565b610d0e83836122d9565b505050565b610d2b600080516020615752833981519152336115c0565b610d475760405162461bcd60e51b81526004016109bb90614e48565b60005b8151811015610d9357610d80828281518110610d6857610d68614e7f565b6020026020010151600361234490919063ffffffff16565b5080610d8b81614e95565b915050610d4a565b5050565b6001600160a01b0381163314610e075760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109bb565b610d938282612359565b6060610e1d60036123c0565b905090565b333214610e415760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff1615610e645760405162461bcd60e51b81526004016109bb90614ba7565b610eae333087610e776020880188614eb0565b6000818110610e8857610e88614e7f565b9050602002016020810190610e9d9190614511565b6001600160a01b0316929190611f4e565b6000610eba3486611fb9565b9050610b65878787878787876123cd565b610ee3600080516020615752833981519152336115c0565b610eff5760405162461bcd60e51b81526004016109bb90614e48565b6001600160a01b039091166000908152600b6020526040902055565b610f33600080516020615752833981519152336115c0565b610f4f5760405162461bcd60e51b81526004016109bb90614e48565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f3f8223bcd8b3b875473e9f9e14e1ad075451a2b5ffd31591655da9a01516bf5e9060200160405180910390a150565b333214610fc25760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff1615610fe55760405162461bcd60e51b81526004016109bb90614ba7565b611040333087611035610ffb6020890189614ef9565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061259492505050565b60601c929190611f4e565b600061104c3486611fb9565b9050610b658787878787878761259b565b600080546001600160a01b031633146110885760405162461bcd60e51b81526004016109bb90614b39565b6002600f5414156110ab5760405162461bcd60e51b81526004016109bb90614b70565b6002600f556110bc60025460ff1690565b156110d95760405162461bcd60e51b81526004016109bb90614ba7565b816110f2600080516020615792833981519152826115c0565b61110e5760405162461bcd60e51b81526004016109bb90614bd1565b600061111c85870187614d3b565b90506000611166826020015189468a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611de692505050565b90506111778a8a8460200151611e20565b6000818152600a602052604090819020805460ff191660039081179091559051600080516020615772833981519152906111b69084908d908590614ddf565b60405180910390a150506001600f555060009998505050505050505050565b6111ed600080516020615752833981519152336115c0565b6112095760405162461bcd60e51b81526004016109bb90614e48565b600e80546001600160a01b0319166001600160a01b0392909216919091179055565b600080546001600160a01b031633146112565760405162461bcd60e51b81526004016109bb90614b39565b6002600f5414156112795760405162461bcd60e51b81526004016109bb90614b70565b6002600f5561128a60025460ff1690565b156112a75760405162461bcd60e51b81526004016109bb90614ba7565b816112c0600080516020615792833981519152826115c0565b6112dc5760405162461bcd60e51b81526004016109bb90614bd1565b60006112ea85870187614d3b565b90506000611334826020015189468a8a8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611de692505050565b90506113498260000151602001518b8b612757565b9850600182516040015160028111156113645761136461460c565b141561137b576113768a8a838561289a565b6113b2565b600282516040015160028111156113945761139461460c565b14156113a6576113768a8a8385612a1a565b6113b28a8a8385612b2c565b600193505050506001600f55979650505050505050565b3332146113e85760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff161561140b5760405162461bcd60e51b81526004016109bb90614ba7565b61141e333087610e776020880188614eb0565b600061142a3486611fb9565b9050610b6587878787878787612c59565b33321461145a5760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff161561147d5760405162461bcd60e51b81526004016109bb90614ba7565b600e546001600160a01b03166114966020850185614eb0565b60008181106114a7576114a7614e7f565b90506020020160208101906114bc9190614511565b6001600160a01b0316146114e25760405162461bcd60e51b81526004016109bb90614f3f565b843410156115025760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b15801561155257600080fd5b505af1158015611566573d6000803e3d6000fd5b50505050506000610eba863461157c9190614e31565b86611fb9565b61159a600080516020615752833981519152336115c0565b6115b65760405162461bcd60e51b81526004016109bb90614e48565b6115be612e13565b565b60009182526001602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611603600080516020615752833981519152336115c0565b61161f5760405162461bcd60e51b81526004016109bb90614e48565b6001600160a01b0382166000908152600560205260409020548111156116785760405162461bcd60e51b815260206004820152600e60248201526d616d6f756e7420746f6f2062696760901b60448201526064016109bb565b611683828233611e20565b6001600160a01b038216600090815260056020526040812080548392906116ab908490614e31565b90915550505050565b6116cc600080516020615752833981519152336115c0565b6116e85760405162461bcd60e51b81526004016109bb90614e48565b620f424081111561170b5760405162461bcd60e51b81526004016109bb90614f94565b6001600160a01b03821661171e57600080fd5b6001600160a01b03909116600090815260076020526040902055565b600080546001600160a01b031633146117655760405162461bcd60e51b81526004016109bb90614b39565b95945050505050565b33321461178d5760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff16156117b05760405162461bcd60e51b81526004016109bb90614ba7565b600e546001600160a01b03166117cc610ffb6020860186614ef9565b60601c146117ec5760405162461bcd60e51b81526004016109bb90614f3f565b8434101561180c5760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b15801561185c57600080fd5b505af1158015611870573d6000803e3d6000fd5b5050505050600061104c863461157c9190614e31565b61189e600080516020615752833981519152336115c0565b6118ba5760405162461bcd60e51b81526004016109bb90614e48565b6001600160a01b039091166000908152600c6020526040902055565b6118ee600080516020615752833981519152336115c0565b61190a5760405162461bcd60e51b81526004016109bb90614e48565b6115be612e88565b3332146119315760405162461bcd60e51b81526004016109bb90614dfa565b600e546001600160a01b0384811691161461195e5760405162461bcd60e51b81526004016109bb90614f3f565b8434101561197e5760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b1580156119ce57600080fd5b505af11580156119e2573d6000803e3d6000fd5b50505050506000610b54863461157c9190614e31565b611a10600080516020615752833981519152336115c0565b611a2c5760405162461bcd60e51b81526004016109bb90614e48565b60005b8151811015610d9357611a65828281518110611a4d57611a4d614e7f565b60200260200101516003611dca90919063ffffffff16565b5080611a7081614e95565b915050611a2f565b611a90600080516020615752833981519152336115c0565b611aac5760405162461bcd60e51b81526004016109bb90614e48565b604051600090339061c35090849084818181858888f193505050503d8060008114611af3576040519150601f19603f3d011682016040523d82523d6000602084013e611af8565b606091505b5050905080610d935760405162461bcd60e51b81526020600482015260156024820152746661696c656420746f2073656e64206e617469766560581b60448201526064016109bb565b611b59600080516020615752833981519152336115c0565b611b755760405162461bcd60e51b81526004016109bb90614e48565b620f4240811115611b985760405162461bcd60e51b81526004016109bb90614f94565b6001600160a01b038216611bab57600080fd5b6001600160a01b03909116600090815260086020526040902055565b333214611be65760405162461bcd60e51b81526004016109bb90614dfa565b60025460ff1615611c095760405162461bcd60e51b81526004016109bb90614ba7565b600e546001600160a01b0316611c226020850185614eb0565b6000818110611c3357611c33614e7f565b9050602002016020810190611c489190614511565b6001600160a01b031614611c6e5760405162461bcd60e51b81526004016109bb90614f3f565b84341015611c8e5760405162461bcd60e51b81526004016109bb90614f67565b600e60009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b158015611cde57600080fd5b505af1158015611cf2573d6000803e3d6000fd5b5050505050600061142a863461157c9190614e31565b60008281526001602081905260409091200154611d258133612275565b610d0e8383612359565b611d47600080516020615752833981519152336115c0565b611d635760405162461bcd60e51b81526004016109bb90614e48565b610d93828233611e20565b611d86600080516020615752833981519152336115c0565b611da25760405162461bcd60e51b81526004016109bb90614e48565b620f4240811115611dc55760405162461bcd60e51b81526004016109bb90614f94565b600d55565b6000611ddf836001600160a01b038416612f02565b9392505050565b600084848484604051602001611dff9493929190614fee565b6040516020818303038152906040528051906020012090505b949350505050565b600e546001600160a01b0384811691161415611f3a57600e54604051632e1a7d4d60e01b8152600481018490526001600160a01b0390911690632e1a7d4d90602401600060405180830381600087803b158015611e7c57600080fd5b505af1158015611e90573d6000803e3d6000fd5b505050506000816001600160a01b03168361c35090604051600060405180830381858888f193505050503d8060008114611ee6576040519150601f19603f3d011682016040523d82523d6000602084013e611eeb565b606091505b5050905080611f345760405162461bcd60e51b81526020600482015260156024820152746661696c656420746f2073656e64206e617469766560581b60448201526064016109bb565b50505050565b610d0e6001600160a01b0384168284612f51565b6040516001600160a01b0380851660248301528316604482015260648101829052611f349085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612f81565b6001600160401b0381166000908152600960205260408120548310156120165760405162461bcd60e51b8152602060048201526012602482015271746f6f206665772063727970746f2066656560701b60448201526064016109bb565b6001600160401b038216600090815260096020526040812054611e189085614e31565b6001600e60148282829054906101000a90046001600160401b031661205e919061504a565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506000469050806001600160401b0316866001600160401b031614156120d95760405162461bcd60e51b815260206004820152600d60248201526c1cd85b594818da185a5b881a59609a1b60448201526064016109bb565b6001600160a01b0385166000908152600b60205260409020548710156121115760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0385166000908152600c60205260409020548711156121495760405162461bcd60e51b81526004016109bb906150c0565b60006121586060860186614eb0565b9050116121775760405162461bcd60e51b81526004016109bb90615109565b600060405180608001604052808661218e90615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b03168152602001886001600160401b03168152506040516020016121e3919061516e565b6040516020818303038152906040529050600061220233848a85611de6565b905061222b8a888b8b600e60149054906101000a90046001600160401b03168a8860018c613053565b507f072d004cb42c4f14203ea1fc0d4504116cab7bf0c0bcd417b96d645ab9a8671781898b8a6040516122619493929190615247565b60405180910390a150505050505050505050565b61227f82826115c0565b610d9357612297816001600160a01b03166014613088565b6122a2836020613088565b6040516020016122b3929190615274565b60408051601f198184030181529082905262461bcd60e51b82526109bb916004016152e9565b6122e382826115c0565b610d935760008281526001602081815260408084206001600160a01b0386168086529252808420805460ff19169093179092559051339285917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d9190a45050565b6000611ddf836001600160a01b038416613223565b61236382826115c0565b15610d935760008281526001602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000611ddf83613316565b6001600e60148282829054906101000a90046001600160401b03166123f2919061504a565b92506101000a8154816001600160401b0302191690836001600160401b031602179055506000469050600185806020019061242d9190614eb0565b905011801561244e5750806001600160401b0316866001600160401b031614155b61246a5760405162461bcd60e51b81526004016109bb906152fc565b60006124796020870187614eb0565b600161248860208a018a614eb0565b612493929150614e31565b8181106124a2576124a2614e7f565b90506020020160208101906124b79190614511565b90508760006124ce6124c889615340565b8b613372565b92509050806124ef5760405162461bcd60e51b81526004016109bb906153af565b6001600160a01b0383166000908152600b60205260409020548210156125275760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0383166000908152600c602052604090205482111561255f5760405162461bcd60e51b81526004016109bb906150c0565b6125878b8b868c8c8c8c600e60149054906101000a90046001600160401b03168d8c8c613499565b5050505050505050505050565b6020015190565b6001600e60148282829054906101000a90046001600160401b03166125c0919061504a565b92506101000a8154816001600160401b0302191690836001600160401b03160217905550600046905060148580602001906125fb9190614ef9565b905011801561261c5750806001600160401b0316866001600160401b031614155b6126385760405162461bcd60e51b81526004016109bb906152fc565b600061268461264a6020880188614ef9565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506135e592505050565b60601c905087600061269e612698896153d8565b8b613601565b92509050806126bf5760405162461bcd60e51b81526004016109bb906153af565b6001600160a01b0383166000908152600b60205260409020548210156126f75760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0383166000908152600c602052604090205482111561272f5760405162461bcd60e51b81526004016109bb906150c0565b6125878b8b868c8c8c8c600e60149054906101000a90046001600160401b03168d8c8c613714565b6001600160a01b038316600090815260076020526040812054801561283a576001600160a01b0385166000908152600860205260408120549061279e8584620f4240613829565b905060006127b08284620f4240613829565b90506127bc8183614e31565b6001600160a01b03808a166000908152600660209081526040808320938c16835292905290812080549091906127f3908490615424565b90915550506001600160a01b03871660009081526005602052604081208054839290612820908490615424565b9091555061283090508287614e31565b9450505050612892565b61285883600d54620f424061284f9190614e31565b620f4240613829565b91506128648284614e31565b6001600160a01b0385166000908152600560205260408120805490919061288c908490615424565b90915550505b509392505050565b8051608001516020015160601c6001600160a01b0316846001600160a01b0316146128d75760405162461bcd60e51b81526004016109bb9061543c565b805160800151516014106129215760405162461bcd60e51b8152602060048201526011602482015270191cdd081cddd85c08195e1c1958dd1959607a1b60448201526064016109bb565b60408051608080820183528351516001600160a01b03168252835101516020820152825160a0015191810191909152815160c00151606082015260009081908161296b8288613601565b9450905080156129b65761299361298583602001516135e5565b60601c858760200151611e20565b6000868152600a60205260409020805460ff1916600190811790915592506129e7565b6129c588888760200151611e20565b6000868152600a60205260409020805460ff1916600390811790915587945092505b600080516020615772833981519152868585604051612a0893929190614ddf565b60405180910390a15050505050505050565b8051606001518051600090612a3157612a31614e7f565b60200260200101516001600160a01b0316846001600160a01b031614612a695760405162461bcd60e51b81526004016109bb9061543c565b80516060015151600114612ab55760405162461bcd60e51b8152602060048201526013602482015272191cdd08189c9a5919d948195e1c1958dd1959606a1b60448201526064016109bb565b612ae6816000015160600151600081518110612ad357612ad3614e7f565b6020026020010151848360200151611e20565b6000828152600a6020526040808220805460ff191690555160008051602061577283398151915290612b1d90859087908590614ddf565b60405180910390a15050505050565b8051606001518051600090612b4357612b43614e7f565b60200260200101516001600160a01b0316846001600160a01b031614612b7b5760405162461bcd60e51b81526004016109bb9061543c565b80516060015151600110612bc55760405162461bcd60e51b8152602060048201526011602482015270191cdd081cddd85c08195e1c1958dd1959607a1b60448201526064016109bb565b604080516080810182528251516001600160a01b0316815282516060908101516020830152835160a0015192820192909252825160c0015191810191909152600090819081612c148288613372565b9450905080156129b657602082015180516129939190612c3690600190614e31565b81518110612c4657612c46614e7f565b6020026020010151858760200151611e20565b6001600e60148282829054906101000a90046001600160401b0316612c7e919061504a565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555060004690506001858060200190612cb99190614eb0565b9050118015612cda5750806001600160401b0316866001600160401b031614155b612cf65760405162461bcd60e51b81526004016109bb906152fc565b6000612d056020870187614eb0565b6001612d1460208a018a614eb0565b612d1f929150614e31565b818110612d2e57612d2e614e7f565b9050602002016020810190612d439190614511565b9050876000612d5a612d54896154ac565b8b6139ae565b9250905080612d7b5760405162461bcd60e51b81526004016109bb906153af565b6001600160a01b0383166000908152600b6020526040902054821015612db35760405162461bcd60e51b81526004016109bb90615075565b6001600160a01b0383166000908152600c6020526040902054821115612deb5760405162461bcd60e51b81526004016109bb906150c0565b6125878b8b868c8c8c8c600e60149054906101000a90046001600160401b03168d8c8c613b5e565b60025460ff1615612e365760405162461bcd60e51b81526004016109bb90614ba7565b6002805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258612e6b3390565b6040516001600160a01b03909116815260200160405180910390a1565b60025460ff16612ed15760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109bb565b6002805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33612e6b565b6000818152600183016020526040812054612f495750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561098a565b50600061098a565b6040516001600160a01b038316602482015260448101829052610d0e90849063a9059cbb60e01b90606401611f82565b6000612fd6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613c5d9092919063ffffffff16565b805190915015610d0e5780806020019051810190612ff49190615536565b610d0e5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109bb565b600061307a8a8a8a8a8a8a8a8a60008054906101000a90046001600160a01b03168b613c6c565b9a9950505050505050505050565b60606000613097836002615558565b6130a2906002615424565b6001600160401b038111156130b9576130b96147c6565b6040519080825280601f01601f1916602001820160405280156130e3576020820181803683370190505b509050600360fc1b816000815181106130fe576130fe614e7f565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061312d5761312d614e7f565b60200101906001600160f81b031916908160001a9053506000613151846002615558565b61315c906001615424565b90505b60018111156131d4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061319057613190614e7f565b1a60f81b8282815181106131a6576131a6614e7f565b60200101906001600160f81b031916908160001a90535060049490941c936131cd81615577565b905061315f565b508315611ddf5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109bb565b6000818152600183016020526040812054801561330c576000613247600183614e31565b855490915060009061325b90600190614e31565b90508181146132c057600086600001828154811061327b5761327b614e7f565b906000526020600020015490508087600001848154811061329e5761329e614e7f565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806132d1576132d161558e565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061098a565b600091505061098a565b60608160000180548060200260200160405190810160405280929190818152602001828054801561336657602002820191906000526020600020905b815481526020019060010190808311613352575b50505050509050919050565b8151600090819061338590600390613d7e565b61339457506000905080613492565b6133c184602001516000815181106133ae576133ae614e7f565b6020026020010151848660000151613da0565b83600001516001600160a01b03166338ed173984866060015187602001513089604001516040518663ffffffff1660e01b81526004016134059594939291906155a4565b600060405180830381600087803b15801561341f57600080fd5b505af192505050801561345457506040513d6000823e601f3d908101601f1916820160405261345191908101906155e0565b60015b61346357506000905080613492565b600181600183516134749190614e31565b8151811061348457613484614e7f565b602002602001015192509250505b9250929050565b60006134a86060880188614eb0565b9050116134c75760405162461bcd60e51b81526004016109bb90615109565b60006040518060800160405280886134de90615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b031681526020018a6001600160401b0316815250604051602001613533919061516e565b60405160208183030381529060405290506000613552338c8c85611de6565b90506135668d85858d8a8c8860018d613053565b507f9031eabb05761a3180d68e266249876dcaf832f476e41feefe97c19d7826445e818b8e61359860208e018e614eb0565b60008181106135a9576135a9614e7f565b90506020020160208101906135be9190614511565b6040516135ce9493929190615247565b60405180910390a150505050505050505050505050565b6000808251600c6135f69190615424565b929092015192915050565b600080600061361e85600001516003613d7e90919063ffffffff16565b61362f576000809250925050613492565b61364f61364186602001516020015190565b60601c858760000151613da0565b6040805160a081018252602080880151825230908201528682015181830152606080820187905287015160808201528651915163c04b8d5960e01b815290916001600160a01b03169063c04b8d59906136ac908490600401615665565b602060405180830381600087803b1580156136c657600080fd5b505af19250505080156136f6575060408051601f3d908101601f191682019092526136f3918101906156bd565b60015b6137065750600092509050613492565b600194509250613492915050565b60006137236060880188614eb0565b9050116137425760405162461bcd60e51b81526004016109bb90615109565b600060405180608001604052808861375990615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b031681526020018a6001600160401b03168152506040516020016137ae919061516e565b604051602081830303815290604052905060006137cd338c8c85611de6565b90506137e18d85858d8a8c8860018d613053565b507f4eb5d441f9e6755d5c8841ba146efcc9927c88c3a96f5b7f4a2fc08a4c75fcd7818b8e613816610ffb60208f018f614ef9565b60601c6040516135ce9493929190615247565b600080806000198587098587029250828110838203039150508060001415613863576000841161385857600080fd5b508290049050611ddf565b80841161386f57600080fd5b60008486880980840393811190920391905060008561389081600019614e31565b61389b906001615424565b169586900495938490049360008190030460010190506138bb8184615558565b9093179260006138cc876003615558565b60021890506138db8188615558565b6138e6906002614e31565b6138f09082615558565b90506138fc8188615558565b613907906002614e31565b6139119082615558565b905061391d8188615558565b613928906002614e31565b6139329082615558565b905061393e8188615558565b613949906002614e31565b6139539082615558565b905061395f8188615558565b61396a906002614e31565b6139749082615558565b90506139808188615558565b61398b906002614e31565b6139959082615558565b90506139a18186615558565b9998505050505050505050565b815160009081906139c190600390613d7e565b6139d057506000905080613492565b6139ea84602001516000815181106133ae576133ae614e7f565b6020840151805160009190613a0190600190614e31565b81518110613a1157613a11614e7f565b60209081029190910101516040516370a0823160e01b81523060048201529091506000906001600160a01b038316906370a082319060240160206040518083038186803b158015613a6157600080fd5b505afa158015613a75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a9991906156bd565b9050613aad86600001518760400151613f41565b506040516370a0823160e01b815230600482015260009082906001600160a01b038516906370a082319060240160206040518083038186803b158015613af257600080fd5b505afa158015613b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b2a91906156bd565b613b349190614e31565b905086606001518110613b4f57600194509250613492915050565b50600096879650945050505050565b6000613b6d6060880188614eb0565b905011613b8c5760405162461bcd60e51b81526004016109bb90615109565b6000604051806080016040528088613ba390615136565b8152602001336001600160a01b03168152602001600e60149054906101000a90046001600160401b03166001600160401b031681526020018a6001600160401b0316815250604051602001613bf8919061516e565b60405160208183030381529060405290506000613c17338c8c85611de6565b9050613c2b8d85858d8a8c8860018d613053565b507f8fc041fb1bcb4ef7c4232fc09dc11530c94a59fca667a6f99d04a1329e214eae818b8e61359860208e018e614eb0565b6060611e188484600085613f83565b60006001846006811115613c8257613c8261460c565b1415613ca057613c998b8b8b8b8b8b8b8a8a6140b4565b905061307a565b6002846006811115613cb457613cb461460c565b1480613cd157506004846006811115613ccf57613ccf61460c565b145b15613cdd576000613c99565b6003846006811115613cf157613cf161460c565b1480613d0e57506005846006811115613d0c57613d0c61460c565b145b80613d2a57506006846006811115613d2857613d2861460c565b145b15613d36576000613c99565b60405162461bcd60e51b815260206004820152601960248201527f6272696467652074797065206e6f7420737570706f727465640000000000000060448201526064016109bb565b6001600160a01b03811660009081526001830160205260408120541515611ddf565b604051636eb1769f60e11b81523060048201526001600160a01b0382811660248301526000919085169063dd62ed3e9060440160206040518083038186803b158015613deb57600080fd5b505afa158015613dff573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e2391906156bd565b905082811015611f345780613e4d57613e486001600160a01b038516836000196142cb565b611f34565b60405163095ea7b360e01b81526001600160a01b038381166004830152600019602483015285169063095ea7b390604401602060405180830381600087803b158015613e9857600080fd5b505af1925050508015613ec8575060408051601f3d908101601f19168201909252613ec591810190615536565b60015b613ef757613ee16001600160a01b0385168360006142cb565b613e486001600160a01b038516836000196142cb565b600181151514613f3a5760405162461bcd60e51b815260206004820152600e60248201526d185c1c1c9bdd994819985a5b195960921b60448201526064016109bb565b5050505050565b6060611ddf83836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250613c5d565b606082471015613fe45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109bb565b6001600160a01b0385163b61403b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109bb565b600080866001600160a01b0316858760405161405791906156d6565b60006040518083038185875af1925050503d8060008114614094576040519150601f19603f3d011682016040523d82523d6000602084013e614099565b606091505b50915091506140a98282866143ef565b979650505050505050565b600080836001600160a01b03166382980dc46040518163ffffffff1660e01b815260040160206040518083038186803b1580156140f057600080fd5b505afa158015614104573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061412891906156f2565b905061413e6001600160a01b038b16828b614428565b60405163a5977fbb60e01b81526001600160a01b038c811660048301528b81166024830152604482018b90526001600160401b03808b1660648401528916608483015263ffffffff881660a483015282169063a5977fbb9060c401600060405180830381600087803b1580156141b357600080fd5b505af11580156141c7573d6000803e3d6000fd5b50506040516bffffffffffffffffffffffff1930606090811b821660208401528f811b821660348401528e901b166048820152605c81018c90526001600160c01b031960c08c811b8216607c8401528b811b8216608484015246901b16608c8201526000925060940190506040516020818303038152906040528051906020012090506000865111156142bc57846001600160a01b0316634289fbb3858e8c86868c6040518763ffffffff1660e01b815260040161428995949392919061570f565b6000604051808303818588803b1580156142a257600080fd5b505af11580156142b6573d6000803e3d6000fd5b50505050505b9b9a5050505050505050505050565b8015806143545750604051636eb1769f60e11b81523060048201526001600160a01b03838116602483015284169063dd62ed3e9060440160206040518083038186803b15801561431a57600080fd5b505afa15801561432e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061435291906156bd565b155b6143bf5760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527520746f206e6f6e2d7a65726f20616c6c6f77616e636560501b60648201526084016109bb565b6040516001600160a01b038316602482015260448101829052610d0e90849063095ea7b360e01b90606401611f82565b606083156143fe575081611ddf565b82511561440e5782518084602001fd5b8160405162461bcd60e51b81526004016109bb91906152e9565b604051636eb1769f60e11b81523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b15801561447457600080fd5b505afa158015614488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144ac91906156bd565b6144b69190615424565b6040516001600160a01b038516602482015260448101829052909150611f3490859063095ea7b360e01b90606401611f82565b6001600160a01b03811681146144fe57600080fd5b50565b803561450c816144e9565b919050565b60006020828403121561452357600080fd5b8135611ddf816144e9565b60006020828403121561454057600080fd5b81356001600160e01b031981168114611ddf57600080fd5b60008083601f84011261456a57600080fd5b5081356001600160401b0381111561458157600080fd5b60208301915083602082850101111561349257600080fd5b6000806000806000608086880312156145b157600080fd5b85356145bc816144e9565b94506020860135935060408601356001600160401b038111156145de57600080fd5b6145ea88828901614558565b90945092505060608601356145fe816144e9565b809150509295509295909350565b634e487b7160e01b600052602160045260246000fd5b600381106144fe576144fe61460c565b6020810161463f83614622565b91905290565b80356001600160401b038116811461450c57600080fd5b600060e0828403121561466e57600080fd5b50919050565b803563ffffffff8116811461450c57600080fd5b60008060008060008060c087890312156146a157600080fd5b86356146ac816144e9565b9550602087013594506146c160408801614645565b935060608701356146d1816144e9565b925060808701356001600160401b038111156146ec57600080fd5b6146f889828a0161465c565b92505061470760a08801614674565b90509295509295509295565b6000806040838503121561472657600080fd5b8235614731816144e9565b946020939093013593505050565b60006020828403121561475157600080fd5b5035919050565b600481106147685761476861460c565b9052565b6020810161098a8284614758565b6000806040838503121561478d57600080fd5b61473183614645565b600080604083850312156147a957600080fd5b8235915060208301356147bb816144e9565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b03811182821017156147fe576147fe6147c6565b60405290565b604051608081016001600160401b03811182821017156147fe576147fe6147c6565b604051601f8201601f191681016001600160401b038111828210171561484e5761484e6147c6565b604052919050565b60006001600160401b0382111561486f5761486f6147c6565b5060051b60200190565b600082601f83011261488a57600080fd5b8135602061489f61489a83614856565b614826565b82815260059290921b840181019181810190868411156148be57600080fd5b8286015b848110156148e25780356148d5816144e9565b83529183019183016148c2565b509695505050505050565b6000602082840312156148ff57600080fd5b81356001600160401b0381111561491557600080fd5b611e1884828501614879565b600081518084526020808501945080840160005b8381101561495a5781516001600160a01b031687529582019590820190600101614935565b509495945050505050565b602081526000611ddf6020830184614921565b60006080828403121561466e57600080fd5b60008060008060008060c087890312156149a357600080fd5b86356149ae816144e9565b9550602087013594506149c360408801614645565b935060608701356001600160401b03808211156149df57600080fd5b6149eb8a838b01614978565b94506080890135915080821115614a0157600080fd5b506146f889828a0161465c565b600080600080600080600060c0888a031215614a2957600080fd5b8735614a34816144e9565b96506020880135614a44816144e9565b955060408801359450614a5960608901614645565b935060808801356001600160401b03811115614a7457600080fd5b614a808a828b01614558565b90945092505060a0880135614a94816144e9565b8091505092959891949750929550565b600080600080600060808688031215614abc57600080fd5b8535614ac7816144e9565b9450614ad560208701614645565b935060408601356001600160401b038111156145de57600080fd5b60008060408385031215614b0357600080fd5b8235614b0e816144e9565b915060208301356147bb816144e9565b600060208284031215614b3057600080fd5b611ddf82614645565b60208082526019908201527f63616c6c6572206973206e6f74206d6573736167652062757300000000000000604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b60208082526019908201527f43616c6c6572206973206e6f7420616e206578656375746f7200000000000000604082015260600190565b80356003811061450c57600080fd5b600082601f830112614c2857600080fd5b81356001600160401b03811115614c4157614c416147c6565b614c54601f8201601f1916602001614826565b818152846020838601011115614c6957600080fd5b816020850160208301376000918101602001919091529392505050565b600060e08284031215614c9857600080fd5b614ca06147dc565b9050614cab82614501565b8152614cb960208301614501565b6020820152614cca60408301614c08565b604082015260608201356001600160401b0380821115614ce957600080fd5b614cf585838601614879565b60608401526080840135915080821115614d0e57600080fd5b50614d1b84828501614c17565b60808301525060a082013560a082015260c082013560c082015292915050565b600060208284031215614d4d57600080fd5b81356001600160401b0380821115614d6457600080fd5b9083019060808286031215614d7857600080fd5b614d80614804565b823582811115614d8f57600080fd5b614d9b87828601614c86565b82525060208301359150614dae826144e9565b816020820152614dc060408401614645565b6040820152614dd160608401614645565b606082015295945050505050565b8381526020810183905260608101611e186040830184614758565b6020808252600790820152664e6f7420454f4160c81b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015614e4357614e43614e1b565b500390565b60208082526017908201527f43616c6c6572206973206e6f742061206d616e61676572000000000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415614ea957614ea9614e1b565b5060010190565b6000808335601e19843603018112614ec757600080fd5b8301803591506001600160401b03821115614ee157600080fd5b6020019150600581901b360382131561349257600080fd5b6000808335601e19843603018112614f1057600080fd5b8301803591506001600160401b03821115614f2a57600080fd5b60200191503681900382131561349257600080fd5b6020808252600e908201526d0e8ded6cadc40dad2e6dac2e8c6d60931b604082015260600190565b602080825260139082015272105b5bdd5b9d081a5b9cdd59999a58da595b9d606a1b604082015260600190565b6020808252601490820152731a5b98dbdc9c9958dd0819995948185b5bdd5b9d60621b604082015260600190565b60005b83811015614fdd578181015183820152602001614fc5565b83811115611f345750506000910152565b6bffffffffffffffffffffffff198560601b16815260006001600160401b0360c01b808660c01b166014840152808560c01b16601c84015250825161503a816024850160208701614fc2565b9190910160240195945050505050565b60006001600160401b0380831681851680830382111561506c5761506c614e1b565b01949350505050565b6020808252602b908201527f616d6f756e74206d7573742062652067726561746572207468616e206d696e2060408201526a1cddd85c08185b5bdd5b9d60aa1b606082015260800190565b60208082526029908201527f616d6f756e74206d757374206265206c6f776572207468616e206d6178207377604082015268185c08185b5bdd5b9d60ba1b606082015260800190565b6020808252601390820152720cadae0e8f240c8e6e840e6eec2e040e0c2e8d606b1b604082015260600190565b600061098a3683614c86565b6000815180845261515a816020860160208601614fc2565b601f01601f19169290920160200192915050565b60208152600082516080602084015260018060a01b038082511660a08501528060208301511660c08501525060408101516151a881614622565b8060e085015250606081015160e06101008501526151ca610180850182614921565b90506080820151609f19858303016101208601526151e88282615142565b60a084015161014087015260c090930151610160860152505060208401516001600160a01b03811660408501529060408501516001600160401b0381166060860152915060608501516001600160401b03811660808601529150611e18565b9384526001600160401b0392909216602084015260408301526001600160a01b0316606082015260800190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516152ac816017850160208801614fc2565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516152dd816028840160208801614fc2565b01602801949350505050565b602081526000611ddf6020830184615142565b60208082526024908201527f656d7074792073726320737761702070617468206f722073616d6520636861696040820152631b881a5960e21b606082015260800190565b60006080823603121561535257600080fd5b61535a614804565b8235615365816144e9565b815260208301356001600160401b0381111561538057600080fd5b61538c36828601614879565b602083015250604083013560408201526060830135606082015280915050919050565b6020808252600f908201526e1cdc98c81cddd85c0819985a5b1959608a1b604082015260600190565b6000608082360312156153ea57600080fd5b6153f2614804565b82356153fd816144e9565b815260208301356001600160401b0381111561541857600080fd5b61538c36828601614c17565b6000821982111561543757615437614e1b565b500190565b6020808252604a908201527f6272696467656420746f6b656e206d757374206265207468652073616d65206160408201527f732074686520666972737420746f6b656e20696e2064657374696e6174696f6e606082015269040e6eec2e040e0c2e8d60b31b608082015260a00190565b6000608082360312156154be57600080fd5b6154c6614804565b82356154d1816144e9565b815260208301356001600160401b03808211156154ed57600080fd5b6154f936838701614879565b6020840152604085013591508082111561551257600080fd5b5061551f36828601614c17565b604083015250606092830135928101929092525090565b60006020828403121561554857600080fd5b81518015158114611ddf57600080fd5b600081600019048311821515161561557257615572614e1b565b500290565b60008161558657615586614e1b565b506000190190565b634e487b7160e01b600052603160045260246000fd5b85815284602082015260a0604082015260006155c360a0830186614921565b6001600160a01b0394909416606083015250608001529392505050565b600060208083850312156155f357600080fd5b82516001600160401b0381111561560957600080fd5b8301601f8101851361561a57600080fd5b805161562861489a82614856565b81815260059190911b8201830190838101908783111561564757600080fd5b928401925b828410156140a95783518252928401929084019061564c565b602081526000825160a0602084015261568160c0840182615142565b905060018060a01b0360208501511660408401526040840151606084015260608401516080840152608084015160a08401528091505092915050565b6000602082840312156156cf57600080fd5b5051919050565b600082516156e8818460208701614fc2565b9190910192915050565b60006020828403121561570457600080fd5b8151611ddf816144e9565b6001600160a01b0386811682526001600160401b0386166020830152841660408201526060810183905260a0608082018190526000906140a99083018461514256feaf290d8680820aad922855f39b306097b20e28774d6c1ad35a20325630c3a02cccbb695db2dfb79e3f69bcf724d11b850c79b0ae358e62d60ed94044f38a2b9c9cf85f95575c3af1e116e3d37fd41e7f36a8a373623f51ffaaa87fdd032fa767a164736f6c6343000809000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004066d196a423b2b3b8b054f4f40efb47a74e200c0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000000000000000040000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f000000000000000000000000e592427a0aece92de3edee1f18e0157c058615640000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d
-----Decoded View---------------
Arg [0] : _messageBus (address): 0x4066D196A423b2b3B8B054f4F40efB47a74E200C
Arg [1] : _supportedDEXes (address[]): 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D,0xd9e1cE17f2641f24aE83637ab66a2cca9C378B9F,0xE592427A0AEce92De3Edee1F18E0157C05861564,0x1111111254fb6c44bAC0beD2854e76F90643097d
Arg [2] : _nativeWrap (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000004066d196a423b2b3b8b054f4f40efb47a74e200c
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [4] : 0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d
Arg [5] : 000000000000000000000000d9e1ce17f2641f24ae83637ab66a2cca9c378b9f
Arg [6] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Arg [7] : 0000000000000000000000001111111254fb6c44bac0bed2854e76f90643097d
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.