ETH Price: $3,444.72 (-0.04%)
Gas: 2 Gwei

Contract

0x5c28b966aB37cFB9397bBc04595f91F0fBf06d9b
 
Transaction Hash
Method
Block
From
To
Redeem203716232024-07-23 20:28:239 hrs ago1721766503IN
0x5c28b966...0fBf06d9b
0 ETH0.002121794.21720276
Mint F Token203709912024-07-23 18:21:3511 hrs ago1721758895IN
0x5c28b966...0fBf06d9b
3 ETH0.00409357.71465199
Mint X Token203609152024-07-22 8:35:5945 hrs ago1721637359IN
0x5c28b966...0fBf06d9b
3.03 ETH0.002827065.85310256
Mint F Token203551802024-07-21 13:21:592 days ago1721568119IN
0x5c28b966...0fBf06d9b
0.15 ETH0.001258422.46063479
Redeem203536672024-07-21 8:18:112 days ago1721549891IN
0x5c28b966...0fBf06d9b
0 ETH0.001209262.25771075
Mint F Token203518742024-07-21 2:18:113 days ago1721528291IN
0x5c28b966...0fBf06d9b
5 ETH0.001260622.37257435
Redeem203504912024-07-20 21:41:113 days ago1721511671IN
0x5c28b966...0fBf06d9b
0 ETH0.002415143.5606256
Mint F Token203456212024-07-20 5:21:594 days ago1721452919IN
0x5c28b966...0fBf06d9b
2.6541 ETH0.001322132.48810814
Mint F Token203455152024-07-20 5:00:474 days ago1721451647IN
0x5c28b966...0fBf06d9b
2.3 ETH0.001224892.39503919
Mint F Token203443352024-07-20 1:02:594 days ago1721437379IN
0x5c28b966...0fBf06d9b
0.4 ETH0.001947833.6823687
Mint X Token203391852024-07-19 7:49:114 days ago1721375351IN
0x5c28b966...0fBf06d9b
0 ETH0.004196576.14510295
Mint F Token203205692024-07-16 17:28:477 days ago1721150927IN
0x5c28b966...0fBf06d9b
100 ETH0.006709113.63650403
Mint F Token203199562024-07-16 15:26:117 days ago1721143571IN
0x5c28b966...0fBf06d9b
0.00000005 ETH0.0178859816.63038994
Redeem202939582024-07-13 0:17:5911 days ago1720829879IN
0x5c28b966...0fBf06d9b
0 ETH0.001304711.8836642
Redeem202936352024-07-12 23:13:2311 days ago1720826003IN
0x5c28b966...0fBf06d9b
0 ETH0.000777631.44983344
Redeem202878232024-07-12 3:44:4712 days ago1720755887IN
0x5c28b966...0fBf06d9b
0 ETH0.001535532.2093614
Redeem202877952024-07-12 3:38:5912 days ago1720755539IN
0x5c28b966...0fBf06d9b
0 ETH0.001957672.41958628
Mint F Token202702322024-07-09 16:48:5914 days ago1720543739IN
0x5c28b966...0fBf06d9b
107.147 ETH0.004250748.54967519
Redeem202626432024-07-08 15:19:4715 days ago1720451987IN
0x5c28b966...0fBf06d9b
0 ETH0.005999487.96129507
Mint F Token202624492024-07-08 14:40:4715 days ago1720449647IN
0x5c28b966...0fBf06d9b
0.00000003 ETH0.0199410316.12116155
Redeem202531702024-07-07 7:33:3516 days ago1720337615IN
0x5c28b966...0fBf06d9b
0 ETH0.001283942.47164428
Redeem202468702024-07-06 10:28:1117 days ago1720261691IN
0x5c28b966...0fBf06d9b
0 ETH0.001424092.13879747
Redeem202468672024-07-06 10:27:3517 days ago1720261655IN
0x5c28b966...0fBf06d9b
0 ETH0.001521891.95948657
Swap202457462024-07-06 6:41:3517 days ago1720248095IN
0x5c28b966...0fBf06d9b
0 ETH0.001720183.15442689
Mint X Token202412262024-07-05 15:33:3518 days ago1720193615IN
0x5c28b966...0fBf06d9b
0 ETH0.0086044812.66026016
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
203709912024-07-23 18:21:3511 hrs ago1721758895
0x5c28b966...0fBf06d9b
3 ETH
203609152024-07-22 8:35:5945 hrs ago1721637359
0x5c28b966...0fBf06d9b
3.03 ETH
203551802024-07-21 13:21:592 days ago1721568119
0x5c28b966...0fBf06d9b
0.15 ETH
203518742024-07-21 2:18:113 days ago1721528291
0x5c28b966...0fBf06d9b
5 ETH
203456212024-07-20 5:21:594 days ago1721452919
0x5c28b966...0fBf06d9b
2.6541 ETH
203455152024-07-20 5:00:474 days ago1721451647
0x5c28b966...0fBf06d9b
2.3 ETH
203443352024-07-20 1:02:594 days ago1721437379
0x5c28b966...0fBf06d9b
0.4 ETH
203205692024-07-16 17:28:477 days ago1721150927
0x5c28b966...0fBf06d9b
100 ETH
202702322024-07-09 16:48:5914 days ago1720543739
0x5c28b966...0fBf06d9b
107.147 ETH
202395862024-07-05 10:03:5918 days ago1720173839
0x5c28b966...0fBf06d9b
0.7 ETH
202310892024-07-04 5:34:1120 days ago1720071251
0x5c28b966...0fBf06d9b
0.5 ETH
202170572024-07-02 6:31:2321 days ago1719901883
0x5c28b966...0fBf06d9b
2.216 ETH
202013372024-06-30 1:51:4724 days ago1719712307
0x5c28b966...0fBf06d9b
41.5 ETH
201929082024-06-28 21:35:4725 days ago1719610547
0x5c28b966...0fBf06d9b
0.02 ETH
201899862024-06-28 11:48:3525 days ago1719575315
0x5c28b966...0fBf06d9b
0.06 ETH
201887132024-06-28 7:32:4725 days ago1719559967
0x5c28b966...0fBf06d9b
1.7 ETH
201836382024-06-27 14:31:2326 days ago1719498683
0x5c28b966...0fBf06d9b
5.5 ETH
201725252024-06-26 1:17:4728 days ago1719364667
0x5c28b966...0fBf06d9b
0.03 ETH
201711842024-06-25 20:48:4728 days ago1719348527
0x5c28b966...0fBf06d9b
0.02 ETH
201697322024-06-25 15:56:2328 days ago1719330983
0x5c28b966...0fBf06d9b
200 ETH
201617722024-06-24 13:14:5929 days ago1719234899
0x5c28b966...0fBf06d9b
0.62 ETH
201613912024-06-24 11:58:1129 days ago1719230291
0x5c28b966...0fBf06d9b
3.68 ETH
201608942024-06-24 10:17:5929 days ago1719224279
0x5c28b966...0fBf06d9b
0.99 ETH
201460462024-06-22 8:26:5931 days ago1719044819
0x5c28b966...0fBf06d9b
11.5 ETH
201458232024-06-22 7:42:2331 days ago1719042143
0x5c28b966...0fBf06d9b
36.1 ETH
View All Internal Transactions
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
File 1 of 9 : FxGateway.sol
// 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 { IFxMarket } from "../interfaces/f(x)/IFxMarket.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 = IFxMarket(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) = IFxMarket(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 = IFxMarket(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.
  /// @return _bonus The amount of bonus base token received.
  function redeem(
    ZapOutCall memory _call,
    uint256 _fTokenIn,
    uint256 _xTokenIn,
    uint256 _minBaseToken,
    uint256 _minDstToken
  )
    external
    returns (
      uint256 _baseOut,
      uint256 _dstOut,
      uint256 _bonus
    )
  {
    require(_call.routes.length > 0, "no routes");

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

    (_baseOut, _bonus) = IFxMarket(market).redeem(_fTokenIn, _xTokenIn, address(this), _minBaseToken);
    require(_baseOut >= _minBaseToken, "insufficient base token");

    _dstOut = _baseOut;
    IERC20(baseToken).safeTransfer(_call.converter, _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);
    }
    if (_bonus > 0) {
      _refund(baseToken, 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.
  /// @return _bonus The amount of bonus token received.
  function swap(
    uint256 _amountIn,
    bool _fTokenForXToken,
    uint256 _minOut
  ) external returns (uint256 _amountOut, uint256 _bonus) {
    if (_fTokenForXToken) {
      _amountIn = _transferTokenIn(fToken, _amountIn);
      (uint256 _baseOut, uint256 _redeemBonus) = IFxMarket(market).redeem(_amountIn, 0, address(this), 0);
      _bonus = _redeemBonus;
      (_amountOut, _redeemBonus) = IFxMarket(market).mintXToken(_baseOut, msg.sender, 0);
      _bonus += _redeemBonus;
      _refund(fToken, msg.sender);
    } else {
      _amountIn = _transferTokenIn(xToken, _amountIn);
      (uint256 _baseOut, uint256 _redeemBonus) = IFxMarket(market).redeem(0, _amountIn, address(this), 0);
      _bonus = _redeemBonus;
      _amountOut = IFxMarket(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);
  }
}

File 2 of 9 : Ownable.sol
// 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;
    }
}

