ETH Price: $3,247.95 (-0.33%)
Gas: 1 Gwei

Contract

0x11C907b3aeDbD863e551c37f21DD3F36b28A6784
 
Transaction Hash
Method
Block
From
To
Transfer Ownersh...183774722023-10-18 13:15:47283 days ago1697634947IN
0x11C907b3...6b28A6784
0 ETH0.0004608616
Transfer Ownersh...183774322023-10-18 13:07:47283 days ago1697634467IN
0x11C907b3...6b28A6784
0 ETH0.000304312.58350963
0x60a06040183684702023-10-17 7:01:35284 days ago1697526095IN
 Create: GeneralTokenConverter
0 ETH0.029645566.43074712

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
203865152024-07-25 22:22:232 days ago1721946143
0x11C907b3...6b28A6784
0.65486696 ETH
203865152024-07-25 22:22:232 days ago1721946143
0x11C907b3...6b28A6784
0.65486696 ETH
203774782024-07-24 16:05:113 days ago1721837111
0x11C907b3...6b28A6784
3.48354214 ETH
203774782024-07-24 16:05:113 days ago1721837111
0x11C907b3...6b28A6784
3.48354214 ETH
203774412024-07-24 15:57:473 days ago1721836667
0x11C907b3...6b28A6784
1.010659 ETH
203774412024-07-24 15:57:473 days ago1721836667
0x11C907b3...6b28A6784
1.010659 ETH
203774382024-07-24 15:57:113 days ago1721836631
0x11C907b3...6b28A6784
0.0654405 ETH
203774382024-07-24 15:57:113 days ago1721836631
0x11C907b3...6b28A6784
0.0654405 ETH
203774352024-07-24 15:56:353 days ago1721836595
0x11C907b3...6b28A6784
2.91692483 ETH
203774352024-07-24 15:56:353 days ago1721836595
0x11C907b3...6b28A6784
2.91692483 ETH
203774342024-07-24 15:56:233 days ago1721836583
0x11C907b3...6b28A6784
1.16420389 ETH
203774342024-07-24 15:56:233 days ago1721836583
0x11C907b3...6b28A6784
1.16420389 ETH
203746212024-07-24 6:30:233 days ago1721802623
0x11C907b3...6b28A6784
0.1140288 ETH
203746212024-07-24 6:30:233 days ago1721802623
0x11C907b3...6b28A6784
0.1140288 ETH
203716232024-07-23 20:28:234 days ago1721766503
0x11C907b3...6b28A6784
1.87526579 ETH
203716232024-07-23 20:28:234 days ago1721766503
0x11C907b3...6b28A6784
1.87526579 ETH
203653952024-07-22 23:36:595 days ago1721691419
0x11C907b3...6b28A6784
0.65633063 ETH
203653952024-07-22 23:36:595 days ago1721691419
0x11C907b3...6b28A6784
0.65633063 ETH
203536672024-07-21 8:18:116 days ago1721549891
0x11C907b3...6b28A6784
2.65682796 ETH
203536672024-07-21 8:18:116 days ago1721549891
0x11C907b3...6b28A6784
2.65682796 ETH
203504912024-07-20 21:41:117 days ago1721511671
0x11C907b3...6b28A6784
0.39652921 ETH
203504912024-07-20 21:41:117 days ago1721511671
0x11C907b3...6b28A6784
0.39652921 ETH
203436862024-07-19 22:52:358 days ago1721429555
0x11C907b3...6b28A6784
1.01316613 ETH
203436862024-07-19 22:52:358 days ago1721429555
0x11C907b3...6b28A6784
1.01316613 ETH
203269042024-07-17 14:40:2310 days ago1721227223
0x11C907b3...6b28A6784
1.86418113 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
GeneralTokenConverter

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 25 : GeneralTokenConverter.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 { IConverterRegistry } from "./IConverterRegistry.sol";
import { ITokenConverter } from "./ITokenConverter.sol";

import { IERC4626 } from "../../common/ERC4626/IERC4626.sol";
import { IBalancerPool } from "../../interfaces/IBalancerPool.sol";
import { IBalancerV1Pool } from "../../interfaces/IBalancerV1Pool.sol";
import { IBalancerVault } from "../../interfaces/IBalancerVault.sol";
import { ICurveAPool } from "../../interfaces/ICurveAPool.sol";
import { ICurvePlainPool } from "../../interfaces/ICurvePlainPool.sol";
import { ICurveYPoolSwap, ICurveYPoolDeposit } from "../../interfaces/ICurveYPool.sol";
import { ICurveMetaPoolSwap } from "../../interfaces/ICurveMetaPool.sol";
import { ICurveCryptoPool } from "../../interfaces/ICurveCryptoPool.sol";
import { ICurveTriCryptoPool } from "../../interfaces/ICurveCryptoPool.sol";
import { IUniswapV2Pair } from "../../interfaces/IUniswapV2Pair.sol";
import { IUniswapV3Pool } from "../../interfaces/IUniswapV3Pool.sol";
import { IUniswapV3Router } from "../../interfaces/IUniswapV3Router.sol";
import { IUniswapV3Quoter } from "../../interfaces/IUniswapV3Quoter.sol";
import { IWETH } from "../../interfaces/IWETH.sol";

import { ConverterBase } from "./ConverterBase.sol";

// solhint-disable no-empty-blocks
// solhint-disable no-inline-assembly
// solhint-disable not-rely-on-time
// solhint-disable var-name-mixedcase

