ETH Price: $3,301.72 (+0.50%)
 

Overview

ETH Balance

0.000000572741466368 ETH

Eth Value

Less Than $0.01 (@ $3,301.72/ETH)

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Mint X Token186696792023-11-28 10:58:59779 days ago1701169139IN
0x49e51067...7a72AbdE4
10 ETH0.0142924529.28775017
Mint F Token186696742023-11-28 10:57:59779 days ago1701169079IN
0x49e51067...7a72AbdE4
5 ETH0.0143717527.56488127
Mint X Token186685012023-11-28 7:01:11779 days ago1701154871IN
0x49e51067...7a72AbdE4
2.7 ETH0.0126518426.86639074
Mint X Token186682562023-11-28 6:11:35779 days ago1701151895IN
0x49e51067...7a72AbdE4
0.001 ETH0.0152528132.00117488
Mint F Token186682522023-11-28 6:10:47779 days ago1701151847IN
0x49e51067...7a72AbdE4
0.001 ETH0.0172110434.08296684
Mint X Token186655462023-11-27 21:06:11780 days ago1701119171IN
0x49e51067...7a72AbdE4
0 ETH0.0309241132.35433613
Mint X Token186652742023-11-27 20:11:35780 days ago1701115895IN
0x49e51067...7a72AbdE4
1 ETH0.0208599539.16942877
Mint F Token186597772023-11-27 1:42:11781 days ago1701049331IN
0x49e51067...7a72AbdE4
1 ETH0.0138431827.58193873
Mint X Token186536632023-11-26 5:08:11781 days ago1700975291IN
0x49e51067...7a72AbdE4
1 ETH0.0093743920.52362431
Mint X Token186531412023-11-26 3:23:11781 days ago1700968991IN
0x49e51067...7a72AbdE4
13 ETH0.0079038617.19873278
Mint X Token186484882023-11-25 11:43:23782 days ago1700912603IN
0x49e51067...7a72AbdE4
2 ETH0.0095692220.2021686
Mint X Token186481832023-11-25 10:41:59782 days ago1700908919IN
0x49e51067...7a72AbdE4
2.7 ETH0.0101575922.11129995
Mint X Token186480772023-11-25 10:20:47782 days ago1700907647IN
0x49e51067...7a72AbdE4
12 ETH0.0085258218.66534303
Mint X Token186435432023-11-24 19:06:23783 days ago1700852783IN
0x49e51067...7a72AbdE4
8.8 ETH0.0168042233.3991652
Redeem186432562023-11-24 18:08:23783 days ago1700849303IN
0x49e51067...7a72AbdE4
0 ETH0.0238066136.26447195
Redeem186417542023-11-24 13:05:59783 days ago1700831159IN
0x49e51067...7a72AbdE4
0 ETH0.016102931.99604444
Mint X Token186409392023-11-24 10:22:11783 days ago1700821331IN
0x49e51067...7a72AbdE4
3.2 ETH0.0138357727.66397454
Mint X Token186397432023-11-24 6:20:47783 days ago1700806847IN
0x49e51067...7a72AbdE4
0 ETH0.0180501120.56759338
Mint X Token186387102023-11-24 2:52:11784 days ago1700794331IN
0x49e51067...7a72AbdE4
0.00000001 ETH0.0244208428.23751507
Mint X Token186384462023-11-24 1:58:35784 days ago1700791115IN
0x49e51067...7a72AbdE4
0.00000001 ETH0.017372219.81006742
Redeem186377452023-11-23 23:36:47784 days ago1700782607IN
0x49e51067...7a72AbdE4
0 ETH0.0109341522.46982761
Mint X Token186366712023-11-23 19:59:23784 days ago1700769563IN
0x49e51067...7a72AbdE4
2.455 ETH0.0163742934.55330265
Redeem186327062023-11-23 6:41:23784 days ago1700721683IN
0x49e51067...7a72AbdE4
0 ETH0.0128838827.15191054
Mint X Token186295522023-11-22 20:06:11785 days ago1700683571IN
0x49e51067...7a72AbdE4
12 ETH0.0263540655.61466857
Mint F Token186290032023-11-22 18:16:11785 days ago1700676971IN
0x49e51067...7a72AbdE4
0.5 ETH0.0253139648.55306568
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Exchange_multipl...186696792023-11-28 10:58:59779 days ago1701169139
0x49e51067...7a72AbdE4
10 ETH
Exchange_multipl...186696742023-11-28 10:57:59779 days ago1701169079
0x49e51067...7a72AbdE4
5 ETH
Exchange_multipl...186685012023-11-28 7:01:11779 days ago1701154871
0x49e51067...7a72AbdE4
2.7 ETH
Exchange_multipl...186682562023-11-28 6:11:35779 days ago1701151895
0x49e51067...7a72AbdE4
0.001 ETH
Exchange_multipl...186682522023-11-28 6:10:47779 days ago1701151847
0x49e51067...7a72AbdE4
0.001 ETH
Exchange_multipl...186652742023-11-27 20:11:35780 days ago1701115895
0x49e51067...7a72AbdE4
1 ETH
Exchange_multipl...186597772023-11-27 1:42:11781 days ago1701049331
0x49e51067...7a72AbdE4
1 ETH
Exchange_multipl...186536632023-11-26 5:08:11781 days ago1700975291
0x49e51067...7a72AbdE4
1 ETH
Exchange_multipl...186531412023-11-26 3:23:11781 days ago1700968991
0x49e51067...7a72AbdE4
13 ETH
Exchange_multipl...186484882023-11-25 11:43:23782 days ago1700912603
0x49e51067...7a72AbdE4
2 ETH
Exchange_multipl...186481832023-11-25 10:41:59782 days ago1700908919
0x49e51067...7a72AbdE4
2.7 ETH
Exchange_multipl...186480772023-11-25 10:20:47782 days ago1700907647
0x49e51067...7a72AbdE4
12 ETH
Exchange_multipl...186435432023-11-24 19:06:23783 days ago1700852783
0x49e51067...7a72AbdE4
8.8 ETH
Exchange_multipl...186412472023-11-24 11:24:11783 days ago1700825051
0x49e51067...7a72AbdE4
3 ETH
Mint X Token186412472023-11-24 11:24:11783 days ago1700825051
0x49e51067...7a72AbdE4
3 ETH
Exchange_multipl...186409392023-11-24 10:22:11783 days ago1700821331
0x49e51067...7a72AbdE4
3.2 ETH
Exchange_multipl...186366712023-11-23 19:59:23784 days ago1700769563
0x49e51067...7a72AbdE4
2.455 ETH
Exchange_multipl...186295522023-11-22 20:06:11785 days ago1700683571
0x49e51067...7a72AbdE4
12 ETH
Exchange_multipl...186290032023-11-22 18:16:11785 days ago1700676971
0x49e51067...7a72AbdE4
0.5 ETH
Exchange_multipl...186276822023-11-22 13:50:35785 days ago1700661035
0x49e51067...7a72AbdE4
12 ETH
Exchange_multipl...186260182023-11-22 8:13:47785 days ago1700640827
0x49e51067...7a72AbdE4
10 ETH
Exchange_multipl...186226432023-11-21 20:52:47786 days ago1700599967
0x49e51067...7a72AbdE4
40 ETH
Exchange_multipl...186193732023-11-21 9:54:11786 days ago1700560451
0x49e51067...7a72AbdE4
5 ETH
Exchange_multipl...186167612023-11-21 1:07:35787 days ago1700528855
0x49e51067...7a72AbdE4
0.1 ETH
Exchange_multipl...186120872023-11-20 9:24:35787 days ago1700472275
0x49e51067...7a72AbdE4
24.5 ETH
View All Internal Transactions
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
FxGateway

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma abicoder v2;

