Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 4,428 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Trade RFQT | 21249105 | 5 hrs ago | IN | 4.92 ETH | 0.00112138 | ||||
Trade RFQT | 21247222 | 11 hrs ago | IN | 0 ETH | 0.00173355 | ||||
Trade RFQT | 21244523 | 20 hrs ago | IN | 0.2 ETH | 0.00199877 | ||||
Trade RFQT | 21244254 | 21 hrs ago | IN | 0 ETH | 0.00198612 | ||||
Trade RFQT | 21243076 | 25 hrs ago | IN | 0 ETH | 0.00159445 | ||||
Trade RFQT | 21239823 | 36 hrs ago | IN | 0 ETH | 0.00129373 | ||||
Trade RFQT | 21238707 | 40 hrs ago | IN | 0 ETH | 0.00049905 | ||||
Trade RFQT | 21237559 | 43 hrs ago | IN | 0 ETH | 0.00157734 | ||||
Trade RFQT | 21237540 | 43 hrs ago | IN | 0 ETH | 0.00184174 | ||||
Trade RFQT | 21237535 | 43 hrs ago | IN | 0 ETH | 0.00041168 | ||||
Trade RFQT | 21236260 | 2 days ago | IN | 0 ETH | 0.00082272 | ||||
Trade RFQT | 21235179 | 2 days ago | IN | 0.015 ETH | 0.00121004 | ||||
Trade RFQT | 21235158 | 2 days ago | IN | 0 ETH | 0.00133311 | ||||
Trade RFQT | 21233819 | 2 days ago | IN | 0 ETH | 0.00143459 | ||||
Trade RFQT | 21233815 | 2 days ago | IN | 0 ETH | 0.00033249 | ||||
Trade RFQT | 21233809 | 2 days ago | IN | 0 ETH | 0.00035698 | ||||
Trade RFQT | 21233718 | 2 days ago | IN | 0 ETH | 0.00127339 | ||||
Trade RFQT | 21233176 | 2 days ago | IN | 0.5895858 ETH | 0.00141971 | ||||
Trade RFQT | 21232865 | 2 days ago | IN | 0 ETH | 0.00081438 | ||||
Trade RFQT | 21232005 | 2 days ago | IN | 0 ETH | 0.00111111 | ||||
Trade RFQT | 21229636 | 2 days ago | IN | 0 ETH | 0.00042572 | ||||
Trade RFQT | 21224077 | 3 days ago | IN | 0 ETH | 0.00224351 | ||||
Trade RFQT | 21221568 | 4 days ago | IN | 0 ETH | 0.00148344 | ||||
Trade RFQT | 21218702 | 4 days ago | IN | 2.17224619 ETH | 0.00118075 | ||||
Trade RFQT | 21211672 | 5 days ago | IN | 0 ETH | 0.00141759 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
21249105 | 5 hrs ago | 4.92 ETH | ||||
21244523 | 20 hrs ago | 0.2 ETH | ||||
21235179 | 2 days ago | 0.015 ETH | ||||
21233176 | 2 days ago | 0.5895858 ETH | ||||
21226781 | 3 days ago | 0.007 ETH | ||||
21226781 | 3 days ago | 0.007 ETH | ||||
21225339 | 3 days ago | 0.46480677 ETH | ||||
21225339 | 3 days ago | 0.46480677 ETH | ||||
21223581 | 3 days ago | 58.28172594 ETH | ||||
21223581 | 3 days ago | 58.28172594 ETH | ||||
21222266 | 3 days ago | 29.98327343 ETH | ||||
21222266 | 3 days ago | 29.98327343 ETH | ||||
21218702 | 4 days ago | 2.17224619 ETH | ||||
21215573 | 4 days ago | 33.32302437 ETH | ||||
21215573 | 4 days ago | 33.32302437 ETH | ||||
21209600 | 5 days ago | 20 ETH | ||||
21207985 | 5 days ago | 29.40917889 ETH | ||||
21207985 | 5 days ago | 29.40917889 ETH | ||||
21207758 | 5 days ago | 19.99057692 ETH | ||||
21207758 | 5 days ago | 19.99057692 ETH | ||||
21205538 | 6 days ago | 60 ETH | ||||
21204377 | 6 days ago | 19.98110842 ETH | ||||
21204377 | 6 days ago | 19.98110842 ETH | ||||
21204356 | 6 days ago | 19.97474959 ETH | ||||
21204356 | 6 days ago | 19.97474959 ETH |
Loading...
Loading
Contract Name:
HashflowRouter
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity 0.8.18; import '@openzeppelin/contracts/access/Ownable2Step.sol'; import '@openzeppelin/contracts/security/ReentrancyGuard.sol'; import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol'; import '@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol'; import '@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import '@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol'; import '@openzeppelin/contracts/proxy/utils/Initializable.sol'; import './interfaces/IHashflowPool.sol'; import './interfaces/IHashflowRouter.sol'; import './interfaces/external/IWETH.sol'; import './interfaces/xchain/IHashflowXChainMessenger.sol'; /// @title HashflowRouter /// @author Victor Ionescu /// @notice Implementation of IHashflowRouter. contract HashflowRouter is IHashflowRouter, EIP712, ReentrancyGuard, Ownable2Step, Initializable { using Address for address payable; using Address for address; using ECDSA for bytes32; using SafeERC20 for IERC20; using SafeERC20 for IERC20Permit; mapping(address => bool) public authorizedPools; mapping(bytes32 => mapping(uint16 => mapping(bytes32 => bool))) public authorizedXChainPools; mapping(address => mapping(uint16 => mapping(bytes32 => bool))) public authorizedXChainCallers; mapping(address => mapping(address => bool)) public authorizedXChainMessengersByPool; mapping(address => mapping(address => bool)) public authorizedXChainMessengersByCallee; /// @dev This is used to interact with external accounts, where native token needs to be wrapped. address public immutable _WETH; address public factory; address public limitOrderGuardian; /// @dev To be used for RFQ-m trades, verified by the router. bytes32 internal constant QUOTE_TYPEHASH = keccak256( 'Quote(bytes32 txid,address trader,address pool,address externalAccount,address baseToken,address quoteToken,uint256 baseTokenAmount,uint256 quoteTokenAmount,uint256 quoteExpiry)' ); /// @dev To be used for RFQ-m trades, verified by the router. bytes32 internal constant QUOTE_LIMIT_ORDER_TYPEHASH = keccak256( 'Quote(bytes32 txid,address baseToken,address quoteToken,uint256 baseTokenAmount,uint256 quoteTokenAmount,uint256 quoteExpiry)' ); /// @dev To be used for cross-chain RFQ-m trades, verified by the router. bytes32 internal constant XCHAIN_QUOTE_TYPEHASH = keccak256( 'XChainQuote(bytes32 txid,uint256 srcChainId,uint256 dstChainId,bytes32 dstTrader,address srcPool,address srcExternalAccount,bytes32 dstPool,bytes32 dstExternalAccount,address baseToken,bytes32 quoteToken,uint256 baseTokenAmount,uint256 quoteTokenAmount,uint256 quoteExpiry)' ); mapping(bytes32 => bool) private _usedTxids; constructor(address weth) EIP712('Hashflow - Router', '1.0') { require(weth != address(0), 'HashflowRouter: WETH is 0 address.'); _WETH = weth; } /// @inheritdoc IHashflowRouter function initialize(address _factory) external override initializer onlyOwner { require( _factory != address(0), 'HashflowRouter::initialize Factory cannot be 0 address.' ); factory = _factory; } /// @inheritdoc IHashflowRouter function tradeRFQT(RFQTQuote memory quote) external payable override { _validateRFQTQuote(quote); if (quote.baseToken == address(0)) { require( msg.value == quote.effectiveBaseTokenAmount, 'HashflowRouter::tradeRFQT msg.value should equal effectiveBaseTokenAmount.' ); } else { require( msg.value == 0, 'HashflowRouter::tradeRFQT msg.value should be 0.' ); } _executeRFQTTrade(quote, false); } /// @inheritdoc IHashflowRouter function tradeRFQTWithPermit( RFQTQuote memory quote, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external override { _validateRFQTQuote(quote); require( quote.baseToken != address(0), 'HashflowRouter::tradeRFQTWithPermit baseToken cannot be the native token.' ); require( amountToApprove >= quote.effectiveBaseTokenAmount, 'HashflowRouter::tradeRFQTWithPermit Insufficient amount to approve.' ); _permitERC20( quote.baseToken, _msgSender(), amountToApprove, deadline, v, r, s ); _executeRFQTTrade(quote, false); } /// @inheritdoc IHashflowRouter function tradeRFQM(RFQMQuote memory quote) external override { _validateRFQMQuote(quote); _validateRFQMSignature(quote); _executeRFQMTrade(quote); } /// @inheritdoc IHashflowRouter function tradeRFQMWithPermit( RFQMQuote memory quote, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external override { _validateRFQMQuote(quote); _validateRFQMSignature(quote); require( amountToApprove >= quote.baseTokenAmount, 'HashflowRouter::tradeRFQMWithPermit Insufficient amount to approve.' ); _permitERC20( quote.baseToken, quote.trader, amountToApprove, deadline, v, r, s ); _executeRFQMTrade(quote); } /// @inheritdoc IHashflowRouter function tradeRFQMLimitOrder( RFQMQuote memory quote, bytes memory guardianSignature ) external override { _validateRFQMQuote(quote); _validateRFQMLimitOrderSignature(quote, guardianSignature); _executeRFQMTrade(quote); } /// @inheritdoc IHashflowRouter function tradeRFQMLimitOrderWithPermit( RFQMQuote memory quote, bytes memory guardianSignature, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external override { _validateRFQMQuote(quote); _validateRFQMLimitOrderSignature(quote, guardianSignature); require( amountToApprove >= quote.baseTokenAmount, 'HashflowRouter::tradeRFQMLimitOrderWithPermit Insufficient amount to approve.' ); _permitERC20( quote.baseToken, quote.trader, amountToApprove, deadline, v, r, s ); _executeRFQMTrade(quote); } /// @inheritdoc IHashflowRouter function tradeXChainRFQT( XChainRFQTQuote memory quote, bytes32 dstContract, bytes memory dstCalldata ) external payable override nonReentrant { _validateXChainRFQTQuote(quote); _executeXChainRFQTTrade(quote, dstContract, dstCalldata); } /// @inheritdoc IHashflowRouter function tradeXChainRFQTWithPermit( XChainRFQTQuote memory quote, bytes32 dstContract, bytes memory dstCalldata, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external payable override nonReentrant { _validateXChainRFQTQuote(quote); require( quote.baseToken != address(0), 'HashflowRouter::tradeXChainRFQTWithPermit baseToken cannot be the native token.' ); require( amountToApprove >= quote.effectiveBaseTokenAmount, 'HashflowRouter::tradeXChainRFQTWithPermit Insufficient amount to approve.' ); _permitERC20( quote.baseToken, _msgSender(), amountToApprove, deadline, v, r, s ); _executeXChainRFQTTrade(quote, dstContract, dstCalldata); } function tradeXChainRFQM( XChainRFQMQuote memory quote, bytes32 dstContract, bytes memory dstCalldata ) external payable override { _validateXChainRFQMQuote(quote); _executeXChainRFQMTrade(quote, dstContract, dstCalldata); } /// @inheritdoc IHashflowRouter function tradeXChainRFQMWithPermit( XChainRFQMQuote memory quote, bytes32 dstContract, bytes memory dstCalldata, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external payable override { _validateXChainRFQMQuote(quote); require( amountToApprove >= quote.baseTokenAmount, 'HashflowRouter::tradeXChainRFQmWithPermit Insufficient amount to approve.' ); _permitERC20( quote.baseToken, quote.trader, amountToApprove, deadline, v, r, s ); _executeXChainRFQMTrade(quote, dstContract, dstCalldata); } /// @inheritdoc IHashflowRouter function fillXChain(XChainFillMessage memory fillMessage) external override { require( authorizedXChainMessengersByPool[fillMessage.dstPool][_msgSender()], 'HashflowRouter::fillXChain Unauthorized messenger.' ); require( authorizedXChainPools[ bytes32(uint256(uint160(fillMessage.dstPool))) ][fillMessage.srcHashflowChainId][fillMessage.srcPool], 'HashflowRouter::fillXChain Unauthorized peer pool.' ); if (fillMessage.dstContract != address(0)) { require( authorizedXChainCallers[fillMessage.dstContract][ fillMessage.srcHashflowChainId ][fillMessage.srcCaller], 'HashflowRouter::fillXChain Unauthorized x-caller.' ); require( authorizedXChainMessengersByCallee[fillMessage.dstContract][ _msgSender() ], 'HashflowRouter::fillXChain Unauthorized messenger for x-call.' ); } IHashflowPool(fillMessage.dstPool).fillXChain( fillMessage.dstExternalAccount, fillMessage.txid, fillMessage.dstTrader, fillMessage.quoteToken, fillMessage.quoteTokenAmount ); if (fillMessage.dstContract != address(0)) { fillMessage.dstContract.functionCall( fillMessage.dstContractCalldata ); } } /// @inheritdoc IHashflowRouter function updateXChainPoolAuthorization( uint16 otherHashflowChainId, bytes32 otherPool, bool authorized ) external override { require( authorizedPools[_msgSender()], 'HashflowRouter::updateXChainPoolAuthorization Pool not authorized.' ); bytes32 evmAgnosticSender = bytes32(uint256(uint160(_msgSender()))); authorizedXChainPools[evmAgnosticSender][otherHashflowChainId][ otherPool ] = authorized; emit UpdateXChainPoolAuthorization( _msgSender(), otherHashflowChainId, otherPool, authorized ); } function updateXChainCallerAuthorization( uint16 otherHashflowChainId, bytes32 caller, bool authorized ) external override { require( msg.sender.isContract(), 'HashflowRouter::updateXChainCallerAuthorization Sender must be a contract.' ); require( caller != bytes32(0), 'HashflowRouter::updateXChainCallerAuthorization Caller is empty.' ); authorizedXChainCallers[msg.sender][otherHashflowChainId][ caller ] = authorized; emit UpdateXChainCallerAuthorization( msg.sender, otherHashflowChainId, caller, authorized ); } /// @inheritdoc IHashflowRouter function updateXChainMessengerAuthorization( address xChainMessenger, bool authorized ) external override { require( authorizedPools[_msgSender()], 'HashflowRouter::updateXChainMessengerAuthorization Pool not authorized.' ); authorizedXChainMessengersByPool[_msgSender()][ xChainMessenger ] = authorized; emit UpdateXChainMessengerAuthorization( _msgSender(), xChainMessenger, authorized ); } function updateXChainMessengerCallerAuthorization( address xChainMessenger, bool authorized ) external override { authorizedXChainMessengersByCallee[msg.sender][ xChainMessenger ] = authorized; emit UpdateXChainMessengerCallerAuthorization( msg.sender, xChainMessenger, authorized ); } /// @inheritdoc IHashflowRouter function forceUnauthorizePool(address pool) external override onlyOwner { require( authorizedPools[pool], 'HashflowRouter::forceUnauthorizePool Pool is not authorized.' ); authorizedPools[pool] = false; emit UpdatePoolAuthorizaton(pool, false); } /// @inheritdoc IHashflowRouter function updatePoolAuthorization(address pool, bool authorized) external override { require( _msgSender() == factory, 'HashflowRouter: msg.sender should be the Factory.' ); authorizedPools[pool] = authorized; emit UpdatePoolAuthorizaton(pool, authorized); } /// @inheritdoc IHashflowRouter function killswitchPool(address pool, bool enabled) external override onlyOwner { IHashflowPool(pool).killswitchOperations(enabled); } /// @inheritdoc IHashflowRouter function withdrawFunds(address token) external override onlyOwner { if (token == address(0)) { payable(_msgSender()).sendValue(address(this).balance); } else { IERC20(token).safeTransfer( _msgSender(), IERC20(token).balanceOf(address(this)) ); } } /// @inheritdoc IHashflowRouter function updateLimitOrderGuardian(address guardian) external override onlyOwner { require( guardian != address(0), 'HashflowRouter::updateLimitOrderGuardian Guardian cannot be 0 address.' ); limitOrderGuardian = guardian; emit UpdateLimitOrderGuardian(guardian); } /// @dev We do not allow the owner to renounce ownership. function renounceOwnership() public view override onlyOwner { revert('HashflowRouter: Renouncing ownership not allowed.'); } // Section: Intra-chain RFQ-T. function _validateRFQTQuote(RFQTQuote memory quote) private view { require( quote.effectiveBaseTokenAmount <= quote.baseTokenAmount, 'HashflowRouter::_validateRFQTQuote effectiveBaseTokenAmount too high.' ); require( quote.quoteExpiry >= block.timestamp, 'HashflowRouter::_validateRFQTQuote Quote has expired.' ); require( quote.nonce <= (block.timestamp + 180) * 1000, 'HashflowRouter::_validateRFQTQuote Nonce too high.' ); require( authorizedPools[quote.pool], 'HashflowRouter::_validateRFQTQuote Pool not authorized.' ); } function _executeRFQTTrade(RFQTQuote memory quote, bool multihop) private { uint256 msgValue; if (quote.baseToken == address(0)) { if (quote.externalAccount == address(0)) { msgValue = quote.effectiveBaseTokenAmount; } else { // Instead of transferring native token to an external account, we transfer // wrapped native token. IWETH(_WETH).deposit{value: quote.effectiveBaseTokenAmount}(); IERC20(_WETH).safeTransfer( quote.externalAccount, quote.effectiveBaseTokenAmount ); } } else { // If the external account is present we transfer to it. Otherwise we transfer // to the pool. address accountToTransferTo = quote.externalAccount != address(0) ? quote.externalAccount : quote.pool; if (multihop) { IERC20(quote.baseToken).safeTransfer( accountToTransferTo, quote.effectiveBaseTokenAmount ); } else { IERC20(quote.baseToken).safeTransferFrom( _msgSender(), accountToTransferTo, quote.effectiveBaseTokenAmount ); } } IHashflowPool(quote.pool).tradeRFQT{value: msgValue}(quote); } // Section: Intra-chain RFQ-M. function _validateRFQMQuote(RFQMQuote memory quote) private { require( quote.quoteExpiry >= block.timestamp, 'HashflowRouter::_validateRFQMQuote Quote has expired.' ); require( authorizedPools[quote.pool], 'HashflowRouter::_validateRFQMQuote Pool not authorized.' ); require( quote.baseToken != address(0), 'HashflowRouter::_validateRFQMQuote RFQ-M does not support native tokens.' ); require( !_usedTxids[quote.txid], 'HashflowRouter::_validateRFQMQuote txid has already been used.' ); _usedTxids[quote.txid] = true; } function _validateRFQMSignature(RFQMQuote memory quote) private view { bytes32 quoteHash = _hashQuoteRFQM(quote); require( SignatureChecker.isValidSignatureNow( quote.trader, quoteHash, quote.takerSignature ), 'HashflowRouter::_validateRFQMSignature Invalid signer.' ); } function _executeRFQMTrade(RFQMQuote memory quote) private { IERC20(quote.baseToken).safeTransferFrom( quote.trader, quote.externalAccount != address(0) ? quote.externalAccount : quote.pool, quote.baseTokenAmount ); IHashflowPool(quote.pool).tradeRFQM(quote); } // Section: Limit orders. function _validateRFQMLimitOrderSignature( RFQMQuote memory quote, bytes memory guardianSignature ) private view { bytes32 traderHash = _hashQuoteLimitOrderRFQM(quote); require( SignatureChecker.isValidSignatureNow( quote.trader, traderHash, quote.takerSignature ), 'HashflowRouter::_validateRFQMLimitOrderSignature Invalid trader signer.' ); bytes32 guardianHash = _hashGuardianQuoteRFQM(quote); require( guardianHash.recover(guardianSignature) == limitOrderGuardian, 'HashflowRouter::_validateRFQMLimitOrderSignature Invalid guardian signer.' ); } // Section: X-Chain RFQ-T. function _validateXChainRFQTQuote(XChainRFQTQuote memory quote) private view { require( quote.effectiveBaseTokenAmount <= quote.baseTokenAmount, 'HashflowRouter::_validateXChainRFQTQuote effectiveBaseTokenAmount too high.' ); require( quote.quoteExpiry >= block.timestamp, 'HashflowRouter::_validateXChainRFQTQuote Quote has expired.' ); require( authorizedPools[quote.srcPool], 'HashflowRouter::_validateXChainRFQTQuote Pool not authorized.' ); require( quote.nonce <= (block.timestamp + 180) * 1000, 'HashflowRouter::_validateXChainRFQTQuote Nonce too high.' ); require( authorizedXChainMessengersByPool[quote.srcPool][ quote.xChainMessenger ], 'HashflowRouter::_validateXChainRFQTQuote Unauthorized messenger for pool.' ); require( authorizedXChainPools[bytes32(uint256(uint160(quote.srcPool)))][ quote.dstChainId ][quote.dstPool], 'HashflowRouter::_validateXChainRFQTQuote Unauthorized x-chain peer pool.' ); } function _executeXChainRFQTTrade( XChainRFQTQuote memory quote, bytes32 dstContract, bytes memory dstCalldata ) private { uint256 xChainFees = msg.value; if (quote.baseToken == address(0)) { require( msg.value >= quote.effectiveBaseTokenAmount, 'HashflowRouter::tradeXChainRFQT msg.value should be >= effectiveBaseTokenAmount.' ); xChainFees = msg.value - quote.effectiveBaseTokenAmount; } uint256 effectiveQuoteTokenAmount = quote.quoteTokenAmount; if (quote.effectiveBaseTokenAmount < quote.baseTokenAmount) { effectiveQuoteTokenAmount = (quote.quoteTokenAmount * quote.effectiveBaseTokenAmount) / quote.baseTokenAmount; } uint256 msgValue = 0; if (quote.baseToken == address(0)) { if (quote.srcExternalAccount == address(0)) { msgValue = quote.effectiveBaseTokenAmount; } else { IWETH(_WETH).deposit{value: quote.effectiveBaseTokenAmount}(); IERC20(_WETH).safeTransfer( quote.srcExternalAccount, quote.effectiveBaseTokenAmount ); } } else { IERC20(quote.baseToken).safeTransferFrom( _msgSender(), quote.srcExternalAccount != address(0) ? quote.srcExternalAccount : quote.srcPool, quote.effectiveBaseTokenAmount ); } IHashflowPool(quote.srcPool).tradeXChainRFQT{value: msgValue}( quote, _msgSender() ); IHashflowXChainMessenger.XChainQuote memory uaQuote; uaQuote.srcChainId = quote.srcChainId; uaQuote.dstChainId = quote.dstChainId; uaQuote.srcPool = quote.srcPool; uaQuote.dstPool = quote.dstPool; uaQuote.srcExternalAccount = quote.srcExternalAccount; uaQuote.dstExternalAccount = quote.dstExternalAccount; uaQuote.trader = _msgSender(); uaQuote.dstTrader = quote.dstTrader; uaQuote.baseToken = quote.baseToken; uaQuote.quoteToken = quote.quoteToken; uaQuote.baseTokenAmount = quote.effectiveBaseTokenAmount; uaQuote.quoteTokenAmount = effectiveQuoteTokenAmount; uaQuote.txid = quote.txid; IHashflowXChainMessenger(quote.xChainMessenger).tradeXChain{ value: xChainFees }(uaQuote, _msgSender(), dstContract, dstCalldata); } // Section: X-Chain RFQ-M. function _validateXChainRFQMQuote(XChainRFQMQuote memory quote) private { require( quote.quoteExpiry >= block.timestamp, 'HashflowRouter::_validateXChainRFQMQuote Quote has expired.' ); require( authorizedPools[quote.srcPool], 'HashflowRouter::_validateXChainRFQMQuote Pool not authorized.' ); require( authorizedXChainMessengersByPool[quote.srcPool][ quote.xChainMessenger ], 'HashflowRouter::_validateXChainRFQMQuote Unauthorized messenger for pool.' ); require( authorizedXChainPools[bytes32(uint256(uint160(quote.srcPool)))][ quote.dstChainId ][quote.dstPool], 'HashflowRouter::_validateXChainRFQMQuote Unauthorized x-chain peer pool.' ); require( quote.baseToken != address(0), 'HashflowRouter::_validateXChainRFQMQuote RFQ-M does not support native tokens.' ); require( !_usedTxids[quote.txid], 'HashflowRouter::_validateXChainRFQMQuote txid has already been used.' ); _usedTxids[quote.txid] = true; bytes32 quoteHash = _hashXChainQuoteRFQM(quote); require( SignatureChecker.isValidSignatureNow( quote.trader, quoteHash, quote.takerSignature ), 'HashflowRouter::_validateXChainRFQMQuote Invalid signer.' ); } function _executeXChainRFQMTrade( XChainRFQMQuote memory quote, bytes32 dstContract, bytes memory dstCalldata ) private { IERC20(quote.baseToken).safeTransferFrom( quote.trader, quote.srcExternalAccount != address(0) ? quote.srcExternalAccount : quote.srcPool, quote.baseTokenAmount ); IHashflowPool(quote.srcPool).tradeXChainRFQM(quote); IHashflowXChainMessenger.XChainQuote memory uaQuote; uaQuote.srcChainId = quote.srcChainId; uaQuote.dstChainId = quote.dstChainId; uaQuote.srcPool = quote.srcPool; uaQuote.dstPool = quote.dstPool; uaQuote.srcExternalAccount = quote.srcExternalAccount; uaQuote.dstExternalAccount = quote.dstExternalAccount; uaQuote.trader = quote.trader; uaQuote.dstTrader = quote.dstTrader; uaQuote.baseToken = quote.baseToken; uaQuote.quoteToken = quote.quoteToken; uaQuote.baseTokenAmount = quote.baseTokenAmount; uaQuote.quoteTokenAmount = quote.quoteTokenAmount; uaQuote.txid = quote.txid; IHashflowXChainMessenger(quote.xChainMessenger).tradeXChain{ value: msg.value }(uaQuote, _msgSender(), dstContract, dstCalldata); } function _permitERC20( address erc20Permit, address trader, uint256 amountToApprove, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { IERC20Permit(erc20Permit).safePermit( trader, address(this), amountToApprove, deadline, v, r, s ); } function _hashQuoteLimitOrderRFQM(RFQMQuote memory quote) private view returns (bytes32) { return _hashTypedDataV4( keccak256( abi.encode( QUOTE_LIMIT_ORDER_TYPEHASH, quote.txid, quote.baseToken, quote.quoteToken, quote.baseTokenAmount, quote.quoteTokenAmount, quote.quoteExpiry ) ) ); } /// @dev Helper for EIP-712 Quote hash generation. function _hashQuoteRFQM(RFQMQuote memory quote) private view returns (bytes32) { return _hashTypedDataV4( keccak256( abi.encode( QUOTE_TYPEHASH, quote.txid, quote.trader, quote.pool, quote.externalAccount, quote.baseToken, quote.quoteToken, quote.baseTokenAmount, quote.quoteTokenAmount, quote.quoteExpiry ) ) ); } /// @dev Helper for EIP-712 Quote hash generation. function _hashXChainQuoteRFQM(XChainRFQMQuote memory quote) private view returns (bytes32) { return _hashTypedDataV4( keccak256( abi.encode( XCHAIN_QUOTE_TYPEHASH, quote.txid, uint256(quote.srcChainId), uint256(quote.dstChainId), quote.dstTrader, quote.srcPool, quote.srcExternalAccount, quote.dstPool, quote.dstExternalAccount, quote.baseToken, quote.quoteToken, quote.baseTokenAmount, quote.quoteTokenAmount, quote.quoteExpiry ) ) ); } function _hashGuardianQuoteRFQM(RFQMQuote memory quote) private view returns (bytes32) { return keccak256( abi.encodePacked( '\x19Ethereum Signed Message:\n32', keccak256( abi.encodePacked( quote.pool, quote.externalAccount, quote.trader, quote.txid, block.chainid ) ) ) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol) pragma solidity ^0.8.0; import "./Ownable.sol"; /** * @dev Contract module which provides access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership} and {acceptOwnership}. * * This module is used through inheritance. It will make available all functions * from parent (Ownable). */ abstract contract Ownable2Step is Ownable { address private _pendingOwner; event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /** * @dev Returns the address of the pending owner. */ function pendingOwner() public view virtual returns (address) { return _pendingOwner; } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual override onlyOwner { _pendingOwner = newOwner; emit OwnershipTransferStarted(owner(), newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner. * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual override { delete _pendingOwner; super._transferOwnership(newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwnership() public virtual { address sender = _msgSender(); require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner"); _transferOwnership(sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271 { /** * @dev Should return whether the signature provided is valid for the provided data * @param hash Hash of the data to be signed * @param signature Signature byte array associated with _data */ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (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() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; // EIP-2612 is Final as of 2022-11-01. This file is deprecated. import "./IERC20Permit.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ 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)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ 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"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // 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 cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts 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 (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; // EIP-712 is Final as of 2022-08-11. This file is deprecated. import "./EIP712.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSA.sol"; import "../ShortStrings.sol"; import "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/SignatureChecker.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; import "../../interfaces/IERC1271.sol"; /** * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like * Argent and Gnosis Safe. * * _Available since v4.1._ */ library SignatureChecker { /** * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. * * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) { (address recovered, ECDSA.RecoverError error) = ECDSA.tryRecover(hash, signature); return (error == ECDSA.RecoverError.NoError && recovered == signer) || isValidERC1271SignatureNow(signer, hash, signature); } /** * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated * against the signer smart contract using ERC1271. * * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ function isValidERC1271SignatureNow( address signer, bytes32 hash, bytes memory signature ) internal view returns (bool) { (bool success, bytes memory result) = signer.staticcall( abi.encodeWithSelector(IERC1271.isValidSignature.selector, hash, signature) ); return (success && result.length >= 32 && abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // 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(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. 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 for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the 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. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // 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 preconditions 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 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; import "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(_FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity >=0.8.0; interface IWETH { function deposit() external payable; function transfer(address to, uint256 value) external returns (bool); function withdraw(uint256) external; }
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity >=0.8.0; import '@openzeppelin/contracts/interfaces/IERC1271.sol'; import './IQuote.sol'; /// @title IHashflowPool /// @author Victor Ionescu /** * Pool contract used for trading. The Pool can either hold funds or * rely on external accounts. External accounts are used in order to preserve * Capital Efficiency on the Market Maker side. This way, a Market Maker can * make markets using funds that are also used on other venues. */ interface IHashflowPool is IQuote, IERC1271 { /// @notice Specifies a HashflowPool on a foreign chain. struct AuthorizedXChainPool { uint16 chainId; bytes32 pool; } /// @notice Contains a signer verification address, and whether trading is enabled. struct SignerConfiguration { address signer; bool enabled; } /// @notice Emitted when the authorization status of a withdrawal account changes. /// @param account The account for which the status changes. /// @param authorized The new authorization status. event UpdateWithdrawalAccount(address account, bool authorized); /// @notice Emitted when the signer key used for the pool has changed. /// @param signer The new signer key. /// @param prevSigner The old signer key. event UpdateSigner(address signer, address prevSigner); /// @notice Emitted when liquidity is withdrawn from the pool. /// @param token Token being withdrawn. /// @param recipient Address receiving the token. /// @param withdrawAmount Amount being withdrawn. event RemoveLiquidity( address token, address recipient, uint256 withdrawAmount ); /// @notice Emitted when an intra-chain trade happens. /// @param trader The trader. /// @param effectiveTrader The effective Trader. /// @param txid The txid of the quote. /// @param baseToken The token the trader sold. /// @param quoteToken The token the trader bought. /// @param baseTokenAmount The amount of baseToken sold. /// @param quoteTokenAmount The amount of quoteToken bought. event Trade( address trader, address effectiveTrader, bytes32 txid, address baseToken, address quoteToken, uint256 baseTokenAmount, uint256 quoteTokenAmount ); /// @notice Emitted when a cross-chain trade happens. /// @param dstChainId The Hashflow Chain ID for the destination chain. /// @param dstPool The pool address on the destination chain. /// @param trader The trader address. /// @param txid The txid of the quote. /// @param baseToken The token the trader sold. /// @param quoteToken The token the trader bought. /// @param baseTokenAmount The amount of baseToken sold. /// @param quoteTokenAmount The amount of quoteToken bought. event XChainTrade( uint16 dstChainId, bytes32 dstPool, address trader, bytes32 dstTrader, bytes32 txid, address baseToken, bytes32 quoteToken, uint256 baseTokenAmount, uint256 quoteTokenAmount ); /// @notice Emitted when a cross-chain trade is filled. /// @param txid The txid identified the quote that was filled. event XChainTradeFill(bytes32 txid); /// @notice Main initializer. /// @param name Name of the pool. /// @param signer Signer key used for quote / deposit verification. /// @param operations Operations key that governs the pool. /// @param router Address of the HashflowRouter contract. function initialize( string calldata name, address signer, address operations, address router ) external; /// @notice Returns the pool name. function name() external view returns (string memory); /// @notice Returns the signer address and whether the pool is enabled. function signerConfiguration() external view returns (address, bool); /// @notice Returns the Operations address of this pool. function operations() external view returns (address); /// @notice Returns the Router contract address. function router() external view returns (address); /// @notice Returns the current nonce for a trader. function nonces(address trader) external view returns (uint256); /// @notice Removes liquidity from the pool. /// @param token Token to withdraw. /// @param recipient Address to send token to. /// @param amount Amount to withdraw. function removeLiquidity( address token, address recipient, uint256 amount ) external; /// @notice Execute an RFQ-T trade. /// @param quote The quote to be executed. function tradeRFQT(RFQTQuote memory quote) external payable; /// @notice Execute an RFQ-M trade. /// @param quote The quote to be executed. function tradeRFQM(RFQMQuote memory quote) external; /// @notice Execute a cross-chain RFQ-T trade. /// @param quote The quote to be executed. /// @param trader The account that sends baseToken on this chain. function tradeXChainRFQT(XChainRFQTQuote memory quote, address trader) external payable; /// @notice Execute a cross-chain RFQ-M trade. /// @param quote The quote to be executed. function tradeXChainRFQM(XChainRFQMQuote memory quote) external; /// @notice Changes authorization for a set of pools to send X-Chain messages. /// @param pools The pools to change authorization status for. /// @param authorized The new authorization status. function updateXChainPoolAuthorization( AuthorizedXChainPool[] calldata pools, bool authorized ) external; /// @notice Changes authorization for an X-Chain Messenger app. /// @param xChainMessenger The address of the Messenger app. /// @param authorized The new authorization status. function updateXChainMessengerAuthorization( address xChainMessenger, bool authorized ) external; /// @notice Fills an x-chain order that completed on the source chain. /// @param externalAccount The external account to fill from, if any. /// @param txid The txid of the quote. /// @param trader The trader to receive the funds. /// @param quoteToken The token to be sent. /// @param quoteTokenAmount The amount of quoteToken to be sent. function fillXChain( address externalAccount, bytes32 txid, address trader, address quoteToken, uint256 quoteTokenAmount ) external; /// @notice Updates withdrawal account authorization. /// @param withdrawalAccounts the accounts for which to update authorization status. /// @param authorized The new authorization status. function updateWithdrawalAccount( address[] memory withdrawalAccounts, bool authorized ) external; /// @notice Updates the signer key. /// @param signer The new signer key. function updateSigner(address signer) external; /// @notice Used by the router to disable pool actions (Trade, Withdraw, Deposit) function killswitchOperations(bool enabled) external; /// @notice Returns the token reserves for this pool. /// @param token The token to check reserves for. function getReserves(address token) external view returns (uint256); /// @notice Approves a token for spend. Used for 1inch RFQ protocol. /// @param token The address of the ERC-20 token. /// @param spender The spender address (typically the 1inch RFQ order router) /// @param amount The approval amount. function approveToken( address token, address spender, uint256 amount ) external; /// @notice Increases allowance for a token. Used for 1inch RFQ protocol. /// @param token The address of the ERC-20 token. /// @param spender The spender address (typically the 1inch RFQ order router). /// @param amount The approval amount. function increaseTokenAllowance( address token, address spender, uint256 amount ) external; /// @notice Decreases allowance for a token. Used for 1inch RFQ protocol. /// @param token The address of the ERC-20 token. /// @param spender The spender address (typically the 1inch RFQ order router) /// @param amount The approval amount. function decreaseTokenAllowance( address token, address spender, uint256 amount ) external; }
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity >=0.8.0; import './IQuote.sol'; /// @title IHashflowRouter /// @author Victor Ionescu /** * @notice In terms of user-facing functionality, the Router is responsible for: * - orchestrating trades * - managing cross-chain permissions * * Every trade requires consent from two parties: the Trader and the Market Maker. * However, there are two models to establish consent: * - RFQ-T: in this model, the Market Maker provides an EIP-191 signature for the quote, * while the Trader signs the transaction and submits it on-chain * - RFQ-M: in this model, the Trader provides an EIP-712 signature for the quote, * the Market Maker provides an EIP-191 signature, and a 3rd party relays the trade. * The 3rd party can be the Market Maker itself. * * In terms of Hashflow internals, the Router maintains a set of authorized pool * contracts that are allowed to be used for trading. This allowlist creates * guarantees against malicious behavior, as documented in specific places. * * The Router contract is not upgradeable. In order to change functionality, a new * Router has to be deployed, and new HashflowPool contracts have to be deployed * by the Market Makers. */ /// @dev Trade / liquidity events are emitted at the HashflowPool level, rather than the router. interface IHashflowRouter is IQuote { /** * @notice X-Chain message received from an X-Chain Messenger. This is used by the * Router to communicate a fill to a HashflowPool. */ struct XChainFillMessage { /// @notice The Hashflow Chain ID of the source chain. uint16 srcHashflowChainId; /// @notice The address of the HashflowPool on the source chain. bytes32 srcPool; /// @notice The HashflowPool to disburse funds on the destination chain. address dstPool; /** * @notice The external account linked to the HashflowPool on the destination chain. * If the HashflowPool holds funds, this should be bytes32(0). */ address dstExternalAccount; /// @notice The recipient of the quoteToken on the destination chain. address dstTrader; /// @notice The token that the trader buys on the destination chain. address quoteToken; /// @notice The amount of quoteToken bought. uint256 quoteTokenAmount; /// @notice Unique identifier for the quote. /// @dev Generated off-chain via a distributed UUID generator. bytes32 txid; /// @notice The caller of the trade function on the source chain. bytes32 srcCaller; /// @notice The contract to call, if any. address dstContract; /// @notice The calldata for the contract. bytes dstContractCalldata; } /// @notice Emitted when the authorization status of a pool changes. /// @param pool The pool whose status changed. /// @param authorized The new auth status. event UpdatePoolAuthorizaton(address pool, bool authorized); /// @notice Emitted when a sender pool authorization changes. /// @param pool Pool address on this chain. /// @param otherHashflowChainId Hashflow Chain ID of the other chain. /// @param otherChainPool Pool address on the other chain. /// @param authorized Whether the pool is authorized. event UpdateXChainPoolAuthorization( address indexed pool, uint16 otherHashflowChainId, bytes32 otherChainPool, bool authorized ); /// @notice Emitted when the authorization of an x-caller changes. /// @param pool Pool address on this chain. /// @param otherHashflowChainId Hashflow Chain ID of the other chain. /// @param caller Caller address on the other chain. /// @param authorized Whether the caller is authorized. event UpdateXChainCallerAuthorization( address indexed pool, uint16 otherHashflowChainId, bytes32 caller, bool authorized ); /// @notice Emitted when the authorization status of an X-Chain Messenger changes for a pool. /// @param pool Pool address for which the Messenger authorization changes. /// @param xChainMessenger Address of the Messenger. /// @param authorized Whether the X-Chain Messenger is authorized. event UpdateXChainMessengerAuthorization( address indexed pool, address xChainMessenger, bool authorized ); /// @notice Emitted when the authorized status of an X-Chain Messenger changes for a callee. /// @param callee Address of the callee. /// @param xChainMessenger Address of the Messenger. /// @param authorized Whether the X-Chain Messenger is authorized. event UpdateXChainMessengerCallerAuthorization( address indexed callee, address xChainMessenger, bool authorized ); /// @notice Emitted when the Limit Order Guardian address is updated. /// @param guardian The new Guardian address. event UpdateLimitOrderGuardian(address guardian); /// @notice Initializes the Router. Called one time. /// @param factory The address of the HashflowFactory contract. function initialize(address factory) external; /// @notice Returns the address of the associated HashflowFactor contract. function factory() external view returns (address); function authorizedXChainPools( bytes32 dstPool, uint16 srcHChainId, bytes32 srcPool ) external view returns (bool); function authorizedXChainCallers( address dstContract, uint16 srcHashflowChainId, bytes32 caller ) external view returns (bool); function authorizedXChainMessengersByPool(address pool, address messenger) external view returns (bool); function authorizedXChainMessengersByCallee( address callee, address messenger ) external view returns (bool); /// @notice Executes an intra-chain RFQ-T trade. /// @param quote The quote data to be executed. function tradeRFQT(RFQTQuote memory quote) external payable; /// @notice Executes an intra-chain RFQ-T trade, leveraging an ERC-20 permit. /// @param quote The quote data to be executed. /// @dev Does not support native tokens for the baseToken. function tradeRFQTWithPermit( RFQTQuote memory quote, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external; /// @notice Executes an intra-chain RFQ-T trade. /// @param quote The quote to be executed. function tradeRFQM(RFQMQuote memory quote) external; /// @notice Executes an intra-chain RFQ-T trade, leveraging an ERC-20 permit. /// @param quote The quote to be executed. /// @param deadline The deadline of the ERC-20 permit. /// @param v v-part of the signature. /// @param r r-part of the signature. /// @param s s-part of the signature. /// @param amountToApprove The amount being approved. function tradeRFQMWithPermit( RFQMQuote memory quote, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external; /// @notice Executes an intra-chain RFQ-T trade. /// @param quote The quote to be executed. /// @param guardianSignature A signature issued by the Limit Order Guardian. function tradeRFQMLimitOrder( RFQMQuote memory quote, bytes memory guardianSignature ) external; /// @notice Executes an intra-chain RFQ-T trade, leveraging an ERC-20 permit. /// @param quote The quote to be executed. /// @param guardianSignature A signature issued by the Limit Order Guardian. /// @param deadline The deadline of the ERC-20 permit. /// @param v v-part of the signature. /// @param r r-part of the signature. /// @param s s-part of the signature. /// @param amountToApprove The amount being approved. function tradeRFQMLimitOrderWithPermit( RFQMQuote memory quote, bytes memory guardianSignature, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external; /// @notice Executes an RFQ-T cross-chain trade. /// @param quote The quote to be executed. /// @param dstContract The address of the contract to be called on the destination chain. /// @param dstCalldata The calldata for the smart contract call. function tradeXChainRFQT( XChainRFQTQuote memory quote, bytes32 dstContract, bytes memory dstCalldata ) external payable; /// @notice Executes an RFQ-T cross-chain trade, leveraging an ERC-20 permit. /// @param quote The quote to be executed. /// @param dstContract The address of the contract to be called on the destination chain. /// @param dstCalldata The calldata for the smart contract call. /// @param deadline The deadline of the ERC-20 permit. /// @param v v-part of the signature. /// @param r r-part of the signature. /// @param s s-part of the signature. /// @param amountToApprove The amount being approved. function tradeXChainRFQTWithPermit( XChainRFQTQuote memory quote, bytes32 dstContract, bytes memory dstCalldata, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external payable; /// @notice Executes an RFQ-M cross-chain trade. /// @param quote The quote to be executed. /// @param dstContract The address of the contract to be called on the destination chain. /// @param dstCalldata The calldata for the smart contract call. function tradeXChainRFQM( XChainRFQMQuote memory quote, bytes32 dstContract, bytes memory dstCalldata ) external payable; /// @notice Similar to tradeXChainRFQm, but includes a spend permit for the baseToken. /// @param quote The quote to be executed. /// @param dstContract The address of the contract to be called on the destination chain. /// @param dstCalldata The calldata for the smart contract call. /// @param deadline The deadline of the ERC-20 permit. /// @param v v-part of the signature. /// @param r r-part of the signature. /// @param s s-part of the signature. /// @param amountToApprove The amount to approve. function tradeXChainRFQMWithPermit( XChainRFQMQuote memory quote, bytes32 dstContract, bytes memory dstCalldata, uint256 deadline, uint8 v, bytes32 r, bytes32 s, uint256 amountToApprove ) external payable; /// @notice Completes the second leg of a cross-chain trade. /// @param fillMessage Payload containing information necessary to complete the trade. function fillXChain(XChainFillMessage memory fillMessage) external; /// @notice Returns whether the pool is authorized for trading. /// @param pool The address of the HashflowPool. function authorizedPools(address pool) external view returns (bool); /// @notice Allows the owner to unauthorize a potentially compromised pool. Cannot be reverted. /// @param pool The address of the HashflowPool. function forceUnauthorizePool(address pool) external; /// @notice Authorizes a HashflowPool for trading. /// @dev Can only be called by the HashflowFactory or the admin. function updatePoolAuthorization(address pool, bool authorized) external; /// @notice Updates the authorization status of an X-Chain pool pair. /// @param otherHashflowChainId The Hashflow Chain ID of the peer chain. /// @param otherPool The 32-byte representation of the Pool address on the peer chain. /// @param authorized Whether the pool is authorized to communicate with the sender pool. function updateXChainPoolAuthorization( uint16 otherHashflowChainId, bytes32 otherPool, bool authorized ) external; /// @notice Updates the authorization status of an X-Chain caller. /// @param otherHashflowChainId The Hashflow Chain ID of the peer chain. /// @param caller The caller address. /// @param authorized Whether the caller is authorized to send an x-call to the sender pool. function updateXChainCallerAuthorization( uint16 otherHashflowChainId, bytes32 caller, bool authorized ) external; /// @notice Updates the authorization status of an X-Chain Messenger app. /// @param xChainMessenger The address of the Messenger App. /// @param authorized The new authorization status. function updateXChainMessengerAuthorization( address xChainMessenger, bool authorized ) external; /// @notice Updates the authorization status of an X-Chain Messenger app. /// @param xChainMessenger The address of the Messenger App. /// @param authorized The new authorization status. function updateXChainMessengerCallerAuthorization( address xChainMessenger, bool authorized ) external; /// @notice Used to stop all operations on a pool, in case of an emergency. /// @param pool The address of the HashflowPool. /// @param enabled Whether the pool is enabled. function killswitchPool(address pool, bool enabled) external; /// @notice Used to update the Limit Order Guardian. /// @param guardian The address of the new Guardian. function updateLimitOrderGuardian(address guardian) external; /// @notice Allows the owner to withdraw excess funds from the Router. /// @dev Under normal operations, the Router should not have excess funds. function withdrawFunds(address token) external; }
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity >=0.8.0; /// @title IQuote /// @author Victor Ionescu /** * @notice Interface for quote structs used for trading. There are two major types of trades: * - intra-chain: atomic transactions within one chain * - cross-chain: multi-leg transactions between two chains, which utilize interoperability protocols * such as Wormhole. * * Separately, there are two trading modes: * - RFQ-T: the trader signs the transaction, the market maker signs the quote * - RFQ-M: both the trader and Market Maker sign the quote, any relayer can sign the transaction */ interface IQuote { /// @notice Used for intra-chain RFQ-T trades. struct RFQTQuote { /// @notice The address of the HashflowPool to trade against. address pool; /** * @notice The external account linked to the HashflowPool. * If the HashflowPool holds funds, this should be address(0). */ address externalAccount; /// @notice The recipient of the quoteToken at the end of the trade. address trader; /** * @notice The account "effectively" making the trade (ultimately receiving the funds). * This is commonly used by aggregators, where a proxy contract (the 'trader') * receives the quoteToken, and the effective trader is the user initiating the call. * * This field DOES NOT influence movement of funds. However, it is used to check against * quote replay. */ address effectiveTrader; /// @notice The token that the trader sells. address baseToken; /// @notice The token that the trader buys. address quoteToken; /** * @notice The amount of baseToken sold in this trade. The exchange rate * is going to be preserved as the quoteTokenAmount / baseTokenAmount ratio. * * Most commonly, effectiveBaseTokenAmount will == baseTokenAmount. */ uint256 effectiveBaseTokenAmount; /// @notice The max amount of baseToken sold. uint256 baseTokenAmount; /// @notice The amount of quoteToken bought when baseTokenAmount is sold. uint256 quoteTokenAmount; /// @notice The Unix timestamp (in seconds) when the quote expires. /// @dev This gets checked against block.timestamp. uint256 quoteExpiry; /// @notice The nonce used by this effectiveTrader. Nonces are used to protect against replay. uint256 nonce; /// @notice Unique identifier for the quote. /// @dev Generated off-chain via a distributed UUID generator. bytes32 txid; /// @notice Signature provided by the market maker (EIP-191). bytes signature; } /// @notice Used for intra-chain RFQ-M trades. struct RFQMQuote { /// @notice The address of the HashflowPool to trade against. address pool; /** * @notice The external account linked to the HashflowPool. * If the HashflowPool holds funds, this should be address(0). */ address externalAccount; /// @notice The account that will be debited baseToken / credited quoteToken. address trader; /// @notice The token that the trader sells. address baseToken; /// @notice The token that the trader buys. address quoteToken; /// @notice The amount of baseToken sold. uint256 baseTokenAmount; /// @notice The amount of quoteToken bought. uint256 quoteTokenAmount; /// @notice The Unix timestamp (in seconds) when the quote expires. /// @dev This gets checked against block.timestamp. uint256 quoteExpiry; /// @notice Unique identifier for the quote. /// @dev Generated off-chain via a distributed UUID generator. bytes32 txid; /// @notice Signature provided by the trader (EIP-712). bytes takerSignature; /// @notice Signature provided by the market maker (EIP-191). bytes makerSignature; } /// @notice Used for cross-chain RFQ-T trades. struct XChainRFQTQuote { /// @notice The Hashflow Chain ID of the source chain. uint16 srcChainId; /// @notice The Hashflow Chain ID of the destination chain. uint16 dstChainId; /// @notice The address of the HashflowPool to trade against on the source chain. address srcPool; /// @notice The HashflowPool to disburse funds on the destination chain. /// @dev This is bytes32 in order to anticipate non-EVM chains. bytes32 dstPool; /** * @notice The external account linked to the HashflowPool on the source chain. * If the HashflowPool holds funds, this should be address(0). */ address srcExternalAccount; /** * @notice The external account linked to the HashflowPool on the destination chain. * If the HashflowPool holds funds, this should be bytes32(0). */ bytes32 dstExternalAccount; /// @notice The recipient of the quoteToken on the destination chain. bytes32 dstTrader; /// @notice The token that the trader sells on the source chain. address baseToken; /// @notice The token that the trader buys on the destination chain. bytes32 quoteToken; /** * @notice The amount of baseToken sold in this trade. The exchange rate * is going to be preserved as the quoteTokenAmount / baseTokenAmount ratio. * * Most commonly, effectiveBaseTokenAmount will == baseTokenAmount. */ uint256 effectiveBaseTokenAmount; /// @notice The amount of baseToken sold. uint256 baseTokenAmount; /// @notice The amount of quoteToken bought. uint256 quoteTokenAmount; /** * @notice The Unix timestamp (in seconds) when the quote expire. Only enforced * on the source chain. */ /// @dev This gets checked against block.timestamp. uint256 quoteExpiry; /// @notice The nonce used by this trader. uint256 nonce; /// @notice Unique identifier for the quote. /// @dev Generated off-chain via a distributed UUID generator. bytes32 txid; /** * @notice The address of the IHashflowXChainMessenger contract used for * cross-chain communication. */ address xChainMessenger; /// @notice Signature provided by the market maker (EIP-191). bytes signature; } /// @notice Used for Cross-Chain RFQ-M trades. struct XChainRFQMQuote { /// @notice The Hashflow Chain ID of the source chain. uint16 srcChainId; /// @notice The Hashflow Chain ID of the destination chain. uint16 dstChainId; /// @notice The address of the HashflowPool to trade against on the source chain. address srcPool; /// @notice The HashflowPool to disburse funds on the destination chain. /// @dev This is bytes32 in order to anticipate non-EVM chains. bytes32 dstPool; /** * @notice The external account linked to the HashflowPool on the source chain. * If the HashflowPool holds funds, this should be address(0). */ address srcExternalAccount; /** * @notice The external account linked to the HashflowPool on the destination chain. * If the HashflowPool holds funds, this should be bytes32(0). */ bytes32 dstExternalAccount; /// @notice The account that will be debited baseToken on the source chain. address trader; /// @notice The recipient of the quoteToken on the destination chain. bytes32 dstTrader; /// @notice The token that the trader sells on the source chain. address baseToken; /// @notice The token that the trader buys on the destination chain. bytes32 quoteToken; /// @notice The amount of baseToken sold. uint256 baseTokenAmount; /// @notice The amount of quoteToken bought. uint256 quoteTokenAmount; /** * @notice The Unix timestamp (in seconds) when the quote expire. Only enforced * on the source chain. */ /// @dev This gets checked against block.timestamp. uint256 quoteExpiry; /// @notice Unique identifier for the quote. /// @dev Generated off-chain via a distributed UUID generator. bytes32 txid; /** * @notice The address of the IHashflowXChainMessenger contract used for * cross-chain communication. */ address xChainMessenger; /// @notice Signature provided by the trader (EIP-712). bytes takerSignature; /// @notice Signature provided by the market maker (EIP-191). bytes makerSignature; } }
/** * SPDX-License-Identifier: UNLICENSED */ pragma solidity >=0.8.0; /// @title IHashflowMessenger /// @author Victor Ionescu /** * @notice This interface should be implemented by any contract * that is to be used for X-Chain Message passing. */ interface IHashflowXChainMessenger { struct XChainQuote { uint16 srcChainId; uint16 dstChainId; address srcPool; bytes32 dstPool; address srcExternalAccount; bytes32 dstExternalAccount; address trader; bytes32 dstTrader; address baseToken; bytes32 quoteToken; uint256 baseTokenAmount; uint256 quoteTokenAmount; bytes32 txid; } struct XChainTradePayload { uint16 dstChainId; bytes32 txid; bytes32 srcPool; bytes32 dstPool; bytes32 dstExternalAccount; bytes32 quoteToken; bytes32 dstTrader; uint256 quoteTokenAmount; bytes32 permissionedRelayer; bytes32 srcCaller; bytes32 dstContract; bytes dstContractCalldata; } /// @notice Emitted when an associated IHashflowMessenger on a source chain changes. /// @param chainId The Hashflow Chain ID. /// @param remoteAddress The address of the remote, pre-padded to 32 bytes. event UpdateXChainRemoteAddress(uint16 chainId, bytes remoteAddress); /// @notice The Hashflow Chain ID for this chain. function hChainId() external view returns (uint16); /// @notice Returns the Hashflow Router. function router() external view returns (address); /// @notice Returns the registered remote for a Hashflow Chain ID. /// @param hChainId The foreign Hashflow Chain ID. function xChainRemotes(uint16 hChainId) external view returns (bytes memory); /// @notice Send X-Chain trade fill message. /// @param xChainQuote Quote object. /// @param caller The caller of the X-Chain trade. /// @param dstContract The contract to call on the destination chain. /// @param dstCalldata The calldata to pass to the contract. function tradeXChain( XChainQuote memory xChainQuote, address caller, bytes32 dstContract, bytes memory dstCalldata ) external payable; /// @notice Updates the associated IHashflowMessenger address on a different chain. /// @param hChainId The Hashflow Chain ID of the peer chain. /// @param remoteAddress The address of the IHashflowMessenger on the peer chain. function updateXChainRemoteAddress( uint16 hChainId, bytes calldata remoteAddress ) external; /// @notice Withdraws excess fees to the owner. function withdrawFunds() external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "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":"weth","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"guardian","type":"address"}],"name":"UpdateLimitOrderGuardian","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"bool","name":"authorized","type":"bool"}],"name":"UpdatePoolAuthorizaton","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint16","name":"otherHashflowChainId","type":"uint16"},{"indexed":false,"internalType":"bytes32","name":"caller","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"authorized","type":"bool"}],"name":"UpdateXChainCallerAuthorization","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"xChainMessenger","type":"address"},{"indexed":false,"internalType":"bool","name":"authorized","type":"bool"}],"name":"UpdateXChainMessengerAuthorization","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"callee","type":"address"},{"indexed":false,"internalType":"address","name":"xChainMessenger","type":"address"},{"indexed":false,"internalType":"bool","name":"authorized","type":"bool"}],"name":"UpdateXChainMessengerCallerAuthorization","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"uint16","name":"otherHashflowChainId","type":"uint16"},{"indexed":false,"internalType":"bytes32","name":"otherChainPool","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"authorized","type":"bool"}],"name":"UpdateXChainPoolAuthorization","type":"event"},{"inputs":[],"name":"_WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorizedPools","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"authorizedXChainCallers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"authorizedXChainMessengersByCallee","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"authorizedXChainMessengersByPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"},{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"authorizedXChainPools","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"srcHashflowChainId","type":"uint16"},{"internalType":"bytes32","name":"srcPool","type":"bytes32"},{"internalType":"address","name":"dstPool","type":"address"},{"internalType":"address","name":"dstExternalAccount","type":"address"},{"internalType":"address","name":"dstTrader","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"bytes32","name":"srcCaller","type":"bytes32"},{"internalType":"address","name":"dstContract","type":"address"},{"internalType":"bytes","name":"dstContractCalldata","type":"bytes"}],"internalType":"struct IHashflowRouter.XChainFillMessage","name":"fillMessage","type":"tuple"}],"name":"fillXChain","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"forceUnauthorizePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"bool","name":"enabled","type":"bool"}],"name":"killswitchPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"limitOrderGuardian","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"externalAccount","type":"address"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"bytes","name":"takerSignature","type":"bytes"},{"internalType":"bytes","name":"makerSignature","type":"bytes"}],"internalType":"struct IQuote.RFQMQuote","name":"quote","type":"tuple"}],"name":"tradeRFQM","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"externalAccount","type":"address"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"bytes","name":"takerSignature","type":"bytes"},{"internalType":"bytes","name":"makerSignature","type":"bytes"}],"internalType":"struct IQuote.RFQMQuote","name":"quote","type":"tuple"},{"internalType":"bytes","name":"guardianSignature","type":"bytes"}],"name":"tradeRFQMLimitOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"externalAccount","type":"address"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"bytes","name":"takerSignature","type":"bytes"},{"internalType":"bytes","name":"makerSignature","type":"bytes"}],"internalType":"struct IQuote.RFQMQuote","name":"quote","type":"tuple"},{"internalType":"bytes","name":"guardianSignature","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"amountToApprove","type":"uint256"}],"name":"tradeRFQMLimitOrderWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"externalAccount","type":"address"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"bytes","name":"takerSignature","type":"bytes"},{"internalType":"bytes","name":"makerSignature","type":"bytes"}],"internalType":"struct IQuote.RFQMQuote","name":"quote","type":"tuple"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"amountToApprove","type":"uint256"}],"name":"tradeRFQMWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"externalAccount","type":"address"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"effectiveTrader","type":"address"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"effectiveBaseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct IQuote.RFQTQuote","name":"quote","type":"tuple"}],"name":"tradeRFQT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"externalAccount","type":"address"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"address","name":"effectiveTrader","type":"address"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"address","name":"quoteToken","type":"address"},{"internalType":"uint256","name":"effectiveBaseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct IQuote.RFQTQuote","name":"quote","type":"tuple"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"amountToApprove","type":"uint256"}],"name":"tradeRFQTWithPermit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"srcChainId","type":"uint16"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"srcPool","type":"address"},{"internalType":"bytes32","name":"dstPool","type":"bytes32"},{"internalType":"address","name":"srcExternalAccount","type":"address"},{"internalType":"bytes32","name":"dstExternalAccount","type":"bytes32"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"bytes32","name":"dstTrader","type":"bytes32"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"bytes32","name":"quoteToken","type":"bytes32"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"address","name":"xChainMessenger","type":"address"},{"internalType":"bytes","name":"takerSignature","type":"bytes"},{"internalType":"bytes","name":"makerSignature","type":"bytes"}],"internalType":"struct IQuote.XChainRFQMQuote","name":"quote","type":"tuple"},{"internalType":"bytes32","name":"dstContract","type":"bytes32"},{"internalType":"bytes","name":"dstCalldata","type":"bytes"}],"name":"tradeXChainRFQM","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"srcChainId","type":"uint16"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"srcPool","type":"address"},{"internalType":"bytes32","name":"dstPool","type":"bytes32"},{"internalType":"address","name":"srcExternalAccount","type":"address"},{"internalType":"bytes32","name":"dstExternalAccount","type":"bytes32"},{"internalType":"address","name":"trader","type":"address"},{"internalType":"bytes32","name":"dstTrader","type":"bytes32"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"bytes32","name":"quoteToken","type":"bytes32"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"address","name":"xChainMessenger","type":"address"},{"internalType":"bytes","name":"takerSignature","type":"bytes"},{"internalType":"bytes","name":"makerSignature","type":"bytes"}],"internalType":"struct IQuote.XChainRFQMQuote","name":"quote","type":"tuple"},{"internalType":"bytes32","name":"dstContract","type":"bytes32"},{"internalType":"bytes","name":"dstCalldata","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"amountToApprove","type":"uint256"}],"name":"tradeXChainRFQMWithPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"srcChainId","type":"uint16"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"srcPool","type":"address"},{"internalType":"bytes32","name":"dstPool","type":"bytes32"},{"internalType":"address","name":"srcExternalAccount","type":"address"},{"internalType":"bytes32","name":"dstExternalAccount","type":"bytes32"},{"internalType":"bytes32","name":"dstTrader","type":"bytes32"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"bytes32","name":"quoteToken","type":"bytes32"},{"internalType":"uint256","name":"effectiveBaseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"address","name":"xChainMessenger","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct IQuote.XChainRFQTQuote","name":"quote","type":"tuple"},{"internalType":"bytes32","name":"dstContract","type":"bytes32"},{"internalType":"bytes","name":"dstCalldata","type":"bytes"}],"name":"tradeXChainRFQT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"srcChainId","type":"uint16"},{"internalType":"uint16","name":"dstChainId","type":"uint16"},{"internalType":"address","name":"srcPool","type":"address"},{"internalType":"bytes32","name":"dstPool","type":"bytes32"},{"internalType":"address","name":"srcExternalAccount","type":"address"},{"internalType":"bytes32","name":"dstExternalAccount","type":"bytes32"},{"internalType":"bytes32","name":"dstTrader","type":"bytes32"},{"internalType":"address","name":"baseToken","type":"address"},{"internalType":"bytes32","name":"quoteToken","type":"bytes32"},{"internalType":"uint256","name":"effectiveBaseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"baseTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteTokenAmount","type":"uint256"},{"internalType":"uint256","name":"quoteExpiry","type":"uint256"},{"internalType":"uint256","name":"nonce","type":"uint256"},{"internalType":"bytes32","name":"txid","type":"bytes32"},{"internalType":"address","name":"xChainMessenger","type":"address"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct IQuote.XChainRFQTQuote","name":"quote","type":"tuple"},{"internalType":"bytes32","name":"dstContract","type":"bytes32"},{"internalType":"bytes","name":"dstCalldata","type":"bytes"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"},{"internalType":"uint256","name":"amountToApprove","type":"uint256"}],"name":"tradeXChainRFQTWithPermit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"guardian","type":"address"}],"name":"updateLimitOrderGuardian","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"updatePoolAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"otherHashflowChainId","type":"uint16"},{"internalType":"bytes32","name":"caller","type":"bytes32"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"updateXChainCallerAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"xChainMessenger","type":"address"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"updateXChainMessengerAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"xChainMessenger","type":"address"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"updateXChainMessengerCallerAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"otherHashflowChainId","type":"uint16"},{"internalType":"bytes32","name":"otherPool","type":"bytes32"},{"internalType":"bool","name":"authorized","type":"bool"}],"name":"updateXChainPoolAuthorization","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"withdrawFunds","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101806040523480156200001257600080fd5b5060405162005bc338038062005bc38339810160408190526200003591620002e6565b604051806040016040528060118152602001702430b9b4333637bb9016902937baba32b960791b815250604051806040016040528060038152602001620312e360ec1b81525062000096600083620001d460201b62001bb61790919060201c565b61012052620000b3816001620001d4602090811b62001bb617901c565b61014052815160208084019190912060e052815190820120610100524660a0526200014160e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b60805250503060c05260016002556200015a3362000224565b6001600160a01b038116620001c15760405162461bcd60e51b815260206004820152602260248201527f48617368666c6f77526f757465723a2057455448206973203020616464726573604482015261399760f11b60648201526084015b60405180910390fd5b6001600160a01b031661016052620004fe565b6000602083511015620001f457620001ec836200024e565b90506200021e565b826200020b836200029160201b62001be91760201c565b90620002189082620003bd565b5060ff90505b92915050565b600480546001600160a01b03191690556200024b8162000294602090811b62001bec17901c565b50565b600080829050601f815111156200027c578260405163305a27a960e01b8152600401620001b8919062000489565b80516200028982620004d9565b179392505050565b90565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600060208284031215620002f957600080fd5b81516001600160a01b03811681146200031157600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200034357607f821691505b6020821081036200036457634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003b857600081815260208120601f850160051c81016020861015620003935750805b601f850160051c820191505b81811015620003b4578281556001016200039f565b5050505b505050565b81516001600160401b03811115620003d957620003d962000318565b620003f181620003ea84546200032e565b846200036a565b602080601f831160018114620004295760008415620004105750858301515b600019600386901b1c1916600185901b178555620003b4565b600085815260208120601f198616915b828110156200045a5788860151825594840194600190910190840162000439565b5085821015620004795787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083528351808285015260005b81811015620004b8578581018301518582016040015282016200049a565b506000604082860101526040601f19601f8301168501019250505092915050565b80516020808301519190811015620003645760001960209190910360031b1b16919050565b60805160a05160c05160e05161010051610120516101405161016051615643620005806000396000818161061e01528181612e6d01528181612efc0152818161332201526133af01526000610e6701526000610e3d0152600061400b01526000613fe301526000613f3e01526000613f6801526000613f9201526156436000f3fe6080604052600436106102045760003560e01c80639404a2d611610118578063c45a0155116100a0578063e30c39781161006f578063e30c397814610640578063e816b3931461065e578063f2fde38b1461068e578063f9c66166146106ae578063fbae3885146106c157600080fd5b8063c45a0155146105b9578063c4d66de8146105d9578063c52ac720146105f9578063e0af36161461060c57600080fd5b8063a31d7757116100e7578063a31d7757146104ea578063a85b5a4a146104fd578063ad5ce56414610538578063c027999014610579578063c08347cb1461059957600080fd5b80639404a2d61461045c5780639953488c1461047c5780639aaf89301461048f578063a1dfb6ba146104af57600080fd5b806368742da61161019b57806379ba50971161016a57806379ba5097146103a957806384b0196e146103be57806388fe1e05146103e657806389a17d94146104065780638da5cb5b1461043e57600080fd5b806368742da6146103415780636ab7a1ec14610361578063715018a6146103815780637296d2811461039657600080fd5b806341c4d05d116101d757806341c4d05d146102c15780634e104b87146102e15780635b637e75146103015780635f43286e1461032157600080fd5b806308d535641461020957806315c67d1d1461025f5780633020db051461028157806337cba5fb146102a1575b600080fd5b34801561021557600080fd5b5061024a6102243660046141d2565b600660209081526000938452604080852082529284528284209052825290205460ff1681565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b5061027f61027a366004614215565b6106e1565b005b34801561028d57600080fd5b5061027f61029c366004614470565b61085a565b3480156102ad57600080fd5b5061027f6102bc3660046144a4565b610878565b3480156102cd57600080fd5b5061027f6102dc3660046144ec565b61097e565b3480156102ed57600080fd5b5061027f6102fc366004614584565b610a4a565b34801561030d57600080fd5b5061027f61031c3660046144a4565b610a6a565b34801561032d57600080fd5b5061027f61033c366004614215565b610ad1565b34801561034d57600080fd5b5061027f61035c3660046145e7565b610be0565b34801561036d57600080fd5b5061027f61037c366004614602565b610c7d565b34801561038d57600080fd5b5061027f610d35565b61027f6103a436600461479d565b610d9f565b3480156103b557600080fd5b5061027f610db8565b3480156103ca57600080fd5b506103d3610e2f565b6040516102569796959493929190614859565b3480156103f257600080fd5b5061027f6104013660046144a4565b610eb7565b34801561041257600080fd5b50600b54610426906001600160a01b031681565b6040516001600160a01b039091168152602001610256565b34801561044a57600080fd5b506003546001600160a01b0316610426565b34801561046857600080fd5b5061027f6104773660046144a4565b610f98565b61027f61048a3660046149ff565b611001565b34801561049b57600080fd5b5061027f6104aa3660046145e7565b61116f565b3480156104bb57600080fd5b5061024a6104ca366004614aa1565b600960209081526000928352604080842090915290825290205460ff1681565b61027f6104f8366004614ad4565b611263565b34801561050957600080fd5b5061024a610518366004614aa1565b600860209081526000928352604080842090915290825290205460ff1681565b34801561054457600080fd5b5061024a610553366004614b14565b600760209081526000938452604080852082529284528284209052825290205460ff1681565b34801561058557600080fd5b5061027f610594366004614b40565b61131c565b3480156105a557600080fd5b5061027f6105b43660046145e7565b611629565b3480156105c557600080fd5b50600a54610426906001600160a01b031681565b3480156105e557600080fd5b5061027f6105f43660046145e7565b61170a565b61027f610607366004614d1a565b6118c6565b34801561061857600080fd5b506104267f000000000000000000000000000000000000000000000000000000000000000081565b34801561064c57600080fd5b506004546001600160a01b0316610426565b34801561066a57600080fd5b5061024a6106793660046145e7565b60056020526000908152604090205460ff1681565b34801561069a57600080fd5b5061027f6106a93660046145e7565b6119e4565b61027f6106bc366004614d4e565b611a55565b3480156106cd57600080fd5b5061027f6106dc366004614d86565b611a7b565b333b61076d5760405162461bcd60e51b815260206004820152604a60248201527f48617368666c6f77526f757465723a3a75706461746558436861696e43616c6c60448201527f6572417574686f72697a6174696f6e2053656e646572206d75737420626520616064820152691031b7b73a3930b1ba1760b11b608482015260a4015b60405180910390fd5b816107e2576040805162461bcd60e51b81526020600482015260248101919091527f48617368666c6f77526f757465723a3a75706461746558436861696e43616c6c60448201527f6572417574686f72697a6174696f6e2043616c6c657220697320656d7074792e6064820152608401610764565b33600081815260076020908152604080832061ffff8816808552908352818420878552835292819020805460ff191686151590811790915581519384529183018690528201527fca7d17625f7b2f5114f0621d847626dd6dff5f4c34cfc9050b8f1fce3df046269060600160405180910390a2505050565b61086381611c3e565b61086c81611e2d565b61087581611eb9565b50565b3360009081526005602052604090205460ff1661090d5760405162461bcd60e51b815260206004820152604760248201527f48617368666c6f77526f757465723a3a75706461746558436861696e4d65737360448201527f656e676572417574686f72697a6174696f6e20506f6f6c206e6f74206175746860648201526637b934bd32b21760c91b608482015260a401610764565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff19168615159081179091558151938452918301919091527fe8dfd8b5fb155ba2f5c55159f912f5ef8d8a36fe29a1d6a6ee56a27496f0b3ee91015b60405180910390a25050565b61098787611c3e565b6109918787611f61565b8660a00151811015610a215760405162461bcd60e51b815260206004820152604d60248201527f48617368666c6f77526f757465723a3a74726164655246514d4c696d69744f7260448201527f646572576974685065726d697420496e73756666696369656e7420616d6f756e60648201526c3a103a379030b8383937bb329760991b608482015260a401610764565b610a38876060015188604001518388888888612161565b610a4187611eb9565b50505050505050565b610a5382611c3e565b610a5d8282611f61565b610a6682611eb9565b5050565b610a7261217a565b6040516305f4cd1360e51b815281151560048201526001600160a01b0383169063be99a26090602401600060405180830381600087803b158015610ab557600080fd5b505af1158015610ac9573d6000803e3d6000fd5b505050505050565b3360009081526005602052604090205460ff16610b615760405162461bcd60e51b815260206004820152604260248201527f48617368666c6f77526f757465723a3a75706461746558436861696e506f6f6c60448201527f417574686f72697a6174696f6e20506f6f6c206e6f7420617574686f72697a65606482015261321760f11b608482015260a401610764565b33600081815260066020908152604080832061ffff8816808552908352818420878552835292819020805486151560ff1990911681179091558151938452918301869052828101919091525182917f7ffc452afec1d39d0e156e268852ae82b9ef5093e3a88b443bb52bd264b8829e919081900360600190a250505050565b610be861217a565b6001600160a01b038116610c005761087533476121d6565b610875336040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6c9190614dc1565b6001600160a01b03841691906122ef565b610c8686611c3e565b610c8f86611e2d565b8560a00151811015610d155760405162461bcd60e51b815260206004820152604360248201527f48617368666c6f77526f757465723a3a74726164655246514d5769746850657260448201527f6d697420496e73756666696369656e7420616d6f756e7420746f20617070726f6064820152623b329760e91b608482015260a401610764565b610d2c866060015187604001518388888888612161565b610ac986611eb9565b610d3d61217a565b60405162461bcd60e51b815260206004820152603160248201527f48617368666c6f77526f757465723a2052656e6f756e63696e67206f776e657260448201527039b434b8103737ba1030b63637bbb2b21760791b6064820152608401610764565b610da883612352565b610db3838383612736565b505050565b60045433906001600160a01b03168114610e265760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610764565b610875816128ee565b600060608082808083610e627f000000000000000000000000000000000000000000000000000000000000000083612907565b610e8d7f00000000000000000000000000000000000000000000000000000000000000006001612907565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b600a546001600160a01b0316336001600160a01b031614610f345760405162461bcd60e51b815260206004820152603160248201527f48617368666c6f77526f757465723a206d73672e73656e6465722073686f756c60448201527032103132903a3432902330b1ba37b93c9760791b6064820152608401610764565b6001600160a01b038216600081815260056020908152604091829020805460ff19168515159081179091558251938452908301527ffc087d65c1c1527a0ded830f211118cc745af1f2e78dc8e17d3e6f91bdc864e591015b60405180910390a15050565b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff19168615159081179091558151938452918301919091527fe80bbdf568eb195098d86688fac386c5de50b820e228a4f7941f09e9346c8ebb9101610972565b6110096129ab565b61101288612a02565b60e08801516001600160a01b03166110aa5760405162461bcd60e51b815260206004820152604f60248201527f48617368666c6f77526f757465723a3a747261646558436861696e524651545760448201527f6974685065726d69742062617365546f6b656e2063616e6e6f7420626520746860648201526e32903730ba34bb32903a37b5b2b71760891b608482015260a401610764565b8761012001518110156111375760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a747261646558436861696e524651545760448201527f6974685065726d697420496e73756666696369656e7420616d6f756e7420746f6064820152681030b8383937bb329760b91b608482015260a401610764565b6111508860e001516111463390565b8388888888612161565b61115b888888612d3c565b6111656001600255565b5050505050505050565b61117761217a565b6001600160a01b03811660009081526005602052604090205460ff166112055760405162461bcd60e51b815260206004820152603c60248201527f48617368666c6f77526f757465723a3a666f726365556e617574686f72697a6560448201527f506f6f6c20506f6f6c206973206e6f7420617574686f72697a65642e000000006064820152608401610764565b6001600160a01b0381166000818152600560209081526040808320805460ff191690558051938452908301919091527ffc087d65c1c1527a0ded830f211118cc745af1f2e78dc8e17d3e6f91bdc864e591015b60405180910390a150565b61126c88612352565b8761014001518110156112f95760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a747261646558436861696e5246516d5760448201527f6974685065726d697420496e73756666696369656e7420616d6f756e7420746f6064820152681030b8383937bb329760b91b608482015260a401610764565b6113118861010001518960c001518388888888612161565b611165888888612736565b6040818101516001600160a01b03166000908152600860209081528282203383529052205460ff166113995760405162461bcd60e51b815260206004820152603260248201526000805160206155ce8339815191526044820152713437b934bd32b21036b2b9b9b2b733b2b91760711b6064820152608401610764565b6040808201516001600160a01b0316600090815260066020908152828220845161ffff16835281528282208185015183529052205460ff166114265760405162461bcd60e51b815260206004820152603260248201526000805160206155ce8339815191526044820152713437b934bd32b2103832b2b9103837b7b61760711b6064820152608401610764565b6101208101516001600160a01b031615611558576101208101516001600160a01b03166000908152600760209081526040808320845161ffff1684528252808320610100850151845290915290205460ff166114cc5760405162461bcd60e51b815260206004820152603160248201526000805160206155ce8339815191526044820152703437b934bd32b2103c16b1b0b63632b91760791b6064820152608401610764565b6101208101516001600160a01b0316600090815260096020908152604080832033845290915290205460ff166115585760405162461bcd60e51b815260206004820152603d60248201526000805160206155ce83398151915260448201527f686f72697a6564206d657373656e67657220666f7220782d63616c6c2e0000006064820152608401610764565b604080820151606083015160e0840151608085015160a086015160c087015195516376a4f13560e01b81526001600160a01b0394851660048201526024810193909352908316604483015282166064820152608481019390935216906376a4f1359060a401600060405180830381600087803b1580156115d757600080fd5b505af11580156115eb573d6000803e3d6000fd5b505050506101208101516001600160a01b03161561087557610a668161014001518261012001516001600160a01b03166130dd90919063ffffffff16565b61163161217a565b6001600160a01b0381166116bc5760405162461bcd60e51b815260206004820152604660248201527f48617368666c6f77526f757465723a3a7570646174654c696d69744f7264657260448201527f477561726469616e20477561726469616e2063616e6e6f742062652030206164606482015265323932b9b99760d11b608482015260a401610764565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1bf268a62b77f3cc4e6f66f6d53de9eb2ec99ae71b9df01a1775e877e96be9cf90602001611258565b600454600160a81b900460ff161580801561173257506004546001600160a01b90910460ff16105b806117535750303b1580156117535750600454600160a01b900460ff166001145b6117b65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610764565b6004805460ff60a01b1916600160a01b17905580156117e3576004805460ff60a81b1916600160a81b1790555b6117eb61217a565b6001600160a01b0382166118675760405162461bcd60e51b815260206004820152603760248201527f48617368666c6f77526f757465723a3a696e697469616c697a6520466163746f60448201527f72792063616e6e6f74206265203020616464726573732e0000000000000000006064820152608401610764565b600a80546001600160a01b0319166001600160a01b0384161790558015610a66576004805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610f8c565b6118cf81613128565b60808101516001600160a01b0316611972578060c00151341461196d5760405162461bcd60e51b815260206004820152604a60248201527f48617368666c6f77526f757465723a3a747261646552465154206d73672e766160448201527f6c75652073686f756c6420657175616c2065666665637469766542617365546f60648201526935b2b720b6b7bab73a1760b11b608482015260a401610764565b6119d9565b34156119d95760405162461bcd60e51b815260206004820152603060248201527f48617368666c6f77526f757465723a3a747261646552465154206d73672e766160448201526f363ab29039b437bab63210313290181760811b6064820152608401610764565b6108758160006132ee565b6119ec61217a565b600480546001600160a01b0383166001600160a01b03199091168117909155611a1d6003546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b611a5d6129ab565b611a6683612a02565b611a71838383612d3c565b610db36001600255565b611a8486613128565b60808601516001600160a01b0316611b165760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a7472616465524651545769746850657260448201527f6d69742062617365546f6b656e2063616e6e6f7420626520746865206e6174696064820152683b32903a37b5b2b71760b91b608482015260a401610764565b8560c00151811015611b9c5760405162461bcd60e51b815260206004820152604360248201527f48617368666c6f77526f757465723a3a7472616465524651545769746850657260448201527f6d697420496e73756666696369656e7420616d6f756e7420746f20617070726f6064820152623b329760e91b608482015260a401610764565b611bab86608001516111463390565b610ac98660006132ee565b6000602083511015611bd257611bcb836134b0565b9050611be3565b81611bdd8482614e5a565b5060ff90505b92915050565b90565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b428160e001511015611c9e5760405162461bcd60e51b8152602060048201526035602482015260008051602061558e8339815191526044820152743a329028bab7ba32903430b99032bc3834b932b21760591b6064820152608401610764565b80516001600160a01b031660009081526005602052604090205460ff16611d155760405162461bcd60e51b8152602060048201526037602482015260008051602061558e8339815191526044820152763a32902837b7b6103737ba1030baba3437b934bd32b21760491b6064820152608401610764565b60608101516001600160a01b0316611d945760405162461bcd60e51b8152602060048201526048602482015260008051602061558e83398151915260448201527f7465205246512d4d20646f6573206e6f7420737570706f7274206e6174697665606482015267103a37b5b2b7399760c11b608482015260a401610764565b6101008101516000908152600c602052604090205460ff1615611e0d5760405162461bcd60e51b815260206004820152603e602482015260008051602061558e83398151915260448201527f746520747869642068617320616c7265616479206265656e20757365642e00006064820152608401610764565b61010001516000908152600c60205260409020805460ff19166001179055565b6000611e38826134ee565b9050611e4e8260400151828461012001516135c7565b610a665760405162461bcd60e51b815260206004820152603660248201527f48617368666c6f77526f757465723a3a5f76616c69646174655246514d5369676044820152753730ba3ab9329024b73b30b634b21039b4b3b732b91760511b6064820152608401610764565b60408101516020820151611efd91906001600160a01b0316611edc578251611ee2565b82602001515b60a084015160608501516001600160a01b0316929190613628565b8051604051633020db0560e01b81526001600160a01b0390911690633020db0590611f2c908490600401614f19565b600060405180830381600087803b158015611f4657600080fd5b505af1158015611f5a573d6000803e3d6000fd5b5050505050565b6000611f6c83613660565b9050611f828360400151828561012001516135c7565b6120045760405162461bcd60e51b815260206004820152604760248201527f48617368666c6f77526f757465723a3a5f76616c69646174655246514d4c696d60448201527f69744f726465725369676e617475726520496e76616c6964207472616465722060648201526639b4b3b732b91760c91b608482015260a401610764565b825160208085015160408087015161010088015182516bffffffffffffffffffffffff19606097881b81168288015294871b851660348201529190951b9092166048830152605c82019390935246607c8083019190915283518083039091018152609c820184528051908301207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060bc83015260d8808301919091528351808303909101815260f89091019092528151910120600b546001600160a01b03166120cd82856136f2565b6001600160a01b03161461215b5760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a5f76616c69646174655246514d4c696d60448201527f69744f726465725369676e617475726520496e76616c69642067756172646961606482015268371039b4b3b732b91760b91b608482015260a401610764565b50505050565b610a416001600160a01b03881687308888888888613716565b6003546001600160a01b031633146121d45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610764565b565b804710156122265760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610764565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612273576040519150601f19603f3d011682016040523d82523d6000602084013e612278565b606091505b5050905080610db35760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610764565b6040516001600160a01b038316602482015260448101829052610db390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138ec565b4281610180015110156123bb5760405162461bcd60e51b815260206004820152603b60248201526000805160206155ae83398151915260448201527f46514d51756f74652051756f74652068617320657870697265642e00000000006064820152608401610764565b6040808201516001600160a01b031660009081526005602052205460ff166124395760405162461bcd60e51b815260206004820152603d60248201526000805160206155ae83398151915260448201527f46514d51756f746520506f6f6c206e6f7420617574686f72697a65642e0000006064820152608401610764565b6040808201516001600160a01b039081166000908152600860209081528382206101c0860151909316825291909152205460ff166124df5760405162461bcd60e51b815260206004820152604960248201526000805160206155ae83398151915260448201527f46514d51756f746520556e617574686f72697a6564206d657373656e676572206064820152683337b9103837b7b61760b91b608482015260a401610764565b6040808201516001600160a01b03166000908152600660209081528282208185015161ffff1683528152828220606085015183529052205460ff1661258b5760405162461bcd60e51b815260206004820152604860248201526000805160206155ae83398151915260448201527f46514d51756f746520556e617574686f72697a656420782d636861696e20706560648201526732b9103837b7b61760c11b608482015260a401610764565b6101008101516001600160a01b03166126115760405162461bcd60e51b815260206004820152604e60248201526000805160206155ae83398151915260448201527f46514d51756f7465205246512d4d20646f6573206e6f7420737570706f72742060648201526d3730ba34bb32903a37b5b2b7399760911b608482015260a401610764565b6101a08101516000908152600c602052604090205460ff16156126985760405162461bcd60e51b8152602060048201526044602482018190526000805160206155ae833981519152908201527f46514d51756f746520747869642068617320616c7265616479206265656e207560648201526339b2b21760e11b608482015260a401610764565b6101a08101516000908152600c60205260408120805460ff191660011790556126c0826139c1565b90506126d68260c0015182846101e001516135c7565b610a665760405162461bcd60e51b815260206004820152603860248201526000805160206155ae83398151915260448201527f46514d51756f746520496e76616c6964207369676e65722e00000000000000006064820152608401610764565b60c0830151608084015161277f91906001600160a01b031661275c578460400151612762565b84608001515b6101408601516101008701516001600160a01b0316929190613628565b82604001516001600160a01b031663b86a5dd7846040518263ffffffff1660e01b81526004016127af9190614ffb565b600060405180830381600087803b1580156127c957600080fd5b505af11580156127dd573d6000803e3d6000fd5b505050506127e961414f565b835161ffff9081168252602080860151909116908201526040808501516001600160a01b03908116828401526060808701519084015260808087015182169084015260a0808701519084015260c08087015182169084015260e08087015190840152610100808701518216908401526101208087015190840152610140808701519084015261016080870151908401526101a08601516101808401526101c08601519151633bb6485360e21b815291169063eed9214c9034906128b690859033908990899060040161512d565b6000604051808303818588803b1580156128cf57600080fd5b505af11580156128e3573d6000803e3d6000fd5b505050505050505050565b600480546001600160a01b031916905561087581611bec565b606060ff831461291a57611bcb83613abd565b81805461292690614dda565b80601f016020809104026020016040519081016040528092919081815260200182805461295290614dda565b801561299f5780601f106129745761010080835404028352916020019161299f565b820191906000526020600020905b81548152906001019060200180831161298257829003601f168201915b50505050509050611be3565b60028054036129fc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610764565b60028055565b8061014001518161012001511115612a845760405162461bcd60e51b815260206004820152604b60248201526000805160206155ae83398151915260448201527f46515451756f74652065666665637469766542617365546f6b656e416d6f756e60648201526a3a103a37b7903434b3b41760a91b608482015260a401610764565b428161018001511015612aed5760405162461bcd60e51b815260206004820152603b60248201526000805160206155ae83398151915260448201527f46515451756f74652051756f74652068617320657870697265642e00000000006064820152608401610764565b6040808201516001600160a01b031660009081526005602052205460ff16612b6b5760405162461bcd60e51b815260206004820152603d60248201526000805160206155ae83398151915260448201527f46515451756f746520506f6f6c206e6f7420617574686f72697a65642e0000006064820152608401610764565b612b764260b4615253565b612b82906103e8615266565b816101a001511115612bea5760405162461bcd60e51b815260206004820152603860248201526000805160206155ae83398151915260448201527f46515451756f7465204e6f6e636520746f6f20686967682e00000000000000006064820152608401610764565b6040808201516001600160a01b039081166000908152600860209081528382206101e0860151909316825291909152205460ff16612c905760405162461bcd60e51b815260206004820152604960248201526000805160206155ae83398151915260448201527f46515451756f746520556e617574686f72697a6564206d657373656e676572206064820152683337b9103837b7b61760b91b608482015260a401610764565b6040808201516001600160a01b03166000908152600660209081528282208185015161ffff1683528152828220606085015183529052205460ff166108755760405162461bcd60e51b815260206004820152604860248201526000805160206155ae83398151915260448201527f46515451756f746520556e617574686f72697a656420782d636861696e20706560648201526732b9103837b7b61760c11b608482015260a401610764565b60e083015134906001600160a01b0316612df757836101200151341015612de45760405162461bcd60e51b815260206004820152605060248201527f48617368666c6f77526f757465723a3a747261646558436861696e524651542060448201527f6d73672e76616c75652073686f756c64206265203e3d2065666665637469766560648201526f2130b9b2aa37b5b2b720b6b7bab73a1760811b608482015260a401610764565b610120840151612df4903461527d565b90505b6101608401516101408501516101208601511015612e3857846101400151856101200151866101600151612e2b9190615266565b612e359190615290565b90505b60e08501516000906001600160a01b0316612f285760808601516001600160a01b0316612e6b5750610120850151612f6a565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db08761012001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015612ecb57600080fd5b505af1158015612edf573d6000803e3d6000fd5b5050506080880151610120890151612f2393506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692506122ef565b612f6a565b612f6a3360808801516001600160a01b0316612f48578760400151612f4e565b87608001515b61012089015160e08a01516001600160a01b0316929190613628565b60408601516001600160a01b031663ca3428d08288336040518463ffffffff1660e01b8152600401612f9d9291906152b2565b6000604051808303818588803b158015612fb657600080fd5b505af1158015612fca573d6000803e3d6000fd5b5050505050612fd761414f565b865161ffff9081168252602080890151909116908201526040808801516001600160a01b03908116828401526060808a0151908401526080808a015182169084015260a0808a0151908401523360c08085018290528a015160e0808601919091528a01518216610100808601919091528a0151610120808601919091528a015161014085015261016084018690526101c08a01516101808501526101e08a01519251633bb6485360e21b8152929091169163eed9214c9187916130a29186918c908c9060040161512d565b6000604051808303818588803b1580156130bb57600080fd5b505af11580156130cf573d6000803e3d6000fd5b505050505050505050505050565b6060613121838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250613afc565b9392505050565b8060e001518160c0015111156131a25760405162461bcd60e51b815260206004820152604560248201526000805160206155ee83398151915260448201527f74652065666665637469766542617365546f6b656e416d6f756e7420746f6f206064820152643434b3b41760d91b608482015260a401610764565b4281610120015110156132035760405162461bcd60e51b815260206004820152603560248201526000805160206155ee8339815191526044820152743a329028bab7ba32903430b99032bc3834b932b21760591b6064820152608401610764565b61320e4260b4615253565b61321a906103e8615266565b81610140015111156132775760405162461bcd60e51b815260206004820152603260248201526000805160206155ee8339815191526044820152713a32902737b731b2903a37b7903434b3b41760711b6064820152608401610764565b80516001600160a01b031660009081526005602052604090205460ff166108755760405162461bcd60e51b815260206004820152603760248201526000805160206155ee8339815191526044820152763a32902837b7b6103737ba1030baba3437b934bd32b21760491b6064820152608401610764565b60808201516000906001600160a01b03166133db5760208301516001600160a01b0316613320575060c0820151613452565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d0e30db08460c001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561337f57600080fd5b505af1158015613393573d6000803e3d6000fd5b505050602085015160c08601516133d693506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001692506122ef565b613452565b60208301516000906001600160a01b03166133f75783516133fd565b83602001515b905082156134305761342b818560c0015186608001516001600160a01b03166122ef9092919063ffffffff16565b613450565b6134503360c086015160808701516001600160a01b031691908490613628565b505b8251604051630629563960e51b81526001600160a01b039091169063c52ac7209083906134839087906004016153fc565b6000604051808303818588803b15801561349c57600080fd5b505af1158015611165573d6000803e3d6000fd5b600080829050601f815111156134db578260405163305a27a960e01b815260040161076491906154ee565b80516134e682615501565b179392505050565b6000611be37f57f425280e5750d80e512f912d1345058e55906481b3b1350084b24f910d8f26836101000151846040015185600001518660200151876060015188608001518960a001518a60c001518b60e001516040516020016135ac9a99989796959493929190998a5260208a01989098526001600160a01b0396871660408a01529486166060890152928516608088015290841660a087015290921660c085015260e08401919091526101008301526101208201526101400190565b60405160208183030381529060405280519060200120613bd9565b60008060006135d68585613c06565b909250905060008160048111156135ef576135ef615525565b14801561360d5750856001600160a01b0316826001600160a01b0316145b8061361e575061361e868686613c4b565b9695505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261215b9085906323b872dd60e01b9060840161231b565b6000611be37f858277df261dac1a331e7a097da24d7013d9b2e800b574e3d4569bcdb205a360836101000151846060015185608001518660a001518760c001518860e001516040516020016135ac979695949392919096875260208701959095526001600160a01b039384166040870152919092166060850152608084019190915260a083015260c082015260e00190565b60008060006137018585613c06565b9150915061370e81613d37565b509392505050565b604051623f675f60e91b81526001600160a01b038881166004830152600091908a1690637ecebe0090602401602060405180830381865afa15801561375f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137839190614dc1565b60405163d505accf60e01b81526001600160a01b038a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e401600060405180830381600087803b1580156137f757600080fd5b505af115801561380b573d6000803e3d6000fd5b5050604051623f675f60e91b81526001600160a01b038b81166004830152600093508c169150637ecebe0090602401602060405180830381865afa158015613857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061387b9190614dc1565b9050613888826001615253565b81146138e05760405162461bcd60e51b815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f74207375636365656044820152601960fa1b6064820152608401610764565b50505050505050505050565b6000613941826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e819092919063ffffffff16565b9050805160001480613962575080806020019051810190613962919061553b565b610db35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610764565b6000611be37f528d84e234d011c5ad5daf43f4d791e0e646817405951551e3337a633c74aca3836101a00151846000015161ffff16856020015161ffff168660e001518760400151886080015189606001518a60a001518b61010001518c61012001518d61014001518e61016001518f61018001516040516020016135ac9e9d9c9b9a999897969594939291909d8e5260208e019c909c5260408d019a909a5260608c019890985260808b01969096526001600160a01b0394851660a08b015292841660c08a015260e0890191909152610100880152166101208601526101408501526101608401526101808301526101a08201526101c00190565b60606000613aca83613e90565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b606082471015613b5d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610764565b600080866001600160a01b03168587604051613b799190615558565b60006040518083038185875af1925050503d8060008114613bb6576040519150601f19603f3d011682016040523d82523d6000602084013e613bbb565b606091505b5091509150613bcc87838387613eb8565b925050505b949350505050565b6000611be3613be6613f31565b8360405161190160f01b8152600281019290925260228201526042902090565b6000808251604103613c3c5760208301516040840151606085015160001a613c3087828585614061565b94509450505050613c44565b506000905060025b9250929050565b6000806000856001600160a01b0316631626ba7e60e01b8686604051602401613c75929190615574565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051613cb39190615558565b600060405180830381855afa9150503d8060008114613cee576040519150601f19603f3d011682016040523d82523d6000602084013e613cf3565b606091505b5091509150818015613d0757506020815110155b801561361e57508051630b135d3f60e11b90613d2c9083016020908101908401614dc1565b149695505050505050565b6000816004811115613d4b57613d4b615525565b03613d535750565b6001816004811115613d6757613d67615525565b03613db45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610764565b6002816004811115613dc857613dc8615525565b03613e155760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610764565b6003816004811115613e2957613e29615525565b036108755760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610764565b6060613bd18484600085613afc565b600060ff8216601f811115611be357604051632cd44ac360e21b815260040160405180910390fd5b60608315613f27578251600003613f20576001600160a01b0385163b613f205760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b5081613bd1565b613bd18383614125565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015613f8a57507f000000000000000000000000000000000000000000000000000000000000000046145b15613fb457507f000000000000000000000000000000000000000000000000000000000000000090565b61405c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115614098575060009050600361411c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156140ec573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166141155760006001925092505061411c565b9150600090505b94509492505050565b8151156141355781518083602001fd5b8060405162461bcd60e51b815260040161076491906154ee565b604080516101a081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081019190915290565b803561ffff811681146141cd57600080fd5b919050565b6000806000606084860312156141e757600080fd5b833592506141f7602085016141bb565b9150604084013590509250925092565b801515811461087557600080fd5b60008060006060848603121561422a57600080fd5b614233846141bb565b925060208401359150604084013561424a81614207565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b038111828210171561428e5761428e614255565b60405290565b60405161022081016001600160401b038111828210171561428e5761428e614255565b6040516101a081016001600160401b038111828210171561428e5761428e614255565b80356001600160a01b03811681146141cd57600080fd5b600082601f83011261430257600080fd5b81356001600160401b038082111561431c5761431c614255565b604051601f8301601f19908116603f0116810190828211818310171561434457614344614255565b8160405283815286602085880101111561435d57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000610160828403121561439057600080fd5b61439861426b565b90506143a3826142da565b81526143b1602083016142da565b60208201526143c2604083016142da565b60408201526143d3606083016142da565b60608201526143e4608083016142da565b608082015260a082013560a082015260c082013560c082015260e082013560e0820152610100808301358183015250610120808301356001600160401b038082111561442f57600080fd5b61443b868387016142f1565b8385015261014092508285013591508082111561445757600080fd5b50614464858286016142f1565b82840152505092915050565b60006020828403121561448257600080fd5b81356001600160401b0381111561449857600080fd5b613bd18482850161437d565b600080604083850312156144b757600080fd5b6144c0836142da565b915060208301356144d081614207565b809150509250929050565b803560ff811681146141cd57600080fd5b600080600080600080600060e0888a03121561450757600080fd5b87356001600160401b038082111561451e57600080fd5b61452a8b838c0161437d565b985060208a013591508082111561454057600080fd5b5061454d8a828b016142f1565b96505060408801359450614563606089016144db565b9699959850939660808101359560a0820135955060c0909101359350915050565b6000806040838503121561459757600080fd5b82356001600160401b03808211156145ae57600080fd5b6145ba8683870161437d565b935060208501359150808211156145d057600080fd5b506145dd858286016142f1565b9150509250929050565b6000602082840312156145f957600080fd5b613121826142da565b60008060008060008060c0878903121561461b57600080fd5b86356001600160401b0381111561463157600080fd5b61463d89828a0161437d565b96505060208701359450614653604088016144db565b9350606087013592506080870135915060a087013590509295509295509295565b6000610220828403121561468757600080fd5b61468f614294565b905061469a826141bb565b81526146a8602083016141bb565b60208201526146b9604083016142da565b6040820152606082013560608201526146d4608083016142da565b608082015260a082013560a08201526146ef60c083016142da565b60c082015260e082013560e082015261010061470c8184016142da565b9082015261012082810135908201526101408083013590820152610160808301359082015261018080830135908201526101a080830135908201526101c06147558184016142da565b908201526101e0828101356001600160401b038082111561477557600080fd5b614781868387016142f1565b8385015261020092508285013591508082111561445757600080fd5b6000806000606084860312156147b257600080fd5b83356001600160401b03808211156147c957600080fd5b6147d587838801614674565b94506020860135935060408601359150808211156147f257600080fd5b506147ff868287016142f1565b9150509250925092565b60005b8381101561482457818101518382015260200161480c565b50506000910152565b60008151808452614845816020860160208601614809565b601f01601f19169290920160200192915050565b60ff60f81b881681526000602060e08184015261487960e084018a61482d565b838103604085015261488b818a61482d565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156148dd578351835292840192918401916001016148c1565b50909c9b505050505050505050505050565b6000610220828403121561490257600080fd5b61490a614294565b9050614915826141bb565b8152614923602083016141bb565b6020820152614934604083016142da565b60408201526060820135606082015261494f608083016142da565b608082015260a082013560a082015260c082013560c082015261497460e083016142da565b60e0820152610100828101359082015261012080830135908201526101408083013590820152610160808301359082015261018080830135908201526101a080830135908201526101c080830135908201526101e06149d48184016142da565b90820152610200828101356001600160401b038111156149f357600080fd5b614464858286016142f1565b600080600080600080600080610100898b031215614a1c57600080fd5b88356001600160401b0380821115614a3357600080fd5b614a3f8c838d016148ef565b995060208b0135985060408b0135915080821115614a5c57600080fd5b50614a698b828c016142f1565b96505060608901359450614a7f60808a016144db565b979a969950949793969560a0850135955060c08501359460e001359350915050565b60008060408385031215614ab457600080fd5b614abd836142da565b9150614acb602084016142da565b90509250929050565b600080600080600080600080610100898b031215614af157600080fd5b88356001600160401b0380821115614b0857600080fd5b614a3f8c838d01614674565b600080600060608486031215614b2957600080fd5b614b32846142da565b92506141f7602085016141bb565b600060208284031215614b5257600080fd5b81356001600160401b0380821115614b6957600080fd5b908301906101608286031215614b7e57600080fd5b614b8661426b565b614b8f836141bb565b815260208301356020820152614ba7604084016142da565b6040820152614bb8606084016142da565b6060820152614bc9608084016142da565b6080820152614bda60a084016142da565b60a082015260c083013560c082015260e083013560e0820152610100808401358183015250610120614c0d8185016142da565b908201526101408381013583811115614c2557600080fd5b614c31888287016142f1565b918301919091525095945050505050565b60006101a08284031215614c5557600080fd5b614c5d6142b7565b9050614c68826142da565b8152614c76602083016142da565b6020820152614c87604083016142da565b6040820152614c98606083016142da565b6060820152614ca9608083016142da565b6080820152614cba60a083016142da565b60a082015260c0828101359082015260e080830135908201526101008083013590820152610120808301359082015261014080830135908201526101608083013590820152610180808301356001600160401b038111156149f357600080fd5b600060208284031215614d2c57600080fd5b81356001600160401b03811115614d4257600080fd5b613bd184828501614c42565b600080600060608486031215614d6357600080fd5b83356001600160401b0380821115614d7a57600080fd5b6147d5878388016148ef565b60008060008060008060c08789031215614d9f57600080fd5b86356001600160401b03811115614db557600080fd5b61463d89828a01614c42565b600060208284031215614dd357600080fd5b5051919050565b600181811c90821680614dee57607f821691505b602082108103614e0e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610db357600081815260208120601f850160051c81016020861015614e3b5750805b601f850160051c820191505b81811015610ac957828155600101614e47565b81516001600160401b03811115614e7357614e73614255565b614e8781614e818454614dda565b84614e14565b602080601f831160018114614ebc5760008415614ea45750858301515b600019600386901b1c1916600185901b178555610ac9565b600085815260208120601f198616915b82811015614eeb57888601518255948401946001909101908401614ecc565b5085821015614f095787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208152614f336020820183516001600160a01b03169052565b60006020830151614f4f60408401826001600160a01b03169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a083015160c083015260c083015160e083015260e08301516101008181850152808501519150506101208181850152808501519150506101606101408181860152614fdf61018086018461482d565b90860151858203601f19018387015290925061361e838261482d565b6020815261501060208201835161ffff169052565b60006020830151615027604084018261ffff169052565b5060408301516001600160a01b03811660608401525060608301516080830152608083015161506160a08401826001600160a01b03169052565b5060a083015160c083015260c083015161508660e08401826001600160a01b03169052565b5060e0830151610100838101919091528301516101206150b0818501836001600160a01b03169052565b8401516101408481019190915284015161016080850191909152840151610180808501919091528401516101a0808501919091528401516101c08085019190915284015190506101e061510d818501836001600160a01b03169052565b808501519150506102206102008181860152614fdf61024086018461482d565b845161ffff1681526000610200602087015161514f602085018261ffff169052565b50604087015161516a60408501826001600160a01b03169052565b5060608701516060840152608087015161518f60808501826001600160a01b03169052565b5060a087015160a084015260c08701516151b460c08501826001600160a01b03169052565b5060e087015160e0840152610100808801516151da828601826001600160a01b03169052565b505061012087810151908401526101408088015190840152610160808801519084015261018080880151908401526001600160a01b0386166101a0840152846101c0840152806101e08401526152328184018561482d565b979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611be357611be361523d565b8082028115828204841417611be357611be361523d565b81810381811115611be357611be361523d565b6000826152ad57634e487b7160e01b600052601260045260246000fd5b500490565b604081526152c760408201845161ffff169052565b600060208401516152de606084018261ffff169052565b5060408401516001600160a01b038116608084015250606084015160a083015260808401516001600160a01b03811660c08401525060a084015160e083015260c0840151610100818185015260e08601519150610120615348818601846001600160a01b03169052565b908601516101408581019190915290860151610160808601919091529086015161018080860191909152908601516101a080860191909152908601516101c080860191909152908601516101e08086019190915290860151610200808601919091529086015191506102206153c7818601846001600160a01b03169052565b8187015192508061024086015250506153e461026084018261482d565b91505061312160208301846001600160a01b03169052565b602081526154166020820183516001600160a01b03169052565b6000602083015161543260408401826001600160a01b03169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a080840152613bd16101c084018261482d565b602081526000613121602083018461482d565b80516020808301519190811015614e0e5760001960209190910360031b1b16919050565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561554d57600080fd5b815161312181614207565b6000825161556a818460208701614809565b9190910192915050565b828152604060208201526000613bd1604083018461482d56fe48617368666c6f77526f757465723a3a5f76616c69646174655246514d51756f48617368666c6f77526f757465723a3a5f76616c696461746558436861696e5248617368666c6f77526f757465723a3a66696c6c58436861696e20556e61757448617368666c6f77526f757465723a3a5f76616c69646174655246515451756fa26469706673582212205d399236b5915ebc16086b74186c7900a517933472c34113d04b3d8925cdc12e64736f6c63430008120033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Deployed Bytecode
0x6080604052600436106102045760003560e01c80639404a2d611610118578063c45a0155116100a0578063e30c39781161006f578063e30c397814610640578063e816b3931461065e578063f2fde38b1461068e578063f9c66166146106ae578063fbae3885146106c157600080fd5b8063c45a0155146105b9578063c4d66de8146105d9578063c52ac720146105f9578063e0af36161461060c57600080fd5b8063a31d7757116100e7578063a31d7757146104ea578063a85b5a4a146104fd578063ad5ce56414610538578063c027999014610579578063c08347cb1461059957600080fd5b80639404a2d61461045c5780639953488c1461047c5780639aaf89301461048f578063a1dfb6ba146104af57600080fd5b806368742da61161019b57806379ba50971161016a57806379ba5097146103a957806384b0196e146103be57806388fe1e05146103e657806389a17d94146104065780638da5cb5b1461043e57600080fd5b806368742da6146103415780636ab7a1ec14610361578063715018a6146103815780637296d2811461039657600080fd5b806341c4d05d116101d757806341c4d05d146102c15780634e104b87146102e15780635b637e75146103015780635f43286e1461032157600080fd5b806308d535641461020957806315c67d1d1461025f5780633020db051461028157806337cba5fb146102a1575b600080fd5b34801561021557600080fd5b5061024a6102243660046141d2565b600660209081526000938452604080852082529284528284209052825290205460ff1681565b60405190151581526020015b60405180910390f35b34801561026b57600080fd5b5061027f61027a366004614215565b6106e1565b005b34801561028d57600080fd5b5061027f61029c366004614470565b61085a565b3480156102ad57600080fd5b5061027f6102bc3660046144a4565b610878565b3480156102cd57600080fd5b5061027f6102dc3660046144ec565b61097e565b3480156102ed57600080fd5b5061027f6102fc366004614584565b610a4a565b34801561030d57600080fd5b5061027f61031c3660046144a4565b610a6a565b34801561032d57600080fd5b5061027f61033c366004614215565b610ad1565b34801561034d57600080fd5b5061027f61035c3660046145e7565b610be0565b34801561036d57600080fd5b5061027f61037c366004614602565b610c7d565b34801561038d57600080fd5b5061027f610d35565b61027f6103a436600461479d565b610d9f565b3480156103b557600080fd5b5061027f610db8565b3480156103ca57600080fd5b506103d3610e2f565b6040516102569796959493929190614859565b3480156103f257600080fd5b5061027f6104013660046144a4565b610eb7565b34801561041257600080fd5b50600b54610426906001600160a01b031681565b6040516001600160a01b039091168152602001610256565b34801561044a57600080fd5b506003546001600160a01b0316610426565b34801561046857600080fd5b5061027f6104773660046144a4565b610f98565b61027f61048a3660046149ff565b611001565b34801561049b57600080fd5b5061027f6104aa3660046145e7565b61116f565b3480156104bb57600080fd5b5061024a6104ca366004614aa1565b600960209081526000928352604080842090915290825290205460ff1681565b61027f6104f8366004614ad4565b611263565b34801561050957600080fd5b5061024a610518366004614aa1565b600860209081526000928352604080842090915290825290205460ff1681565b34801561054457600080fd5b5061024a610553366004614b14565b600760209081526000938452604080852082529284528284209052825290205460ff1681565b34801561058557600080fd5b5061027f610594366004614b40565b61131c565b3480156105a557600080fd5b5061027f6105b43660046145e7565b611629565b3480156105c557600080fd5b50600a54610426906001600160a01b031681565b3480156105e557600080fd5b5061027f6105f43660046145e7565b61170a565b61027f610607366004614d1a565b6118c6565b34801561061857600080fd5b506104267f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561064c57600080fd5b506004546001600160a01b0316610426565b34801561066a57600080fd5b5061024a6106793660046145e7565b60056020526000908152604090205460ff1681565b34801561069a57600080fd5b5061027f6106a93660046145e7565b6119e4565b61027f6106bc366004614d4e565b611a55565b3480156106cd57600080fd5b5061027f6106dc366004614d86565b611a7b565b333b61076d5760405162461bcd60e51b815260206004820152604a60248201527f48617368666c6f77526f757465723a3a75706461746558436861696e43616c6c60448201527f6572417574686f72697a6174696f6e2053656e646572206d75737420626520616064820152691031b7b73a3930b1ba1760b11b608482015260a4015b60405180910390fd5b816107e2576040805162461bcd60e51b81526020600482015260248101919091527f48617368666c6f77526f757465723a3a75706461746558436861696e43616c6c60448201527f6572417574686f72697a6174696f6e2043616c6c657220697320656d7074792e6064820152608401610764565b33600081815260076020908152604080832061ffff8816808552908352818420878552835292819020805460ff191686151590811790915581519384529183018690528201527fca7d17625f7b2f5114f0621d847626dd6dff5f4c34cfc9050b8f1fce3df046269060600160405180910390a2505050565b61086381611c3e565b61086c81611e2d565b61087581611eb9565b50565b3360009081526005602052604090205460ff1661090d5760405162461bcd60e51b815260206004820152604760248201527f48617368666c6f77526f757465723a3a75706461746558436861696e4d65737360448201527f656e676572417574686f72697a6174696f6e20506f6f6c206e6f74206175746860648201526637b934bd32b21760c91b608482015260a401610764565b3360008181526008602090815260408083206001600160a01b03871680855290835292819020805460ff19168615159081179091558151938452918301919091527fe8dfd8b5fb155ba2f5c55159f912f5ef8d8a36fe29a1d6a6ee56a27496f0b3ee91015b60405180910390a25050565b61098787611c3e565b6109918787611f61565b8660a00151811015610a215760405162461bcd60e51b815260206004820152604d60248201527f48617368666c6f77526f757465723a3a74726164655246514d4c696d69744f7260448201527f646572576974685065726d697420496e73756666696369656e7420616d6f756e60648201526c3a103a379030b8383937bb329760991b608482015260a401610764565b610a38876060015188604001518388888888612161565b610a4187611eb9565b50505050505050565b610a5382611c3e565b610a5d8282611f61565b610a6682611eb9565b5050565b610a7261217a565b6040516305f4cd1360e51b815281151560048201526001600160a01b0383169063be99a26090602401600060405180830381600087803b158015610ab557600080fd5b505af1158015610ac9573d6000803e3d6000fd5b505050505050565b3360009081526005602052604090205460ff16610b615760405162461bcd60e51b815260206004820152604260248201527f48617368666c6f77526f757465723a3a75706461746558436861696e506f6f6c60448201527f417574686f72697a6174696f6e20506f6f6c206e6f7420617574686f72697a65606482015261321760f11b608482015260a401610764565b33600081815260066020908152604080832061ffff8816808552908352818420878552835292819020805486151560ff1990911681179091558151938452918301869052828101919091525182917f7ffc452afec1d39d0e156e268852ae82b9ef5093e3a88b443bb52bd264b8829e919081900360600190a250505050565b610be861217a565b6001600160a01b038116610c005761087533476121d6565b610875336040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610c48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6c9190614dc1565b6001600160a01b03841691906122ef565b610c8686611c3e565b610c8f86611e2d565b8560a00151811015610d155760405162461bcd60e51b815260206004820152604360248201527f48617368666c6f77526f757465723a3a74726164655246514d5769746850657260448201527f6d697420496e73756666696369656e7420616d6f756e7420746f20617070726f6064820152623b329760e91b608482015260a401610764565b610d2c866060015187604001518388888888612161565b610ac986611eb9565b610d3d61217a565b60405162461bcd60e51b815260206004820152603160248201527f48617368666c6f77526f757465723a2052656e6f756e63696e67206f776e657260448201527039b434b8103737ba1030b63637bbb2b21760791b6064820152608401610764565b610da883612352565b610db3838383612736565b505050565b60045433906001600160a01b03168114610e265760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b6064820152608401610764565b610875816128ee565b600060608082808083610e627f48617368666c6f77202d20526f7574657200000000000000000000000000001183612907565b610e8d7f312e3000000000000000000000000000000000000000000000000000000000036001612907565b60408051600080825260208201909252600f60f81b9b939a50919850469750309650945092509050565b600a546001600160a01b0316336001600160a01b031614610f345760405162461bcd60e51b815260206004820152603160248201527f48617368666c6f77526f757465723a206d73672e73656e6465722073686f756c60448201527032103132903a3432902330b1ba37b93c9760791b6064820152608401610764565b6001600160a01b038216600081815260056020908152604091829020805460ff19168515159081179091558251938452908301527ffc087d65c1c1527a0ded830f211118cc745af1f2e78dc8e17d3e6f91bdc864e591015b60405180910390a15050565b3360008181526009602090815260408083206001600160a01b03871680855290835292819020805460ff19168615159081179091558151938452918301919091527fe80bbdf568eb195098d86688fac386c5de50b820e228a4f7941f09e9346c8ebb9101610972565b6110096129ab565b61101288612a02565b60e08801516001600160a01b03166110aa5760405162461bcd60e51b815260206004820152604f60248201527f48617368666c6f77526f757465723a3a747261646558436861696e524651545760448201527f6974685065726d69742062617365546f6b656e2063616e6e6f7420626520746860648201526e32903730ba34bb32903a37b5b2b71760891b608482015260a401610764565b8761012001518110156111375760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a747261646558436861696e524651545760448201527f6974685065726d697420496e73756666696369656e7420616d6f756e7420746f6064820152681030b8383937bb329760b91b608482015260a401610764565b6111508860e001516111463390565b8388888888612161565b61115b888888612d3c565b6111656001600255565b5050505050505050565b61117761217a565b6001600160a01b03811660009081526005602052604090205460ff166112055760405162461bcd60e51b815260206004820152603c60248201527f48617368666c6f77526f757465723a3a666f726365556e617574686f72697a6560448201527f506f6f6c20506f6f6c206973206e6f7420617574686f72697a65642e000000006064820152608401610764565b6001600160a01b0381166000818152600560209081526040808320805460ff191690558051938452908301919091527ffc087d65c1c1527a0ded830f211118cc745af1f2e78dc8e17d3e6f91bdc864e591015b60405180910390a150565b61126c88612352565b8761014001518110156112f95760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a747261646558436861696e5246516d5760448201527f6974685065726d697420496e73756666696369656e7420616d6f756e7420746f6064820152681030b8383937bb329760b91b608482015260a401610764565b6113118861010001518960c001518388888888612161565b611165888888612736565b6040818101516001600160a01b03166000908152600860209081528282203383529052205460ff166113995760405162461bcd60e51b815260206004820152603260248201526000805160206155ce8339815191526044820152713437b934bd32b21036b2b9b9b2b733b2b91760711b6064820152608401610764565b6040808201516001600160a01b0316600090815260066020908152828220845161ffff16835281528282208185015183529052205460ff166114265760405162461bcd60e51b815260206004820152603260248201526000805160206155ce8339815191526044820152713437b934bd32b2103832b2b9103837b7b61760711b6064820152608401610764565b6101208101516001600160a01b031615611558576101208101516001600160a01b03166000908152600760209081526040808320845161ffff1684528252808320610100850151845290915290205460ff166114cc5760405162461bcd60e51b815260206004820152603160248201526000805160206155ce8339815191526044820152703437b934bd32b2103c16b1b0b63632b91760791b6064820152608401610764565b6101208101516001600160a01b0316600090815260096020908152604080832033845290915290205460ff166115585760405162461bcd60e51b815260206004820152603d60248201526000805160206155ce83398151915260448201527f686f72697a6564206d657373656e67657220666f7220782d63616c6c2e0000006064820152608401610764565b604080820151606083015160e0840151608085015160a086015160c087015195516376a4f13560e01b81526001600160a01b0394851660048201526024810193909352908316604483015282166064820152608481019390935216906376a4f1359060a401600060405180830381600087803b1580156115d757600080fd5b505af11580156115eb573d6000803e3d6000fd5b505050506101208101516001600160a01b03161561087557610a668161014001518261012001516001600160a01b03166130dd90919063ffffffff16565b61163161217a565b6001600160a01b0381166116bc5760405162461bcd60e51b815260206004820152604660248201527f48617368666c6f77526f757465723a3a7570646174654c696d69744f7264657260448201527f477561726469616e20477561726469616e2063616e6e6f742062652030206164606482015265323932b9b99760d11b608482015260a401610764565b600b80546001600160a01b0319166001600160a01b0383169081179091556040519081527f1bf268a62b77f3cc4e6f66f6d53de9eb2ec99ae71b9df01a1775e877e96be9cf90602001611258565b600454600160a81b900460ff161580801561173257506004546001600160a01b90910460ff16105b806117535750303b1580156117535750600454600160a01b900460ff166001145b6117b65760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610764565b6004805460ff60a01b1916600160a01b17905580156117e3576004805460ff60a81b1916600160a81b1790555b6117eb61217a565b6001600160a01b0382166118675760405162461bcd60e51b815260206004820152603760248201527f48617368666c6f77526f757465723a3a696e697469616c697a6520466163746f60448201527f72792063616e6e6f74206265203020616464726573732e0000000000000000006064820152608401610764565b600a80546001600160a01b0319166001600160a01b0384161790558015610a66576004805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610f8c565b6118cf81613128565b60808101516001600160a01b0316611972578060c00151341461196d5760405162461bcd60e51b815260206004820152604a60248201527f48617368666c6f77526f757465723a3a747261646552465154206d73672e766160448201527f6c75652073686f756c6420657175616c2065666665637469766542617365546f60648201526935b2b720b6b7bab73a1760b11b608482015260a401610764565b6119d9565b34156119d95760405162461bcd60e51b815260206004820152603060248201527f48617368666c6f77526f757465723a3a747261646552465154206d73672e766160448201526f363ab29039b437bab63210313290181760811b6064820152608401610764565b6108758160006132ee565b6119ec61217a565b600480546001600160a01b0383166001600160a01b03199091168117909155611a1d6003546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b611a5d6129ab565b611a6683612a02565b611a71838383612d3c565b610db36001600255565b611a8486613128565b60808601516001600160a01b0316611b165760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a7472616465524651545769746850657260448201527f6d69742062617365546f6b656e2063616e6e6f7420626520746865206e6174696064820152683b32903a37b5b2b71760b91b608482015260a401610764565b8560c00151811015611b9c5760405162461bcd60e51b815260206004820152604360248201527f48617368666c6f77526f757465723a3a7472616465524651545769746850657260448201527f6d697420496e73756666696369656e7420616d6f756e7420746f20617070726f6064820152623b329760e91b608482015260a401610764565b611bab86608001516111463390565b610ac98660006132ee565b6000602083511015611bd257611bcb836134b0565b9050611be3565b81611bdd8482614e5a565b5060ff90505b92915050565b90565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b428160e001511015611c9e5760405162461bcd60e51b8152602060048201526035602482015260008051602061558e8339815191526044820152743a329028bab7ba32903430b99032bc3834b932b21760591b6064820152608401610764565b80516001600160a01b031660009081526005602052604090205460ff16611d155760405162461bcd60e51b8152602060048201526037602482015260008051602061558e8339815191526044820152763a32902837b7b6103737ba1030baba3437b934bd32b21760491b6064820152608401610764565b60608101516001600160a01b0316611d945760405162461bcd60e51b8152602060048201526048602482015260008051602061558e83398151915260448201527f7465205246512d4d20646f6573206e6f7420737570706f7274206e6174697665606482015267103a37b5b2b7399760c11b608482015260a401610764565b6101008101516000908152600c602052604090205460ff1615611e0d5760405162461bcd60e51b815260206004820152603e602482015260008051602061558e83398151915260448201527f746520747869642068617320616c7265616479206265656e20757365642e00006064820152608401610764565b61010001516000908152600c60205260409020805460ff19166001179055565b6000611e38826134ee565b9050611e4e8260400151828461012001516135c7565b610a665760405162461bcd60e51b815260206004820152603660248201527f48617368666c6f77526f757465723a3a5f76616c69646174655246514d5369676044820152753730ba3ab9329024b73b30b634b21039b4b3b732b91760511b6064820152608401610764565b60408101516020820151611efd91906001600160a01b0316611edc578251611ee2565b82602001515b60a084015160608501516001600160a01b0316929190613628565b8051604051633020db0560e01b81526001600160a01b0390911690633020db0590611f2c908490600401614f19565b600060405180830381600087803b158015611f4657600080fd5b505af1158015611f5a573d6000803e3d6000fd5b5050505050565b6000611f6c83613660565b9050611f828360400151828561012001516135c7565b6120045760405162461bcd60e51b815260206004820152604760248201527f48617368666c6f77526f757465723a3a5f76616c69646174655246514d4c696d60448201527f69744f726465725369676e617475726520496e76616c6964207472616465722060648201526639b4b3b732b91760c91b608482015260a401610764565b825160208085015160408087015161010088015182516bffffffffffffffffffffffff19606097881b81168288015294871b851660348201529190951b9092166048830152605c82019390935246607c8083019190915283518083039091018152609c820184528051908301207f19457468657265756d205369676e6564204d6573736167653a0a33320000000060bc83015260d8808301919091528351808303909101815260f89091019092528151910120600b546001600160a01b03166120cd82856136f2565b6001600160a01b03161461215b5760405162461bcd60e51b815260206004820152604960248201527f48617368666c6f77526f757465723a3a5f76616c69646174655246514d4c696d60448201527f69744f726465725369676e617475726520496e76616c69642067756172646961606482015268371039b4b3b732b91760b91b608482015260a401610764565b50505050565b610a416001600160a01b03881687308888888888613716565b6003546001600160a01b031633146121d45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610764565b565b804710156122265760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610764565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114612273576040519150601f19603f3d011682016040523d82523d6000602084013e612278565b606091505b5050905080610db35760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610764565b6040516001600160a01b038316602482015260448101829052610db390849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526138ec565b4281610180015110156123bb5760405162461bcd60e51b815260206004820152603b60248201526000805160206155ae83398151915260448201527f46514d51756f74652051756f74652068617320657870697265642e00000000006064820152608401610764565b6040808201516001600160a01b031660009081526005602052205460ff166124395760405162461bcd60e51b815260206004820152603d60248201526000805160206155ae83398151915260448201527f46514d51756f746520506f6f6c206e6f7420617574686f72697a65642e0000006064820152608401610764565b6040808201516001600160a01b039081166000908152600860209081528382206101c0860151909316825291909152205460ff166124df5760405162461bcd60e51b815260206004820152604960248201526000805160206155ae83398151915260448201527f46514d51756f746520556e617574686f72697a6564206d657373656e676572206064820152683337b9103837b7b61760b91b608482015260a401610764565b6040808201516001600160a01b03166000908152600660209081528282208185015161ffff1683528152828220606085015183529052205460ff1661258b5760405162461bcd60e51b815260206004820152604860248201526000805160206155ae83398151915260448201527f46514d51756f746520556e617574686f72697a656420782d636861696e20706560648201526732b9103837b7b61760c11b608482015260a401610764565b6101008101516001600160a01b03166126115760405162461bcd60e51b815260206004820152604e60248201526000805160206155ae83398151915260448201527f46514d51756f7465205246512d4d20646f6573206e6f7420737570706f72742060648201526d3730ba34bb32903a37b5b2b7399760911b608482015260a401610764565b6101a08101516000908152600c602052604090205460ff16156126985760405162461bcd60e51b8152602060048201526044602482018190526000805160206155ae833981519152908201527f46514d51756f746520747869642068617320616c7265616479206265656e207560648201526339b2b21760e11b608482015260a401610764565b6101a08101516000908152600c60205260408120805460ff191660011790556126c0826139c1565b90506126d68260c0015182846101e001516135c7565b610a665760405162461bcd60e51b815260206004820152603860248201526000805160206155ae83398151915260448201527f46514d51756f746520496e76616c6964207369676e65722e00000000000000006064820152608401610764565b60c0830151608084015161277f91906001600160a01b031661275c578460400151612762565b84608001515b6101408601516101008701516001600160a01b0316929190613628565b82604001516001600160a01b031663b86a5dd7846040518263ffffffff1660e01b81526004016127af9190614ffb565b600060405180830381600087803b1580156127c957600080fd5b505af11580156127dd573d6000803e3d6000fd5b505050506127e961414f565b835161ffff9081168252602080860151909116908201526040808501516001600160a01b03908116828401526060808701519084015260808087015182169084015260a0808701519084015260c08087015182169084015260e08087015190840152610100808701518216908401526101208087015190840152610140808701519084015261016080870151908401526101a08601516101808401526101c08601519151633bb6485360e21b815291169063eed9214c9034906128b690859033908990899060040161512d565b6000604051808303818588803b1580156128cf57600080fd5b505af11580156128e3573d6000803e3d6000fd5b505050505050505050565b600480546001600160a01b031916905561087581611bec565b606060ff831461291a57611bcb83613abd565b81805461292690614dda565b80601f016020809104026020016040519081016040528092919081815260200182805461295290614dda565b801561299f5780601f106129745761010080835404028352916020019161299f565b820191906000526020600020905b81548152906001019060200180831161298257829003601f168201915b50505050509050611be3565b60028054036129fc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610764565b60028055565b8061014001518161012001511115612a845760405162461bcd60e51b815260206004820152604b60248201526000805160206155ae83398151915260448201527f46515451756f74652065666665637469766542617365546f6b656e416d6f756e60648201526a3a103a37b7903434b3b41760a91b608482015260a401610764565b428161018001511015612aed5760405162461bcd60e51b815260206004820152603b60248201526000805160206155ae83398151915260448201527f46515451756f74652051756f74652068617320657870697265642e00000000006064820152608401610764565b6040808201516001600160a01b031660009081526005602052205460ff16612b6b5760405162461bcd60e51b815260206004820152603d60248201526000805160206155ae83398151915260448201527f46515451756f746520506f6f6c206e6f7420617574686f72697a65642e0000006064820152608401610764565b612b764260b4615253565b612b82906103e8615266565b816101a001511115612bea5760405162461bcd60e51b815260206004820152603860248201526000805160206155ae83398151915260448201527f46515451756f7465204e6f6e636520746f6f20686967682e00000000000000006064820152608401610764565b6040808201516001600160a01b039081166000908152600860209081528382206101e0860151909316825291909152205460ff16612c905760405162461bcd60e51b815260206004820152604960248201526000805160206155ae83398151915260448201527f46515451756f746520556e617574686f72697a6564206d657373656e676572206064820152683337b9103837b7b61760b91b608482015260a401610764565b6040808201516001600160a01b03166000908152600660209081528282208185015161ffff1683528152828220606085015183529052205460ff166108755760405162461bcd60e51b815260206004820152604860248201526000805160206155ae83398151915260448201527f46515451756f746520556e617574686f72697a656420782d636861696e20706560648201526732b9103837b7b61760c11b608482015260a401610764565b60e083015134906001600160a01b0316612df757836101200151341015612de45760405162461bcd60e51b815260206004820152605060248201527f48617368666c6f77526f757465723a3a747261646558436861696e524651542060448201527f6d73672e76616c75652073686f756c64206265203e3d2065666665637469766560648201526f2130b9b2aa37b5b2b720b6b7bab73a1760811b608482015260a401610764565b610120840151612df4903461527d565b90505b6101608401516101408501516101208601511015612e3857846101400151856101200151866101600151612e2b9190615266565b612e359190615290565b90505b60e08501516000906001600160a01b0316612f285760808601516001600160a01b0316612e6b5750610120850151612f6a565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08761012001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015612ecb57600080fd5b505af1158015612edf573d6000803e3d6000fd5b5050506080880151610120890151612f2393506001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21692506122ef565b612f6a565b612f6a3360808801516001600160a01b0316612f48578760400151612f4e565b87608001515b61012089015160e08a01516001600160a01b0316929190613628565b60408601516001600160a01b031663ca3428d08288336040518463ffffffff1660e01b8152600401612f9d9291906152b2565b6000604051808303818588803b158015612fb657600080fd5b505af1158015612fca573d6000803e3d6000fd5b5050505050612fd761414f565b865161ffff9081168252602080890151909116908201526040808801516001600160a01b03908116828401526060808a0151908401526080808a015182169084015260a0808a0151908401523360c08085018290528a015160e0808601919091528a01518216610100808601919091528a0151610120808601919091528a015161014085015261016084018690526101c08a01516101808501526101e08a01519251633bb6485360e21b8152929091169163eed9214c9187916130a29186918c908c9060040161512d565b6000604051808303818588803b1580156130bb57600080fd5b505af11580156130cf573d6000803e3d6000fd5b505050505050505050505050565b6060613121838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c65640000815250613afc565b9392505050565b8060e001518160c0015111156131a25760405162461bcd60e51b815260206004820152604560248201526000805160206155ee83398151915260448201527f74652065666665637469766542617365546f6b656e416d6f756e7420746f6f206064820152643434b3b41760d91b608482015260a401610764565b4281610120015110156132035760405162461bcd60e51b815260206004820152603560248201526000805160206155ee8339815191526044820152743a329028bab7ba32903430b99032bc3834b932b21760591b6064820152608401610764565b61320e4260b4615253565b61321a906103e8615266565b81610140015111156132775760405162461bcd60e51b815260206004820152603260248201526000805160206155ee8339815191526044820152713a32902737b731b2903a37b7903434b3b41760711b6064820152608401610764565b80516001600160a01b031660009081526005602052604090205460ff166108755760405162461bcd60e51b815260206004820152603760248201526000805160206155ee8339815191526044820152763a32902837b7b6103737ba1030baba3437b934bd32b21760491b6064820152608401610764565b60808201516000906001600160a01b03166133db5760208301516001600160a01b0316613320575060c0820151613452565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db08460c001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561337f57600080fd5b505af1158015613393573d6000803e3d6000fd5b505050602085015160c08601516133d693506001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21692506122ef565b613452565b60208301516000906001600160a01b03166133f75783516133fd565b83602001515b905082156134305761342b818560c0015186608001516001600160a01b03166122ef9092919063ffffffff16565b613450565b6134503360c086015160808701516001600160a01b031691908490613628565b505b8251604051630629563960e51b81526001600160a01b039091169063c52ac7209083906134839087906004016153fc565b6000604051808303818588803b15801561349c57600080fd5b505af1158015611165573d6000803e3d6000fd5b600080829050601f815111156134db578260405163305a27a960e01b815260040161076491906154ee565b80516134e682615501565b179392505050565b6000611be37f57f425280e5750d80e512f912d1345058e55906481b3b1350084b24f910d8f26836101000151846040015185600001518660200151876060015188608001518960a001518a60c001518b60e001516040516020016135ac9a99989796959493929190998a5260208a01989098526001600160a01b0396871660408a01529486166060890152928516608088015290841660a087015290921660c085015260e08401919091526101008301526101208201526101400190565b60405160208183030381529060405280519060200120613bd9565b60008060006135d68585613c06565b909250905060008160048111156135ef576135ef615525565b14801561360d5750856001600160a01b0316826001600160a01b0316145b8061361e575061361e868686613c4b565b9695505050505050565b6040516001600160a01b038085166024830152831660448201526064810182905261215b9085906323b872dd60e01b9060840161231b565b6000611be37f858277df261dac1a331e7a097da24d7013d9b2e800b574e3d4569bcdb205a360836101000151846060015185608001518660a001518760c001518860e001516040516020016135ac979695949392919096875260208701959095526001600160a01b039384166040870152919092166060850152608084019190915260a083015260c082015260e00190565b60008060006137018585613c06565b9150915061370e81613d37565b509392505050565b604051623f675f60e91b81526001600160a01b038881166004830152600091908a1690637ecebe0090602401602060405180830381865afa15801561375f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137839190614dc1565b60405163d505accf60e01b81526001600160a01b038a811660048301528981166024830152604482018990526064820188905260ff8716608483015260a4820186905260c48201859052919250908a169063d505accf9060e401600060405180830381600087803b1580156137f757600080fd5b505af115801561380b573d6000803e3d6000fd5b5050604051623f675f60e91b81526001600160a01b038b81166004830152600093508c169150637ecebe0090602401602060405180830381865afa158015613857573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061387b9190614dc1565b9050613888826001615253565b81146138e05760405162461bcd60e51b815260206004820152602160248201527f5361666545524332303a207065726d697420646964206e6f74207375636365656044820152601960fa1b6064820152608401610764565b50505050505050505050565b6000613941826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613e819092919063ffffffff16565b9050805160001480613962575080806020019051810190613962919061553b565b610db35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610764565b6000611be37f528d84e234d011c5ad5daf43f4d791e0e646817405951551e3337a633c74aca3836101a00151846000015161ffff16856020015161ffff168660e001518760400151886080015189606001518a60a001518b61010001518c61012001518d61014001518e61016001518f61018001516040516020016135ac9e9d9c9b9a999897969594939291909d8e5260208e019c909c5260408d019a909a5260608c019890985260808b01969096526001600160a01b0394851660a08b015292841660c08a015260e0890191909152610100880152166101208601526101408501526101608401526101808301526101a08201526101c00190565b60606000613aca83613e90565b604080516020808252818301909252919250600091906020820181803683375050509182525060208101929092525090565b606082471015613b5d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610764565b600080866001600160a01b03168587604051613b799190615558565b60006040518083038185875af1925050503d8060008114613bb6576040519150601f19603f3d011682016040523d82523d6000602084013e613bbb565b606091505b5091509150613bcc87838387613eb8565b925050505b949350505050565b6000611be3613be6613f31565b8360405161190160f01b8152600281019290925260228201526042902090565b6000808251604103613c3c5760208301516040840151606085015160001a613c3087828585614061565b94509450505050613c44565b506000905060025b9250929050565b6000806000856001600160a01b0316631626ba7e60e01b8686604051602401613c75929190615574565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051613cb39190615558565b600060405180830381855afa9150503d8060008114613cee576040519150601f19603f3d011682016040523d82523d6000602084013e613cf3565b606091505b5091509150818015613d0757506020815110155b801561361e57508051630b135d3f60e11b90613d2c9083016020908101908401614dc1565b149695505050505050565b6000816004811115613d4b57613d4b615525565b03613d535750565b6001816004811115613d6757613d67615525565b03613db45760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401610764565b6002816004811115613dc857613dc8615525565b03613e155760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610764565b6003816004811115613e2957613e29615525565b036108755760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610764565b6060613bd18484600085613afc565b600060ff8216601f811115611be357604051632cd44ac360e21b815260040160405180910390fd5b60608315613f27578251600003613f20576001600160a01b0385163b613f205760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610764565b5081613bd1565b613bd18383614125565b6000306001600160a01b037f00000000000000000000000055084ee0fef03f14a305cd24286359a35d73515116148015613f8a57507f000000000000000000000000000000000000000000000000000000000000000146145b15613fb457507f8439e60b4107fcfbd5c424aa59d0e1712a37f295626b1a4eeda377218add2cdd90565b61405c604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527fcc16ac766c1675e699029fcc8af468e4ad59a006afee8216f64fef6bc36d65c9918101919091527fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b360608201524660808201523060a082015260009060c00160405160208183030381529060405280519060200120905090565b905090565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115614098575060009050600361411c565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156140ec573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166141155760006001925092505061411c565b9150600090505b94509492505050565b8151156141355781518083602001fd5b8060405162461bcd60e51b815260040161076491906154ee565b604080516101a081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e08101829052610100810182905261012081018290526101408101829052610160810182905261018081019190915290565b803561ffff811681146141cd57600080fd5b919050565b6000806000606084860312156141e757600080fd5b833592506141f7602085016141bb565b9150604084013590509250925092565b801515811461087557600080fd5b60008060006060848603121561422a57600080fd5b614233846141bb565b925060208401359150604084013561424a81614207565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b60405161016081016001600160401b038111828210171561428e5761428e614255565b60405290565b60405161022081016001600160401b038111828210171561428e5761428e614255565b6040516101a081016001600160401b038111828210171561428e5761428e614255565b80356001600160a01b03811681146141cd57600080fd5b600082601f83011261430257600080fd5b81356001600160401b038082111561431c5761431c614255565b604051601f8301601f19908116603f0116810190828211818310171561434457614344614255565b8160405283815286602085880101111561435d57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000610160828403121561439057600080fd5b61439861426b565b90506143a3826142da565b81526143b1602083016142da565b60208201526143c2604083016142da565b60408201526143d3606083016142da565b60608201526143e4608083016142da565b608082015260a082013560a082015260c082013560c082015260e082013560e0820152610100808301358183015250610120808301356001600160401b038082111561442f57600080fd5b61443b868387016142f1565b8385015261014092508285013591508082111561445757600080fd5b50614464858286016142f1565b82840152505092915050565b60006020828403121561448257600080fd5b81356001600160401b0381111561449857600080fd5b613bd18482850161437d565b600080604083850312156144b757600080fd5b6144c0836142da565b915060208301356144d081614207565b809150509250929050565b803560ff811681146141cd57600080fd5b600080600080600080600060e0888a03121561450757600080fd5b87356001600160401b038082111561451e57600080fd5b61452a8b838c0161437d565b985060208a013591508082111561454057600080fd5b5061454d8a828b016142f1565b96505060408801359450614563606089016144db565b9699959850939660808101359560a0820135955060c0909101359350915050565b6000806040838503121561459757600080fd5b82356001600160401b03808211156145ae57600080fd5b6145ba8683870161437d565b935060208501359150808211156145d057600080fd5b506145dd858286016142f1565b9150509250929050565b6000602082840312156145f957600080fd5b613121826142da565b60008060008060008060c0878903121561461b57600080fd5b86356001600160401b0381111561463157600080fd5b61463d89828a0161437d565b96505060208701359450614653604088016144db565b9350606087013592506080870135915060a087013590509295509295509295565b6000610220828403121561468757600080fd5b61468f614294565b905061469a826141bb565b81526146a8602083016141bb565b60208201526146b9604083016142da565b6040820152606082013560608201526146d4608083016142da565b608082015260a082013560a08201526146ef60c083016142da565b60c082015260e082013560e082015261010061470c8184016142da565b9082015261012082810135908201526101408083013590820152610160808301359082015261018080830135908201526101a080830135908201526101c06147558184016142da565b908201526101e0828101356001600160401b038082111561477557600080fd5b614781868387016142f1565b8385015261020092508285013591508082111561445757600080fd5b6000806000606084860312156147b257600080fd5b83356001600160401b03808211156147c957600080fd5b6147d587838801614674565b94506020860135935060408601359150808211156147f257600080fd5b506147ff868287016142f1565b9150509250925092565b60005b8381101561482457818101518382015260200161480c565b50506000910152565b60008151808452614845816020860160208601614809565b601f01601f19169290920160200192915050565b60ff60f81b881681526000602060e08184015261487960e084018a61482d565b838103604085015261488b818a61482d565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825283870192509083019060005b818110156148dd578351835292840192918401916001016148c1565b50909c9b505050505050505050505050565b6000610220828403121561490257600080fd5b61490a614294565b9050614915826141bb565b8152614923602083016141bb565b6020820152614934604083016142da565b60408201526060820135606082015261494f608083016142da565b608082015260a082013560a082015260c082013560c082015261497460e083016142da565b60e0820152610100828101359082015261012080830135908201526101408083013590820152610160808301359082015261018080830135908201526101a080830135908201526101c080830135908201526101e06149d48184016142da565b90820152610200828101356001600160401b038111156149f357600080fd5b614464858286016142f1565b600080600080600080600080610100898b031215614a1c57600080fd5b88356001600160401b0380821115614a3357600080fd5b614a3f8c838d016148ef565b995060208b0135985060408b0135915080821115614a5c57600080fd5b50614a698b828c016142f1565b96505060608901359450614a7f60808a016144db565b979a969950949793969560a0850135955060c08501359460e001359350915050565b60008060408385031215614ab457600080fd5b614abd836142da565b9150614acb602084016142da565b90509250929050565b600080600080600080600080610100898b031215614af157600080fd5b88356001600160401b0380821115614b0857600080fd5b614a3f8c838d01614674565b600080600060608486031215614b2957600080fd5b614b32846142da565b92506141f7602085016141bb565b600060208284031215614b5257600080fd5b81356001600160401b0380821115614b6957600080fd5b908301906101608286031215614b7e57600080fd5b614b8661426b565b614b8f836141bb565b815260208301356020820152614ba7604084016142da565b6040820152614bb8606084016142da565b6060820152614bc9608084016142da565b6080820152614bda60a084016142da565b60a082015260c083013560c082015260e083013560e0820152610100808401358183015250610120614c0d8185016142da565b908201526101408381013583811115614c2557600080fd5b614c31888287016142f1565b918301919091525095945050505050565b60006101a08284031215614c5557600080fd5b614c5d6142b7565b9050614c68826142da565b8152614c76602083016142da565b6020820152614c87604083016142da565b6040820152614c98606083016142da565b6060820152614ca9608083016142da565b6080820152614cba60a083016142da565b60a082015260c0828101359082015260e080830135908201526101008083013590820152610120808301359082015261014080830135908201526101608083013590820152610180808301356001600160401b038111156149f357600080fd5b600060208284031215614d2c57600080fd5b81356001600160401b03811115614d4257600080fd5b613bd184828501614c42565b600080600060608486031215614d6357600080fd5b83356001600160401b0380821115614d7a57600080fd5b6147d5878388016148ef565b60008060008060008060c08789031215614d9f57600080fd5b86356001600160401b03811115614db557600080fd5b61463d89828a01614c42565b600060208284031215614dd357600080fd5b5051919050565b600181811c90821680614dee57607f821691505b602082108103614e0e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115610db357600081815260208120601f850160051c81016020861015614e3b5750805b601f850160051c820191505b81811015610ac957828155600101614e47565b81516001600160401b03811115614e7357614e73614255565b614e8781614e818454614dda565b84614e14565b602080601f831160018114614ebc5760008415614ea45750858301515b600019600386901b1c1916600185901b178555610ac9565b600085815260208120601f198616915b82811015614eeb57888601518255948401946001909101908401614ecc565b5085821015614f095787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60208152614f336020820183516001600160a01b03169052565b60006020830151614f4f60408401826001600160a01b03169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a083015160c083015260c083015160e083015260e08301516101008181850152808501519150506101208181850152808501519150506101606101408181860152614fdf61018086018461482d565b90860151858203601f19018387015290925061361e838261482d565b6020815261501060208201835161ffff169052565b60006020830151615027604084018261ffff169052565b5060408301516001600160a01b03811660608401525060608301516080830152608083015161506160a08401826001600160a01b03169052565b5060a083015160c083015260c083015161508660e08401826001600160a01b03169052565b5060e0830151610100838101919091528301516101206150b0818501836001600160a01b03169052565b8401516101408481019190915284015161016080850191909152840151610180808501919091528401516101a0808501919091528401516101c08085019190915284015190506101e061510d818501836001600160a01b03169052565b808501519150506102206102008181860152614fdf61024086018461482d565b845161ffff1681526000610200602087015161514f602085018261ffff169052565b50604087015161516a60408501826001600160a01b03169052565b5060608701516060840152608087015161518f60808501826001600160a01b03169052565b5060a087015160a084015260c08701516151b460c08501826001600160a01b03169052565b5060e087015160e0840152610100808801516151da828601826001600160a01b03169052565b505061012087810151908401526101408088015190840152610160808801519084015261018080880151908401526001600160a01b0386166101a0840152846101c0840152806101e08401526152328184018561482d565b979650505050505050565b634e487b7160e01b600052601160045260246000fd5b80820180821115611be357611be361523d565b8082028115828204841417611be357611be361523d565b81810381811115611be357611be361523d565b6000826152ad57634e487b7160e01b600052601260045260246000fd5b500490565b604081526152c760408201845161ffff169052565b600060208401516152de606084018261ffff169052565b5060408401516001600160a01b038116608084015250606084015160a083015260808401516001600160a01b03811660c08401525060a084015160e083015260c0840151610100818185015260e08601519150610120615348818601846001600160a01b03169052565b908601516101408581019190915290860151610160808601919091529086015161018080860191909152908601516101a080860191909152908601516101c080860191909152908601516101e08086019190915290860151610200808601919091529086015191506102206153c7818601846001600160a01b03169052565b8187015192508061024086015250506153e461026084018261482d565b91505061312160208301846001600160a01b03169052565b602081526154166020820183516001600160a01b03169052565b6000602083015161543260408401826001600160a01b03169052565b5060408301516001600160a01b03811660608401525060608301516001600160a01b03811660808401525060808301516001600160a01b03811660a08401525060a08301516001600160a01b03811660c08401525060c083015160e08381019190915283015161010080840191909152830151610120808401919091528301516101408084019190915283015161016080840191909152830151610180808401919091528301516101a080840152613bd16101c084018261482d565b602081526000613121602083018461482d565b80516020808301519190811015614e0e5760001960209190910360031b1b16919050565b634e487b7160e01b600052602160045260246000fd5b60006020828403121561554d57600080fd5b815161312181614207565b6000825161556a818460208701614809565b9190910192915050565b828152604060208201526000613bd1604083018461482d56fe48617368666c6f77526f757465723a3a5f76616c69646174655246514d51756f48617368666c6f77526f757465723a3a5f76616c696461746558436861696e5248617368666c6f77526f757465723a3a66696c6c58436861696e20556e61757448617368666c6f77526f757465723a3a5f76616c69646174655246515451756fa26469706673582212205d399236b5915ebc16086b74186c7900a517933472c34113d04b3d8925cdc12e64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
-----Decoded View---------------
Arg [0] : weth (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.