/// @title GeneralTokenConverter
/// @notice This implements token converting for `pool_type` from 0 to 9 (both inclusive).
/// For other types, it will retrieve the implementation from
/// `ConverterRegistry` contract and delegate call.
contract GeneralTokenConverter is Ownable, ConverterBase {
  using SafeERC20 for IERC20;

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

  /// @dev The address of Balancer V2 Vault
  address private constant BALANCER_VAULT = 0xBA12222222228d8Ba445958a75a0704d566BF2C8;

  /// @dev The address of Uniswap V3 Router
  address private constant UNISWAP_V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564;

  /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
  uint160 private constant MIN_SQRT_RATIO = 4295128739;

  /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
  uint160 private constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

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

  /// @notice The mask of supported pool types.
  /// @dev If the `i`-th bit is `1`, the `i`-th pool type is supported in this contract.
  uint256 public supportedPoolTypes;

  /// @notice Mapping from token address to token minter.
  /// @dev It is used to determine the pool address for lp token address.
  mapping(address => address) public tokenMinter;

  /// @dev Execution context used in fallback function.
  uint256 private context;

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

  constructor(address _registry) ConverterBase(_registry) {
    supportedPoolTypes = 1023;

    // setup 3pool, compound, susd
    tokenMinter[0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490] = 0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7;
    tokenMinter[0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2] = 0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56;
    tokenMinter[0xC25a3A3b969415c80451098fa907EC722572917F] = 0xA5407eAE9Ba41422680e2e00537571bcC53efBfD;
  }

  /*************************
   * Public View Functions *
   *************************/

  /// @inheritdoc ITokenConverter
  function getTokenPair(uint256 _route) external view override returns (address, address) {
    uint256 _poolType = _route & 255;
    uint256 _action = (_route >> 8) & 3;

    return _getTokenPair(_poolType, _action, _route >> 10);
  }

  /// @inheritdoc ITokenConverter
  function queryConvert(uint256 _encoding, uint256 _amountIn) external override returns (uint256 _amountOut) {
    uint256 _poolType = _encoding & 255;
    uint256 _action = (_encoding >> 8) & 3;

    if (((supportedPoolTypes >> _poolType) & 1) == 1) {
      _encoding = _encoding >> 10;
      if (_action == 0) _amountOut = _querySwap(_poolType, _encoding, _amountIn);
      else if (_action == 1) _amountOut = _queryWrap(_poolType, _encoding, _amountIn);
      else if (_action == 2) _amountOut = _queryUnwrap(_poolType, _encoding, _amountIn);
      else revert("invalid action");
    } else {
      address _converter = IConverterRegistry(registry).getConverter(_poolType);
      _amountOut = ITokenConverter(_converter).queryConvert(_encoding, _amountIn);
    }
  }

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

  // solhint-disable-next-line no-complex-fallback
  fallback() external payable {
    uint256 _context = context;
    if (address(_context) == _msgSender() || _context == 1) {
      // handle uniswap v3 swap callback or uniswap v3 quote callback
      // | 4 bytes |   32 bytes   |   32 bytes   |   32 bytes  |   32 bytes  | 32 bytes |
      // |   sig   | amount0Delta | amount1Delta | data.offset | data.length |  tokenIn |
      int256 amount0Delta;
      int256 amount1Delta;
      address tokenIn;
      assembly {
        amount0Delta := calldataload(4)
        amount1Delta := calldataload(36)
        tokenIn := calldataload(132)
      }
      (uint256 amountToPay, uint256 amountReceived) = amount0Delta > 0
        ? (uint256(amount0Delta), uint256(-amount1Delta))
        : (uint256(amount1Delta), uint256(-amount0Delta));
      if (_context == 1) {
        assembly {
          let ptr := mload(0x40)
          mstore(ptr, amountReceived)
          revert(ptr, 32)
        }
      } else {
        IERC20(tokenIn).safeTransfer(address(_context), amountToPay);
      }
    } else {
      revert("invalid call");
    }
  }

  /// @inheritdoc ITokenConverter
  function convert(
    uint256 _encoding,
    uint256 _amountIn,
    address _recipient
  ) external payable override returns (uint256 _amountOut) {
    uint256 _poolType = _encoding & 255;
    uint256 _action = (_encoding >> 8) & 3;

    if (((supportedPoolTypes >> _poolType) & 1) == 1) {
      _encoding = _encoding >> 10;
      if (_action == 0) _amountOut = _swap(_poolType, _encoding, _amountIn, _recipient);
      else if (_action == 1) _amountOut = _wrap(_poolType, _encoding, _amountIn, _recipient);
      else if (_action == 2) _amountOut = _unwrap(_poolType, _encoding, _amountIn, _recipient);
      else revert("invalid action");
    } else {
      address _converter = IConverterRegistry(registry).getConverter(_poolType);
      // solhint-disable-next-line avoid-low-level-calls
      (bool _success, bytes memory _result) = _converter.delegatecall(
        abi.encodeWithSelector(ITokenConverter.convert.selector, _encoding, _amountIn, _recipient)
      );
      // 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)
        }
      }
      _amountOut = abi.decode(_result, (uint256));
    }
  }

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

  /// @notice Update the pool types supported by this contract by default.
  /// @param _supportedPoolTypes The mask of pool types supported.
  function updateSupportedPoolTypes(uint256 _supportedPoolTypes) external onlyOwner {
    supportedPoolTypes = _supportedPoolTypes;
  }

  /// @notice Update the token minter mapping.
  /// @param _tokens The address list of tokens to update.
  /// @param _minters The address list of corresponding minters.
  function updateTokenMinter(address[] memory _tokens, address[] memory _minters) external onlyOwner {
    for (uint256 i = 0; i < _tokens.length; i++) {
      tokenMinter[_tokens[i]] = _minters[i];
    }
  }

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

  /// @dev Internal function to find token pair based on route encoding.
  /// @param _poolType The type of the route.
  /// @param _action The action of the route.
  /// @param _encoding The customized encoding of the route.
  /// @return _tokenIn The address of input token.
  /// @return _tokenOut The address of output token.
  function _getTokenPair(
    uint256 _poolType,
    uint256 _action,
    uint256 _encoding
  ) internal view returns (address _tokenIn, address _tokenOut) {
    address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);

    if (_action == 0) {
      // swap
      if (_poolType <= 1) {
        // UniswapV2 or UniswapV3
        _tokenIn = IUniswapV2Pair(_pool).token0();
        _tokenOut = IUniswapV2Pair(_pool).token1();
        uint256 zero_for_one = (_encoding >> 184) & 1;
        if (zero_for_one == 0) {
          (_tokenIn, _tokenOut) = (_tokenOut, _tokenIn);
        }
      } else if (_poolType == 2) {
        // BalancerV1
        address[] memory _tokens = IBalancerV1Pool(_pool).getCurrentTokens();
        _tokenIn = _tokens[(_encoding >> 163) & 7];
        _tokenOut = _tokens[(_encoding >> 166) & 7];
      } else if (_poolType == 3) {
        // BalancerV2
        bytes32 _poolId = IBalancerPool(_pool).getPoolId();
        (address[] memory _tokens, , ) = IBalancerVault(BALANCER_VAULT).getPoolTokens(_poolId);
        _tokenIn = _tokens[(_encoding >> 163) & 7];
        _tokenOut = _tokens[(_encoding >> 166) & 7];
      } else if (_poolType <= 8) {
        // Curve
        _tokenIn = _getCurveTokenByIndex(_pool, _poolType, (_encoding >> 163) & 7, _encoding);
        _tokenOut = _getCurveTokenByIndex(_pool, _poolType, (_encoding >> 166) & 7, _encoding);
      }
    } else if (_action == 1) {
      _tokenOut = _pool;
      if (4 <= _poolType && _poolType <= 8) {
        if (_poolType == 6 && (((_encoding >> 169) & 1) == 1)) {
          _tokenOut = ICurveYPoolDeposit(_pool).token();
        } else {
          _pool = _getTokenMinter(_pool);
        }
        _tokenIn = _getCurveTokenByIndex(_pool, _poolType, (_encoding >> 163) & 7, _encoding);
      } else if (_poolType == 9) {
        _tokenIn = IERC4626(_pool).asset();
      } else {
        _tokenOut = address(0);
      }
    } else if (_action == 2) {
      _tokenIn = _pool;
      if (4 <= _poolType && _poolType <= 8) {
        if (_poolType == 6 && (((_encoding >> 169) & 1) == 1)) {
          _tokenIn = ICurveYPoolDeposit(_pool).token();
        } else {
          _pool = _getTokenMinter(_pool);
        }
        _tokenOut = _getCurveTokenByIndex(_pool, _poolType, (_encoding >> 166) & 7, _encoding);
      } else if (_poolType == 9) {
        _tokenOut = IERC4626(_pool).asset();
      } else {
        _tokenIn = address(0);
      }
    }
    if (_tokenIn == ETH) _tokenIn = WETH;
    if (_tokenOut == ETH) _tokenOut = WETH;
  }

  /// @dev Internal function to return the minter for curve lp token.
  /// @param _token The address of token.
  /// @return _minter The address of minter for the token.
  function _getTokenMinter(address _token) internal view returns (address _minter) {
    _minter = tokenMinter[_token];
    if (_minter == address(0)) {
      // solhint-disable-next-line no-inline-assembly
      assembly {
        // keccack("minter()")
        mstore(0x00, 0x0754617200000000000000000000000000000000000000000000000000000000)
        let success := staticcall(gas(), _token, 0x00, 0x04, 0x00, 0x20)
        if success {
          _minter := and(mload(0x00), 0xffffffffffffffffffffffffffffffffffffffff)
        }
        if iszero(_minter) {
          _minter := _token
        }
      }
    }
  }

  /// @dev Internal function to get the curve token by index.
  /// @param _poolType The pool type.
  /// @param _index The index of the token.
  /// @param _encoding The customized encoding of the route.
  /// @return _token The address of the token.
  function _getCurveTokenByIndex(
    address _pool,
    uint256 _poolType,
    uint256 _index,
    uint256 _encoding
  ) internal view returns (address _token) {
    if ((_poolType == 5 || _poolType == 6) && (((_encoding >> 169) & 1) == 1)) {
      if (_poolType == 5) {
        _token = ICurveAPool(_pool).underlying_coins(_index);
      } else {
        _token = ICurveYPoolSwap(_pool).underlying_coins(int128(_index));
      }
    } else {
      try ICurvePlainPool(_pool).coins(_index) returns (address result) {
        _token = result;
      } catch {
        _token = ICurvePlainPool(_pool).coins(int128(_index));
      }
    }
  }

  /*************************************
   * Internal Functions for Token Swap *
   *************************************/

  /// @dev Query the amount of output token by swapping.
  /// @param _poolType The pool type.
  /// @param _encoding The customized encoding of the route.
  /// @param _amountIn The amount of input token.
  /// @return _amountOut The amount of output token.
  function _querySwap(
    uint256 _poolType,
    uint256 _encoding,
    uint256 _amountIn
  ) internal returns (uint256 _amountOut) {
    (address _tokenIn, address _tokenOut) = _getTokenPair(_poolType, 0, _encoding);
    address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);
    if (_poolType == 0) {
      if (((_encoding >> 185) & 1) == 1) {
        IUniswapV2Pair(_pool).executeVirtualOrders(block.timestamp);
      }
      uint256 zero_for_one = (_encoding >> 184) & 1;
      (uint256 rIn, uint256 rOut, ) = IUniswapV2Pair(_pool).getReserves();
      if (zero_for_one == 0) {
        (rIn, rOut) = (rOut, rIn);
      }
      // We won't handle fee on transfer token here.
      _amountOut = _amountIn * ((_encoding >> 160) & 16777215);
      _amountOut = (_amountOut * rOut) / (rIn * 1000000 + _amountOut);
    } else if (_poolType == 1) {
      bool zeroForOne = _tokenIn < _tokenOut;
      context = 1;
      try
        IUniswapV3Pool(_pool).swap(
          address(this),
          zeroForOne,
          int256(_amountIn),
          (zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1),
          new bytes(0)
        )
      {} catch (bytes memory reason) {
        _amountOut = abi.decode(reason, (uint256));
      }
      context = 0;
    } else if (_poolType == 2) {
      _amountOut = IBalancerV1Pool(_pool).calcOutGivenIn(
        IBalancerV1Pool(_pool).getBalance(_tokenIn),
        IBalancerV1Pool(_pool).getDenormalizedWeight(_tokenIn),
        IBalancerV1Pool(_pool).getBalance(_tokenOut),
        IBalancerV1Pool(_pool).getDenormalizedWeight(_tokenOut),
        _amountIn,
        IBalancerV1Pool(_pool).getSwapFee()
      );
    } else if (_poolType == 3) {
      address[] memory _assets = new address[](2);
      _assets[0] = _tokenIn;
      _assets[1] = _tokenOut;
      IBalancerVault.BatchSwapStep[] memory _swaps = new IBalancerVault.BatchSwapStep[](1);
      _swaps[0] = IBalancerVault.BatchSwapStep({
        poolId: IBalancerPool(_pool).getPoolId(),
        assetInIndex: 0,
        assetOutIndex: 1,
        amount: _amountIn,
        userData: new bytes(0)
      });
      int256[] memory _deltas = IBalancerVault(BALANCER_VAULT).queryBatchSwap(
        IBalancerVault.SwapKind.GIVEN_IN,
        _swaps,
        _assets,
        IBalancerVault.FundManagement({
          sender: address(this),
          fromInternalBalance: false,
          recipient: payable(address(this)),
          toInternalBalance: false
        })
      );
      _amountOut = uint256(-_deltas[1]);
    } else if (_poolType <= 8) {
      uint256 indexIn = (_encoding >> 163) & 7;
      uint256 indexOut = (_encoding >> 166) & 7;
      if (_poolType == 8) {
        _amountOut = ICurveCryptoPool(_pool).get_dy(indexIn, indexOut, _amountIn);
      } else if (_poolType == 5 && ((_encoding >> 169) & 1) == 1) {
        _amountOut = ICurveAPool(_pool).get_dy_underlying(int128(indexIn), int128(indexOut), _amountIn);
      } else if (_poolType == 6 && ((_encoding >> 169) & 1) == 1) {
        _pool = ICurveYPoolDeposit(_pool).curve();
        _amountOut = ICurveYPoolSwap(_pool).get_dy_underlying(int128(indexIn), int128(indexOut), _amountIn);
      } else {
        _amountOut = ICurvePlainPool(_pool).get_dy(int128(indexIn), int128(indexOut), _amountIn);
      }
    }
  }

  /// @dev Swap from one token to another token.
  /// @param _poolType The pool type.
  /// @param _encoding The customized encoding of the route.
  /// @param _amountIn The amount of input token.
  /// @param _recipient The address of output token receiver.
  /// @return _amountOut The amount of output token.
  function _swap(
    uint256 _poolType,
    uint256 _encoding,
    uint256 _amountIn,
    address _recipient
  ) internal returns (uint256 _amountOut) {
    (address _tokenIn, address _tokenOut) = _getTokenPair(_poolType, 0, _encoding);
    address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);

    if ((_poolType == 4 || _poolType == 8) && ((_encoding >> 169) & 1) == 1) {
      // tokenIn is (W)ETH and we are going to use ETH.
      _unwrapIfNeeded(_amountIn);
    } else {
      _wrapTokenIfNeeded(_tokenIn, _amountIn);
    }

    uint256 _balanceBefore = IERC20(_tokenOut).balanceOf(address(this));
    if (_poolType == 0) {
      // Uniswap V2
      if (((_encoding >> 185) & 1) == 1) {
        IUniswapV2Pair(_pool).executeVirtualOrders(block.timestamp);
      }
      uint256 zero_for_one = (_encoding >> 184) & 1;
      (uint256 rIn, uint256 rOut, ) = IUniswapV2Pair(_pool).getReserves();
      if (zero_for_one == 0) {
        (rIn, rOut) = (rOut, rIn);
      }

      // We won't handle fee on transfer token here.
      _amountOut = _amountIn * ((_encoding >> 160) & 16777215);
      _amountOut = (_amountOut * rOut) / (rIn * 1000000 + _amountOut);

      IERC20(_tokenIn).safeTransfer(_pool, _amountIn);
      if (zero_for_one == 1) {
        IUniswapV2Pair(_pool).swap(0, _amountOut, _recipient, new bytes(0));
      } else {
        IUniswapV2Pair(_pool).swap(_amountOut, 0, _recipient, new bytes(0));
      }
      return _amountOut;
    } else if (_poolType == 1) {
      // UniswapV3
      bool zeroForOne = _tokenIn < _tokenOut;
      bytes memory _data = new bytes(32);
      assembly {
        mstore(add(_data, 0x20), _tokenIn)
      }
      context = uint256(_pool);
      (int256 amount0, int256 amount1) = IUniswapV3Pool(_pool).swap(
        _recipient,
        zeroForOne,
        int256(_amountIn),
        (zeroForOne ? MIN_SQRT_RATIO + 1 : MAX_SQRT_RATIO - 1),
        _data
      );
      context = 0;
      return zeroForOne ? uint256(-amount1) : uint256(amount0);
    } else if (_poolType == 2) {
      // BalancerV1
      _approve(_tokenIn, _pool, _amountIn);
      (_amountOut, ) = IBalancerV1Pool(_pool).swapExactAmountIn(_tokenIn, _amountIn, _tokenOut, 0, uint256(-1));
    } else if (_poolType == 3) {
      bytes32 _poolId = IBalancerPool(_pool).getPoolId();
      _wrapTokenIfNeeded(_tokenIn, _amountIn);
      _approve(_tokenIn, BALANCER_VAULT, _amountIn);
      return
        IBalancerVault(BALANCER_VAULT).swap(
          IBalancerVault.SingleSwap({
            poolId: _poolId,
            kind: IBalancerVault.SwapKind.GIVEN_IN,
            assetIn: _tokenIn,
            assetOut: _tokenOut,
            amount: _amountIn,
            userData: new bytes(0)
          }),
          IBalancerVault.FundManagement({
            sender: address(this),
            fromInternalBalance: false,
            recipient: payable(_recipient),
            toInternalBalance: false
          }),
          0,
          // solhint-disable-next-line not-rely-on-time
          block.timestamp
        );
    } else if (_poolType <= 8) {
      uint256 indexIn = (_encoding >> 163) & 7;
      uint256 indexOut = (_encoding >> 166) & 7;
      _approve(_tokenIn, _pool, _amountIn);
      if (_poolType == 4) {
        if (((_encoding >> 169) & 1) == 0) {
          _approve(_tokenIn, _pool, _amountIn);
          ICurvePlainPool(_pool).exchange(int128(indexIn), int128(indexOut), _amountIn, 0);
        } else {
          ICurvePlainPool(_pool).exchange{ value: _amountIn }(int128(indexIn), int128(indexOut), _amountIn, 0);
        }
      } else if (_poolType == 5) {
        _approve(_tokenIn, _pool, _amountIn);
        if (((_encoding >> 169) & 1) == 0) {
          ICurveAPool(_pool).exchange(int128(indexIn), int128(indexOut), _amountIn, 0);
        } else {
          ICurveAPool(_pool).exchange_underlying(int128(indexIn), int128(indexOut), _amountIn, 0);
        }
      } else if (_poolType == 6) {
        if (((_encoding >> 169) & 1) == 1) {
          _pool = ICurveYPoolDeposit(_pool).curve();
        }
        _approve(_tokenIn, _pool, _amountIn);
        if (((_encoding >> 169) & 1) == 0) {
          ICurveYPoolSwap(_pool).exchange(int128(indexIn), int128(indexOut), _amountIn, 0);
        } else {
          ICurveYPoolSwap(_pool).exchange_underlying(int128(indexIn), int128(indexOut), _amountIn, 0);
        }
      } else if (_poolType == 7) {
        _approve(_tokenIn, _pool, _amountIn);
        ICurveMetaPoolSwap(_pool).exchange(int128(indexIn), int128(indexOut), _amountIn, 0);
      } else if (_poolType == 8) {
        if (((_encoding >> 169) & 1) == 0) {
          _approve(_tokenIn, _pool, _amountIn);
          ICurveCryptoPool(_pool).exchange(indexIn, indexOut, _amountIn, 0);
        } else {
          ICurveCryptoPool(_pool).exchange{ value: _amountIn }(indexIn, indexOut, _amountIn, 0, true);
        }
      }
    } else {
      revert("invalid poolType");
    }

    if (_tokenOut == WETH) {
      _wrapTokenIfNeeded(_tokenOut, address(this).balance);
    }
    if (_amountOut == 0) {
      _amountOut = IERC20(_tokenOut).balanceOf(address(this)) - _balanceBefore;
    }
    if (_recipient != address(this)) {
      IERC20(_tokenOut).safeTransfer(_recipient, _amountOut);
    }
  }

  /*****************************************
   * Internal Functions for Token Wrapping *
   *****************************************/

  /// @dev Query the amount of output token by wrapping.
  /// @param _poolType The pool type.
  /// @param _encoding The customized encoding of the route.
  /// @param _amountIn The amount of input token.
  /// @return _amountOut The amount of output token.
  function _queryWrap(
    uint256 _poolType,
    uint256 _encoding,
    uint256 _amountIn
  ) internal view returns (uint256 _amountOut) {
    address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);
    if (4 <= _poolType && _poolType <= 8) {
      uint256 _tokens = ((_encoding >> 160) & 7) + 1;
      uint256 _indexIn = (_encoding >> 166) & 7;
      require(2 <= _tokens && _tokens <= 4, "invalid tokens");

      // compute actual token amount and actual pool
      if (_poolType == 6 && ((_encoding >> 169) & 1) == 1) {
        address _token = ICurveYPoolDeposit(_pool).coins(int128(_indexIn));
        address _underlying = ICurveYPoolDeposit(_pool).underlying_coins(int128(_indexIn));
        if (_token != _underlying) {
          assembly {
            // keccack("exchangeRateStored()")
            mstore(0x00, 0x182df0f500000000000000000000000000000000000000000000000000000000)
            let success := staticcall(gas(), _token, 0x00, 0x04, 0x00, 0x20)
            if success {
              _amountIn := div(mul(_amountIn, 1000000000000000000), mload(0x00))
            }
          }
        }
        _pool = ICurveYPoolDeposit(_pool).curve();
      } else {
        _pool = _getTokenMinter(_pool);
      }

      if (_tokens == 2) {
        uint256[2] memory _amounts;
        _amounts[_indexIn] = _amountIn;
        // some old pools are using `calc_token_amount(uint256[2])`
        // we use `calc_token_amount(uint256[2],bool)` first and then try `calc_token_amount(uint256[2])`
        assembly {
          // keccack("calc_token_amount(uint256[2],bool)")
          let p := mload(0x40)
          mstore(p, 0xed8e84f300000000000000000000000000000000000000000000000000000000)
          switch _indexIn
          case 0 {
            mstore(add(p, 0x04), _amountIn)
            mstore(add(p, 0x24), 0)
          }
          default {
            mstore(add(p, 0x04), 0)
            mstore(add(p, 0x24), _amountIn)
          }
          mstore(add(p, 0x44), 1)
          mstore(0x00, 0)
          let success := staticcall(gas(), _pool, p, 0x64, 0x00, 0x20)
          if success {
            _amountOut := mload(0x00)
          }
        }
        if (_amountOut == 0) {
          _amountOut = ICurvePlainPool(_pool).calc_token_amount(_amounts);
        }
      } else if (_tokens == 3) {
        uint256[3] memory _amounts;
        _amounts[_indexIn] = _amountIn;
        _amountOut = ICurvePlainPool(_pool).calc_token_amount(_amounts, true);
      } else {
        uint256[4] memory _amounts;
        _amounts[_indexIn] = _amountIn;
        _amountOut = ICurvePlainPool(_pool).calc_token_amount(_amounts, true);
      }
    } else if (_poolType == 9) {
      _amountOut = IERC4626(_pool).previewDeposit(_amountIn);
    }
  }

  /// @dev Wrap from one token to another token.
  /// @param _poolType The pool type.
  /// @param _encoding The customized encoding of the route.
  /// @param _amountIn The amount of input token.
  /// @param _recipient The address of output token receiver.
  /// @return _amountOut The amount of output token.
  function _wrap(
    uint256 _poolType,
    uint256 _encoding,
    uint256 _amountIn,
    address _recipient
  ) internal returns (uint256 _amountOut) {
    (address _tokenIn, address _tokenOut) = _getTokenPair(_poolType, 1, _encoding);
    address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);

    if ((_poolType == 4 || _poolType == 8) && ((_encoding >> 169) & 1) == 1) {
      // tokenIn is (W)ETH and we are going to use ETH.
      _unwrapIfNeeded(_amountIn);
    } else {
      _wrapTokenIfNeeded(_tokenIn, _amountIn);
    }

    uint256 _balanceBefore = IERC20(_tokenOut).balanceOf(address(this));
    if (4 <= _poolType && _poolType <= 8) {
      _pool = _getTokenMinter(_pool);
      uint256 _tokens = ((_encoding >> 160) & 7) + 1;
      uint256 _indexIn = (_encoding >> 163) & 7;
      require(2 <= _tokens && _tokens <= 4, "invalid tokens");

      if (_poolType == 5) {
        bool _use_underlying = ((_encoding >> 169) & 1) == 1;
        _approve(_tokenIn, _pool, _amountIn);
        if (_tokens == 2) {
          uint256[2] memory _amounts;
          _amounts[_indexIn] = _amountIn;
          ICurveAPool(_pool).add_liquidity(_amounts, 0, _use_underlying);
        } else if (_tokens == 3) {
          uint256[3] memory _amounts;
          _amounts[_indexIn] = _amountIn;
          ICurveAPool(_pool).add_liquidity(_amounts, 0, _use_underlying);
        } else {
          uint256[4] memory _amounts;
          _amounts[_indexIn] = _amountIn;
          ICurveAPool(_pool).add_liquidity(_amounts, 0, _use_underlying);
        }
      } else {
        bool _use_eth = (_poolType == 4 || _poolType == 8) && (((_encoding >> 169) & 1) == 1);
        if (!_use_eth) {
          _approve(_tokenIn, _pool, _amountIn);
        }
        if (_tokens == 2) {
          uint256[2] memory _amounts;
          _amounts[_indexIn] = _amountIn;
          if (_use_eth) {
            if (_poolType == 8) {
              ICurveCryptoPool(_pool).add_liquidity{ value: _amountIn }(_amounts, 0, true);
            } else {
              ICurvePlainPool(_pool).add_liquidity{ value: _amountIn }(_amounts, 0);
            }
          } else {
            ICurvePlainPool(_pool).add_liquidity(_amounts, 0);
          }
        } else if (_tokens == 3) {
          uint256[3] memory _amounts;
          _amounts[_indexIn] = _amountIn;
          if (_use_eth) {
            if (_poolType == 8) {
              ICurveTriCryptoPool(_pool).add_liquidity{ value: _amountIn }(_amounts, 0, true);
            } else {
              ICurvePlainPool(_pool).add_liquidity{ value: _amountIn }(_amounts, 0);
            }
          } else {
            ICurvePlainPool(_pool).add_liquidity(_amounts, 0);
          }
        } else {
          uint256[4] memory _amounts;
          _amounts[_indexIn] = _amountIn;
          if (_use_eth) {
            ICurvePlainPool(_pool).add_liquidity{ value: _amountIn }(_amounts, 0);
          } else {
            ICurvePlainPool(_pool).add_liquidity(_amounts, 0);
          }
        }
      }
    } else if (_poolType == 9) {
      _approve(_tokenIn, _pool, _amountIn);
      _amountOut = IERC4626(_pool).deposit(_amountIn, _recipient);
      return _amountOut;
    } else {
      revert("invalid poolType");
    }

    _amountOut = IERC20(_tokenOut).balanceOf(address(this)) - _balanceBefore;
    if (_recipient != address(this)) {
      IERC20(_tokenOut).safeTransfer(_recipient, _amountOut);
    }
  }

  /*******************************************
   * Internal Functions for Token Unwrapping *
   *******************************************/

  /// @dev Query the amount of output token by unwrapping.
  /// @param _poolType The pool type.
  /// @param _encoding The customized encoding of the route.
  /// @param _amountIn The amount of input token.
  /// @return _amountOut The amount of output token.
  function _queryUnwrap(
    uint256 _poolType,
    uint256 _encoding,
    uint256 _amountIn
  ) internal view returns (uint256 _amountOut) {
    address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);

    if (4 <= _poolType && _poolType <= 8) {
      if (_poolType != 6) {
        _pool = _getTokenMinter(_pool);
      }
      uint256 _indexOut = (_encoding >> 166) & 7;
      if (_poolType == 8) {
        _amountOut = ICurveCryptoPool(_pool).calc_withdraw_one_coin(_amountIn, _indexOut);
      } else {
        _amountOut = ICurvePlainPool(_pool).calc_withdraw_one_coin(_amountIn, int128(_indexOut));
      }
    } else if (_poolType == 9) {
      _amountOut = IERC4626(_pool).previewRedeem(_amountIn);
    }
  }

  /// @dev Unwrap from one token to another token.
  /// @param _poolType The pool type.
  /// @param _encoding The customized encoding of the route.
  /// @param _amountIn The amount of input token.
  /// @param _recipient The address of output token receiver.
  /// @return _amountOut The amount of output token.
  function _unwrap(
    uint256 _poolType,
    uint256 _encoding,
    uint256 _amountIn,
    address _recipient
  ) internal returns (uint256 _amountOut) {
    (address _tokenIn, address _tokenOut) = _getTokenPair(_poolType, 2, _encoding);
    address _pool = address(_encoding & 1461501637330902918203684832716283019655932542975);

    uint256 _balanceBefore = IERC20(_tokenOut).balanceOf(address(this));
    if (4 <= _poolType && _poolType <= 8) {
      if (_poolType != 6) {
        _pool = _getTokenMinter(_pool);
      }
      uint256 _tokens = ((_encoding >> 160) & 7) + 1;
      uint256 _indexOut = (_encoding >> 166) & 7;
      require(2 <= _tokens && _tokens <= 4, "invalid tokens");

      if (_poolType == 4) {
        ICurvePlainPool(_pool).remove_liquidity_one_coin(_amountIn, int128(_indexOut), 0);
      } else if (_poolType == 5) {
        bool _use_underlying = ((_encoding >> 169) & 1) == 1;
        ICurveAPool(_pool).remove_liquidity_one_coin(_amountIn, int128(_indexOut), 0, _use_underlying);
      } else if (_poolType == 6) {
        _approve(_tokenIn, _pool, _amountIn);
        ICurveYPoolDeposit(_pool).remove_liquidity_one_coin(_amountIn, int128(_indexOut), 0, true);
      } else if (_poolType == 7) {
        ICurveMetaPoolSwap(_pool).remove_liquidity_one_coin(_amountIn, int128(_indexOut), 0);
      } else {
        ICurveCryptoPool(_pool).remove_liquidity_one_coin(_amountIn, _indexOut, 0);
      }
    } else if (_poolType == 9) {
      _amountOut = IERC4626(_pool).redeem(_amountIn, _recipient, address(this));
      return _amountOut;
    } else {
      revert("invalid poolType");
    }

    if (_tokenOut == WETH) {
      _wrapTokenIfNeeded(_tokenOut, address(this).balance);
    }

    _amountOut = IERC20(_tokenOut).balanceOf(address(this)) - _balanceBefore;
    if (_recipient != address(this)) {
      IERC20(_tokenOut).safeTransfer(_recipient, _amountOut);
    }
  }
}