import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";

import { IMarket } from "../f(x)/interfaces/IMarket.sol";
import { ITokenConverter } from "../helpers/converter/ITokenConverter.sol";

// solhint-disable contract-name-camelcase

contract FxGateway is Ownable {
  using SafeERC20 for IERC20;

  /*************
   * Constants *
   *************/

  /// @notice The address of base token.
  address public immutable baseToken;

  /// @notice The address of Fractional Token.
  address public immutable fToken;

  /// @notice The address of Leveraged Token.
  address public immutable xToken;

  /// @notice The address of Market.
  address public immutable market;

  /***********
   * Structs *
   ***********/

  struct ZapInCall {
    address src;
    uint256 amount;
    address target;
    bytes data;
  }

  struct ZapOutCall {
    address converter;
    uint256[] routes;
  }

  /*************
   * Variables *
   *************/

  /// @notice The list of approved target contracts.
  mapping(address => bool) public approvedTargets;

  /************
   * Modifier *
   ************/

  modifier zapInToken(ZapInCall memory _call) {
    require(approvedTargets[_call.target], "target not approved");
    _transferTokenIn(_call.src, _call.amount);

    bool _success;
    if (_call.src == address(0)) {
      (_success, ) = _call.target.call{ value: _call.amount }(_call.data);
    } else {
      IERC20(_call.src).safeApprove(_call.target, 0);
      IERC20(_call.src).safeApprove(_call.target, _call.amount);
      (_success, ) = _call.target.call(_call.data);
    }

    // below lines will propagate inner error up
    if (!_success) {
      // solhint-disable-next-line no-inline-assembly
      assembly {
        let ptr := mload(0x40)
        let size := returndatasize()
        returndatacopy(ptr, 0, size)
        revert(ptr, size)
      }
    }

    _;
  }

  /***************
   * Constructor *
   ***************/

  constructor(
    address _market,
    address _baseToken,
    address _fToken,
    address _xToken
  ) {
    baseToken = _baseToken;
    fToken = _fToken;
    xToken = _xToken;
    market = _market;

    IERC20(_baseToken).safeApprove(_market, uint256(-1));
    IERC20(_fToken).safeApprove(_market, uint256(-1));
    IERC20(_xToken).safeApprove(_market, uint256(-1));
  }

  /****************************
   * Public Mutated Functions *
   ****************************/

  /// @notice Mint some fToken with some ETH.
  /// @param _minFTokenMinted The minimum amount of fToken should be received.
  /// @return _fTokenMinted The amount of fToken received.
  function mintFToken(ZapInCall memory _call, uint256 _minFTokenMinted)
    external
    payable
    zapInToken(_call)
    returns (uint256 _fTokenMinted)
  {
    uint256 _amount = IERC20(baseToken).balanceOf(address(this));
    _fTokenMinted = IMarket(market).mintFToken(_amount, msg.sender, _minFTokenMinted);

    _refund(baseToken, msg.sender);
  }

  /// @notice Mint some xToken with some ETH.
  /// @param _minXTokenMinted The minimum amount of xToken should be received.
  /// @return _xTokenMinted The amount of xToken received.
  /// @return _bonus The amount of bonus base token received.
  function mintXToken(ZapInCall memory _call, uint256 _minXTokenMinted)
    external
    payable
    zapInToken(_call)
    returns (uint256 _xTokenMinted, uint256 _bonus)
  {
    uint256 _amount = IERC20(baseToken).balanceOf(address(this));
    (_xTokenMinted, _bonus) = IMarket(market).mintXToken(_amount, msg.sender, _minXTokenMinted);

    _refund(baseToken, msg.sender);
  }

  /// @notice Mint some xToken by add some ETH as collateral.
  /// @param _minXTokenMinted The minimum amount of xToken should be received.
  /// @return _xTokenMinted The amount of xToken received.
  function addBaseToken(ZapInCall memory _call, uint256 _minXTokenMinted)
    external
    payable
    zapInToken(_call)
    returns (uint256 _xTokenMinted)
  {
    uint256 _amount = IERC20(baseToken).balanceOf(address(this));
    _xTokenMinted = IMarket(market).addBaseToken(_amount, msg.sender, _minXTokenMinted);

    _refund(baseToken, msg.sender);
  }

  /// @notice Redeem and convert to some other token.
  /// @param _fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken.
  /// @param _xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken.
  /// @param _minBaseToken The minimum amount of base token should be received.
  /// @param _minDstToken The minimum amount of dst token should be received.
  /// @return _baseOut The amount of base token received.
  /// @return _dstOut The amount of dst token received.
  function redeem(
    ZapOutCall memory _call,
    uint256 _fTokenIn,
    uint256 _xTokenIn,
    uint256 _minBaseToken,
    uint256 _minDstToken
  ) external returns (uint256 _baseOut, uint256 _dstOut) {
    require(_call.routes.length > 0, "no routes");

    if (_xTokenIn == 0) {
      _fTokenIn = _transferTokenIn(fToken, _fTokenIn);
    } else {
      _xTokenIn = _transferTokenIn(xToken, _xTokenIn);
      _fTokenIn = 0;
    }

    _baseOut = IMarket(market).redeem(_fTokenIn, _xTokenIn, _call.converter, _minBaseToken);
    require(_baseOut >= _minBaseToken, "insufficient base token");

    _dstOut = _baseOut;
    for (uint256 i = 0; i < _call.routes.length; i++) {
      address _recipient = i == _call.routes.length - 1 ? msg.sender : _call.converter;
      _dstOut = ITokenConverter(_call.converter).convert(_call.routes[i], _dstOut, _recipient);
    }
    require(_dstOut >= _minDstToken, "insufficient dst token");

    if (_fTokenIn > 0) {
      _refund(fToken, msg.sender);
    }
    if (_xTokenIn > 0) {
      _refund(xToken, msg.sender);
    }
  }

  /// @notice Swap between fToken and xToken
  /// @param _amountIn The amount of input token.
  /// @param _fTokenForXToken Whether swap fToken for xToken.
  /// @param _minOut The minimum amount of token should be received.
  /// @return _amountOut The amount of token received.
  function swap(
    uint256 _amountIn,
    bool _fTokenForXToken,
    uint256 _minOut
  ) external returns (uint256 _amountOut) {
    if (_fTokenForXToken) {
      _amountIn = _transferTokenIn(fToken, _amountIn);
      uint256 _baseOut = IMarket(market).redeem(_amountIn, 0, address(this), 0);
      (_amountOut, ) = IMarket(market).mintXToken(_baseOut, msg.sender, 0);
      _refund(fToken, msg.sender);
    } else {
      _amountIn = _transferTokenIn(xToken, _amountIn);
      uint256 _baseOut = IMarket(market).redeem(0, _amountIn, address(this), 0);
      _amountOut = IMarket(market).mintFToken(_baseOut, msg.sender, 0);
      _refund(xToken, msg.sender);
    }
    require(_amountOut >= _minOut, "insufficient output");

    _refund(baseToken, msg.sender);
  }

  // solhint-disable-next-line no-empty-blocks
  receive() external payable {}

  /************************
   * Restricted Functions *
   ************************/

  /// @notice Update the status of a target contract.
  /// @param _target The address of target contract.
  /// @param _status The status to update.
  function updateTargetStatus(address _target, bool _status) external onlyOwner {
    approvedTargets[_target] = _status;
  }

  /// @notice Emergency function
  function execute(
    address _to,
    uint256 _value,
    bytes calldata _data
  ) external payable onlyOwner returns (bool, bytes memory) {
    // solhint-disable-next-line avoid-low-level-calls
    (bool success, bytes memory result) = _to.call{ value: _value }(_data);
    return (success, result);
  }

  /**********************
   * Internal Functions *
   **********************/

  /// @dev Internal function to transfer token to this contract.
  /// @param _token The address of token to transfer.
  /// @param _amount The amount of token to transfer.
  /// @return uint256 The amount of token transfered.
  function _transferTokenIn(address _token, uint256 _amount) internal returns (uint256) {
    if (_token == address(0)) {
      require(msg.value == _amount, "msg.value mismatch");
      return _amount;
    }

    if (_amount == uint256(-1)) {
      _amount = IERC20(_token).balanceOf(msg.sender);
    }

    if (_amount > 0) {
      IERC20(_token).safeTransferFrom(msg.sender, address(this), _amount);
    }

    return _amount;
  }

  /// @dev Internal function to refund extra token.
  /// @param _token The address of token to refund.
  /// @param _recipient The address of the token receiver.
  function _refund(address _token, address _recipient) internal {
    uint256 _balance = IERC20(_token).balanceOf(address(this));

    IERC20(_token).safeTransfer(_recipient, _balance);
  }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.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 () {
        address msgSender = _msgSender();
        _owner = msgSender;
        emit OwnershipTransferred(address(0), 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 {
        emit OwnershipTransferred(_owner, address(0));
        _owner = 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");
        emit OwnershipTransferred(_owner, newOwner);
        _owner = newOwner;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the substraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b > a) return (false, 0);
        return (true, a - b);
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
        // benefit is lost if 'b' is also tested.
        // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
        if (a == 0) return (true, 0);
        uint256 c = a * b;
        if (c / a != b) return (false, 0);
        return (true, c);
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a / b);
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        if (b == 0) return (false, 0);
        return (true, a % b);
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

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

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

import "./IERC20.sol";
import "../../math/SafeMath.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 SafeMath for uint256;
    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'
        // solhint-disable-next-line max-line-length
        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).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _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
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0;

/**
 * @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
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (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");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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 GSN 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 payable) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes memory) {
        this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IMarket {
  /**********
   * Events *
   **********/

  /// @notice Emitted when fToken or xToken is minted.
  /// @param owner The address of base token owner.
  /// @param recipient The address of receiver for fToken or xToken.
  /// @param baseTokenIn The amount of base token deposited.
  /// @param fTokenOut The amount of fToken minted.
  /// @param xTokenOut The amount of xToken minted.
  /// @param mintFee The amount of mint fee charged.
  event Mint(
    address indexed owner,
    address indexed recipient,
    uint256 baseTokenIn,
    uint256 fTokenOut,
    uint256 xTokenOut,
    uint256 mintFee
  );

  /// @notice Emitted when someone redeem base token with fToken or xToken.
  /// @param owner The address of fToken and xToken owner.
  /// @param recipient The address of receiver for base token.
  /// @param fTokenBurned The amount of fToken burned.
  /// @param xTokenBurned The amount of xToken burned.
  /// @param baseTokenOut The amount of base token redeemed.
  /// @param redeemFee The amount of redeem fee charged.
  event Redeem(
    address indexed owner,
    address indexed recipient,
    uint256 fTokenBurned,
    uint256 xTokenBurned,
    uint256 baseTokenOut,
    uint256 redeemFee
  );

  /// @notice Emitted when someone add more base token.
  /// @param owner The address of base token owner.
  /// @param recipient The address of receiver for fToken or xToken.
  /// @param baseTokenIn The amount of base token deposited.
  /// @param xTokenMinted The amount of xToken minted.
  event AddCollateral(address indexed owner, address indexed recipient, uint256 baseTokenIn, uint256 xTokenMinted);

  /// @notice Emitted when someone liquidate with fToken.
  /// @param owner The address of fToken and xToken owner.
  /// @param recipient The address of receiver for base token.
  /// @param fTokenBurned The amount of fToken burned.
  /// @param baseTokenOut The amount of base token redeemed.
  event UserLiquidate(address indexed owner, address indexed recipient, uint256 fTokenBurned, uint256 baseTokenOut);

  /// @notice Emitted when self liquidate with fToken.
  /// @param caller The address of caller.
  /// @param baseSwapAmt The amount of base token used to swap.
  /// @param baseTokenOut The amount of base token redeemed.
  /// @param fTokenBurned The amount of fToken liquidated.
  event SelfLiquidate(address indexed caller, uint256 baseSwapAmt, uint256 baseTokenOut, uint256 fTokenBurned);

  /****************************
   * Public Mutated Functions *
   ****************************/

  /// @notice Mint both fToken and xToken with some base token.
  /// @param baseIn The amount of base token supplied.
  /// @param recipient The address of receiver for fToken and xToken.
  /// @param minFTokenMinted The minimum amount of fToken should be received.
  /// @param minXTokenMinted The minimum amount of xToken should be received.
  /// @return fTokenMinted The amount of fToken should be received.
  /// @return xTokenMinted The amount of xToken should be received.
  function mint(
    uint256 baseIn,
    address recipient,
    uint256 minFTokenMinted,
    uint256 minXTokenMinted
  ) external returns (uint256 fTokenMinted, uint256 xTokenMinted);

  /// @notice Mint some fToken with some base token.
  /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token.
  /// @param recipient The address of receiver for fToken.
  /// @param minFTokenMinted The minimum amount of fToken should be received.
  /// @return fTokenMinted The amount of fToken should be received.
  function mintFToken(
    uint256 baseIn,
    address recipient,
    uint256 minFTokenMinted
  ) external returns (uint256 fTokenMinted);

  /// @notice Mint some xToken with some base token.
  /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token.
  /// @param recipient The address of receiver for xToken.
  /// @param minXTokenMinted The minimum amount of xToken should be received.
  /// @return xTokenMinted The amount of xToken should be received.
  /// @return bonus The amount of base token as bonus.
  function mintXToken(
    uint256 baseIn,
    address recipient,
    uint256 minXTokenMinted
  ) external returns (uint256 xTokenMinted, uint256 bonus);

  /// @notice Mint some xToken by add some base token as collateral.
  /// @param baseIn The amount of base token supplied, use `uint256(-1)` to supply all base token.
  /// @param recipient The address of receiver for xToken.
  /// @param minXTokenMinted The minimum amount of xToken should be received.
  /// @return xTokenMinted The amount of xToken should be received.
  function addBaseToken(
    uint256 baseIn,
    address recipient,
    uint256 minXTokenMinted
  ) external returns (uint256 xTokenMinted);

  /// @notice Redeem base token with fToken and xToken.
  /// @param fTokenIn the amount of fToken to redeem, use `uint256(-1)` to redeem all fToken.
  /// @param xTokenIn the amount of xToken to redeem, use `uint256(-1)` to redeem all xToken.
  /// @param recipient The address of receiver for base token.
  /// @param minBaseOut The minimum amount of base token should be received.
  /// @return baseOut The amount of base token should be received.
  function redeem(
    uint256 fTokenIn,
    uint256 xTokenIn,
    address recipient,
    uint256 minBaseOut
  ) external returns (uint256 baseOut);

  /// @notice Permissionless liquidate some fToken to increase the collateral ratio.
  /// @param fTokenIn the amount of fToken to supply, use `uint256(-1)` to liquidate all fToken.
  /// @param recipient The address of receiver for base token.
  /// @param minBaseOut The minimum amount of base token should be received.
  /// @return baseOut The amount of base token should be received.
  function liquidate(
    uint256 fTokenIn,
    address recipient,
    uint256 minBaseOut
  ) external returns (uint256 baseOut);
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface ITokenConverter {
  /*************************
   * Public View Functions *
   *************************/

  /// @notice The address of Converter Registry.
  function registry() external view returns (address);

  /// @notice Return the input token and output token for the route.
  /// @param route The encoding of the route.
  /// @return tokenIn The address of input token.
  /// @return tokenOut The address of output token.
  function getTokenPair(uint256 route) external view returns (address tokenIn, address tokenOut);

  /// @notice Query the output token amount according to the encoding.
  ///
  /// @dev See the comments in `convert` for the meaning of encoding.
  ///
  /// @param encoding The encoding used to convert.
  /// @param amountIn The amount of input token.
  /// @param amountOut The amount of output token received.
  function queryConvert(uint256 encoding, uint256 amountIn) external view returns (uint256 amountOut);

  /****************************
   * Public Mutated Functions *
   ****************************/

  /// @notice Convert input token to output token according to the encoding.
  /// Assuming that the input token is already in the contract.
  ///
  /// @dev encoding for single route
  /// |   8 bits  | 2 bits |  246 bits  |
  /// | pool_type | action | customized |
  ///
  /// + pool_type = 0: UniswapV2, only action = 0
  ///   customized = |   160 bits   | 24 bits |     1 bit    | 1 bit | ... |
  ///                | pool address | fee_num | zero_for_one | twamm | ... |
  /// + pool_type = 1: UniswapV3, only action = 0
  ///   customized = |   160 bits   | 24 bits |     1 bit    | ... |
  ///                | pool address | fee_num | zero_for_one | ... |
  /// + pool_type = 2: BalancerV1, only action = 0
  ///   customized = |   160 bits   | 3 bits |  3 bits  |   3 bits  | ... |
  ///                | pool address | tokens | index in | index out | ... |
  /// + pool_type = 3: BalancerV2, only action = 0
  ///   customized = |   160 bits   | 3 bits |  3 bits  |   3 bits  | ... |
  ///                | pool address | tokens | index in | index out | ... |
  /// + pool_type = 4: CurvePlainPool or CurveFactoryPlainPool
  ///   customized = |   160 bits   | 3 bits |  3 bits  |   3 bits  |  1 bit  | ... |
  ///                | pool address | tokens | index in | index out | use_eth | ... |
  /// + pool_type = 5: CurveAPool
  ///   customized = |   160 bits   | 3 bits |  3 bits  |   3 bits  |     1 bits     | ... |
  ///                | pool address | tokens | index in | index out | use_underlying | ... |
  /// + pool_type = 6: CurveYPool
  ///   customized = |   160 bits   | 3 bits |  3 bits  |   3 bits  |     1 bits     | ... |
  ///                | pool address | tokens | index in | index out | use_underlying | ... |
  /// + pool_type = 7: CurveMetaPool or CurveFactoryMetaPool
  ///   customized = |   160 bits   | 3 bits |  3 bits  |   3 bits  | ... |
  ///                | pool address | tokens | index in | index out | ... |
  /// + pool_type = 8: CurveCryptoPool or CurveFactoryCryptoPool
  ///   customized = |   160 bits   | 3 bits |  3 bits  |   3 bits  |  1 bit  | ... |
  ///                | pool address | tokens | index in | index out | use_eth | ... |
  /// + pool_type = 9: ERC4626
  ///   customized = |   160 bits   | ... |
  ///                | pool address | ... |
  ///
  /// Note: tokens + 1 is the number of tokens of the pool
  ///
  /// + action = 0: swap
  /// + action = 1: add liquidity / wrap / stake
  /// + action = 2: remove liquidity / unwrap / unstake
  ///
  /// @param encoding The encoding used to convert.
  /// @param amountIn The amount of input token.
  /// @param recipient The address of token receiver.
  /// @return amountOut The amount of output token received.
  function convert(
    uint256 encoding,
    uint256 amountIn,
    address recipient
  ) external payable returns (uint256 amountOut);

  /// @notice Withdraw dust assets in this contract.
  /// @param token The address of token to withdraw.
  /// @param recipient The address of token receiver.
  function withdrawFund(address token, address recipient) external;
}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_market","type":"address"},{"internalType":"address","name":"_baseToken","type":"address"},{"internalType":"address","name":"_fToken","type":"address"},{"internalType":"address","name":"_xToken","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"components":[{"internalType":"address","name":"src","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct FxGateway.ZapInCall","name":"_call","type":"tuple"},{"internalType":"uint256","name":"_minXTokenMinted","type":"uint256"}],"name":"addBaseToken","outputs":[{"internalType":"uint256","name":"_xTokenMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedTargets","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"execute","outputs":[{"internalType":"bool","name":"","type":"bool"},{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"market","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"src","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct FxGateway.ZapInCall","name":"_call","type":"tuple"},{"internalType":"uint256","name":"_minFTokenMinted","type":"uint256"}],"name":"mintFToken","outputs":[{"internalType":"uint256","name":"_fTokenMinted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"src","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct FxGateway.ZapInCall","name":"_call","type":"tuple"},{"internalType":"uint256","name":"_minXTokenMinted","type":"uint256"}],"name":"mintXToken","outputs":[{"internalType":"uint256","name":"_xTokenMinted","type":"uint256"},{"internalType":"uint256","name":"_bonus","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"converter","type":"address"},{"internalType":"uint256[]","name":"routes","type":"uint256[]"}],"internalType":"struct FxGateway.ZapOutCall","name":"_call","type":"tuple"},{"internalType":"uint256","name":"_fTokenIn","type":"uint256"},{"internalType":"uint256","name":"_xTokenIn","type":"uint256"},{"internalType":"uint256","name":"_minBaseToken","type":"uint256"},{"internalType":"uint256","name":"_minDstToken","type":"uint256"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"_baseOut","type":"uint256"},{"internalType":"uint256","name":"_dstOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"bool","name":"_fTokenForXToken","type":"bool"},{"internalType":"uint256","name":"_minOut","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_target","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"updateTargetStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101006040523480156200001257600080fd5b506040516200294b3803806200294b833981016040819052620000359162000565565b60006200004162000133565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350606083811b6001600160601b031990811660805283821b811660a05282821b811660c0529085901b1660e052620000db6001600160a01b0384168560001962000137602090811b6200157517901c565b6200010284600019846001600160a01b03166200013760201b62001575179092919060201c565b6200012984600019836001600160a01b03166200013760201b62001575179092919060201c565b50505050620005c1565b3390565b801580620001c1575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156200019157600080fd5b505afa158015620001a6573d6000803e3d6000fd5b505050506040513d6020811015620001bd57600080fd5b5051155b620001fe5760405162461bcd60e51b8152600401808060200182810382526036815260200180620029156036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620002569185916200025b16565b505050565b6000620002b7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200031760201b6200168d179092919060201c565b8051909150156200025657808060200190516020811015620002d857600080fd5b5051620002565760405162461bcd60e51b815260040180806020018281038252602a815260200180620028eb602a913960400191505060405180910390fd5b606062000328848460008562000332565b90505b9392505050565b606082471015620003755760405162461bcd60e51b8152600401808060200182810382526026815260200180620028c56026913960400191505060405180910390fd5b620003808562000499565b620003d2576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310620004125780518252601f199092019160209182019101620003f1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811462000476576040519150601f19603f3d011682016040523d82523d6000602084013e6200047b565b606091505b5090925090506200048e828286620004a3565b979650505050505050565b803b15155b919050565b60608315620004b45750816200032b565b825115620004c55782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562000511578181015183820152602001620004f7565b50505050905090810190601f1680156200053f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80516001600160a01b03811681146200049e57600080fd5b600080600080608085870312156200057b578384fd5b62000586856200054d565b935062000596602086016200054d565b9250620005a6604086016200054d565b9150620005b6606086016200054d565b905092959194509250565b60805160601c60a05160601c60c05160601c60e05160601c6122546200067160003980610524528061061c52806106da52806107c852806108865280610ac65280610d835280610fee528061143a5250806102b2528061079d52806109195280610a815280610ca65250806105f1528061076d5280610a505280610c7652806110d752508061048552806105b652806109655280610f4f528061108252806111d1528061139b52506122546000f3fe6080604052600436106100ec5760003560e01c80638376ae3e1161008a578063b61d27f611610059578063b61d27f614610247578063c55dae6314610268578063ef7b25d61461027d578063f2fde38b14610290576100f3565b80638376ae3e146101dd5780638da5cb5b146101f05780639779d1a614610205578063a8694e5714610232576100f3565b806344db91bc116100c657806344db91bc146101635780636d7a52e214610185578063715018a6146101b357806380f55605146101c8576100f3565b8063088b699e146100f8578063177fea3c146101235780634312ae3114610143576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d6102b0565b60405161011a9190611f1e565b60405180910390f35b610136610131366004611c81565b6102d4565b60405161011a91906120ad565b34801561014f57600080fd5b5061013661015e366004611e9b565b6105e4565b34801561016f57600080fd5b5061018361017e366004611bcd565b610991565b005b34801561019157600080fd5b506101a56101a0366004611d77565b610a1e565b60405161011a9291906120d5565b3480156101bf57600080fd5b50610183610cd5565b3480156101d457600080fd5b5061010d610d81565b6101a56101eb366004611c81565b610da5565b3480156101fc57600080fd5b5061010d6110b1565b34801561021157600080fd5b50610225610220366004611bb3565b6110c0565b60405161011a9190611f32565b34801561023e57600080fd5b5061010d6110d5565b61025a610255366004611bff565b6110f9565b60405161011a929190611f3d565b34801561027457600080fd5b5061010d6111cf565b61013661028b366004611c81565b6111f3565b34801561029c57600080fd5b506101836102ab366004611bb3565b611473565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040808301516001600160a01b03166000908152600160205290812054839060ff1661031b5760405162461bcd60e51b81526004016103129061205d565b60405180910390fd5b61032d816000015182602001516116a4565b5080516000906001600160a01b03166103b25781604001516001600160a01b0316826020015183606001516040516103659190611f02565b60006040518083038185875af1925050503d80600081146103a2576040519150601f19603f3d011682016040523d82523d6000602084013e6103a7565b606091505b505080915050610459565b604082015182516103d0916001600160a01b03909116906000611575565b6040820151602083015183516103f1926001600160a01b0390911691611575565b81604001516001600160a01b031682606001516040516104119190611f02565b6000604051808303816000865af19150503d806000811461044e576040519150601f19603f3d011682016040523d82523d6000602084013e610453565b606091505b50909150505b8061046b576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906104ba903090600401611f1e565b60206040518083038186803b1580156104d257600080fd5b505afa1580156104e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050a9190611e83565b604051630c26a4ed60e41b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c26a4ed09061055d90849033908a906004016120b6565b602060405180830381600087803b15801561057757600080fd5b505af115801561058b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105af9190611e83565b93506105db7f000000000000000000000000000000000000000000000000000000000000000033611787565b50505092915050565b60008215610798576106167f0000000000000000000000000000000000000000000000000000000000000000856116a4565b935060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663694a7ce78660003060006040518563ffffffff1660e01b815260040161066e9493929190611f79565b602060405180830381600087803b15801561068857600080fd5b505af115801561069c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c09190611e83565b60405163b556747360e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b55674739061071490849033906000906004016120b6565b6040805180830381600087803b15801561072d57600080fd5b505af1158015610741573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107659190611ecf565b5091506107927f000000000000000000000000000000000000000000000000000000000000000033611787565b50610940565b6107c27f0000000000000000000000000000000000000000000000000000000000000000856116a4565b935060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663694a7ce76000873060006040518563ffffffff1660e01b815260040161081a9493929190611f79565b602060405180830381600087803b15801561083457600080fd5b505af1158015610848573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086c9190611e83565b6040516364c9b4c360e01b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906364c9b4c3906108c090849033906000906004016120b6565b602060405180830381600087803b1580156108da57600080fd5b505af11580156108ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109129190611e83565b915061093e7f000000000000000000000000000000000000000000000000000000000000000033611787565b505b818110156109605760405162461bcd60e51b815260040161031290612000565b61098a7f000000000000000000000000000000000000000000000000000000000000000033611787565b9392505050565b61099961181c565b6001600160a01b03166109aa6110b1565b6001600160a01b0316146109f3576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b600080600087602001515111610a465760405162461bcd60e51b81526004016103129061208a565b84610a7c57610a757f0000000000000000000000000000000000000000000000000000000000000000876116a4565b9550610aad565b610aa67f0000000000000000000000000000000000000000000000000000000000000000866116a4565b9450600095505b865160405163694a7ce760e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163694a7ce791610b00918a918a91908a90600401611f79565b602060405180830381600087803b158015610b1a57600080fd5b505af1158015610b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b529190611e83565b915083821015610b745760405162461bcd60e51b815260040161031290611fc9565b508060005b876020015151811015610c4a5760006001896020015151038214610b9e578851610ba0565b335b905088600001516001600160a01b031663392f084f8a602001518481518110610bc557fe5b602002602001015185846040518463ffffffff1660e01b8152600401610bed939291906120e3565b602060405180830381600087803b158015610c0757600080fd5b505af1158015610c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3f9190611e83565b925050600101610b79565b5082811015610c6b5760405162461bcd60e51b81526004016103129061202d565b8515610c9b57610c9b7f000000000000000000000000000000000000000000000000000000000000000033611787565b8415610ccb57610ccb7f000000000000000000000000000000000000000000000000000000000000000033611787565b9550959350505050565b610cdd61181c565b6001600160a01b0316610cee6110b1565b6001600160a01b031614610d37576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040808301516001600160a01b031660009081526001602052908120548190849060ff16610de55760405162461bcd60e51b81526004016103129061205d565b610df7816000015182602001516116a4565b5080516000906001600160a01b0316610e7c5781604001516001600160a01b031682602001518360600151604051610e2f9190611f02565b60006040518083038185875af1925050503d8060008114610e6c576040519150601f19603f3d011682016040523d82523d6000602084013e610e71565b606091505b505080915050610f23565b60408201518251610e9a916001600160a01b03909116906000611575565b604082015160208301518351610ebb926001600160a01b0390911691611575565b81604001516001600160a01b03168260600151604051610edb9190611f02565b6000604051808303816000865af19150503d8060008114610f18576040519150601f19603f3d011682016040523d82523d6000602084013e610f1d565b606091505b50909150505b80610f35576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190610f84903090600401611f1e565b60206040518083038186803b158015610f9c57600080fd5b505afa158015610fb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd49190611e83565b60405163b556747360e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b55674739061102790849033908b906004016120b6565b6040805180830381600087803b15801561104057600080fd5b505af1158015611054573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110789190611ecf565b90955093506110a77f000000000000000000000000000000000000000000000000000000000000000033611787565b5050509250929050565b6000546001600160a01b031690565b60016020526000908152604090205460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000606061110561181c565b6001600160a01b03166111166110b1565b6001600160a01b03161461115f576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b600080876001600160a01b031687878760405161117d929190611ef2565b60006040518083038185875af1925050503d80600081146111ba576040519150601f19603f3d011682016040523d82523d6000602084013e6111bf565b606091505b5090999098509650505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040808301516001600160a01b03166000908152600160205290812054839060ff166112315760405162461bcd60e51b81526004016103129061205d565b611243816000015182602001516116a4565b5080516000906001600160a01b03166112c85781604001516001600160a01b03168260200151836060015160405161127b9190611f02565b60006040518083038185875af1925050503d80600081146112b8576040519150601f19603f3d011682016040523d82523d6000602084013e6112bd565b606091505b50508091505061136f565b604082015182516112e6916001600160a01b03909116906000611575565b604082015160208301518351611307926001600160a01b0390911691611575565b81604001516001600160a01b031682606001516040516113279190611f02565b6000604051808303816000865af19150503d8060008114611364576040519150601f19603f3d011682016040523d82523d6000602084013e611369565b606091505b50909150505b80611381576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906113d0903090600401611f1e565b60206040518083038186803b1580156113e857600080fd5b505afa1580156113fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114209190611e83565b6040516364c9b4c360e01b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906364c9b4c39061055d90849033908a906004016120b6565b61147b61181c565b6001600160a01b031661148c6110b1565b6001600160a01b0316146114d5576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b6001600160a01b03811661151a5760405162461bcd60e51b81526004018080602001828103825260268152602001806121536026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b8015806115fb575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156115cd57600080fd5b505afa1580156115e1573d6000803e3d6000fd5b505050506040513d60208110156115f757600080fd5b5051155b6116365760405162461bcd60e51b81526004018080602001828103825260368152602001806121e96036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611688908490611820565b505050565b606061169c84846000856118d1565b949350505050565b60006001600160a01b0383166116da578134146116d35760405162461bcd60e51b815260040161031290611f9d565b5080611781565b600019821415611763576040516370a0823160e01b81526001600160a01b038416906370a0823190611710903390600401611f1e565b60206040518083038186803b15801561172857600080fd5b505afa15801561173c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117609190611e83565b91505b811561177e5761177e6001600160a01b038416333085611a2c565b50805b92915050565b6040516370a0823160e01b81526000906001600160a01b038416906370a08231906117b6903090600401611f1e565b60206040518083038186803b1580156117ce57600080fd5b505afa1580156117e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118069190611e83565b90506116886001600160a01b0384168383611a8c565b3390565b6000611875826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661168d9092919063ffffffff16565b8051909150156116885780806020019051602081101561189457600080fd5b50516116885760405162461bcd60e51b815260040180806020018281038252602a8152602001806121bf602a913960400191505060405180910390fd5b6060824710156119125760405162461bcd60e51b81526004018080602001828103825260268152602001806121796026913960400191505060405180910390fd5b61191b85611ade565b61196c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106119aa5780518252601f19909201916020918201910161198b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611a0c576040519150601f19603f3d011682016040523d82523d6000602084013e611a11565b606091505b5091509150611a21828286611ae8565b979650505050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611a86908590611820565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611688908490611820565b803b15155b919050565b60608315611af757508161098a565b825115611b075782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611b51578181015183820152602001611b39565b50505050905090810190601f168015611b7e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80356001600160a01b0381168114611ae357600080fd5b80358015158114611ae357600080fd5b600060208284031215611bc4578081fd5b61098a82611b8c565b60008060408385031215611bdf578081fd5b611be883611b8c565b9150611bf660208401611ba3565b90509250929050565b60008060008060608587031215611c14578182fd5b611c1d85611b8c565b935060208501359250604085013567ffffffffffffffff80821115611c40578384fd5b818701915087601f830112611c53578384fd5b813581811115611c61578485fd5b886020828501011115611c72578485fd5b95989497505060200194505050565b60008060408385031215611c93578182fd5b823567ffffffffffffffff80821115611caa578384fd5b9084019060808287031215611cbd578384fd5b604051608081018181108382111715611cd257fe5b604052611cde83611b8c565b815260208084013581830152611cf660408501611b8c565b6040830152606084013583811115611d0c578687fd5b80850194505087601f850112611d20578586fd5b833583811115611d2c57fe5b611d3e601f8201601f19168301612102565b93508084528882828701011115611d53578687fd5b80828601838601378301810195909552606081019190915295939092013593505050565b600080600080600060a08688031215611d8e578081fd5b853567ffffffffffffffff80821115611da5578283fd5b908701906040828a031215611db8578283fd5b604051604081018181108382111715611dcd57fe5b604052611dd983611b8c565b815260208084013583811115611ded578586fd5b8085019450508a601f850112611e01578485fd5b833583811115611e0d57fe5b8181029350611e1d828501612102565b8181528281019086840186880185018f1015611e37578889fd5b8897505b83881015611e59578035835260019790970196918401918401611e3b565b508484015250919b908a01359a5060408a0135996060810135995060800135975095505050505050565b600060208284031215611e94578081fd5b5051919050565b600080600060608486031215611eaf578283fd5b83359250611ebf60208501611ba3565b9150604084013590509250925092565b60008060408385031215611ee1578182fd5b505080516020909101519092909150565b6000828483379101908152919050565b60008251611f14818460208701612126565b9190910192915050565b6001600160a01b0391909116815260200190565b901515815260200190565b60008315158252604060208301528251806040840152611f64816060850160208701612126565b601f01601f1916919091016060019392505050565b93845260208401929092526001600160a01b03166040830152606082015260800190565b6020808252601290820152710dae6ce5cecc2d8eaca40dad2e6dac2e8c6d60731b604082015260600190565b60208082526017908201527f696e73756666696369656e74206261736520746f6b656e000000000000000000604082015260600190565b6020808252601390820152721a5b9cdd59999a58da595b9d081bdd5d1c1d5d606a1b604082015260600190565b60208082526016908201527534b739bab33334b1b4b2b73a103239ba103a37b5b2b760511b604082015260600190565b6020808252601390820152721d185c99d95d081b9bdd08185c1c1c9bdd9959606a1b604082015260600190565b6020808252600990820152686e6f20726f7574657360b81b604082015260600190565b90815260200190565b9283526001600160a01b03919091166020830152604082015260600190565b918252602082015260400190565b92835260208301919091526001600160a01b0316604082015260600190565b60405181810167ffffffffffffffff8111828210171561211e57fe5b604052919050565b60005b83811015612141578181015183820152602001612129565b83811115611a86575050600091015256fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220f7258fddd4bb3dac421fa81198521eaf1593edf7ddade65952128fc8c9a7226264736f6c63430007060033416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8400000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2

Deployed Bytecode

0x6080604052600436106100ec5760003560e01c80638376ae3e1161008a578063b61d27f611610059578063b61d27f614610247578063c55dae6314610268578063ef7b25d61461027d578063f2fde38b14610290576100f3565b80638376ae3e146101dd5780638da5cb5b146101f05780639779d1a614610205578063a8694e5714610232576100f3565b806344db91bc116100c657806344db91bc146101635780636d7a52e214610185578063715018a6146101b357806380f55605146101c8576100f3565b8063088b699e146100f8578063177fea3c146101235780634312ae3114610143576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d6102b0565b60405161011a9190611f1e565b60405180910390f35b610136610131366004611c81565b6102d4565b60405161011a91906120ad565b34801561014f57600080fd5b5061013661015e366004611e9b565b6105e4565b34801561016f57600080fd5b5061018361017e366004611bcd565b610991565b005b34801561019157600080fd5b506101a56101a0366004611d77565b610a1e565b60405161011a9291906120d5565b3480156101bf57600080fd5b50610183610cd5565b3480156101d457600080fd5b5061010d610d81565b6101a56101eb366004611c81565b610da5565b3480156101fc57600080fd5b5061010d6110b1565b34801561021157600080fd5b50610225610220366004611bb3565b6110c0565b60405161011a9190611f32565b34801561023e57600080fd5b5061010d6110d5565b61025a610255366004611bff565b6110f9565b60405161011a929190611f3d565b34801561027457600080fd5b5061010d6111cf565b61013661028b366004611c81565b6111f3565b34801561029c57600080fd5b506101836102ab366004611bb3565b611473565b7f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae281565b6040808301516001600160a01b03166000908152600160205290812054839060ff1661031b5760405162461bcd60e51b81526004016103129061205d565b60405180910390fd5b61032d816000015182602001516116a4565b5080516000906001600160a01b03166103b25781604001516001600160a01b0316826020015183606001516040516103659190611f02565b60006040518083038185875af1925050503d80600081146103a2576040519150601f19603f3d011682016040523d82523d6000602084013e6103a7565b606091505b505080915050610459565b604082015182516103d0916001600160a01b03909116906000611575565b6040820151602083015183516103f1926001600160a01b0390911691611575565b81604001516001600160a01b031682606001516040516104119190611f02565b6000604051808303816000865af19150503d806000811461044e576040519150601f19603f3d011682016040523d82523d6000602084013e610453565b606091505b50909150505b8061046b576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a08231906104ba903090600401611f1e565b60206040518083038186803b1580156104d257600080fd5b505afa1580156104e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050a9190611e83565b604051630c26a4ed60e41b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169063c26a4ed09061055d90849033908a906004016120b6565b602060405180830381600087803b15801561057757600080fd5b505af115801561058b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105af9190611e83565b93506105db7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8433611787565b50505092915050565b60008215610798576106167f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726856116a4565b935060007f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db6001600160a01b031663694a7ce78660003060006040518563ffffffff1660e01b815260040161066e9493929190611f79565b602060405180830381600087803b15801561068857600080fd5b505af115801561069c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c09190611e83565b60405163b556747360e01b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169063b55674739061071490849033906000906004016120b6565b6040805180830381600087803b15801561072d57600080fd5b505af1158015610741573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107659190611ecf565b5091506107927f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372633611787565b50610940565b6107c27f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2856116a4565b935060007f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db6001600160a01b031663694a7ce76000873060006040518563ffffffff1660e01b815260040161081a9493929190611f79565b602060405180830381600087803b15801561083457600080fd5b505af1158015610848573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086c9190611e83565b6040516364c9b4c360e01b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db16906364c9b4c3906108c090849033906000906004016120b6565b602060405180830381600087803b1580156108da57600080fd5b505af11580156108ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109129190611e83565b915061093e7f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae233611787565b505b818110156109605760405162461bcd60e51b815260040161031290612000565b61098a7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8433611787565b9392505050565b61099961181c565b6001600160a01b03166109aa6110b1565b6001600160a01b0316146109f3576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b600080600087602001515111610a465760405162461bcd60e51b81526004016103129061208a565b84610a7c57610a757f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726876116a4565b9550610aad565b610aa67f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2866116a4565b9450600095505b865160405163694a7ce760e01b81526001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169163694a7ce791610b00918a918a91908a90600401611f79565b602060405180830381600087803b158015610b1a57600080fd5b505af1158015610b2e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b529190611e83565b915083821015610b745760405162461bcd60e51b815260040161031290611fc9565b508060005b876020015151811015610c4a5760006001896020015151038214610b9e578851610ba0565b335b905088600001516001600160a01b031663392f084f8a602001518481518110610bc557fe5b602002602001015185846040518463ffffffff1660e01b8152600401610bed939291906120e3565b602060405180830381600087803b158015610c0757600080fd5b505af1158015610c1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3f9190611e83565b925050600101610b79565b5082811015610c6b5760405162461bcd60e51b81526004016103129061202d565b8515610c9b57610c9b7f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372633611787565b8415610ccb57610ccb7f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae233611787565b9550959350505050565b610cdd61181c565b6001600160a01b0316610cee6110b1565b6001600160a01b031614610d37576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db81565b6040808301516001600160a01b031660009081526001602052908120548190849060ff16610de55760405162461bcd60e51b81526004016103129061205d565b610df7816000015182602001516116a4565b5080516000906001600160a01b0316610e7c5781604001516001600160a01b031682602001518360600151604051610e2f9190611f02565b60006040518083038185875af1925050503d8060008114610e6c576040519150601f19603f3d011682016040523d82523d6000602084013e610e71565b606091505b505080915050610f23565b60408201518251610e9a916001600160a01b03909116906000611575565b604082015160208301518351610ebb926001600160a01b0390911691611575565b81604001516001600160a01b03168260600151604051610edb9190611f02565b6000604051808303816000865af19150503d8060008114610f18576040519150601f19603f3d011682016040523d82523d6000602084013e610f1d565b606091505b50909150505b80610f35576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a0823190610f84903090600401611f1e565b60206040518083038186803b158015610f9c57600080fd5b505afa158015610fb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd49190611e83565b60405163b556747360e01b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169063b55674739061102790849033908b906004016120b6565b6040805180830381600087803b15801561104057600080fd5b505af1158015611054573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110789190611ecf565b90955093506110a77f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8433611787565b5050509250929050565b6000546001600160a01b031690565b60016020526000908152604090205460ff1681565b7f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372681565b6000606061110561181c565b6001600160a01b03166111166110b1565b6001600160a01b03161461115f576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b600080876001600160a01b031687878760405161117d929190611ef2565b60006040518083038185875af1925050503d80600081146111ba576040519150601f19603f3d011682016040523d82523d6000602084013e6111bf565b606091505b5090999098509650505050505050565b7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b6040808301516001600160a01b03166000908152600160205290812054839060ff166112315760405162461bcd60e51b81526004016103129061205d565b611243816000015182602001516116a4565b5080516000906001600160a01b03166112c85781604001516001600160a01b03168260200151836060015160405161127b9190611f02565b60006040518083038185875af1925050503d80600081146112b8576040519150601f19603f3d011682016040523d82523d6000602084013e6112bd565b606091505b50508091505061136f565b604082015182516112e6916001600160a01b03909116906000611575565b604082015160208301518351611307926001600160a01b0390911691611575565b81604001516001600160a01b031682606001516040516113279190611f02565b6000604051808303816000865af19150503d8060008114611364576040519150601f19603f3d011682016040523d82523d6000602084013e611369565b606091505b50909150505b80611381576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a08231906113d0903090600401611f1e565b60206040518083038186803b1580156113e857600080fd5b505afa1580156113fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114209190611e83565b6040516364c9b4c360e01b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db16906364c9b4c39061055d90849033908a906004016120b6565b61147b61181c565b6001600160a01b031661148c6110b1565b6001600160a01b0316146114d5576040805162461bcd60e51b8152602060048201819052602482015260008051602061219f833981519152604482015290519081900360640190fd5b6001600160a01b03811661151a5760405162461bcd60e51b81526004018080602001828103825260268152602001806121536026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b8015806115fb575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156115cd57600080fd5b505afa1580156115e1573d6000803e3d6000fd5b505050506040513d60208110156115f757600080fd5b5051155b6116365760405162461bcd60e51b81526004018080602001828103825260368152602001806121e96036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052611688908490611820565b505050565b606061169c84846000856118d1565b949350505050565b60006001600160a01b0383166116da578134146116d35760405162461bcd60e51b815260040161031290611f9d565b5080611781565b600019821415611763576040516370a0823160e01b81526001600160a01b038416906370a0823190611710903390600401611f1e565b60206040518083038186803b15801561172857600080fd5b505afa15801561173c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117609190611e83565b91505b811561177e5761177e6001600160a01b038416333085611a2c565b50805b92915050565b6040516370a0823160e01b81526000906001600160a01b038416906370a08231906117b6903090600401611f1e565b60206040518083038186803b1580156117ce57600080fd5b505afa1580156117e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118069190611e83565b90506116886001600160a01b0384168383611a8c565b3390565b6000611875826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661168d9092919063ffffffff16565b8051909150156116885780806020019051602081101561189457600080fd5b50516116885760405162461bcd60e51b815260040180806020018281038252602a8152602001806121bf602a913960400191505060405180910390fd5b6060824710156119125760405162461bcd60e51b81526004018080602001828103825260268152602001806121796026913960400191505060405180910390fd5b61191b85611ade565b61196c576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106119aa5780518252601f19909201916020918201910161198b565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611a0c576040519150601f19603f3d011682016040523d82523d6000602084013e611a11565b606091505b5091509150611a21828286611ae8565b979650505050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611a86908590611820565b50505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611688908490611820565b803b15155b919050565b60608315611af757508161098a565b825115611b075782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611b51578181015183820152602001611b39565b50505050905090810190601f168015611b7e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80356001600160a01b0381168114611ae357600080fd5b80358015158114611ae357600080fd5b600060208284031215611bc4578081fd5b61098a82611b8c565b60008060408385031215611bdf578081fd5b611be883611b8c565b9150611bf660208401611ba3565b90509250929050565b60008060008060608587031215611c14578182fd5b611c1d85611b8c565b935060208501359250604085013567ffffffffffffffff80821115611c40578384fd5b818701915087601f830112611c53578384fd5b813581811115611c61578485fd5b886020828501011115611c72578485fd5b95989497505060200194505050565b60008060408385031215611c93578182fd5b823567ffffffffffffffff80821115611caa578384fd5b9084019060808287031215611cbd578384fd5b604051608081018181108382111715611cd257fe5b604052611cde83611b8c565b815260208084013581830152611cf660408501611b8c565b6040830152606084013583811115611d0c578687fd5b80850194505087601f850112611d20578586fd5b833583811115611d2c57fe5b611d3e601f8201601f19168301612102565b93508084528882828701011115611d53578687fd5b80828601838601378301810195909552606081019190915295939092013593505050565b600080600080600060a08688031215611d8e578081fd5b853567ffffffffffffffff80821115611da5578283fd5b908701906040828a031215611db8578283fd5b604051604081018181108382111715611dcd57fe5b604052611dd983611b8c565b815260208084013583811115611ded578586fd5b8085019450508a601f850112611e01578485fd5b833583811115611e0d57fe5b8181029350611e1d828501612102565b8181528281019086840186880185018f1015611e37578889fd5b8897505b83881015611e59578035835260019790970196918401918401611e3b565b508484015250919b908a01359a5060408a0135996060810135995060800135975095505050505050565b600060208284031215611e94578081fd5b5051919050565b600080600060608486031215611eaf578283fd5b83359250611ebf60208501611ba3565b9150604084013590509250925092565b60008060408385031215611ee1578182fd5b505080516020909101519092909150565b6000828483379101908152919050565b60008251611f14818460208701612126565b9190910192915050565b6001600160a01b0391909116815260200190565b901515815260200190565b60008315158252604060208301528251806040840152611f64816060850160208701612126565b601f01601f1916919091016060019392505050565b93845260208401929092526001600160a01b03166040830152606082015260800190565b6020808252601290820152710dae6ce5cecc2d8eaca40dad2e6dac2e8c6d60731b604082015260600190565b60208082526017908201527f696e73756666696369656e74206261736520746f6b656e000000000000000000604082015260600190565b6020808252601390820152721a5b9cdd59999a58da595b9d081bdd5d1c1d5d606a1b604082015260600190565b60208082526016908201527534b739bab33334b1b4b2b73a103239ba103a37b5b2b760511b604082015260600190565b6020808252601390820152721d185c99d95d081b9bdd08185c1c1c9bdd9959606a1b604082015260600190565b6020808252600990820152686e6f20726f7574657360b81b604082015260600190565b90815260200190565b9283526001600160a01b03919091166020830152604082015260600190565b918252602082015260400190565b92835260208301919091526001600160a01b0316604082015260600190565b60405181810167ffffffffffffffff8111828210171561211e57fe5b604052919050565b60005b83811015612141578181015183820152602001612129565b83811115611a86575050600091015256fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220f7258fddd4bb3dac421fa81198521eaf1593edf7ddade65952128fc8c9a7226264736f6c63430007060033

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

000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8400000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2

-----Decoded View---------------
Arg [0] : _market (address): 0xe7b9c7c9cA85340b8c06fb805f7775e3015108dB
Arg [1] : _baseToken (address): 0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84
Arg [2] : _fToken (address): 0x53805A76E1f5ebbFE7115F16f9c87C2f7e633726
Arg [3] : _xToken (address): 0xe063F04f280c60aECa68b38341C2eEcBeC703ae2

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db
Arg [1] : 000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe84
Arg [2] : 00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726
Arg [3] : 000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.