File 3 of 9 : SafeMath.sol
// 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;
    }
}

File 4 of 9 : IERC20.sol
// 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);
}

File 5 of 9 : SafeERC20.sol
// 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");
        }
    }
}

File 6 of 9 : Address.sol
// 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);
            }
        }
    }
}

File 7 of 9 : Context.sol
// 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;
    }
}

File 8 of 9 : ITokenConverter.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

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 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, no action 0
  ///   customized = |   160 bits   | ... |
  ///                | pool address | ... |
  /// + pool_type = 10: Lido, no action 0
  ///   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;
}

File 9 of 9 : IFxMarket.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

interface IFxMarket {
  /**********
   * 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.
  /// @return bonus The amount of base token as bonus.
  function redeem(
    uint256 fTokenIn,
    uint256 xTokenIn,
    address recipient,
    uint256 minBaseOut
  ) external returns (uint256 baseOut, uint256 bonus);

  /// @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);
}

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

Contract Security Audit

Contract ABI

[{"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"},{"internalType":"uint256","name":"_bonus","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"},{"internalType":"uint256","name":"_bonus","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"}]

6101006040523480156200001257600080fd5b50604051620029f5380380620029f5833981016040819052620000359162000565565b60006200004162000133565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350606083811b6001600160601b031990811660805283821b811660a05282821b811660c0529085901b1660e052620000db6001600160a01b0384168560001962000137602090811b6200160117901c565b6200010284600019846001600160a01b03166200013760201b62001601179092919060201c565b6200012984600019836001600160a01b03166200013760201b62001601179092919060201c565b50505050620005c1565b3390565b801580620001c1575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b1580156200019157600080fd5b505afa158015620001a6573d6000803e3d6000fd5b505050506040513d6020811015620001bd57600080fd5b5051155b620001fe5760405162461bcd60e51b8152600401808060200182810382526036815260200180620029bf6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b0390811663095ea7b360e01b17909152620002569185916200025b16565b505050565b6000620002b7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166200031760201b62001719179092919060201c565b8051909150156200025657808060200190516020811015620002d857600080fd5b5051620002565760405162461bcd60e51b815260040180806020018281038252602a81526020018062002995602a913960400191505060405180910390fd5b606062000328848460008562000332565b90505b9392505050565b606082471015620003755760405162461bcd60e51b81526004018080602001828103825260268152602001806200296f6026913960400191505060405180910390fd5b620003808562000499565b620003d2576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310620004125780518252601f199092019160209182019101620003f1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d806000811462000476576040519150601f19603f3d011682016040523d82523d6000602084013e6200047b565b606091505b5090925090506200048e828286620004a3565b979650505050505050565b803b15155b919050565b60608315620004b45750816200032b565b825115620004c55782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101562000511578181015183820152602001620004f7565b50505050905090810190601f1680156200053f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80516001600160a01b03811681146200049e57600080fd5b600080600080608085870312156200057b578384fd5b62000586856200054d565b935062000596602086016200054d565b9250620005a6604086016200054d565b9150620005b6606086016200054d565b905092959194509250565b60805160601c60a05160601c60c05160601c60e05160601c6122f46200067b60003980610533528061062d52806106d952806107e452806108905280610ae65280610e0f528061107a52806114c65250806102c152806107b852806109385280610aa35280610d0152508061060152806107875280610a725280610cd1528061116352508061049452806105c552806109855280610baa5280610d315280610fdb528061110e528061125d528061142752506122f46000f3fe6080604052600436106100ec5760003560e01c80638376ae3e1161008a578063b61d27f611610059578063b61d27f614610256578063c55dae6314610277578063ef7b25d61461028c578063f2fde38b1461029f576100f3565b80638376ae3e146101ec5780638da5cb5b146101ff5780639779d1a614610214578063a8694e5714610241576100f3565b806344db91bc116100c657806344db91bc146101715780636d7a52e214610193578063715018a6146101c257806380f55605146101d7576100f3565b8063088b699e146100f8578063177fea3c146101235780634312ae3114610143576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d6102bf565b60405161011a9190611fa8565b60405180910390f35b610136610131366004611d0b565b6102e3565b60405161011a9190612137565b34801561014f57600080fd5b5061016361015e366004611f25565b6105f3565b60405161011a92919061215f565b34801561017d57600080fd5b5061019161018c366004611c57565b6109b2565b005b34801561019f57600080fd5b506101b36101ae366004611e01565b610a3f565b60405161011a9392919061218c565b3480156101ce57600080fd5b50610191610d61565b3480156101e357600080fd5b5061010d610e0d565b6101636101fa366004611d0b565b610e31565b34801561020b57600080fd5b5061010d61113d565b34801561022057600080fd5b5061023461022f366004611c3d565b61114c565b60405161011a9190611fbc565b34801561024d57600080fd5b5061010d611161565b610269610264366004611c89565b611185565b60405161011a929190611fc7565b34801561028357600080fd5b5061010d61125b565b61013661029a366004611d0b565b61127f565b3480156102ab57600080fd5b506101916102ba366004611c3d565b6114ff565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040808301516001600160a01b03166000908152600160205290812054839060ff1661032a5760405162461bcd60e51b8152600401610321906120e7565b60405180910390fd5b61033c81600001518260200151611732565b5080516000906001600160a01b03166103c15781604001516001600160a01b0316826020015183606001516040516103749190611f8c565b60006040518083038185875af1925050503d80600081146103b1576040519150601f19603f3d011682016040523d82523d6000602084013e6103b6565b606091505b505080915050610468565b604082015182516103df916001600160a01b03909116906000611601565b604082015160208301518351610400926001600160a01b0390911691611601565b81604001516001600160a01b031682606001516040516104209190611f8c565b6000604051808303816000865af19150503d806000811461045d576040519150601f19603f3d011682016040523d82523d6000602084013e610462565b606091505b50909150505b8061047a576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906104c9903090600401611fa8565b60206040518083038186803b1580156104e157600080fd5b505afa1580156104f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105199190611f0d565b604051630c26a4ed60e41b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c26a4ed09061056c90849033908a90600401612140565b602060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105be9190611f0d565b93506105ea7f000000000000000000000000000000000000000000000000000000000000000033611815565b50505092915050565b60008083156107b3576106267f000000000000000000000000000000000000000000000000000000000000000086611732565b94506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663694a7ce78860003060006040518563ffffffff1660e01b815260040161067f9493929190612003565b6040805180830381600087803b15801561069857600080fd5b505af11580156106ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d09190611f59565b915091508092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663b5567473833360006040518463ffffffff1660e01b815260040161072893929190612140565b6040805180830381600087803b15801561074157600080fd5b505af1158015610755573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107799190611f59565b9094509283019290506107ac7f000000000000000000000000000000000000000000000000000000000000000033611815565b5050610960565b6107dd7f000000000000000000000000000000000000000000000000000000000000000086611732565b94506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663694a7ce76000893060006040518563ffffffff1660e01b81526004016108369493929190612003565b6040805180830381600087803b15801561084f57600080fd5b505af1158015610863573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108879190611f59565b915091508092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166364c9b4c3833360006040518463ffffffff1660e01b81526004016108df93929190612140565b602060405180830381600087803b1580156108f957600080fd5b505af115801561090d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109319190611f0d565b935061095d7f000000000000000000000000000000000000000000000000000000000000000033611815565b50505b828210156109805760405162461bcd60e51b81526004016103219061208a565b6109aa7f000000000000000000000000000000000000000000000000000000000000000033611815565b935093915050565b6109ba6118aa565b6001600160a01b03166109cb61113d565b6001600160a01b031614610a14576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b60008060008088602001515111610a685760405162461bcd60e51b815260040161032190612114565b85610a9e57610a977f000000000000000000000000000000000000000000000000000000000000000088611732565b9650610acf565b610ac87f000000000000000000000000000000000000000000000000000000000000000087611732565b9550600096505b60405163694a7ce760e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063694a7ce790610b21908a908a9030908b90600401612003565b6040805180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b729190611f59565b909350905084831015610b975760405162461bcd60e51b815260040161032190612053565b8751839250610bd1906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690846118ae565b60005b886020015151811015610ca557600060018a6020015151038214610bf9578951610bfb565b335b905089600001516001600160a01b031663392f084f8b602001518481518110610c2057fe5b602002602001015186846040518463ffffffff1660e01b8152600401610c489392919061216d565b602060405180830381600087803b158015610c6257600080fd5b505af1158015610c76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9a9190611f0d565b935050600101610bd4565b5083821015610cc65760405162461bcd60e51b8152600401610321906120b7565b8615610cf657610cf67f000000000000000000000000000000000000000000000000000000000000000033611815565b8515610d2657610d267f000000000000000000000000000000000000000000000000000000000000000033611815565b8015610d5657610d567f000000000000000000000000000000000000000000000000000000000000000033611815565b955095509592505050565b610d696118aa565b6001600160a01b0316610d7a61113d565b6001600160a01b031614610dc3576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040808301516001600160a01b031660009081526001602052908120548190849060ff16610e715760405162461bcd60e51b8152600401610321906120e7565b610e8381600001518260200151611732565b5080516000906001600160a01b0316610f085781604001516001600160a01b031682602001518360600151604051610ebb9190611f8c565b60006040518083038185875af1925050503d8060008114610ef8576040519150601f19603f3d011682016040523d82523d6000602084013e610efd565b606091505b505080915050610faf565b60408201518251610f26916001600160a01b03909116906000611601565b604082015160208301518351610f47926001600160a01b0390911691611601565b81604001516001600160a01b03168260600151604051610f679190611f8c565b6000604051808303816000865af19150503d8060008114610fa4576040519150601f19603f3d011682016040523d82523d6000602084013e610fa9565b606091505b50909150505b80610fc1576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190611010903090600401611fa8565b60206040518083038186803b15801561102857600080fd5b505afa15801561103c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110609190611f0d565b60405163b556747360e01b81529091506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063b5567473906110b390849033908b90600401612140565b6040805180830381600087803b1580156110cc57600080fd5b505af11580156110e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111049190611f59565b90955093506111337f000000000000000000000000000000000000000000000000000000000000000033611815565b5050509250929050565b6000546001600160a01b031690565b60016020526000908152604090205460ff1681565b7f000000000000000000000000000000000000000000000000000000000000000081565b600060606111916118aa565b6001600160a01b03166111a261113d565b6001600160a01b0316146111eb576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b600080876001600160a01b0316878787604051611209929190611f7c565b60006040518083038185875af1925050503d8060008114611246576040519150601f19603f3d011682016040523d82523d6000602084013e61124b565b606091505b5090999098509650505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040808301516001600160a01b03166000908152600160205290812054839060ff166112bd5760405162461bcd60e51b8152600401610321906120e7565b6112cf81600001518260200151611732565b5080516000906001600160a01b03166113545781604001516001600160a01b0316826020015183606001516040516113079190611f8c565b60006040518083038185875af1925050503d8060008114611344576040519150601f19603f3d011682016040523d82523d6000602084013e611349565b606091505b5050809150506113fb565b60408201518251611372916001600160a01b03909116906000611601565b604082015160208301518351611393926001600160a01b0390911691611601565b81604001516001600160a01b031682606001516040516113b39190611f8c565b6000604051808303816000865af19150503d80600081146113f0576040519150601f19603f3d011682016040523d82523d6000602084013e6113f5565b606091505b50909150505b8061140d576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a082319061145c903090600401611fa8565b60206040518083038186803b15801561147457600080fd5b505afa158015611488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ac9190611f0d565b6040516364c9b4c360e01b81529091506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906364c9b4c39061056c90849033908a90600401612140565b6115076118aa565b6001600160a01b031661151861113d565b6001600160a01b031614611561576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b6001600160a01b0381166115a65760405162461bcd60e51b81526004018080602001828103825260268152602001806121f36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b801580611687575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561165957600080fd5b505afa15801561166d573d6000803e3d6000fd5b505050506040513d602081101561168357600080fd5b5051155b6116c25760405162461bcd60e51b81526004018080602001828103825260368152602001806122896036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526117149084906118fc565b505050565b606061172884846000856119ad565b90505b9392505050565b60006001600160a01b038316611768578134146117615760405162461bcd60e51b815260040161032190612027565b508061180f565b6000198214156117f1576040516370a0823160e01b81526001600160a01b038416906370a082319061179e903390600401611fa8565b60206040518083038186803b1580156117b657600080fd5b505afa1580156117ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ee9190611f0d565b91505b811561180c5761180c6001600160a01b038416333085611b08565b50805b92915050565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611844903090600401611fa8565b60206040518083038186803b15801561185c57600080fd5b505afa158015611870573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118949190611f0d565b90506117146001600160a01b03841683836118ae565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117149084905b6000611951826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117199092919063ffffffff16565b8051909150156117145780806020019051602081101561197057600080fd5b50516117145760405162461bcd60e51b815260040180806020018281038252602a81526020018061225f602a913960400191505060405180910390fd5b6060824710156119ee5760405162461bcd60e51b81526004018080602001828103825260268152602001806122196026913960400191505060405180910390fd5b6119f785611b68565b611a48576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310611a865780518252601f199092019160209182019101611a67565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611ae8576040519150601f19603f3d011682016040523d82523d6000602084013e611aed565b606091505b5091509150611afd828286611b72565b979650505050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611b629085906118fc565b50505050565b803b15155b919050565b60608315611b8157508161172b565b825115611b915782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611bdb578181015183820152602001611bc3565b50505050905090810190601f168015611c085780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80356001600160a01b0381168114611b6d57600080fd5b80358015158114611b6d57600080fd5b600060208284031215611c4e578081fd5b61172b82611c16565b60008060408385031215611c69578081fd5b611c7283611c16565b9150611c8060208401611c2d565b90509250929050565b60008060008060608587031215611c9e578182fd5b611ca785611c16565b935060208501359250604085013567ffffffffffffffff80821115611cca578384fd5b818701915087601f830112611cdd578384fd5b813581811115611ceb578485fd5b886020828501011115611cfc578485fd5b95989497505060200194505050565b60008060408385031215611d1d578182fd5b823567ffffffffffffffff80821115611d34578384fd5b9084019060808287031215611d47578384fd5b604051608081018181108382111715611d5c57fe5b604052611d6883611c16565b815260208084013581830152611d8060408501611c16565b6040830152606084013583811115611d96578687fd5b80850194505087601f850112611daa578586fd5b833583811115611db657fe5b611dc8601f8201601f191683016121a2565b93508084528882828701011115611ddd578687fd5b80828601838601378301810195909552606081019190915295939092013593505050565b600080600080600060a08688031215611e18578081fd5b853567ffffffffffffffff80821115611e2f578283fd5b908701906040828a031215611e42578283fd5b604051604081018181108382111715611e5757fe5b604052611e6383611c16565b815260208084013583811115611e77578586fd5b8085019450508a601f850112611e8b578485fd5b833583811115611e9757fe5b8181029350611ea78285016121a2565b8181528281019086840186880185018f1015611ec1578889fd5b8897505b83881015611ee3578035835260019790970196918401918401611ec5565b508484015250919b908a01359a5060408a0135996060810135995060800135975095505050505050565b600060208284031215611f1e578081fd5b5051919050565b600080600060608486031215611f39578283fd5b83359250611f4960208501611c2d565b9150604084013590509250925092565b60008060408385031215611f6b578182fd5b505080516020909101519092909150565b6000828483379101908152919050565b60008251611f9e8184602087016121c6565b9190910192915050565b6001600160a01b0391909116815260200190565b901515815260200190565b60008315158252604060208301528251806040840152611fee8160608501602087016121c6565b601f01601f1916919091016060019392505050565b93845260208401929092526001600160a01b03166040830152606082015260800190565b6020808252601290820152710dae6ce5cecc2d8eaca40dad2e6dac2e8c6d60731b604082015260600190565b60208082526017908201527f696e73756666696369656e74206261736520746f6b656e000000000000000000604082015260600190565b6020808252601390820152721a5b9cdd59999a58da595b9d081bdd5d1c1d5d606a1b604082015260600190565b60208082526016908201527534b739bab33334b1b4b2b73a103239ba103a37b5b2b760511b604082015260600190565b6020808252601390820152721d185c99d95d081b9bdd08185c1c1c9bdd9959606a1b604082015260600190565b6020808252600990820152686e6f20726f7574657360b81b604082015260600190565b90815260200190565b9283526001600160a01b03919091166020830152604082015260600190565b918252602082015260400190565b92835260208301919091526001600160a01b0316604082015260600190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff811182821017156121be57fe5b604052919050565b60005b838110156121e15781810151838201526020016121c9565b83811115611b62575050600091015256fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220a43cd9f4bb8ad52b86434facfa6d76a962829c8321e6439f2cab73326310f3c464736f6c63430007060033416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c5361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8400000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e633726000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae2

Deployed Bytecode

0x6080604052600436106100ec5760003560e01c80638376ae3e1161008a578063b61d27f611610059578063b61d27f614610256578063c55dae6314610277578063ef7b25d61461028c578063f2fde38b1461029f576100f3565b80638376ae3e146101ec5780638da5cb5b146101ff5780639779d1a614610214578063a8694e5714610241576100f3565b806344db91bc116100c657806344db91bc146101715780636d7a52e214610193578063715018a6146101c257806380f55605146101d7576100f3565b8063088b699e146100f8578063177fea3c146101235780634312ae3114610143576100f3565b366100f357005b600080fd5b34801561010457600080fd5b5061010d6102bf565b60405161011a9190611fa8565b60405180910390f35b610136610131366004611d0b565b6102e3565b60405161011a9190612137565b34801561014f57600080fd5b5061016361015e366004611f25565b6105f3565b60405161011a92919061215f565b34801561017d57600080fd5b5061019161018c366004611c57565b6109b2565b005b34801561019f57600080fd5b506101b36101ae366004611e01565b610a3f565b60405161011a9392919061218c565b3480156101ce57600080fd5b50610191610d61565b3480156101e357600080fd5b5061010d610e0d565b6101636101fa366004611d0b565b610e31565b34801561020b57600080fd5b5061010d61113d565b34801561022057600080fd5b5061023461022f366004611c3d565b61114c565b60405161011a9190611fbc565b34801561024d57600080fd5b5061010d611161565b610269610264366004611c89565b611185565b60405161011a929190611fc7565b34801561028357600080fd5b5061010d61125b565b61013661029a366004611d0b565b61127f565b3480156102ab57600080fd5b506101916102ba366004611c3d565b6114ff565b7f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae281565b6040808301516001600160a01b03166000908152600160205290812054839060ff1661032a5760405162461bcd60e51b8152600401610321906120e7565b60405180910390fd5b61033c81600001518260200151611732565b5080516000906001600160a01b03166103c15781604001516001600160a01b0316826020015183606001516040516103749190611f8c565b60006040518083038185875af1925050503d80600081146103b1576040519150601f19603f3d011682016040523d82523d6000602084013e6103b6565b606091505b505080915050610468565b604082015182516103df916001600160a01b03909116906000611601565b604082015160208301518351610400926001600160a01b0390911691611601565b81604001516001600160a01b031682606001516040516104209190611f8c565b6000604051808303816000865af19150503d806000811461045d576040519150601f19603f3d011682016040523d82523d6000602084013e610462565b606091505b50909150505b8061047a576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a08231906104c9903090600401611fa8565b60206040518083038186803b1580156104e157600080fd5b505afa1580156104f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105199190611f0d565b604051630c26a4ed60e41b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169063c26a4ed09061056c90849033908a90600401612140565b602060405180830381600087803b15801561058657600080fd5b505af115801561059a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105be9190611f0d565b93506105ea7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8433611815565b50505092915050565b60008083156107b3576106267f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372686611732565b94506000807f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db6001600160a01b031663694a7ce78860003060006040518563ffffffff1660e01b815260040161067f9493929190612003565b6040805180830381600087803b15801561069857600080fd5b505af11580156106ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106d09190611f59565b915091508092507f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db6001600160a01b031663b5567473833360006040518463ffffffff1660e01b815260040161072893929190612140565b6040805180830381600087803b15801561074157600080fd5b505af1158015610755573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107799190611f59565b9094509283019290506107ac7f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372633611815565b5050610960565b6107dd7f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae286611732565b94506000807f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db6001600160a01b031663694a7ce76000893060006040518563ffffffff1660e01b81526004016108369493929190612003565b6040805180830381600087803b15801561084f57600080fd5b505af1158015610863573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108879190611f59565b915091508092507f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db6001600160a01b03166364c9b4c3833360006040518463ffffffff1660e01b81526004016108df93929190612140565b602060405180830381600087803b1580156108f957600080fd5b505af115801561090d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109319190611f0d565b935061095d7f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae233611815565b50505b828210156109805760405162461bcd60e51b81526004016103219061208a565b6109aa7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8433611815565b935093915050565b6109ba6118aa565b6001600160a01b03166109cb61113d565b6001600160a01b031614610a14576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b6001600160a01b03919091166000908152600160205260409020805460ff1916911515919091179055565b60008060008088602001515111610a685760405162461bcd60e51b815260040161032190612114565b85610a9e57610a977f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372688611732565b9650610acf565b610ac87f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae287611732565b9550600096505b60405163694a7ce760e01b81526001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169063694a7ce790610b21908a908a9030908b90600401612003565b6040805180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b729190611f59565b909350905084831015610b975760405162461bcd60e51b815260040161032190612053565b8751839250610bd1906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe841690846118ae565b60005b886020015151811015610ca557600060018a6020015151038214610bf9578951610bfb565b335b905089600001516001600160a01b031663392f084f8b602001518481518110610c2057fe5b602002602001015186846040518463ffffffff1660e01b8152600401610c489392919061216d565b602060405180830381600087803b158015610c6257600080fd5b505af1158015610c76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9a9190611f0d565b935050600101610bd4565b5083821015610cc65760405162461bcd60e51b8152600401610321906120b7565b8615610cf657610cf67f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372633611815565b8515610d2657610d267f000000000000000000000000e063f04f280c60aeca68b38341c2eecbec703ae233611815565b8015610d5657610d567f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8433611815565b955095509592505050565b610d696118aa565b6001600160a01b0316610d7a61113d565b6001600160a01b031614610dc3576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db81565b6040808301516001600160a01b031660009081526001602052908120548190849060ff16610e715760405162461bcd60e51b8152600401610321906120e7565b610e8381600001518260200151611732565b5080516000906001600160a01b0316610f085781604001516001600160a01b031682602001518360600151604051610ebb9190611f8c565b60006040518083038185875af1925050503d8060008114610ef8576040519150601f19603f3d011682016040523d82523d6000602084013e610efd565b606091505b505080915050610faf565b60408201518251610f26916001600160a01b03909116906000611601565b604082015160208301518351610f47926001600160a01b0390911691611601565b81604001516001600160a01b03168260600151604051610f679190611f8c565b6000604051808303816000865af19150503d8060008114610fa4576040519150601f19603f3d011682016040523d82523d6000602084013e610fa9565b606091505b50909150505b80610fc1576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a0823190611010903090600401611fa8565b60206040518083038186803b15801561102857600080fd5b505afa15801561103c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110609190611f0d565b60405163b556747360e01b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db169063b5567473906110b390849033908b90600401612140565b6040805180830381600087803b1580156110cc57600080fd5b505af11580156110e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111049190611f59565b90955093506111337f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8433611815565b5050509250929050565b6000546001600160a01b031690565b60016020526000908152604090205460ff1681565b7f00000000000000000000000053805a76e1f5ebbfe7115f16f9c87c2f7e63372681565b600060606111916118aa565b6001600160a01b03166111a261113d565b6001600160a01b0316146111eb576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b600080876001600160a01b0316878787604051611209929190611f7c565b60006040518083038185875af1925050503d8060008114611246576040519150601f19603f3d011682016040523d82523d6000602084013e61124b565b606091505b5090999098509650505050505050565b7f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8481565b6040808301516001600160a01b03166000908152600160205290812054839060ff166112bd5760405162461bcd60e51b8152600401610321906120e7565b6112cf81600001518260200151611732565b5080516000906001600160a01b03166113545781604001516001600160a01b0316826020015183606001516040516113079190611f8c565b60006040518083038185875af1925050503d8060008114611344576040519150601f19603f3d011682016040523d82523d6000602084013e611349565b606091505b5050809150506113fb565b60408201518251611372916001600160a01b03909116906000611601565b604082015160208301518351611393926001600160a01b0390911691611601565b81604001516001600160a01b031682606001516040516113b39190611f8c565b6000604051808303816000865af19150503d80600081146113f0576040519150601f19603f3d011682016040523d82523d6000602084013e6113f5565b606091505b50909150505b8061140d576040513d806000833e8082fd5b6040516370a0823160e01b81526000906001600160a01b037f000000000000000000000000ae7ab96520de3a18e5e111b5eaab095312d7fe8416906370a082319061145c903090600401611fa8565b60206040518083038186803b15801561147457600080fd5b505afa158015611488573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ac9190611f0d565b6040516364c9b4c360e01b81529091506001600160a01b037f000000000000000000000000e7b9c7c9ca85340b8c06fb805f7775e3015108db16906364c9b4c39061056c90849033908a90600401612140565b6115076118aa565b6001600160a01b031661151861113d565b6001600160a01b031614611561576040805162461bcd60e51b8152602060048201819052602482015260008051602061223f833981519152604482015290519081900360640190fd5b6001600160a01b0381166115a65760405162461bcd60e51b81526004018080602001828103825260268152602001806121f36026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b801580611687575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561165957600080fd5b505afa15801561166d573d6000803e3d6000fd5b505050506040513d602081101561168357600080fd5b5051155b6116c25760405162461bcd60e51b81526004018080602001828103825260368152602001806122896036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526117149084906118fc565b505050565b606061172884846000856119ad565b90505b9392505050565b60006001600160a01b038316611768578134146117615760405162461bcd60e51b815260040161032190612027565b508061180f565b6000198214156117f1576040516370a0823160e01b81526001600160a01b038416906370a082319061179e903390600401611fa8565b60206040518083038186803b1580156117b657600080fd5b505afa1580156117ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ee9190611f0d565b91505b811561180c5761180c6001600160a01b038416333085611b08565b50805b92915050565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611844903090600401611fa8565b60206040518083038186803b15801561185c57600080fd5b505afa158015611870573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118949190611f0d565b90506117146001600160a01b03841683836118ae565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117149084905b6000611951826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166117199092919063ffffffff16565b8051909150156117145780806020019051602081101561197057600080fd5b50516117145760405162461bcd60e51b815260040180806020018281038252602a81526020018061225f602a913960400191505060405180910390fd5b6060824710156119ee5760405162461bcd60e51b81526004018080602001828103825260268152602001806122196026913960400191505060405180910390fd5b6119f785611b68565b611a48576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310611a865780518252601f199092019160209182019101611a67565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611ae8576040519150601f19603f3d011682016040523d82523d6000602084013e611aed565b606091505b5091509150611afd828286611b72565b979650505050505050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611b629085906118fc565b50505050565b803b15155b919050565b60608315611b8157508161172b565b825115611b915782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611bdb578181015183820152602001611bc3565b50505050905090810190601f168015611c085780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b80356001600160a01b0381168114611b6d57600080fd5b80358015158114611b6d57600080fd5b600060208284031215611c4e578081fd5b61172b82611c16565b60008060408385031215611c69578081fd5b611c7283611c16565b9150611c8060208401611c2d565b90509250929050565b60008060008060608587031215611c9e578182fd5b611ca785611c16565b935060208501359250604085013567ffffffffffffffff80821115611cca578384fd5b818701915087601f830112611cdd578384fd5b813581811115611ceb578485fd5b886020828501011115611cfc578485fd5b95989497505060200194505050565b60008060408385031215611d1d578182fd5b823567ffffffffffffffff80821115611d34578384fd5b9084019060808287031215611d47578384fd5b604051608081018181108382111715611d5c57fe5b604052611d6883611c16565b815260208084013581830152611d8060408501611c16565b6040830152606084013583811115611d96578687fd5b80850194505087601f850112611daa578586fd5b833583811115611db657fe5b611dc8601f8201601f191683016121a2565b93508084528882828701011115611ddd578687fd5b80828601838601378301810195909552606081019190915295939092013593505050565b600080600080600060a08688031215611e18578081fd5b853567ffffffffffffffff80821115611e2f578283fd5b908701906040828a031215611e42578283fd5b604051604081018181108382111715611e5757fe5b604052611e6383611c16565b815260208084013583811115611e77578586fd5b8085019450508a601f850112611e8b578485fd5b833583811115611e9757fe5b8181029350611ea78285016121a2565b8181528281019086840186880185018f1015611ec1578889fd5b8897505b83881015611ee3578035835260019790970196918401918401611ec5565b508484015250919b908a01359a5060408a0135996060810135995060800135975095505050505050565b600060208284031215611f1e578081fd5b5051919050565b600080600060608486031215611f39578283fd5b83359250611f4960208501611c2d565b9150604084013590509250925092565b60008060408385031215611f6b578182fd5b505080516020909101519092909150565b6000828483379101908152919050565b60008251611f9e8184602087016121c6565b9190910192915050565b6001600160a01b0391909116815260200190565b901515815260200190565b60008315158252604060208301528251806040840152611fee8160608501602087016121c6565b601f01601f1916919091016060019392505050565b93845260208401929092526001600160a01b03166040830152606082015260800190565b6020808252601290820152710dae6ce5cecc2d8eaca40dad2e6dac2e8c6d60731b604082015260600190565b60208082526017908201527f696e73756666696369656e74206261736520746f6b656e000000000000000000604082015260600190565b6020808252601390820152721a5b9cdd59999a58da595b9d081bdd5d1c1d5d606a1b604082015260600190565b60208082526016908201527534b739bab33334b1b4b2b73a103239ba103a37b5b2b760511b604082015260600190565b6020808252601390820152721d185c99d95d081b9bdd08185c1c1c9bdd9959606a1b604082015260600190565b6020808252600990820152686e6f20726f7574657360b81b604082015260600190565b90815260200190565b9283526001600160a01b03919091166020830152604082015260600190565b918252602082015260400190565b92835260208301919091526001600160a01b0316604082015260600190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff811182821017156121be57fe5b604052919050565b60005b838110156121e15781810151838201526020016121c9565b83811115611b62575050600091015256fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220a43cd9f4bb8ad52b86434facfa6d76a962829c8321e6439f2cab73326310f3c464736f6c63430007060033

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 Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.