File 2 of 25 : 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 25 : 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 25 : 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 25 : 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 25 : 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 25 : 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 25 : IERC4626.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

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

import "../../interfaces/IERC20Metadata.sol";

// Copy from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/interfaces/IERC4626.sol

/**
 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
 *
 * _Available since v4.7._
 */
interface IERC4626 is IERC20, IERC20Metadata {
  event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

  event Withdraw(
    address indexed sender,
    address indexed receiver,
    address indexed owner,
    uint256 assets,
    uint256 shares
  );

  /**
   * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
   *
   * - MUST be an ERC-20 token contract.
   * - MUST NOT revert.
   */
  function asset() external view returns (address assetTokenAddress);

  /**
   * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
   *
   * - SHOULD include any compounding that occurs from yield.
   * - MUST be inclusive of any fees that are charged against assets in the Vault.
   * - MUST NOT revert.
   */
  function totalAssets() external view returns (uint256 totalManagedAssets);

  /**
   * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
   * scenario where all the conditions are met.
   *
   * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
   * - MUST NOT show any variations depending on the caller.
   * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
   * - MUST NOT revert.
   *
   * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
   * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
   * from.
   */
  function convertToShares(uint256 assets) external view returns (uint256 shares);

  /**
   * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
   * scenario where all the conditions are met.
   *
   * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
   * - MUST NOT show any variations depending on the caller.
   * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
   * - MUST NOT revert.
   *
   * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
   * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
   * from.
   */
  function convertToAssets(uint256 shares) external view returns (uint256 assets);

  /**
   * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
   * through a deposit call.
   *
   * - MUST return a limited value if receiver is subject to some deposit limit.
   * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
   * - MUST NOT revert.
   */
  function maxDeposit(address receiver) external view returns (uint256 maxAssets);

  /**
   * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
   * current on-chain conditions.
   *
   * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
   *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
   *   in the same transaction.
   * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
   *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
   * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
   * - MUST NOT revert.
   *
   * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
   * share price or some other type of condition, meaning the depositor will lose assets by depositing.
   */
  function previewDeposit(uint256 assets) external view returns (uint256 shares);

  /**
   * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
   *
   * - MUST emit the Deposit event.
   * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
   *   deposit execution, and are accounted for during deposit.
   * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
   *   approving enough underlying tokens to the Vault contract, etc).
   *
   * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
   */
  function deposit(uint256 assets, address receiver) external returns (uint256 shares);

  /**
   * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
   * - MUST return a limited value if receiver is subject to some mint limit.
   * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
   * - MUST NOT revert.
   */
  function maxMint(address receiver) external view returns (uint256 maxShares);

  /**
   * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
   * current on-chain conditions.
   *
   * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
   *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
   *   same transaction.
   * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
   *   would be accepted, regardless if the user has enough tokens approved, etc.
   * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
   * - MUST NOT revert.
   *
   * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
   * share price or some other type of condition, meaning the depositor will lose assets by minting.
   */
  function previewMint(uint256 shares) external view returns (uint256 assets);

  /**
   * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
   *
   * - MUST emit the Deposit event.
   * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
   *   execution, and are accounted for during mint.
   * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
   *   approving enough underlying tokens to the Vault contract, etc).
   *
   * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
   */
  function mint(uint256 shares, address receiver) external returns (uint256 assets);

  /**
   * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
   * Vault, through a withdraw call.
   *
   * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
   * - MUST NOT revert.
   */
  function maxWithdraw(address owner) external view returns (uint256 maxAssets);

  /**
   * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
   * given current on-chain conditions.
   *
   * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
   *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
   *   called
   *   in the same transaction.
   * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
   *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
   * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
   * - MUST NOT revert.
   *
   * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
   * share price or some other type of condition, meaning the depositor will lose assets by depositing.
   */
  function previewWithdraw(uint256 assets) external view returns (uint256 shares);

  /**
   * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
   *
   * - MUST emit the Withdraw event.
   * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
   *   withdraw execution, and are accounted for during withdraw.
   * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
   *   not having enough shares, etc).
   *
   * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
   * Those methods should be performed separately.
   */
  function withdraw(
    uint256 assets,
    address receiver,
    address owner
  ) external returns (uint256 shares);

  /**
   * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
   * through a redeem call.
   *
   * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
   * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
   * - MUST NOT revert.
   */
  function maxRedeem(address owner) external view returns (uint256 maxShares);

  /**
   * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
   * given current on-chain conditions.
   *
   * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
   *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
   *   same transaction.
   * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
   *   redemption would be accepted, regardless if the user has enough shares, etc.
   * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
   * - MUST NOT revert.
   *
   * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
   * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
   */
  function previewRedeem(uint256 shares) external view returns (uint256 assets);

  /**
   * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
   *
   * - MUST emit the Withdraw event.
   * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
   *   redeem execution, and are accounted for during redeem.
   * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
   *   not having enough shares, etc).
   *
   * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
   * Those methods should be performed separately.
   */
  function redeem(
    uint256 shares,
    address receiver,
    address owner
  ) external returns (uint256 assets);
}

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

pragma solidity ^0.7.6;

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

import { IWETH } from "../../interfaces/IWETH.sol";
import { ITokenConverter } from "./ITokenConverter.sol";

abstract contract ConverterBase is ITokenConverter {
  using SafeERC20 for IERC20;

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

  /// @inheritdoc ITokenConverter
  address public immutable override registry;

  /// @dev The address of ETH which is commonly used.
  address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

  /// @dev The address of WETH token.
  address internal constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;

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

  constructor(address _registry) {
    registry = _registry;
  }

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

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

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

  /// @inheritdoc ITokenConverter
  function withdrawFund(address _token, address _recipient) external override {
    require(msg.sender == registry, "only registry");

    if (_token == address(0)) {
      (bool success, ) = _recipient.call{ value: address(this).balance }("");
      require(success, "withdraw ETH failed");
    } else {
      IERC20(_token).safeTransfer(_recipient, IERC20(_token).balanceOf(address(this)));
    }
  }

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

  /// @dev Internal function to get the pool type of the route.
  /// @param encoding The route encoding.
  function _getPoolType(uint256 encoding) internal pure returns (uint256) {
    return encoding & 255;
  }

  /// @dev Internal function to get the action of the route.
  /// @param encoding The route encoding.
  function _getAction(uint256 encoding) internal pure returns (uint256) {
    return (encoding >> 8) & 3;
  }

  function _isETH(address _token) internal pure returns (bool) {
    return _token == ETH || _token == address(0);
  }

  function _wrapTokenIfNeeded(address _token, uint256 _amount) internal {
    if (_token == WETH && IERC20(_token).balanceOf(address(this)) < _amount) {
      IWETH(_token).deposit{ value: _amount }();
    }
  }

  function _unwrapIfNeeded(uint256 _amount) internal {
    if (address(this).balance < _amount) {
      IWETH(WETH).withdraw(_amount);
    }
  }

  function _approve(
    address _token,
    address _spender,
    uint256 _amount
  ) internal {
    if (!_isETH(_token) && IERC20(_token).allowance(address(this), _spender) < _amount) {
      // hBTC cannot approve 0
      if (_token != 0x0316EB71485b0Ab14103307bf65a021042c6d380) {
        IERC20(_token).safeApprove(_spender, 0);
      }
      IERC20(_token).safeApprove(_spender, uint256(-1));
    }
  }
}

File 10 of 25 : IConverterRegistry.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

interface IConverterRegistry {
  /**********
   * Events *
   **********/

  /// @notice Emitted when the converter route is updated.
  /// @param src The address of source token.
  /// @param dst The address of destination token.
  /// @param routes The list of route encodings.
  event UpdateRoute(address indexed src, address indexed dst, uint256[] routes);

  /// @notice Emitted when the token converter is updated for some pool type.
  /// @param poolType The pool type updated.
  /// @param oldConverter The address of previous converter.
  /// @param newConverter The address of current converter.
  event UpdateConverter(uint256 indexed poolType, address indexed oldConverter, address indexed newConverter);

  /*************************
   * Public View Functions *
   *************************/

  /// @notice Return the routes used to convert source token to destination token.
  /// @param src The address of source token.
  /// @param dst The address of destination token.
  /// @return routes The list of route encodings.
  function getRoutes(address src, address dst) external view returns (uint256[] memory routes);

  /// @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 Return the address of converter for a specific pool type.
  /// @param poolType The type of converter.
  /// @return converter The address of converter.
  function getConverter(uint256 poolType) external view returns (address converter);
}

File 11 of 25 : 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 12 of 25 : IBalancerPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IBalancerPool {
  function getPoolId() external view returns (bytes32);
}

File 13 of 25 : IBalancerV1Pool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IBalancerV1Pool {
  function getCurrentTokens() external view returns (address[] memory tokens);

  function joinPool(uint256 poolAmountOut, uint256[] calldata maxAmountsIn) external;

  function exitPool(uint256 poolAmountIn, uint256[] calldata minAmountsOut) external;

  function swapExactAmountIn(
    address tokenIn,
    uint256 tokenAmountIn,
    address tokenOut,
    uint256 minAmountOut,
    uint256 maxPrice
  ) external returns (uint256 tokenAmountOut, uint256 spotPriceAfter);

  function swapExactAmountOut(
    address tokenIn,
    uint256 maxAmountIn,
    address tokenOut,
    uint256 tokenAmountOut,
    uint256 maxPrice
  ) external returns (uint256 tokenAmountIn, uint256 spotPriceAfter);

  function joinswapExternAmountIn(
    address tokenIn,
    uint256 tokenAmountIn,
    uint256 minPoolAmountOut
  ) external returns (uint256 poolAmountOut);

  function joinswapPoolAmountOut(
    address tokenIn,
    uint256 poolAmountOut,
    uint256 maxAmountIn
  ) external returns (uint256 tokenAmountIn);

  function exitswapPoolAmountIn(
    address tokenOut,
    uint256 poolAmountIn,
    uint256 minAmountOut
  ) external returns (uint256 tokenAmountOut);

  function exitswapExternAmountOut(
    address tokenOut,
    uint256 tokenAmountOut,
    uint256 maxPoolAmountIn
  ) external returns (uint256 poolAmountIn);

  function getBalance(address token) external view returns (uint256);

  function getDenormalizedWeight(address token) external view returns (uint256);

  function getSwapFee() external view returns (uint256);

  /**********************************************************************************************
    // calcOutGivenIn                                                                            //
    // aO = tokenAmountOut                                                                       //
    // bO = tokenBalanceOut                                                                      //
    // bI = tokenBalanceIn              /      /            bI             \    (wI / wO) \      //
    // aI = tokenAmountIn    aO = bO * |  1 - | --------------------------  | ^            |     //
    // wI = tokenWeightIn               \      \ ( bI + ( aI * ( 1 - sF )) /              /      //
    // wO = tokenWeightOut                                                                       //
    // sF = swapFee                                                                              //
    **********************************************************************************************/
  function calcOutGivenIn(
    uint256 tokenBalanceIn,
    uint256 tokenWeightIn,
    uint256 tokenBalanceOut,
    uint256 tokenWeightOut,
    uint256 tokenAmountIn,
    uint256 swapFee
  ) external view returns (uint256 tokenAmountOut);
}

File 14 of 25 : IBalancerVault.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma abicoder v2;

interface IBalancerVault {
  enum JoinKind {
    INIT,
    EXACT_TOKENS_IN_FOR_BPT_OUT,
    TOKEN_IN_FOR_EXACT_BPT_OUT,
    ALL_TOKENS_IN_FOR_EXACT_BPT_OUT
  }

  enum ExitKind {
    EXACT_BPT_IN_FOR_ONE_TOKEN_OUT,
    EXACT_BPT_IN_FOR_TOKENS_OUT,
    BPT_IN_FOR_EXACT_TOKENS_OUT
  }

  enum SwapKind {
    GIVEN_IN,
    GIVEN_OUT
  }

  struct SingleSwap {
    bytes32 poolId;
    SwapKind kind;
    address assetIn;
    address assetOut;
    uint256 amount;
    bytes userData;
  }

  struct FundManagement {
    address sender;
    bool fromInternalBalance;
    address payable recipient;
    bool toInternalBalance;
  }

  function getPoolTokens(bytes32 poolId)
    external
    view
    returns (
      address[] memory tokens,
      uint256[] memory balances,
      uint256 lastChangeBlock
    );

  function swap(
    SingleSwap memory singleSwap,
    FundManagement memory funds,
    uint256 limit,
    uint256 deadline
  ) external payable returns (uint256 amountCalculated);

  struct JoinPoolRequest {
    address[] assets;
    uint256[] maxAmountsIn;
    bytes userData;
    bool fromInternalBalance;
  }

  function joinPool(
    bytes32 poolId,
    address sender,
    address recipient,
    JoinPoolRequest memory request
  ) external payable;

  struct ExitPoolRequest {
    address[] assets;
    uint256[] minAmountsOut;
    bytes userData;
    bool toInternalBalance;
  }

  function exitPool(
    bytes32 poolId,
    address sender,
    address payable recipient,
    ExitPoolRequest memory request
  ) external;

  /**
   * @dev Data for each individual swap executed by `batchSwap`. The asset in and out fields are indexes into the
   * `assets` array passed to that function, and ETH assets are converted to WETH.
   *
   * If `amount` is zero, the multihop mechanism is used to determine the actual amount based on the amount in/out
   * from the previous swap, depending on the swap kind.
   *
   * The `userData` field is ignored by the Vault, but forwarded to the Pool in the `onSwap` hook, and may be
   * used to extend swap behavior.
   */
  struct BatchSwapStep {
    bytes32 poolId;
    uint256 assetInIndex;
    uint256 assetOutIndex;
    uint256 amount;
    bytes userData;
  }

  // This function is not marked as `nonReentrant` because the underlying mechanism relies on reentrancy
  function queryBatchSwap(
    SwapKind kind,
    BatchSwapStep[] memory swaps,
    address[] memory assets,
    FundManagement memory funds
  ) external returns (int256[] memory);
}

File 15 of 25 : ICurveAPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

// solhint-disable var-name-mixedcase, func-name-mixedcase

interface ICurveAPool {
  function remove_liquidity_one_coin(
    uint256 _token_amount,
    int128 i,
    uint256 _min_amount,
    bool _use_underlying
  ) external returns (uint256);

