Contract 0x180555D4d45e67520adC7c0c51b512c7A50877f2 7

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x1d6cb3f26558f3f33f92256a51ba158fe46b2a063c3b40998a58a7069faba54bSwap206750672022-08-19 10:19:5342 days 4 hrs ago0x7ea3b82eccadecd6086b4ce66ab2e87534d2db47 IN  0x180555d4d45e67520adc7c0c51b512c7a50877f20 ETH0.000565648407 ETH
0x3933a1deb2a2a097984622e01762be8512064a4e2ee57f4c93dfb9bf0faa3eb3Transfer Ownersh...199837212022-08-11 7:36:5650 days 7 hrs ago0x7afac84bf3931b11548ed02b4460ad754cf54c66 IN  0x180555d4d45e67520adc7c0c51b512c7a50877f20 ETH0.000112539724 ETH
0x879e0d1007f78b26bb8aeae4b77554e4548c9538d2fc133706440286c73829edUpdate Whitelist199837162022-08-11 7:36:5650 days 7 hrs ago0x7afac84bf3931b11548ed02b4460ad754cf54c66 IN  0x180555d4d45e67520adc7c0c51b512c7a50877f20 ETH0.000128307268 ETH
0xc56a4cf2b1e1a78ae4eafe5d92b1fcfdf64848c8596aab6b06c4d4299c15c6f70x60a06040199837082022-08-11 7:36:5650 days 7 hrs ago0x7afac84bf3931b11548ed02b4460ad754cf54c66 IN  Create: MetaAggregationRouter0 ETH0.013655682431 ETH
[ Download CSV Export 
Latest 4 internal transactions
Parent Txn Hash Block From To Value
0x1d6cb3f26558f3f33f92256a51ba158fe46b2a063c3b40998a58a7069faba54b206750672022-08-19 10:19:5342 days 4 hrs ago 0x180555d4d45e67520adc7c0c51b512c7a50877f2 Dopex: rDPX Token0 ETH
0x1d6cb3f26558f3f33f92256a51ba158fe46b2a063c3b40998a58a7069faba54b206750672022-08-19 10:19:5342 days 4 hrs ago 0x180555d4d45e67520adc7c0c51b512c7a50877f2 0x41684b361557e9282e0373ca51260d9331e518c90 ETH
0x1d6cb3f26558f3f33f92256a51ba158fe46b2a063c3b40998a58a7069faba54b206750672022-08-19 10:19:5342 days 4 hrs ago 0x180555d4d45e67520adc7c0c51b512c7a50877f2 Dopex: rDPX Token0 ETH
0x1d6cb3f26558f3f33f92256a51ba158fe46b2a063c3b40998a58a7069faba54b206750672022-08-19 10:19:5342 days 4 hrs ago 0x180555d4d45e67520adc7c0c51b512c7a50877f2 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
MetaAggregationRouter

Compiler Version
v0.8.9+commit.e5eed63a

Optimization Enabled:
Yes with 9999 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 13 : MetaAggregationRouter.sol
// SPDX-License-Identifier: MIT

/// Copyright (c) 2019-2021 1inch
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
/// and associated documentation files (the "Software"), to deal in the Software without restriction,
/// including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
/// subject to the following conditions:
/// The above copyright notice and this permission notice shall be included in all copies or
/// substantial portions of the Software.
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
/// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
/// AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
/// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
/// OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE

pragma solidity 0.8.9;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';

import './dependency/Permitable.sol';
import './interfaces/IAggregationExecutor.sol';
import './interfaces/IAggregationExecutor1Inch.sol';
import './libraries/TransferHelper.sol';
import './libraries/RevertReasonParser.sol';

contract MetaAggregationRouter is Permitable, Ownable {
  using SafeERC20 for IERC20;

  address public immutable WETH;
  address private constant ETH_ADDRESS = address(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);

  uint256 private constant _PARTIAL_FILL = 0x01;
  uint256 private constant _REQUIRES_EXTRA_ETH = 0x02;
  uint256 private constant _SHOULD_CLAIM = 0x04;
  uint256 private constant _BURN_FROM_MSG_SENDER = 0x08;
  uint256 private constant _BURN_FROM_TX_ORIGIN = 0x10;
  uint256 private constant _SIMPLE_SWAP = 0x20;

  mapping(address => bool) public isWhitelist;

  struct SwapDescription {
    IERC20 srcToken;
    IERC20 dstToken;
    address[] srcReceivers;
    uint256[] srcAmounts;
    address dstReceiver;
    uint256 amount;
    uint256 minReturnAmount;
    uint256 flags;
    bytes permit;
  }

  struct SimpleSwapData {
    address[] firstPools;
    uint256[] firstSwapAmounts;
    bytes[] swapDatas;
    uint256 deadline;
    bytes destTokenFeeData;
  }

  event Swapped(
    address sender,
    IERC20 srcToken,
    IERC20 dstToken,
    address dstReceiver,
    uint256 spentAmount,
    uint256 returnAmount
  );

  event ClientData(bytes clientData);

  event Exchange(address pair, uint256 amountOut, address output);

  constructor(address _WETH) {
    WETH = _WETH;
  }

  receive() external payable {}

  function rescueFunds(address token, uint256 amount) external onlyOwner {
    if (_isETH(IERC20(token))) {
      TransferHelper.safeTransferETH(msg.sender, amount);
    } else {
      TransferHelper.safeTransfer(token, msg.sender, amount);
    }
  }

  function updateWhitelist(address addr, bool value) external onlyOwner {
    isWhitelist[addr] = value;
  }

  function swapRouter1Inch(
    address router1Inch,
    bytes calldata router1InchData,
    SwapDescription calldata desc,
    bytes calldata clientData
  ) external payable returns (uint256 returnAmount, uint256 gasUsed) {
    uint256 gasBefore = gasleft();
    require(isWhitelist[router1Inch], 'not whitelist router');
    require(desc.minReturnAmount > 0, 'Min return should not be 0');
    require(
      desc.srcReceivers.length == desc.srcAmounts.length && desc.srcAmounts.length <= 1,
      'Invalid lengths for receiving src tokens'
    );

    uint256 val = msg.value;
    if (!_isETH(desc.srcToken)) {
      // transfer token to kyber router
      _permit(desc.srcToken, desc.amount, desc.permit);
      TransferHelper.safeTransferFrom(address(desc.srcToken), msg.sender, address(this), desc.amount);

      // approve token to 1inch router
      uint256 amount = _getBalance(desc.srcToken, address(this));
      desc.srcToken.safeIncreaseAllowance(router1Inch, amount);

      // transfer fee to feeTaker
      for (uint256 i = 0; i < desc.srcReceivers.length; i++) {
        TransferHelper.safeTransferFrom(address(desc.srcToken), msg.sender, desc.srcReceivers[i], desc.srcAmounts[i]);
      }
    } else {
      for (uint256 i = 0; i < desc.srcReceivers.length; i++) {
        val -= desc.srcAmounts[i];
        TransferHelper.safeTransferETH(desc.srcReceivers[i], desc.srcAmounts[i]);
      }
    }

    address dstReceiver = (desc.dstReceiver == address(0)) ? msg.sender : desc.dstReceiver;
    uint256 initialSrcBalance = (desc.flags & _PARTIAL_FILL != 0) ? _getBalance(desc.srcToken, msg.sender) : 0;
    uint256 initialDstBalance = _getBalance(desc.dstToken, dstReceiver);
    {
      // call to 1inch router contract
      (bool success, ) = router1Inch.call{value: val}(router1InchData);
      require(success, 'call to 1inch router fail');
    }

    // 1inch router return to msg.sender (mean fund will return to this address)
    uint256 stuckAmount = _getBalance(desc.dstToken, address(this));
    _doTransferERC20(desc.dstToken, dstReceiver, stuckAmount);

    // safe check here
    returnAmount = _getBalance(desc.dstToken, dstReceiver) - initialDstBalance;
    uint256 spentAmount = desc.amount;
    if (desc.flags & _PARTIAL_FILL != 0) {
      spentAmount = initialSrcBalance + desc.amount - _getBalance(desc.srcToken, msg.sender);
      require(returnAmount * desc.amount >= desc.minReturnAmount * spentAmount, 'Return amount is not enough');
    } else {
      require(returnAmount >= desc.minReturnAmount, 'Return amount is not enough');
    }

    emit Swapped(msg.sender, desc.srcToken, desc.dstToken, dstReceiver, spentAmount, returnAmount);
    emit Exchange(router1Inch, returnAmount, _isETH(desc.dstToken) ? WETH : address(desc.dstToken));
    emit ClientData(clientData);
    unchecked {
      gasUsed = gasBefore - gasleft();
    }
  }

  function swapExecutor1Inch(
    IAggregationExecutor1Inch caller,
    SwapDescriptionExecutor1Inch calldata desc,
    bytes calldata executor1InchData,
    bytes calldata clientData
  ) external payable returns (uint256 returnAmount, uint256 gasUsed) {
    uint256 gasBefore = gasleft();
    require(desc.minReturnAmount > 0, 'Min return should not be 0');
    require(executor1InchData.length > 0, 'data should not be empty');
    require(desc.srcReceivers.length == desc.srcAmounts.length, 'invalid src receivers length');

    bool srcETH = _isETH(desc.srcToken);
    if (desc.flags & _REQUIRES_EXTRA_ETH != 0) {
      require(msg.value > (srcETH ? desc.amount : 0), 'Invalid msg.value');
    } else {
      require(msg.value == (srcETH ? desc.amount : 0), 'Invalid msg.value');
    }
    uint256 val = msg.value;
    if (!srcETH) {
      _permit(desc.srcToken, desc.amount, desc.permit);

      // transfer to fee taker
      uint256 srcReceiversLength = desc.srcReceivers.length;
      for (uint256 i = 0; i < srcReceiversLength; ) {
        TransferHelper.safeTransferFrom(address(desc.srcToken), msg.sender, desc.srcReceivers[i], desc.srcAmounts[i]);
        unchecked {
          ++i;
        }
      }

      // transfer to 1inch srcReceiver
      TransferHelper.safeTransferFrom(address(desc.srcToken), msg.sender, desc.srcReceiver1Inch, desc.amount);
    } else {
      // transfer to 1inch srcReceiver
      uint256 srcReceiversLength = desc.srcReceivers.length;
      for (uint256 i = 0; i < srcReceiversLength; ) {
        val -= desc.srcAmounts[i];
        TransferHelper.safeTransferETH(desc.srcReceivers[i], desc.srcAmounts[i]);
        unchecked {
          ++i;
        }
      }
    }

    {
      bytes memory callData = abi.encodePacked(caller.callBytes.selector, bytes12(0), msg.sender, executor1InchData);
      // solhint-disable-next-line avoid-low-level-calls
      (bool success, bytes memory result) = address(caller).call{value: val}(callData);
      if (!success) {
        revert(RevertReasonParser.parse(result, 'callBytes failed: '));
      }
    }

    uint256 spentAmount = desc.amount;
    returnAmount = _getBalance(desc.dstToken, address(this));

    if (desc.flags & _PARTIAL_FILL != 0) {
      uint256 unspentAmount = _getBalance(desc.srcToken, address(this));
      if (unspentAmount > 0) {
        spentAmount = spentAmount - unspentAmount;
        _doTransferERC20(desc.srcToken, msg.sender, unspentAmount);
      }

      require(returnAmount * desc.amount >= desc.minReturnAmount * spentAmount, 'Return amount is not enough');
    } else {
      require(returnAmount >= desc.minReturnAmount, 'Return amount is not enough');
    }

    address dstReceiver = (desc.dstReceiver == address(0)) ? msg.sender : desc.dstReceiver;
    _doTransferERC20(desc.dstToken, dstReceiver, returnAmount);

    emit Swapped(msg.sender, desc.srcToken, desc.dstToken, dstReceiver, spentAmount, returnAmount);
    emit Exchange(address(caller), returnAmount, _isETH(desc.dstToken) ? WETH : address(desc.dstToken));
    emit ClientData(clientData);
    unchecked {
      gasUsed = gasBefore - gasleft();
    }
  }

  function swap(
    IAggregationExecutor caller,
    SwapDescription calldata desc,
    bytes calldata executorData,
    bytes calldata clientData
  ) external payable returns (uint256 returnAmount, uint256 gasUsed) {
    uint256 gasBefore = gasleft();
    require(desc.minReturnAmount > 0, 'Min return should not be 0');
    require(executorData.length > 0, 'executorData should be not zero');

    uint256 flags = desc.flags;

    // simple mode swap
    if (flags & _SIMPLE_SWAP != 0) return swapSimpleMode(caller, desc, executorData, clientData);

    {
      IERC20 srcToken = desc.srcToken;
      if (flags & _REQUIRES_EXTRA_ETH != 0) {
        require(msg.value > (_isETH(srcToken) ? desc.amount : 0), 'Invalid msg.value');
      } else {
        require(msg.value == (_isETH(srcToken) ? desc.amount : 0), 'Invalid msg.value');
      }

      require(desc.srcReceivers.length == desc.srcAmounts.length, 'Invalid lengths for receiving src tokens');

      if (flags & _SHOULD_CLAIM != 0) {
        require(!_isETH(srcToken), 'Claim token is ETH');
        _permit(srcToken, desc.amount, desc.permit);
        for (uint256 i = 0; i < desc.srcReceivers.length; i++) {
          TransferHelper.safeTransferFrom(address(srcToken), msg.sender, desc.srcReceivers[i], desc.srcAmounts[i]);
        }
      }

      if (_isETH(srcToken)) {
        // normally in case taking fee in srcToken and srcToken is the native token
        for (uint256 i = 0; i < desc.srcReceivers.length; i++) {
          TransferHelper.safeTransferETH(desc.srcReceivers[i], desc.srcAmounts[i]);
        }
      }
    }

    {
      address dstReceiver = (desc.dstReceiver == address(0)) ? msg.sender : desc.dstReceiver;
      uint256 initialSrcBalance = (flags & _PARTIAL_FILL != 0) ? _getBalance(desc.srcToken, msg.sender) : 0;
      IERC20 dstToken = desc.dstToken;
      uint256 initialDstBalance = _getBalance(dstToken, dstReceiver);

      _callWithEth(caller, executorData);

      uint256 spentAmount = desc.amount;
      returnAmount = _getBalance(dstToken, dstReceiver) - initialDstBalance;

      if (flags & _PARTIAL_FILL != 0) {
        spentAmount = initialSrcBalance + desc.amount - _getBalance(desc.srcToken, msg.sender);
        require(returnAmount * desc.amount >= desc.minReturnAmount * spentAmount, 'Return amount is not enough');
      } else {
        require(returnAmount >= desc.minReturnAmount, 'Return amount is not enough');
      }

      emit Swapped(msg.sender, desc.srcToken, dstToken, dstReceiver, spentAmount, returnAmount);
      emit Exchange(address(caller), returnAmount, _isETH(dstToken) ? WETH : address(dstToken));
      emit ClientData(clientData);
    }

    unchecked {
      gasUsed = gasBefore - gasleft();
    }
  }

  function swapSimpleMode(
    IAggregationExecutor caller,
    SwapDescription calldata desc,
    bytes calldata executorData,
    bytes calldata clientData
  ) public returns (uint256 returnAmount, uint256 gasUsed) {
    uint256 gasBefore = gasleft();

    require(!_isETH(desc.srcToken), 'src is eth, should use normal swap');
    _permit(desc.srcToken, desc.amount, desc.permit);

    uint256 totalSwapAmount = desc.amount;
    if (desc.srcReceivers.length > 0) {
      // take fee in tokenIn
      require(
        desc.srcReceivers.length == 1 && desc.srcReceivers.length == desc.srcAmounts.length,
        'Wrong number of src receivers'
      );
      TransferHelper.safeTransferFrom(address(desc.srcToken), msg.sender, desc.srcReceivers[0], desc.srcAmounts[0]);
      require(desc.srcAmounts[0] <= totalSwapAmount, 'invalid fee amount in src token');
      totalSwapAmount -= desc.srcAmounts[0];
    }
    address dstReceiver = (desc.dstReceiver == address(0)) ? msg.sender : desc.dstReceiver;
    uint256 initialDstBalance = _getBalance(desc.dstToken, dstReceiver);

    _swapMultiSequencesWithSimpleMode(
      caller,
      address(desc.srcToken),
      totalSwapAmount,
      address(desc.dstToken),
      dstReceiver,
      executorData
    );

    returnAmount = _getBalance(desc.dstToken, dstReceiver) - initialDstBalance;

    require(returnAmount >= desc.minReturnAmount, 'Return amount is not enough');
    emit Swapped(msg.sender, desc.srcToken, desc.dstToken, dstReceiver, desc.amount, returnAmount);
    emit Exchange(address(caller), returnAmount, _isETH(desc.dstToken) ? WETH : address(desc.dstToken));
    emit ClientData(clientData);

    unchecked {
      gasUsed = gasBefore - gasleft();
    }
  }

  function _doTransferERC20(
    IERC20 token,
    address to,
    uint256 amount
  ) internal {
    if (amount > 0) {
      if (_isETH(token)) {
        TransferHelper.safeTransferETH(to, amount);
      } else {
        TransferHelper.safeTransfer(address(token), to, amount);
      }
    }
  }

  // Only use this mode if the first pool of each sequence can receive tokenIn directly into the pool
  function _swapMultiSequencesWithSimpleMode(
    IAggregationExecutor caller,
    address tokenIn,
    uint256 totalSwapAmount,
    address tokenOut,
    address dstReceiver,
    bytes calldata data
  ) internal {
    SimpleSwapData memory swapData = abi.decode(data, (SimpleSwapData));
    require(swapData.deadline >= block.timestamp, 'ROUTER: Expired');
    require(
      swapData.firstPools.length == swapData.firstSwapAmounts.length &&
        swapData.firstPools.length == swapData.swapDatas.length,
      'invalid swap data length'
    );
    uint256 numberSeq = swapData.firstPools.length;
    for (uint256 i = 0; i < numberSeq; i++) {
      // collect amount to the first pool
      TransferHelper.safeTransferFrom(tokenIn, msg.sender, swapData.firstPools[i], swapData.firstSwapAmounts[i]);
      require(swapData.firstSwapAmounts[i] <= totalSwapAmount, 'invalid swap amount');
      totalSwapAmount -= swapData.firstSwapAmounts[i];
      {
        // solhint-disable-next-line avoid-low-level-calls
        // may take some native tokens for commission fee
        (bool success, bytes memory result) = address(caller).call(
          abi.encodeWithSelector(caller.swapSingleSequence.selector, swapData.swapDatas[i])
        );
        if (!success) {
          revert(RevertReasonParser.parse(result, 'swapSingleSequence failed: '));
        }
      }
    }
    {
      // solhint-disable-next-line avoid-low-level-calls
      // may take some native tokens for commission fee
      (bool success, bytes memory result) = address(caller).call(
        abi.encodeWithSelector(
          caller.finalTransactionProcessing.selector,
          tokenIn,
          tokenOut,
          dstReceiver,
          swapData.destTokenFeeData
        )
      );
      if (!success) {
        revert(RevertReasonParser.parse(result, 'finalTransactionProcessing failed: '));
      }
    }
  }

  function _getBalance(IERC20 token, address account) internal view returns (uint256) {
    if (_isETH(token)) {
      return account.balance;
    } else {
      return token.balanceOf(account);
    }
  }

  function _isETH(IERC20 token) internal pure returns (bool) {
    return (address(token) == ETH_ADDRESS);
  }

  function _callWithEth(IAggregationExecutor caller, bytes calldata executorData) internal {
    // solhint-disable-next-line avoid-low-level-calls
    // may take some native tokens for commission fee
    uint256 ethAmount = _getBalance(IERC20(ETH_ADDRESS), address(this));
    if (ethAmount > msg.value) ethAmount = msg.value;
    (bool success, bytes memory result) = address(caller).call{value: ethAmount}(
      abi.encodeWithSelector(caller.callBytes.selector, executorData)
    );
    if (!success) {
      revert(RevertReasonParser.parse(result, 'callBytes failed: '));
    }
  }
}

File 2 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

File 3 of 13 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 4 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 5 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 13 : Permitable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import '@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol';

import '../libraries/RevertReasonParser.sol';

/*
“Copyright (c) 2019-2021 1inch 
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: 
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE”.
*/

contract Permitable {
  event Error(string reason);

  function _permit(
    IERC20 token,
    uint256 amount,
    bytes calldata permit
  ) internal {
    if (permit.length == 32 * 7) {
      // solhint-disable-next-line avoid-low-level-calls
      (bool success, bytes memory result) = address(token).call(
        abi.encodePacked(IERC20Permit.permit.selector, permit)
      );
      if (!success) {
        string memory reason = RevertReasonParser.parse(result, 'Permit call failed: ');
        if (token.allowance(msg.sender, address(this)) < amount) {
          revert(reason);
        } else {
          emit Error(reason);
        }
      }
    }
  }
}

File 7 of 13 : IAggregationExecutor.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.6.12;

interface IAggregationExecutor {
  function callBytes(bytes calldata data) external payable; // 0xd9c45357

  // callbytes per swap sequence
  function swapSingleSequence(bytes calldata data) external;

  function finalTransactionProcessing(
    address tokenIn,
    address tokenOut,
    address to,
    bytes calldata destTokenFeeData
  ) external;
}

File 8 of 13 : IAggregationExecutor1Inch.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.9;

import '@openzeppelin/contracts/interfaces/IERC20.sol';

interface IAggregationExecutor1Inch {
  function callBytes(address msgSender, bytes calldata data) external payable; // 0x2636f7f8
}

interface IAggregationRouter1InchV4 {
  function swap(
    IAggregationExecutor1Inch caller,
    SwapDescription1Inch calldata desc,
    bytes calldata data
  ) external payable returns (uint256 returnAmount, uint256 gasLeft);
}

struct SwapDescription1Inch {
  IERC20 srcToken;
  IERC20 dstToken;
  address payable srcReceiver;
  address payable dstReceiver;
  uint256 amount;
  uint256 minReturnAmount;
  uint256 flags;
  bytes permit;
}

struct SwapDescriptionExecutor1Inch {
  IERC20 srcToken;
  IERC20 dstToken;
  address payable srcReceiver1Inch;
  address payable dstReceiver;
  address[] srcReceivers;
  uint256[] srcAmounts;
  uint256 amount;
  uint256 minReturnAmount;
  uint256 flags;
  bytes permit;
}

File 9 of 13 : TransferHelper.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.5.16;

// helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false
library TransferHelper {
  function safeApprove(
    address token,
    address to,
    uint256 value
  ) internal {
    // bytes4(keccak256(bytes('approve(address,uint256)')));
    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
    require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED');
  }

  function safeTransfer(
    address token,
    address to,
    uint256 value
  ) internal {
    // bytes4(keccak256(bytes('transfer(address,uint256)')));
    if (value == 0) return;
    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
    require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED');
  }

  function safeTransferFrom(
    address token,
    address from,
    address to,
    uint256 value
  ) internal {
    // bytes4(keccak256(bytes('transferFrom(address,address,uint256)')));
    if (value == 0) return;
    (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
    require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED');
  }

  function safeTransferETH(address to, uint256 value) internal {
    if (value == 0) return;
    (bool success, ) = to.call{value: value}(new bytes(0));
    require(success, 'TransferHelper: ETH_TRANSFER_FAILED');
  }
}

File 10 of 13 : RevertReasonParser.sol
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.7.6;

/*
“Copyright (c) 2019-2021 1inch 
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: 
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software. 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE”.
*/

library RevertReasonParser {
  function parse(bytes memory data, string memory prefix) internal pure returns (string memory) {
    // https://solidity.readthedocs.io/en/latest/control-structures.html#revert
    // We assume that revert reason is abi-encoded as Error(string)

    // 68 = 4-byte selector 0x08c379a0 + 32 bytes offset + 32 bytes length
    if (data.length >= 68 && data[0] == '\x08' && data[1] == '\xc3' && data[2] == '\x79' && data[3] == '\xa0') {
      string memory reason;
      // solhint-disable no-inline-assembly
      assembly {
        // 68 = 32 bytes data length + 4-byte selector + 32 bytes offset
        reason := add(data, 68)
      }
      /*
                revert reason is padded up to 32 bytes with ABI encoder: Error(string)
                also sometimes there is extra 32 bytes of zeros padded in the end:
                https://github.com/ethereum/solidity/issues/10170
                because of that we can't check for equality and instead check
                that string length + extra 68 bytes is less than overall data length
            */
      require(data.length >= 68 + bytes(reason).length, 'Invalid revert reason');
      return string(abi.encodePacked(prefix, 'Error(', reason, ')'));
    }
    // 36 = 4-byte selector 0x4e487b71 + 32 bytes integer
    else if (data.length == 36 && data[0] == '\x4e' && data[1] == '\x48' && data[2] == '\x7b' && data[3] == '\x71') {
      uint256 code;
      // solhint-disable no-inline-assembly
      assembly {
        // 36 = 32 bytes data length + 4-byte selector
        code := mload(add(data, 36))
      }
      return string(abi.encodePacked(prefix, 'Panic(', _toHex(code), ')'));
    }

    return string(abi.encodePacked(prefix, 'Unknown(', _toHex(data), ')'));
  }

  function _toHex(uint256 value) private pure returns (string memory) {
    return _toHex(abi.encodePacked(value));
  }

  function _toHex(bytes memory data) private pure returns (string memory) {
    bytes16 alphabet = 0x30313233343536373839616263646566;
    bytes memory str = new bytes(2 + data.length * 2);
    str[0] = '0';
    str[1] = 'x';
    for (uint256 i = 0; i < data.length; i++) {
      str[2 * i + 2] = alphabet[uint8(data[i] >> 4)];
      str[2 * i + 3] = alphabet[uint8(data[i] & 0x0f)];
    }
    return string(str);
  }
}

File 11 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 12 of 13 : draft-IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 13 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)

pragma solidity ^0.8.0;

import "../token/ERC20/IERC20.sol";

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

Contract ABI

[{"inputs":[{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"clientData","type":"bytes"}],"name":"ClientData","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"reason","type":"string"}],"name":"Error","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"},{"indexed":false,"internalType":"address","name":"output","type":"address"}],"name":"Exchange","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":"sender","type":"address"},{"indexed":false,"internalType":"contract IERC20","name":"srcToken","type":"address"},{"indexed":false,"internalType":"contract IERC20","name":"dstToken","type":"address"},{"indexed":false,"internalType":"address","name":"dstReceiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"spentAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"returnAmount","type":"uint256"}],"name":"Swapped","type":"event"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"rescueFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IAggregationExecutor","name":"caller","type":"address"},{"components":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"contract IERC20","name":"dstToken","type":"address"},{"internalType":"address[]","name":"srcReceivers","type":"address[]"},{"internalType":"uint256[]","name":"srcAmounts","type":"uint256[]"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct MetaAggregationRouter.SwapDescription","name":"desc","type":"tuple"},{"internalType":"bytes","name":"executorData","type":"bytes"},{"internalType":"bytes","name":"clientData","type":"bytes"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IAggregationExecutor1Inch","name":"caller","type":"address"},{"components":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"contract IERC20","name":"dstToken","type":"address"},{"internalType":"address payable","name":"srcReceiver1Inch","type":"address"},{"internalType":"address payable","name":"dstReceiver","type":"address"},{"internalType":"address[]","name":"srcReceivers","type":"address[]"},{"internalType":"uint256[]","name":"srcAmounts","type":"uint256[]"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct SwapDescriptionExecutor1Inch","name":"desc","type":"tuple"},{"internalType":"bytes","name":"executor1InchData","type":"bytes"},{"internalType":"bytes","name":"clientData","type":"bytes"}],"name":"swapExecutor1Inch","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"router1Inch","type":"address"},{"internalType":"bytes","name":"router1InchData","type":"bytes"},{"components":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"contract IERC20","name":"dstToken","type":"address"},{"internalType":"address[]","name":"srcReceivers","type":"address[]"},{"internalType":"uint256[]","name":"srcAmounts","type":"uint256[]"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct MetaAggregationRouter.SwapDescription","name":"desc","type":"tuple"},{"internalType":"bytes","name":"clientData","type":"bytes"}],"name":"swapRouter1Inch","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IAggregationExecutor","name":"caller","type":"address"},{"components":[{"internalType":"contract IERC20","name":"srcToken","type":"address"},{"internalType":"contract IERC20","name":"dstToken","type":"address"},{"internalType":"address[]","name":"srcReceivers","type":"address[]"},{"internalType":"uint256[]","name":"srcAmounts","type":"uint256[]"},{"internalType":"address","name":"dstReceiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturnAmount","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"bytes","name":"permit","type":"bytes"}],"internalType":"struct MetaAggregationRouter.SwapDescription","name":"desc","type":"tuple"},{"internalType":"bytes","name":"executorData","type":"bytes"},{"internalType":"bytes","name":"clientData","type":"bytes"}],"name":"swapSimpleMode","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256","name":"gasUsed","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"value","type":"bool"}],"name":"updateWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b506040516200433a3803806200433a8339810160408190526200003491620000a1565b6200003f3362000051565b6001600160a01b0316608052620000d3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060208284031215620000b457600080fd5b81516001600160a01b0381168114620000cc57600080fd5b9392505050565b60805161422f6200010b600039600081816101da01528181610a41015281816112590152818161171f0152611e37015261422f6000f3fe6080604052600436106100c05760003560e01c8063a72bd2f511610074578063ad5c46481161004e578063ad5c4648146101c8578063c683630d146101fc578063f2fde38b1461023c57600080fd5b8063a72bd2f514610182578063a7f5c10414610195578063abcffc26146101b557600080fd5b8063715018a6116100a5578063715018a61461011b57806378e3214f146101305780638da5cb5b1461015057600080fd5b80630d392cd9146100cc5780631fb3e235146100ee57600080fd5b366100c757005b600080fd5b3480156100d857600080fd5b506100ec6100e73660046136e1565b61025c565b005b6101016100fc366004613763565b610304565b604080519283526020830191909152015b60405180910390f35b34801561012757600080fd5b506100ec610ad9565b34801561013c57600080fd5b506100ec61014b366004613813565b610b3f565b34801561015c57600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610112565b610101610190366004613858565b610bd7565b3480156101a157600080fd5b506101016101b03660046138e0565b6112f3565b6101016101c33660046138e0565b6117b6565b3480156101d457600080fd5b5061016a7f000000000000000000000000000000000000000000000000000000000000000081565b34801561020857600080fd5b5061022c610217366004613943565b60016020526000908152604090205460ff1681565b6040519015158152602001610112565b34801561024857600080fd5b506100ec610257366004613943565b611ed2565b6000546001600160a01b031633146102bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b0391909116600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b60008060005a905060008860e00135116103605760405162461bcd60e51b815260206004820152601a60248201527f4d696e2072657475726e2073686f756c64206e6f74206265203000000000000060448201526064016102b2565b856103ad5760405162461bcd60e51b815260206004820152601860248201527f646174612073686f756c64206e6f7420626520656d707479000000000000000060448201526064016102b2565b6103ba60a0890189613960565b90506103c960808a018a613960565b9050146104185760405162461bcd60e51b815260206004820152601c60248201527f696e76616c69642073726320726563656976657273206c656e6774680000000060448201526064016102b2565b600061044c61042a60208b018b613943565b6001600160a01b031673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1490565b9050610100890135600216156104c1578061046857600061046e565b8860c001355b34116104bc5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964206d73672e76616c756500000000000000000000000000000060448201526064016102b2565b610521565b806104cd5760006104d3565b8860c001355b34146105215760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964206d73672e76616c756500000000000000000000000000000060448201526064016102b2565b348161061c5761054f61053760208c018c613943565b60c08c013561054a6101208e018e6139c8565b611fb4565b600061055e60808c018c613960565b9050905060005b818110156105e7576105df61057d60208e018e613943565b338e806080019061058e9190613960565b8581811061059e5761059e613a2d565b90506020020160208101906105b39190613943565b8f8060a001906105c39190613960565b868181106105d3576105d3613a2d565b9050602002013561218a565b600101610565565b506106166105f860208d018d613943565b338d604001602081019061060c9190613943565b8e60c0013561218a565b506106d4565b600061062b60808c018c613960565b9050905060005b818110156106d15761064760a08d018d613960565b8281811061065757610657613a2d565b90506020020135836106699190613a8b565b92506106c961067b60808e018e613960565b8381811061068b5761068b613a2d565b90506020020160208101906106a09190613943565b6106ad60a08f018f613960565b848181106106bd576106bd613a2d565b90506020020135612303565b600101610632565b50505b604051600090610710907f2636f7f80000000000000000000000000000000000000000000000000000000090839033908e908e90602001613aa2565b60405160208183030381529060405290506000808d6001600160a01b0316848460405161073d9190613b5f565b60006040518083038185875af1925050503d806000811461077a576040519150601f19603f3d011682016040523d82523d6000602084013e61077f565b606091505b5091509150816107e1576107c8816040518060400160405280601281526020017f63616c6c4279746573206661696c65643a2000000000000000000000000000008152506123f4565b60405162461bcd60e51b81526004016102b29190613ba7565b50505060c08a01356108026107fc60408d0160208e01613943565b30612813565b95506101008b0135600116156108bf5760006108246107fc60208e018e613943565b9050801561084f576108368183613a8b565b915061084f61084860208e018e613943565b33836128e4565b61085d8260e08e0135613bba565b61086b60c08e013589613bba565b10156108b95760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016102b2565b50610913565b8a60e001358610156109135760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016102b2565b60008061092660808e0160608f01613943565b6001600160a01b0316146109495761094460808d0160608e01613943565b61094b565b335b905061096761096060408e0160208f01613943565b82896128e4565b7fd6d4f5681c246c9f42c203e287975af1601f8df8035a9251f79aab5c8f09e2f83361099660208f018f613943565b8e60200160208101906109a99190613943565b604080516001600160a01b03948516815292841660208401529083169082015290831660608201526080810184905260a0810189905260c00160405180910390a17fddac40937f35385a34f721af292e5a83fc5b840f722bff57c2fc71adba708c488d88610a238f602001602081019061042a9190613943565b610a3f578e6020016020810190610a3a9190613943565b610a61565b7f00000000000000000000000000000000000000000000000000000000000000005b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a17f095e66fa4dd6a6f7b43fb8444a7bd0edb870508c7abf639bc216efb0bcff97798989604051610abc929190613bf7565b60405180910390a15a850395505050505050965096945050505050565b6000546001600160a01b03163314610b335760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102b2565b610b3d6000612924565b565b6000546001600160a01b03163314610b995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102b2565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0383161415610bcc57610bc83382612303565b5050565b610bc882338361298c565b60008060005a6001600160a01b038a1660009081526001602052604090205490915060ff16610c485760405162461bcd60e51b815260206004820152601460248201527f6e6f742077686974656c69737420726f7574657200000000000000000000000060448201526064016102b2565b60008660c0013511610c9c5760405162461bcd60e51b815260206004820152601a60248201527f4d696e2072657475726e2073686f756c64206e6f74206265203000000000000060448201526064016102b2565b610ca96060870187613960565b9050610cb86040880188613960565b9050148015610cd657506001610cd16060880188613960565b905011155b610d485760405162461bcd60e51b815260206004820152602860248201527f496e76616c6964206c656e6774687320666f7220726563656976696e6720737260448201527f6320746f6b656e7300000000000000000000000000000000000000000000000060648201526084016102b2565b34610d5961042a6020890189613943565b610e5457610d80610d6d6020890189613943565b60a089013561054a6101008b018b6139c8565b610d9c610d906020890189613943565b33308a60a0013561218a565b6000610dae6107fc60208a018a613943565b9050610dd28b82610dc260208c018c613943565b6001600160a01b03169190612adf565b60005b610de260408a018a613960565b9050811015610e4d57610e3b610dfb60208b018b613943565b33610e0960408d018d613960565b85818110610e1957610e19613a2d565b9050602002016020810190610e2e9190613943565b6105c360608e018e613960565b80610e4581613c26565b915050610dd5565b5050610ef4565b60005b610e646040890189613960565b9050811015610ef257610e7a6060890189613960565b82818110610e8a57610e8a613a2d565b9050602002013582610e9c9190613a8b565b9150610ee0610eae60408a018a613960565b83818110610ebe57610ebe613a2d565b9050602002016020810190610ed39190613943565b6106ad60608b018b613960565b80610eea81613c26565b915050610e57565b505b600080610f0760a08a0160808b01613943565b6001600160a01b031614610f2a57610f2560a0890160808a01613943565b610f2c565b335b9050600060e0890135600116610f43576000610f59565b610f59610f5360208b018b613943565b33612813565b90506000610f76610f7060408c0160208d01613943565b84612813565b905060008d6001600160a01b0316858e8e604051610f95929190613c5f565b60006040518083038185875af1925050503d8060008114610fd2576040519150601f19603f3d011682016040523d82523d6000602084013e610fd7565b606091505b50509050806110285760405162461bcd60e51b815260206004820152601960248201527f63616c6c20746f2031696e636820726f75746572206661696c0000000000000060448201526064016102b2565b50600061103e6107fc60408d0160208e01613943565b905061105a61105360408d0160208e01613943565b85836128e4565b8161107461106e60408e0160208f01613943565b86612813565b61107e9190613a8b565b975060a08b013560e08c01356001161561112b576110a2610f5360208e018e613943565b6110b060a08e013586613c6f565b6110ba9190613a8b565b90506110ca8160c08e0135613bba565b6110d860a08e01358b613bba565b10156111265760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016102b2565b61117f565b8b60c0013589101561117f5760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016102b2565b7fd6d4f5681c246c9f42c203e287975af1601f8df8035a9251f79aab5c8f09e2f8336111ae60208f018f613943565b8e60200160208101906111c19190613943565b604080516001600160a01b03948516815292841660208401529083169082015290871660608201526080810183905260a081018b905260c00160405180910390a17fddac40937f35385a34f721af292e5a83fc5b840f722bff57c2fc71adba708c488f8a61123b8f602001602081019061042a9190613943565b611257578e60200160208101906112529190613943565b611279565b7f00000000000000000000000000000000000000000000000000000000000000005b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a17f095e66fa4dd6a6f7b43fb8444a7bd0edb870508c7abf639bc216efb0bcff97798b8b6040516112d4929190613bf7565b60405180910390a15a8703975050505050505050965096945050505050565b60008060005a905061130b61042a60208a018a613943565b1561137e5760405162461bcd60e51b815260206004820152602260248201527f737263206973206574682c2073686f756c6420757365206e6f726d616c20737760448201527f617000000000000000000000000000000000000000000000000000000000000060648201526084016102b2565b6113a161138e60208a018a613943565b60a08a013561054a6101008c018c6139c8565b60a088013560006113b560408b018b613960565b9050111561154b576113ca60408a018a613960565b905060011480156113f657506113e360608a018a613960565b90506113f260408b018b613960565b9050145b6114425760405162461bcd60e51b815260206004820152601d60248201527f57726f6e67206e756d626572206f66207372632072656365697665727300000060448201526064016102b2565b6114a461145260208b018b613943565b3361146060408d018d613960565b600081811061147157611471613a2d565b90506020020160208101906114869190613943565b61149360608e018e613960565b60008181106105d3576105d3613a2d565b806114b260608b018b613960565b60008181106114c3576114c3613a2d565b9050602002013511156115185760405162461bcd60e51b815260206004820152601f60248201527f696e76616c69642066656520616d6f756e7420696e2073726320746f6b656e0060448201526064016102b2565b61152560608a018a613960565b600081811061153657611536613a2d565b90506020020135816115489190613a8b565b90505b60008061155e60a08c0160808d01613943565b6001600160a01b0316146115815761157c60a08b0160808c01613943565b611583565b335b905060006115a061159a60408d0160208e01613943565b83612813565b90506115cf8c6115b360208e018e613943565b858e60200160208101906115c79190613943565b868f8f612c09565b806115e3610f7060408e0160208f01613943565b6115ed9190613a8b565b95508a60c001358610156116435760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016102b2565b7fd6d4f5681c246c9f42c203e287975af1601f8df8035a9251f79aab5c8f09e2f83361167260208e018e613943565b8d60200160208101906116859190613943565b604080516001600160a01b039485168152928416602084015290831690820152908416606082015260a0808e01356080830152810188905260c00160405180910390a17fddac40937f35385a34f721af292e5a83fc5b840f722bff57c2fc71adba708c488c876117018e602001602081019061042a9190613943565b61171d578d60200160208101906117189190613943565b61173f565b7f00000000000000000000000000000000000000000000000000000000000000005b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a17f095e66fa4dd6a6f7b43fb8444a7bd0edb870508c7abf639bc216efb0bcff9779888860405161179a929190613bf7565b60405180910390a15a8403945050505050965096945050505050565b60008060005a905060008860c00135116118125760405162461bcd60e51b815260206004820152601a60248201527f4d696e2072657475726e2073686f756c64206e6f74206265203000000000000060448201526064016102b2565b8561185f5760405162461bcd60e51b815260206004820152601f60248201527f6578656375746f72446174612073686f756c64206265206e6f74207a65726f0060448201526064016102b2565b60e088013560208116156118865761187b8a8a8a8a8a8a6112f3565b935093505050611ec7565b600061189560208b018b613943565b905060028216156119245773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b038216146118cb5760006118d1565b8960a001355b341161191f5760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964206d73672e76616c756500000000000000000000000000000060448201526064016102b2565b6119a3565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0382161461194f576000611955565b8960a001355b34146119a35760405162461bcd60e51b815260206004820152601160248201527f496e76616c6964206d73672e76616c756500000000000000000000000000000060448201526064016102b2565b6119b060608b018b613960565b90506119bf60408c018c613960565b905014611a345760405162461bcd60e51b815260206004820152602860248201527f496e76616c6964206c656e6774687320666f7220726563656976696e6720737260448201527f6320746f6b656e7300000000000000000000000000000000000000000000000060648201526084016102b2565b6004821615611b355773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0382161415611aaa5760405162461bcd60e51b815260206004820152601260248201527f436c61696d20746f6b656e20697320455448000000000000000000000000000060448201526064016102b2565b611ac18160a08c013561054a6101008e018e6139c8565b60005b611ad160408c018c613960565b9050811015611b3357611b218233611aec60408f018f613960565b85818110611afc57611afc613a2d565b9050602002016020810190611b119190613943565b8e80606001906105c39190613960565b80611b2b81613c26565b915050611ac4565b505b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0382161415611bc95760005b611b6a60408c018c613960565b9050811015611bc757611bb5611b8360408d018d613960565b83818110611b9357611b93613a2d565b9050602002016020810190611ba89190613943565b6106ad60608e018e613960565b80611bbf81613c26565b915050611b5d565b505b50600080611bdd60a08c0160808d01613943565b6001600160a01b031614611c0057611bfb60a08b0160808c01613943565b611c02565b335b9050600060018316611c15576000611c25565b611c25610f5360208d018d613943565b90506000611c3960408d0160208e01613943565b90506000611c478285612813565b9050611c548e8d8d613026565b60a08d013581611c648487612813565b611c6e9190613a8b565b98506001861615611d1e57611c8f8e6000016020810190610f539190613943565b8e60a0013585611c9f9190613c6f565b611ca99190613a8b565b9050808e60c00135611cbb9190613bba565b8e60a001358a611ccb9190613bba565b1015611d195760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016102b2565b611d72565b8d60c00135891015611d725760405162461bcd60e51b815260206004820152601b60248201527f52657475726e20616d6f756e74206973206e6f7420656e6f756768000000000060448201526064016102b2565b7fd6d4f5681c246c9f42c203e287975af1601f8df8035a9251f79aab5c8f09e2f8338f6000016020810190611da79190613943565b604080516001600160a01b03938416815291831660208301528287169082015290871660608201526080810183905260a081018b905260c00160405180910390a17fddac40937f35385a34f721af292e5a83fc5b840f722bff57c2fc71adba708c488f8a73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b03871614611e355785611e57565b7f00000000000000000000000000000000000000000000000000000000000000005b604080516001600160a01b039485168152602081019390935292168183015290519081900360600190a17f095e66fa4dd6a6f7b43fb8444a7bd0edb870508c7abf639bc216efb0bcff97798b8b604051611eb2929190613bf7565b60405180910390a150505050505a8203925050505b965096945050505050565b6000546001600160a01b03163314611f2c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016102b2565b6001600160a01b038116611fa85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016102b2565b611fb181612924565b50565b60e081141561218457600080856001600160a01b031663d505accf60e01b8585604051602001611fe693929190613c87565b60408051601f198184030181529082905261200091613b5f565b6000604051808303816000865af19150503d806000811461203d576040519150601f19603f3d011682016040523d82523d6000602084013e612042565b606091505b50915091508161218157600061208d826040518060400160405280601481526020017f5065726d69742063616c6c206661696c65643a200000000000000000000000008152506123f4565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815233600482015230602482015290915086906001600160a01b0389169063dd62ed3e9060440160206040518083038186803b1580156120f057600080fd5b505afa158015612104573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121289190613cc3565b1015612148578060405162461bcd60e51b81526004016102b29190613ba7565b7f08c379a0afcc32b1a39302f7cb8073359698411ab5fd6e3edb2c02c0b5fba8aa816040516121779190613ba7565b60405180910390a1505b50505b50505050565b8061219457612184565b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905291516000928392908816916122269190613b5f565b6000604051808303816000865af19150503d8060008114612263576040519150601f19603f3d011682016040523d82523d6000602084013e612268565b606091505b50915091508180156122925750805115806122925750808060200190518101906122929190613cdc565b6121815760405162461bcd60e51b8152602060048201526024808201527f5472616e7366657248656c7065723a205452414e534645525f46524f4d5f464160448201527f494c45440000000000000000000000000000000000000000000000000000000060648201526084016102b2565b8061230c575050565b604080516000808252602082019092526001600160a01b0384169083906040516123369190613b5f565b60006040518083038185875af1925050503d8060008114612373576040519150601f19603f3d011682016040523d82523d6000602084013e612378565b606091505b50509050806123ef5760405162461bcd60e51b815260206004820152602360248201527f5472616e7366657248656c7065723a204554485f5452414e534645525f46414960448201527f4c4544000000000000000000000000000000000000000000000000000000000060648201526084016102b2565b505050565b6060604483511015801561246157508260008151811061241657612416613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f0800000000000000000000000000000000000000000000000000000000000000145b80156124c657508260018151811061247b5761247b613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167fc300000000000000000000000000000000000000000000000000000000000000145b801561252b5750826002815181106124e0576124e0613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7900000000000000000000000000000000000000000000000000000000000000145b801561259057508260038151811061254557612545613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167fa000000000000000000000000000000000000000000000000000000000000000145b15612622576044838101805190916125a89190613c6f565b845110156125f85760405162461bcd60e51b815260206004820152601560248201527f496e76616c69642072657665727420726561736f6e000000000000000000000060448201526064016102b2565b828160405160200161260b929190613d28565b60405160208183030381529060405291505061280d565b8251602414801561268c57508260008151811061264157612641613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f4e00000000000000000000000000000000000000000000000000000000000000145b80156126f15750826001815181106126a6576126a6613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f4800000000000000000000000000000000000000000000000000000000000000145b801561275657508260028151811061270b5761270b613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7b00000000000000000000000000000000000000000000000000000000000000145b80156127bb57508260038151811061277057612770613a2d565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f7100000000000000000000000000000000000000000000000000000000000000145b156127e0576024830151826127cf82613172565b60405160200161260b929190613daa565b816127ea8461319a565b6040516020016127fb929190613df6565b60405160208183030381529060405290505b92915050565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b038416141561284b57506001600160a01b0381163161280d565b6040517f70a082310000000000000000000000000000000000000000000000000000000081526001600160a01b0383811660048301528416906370a082319060240160206040518083038186803b1580156128a557600080fd5b505afa1580156128b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128dd9190613cc3565b905061280d565b80156123ef5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6001600160a01b0384161415612919576123ef8282612303565b6123ef83838361298c565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8061299657505050565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839290871691612a209190613b5f565b6000604051808303816000865af19150503d8060008114612a5d576040519150601f19603f3d011682016040523d82523d6000602084013e612a62565b606091505b5091509150818015612a8c575080511580612a8c575080806020019051810190612a8c9190613cdc565b612ad85760405162461bcd60e51b815260206004820152601f60248201527f5472616e7366657248656c7065723a205452414e534645525f4641494c45440060448201526064016102b2565b5050505050565b6040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038381166024830152600091839186169063dd62ed3e9060440160206040518083038186803b158015612b4457600080fd5b505afa158015612b58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b7c9190613cc3565b612b869190613c6f565b604080516001600160a01b038616602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f095ea7b30000000000000000000000000000000000000000000000000000000017905290915061218490859061343f565b6000612c17828401846140b5565b90504281606001511015612c6d5760405162461bcd60e51b815260206004820152600f60248201527f524f555445523a2045787069726564000000000000000000000000000000000060448201526064016102b2565b602081015151815151148015612c895750604081015151815151145b612cd55760405162461bcd60e51b815260206004820152601860248201527f696e76616c696420737761702064617461206c656e677468000000000000000060448201526064016102b2565b80515160005b81811015612f0f57612d29893385600001518481518110612cfe57612cfe613a2d565b602002602001015186602001518581518110612d1c57612d1c613a2d565b602002602001015161218a565b8783602001518281518110612d4057612d40613a2d565b60200260200101511115612d965760405162461bcd60e51b815260206004820152601360248201527f696e76616c6964207377617020616d6f756e740000000000000000000000000060448201526064016102b2565b82602001518181518110612dac57612dac613a2d565b602002602001015188612dbf9190613a8b565b97506000808b6001600160a01b0316638b674f5d60e01b86604001518581518110612dec57612dec613a2d565b6020026020010151604051602401612e049190613ba7565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612e6f9190613b5f565b6000604051808303816000865af19150503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b509150915081612efa576107c8816040518060400160405280601b81526020017f7377617053696e676c6553657175656e6365206661696c65643a2000000000008152506123f4565b50508080612f0790613c26565b915050612cdb565b506000808a6001600160a01b031663774b6b7e60e01b8b8a8a8860800151604051602401612f409493929190614198565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051612fab9190613b5f565b6000604051808303816000865af19150503d8060008114612fe8576040519150601f19603f3d011682016040523d82523d6000602084013e612fed565b606091505b509150915081613019576107c8816040518060600160405280602381526020016141d7602391396123f4565b5050505050505050505050565b600061304673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee30612813565b9050348111156130535750345b600080856001600160a01b03168363d9c4535760e01b878760405160240161307c929190613bf7565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516130e79190613b5f565b60006040518083038185875af1925050503d8060008114613124576040519150601f19603f3d011682016040523d82523d6000602084013e613129565b606091505b509150915081612181576107c8816040518060400160405280601281526020017f63616c6c4279746573206661696c65643a2000000000000000000000000000008152506123f4565b606061280d8260405160200161318a91815260200190565b6040516020818303038152906040525b80516060907f3031323334353637383961626364656600000000000000000000000000000000906000906131cf906002613bba565b6131da906002613c6f565b67ffffffffffffffff8111156131f2576131f2613cf9565b6040519080825280601f01601f19166020018201604052801561321c576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061325357613253613a2d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f7800000000000000000000000000000000000000000000000000000000000000816001815181106132b6576132b6613a2d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060005b84518110156134375782600486838151811061330657613306613a2d565b01602001517fff0000000000000000000000000000000000000000000000000000000000000016901c60f81c6010811061334257613342613a2d565b1a60f81b82613352836002613bba565b61335d906002613c6f565b8151811061336d5761336d613a2d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350828582815181106133af576133af613a2d565b60209101015160f81c600f16601081106133cb576133cb613a2d565b1a60f81b826133db836002613bba565b6133e6906003613c6f565b815181106133f6576133f6613a2d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508061342f81613c26565b9150506132e8565b509392505050565b6000613494826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166135249092919063ffffffff16565b8051909150156123ef57808060200190518101906134b29190613cdc565b6123ef5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016102b2565b6060613533848460008561353d565b90505b9392505050565b6060824710156135b55760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016102b2565b6001600160a01b0385163b61360c5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016102b2565b600080866001600160a01b031685876040516136289190613b5f565b60006040518083038185875af1925050503d8060008114613665576040519150601f19603f3d011682016040523d82523d6000602084013e61366a565b606091505b509150915061367a828286613685565b979650505050505050565b60608315613694575081613536565b8251156136a45782518084602001fd5b8160405162461bcd60e51b81526004016102b29190613ba7565b6001600160a01b0381168114611fb157600080fd5b8015158114611fb157600080fd5b600080604083850312156136f457600080fd5b82356136ff816136be565b9150602083013561370f816136d3565b809150509250929050565b60008083601f84011261372c57600080fd5b50813567ffffffffffffffff81111561374457600080fd5b60208301915083602082850101111561375c57600080fd5b9250929050565b6000806000806000806080878903121561377c57600080fd5b8635613787816136be565b9550602087013567ffffffffffffffff808211156137a457600080fd5b90880190610140828b0312156137b957600080fd5b909550604088013590808211156137cf57600080fd5b6137db8a838b0161371a565b909650945060608901359150808211156137f457600080fd5b5061380189828a0161371a565b979a9699509497509295939492505050565b6000806040838503121561382657600080fd5b8235613831816136be565b946020939093013593505050565b6000610120828403121561385257600080fd5b50919050565b6000806000806000806080878903121561387157600080fd5b863561387c816136be565b9550602087013567ffffffffffffffff8082111561389957600080fd5b6138a58a838b0161371a565b909750955060408901359150808211156138be57600080fd5b6138ca8a838b0161383f565b945060608901359150808211156137f457600080fd5b600080600080600080608087890312156138f957600080fd5b8635613904816136be565b9550602087013567ffffffffffffffff8082111561392157600080fd5b61392d8a838b0161383f565b965060408901359150808211156137cf57600080fd5b60006020828403121561395557600080fd5b8135613536816136be565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261399557600080fd5b83018035915067ffffffffffffffff8211156139b057600080fd5b6020019150600581901b360382131561375c57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126139fd57600080fd5b83018035915067ffffffffffffffff821115613a1857600080fd5b60200191503681900382131561375c57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600082821015613a9d57613a9d613a5c565b500390565b7fffffffff00000000000000000000000000000000000000000000000000000000861681527fffffffffffffffffffffffff0000000000000000000000000000000000000000851660048201527fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008460601b1660108201528183602483013760009101602401908152949350505050565b60005b83811015613b4e578181015183820152602001613b36565b838111156121845750506000910152565b60008251613b71818460208701613b33565b9190910192915050565b60008151808452613b93816020860160208601613b33565b601f01601f19169290920160200192915050565b6020815260006135366020830184613b7b565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613bf257613bf2613a5c565b500290565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415613c5857613c58613a5c565b5060010190565b8183823760009101908152919050565b60008219821115613c8257613c82613a5c565b500190565b7fffffffff0000000000000000000000000000000000000000000000000000000084168152818360048301376000910160040190815292915050565b600060208284031215613cd557600080fd5b5051919050565b600060208284031215613cee57600080fd5b8151613536816136d3565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008351613d3a818460208801613b33565b7f4572726f722800000000000000000000000000000000000000000000000000009083019081528351613d74816006840160208801613b33565b7f290000000000000000000000000000000000000000000000000000000000000060069290910191820152600701949350505050565b60008351613dbc818460208801613b33565b7f50616e69632800000000000000000000000000000000000000000000000000009083019081528351613d74816006840160208801613b33565b60008351613e08818460208801613b33565b7f556e6b6e6f776e280000000000000000000000000000000000000000000000009083019081528351613e42816008840160208801613b33565b7f290000000000000000000000000000000000000000000000000000000000000060089290910191820152600901949350505050565b60405160a0810167ffffffffffffffff81118282101715613e9b57613e9b613cf9565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715613eca57613eca613cf9565b604052919050565b600067ffffffffffffffff821115613eec57613eec613cf9565b5060051b60200190565b600082601f830112613f0757600080fd5b81356020613f1c613f1783613ed2565b613ea1565b82815260059290921b84018101918181019086841115613f3b57600080fd5b8286015b84811015613f5f578035613f52816136be565b8352918301918301613f3f565b509695505050505050565b600082601f830112613f7b57600080fd5b81356020613f8b613f1783613ed2565b82815260059290921b84018101918181019086841115613faa57600080fd5b8286015b84811015613f5f5780358352918301918301613fae565b600082601f830112613fd657600080fd5b813567ffffffffffffffff811115613ff057613ff0613cf9565b6140036020601f19601f84011601613ea1565b81815284602083860101111561401857600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f83011261404657600080fd5b81356020614056613f1783613ed2565b82815260059290921b8401810191818101908684111561407557600080fd5b8286015b84811015613f5f57803567ffffffffffffffff8111156140995760008081fd5b6140a78986838b0101613fc5565b845250918301918301614079565b6000602082840312156140c757600080fd5b813567ffffffffffffffff808211156140df57600080fd5b9083019060a082860312156140f357600080fd5b6140fb613e78565b82358281111561410a57600080fd5b61411687828601613ef6565b82525060208301358281111561412b57600080fd5b61413787828601613f6a565b60208301525060408301358281111561414f57600080fd5b61415b87828601614035565b6040830152506060830135606082015260808301358281111561417d57600080fd5b61418987828601613fc5565b60808301525095945050505050565b60006001600160a01b0380871683528086166020840152808516604084015250608060608301526141cc6080830184613b7b565b969550505050505056fe66696e616c5472616e73616374696f6e50726f63657373696e67206661696c65643a20a264697066735822122043ade6779d161e95ef59734aef7aa247e516ab990bdd1e7233b2d927344164c864736f6c6343000809003300000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1

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

00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1

-----Decoded View---------------
Arg [0] : _WETH (address): 0x82af49447d8a07e3bd95bd0d56f35241523fbab1

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.