Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
17499089 | 594 days ago | 0.33422638 ETH | ||||
17499089 | 594 days ago | 0.33422638 ETH | ||||
17499089 | 594 days ago | 0.36974819 ETH | ||||
17499089 | 594 days ago | 0.36974819 ETH | ||||
17499089 | 594 days ago | 0.2994675 ETH | ||||
17499089 | 594 days ago | 0.2994675 ETH | ||||
17499089 | 594 days ago | 0.29590322 ETH | ||||
17499089 | 594 days ago | 0.29590322 ETH | ||||
11825690 | 1451 days ago | 0.15806103 ETH | ||||
11825690 | 1451 days ago | 0.15806103 ETH | ||||
11825690 | 1451 days ago | 0.31975652 ETH | ||||
11825690 | 1451 days ago | 0.31975652 ETH | ||||
11825690 | 1451 days ago | 0.33893685 ETH | ||||
11825690 | 1451 days ago | 0.33893685 ETH | ||||
11825690 | 1451 days ago | 0.32044999 ETH | ||||
11825690 | 1451 days ago | 0.32044999 ETH | ||||
11540237 | 1495 days ago | 0.53733368 ETH | ||||
11540237 | 1495 days ago | 0.53733368 ETH | ||||
11488367 | 1503 days ago | 0.05141421 ETH | ||||
11488367 | 1503 days ago | 0.05141421 ETH | ||||
11488367 | 1503 days ago | 0.08686518 ETH | ||||
11488367 | 1503 days ago | 0.08686518 ETH | ||||
11488367 | 1503 days ago | 0.08948216 ETH | ||||
11488367 | 1503 days ago | 0.08948216 ETH | ||||
11488367 | 1503 days ago | 0.07223843 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
OneSplit
Compiler Version
v0.5.17+commit.d19bba13
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2020-07-05 */ // File: @openzeppelin/contracts/token/ERC20/IERC20.sol pragma solidity ^0.5.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. Does not include * the optional functions; to access them see {ERC20Detailed}. */ 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: contracts/IOneSplit.sol pragma solidity ^0.5.0; // // [ msg.sender ] // | | // | | // \_/ // +---------------+ ________________________________ // | OneSplitAudit | _______________________________ \ // +---------------+ \ \ // | | ______________ | | (staticcall) // | | / ____________ \ | | // | | (call) / / \ \ | | // | | / / | | | | // \_/ | | \_/ \_/ // +--------------+ | | +----------------------+ // | OneSplitWrap | | | | OneSplitViewWrap | // +--------------+ | | +----------------------+ // | | | | | | // | | (delegatecall) | | (staticcall) | | (staticcall) // \_/ | | \_/ // +--------------+ | | +------------------+ // | OneSplit | | | | OneSplitView | // +--------------+ | | +------------------+ // | | / / // \ \________________/ / // \__________________/ // contract IOneSplitConsts { // flags = FLAG_DISABLE_UNISWAP + FLAG_DISABLE_KYBER + ... uint256 internal constant FLAG_DISABLE_UNISWAP = 0x01; uint256 internal constant FLAG_DISABLE_KYBER = 0x02; uint256 internal constant FLAG_DISABLE_BANCOR = 0x04; uint256 internal constant FLAG_DISABLE_OASIS = 0x08; uint256 internal constant FLAG_DISABLE_COMPOUND = 0x10; uint256 internal constant FLAG_DISABLE_FULCRUM = 0x20; uint256 internal constant FLAG_DISABLE_CHAI = 0x40; uint256 internal constant FLAG_DISABLE_AAVE = 0x80; uint256 internal constant FLAG_DISABLE_SMART_TOKEN = 0x100; uint256 internal constant FLAG_ENABLE_MULTI_PATH_ETH = 0x200; // Turned off by default uint256 internal constant FLAG_DISABLE_BDAI = 0x400; uint256 internal constant FLAG_DISABLE_IEARN = 0x800; uint256 internal constant FLAG_DISABLE_CURVE_COMPOUND = 0x1000; uint256 internal constant FLAG_DISABLE_CURVE_USDT = 0x2000; uint256 internal constant FLAG_DISABLE_CURVE_Y = 0x4000; uint256 internal constant FLAG_DISABLE_CURVE_BINANCE = 0x8000; uint256 internal constant FLAG_ENABLE_MULTI_PATH_DAI = 0x10000; // Turned off by default uint256 internal constant FLAG_ENABLE_MULTI_PATH_USDC = 0x20000; // Turned off by default uint256 internal constant FLAG_DISABLE_CURVE_SYNTHETIX = 0x40000; uint256 internal constant FLAG_DISABLE_WETH = 0x80000; uint256 internal constant FLAG_DISABLE_UNISWAP_COMPOUND = 0x100000; // Works only when one of assets is ETH or FLAG_ENABLE_MULTI_PATH_ETH uint256 internal constant FLAG_DISABLE_UNISWAP_CHAI = 0x200000; // Works only when ETH<>DAI or FLAG_ENABLE_MULTI_PATH_ETH uint256 internal constant FLAG_DISABLE_UNISWAP_AAVE = 0x400000; // Works only when one of assets is ETH or FLAG_ENABLE_MULTI_PATH_ETH uint256 internal constant FLAG_DISABLE_IDLE = 0x800000; uint256 internal constant FLAG_DISABLE_MOONISWAP = 0x1000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2 = 0x2000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_ETH = 0x4000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_DAI = 0x8000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_USDC = 0x10000000; uint256 internal constant FLAG_DISABLE_ALL_SPLIT_SOURCES = 0x20000000; uint256 internal constant FLAG_DISABLE_ALL_WRAP_SOURCES = 0x40000000; uint256 internal constant FLAG_DISABLE_CURVE_PAX = 0x80000000; uint256 internal constant FLAG_DISABLE_CURVE_RENBTC = 0x100000000; uint256 internal constant FLAG_DISABLE_CURVE_TBTC = 0x200000000; uint256 internal constant FLAG_ENABLE_MULTI_PATH_USDT = 0x400000000; // Turned off by default uint256 internal constant FLAG_ENABLE_MULTI_PATH_WBTC = 0x800000000; // Turned off by default uint256 internal constant FLAG_ENABLE_MULTI_PATH_TBTC = 0x1000000000; // Turned off by default uint256 internal constant FLAG_ENABLE_MULTI_PATH_RENBTC = 0x2000000000; // Turned off by default uint256 internal constant FLAG_DISABLE_DFORCE_SWAP = 0x4000000000; uint256 internal constant FLAG_DISABLE_SHELL = 0x8000000000; uint256 internal constant FLAG_ENABLE_CHI_BURN = 0x10000000000; uint256 internal constant FLAG_DISABLE_MSTABLE_MUSD = 0x20000000000; uint256 internal constant FLAG_DISABLE_CURVE_SBTC = 0x40000000000; uint256 internal constant FLAG_DISABLE_DMM = 0x80000000000; uint256 internal constant FLAG_DISABLE_UNISWAP_ALL = 0x100000000000; uint256 internal constant FLAG_DISABLE_CURVE_ALL = 0x200000000000; uint256 internal constant FLAG_DISABLE_UNISWAP_V2_ALL = 0x400000000000; uint256 internal constant FLAG_DISABLE_SPLIT_RECALCULATION = 0x800000000000; uint256 internal constant FLAG_DISABLE_BALANCER_ALL = 0x1000000000000; uint256 internal constant FLAG_DISABLE_BALANCER_1 = 0x2000000000000; uint256 internal constant FLAG_DISABLE_BALANCER_2 = 0x4000000000000; uint256 internal constant FLAG_DISABLE_BALANCER_3 = 0x8000000000000; uint256 internal constant FLAG_ENABLE_KYBER_UNISWAP_RESERVE = 0x10000000000000; // Turned off by default uint256 internal constant FLAG_ENABLE_KYBER_OASIS_RESERVE = 0x20000000000000; // Turned off by default uint256 internal constant FLAG_ENABLE_KYBER_BANCOR_RESERVE = 0x40000000000000; // Turned off by default uint256 internal constant FLAG_ENABLE_REFERRAL_GAS_SPONSORSHIP = 0x80000000000000; // Turned off by default uint256 internal constant FLAG_ENABLE_MULTI_PATH_COMP = 0x100000000000000; // Turned off by default } contract IOneSplit is IOneSplitConsts { function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags // See constants in IOneSplit.sol ) public view returns( uint256 returnAmount, uint256[] memory distribution ); function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, // See constants in IOneSplit.sol uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ); function swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 minReturn, uint256[] memory distribution, uint256 flags ) public payable returns(uint256 returnAmount); } // File: @openzeppelin/contracts/math/SafeMath.sol pragma solidity ^0.5.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, 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) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @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) { // 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 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts 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) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message 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. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts 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) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message 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. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } } // File: contracts/interface/IUniswapExchange.sol pragma solidity ^0.5.0; interface IUniswapExchange { function getEthToTokenInputPrice(uint256 ethSold) external view returns (uint256 tokensBought); function getTokenToEthInputPrice(uint256 tokensSold) external view returns (uint256 ethBought); function ethToTokenSwapInput(uint256 minTokens, uint256 deadline) external payable returns (uint256 tokensBought); function tokenToEthSwapInput(uint256 tokensSold, uint256 minEth, uint256 deadline) external returns (uint256 ethBought); function tokenToTokenSwapInput( uint256 tokensSold, uint256 minTokensBought, uint256 minEthBought, uint256 deadline, address tokenAddr ) external returns (uint256 tokensBought); } // File: contracts/interface/IUniswapFactory.sol pragma solidity ^0.5.0; interface IUniswapFactory { function getExchange(IERC20 token) external view returns (IUniswapExchange exchange); } // File: contracts/interface/IKyberNetworkContract.sol pragma solidity ^0.5.0; interface IKyberNetworkContract { function searchBestRate(IERC20 src, IERC20 dest, uint256 srcAmount, bool usePermissionless) external view returns (address reserve, uint256 rate); } // File: contracts/interface/IKyberNetworkProxy.sol pragma solidity ^0.5.0; interface IKyberNetworkProxy { function getExpectedRate(IERC20 src, IERC20 dest, uint256 srcQty) external view returns (uint256 expectedRate, uint256 slippageRate); function tradeWithHint( IERC20 src, uint256 srcAmount, IERC20 dest, address destAddress, uint256 maxDestAmount, uint256 minConversionRate, address walletId, bytes calldata hint ) external payable returns (uint256); function kyberNetworkContract() external view returns (IKyberNetworkContract); // TODO: Limit usage by tx.gasPrice // function maxGasPrice() external view returns (uint256); // TODO: Limit usage by user cap // function getUserCapInWei(address user) external view returns (uint256); // function getUserCapInTokenWei(address user, IERC20 token) external view returns (uint256); } // File: contracts/interface/IKyberUniswapReserve.sol pragma solidity ^0.5.0; interface IKyberUniswapReserve { function uniswapFactory() external view returns (address); } // File: contracts/interface/IKyberOasisReserve.sol pragma solidity ^0.5.0; interface IKyberOasisReserve { function otc() external view returns (address); } // File: contracts/interface/IKyberBancorReserve.sol pragma solidity ^0.5.0; contract IKyberBancorReserve { function bancorEth() public view returns (address); } // File: contracts/interface/IBancorNetwork.sol pragma solidity ^0.5.0; interface IBancorNetwork { function getReturnByPath(address[] calldata path, uint256 amount) external view returns (uint256 returnAmount, uint256 conversionFee); function claimAndConvert(address[] calldata path, uint256 amount, uint256 minReturn) external returns (uint256); function convert(address[] calldata path, uint256 amount, uint256 minReturn) external payable returns (uint256); } // File: contracts/interface/IBancorContractRegistry.sol pragma solidity ^0.5.0; contract IBancorContractRegistry { function addressOf(bytes32 contractName) external view returns (address); } // File: contracts/interface/IBancorNetworkPathFinder.sol pragma solidity ^0.5.0; interface IBancorNetworkPathFinder { function generatePath(IERC20 sourceToken, IERC20 targetToken) external view returns (address[] memory); } // File: contracts/interface/IBancorConverterRegistry.sol pragma solidity ^0.5.0; interface IBancorConverterRegistry { function getConvertibleTokenSmartTokenCount(IERC20 convertibleToken) external view returns(uint256); function getConvertibleTokenSmartTokens(IERC20 convertibleToken) external view returns(address[] memory); function getConvertibleTokenSmartToken(IERC20 convertibleToken, uint256 index) external view returns(address); function isConvertibleTokenSmartToken(IERC20 convertibleToken, address value) external view returns(bool); } // File: contracts/interface/IBancorEtherToken.sol pragma solidity ^0.5.0; contract IBancorEtherToken is IERC20 { function deposit() external payable; function withdraw(uint256 amount) external; } // File: contracts/interface/IBancorFinder.sol pragma solidity ^0.5.0; interface IBancorFinder { function buildBancorPath( IERC20 fromToken, IERC20 destToken ) external view returns(address[] memory path); } // File: contracts/interface/IOasisExchange.sol pragma solidity ^0.5.0; interface IOasisExchange { function getBuyAmount(IERC20 buyGem, IERC20 payGem, uint256 payAmt) external view returns (uint256 fillAmt); function sellAllAmount(IERC20 payGem, uint256 payAmt, IERC20 buyGem, uint256 minFillAmount) external returns (uint256 fillAmt); } // File: contracts/interface/IWETH.sol pragma solidity ^0.5.0; contract IWETH is IERC20 { function deposit() external payable; function withdraw(uint256 amount) external; } // File: contracts/interface/ICurve.sol pragma solidity ^0.5.0; interface ICurve { // solium-disable-next-line mixedcase function get_dy_underlying(int128 i, int128 j, uint256 dx) external view returns(uint256 dy); // solium-disable-next-line mixedcase function get_dy(int128 i, int128 j, uint256 dx) external view returns(uint256 dy); // solium-disable-next-line mixedcase function exchange_underlying(int128 i, int128 j, uint256 dx, uint256 minDy) external; // solium-disable-next-line mixedcase function exchange(int128 i, int128 j, uint256 dx, uint256 minDy) external; } contract ICurveRegistry { function get_pool_info(address pool) external view returns( uint256[8] memory balances, uint256[8] memory underlying_balances, uint256[8] memory decimals, uint256[8] memory underlying_decimals, address lp_token, uint256 A, uint256 fee ); } contract ICurveCalculator { function get_dy( int128 nCoins, uint256[8] calldata balances, uint256 amp, uint256 fee, uint256[8] calldata rates, uint256[8] calldata precisions, bool underlying, int128 i, int128 j, uint256[100] calldata dx ) external view returns(uint256[100] memory dy); } // File: contracts/interface/IChai.sol pragma solidity ^0.5.0; interface IPot { function dsr() external view returns (uint256); function chi() external view returns (uint256); function rho() external view returns (uint256); function drip() external returns (uint256); function join(uint256) external; function exit(uint256) external; } contract IChai is IERC20 { function POT() public view returns (IPot); function join(address dst, uint256 wad) external; function exit(address src, uint256 wad) external; } library ChaiHelper { IPot private constant POT = IPot(0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7); uint256 private constant RAY = 10**27; function _mul(uint256 x, uint256 y) private pure returns (uint256 z) { require(y == 0 || (z = x * y) / y == x); } function _rmul(uint256 x, uint256 y) private pure returns (uint256 z) { // always rounds down z = _mul(x, y) / RAY; } function _rdiv(uint256 x, uint256 y) private pure returns (uint256 z) { // always rounds down z = _mul(x, RAY) / y; } function rpow(uint256 x, uint256 n, uint256 base) private pure returns (uint256 z) { // solium-disable-next-line security/no-inline-assembly assembly { switch x case 0 { switch n case 0 { z := base } default { z := 0 } } default { switch mod(n, 2) case 0 { z := base } default { z := x } let half := div(base, 2) // for rounding. for { n := div(n, 2) } n { n := div(n, 2) } { let xx := mul(x, x) if iszero(eq(div(xx, x), x)) { revert(0, 0) } let xxRound := add(xx, half) if lt(xxRound, xx) { revert(0, 0) } x := div(xxRound, base) if mod(n, 2) { let zx := mul(z, x) if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0, 0) } let zxRound := add(zx, half) if lt(zxRound, zx) { revert(0, 0) } z := div(zxRound, base) } } } } } function potDrip() private view returns (uint256) { return _rmul(rpow(POT.dsr(), now - POT.rho(), RAY), POT.chi()); } function chaiPrice(IChai chai) internal view returns(uint256) { return chaiToDai(chai, 1e18); } function daiToChai( IChai /*chai*/, uint256 amount ) internal view returns (uint256) { uint256 chi = (now > POT.rho()) ? potDrip() : POT.chi(); return _rdiv(amount, chi); } function chaiToDai( IChai /*chai*/, uint256 amount ) internal view returns (uint256) { uint256 chi = (now > POT.rho()) ? potDrip() : POT.chi(); return _rmul(chi, amount); } } // File: contracts/interface/ICompound.sol pragma solidity ^0.5.0; contract ICompound { function markets(address cToken) external view returns (bool isListed, uint256 collateralFactorMantissa); } contract ICompoundToken is IERC20 { function underlying() external view returns (address); function exchangeRateStored() external view returns (uint256); function mint(uint256 mintAmount) external returns (uint256); function redeem(uint256 redeemTokens) external returns (uint256); } contract ICompoundEther is IERC20 { function mint() external payable; function redeem(uint256 redeemTokens) external returns (uint256); } // File: contracts/interface/IAaveToken.sol pragma solidity ^0.5.0; contract IAaveToken is IERC20 { function underlyingAssetAddress() external view returns (IERC20); function redeem(uint256 amount) external; } interface IAaveLendingPool { function core() external view returns (address); function deposit(IERC20 token, uint256 amount, uint16 refCode) external payable; } // File: contracts/interface/IMooniswap.sol pragma solidity ^0.5.0; interface IMooniswapRegistry { function target() external view returns(IMooniswap); } interface IMooniswap { function getReturn( IERC20 fromToken, IERC20 destToken, uint256 amount ) external view returns(uint256 returnAmount); function swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 minReturn ) external payable returns(uint256 returnAmount); } // File: @openzeppelin/contracts/utils/Address.sol pragma solidity ^0.5.5; /** * @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) { // According to EIP-1052, 0x0 is the value returned for not-yet created accounts // and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned // for accounts without code, i.e. `keccak256('')` bytes32 codehash; bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470; // solhint-disable-next-line no-inline-assembly assembly { codehash := extcodehash(account) } return (codehash != accountHash && codehash != 0x0); } /** * @dev Converts an `address` into `address payable`. Note that this is * simply a type cast: the actual underlying value is not changed. * * _Available since v2.4.0._ */ function toPayable(address account) internal pure returns (address payable) { return address(uint160(account)); } /** * @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]. * * _Available since v2.4.0._ */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-call-value (bool success, ) = recipient.call.value(amount)(""); require(success, "Address: unable to send value, recipient may have reverted"); } } // File: @openzeppelin/contracts/token/ERC20/SafeERC20.sol pragma solidity ^0.5.0; /** * @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 ERC20;` 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)); } 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. // A Solidity high level call has three parts: // 1. The target address is checked to verify it contains contract code // 2. The call itself is made, and success asserted // 3. The return value is decoded, which in turn checks the size of the returned data. // solhint-disable-next-line max-line-length require(address(token).isContract(), "SafeERC20: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = address(token).call(data); require(success, "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: contracts/UniversalERC20.sol pragma solidity ^0.5.0; library UniversalERC20 { using SafeMath for uint256; using SafeERC20 for IERC20; IERC20 private constant ZERO_ADDRESS = IERC20(0x0000000000000000000000000000000000000000); IERC20 private constant ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); function universalTransfer(IERC20 token, address to, uint256 amount) internal returns(bool) { if (amount == 0) { return true; } if (isETH(token)) { address(uint160(to)).transfer(amount); } else { token.safeTransfer(to, amount); return true; } } function universalTransferFrom(IERC20 token, address from, address to, uint256 amount) internal { if (amount == 0) { return; } if (isETH(token)) { require(from == msg.sender && msg.value >= amount, "Wrong useage of ETH.universalTransferFrom()"); if (to != address(this)) { address(uint160(to)).transfer(amount); } if (msg.value > amount) { msg.sender.transfer(msg.value.sub(amount)); } } else { token.safeTransferFrom(from, to, amount); } } function universalTransferFromSenderToThis(IERC20 token, uint256 amount) internal { if (amount == 0) { return; } if (isETH(token)) { if (msg.value > amount) { // Return remainder if exist msg.sender.transfer(msg.value.sub(amount)); } } else { token.safeTransferFrom(msg.sender, address(this), amount); } } function universalApprove(IERC20 token, address to, uint256 amount) internal { if (!isETH(token)) { if (amount == 0) { token.safeApprove(to, 0); return; } uint256 allowance = token.allowance(address(this), to); if (allowance < amount) { if (allowance > 0) { token.safeApprove(to, 0); } token.safeApprove(to, amount); } } } function universalBalanceOf(IERC20 token, address who) internal view returns (uint256) { if (isETH(token)) { return who.balance; } else { return token.balanceOf(who); } } function universalDecimals(IERC20 token) internal view returns (uint256) { if (isETH(token)) { return 18; } (bool success, bytes memory data) = address(token).staticcall.gas(10000)( abi.encodeWithSignature("decimals()") ); if (!success || data.length == 0) { (success, data) = address(token).staticcall.gas(10000)( abi.encodeWithSignature("DECIMALS()") ); } return (success && data.length > 0) ? abi.decode(data, (uint256)) : 18; } function isETH(IERC20 token) internal pure returns(bool) { return (address(token) == address(ZERO_ADDRESS) || address(token) == address(ETH_ADDRESS)); } function notExist(IERC20 token) internal pure returns(bool) { return (address(token) == address(-1)); } } // File: contracts/interface/IUniswapV2Exchange.sol pragma solidity ^0.5.0; interface IUniswapV2Exchange { function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external; } library UniswapV2ExchangeLib { using SafeMath for uint256; using UniversalERC20 for IERC20; function getReturn( IUniswapV2Exchange exchange, IERC20 fromToken, IERC20 destToken, uint amountIn ) internal view returns (uint256) { uint256 reserveIn = fromToken.universalBalanceOf(address(exchange)); uint256 reserveOut = destToken.universalBalanceOf(address(exchange)); uint256 amountInWithFee = amountIn.mul(997); uint256 numerator = amountInWithFee.mul(reserveOut); uint256 denominator = reserveIn.mul(1000).add(amountInWithFee); return (denominator == 0) ? 0 : numerator.div(denominator); } } // File: contracts/interface/IUniswapV2Factory.sol pragma solidity ^0.5.0; interface IUniswapV2Factory { function getPair(IERC20 tokenA, IERC20 tokenB) external view returns (IUniswapV2Exchange pair); } // File: contracts/interface/IDForceSwap.sol pragma solidity ^0.5.0; interface IDForceSwap { function getAmountByInput(IERC20 input, IERC20 output, uint256 amount) external view returns(uint256); function swap(IERC20 input, IERC20 output, uint256 amount) external; } // File: contracts/interface/IShell.sol pragma solidity ^0.5.0; interface IShell { function viewOriginTrade( address origin, address target, uint256 originAmount ) external view returns (uint256); function swapByOrigin( address origin, address target, uint256 originAmount, uint256 minTargetAmount, uint256 deadline ) external returns (uint256); } // File: contracts/interface/IMStable.sol pragma solidity ^0.5.0; contract IMStable is IERC20 { function getSwapOutput( IERC20 _input, IERC20 _output, uint256 _quantity ) external view returns (bool, string memory, uint256 output); function swap( IERC20 _input, IERC20 _output, uint256 _quantity, address _recipient ) external returns (uint256 output); function redeem( IERC20 _basset, uint256 _bassetQuantity ) external returns (uint256 massetRedeemed); } interface IMassetRedemptionValidator { function getRedeemValidity( IERC20 _mAsset, uint256 _mAssetQuantity, IERC20 _outputBasset ) external view returns (bool, string memory, uint256 output); } // File: contracts/interface/IBalancerRegistry.sol pragma solidity ^0.5.0; interface IBalancerPool { function swapExactAmountIn( IERC20 tokenIn, uint256 tokenAmountIn, IERC20 tokenOut, uint256 minAmountOut, uint256 maxPrice ) external returns (uint256 tokenAmountOut, uint256 spotPriceAfter); } pragma solidity ^0.5.0; interface IBalancerRegistry { event PoolAdded( address indexed pool ); event PoolTokenPairAdded( address indexed pool, address indexed fromToken, address indexed destToken ); event IndicesUpdated( address indexed fromToken, address indexed destToken, bytes32 oldIndices, bytes32 newIndices ); // Get info about pool pair for 1 SLOAD function getPairInfo(address pool, address fromToken, address destToken) external view returns(uint256 weight1, uint256 weight2, uint256 swapFee); // Pools function checkAddedPools(address pool) external view returns(bool); function getAddedPoolsLength() external view returns(uint256); function getAddedPools() external view returns(address[] memory); function getAddedPoolsWithLimit(uint256 offset, uint256 limit) external view returns(address[] memory result); // Tokens function getAllTokensLength() external view returns(uint256); function getAllTokens() external view returns(address[] memory); function getAllTokensWithLimit(uint256 offset, uint256 limit) external view returns(address[] memory result); // Pairs function getPoolsLength(address fromToken, address destToken) external view returns(uint256); function getPools(address fromToken, address destToken) external view returns(address[] memory); function getPoolsWithLimit(address fromToken, address destToken, uint256 offset, uint256 limit) external view returns(address[] memory result); function getBestPools(address fromToken, address destToken) external view returns(address[] memory pools); function getBestPoolsWithLimit(address fromToken, address destToken, uint256 limit) external view returns(address[] memory pools); // Get swap rates function getPoolReturn(address pool, address fromToken, address destToken, uint256 amount) external view returns(uint256); function getPoolReturns(address pool, address fromToken, address destToken, uint256[] calldata amounts) external view returns(uint256[] memory result); // Add and update registry function addPool(address pool) external returns(uint256 listed); function addPools(address[] calldata pools) external returns(uint256[] memory listed); function updatedIndices(address[] calldata tokens, uint256 lengthLimit) external; } // File: contracts/OneSplitBase.sol pragma solidity ^0.5.0; contract IOneSplitView is IOneSplitConsts { function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) public view returns( uint256 returnAmount, uint256[] memory distribution ); function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ); } library DisableFlags { function check(uint256 flags, uint256 flag) internal pure returns(bool) { return (flags & flag) != 0; } } contract OneSplitRoot is IOneSplitView { using SafeMath for uint256; using DisableFlags for uint256; using UniversalERC20 for IERC20; using UniversalERC20 for IWETH; using UniswapV2ExchangeLib for IUniswapV2Exchange; using ChaiHelper for IChai; uint256 constant internal DEXES_COUNT = 27; IERC20 constant internal ETH_ADDRESS = IERC20(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE); IBancorEtherToken constant internal bancorEtherToken = IBancorEtherToken(0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315); IWETH constant internal weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); IChai constant internal chai = IChai(0x06AF07097C9Eeb7fD685c692751D5C66dB49c215); IERC20 constant internal dai = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F); IERC20 constant internal bnt = IERC20(0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C); IERC20 constant internal usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); IERC20 constant internal usdt = IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7); IERC20 constant internal tusd = IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); IERC20 constant internal busd = IERC20(0x4Fabb145d64652a948d72533023f6E7A623C7C53); IERC20 constant internal susd = IERC20(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51); IERC20 constant internal pax = IERC20(0x8E870D67F660D95d5be530380D0eC0bd388289E1); IERC20 constant internal renbtc = IERC20(0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D); IERC20 constant internal wbtc = IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); IERC20 constant internal tbtc = IERC20(0x1bBE271d15Bb64dF0bc6CD28Df9Ff322F2eBD847); IERC20 constant internal hbtc = IERC20(0x0316EB71485b0Ab14103307bf65a021042c6d380); IERC20 constant internal sbtc = IERC20(0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6); IERC20 constant internal comp = IERC20(0xc00e94Cb662C3520282E6f5717214004A7f26888); IKyberNetworkProxy constant internal kyberNetworkProxy = IKyberNetworkProxy(0x818E6FECD516Ecc3849DAf6845e3EC868087B755); IUniswapFactory constant internal uniswapFactory = IUniswapFactory(0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95); IBancorContractRegistry constant internal bancorContractRegistry = IBancorContractRegistry(0x52Ae12ABe5D8BD778BD5397F99cA900624CfADD4); IBancorNetworkPathFinder constant internal bancorNetworkPathFinder = IBancorNetworkPathFinder(0x6F0cD8C4f6F06eAB664C7E3031909452b4B72861); //IBancorConverterRegistry constant internal bancorConverterRegistry = IBancorConverterRegistry(0xf6E2D7F616B67E46D708e4410746E9AAb3a4C518); IBancorFinder constant internal bancorFinder = IBancorFinder(0x2B344e14dc2641D11D338C053C908c7A7D4c30B9); IOasisExchange constant internal oasisExchange = IOasisExchange(0x794e6e91555438aFc3ccF1c5076A74F42133d08D); ICurve constant internal curveCompound = ICurve(0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56); ICurve constant internal curveUSDT = ICurve(0x52EA46506B9CC5Ef470C5bf89f17Dc28bB35D85C); ICurve constant internal curveY = ICurve(0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51); ICurve constant internal curveBinance = ICurve(0x79a8C46DeA5aDa233ABaFFD40F3A0A2B1e5A4F27); ICurve constant internal curveSynthetix = ICurve(0xA5407eAE9Ba41422680e2e00537571bcC53efBfD); ICurve constant internal curvePAX = ICurve(0x06364f10B501e868329afBc005b3492902d6C763); ICurve constant internal curveRenBTC = ICurve(0x93054188d876f558f4a66B2EF1d97d16eDf0895B); ICurve constant internal curveTBTC = ICurve(0x9726e9314eF1b96E45f40056bEd61A088897313E); ICurve constant internal curveSBTC = ICurve(0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714); IShell constant internal shell = IShell(0xA8253a440Be331dC4a7395B73948cCa6F19Dc97D); IAaveLendingPool constant internal aave = IAaveLendingPool(0x398eC7346DcD622eDc5ae82352F02bE94C62d119); ICompound constant internal compound = ICompound(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); ICompoundEther constant internal cETH = ICompoundEther(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5); IMooniswapRegistry constant internal mooniswapRegistry = IMooniswapRegistry(0x7079E8517594e5b21d2B9a0D17cb33F5FE2bca70); IUniswapV2Factory constant internal uniswapV2 = IUniswapV2Factory(0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f); IDForceSwap constant internal dforceSwap = IDForceSwap(0x03eF3f37856bD08eb47E2dE7ABc4Ddd2c19B60F2); IMStable constant internal musd = IMStable(0xe2f2a5C287993345a840Db3B0845fbC70f5935a5); IMassetRedemptionValidator constant internal musd_helper = IMassetRedemptionValidator(0x4c5e03065bC52cCe84F3ac94DF14bbAC27eac89b); IBalancerRegistry constant internal balancerRegistry = IBalancerRegistry(0x65e67cbc342712DF67494ACEfc06fe951EE93982); ICurveCalculator constant internal curveCalculator = ICurveCalculator(0xc1DB00a8E5Ef7bfa476395cdbcc98235477cDE4E); ICurveRegistry constant internal curveRegistry = ICurveRegistry(0x7002B727Ef8F5571Cb5F9D70D13DBEEb4dFAe9d1); int256 internal constant VERY_NEGATIVE_VALUE = -1e72; function _findBestDistribution( uint256 s, // parts int256[][] memory amounts // exchangesReturns ) internal pure returns( int256 returnAmount, uint256[] memory distribution ) { uint256 n = amounts.length; int256[][] memory answer = new int256[][](n); // int[n][s+1] uint256[][] memory parent = new uint256[][](n); // int[n][s+1] for (uint i = 0; i < n; i++) { answer[i] = new int256[](s + 1); parent[i] = new uint256[](s + 1); } for (uint j = 0; j <= s; j++) { answer[0][j] = amounts[0][j]; for (uint i = 1; i < n; i++) { answer[i][j] = -1e72; } parent[0][j] = 0; } for (uint i = 1; i < n; i++) { for (uint j = 0; j <= s; j++) { answer[i][j] = answer[i - 1][j]; parent[i][j] = j; for (uint k = 1; k <= j; k++) { if (answer[i - 1][j - k] + amounts[i][k] > answer[i][j]) { answer[i][j] = answer[i - 1][j - k] + amounts[i][k]; parent[i][j] = j - k; } } } } distribution = new uint256[](DEXES_COUNT); uint256 partsLeft = s; for (uint curExchange = n - 1; partsLeft > 0; curExchange--) { distribution[curExchange] = partsLeft - parent[curExchange][partsLeft]; partsLeft = parent[curExchange][partsLeft]; } returnAmount = (answer[n - 1][s] == VERY_NEGATIVE_VALUE) ? 0 : answer[n - 1][s]; } function _getCompoundToken(IERC20 token) internal pure returns(ICompoundToken) { if (token.isETH()) { // ETH return ICompoundToken(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5); } if (token == IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F)) { // DAI return ICompoundToken(0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643); } if (token == IERC20(0x0D8775F648430679A709E98d2b0Cb6250d2887EF)) { // BAT return ICompoundToken(0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E); } if (token == IERC20(0x1985365e9f78359a9B6AD760e32412f4a445E862)) { // REP return ICompoundToken(0x158079Ee67Fce2f58472A96584A73C7Ab9AC95c1); } if (token == IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)) { // USDC return ICompoundToken(0x39AA39c021dfbaE8faC545936693aC917d5E7563); } if (token == IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599)) { // WBTC return ICompoundToken(0xC11b1268C1A384e55C48c2391d8d480264A3A7F4); } if (token == IERC20(0xE41d2489571d322189246DaFA5ebDe1F4699F498)) { // ZRX return ICompoundToken(0xB3319f5D18Bc0D84dD1b4825Dcde5d5f7266d407); } if (token == IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7)) { // USDT return ICompoundToken(0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9); } return ICompoundToken(0); } function _getAaveToken(IERC20 token) internal pure returns(IAaveToken) { if (token.isETH()) { // ETH return IAaveToken(0x3a3A65aAb0dd2A17E3F1947bA16138cd37d08c04); } if (token == IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F)) { // DAI return IAaveToken(0xfC1E690f61EFd961294b3e1Ce3313fBD8aa4f85d); } if (token == IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)) { // USDC return IAaveToken(0x9bA00D6856a4eDF4665BcA2C2309936572473B7E); } if (token == IERC20(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51)) { // SUSD return IAaveToken(0x625aE63000f46200499120B906716420bd059240); } if (token == IERC20(0x4Fabb145d64652a948d72533023f6E7A623C7C53)) { // BUSD return IAaveToken(0x6Ee0f7BB50a54AB5253dA0667B0Dc2ee526C30a8); } if (token == IERC20(0x0000000000085d4780B73119b644AE5ecd22b376)) { // TUSD return IAaveToken(0x4DA9b813057D04BAef4e5800E36083717b4a0341); } if (token == IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7)) { // USDT return IAaveToken(0x71fc860F7D3A592A4a98740e39dB31d25db65ae8); } if (token == IERC20(0x0D8775F648430679A709E98d2b0Cb6250d2887EF)) { // BAT return IAaveToken(0xE1BA0FB44CCb0D11b80F92f4f8Ed94CA3fF51D00); } if (token == IERC20(0xdd974D5C2e2928deA5F71b9825b8b646686BD200)) { // KNC return IAaveToken(0x9D91BE44C06d373a8a226E1f3b146956083803eB); } if (token == IERC20(0x80fB784B7eD66730e8b1DBd9820aFD29931aab03)) { // LEND return IAaveToken(0x7D2D3688Df45Ce7C552E19c27e007673da9204B8); } if (token == IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA)) { // LINK return IAaveToken(0xA64BD6C70Cb9051F6A9ba1F163Fdc07E0DfB5F84); } if (token == IERC20(0x0F5D2fB29fb7d3CFeE444a200298f468908cC942)) { // MANA return IAaveToken(0x6FCE4A401B6B80ACe52baAefE4421Bd188e76F6f); } if (token == IERC20(0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2)) { // MKR return IAaveToken(0x7deB5e830be29F91E298ba5FF1356BB7f8146998); } if (token == IERC20(0x1985365e9f78359a9B6AD760e32412f4a445E862)) { // REP return IAaveToken(0x71010A9D003445aC60C4e6A7017c1E89A477B438); } if (token == IERC20(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F)) { // SNX return IAaveToken(0x328C4c80BC7aCa0834Db37e6600A6c49E12Da4DE); } if (token == IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599)) { // WBTC return IAaveToken(0xFC4B8ED459e00e5400be803A9BB3954234FD50e3); } if (token == IERC20(0xE41d2489571d322189246DaFA5ebDe1F4699F498)) { // ZRX return IAaveToken(0x6Fb0855c404E09c47C3fBCA25f08d4E41f9F062f); } return IAaveToken(0); } function _scaleDestTokenEthPriceTimesGasPrice( IERC20 fromToken, IERC20 destToken, uint256 destTokenEthPriceTimesGasPrice ) internal view returns(uint256) { if (fromToken == destToken) { return destTokenEthPriceTimesGasPrice; } uint256 mul = _cheapGetPrice(ETH_ADDRESS, destToken, 0.01 ether); uint256 div = _cheapGetPrice(ETH_ADDRESS, fromToken, 0.01 ether); if (div > 0) { return destTokenEthPriceTimesGasPrice.mul(mul).div(div); } return 0; } function _cheapGetPrice( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal view returns(uint256 returnAmount) { (returnAmount,,) = this.getExpectedReturnWithGas( fromToken, destToken, amount, 1, FLAG_DISABLE_SPLIT_RECALCULATION | FLAG_DISABLE_ALL_SPLIT_SOURCES | FLAG_DISABLE_UNISWAP_V2_ALL | FLAG_DISABLE_UNISWAP, 0 ); } function _linearInterpolation( uint256 value, uint256 parts ) internal pure returns(uint256[] memory rets) { rets = new uint256[](parts); for (uint i = 0; i < parts; i++) { rets[i] = value.mul(i + 1).div(parts); } } function _tokensEqual(IERC20 tokenA, IERC20 tokenB) internal pure returns(bool) { return ((tokenA.isETH() && tokenB.isETH()) || tokenA == tokenB); } } contract OneSplitViewWrapBase is IOneSplitView, OneSplitRoot { function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags // See constants in IOneSplit.sol ) public view returns( uint256 returnAmount, uint256[] memory distribution ) { (returnAmount, , distribution) = this.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, 0 ); } function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _getExpectedReturnRespectingGasFloor( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _getExpectedReturnRespectingGasFloor( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, // See constants in IOneSplit.sol uint256 destTokenEthPriceTimesGasPrice ) internal view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ); } contract OneSplitView is IOneSplitView, OneSplitRoot { function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags // See constants in IOneSplit.sol ) public view returns( uint256 returnAmount, uint256[] memory distribution ) { (returnAmount, , distribution) = getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, 0 ); } function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, // See constants in IOneSplit.sol uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { distribution = new uint256[](DEXES_COUNT); if (fromToken == destToken) { return (amount, 0, distribution); } function(IERC20,IERC20,uint256,uint256,uint256) view returns(uint256[] memory, uint256)[DEXES_COUNT] memory reserves = _getAllReserves(flags); int256[][] memory matrix = new int256[][](DEXES_COUNT); uint256[DEXES_COUNT] memory gases; bool atLeastOnePositive = false; for (uint i = 0; i < DEXES_COUNT; i++) { uint256[] memory rets; (rets, gases[i]) = reserves[i](fromToken, destToken, amount, parts, flags); // Prepend zero and sub gas int256 gas = int256(gases[i].mul(destTokenEthPriceTimesGasPrice).div(1e18)); matrix[i] = new int256[](parts + 1); for (uint j = 0; j < parts; j++) { matrix[i][j + 1] = int256(rets[j]) - gas; atLeastOnePositive = atLeastOnePositive || (matrix[i][j + 1] > 0); } } if (!atLeastOnePositive) { for (uint i = 0; i < DEXES_COUNT; i++) { for (uint j = 1; j < parts + 1; j++) { if (matrix[i][j] == 0) { matrix[i][j] = VERY_NEGATIVE_VALUE; } } } } (, distribution) = _findBestDistribution(parts, matrix); (returnAmount, estimateGasAmount) = _getReturnAndGasByDistribution( Args({ fromToken: fromToken, destToken: destToken, amount: amount, parts: parts, flags: flags, destTokenEthPriceTimesGasPrice: destTokenEthPriceTimesGasPrice, distribution: distribution, matrix: matrix, gases: gases, reserves: reserves }) ); return (returnAmount, estimateGasAmount, distribution); } struct Args { IERC20 fromToken; IERC20 destToken; uint256 amount; uint256 parts; uint256 flags; uint256 destTokenEthPriceTimesGasPrice; uint256[] distribution; int256[][] matrix; uint256[DEXES_COUNT] gases; function(IERC20,IERC20,uint256,uint256,uint256) view returns(uint256[] memory, uint256)[DEXES_COUNT] reserves; } function _getReturnAndGasByDistribution( Args memory args ) internal view returns(uint256 returnAmount, uint256 estimateGasAmount) { bool[DEXES_COUNT] memory exact = [ true, // "Uniswap", false, // "Kyber", false, // "Bancor", false, // "Oasis", true, // "Curve Compound", true, // "Curve USDT", true, // "Curve Y", true, // "Curve Binance", true, // "Curve Synthetix", true, // "Uniswap Compound", true, // "Uniswap CHAI", true, // "Uniswap Aave", false, // "Mooniswap", true, // "Uniswap V2", true, // "Uniswap V2 (ETH)", true, // "Uniswap V2 (DAI)", true, // "Uniswap V2 (USDC)", true, // "Curve Pax", true, // "Curve RenBTC", true, // "Curve tBTC", true, // "Dforce XSwap", false, // "Shell", true, // "mStable", true, // "Curve sBTC" true, // "Balancer 1" true, // "Balancer 2" true // "Balancer 3" ]; for (uint i = 0; i < DEXES_COUNT; i++) { if (args.distribution[i] > 0) { if (args.distribution[i] == args.parts || exact[i] || args.flags.check(FLAG_DISABLE_SPLIT_RECALCULATION)) { estimateGasAmount = estimateGasAmount.add(args.gases[i]); int256 value = args.matrix[i][args.distribution[i]]; returnAmount = returnAmount.add(uint256( (value == VERY_NEGATIVE_VALUE ? 0 : value) + int256(args.gases[i].mul(args.destTokenEthPriceTimesGasPrice).div(1e18)) )); } else { (uint256[] memory rets, uint256 gas) = args.reserves[i](args.fromToken, args.destToken, args.amount.mul(args.distribution[i]).div(args.parts), 1, args.flags); estimateGasAmount = estimateGasAmount.add(gas); returnAmount = returnAmount.add(rets[0]); } } } } function _getAllReserves(uint256 flags) internal pure returns(function(IERC20,IERC20,uint256,uint256,uint256) view returns(uint256[] memory, uint256)[DEXES_COUNT] memory) { bool invert = flags.check(FLAG_DISABLE_ALL_SPLIT_SOURCES); return [ invert != flags.check(FLAG_DISABLE_UNISWAP_ALL | FLAG_DISABLE_UNISWAP) ? _calculateNoReturn : calculateUniswap, invert != flags.check(FLAG_DISABLE_KYBER) ? _calculateNoReturn : calculateKyber, invert != flags.check(FLAG_DISABLE_BANCOR) ? _calculateNoReturn : calculateBancor, invert != flags.check(FLAG_DISABLE_OASIS) ? _calculateNoReturn : calculateOasis, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_COMPOUND) ? _calculateNoReturn : calculateCurveCompound, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_USDT) ? _calculateNoReturn : calculateCurveUSDT, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_Y) ? _calculateNoReturn : calculateCurveY, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_BINANCE) ? _calculateNoReturn : calculateCurveBinance, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_SYNTHETIX) ? _calculateNoReturn : calculateCurveSynthetix, invert != flags.check(FLAG_DISABLE_UNISWAP_ALL | FLAG_DISABLE_UNISWAP_COMPOUND) ? _calculateNoReturn : calculateUniswapCompound, invert != flags.check(FLAG_DISABLE_UNISWAP_ALL | FLAG_DISABLE_UNISWAP_CHAI) ? _calculateNoReturn : calculateUniswapChai, invert != flags.check(FLAG_DISABLE_UNISWAP_ALL | FLAG_DISABLE_UNISWAP_AAVE) ? _calculateNoReturn : calculateUniswapAave, invert != flags.check(FLAG_DISABLE_MOONISWAP) ? _calculateNoReturn : calculateMooniswap, invert != flags.check(FLAG_DISABLE_UNISWAP_V2_ALL | FLAG_DISABLE_UNISWAP_V2) ? _calculateNoReturn : calculateUniswapV2, invert != flags.check(FLAG_DISABLE_UNISWAP_V2_ALL | FLAG_DISABLE_UNISWAP_V2_ETH) ? _calculateNoReturn : calculateUniswapV2ETH, invert != flags.check(FLAG_DISABLE_UNISWAP_V2_ALL | FLAG_DISABLE_UNISWAP_V2_DAI) ? _calculateNoReturn : calculateUniswapV2DAI, invert != flags.check(FLAG_DISABLE_UNISWAP_V2_ALL | FLAG_DISABLE_UNISWAP_V2_USDC) ? _calculateNoReturn : calculateUniswapV2USDC, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_PAX) ? _calculateNoReturn : calculateCurvePAX, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_RENBTC) ? _calculateNoReturn : calculateCurveRenBTC, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_TBTC) ? _calculateNoReturn : calculateCurveTBTC, invert != flags.check(FLAG_DISABLE_DFORCE_SWAP) ? _calculateNoReturn : calculateDforceSwap, invert != flags.check(FLAG_DISABLE_SHELL) ? _calculateNoReturn : calculateShell, invert != flags.check(FLAG_DISABLE_MSTABLE_MUSD) ? _calculateNoReturn : calculateMStableMUSD, invert != flags.check(FLAG_DISABLE_CURVE_ALL | FLAG_DISABLE_CURVE_SBTC) ? _calculateNoReturn : calculateCurveSBTC, invert != flags.check(FLAG_DISABLE_BALANCER_ALL | FLAG_DISABLE_BALANCER_1) ? _calculateNoReturn : calculateBalancer1, invert != flags.check(FLAG_DISABLE_BALANCER_ALL | FLAG_DISABLE_BALANCER_2) ? _calculateNoReturn : calculateBalancer2, invert != flags.check(FLAG_DISABLE_BALANCER_ALL | FLAG_DISABLE_BALANCER_3) ? _calculateNoReturn : calculateBalancer3 ]; } function _calculateNoGas( IERC20 /*fromToken*/, IERC20 /*destToken*/, uint256 /*amount*/, uint256 /*parts*/, uint256 /*destTokenEthPriceTimesGasPrice*/, uint256 /*flags*/, uint256 /*destTokenEthPrice*/ ) internal view returns(uint256[] memory /*rets*/, uint256 /*gas*/) { this; } // View Helpers function _calculateBalancer( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/, uint256 poolIndex ) internal view returns(uint256[] memory rets, uint256 gas) { rets = new uint256[](parts); address[] memory pools = balancerRegistry.getBestPoolsWithLimit( address(fromToken.isETH() ? weth : fromToken), address(destToken.isETH() ? weth : destToken), poolIndex + 1 ); if (poolIndex >= pools.length) { return (rets, 0); } (bool success, bytes memory result) = address(balancerRegistry).staticcall( abi.encodeWithSelector( balancerRegistry.getPoolReturns.selector, pools[poolIndex], address(fromToken.isETH() ? weth : fromToken), address(destToken.isETH() ? weth : destToken), _linearInterpolation(amount, parts) ) ); if (!success || result.length == 0) { return (rets, 0); } return ( abi.decode(result, (uint256[])), 100_000 ); } function calculateBalancer1( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { return _calculateBalancer( fromToken, destToken, amount, parts, flags, 0 ); } function calculateBalancer2( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { return _calculateBalancer( fromToken, destToken, amount, parts, flags, 1 ); } function calculateBalancer3( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { return _calculateBalancer( fromToken, destToken, amount, parts, flags, 2 ); } function calculateMStableMUSD( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { rets = new uint256[](parts); if ((fromToken != usdc && fromToken != dai && fromToken != usdt && fromToken != tusd) || (destToken != usdc && destToken != dai && destToken != usdt && destToken != tusd)) { return (rets, 0); } for (uint i = 1; i <= parts; i *= 2) { (bool success, bytes memory data) = address(musd).staticcall(abi.encodeWithSelector( musd.getSwapOutput.selector, fromToken, destToken, amount.mul(parts.div(i)).div(parts) )); if (success && data.length > 0) { (,, uint256 maxRet) = abi.decode(data, (bool,string,uint256)); if (maxRet > 0) { for (uint j = 0; j < parts.div(i); j++) { rets[j] = maxRet.mul(j + 1).div(parts.div(i)); } break; } } } return ( rets, 700_000 ); } function _getCurvePoolInfo( ICurve curve, bool haveUnderlying ) internal view returns( uint256[8] memory balances, uint256[8] memory precisions, uint256[8] memory rates, uint256 amp, uint256 fee ) { uint256[8] memory underlying_balances; uint256[8] memory decimals; uint256[8] memory underlying_decimals; ( balances, underlying_balances, decimals, underlying_decimals, /*address lp_token*/, amp, fee ) = curveRegistry.get_pool_info(address(curve)); for (uint k = 0; k < 8 && balances[k] > 0; k++) { precisions[k] = 10 ** (18 - (haveUnderlying ? underlying_decimals : decimals)[k]); if (haveUnderlying) { rates[k] = underlying_balances[k].mul(1e18).div(balances[k]); } else { rates[k] = 1e18; } } } function _calculateCurveSelector( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, ICurve curve, bool haveUnderlying, IERC20[] memory tokens ) internal view returns(uint256[] memory rets) { rets = new uint256[](parts); int128 i = 0; int128 j = 0; for (uint t = 0; t < tokens.length; t++) { if (fromToken == tokens[t]) { i = int128(t + 1); } if (destToken == tokens[t]) { j = int128(t + 1); } } if (i == 0 || j == 0) { return rets; } bytes memory data = abi.encodePacked( uint256(haveUnderlying ? 1 : 0), uint256(i - 1), uint256(j - 1), _linearInterpolation100(amount, parts) ); ( uint256[8] memory balances, uint256[8] memory precisions, uint256[8] memory rates, uint256 amp, uint256 fee ) = _getCurvePoolInfo(curve, haveUnderlying); bool success; (success, data) = address(curveCalculator).staticcall( abi.encodePacked( abi.encodeWithSelector( curveCalculator.get_dy.selector, tokens.length, balances, amp, fee, rates, precisions ), data ) ); if (!success || data.length == 0) { return rets; } uint256[100] memory dy = abi.decode(data, (uint256[100])); for (uint t = 0; t < parts; t++) { rets[t] = dy[t]; } } function _linearInterpolation100( uint256 value, uint256 parts ) internal pure returns(uint256[100] memory rets) { for (uint i = 0; i < parts; i++) { rets[i] = value.mul(i + 1).div(parts); } } function calculateCurveCompound( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](2); tokens[0] = dai; tokens[1] = usdc; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveCompound, true, tokens ), 720_000); } function calculateCurveUSDT( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](3); tokens[0] = dai; tokens[1] = usdc; tokens[2] = usdt; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveUSDT, true, tokens ), 720_000); } function calculateCurveY( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](4); tokens[0] = dai; tokens[1] = usdc; tokens[2] = usdt; tokens[3] = tusd; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveY, true, tokens ), 1_400_000); } function calculateCurveBinance( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](4); tokens[0] = dai; tokens[1] = usdc; tokens[2] = usdt; tokens[3] = busd; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveBinance, true, tokens ), 1_400_000); } function calculateCurveSynthetix( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](4); tokens[0] = dai; tokens[1] = usdc; tokens[2] = usdt; tokens[3] = susd; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveSynthetix, true, tokens ), 200_000); } function calculateCurvePAX( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](4); tokens[0] = dai; tokens[1] = usdc; tokens[2] = usdt; tokens[3] = pax; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curvePAX, true, tokens ), 1_000_000); } function calculateCurveRenBTC( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](2); tokens[0] = renbtc; tokens[1] = wbtc; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveRenBTC, false, tokens ), 130_000); } function calculateCurveTBTC( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](3); tokens[0] = tbtc; tokens[1] = wbtc; tokens[2] = hbtc; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveTBTC, false, tokens ), 145_000); } function calculateCurveSBTC( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20[] memory tokens = new IERC20[](3); tokens[0] = renbtc; tokens[1] = wbtc; tokens[2] = sbtc; return (_calculateCurveSelector( fromToken, destToken, amount, parts, curveSBTC, false, tokens ), 150_000); } function calculateShell( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { (bool success, bytes memory data) = address(shell).staticcall(abi.encodeWithSelector( shell.viewOriginTrade.selector, fromToken, destToken, amount )); if (!success || data.length == 0) { return (new uint256[](parts), 0); } uint256 maxRet = abi.decode(data, (uint256)); return (_linearInterpolation(maxRet, parts), 300_000); } function calculateDforceSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { (bool success, bytes memory data) = address(dforceSwap).staticcall( abi.encodeWithSelector( dforceSwap.getAmountByInput.selector, fromToken, destToken, amount ) ); if (!success || data.length == 0) { return (new uint256[](parts), 0); } uint256 maxRet = abi.decode(data, (uint256)); uint256 available = destToken.universalBalanceOf(address(dforceSwap)); if (maxRet > available) { return (new uint256[](parts), 0); } return (_linearInterpolation(maxRet, parts), 160_000); } function _calculateUniswapFormula(uint256 fromBalance, uint256 toBalance, uint256 amount) internal pure returns(uint256) { if (amount == 0) { return 0; } return amount.mul(toBalance).mul(997).div( fromBalance.mul(1000).add(amount.mul(997)) ); } function _calculateUniswap( IERC20 fromToken, IERC20 destToken, uint256[] memory amounts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { rets = amounts; if (!fromToken.isETH()) { IUniswapExchange fromExchange = uniswapFactory.getExchange(fromToken); if (fromExchange == IUniswapExchange(0)) { return (new uint256[](rets.length), 0); } uint256 fromTokenBalance = fromToken.universalBalanceOf(address(fromExchange)); uint256 fromEtherBalance = address(fromExchange).balance; for (uint i = 0; i < rets.length; i++) { rets[i] = _calculateUniswapFormula(fromTokenBalance, fromEtherBalance, rets[i]); } } if (!destToken.isETH()) { IUniswapExchange toExchange = uniswapFactory.getExchange(destToken); if (toExchange == IUniswapExchange(0)) { return (new uint256[](rets.length), 0); } uint256 toEtherBalance = address(toExchange).balance; uint256 toTokenBalance = destToken.universalBalanceOf(address(toExchange)); for (uint i = 0; i < rets.length; i++) { rets[i] = _calculateUniswapFormula(toEtherBalance, toTokenBalance, rets[i]); } } return (rets, fromToken.isETH() || destToken.isETH() ? 60_000 : 100_000); } function calculateUniswap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { return _calculateUniswap( fromToken, destToken, _linearInterpolation(amount, parts), flags ); } function _calculateUniswapWrapped( IERC20 fromToken, IERC20 midToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 midTokenPrice, uint256 flags, uint256 gas1, uint256 gas2 ) internal view returns(uint256[] memory rets, uint256 gas) { if (!fromToken.isETH() && destToken.isETH()) { (rets, gas) = _calculateUniswap( midToken, destToken, _linearInterpolation(amount.mul(1e18).div(midTokenPrice), parts), flags ); return (rets, gas + gas1); } else if (fromToken.isETH() && !destToken.isETH()) { (rets, gas) = _calculateUniswap( fromToken, midToken, _linearInterpolation(amount, parts), flags ); for (uint i = 0; i < parts; i++) { rets[i] = rets[i].mul(midTokenPrice).div(1e18); } return (rets, gas + gas2); } return (new uint256[](parts), 0); } function calculateUniswapCompound( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20 midPreToken; if (!fromToken.isETH() && destToken.isETH()) { midPreToken = fromToken; } else if (!destToken.isETH() && fromToken.isETH()) { midPreToken = destToken; } if (!midPreToken.isETH()) { ICompoundToken midToken = _getCompoundToken(midPreToken); if (midToken != ICompoundToken(0)) { return _calculateUniswapWrapped( fromToken, midToken, destToken, amount, parts, midToken.exchangeRateStored(), flags, 200_000, 200_000 ); } } return (new uint256[](parts), 0); } function calculateUniswapChai( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { if (fromToken == dai && destToken.isETH() || fromToken.isETH() && destToken == dai) { return _calculateUniswapWrapped( fromToken, chai, destToken, amount, parts, chai.chaiPrice(), flags, 180_000, 160_000 ); } return (new uint256[](parts), 0); } function calculateUniswapAave( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { IERC20 midPreToken; if (!fromToken.isETH() && destToken.isETH()) { midPreToken = fromToken; } else if (!destToken.isETH() && fromToken.isETH()) { midPreToken = destToken; } if (!midPreToken.isETH()) { IAaveToken midToken = _getAaveToken(midPreToken); if (midToken != IAaveToken(0)) { return _calculateUniswapWrapped( fromToken, midToken, destToken, amount, parts, 1e18, flags, 310_000, 670_000 ); } } return (new uint256[](parts), 0); } function _calculateKyber( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 flags ) internal view returns(uint256 returnAmount, uint256 gas) { (bool success, bytes memory data) = address(kyberNetworkProxy).staticcall.gas(2300)(abi.encodeWithSelector( kyberNetworkProxy.kyberNetworkContract.selector )); if (!success || data.length == 0) { return (0, 0); } IKyberNetworkContract kyberNetworkContract = IKyberNetworkContract(abi.decode(data, (address))); if (fromToken.isETH() || destToken.isETH()) { return _calculateKyberWithEth(kyberNetworkContract, fromToken, destToken, amount, flags); } (uint256 value, uint256 gasFee) = _calculateKyberWithEth(kyberNetworkContract, fromToken, ETH_ADDRESS, amount, flags); if (value == 0) { return (0, 0); } (uint256 value2, uint256 gasFee2) = _calculateKyberWithEth(kyberNetworkContract, ETH_ADDRESS, destToken, value, flags); return (value2, gasFee + gasFee2); } function _calculateKyberWithEth( IKyberNetworkContract kyberNetworkContract, IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 flags ) internal view returns(uint256 returnAmount, uint256 gas) { require(fromToken.isETH() || destToken.isETH(), "2ETH"); (bool success, bytes memory data) = address(kyberNetworkContract).staticcall.gas(1500000)(abi.encodeWithSelector( kyberNetworkContract.searchBestRate.selector, fromToken.isETH() ? ETH_ADDRESS : fromToken, destToken.isETH() ? ETH_ADDRESS : destToken, amount, true )); if (!success) { return (0, 0); } (address reserve, uint256 ret) = abi.decode(data, (address,uint256)); if (ret == 0) { return (0, 0); } if ((reserve == 0x31E085Afd48a1d6e51Cc193153d625e8f0514C7F && !flags.check(FLAG_ENABLE_KYBER_UNISWAP_RESERVE)) || (reserve == 0x1E158c0e93c30d24e918Ef83d1e0bE23595C3c0f && !flags.check(FLAG_ENABLE_KYBER_OASIS_RESERVE)) || (reserve == 0x053AA84FCC676113a57e0EbB0bD1913839874bE4 && !flags.check(FLAG_ENABLE_KYBER_BANCOR_RESERVE))) { return (0, 0); } if (!flags.check(FLAG_ENABLE_KYBER_UNISWAP_RESERVE)) { (success,) = reserve.staticcall.gas(2300)(abi.encodeWithSelector( IKyberUniswapReserve(reserve).uniswapFactory.selector )); if (success) { return (0, 0); } } if (!flags.check(FLAG_ENABLE_KYBER_OASIS_RESERVE)) { (success,) = reserve.staticcall.gas(2300)(abi.encodeWithSelector( IKyberOasisReserve(reserve).otc.selector )); if (success) { return (0, 0); } } if (!flags.check(FLAG_ENABLE_KYBER_BANCOR_RESERVE)) { (success,) = reserve.staticcall.gas(2300)(abi.encodeWithSelector( IKyberBancorReserve(reserve).bancorEth.selector )); if (success) { return (0, 0); } } return ( ret.mul(amount) .mul(10 ** IERC20(destToken).universalDecimals()) .div(10 ** IERC20(fromToken).universalDecimals()) .div(1e18), 700_000 ); } function calculateKyber( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { rets = new uint256[](parts); for (uint i = 0; i < parts; i++) { (rets[i], gas) = _calculateKyber(fromToken, destToken, amount.mul(i + 1).div(parts), flags); if (rets[i] == 0) { break; } } return (rets, gas); } function calculateBancor( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IBancorNetwork bancorNetwork = IBancorNetwork(bancorContractRegistry.addressOf("BancorNetwork")); address[] memory path = bancorFinder.buildBancorPath( fromToken.isETH() ? bancorEtherToken : fromToken, destToken.isETH() ? bancorEtherToken : destToken ); rets = _linearInterpolation(amount, parts); for (uint i = 0; i < parts; i++) { (bool success, bytes memory data) = address(bancorNetwork).staticcall.gas(500000)( abi.encodeWithSelector( bancorNetwork.getReturnByPath.selector, path, rets[i] ) ); if (!success || data.length == 0) { for (; i < parts; i++) { rets[i] = 0; } break; } else { (uint256 ret,) = abi.decode(data, (uint256,uint256)); rets[i] = ret; } } return (rets, path.length.mul(150_000)); } function calculateOasis( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { rets = _linearInterpolation(amount, parts); for (uint i = 0; i < parts; i++) { (bool success, bytes memory data) = address(oasisExchange).staticcall.gas(500000)( abi.encodeWithSelector( oasisExchange.getBuyAmount.selector, destToken.isETH() ? weth : destToken, fromToken.isETH() ? weth : fromToken, rets[i] ) ); if (!success || data.length == 0) { for (; i < parts; i++) { rets[i] = 0; } break; } else { rets[i] = abi.decode(data, (uint256)); } } return (rets, 500_000); } function calculateMooniswap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { IMooniswap mooniswap = mooniswapRegistry.target(); (bool success, bytes memory data) = address(mooniswap).staticcall.gas(1000000)( abi.encodeWithSelector( mooniswap.getReturn.selector, fromToken, destToken, amount ) ); if (!success || data.length == 0) { return (new uint256[](parts), 0); } uint256 maxRet = abi.decode(data, (uint256)); return (_linearInterpolation(maxRet, parts), 1_000_000); } function calculateUniswapV2( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { return _calculateUniswapV2( fromToken, destToken, _linearInterpolation(amount, parts), flags ); } function calculateUniswapV2ETH( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { if (fromToken.isETH() || fromToken == weth || destToken.isETH() || destToken == weth) { return (new uint256[](parts), 0); } return _calculateUniswapV2OverMidToken( fromToken, weth, destToken, amount, parts, flags ); } function calculateUniswapV2DAI( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { if (fromToken == dai || destToken == dai) { return (new uint256[](parts), 0); } return _calculateUniswapV2OverMidToken( fromToken, dai, destToken, amount, parts, flags ); } function calculateUniswapV2USDC( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { if (fromToken == usdc || destToken == usdc) { return (new uint256[](parts), 0); } return _calculateUniswapV2OverMidToken( fromToken, usdc, destToken, amount, parts, flags ); } function _calculateUniswapV2( IERC20 fromToken, IERC20 destToken, uint256[] memory amounts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { rets = new uint256[](amounts.length); IERC20 fromTokenReal = fromToken.isETH() ? weth : fromToken; IERC20 destTokenReal = destToken.isETH() ? weth : destToken; IUniswapV2Exchange exchange = uniswapV2.getPair(fromTokenReal, destTokenReal); if (exchange != IUniswapV2Exchange(0)) { uint256 fromTokenBalance = fromTokenReal.universalBalanceOf(address(exchange)); uint256 destTokenBalance = destTokenReal.universalBalanceOf(address(exchange)); for (uint i = 0; i < amounts.length; i++) { rets[i] = _calculateUniswapFormula(fromTokenBalance, destTokenBalance, amounts[i]); } return (rets, 50_000); } } function _calculateUniswapV2OverMidToken( IERC20 fromToken, IERC20 midToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) internal view returns(uint256[] memory rets, uint256 gas) { rets = _linearInterpolation(amount, parts); uint256 gas1; uint256 gas2; (rets, gas1) = _calculateUniswapV2(fromToken, midToken, rets, flags); (rets, gas2) = _calculateUniswapV2(midToken, destToken, rets, flags); return (rets, gas1 + gas2); } function _calculateNoReturn( IERC20 /*fromToken*/, IERC20 /*destToken*/, uint256 /*amount*/, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets, uint256 gas) { this; return (new uint256[](parts), 0); } } contract OneSplitBaseWrap is IOneSplit, OneSplitRoot { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags // See constants in IOneSplit.sol ) internal { if (fromToken == destToken) { return; } _swapFloor( fromToken, destToken, amount, distribution, flags ); } function _swapFloor( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 /*flags*/ // See constants in IOneSplit.sol ) internal; } contract OneSplit is IOneSplit, OneSplitRoot { IOneSplitView public oneSplitView; constructor(IOneSplitView _oneSplitView) public { oneSplitView = _oneSplitView; } function() external payable { // solium-disable-next-line security/no-tx-origin require(msg.sender != tx.origin); } function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) public view returns( uint256 returnAmount, uint256[] memory distribution ) { (returnAmount, , distribution) = getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, 0 ); } function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return oneSplitView.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 minReturn, uint256[] memory distribution, uint256 /*flags*/ // See constants in IOneSplit.sol ) public payable returns(uint256 returnAmount) { if (fromToken == destToken) { return amount; } function(IERC20,IERC20,uint256) returns(uint256)[DEXES_COUNT] memory reserves = [ _swapOnUniswap, _swapOnKyber, _swapOnBancor, _swapOnOasis, _swapOnCurveCompound, _swapOnCurveUSDT, _swapOnCurveY, _swapOnCurveBinance, _swapOnCurveSynthetix, _swapOnUniswapCompound, _swapOnUniswapChai, _swapOnUniswapAave, _swapOnMooniswap, _swapOnUniswapV2, _swapOnUniswapV2ETH, _swapOnUniswapV2DAI, _swapOnUniswapV2USDC, _swapOnCurvePAX, _swapOnCurveRenBTC, _swapOnCurveTBTC, _swapOnDforceSwap, _swapOnShell, _swapOnMStableMUSD, _swapOnCurveSBTC, _swapOnBalancer1, _swapOnBalancer2, _swapOnBalancer3 ]; require(distribution.length <= reserves.length, "OneSplit: Distribution array should not exceed reserves array size"); uint256 parts = 0; uint256 lastNonZeroIndex = 0; for (uint i = 0; i < distribution.length; i++) { if (distribution[i] > 0) { parts = parts.add(distribution[i]); lastNonZeroIndex = i; } } if (parts == 0) { if (fromToken.isETH()) { msg.sender.transfer(msg.value); return msg.value; } return amount; } fromToken.universalTransferFrom(msg.sender, address(this), amount); uint256 remainingAmount = fromToken.universalBalanceOf(address(this)); for (uint i = 0; i < distribution.length; i++) { if (distribution[i] == 0) { continue; } uint256 swapAmount = amount.mul(distribution[i]).div(parts); if (i == lastNonZeroIndex) { swapAmount = remainingAmount; } remainingAmount -= swapAmount; reserves[i](fromToken, destToken, swapAmount); } returnAmount = destToken.universalBalanceOf(address(this)); require(returnAmount >= minReturn, "OneSplit: Return amount was not enough"); destToken.universalTransfer(msg.sender, returnAmount); fromToken.universalTransfer(msg.sender, fromToken.universalBalanceOf(address(this))); } // Swap helpers function _swapOnCurveCompound( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == dai ? 1 : 0) + (fromToken == usdc ? 2 : 0); int128 j = (destToken == dai ? 1 : 0) + (destToken == usdc ? 2 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveCompound), amount); curveCompound.exchange_underlying(i - 1, j - 1, amount, 0); } function _swapOnCurveUSDT( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == dai ? 1 : 0) + (fromToken == usdc ? 2 : 0) + (fromToken == usdt ? 3 : 0); int128 j = (destToken == dai ? 1 : 0) + (destToken == usdc ? 2 : 0) + (destToken == usdt ? 3 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveUSDT), amount); curveUSDT.exchange_underlying(i - 1, j - 1, amount, 0); } function _swapOnCurveY( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == dai ? 1 : 0) + (fromToken == usdc ? 2 : 0) + (fromToken == usdt ? 3 : 0) + (fromToken == tusd ? 4 : 0); int128 j = (destToken == dai ? 1 : 0) + (destToken == usdc ? 2 : 0) + (destToken == usdt ? 3 : 0) + (destToken == tusd ? 4 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveY), amount); curveY.exchange_underlying(i - 1, j - 1, amount, 0); } function _swapOnCurveBinance( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == dai ? 1 : 0) + (fromToken == usdc ? 2 : 0) + (fromToken == usdt ? 3 : 0) + (fromToken == busd ? 4 : 0); int128 j = (destToken == dai ? 1 : 0) + (destToken == usdc ? 2 : 0) + (destToken == usdt ? 3 : 0) + (destToken == busd ? 4 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveBinance), amount); curveBinance.exchange_underlying(i - 1, j - 1, amount, 0); } function _swapOnCurveSynthetix( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == dai ? 1 : 0) + (fromToken == usdc ? 2 : 0) + (fromToken == usdt ? 3 : 0) + (fromToken == susd ? 4 : 0); int128 j = (destToken == dai ? 1 : 0) + (destToken == usdc ? 2 : 0) + (destToken == usdt ? 3 : 0) + (destToken == susd ? 4 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveSynthetix), amount); curveSynthetix.exchange_underlying(i - 1, j - 1, amount, 0); } function _swapOnCurvePAX( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == dai ? 1 : 0) + (fromToken == usdc ? 2 : 0) + (fromToken == usdt ? 3 : 0) + (fromToken == pax ? 4 : 0); int128 j = (destToken == dai ? 1 : 0) + (destToken == usdc ? 2 : 0) + (destToken == usdt ? 3 : 0) + (destToken == pax ? 4 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curvePAX), amount); curvePAX.exchange_underlying(i - 1, j - 1, amount, 0); } function _swapOnShell( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns (uint256) { fromToken.universalApprove(address(shell), amount); return shell.swapByOrigin( address(fromToken), address(destToken), amount, 0, now + 50 ); } function _swapOnMStableMUSD( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns (uint256) { fromToken.universalApprove(address(musd), amount); return musd.swap( fromToken, destToken, amount, address(this) ); } function _swapOnCurveRenBTC( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == renbtc ? 1 : 0) + (fromToken == wbtc ? 2 : 0); int128 j = (destToken == renbtc ? 1 : 0) + (destToken == wbtc ? 2 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveRenBTC), amount); curveRenBTC.exchange(i - 1, j - 1, amount, 0); } function _swapOnCurveTBTC( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == tbtc ? 1 : 0) + (fromToken == wbtc ? 2 : 0) + (fromToken == hbtc ? 3 : 0); int128 j = (destToken == tbtc ? 1 : 0) + (destToken == wbtc ? 2 : 0) + (destToken == hbtc ? 3 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveTBTC), amount); curveTBTC.exchange(i - 1, j - 1, amount, 0); } function _swapOnCurveSBTC( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { int128 i = (fromToken == renbtc ? 1 : 0) + (fromToken == wbtc ? 2 : 0) + (fromToken == sbtc ? 3 : 0); int128 j = (destToken == renbtc ? 1 : 0) + (destToken == wbtc ? 2 : 0) + (destToken == sbtc ? 3 : 0); if (i == 0 || j == 0) { return 0; } fromToken.universalApprove(address(curveSBTC), amount); curveSBTC.exchange(i - 1, j - 1, amount, 0); } function _swapOnDforceSwap( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { fromToken.universalApprove(address(dforceSwap), amount); dforceSwap.swap(fromToken, destToken, amount); } function _swapOnUniswap( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { uint256 returnAmount = amount; if (!fromToken.isETH()) { IUniswapExchange fromExchange = uniswapFactory.getExchange(fromToken); if (fromExchange != IUniswapExchange(0)) { fromToken.universalApprove(address(fromExchange), returnAmount); returnAmount = fromExchange.tokenToEthSwapInput(returnAmount, 1, now); } } if (!destToken.isETH()) { IUniswapExchange toExchange = uniswapFactory.getExchange(destToken); if (toExchange != IUniswapExchange(0)) { returnAmount = toExchange.ethToTokenSwapInput.value(returnAmount)(1, now); } } return returnAmount; } function _swapOnUniswapCompound( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { if (!fromToken.isETH()) { ICompoundToken fromCompound = _getCompoundToken(fromToken); fromToken.universalApprove(address(fromCompound), amount); fromCompound.mint(amount); return _swapOnUniswap(IERC20(fromCompound), destToken, IERC20(fromCompound).universalBalanceOf(address(this))); } if (!destToken.isETH()) { ICompoundToken toCompound = _getCompoundToken(destToken); uint256 compoundAmount = _swapOnUniswap(fromToken, IERC20(toCompound), amount); toCompound.redeem(compoundAmount); return destToken.universalBalanceOf(address(this)); } return 0; } function _swapOnUniswapChai( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { if (fromToken == dai) { fromToken.universalApprove(address(chai), amount); chai.join(address(this), amount); return _swapOnUniswap(IERC20(chai), destToken, IERC20(chai).universalBalanceOf(address(this))); } if (destToken == dai) { uint256 chaiAmount = _swapOnUniswap(fromToken, IERC20(chai), amount); chai.exit(address(this), chaiAmount); return destToken.universalBalanceOf(address(this)); } return 0; } function _swapOnUniswapAave( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { if (!fromToken.isETH()) { IAaveToken fromAave = _getAaveToken(fromToken); fromToken.universalApprove(aave.core(), amount); aave.deposit(fromToken, amount, 1101); return _swapOnUniswap(IERC20(fromAave), destToken, IERC20(fromAave).universalBalanceOf(address(this))); } if (!destToken.isETH()) { IAaveToken toAave = _getAaveToken(destToken); uint256 aaveAmount = _swapOnUniswap(fromToken, IERC20(toAave), amount); toAave.redeem(aaveAmount); return aaveAmount; } return 0; } function _swapOnMooniswap( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { IMooniswap mooniswap = mooniswapRegistry.target(); fromToken.universalApprove(address(mooniswap), amount); return mooniswap.swap.value(fromToken.isETH() ? amount : 0)( fromToken, destToken, amount, 0 ); } function _swapOnKyber( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { fromToken.universalApprove(address(kyberNetworkProxy), amount); return kyberNetworkProxy.tradeWithHint.value(fromToken.isETH() ? amount : 0)( fromToken.isETH() ? ETH_ADDRESS : fromToken, amount, destToken.isETH() ? ETH_ADDRESS : destToken, address(this), 1 << 255, 0, 0x4D37f28D2db99e8d35A6C725a5f1749A085850a3, "" ); } function _swapOnBancor( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { IBancorNetwork bancorNetwork = IBancorNetwork(bancorContractRegistry.addressOf("BancorNetwork")); address[] memory path = bancorNetworkPathFinder.generatePath( fromToken.isETH() ? bancorEtherToken : fromToken, destToken.isETH() ? bancorEtherToken : destToken ); fromToken.universalApprove(address(bancorNetwork), amount); return bancorNetwork.convert.value(fromToken.isETH() ? amount : 0)(path, amount, 1); } function _swapOnOasis( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { if (fromToken.isETH()) { weth.deposit.value(amount)(); } IERC20 approveToken = fromToken.isETH() ? weth : fromToken; approveToken.universalApprove(address(oasisExchange), amount); uint256 returnAmount = oasisExchange.sellAllAmount( fromToken.isETH() ? weth : fromToken, amount, destToken.isETH() ? weth : destToken, 1 ); if (destToken.isETH()) { weth.withdraw(weth.balanceOf(address(this))); } return returnAmount; } function _swapOnUniswapV2Internal( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256 returnAmount) { if (fromToken.isETH()) { weth.deposit.value(amount)(); } IERC20 fromTokenReal = fromToken.isETH() ? weth : fromToken; IERC20 toTokenReal = destToken.isETH() ? weth : destToken; IUniswapV2Exchange exchange = uniswapV2.getPair(fromTokenReal, toTokenReal); returnAmount = exchange.getReturn(fromTokenReal, toTokenReal, amount); fromTokenReal.universalTransfer(address(exchange), amount); if (uint256(address(fromTokenReal)) < uint256(address(toTokenReal))) { exchange.swap(0, returnAmount, address(this), ""); } else { exchange.swap(returnAmount, 0, address(this), ""); } if (destToken.isETH()) { weth.withdraw(weth.balanceOf(address(this))); } } function _swapOnUniswapV2OverMid( IERC20 fromToken, IERC20 midToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { return _swapOnUniswapV2Internal( midToken, destToken, _swapOnUniswapV2Internal( fromToken, midToken, amount ) ); } function _swapOnUniswapV2( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { return _swapOnUniswapV2Internal( fromToken, destToken, amount ); } function _swapOnUniswapV2ETH( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { return _swapOnUniswapV2OverMid( fromToken, weth, destToken, amount ); } function _swapOnUniswapV2DAI( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { return _swapOnUniswapV2OverMid( fromToken, dai, destToken, amount ); } function _swapOnUniswapV2USDC( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { return _swapOnUniswapV2OverMid( fromToken, usdc, destToken, amount ); } function _swapOnBalancerX( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 poolIndex ) internal returns(uint256) { address[] memory pools = balancerRegistry.getBestPoolsWithLimit( address(fromToken.isETH() ? weth : fromToken), address(destToken.isETH() ? weth : destToken), poolIndex + 1 ); if (fromToken.isETH()) { weth.deposit.value(amount)(); } (fromToken.isETH() ? weth : fromToken).universalApprove(pools[poolIndex], amount); IBalancerPool(pools[poolIndex]).swapExactAmountIn( fromToken.isETH() ? weth : fromToken, amount, destToken.isETH() ? weth : destToken, 0, uint256(-1) ); if (destToken.isETH()) { weth.withdraw(weth.balanceOf(address(this))); } } function _swapOnBalancer1( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { _swapOnBalancerX(fromToken, destToken, amount, 0); } function _swapOnBalancer2( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { _swapOnBalancerX(fromToken, destToken, amount, 1); } function _swapOnBalancer3( IERC20 fromToken, IERC20 destToken, uint256 amount ) internal returns(uint256) { _swapOnBalancerX(fromToken, destToken, amount, 2); } } // File: contracts/OneSplitMultiPath.sol pragma solidity ^0.5.0; contract OneSplitMultiPathBase is IOneSplitConsts, OneSplitRoot { function _getMultiPathToken(uint256 flags) internal pure returns(IERC20 midToken) { uint256[8] memory allFlags = [ FLAG_ENABLE_MULTI_PATH_ETH, FLAG_ENABLE_MULTI_PATH_DAI, FLAG_ENABLE_MULTI_PATH_USDC, FLAG_ENABLE_MULTI_PATH_USDT, FLAG_ENABLE_MULTI_PATH_WBTC, FLAG_ENABLE_MULTI_PATH_TBTC, FLAG_ENABLE_MULTI_PATH_RENBTC, FLAG_ENABLE_MULTI_PATH_COMP ]; IERC20[8] memory allMidTokens = [ ETH_ADDRESS, dai, usdc, usdt, wbtc, tbtc, renbtc, comp ]; for (uint i = 0; i < allFlags.length; i++) { if (flags.check(allFlags[i])) { require(midToken == IERC20(0), "OneSplit: Do not use multipath with each other"); midToken = allMidTokens[i]; } } } } contract OneSplitMultiPathView is OneSplitViewWrapBase, OneSplitMultiPathBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns ( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } IERC20 midToken = _getMultiPathToken(flags); if (midToken != IERC20(0)) { if (_tokensEqual(fromToken, midToken) || _tokensEqual(midToken, destToken)) { return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } // Stack too deep uint256 _flags = flags; IERC20 _destToken = destToken; uint256 _destTokenEthPriceTimesGasPrice = destTokenEthPriceTimesGasPrice; (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, midToken, amount, parts, _flags, _scaleDestTokenEthPriceTimesGasPrice( _destToken, midToken, _destTokenEthPriceTimesGasPrice ) ); uint256[] memory dist; uint256 estimateGasAmount2; (returnAmount, estimateGasAmount2, dist) = super.getExpectedReturnWithGas( midToken, destToken, returnAmount, parts, _flags, // Double tap into the same source is not an issue since price wouldn't be worse destTokenEthPriceTimesGasPrice ); for (uint i = 0; i < distribution.length; i++) { distribution[i] = distribution[i].add(dist[i] << 8); } return (returnAmount, estimateGasAmount + estimateGasAmount2, distribution); } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitMultiPath is OneSplitBaseWrap, OneSplitMultiPathBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { IERC20 midToken = _getMultiPathToken(flags); if (midToken != IERC20(0) && !_tokensEqual(fromToken, midToken) && !_tokensEqual(midToken, destToken)) { uint256[] memory dist = new uint256[](distribution.length); for (uint i = 0; i < distribution.length; i++) { dist[i] = distribution[i] & 0xFF; } super._swap( fromToken, midToken, amount, dist, flags ); for (uint i = 0; i < distribution.length; i++) { dist[i] = (distribution[i] >> 8) & 0xFF; } super._swap( midToken, destToken, midToken.universalBalanceOf(address(this)), dist, flags ); return; } super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/OneSplitCompound.sol pragma solidity ^0.5.0; contract OneSplitCompoundBase { function _getCompoundUnderlyingToken(IERC20 token) internal pure returns(IERC20) { if (token == IERC20(0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5)) { // ETH return IERC20(0); } if (token == IERC20(0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643)) { // DAI return IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F); } if (token == IERC20(0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E)) { // BAT return IERC20(0x0D8775F648430679A709E98d2b0Cb6250d2887EF); } if (token == IERC20(0x158079Ee67Fce2f58472A96584A73C7Ab9AC95c1)) { // REP return IERC20(0x1985365e9f78359a9B6AD760e32412f4a445E862); } if (token == IERC20(0x39AA39c021dfbaE8faC545936693aC917d5E7563)) { // USDC return IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); } if (token == IERC20(0xC11b1268C1A384e55C48c2391d8d480264A3A7F4)) { // WBTC return IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); } if (token == IERC20(0xB3319f5D18Bc0D84dD1b4825Dcde5d5f7266d407)) { // ZRX return IERC20(0xE41d2489571d322189246DaFA5ebDe1F4699F498); } if (token == IERC20(0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9)) { // USDT return IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7); } return IERC20(-1); } } contract OneSplitCompoundView is OneSplitViewWrapBase, OneSplitCompoundBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _compoundGetExpectedReturn( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _compoundGetExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) private view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_COMPOUND)) { IERC20 underlying = _getCompoundUnderlyingToken(fromToken); if (underlying != IERC20(-1)) { uint256 compoundRate = ICompoundToken(address(fromToken)).exchangeRateStored(); (returnAmount, estimateGasAmount, distribution) = _compoundGetExpectedReturn( underlying, destToken, amount.mul(compoundRate).div(1e18), parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 295_000, distribution); } underlying = _getCompoundUnderlyingToken(destToken); if (underlying != IERC20(-1)) { uint256 _destTokenEthPriceTimesGasPrice = destTokenEthPriceTimesGasPrice; uint256 compoundRate = ICompoundToken(address(destToken)).exchangeRateStored(); (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, underlying, amount, parts, flags, _destTokenEthPriceTimesGasPrice.mul(compoundRate).div(1e18) ); return (returnAmount.mul(1e18).div(compoundRate), estimateGasAmount + 430_000, distribution); } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitCompound is OneSplitBaseWrap, OneSplitCompoundBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { _compoundSwap( fromToken, destToken, amount, distribution, flags ); } function _compoundSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) private { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_COMPOUND)) { IERC20 underlying = _getCompoundUnderlyingToken(fromToken); if (underlying != IERC20(-1)) { ICompoundToken(address(fromToken)).redeem(amount); uint256 underlyingAmount = underlying.universalBalanceOf(address(this)); return _compoundSwap( underlying, destToken, underlyingAmount, distribution, flags ); } underlying = _getCompoundUnderlyingToken(destToken); if (underlying != IERC20(-1)) { super._swap( fromToken, underlying, amount, distribution, flags ); uint256 underlyingAmount = underlying.universalBalanceOf(address(this)); if (underlying.isETH()) { cETH.mint.value(underlyingAmount)(); } else { underlying.universalApprove(address(destToken), underlyingAmount); ICompoundToken(address(destToken)).mint(underlyingAmount); } return; } } return super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/interface/IFulcrum.sol pragma solidity ^0.5.0; contract IFulcrumToken is IERC20 { function tokenPrice() external view returns (uint256); function loanTokenAddress() external view returns (address); function mintWithEther(address receiver) external payable returns (uint256 mintAmount); function mint(address receiver, uint256 depositAmount) external returns (uint256 mintAmount); function burnToEther(address receiver, uint256 burnAmount) external returns (uint256 loanAmountPaid); function burn(address receiver, uint256 burnAmount) external returns (uint256 loanAmountPaid); } // File: contracts/OneSplitFulcrum.sol pragma solidity ^0.5.0; contract OneSplitFulcrumBase { using UniversalERC20 for IERC20; function _isFulcrumToken(IERC20 token) internal view returns(IERC20) { if (token.isETH()) { return IERC20(-1); } (bool success, bytes memory data) = address(token).staticcall.gas(5000)(abi.encodeWithSignature( "name()" )); if (!success) { return IERC20(-1); } bool foundBZX = false; for (uint i = 0; i + 6 < data.length; i++) { if (data[i + 0] == "F" && data[i + 1] == "u" && data[i + 2] == "l" && data[i + 3] == "c" && data[i + 4] == "r" && data[i + 5] == "u" && data[i + 6] == "m") { foundBZX = true; break; } } if (!foundBZX) { return IERC20(-1); } (success, data) = address(token).staticcall.gas(5000)(abi.encodeWithSelector( IFulcrumToken(address(token)).loanTokenAddress.selector )); if (!success) { return IERC20(-1); } return abi.decode(data, (IERC20)); } } contract OneSplitFulcrumView is OneSplitViewWrapBase, OneSplitFulcrumBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _fulcrumGetExpectedReturn( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _fulcrumGetExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) private view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_FULCRUM)) { IERC20 underlying = _isFulcrumToken(fromToken); if (underlying != IERC20(-1)) { uint256 fulcrumRate = IFulcrumToken(address(fromToken)).tokenPrice(); (returnAmount, estimateGasAmount, distribution) = _fulcrumGetExpectedReturn( underlying, destToken, amount.mul(fulcrumRate).div(1e18), parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 381_000, distribution); } underlying = _isFulcrumToken(destToken); if (underlying != IERC20(-1)) { uint256 _destTokenEthPriceTimesGasPrice = destTokenEthPriceTimesGasPrice; uint256 fulcrumRate = IFulcrumToken(address(destToken)).tokenPrice(); (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, underlying, amount, parts, flags, _destTokenEthPriceTimesGasPrice.mul(fulcrumRate).div(1e18) ); return (returnAmount.mul(1e18).div(fulcrumRate), estimateGasAmount + 354_000, distribution); } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitFulcrum is OneSplitBaseWrap, OneSplitFulcrumBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { _fulcrumSwap( fromToken, destToken, amount, distribution, flags ); } function _fulcrumSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) private { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_FULCRUM)) { IERC20 underlying = _isFulcrumToken(fromToken); if (underlying != IERC20(-1)) { if (underlying.isETH()) { IFulcrumToken(address(fromToken)).burnToEther(address(this), amount); } else { IFulcrumToken(address(fromToken)).burn(address(this), amount); } uint256 underlyingAmount = underlying.universalBalanceOf(address(this)); return super._swap( underlying, destToken, underlyingAmount, distribution, flags ); } underlying = _isFulcrumToken(destToken); if (underlying != IERC20(-1)) { super._swap( fromToken, underlying, amount, distribution, flags ); uint256 underlyingAmount = underlying.universalBalanceOf(address(this)); if (underlying.isETH()) { IFulcrumToken(address(destToken)).mintWithEther.value(underlyingAmount)(address(this)); } else { underlying.universalApprove(address(destToken), underlyingAmount); IFulcrumToken(address(destToken)).mint(address(this), underlyingAmount); } return; } } return super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/OneSplitChai.sol pragma solidity ^0.5.0; contract OneSplitChaiView is OneSplitViewWrapBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_CHAI)) { if (fromToken == IERC20(chai)) { (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( dai, destToken, chai.chaiToDai(amount), parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 197_000, distribution); } if (destToken == IERC20(chai)) { uint256 price = chai.chaiPrice(); (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, dai, amount, parts, flags, destTokenEthPriceTimesGasPrice.mul(1e18).div(price) ); return (returnAmount.mul(price).div(1e18), estimateGasAmount + 168_000, distribution); } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitChai is OneSplitBaseWrap { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_CHAI)) { if (fromToken == IERC20(chai)) { chai.exit(address(this), amount); return super._swap( dai, destToken, dai.balanceOf(address(this)), distribution, flags ); } if (destToken == IERC20(chai)) { super._swap( fromToken, dai, amount, distribution, flags ); uint256 daiBalance = dai.balanceOf(address(this)); dai.universalApprove(address(chai), daiBalance); chai.join(address(this), daiBalance); return; } } return super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/interface/IBdai.sol pragma solidity ^0.5.0; contract IBdai is IERC20 { function join(uint256) external; function exit(uint256) external; } // File: contracts/OneSplitBdai.sol pragma solidity ^0.5.0; contract OneSplitBdaiBase { IBdai internal constant bdai = IBdai(0x6a4FFAafa8DD400676Df8076AD6c724867b0e2e8); IERC20 internal constant btu = IERC20(0xb683D83a532e2Cb7DFa5275eED3698436371cc9f); } contract OneSplitBdaiView is OneSplitViewWrapBase, OneSplitBdaiBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_BDAI)) { if (fromToken == IERC20(bdai)) { (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( dai, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 227_000, distribution); } if (destToken == IERC20(bdai)) { (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, dai, amount, parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 295_000, distribution); } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitBdai is OneSplitBaseWrap, OneSplitBdaiBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_BDAI)) { if (fromToken == IERC20(bdai)) { bdai.exit(amount); uint256 btuBalance = btu.balanceOf(address(this)); if (btuBalance > 0) { (,uint256[] memory btuDistribution) = getExpectedReturn( btu, destToken, btuBalance, 1, flags ); _swap( btu, destToken, btuBalance, btuDistribution, flags ); } return super._swap( dai, destToken, amount, distribution, flags ); } if (destToken == IERC20(bdai)) { super._swap(fromToken, dai, amount, distribution, flags); uint256 daiBalance = dai.balanceOf(address(this)); dai.universalApprove(address(bdai), daiBalance); bdai.join(daiBalance); return; } } return super._swap(fromToken, destToken, amount, distribution, flags); } } // File: contracts/interface/IIearn.sol pragma solidity ^0.5.0; contract IIearn is IERC20 { function token() external view returns(IERC20); function calcPoolValueInToken() external view returns(uint256); function deposit(uint256 _amount) external; function withdraw(uint256 _shares) external; } // File: contracts/OneSplitIearn.sol pragma solidity ^0.5.0; contract OneSplitIearnBase { function _yTokens() internal pure returns(IIearn[13] memory) { return [ IIearn(0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01), IIearn(0x04Aa51bbcB46541455cCF1B8bef2ebc5d3787EC9), IIearn(0x73a052500105205d34Daf004eAb301916DA8190f), IIearn(0x83f798e925BcD4017Eb265844FDDAbb448f1707D), IIearn(0xd6aD7a6750A7593E092a9B218d66C0A814a3436e), IIearn(0xF61718057901F84C4eEC4339EF8f0D86D2B45600), IIearn(0x04bC0Ab673d88aE9dbC9DA2380cB6B79C4BCa9aE), IIearn(0xC2cB1040220768554cf699b0d863A3cd4324ce32), IIearn(0xE6354ed5bC4b393a5Aad09f21c46E101e692d447), IIearn(0x26EA744E5B887E5205727f55dFBE8685e3b21951), IIearn(0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc), IIearn(0x9777d7E2b60bB01759D0E2f8be2095df444cb07E), IIearn(0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59) ]; } } contract OneSplitIearnView is OneSplitViewWrapBase, OneSplitIearnBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _iearnGetExpectedReturn( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _iearnGetExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) private view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (!flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == !flags.check(FLAG_DISABLE_IEARN)) { IIearn[13] memory yTokens = _yTokens(); for (uint i = 0; i < yTokens.length; i++) { if (fromToken == IERC20(yTokens[i])) { (returnAmount, estimateGasAmount, distribution) = _iearnGetExpectedReturn( yTokens[i].token(), destToken, amount .mul(yTokens[i].calcPoolValueInToken()) .div(yTokens[i].totalSupply()), parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 260_000, distribution); } } for (uint i = 0; i < yTokens.length; i++) { if (destToken == IERC20(yTokens[i])) { uint256 _destTokenEthPriceTimesGasPrice = destTokenEthPriceTimesGasPrice; IERC20 token = yTokens[i].token(); (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, token, amount, parts, flags, _destTokenEthPriceTimesGasPrice .mul(yTokens[i].calcPoolValueInToken()) .div(yTokens[i].totalSupply()) ); return( returnAmount .mul(yTokens[i].totalSupply()) .div(yTokens[i].calcPoolValueInToken()), estimateGasAmount + 743_000, distribution ); } } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitIearn is OneSplitBaseWrap, OneSplitIearnBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { _iearnSwap( fromToken, destToken, amount, distribution, flags ); } function _iearnSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) private { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_IEARN)) { IIearn[13] memory yTokens = _yTokens(); for (uint i = 0; i < yTokens.length; i++) { if (fromToken == IERC20(yTokens[i])) { IERC20 underlying = yTokens[i].token(); yTokens[i].withdraw(amount); _iearnSwap(underlying, destToken, underlying.balanceOf(address(this)), distribution, flags); return; } } for (uint i = 0; i < yTokens.length; i++) { if (destToken == IERC20(yTokens[i])) { IERC20 underlying = yTokens[i].token(); super._swap(fromToken, underlying, amount, distribution, flags); uint256 underlyingBalance = underlying.balanceOf(address(this)); underlying.universalApprove(address(yTokens[i]), underlyingBalance); yTokens[i].deposit(underlyingBalance); return; } } } return super._swap(fromToken, destToken, amount, distribution, flags); } } // File: contracts/interface/IIdle.sol pragma solidity ^0.5.0; contract IIdle is IERC20 { function token() external view returns (IERC20); function tokenPrice() external view returns (uint256); function mintIdleToken(uint256 _amount, uint256[] calldata _clientProtocolAmounts) external returns (uint256 mintedTokens); function redeemIdleToken(uint256 _amount, bool _skipRebalance, uint256[] calldata _clientProtocolAmounts) external returns (uint256 redeemedTokens); } // File: contracts/OneSplitIdle.sol pragma solidity ^0.5.0; contract OneSplitIdleBase { function _idleTokens() internal pure returns(IIdle[8] memory) { // https://developers.idle.finance/contracts-and-codebase return [ // V3 IIdle(0x78751B12Da02728F467A44eAc40F5cbc16Bd7934), IIdle(0x12B98C621E8754Ae70d0fDbBC73D6208bC3e3cA6), IIdle(0x63D27B3DA94A9E871222CB0A32232674B02D2f2D), IIdle(0x1846bdfDB6A0f5c473dEc610144513bd071999fB), IIdle(0xcDdB1Bceb7a1979C6caa0229820707429dd3Ec6C), IIdle(0x42740698959761BAF1B06baa51EfBD88CB1D862B), // V2 IIdle(0x10eC0D497824e342bCB0EDcE00959142aAa766dD), IIdle(0xeB66ACc3d011056B00ea521F8203580C2E5d3991) ]; } } contract OneSplitIdleView is OneSplitViewWrapBase, OneSplitIdleBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _idleGetExpectedReturn( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _idleGetExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) internal view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (!flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == !flags.check(FLAG_DISABLE_IDLE)) { IIdle[8] memory tokens = _idleTokens(); for (uint i = 0; i < tokens.length; i++) { if (fromToken == IERC20(tokens[i])) { (returnAmount, estimateGasAmount, distribution) = _idleGetExpectedReturn( tokens[i].token(), destToken, amount.mul(tokens[i].tokenPrice()).div(1e18), parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 2_400_000, distribution); } } for (uint i = 0; i < tokens.length; i++) { if (destToken == IERC20(tokens[i])) { uint256 _destTokenEthPriceTimesGasPrice = destTokenEthPriceTimesGasPrice; uint256 _price = tokens[i].tokenPrice(); IERC20 token = tokens[i].token(); (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, token, amount, parts, flags, _destTokenEthPriceTimesGasPrice.mul(_price).div(1e18) ); return (returnAmount.mul(1e18).div(_price), estimateGasAmount + 1_300_000, distribution); } } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitIdle is OneSplitBaseWrap, OneSplitIdleBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { _idleSwap( fromToken, destToken, amount, distribution, flags ); } function _idleSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { if (!flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == !flags.check(FLAG_DISABLE_IDLE)) { IIdle[8] memory tokens = _idleTokens(); for (uint i = 0; i < tokens.length; i++) { if (fromToken == IERC20(tokens[i])) { IERC20 underlying = tokens[i].token(); uint256 minted = tokens[i].redeemIdleToken(amount, true, new uint256[](0)); _idleSwap(underlying, destToken, minted, distribution, flags); return; } } for (uint i = 0; i < tokens.length; i++) { if (destToken == IERC20(tokens[i])) { IERC20 underlying = tokens[i].token(); super._swap(fromToken, underlying, amount, distribution, flags); uint256 underlyingBalance = underlying.balanceOf(address(this)); underlying.universalApprove(address(tokens[i]), underlyingBalance); tokens[i].mintIdleToken(underlyingBalance, new uint256[](0)); return; } } } return super._swap(fromToken, destToken, amount, distribution, flags); } } // File: contracts/OneSplitAave.sol pragma solidity ^0.5.0; contract OneSplitAaveBase { function _getAaveUnderlyingToken(IERC20 token) internal pure returns(IERC20) { if (token == IERC20(0x3a3A65aAb0dd2A17E3F1947bA16138cd37d08c04)) { // ETH return IERC20(0); } if (token == IERC20(0xfC1E690f61EFd961294b3e1Ce3313fBD8aa4f85d)) { // DAI return IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F); } if (token == IERC20(0x9bA00D6856a4eDF4665BcA2C2309936572473B7E)) { // USDC return IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48); } if (token == IERC20(0x625aE63000f46200499120B906716420bd059240)) { // SUSD return IERC20(0x57Ab1ec28D129707052df4dF418D58a2D46d5f51); } if (token == IERC20(0x6Ee0f7BB50a54AB5253dA0667B0Dc2ee526C30a8)) { // BUSD return IERC20(0x4Fabb145d64652a948d72533023f6E7A623C7C53); } if (token == IERC20(0x4DA9b813057D04BAef4e5800E36083717b4a0341)) { // TUSD return IERC20(0x0000000000085d4780B73119b644AE5ecd22b376); } if (token == IERC20(0x71fc860F7D3A592A4a98740e39dB31d25db65ae8)) { // USDT return IERC20(0xdAC17F958D2ee523a2206206994597C13D831ec7); } if (token == IERC20(0xE1BA0FB44CCb0D11b80F92f4f8Ed94CA3fF51D00)) { // BAT return IERC20(0x0D8775F648430679A709E98d2b0Cb6250d2887EF); } if (token == IERC20(0x9D91BE44C06d373a8a226E1f3b146956083803eB)) { // KNC return IERC20(0xdd974D5C2e2928deA5F71b9825b8b646686BD200); } if (token == IERC20(0x7D2D3688Df45Ce7C552E19c27e007673da9204B8)) { // LEND return IERC20(0x80fB784B7eD66730e8b1DBd9820aFD29931aab03); } if (token == IERC20(0xA64BD6C70Cb9051F6A9ba1F163Fdc07E0DfB5F84)) { // LINK return IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA); } if (token == IERC20(0x6FCE4A401B6B80ACe52baAefE4421Bd188e76F6f)) { // MANA return IERC20(0x0F5D2fB29fb7d3CFeE444a200298f468908cC942); } if (token == IERC20(0x7deB5e830be29F91E298ba5FF1356BB7f8146998)) { // MKR return IERC20(0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2); } if (token == IERC20(0x71010A9D003445aC60C4e6A7017c1E89A477B438)) { // REP return IERC20(0x1985365e9f78359a9B6AD760e32412f4a445E862); } if (token == IERC20(0x328C4c80BC7aCa0834Db37e6600A6c49E12Da4DE)) { // SNX return IERC20(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F); } if (token == IERC20(0xFC4B8ED459e00e5400be803A9BB3954234FD50e3)) { // WBTC return IERC20(0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599); } if (token == IERC20(0x6Fb0855c404E09c47C3fBCA25f08d4E41f9F062f)) { // ZRX return IERC20(0xE41d2489571d322189246DaFA5ebDe1F4699F498); } return IERC20(-1); } } contract OneSplitAaveView is OneSplitViewWrapBase, OneSplitAaveBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, // See constants in IOneSplit.sol uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _aaveGetExpectedReturn( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _aaveGetExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) private view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_AAVE)) { IERC20 underlying = _getAaveUnderlyingToken(fromToken); if (underlying != IERC20(-1)) { (returnAmount, estimateGasAmount, distribution) = _aaveGetExpectedReturn( underlying, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 670_000, distribution); } underlying = _getAaveUnderlyingToken(destToken); if (underlying != IERC20(-1)) { (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, underlying, amount, parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 310_000, distribution); } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitAave is OneSplitBaseWrap, OneSplitAaveBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { _aaveSwap( fromToken, destToken, amount, distribution, flags ); } function _aaveSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) private { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_AAVE)) { IERC20 underlying = _getAaveUnderlyingToken(fromToken); if (underlying != IERC20(-1)) { IAaveToken(address(fromToken)).redeem(amount); return _aaveSwap( underlying, destToken, amount, distribution, flags ); } underlying = _getAaveUnderlyingToken(destToken); if (underlying != IERC20(-1)) { super._swap( fromToken, underlying, amount, distribution, flags ); uint256 underlyingAmount = underlying.universalBalanceOf(address(this)); underlying.universalApprove(aave.core(), underlyingAmount); aave.deposit.value(underlying.isETH() ? underlyingAmount : 0)( underlying.isETH() ? ETH_ADDRESS : underlying, underlyingAmount, 1101 ); return; } } return super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/OneSplitWeth.sol pragma solidity ^0.5.0; contract OneSplitWethView is OneSplitViewWrapBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _wethGetExpectedReturn( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _wethGetExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) private view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_WETH)) { if (fromToken == weth || fromToken == bancorEtherToken) { return super.getExpectedReturnWithGas(ETH_ADDRESS, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice); } if (destToken == weth || destToken == bancorEtherToken) { return super.getExpectedReturnWithGas(fromToken, ETH_ADDRESS, amount, parts, flags, destTokenEthPriceTimesGasPrice); } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitWeth is OneSplitBaseWrap { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { _wethSwap( fromToken, destToken, amount, distribution, flags ); } function _wethSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) private { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_WETH)) { if (fromToken == weth) { weth.withdraw(weth.balanceOf(address(this))); super._swap( ETH_ADDRESS, destToken, amount, distribution, flags ); return; } if (fromToken == bancorEtherToken) { bancorEtherToken.withdraw(bancorEtherToken.balanceOf(address(this))); super._swap( ETH_ADDRESS, destToken, amount, distribution, flags ); return; } if (destToken == weth) { _wethSwap( fromToken, ETH_ADDRESS, amount, distribution, flags ); weth.deposit.value(address(this).balance)(); return; } if (destToken == bancorEtherToken) { _wethSwap( fromToken, ETH_ADDRESS, amount, distribution, flags ); bancorEtherToken.deposit.value(address(this).balance)(); return; } } return super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/OneSplitMStable.sol pragma solidity ^0.5.0; contract OneSplitMStableView is OneSplitViewWrapBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_MSTABLE_MUSD)) { if (fromToken == IERC20(musd)) { if (destToken == usdc || destToken == dai || destToken == usdt || destToken == tusd) { (,, returnAmount) = musd_helper.getRedeemValidity(fromToken, amount, destToken); return (returnAmount, 300_000, new uint256[](DEXES_COUNT)); } else { (,, returnAmount) = musd_helper.getRedeemValidity(fromToken, amount, dai); (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( dai, destToken, returnAmount, parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 300_000, distribution); } } if (destToken == IERC20(musd)) { if (fromToken == usdc || fromToken == dai || fromToken == usdt || fromToken == tusd) { (,, returnAmount) = musd.getSwapOutput(fromToken, destToken, amount); return (returnAmount, 300_000, new uint256[](DEXES_COUNT)); } else { IERC20 _destToken = destToken; (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, dai, amount, parts, flags, _scaleDestTokenEthPriceTimesGasPrice( _destToken, dai, destTokenEthPriceTimesGasPrice ) ); (,, returnAmount) = musd_helper.getRedeemValidity(dai, returnAmount, destToken); return (returnAmount, estimateGasAmount + 300_000, distribution); } } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitMStable is OneSplitBaseWrap { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_MSTABLE_MUSD)) { if (fromToken == IERC20(musd)) { if (destToken == usdc || destToken == dai || destToken == usdt || destToken == tusd) { (,, uint256 result) = musd_helper.getRedeemValidity(fromToken, amount, destToken); musd.redeem( destToken, result ); } else { (,, uint256 result) = musd_helper.getRedeemValidity(fromToken, amount, dai); musd.redeem( dai, result ); super._swap( dai, destToken, dai.balanceOf(address(this)), distribution, flags ); } return; } if (destToken == IERC20(musd)) { if (fromToken == usdc || fromToken == dai || fromToken == usdt || fromToken == tusd) { fromToken.universalApprove(address(musd), amount); musd.swap( fromToken, destToken, amount, address(this) ); } else { super._swap( fromToken, dai, amount, distribution, flags ); musd.swap( dai, destToken, dai.balanceOf(address(this)), address(this) ); } return; } } return super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/interface/IDMM.sol pragma solidity ^0.5.0; interface IDMMController { function getUnderlyingTokenForDmm(IERC20 token) external view returns(IERC20); } contract IDMM is IERC20 { function getCurrentExchangeRate() public view returns(uint256); function mint(uint256 underlyingAmount) public returns(uint256); function redeem(uint256 amount) public returns(uint256); } // File: contracts/OneSplitDMM.sol pragma solidity ^0.5.0; contract OneSplitDMMBase { IDMMController internal constant _dmmController = IDMMController(0x4CB120Dd1D33C9A3De8Bc15620C7Cd43418d77E2); function _getDMMUnderlyingToken(IERC20 token) internal view returns(IERC20) { (bool success, bytes memory data) = address(_dmmController).staticcall( abi.encodeWithSelector( _dmmController.getUnderlyingTokenForDmm.selector, token ) ); if (!success || data.length == 0) { return IERC20(-1); } return abi.decode(data, (IERC20)); } function _getDMMExchangeRate(IDMM dmm) internal view returns(uint256) { (bool success, bytes memory data) = address(dmm).staticcall( abi.encodeWithSelector( dmm.getCurrentExchangeRate.selector ) ); if (!success || data.length == 0) { return 0; } return abi.decode(data, (uint256)); } } contract OneSplitDMMView is OneSplitViewWrapBase, OneSplitDMMBase { function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return _dmmGetExpectedReturn( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _dmmGetExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) private view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_DMM)) { IERC20 underlying = _getDMMUnderlyingToken(fromToken); if (underlying != IERC20(-1)) { if (underlying == weth) { underlying = ETH_ADDRESS; } IERC20 _fromToken = fromToken; (returnAmount, estimateGasAmount, distribution) = _dmmGetExpectedReturn( underlying, destToken, amount.mul(_getDMMExchangeRate(IDMM(address(_fromToken)))).div(1e18), parts, flags, destTokenEthPriceTimesGasPrice ); return (returnAmount, estimateGasAmount + 295_000, distribution); } underlying = _getDMMUnderlyingToken(destToken); if (underlying != IERC20(-1)) { if (underlying == weth) { underlying = ETH_ADDRESS; } uint256 price = _getDMMExchangeRate(IDMM(address(destToken))); (returnAmount, estimateGasAmount, distribution) = super.getExpectedReturnWithGas( fromToken, underlying, amount, parts, flags, destTokenEthPriceTimesGasPrice.mul(price).div(1e18) ); return ( returnAmount.mul(1e18).div(price), estimateGasAmount + 430_000, distribution ); } } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitDMM is OneSplitBaseWrap, OneSplitDMMBase { function _swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { _dmmSwap( fromToken, destToken, amount, distribution, flags ); } function _dmmSwap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) private { if (fromToken == destToken) { return; } if (flags.check(FLAG_DISABLE_ALL_WRAP_SOURCES) == flags.check(FLAG_DISABLE_DMM)) { IERC20 underlying = _getDMMUnderlyingToken(fromToken); if (underlying != IERC20(-1)) { IDMM(address(fromToken)).redeem(amount); uint256 balance = underlying.universalBalanceOf(address(this)); if (underlying == weth) { weth.withdraw(balance); } _dmmSwap( (underlying == weth) ? ETH_ADDRESS : underlying, destToken, balance, distribution, flags ); } underlying = _getDMMUnderlyingToken(destToken); if (underlying != IERC20(-1)) { super._swap( fromToken, (underlying == weth) ? ETH_ADDRESS : underlying, amount, distribution, flags ); uint256 underlyingAmount = ((underlying == weth) ? ETH_ADDRESS : underlying).universalBalanceOf(address(this)); if (underlying == weth) { weth.deposit.value(underlyingAmount); } underlying.universalApprove(address(destToken), underlyingAmount); IDMM(address(destToken)).mint(underlyingAmount); return; } } return super._swap( fromToken, destToken, amount, distribution, flags ); } } // File: contracts/OneSplit.sol pragma solidity ^0.5.0; //import "./OneSplitSmartToken.sol"; contract OneSplitViewWrap is OneSplitViewWrapBase, OneSplitMStableView, OneSplitChaiView, OneSplitBdaiView, OneSplitAaveView, OneSplitFulcrumView, OneSplitCompoundView, OneSplitIearnView, OneSplitIdleView, OneSplitWethView, OneSplitDMMView, OneSplitMultiPathView //OneSplitSmartTokenView { IOneSplitView public oneSplitView; constructor(IOneSplitView _oneSplit) public { oneSplitView = _oneSplit; } function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) public view returns( uint256 returnAmount, uint256[] memory distribution ) { (returnAmount, , distribution) = getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, 0 ); } function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, // See constants in IOneSplit.sol uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { if (fromToken == destToken) { return (amount, 0, new uint256[](DEXES_COUNT)); } return super.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function _getExpectedReturnRespectingGasFloor( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) internal view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return oneSplitView.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } } contract OneSplitWrap is OneSplitBaseWrap, OneSplitMStable, OneSplitChai, OneSplitBdai, OneSplitAave, OneSplitFulcrum, OneSplitCompound, OneSplitIearn, OneSplitIdle, OneSplitWeth, OneSplitDMM, OneSplitMultiPath //OneSplitSmartToken { IOneSplitView public oneSplitView; IOneSplit public oneSplit; constructor(IOneSplitView _oneSplitView, IOneSplit _oneSplit) public { oneSplitView = _oneSplitView; oneSplit = _oneSplit; } function() external payable { // solium-disable-next-line security/no-tx-origin require(msg.sender != tx.origin); } function getExpectedReturn( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags ) public view returns( uint256 returnAmount, uint256[] memory distribution ) { (returnAmount, , distribution) = getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, 0 ); } function getExpectedReturnWithGas( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 flags, uint256 destTokenEthPriceTimesGasPrice ) public view returns( uint256 returnAmount, uint256 estimateGasAmount, uint256[] memory distribution ) { return oneSplitView.getExpectedReturnWithGas( fromToken, destToken, amount, parts, flags, destTokenEthPriceTimesGasPrice ); } function getExpectedReturnWithGasMulti( IERC20[] memory tokens, uint256 amount, uint256 parts, uint256 flags, uint256[] memory destTokenEthPriceTimesGasPrices ) public view returns( uint256[] memory returnAmounts, uint256 estimateGasAmount, uint256[] memory distribution ) { uint256[] memory dist; returnAmounts = new uint256[](tokens.length - 1); for (uint i = 1; i < tokens.length; i++) { if (tokens[i - 1] == tokens[i]) { continue; } IERC20[] memory _tokens = tokens; ( returnAmounts[i - 1], amount, dist ) = getExpectedReturnWithGas( _tokens[i - 1], _tokens[i], (i == 1) ? amount : returnAmounts[i - 2], parts, flags, destTokenEthPriceTimesGasPrices[i] ); estimateGasAmount = estimateGasAmount.add(amount); if (distribution.length == 0) { distribution = new uint256[](dist.length); } for (uint j = 0; j < distribution.length; j++) { distribution[j] = distribution[j].add(dist[j] << (8 * (i - 1))); } } } function swap( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 minReturn, uint256[] memory distribution, uint256 flags ) public payable returns(uint256 returnAmount) { fromToken.universalTransferFrom(msg.sender, address(this), amount); uint256 confirmed = fromToken.universalBalanceOf(address(this)); _swap(fromToken, destToken, confirmed, distribution, flags); returnAmount = destToken.universalBalanceOf(address(this)); require(returnAmount >= minReturn, "OneSplit: actual return amount is less than minReturn"); destToken.universalTransfer(msg.sender, returnAmount); fromToken.universalTransfer(msg.sender, fromToken.universalBalanceOf(address(this))); } function swapMulti( IERC20[] memory tokens, uint256 amount, uint256 minReturn, uint256[] memory distribution, uint256 flags ) public payable returns(uint256 returnAmount) { tokens[0].universalTransferFrom(msg.sender, address(this), amount); returnAmount = tokens[0].universalBalanceOf(address(this)); for (uint i = 1; i < tokens.length; i++) { if (tokens[i - 1] == tokens[i]) { continue; } uint256[] memory dist = new uint256[](distribution.length); for (uint j = 0; j < distribution.length; j++) { dist[j] = (distribution[j] >> (8 * (i - 1))) & 0xFF; } _swap( tokens[i - 1], tokens[i], returnAmount, dist, flags ); returnAmount = tokens[i].universalBalanceOf(address(this)); tokens[i - 1].universalTransfer(msg.sender, tokens[i - 1].universalBalanceOf(address(this))); } require(returnAmount >= minReturn, "OneSplit: actual return amount is less than minReturn"); tokens[tokens.length - 1].universalTransfer(msg.sender, returnAmount); } function _swapFloor( IERC20 fromToken, IERC20 destToken, uint256 amount, uint256[] memory distribution, uint256 flags ) internal { fromToken.universalApprove(address(oneSplit), amount); oneSplit.swap.value(fromToken.isETH() ? amount : 0)( fromToken, destToken, amount, 0, distribution, flags ); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IOneSplitView","name":"_oneSplitView","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":true,"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"parts","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"}],"name":"getExpectedReturn","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"parts","type":"uint256"},{"internalType":"uint256","name":"flags","type":"uint256"},{"internalType":"uint256","name":"destTokenEthPriceTimesGasPrice","type":"uint256"}],"name":"getExpectedReturnWithGas","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"},{"internalType":"uint256","name":"estimateGasAmount","type":"uint256"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"oneSplitView","outputs":[{"internalType":"contract IOneSplitView","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"contract IERC20","name":"fromToken","type":"address"},{"internalType":"contract IERC20","name":"destToken","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"minReturn","type":"uint256"},{"internalType":"uint256[]","name":"distribution","type":"uint256[]"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405162004867380380620048678339818101604052602081101561003557600080fd5b5051600080546001600160a01b039092166001600160a01b03199092169190911790556147ff80620000686000396000f3fe60806040526004361061003f5760003560e01c8063085e2c5b1461004e5780638373f265146100f8578063e2a7515e146101af578063fbe4ed9514610289575b3332141561004c57600080fd5b005b34801561005a57600080fd5b5061009d600480360360a081101561007157600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356102ba565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156100e35781810151838201526020016100cb565b50505050905001935050505060405180910390f35b34801561010457600080fd5b5061014d600480360360c081101561011b57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a001356102dd565b6040518084815260200183815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610199578181015183820152602001610181565b5050505090500194505050505060405180910390f35b610277600480360360c08110156101c557600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b81111561020457600080fd5b82018360208201111561021657600080fd5b803590602001918460208302840111600160201b8311171561023757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610434915050565b60408051918252519081900360200190f35b34801561029557600080fd5b5061029e6107d5565b604080516001600160a01b039092168252519081900360200190f35b600060606102cd878787878760006102dd565b9199919850909650505050505050565b6000805460408051638373f26560e01b81526001600160a01b038a81166004830152898116602483015260448201899052606482018890526084820187905260a48201869052915184936060931691638373f2659160c48083019287929190829003018186803b15801561035057600080fd5b505afa158015610364573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052606081101561038d57600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156103b757600080fd5b9083019060208201858111156103cc57600080fd5b82518660208202830111600160201b821117156103e857600080fd5b82525081516020918201928201910280838360005b838110156104155781810151838201526020016103fd565b5050505090500160405250505092509250925096509650969350505050565b6000856001600160a01b0316876001600160a01b031614156104575750836107cb565b61045f61462b565b6040518061036001604052806107e48152602001610a758152602001610c108152602001610f59815260200161122a81526020016113c581526020016115a681526020016117db8152602001611a1a8152602001611c598152602001611e078152602001611fc381526020016121b88152602001612310815260200161231d81526020016123398152602001612355815260200161237181526020016125b08152602001612742815260200161293b81526020016129f48152602001612acd8152602001612b6e8152602001612d678152602001612d7e8152602001612d8d8152509050601b845111156105845760405162461bcd60e51b81526004018080602001828103825260428152602001806147896042913960600191505060405180910390fd5b600080805b86518110156105e25760008782815181106105a057fe5b602002602001015111156105da576105d48782815181106105bd57fe5b602002602001015184612d9c90919063ffffffff16565b92508091505b600101610589565b5081610642576105fa8a6001600160a01b0316612dff565b156106375760405133903480156108fc02916000818181858888f1935050505015801561062b573d6000803e3d6000fd5b503493505050506107cb565b8793505050506107cb565b61065d6001600160a01b038b1633308b63ffffffff612e3b16565b60006106786001600160a01b038c163063ffffffff612f5a16565b905060005b875181101561071b5787818151811061069257fe5b6020026020010151600014156106a757610713565b60006106df856106d38b85815181106106bc57fe5b60200260200101518e61300490919063ffffffff16565b9063ffffffff61305d16565b9050838214156106ec5750815b80830392506107108d8d838986601b811061070357fe5b602002015163ffffffff16565b50505b60010161067d565b506107356001600160a01b038b163063ffffffff612f5a16565b9450878510156107765760405162461bcd60e51b81526004018080602001828103825260268152602001806147036026913960400191505060405180910390fd5b6107906001600160a01b038b16338763ffffffff61309f16565b506107c5336107ae6001600160a01b038e163063ffffffff612f5a16565b6001600160a01b038e16919063ffffffff61309f16565b50505050505b9695505050505050565b6000546001600160a01b031681565b6000816107f96001600160a01b038616612dff565b61093957604080516303795fb160e11b81526001600160a01b0387166004820152905160009173c0a47dfe034b400b47bdad5fecda2621de6c4d95916306f2bf6291602480820192602092909190829003018186803b15801561085b57600080fd5b505afa15801561086f573d6000803e3d6000fd5b505050506040513d602081101561088557600080fd5b505190506001600160a01b03811615610937576108b26001600160a01b038716828463ffffffff61311a16565b604080516395e3c50b60e01b8152600481018490526001602482015242604482015290516001600160a01b038316916395e3c50b9160648083019260209291908290030181600087803b15801561090857600080fd5b505af115801561091c573d6000803e3d6000fd5b505050506040513d602081101561093257600080fd5b505191505b505b61094b846001600160a01b0316612dff565b610a6b57604080516303795fb160e11b81526001600160a01b0386166004820152905160009173c0a47dfe034b400b47bdad5fecda2621de6c4d95916306f2bf6291602480820192602092909190829003018186803b1580156109ad57600080fd5b505afa1580156109c1573d6000803e3d6000fd5b505050506040513d60208110156109d757600080fd5b505190506001600160a01b03811615610a6957806001600160a01b031663f39b5b9b836001426040518463ffffffff1660e01b815260040180838152602001828152602001925050506020604051808303818588803b158015610a3957600080fd5b505af1158015610a4d573d6000803e3d6000fd5b50505050506040513d6020811015610a6457600080fd5b505191505b505b90505b9392505050565b6000610aa56001600160a01b03851673818e6fecd516ecc3849daf6845e3ec868087b7558463ffffffff61311a16565b73818e6fecd516ecc3849daf6845e3ec868087b7556329589f61610ad16001600160a01b038716612dff565b610adc576000610ade565b835b610af0876001600160a01b0316612dff565b610afa5786610b10565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b85610b23886001600160a01b0316612dff565b610b2d5787610b43565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b604080516001600160e01b031960e088901b1681526001600160a01b039485166004820152602481019390935292166044820152306064820152600160ff1b6084820152600060a48201819052734d37f28d2db99e8d35a6c725a5f1749a085850a360c483015261010060e4830152610104820152905161014480830192602092919082900301818588803b158015610bdb57600080fd5b505af1158015610bef573d6000803e3d6000fd5b50505050506040513d6020811015610c0657600080fd5b5051949350505050565b6000807352ae12abe5d8bd778bd5397f99ca900624cfadd46001600160a01b031663bb34534c6040518163ffffffff1660e01b815260040180806c42616e636f724e6574776f726b60981b815250602001905060206040518083038186803b158015610c7b57600080fd5b505afa158015610c8f573d6000803e3d6000fd5b505050506040513d6020811015610ca557600080fd5b505190506060736f0cd8c4f6f06eab664c7e3031909452b4b728616375e1cc82610cd76001600160a01b038916612dff565b610ce15787610cf7565b73c0829421c1d260bd3cb3e0f06cfe2d52db2ce3155b610d09886001600160a01b0316612dff565b610d135787610d29565b73c0829421c1d260bd3cb3e0f06cfe2d52db2ce3155b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b03168152602001826001600160a01b03166001600160a01b031681526020019250505060006040518083038186803b158015610d8857600080fd5b505afa158015610d9c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610dc557600080fd5b8101908080516040519392919084600160201b821115610de457600080fd5b908301906020820185811115610df957600080fd5b82518660208202830111600160201b82111715610e1557600080fd5b82525081516020918201928201910280838360005b83811015610e42578181015183820152602001610e2a565b505050509050016040525050509050610e6f8285886001600160a01b031661311a9092919063ffffffff16565b816001600160a01b031663f3898a97610e90886001600160a01b0316612dff565b610e9b576000610e9d565b855b838760016040518563ffffffff1660e01b81526004018080602001848152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015610efc578181015183820152602001610ee4565b505050509050019450505050506020604051808303818588803b158015610f2257600080fd5b505af1158015610f36573d6000803e3d6000fd5b50505050506040513d6020811015610f4d57600080fd5b50519695505050505050565b6000610f6d846001600160a01b0316612dff565b15610fd5576000805160206146578339815191526001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015610fbb57600080fd5b505af1158015610fcf573d6000803e3d6000fd5b50505050505b6000610fe9856001600160a01b0316612dff565b610ff35784611003565b6000805160206146578339815191525b90506110336001600160a01b03821673794e6e91555438afc3ccf1c5076a74f42133d08d8563ffffffff61311a16565b600073794e6e91555438afc3ccf1c5076a74f42133d08d630621b4f66110616001600160a01b038916612dff565b61106b578761107b565b6000805160206146578339815191525b8661108e896001600160a01b0316612dff565b61109857886110a8565b6000805160206146578339815191525b604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015260248101939093529216604482015260016064820152905160848083019260209291908290030181600087803b15801561110657600080fd5b505af115801561111a573d6000803e3d6000fd5b505050506040513d602081101561113057600080fd5b505190506111466001600160a01b038616612dff565b1561122157604080516370a0823160e01b8152306004820152905160008051602061465783398151915291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b15801561119e57600080fd5b505afa1580156111b2573d6000803e3d6000fd5b505050506040513d60208110156111c857600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b15801561120857600080fd5b505af115801561121c573d6000803e3d6000fd5b505050505b95945050505050565b6000806001600160a01b0385166000805160206146e383398151915214611252576000611255565b60025b6001600160a01b0386166000805160206146778339815191521461127a57600061127d565b60015b0160ff16905060006000805160206146e38339815191526001600160a01b038616146112aa5760006112ad565b60025b6001600160a01b038616600080516020614677833981519152146112d25760006112d5565b60015b0160ff16905081600f0b600014806112f0575080600f0b6000145b1561130057600092505050610a6e565b61132e6001600160a01b03871673a2b47e3d5c44877cca798226b7b8118f9bfb7a568663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b602482015260448101869052600060648201819052915173a2b47e3d5c44877cca798226b7b8118f9bfb7a569263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b505af11580156113b8573d6000803e3d6000fd5b5050505050509392505050565b6000806001600160a01b03851673dac17f958d2ee523a2206206994597c13d831ec7146113f35760006113f6565b60035b6001600160a01b0386166000805160206146e38339815191521461141b57600061141e565b60025b6001600160a01b03871660008051602061467783398151915214611443576000611446565b60015b010160ff169050600073dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316856001600160a01b031614611483576000611486565b60035b6001600160a01b0386166000805160206146e3833981519152146114ab5760006114ae565b60025b6001600160a01b038716600080516020614677833981519152146114d35760006114d6565b60015b010160ff16905081600f0b600014806114f2575080600f0b6000145b1561150257600092505050610a6e565b6115306001600160a01b0387167352ea46506b9cc5ef470c5bf89f17dc28bb35d85c8663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517352ea46506b9cc5ef470c5bf89f17dc28bb35d85c9263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b0385166e085d4780b73119b644ae5ecd22b376146115cf5760006115d2565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146115fd576000611600565b60035b6001600160a01b0387166000805160206146e383398151915214611625576000611628565b60025b6001600160a01b0388166000805160206146778339815191521461164d576000611650565b60015b01010160ff16905060006e085d4780b73119b644ae5ecd22b3766001600160a01b0316856001600160a01b03161461168957600061168c565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146116b75760006116ba565b60035b6001600160a01b0387166000805160206146e3833981519152146116df5760006116e2565b60025b6001600160a01b0388166000805160206146778339815191521461170757600061170a565b60015b01010160ff16905081600f0b60001480611727575080600f0b6000145b1561173757600092505050610a6e565b6117656001600160a01b0387167345f783cce6b7ff23b2ab2d70e416cdb7d6055f518663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517345f783cce6b7ff23b2ab2d70e416cdb7d6055f519263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b038516734fabb145d64652a948d72533023f6e7a623c7c531461180957600061180c565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec71461183757600061183a565b60035b6001600160a01b0387166000805160206146e38339815191521461185f576000611862565b60025b6001600160a01b0388166000805160206146778339815191521461188757600061188a565b60015b01010160ff1690506000734fabb145d64652a948d72533023f6e7a623c7c536001600160a01b0316856001600160a01b0316146118c85760006118cb565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146118f65760006118f9565b60035b6001600160a01b0387166000805160206146e38339815191521461191e576000611921565b60025b6001600160a01b03881660008051602061467783398151915214611946576000611949565b60015b01010160ff16905081600f0b60001480611966575080600f0b6000145b1561197657600092505050610a6e565b6119a46001600160a01b0387167379a8c46dea5ada233abaffd40f3a0a2b1e5a4f278663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517379a8c46dea5ada233abaffd40f3a0a2b1e5a4f279263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b0385167357ab1ec28d129707052df4df418d58a2d46d5f5114611a48576000611a4b565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec714611a76576000611a79565b60035b6001600160a01b0387166000805160206146e383398151915214611a9e576000611aa1565b60025b6001600160a01b03881660008051602061467783398151915214611ac6576000611ac9565b60015b01010160ff16905060007357ab1ec28d129707052df4df418d58a2d46d5f516001600160a01b0316856001600160a01b031614611b07576000611b0a565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec714611b35576000611b38565b60035b6001600160a01b0387166000805160206146e383398151915214611b5d576000611b60565b60025b6001600160a01b03881660008051602061467783398151915214611b85576000611b88565b60015b01010160ff16905081600f0b60001480611ba5575080600f0b6000145b15611bb557600092505050610a6e565b611be36001600160a01b03871673a5407eae9ba41422680e2e00537571bcc53efbfd8663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b602482015260448101869052600060648201819052915173a5407eae9ba41422680e2e00537571bcc53efbfd9263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000611c6d846001600160a01b0316612dff565b611d36576000611c7c85613213565b9050611c986001600160a01b038616828563ffffffff61311a16565b806001600160a01b031663a0712d68846040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015611cde57600080fd5b505af1158015611cf2573d6000803e3d6000fd5b505050506040513d6020811015611d0857600080fd5b50611d2e90508185611d296001600160a01b0383163063ffffffff612f5a16565b6107e4565b915050610a6e565b611d48836001600160a01b0316612dff565b611dfd576000611d5784613213565b90506000611d668683866107e4565b9050816001600160a01b031663db006a75826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015611dae57600080fd5b505af1158015611dc2573d6000803e3d6000fd5b505050506040513d6020811015611dd857600080fd5b50611df490506001600160a01b0386163063ffffffff612f5a16565b92505050610a6e565b5060009392505050565b60006001600160a01b0384166000805160206146778339815191521415611efa57611e566001600160a01b0385167306af07097c9eeb7fd685c692751d5c66db49c2158463ffffffff61311a16565b60408051633b4da69f60e01b81523060048201526024810184905290517306af07097c9eeb7fd685c692751d5c66db49c21591633b4da69f91604480830192600092919082900301818387803b158015611eaf57600080fd5b505af1158015611ec3573d6000803e3d6000fd5b50611ef392507306af07097c9eeb7fd685c692751d5c66db49c2159150859050611d29823063ffffffff612f5a16565b9050610a6e565b6001600160a01b0383166000805160206146778339815191521415611dfd576000611f3a857306af07097c9eeb7fd685c692751d5c66db49c215856107e4565b6040805163ef693bed60e01b81523060048201526024810183905290519192507306af07097c9eeb7fd685c692751d5c66db49c2159163ef693bed9160448082019260009290919082900301818387803b158015611f9757600080fd5b505af1158015611fab573d6000803e3d6000fd5b50611d2e925050506001600160a01b03851630612f5a565b6000611fd7846001600160a01b0316612dff565b61211e576000611fe685613403565b905061207b73398ec7346dcd622edc5ae82352f02be94c62d1196001600160a01b031663f2f4eb266040518163ffffffff1660e01b815260040160206040518083038186803b15801561203857600080fd5b505afa15801561204c573d6000803e3d6000fd5b505050506040513d602081101561206257600080fd5b50516001600160a01b038716908563ffffffff61311a16565b60408051636968703360e11b81526001600160a01b03871660048201526024810185905261044d6044820152905173398ec7346dcd622edc5ae82352f02be94c62d1199163d2d0e06691606480830192600092919082900301818387803b1580156120e557600080fd5b505af11580156120f9573d6000803e3d6000fd5b50505050611d2e8185611d2930856001600160a01b0316612f5a90919063ffffffff16565b612130836001600160a01b0316612dff565b611dfd57600061213f84613403565b9050600061214e8683866107e4565b9050816001600160a01b031663db006a75826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561219657600080fd5b505af11580156121aa573d6000803e3d6000fd5b505050508092505050610a6e565b600080737079e8517594e5b21d2b9a0d17cb33f5fe2bca706001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b15801561220857600080fd5b505afa15801561221c573d6000803e3d6000fd5b505050506040513d602081101561223257600080fd5b505190506122506001600160a01b038616828563ffffffff61311a16565b806001600160a01b031663fe029156612271876001600160a01b0316612dff565b61227c57600061227e565b845b604080516001600160e01b031960e085901b1681526001600160a01b03808b1660048301528916602482015260448101889052600060648201529051608480830192602092919082900301818588803b1580156122da57600080fd5b505af11580156122ee573d6000803e3d6000fd5b50505050506040513d602081101561230557600080fd5b505195945050505050565b6000610a6b848484613826565b6000610a6b846000805160206146578339815191528585613bd7565b6000610a6b846000805160206146778339815191528585613bd7565b6000610a6b846000805160206146e38339815191528585613bd7565b6000806001600160a01b038516738e870d67f660d95d5be530380d0ec0bd388289e11461239f5760006123a2565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146123cd5760006123d0565b60035b6001600160a01b0387166000805160206146e3833981519152146123f55760006123f8565b60025b6001600160a01b0388166000805160206146778339815191521461241d576000612420565b60015b01010160ff1690506000738e870d67f660d95d5be530380d0ec0bd388289e16001600160a01b0316856001600160a01b03161461245e576000612461565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec71461248c57600061248f565b60035b6001600160a01b0387166000805160206146e3833981519152146124b45760006124b7565b60025b6001600160a01b038816600080516020614677833981519152146124dc5760006124df565b60015b01010160ff16905081600f0b600014806124fc575080600f0b6000145b1561250c57600092505050610a6e565b61253a6001600160a01b0387167306364f10b501e868329afbc005b3492902d6c7638663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517306364f10b501e868329afbc005b3492902d6c7639263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b038516732260fac5e5542a773aa44fbcfedf7c193bc2c599146125de5760006125e1565b60025b6001600160a01b03861673eb4c2781e4eba804ce9a9803c67d0893436bb27d1461260c57600061260f565b60015b0160ff1690506000732260fac5e5542a773aa44fbcfedf7c193bc2c5996001600160a01b03861614612642576000612645565b60025b6001600160a01b03861673eb4c2781e4eba804ce9a9803c67d0893436bb27d14612670576000612673565b60015b0160ff16905081600f0b6000148061268e575080600f0b6000145b1561269e57600092505050610a6e565b6126cc6001600160a01b0387167393054188d876f558f4a66b2ef1d97d16edf0895b8663ffffffff61311a16565b60408051630f7c084960e21b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517393054188d876f558f4a66b2ef1d97d16edf0895b92633df02124926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b038516730316eb71485b0ab14103307bf65a021042c6d38014612770576000612773565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c5991461279e5760006127a1565b60025b6001600160a01b038716731bbe271d15bb64df0bc6cd28df9ff322f2ebd847146127cc5760006127cf565b60015b010160ff1690506000730316eb71485b0ab14103307bf65a021042c6d3806001600160a01b0316856001600160a01b03161461280c57600061280f565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c5991461283a57600061283d565b60025b6001600160a01b038716731bbe271d15bb64df0bc6cd28df9ff322f2ebd8471461286857600061286b565b60015b010160ff16905081600f0b60001480612887575080600f0b6000145b1561289757600092505050610a6e565b6128c56001600160a01b038716739726e9314ef1b96e45f40056bed61a088897313e8663ffffffff61311a16565b60408051630f7c084960e21b8152600019808501600f90810b810b6004840152908401810b900b6024820152604481018690526000606482018190529151739726e9314ef1b96e45f40056bed61a088897313e92633df02124926084808201939182900301818387803b1580156113a457600080fd5b600061296b6001600160a01b0385167303ef3f37856bd08eb47e2de7abc4ddd2c19b60f28463ffffffff61311a16565b60408051630df791e560e41b81526001600160a01b038681166004830152851660248201526044810184905290517303ef3f37856bd08eb47e2de7abc4ddd2c19b60f29163df791e5091606480830192600092919082900301818387803b1580156129d557600080fd5b505af11580156129e9573d6000803e3d6000fd5b505050509392505050565b6000612a246001600160a01b03851673a8253a440be331dc4a7395b73948cca6f19dc97d8463ffffffff61311a16565b604080516303ff4c0160e31b81526001600160a01b0386811660048301528516602482015260448101849052600060648201819052603242016084830152915173a8253a440be331dc4a7395b73948cca6f19dc97d92631ffa60089260a480820193602093909283900390910190829087803b158015612aa357600080fd5b505af1158015612ab7573d6000803e3d6000fd5b505050506040513d6020811015610c0657600080fd5b6000612afd6001600160a01b03851673e2f2a5c287993345a840db3b0845fbc70f5935a58463ffffffff61311a16565b60408051631ba0488760e21b81526001600160a01b0386811660048301528516602482015260448101849052306064820152905173e2f2a5c287993345a840db3b0845fbc70f5935a591636e81221c9160848083019260209291908290030181600087803b158015612aa357600080fd5b6000806001600160a01b03851673fe18be6b3bd88a2d2a7f928d00292e7a9963cfc614612b9c576000612b9f565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c59914612bca576000612bcd565b60025b6001600160a01b03871673eb4c2781e4eba804ce9a9803c67d0893436bb27d14612bf8576000612bfb565b60015b010160ff169050600073fe18be6b3bd88a2d2a7f928d00292e7a9963cfc66001600160a01b0316856001600160a01b031614612c38576000612c3b565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c59914612c66576000612c69565b60025b6001600160a01b03871673eb4c2781e4eba804ce9a9803c67d0893436bb27d14612c94576000612c97565b60015b010160ff16905081600f0b60001480612cb3575080600f0b6000145b15612cc357600092505050610a6e565b612cf16001600160a01b038716737fc77b5c7614e1533320ea6ddc2eb61fa00a97148663ffffffff61311a16565b60408051630f7c084960e21b8152600019808501600f90810b810b6004840152908401810b900b6024820152604481018690526000606482018190529151737fc77b5c7614e1533320ea6ddc2eb61fa00a971492633df02124926084808201939182900301818387803b1580156113a457600080fd5b6000612d768484846000613bee565b509392505050565b6000612d768484846001613bee565b6000612d768484846002613bee565b600082820183811015612df6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b60006001600160a01b0382161580612e3357506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b90505b919050565b80612e4557612f54565b612e4e84612dff565b15612f39576001600160a01b03831633148015612e6b5750803410155b612ea65760405162461bcd60e51b815260040180806020018281038252602b815260200180614697602b913960400191505060405180910390fd5b6001600160a01b0382163014612eee576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612eec573d6000803e3d6000fd5b505b80341115612f3457336108fc612f0a348463ffffffff61408316565b6040518115909202916000818181858888f19350505050158015612f32573d6000803e3d6000fd5b505b612f54565b612f546001600160a01b03851684848463ffffffff6140c516565b50505050565b6000612f6583612dff565b15612f7b57506001600160a01b03811631612df9565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015612fd157600080fd5b505afa158015612fe5573d6000803e3d6000fd5b505050506040513d6020811015612ffb57600080fd5b50519050612df9565b60008261301357506000612df9565b8282028284828161302057fe5b0414612df65760405162461bcd60e51b81526004018080602001828103825260218152602001806146c26021913960400191505060405180910390fd5b6000612df683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061411f565b6000816130ae57506001610a6e565b6130b784612dff565b156130f8576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156130f2573d6000803e3d6000fd5b50610a6e565b6131126001600160a01b038516848463ffffffff6141c116565b506001610a6e565b61312383612dff565b61320e578061314c576131476001600160a01b03841683600063ffffffff61421316565b61320e565b60408051636eb1769f60e11b81523060048201526001600160a01b038481166024830152915160009286169163dd62ed3e916044808301926020929190829003018186803b15801561319d57600080fd5b505afa1580156131b1573d6000803e3d6000fd5b505050506040513d60208110156131c757600080fd5b5051905081811015612f545780156131f4576131f46001600160a01b03851684600063ffffffff61421316565b612f546001600160a01b038516848463ffffffff61421316565b505050565b6000613227826001600160a01b0316612dff565b156132475750734ddc2d193948926d02f9b1fe9e1daa0718270ed5612e36565b6001600160a01b03821660008051602061467783398151915214156132815750735d3a536e4d6dbd6114cc1ead35777bab948e3643612e36565b6001600160a01b038216730d8775f648430679a709e98d2b0cb6250d2887ef14156132c15750736c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e612e36565b6001600160a01b038216731985365e9f78359a9b6ad760e32412f4a445e8621415613301575073158079ee67fce2f58472a96584a73c7ab9ac95c1612e36565b6001600160a01b0382166000805160206146e3833981519152141561333b57507339aa39c021dfbae8fac545936693ac917d5e7563612e36565b6001600160a01b038216732260fac5e5542a773aa44fbcfedf7c193bc2c599141561337b575073c11b1268c1a384e55c48c2391d8d480264a3a7f4612e36565b6001600160a01b03821673e41d2489571d322189246dafa5ebde1f4699f49814156133bb575073b3319f5d18bc0d84dd1b4825dcde5d5f7266d407612e36565b6001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec714156133fb575073f650c3d88d12db855b8bf7d11be6c55a4e07dcc9612e36565b506000919050565b6000613417826001600160a01b0316612dff565b156134375750733a3a65aab0dd2a17e3f1947ba16138cd37d08c04612e36565b6001600160a01b0382166000805160206146778339815191521415613471575073fc1e690f61efd961294b3e1ce3313fbd8aa4f85d612e36565b6001600160a01b0382166000805160206146e383398151915214156134ab5750739ba00d6856a4edf4665bca2c2309936572473b7e612e36565b6001600160a01b0382167357ab1ec28d129707052df4df418d58a2d46d5f5114156134eb575073625ae63000f46200499120b906716420bd059240612e36565b6001600160a01b038216734fabb145d64652a948d72533023f6e7a623c7c53141561352b5750736ee0f7bb50a54ab5253da0667b0dc2ee526c30a8612e36565b6001600160a01b0382166e085d4780b73119b644ae5ecd22b37614156135665750734da9b813057d04baef4e5800e36083717b4a0341612e36565b6001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec714156135a657507371fc860f7d3a592a4a98740e39db31d25db65ae8612e36565b6001600160a01b038216730d8775f648430679a709e98d2b0cb6250d2887ef14156135e6575073e1ba0fb44ccb0d11b80f92f4f8ed94ca3ff51d00612e36565b6001600160a01b03821673dd974d5c2e2928dea5f71b9825b8b646686bd20014156136265750739d91be44c06d373a8a226e1f3b146956083803eb612e36565b6001600160a01b0382167380fb784b7ed66730e8b1dbd9820afd29931aab0314156136665750737d2d3688df45ce7c552e19c27e007673da9204b8612e36565b6001600160a01b03821673514910771af9ca656af840dff83e8264ecf986ca14156136a6575073a64bd6c70cb9051f6a9ba1f163fdc07e0dfb5f84612e36565b6001600160a01b038216730f5d2fb29fb7d3cfee444a200298f468908cc94214156136e65750736fce4a401b6b80ace52baaefe4421bd188e76f6f612e36565b6001600160a01b038216739f8f72aa9304c8b593d555f12ef6589cc3a579a214156137265750737deb5e830be29f91e298ba5ff1356bb7f8146998612e36565b6001600160a01b038216731985365e9f78359a9b6ad760e32412f4a445e862141561376657507371010a9d003445ac60c4e6a7017c1e89a477b438612e36565b6001600160a01b03821673c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f14156137a6575073328c4c80bc7aca0834db37e6600a6c49e12da4de612e36565b6001600160a01b038216732260fac5e5542a773aa44fbcfedf7c193bc2c59914156137e6575073fc4b8ed459e00e5400be803a9bb3954234fd50e3612e36565b6001600160a01b03821673e41d2489571d322189246dafa5ebde1f4699f49814156133fb5750736fb0855c404e09c47c3fbca25f08d4e41f9f062f612e36565b600061383a846001600160a01b0316612dff565b156138a2576000805160206146578339815191526001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561388857600080fd5b505af115801561389c573d6000803e3d6000fd5b50505050505b60006138b6856001600160a01b0316612dff565b6138c057846138d0565b6000805160206146578339815191525b905060006138e6856001600160a01b0316612dff565b6138f05784613900565b6000805160206146578339815191525b6040805163e6a4390560e01b81526001600160a01b038581166004830152831660248201529051919250600091735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561396857600080fd5b505afa15801561397c573d6000803e3d6000fd5b505050506040513d602081101561399257600080fd5b505190506139b16001600160a01b03821684848863ffffffff61432616565b93506139cd6001600160a01b038416828763ffffffff61309f16565b50816001600160a01b0316836001600160a01b03161015613a66576040805163022c0d9f60e01b815260006004820181905260248201879052306044830152608060648301526084820181905291516001600160a01b0384169263022c0d9f9260c4808201939182900301818387803b158015613a4957600080fd5b505af1158015613a5d573d6000803e3d6000fd5b50505050613ae0565b6040805163022c0d9f60e01b815260048101869052600060248201819052306044830152608060648301526084820181905291516001600160a01b0384169263022c0d9f9260c4808201939182900301818387803b158015613ac757600080fd5b505af1158015613adb573d6000803e3d6000fd5b505050505b613af2866001600160a01b0316612dff565b15613bcd57604080516370a0823160e01b8152306004820152905160008051602061465783398151915291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b158015613b4a57600080fd5b505afa158015613b5e573d6000803e3d6000fd5b505050506040513d6020811015613b7457600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b158015613bb457600080fd5b505af1158015613bc8573d6000803e3d6000fd5b505050505b5050509392505050565b60006112218484613be9888887613826565b613826565b600060607365e67cbc342712df67494acefc06fe951ee9398263bfdbfc43613c1e6001600160a01b038916612dff565b613c285787613c38565b6000805160206146578339815191525b613c4a886001600160a01b0316612dff565b613c545787613c64565b6000805160206146578339815191525b866001016040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b03168152602001828152602001935050505060006040518083038186803b158015613cce57600080fd5b505afa158015613ce2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015613d0b57600080fd5b8101908080516040519392919084600160201b821115613d2a57600080fd5b908301906020820185811115613d3f57600080fd5b82518660208202830111600160201b82111715613d5b57600080fd5b82525081516020918201928201910280838360005b83811015613d88578181015183820152602001613d70565b505050509050016040525050509050613da9866001600160a01b0316612dff565b15613e11576000805160206146578339815191526001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015613df757600080fd5b505af1158015613e0b573d6000803e3d6000fd5b50505050505b613e6b818481518110613e2057fe5b602002602001015185613e3b896001600160a01b0316612dff565b613e455788613e55565b6000805160206146578339815191525b6001600160a01b0316919063ffffffff61311a16565b808381518110613e7757fe5b60200260200101516001600160a01b0316638201aa3f613e9f886001600160a01b0316612dff565b613ea95787613eb9565b6000805160206146578339815191525b86613ecc896001600160a01b0316612dff565b613ed65788613ee6565b6000805160206146578339815191525b60006000196040518663ffffffff1660e01b815260040180866001600160a01b03166001600160a01b03168152602001858152602001846001600160a01b03166001600160a01b03168152602001838152602001828152602001955050505050506040805180830381600087803b158015613f6057600080fd5b505af1158015613f74573d6000803e3d6000fd5b505050506040513d6040811015613f8a57600080fd5b50613f9f90506001600160a01b038616612dff565b1561407a57604080516370a0823160e01b8152306004820152905160008051602061465783398151915291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b158015613ff757600080fd5b505afa15801561400b573d6000803e3d6000fd5b505050506040513d602081101561402157600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b15801561406157600080fd5b505af1158015614075573d6000803e3d6000fd5b505050505b50949350505050565b6000612df683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506143dd565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612f54908590614437565b600081836141ab5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614170578181015183820152602001614158565b50505050905090810190601f16801561419d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816141b757fe5b0495945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261320e908490614437565b801580614299575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561426b57600080fd5b505afa15801561427f573d6000803e3d6000fd5b505050506040513d602081101561429557600080fd5b5051155b6142d45760405162461bcd60e51b81526004018080602001828103825260368152602001806147536036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261320e908490614437565b6000806143426001600160a01b0386168763ffffffff612f5a16565b9050600061435f6001600160a01b0386168863ffffffff612f5a16565b90506000614375856103e563ffffffff61300416565b90506000614389828463ffffffff61300416565b905060006143af836143a3876103e863ffffffff61300416565b9063ffffffff612d9c16565b905080156143cc576143c7828263ffffffff61305d16565b6143cf565b60005b9a9950505050505050505050565b6000818484111561442f5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614170578181015183820152602001614158565b505050900390565b614449826001600160a01b03166145ef565b61449a576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106144d85780518252601f1990920191602091820191016144b9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461453a576040519150601f19603f3d011682016040523d82523d6000602084013e61453f565b606091505b509150915081614596576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115612f54578080602001905160208110156145b257600080fd5b5051612f545760405162461bcd60e51b815260040180806020018281038252602a815260200180614729602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061462357508115155b949350505050565b604051806103600160405280601b905b61465481526020019060019003908161463b5790505090565bfefe000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f57726f6e6720757365616765206f66204554482e756e6976657273616c5472616e7366657246726f6d2829536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb484f6e6553706c69743a2052657475726e20616d6f756e7420776173206e6f7420656e6f7567685361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e63654f6e6553706c69743a20446973747269627574696f6e2061727261792073686f756c64206e6f74206578636565642072657365727665732061727261792073697a65a265627a7a723158200c4af721552effba7f39a40538f0a0a0fc023e83e9bd0298755ffabcb468bb0a64736f6c634300051100320000000000000000000000002fdac0084b40d7c259a284d72e8ee43930262266
Deployed Bytecode
0x60806040526004361061003f5760003560e01c8063085e2c5b1461004e5780638373f265146100f8578063e2a7515e146101af578063fbe4ed9514610289575b3332141561004c57600080fd5b005b34801561005a57600080fd5b5061009d600480360360a081101561007157600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356102ba565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156100e35781810151838201526020016100cb565b50505050905001935050505060405180910390f35b34801561010457600080fd5b5061014d600480360360c081101561011b57600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a001356102dd565b6040518084815260200183815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015610199578181015183820152602001610181565b5050505090500194505050505060405180910390f35b610277600480360360c08110156101c557600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b81111561020457600080fd5b82018360208201111561021657600080fd5b803590602001918460208302840111600160201b8311171561023757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610434915050565b60408051918252519081900360200190f35b34801561029557600080fd5b5061029e6107d5565b604080516001600160a01b039092168252519081900360200190f35b600060606102cd878787878760006102dd565b9199919850909650505050505050565b6000805460408051638373f26560e01b81526001600160a01b038a81166004830152898116602483015260448201899052606482018890526084820187905260a48201869052915184936060931691638373f2659160c48083019287929190829003018186803b15801561035057600080fd5b505afa158015610364573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052606081101561038d57600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156103b757600080fd5b9083019060208201858111156103cc57600080fd5b82518660208202830111600160201b821117156103e857600080fd5b82525081516020918201928201910280838360005b838110156104155781810151838201526020016103fd565b5050505090500160405250505092509250925096509650969350505050565b6000856001600160a01b0316876001600160a01b031614156104575750836107cb565b61045f61462b565b6040518061036001604052806107e48152602001610a758152602001610c108152602001610f59815260200161122a81526020016113c581526020016115a681526020016117db8152602001611a1a8152602001611c598152602001611e078152602001611fc381526020016121b88152602001612310815260200161231d81526020016123398152602001612355815260200161237181526020016125b08152602001612742815260200161293b81526020016129f48152602001612acd8152602001612b6e8152602001612d678152602001612d7e8152602001612d8d8152509050601b845111156105845760405162461bcd60e51b81526004018080602001828103825260428152602001806147896042913960600191505060405180910390fd5b600080805b86518110156105e25760008782815181106105a057fe5b602002602001015111156105da576105d48782815181106105bd57fe5b602002602001015184612d9c90919063ffffffff16565b92508091505b600101610589565b5081610642576105fa8a6001600160a01b0316612dff565b156106375760405133903480156108fc02916000818181858888f1935050505015801561062b573d6000803e3d6000fd5b503493505050506107cb565b8793505050506107cb565b61065d6001600160a01b038b1633308b63ffffffff612e3b16565b60006106786001600160a01b038c163063ffffffff612f5a16565b905060005b875181101561071b5787818151811061069257fe5b6020026020010151600014156106a757610713565b60006106df856106d38b85815181106106bc57fe5b60200260200101518e61300490919063ffffffff16565b9063ffffffff61305d16565b9050838214156106ec5750815b80830392506107108d8d838986601b811061070357fe5b602002015163ffffffff16565b50505b60010161067d565b506107356001600160a01b038b163063ffffffff612f5a16565b9450878510156107765760405162461bcd60e51b81526004018080602001828103825260268152602001806147036026913960400191505060405180910390fd5b6107906001600160a01b038b16338763ffffffff61309f16565b506107c5336107ae6001600160a01b038e163063ffffffff612f5a16565b6001600160a01b038e16919063ffffffff61309f16565b50505050505b9695505050505050565b6000546001600160a01b031681565b6000816107f96001600160a01b038616612dff565b61093957604080516303795fb160e11b81526001600160a01b0387166004820152905160009173c0a47dfe034b400b47bdad5fecda2621de6c4d95916306f2bf6291602480820192602092909190829003018186803b15801561085b57600080fd5b505afa15801561086f573d6000803e3d6000fd5b505050506040513d602081101561088557600080fd5b505190506001600160a01b03811615610937576108b26001600160a01b038716828463ffffffff61311a16565b604080516395e3c50b60e01b8152600481018490526001602482015242604482015290516001600160a01b038316916395e3c50b9160648083019260209291908290030181600087803b15801561090857600080fd5b505af115801561091c573d6000803e3d6000fd5b505050506040513d602081101561093257600080fd5b505191505b505b61094b846001600160a01b0316612dff565b610a6b57604080516303795fb160e11b81526001600160a01b0386166004820152905160009173c0a47dfe034b400b47bdad5fecda2621de6c4d95916306f2bf6291602480820192602092909190829003018186803b1580156109ad57600080fd5b505afa1580156109c1573d6000803e3d6000fd5b505050506040513d60208110156109d757600080fd5b505190506001600160a01b03811615610a6957806001600160a01b031663f39b5b9b836001426040518463ffffffff1660e01b815260040180838152602001828152602001925050506020604051808303818588803b158015610a3957600080fd5b505af1158015610a4d573d6000803e3d6000fd5b50505050506040513d6020811015610a6457600080fd5b505191505b505b90505b9392505050565b6000610aa56001600160a01b03851673818e6fecd516ecc3849daf6845e3ec868087b7558463ffffffff61311a16565b73818e6fecd516ecc3849daf6845e3ec868087b7556329589f61610ad16001600160a01b038716612dff565b610adc576000610ade565b835b610af0876001600160a01b0316612dff565b610afa5786610b10565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b85610b23886001600160a01b0316612dff565b610b2d5787610b43565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b604080516001600160e01b031960e088901b1681526001600160a01b039485166004820152602481019390935292166044820152306064820152600160ff1b6084820152600060a48201819052734d37f28d2db99e8d35a6c725a5f1749a085850a360c483015261010060e4830152610104820152905161014480830192602092919082900301818588803b158015610bdb57600080fd5b505af1158015610bef573d6000803e3d6000fd5b50505050506040513d6020811015610c0657600080fd5b5051949350505050565b6000807352ae12abe5d8bd778bd5397f99ca900624cfadd46001600160a01b031663bb34534c6040518163ffffffff1660e01b815260040180806c42616e636f724e6574776f726b60981b815250602001905060206040518083038186803b158015610c7b57600080fd5b505afa158015610c8f573d6000803e3d6000fd5b505050506040513d6020811015610ca557600080fd5b505190506060736f0cd8c4f6f06eab664c7e3031909452b4b728616375e1cc82610cd76001600160a01b038916612dff565b610ce15787610cf7565b73c0829421c1d260bd3cb3e0f06cfe2d52db2ce3155b610d09886001600160a01b0316612dff565b610d135787610d29565b73c0829421c1d260bd3cb3e0f06cfe2d52db2ce3155b6040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b03168152602001826001600160a01b03166001600160a01b031681526020019250505060006040518083038186803b158015610d8857600080fd5b505afa158015610d9c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015610dc557600080fd5b8101908080516040519392919084600160201b821115610de457600080fd5b908301906020820185811115610df957600080fd5b82518660208202830111600160201b82111715610e1557600080fd5b82525081516020918201928201910280838360005b83811015610e42578181015183820152602001610e2a565b505050509050016040525050509050610e6f8285886001600160a01b031661311a9092919063ffffffff16565b816001600160a01b031663f3898a97610e90886001600160a01b0316612dff565b610e9b576000610e9d565b855b838760016040518563ffffffff1660e01b81526004018080602001848152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015610efc578181015183820152602001610ee4565b505050509050019450505050506020604051808303818588803b158015610f2257600080fd5b505af1158015610f36573d6000803e3d6000fd5b50505050506040513d6020811015610f4d57600080fd5b50519695505050505050565b6000610f6d846001600160a01b0316612dff565b15610fd5576000805160206146578339815191526001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b158015610fbb57600080fd5b505af1158015610fcf573d6000803e3d6000fd5b50505050505b6000610fe9856001600160a01b0316612dff565b610ff35784611003565b6000805160206146578339815191525b90506110336001600160a01b03821673794e6e91555438afc3ccf1c5076a74f42133d08d8563ffffffff61311a16565b600073794e6e91555438afc3ccf1c5076a74f42133d08d630621b4f66110616001600160a01b038916612dff565b61106b578761107b565b6000805160206146578339815191525b8661108e896001600160a01b0316612dff565b61109857886110a8565b6000805160206146578339815191525b604080516001600160e01b031960e087901b1681526001600160a01b03948516600482015260248101939093529216604482015260016064820152905160848083019260209291908290030181600087803b15801561110657600080fd5b505af115801561111a573d6000803e3d6000fd5b505050506040513d602081101561113057600080fd5b505190506111466001600160a01b038616612dff565b1561122157604080516370a0823160e01b8152306004820152905160008051602061465783398151915291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b15801561119e57600080fd5b505afa1580156111b2573d6000803e3d6000fd5b505050506040513d60208110156111c857600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b15801561120857600080fd5b505af115801561121c573d6000803e3d6000fd5b505050505b95945050505050565b6000806001600160a01b0385166000805160206146e383398151915214611252576000611255565b60025b6001600160a01b0386166000805160206146778339815191521461127a57600061127d565b60015b0160ff16905060006000805160206146e38339815191526001600160a01b038616146112aa5760006112ad565b60025b6001600160a01b038616600080516020614677833981519152146112d25760006112d5565b60015b0160ff16905081600f0b600014806112f0575080600f0b6000145b1561130057600092505050610a6e565b61132e6001600160a01b03871673a2b47e3d5c44877cca798226b7b8118f9bfb7a568663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b602482015260448101869052600060648201819052915173a2b47e3d5c44877cca798226b7b8118f9bfb7a569263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b505af11580156113b8573d6000803e3d6000fd5b5050505050509392505050565b6000806001600160a01b03851673dac17f958d2ee523a2206206994597c13d831ec7146113f35760006113f6565b60035b6001600160a01b0386166000805160206146e38339815191521461141b57600061141e565b60025b6001600160a01b03871660008051602061467783398151915214611443576000611446565b60015b010160ff169050600073dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316856001600160a01b031614611483576000611486565b60035b6001600160a01b0386166000805160206146e3833981519152146114ab5760006114ae565b60025b6001600160a01b038716600080516020614677833981519152146114d35760006114d6565b60015b010160ff16905081600f0b600014806114f2575080600f0b6000145b1561150257600092505050610a6e565b6115306001600160a01b0387167352ea46506b9cc5ef470c5bf89f17dc28bb35d85c8663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517352ea46506b9cc5ef470c5bf89f17dc28bb35d85c9263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b0385166e085d4780b73119b644ae5ecd22b376146115cf5760006115d2565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146115fd576000611600565b60035b6001600160a01b0387166000805160206146e383398151915214611625576000611628565b60025b6001600160a01b0388166000805160206146778339815191521461164d576000611650565b60015b01010160ff16905060006e085d4780b73119b644ae5ecd22b3766001600160a01b0316856001600160a01b03161461168957600061168c565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146116b75760006116ba565b60035b6001600160a01b0387166000805160206146e3833981519152146116df5760006116e2565b60025b6001600160a01b0388166000805160206146778339815191521461170757600061170a565b60015b01010160ff16905081600f0b60001480611727575080600f0b6000145b1561173757600092505050610a6e565b6117656001600160a01b0387167345f783cce6b7ff23b2ab2d70e416cdb7d6055f518663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517345f783cce6b7ff23b2ab2d70e416cdb7d6055f519263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b038516734fabb145d64652a948d72533023f6e7a623c7c531461180957600061180c565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec71461183757600061183a565b60035b6001600160a01b0387166000805160206146e38339815191521461185f576000611862565b60025b6001600160a01b0388166000805160206146778339815191521461188757600061188a565b60015b01010160ff1690506000734fabb145d64652a948d72533023f6e7a623c7c536001600160a01b0316856001600160a01b0316146118c85760006118cb565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146118f65760006118f9565b60035b6001600160a01b0387166000805160206146e38339815191521461191e576000611921565b60025b6001600160a01b03881660008051602061467783398151915214611946576000611949565b60015b01010160ff16905081600f0b60001480611966575080600f0b6000145b1561197657600092505050610a6e565b6119a46001600160a01b0387167379a8c46dea5ada233abaffd40f3a0a2b1e5a4f278663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517379a8c46dea5ada233abaffd40f3a0a2b1e5a4f279263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b0385167357ab1ec28d129707052df4df418d58a2d46d5f5114611a48576000611a4b565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec714611a76576000611a79565b60035b6001600160a01b0387166000805160206146e383398151915214611a9e576000611aa1565b60025b6001600160a01b03881660008051602061467783398151915214611ac6576000611ac9565b60015b01010160ff16905060007357ab1ec28d129707052df4df418d58a2d46d5f516001600160a01b0316856001600160a01b031614611b07576000611b0a565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec714611b35576000611b38565b60035b6001600160a01b0387166000805160206146e383398151915214611b5d576000611b60565b60025b6001600160a01b03881660008051602061467783398151915214611b85576000611b88565b60015b01010160ff16905081600f0b60001480611ba5575080600f0b6000145b15611bb557600092505050610a6e565b611be36001600160a01b03871673a5407eae9ba41422680e2e00537571bcc53efbfd8663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b602482015260448101869052600060648201819052915173a5407eae9ba41422680e2e00537571bcc53efbfd9263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000611c6d846001600160a01b0316612dff565b611d36576000611c7c85613213565b9050611c986001600160a01b038616828563ffffffff61311a16565b806001600160a01b031663a0712d68846040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015611cde57600080fd5b505af1158015611cf2573d6000803e3d6000fd5b505050506040513d6020811015611d0857600080fd5b50611d2e90508185611d296001600160a01b0383163063ffffffff612f5a16565b6107e4565b915050610a6e565b611d48836001600160a01b0316612dff565b611dfd576000611d5784613213565b90506000611d668683866107e4565b9050816001600160a01b031663db006a75826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b158015611dae57600080fd5b505af1158015611dc2573d6000803e3d6000fd5b505050506040513d6020811015611dd857600080fd5b50611df490506001600160a01b0386163063ffffffff612f5a16565b92505050610a6e565b5060009392505050565b60006001600160a01b0384166000805160206146778339815191521415611efa57611e566001600160a01b0385167306af07097c9eeb7fd685c692751d5c66db49c2158463ffffffff61311a16565b60408051633b4da69f60e01b81523060048201526024810184905290517306af07097c9eeb7fd685c692751d5c66db49c21591633b4da69f91604480830192600092919082900301818387803b158015611eaf57600080fd5b505af1158015611ec3573d6000803e3d6000fd5b50611ef392507306af07097c9eeb7fd685c692751d5c66db49c2159150859050611d29823063ffffffff612f5a16565b9050610a6e565b6001600160a01b0383166000805160206146778339815191521415611dfd576000611f3a857306af07097c9eeb7fd685c692751d5c66db49c215856107e4565b6040805163ef693bed60e01b81523060048201526024810183905290519192507306af07097c9eeb7fd685c692751d5c66db49c2159163ef693bed9160448082019260009290919082900301818387803b158015611f9757600080fd5b505af1158015611fab573d6000803e3d6000fd5b50611d2e925050506001600160a01b03851630612f5a565b6000611fd7846001600160a01b0316612dff565b61211e576000611fe685613403565b905061207b73398ec7346dcd622edc5ae82352f02be94c62d1196001600160a01b031663f2f4eb266040518163ffffffff1660e01b815260040160206040518083038186803b15801561203857600080fd5b505afa15801561204c573d6000803e3d6000fd5b505050506040513d602081101561206257600080fd5b50516001600160a01b038716908563ffffffff61311a16565b60408051636968703360e11b81526001600160a01b03871660048201526024810185905261044d6044820152905173398ec7346dcd622edc5ae82352f02be94c62d1199163d2d0e06691606480830192600092919082900301818387803b1580156120e557600080fd5b505af11580156120f9573d6000803e3d6000fd5b50505050611d2e8185611d2930856001600160a01b0316612f5a90919063ffffffff16565b612130836001600160a01b0316612dff565b611dfd57600061213f84613403565b9050600061214e8683866107e4565b9050816001600160a01b031663db006a75826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561219657600080fd5b505af11580156121aa573d6000803e3d6000fd5b505050508092505050610a6e565b600080737079e8517594e5b21d2b9a0d17cb33f5fe2bca706001600160a01b031663d4b839926040518163ffffffff1660e01b815260040160206040518083038186803b15801561220857600080fd5b505afa15801561221c573d6000803e3d6000fd5b505050506040513d602081101561223257600080fd5b505190506122506001600160a01b038616828563ffffffff61311a16565b806001600160a01b031663fe029156612271876001600160a01b0316612dff565b61227c57600061227e565b845b604080516001600160e01b031960e085901b1681526001600160a01b03808b1660048301528916602482015260448101889052600060648201529051608480830192602092919082900301818588803b1580156122da57600080fd5b505af11580156122ee573d6000803e3d6000fd5b50505050506040513d602081101561230557600080fd5b505195945050505050565b6000610a6b848484613826565b6000610a6b846000805160206146578339815191528585613bd7565b6000610a6b846000805160206146778339815191528585613bd7565b6000610a6b846000805160206146e38339815191528585613bd7565b6000806001600160a01b038516738e870d67f660d95d5be530380d0ec0bd388289e11461239f5760006123a2565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec7146123cd5760006123d0565b60035b6001600160a01b0387166000805160206146e3833981519152146123f55760006123f8565b60025b6001600160a01b0388166000805160206146778339815191521461241d576000612420565b60015b01010160ff1690506000738e870d67f660d95d5be530380d0ec0bd388289e16001600160a01b0316856001600160a01b03161461245e576000612461565b60045b6001600160a01b03861673dac17f958d2ee523a2206206994597c13d831ec71461248c57600061248f565b60035b6001600160a01b0387166000805160206146e3833981519152146124b45760006124b7565b60025b6001600160a01b038816600080516020614677833981519152146124dc5760006124df565b60015b01010160ff16905081600f0b600014806124fc575080600f0b6000145b1561250c57600092505050610a6e565b61253a6001600160a01b0387167306364f10b501e868329afbc005b3492902d6c7638663ffffffff61311a16565b60408051635320bf6b60e11b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517306364f10b501e868329afbc005b3492902d6c7639263a6417ed6926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b038516732260fac5e5542a773aa44fbcfedf7c193bc2c599146125de5760006125e1565b60025b6001600160a01b03861673eb4c2781e4eba804ce9a9803c67d0893436bb27d1461260c57600061260f565b60015b0160ff1690506000732260fac5e5542a773aa44fbcfedf7c193bc2c5996001600160a01b03861614612642576000612645565b60025b6001600160a01b03861673eb4c2781e4eba804ce9a9803c67d0893436bb27d14612670576000612673565b60015b0160ff16905081600f0b6000148061268e575080600f0b6000145b1561269e57600092505050610a6e565b6126cc6001600160a01b0387167393054188d876f558f4a66b2ef1d97d16edf0895b8663ffffffff61311a16565b60408051630f7c084960e21b8152600019808501600f90810b810b6004840152908401810b900b60248201526044810186905260006064820181905291517393054188d876f558f4a66b2ef1d97d16edf0895b92633df02124926084808201939182900301818387803b1580156113a457600080fd5b6000806001600160a01b038516730316eb71485b0ab14103307bf65a021042c6d38014612770576000612773565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c5991461279e5760006127a1565b60025b6001600160a01b038716731bbe271d15bb64df0bc6cd28df9ff322f2ebd847146127cc5760006127cf565b60015b010160ff1690506000730316eb71485b0ab14103307bf65a021042c6d3806001600160a01b0316856001600160a01b03161461280c57600061280f565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c5991461283a57600061283d565b60025b6001600160a01b038716731bbe271d15bb64df0bc6cd28df9ff322f2ebd8471461286857600061286b565b60015b010160ff16905081600f0b60001480612887575080600f0b6000145b1561289757600092505050610a6e565b6128c56001600160a01b038716739726e9314ef1b96e45f40056bed61a088897313e8663ffffffff61311a16565b60408051630f7c084960e21b8152600019808501600f90810b810b6004840152908401810b900b6024820152604481018690526000606482018190529151739726e9314ef1b96e45f40056bed61a088897313e92633df02124926084808201939182900301818387803b1580156113a457600080fd5b600061296b6001600160a01b0385167303ef3f37856bd08eb47e2de7abc4ddd2c19b60f28463ffffffff61311a16565b60408051630df791e560e41b81526001600160a01b038681166004830152851660248201526044810184905290517303ef3f37856bd08eb47e2de7abc4ddd2c19b60f29163df791e5091606480830192600092919082900301818387803b1580156129d557600080fd5b505af11580156129e9573d6000803e3d6000fd5b505050509392505050565b6000612a246001600160a01b03851673a8253a440be331dc4a7395b73948cca6f19dc97d8463ffffffff61311a16565b604080516303ff4c0160e31b81526001600160a01b0386811660048301528516602482015260448101849052600060648201819052603242016084830152915173a8253a440be331dc4a7395b73948cca6f19dc97d92631ffa60089260a480820193602093909283900390910190829087803b158015612aa357600080fd5b505af1158015612ab7573d6000803e3d6000fd5b505050506040513d6020811015610c0657600080fd5b6000612afd6001600160a01b03851673e2f2a5c287993345a840db3b0845fbc70f5935a58463ffffffff61311a16565b60408051631ba0488760e21b81526001600160a01b0386811660048301528516602482015260448101849052306064820152905173e2f2a5c287993345a840db3b0845fbc70f5935a591636e81221c9160848083019260209291908290030181600087803b158015612aa357600080fd5b6000806001600160a01b03851673fe18be6b3bd88a2d2a7f928d00292e7a9963cfc614612b9c576000612b9f565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c59914612bca576000612bcd565b60025b6001600160a01b03871673eb4c2781e4eba804ce9a9803c67d0893436bb27d14612bf8576000612bfb565b60015b010160ff169050600073fe18be6b3bd88a2d2a7f928d00292e7a9963cfc66001600160a01b0316856001600160a01b031614612c38576000612c3b565b60035b6001600160a01b038616732260fac5e5542a773aa44fbcfedf7c193bc2c59914612c66576000612c69565b60025b6001600160a01b03871673eb4c2781e4eba804ce9a9803c67d0893436bb27d14612c94576000612c97565b60015b010160ff16905081600f0b60001480612cb3575080600f0b6000145b15612cc357600092505050610a6e565b612cf16001600160a01b038716737fc77b5c7614e1533320ea6ddc2eb61fa00a97148663ffffffff61311a16565b60408051630f7c084960e21b8152600019808501600f90810b810b6004840152908401810b900b6024820152604481018690526000606482018190529151737fc77b5c7614e1533320ea6ddc2eb61fa00a971492633df02124926084808201939182900301818387803b1580156113a457600080fd5b6000612d768484846000613bee565b509392505050565b6000612d768484846001613bee565b6000612d768484846002613bee565b600082820183811015612df6576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b90505b92915050565b60006001600160a01b0382161580612e3357506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b90505b919050565b80612e4557612f54565b612e4e84612dff565b15612f39576001600160a01b03831633148015612e6b5750803410155b612ea65760405162461bcd60e51b815260040180806020018281038252602b815260200180614697602b913960400191505060405180910390fd5b6001600160a01b0382163014612eee576040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612eec573d6000803e3d6000fd5b505b80341115612f3457336108fc612f0a348463ffffffff61408316565b6040518115909202916000818181858888f19350505050158015612f32573d6000803e3d6000fd5b505b612f54565b612f546001600160a01b03851684848463ffffffff6140c516565b50505050565b6000612f6583612dff565b15612f7b57506001600160a01b03811631612df9565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b158015612fd157600080fd5b505afa158015612fe5573d6000803e3d6000fd5b505050506040513d6020811015612ffb57600080fd5b50519050612df9565b60008261301357506000612df9565b8282028284828161302057fe5b0414612df65760405162461bcd60e51b81526004018080602001828103825260218152602001806146c26021913960400191505060405180910390fd5b6000612df683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061411f565b6000816130ae57506001610a6e565b6130b784612dff565b156130f8576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156130f2573d6000803e3d6000fd5b50610a6e565b6131126001600160a01b038516848463ffffffff6141c116565b506001610a6e565b61312383612dff565b61320e578061314c576131476001600160a01b03841683600063ffffffff61421316565b61320e565b60408051636eb1769f60e11b81523060048201526001600160a01b038481166024830152915160009286169163dd62ed3e916044808301926020929190829003018186803b15801561319d57600080fd5b505afa1580156131b1573d6000803e3d6000fd5b505050506040513d60208110156131c757600080fd5b5051905081811015612f545780156131f4576131f46001600160a01b03851684600063ffffffff61421316565b612f546001600160a01b038516848463ffffffff61421316565b505050565b6000613227826001600160a01b0316612dff565b156132475750734ddc2d193948926d02f9b1fe9e1daa0718270ed5612e36565b6001600160a01b03821660008051602061467783398151915214156132815750735d3a536e4d6dbd6114cc1ead35777bab948e3643612e36565b6001600160a01b038216730d8775f648430679a709e98d2b0cb6250d2887ef14156132c15750736c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e612e36565b6001600160a01b038216731985365e9f78359a9b6ad760e32412f4a445e8621415613301575073158079ee67fce2f58472a96584a73c7ab9ac95c1612e36565b6001600160a01b0382166000805160206146e3833981519152141561333b57507339aa39c021dfbae8fac545936693ac917d5e7563612e36565b6001600160a01b038216732260fac5e5542a773aa44fbcfedf7c193bc2c599141561337b575073c11b1268c1a384e55c48c2391d8d480264a3a7f4612e36565b6001600160a01b03821673e41d2489571d322189246dafa5ebde1f4699f49814156133bb575073b3319f5d18bc0d84dd1b4825dcde5d5f7266d407612e36565b6001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec714156133fb575073f650c3d88d12db855b8bf7d11be6c55a4e07dcc9612e36565b506000919050565b6000613417826001600160a01b0316612dff565b156134375750733a3a65aab0dd2a17e3f1947ba16138cd37d08c04612e36565b6001600160a01b0382166000805160206146778339815191521415613471575073fc1e690f61efd961294b3e1ce3313fbd8aa4f85d612e36565b6001600160a01b0382166000805160206146e383398151915214156134ab5750739ba00d6856a4edf4665bca2c2309936572473b7e612e36565b6001600160a01b0382167357ab1ec28d129707052df4df418d58a2d46d5f5114156134eb575073625ae63000f46200499120b906716420bd059240612e36565b6001600160a01b038216734fabb145d64652a948d72533023f6e7a623c7c53141561352b5750736ee0f7bb50a54ab5253da0667b0dc2ee526c30a8612e36565b6001600160a01b0382166e085d4780b73119b644ae5ecd22b37614156135665750734da9b813057d04baef4e5800e36083717b4a0341612e36565b6001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec714156135a657507371fc860f7d3a592a4a98740e39db31d25db65ae8612e36565b6001600160a01b038216730d8775f648430679a709e98d2b0cb6250d2887ef14156135e6575073e1ba0fb44ccb0d11b80f92f4f8ed94ca3ff51d00612e36565b6001600160a01b03821673dd974d5c2e2928dea5f71b9825b8b646686bd20014156136265750739d91be44c06d373a8a226e1f3b146956083803eb612e36565b6001600160a01b0382167380fb784b7ed66730e8b1dbd9820afd29931aab0314156136665750737d2d3688df45ce7c552e19c27e007673da9204b8612e36565b6001600160a01b03821673514910771af9ca656af840dff83e8264ecf986ca14156136a6575073a64bd6c70cb9051f6a9ba1f163fdc07e0dfb5f84612e36565b6001600160a01b038216730f5d2fb29fb7d3cfee444a200298f468908cc94214156136e65750736fce4a401b6b80ace52baaefe4421bd188e76f6f612e36565b6001600160a01b038216739f8f72aa9304c8b593d555f12ef6589cc3a579a214156137265750737deb5e830be29f91e298ba5ff1356bb7f8146998612e36565b6001600160a01b038216731985365e9f78359a9b6ad760e32412f4a445e862141561376657507371010a9d003445ac60c4e6a7017c1e89a477b438612e36565b6001600160a01b03821673c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f14156137a6575073328c4c80bc7aca0834db37e6600a6c49e12da4de612e36565b6001600160a01b038216732260fac5e5542a773aa44fbcfedf7c193bc2c59914156137e6575073fc4b8ed459e00e5400be803a9bb3954234fd50e3612e36565b6001600160a01b03821673e41d2489571d322189246dafa5ebde1f4699f49814156133fb5750736fb0855c404e09c47c3fbca25f08d4e41f9f062f612e36565b600061383a846001600160a01b0316612dff565b156138a2576000805160206146578339815191526001600160a01b031663d0e30db0836040518263ffffffff1660e01b81526004016000604051808303818588803b15801561388857600080fd5b505af115801561389c573d6000803e3d6000fd5b50505050505b60006138b6856001600160a01b0316612dff565b6138c057846138d0565b6000805160206146578339815191525b905060006138e6856001600160a01b0316612dff565b6138f05784613900565b6000805160206146578339815191525b6040805163e6a4390560e01b81526001600160a01b038581166004830152831660248201529051919250600091735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f9163e6a43905916044808301926020929190829003018186803b15801561396857600080fd5b505afa15801561397c573d6000803e3d6000fd5b505050506040513d602081101561399257600080fd5b505190506139b16001600160a01b03821684848863ffffffff61432616565b93506139cd6001600160a01b038416828763ffffffff61309f16565b50816001600160a01b0316836001600160a01b03161015613a66576040805163022c0d9f60e01b815260006004820181905260248201879052306044830152608060648301526084820181905291516001600160a01b0384169263022c0d9f9260c4808201939182900301818387803b158015613a4957600080fd5b505af1158015613a5d573d6000803e3d6000fd5b50505050613ae0565b6040805163022c0d9f60e01b815260048101869052600060248201819052306044830152608060648301526084820181905291516001600160a01b0384169263022c0d9f9260c4808201939182900301818387803b158015613ac757600080fd5b505af1158015613adb573d6000803e3d6000fd5b505050505b613af2866001600160a01b0316612dff565b15613bcd57604080516370a0823160e01b8152306004820152905160008051602061465783398151915291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b158015613b4a57600080fd5b505afa158015613b5e573d6000803e3d6000fd5b505050506040513d6020811015613b7457600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b158015613bb457600080fd5b505af1158015613bc8573d6000803e3d6000fd5b505050505b5050509392505050565b60006112218484613be9888887613826565b613826565b600060607365e67cbc342712df67494acefc06fe951ee9398263bfdbfc43613c1e6001600160a01b038916612dff565b613c285787613c38565b6000805160206146578339815191525b613c4a886001600160a01b0316612dff565b613c545787613c64565b6000805160206146578339815191525b866001016040518463ffffffff1660e01b815260040180846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b03168152602001828152602001935050505060006040518083038186803b158015613cce57600080fd5b505afa158015613ce2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526020811015613d0b57600080fd5b8101908080516040519392919084600160201b821115613d2a57600080fd5b908301906020820185811115613d3f57600080fd5b82518660208202830111600160201b82111715613d5b57600080fd5b82525081516020918201928201910280838360005b83811015613d88578181015183820152602001613d70565b505050509050016040525050509050613da9866001600160a01b0316612dff565b15613e11576000805160206146578339815191526001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b158015613df757600080fd5b505af1158015613e0b573d6000803e3d6000fd5b50505050505b613e6b818481518110613e2057fe5b602002602001015185613e3b896001600160a01b0316612dff565b613e455788613e55565b6000805160206146578339815191525b6001600160a01b0316919063ffffffff61311a16565b808381518110613e7757fe5b60200260200101516001600160a01b0316638201aa3f613e9f886001600160a01b0316612dff565b613ea95787613eb9565b6000805160206146578339815191525b86613ecc896001600160a01b0316612dff565b613ed65788613ee6565b6000805160206146578339815191525b60006000196040518663ffffffff1660e01b815260040180866001600160a01b03166001600160a01b03168152602001858152602001846001600160a01b03166001600160a01b03168152602001838152602001828152602001955050505050506040805180830381600087803b158015613f6057600080fd5b505af1158015613f74573d6000803e3d6000fd5b505050506040513d6040811015613f8a57600080fd5b50613f9f90506001600160a01b038616612dff565b1561407a57604080516370a0823160e01b8152306004820152905160008051602061465783398151915291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b158015613ff757600080fd5b505afa15801561400b573d6000803e3d6000fd5b505050506040513d602081101561402157600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b15801561406157600080fd5b505af1158015614075573d6000803e3d6000fd5b505050505b50949350505050565b6000612df683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506143dd565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052612f54908590614437565b600081836141ab5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614170578181015183820152602001614158565b50505050905090810190601f16801561419d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816141b757fe5b0495945050505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261320e908490614437565b801580614299575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561426b57600080fd5b505afa15801561427f573d6000803e3d6000fd5b505050506040513d602081101561429557600080fd5b5051155b6142d45760405162461bcd60e51b81526004018080602001828103825260368152602001806147536036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b17905261320e908490614437565b6000806143426001600160a01b0386168763ffffffff612f5a16565b9050600061435f6001600160a01b0386168863ffffffff612f5a16565b90506000614375856103e563ffffffff61300416565b90506000614389828463ffffffff61300416565b905060006143af836143a3876103e863ffffffff61300416565b9063ffffffff612d9c16565b905080156143cc576143c7828263ffffffff61305d16565b6143cf565b60005b9a9950505050505050505050565b6000818484111561442f5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315614170578181015183820152602001614158565b505050900390565b614449826001600160a01b03166145ef565b61449a576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106144d85780518252601f1990920191602091820191016144b9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461453a576040519150601f19603f3d011682016040523d82523d6000602084013e61453f565b606091505b509150915081614596576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115612f54578080602001905160208110156145b257600080fd5b5051612f545760405162461bcd60e51b815260040180806020018281038252602a815260200180614729602a913960400191505060405180910390fd5b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061462357508115155b949350505050565b604051806103600160405280601b905b61465481526020019060019003908161463b5790505090565bfefe000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000006b175474e89094c44da98b954eedeac495271d0f57726f6e6720757365616765206f66204554482e756e6976657273616c5472616e7366657246726f6d2829536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb484f6e6553706c69743a2052657475726e20616d6f756e7420776173206e6f7420656e6f7567685361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e63654f6e6553706c69743a20446973747269627574696f6e2061727261792073686f756c64206e6f74206578636565642072657365727665732061727261792073697a65a265627a7a723158200c4af721552effba7f39a40538f0a0a0fc023e83e9bd0298755ffabcb468bb0a64736f6c63430005110032
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000002fdac0084b40d7c259a284d72e8ee43930262266
-----Decoded View---------------
Arg [0] : _oneSplitView (address): 0x2Fdac0084B40D7C259a284d72e8eE43930262266
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000002fdac0084b40d7c259a284d72e8ee43930262266
Deployed Bytecode Sourcemap
102040:20912:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;102343:10;102357:9;102343:23;;102335:32;;;;;;102040:20912;102383:515;;8:9:-1;5:2;;;30:1;27;20:12;5:2;102383:515:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;102383:515:0;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;102383:515:0;;;;;;;;;;;;;;;;;;102906:627;;8:9:-1;5:2;;;30:1;27;20:12;5:2;102906:627:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;102906:627:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;102906:627:0;;;;;;;;;;;;;;;;;;;103541:2853;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;103541:2853:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;103541:2853:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;103541:2853:0;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;-1:-1;;;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;103541:2853:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;103541:2853:0;;-1:-1:-1;;103541:2853:0;;;-1:-1:-1;103541:2853:0;;-1:-1:-1;;103541:2853:0:i;:::-;;;;;;;;;;;;;;;;102092:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;102092:33:0;;;:::i;:::-;;;;-1:-1:-1;;;;;102092:33:0;;;;;;;;;;;;;;102383:515;102605:20;102640:29;102730:160;102769:9;102793;102817:6;102838:5;102858;102878:1;102730:24;:160::i;:::-;102697:193;;;;-1:-1:-1;102383:515:0;;-1:-1:-1;;;;;;;102383:515:0:o;102906:627::-;103184:20;103323:12;;:202;;;-1:-1:-1;;;103323:202:0;;-1:-1:-1;;;;;103323:202:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;103184:20;;103259:29;;103323:12;;:37;;:202;;;;;103184:20;;103323:202;;;;;;;:12;:202;;;5:2:-1;;;;30:1;27;20:12;5:2;103323:202:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;103323:202:0;;;;;;39:16:-1;36:1;17:17;2:54;101:4;103323:202:0;80:15:-1;;;-1:-1;;76:31;65:43;;120:4;113:20;13:2;5:11;;2:2;;;29:1;26;19:12;2:2;103323:202:0;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;11:20;;8:2;;;44:1;41;34:12;8:2;62:21;;;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;219:3;213:10;331:9;325:2;311:12;307:21;289:16;285:44;282:59;-1:-1;;;247:12;244:29;233:116;230:2;;;362:1;359;352:12;230:2;373:25;;-1:-1;103323:202:0;;421:4:-1;412:14;;;;103323:202:0;;;;;412:14:-1;103323:202:0;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;103323:202:0;;;;;;;;;;;103316:209;;;;;;102906:627;;;;;;;;;;:::o;103541:2853::-;103795:20;103845:9;-1:-1:-1;;;;;103832:22:0;:9;-1:-1:-1;;;;;103832:22:0;;103828:68;;;-1:-1:-1;103878:6:0;103871:13;;103828:68;103908:77;;:::i;:::-;:944;;;;;;;;104003:14;103908:944;;;;104032:12;103908:944;;;;104059:13;103908:944;;;;104087:12;103908:944;;;;104114:20;103908:944;;;;104149:16;103908:944;;;;104180:13;103908:944;;;;104208:19;103908:944;;;;104242:21;103908:944;;;;104278:22;103908:944;;;;104315:18;103908:944;;;;104348:18;103908:944;;;;104381:16;103908:944;;;;104412:16;103908:944;;;;104443:19;103908:944;;;;104477:19;103908:944;;;;104511:20;103908:944;;;;104546:15;103908:944;;;;104576:18;103908:944;;;;104609:16;103908:944;;;;104640:17;103908:944;;;;104672:12;103908:944;;;;104699:18;103908:944;;;;104732:16;103908:944;;;;104763:16;103908:944;;;;104794:16;103908:944;;;;104825:16;103908:944;;;;;104896:15;104873:12;:19;:38;;104865:117;;;;-1:-1:-1;;;104865:117:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;104995:13;;;105062:206;105083:12;:19;105079:1;:23;105062:206;;;105146:1;105128:12;105141:1;105128:15;;;;;;;;;;;;;;:19;105124:133;;;105176:26;105186:12;105199:1;105186:15;;;;;;;;;;;;;;105176:5;:9;;:26;;;;:::i;:::-;105168:34;;105240:1;105221:20;;105124:133;105104:3;;105062:206;;;-1:-1:-1;105284:10:0;105280:193;;105315:17;:9;-1:-1:-1;;;;;105315:15:0;;:17::i;:::-;105311:123;;;105353:30;;:10;;105373:9;105353:30;;;;;;;;;105373:9;105353:10;:30;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;105353:30:0;105409:9;105402:16;;;;;;;105311:123;105455:6;105448:13;;;;;;;105280:193;105485:66;-1:-1:-1;;;;;105485:31:0;;105517:10;105537:4;105544:6;105485:66;:31;:66;:::i;:::-;105562:23;105588:43;-1:-1:-1;;;;;105588:28:0;;105625:4;105588:43;:28;:43;:::i;:::-;105562:69;-1:-1:-1;105649:6:0;105644:426;105665:12;:19;105661:1;:23;105644:426;;;105710:12;105723:1;105710:15;;;;;;;;;;;;;;105729:1;105710:20;105706:69;;;105751:8;;105706:69;105791:18;105812:38;105844:5;105812:27;105823:12;105836:1;105823:15;;;;;;;;;;;;;;105812:6;:10;;:27;;;;:::i;:::-;:31;:38;:31;:38;:::i;:::-;105791:59;;105874:16;105869:1;:21;105865:90;;;-1:-1:-1;105924:15:0;105865:90;105988:10;105969:29;;;;106013:45;106025:9;106036;106047:10;106013:8;106022:1;106013:11;;;;;;;;;;;:45;;:::i;:::-;;105644:426;;105686:3;;105644:426;;;-1:-1:-1;106097:43:0;-1:-1:-1;;;;;106097:28:0;;106134:4;106097:43;:28;:43;:::i;:::-;106082:58;;106175:9;106159:12;:25;;106151:76;;;;-1:-1:-1;;;106151:76:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;106238:53;-1:-1:-1;;;;;106238:27:0;;106266:10;106278:12;106238:53;:27;:53;:::i;:::-;-1:-1:-1;106302:84:0;106330:10;106342:43;-1:-1:-1;;;;;106342:28:0;;106379:4;106342:43;:28;:43;:::i;:::-;-1:-1:-1;;;;;106302:27:0;;;:84;;:27;:84;:::i;:::-;;103541:2853;;;;;;;;;;;;;:::o;102092:33::-;;;-1:-1:-1;;;;;102092:33:0;;:::o;113183:882::-;113310:7;113355:6;113379:17;-1:-1:-1;;;;;113379:15:0;;;:17::i;:::-;113374:361;;113445:37;;;-1:-1:-1;;;113445:37:0;;-1:-1:-1;;;;;113445:37:0;;;;;;;;113413:29;;47353:42;;113445:26;;:37;;;;;;;;;;;;;;;47353:42;113445:37;;;5:2:-1;;;;30:1;27;20:12;5:2;113445:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;113445:37:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;113445:37:0;;-1:-1:-1;;;;;;113501:35:0;;;113497:227;;113557:63;-1:-1:-1;;;;;113557:26:0;;113592:12;113607;113557:63;:26;:63;:::i;:::-;113654:54;;;-1:-1:-1;;;113654:54:0;;;;;;;;113701:1;113654:54;;;;113704:3;113654:54;;;;;;-1:-1:-1;;;;;113654:32:0;;;;;:54;;;;;;;;;;;;;;-1:-1:-1;113654:32:0;:54;;;5:2:-1;;;;30:1;27;20:12;5:2;113654:54:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;113654:54:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;113654:54:0;;-1:-1:-1;113497:227:0;113374:361;;113752:17;:9;-1:-1:-1;;;;;113752:15:0;;:17::i;:::-;113747:279;;113816:37;;;-1:-1:-1;;;113816:37:0;;-1:-1:-1;;;;;113816:37:0;;;;;;;;113786:27;;47353:42;;113816:26;;:37;;;;;;;;;;;;;;;47353:42;113816:37;;;5:2:-1;;;;30:1;27;20:12;5:2;113816:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;113816:37:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;113816:37:0;;-1:-1:-1;;;;;;113872:33:0;;;113868:147;;113941:10;-1:-1:-1;;;;;113941:30:0;;113978:12;113992:1;113995:3;113941:58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;113941:58:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;113941:58:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;113941:58:0;;-1:-1:-1;113868:147:0;113747:279;;114045:12;-1:-1:-1;113183:882:0;;;;;;:::o;116845:591::-;116970:7;116990:62;-1:-1:-1;;;;;116990:26:0;;47236:42;117045:6;116990:62;:26;:62;:::i;:::-;47236:42;117070:31;117108:17;-1:-1:-1;;;;;117108:15:0;;;:17::i;:::-;:30;;117137:1;117108:30;;;117128:6;117108:30;117154:17;:9;-1:-1:-1;;;;;117154:15:0;;:17::i;:::-;:43;;117188:9;117154:43;;;45564:42;117154:43;117212:6;117233:17;:9;-1:-1:-1;;;;;117233:15:0;;:17::i;:::-;:43;;117267:9;117233:43;;;45564:42;117233:43;117070:358;;;-1:-1:-1;;;;;;117070:358:0;;;;;;;-1:-1:-1;;;;;117070:358:0;;;;;;;;;;;;;;;;;;;;117299:4;117070:358;;;;-1:-1:-1;;;117070:358:0;;;;117342:1;117070:358;;;;;;117358:42;117070:358;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5:2:-1;;;;30:1;27;20:12;5:2;117070:358:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;117070:358:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;117070:358:0;;116845:591;-1:-1:-1;;;;116845:591:0:o;117444:621::-;117570:7;117590:28;47494:42;-1:-1:-1;;;;;117636:32:0;;:49;;;;;;;;;;;;;-1:-1:-1;;;117636:49:0;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;117636:49:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;117636:49:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;117636:49:0;;-1:-1:-1;117697:21:0;47638:42;117721:36;117772:17;-1:-1:-1;;;;;117772:15:0;;;:17::i;:::-;:48;;117811:9;117772:48;;;45689:42;117772:48;117835:17;:9;-1:-1:-1;;;;;117835:15:0;;:17::i;:::-;:48;;117874:9;117835:48;;;45689:42;117835:48;117721:173;;;;;;;;;;;;;-1:-1:-1;;;;;117721:173:0;-1:-1:-1;;;;;117721:173:0;;;;;;-1:-1:-1;;;;;117721:173:0;-1:-1:-1;;;;;117721:173:0;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;117721:173:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;117721:173:0;;;;;;39:16:-1;36:1;17:17;2:54;101:4;117721:173:0;80:15:-1;;;-1:-1;;76:31;65:43;;120:4;113:20;13:2;5:11;;2:2;;;29:1;26;19:12;2:2;117721:173:0;;;;;;;;;;;;;-1:-1:-1;;;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;219:3;213:10;331:9;325:2;311:12;307:21;289:16;285:44;282:59;-1:-1;;;247:12;244:29;233:116;230:2;;;362:1;359;352:12;230:2;373:25;;-1:-1;117721:173:0;;421:4:-1;412:14;;;;117721:173:0;;;;;412:14:-1;117721:173:0;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;117721:173:0;;;;;;;;;;;117697:197;;117905:58;117940:13;117956:6;117905:9;-1:-1:-1;;;;;117905:26:0;;;:58;;;;;:::i;:::-;117981:13;-1:-1:-1;;;;;117981:21:0;;118009:17;:9;-1:-1:-1;;;;;118009:15:0;;:17::i;:::-;:30;;118038:1;118009:30;;;118029:6;118009:30;118041:4;118047:6;118055:1;117981:76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;117981:76:0;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;117981:76:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;117981:76:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;117981:76:0;;117444:621;-1:-1:-1;;;;;;117444:621:0:o;118073:722::-;118198:7;118222:17;:9;-1:-1:-1;;;;;118222:15:0;;:17::i;:::-;118218:78;;;-1:-1:-1;;;;;;;;;;;;;;;;118256:12:0;;118275:6;118256:28;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;118256:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;118256:28:0;;;;;118218:78;118308:19;118330:17;:9;-1:-1:-1;;;;;118330:15:0;;:17::i;:::-;:36;;118357:9;118330:36;;;-1:-1:-1;;;;;;;;;;;118330:36:0;118308:58;-1:-1:-1;118377:61:0;-1:-1:-1;;;;;118377:29:0;;48009:42;118431:6;118377:61;:29;:61;:::i;:::-;118449:20;48009:42;118472:27;118514:17;-1:-1:-1;;;;;118514:15:0;;;:17::i;:::-;:36;;118541:9;118514:36;;;-1:-1:-1;;;;;;;;;;;118514:36:0;118565:6;118586:17;:9;-1:-1:-1;;;;;118586:15:0;;:17::i;:::-;:36;;118613:9;118586:36;;;-1:-1:-1;;;;;;;;;;;118586:36:0;118472:177;;;-1:-1:-1;;;;;;118472:177:0;;;;;;;-1:-1:-1;;;;;118472:177:0;;;;;;;;;;;;;;;;;;;;118637:1;118472:177;;;;;;;;;;;;;;;;;;;;-1:-1:-1;118472:177:0;;;;5:2:-1;;;;30:1;27;20:12;5:2;118472:177:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;118472:177:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;118472:177:0;;-1:-1:-1;118666:17:0;-1:-1:-1;;;;;118666:15:0;;;:17::i;:::-;118662:94;;;118714:29;;;-1:-1:-1;;;118714:29:0;;118737:4;118714:29;;;;;;-1:-1:-1;;;;;;;;;;;45776:42:0;118700:13;;45776:42;;118714:14;;:29;;;;;;;;;;;;;;45776:42;118714:29;;;5:2:-1;;;;30:1;27;20:12;5:2;118714:29:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;118714:29:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;118714:29:0;118700:44;;;-1:-1:-1;;;;;;118700:44:0;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;118700:44:0;;;;;;;-1:-1:-1;118700:44:0;;;;5:2:-1;;;;30:1;27;20:12;5:2;118700:44:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;118700:44:0;;;;118662:94;118775:12;118073:722;-1:-1:-1;;;;;118073:722:0:o;106425:513::-;106558:7;;-1:-1:-1;;;;;106619:17:0;;-1:-1:-1;;;;;;;;;;;106619:17:0;:25;;106643:1;106619:25;;;106639:1;106619:25;-1:-1:-1;;;;;106590:16:0;;-1:-1:-1;;;;;;;;;;;106590:16:0;:24;;106613:1;106590:24;;;106609:1;106590:24;106589:56;106578:67;;;-1:-1:-1;106656:8:0;-1:-1:-1;;;;;;;;;;;;;;;;106697:17:0;;;:25;;106721:1;106697:25;;;106717:1;106697:25;-1:-1:-1;;;;;106668:16:0;;-1:-1:-1;;;;;;;;;;;106668:16:0;:24;;106691:1;106668:24;;;106687:1;106668:24;106667:56;106656:67;;;;106738:1;:6;;106743:1;106738:6;:16;;;;106748:1;:6;;106753:1;106748:6;106738:16;106734:57;;;106778:1;106771:8;;;;;;106734:57;106803:58;-1:-1:-1;;;;;106803:26:0;;48107:42;106854:6;106803:58;:26;:58;:::i;:::-;106872;;;-1:-1:-1;;;106872:58:0;;-1:-1:-1;;106906:5:0;;;106872:58;;;;;;;;;;106913:5;;;106872:58;;;;;;;;;;;;;;106928:1;106872:58;;;;;;;;48107:42;;106872:33;;:58;;;;;;;;;;;106928:1;48107:42;106872:58;;;5:2:-1;;;;30:1;27;20:12;5:2;106872:58:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;106872:58:0;;;;106425:513;;;;;;;:::o;106946:613::-;107075:7;;-1:-1:-1;;;;;107192:17:0;;46217:42;107192:17;:25;;107216:1;107192:25;;;107212:1;107192:25;-1:-1:-1;;;;;107149:17:0;;-1:-1:-1;;;;;;;;;;;107149:17:0;:25;;107173:1;107149:25;;;107169:1;107149:25;-1:-1:-1;;;;;107107:16:0;;-1:-1:-1;;;;;;;;;;;107107:16:0;:24;;107130:1;107107:24;;;107126:1;107107:24;107106:69;:112;107095:123;;;;107229:8;46217:42;-1:-1:-1;;;;;107326:17:0;:9;-1:-1:-1;;;;;107326:17:0;;:25;;107350:1;107326:25;;;107346:1;107326:25;-1:-1:-1;;;;;107283:17:0;;-1:-1:-1;;;;;;;;;;;107283:17:0;:25;;107307:1;107283:25;;;107303:1;107283:25;-1:-1:-1;;;;;107241:16:0;;-1:-1:-1;;;;;;;;;;;107241:16:0;:24;;107264:1;107241:24;;;107260:1;107241:24;107240:69;:112;107229:123;;;;107367:1;:6;;107372:1;107367:6;:16;;;;107377:1;:6;;107382:1;107377:6;107367:16;107363:57;;;107407:1;107400:8;;;;;;107363:57;107432:54;-1:-1:-1;;;;;107432:26:0;;48201:42;107479:6;107432:54;:26;:54;:::i;:::-;107497;;;-1:-1:-1;;;107497:54:0;;-1:-1:-1;;107527:5:0;;;107497:54;;;;;;;;;;107534:5;;;107497:54;;;;;;;;;;;;;;107549:1;107497:54;;;;;;;;48201:42;;107497:29;;:54;;;;;;;;;;;107549:1;48201:42;107497:54;;;5:2:-1;;;;30:1;27;20:12;107567:690:0;107693:7;;-1:-1:-1;;;;;107853:17:0;;46306:42;107853:17;:25;;107877:1;107853:25;;;107873:1;107853:25;-1:-1:-1;;;;;107810:17:0;;46217:42;107810:17;:25;;107834:1;107810:25;;;107830:1;107810:25;-1:-1:-1;;;;;107767:17:0;;-1:-1:-1;;;;;;;;;;;107767:17:0;:25;;107791:1;107767:25;;;107787:1;107767:25;-1:-1:-1;;;;;107725:16:0;;-1:-1:-1;;;;;;;;;;;107725:16:0;:24;;107748:1;107725:24;;;107744:1;107725:24;107724:69;:112;:155;107713:166;;;;107890:8;46306:42;-1:-1:-1;;;;;108030:17:0;:9;-1:-1:-1;;;;;108030:17:0;;:25;;108054:1;108030:25;;;108050:1;108030:25;-1:-1:-1;;;;;107987:17:0;;46217:42;107987:17;:25;;108011:1;107987:25;;;108007:1;107987:25;-1:-1:-1;;;;;107944:17:0;;-1:-1:-1;;;;;;;;;;;107944:17:0;:25;;107968:1;107944:25;;;107964:1;107944:25;-1:-1:-1;;;;;107902:16:0;;-1:-1:-1;;;;;;;;;;;107902:16:0;:24;;107925:1;107902:24;;;107921:1;107902:24;107901:69;:112;:155;107890:166;;;;108071:1;:6;;108076:1;108071:6;:16;;;;108081:1;:6;;108086:1;108081:6;108071:16;108067:57;;;108111:1;108104:8;;;;;;108067:57;108136:51;-1:-1:-1;;;;;108136:26:0;;48292:42;108180:6;108136:51;:26;:51;:::i;:::-;108198;;;-1:-1:-1;;;108198:51:0;;-1:-1:-1;;108225:5:0;;;108198:51;;;;;;;;;;108232:5;;;108198:51;;;;;;;;;;;;;;108247:1;108198:51;;;;;;;;48292:42;;108198:26;;:51;;;;;;;;;;;108247:1;48292:42;108198:51;;;5:2:-1;;;;30:1;27;20:12;108265:708:0;108397:7;;-1:-1:-1;;;;;108557:17:0;;46395:42;108557:17;:25;;108581:1;108557:25;;;108577:1;108557:25;-1:-1:-1;;;;;108514:17:0;;46217:42;108514:17;:25;;108538:1;108514:25;;;108534:1;108514:25;-1:-1:-1;;;;;108471:17:0;;-1:-1:-1;;;;;;;;;;;108471:17:0;:25;;108495:1;108471:25;;;108491:1;108471:25;-1:-1:-1;;;;;108429:16:0;;-1:-1:-1;;;;;;;;;;;108429:16:0;:24;;108452:1;108429:24;;;108448:1;108429:24;108428:69;:112;:155;108417:166;;;;108594:8;46395:42;-1:-1:-1;;;;;108734:17:0;:9;-1:-1:-1;;;;;108734:17:0;;:25;;108758:1;108734:25;;;108754:1;108734:25;-1:-1:-1;;;;;108691:17:0;;46217:42;108691:17;:25;;108715:1;108691:25;;;108711:1;108691:25;-1:-1:-1;;;;;108648:17:0;;-1:-1:-1;;;;;;;;;;;108648:17:0;:25;;108672:1;108648:25;;;108668:1;108648:25;-1:-1:-1;;;;;108606:16:0;;-1:-1:-1;;;;;;;;;;;108606:16:0;:24;;108629:1;108606:24;;;108625:1;108606:24;108605:69;:112;:155;108594:166;;;;108775:1;:6;;108780:1;108775:6;:16;;;;108785:1;:6;;108790:1;108785:6;108775:16;108771:57;;;108815:1;108808:8;;;;;;108771:57;108840;-1:-1:-1;;;;;108840:26:0;;48389:42;108890:6;108840:57;:26;:57;:::i;:::-;108908;;;-1:-1:-1;;;108908:57:0;;-1:-1:-1;;108941:5:0;;;108908:57;;;;;;;;;;108948:5;;;108908:57;;;;;;;;;;;;;;108963:1;108908:57;;;;;;;;48389:42;;108908:32;;:57;;;;;;;;;;;108963:1;48389:42;108908:57;;;5:2:-1;;;;30:1;27;20:12;108981:714:0;109115:7;;-1:-1:-1;;;;;109275:17:0;;46484:42;109275:17;:25;;109299:1;109275:25;;;109295:1;109275:25;-1:-1:-1;;;;;109232:17:0;;46217:42;109232:17;:25;;109256:1;109232:25;;;109252:1;109232:25;-1:-1:-1;;;;;109189:17:0;;-1:-1:-1;;;;;;;;;;;109189:17:0;:25;;109213:1;109189:25;;;109209:1;109189:25;-1:-1:-1;;;;;109147:16:0;;-1:-1:-1;;;;;;;;;;;109147:16:0;:24;;109170:1;109147:24;;;109166:1;109147:24;109146:69;:112;:155;109135:166;;;;109312:8;46484:42;-1:-1:-1;;;;;109452:17:0;:9;-1:-1:-1;;;;;109452:17:0;;:25;;109476:1;109452:25;;;109472:1;109452:25;-1:-1:-1;;;;;109409:17:0;;46217:42;109409:17;:25;;109433:1;109409:25;;;109429:1;109409:25;-1:-1:-1;;;;;109366:17:0;;-1:-1:-1;;;;;;;;;;;109366:17:0;:25;;109390:1;109366:25;;;109386:1;109366:25;-1:-1:-1;;;;;109324:16:0;;-1:-1:-1;;;;;;;;;;;109324:16:0;:24;;109347:1;109324:24;;;109343:1;109324:24;109323:69;:112;:155;109312:166;;;;109493:1;:6;;109498:1;109493:6;:16;;;;109503:1;:6;;109508:1;109503:6;109493:16;109489:57;;;109533:1;109526:8;;;;;;109489:57;109558:59;-1:-1:-1;;;;;109558:26:0;;48488:42;109610:6;109558:59;:26;:59;:::i;:::-;109628;;;-1:-1:-1;;;109628:59:0;;-1:-1:-1;;109663:5:0;;;109628:59;;;;;;;;;;109670:5;;;109628:59;;;;;;;;;;;;;;109685:1;109628:59;;;;;;;;48488:42;;109628:34;;:59;;;;;;;;;;;109685:1;48488:42;109628:59;;;5:2:-1;;;;30:1;27;20:12;114073:854:0;114208:7;114233:17;:9;-1:-1:-1;;;;;114233:15:0;;:17::i;:::-;114228:346;;114267:27;114297:28;114315:9;114297:17;:28::i;:::-;114267:58;-1:-1:-1;114340:57:0;-1:-1:-1;;;;;114340:26:0;;114267:58;114390:6;114340:57;:26;:57;:::i;:::-;114412:12;-1:-1:-1;;;;;114412:17:0;;114430:6;114412:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;114412:25:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;114412:25:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;114459:103:0;;-1:-1:-1;114481:12:0;114496:9;114507:54;-1:-1:-1;;;;;114507:39:0;;114555:4;114507:54;:39;:54;:::i;:::-;114459:14;:103::i;:::-;114452:110;;;;;114228:346;114591:17;:9;-1:-1:-1;;;;;114591:15:0;;:17::i;:::-;114586:313;;114625:25;114653:28;114671:9;114653:17;:28::i;:::-;114625:56;;114696:22;114721:53;114736:9;114754:10;114767:6;114721:14;:53::i;:::-;114696:78;;114789:10;-1:-1:-1;;;;;114789:17:0;;114807:14;114789:33;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;114789:33:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;114789:33:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;114844:43:0;;-1:-1:-1;;;;;;114844:28:0;;114881:4;114844:43;:28;:43;:::i;:::-;114837:50;;;;;;114586:313;-1:-1:-1;114918:1:0;114073:854;;;;;:::o;114935:678::-;115066:7;-1:-1:-1;;;;;115090:16:0;;-1:-1:-1;;;;;;;;;;;115090:16:0;115086:254;;;115123:49;-1:-1:-1;;;;;115123:26:0;;45863:42;115165:6;115123:49;:26;:49;:::i;:::-;115187:32;;;-1:-1:-1;;;115187:32:0;;115205:4;115187:32;;;;;;;;;;;;45863:42;;115187:9;;:32;;;;;-1:-1:-1;;115187:32:0;;;;;;;-1:-1:-1;45863:42:0;115187:32;;;5:2:-1;;;;30:1;27;20:12;5:2;115187:32:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;115241:87:0;;-1:-1:-1;45863:42:0;;-1:-1:-1;115270:9:0;;-1:-1:-1;115281:46:0;45863:42;115321:4;115281:46;:31;:46;:::i;115241:87::-;115234:94;;;;115086:254;-1:-1:-1;;;;;115356:16:0;;-1:-1:-1;;;;;;;;;;;115356:16:0;115352:233;;;115389:18;115410:47;115425:9;45863:42;115450:6;115410:14;:47::i;:::-;115472:36;;;-1:-1:-1;;;115472:36:0;;115490:4;115472:36;;;;;;;;;;;;115389:68;;-1:-1:-1;45863:42:0;;115472:9;;:36;;;;;-1:-1:-1;;115472:36:0;;;;;;;;-1:-1:-1;45863:42:0;115472:36;;;5:2:-1;;;;30:1;27;20:12;5:2;115472:36:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;115530:43:0;;-1:-1:-1;;;;;;;;115530:28:0;;115567:4;115530:28;:43::i;115621:771::-;115752:7;115777:17;:9;-1:-1:-1;;;;;115777:15:0;;:17::i;:::-;115772:328;;115811:19;115833:24;115847:9;115833:13;:24::i;:::-;115811:46;;115872:47;49064:42;-1:-1:-1;;;;;115899:9:0;;:11;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;115899:11:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;115899:11:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;115899:11:0;-1:-1:-1;;;;;115872:26:0;;;115912:6;115872:47;:26;:47;:::i;:::-;115934:37;;;-1:-1:-1;;;115934:37:0;;-1:-1:-1;;;;;115934:37:0;;;;;;;;;;;;115966:4;115934:37;;;;;;49064:42;;115934:12;;:37;;;;;-1:-1:-1;;115934:37:0;;;;;;;-1:-1:-1;49064:42:0;115934:37;;;5:2:-1;;;;30:1;27;20:12;5:2;115934:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;115934:37:0;;;;115993:95;116015:8;116026:9;116037:50;116081:4;116044:8;-1:-1:-1;;;;;116037:35:0;;;:50;;;;:::i;115772:328::-;116117:17;:9;-1:-1:-1;;;;;116117:15:0;;:17::i;:::-;116112:252;;116151:17;116171:24;116185:9;116171:13;:24::i;:::-;116151:44;;116210:18;116231:49;116246:9;116264:6;116273;116231:14;:49::i;:::-;116210:70;;116295:6;-1:-1:-1;;;;;116295:13:0;;116309:10;116295:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;116295:25:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;116295:25:0;;;;116342:10;116335:17;;;;;;116400:437;116529:7;116549:20;49394:42;-1:-1:-1;;;;;116572:24:0;;:26;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;116572:26:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;116572:26:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;116572:26:0;;-1:-1:-1;116609:54:0;-1:-1:-1;;;;;116609:26:0;;116572;116656:6;116609:54;:26;:54;:::i;:::-;116681:9;-1:-1:-1;;;;;116681:14:0;;116702:17;:9;-1:-1:-1;;;;;116702:15:0;;:17::i;:::-;:30;;116731:1;116702:30;;;116722:6;116702:30;116681:148;;;-1:-1:-1;;;;;;116681:148:0;;;;;;;-1:-1:-1;;;;;116681:148:0;;;;;;;;;;;;;;;;;;;116817:1;116681:148;;;;;;;;;;;;;;;;;;;;;;;;;5:2:-1;;;;30:1;27;20:12;5:2;116681:148:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;116681:148:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;116681:148:0;;116400:437;-1:-1:-1;;;;;116400:437:0:o;120207:268::-;120336:7;120363:104;120402:9;120426;120450:6;120363:24;:104::i;120483:289::-;120615:7;120642:122;120680:9;-1:-1:-1;;;;;;;;;;;120723:9:0;120747:6;120642:23;:122::i;120780:288::-;120912:7;120939:121;120977:9;-1:-1:-1;;;;;;;;;;;121019:9:0;121043:6;120939:23;:121::i;121076:290::-;121209:7;121236:122;121274:9;-1:-1:-1;;;;;;;;;;;121317:9:0;121341:6;121236:23;:122::i;109703:694::-;109831:7;;-1:-1:-1;;;;;109991:16:0;;46572:42;109991:16;:24;;110014:1;109991:24;;;110010:1;109991:24;-1:-1:-1;;;;;109948:17:0;;46217:42;109948:17;:25;;109972:1;109948:25;;;109968:1;109948:25;-1:-1:-1;;;;;109905:17:0;;-1:-1:-1;;;;;;;;;;;109905:17:0;:25;;109929:1;109905:25;;;109925:1;109905:25;-1:-1:-1;;;;;109863:16:0;;-1:-1:-1;;;;;;;;;;;109863:16:0;:24;;109886:1;109863:24;;;109882:1;109863:24;109862:69;:112;:154;109851:165;;;;110027:8;46572:42;-1:-1:-1;;;;;110167:16:0;:9;-1:-1:-1;;;;;110167:16:0;;:24;;110190:1;110167:24;;;110186:1;110167:24;-1:-1:-1;;;;;110124:17:0;;46217:42;110124:17;:25;;110148:1;110124:25;;;110144:1;110124:25;-1:-1:-1;;;;;110081:17:0;;-1:-1:-1;;;;;;;;;;;110081:17:0;:25;;110105:1;110081:25;;;110101:1;110081:25;-1:-1:-1;;;;;110039:16:0;;-1:-1:-1;;;;;;;;;;;110039:16:0;:24;;110062:1;110039:24;;;110058:1;110039:24;110038:69;:112;:154;110027:165;;;;110207:1;:6;;110212:1;110207:6;:16;;;;110217:1;:6;;110222:1;110217:6;110207:16;110203:57;;;110247:1;110240:8;;;;;;110203:57;110272:53;-1:-1:-1;;;;;110272:26:0;;48581:42;110318:6;110272:53;:26;:53;:::i;:::-;110336;;;-1:-1:-1;;;110336:53:0;;-1:-1:-1;;110365:5:0;;;110336:53;;;;;;;;;;110372:5;;;110336:53;;;;;;;;;;;;;;110387:1;110336:53;;;;;;;;48581:42;;110336:28;;:53;;;;;;;;;;;110387:1;48581:42;110336:53;;;5:2:-1;;;;30:1;27;20:12;111142:528:0;111273:7;;-1:-1:-1;;;;;111350:17:0;;46752:42;111350:17;:25;;111374:1;111350:25;;;111370:1;111350:25;-1:-1:-1;;;;;111305:19:0;;46663:42;111305:19;:27;;111331:1;111305:27;;;111327:1;111305:27;111304:72;111293:83;;;-1:-1:-1;111387:8:0;46752:42;-1:-1:-1;;;;;111444:17:0;;;:25;;111468:1;111444:25;;;111464:1;111444:25;-1:-1:-1;;;;;111399:19:0;;46663:42;111399:19;:27;;111425:1;111399:27;;;111421:1;111399:27;111398:72;111387:83;;;;111485:1;:6;;111490:1;111485:6;:16;;;;111495:1;:6;;111500:1;111495:6;111485:16;111481:57;;;111525:1;111518:8;;;;;;111481:57;111550:56;-1:-1:-1;;;;;111550:26:0;;48677:42;111599:6;111550:56;:26;:56;:::i;:::-;111617:45;;;-1:-1:-1;;;111617:45:0;;-1:-1:-1;;111638:5:0;;;111617:45;;;;;;;;;;111645:5;;;111617:45;;;;;;;;;;;;;;111660:1;111617:45;;;;;;;;48677:42;;111617:20;;:45;;;;;;;;;;;111660:1;48677:42;111617:45;;;5:2:-1;;;;30:1;27;20:12;111678:604:0;111807:7;;-1:-1:-1;;;;;111925:17:0;;46930:42;111925:17;:25;;111949:1;111925:25;;;111945:1;111925:25;-1:-1:-1;;;;;111882:17:0;;46752:42;111882:17;:25;;111906:1;111882:25;;;111902:1;111882:25;-1:-1:-1;;;;;111839:17:0;;46841:42;111839:17;:25;;111863:1;111839:25;;;111859:1;111839:25;111838:70;:113;111827:124;;;;111962:8;46930:42;-1:-1:-1;;;;;112060:17:0;:9;-1:-1:-1;;;;;112060:17:0;;:25;;112084:1;112060:25;;;112080:1;112060:25;-1:-1:-1;;;;;112017:17:0;;46752:42;112017:17;:25;;112041:1;112017:25;;;112037:1;112017:25;-1:-1:-1;;;;;111974:17:0;;46841:42;111974:17;:25;;111998:1;111974:25;;;111994:1;111974:25;111973:70;:113;111962:124;;;;112101:1;:6;;112106:1;112101:6;:16;;;;112111:1;:6;;112116:1;112111:6;112101:16;112097:57;;;112141:1;112134:8;;;;;;112097:57;112166:54;-1:-1:-1;;;;;112166:26:0;;48771:42;112213:6;112166:54;:26;:54;:::i;:::-;112231:43;;;-1:-1:-1;;;112231:43:0;;-1:-1:-1;;112250:5:0;;;112231:43;;;;;;;;;;112257:5;;;112231:43;;;;;;;;;;;;;;112272:1;112231:43;;;;;;;;48771:42;;112231:18;;:43;;;;;;;;;;;112272:1;48771:42;112231:43;;;5:2:-1;;;;30:1;27;20:12;112906:269:0;113036:7;113056:55;-1:-1:-1;;;;;113056:26:0;;49615:42;113104:6;113056:55;:26;:55;:::i;:::-;113122:45;;;-1:-1:-1;;;113122:45:0;;-1:-1:-1;;;;;113122:45:0;;;;;;;;;;;;;;;;;;;;;49615:42;;113122:15;;:45;;;;;-1:-1:-1;;113122:45:0;;;;;;;-1:-1:-1;49615:42:0;113122:45;;;5:2:-1;;;;30:1;27;20:12;5:2;113122:45:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;113122:45:0;;;;112906:269;;;;;:::o;110405:377::-;110531:7;110551:50;-1:-1:-1;;;;;110551:26:0;;48955:42;110594:6;110551:50;:26;:50;:::i;:::-;110619:155;;;-1:-1:-1;;;110619:155:0;;-1:-1:-1;;;;;110619:155:0;;;;;;;;;;;;;;;;;;;110739:1;110619:155;;;;;;110761:2;110755:3;:8;110619:155;;;;;;48955:42;;110619:18;;:155;;;;;;;;;;;;;;;;;;48955:42;110619:155;;;5:2:-1;;;;30:1;27;20:12;5:2;110619:155:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;110619:155:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;110790:344:0;110922:7;110942:49;-1:-1:-1;;;;;110942:26:0;;49708:42;110984:6;110942:49;:26;:49;:::i;:::-;111009:117;;;-1:-1:-1;;;111009:117:0;;-1:-1:-1;;;;;111009:117:0;;;;;;;;;;;;;;;;;;;111110:4;111009:117;;;;;;49708:42;;111009:9;;:117;;;;;;;;;;;;;;-1:-1:-1;49708:42:0;111009:117;;;5:2:-1;;;;30:1;27;20:12;112290:608:0;112419:7;;-1:-1:-1;;;;;112539:17:0;;47019:42;112539:17;:25;;112563:1;112539:25;;;112559:1;112539:25;-1:-1:-1;;;;;112496:17:0;;46752:42;112496:17;:25;;112520:1;112496:25;;;112516:1;112496:25;-1:-1:-1;;;;;112451:19:0;;46663:42;112451:19;:27;;112477:1;112451:27;;;112473:1;112451:27;112450:72;:115;112439:126;;;;112576:8;47019:42;-1:-1:-1;;;;;112676:17:0;:9;-1:-1:-1;;;;;112676:17:0;;:25;;112700:1;112676:25;;;112696:1;112676:25;-1:-1:-1;;;;;112633:17:0;;46752:42;112633:17;:25;;112657:1;112633:25;;;112653:1;112633:25;-1:-1:-1;;;;;112588:19:0;;46663:42;112588:19;:27;;112614:1;112588:27;;;112610:1;112588:27;112587:72;:115;112576:126;;;;112717:1;:6;;112722:1;112717:6;:16;;;;112727:1;:6;;112732:1;112727:6;112717:16;112713:57;;;112757:1;112750:8;;;;;;112713:57;112782:54;-1:-1:-1;;;;;112782:26:0;;48865:42;112829:6;112782:54;:26;:54;:::i;:::-;112847:43;;;-1:-1:-1;;;112847:43:0;;-1:-1:-1;;112866:5:0;;;112847:43;;;;;;;;;;112873:5;;;112847:43;;;;;;;;;;;;;;112888:1;112847:43;;;;;;;;48865:42;;112847:18;;:43;;;;;;;;;;;112888:1;48865:42;112847:43;;;5:2:-1;;;;30:1;27;20:12;122315:206:0;122444:7;122464:49;122481:9;122492;122503:6;122511:1;122464:16;:49::i;:::-;;122315:206;;;;;:::o;122529:::-;122658:7;122678:49;122695:9;122706;122717:6;122725:1;122678:16;:49::i;122743:206::-;122872:7;122892:49;122909:9;122920;122931:6;122939:1;122892:16;:49::i;10785:181::-;10843:7;10875:5;;;10899:6;;;;10891:46;;;;;-1:-1:-1;;;10891:46:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;10957:1;-1:-1:-1;10785:181:0;;;;;:::o;38067:166::-;38118:4;-1:-1:-1;;;;;38143:39:0;;;;:81;;-1:-1:-1;;;;;;38186:38:0;;35239:42;38186:38;38143:81;38135:90;;38067:166;;;;:::o;35647:617::-;35758:11;35754:50;;35786:7;;35754:50;35820:12;35826:5;35820;:12::i;:::-;35816:441;;;-1:-1:-1;;;;;35857:18:0;;35865:10;35857:18;:41;;;;;35892:6;35879:9;:19;;35857:41;35849:97;;;;-1:-1:-1;;;35849:97:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;35965:19:0;;35979:4;35965:19;35961:97;;36005:37;;-1:-1:-1;;;;;36005:29:0;;;:37;;;;;36035:6;;36005:37;;;;36035:6;36005:29;:37;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;36005:37:0;35961:97;36088:6;36076:9;:18;36072:101;;;36115:10;:42;36135:21;:9;36149:6;36135:21;:13;:21;:::i;:::-;36115:42;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;36115:42:0;36072:101;35816:441;;;36205:40;-1:-1:-1;;;;;36205:22:0;;36228:4;36234:2;36238:6;36205:40;:22;:40;:::i;:::-;35647:617;;;;:::o;37249:228::-;37327:7;37351:12;37357:5;37351;:12::i;:::-;37347:123;;;-1:-1:-1;;;;;;37387:11:0;;;37380:18;;37347:123;37438:5;-1:-1:-1;;;;;37438:15:0;;37454:3;37438:20;;;;;;;;;;;;;-1:-1:-1;;;;;37438:20:0;-1:-1:-1;;;;;37438:20:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;37438:20:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;37438:20:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;37438:20:0;;-1:-1:-1;37431:27:0;;12157:471;12215:7;12460:6;12456:47;;-1:-1:-1;12490:1:0;12483:8;;12456:47;12527:5;;;12531:1;12527;:5;:1;12551:5;;;;;:10;12543:56;;;;-1:-1:-1;;;12543:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13096:132;13154:7;13181:39;13185:1;13188;13181:39;;;;;;;;;;;;;;;;;:3;:39::i;35291:348::-;35377:4;35398:11;35394:55;;-1:-1:-1;35433:4:0;35426:11;;35394:55;35465:12;35471:5;35465;:12::i;:::-;35461:171;;;35494:37;;-1:-1:-1;;;;;35494:29:0;;;:37;;;;;35524:6;;35494:37;;;;35524:6;35494:29;:37;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;35494:37:0;35461:171;;;35564:30;-1:-1:-1;;;;;35564:18:0;;35583:2;35587:6;35564:30;:18;:30;:::i;:::-;-1:-1:-1;35616:4:0;35609:11;;36723:518;36816:12;36822:5;36816;:12::i;:::-;36811:423;;36849:11;36845:101;;36881:24;-1:-1:-1;;;;;36881:17:0;;36899:2;36903:1;36881:24;:17;:24;:::i;:::-;36924:7;;36845:101;36982:34;;;-1:-1:-1;;;36982:34:0;;37006:4;36982:34;;;;-1:-1:-1;;;;;36982:34:0;;;;;;;;;36962:17;;36982:15;;;;;:34;;;;;;;;;;;;;;:15;:34;;;5:2:-1;;;;30:1;27;20:12;5:2;36982:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;36982:34:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;36982:34:0;;-1:-1:-1;37035:18:0;;;37031:192;;;37078:13;;37074:86;;37116:24;-1:-1:-1;;;;;37116:17:0;;37134:2;37138:1;37116:24;:17;:24;:::i;:::-;37178:29;-1:-1:-1;;;;;37178:17:0;;37196:2;37200:6;37178:29;:17;:29;:::i;36811:423::-;36723:518;;;:::o;52065:1473::-;52128:14;52159:13;:5;-1:-1:-1;;;;;52159:11:0;;:13::i;:::-;52155:118;;;-1:-1:-1;52218:42:0;52196:65;;52155:118;-1:-1:-1;;;;;52287:59:0;;-1:-1:-1;;;;;;;;;;;52287:59:0;52283:164;;;-1:-1:-1;52392:42:0;52370:65;;52283:164;-1:-1:-1;;;;;52461:59:0;;52477:42;52461:59;52457:164;;;-1:-1:-1;52566:42:0;52544:65;;52457:164;-1:-1:-1;;;;;52635:59:0;;52651:42;52635:59;52631:164;;;-1:-1:-1;52740:42:0;52718:65;;52631:164;-1:-1:-1;;;;;52809:59:0;;-1:-1:-1;;;;;;;;;;;52809:59:0;52805:165;;;-1:-1:-1;52915:42:0;52893:65;;52805:165;-1:-1:-1;;;;;52984:59:0;;53000:42;52984:59;52980:165;;;-1:-1:-1;53090:42:0;53068:65;;52980:165;-1:-1:-1;;;;;53159:59:0;;53175:42;53159:59;53155:164;;;-1:-1:-1;53264:42:0;53242:65;;53155:164;-1:-1:-1;;;;;53333:59:0;;53349:42;53333:59;53329:165;;;-1:-1:-1;53439:42:0;53417:65;;53329:165;-1:-1:-1;53528:1:0;52065:1473;;;:::o;53546:2965::-;53605:10;53632:13;:5;-1:-1:-1;;;;;53632:11:0;;:13::i;:::-;53628:114;;;-1:-1:-1;53687:42:0;53669:61;;53628:114;-1:-1:-1;;;;;53756:59:0;;-1:-1:-1;;;;;;;;;;;53756:59:0;53752:160;;;-1:-1:-1;53857:42:0;53839:61;;53752:160;-1:-1:-1;;;;;53926:59:0;;-1:-1:-1;;;;;;;;;;;53926:59:0;53922:161;;;-1:-1:-1;54028:42:0;54010:61;;53922:161;-1:-1:-1;;;;;54097:59:0;;54113:42;54097:59;54093:161;;;-1:-1:-1;54199:42:0;54181:61;;54093:161;-1:-1:-1;;;;;54268:59:0;;54284:42;54268:59;54264:161;;;-1:-1:-1;54370:42:0;54352:61;;54264:161;-1:-1:-1;;;;;54439:59:0;;54455:42;54439:59;54435:161;;;-1:-1:-1;54541:42:0;54523:61;;54435:161;-1:-1:-1;;;;;54610:59:0;;54626:42;54610:59;54606:161;;;-1:-1:-1;54712:42:0;54694:61;;54606:161;-1:-1:-1;;;;;54781:59:0;;54797:42;54781:59;54777:160;;;-1:-1:-1;54882:42:0;54864:61;;54777:160;-1:-1:-1;;;;;54951:59:0;;54967:42;54951:59;54947:160;;;-1:-1:-1;55052:42:0;55034:61;;54947:160;-1:-1:-1;;;;;55121:59:0;;55137:42;55121:59;55117:161;;;-1:-1:-1;55223:42:0;55205:61;;55117:161;-1:-1:-1;;;;;55292:59:0;;55308:42;55292:59;55288:161;;;-1:-1:-1;55394:42:0;55376:61;;55288:161;-1:-1:-1;;;;;55463:59:0;;55479:42;55463:59;55459:161;;;-1:-1:-1;55565:42:0;55547:61;;55459:161;-1:-1:-1;;;;;55634:59:0;;55650:42;55634:59;55630:160;;;-1:-1:-1;55735:42:0;55717:61;;55630:160;-1:-1:-1;;;;;55804:59:0;;55820:42;55804:59;55800:160;;;-1:-1:-1;55905:42:0;55887:61;;55800:160;-1:-1:-1;;;;;55974:59:0;;55990:42;55974:59;55970:160;;;-1:-1:-1;56075:42:0;56057:61;;55970:160;-1:-1:-1;;;;;56144:59:0;;56160:42;56144:59;56140:161;;;-1:-1:-1;56246:42:0;56228:61;;56140:161;-1:-1:-1;;;;;56315:59:0;;56331:42;56315:59;56311:160;;;-1:-1:-1;56416:42:0;56398:61;;118803:975;118940:20;118977:17;:9;-1:-1:-1;;;;;118977:15:0;;:17::i;:::-;118973:78;;;-1:-1:-1;;;;;;;;;;;;;;;;119011:12:0;;119030:6;119011:28;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;119011:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;119011:28:0;;;;;118973:78;119063:20;119086:17;:9;-1:-1:-1;;;;;119086:15:0;;:17::i;:::-;:36;;119113:9;119086:36;;;-1:-1:-1;;;;;;;;;;;119086:36:0;119063:59;;119133:18;119154:17;:9;-1:-1:-1;;;;;119154:15:0;;:17::i;:::-;:36;;119181:9;119154:36;;;-1:-1:-1;;;;;;;;;;;119154:36:0;119231:45;;;-1:-1:-1;;;119231:45:0;;-1:-1:-1;;;;;119231:45:0;;;;;;;;;;;;;;;119133:57;;-1:-1:-1;119201:27:0;;49510:42;;119231:17;;:45;;;;;;;;;;;;;;49510:42;119231:45;;;5:2:-1;;;;30:1;27;20:12;5:2;119231:45:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;119231:45:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;119231:45:0;;-1:-1:-1;119302:54:0;-1:-1:-1;;;;;119302:18:0;;119321:13;119336:11;119349:6;119302:54;:18;:54;:::i;:::-;119287:69;-1:-1:-1;119369:58:0;-1:-1:-1;;;;;119369:31:0;;119409:8;119420:6;119369:58;:31;:58;:::i;:::-;;119492:11;-1:-1:-1;;;;;119476:29:0;119458:13;-1:-1:-1;;;;;119442:31:0;:63;119438:227;;;119522:49;;;-1:-1:-1;;;119522:49:0;;119536:1;119522:49;;;;;;;;;;;;119561:4;119522:49;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;119522:13:0;;;;;:49;;;;;;;;;;;119536:1;119522:13;:49;;;5:2:-1;;;;30:1;27;20:12;5:2;119522:49:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;119522:49:0;;;;119438:227;;;119604:49;;;-1:-1:-1;;;119604:49:0;;;;;;;;119632:1;119604:49;;;;;;119643:4;119604:49;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;119604:13:0;;;;;:49;;;;;;;;;;;119632:1;119604:13;:49;;;5:2:-1;;;;30:1;27;20:12;5:2;119604:49:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;119604:49:0;;;;119438:227;119681:17;:9;-1:-1:-1;;;;;119681:15:0;;:17::i;:::-;119677:94;;;119729:29;;;-1:-1:-1;;;119729:29:0;;119752:4;119729:29;;;;;;-1:-1:-1;;;;;;;;;;;45776:42:0;119715:13;;45776:42;;119729:14;;:29;;;;;;;;;;;;;;45776:42;119729:29;;;5:2:-1;;;;30:1;27;20:12;5:2;119729:29:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;119729:29:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;119729:29:0;119715:44;;;-1:-1:-1;;;;;;119715:44:0;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;119715:44:0;;;;;;;-1:-1:-1;119715:44:0;;;;5:2:-1;;;;30:1;27;20:12;5:2;119715:44:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;119715:44:0;;;;119677:94;118803:975;;;;;;;;:::o;119786:413::-;119948:7;119975:216;120014:8;120037:9;120061:119;120104:9;120132:8;120159:6;120061:24;:119::i;:::-;119975:24;:216::i;121374:933::-;121531:7;121551:22;49967:42;121576:38;121637:17;-1:-1:-1;;;;;121637:15:0;;;:17::i;:::-;:36;;121664:9;121637:36;;;-1:-1:-1;;;;;;;;;;;121637:36:0;121697:17;:9;-1:-1:-1;;;;;121697:15:0;;:17::i;:::-;:36;;121724:9;121697:36;;;-1:-1:-1;;;;;;;;;;;121697:36:0;121749:9;121761:1;121749:13;121576:197;;;;;;;;;;;;;-1:-1:-1;;;;;121576:197:0;-1:-1:-1;;;;;121576:197:0;;;;;;-1:-1:-1;;;;;121576:197:0;-1:-1:-1;;;;;121576:197:0;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;121576:197:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;121576:197:0;;;;;;39:16:-1;36:1;17:17;2:54;101:4;121576:197:0;80:15:-1;;;-1:-1;;76:31;65:43;;120:4;113:20;13:2;5:11;;2:2;;;29:1;26;19:12;2:2;121576:197:0;;;;;;;;;;;;;-1:-1:-1;;;14:3;11:20;8:2;;;44:1;41;34:12;8:2;62:21;;;;123:4;114:14;;138:31;;;135:2;;;182:1;179;172:12;135:2;219:3;213:10;331:9;325:2;311:12;307:21;289:16;285:44;282:59;-1:-1;;;247:12;244:29;233:116;230:2;;;362:1;359;352:12;230:2;373:25;;-1:-1;121576:197:0;;421:4:-1;412:14;;;;121576:197:0;;;;;412:14:-1;121576:197:0;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;121576:197:0;;;;;;;;;;;121551:222;;121790:17;:9;-1:-1:-1;;;;;121790:15:0;;:17::i;:::-;121786:78;;;-1:-1:-1;;;;;;;;;;;;;;;;121824:12:0;;121843:6;121824:28;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;121824:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;121824:28:0;;;;;121786:78;121876:81;121932:5;121938:9;121932:16;;;;;;;;;;;;;;121950:6;121877:17;:9;-1:-1:-1;;;;;121877:15:0;;:17::i;:::-;:36;;121904:9;121877:36;;;-1:-1:-1;;;;;;;;;;;121877:36:0;-1:-1:-1;;;;;121876:55:0;;:81;;:55;:81;:::i;:::-;121982:5;121988:9;121982:16;;;;;;;;;;;;;;-1:-1:-1;;;;;121968:49:0;;122032:17;:9;-1:-1:-1;;;;;122032:15:0;;:17::i;:::-;:36;;122059:9;122032:36;;;-1:-1:-1;;;;;;;;;;;122032:36:0;122083:6;122104:17;:9;-1:-1:-1;;;;;122104:15:0;;:17::i;:::-;:36;;122131:9;122104:36;;;-1:-1:-1;;;;;;;;;;;122104:36:0;122155:1;-1:-1:-1;;121968:225:0;;;;;;;;;;;;;-1:-1:-1;;;;;121968:225:0;-1:-1:-1;;;;;121968:225:0;;;;;;;;;;;-1:-1:-1;;;;;121968:225:0;-1:-1:-1;;;;;121968:225:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;121968:225:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;121968:225:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;122210:17:0;;-1:-1:-1;;;;;;122210:15:0;;;:17::i;:::-;122206:94;;;122258:29;;;-1:-1:-1;;;122258:29:0;;122281:4;122258:29;;;;;;-1:-1:-1;;;;;;;;;;;45776:42:0;122244:13;;45776:42;;122258:14;;:29;;;;;;;;;;;;;;45776:42;122258:29;;;5:2:-1;;;;30:1;27;20:12;5:2;122258:29:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;122258:29:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;122258:29:0;122244:44;;;-1:-1:-1;;;;;;122244:44:0;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;122244:44:0;;;;;;;-1:-1:-1;122244:44:0;;;;5:2:-1;;;;30:1;27;20:12;5:2;122244:44:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;122244:44:0;;;;122206:94;121374:933;;;;;;;:::o;11241:136::-;11299:7;11326:43;11330:1;11333;11326:43;;;;;;;;;;;;;;;;;:3;:43::i;31946:204::-;32073:68;;;-1:-1:-1;;;;;32073:68:0;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;32073:68:0;;;;;;;;25:18:-1;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;32047:95:0;;32066:5;;32047:18;:95::i;13758:345::-;13844:7;13946:12;13939:5;13931:28;;;;-1:-1:-1;;;13931:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;13931:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;13970:9;13986:1;13982;:5;;;;;;;13758:345;-1:-1:-1;;;;;13758:345:0:o;31762:176::-;31871:58;;;-1:-1:-1;;;;;31871:58:0;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;31871:58:0;;;;;;;;25:18:-1;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;31845:85:0;;31864:5;;31845:18;:85::i;32158:621::-;32528:10;;;32527:62;;-1:-1:-1;32544:39:0;;;-1:-1:-1;;;32544:39:0;;32568:4;32544:39;;;;-1:-1:-1;;;;;32544:39:0;;;;;;;;;:15;;;;;;:39;;;;;;;;;;;;;;;:15;:39;;;5:2:-1;;;;30:1;27;20:12;5:2;32544:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;32544:39:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;32544:39:0;:44;32527:62;32519:152;;;;-1:-1:-1;;;32519:152:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;32708:62;;;-1:-1:-1;;;;;32708:62:0;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;32708:62:0;;;;;;;;25:18:-1;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;32682:89:0;;32701:5;;32682:18;:89::i;38699:599::-;38864:7;;38904:47;-1:-1:-1;;;;;38904:28:0;;38941:8;38904:47;:28;:47;:::i;:::-;38884:67;-1:-1:-1;38962:18:0;38983:47;-1:-1:-1;;;;;38983:28:0;;39020:8;38983:47;:28;:47;:::i;:::-;38962:68;-1:-1:-1;39043:23:0;39069:17;:8;39082:3;39069:17;:12;:17;:::i;:::-;39043:43;-1:-1:-1;39097:17:0;39117:31;39043:43;39137:10;39117:31;:19;:31;:::i;:::-;39097:51;-1:-1:-1;39159:19:0;39181:40;39205:15;39181:19;:9;39195:4;39181:19;:13;:19;:::i;:::-;:23;:40;:23;:40;:::i;:::-;39159:62;-1:-1:-1;39240:16:0;;39239:51;;39264:26;:9;39278:11;39264:26;:13;:26;:::i;:::-;39239:51;;;39260:1;39239:51;39232:58;38699:599;-1:-1:-1;;;;;;;;;;38699:599:0:o;11714:192::-;11800:7;11836:12;11828:6;;;;11820:29;;;;-1:-1:-1;;;11820:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;27:10:-1;;8:100;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;11820:29:0;-1:-1:-1;;;11872:5:0;;;11714:192::o;33801:1114::-;34405:27;34413:5;-1:-1:-1;;;;;34405:25:0;;:27::i;:::-;34397:71;;;;;-1:-1:-1;;;34397:71:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;34542:12;34556:23;34591:5;-1:-1:-1;;;;;34583:19:0;34603:4;34583:25;;;;;;;;;;;;;36:153:-1;66:2;61:3;58:11;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;34583:25:0;;;;;;;;;;;;;;;;;;;;;;;;14:1:-1;21;16:31;;;;75:4;69:11;64:16;;144:4;140:9;133:4;115:16;111:27;107:43;104:1;100:51;94:4;87:65;169:16;166:1;159:27;225:16;222:1;215:4;212:1;208:12;193:49;7:242;;16:31;36:4;31:9;;7:242;;34541:67:0;;;;34627:7;34619:52;;;;;-1:-1:-1;;;34619:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;34688:17;;:21;34684:224;;34830:10;34819:30;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;34819:30:0;34811:85;;;;-1:-1:-1;;;34811:85:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;28791:619;28851:4;29319:20;;29162:66;29359:23;;;;;;:42;;-1:-1:-1;29386:15:0;;;29359:42;29351:51;28791:619;-1:-1:-1;;;;28791:619:0:o;102040:20912::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;
Swarm Source
bzzr://0c4af721552effba7f39a40538f0a0a0fc023e83e9bd0298755ffabcb468bb0a
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
BSC | 100.00% | $3.42 | 1 | $3.42 |
Loading...
Loading
[ 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.