  function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256);

  function exchange(
    int128 i,
    int128 j,
    uint256 dx,
    uint256 min_dy
  ) external returns (uint256);

  function exchange_underlying(
    int128 i,
    int128 j,
    uint256 dx,
    uint256 min_dy
  ) external returns (uint256);

  function get_dy(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function get_dy_underlying(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function add_liquidity(
    uint256[2] memory _amounts,
    uint256 _min_mint_amount,
    bool _use_underlying
  ) external returns (uint256);

  function calc_token_amount(uint256[2] memory amounts, bool is_deposit) external view returns (uint256);

  function add_liquidity(
    uint256[3] memory _amounts,
    uint256 _min_mint_amount,
    bool _use_underlying
  ) external returns (uint256);

  function calc_token_amount(uint256[3] memory amounts, bool is_deposit) external view returns (uint256);

  function add_liquidity(
    uint256[4] memory _amounts,
    uint256 _min_mint_amount,
    bool _use_underlying
  ) external returns (uint256);

  function calc_token_amount(uint256[4] memory amounts, bool is_deposit) external view returns (uint256);

  function coins(uint256 index) external view returns (address);

  function underlying_coins(uint256 index) external view returns (address);

  function lp_token() external view returns (address);
}

/// @dev This is the interface of Curve aave-style Pool with 2 tokens, examples:
/// + saave: https://curve.fi/saave
interface ICurveA2Pool is ICurveAPool {

}

/// @dev This is the interface of Curve aave-style Pool with 3 tokens, examples:
/// aave: https://curve.fi/aave
/// ironbank: https://curve.fi/ib
interface ICurveA3Pool is ICurveAPool {

}

/// @dev This is the interface of Curve aave-style Pool with 3 tokens, examples:
interface ICurveA4Pool is ICurveAPool {

}

File 16 of 25 : ICurveCryptoPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.0 || ^0.8.0;

// solhint-disable func-name-mixedcase, var-name-mixedcase

/// @dev This is the interface of Curve Crypto Pools (including Factory Pool), examples:
/// + cvxeth: https://curve.fi/cvxeth
/// + crveth: https://curve.fi/crveth
/// + eursusd: https://curve.fi/eursusd
/// + teth: https://curve.fi/teth
/// + spelleth: https://curve.fi/spelleth

/// + FXS/ETH: https://curve.fi/factory-crypto/3
/// + YFI/ETH: https://curve.fi/factory-crypto/8
/// + AAVE/palStkAAVE: https://curve.fi/factory-crypto/9
/// + DYDX/ETH: https://curve.fi/factory-crypto/10
/// + SDT/ETH: https://curve.fi/factory-crypto/11
/// + BTRFLY/ETH: https://curve.fi/factory-crypto/17
/// + cvxFXS/FXS: https://curve.fi/factory-crypto/18
interface ICurveCryptoPool {
  function lp_price() external view returns (uint256);

  function price_oracle() external view returns (uint256);

  function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external payable returns (uint256);

  function add_liquidity(
    uint256[2] memory amounts,
    uint256 min_mint_amount,
    bool use_eth
  ) external payable returns (uint256);

  function calc_token_amount(uint256[2] memory amounts) external view returns (uint256);

  function remove_liquidity_one_coin(
    uint256 token_amount,
    uint256 i,
    uint256 min_amount
  ) external returns (uint256);

  function calc_withdraw_one_coin(uint256 token_amount, uint256 i) external view returns (uint256);

  function exchange(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy
  ) external payable;

  function exchange(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy,
    bool use_eth
  ) external payable;

  function exchange(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy,
    bool use_eth,
    address receiver
  ) external payable;

  function exchange_underlying(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy
  ) external payable returns (uint256);

  function exchange_underlying(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy,
    address receiver
  ) external payable returns (uint256);

  function get_dy(
    uint256 i,
    uint256 j,
    uint256 dx
  ) external view returns (uint256);

  function coins(uint256 index) external view returns (address);

  function token() external view returns (address);
}

/// @dev This is the interface of Zap Contract for Curve Meta Crypto Pools, examples:
/// + eurtusd: https://curve.fi/eurtusd
/// + xautusd: https://curve.fi/xautusd
interface IZapCurveMetaCryptoPool {
  function add_liquidity(uint256[4] memory amounts, uint256 min_mint_amount) external returns (uint256);

  function calc_token_amount(uint256[4] memory amounts) external view returns (uint256);

  function remove_liquidity_one_coin(
    uint256 token_amount,
    uint256 i,
    uint256 min_amount
  ) external;

  function calc_withdraw_one_coin(uint256 token_amount, uint256 i) external view returns (uint256);

  function exchange_underlying(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy
  ) external returns (uint256);

  function get_dy_underlying(
    uint256 i,
    uint256 j,
    uint256 dx
  ) external view returns (uint256);

  function coins(uint256 index) external view returns (address);

  function underlying_coins(uint256 index) external view returns (address);

  function token() external view returns (address);

  function base_pool() external view returns (address);

  function pool() external view returns (address);
}

/// @dev This is the interface of Curve Tri Crypto Pools, examples:
/// + tricrypto2: https://curve.fi/tricrypto2
/// + tricrypto: https://curve.fi/tricrypto
interface ICurveTriCryptoPool {
  function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount) external payable;

  function add_liquidity(
    uint256[3] memory amounts,
    uint256 min_mint_amount,
    bool use_eth
  ) external payable;

  function calc_token_amount(uint256[3] memory amounts, bool deposit) external view returns (uint256);

  function remove_liquidity_one_coin(
    uint256 token_amount,
    uint256 i,
    uint256 min_amount
  ) external;

  function calc_withdraw_one_coin(uint256 token_amount, uint256 i) external view returns (uint256);

  function exchange(
    uint256 i,
    uint256 j,
    uint256 dx,
    uint256 min_dy,
    bool use_eth
  ) external;

  function get_dy(
    uint256 i,
    uint256 j,
    uint256 dx
  ) external view returns (uint256);

  function token() external view returns (address);

  function coins(uint256 index) external returns (address);
}

File 17 of 25 : ICurveMetaPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

// solhint-disable var-name-mixedcase, func-name-mixedcase

/// @dev This is the interface of Curve Meta Pool with (3pool or sbtc), examples:
/// + ust: https://curve.fi/ust
/// + dusd: https://www.curve.fi/dusd
/// + gusd: https://curve.fi/gusd
/// + husd: https://curve.fi/husd
/// + rai: https://curve.fi/rai
/// + musd: https://curve.fi/musd
///
/// + bbtc: https://curve.fi/bbtc
/// + obtc: https://www.curve.fi/obtc
/// + pbtc: https://www.curve.fi/pbtc
/// + tbtc: https://www.curve.fi/tbtc
interface ICurveMetaPoolSwap {
  function add_liquidity(uint256[2] memory _amounts, uint256 _min_mint_amount) external returns (uint256);

  function calc_token_amount(uint256[2] memory amounts, bool is_deposit) external view returns (uint256);

  function remove_liquidity_one_coin(
    uint256 token_amount,
    int128 i,
    uint256 min_amount
  ) external returns (uint256);

  function calc_withdraw_one_coin(uint256 token_amount, int128 i) external view returns (uint256);

  function exchange(
    int128 i,
    int128 j,
    uint256 dx,
    uint256 min_dy
  ) external returns (uint256);

  function exchange_underlying(
    int128 i,
    int128 j,
    uint256 dx,
    uint256 min_dy
  ) external returns (uint256);

  function get_dy(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function get_dy_underlying(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function base_pool() external view returns (address);

  function base_coins(uint256 index) external view returns (address);

  function coins(uint256 index) external view returns (address);

  function token() external view returns (address);
}

interface ICurveMetaPoolDeposit {
  function add_liquidity(uint256[4] memory amounts, uint256 min_mint_amount) external returns (uint256);

  function calc_token_amount(uint256[4] memory amounts, bool is_deposit) external view returns (uint256);

  function remove_liquidity_one_coin(
    uint256 token_amount,
    int128 i,
    uint256 min_amount
  ) external returns (uint256);

  function calc_withdraw_one_coin(uint256 token_amount, int128 i) external view returns (uint256);

  function token() external view returns (address);

  function base_pool() external view returns (address);

  function pool() external view returns (address);

  function coins(uint256 index) external view returns (address);

  function base_coins(uint256 index) external view returns (address);
}

File 18 of 25 : ICurvePlainPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

// solhint-disable var-name-mixedcase, func-name-mixedcase

interface ICurvePlainPool {
  function exchange(
    int128 i,
    int128 j,
    uint256 dx,
    uint256 min_dy
  ) external payable;

  function get_dy(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function add_liquidity(uint256[2] memory amounts, uint256 min_mint_amount) external payable;

  function calc_token_amount(uint256[2] memory amounts) external view returns (uint256);

  function calc_token_amount(uint256[2] memory amounts, bool deposit) external view returns (uint256);

  function add_liquidity(uint256[3] memory amounts, uint256 min_mint_amount) external payable;

  function calc_token_amount(uint256[3] memory amounts, bool deposit) external view returns (uint256);

  function add_liquidity(uint256[4] memory amounts, uint256 min_mint_amount) external payable;

  function calc_token_amount(uint256[4] memory amounts, bool deposit) external view returns (uint256);

  function remove_liquidity_one_coin(
    uint256 _token_amount,
    int128 i,
    uint256 min_amount
  ) external;

  function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256);

  function coins(uint256 index) external view returns (address);

  function balances(uint256 index) external view returns (uint256);

  // ren and sbtc pool
  function coins(int128 index) external view returns (address);

  // ren and sbtc pool
  function balances(int128 index) external view returns (uint256);

  function get_virtual_price() external view returns (uint256);
}

File 19 of 25 : ICurveYPool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

// solhint-disable var-name-mixedcase, func-name-mixedcase

interface ICurveYPoolSwap {
  function exchange(
    int128 i,
    int128 j,
    uint256 dx,
    uint256 min_dy
  ) external;

  function exchange_underlying(
    int128 i,
    int128 j,
    uint256 dx,
    uint256 min_dy
  ) external;

  function get_dy(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function get_dy_underlying(
    int128 i,
    int128 j,
    uint256 dx
  ) external view returns (uint256);

  function add_liquidity(uint256[2] memory _amounts, uint256 _min_mint_amount) external;

  function add_liquidity(uint256[3] memory _amounts, uint256 _min_mint_amount) external;

  function add_liquidity(uint256[4] memory _amounts, uint256 _min_mint_amount) external;

  function coins(uint256 index) external view returns (address);

  function underlying_coins(uint256 index) external view returns (address);

  function coins(int128 index) external view returns (address);

  function underlying_coins(int128 index) external view returns (address);
}

interface ICurveYPoolDeposit {
  function remove_liquidity_one_coin(
    uint256 _token_amount,
    int128 i,
    uint256 _min_amount,
    bool donate_dust
  ) external;

  function calc_withdraw_one_coin(uint256 _token_amount, int128 i) external view returns (uint256);

  function add_liquidity(uint256[2] memory _amounts, uint256 _min_mint_amount) external;

  function add_liquidity(uint256[3] memory _amounts, uint256 _min_mint_amount) external;

  function add_liquidity(uint256[4] memory _amounts, uint256 _min_mint_amount) external;

  function token() external view returns (address);

  function curve() external view returns (address);

  function coins(uint256 index) external view returns (address);

  function underlying_coins(uint256 index) external view returns (address);

  function coins(int128 index) external view returns (address);

  function underlying_coins(int128 index) external view returns (address);
}

// solhint-disable var-name-mixedcase, func-name-mixedcase
/// @dev This is the interface of Curve yearn-style Pool with 2 tokens, examples:
/// + compound: https://curve.fi/compound
interface ICurveY2PoolDeposit is ICurveYPoolDeposit {

}

interface ICurveY2PoolSwap is ICurveYPoolSwap {}

/// @dev This is the interface of Curve yearn-style Pool with 3 tokens, examples:
/// usdt: https://curve.fi/usdt
interface ICurveY3PoolDeposit is ICurveYPoolDeposit {

}

interface ICurveY3PoolSwap is ICurveYPoolSwap {}

/// @dev This is the interface of Curve yearn-style Pool with 4 tokens, examples:
/// + pax: https://curve.fi/pax
/// + y: https://curve.fi/iearn
/// + busd: https://curve.fi/busd
/// + susd v2: https://curve.fi/susdv2
interface ICurveY4PoolDeposit is ICurveYPoolDeposit {

}

interface ICurveY4PoolSwap is ICurveYPoolSwap {}

File 20 of 25 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IERC20Metadata {
  function decimals() external view returns (uint8);

  function symbol() external view returns (string memory);

  function name() external view returns (string memory);
}

File 21 of 25 : IUniswapV2Pair.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IUniswapV2Pair {
  function token0() external view returns (address);

  function token1() external view returns (address);

  function getReserves()
    external
    view
    returns (
      uint112 _reserve0,
      uint112 _reserve1,
      uint32 _blockTimestampLast
    );

  function swap(
    uint256 amount0Out,
    uint256 amount1Out,
    address to,
    bytes calldata data
  ) external;

  // fraxswap
  function executeVirtualOrders(uint256 blockTimestamp) external;

  // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
  function getAmountOut(uint256 amountIn, address tokenIn) external view returns (uint256);
}

File 22 of 25 : IUniswapV3Pool.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IUniswapV3Pool {
  /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
  /// @return The contract address
  function factory() external view returns (address);

  /// @notice The first of the two tokens of the pool, sorted by address
  /// @return The token contract address
  function token0() external view returns (address);

  /// @notice The second of the two tokens of the pool, sorted by address
  /// @return The token contract address
  function token1() external view returns (address);

  /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
  /// @return The fee
  function fee() external view returns (uint24);

  /// @notice Swap token0 for token1, or token1 for token0
  /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
  /// @param recipient The address to receive the output of the swap
  /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
  /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
  /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
  /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
  /// @param data Any data to be passed through to the callback
  /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
  /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
  function swap(
    address recipient,
    bool zeroForOne,
    int256 amountSpecified,
    uint160 sqrtPriceLimitX96,
    bytes calldata data
  ) external returns (int256 amount0, int256 amount1);
}

File 23 of 25 : IUniswapV3Quoter.sol
// SPDX-License-Identifier: MIT

pragma solidity >=0.7.6;
pragma abicoder v2;

/// @title Quoter Interface
/// @notice Supports quoting the calculated amounts from exact input or exact output swaps
/// @dev These functions are not marked view because they rely on calling non-view functions and reverting
/// to compute the result. They are also not gas efficient and should not be called on-chain.
interface IUniswapV3Quoter {
  /// @notice Returns the amount out received for a given exact input swap without executing the swap
  /// @param path The path of the swap, i.e. each token pair and the pool fee
  /// @param amountIn The amount of the first token to swap
  /// @return amountOut The amount of the last token that would be received
  function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut);

  /// @notice Returns the amount out received for a given exact input but for a swap of a single pool
  /// @param tokenIn The token being swapped in
  /// @param tokenOut The token being swapped out
  /// @param fee The fee of the token pool to consider for the pair
  /// @param amountIn The desired input amount
  /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
  /// @return amountOut The amount of `tokenOut` that would be received
  function quoteExactInputSingle(
    address tokenIn,
    address tokenOut,
    uint24 fee,
    uint256 amountIn,
    uint160 sqrtPriceLimitX96
  ) external returns (uint256 amountOut);

  /// @notice Returns the amount in required for a given exact output swap without executing the swap
  /// @param path The path of the swap, i.e. each token pair and the pool fee
  /// @param amountOut The amount of the last token to receive
  /// @return amountIn The amount of first token required to be paid
  function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn);

  /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool
  /// @param tokenIn The token being swapped in
  /// @param tokenOut The token being swapped out
  /// @param fee The fee of the token pool to consider for the pair
  /// @param amountOut The desired output amount
  /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
  /// @return amountIn The amount required as the input for the swap in order to receive `amountOut`
  function quoteExactOutputSingle(
    address tokenIn,
    address tokenOut,
    uint24 fee,
    uint256 amountOut,
    uint160 sqrtPriceLimitX96
  ) external returns (uint256 amountIn);
}

File 24 of 25 : IUniswapV3Router.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma abicoder v2;

interface IUniswapV3Router {
  struct ExactInputSingleParams {
    address tokenIn;
    address tokenOut;
    uint24 fee;
    address recipient;
    uint256 deadline;
    uint256 amountIn;
    uint256 amountOutMinimum;
    uint160 sqrtPriceLimitX96;
  }

  function exactInputSingle(ExactInputSingleParams calldata params) external returns (uint256 amountOut);
}

File 25 of 25 : IWETH.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;

interface IWETH {
  function deposit() external payable;

  function withdraw(uint256 wad) external;
}

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":"_registry","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"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"uint256","name":"_encoding","type":"uint256"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"convert","outputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_route","type":"uint256"}],"name":"getTokenPair","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_encoding","type":"uint256"},{"internalType":"uint256","name":"_amountIn","type":"uint256"}],"name":"queryConvert","outputs":[{"internalType":"uint256","name":"_amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supportedPoolTypes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"tokenMinter","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_supportedPoolTypes","type":"uint256"}],"name":"updateSupportedPoolTypes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"address[]","name":"_minters","type":"address[]"}],"name":"updateTokenMinter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_recipient","type":"address"}],"name":"withdrawFund","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a06040523480156200001157600080fd5b506040516200522d3803806200522d83398101604081905262000034916200018f565b806000620000416200018b565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160601b031960609190911b16608052506103ff60015560026020527f85dbc10f6526e911cb813488665886f60f4f60bea962aa4f1f51aa2badfc980d80546001600160a01b031990811673bebc44782c7db0a1a60cb6fe97d0b483032ff1c7179091557f46fc4c8b02551bc0d28d28f5b2d50bd81ace7c9f2f6c19163c3a782951f9c9bc8054821673a2b47e3d5c44877cca798226b7b8118f9bfb7a5617905573c25a3a3b969415c80451098fa907ec722572917f6000527fc22765341488b396feabb2c37ea6e5c979b36d1190a66f40f2f03ce3166ce43e805490911673a5407eae9ba41422680e2e00537571bcc53efbfd179055620001bf565b3390565b600060208284031215620001a1578081fd5b81516001600160a01b0381168114620001b8578182fd5b9392505050565b60805160601c615041620001ec60003980610358528061059c52806107b9528061089852506150416000f3fe6080604052600436106100aa5760003560e01c80637c21ce14116100645780637c21ce14146102145780638da5cb5b146102425780639114750b1461025757806394c9174a14610277578063f2fde38b14610297578063fb57363c146102b7576100b1565b80620fb29c1461015d57806322fdad5f14610193578063392f084f146101b55780635744ba15146101d5578063715018a6146101ea5780637b103999146101ff576100b1565b366100b157005b6003546100bc6102d7565b6001600160a01b0316816001600160a01b031614806100db5750806001145b15610139576004356024356084356000808085136100fd578385600003610103565b84846000035b91509150856001141561011b57604051818152602081fd5b61012f6001600160a01b03841687846102db565b505050505061015a565b60405162461bcd60e51b815260040161015190614cb8565b60405180910390fd5b50005b34801561016957600080fd5b5061017d6101783660046144f4565b610332565b60405161018a9190614976565b60405180910390f35b34801561019f57600080fd5b506101b36101ae36600461452c565b61034d565b005b6101c86101c336600461480c565b6104fc565b60405161018a9190614b18565b3480156101e157600080fd5b506101c8610705565b3480156101f657600080fd5b506101b361070b565b34801561020b57600080fd5b5061017d6107b7565b34801561022057600080fd5b5061023461022f3660046147d3565b6107db565b60405161018a9291906149c5565b34801561024e57600080fd5b5061017d610804565b34801561026357600080fd5b506101c86102723660046147eb565b610813565b34801561028357600080fd5b506101b3610292366004614597565b6109ac565b3480156102a357600080fd5b506101b36102b23660046144f4565b610a82565b3480156102c357600080fd5b506101b36102d23660046147d3565b610b84565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261032d908490610beb565b505050565b6002602052600090815260409020546001600160a01b031681565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103ba576040805162461bcd60e51b815260206004820152600d60248201526c6f6e6c7920726567697374727960981b604482015290519081900360640190fd5b6001600160a01b03821661046a576040516000906001600160a01b0383169047908381818185875af1925050503d8060008114610413576040519150601f19603f3d011682016040523d82523d6000602084013e610418565b606091505b5050905080610464576040805162461bcd60e51b81526020600482015260136024820152721dda5d1a191c985dc81155120819985a5b1959606a1b604482015290519081900360640190fd5b506104f8565b6104f881836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156104bb57600080fd5b505afa1580156104cf573d6000803e3d6000fd5b505050506040513d60208110156104e557600080fd5b50516001600160a01b03851691906102db565b5050565b6001805460009160ff8616916003600888901c169190831c8116141561058257600a9590951c948061053b5761053482878787610c9c565b925061057d565b806001141561055057610534828787876118c6565b80600214156105655761053482878787612051565b60405162461bcd60e51b815260040161015190614cde565b6106fc565b604051635120990b60e01b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635120990b906105d1908690600401614b18565b60206040518083038186803b1580156105e957600080fd5b505afa1580156105fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106219190614510565b9050600080826001600160a01b031663392f084f60e01b8a8a8a60405160240161064d93929190614e1f565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161068b919061495a565b600060405180830381855af49150503d80600081146106c6576040519150601f19603f3d011682016040523d82523d6000602084013e6106cb565b606091505b5091509150816106e2576040513d806000833e8082fd5b808060200190518101906106f6919061474a565b95505050505b50509392505050565b60015481565b6107136102d7565b6001600160a01b0316610724610804565b6001600160a01b03161461076d576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000000000000000000000000000000000000000000081565b60008060ff83166003600885901c166107f98282600a88901c612438565b935093505050915091565b6000546001600160a01b031690565b6001805460009160ff8516916003600887901c169190831c8116141561087e57600a9490941c93806108515761084a828686612ad3565b9250610879565b80600114156108655761084a828686613508565b80600214156105655761084a8286866139e5565b6109a4565b604051635120990b60e01b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635120990b906108cd908690600401614b18565b60206040518083038186803b1580156108e557600080fd5b505afa1580156108f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091d9190614510565b604051639114750b60e01b81529091506001600160a01b03821690639114750b9061094e9089908990600401614e11565b602060405180830381600087803b15801561096857600080fd5b505af115801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a0919061474a565b9350505b505092915050565b6109b46102d7565b6001600160a01b03166109c5610804565b6001600160a01b031614610a0e576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b60005b825181101561032d57818181518110610a2657fe5b602002602001015160026000858481518110610a3e57fe5b6020908102919091018101516001600160a01b0390811683529082019290925260400160002080546001600160a01b03191692909116919091179055600101610a11565b610a8a6102d7565b6001600160a01b0316610a9b610804565b6001600160a01b031614610ae4576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b6001600160a01b038116610b295760405162461bcd60e51b8152600401808060200182810382526026815260200180614f406026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b610b8c6102d7565b6001600160a01b0316610b9d610804565b6001600160a01b031614610be6576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b600155565b6000610c40826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b6e9092919063ffffffff16565b80519091501561032d57808060200190516020811015610c5f57600080fd5b505161032d5760405162461bcd60e51b815260040180806020018281038252602a815260200180614fac602a913960400191505060405180910390fd5b6000806000610cad87600088612438565b90925090506001600160a01b0386166004881480610ccb5750876008145b8015610cde575060a987901c6001166001145b15610cf157610cec86613b87565b610cfb565b610cfb8387613c05565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190610d2a903090600401614976565b60206040518083038186803b158015610d4257600080fd5b505afa158015610d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7a919061474a565b905088610fc55760b988901c60011660011415610df057604051632e0ae37560e01b81526001600160a01b03831690632e0ae37590610dbd904290600401614b18565b600060405180830381600087803b158015610dd757600080fd5b505af1158015610deb573d6000803e3d6000fd5b505050505b600060b889901c6001169050600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610e3857600080fd5b505afa158015610e4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e709190614785565b506001600160701b031691506001600160701b031691508260001415610e9257905b60a08b901c62ffffff168a0297508782620f4240020181890281610eb257fe5b049750610ec96001600160a01b038816868c6102db565b8260011415610f4857604080516000808252602082019283905263022c0d9f60e01b9092526001600160a01b0387169163022c0d9f91610f1191908c908e9060248101614c2f565b600060405180830381600087803b158015610f2b57600080fd5b505af1158015610f3f573d6000803e3d6000fd5b50505050610fb9565b604080516000808252602082019283905263022c0d9f60e01b9092526001600160a01b0387169163022c0d9f91610f86918c918e9060248101614c2f565b600060405180830381600087803b158015610fa057600080fd5b505af1158015610fb4573d6000803e3d6000fd5b505050505b505050505050506118be565b88600114156110e4576040805160208082528183019092526001600160a01b03858116908716109160009190602082018180368337505050602081018790526001600160a01b0385166003819055909150600090819063128acb088b868e816110425773fffd8963efd1fc6a506488495d951d5263988d25611049565b6401000276a45b886040518663ffffffff1660e01b815260040161106a95949392919061498a565b6040805180830381600087803b15801561108357600080fd5b505af1158015611097573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bb9190614762565b60006003559092509050836110d057816110d5565b806000035b985050505050505050506118be565b8860021415611188576110f8848389613d05565b604051638201aa3f60e01b81526001600160a01b03831690638201aa3f9061112f9087908b908890600090600019906004016149df565b6040805180830381600087803b15801561114857600080fd5b505af115801561115c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111809190614762565b5094506117df565b886003141561132a576000826001600160a01b03166338fff2d06040518163ffffffff1660e01b815260040160206040518083038186803b1580156111cc57600080fd5b505afa1580156111e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611204919061474a565b90506112108589613c05565b61122f8573ba12222222228d8ba445958a75a0704d566bf2c88a613d05565b6040805160c081018252828152600060208083018290526001600160a01b038981168486015288811660608086019190915260808086018f90528651858152808501885260a087015286519081018752308152928301849052908c1682860152810182905292516352bbbe2960e01b815273ba12222222228d8ba445958a75a0704d566bf2c8936352bbbe29936112cc9390924290600401614d06565b602060405180830381600087803b1580156112e657600080fd5b505af11580156112fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131e919061474a565b955050505050506118be565b600889116117c757600760a389901c81169060a68a901c1661134d86858b613d05565b8a6004141561144457600160a98b901c166113d75761136d86858b613d05565b604051630f7c084960e21b81526001600160a01b03851690633df02124906113a090859085908e90600090600401614c0c565b600060405180830381600087803b1580156113ba57600080fd5b505af11580156113ce573d6000803e3d6000fd5b5050505061143f565b604051630f7c084960e21b81526001600160a01b03851690633df02124908b9061140c90869086908490600090600401614c0c565b6000604051808303818588803b15801561142557600080fd5b505af1158015611439573d6000803e3d6000fd5b50505050505b6117c0565b8a6005141561157a5761145886858b613d05565b600160a98b901c166114ef57604051630f7c084960e21b81526001600160a01b03851690633df021249061149790859085908e90600090600401614c0c565b602060405180830381600087803b1580156114b157600080fd5b505af11580156114c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e9919061474a565b5061143f565b604051635320bf6b60e11b81526001600160a01b0385169063a6417ed69061152290859085908e90600090600401614c0c565b602060405180830381600087803b15801561153c57600080fd5b505af1158015611550573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611574919061474a565b506117c0565b8a600614156116bb5760a98a901c6001166001141561160757836001600160a01b0316637165485d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115cc57600080fd5b505afa1580156115e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116049190614510565b93505b61161286858b613d05565b600160a98b901c1661165157604051630f7c084960e21b81526001600160a01b03851690633df02124906113a090859085908e90600090600401614c0c565b604051635320bf6b60e11b81526001600160a01b0385169063a6417ed69061168490859085908e90600090600401614c0c565b600060405180830381600087803b15801561169e57600080fd5b505af11580156116b2573d6000803e3d6000fd5b505050506117c0565b8a60071415611702576116cf86858b613d05565b604051630f7c084960e21b81526001600160a01b03851690633df021249061152290859085908e90600090600401614c0c565b8a600814156117c057600160a98b901c166117555761172286858b613d05565b604051630b68372160e31b81526001600160a01b03851690635b41b9089061168490859085908e90600090600401614e54565b60405163394747c560e01b81526001600160a01b0385169063394747c5908b9061178d90869086908490600090600190600401614e6f565b6000604051808303818588803b1580156117a657600080fd5b505af11580156117ba573d6000803e3d6000fd5b50505050505b50506117df565b60405162461bcd60e51b815260040161015190614c66565b6001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561180e5761180e8347613c05565b84611895576040516370a0823160e01b815281906001600160a01b038516906370a0823190611841903090600401614976565b60206040518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611891919061474a565b0394505b6001600160a01b03861630146118b9576118b96001600160a01b03841687876102db565b505050505b949350505050565b60008060006118d787600188612438565b90925090506001600160a01b03861660048814806118f55750876008145b8015611908575060a987901c6001166001145b1561191b5761191686613b87565b611925565b6119258387613c05565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611954903090600401614976565b60206040518083038186803b15801561196c57600080fd5b505afa158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a4919061474a565b9050886004111580156119b8575060088911155b15611f84576119c682613de8565b915060a088901c60079081166001019060a38a901c16600282108015906119ee575060048211155b611a0a5760405162461bcd60e51b815260040161015190614c90565b8a60051415611bcf57600160a98b901c811614611a2887868c613d05565b8260021415611ad557611a39614379565b8a818460028110611a4657fe5b602002015260405163ee22be2360e01b81526001600160a01b0387169063ee22be2390611a7c9084906000908790600401614a3c565b602060405180830381600087803b158015611a9657600080fd5b505af1158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace919061474a565b5050611bc9565b8260031415611b2957611ae6614397565b8a818460038110611af357fe5b60200201526040516315b74c9d60e11b81526001600160a01b03871690632b6e993a90611a7c9084906000908790600401614a98565b611b316143b5565b8a818460048110611b3e57fe5b602002015260405163dc3a2d8160e01b81526001600160a01b0387169063dc3a2d8190611b749084906000908790600401614af4565b602060405180830381600087803b158015611b8e57600080fd5b505af1158015611ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc6919061474a565b50505b50611f7d565b60008b60041480611be057508b6008145b8015611bf3575060a98b901c6001166001145b905080611c0557611c0587868c613d05565b8260021415611d9457611c16614379565b8a818460028110611c2357fe5b60200201528115611d2c578c60081415611cc35760405163ee22be2360e01b81526001600160a01b0387169063ee22be23908d90611c6b908590600090600190600401614a3c565b6020604051808303818588803b158015611c8457600080fd5b505af1158015611c98573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611cbd919061474a565b50611d27565b604051630b4c7e4d60e01b81526001600160a01b03871690630b4c7e4d908d90611cf4908590600090600401614a21565b6000604051808303818588803b158015611d0d57600080fd5b505af1158015611d21573d6000803e3d6000fd5b50505050505b611d8e565b604051630b4c7e4d60e01b81526001600160a01b03871690630b4c7e4d90611d5b908490600090600401614a21565b600060405180830381600087803b158015611d7557600080fd5b505af1158015611d89573d6000803e3d6000fd5b505050505b50611f7b565b8260031415611e9157611da5614397565b8a818460038110611db257fe5b60200201528115611e62578c60081415611e31576040516315b74c9d60e11b81526001600160a01b03871690632b6e993a908d90611dfa908590600090600190600401614a98565b6000604051808303818588803b158015611e1357600080fd5b505af1158015611e27573d6000803e3d6000fd5b5050505050611d27565b604051634515cef360e01b81526001600160a01b03871690634515cef3908d90611cf4908590600090600401614a7d565b604051634515cef360e01b81526001600160a01b03871690634515cef390611d5b908490600090600401614a7d565b611e996143b5565b8a818460048110611ea657fe5b60200201528115611f185760405162a6cbcd60e21b81526001600160a01b0387169063029b2f34908d90611ee1908590600090600401614ad9565b6000604051808303818588803b158015611efa57600080fd5b505af1158015611f0e573d6000803e3d6000fd5b5050505050611f79565b60405162a6cbcd60e21b81526001600160a01b0387169063029b2f3490611f46908490600090600401614ad9565b600060405180830381600087803b158015611f6057600080fd5b505af1158015611f74573d6000803e3d6000fd5b505050505b505b505b5050612023565b88600914156117c757611f98848389613d05565b604051636e553f6560e01b81526001600160a01b03831690636e553f6590611fc6908a908a90600401614d91565b602060405180830381600087803b158015611fe057600080fd5b505af1158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612018919061474a565b9450505050506118be565b6040516370a0823160e01b815281906001600160a01b038516906370a0823190611841903090600401614976565b600080600061206287600288612438565b6040516370a0823160e01b815291935091506001600160a01b03808816916000918416906370a082319061209a903090600401614976565b60206040518083038186803b1580156120b257600080fd5b505afa1580156120c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ea919061474a565b9050886004111580156120fe575060088911155b156123d057886006146121175761211482613de8565b91505b60a088901c60079081166001019060a68a901c166002821080159061213d575060048211155b6121595760405162461bcd60e51b815260040161015190614c90565b8a600414156121ca57604051630d2680e960e11b81526001600160a01b03851690631a4d01d290612193908c908590600090600401614dd8565b600060405180830381600087803b1580156121ad57600080fd5b505af11580156121c1573d6000803e3d6000fd5b505050506123c9565b8a6005141561226a5760405163517a55a360e01b8152600160a98c901c811614906001600160a01b0386169063517a55a390612211908d9086906000908790600401614df1565b602060405180830381600087803b15801561222b57600080fd5b505af115801561223f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612263919061474a565b50506123c9565b8a600614156122b25761227e86858b613d05565b60405163517a55a360e01b81526001600160a01b0385169063517a55a390612193908c908590600090600190600401614df1565b8a6007141561234457604051630d2680e960e11b81526001600160a01b03851690631a4d01d2906122ec908c908590600090600401614dd8565b602060405180830381600087803b15801561230657600080fd5b505af115801561231a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233e919061474a565b506123c9565b60405163f1dc3cc960e01b81526001600160a01b0385169063f1dc3cc990612375908c908590600090600401614e3e565b602060405180830381600087803b15801561238f57600080fd5b505af11580156123a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c7919061474a565b505b5050612409565b88600914156117c757604051635d043b2960e11b81526001600160a01b0383169063ba08765290611fc6908a908a903090600401614da8565b6001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21415612023576120238347613c05565b6000806001600160a01b0383168461279b576001861161254f57806001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561248b57600080fd5b505afa15801561249f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c39190614510565b9250806001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156124fe57600080fd5b505afa158015612512573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125369190614510565b9150600160b885901c1680612549579192915b50612796565b8560021415612611576000816001600160a01b031663cc77828d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561259357600080fd5b505afa1580156125a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125cf9190810190614564565b90508060a386901c600716815181106125e457fe5b602002602001015193508060a686901c6007168151811061260157fe5b6020026020010151925050612796565b8560031415612763576000816001600160a01b03166338fff2d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561265557600080fd5b505afa158015612669573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061268d919061474a565b604051631f29a8cd60e31b815290915060009073ba12222222228d8ba445958a75a0704d566bf2c89063f94d4668906126ca908590600401614b18565b60006040518083038186803b1580156126e257600080fd5b505afa1580156126f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261271e91908101906145f8565b505090508060a387901c6007168151811061273557fe5b602002602001015194508060a687901c6007168151811061275257fe5b602002602001015193505050612796565b600886116127965761277e818760a387901c60071687613e41565b9250612793818760a687901c60071687613e41565b91505b612a50565b84600114156128fb57809150856004111580156127b9575060088611155b15612878578560061480156127d5575060a984901c6001166001145b1561285257806001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561281357600080fd5b505afa158015612827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284b9190614510565b915061285e565b61285b81613de8565b90505b612871818760a387901c60071687613e41565b9250612796565b85600914156128f257806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156128ba57600080fd5b505afa1580156128ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128719190614510565b60009150612a50565b8460021415612a505780925085600411158015612919575060088611155b156129d157856006148015612935575060a984901c6001166001145b156129b257806001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561297357600080fd5b505afa158015612987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ab9190614510565b92506129be565b6129bb81613de8565b90505b612793818760a687901c60071687613e41565b8560091415612a4b57806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b158015612a1357600080fd5b505afa158015612a27573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127939190614510565b600092505b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612a8d5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc292505b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612aca5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291505b50935093915050565b6000806000612ae486600087612438565b90925090506001600160a01b03851686612c345760b986901c60011660011415612b6757604051632e0ae37560e01b81526001600160a01b03821690632e0ae37590612b34904290600401614b18565b600060405180830381600087803b158015612b4e57600080fd5b505af1158015612b62573d6000803e3d6000fd5b505050505b600060b887901c6001169050600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015612baf57600080fd5b505afa158015612bc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be79190614785565b506001600160701b031691506001600160701b031691508260001415612c0957905b60a089901c62ffffff16880296508682620f4240020181880281612c2957fe5b0496505050506134fe565b8660011415612d5c5760016003556001600160a01b038083168482161090821663128acb0830838981612c7b5773fffd8963efd1fc6a506488495d951d5263988d25612c82565b6401000276a45b604080516000815260208101918290526001600160e01b031960e088901b16909152612cb594939291906024810161498a565b6040805180830381600087803b158015612cce57600080fd5b505af1925050508015612cfe575060408051601f3d908101601f19168201909252612cfb91810190614762565b60015b612d4e573d808015612d2c576040519150601f19603f3d011682016040523d82523d6000602084013e612d31565b606091505b5080806020019051810190612d46919061474a565b955050612d51565b50505b5060006003556134fe565b86600214156130475760405163f8b2cb4f60e01b81526001600160a01b0382169063ba9530a690829063f8b2cb4f90612d99908890600401614976565b60206040518083038186803b158015612db157600080fd5b505afa158015612dc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612de9919061474a565b604051634a46c67360e11b81526001600160a01b0385169063948d8ce690612e15908990600401614976565b60206040518083038186803b158015612e2d57600080fd5b505afa158015612e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e65919061474a565b60405163f8b2cb4f60e01b81526001600160a01b0386169063f8b2cb4f90612e91908990600401614976565b60206040518083038186803b158015612ea957600080fd5b505afa158015612ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee1919061474a565b604051634a46c67360e11b81526001600160a01b0387169063948d8ce690612f0d908a90600401614976565b60206040518083038186803b158015612f2557600080fd5b505afa158015612f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f5d919061474a565b8a876001600160a01b031663d4cadf686040518163ffffffff1660e01b815260040160206040518083038186803b158015612f9757600080fd5b505afa158015612fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fcf919061474a565b6040518763ffffffff1660e01b8152600401612ff096959493929190614e94565b60206040518083038186803b15801561300857600080fd5b505afa15801561301c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613040919061474a565b93506134fe565b86600314156132c757604080516002808252606082018352600092602083019080368337019050509050838160008151811061307f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505082816001815181106130ad57fe5b6001600160a01b039290921660209283029190910190910152604080516001808252818301909252600091816020015b6130e56143d3565b8152602001906001900390816130dd5790505090506040518060a00160405280846001600160a01b03166338fff2d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561313e57600080fd5b505afa158015613152573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613176919061474a565b81526020016000815260200160018152602001888152602001600067ffffffffffffffff811180156131a757600080fd5b506040519080825280601f01601f1916602001820160405280156131d2576020820181803683370190505b50815250816000815181106131e357fe5b6020908102919091018101919091526040805160808101825230808252600093820184905281830152606081018390529051637c26833760e11b815273ba12222222228d8ba445958a75a0704d566bf2c89163f84d066e9161324d91859187918991600401614b21565b600060405180830381600087803b15801561326757600080fd5b505af115801561327b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526132a391908101906146ba565b9050806001815181106132b257fe5b602002602001015160000396505050506134fe565b600887116134fe57600760a387901c81169060a688901c16600889141561336f5760405163556d6e9f60e01b81526001600160a01b0384169063556d6e9f9061331890859085908c90600401614e3e565b60206040518083038186803b15801561333057600080fd5b505afa158015613344573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613368919061474a565b95506134fb565b886005148015613386575060a988901c6001166001145b156133bb576040516307211ef760e01b81526001600160a01b038416906307211ef79061331890859085908c90600401614bee565b8860061480156133d2575060a988901c6001166001145b1561347b57826001600160a01b0316637165485d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561341057600080fd5b505afa158015613424573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134489190614510565b6040516307211ef760e01b81529093506001600160a01b038416906307211ef79061331890859085908c90600401614bee565b604051635e0d443f60e01b81526001600160a01b03841690635e0d443f906134ab90859085908c90600401614bee565b60206040518083038186803b1580156134c357600080fd5b505afa1580156134d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f6919061474a565b50505b5050509392505050565b60006001600160a01b03831660048510801590613526575060088511155b156139555760a084901c60079081166001019060a686901c1660028210801590613551575060048211155b61356d5760405162461bcd60e51b815260040161015190614c90565b866006148015613584575060a986901c6001166001145b1561374d5760405163046e8dd760e31b81526000906001600160a01b038516906323746eb8906135b8908590600401614be0565b60206040518083038186803b1580156135d057600080fd5b505afa1580156135e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136089190614510565b90506000846001600160a01b031663b739953e846040518263ffffffff1660e01b81526004016136389190614be0565b60206040518083038186803b15801561365057600080fd5b505afa158015613664573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136889190614510565b9050806001600160a01b0316826001600160a01b0316146136d35763182df0f560e01b6000526020600060046000855afa80156136d157600051670de0b6b3a764000089020497505b505b846001600160a01b0316637165485d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561370c57600080fd5b505afa158015613720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137449190614510565b94505050613759565b61375683613de8565b92505b816002141561385f5761376a614379565b8581836002811061377757fe5b602002015260405163ed8e84f360e01b81528280156137a257600060048301528760248301526137b0565b876004830152600060248301525b50600160448201526000805260206000606483885afa905080156137d45760005195505b508461385957604051638d8ea72760e01b81526001600160a01b03851690638d8ea72790613806908490600401614a13565b60206040518083038186803b15801561381e57600080fd5b505afa158015613832573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613856919061474a565b94505b5061394e565b81600314156138b157613870614397565b8581836003811061387d57fe5b6020020152604051633883e11960e01b81526001600160a01b03851690633883e11990613806908490600190600401614a60565b6138b96143b5565b858183600481106138c657fe5b602002015260405163cf701ff760e01b81526001600160a01b0385169063cf701ff7906138fa908490600190600401614abc565b60206040518083038186803b15801561391257600080fd5b505afa158015613926573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061394a919061474a565b9450505b50506139dd565b84600914156139dd5760405163ef8b30f760e01b81526001600160a01b0382169063ef8b30f79061398a908690600401614b18565b60206040518083038186803b1580156139a257600080fd5b505afa1580156139b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139da919061474a565b91505b509392505050565b60006001600160a01b03831660048510801590613a03575060088511155b15613b395784600614613a1c57613a1981613de8565b90505b600760a685901c166008861415613ab2576040516327d8462f60e11b81526001600160a01b03831690634fb08c5e90613a5b9087908590600401614e11565b60206040518083038186803b158015613a7357600080fd5b505afa158015613a87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aab919061474a565b9250613b33565b60405163cc2b27d760e01b81526001600160a01b0383169063cc2b27d790613ae09087908590600401614dc7565b60206040518083038186803b158015613af857600080fd5b505afa158015613b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b30919061474a565b92505b506139dd565b84600914156139dd5760405163266d6a8360e11b81526001600160a01b03821690634cdad5069061398a908690600401614b18565b6060613b7d8484600085614027565b90505b9392505050565b80471015613c025773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015613be957600080fd5b505af1158015613bfd573d6000803e3d6000fd5b505050505b50565b6001600160a01b03821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2148015613ca8575080826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613c7a57600080fd5b505afa158015613c8e573d6000803e3d6000fd5b505050506040513d6020811015613ca457600080fd5b5051105b156104f857816001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613ce857600080fd5b505af1158015613cfc573d6000803e3d6000fd5b50505050505050565b613d0e83614182565b158015613d94575060408051636eb1769f60e11b81523060048201526001600160a01b0384811660248301529151839286169163dd62ed3e916044808301926020929190829003018186803b158015613d6657600080fd5b505afa158015613d7a573d6000803e3d6000fd5b505050506040513d6020811015613d9057600080fd5b5051105b1561032d57730316eb71485b0ab14103307bf65a021042c6d3806001600160a01b03841614613dd257613dd26001600160a01b0384168360006141bc565b61032d6001600160a01b038416836000196141bc565b6001600160a01b038082166000908152600260205260409020541680613e3c576303aa30b960e11b6000526020600060046000855afa8015613e33576001600160a01b036000511691505b5080613e3c5750805b919050565b60008360051480613e525750836006145b8015613e65575060a982901c6001166001145b15613f7a578360051415613ef657604051630b9947eb60e41b81526001600160a01b0386169063b9947eb090613e9f908690600401614b18565b60206040518083038186803b158015613eb757600080fd5b505afa158015613ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eef9190614510565b9050613f75565b604051635b9cca9f60e11b81526001600160a01b0386169063b739953e90613f22908690600401614be0565b60206040518083038186803b158015613f3a57600080fd5b505afa158015613f4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f729190614510565b90505b6118be565b60405163c661065760e01b81526001600160a01b0386169063c661065790613fa6908690600401614b18565b60206040518083038186803b158015613fbe57600080fd5b505afa925050508015613fee575060408051601f3d908101601f19168201909252613feb91810190614510565b60015b61401e5760405163046e8dd760e31b81526001600160a01b038616906323746eb890613f22908690600401614be0565b95945050505050565b6060824710156140685760405162461bcd60e51b8152600401808060200182810382526026815260200180614f666026913960400191505060405180910390fd5b614071856142cf565b6140c2576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106141005780518252601f1990920191602091820191016140e1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614162576040519150601f19603f3d011682016040523d82523d6000602084013e614167565b606091505b50915091506141778282866142d5565b979650505050505050565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14806141b657506001600160a01b038216155b92915050565b801580614242575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561421457600080fd5b505afa158015614228573d6000803e3d6000fd5b505050506040513d602081101561423e57600080fd5b5051155b61427d5760405162461bcd60e51b8152600401808060200182810382526036815260200180614fd66036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261032d908490610beb565b3b151590565b606083156142e4575081613b80565b8251156142f45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561433e578181015183820152602001614326565b50505050905090810190601f16801561436b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b6040518060a0016040528060008019168152602001600081526020016000815260200160008152602001606081525090565b600082601f830112614415578081fd5b8135602061442a61442583614ee0565b614ebc565b8281528181019085830183850287018401881015614446578586fd5b855b8581101561446d57813561445b81614f2a565b84529284019290840190600101614448565b5090979650505050505050565b600082601f83011261448a578081fd5b8151602061449a61442583614ee0565b82815281810190858301838502870184018810156144b6578586fd5b855b8581101561446d5781516144cb81614f2a565b845292840192908401906001016144b8565b80516001600160701b0381168114613e3c57600080fd5b600060208284031215614505578081fd5b8135613b8081614f2a565b600060208284031215614521578081fd5b8151613b8081614f2a565b6000806040838503121561453e578081fd5b823561454981614f2a565b9150602083013561455981614f2a565b809150509250929050565b600060208284031215614575578081fd5b815167ffffffffffffffff81111561458b578182fd5b6118be8482850161447a565b600080604083850312156145a9578182fd5b823567ffffffffffffffff808211156145c0578384fd5b6145cc86838701614405565b935060208501359150808211156145e1578283fd5b506145ee85828601614405565b9150509250929050565b60008060006060848603121561460c578081fd5b835167ffffffffffffffff80821115614623578283fd5b61462f8783880161447a565b9450602091508186015181811115614645578384fd5b86019050601f81018713614657578283fd5b805161466561442582614ee0565b81815283810190838501858402850186018b1015614681578687fd5b8694505b838510156146a3578051835260019490940193918501918501614685565b508096505050505050604084015190509250925092565b600060208083850312156146cc578182fd5b825167ffffffffffffffff8111156146e2578283fd5b8301601f810185136146f2578283fd5b805161470061442582614ee0565b818152838101908385018584028501860189101561471c578687fd5b8694505b8385101561473e578051835260019490940193918501918501614720565b50979650505050505050565b60006020828403121561475b578081fd5b5051919050565b60008060408385031215614774578182fd5b505080516020909101519092909150565b600080600060608486031215614799578081fd5b6147a2846144dd565b92506147b0602085016144dd565b9150604084015163ffffffff811681146147c8578182fd5b809150509250925092565b6000602082840312156147e4578081fd5b5035919050565b600080604083850312156147fd578182fd5b50508035926020909101359150565b600080600060608486031215614820578081fd5b833592506020840135915060408401356147c881614f2a565b6000815180845260208085019450808401835b838110156148715781516001600160a01b03168752958201959082019060010161484c565b509495945050505050565b8060005b600281101561489f578151845260209384019390910190600101614880565b50505050565b8060005b600381101561489f5781518452602093840193909101906001016148a9565b8060005b600481101561489f5781518452602093840193909101906001016148cc565b60008151808452614903816020860160208601614efe565b601f01601f19169290920160200192915050565b6002811061492157fe5b9052565b80516001600160a01b039081168352602080830151151590840152604080830151909116908301526060908101511515910152565b6000825161496c818460208701614efe565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a060808201819052600090614177908301846148eb565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03958616815260208101949094529190931660408301526060820192909252608081019190915260a00190565b604081016141b6828461487c565b60608101614a2f828561487c565b8260408301529392505050565b60808101614a4a828661487c565b8360408301528215156060830152949350505050565b60808101614a6e82856148a5565b82151560608301529392505050565b60808101614a8b82856148a5565b8260608301529392505050565b60a08101614aa682866148a5565b8360608301528215156080830152949350505050565b60a08101614aca82856148c8565b82151560808301529392505050565b60a08101614ae782856148c8565b8260808301529392505050565b60c08101614b0282866148c8565b83608083015282151560a0830152949350505050565b90815260200190565b600060e08201614b318388614917565b602060e08185015281875180845261010093508386019150838382028701019350828901855b82811015614bb95787860360ff190184528151805187528581015186880152604080820151908801526060808201519088015260809081015160a091880182905290614ba5818901836148eb565b975050509284019290840190600101614b57565b50505050508281036040840152614bd08186614839565b91505061401e6060830184614925565b600f9190910b815260200190565b600f93840b81529190920b6020820152604081019190915260600190565b600f94850b81529290930b60208301526040820152606081019190915260800190565b600085825284602083015260018060a01b038416604083015260806060830152614c5c60808301846148eb565b9695505050505050565b60208082526010908201526f696e76616c696420706f6f6c5479706560801b604082015260600190565b6020808252600e908201526d696e76616c696420746f6b656e7360901b604082015260600190565b6020808252600c908201526b1a5b9d985b1a590818d85b1b60a21b604082015260600190565b6020808252600e908201526d34b73b30b634b21030b1ba34b7b760911b604082015260600190565b600060e08252855160e08301526020860151614d26610100840182614917565b5060408601516001600160a01b03908116610120840152606087015116610140830152608086015161016083015260a086015160c0610180840152614d6f6101a08401826148eb565b915050614d7f6020830186614925565b60a082019390935260c0015292915050565b9182526001600160a01b0316602082015260400190565b9283526001600160a01b03918216602084015216604082015260600190565b918252600f0b602082015260400190565b928352600f9190910b6020830152604082015260600190565b938452600f9290920b602084015260408301521515606082015260800190565b918252602082015260400190565b92835260208301919091526001600160a01b0316604082015260600190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b9485526020850193909352604084019190915260608301521515608082015260a00190565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b60405181810167ffffffffffffffff81118282101715614ed857fe5b604052919050565b600067ffffffffffffffff821115614ef457fe5b5060209081020190565b60005b83811015614f19578181015183820152602001614f01565b8381111561489f5750506000910152565b6001600160a01b0381168114613c0257600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220800d1310a45543632ca1b2f7e0927476fe430506cdbd18cda385250997c9b8df64736f6c63430007060033000000000000000000000000997b6f43c1c1e8630d03b8e3c11b60e98a1bea90

Deployed Bytecode

0x6080604052600436106100aa5760003560e01c80637c21ce14116100645780637c21ce14146102145780638da5cb5b146102425780639114750b1461025757806394c9174a14610277578063f2fde38b14610297578063fb57363c146102b7576100b1565b80620fb29c1461015d57806322fdad5f14610193578063392f084f146101b55780635744ba15146101d5578063715018a6146101ea5780637b103999146101ff576100b1565b366100b157005b6003546100bc6102d7565b6001600160a01b0316816001600160a01b031614806100db5750806001145b15610139576004356024356084356000808085136100fd578385600003610103565b84846000035b91509150856001141561011b57604051818152602081fd5b61012f6001600160a01b03841687846102db565b505050505061015a565b60405162461bcd60e51b815260040161015190614cb8565b60405180910390fd5b50005b34801561016957600080fd5b5061017d6101783660046144f4565b610332565b60405161018a9190614976565b60405180910390f35b34801561019f57600080fd5b506101b36101ae36600461452c565b61034d565b005b6101c86101c336600461480c565b6104fc565b60405161018a9190614b18565b3480156101e157600080fd5b506101c8610705565b3480156101f657600080fd5b506101b361070b565b34801561020b57600080fd5b5061017d6107b7565b34801561022057600080fd5b5061023461022f3660046147d3565b6107db565b60405161018a9291906149c5565b34801561024e57600080fd5b5061017d610804565b34801561026357600080fd5b506101c86102723660046147eb565b610813565b34801561028357600080fd5b506101b3610292366004614597565b6109ac565b3480156102a357600080fd5b506101b36102b23660046144f4565b610a82565b3480156102c357600080fd5b506101b36102d23660046147d3565b610b84565b3390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261032d908490610beb565b505050565b6002602052600090815260409020546001600160a01b031681565b336001600160a01b037f000000000000000000000000997b6f43c1c1e8630d03b8e3c11b60e98a1bea9016146103ba576040805162461bcd60e51b815260206004820152600d60248201526c6f6e6c7920726567697374727960981b604482015290519081900360640190fd5b6001600160a01b03821661046a576040516000906001600160a01b0383169047908381818185875af1925050503d8060008114610413576040519150601f19603f3d011682016040523d82523d6000602084013e610418565b606091505b5050905080610464576040805162461bcd60e51b81526020600482015260136024820152721dda5d1a191c985dc81155120819985a5b1959606a1b604482015290519081900360640190fd5b506104f8565b6104f881836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156104bb57600080fd5b505afa1580156104cf573d6000803e3d6000fd5b505050506040513d60208110156104e557600080fd5b50516001600160a01b03851691906102db565b5050565b6001805460009160ff8616916003600888901c169190831c8116141561058257600a9590951c948061053b5761053482878787610c9c565b925061057d565b806001141561055057610534828787876118c6565b80600214156105655761053482878787612051565b60405162461bcd60e51b815260040161015190614cde565b6106fc565b604051635120990b60e01b81526000906001600160a01b037f000000000000000000000000997b6f43c1c1e8630d03b8e3c11b60e98a1bea901690635120990b906105d1908690600401614b18565b60206040518083038186803b1580156105e957600080fd5b505afa1580156105fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106219190614510565b9050600080826001600160a01b031663392f084f60e01b8a8a8a60405160240161064d93929190614e1f565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161068b919061495a565b600060405180830381855af49150503d80600081146106c6576040519150601f19603f3d011682016040523d82523d6000602084013e6106cb565b606091505b5091509150816106e2576040513d806000833e8082fd5b808060200190518101906106f6919061474a565b95505050505b50509392505050565b60015481565b6107136102d7565b6001600160a01b0316610724610804565b6001600160a01b03161461076d576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b7f000000000000000000000000997b6f43c1c1e8630d03b8e3c11b60e98a1bea9081565b60008060ff83166003600885901c166107f98282600a88901c612438565b935093505050915091565b6000546001600160a01b031690565b6001805460009160ff8516916003600887901c169190831c8116141561087e57600a9490941c93806108515761084a828686612ad3565b9250610879565b80600114156108655761084a828686613508565b80600214156105655761084a8286866139e5565b6109a4565b604051635120990b60e01b81526000906001600160a01b037f000000000000000000000000997b6f43c1c1e8630d03b8e3c11b60e98a1bea901690635120990b906108cd908690600401614b18565b60206040518083038186803b1580156108e557600080fd5b505afa1580156108f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091d9190614510565b604051639114750b60e01b81529091506001600160a01b03821690639114750b9061094e9089908990600401614e11565b602060405180830381600087803b15801561096857600080fd5b505af115801561097c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a0919061474a565b9350505b505092915050565b6109b46102d7565b6001600160a01b03166109c5610804565b6001600160a01b031614610a0e576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b60005b825181101561032d57818181518110610a2657fe5b602002602001015160026000858481518110610a3e57fe5b6020908102919091018101516001600160a01b0390811683529082019290925260400160002080546001600160a01b03191692909116919091179055600101610a11565b610a8a6102d7565b6001600160a01b0316610a9b610804565b6001600160a01b031614610ae4576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b6001600160a01b038116610b295760405162461bcd60e51b8152600401808060200182810382526026815260200180614f406026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b610b8c6102d7565b6001600160a01b0316610b9d610804565b6001600160a01b031614610be6576040805162461bcd60e51b81526020600482018190526024820152600080516020614f8c833981519152604482015290519081900360640190fd5b600155565b6000610c40826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316613b6e9092919063ffffffff16565b80519091501561032d57808060200190516020811015610c5f57600080fd5b505161032d5760405162461bcd60e51b815260040180806020018281038252602a815260200180614fac602a913960400191505060405180910390fd5b6000806000610cad87600088612438565b90925090506001600160a01b0386166004881480610ccb5750876008145b8015610cde575060a987901c6001166001145b15610cf157610cec86613b87565b610cfb565b610cfb8387613c05565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190610d2a903090600401614976565b60206040518083038186803b158015610d4257600080fd5b505afa158015610d56573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d7a919061474a565b905088610fc55760b988901c60011660011415610df057604051632e0ae37560e01b81526001600160a01b03831690632e0ae37590610dbd904290600401614b18565b600060405180830381600087803b158015610dd757600080fd5b505af1158015610deb573d6000803e3d6000fd5b505050505b600060b889901c6001169050600080846001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610e3857600080fd5b505afa158015610e4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e709190614785565b506001600160701b031691506001600160701b031691508260001415610e9257905b60a08b901c62ffffff168a0297508782620f4240020181890281610eb257fe5b049750610ec96001600160a01b038816868c6102db565b8260011415610f4857604080516000808252602082019283905263022c0d9f60e01b9092526001600160a01b0387169163022c0d9f91610f1191908c908e9060248101614c2f565b600060405180830381600087803b158015610f2b57600080fd5b505af1158015610f3f573d6000803e3d6000fd5b50505050610fb9565b604080516000808252602082019283905263022c0d9f60e01b9092526001600160a01b0387169163022c0d9f91610f86918c918e9060248101614c2f565b600060405180830381600087803b158015610fa057600080fd5b505af1158015610fb4573d6000803e3d6000fd5b505050505b505050505050506118be565b88600114156110e4576040805160208082528183019092526001600160a01b03858116908716109160009190602082018180368337505050602081018790526001600160a01b0385166003819055909150600090819063128acb088b868e816110425773fffd8963efd1fc6a506488495d951d5263988d25611049565b6401000276a45b886040518663ffffffff1660e01b815260040161106a95949392919061498a565b6040805180830381600087803b15801561108357600080fd5b505af1158015611097573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bb9190614762565b60006003559092509050836110d057816110d5565b806000035b985050505050505050506118be565b8860021415611188576110f8848389613d05565b604051638201aa3f60e01b81526001600160a01b03831690638201aa3f9061112f9087908b908890600090600019906004016149df565b6040805180830381600087803b15801561114857600080fd5b505af115801561115c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111809190614762565b5094506117df565b886003141561132a576000826001600160a01b03166338fff2d06040518163ffffffff1660e01b815260040160206040518083038186803b1580156111cc57600080fd5b505afa1580156111e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611204919061474a565b90506112108589613c05565b61122f8573ba12222222228d8ba445958a75a0704d566bf2c88a613d05565b6040805160c081018252828152600060208083018290526001600160a01b038981168486015288811660608086019190915260808086018f90528651858152808501885260a087015286519081018752308152928301849052908c1682860152810182905292516352bbbe2960e01b815273ba12222222228d8ba445958a75a0704d566bf2c8936352bbbe29936112cc9390924290600401614d06565b602060405180830381600087803b1580156112e657600080fd5b505af11580156112fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131e919061474a565b955050505050506118be565b600889116117c757600760a389901c81169060a68a901c1661134d86858b613d05565b8a6004141561144457600160a98b901c166113d75761136d86858b613d05565b604051630f7c084960e21b81526001600160a01b03851690633df02124906113a090859085908e90600090600401614c0c565b600060405180830381600087803b1580156113ba57600080fd5b505af11580156113ce573d6000803e3d6000fd5b5050505061143f565b604051630f7c084960e21b81526001600160a01b03851690633df02124908b9061140c90869086908490600090600401614c0c565b6000604051808303818588803b15801561142557600080fd5b505af1158015611439573d6000803e3d6000fd5b50505050505b6117c0565b8a6005141561157a5761145886858b613d05565b600160a98b901c166114ef57604051630f7c084960e21b81526001600160a01b03851690633df021249061149790859085908e90600090600401614c0c565b602060405180830381600087803b1580156114b157600080fd5b505af11580156114c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e9919061474a565b5061143f565b604051635320bf6b60e11b81526001600160a01b0385169063a6417ed69061152290859085908e90600090600401614c0c565b602060405180830381600087803b15801561153c57600080fd5b505af1158015611550573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611574919061474a565b506117c0565b8a600614156116bb5760a98a901c6001166001141561160757836001600160a01b0316637165485d6040518163ffffffff1660e01b815260040160206040518083038186803b1580156115cc57600080fd5b505afa1580156115e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116049190614510565b93505b61161286858b613d05565b600160a98b901c1661165157604051630f7c084960e21b81526001600160a01b03851690633df02124906113a090859085908e90600090600401614c0c565b604051635320bf6b60e11b81526001600160a01b0385169063a6417ed69061168490859085908e90600090600401614c0c565b600060405180830381600087803b15801561169e57600080fd5b505af11580156116b2573d6000803e3d6000fd5b505050506117c0565b8a60071415611702576116cf86858b613d05565b604051630f7c084960e21b81526001600160a01b03851690633df021249061152290859085908e90600090600401614c0c565b8a600814156117c057600160a98b901c166117555761172286858b613d05565b604051630b68372160e31b81526001600160a01b03851690635b41b9089061168490859085908e90600090600401614e54565b60405163394747c560e01b81526001600160a01b0385169063394747c5908b9061178d90869086908490600090600190600401614e6f565b6000604051808303818588803b1580156117a657600080fd5b505af11580156117ba573d6000803e3d6000fd5b50505050505b50506117df565b60405162461bcd60e51b815260040161015190614c66565b6001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561180e5761180e8347613c05565b84611895576040516370a0823160e01b815281906001600160a01b038516906370a0823190611841903090600401614976565b60206040518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611891919061474a565b0394505b6001600160a01b03861630146118b9576118b96001600160a01b03841687876102db565b505050505b949350505050565b60008060006118d787600188612438565b90925090506001600160a01b03861660048814806118f55750876008145b8015611908575060a987901c6001166001145b1561191b5761191686613b87565b611925565b6119258387613c05565b6040516370a0823160e01b81526000906001600160a01b038416906370a0823190611954903090600401614976565b60206040518083038186803b15801561196c57600080fd5b505afa158015611980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a4919061474a565b9050886004111580156119b8575060088911155b15611f84576119c682613de8565b915060a088901c60079081166001019060a38a901c16600282108015906119ee575060048211155b611a0a5760405162461bcd60e51b815260040161015190614c90565b8a60051415611bcf57600160a98b901c811614611a2887868c613d05565b8260021415611ad557611a39614379565b8a818460028110611a4657fe5b602002015260405163ee22be2360e01b81526001600160a01b0387169063ee22be2390611a7c9084906000908790600401614a3c565b602060405180830381600087803b158015611a9657600080fd5b505af1158015611aaa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ace919061474a565b5050611bc9565b8260031415611b2957611ae6614397565b8a818460038110611af357fe5b60200201526040516315b74c9d60e11b81526001600160a01b03871690632b6e993a90611a7c9084906000908790600401614a98565b611b316143b5565b8a818460048110611b3e57fe5b602002015260405163dc3a2d8160e01b81526001600160a01b0387169063dc3a2d8190611b749084906000908790600401614af4565b602060405180830381600087803b158015611b8e57600080fd5b505af1158015611ba2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bc6919061474a565b50505b50611f7d565b60008b60041480611be057508b6008145b8015611bf3575060a98b901c6001166001145b905080611c0557611c0587868c613d05565b8260021415611d9457611c16614379565b8a818460028110611c2357fe5b60200201528115611d2c578c60081415611cc35760405163ee22be2360e01b81526001600160a01b0387169063ee22be23908d90611c6b908590600090600190600401614a3c565b6020604051808303818588803b158015611c8457600080fd5b505af1158015611c98573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190611cbd919061474a565b50611d27565b604051630b4c7e4d60e01b81526001600160a01b03871690630b4c7e4d908d90611cf4908590600090600401614a21565b6000604051808303818588803b158015611d0d57600080fd5b505af1158015611d21573d6000803e3d6000fd5b50505050505b611d8e565b604051630b4c7e4d60e01b81526001600160a01b03871690630b4c7e4d90611d5b908490600090600401614a21565b600060405180830381600087803b158015611d7557600080fd5b505af1158015611d89573d6000803e3d6000fd5b505050505b50611f7b565b8260031415611e9157611da5614397565b8a818460038110611db257fe5b60200201528115611e62578c60081415611e31576040516315b74c9d60e11b81526001600160a01b03871690632b6e993a908d90611dfa908590600090600190600401614a98565b6000604051808303818588803b158015611e1357600080fd5b505af1158015611e27573d6000803e3d6000fd5b5050505050611d27565b604051634515cef360e01b81526001600160a01b03871690634515cef3908d90611cf4908590600090600401614a7d565b604051634515cef360e01b81526001600160a01b03871690634515cef390611d5b908490600090600401614a7d565b611e996143b5565b8a818460048110611ea657fe5b60200201528115611f185760405162a6cbcd60e21b81526001600160a01b0387169063029b2f34908d90611ee1908590600090600401614ad9565b6000604051808303818588803b158015611efa57600080fd5b505af1158015611f0e573d6000803e3d6000fd5b5050505050611f79565b60405162a6cbcd60e21b81526001600160a01b0387169063029b2f3490611f46908490600090600401614ad9565b600060405180830381600087803b158015611f6057600080fd5b505af1158015611f74573d6000803e3d6000fd5b505050505b505b505b5050612023565b88600914156117c757611f98848389613d05565b604051636e553f6560e01b81526001600160a01b03831690636e553f6590611fc6908a908a90600401614d91565b602060405180830381600087803b158015611fe057600080fd5b505af1158015611ff4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612018919061474a565b9450505050506118be565b6040516370a0823160e01b815281906001600160a01b038516906370a0823190611841903090600401614976565b600080600061206287600288612438565b6040516370a0823160e01b815291935091506001600160a01b03808816916000918416906370a082319061209a903090600401614976565b60206040518083038186803b1580156120b257600080fd5b505afa1580156120c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ea919061474a565b9050886004111580156120fe575060088911155b156123d057886006146121175761211482613de8565b91505b60a088901c60079081166001019060a68a901c166002821080159061213d575060048211155b6121595760405162461bcd60e51b815260040161015190614c90565b8a600414156121ca57604051630d2680e960e11b81526001600160a01b03851690631a4d01d290612193908c908590600090600401614dd8565b600060405180830381600087803b1580156121ad57600080fd5b505af11580156121c1573d6000803e3d6000fd5b505050506123c9565b8a6005141561226a5760405163517a55a360e01b8152600160a98c901c811614906001600160a01b0386169063517a55a390612211908d9086906000908790600401614df1565b602060405180830381600087803b15801561222b57600080fd5b505af115801561223f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612263919061474a565b50506123c9565b8a600614156122b25761227e86858b613d05565b60405163517a55a360e01b81526001600160a01b0385169063517a55a390612193908c908590600090600190600401614df1565b8a6007141561234457604051630d2680e960e11b81526001600160a01b03851690631a4d01d2906122ec908c908590600090600401614dd8565b602060405180830381600087803b15801561230657600080fd5b505af115801561231a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061233e919061474a565b506123c9565b60405163f1dc3cc960e01b81526001600160a01b0385169063f1dc3cc990612375908c908590600090600401614e3e565b602060405180830381600087803b15801561238f57600080fd5b505af11580156123a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c7919061474a565b505b5050612409565b88600914156117c757604051635d043b2960e11b81526001600160a01b0383169063ba08765290611fc6908a908a903090600401614da8565b6001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21415612023576120238347613c05565b6000806001600160a01b0383168461279b576001861161254f57806001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561248b57600080fd5b505afa15801561249f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c39190614510565b9250806001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156124fe57600080fd5b505afa158015612512573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125369190614510565b9150600160b885901c1680612549579192915b50612796565b8560021415612611576000816001600160a01b031663cc77828d6040518163ffffffff1660e01b815260040160006040518083038186803b15801561259357600080fd5b505afa1580156125a7573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526125cf9190810190614564565b90508060a386901c600716815181106125e457fe5b602002602001015193508060a686901c6007168151811061260157fe5b6020026020010151925050612796565b8560031415612763576000816001600160a01b03166338fff2d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561265557600080fd5b505afa158015612669573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061268d919061474a565b604051631f29a8cd60e31b815290915060009073ba12222222228d8ba445958a75a0704d566bf2c89063f94d4668906126ca908590600401614b18565b60006040518083038186803b1580156126e257600080fd5b505afa1580156126f6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261271e91908101906145f8565b505090508060a387901c6007168151811061273557fe5b602002602001015194508060a687901c6007168151811061275257fe5b602002602001015193505050612796565b600886116127965761277e818760a387901c60071687613e41565b9250612793818760a687901c60071687613e41565b91505b612a50565b84600114156128fb57809150856004111580156127b9575060088611155b15612878578560061480156127d5575060a984901c6001166001145b1561285257806001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561281357600080fd5b505afa158015612827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061284b9190614510565b915061285e565b61285b81613de8565b90505b612871818760a387901c60071687613e41565b9250612796565b85600914156128f257806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b1580156128ba57600080fd5b505afa1580156128ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128719190614510565b60009150612a50565b8460021415612a505780925085600411158015612919575060088611155b156129d157856006148015612935575060a984901c6001166001145b156129b257806001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561297357600080fd5b505afa158015612987573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ab9190614510565b92506129be565b6129bb81613de8565b90505b612793818760a687901c60071687613e41565b8560091415612a4b57806001600160a01b03166338d52e0f6040518163ffffffff1660e01b815260040160206040518083038186803b158015612a1357600080fd5b505afa158015612a27573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127939190614510565b600092505b6001600160a01b03831673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612a8d5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc292505b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415612aca5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291505b50935093915050565b6000806000612ae486600087612438565b90925090506001600160a01b03851686612c345760b986901c60011660011415612b6757604051632e0ae37560e01b81526001600160a01b03821690632e0ae37590612b34904290600401614b18565b600060405180830381600087803b158015612b4e57600080fd5b505af1158015612b62573d6000803e3d6000fd5b505050505b600060b887901c6001169050600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015612baf57600080fd5b505afa158015612bc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be79190614785565b506001600160701b031691506001600160701b031691508260001415612c0957905b60a089901c62ffffff16880296508682620f4240020181880281612c2957fe5b0496505050506134fe565b8660011415612d5c5760016003556001600160a01b038083168482161090821663128acb0830838981612c7b5773fffd8963efd1fc6a506488495d951d5263988d25612c82565b6401000276a45b604080516000815260208101918290526001600160e01b031960e088901b16909152612cb594939291906024810161498a565b6040805180830381600087803b158015612cce57600080fd5b505af1925050508015612cfe575060408051601f3d908101601f19168201909252612cfb91810190614762565b60015b612d4e573d808015612d2c576040519150601f19603f3d011682016040523d82523d6000602084013e612d31565b606091505b5080806020019051810190612d46919061474a565b955050612d51565b50505b5060006003556134fe565b86600214156130475760405163f8b2cb4f60e01b81526001600160a01b0382169063ba9530a690829063f8b2cb4f90612d99908890600401614976565b60206040518083038186803b158015612db157600080fd5b505afa158015612dc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612de9919061474a565b604051634a46c67360e11b81526001600160a01b0385169063948d8ce690612e15908990600401614976565b60206040518083038186803b158015612e2d57600080fd5b505afa158015612e41573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e65919061474a565b60405163f8b2cb4f60e01b81526001600160a01b0386169063f8b2cb4f90612e91908990600401614976565b60206040518083038186803b158015612ea957600080fd5b505afa158015612ebd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee1919061474a565b604051634a46c67360e11b81526001600160a01b0387169063948d8ce690612f0d908a90600401614976565b60206040518083038186803b158015612f2557600080fd5b505afa158015612f39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f5d919061474a565b8a876001600160a01b031663d4cadf686040518163ffffffff1660e01b815260040160206040518083038186803b158015612f9757600080fd5b505afa158015612fab573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fcf919061474a565b6040518763ffffffff1660e01b8152600401612ff096959493929190614e94565b60206040518083038186803b15801561300857600080fd5b505afa15801561301c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613040919061474a565b93506134fe565b86600314156132c757604080516002808252606082018352600092602083019080368337019050509050838160008151811061307f57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505082816001815181106130ad57fe5b6001600160a01b039290921660209283029190910190910152604080516001808252818301909252600091816020015b6130e56143d3565b8152602001906001900390816130dd5790505090506040518060a00160405280846001600160a01b03166338fff2d06040518163ffffffff1660e01b815260040160206040518083038186803b15801561313e57600080fd5b505afa158015613152573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613176919061474a565b81526020016000815260200160018152602001888152602001600067ffffffffffffffff811180156131a757600080fd5b506040519080825280601f01601f1916602001820160405280156131d2576020820181803683370190505b50815250816000815181106131e357fe5b6020908102919091018101919091526040805160808101825230808252600093820184905281830152606081018390529051637c26833760e11b815273ba12222222228d8ba445958a75a0704d566bf2c89163f84d066e9161324d91859187918991600401614b21565b600060405180830381600087803b15801561326757600080fd5b505af115801561327b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526132a391908101906146ba565b9050806001815181106132b257fe5b602002602001015160000396505050506134fe565b600887116134fe57600760a387901c81169060a688901c16600889141561336f5760405163556d6e9f60e01b81526001600160a01b0384169063556d6e9f9061331890859085908c90600401614e3e565b60206040518083038186803b15801561333057600080fd5b505afa158015613344573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613368919061474a565b95506134fb565b886005148015613386575060a988901c6001166001145b156133bb576040516307211ef760e01b81526001600160a01b038416906307211ef79061331890859085908c90600401614bee565b8860061480156133d2575060a988901c6001166001145b1561347b57826001600160a01b0316637165485d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561341057600080fd5b505afa158015613424573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134489190614510565b6040516307211ef760e01b81529093506001600160a01b038416906307211ef79061331890859085908c90600401614bee565b604051635e0d443f60e01b81526001600160a01b03841690635e0d443f906134ab90859085908c90600401614bee565b60206040518083038186803b1580156134c357600080fd5b505afa1580156134d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f6919061474a565b50505b5050509392505050565b60006001600160a01b03831660048510801590613526575060088511155b156139555760a084901c60079081166001019060a686901c1660028210801590613551575060048211155b61356d5760405162461bcd60e51b815260040161015190614c90565b866006148015613584575060a986901c6001166001145b1561374d5760405163046e8dd760e31b81526000906001600160a01b038516906323746eb8906135b8908590600401614be0565b60206040518083038186803b1580156135d057600080fd5b505afa1580156135e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136089190614510565b90506000846001600160a01b031663b739953e846040518263ffffffff1660e01b81526004016136389190614be0565b60206040518083038186803b15801561365057600080fd5b505afa158015613664573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136889190614510565b9050806001600160a01b0316826001600160a01b0316146136d35763182df0f560e01b6000526020600060046000855afa80156136d157600051670de0b6b3a764000089020497505b505b846001600160a01b0316637165485d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561370c57600080fd5b505afa158015613720573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137449190614510565b94505050613759565b61375683613de8565b92505b816002141561385f5761376a614379565b8581836002811061377757fe5b602002015260405163ed8e84f360e01b81528280156137a257600060048301528760248301526137b0565b876004830152600060248301525b50600160448201526000805260206000606483885afa905080156137d45760005195505b508461385957604051638d8ea72760e01b81526001600160a01b03851690638d8ea72790613806908490600401614a13565b60206040518083038186803b15801561381e57600080fd5b505afa158015613832573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613856919061474a565b94505b5061394e565b81600314156138b157613870614397565b8581836003811061387d57fe5b6020020152604051633883e11960e01b81526001600160a01b03851690633883e11990613806908490600190600401614a60565b6138b96143b5565b858183600481106138c657fe5b602002015260405163cf701ff760e01b81526001600160a01b0385169063cf701ff7906138fa908490600190600401614abc565b60206040518083038186803b15801561391257600080fd5b505afa158015613926573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061394a919061474a565b9450505b50506139dd565b84600914156139dd5760405163ef8b30f760e01b81526001600160a01b0382169063ef8b30f79061398a908690600401614b18565b60206040518083038186803b1580156139a257600080fd5b505afa1580156139b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139da919061474a565b91505b509392505050565b60006001600160a01b03831660048510801590613a03575060088511155b15613b395784600614613a1c57613a1981613de8565b90505b600760a685901c166008861415613ab2576040516327d8462f60e11b81526001600160a01b03831690634fb08c5e90613a5b9087908590600401614e11565b60206040518083038186803b158015613a7357600080fd5b505afa158015613a87573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aab919061474a565b9250613b33565b60405163cc2b27d760e01b81526001600160a01b0383169063cc2b27d790613ae09087908590600401614dc7565b60206040518083038186803b158015613af857600080fd5b505afa158015613b0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b30919061474a565b92505b506139dd565b84600914156139dd5760405163266d6a8360e11b81526001600160a01b03821690634cdad5069061398a908690600401614b18565b6060613b7d8484600085614027565b90505b9392505050565b80471015613c025773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015613be957600080fd5b505af1158015613bfd573d6000803e3d6000fd5b505050505b50565b6001600160a01b03821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2148015613ca8575080826001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015613c7a57600080fd5b505afa158015613c8e573d6000803e3d6000fd5b505050506040513d6020811015613ca457600080fd5b5051105b156104f857816001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b158015613ce857600080fd5b505af1158015613cfc573d6000803e3d6000fd5b50505050505050565b613d0e83614182565b158015613d94575060408051636eb1769f60e11b81523060048201526001600160a01b0384811660248301529151839286169163dd62ed3e916044808301926020929190829003018186803b158015613d6657600080fd5b505afa158015613d7a573d6000803e3d6000fd5b505050506040513d6020811015613d9057600080fd5b5051105b1561032d57730316eb71485b0ab14103307bf65a021042c6d3806001600160a01b03841614613dd257613dd26001600160a01b0384168360006141bc565b61032d6001600160a01b038416836000196141bc565b6001600160a01b038082166000908152600260205260409020541680613e3c576303aa30b960e11b6000526020600060046000855afa8015613e33576001600160a01b036000511691505b5080613e3c5750805b919050565b60008360051480613e525750836006145b8015613e65575060a982901c6001166001145b15613f7a578360051415613ef657604051630b9947eb60e41b81526001600160a01b0386169063b9947eb090613e9f908690600401614b18565b60206040518083038186803b158015613eb757600080fd5b505afa158015613ecb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613eef9190614510565b9050613f75565b604051635b9cca9f60e11b81526001600160a01b0386169063b739953e90613f22908690600401614be0565b60206040518083038186803b158015613f3a57600080fd5b505afa158015613f4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613f729190614510565b90505b6118be565b60405163c661065760e01b81526001600160a01b0386169063c661065790613fa6908690600401614b18565b60206040518083038186803b158015613fbe57600080fd5b505afa925050508015613fee575060408051601f3d908101601f19168201909252613feb91810190614510565b60015b61401e5760405163046e8dd760e31b81526001600160a01b038616906323746eb890613f22908690600401614be0565b95945050505050565b6060824710156140685760405162461bcd60e51b8152600401808060200182810382526026815260200180614f666026913960400191505060405180910390fd5b614071856142cf565b6140c2576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b602083106141005780518252601f1990920191602091820191016140e1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614162576040519150601f19603f3d011682016040523d82523d6000602084013e614167565b606091505b50915091506141778282866142d5565b979650505050505050565b60006001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14806141b657506001600160a01b038216155b92915050565b801580614242575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561421457600080fd5b505afa158015614228573d6000803e3d6000fd5b505050506040513d602081101561423e57600080fd5b5051155b61427d5760405162461bcd60e51b8152600401808060200182810382526036815260200180614fd66036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261032d908490610beb565b3b151590565b606083156142e4575081613b80565b8251156142f45782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561433e578181015183820152602001614326565b50505050905090810190601f16801561436b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b60405180604001604052806002906020820280368337509192915050565b60405180606001604052806003906020820280368337509192915050565b60405180608001604052806004906020820280368337509192915050565b6040518060a0016040528060008019168152602001600081526020016000815260200160008152602001606081525090565b600082601f830112614415578081fd5b8135602061442a61442583614ee0565b614ebc565b8281528181019085830183850287018401881015614446578586fd5b855b8581101561446d57813561445b81614f2a565b84529284019290840190600101614448565b5090979650505050505050565b600082601f83011261448a578081fd5b8151602061449a61442583614ee0565b82815281810190858301838502870184018810156144b6578586fd5b855b8581101561446d5781516144cb81614f2a565b845292840192908401906001016144b8565b80516001600160701b0381168114613e3c57600080fd5b600060208284031215614505578081fd5b8135613b8081614f2a565b600060208284031215614521578081fd5b8151613b8081614f2a565b6000806040838503121561453e578081fd5b823561454981614f2a565b9150602083013561455981614f2a565b809150509250929050565b600060208284031215614575578081fd5b815167ffffffffffffffff81111561458b578182fd5b6118be8482850161447a565b600080604083850312156145a9578182fd5b823567ffffffffffffffff808211156145c0578384fd5b6145cc86838701614405565b935060208501359150808211156145e1578283fd5b506145ee85828601614405565b9150509250929050565b60008060006060848603121561460c578081fd5b835167ffffffffffffffff80821115614623578283fd5b61462f8783880161447a565b9450602091508186015181811115614645578384fd5b86019050601f81018713614657578283fd5b805161466561442582614ee0565b81815283810190838501858402850186018b1015614681578687fd5b8694505b838510156146a3578051835260019490940193918501918501614685565b508096505050505050604084015190509250925092565b600060208083850312156146cc578182fd5b825167ffffffffffffffff8111156146e2578283fd5b8301601f810185136146f2578283fd5b805161470061442582614ee0565b818152838101908385018584028501860189101561471c578687fd5b8694505b8385101561473e578051835260019490940193918501918501614720565b50979650505050505050565b60006020828403121561475b578081fd5b5051919050565b60008060408385031215614774578182fd5b505080516020909101519092909150565b600080600060608486031215614799578081fd5b6147a2846144dd565b92506147b0602085016144dd565b9150604084015163ffffffff811681146147c8578182fd5b809150509250925092565b6000602082840312156147e4578081fd5b5035919050565b600080604083850312156147fd578182fd5b50508035926020909101359150565b600080600060608486031215614820578081fd5b833592506020840135915060408401356147c881614f2a565b6000815180845260208085019450808401835b838110156148715781516001600160a01b03168752958201959082019060010161484c565b509495945050505050565b8060005b600281101561489f578151845260209384019390910190600101614880565b50505050565b8060005b600381101561489f5781518452602093840193909101906001016148a9565b8060005b600481101561489f5781518452602093840193909101906001016148cc565b60008151808452614903816020860160208601614efe565b601f01601f19169290920160200192915050565b6002811061492157fe5b9052565b80516001600160a01b039081168352602080830151151590840152604080830151909116908301526060908101511515910152565b6000825161496c818460208701614efe565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528515156020830152604082018590528316606082015260a060808201819052600090614177908301846148eb565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03958616815260208101949094529190931660408301526060820192909252608081019190915260a00190565b604081016141b6828461487c565b60608101614a2f828561487c565b8260408301529392505050565b60808101614a4a828661487c565b8360408301528215156060830152949350505050565b60808101614a6e82856148a5565b82151560608301529392505050565b60808101614a8b82856148a5565b8260608301529392505050565b60a08101614aa682866148a5565b8360608301528215156080830152949350505050565b60a08101614aca82856148c8565b82151560808301529392505050565b60a08101614ae782856148c8565b8260808301529392505050565b60c08101614b0282866148c8565b83608083015282151560a0830152949350505050565b90815260200190565b600060e08201614b318388614917565b602060e08185015281875180845261010093508386019150838382028701019350828901855b82811015614bb95787860360ff190184528151805187528581015186880152604080820151908801526060808201519088015260809081015160a091880182905290614ba5818901836148eb565b975050509284019290840190600101614b57565b50505050508281036040840152614bd08186614839565b91505061401e6060830184614925565b600f9190910b815260200190565b600f93840b81529190920b6020820152604081019190915260600190565b600f94850b81529290930b60208301526040820152606081019190915260800190565b600085825284602083015260018060a01b038416604083015260806060830152614c5c60808301846148eb565b9695505050505050565b60208082526010908201526f696e76616c696420706f6f6c5479706560801b604082015260600190565b6020808252600e908201526d696e76616c696420746f6b656e7360901b604082015260600190565b6020808252600c908201526b1a5b9d985b1a590818d85b1b60a21b604082015260600190565b6020808252600e908201526d34b73b30b634b21030b1ba34b7b760911b604082015260600190565b600060e08252855160e08301526020860151614d26610100840182614917565b5060408601516001600160a01b03908116610120840152606087015116610140830152608086015161016083015260a086015160c0610180840152614d6f6101a08401826148eb565b915050614d7f6020830186614925565b60a082019390935260c0015292915050565b9182526001600160a01b0316602082015260400190565b9283526001600160a01b03918216602084015216604082015260600190565b918252600f0b602082015260400190565b928352600f9190910b6020830152604082015260600190565b938452600f9290920b602084015260408301521515606082015260800190565b918252602082015260400190565b92835260208301919091526001600160a01b0316604082015260600190565b9283526020830191909152604082015260600190565b93845260208401929092526040830152606082015260800190565b9485526020850193909352604084019190915260608301521515608082015260a00190565b958652602086019490945260408501929092526060840152608083015260a082015260c00190565b60405181810167ffffffffffffffff81118282101715614ed857fe5b604052919050565b600067ffffffffffffffff821115614ef457fe5b5060209081020190565b60005b83811015614f19578181015183820152602001614f01565b8381111561489f5750506000910152565b6001600160a01b0381168114613c0257600080fdfe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220800d1310a45543632ca1b2f7e0927476fe430506cdbd18cda385250997c9b8df64736f6c63430007060033

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

000000000000000000000000997b6f43c1c1e8630d03b8e3c11b60e98a1bea90

-----Decoded View---------------
Arg [0] : _registry (address): 0x997B6F43c1c1e8630d03B8E3C11B60E98A1beA90

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000997b6f43c1c1e8630d03b8e3c11b60e98a1bea90


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.