Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
10860064 | 1549 days ago | 1.24856005 ETH | ||||
10860064 | 1549 days ago | 1.24856005 ETH | ||||
10601328 | 1589 days ago | 0.75 ETH | ||||
10601328 | 1589 days ago | 0.75 ETH | ||||
10503497 | 1604 days ago | 29.1 ETH | ||||
10503497 | 1604 days ago | 29.1 ETH | ||||
10408516 | 1618 days ago | 4 ETH | ||||
10408516 | 1618 days ago | 4 ETH | ||||
10408504 | 1618 days ago | 2 ETH | ||||
10408504 | 1618 days ago | 2 ETH | ||||
10408481 | 1618 days ago | 4 ETH | ||||
10408481 | 1618 days ago | 4 ETH | ||||
10395176 | 1620 days ago | 0.85784865 ETH | ||||
10395176 | 1620 days ago | 0.85784865 ETH | ||||
10394766 | 1620 days ago | 1.72727195 ETH | ||||
10394766 | 1620 days ago | 1.72727195 ETH | ||||
10393276 | 1621 days ago | 13.974 ETH | ||||
10393276 | 1621 days ago | 13.974 ETH | ||||
10392203 | 1621 days ago | 0.1 ETH | ||||
10392203 | 1621 days ago | 0.1 ETH | ||||
10389545 | 1621 days ago | 13.96305301 ETH | ||||
10389545 | 1621 days ago | 13.96305301 ETH | ||||
10389475 | 1621 days ago | 5.98220238 ETH | ||||
10389475 | 1621 days ago | 5.98220238 ETH | ||||
10389470 | 1621 days ago | 7.59637842 ETH |
Loading...
Loading
Contract Name:
OneSplitWrap
Compiler Version
v0.5.17+commit.d19bba13
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2020-06-26 */ // 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_ENABLE_KYBER_UNISWAP_RESERVE = 0x100000000; // Turned off by default uint256 internal constant FLAG_ENABLE_KYBER_OASIS_RESERVE = 0x200000000; // Turned off by default uint256 internal constant FLAG_ENABLE_KYBER_BANCOR_RESERVE = 0x400000000; // Turned off by default 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; } 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/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/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; } // 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; //import "./interface/IBancorNetworkPathFinder.sol"; 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); 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); 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(0x8474c1236F0Bc23830A23a41aBB81B2764bA9f4F); 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); 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 _buildBancorPath( IERC20 fromToken, IERC20 destToken ) internal view returns(address[] memory path) { if (fromToken == destToken) { return new address[](0); } if (fromToken.isETH()) { fromToken = ETH_ADDRESS; } if (destToken.isETH()) { destToken = ETH_ADDRESS; } if (fromToken == bnt || destToken == bnt) { path = new address[](3); } else { path = new address[](5); } address fromConverter; address toConverter; IBancorConverterRegistry bancorConverterRegistry = IBancorConverterRegistry(bancorContractRegistry.addressOf("BancorConverterRegistry")); if (fromToken != bnt) { (bool success, bytes memory data) = address(bancorConverterRegistry).staticcall.gas(100000)(abi.encodeWithSelector( bancorConverterRegistry.getConvertibleTokenSmartToken.selector, fromToken.isETH() ? ETH_ADDRESS : fromToken, 0 )); if (!success) { return new address[](0); } fromConverter = abi.decode(data, (address)); if (fromConverter == address(0)) { return new address[](0); } } if (destToken != bnt) { (bool success, bytes memory data) = address(bancorConverterRegistry).staticcall.gas(100000)(abi.encodeWithSelector( bancorConverterRegistry.getConvertibleTokenSmartToken.selector, destToken.isETH() ? ETH_ADDRESS : destToken, 0 )); if (!success) { return new address[](0); } toConverter = abi.decode(data, (address)); if (toConverter == address(0)) { return new address[](0); } } if (destToken == bnt) { path[0] = address(fromToken); path[1] = fromConverter; path[2] = address(bnt); return path; } if (fromToken == bnt) { path[0] = address(bnt); path[1] = toConverter; path[2] = address(destToken); return path; } path[0] = address(fromToken); path[1] = fromConverter; path[2] = address(bnt); path[3] = toConverter; path[4] = address(destToken); return path; } 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) { uint256 mul = _cheapGetPrice(ETH_ADDRESS, destToken, 1e16); uint256 div = _cheapGetPrice(ETH_ADDRESS, fromToken, 1e16); 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", false, // "Curve Compound", false, // "Curve USDT", false, // "Curve Y", false, // "Curve Binance", false, // "CurveSynthetix", 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)", false, // "Curve Pax", false, // "Curve RenBTC", false, // "Curve tBTC", true, // "Dforce XSwap", false, // "Shell", true, // "mStable", false, // "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) { address[] memory pools = balancerRegistry.getBestPoolsWithLimit( address(fromToken.isETH() ? weth : fromToken), address(destToken.isETH() ? weth : destToken), poolIndex + 1 ); if (poolIndex >= pools.length) { return (new uint256[](parts), 0); } return ( balancerRegistry.getPoolReturns( pools[poolIndex], address(fromToken.isETH() ? weth : fromToken), address(destToken.isETH() ? weth : destToken), _linearInterpolation(amount, parts) ), 500_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 _calculateCurveSelector( ICurve curve, bytes4 sel, IERC20[] memory tokens, IERC20 fromToken, IERC20 destToken, uint256 amount, uint256 parts, uint256 /*flags*/ ) internal view returns(uint256[] memory rets) { 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 new uint256[](parts); } // curve.get_dy(i - 1, j - 1, amount); // curve.get_dy_underlying(i - 1, j - 1, amount); (bool success, bytes memory data) = address(curve).staticcall(abi.encodeWithSelector(sel, i - 1, j - 1, amount)); uint256 maxRet = (!success || data.length == 0) ? 0 : abi.decode(data, (uint256)); return _linearInterpolation(maxRet, 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( curveCompound, curveCompound.get_dy_underlying.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curveUSDT, curveUSDT.get_dy_underlying.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curveY, curveY.get_dy_underlying.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curveBinance, curveBinance.get_dy_underlying.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curveSynthetix, curveSynthetix.get_dy_underlying.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curvePAX, curvePAX.get_dy_underlying.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curveRenBTC, curveRenBTC.get_dy.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curveTBTC, curveTBTC.get_dy.selector, tokens, fromToken, destToken, amount, parts, flags ), 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( curveSBTC, curveSBTC.get_dy.selector, tokens, fromToken, destToken, amount, parts, flags ), 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) { 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 = _buildBancorPath(fromToken, 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 = _buildBancorPath(fromToken, 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 : destToken).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[7] 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 ]; IERC20[7] memory allMidTokens = [ ETH_ADDRESS, dai, usdc, usdt, wbtc, tbtc, renbtc ]; 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]; } } } function _getFlagsByDistribution(uint256[] memory distribution) internal pure returns(uint256 flags) { uint256[DEXES_COUNT] memory sourcesFlags = [ FLAG_DISABLE_UNISWAP, FLAG_DISABLE_KYBER, FLAG_DISABLE_BANCOR, FLAG_DISABLE_OASIS, FLAG_DISABLE_CURVE_COMPOUND, FLAG_DISABLE_CURVE_USDT, FLAG_DISABLE_CURVE_Y, FLAG_DISABLE_CURVE_BINANCE, FLAG_DISABLE_CURVE_SYNTHETIX, FLAG_DISABLE_UNISWAP_COMPOUND, FLAG_DISABLE_UNISWAP_CHAI, FLAG_DISABLE_UNISWAP_AAVE, FLAG_DISABLE_MOONISWAP, FLAG_DISABLE_UNISWAP_V2, FLAG_DISABLE_UNISWAP_V2_ETH, FLAG_DISABLE_UNISWAP_V2_DAI, FLAG_DISABLE_UNISWAP_V2_USDC, FLAG_DISABLE_CURVE_PAX, FLAG_DISABLE_CURVE_RENBTC, FLAG_DISABLE_CURVE_TBTC, FLAG_DISABLE_DFORCE_SWAP, FLAG_DISABLE_SHELL, FLAG_DISABLE_MSTABLE_MUSD, FLAG_DISABLE_CURVE_SBTC, 0, 0, 0 ]; for (uint i = 0; i < distribution.length; i++) { if (distribution[i] > 0) { flags |= sourcesFlags[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 | _getFlagsByDistribution(distribution), 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 ); uint256 additionalFlags = _getFlagsByDistribution(distribution); for (uint i = 0; i < distribution.length; i++) { dist[i] = (distribution[i] >> 8) & 0xFF; } super._swap( midToken, destToken, midToken.universalBalanceOf(address(this)), dist, flags | additionalFlags ); 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 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 _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"},{"internalType":"contract IOneSplit","name":"_oneSplit","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":"oneSplit","outputs":[{"internalType":"contract IOneSplit","name":"","type":"address"}],"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":"flags","type":"uint256"}],"name":"swap","outputs":[{"internalType":"uint256","name":"returnAmount","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50604051620047f1380380620047f18339818101604052604081101561003557600080fd5b508051602090910151600080546001600160a01b039384166001600160a01b03199182161790915560018054939092169216919091179055614774806200007d6000396000f3fe60806040526004361061004a5760003560e01c8063085e2c5b1461005957806343ee21f0146101035780638373f26514610134578063e2a7515e146101eb578063fbe4ed95146102c5575b3332141561005757600080fd5b005b34801561006557600080fd5b506100a8600480360360a081101561007c57600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356102da565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156100ee5781810151838201526020016100d6565b50505050905001935050505060405180910390f35b34801561010f57600080fd5b506101186102fd565b604080516001600160a01b039092168252519081900360200190f35b34801561014057600080fd5b50610189600480360360c081101561015757600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a0013561030c565b6040518084815260200183815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156101d55781810151838201526020016101bd565b5050505090500194505050505060405180910390f35b6102b3600480360360c081101561020157600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b81111561024057600080fd5b82018360208201111561025257600080fd5b803590602001918460208302840111600160201b8311171561027357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610463915050565b60408051918252519081900360200190f35b3480156102d157600080fd5b5061011861055f565b600060606102ed8787878787600061030c565b9199919850909650505050505050565b6001546001600160a01b031681565b6000805460408051638373f26560e01b81526001600160a01b038a81166004830152898116602483015260448201899052606482018890526084820187905260a48201869052915184936060931691638373f2659160c48083019287929190829003018186803b15801561037f57600080fd5b505afa158015610393573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260608110156103bc57600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156103e657600080fd5b9083019060208201858111156103fb57600080fd5b82518660208202830111600160201b8211171561041757600080fd5b82525081516020918201928201910280838360005b8381101561044457818101518382015260200161042c565b5050505090500160405250505092509250925096509650969350505050565b60006104806001600160a01b03881633308863ffffffff61056e16565b600061049b6001600160a01b0389163063ffffffff61068d16565b90506104aa8888838787610739565b6104c36001600160a01b0388163063ffffffff61068d16565b9150848210156105045760405162461bcd60e51b81526004018080602001828103825260358152602001806146326035913960400191505060405180910390fd5b61051e6001600160a01b038816338463ffffffff61089616565b506105533361053c6001600160a01b038b163063ffffffff61068d16565b6001600160a01b038b16919063ffffffff61089616565b50509695505050505050565b6000546001600160a01b031681565b8061057857610687565b61058184610914565b1561066c576001600160a01b0383163314801561059e5750803410155b6105d95760405162461bcd60e51b815260040180806020018281038252602b815260200180614687602b913960400191505060405180910390fd5b6001600160a01b0382163014610621576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561061f573d6000803e3d6000fd5b505b8034111561066757336108fc61063d348463ffffffff61095016565b6040518115909202916000818181858888f19350505050158015610665573d6000803e3d6000fd5b505b610687565b6106876001600160a01b03851684848463ffffffff61099216565b50505050565b600061069883610914565b156106ae57506001600160a01b03811631610733565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561070457600080fd5b505afa158015610718573d6000803e3d6000fd5b505050506040513d602081101561072e57600080fd5b505190505b92915050565b6000610744826109ec565b90506001600160a01b0381161580159061076557506107638682610ba5565b155b801561077857506107768186610ba5565b155b1561088057606083516040519080825280602002602001820160405280156107aa578160200160208202803883390190505b50905060005b84518110156107ef578481815181106107c557fe5b602002602001015160ff168282815181106107dc57fe5b60209081029190910101526001016107b0565b506107fd8783878487610bea565b600061080885610bf7565b905060005b855181101561085057600886828151811061082457fe5b6020026020010151901c60ff1683828151811061083d57fe5b602090810291909101015260010161080d565b50610878838861086f6001600160a01b0383163063ffffffff61068d16565b85858917610bea565b50505061088f565b61088d8686868686610bea565b505b5050505050565b6000816108a55750600161090d565b6108ae84610914565b156108ef576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156108e9573d6000803e3d6000fd5b5061090d565b6109096001600160a01b038516848463ffffffff610d5116565b5060015b9392505050565b60006001600160a01b038216158061094857506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b90505b919050565b600061090d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610da8565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610687908590610e3f565b60006109f66145b6565b6040518060e0016040528061020081526020016201000081526020016202000081526020016404000000008152602001640800000000815260200164100000000081526020016420000000008152509050610a4f6145b6565b506040805160e08101825273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8152600080516020614667833981519152602082015273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb489181019190915273dac17f958d2ee523a2206206994597c13d831ec76060820152732260fac5e5542a773aa44fbcfedf7c193bc2c5996080820152731bbe271d15bb64df0bc6cd28df9ff322f2ebd84760a082015273eb4c2781e4eba804ce9a9803c67d0893436bb27d60c082015260005b6007811015610b9d57610b36838260078110610b2457fe5b6020020151869063ffffffff610ff716565b15610b95576001600160a01b03841615610b815760405162461bcd60e51b815260040180806020018281038252602e8152602001806146b2602e913960400191505060405180910390fd5b818160078110610b8d57fe5b602002015193505b600101610b0c565b505050919050565b6000610bb9836001600160a01b0316610914565b8015610bd25750610bd2826001600160a01b0316610914565b8061090d5750506001600160a01b0391821691161490565b61088f8585858585610ffd565b6000610c016145d4565b604051806103600160405280600181526020016002815260200160048152602001600881526020016110008152602001612000815260200161400081526020016180008152602001620400008152602001621000008152602001622000008152602001624000008152602001630100000081526020016302000000815260200163040000008152602001630800000081526020016310000000815260200163800000008152602001600160201b815260200164020000000081526020016440000000008152602001648000000000815260200165020000000000815260200165040000000000815260200160008152602001600081526020016000815250905060008090505b8351811015610d4a576000848281518110610d1e57fe5b60200260200101511115610d42578181601b8110610d3857fe5b6020020151831792505b600101610d07565b5050919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610da3908490610e3f565b505050565b60008184841115610e375760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610dfc578181015183820152602001610de4565b50505050905090810190601f168015610e295780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b610e51826001600160a01b031661134b565b610ea2576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610ee05780518252601f199092019160209182019101610ec1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610f42576040519150601f19603f3d011682016040523d82523d6000602084013e610f47565b606091505b509150915081610f9e576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561068757808060200190516020811015610fba57600080fd5b50516106875760405162461bcd60e51b815260040180806020018281038252602a8152602001806146e0602a913960400191505060405180910390fd5b16151590565b836001600160a01b0316856001600160a01b0316141561101c5761088f565b611032816508000000000063ffffffff610ff716565b151561104882634000000063ffffffff610ff716565b1515141561133e57600061105b86611387565b90506001600160a01b03808216146111e357856001600160a01b031663db006a75856040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156110b357600080fd5b505af11580156110c7573d6000803e3d6000fd5b505050506040513d60208110156110dd57600080fd5b50600090506110fb6001600160a01b0383163063ffffffff61068d16565b90506001600160a01b03821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214156111955773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561117c57600080fd5b505af1158015611190573d6000803e3d6000fd5b505050505b6111e16001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2146111c257826111d8565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b87838787610ffd565b505b6111ec85611387565b90506001600160a01b038082161461133c5761124a866001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461122c5782611242565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b8686866114bb565b60006112a5306001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461127a5783611290565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b6001600160a01b03169063ffffffff61068d16565b90505b6112c26001600160a01b038316878363ffffffff6114c816565b856001600160a01b031663a0712d68826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561130857600080fd5b505af115801561131c573d6000803e3d6000fd5b505050506040513d602081101561133257600080fd5b5061088f92505050565b505b61088f85858585856114bb565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061137f57508115155b949350505050565b604080516001600160a01b03831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166330df135f60e21b178152915181516000938493606093734cb120dd1d33c9a3de8bc15620c7cd43418d77e293919290918291908083835b602083106114155780518252601f1990920191602091820191016113f6565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611475576040519150601f19603f3d011682016040523d82523d6000602084013e61147a565b606091505b509150915081158061148b57508051155b1561149c576000199250505061094b565b8080602001905160208110156114b157600080fd5b5051949350505050565b61088f85858585856115bc565b6114d183610914565b610da357806114fa576114f56001600160a01b03841683600063ffffffff61190516565b610da3565b60408051636eb1769f60e11b81523060048201526001600160a01b038481166024830152915160009286169163dd62ed3e916044808301926020929190829003018186803b15801561154b57600080fd5b505afa15801561155f573d6000803e3d6000fd5b505050506040513d602081101561157557600080fd5b50519050818110156106875780156115a2576115a26001600160a01b03851684600063ffffffff61190516565b6106876001600160a01b038516848463ffffffff61190516565b836001600160a01b0316856001600160a01b031614156115db5761088f565b6115ee816208000063ffffffff610ff716565b151561160482634000000063ffffffff610ff716565b151514156118f8576001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561173257604080516370a0823160e01b8152306004820152905173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b15801561168a57600080fd5b505afa15801561169e573d6000803e3d6000fd5b505050506040513d60208110156116b457600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b1580156116f457600080fd5b505af1158015611708573d6000803e3d6000fd5b5050505061172d73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee85858585611a18565b61088f565b6001600160a01b03851673c0829421c1d260bd3cb3e0f06cfe2d52db2ce31514156117b057604080516370a0823160e01b8152306004820152905173c0829421c1d260bd3cb3e0f06cfe2d52db2ce31591632e1a7d4d9183916370a08231916024808301926020929190829003018186803b15801561168a57600080fd5b6001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21415611863576117f68573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8585856115bc565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561184557600080fd5b505af1158015611859573d6000803e3d6000fd5b505050505061088f565b6001600160a01b03841673c0829421c1d260bd3cb3e0f06cfe2d52db2ce31514156118f8576118a98573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8585856115bc565b73c0829421c1d260bd3cb3e0f06cfe2d52db2ce3156001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561184557600080fd5b61088f8585858585611a18565b80158061198b575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561195d57600080fd5b505afa158015611971573d6000803e3d6000fd5b505050506040513d602081101561198757600080fd5b5051155b6119c65760405162461bcd60e51b815260040180806020018281038252603681526020018061470a6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610da3908490610e3f565b61088f85858585855b611a34816280000063ffffffff610ff716565b15611a4982634000000063ffffffff610ff716565b151415611e9b57611a586145f3565b611a60611ea8565b905060005b6008811015611c3357818160088110611a7a57fe5b60200201516001600160a01b0316876001600160a01b03161415611c2b576000828260088110611aa657fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ae357600080fd5b505afa158015611af7573d6000803e3d6000fd5b505050506040513d6020811015611b0d57600080fd5b505190506000838360088110611b1f57fe5b60200201516001600160a01b031663c85c93aa8860016000604051908082528060200260200182016040528015611b60578160200160208202803883390190505b506040518463ffffffff1660e01b8152600401808481526020018315151515815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015611bc0578181015183820152602001611ba8565b50505050905001945050505050602060405180830381600087803b158015611be757600080fd5b505af1158015611bfb573d6000803e3d6000fd5b505050506040513d6020811015611c1157600080fd5b50519050611c228289838989611a21565b5050505061088f565b600101611a65565b5060005b6008811015611e9857818160088110611c4c57fe5b60200201516001600160a01b0316866001600160a01b03161415611e90576000828260088110611c7857fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611cb557600080fd5b505afa158015611cc9573d6000803e3d6000fd5b505050506040513d6020811015611cdf57600080fd5b50519050611cf08882888888611f8e565b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b158015611d3a57600080fd5b505afa158015611d4e573d6000803e3d6000fd5b505050506040513d6020811015611d6457600080fd5b50519050611d93848460088110611d7757fe5b60200201516001600160a01b038416908363ffffffff6114c816565b838360088110611d9f57fe5b60200201516001600160a01b0316633cfcef64826000604051908082528060200260200182016040528015611dde578160200160208202803883390190505b506040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015611e34578181015183820152602001611e1c565b505050509050019350505050602060405180830381600087803b158015611e5a57600080fd5b505af1158015611e6e573d6000803e3d6000fd5b505050506040513d6020811015611e8457600080fd5b5061088f945050505050565b600101611c37565b50505b61088f8585858585611f8e565b611eb06145f3565b5060408051610100810182527378751b12da02728f467a44eac40f5cbc16bd793481527312b98c621e8754ae70d0fdbbc73d6208bc3e3ca660208201527363d27b3da94a9e871222cb0a32232674b02d2f2d91810191909152731846bdfdb6a0f5c473dec610144513bd071999fb606082015273cddb1bceb7a1979c6caa0229820707429dd3ec6c60808201527342740698959761baf1b06baa51efbd88cb1d862b60a08201527310ec0d497824e342bcb0edce00959142aaa766dd60c082015273eb66acc3d011056b00ea521f8203580c2e5d399160e082015290565b61088f85858585855b836001600160a01b0316856001600160a01b03161415611fb65761088f565b611fc88161080063ffffffff610ff716565b1515611fde82634000000063ffffffff610ff716565b1515141561237157611fee614612565b611ff661237e565b905060005b600d8110156121ab578181600d811061201057fe5b60200201516001600160a01b0316876001600160a01b031614156121a35760008282600d811061203c57fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561207957600080fd5b505afa15801561208d573d6000803e3d6000fd5b505050506040513d60208110156120a357600080fd5b505190508282600d81106120b357fe5b60200201516001600160a01b0316632e1a7d4d876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156120fd57600080fd5b505af1158015612111573d6000803e3d6000fd5b505050506108788188836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561217057600080fd5b505afa158015612184573d6000803e3d6000fd5b505050506040513d602081101561219a57600080fd5b50518888611f97565b600101611ffb565b5060005b600d81101561236e578181600d81106121c457fe5b60200201516001600160a01b0316866001600160a01b031614156123665760008282600d81106121f057fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561222d57600080fd5b505afa158015612241573d6000803e3d6000fd5b505050506040513d602081101561225757600080fd5b5051905061226888828888886124eb565b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b1580156122b257600080fd5b505afa1580156122c6573d6000803e3d6000fd5b505050506040513d60208110156122dc57600080fd5b505190506122ef8484600d8110611d7757fe5b8383600d81106122fb57fe5b60200201516001600160a01b031663b6b55f25826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561234557600080fd5b505af1158015612359573d6000803e3d6000fd5b505050505050505061088f565b6001016121af565b50505b61088f85858585856124eb565b612386614612565b50604080516101a0810182527316de59092dae5ccf4a1e6439d611fd0653f0bd0181527304aa51bbcb46541455ccf1b8bef2ebc5d3787ec960208201527373a052500105205d34daf004eab301916da8190f918101919091527383f798e925bcd4017eb265844fddabb448f1707d606082015273d6ad7a6750a7593e092a9b218d66c0a814a3436e608082015273f61718057901f84c4eec4339ef8f0d86d2b4560060a08201527304bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae60c082015273c2cb1040220768554cf699b0d863a3cd4324ce3260e082015273e6354ed5bc4b393a5aad09f21c46e101e692d4476101008201527326ea744e5b887e5205727f55dfbe8685e3b219516101208201527399d1fa417f94dcd62bfe781a1213c092a47041bc610140820152739777d7e2b60bb01759d0e2f8be2095df444cb07e610160820152731be5d71f2da660bfdee8012ddc58d024448a0a5961018082015290565b61088f85858585855b836001600160a01b0316856001600160a01b031614156125135761088f565b61252481601063ffffffff610ff716565b151561253a82634000000063ffffffff610ff716565b151514156126ce57600061254d866126db565b90506001600160a01b038082161461260357856001600160a01b031663db006a75856040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156125a557600080fd5b505af11580156125b9573d6000803e3d6000fd5b505050506040513d60208110156125cf57600080fd5b50600090506125ed6001600160a01b0383163063ffffffff61068d16565b90506125fc82878387876124f4565b505061088f565b61260c856126db565b90506001600160a01b03808216146126cc5761262b86828686866128cd565b60006126466001600160a01b0383163063ffffffff61068d16565b905061265a826001600160a01b0316610914565b156112a857734ddc2d193948926d02f9b1fe9e1daa0718270ed56001600160a01b0316631249c58b826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156126ae57600080fd5b505af11580156126c2573d6000803e3d6000fd5b50505050506125fc565b505b61088f85858585856128cd565b60006001600160a01b038216734ddc2d193948926d02f9b1fe9e1daa0718270ed5141561270a5750600061094b565b6001600160a01b038216735d3a536e4d6dbd6114cc1ead35777bab948e36431415612744575060008051602061466783398151915261094b565b6001600160a01b038216736c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e14156127845750730d8775f648430679a709e98d2b0cb6250d2887ef61094b565b6001600160a01b03821673158079ee67fce2f58472a96584a73c7ab9ac95c114156127c45750731985365e9f78359a9b6ad760e32412f4a445e86261094b565b6001600160a01b0382167339aa39c021dfbae8fac545936693ac917d5e75631415612804575073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4861094b565b6001600160a01b03821673c11b1268c1a384e55c48c2391d8d480264a3a7f414156128445750732260fac5e5542a773aa44fbcfedf7c193bc2c59961094b565b6001600160a01b03821673b3319f5d18bc0d84dd1b4825dcde5d5f7266d4071415612884575073e41d2489571d322189246dafa5ebde1f4699f49861094b565b6001600160a01b03821673f650c3d88d12db855b8bf7d11be6c55a4e07dcc914156128c4575073dac17f958d2ee523a2206206994597c13d831ec761094b565b50600019919050565b61088f8585858585836001600160a01b0316856001600160a01b031614156128f45761088f565b61290581602063ffffffff610ff716565b151561291b82634000000063ffffffff610ff716565b15151415612bc257600061292e86612bcf565b90506001600160a01b0380821614612a7e57612952816001600160a01b0316610914565b156129d8576040805163081a6b2560e41b81523060048201526024810186905290516001600160a01b038816916381a6b2509160448083019260209291908290030181600087803b1580156129a657600080fd5b505af11580156129ba573d6000803e3d6000fd5b505050506040513d60208110156129d057600080fd5b50612a549050565b60408051632770a7eb60e21b81523060048201526024810186905290516001600160a01b03881691639dc29fac9160448083019260209291908290030181600087803b158015612a2757600080fd5b505af1158015612a3b573d6000803e3d6000fd5b505050506040513d6020811015612a5157600080fd5b50505b6000612a6f6001600160a01b0383163063ffffffff61068d16565b90506125fc8287838787612f45565b612a8785612bcf565b90506001600160a01b0380821614612bc057612aa68682868686612f45565b6000612ac16001600160a01b0383163063ffffffff61068d16565b9050612ad5826001600160a01b0316610914565b15612b575760408051638f6ede1f60e01b815230600482015290516001600160a01b03881691638f6ede1f91849160248082019260209290919082900301818588803b158015612b2457600080fd5b505af1158015612b38573d6000803e3d6000fd5b50505050506040513d6020811015612b4f57600080fd5b506125fc9050565b612b716001600160a01b038316878363ffffffff6114c816565b604080516340c10f1960e01b81523060048201526024810183905290516001600160a01b038816916340c10f199160448083019260209291908290030181600087803b15801561130857600080fd5b505b61088f8585858585612f45565b6000612be3826001600160a01b0316610914565b15612bf1575060001961094b565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b178152915181516000936060936001600160a01b0388169361138893919290918291908083835b60208310612c5c5780518252601f199092019160209182019101612c3d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303818686fa925050503d8060008114612cbd576040519150601f19603f3d011682016040523d82523d6000602084013e612cc2565b606091505b509150915081612cd8576000199250505061094b565b6000805b8251816006011015612e3157828160000181518110612cf757fe5b6020910101516001600160f81b031916602360f91b148015612d3a5750828160010181518110612d2357fe5b6020910101516001600160f81b031916607560f81b145b8015612d675750828160020181518110612d5057fe5b6020910101516001600160f81b031916601b60fa1b145b8015612d945750828160030181518110612d7d57fe5b6020910101516001600160f81b031916606360f81b145b8015612dc15750828160040181518110612daa57fe5b6020910101516001600160f81b031916603960f91b145b8015612dee5750828160050181518110612dd757fe5b6020910101516001600160f81b031916607560f81b145b8015612e1b5750828160060181518110612e0457fe5b6020910101516001600160f81b031916606d60f81b145b15612e295760019150612e31565b600101612cdc565b5080612e4457600019935050505061094b565b60408051600481526024810182526020810180516001600160e01b031663797bf38560e01b178152915181516001600160a01b038916936113889392918291908083835b60208310612ea75780518252601f199092019160209182019101612e88565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303818686fa925050503d8060008114612f08576040519150601f19603f3d011682016040523d82523d6000602084013e612f0d565b606091505b50909350915082612f2557600019935050505061094b565b818060200190516020811015612f3a57600080fd5b505195945050505050565b61088f85858585855b836001600160a01b0316856001600160a01b03161415612f6d5761088f565b612f7e81608063ffffffff610ff716565b1515612f9482634000000063ffffffff610ff716565b151514156131e4576000612fa7866131f1565b90506001600160a01b038082161461302a57856001600160a01b031663db006a75856040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612fff57600080fd5b505af1158015613013573d6000803e3d6000fd5b505050506130248186868686612f4e565b5061088f565b613033856131f1565b90506001600160a01b03808216146131e2576130528682868686613615565b600061306d6001600160a01b0383163063ffffffff61068d16565b905061310273398ec7346dcd622edc5ae82352f02be94c62d1196001600160a01b031663f2f4eb266040518163ffffffff1660e01b815260040160206040518083038186803b1580156130bf57600080fd5b505afa1580156130d3573d6000803e3d6000fd5b505050506040513d60208110156130e957600080fd5b50516001600160a01b038416908363ffffffff6114c816565b73398ec7346dcd622edc5ae82352f02be94c62d11963d2d0e06661312e6001600160a01b038516610914565b61313957600061313b565b825b61314d856001600160a01b0316610914565b613157578461316d565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b604080516001600160e01b031960e086901b1681526001600160a01b0390921660048301526024820186905261044d604483015251606480830192600092919082900301818588803b1580156131c257600080fd5b505af11580156131d6573d6000803e3d6000fd5b5050505050505061088f565b505b61088f8585858585613615565b60006001600160a01b038216733a3a65aab0dd2a17e3f1947ba16138cd37d08c0414156132205750600061094b565b6001600160a01b03821673fc1e690f61efd961294b3e1ce3313fbd8aa4f85d141561325a575060008051602061466783398151915261094b565b6001600160a01b038216739ba00d6856a4edf4665bca2c2309936572473b7e141561329a575073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4861094b565b6001600160a01b03821673625ae63000f46200499120b906716420bd05924014156132da57507357ab1ec28d129707052df4df418d58a2d46d5f5161094b565b6001600160a01b038216736ee0f7bb50a54ab5253da0667b0dc2ee526c30a8141561331a5750734fabb145d64652a948d72533023f6e7a623c7c5361094b565b6001600160a01b038216734da9b813057d04baef4e5800e36083717b4a0341141561335557506e085d4780b73119b644ae5ecd22b37661094b565b6001600160a01b0382167371fc860f7d3a592a4a98740e39db31d25db65ae81415613395575073dac17f958d2ee523a2206206994597c13d831ec761094b565b6001600160a01b03821673e1ba0fb44ccb0d11b80f92f4f8ed94ca3ff51d0014156133d55750730d8775f648430679a709e98d2b0cb6250d2887ef61094b565b6001600160a01b038216739d91be44c06d373a8a226e1f3b146956083803eb1415613415575073dd974d5c2e2928dea5f71b9825b8b646686bd20061094b565b6001600160a01b038216737d2d3688df45ce7c552e19c27e007673da9204b8141561345557507380fb784b7ed66730e8b1dbd9820afd29931aab0361094b565b6001600160a01b03821673a64bd6c70cb9051f6a9ba1f163fdc07e0dfb5f841415613495575073514910771af9ca656af840dff83e8264ecf986ca61094b565b6001600160a01b038216736fce4a401b6b80ace52baaefe4421bd188e76f6f14156134d55750730f5d2fb29fb7d3cfee444a200298f468908cc94261094b565b6001600160a01b038216737deb5e830be29f91e298ba5ff1356bb7f814699814156135155750739f8f72aa9304c8b593d555f12ef6589cc3a579a261094b565b6001600160a01b0382167371010a9d003445ac60c4e6a7017c1e89a477b43814156135555750731985365e9f78359a9b6ad760e32412f4a445e86261094b565b6001600160a01b03821673328c4c80bc7aca0834db37e6600a6c49e12da4de1415613595575073c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f61094b565b6001600160a01b03821673fc4b8ed459e00e5400be803a9bb3954234fd50e314156135d55750732260fac5e5542a773aa44fbcfedf7c193bc2c59961094b565b6001600160a01b038216736fb0855c404e09c47c3fbca25f08d4e41f9f062f14156128c4575073e41d2489571d322189246dafa5ebde1f4699f49861094b565b836001600160a01b0316856001600160a01b031614156136345761088f565b6136468161040063ffffffff610ff716565b151561365c82634000000063ffffffff610ff716565b15151415613933576001600160a01b038516736a4ffaafa8dd400676df8076ad6c724867b0e2e814156137e957736a4ffaafa8dd400676df8076ad6c724867b0e2e86001600160a01b0316637f8661a1846040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156136e357600080fd5b505af11580156136f7573d6000803e3d6000fd5b5050604080516370a0823160e01b815230600482015290516000935073b683d83a532e2cb7dfa5275eed3698436371cc9f92506370a0823191602480820192602092909190829003018186803b15801561375057600080fd5b505afa158015613764573d6000803e3d6000fd5b505050506040513d602081101561377a57600080fd5b5051905080156137ce5760606137a873b683d83a532e2cb7dfa5275eed3698436371cc9f87846001876102da565b9150506137cc73b683d83a532e2cb7dfa5275eed3698436371cc9f87848487610739565b505b6130246000805160206146678339815191528686868661393c565b6001600160a01b038416736a4ffaafa8dd400676df8076ad6c724867b0e2e81415613933576138298560008051602061466783398151915285858561393c565b604080516370a0823160e01b81523060048201529051600091600080516020614667833981519152916370a0823191602480820192602092909190829003018186803b15801561387857600080fd5b505afa15801561388c573d6000803e3d6000fd5b505050506040513d60208110156138a257600080fd5b505190506138d9600080516020614667833981519152736a4ffaafa8dd400676df8076ad6c724867b0e2e88363ffffffff6114c816565b736a4ffaafa8dd400676df8076ad6c724867b0e2e86001600160a01b031663049878f3826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561184557600080fd5b61088f85858585855b836001600160a01b0316856001600160a01b0316141561395b5761088f565b61396c81604063ffffffff610ff716565b151561398282634000000063ffffffff610ff716565b15151415613bf0576001600160a01b0385167306af07097c9eeb7fd685c692751d5c66db49c2151415613aa7576040805163ef693bed60e01b81523060048201526024810185905290517306af07097c9eeb7fd685c692751d5c66db49c2159163ef693bed91604480830192600092919082900301818387803b158015613a0857600080fd5b505af1158015613a1c573d6000803e3d6000fd5b5050604080516370a0823160e01b8152306004820152905161172d93506000805160206146678339815191529250879183916370a0823191602480820192602092909190829003018186803b158015613a7457600080fd5b505afa158015613a88573d6000803e3d6000fd5b505050506040513d6020811015613a9e57600080fd5b50518585613bf9565b6001600160a01b0384167306af07097c9eeb7fd685c692751d5c66db49c2151415613bf057613ae785600080516020614667833981519152858585613bf9565b604080516370a0823160e01b81523060048201529051600091600080516020614667833981519152916370a0823191602480820192602092909190829003018186803b158015613b3657600080fd5b505afa158015613b4a573d6000803e3d6000fd5b505050506040513d6020811015613b6057600080fd5b50519050613b976000805160206146678339815191527306af07097c9eeb7fd685c692751d5c66db49c2158363ffffffff6114c816565b60408051633b4da69f60e01b81523060048201526024810183905290517306af07097c9eeb7fd685c692751d5c66db49c21591633b4da69f91604480830192600092919082900301818387803b15801561184557600080fd5b61088f85858585855b836001600160a01b0316856001600160a01b03161415613c185761088f565b613c2e816502000000000063ffffffff610ff716565b1515613c4482634000000063ffffffff610ff716565b15151415614444576001600160a01b03851673e2f2a5c287993345a840db3b0845fbc70f5935a51415614187576001600160a01b03841673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481480613cb257506001600160a01b038416600080516020614667833981519152145b80613cd957506001600160a01b03841673dac17f958d2ee523a2206206994597c13d831ec7145b80613cfb57506001600160a01b0384166e085d4780b73119b644ae5ecd22b376145b15613efb5760408051633b3fb85360e21b81526001600160a01b03878116600483015260248201869052861660448201529051600091734c5e03065bc52cce84f3ac94df14bbac27eac89b9163ecfee14c916064808201928692909190829003018186803b158015613d6c57600080fd5b505afa158015613d80573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526060811015613da957600080fd5b815160208301805160405192949293830192919084600160201b821115613dcf57600080fd5b908301906020820185811115613de457600080fd5b8251600160201b811182820188101715613dfd57600080fd5b82525081516020918201929091019080838360005b83811015613e2a578181015183820152602001613e12565b50505050905090810190601f168015613e575780820380516001836020036101000a031916815260200191505b5060408181526020928301516301e9a69560e41b83526001600160a01b038d16600484015260248301819052905190975073e2f2a5c287993345a840db3b0845fbc70f5935a59650631e9a695095506044808301955092935091908290030181600087803b158015613ec857600080fd5b505af1158015613edc573d6000803e3d6000fd5b505050506040513d6020811015613ef257600080fd5b5061172d915050565b60408051633b3fb85360e21b81526001600160a01b03871660048201526024810185905260008051602061466783398151915260448201529051600091734c5e03065bc52cce84f3ac94df14bbac27eac89b9163ecfee14c916064808201928692909190829003018186803b158015613f7357600080fd5b505afa158015613f87573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526060811015613fb057600080fd5b815160208301805160405192949293830192919084600160201b821115613fd657600080fd5b908301906020820185811115613feb57600080fd5b8251600160201b81118282018810171561400457600080fd5b82525081516020918201929091019080838360005b83811015614031578181015183820152602001614019565b50505050905090810190601f16801561405e5780820380516001836020036101000a031916815260200191505b5060408181526020928301516301e9a69560e41b8352600080516020614667833981519152600484015260248301819052905190975073e2f2a5c287993345a840db3b0845fbc70f5935a59650631e9a695095506044808301955092935091908290030181600087803b1580156140d457600080fd5b505af11580156140e8573d6000803e3d6000fd5b505050506040513d60208110156140fe57600080fd5b5050604080516370a0823160e01b815230600482015290516130249160008051602061466783398151915291889183916370a0823191602480820192602092909190829003018186803b15801561415457600080fd5b505afa158015614168573d6000803e3d6000fd5b505050506040513d602081101561417e57600080fd5b5051868661444d565b6001600160a01b03841673e2f2a5c287993345a840db3b0845fbc70f5935a51415614444576001600160a01b03851673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4814806141ed57506001600160a01b038516600080516020614667833981519152145b8061421457506001600160a01b03851673dac17f958d2ee523a2206206994597c13d831ec7145b8061423657506001600160a01b0385166e085d4780b73119b644ae5ecd22b376145b1561430c576142696001600160a01b03861673e2f2a5c287993345a840db3b0845fbc70f5935a58563ffffffff6114c816565b60408051631ba0488760e21b81526001600160a01b0387811660048301528616602482015260448101859052306064820152905173e2f2a5c287993345a840db3b0845fbc70f5935a591636e81221c9160848083019260209291908290030181600087803b1580156142da57600080fd5b505af11580156142ee573d6000803e3d6000fd5b505050506040513d602081101561430457600080fd5b5061172d9050565b6143278560008051602061466783398151915285858561444d565b604080516370a0823160e01b8152306004820152905173e2f2a5c287993345a840db3b0845fbc70f5935a591636e81221c9160008051602061466783398151915291889183916370a08231916024808301926020929190829003018186803b15801561439257600080fd5b505afa1580156143a6573d6000803e3d6000fd5b505050506040513d60208110156143bc57600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0394851660048201529290931660248301526044820152306064820152905160848083019260209291908290030181600087803b15801561441a57600080fd5b505af115801561442e573d6000803e3d6000fd5b505050506040513d60208110156125fc57600080fd5b61088f85858585855b836001600160a01b0316856001600160a01b0316141561446c5761088f565b61088f8585858585600154614494906001600160a01b0387811691168563ffffffff6114c816565b6001546001600160a01b039081169063e2a7515e906144b4908816610914565b6144bf5760006144c1565b845b878787600088886040518863ffffffff1660e01b815260040180876001600160a01b03166001600160a01b03168152602001866001600160a01b03166001600160a01b0316815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019060200280838360005b83811015614559578181015183820152602001614541565b505050509050019750505050505050506020604051808303818588803b15801561458257600080fd5b505af1158015614596573d6000803e3d6000fd5b50505050506040513d60208110156145ad57600080fd5b50505050505050565b6040518060e001604052806007906020820280388339509192915050565b604051806103600160405280601b906020820280388339509192915050565b6040518061010001604052806008906020820280388339509192915050565b604051806101a00160405280600d90602082028038833950919291505056fe4f6e6553706c69743a2061637475616c2072657475726e20616d6f756e74206973206c657373207468616e206d696e52657475726e0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f57726f6e6720757365616765206f66204554482e756e6976657273616c5472616e7366657246726f6d28294f6e6553706c69743a20446f206e6f7420757365206d756c74697061746820776974682065616368206f746865725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a72315820449cfd47120284ae61b36d9bc7383c4d74daab37158983094b3c5f55cde7670c64736f6c634300051100320000000000000000000000004c9327ad39d41bb6c39c300fe6742914f6e9e6ea00000000000000000000000068c70d41b193a4a86e56e9020aa4c910e4abbaf3
Deployed Bytecode
0x60806040526004361061004a5760003560e01c8063085e2c5b1461005957806343ee21f0146101035780638373f26514610134578063e2a7515e146101eb578063fbe4ed95146102c5575b3332141561005757600080fd5b005b34801561006557600080fd5b506100a8600480360360a081101561007c57600080fd5b506001600160a01b038135811691602081013590911690604081013590606081013590608001356102da565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156100ee5781810151838201526020016100d6565b50505050905001935050505060405180910390f35b34801561010f57600080fd5b506101186102fd565b604080516001600160a01b039092168252519081900360200190f35b34801561014057600080fd5b50610189600480360360c081101561015757600080fd5b506001600160a01b03813581169160208101359091169060408101359060608101359060808101359060a0013561030c565b6040518084815260200183815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156101d55781810151838201526020016101bd565b5050505090500194505050505060405180910390f35b6102b3600480360360c081101561020157600080fd5b6001600160a01b03823581169260208101359091169160408201359160608101359181019060a081016080820135600160201b81111561024057600080fd5b82018360208201111561025257600080fd5b803590602001918460208302840111600160201b8311171561027357600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505091359250610463915050565b60408051918252519081900360200190f35b3480156102d157600080fd5b5061011861055f565b600060606102ed8787878787600061030c565b9199919850909650505050505050565b6001546001600160a01b031681565b6000805460408051638373f26560e01b81526001600160a01b038a81166004830152898116602483015260448201899052606482018890526084820187905260a48201869052915184936060931691638373f2659160c48083019287929190829003018186803b15801561037f57600080fd5b505afa158015610393573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405260608110156103bc57600080fd5b81516020830151604080850180519151939592948301929184600160201b8211156103e657600080fd5b9083019060208201858111156103fb57600080fd5b82518660208202830111600160201b8211171561041757600080fd5b82525081516020918201928201910280838360005b8381101561044457818101518382015260200161042c565b5050505090500160405250505092509250925096509650969350505050565b60006104806001600160a01b03881633308863ffffffff61056e16565b600061049b6001600160a01b0389163063ffffffff61068d16565b90506104aa8888838787610739565b6104c36001600160a01b0388163063ffffffff61068d16565b9150848210156105045760405162461bcd60e51b81526004018080602001828103825260358152602001806146326035913960400191505060405180910390fd5b61051e6001600160a01b038816338463ffffffff61089616565b506105533361053c6001600160a01b038b163063ffffffff61068d16565b6001600160a01b038b16919063ffffffff61089616565b50509695505050505050565b6000546001600160a01b031681565b8061057857610687565b61058184610914565b1561066c576001600160a01b0383163314801561059e5750803410155b6105d95760405162461bcd60e51b815260040180806020018281038252602b815260200180614687602b913960400191505060405180910390fd5b6001600160a01b0382163014610621576040516001600160a01b0383169082156108fc029083906000818181858888f1935050505015801561061f573d6000803e3d6000fd5b505b8034111561066757336108fc61063d348463ffffffff61095016565b6040518115909202916000818181858888f19350505050158015610665573d6000803e3d6000fd5b505b610687565b6106876001600160a01b03851684848463ffffffff61099216565b50505050565b600061069883610914565b156106ae57506001600160a01b03811631610733565b826001600160a01b03166370a08231836040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561070457600080fd5b505afa158015610718573d6000803e3d6000fd5b505050506040513d602081101561072e57600080fd5b505190505b92915050565b6000610744826109ec565b90506001600160a01b0381161580159061076557506107638682610ba5565b155b801561077857506107768186610ba5565b155b1561088057606083516040519080825280602002602001820160405280156107aa578160200160208202803883390190505b50905060005b84518110156107ef578481815181106107c557fe5b602002602001015160ff168282815181106107dc57fe5b60209081029190910101526001016107b0565b506107fd8783878487610bea565b600061080885610bf7565b905060005b855181101561085057600886828151811061082457fe5b6020026020010151901c60ff1683828151811061083d57fe5b602090810291909101015260010161080d565b50610878838861086f6001600160a01b0383163063ffffffff61068d16565b85858917610bea565b50505061088f565b61088d8686868686610bea565b505b5050505050565b6000816108a55750600161090d565b6108ae84610914565b156108ef576040516001600160a01b0384169083156108fc029084906000818181858888f193505050501580156108e9573d6000803e3d6000fd5b5061090d565b6109096001600160a01b038516848463ffffffff610d5116565b5060015b9392505050565b60006001600160a01b038216158061094857506001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee145b90505b919050565b600061090d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610da8565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610687908590610e3f565b60006109f66145b6565b6040518060e0016040528061020081526020016201000081526020016202000081526020016404000000008152602001640800000000815260200164100000000081526020016420000000008152509050610a4f6145b6565b506040805160e08101825273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8152600080516020614667833981519152602082015273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb489181019190915273dac17f958d2ee523a2206206994597c13d831ec76060820152732260fac5e5542a773aa44fbcfedf7c193bc2c5996080820152731bbe271d15bb64df0bc6cd28df9ff322f2ebd84760a082015273eb4c2781e4eba804ce9a9803c67d0893436bb27d60c082015260005b6007811015610b9d57610b36838260078110610b2457fe5b6020020151869063ffffffff610ff716565b15610b95576001600160a01b03841615610b815760405162461bcd60e51b815260040180806020018281038252602e8152602001806146b2602e913960400191505060405180910390fd5b818160078110610b8d57fe5b602002015193505b600101610b0c565b505050919050565b6000610bb9836001600160a01b0316610914565b8015610bd25750610bd2826001600160a01b0316610914565b8061090d5750506001600160a01b0391821691161490565b61088f8585858585610ffd565b6000610c016145d4565b604051806103600160405280600181526020016002815260200160048152602001600881526020016110008152602001612000815260200161400081526020016180008152602001620400008152602001621000008152602001622000008152602001624000008152602001630100000081526020016302000000815260200163040000008152602001630800000081526020016310000000815260200163800000008152602001600160201b815260200164020000000081526020016440000000008152602001648000000000815260200165020000000000815260200165040000000000815260200160008152602001600081526020016000815250905060008090505b8351811015610d4a576000848281518110610d1e57fe5b60200260200101511115610d42578181601b8110610d3857fe5b6020020151831792505b600101610d07565b5050919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610da3908490610e3f565b505050565b60008184841115610e375760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610dfc578181015183820152602001610de4565b50505050905090810190601f168015610e295780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b610e51826001600160a01b031661134b565b610ea2576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610ee05780518252601f199092019160209182019101610ec1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610f42576040519150601f19603f3d011682016040523d82523d6000602084013e610f47565b606091505b509150915081610f9e576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b80511561068757808060200190516020811015610fba57600080fd5b50516106875760405162461bcd60e51b815260040180806020018281038252602a8152602001806146e0602a913960400191505060405180910390fd5b16151590565b836001600160a01b0316856001600160a01b0316141561101c5761088f565b611032816508000000000063ffffffff610ff716565b151561104882634000000063ffffffff610ff716565b1515141561133e57600061105b86611387565b90506001600160a01b03808216146111e357856001600160a01b031663db006a75856040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156110b357600080fd5b505af11580156110c7573d6000803e3d6000fd5b505050506040513d60208110156110dd57600080fd5b50600090506110fb6001600160a01b0383163063ffffffff61068d16565b90506001600160a01b03821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214156111955773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316632e1a7d4d826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561117c57600080fd5b505af1158015611190573d6000803e3d6000fd5b505050505b6111e16001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2146111c257826111d8565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b87838787610ffd565b505b6111ec85611387565b90506001600160a01b038082161461133c5761124a866001600160a01b03831673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461122c5782611242565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b8686866114bb565b60006112a5306001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21461127a5783611290565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b6001600160a01b03169063ffffffff61068d16565b90505b6112c26001600160a01b038316878363ffffffff6114c816565b856001600160a01b031663a0712d68826040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b15801561130857600080fd5b505af115801561131c573d6000803e3d6000fd5b505050506040513d602081101561133257600080fd5b5061088f92505050565b505b61088f85858585856114bb565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061137f57508115155b949350505050565b604080516001600160a01b03831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166330df135f60e21b178152915181516000938493606093734cb120dd1d33c9a3de8bc15620c7cd43418d77e293919290918291908083835b602083106114155780518252601f1990920191602091820191016113f6565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d8060008114611475576040519150601f19603f3d011682016040523d82523d6000602084013e61147a565b606091505b509150915081158061148b57508051155b1561149c576000199250505061094b565b8080602001905160208110156114b157600080fd5b5051949350505050565b61088f85858585856115bc565b6114d183610914565b610da357806114fa576114f56001600160a01b03841683600063ffffffff61190516565b610da3565b60408051636eb1769f60e11b81523060048201526001600160a01b038481166024830152915160009286169163dd62ed3e916044808301926020929190829003018186803b15801561154b57600080fd5b505afa15801561155f573d6000803e3d6000fd5b505050506040513d602081101561157557600080fd5b50519050818110156106875780156115a2576115a26001600160a01b03851684600063ffffffff61190516565b6106876001600160a01b038516848463ffffffff61190516565b836001600160a01b0316856001600160a01b031614156115db5761088f565b6115ee816208000063ffffffff610ff716565b151561160482634000000063ffffffff610ff716565b151514156118f8576001600160a01b03851673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2141561173257604080516370a0823160e01b8152306004820152905173c02aaa39b223fe8d0a0e5c4f27ead9083c756cc291632e1a7d4d9183916370a08231916024808301926020929190829003018186803b15801561168a57600080fd5b505afa15801561169e573d6000803e3d6000fd5b505050506040513d60208110156116b457600080fd5b5051604080516001600160e01b031960e085901b168152600481019290925251602480830192600092919082900301818387803b1580156116f457600080fd5b505af1158015611708573d6000803e3d6000fd5b5050505061172d73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee85858585611a18565b61088f565b6001600160a01b03851673c0829421c1d260bd3cb3e0f06cfe2d52db2ce31514156117b057604080516370a0823160e01b8152306004820152905173c0829421c1d260bd3cb3e0f06cfe2d52db2ce31591632e1a7d4d9183916370a08231916024808301926020929190829003018186803b15801561168a57600080fd5b6001600160a01b03841673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21415611863576117f68573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8585856115bc565b73c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561184557600080fd5b505af1158015611859573d6000803e3d6000fd5b505050505061088f565b6001600160a01b03841673c0829421c1d260bd3cb3e0f06cfe2d52db2ce31514156118f8576118a98573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8585856115bc565b73c0829421c1d260bd3cb3e0f06cfe2d52db2ce3156001600160a01b031663d0e30db0476040518263ffffffff1660e01b81526004016000604051808303818588803b15801561184557600080fd5b61088f8585858585611a18565b80158061198b575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b15801561195d57600080fd5b505afa158015611971573d6000803e3d6000fd5b505050506040513d602081101561198757600080fd5b5051155b6119c65760405162461bcd60e51b815260040180806020018281038252603681526020018061470a6036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b179052610da3908490610e3f565b61088f85858585855b611a34816280000063ffffffff610ff716565b15611a4982634000000063ffffffff610ff716565b151415611e9b57611a586145f3565b611a60611ea8565b905060005b6008811015611c3357818160088110611a7a57fe5b60200201516001600160a01b0316876001600160a01b03161415611c2b576000828260088110611aa657fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611ae357600080fd5b505afa158015611af7573d6000803e3d6000fd5b505050506040513d6020811015611b0d57600080fd5b505190506000838360088110611b1f57fe5b60200201516001600160a01b031663c85c93aa8860016000604051908082528060200260200182016040528015611b60578160200160208202803883390190505b506040518463ffffffff1660e01b8152600401808481526020018315151515815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015611bc0578181015183820152602001611ba8565b50505050905001945050505050602060405180830381600087803b158015611be757600080fd5b505af1158015611bfb573d6000803e3d6000fd5b505050506040513d6020811015611c1157600080fd5b50519050611c228289838989611a21565b5050505061088f565b600101611a65565b5060005b6008811015611e9857818160088110611c4c57fe5b60200201516001600160a01b0316866001600160a01b03161415611e90576000828260088110611c7857fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b158015611cb557600080fd5b505afa158015611cc9573d6000803e3d6000fd5b505050506040513d6020811015611cdf57600080fd5b50519050611cf08882888888611f8e565b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b158015611d3a57600080fd5b505afa158015611d4e573d6000803e3d6000fd5b505050506040513d6020811015611d6457600080fd5b50519050611d93848460088110611d7757fe5b60200201516001600160a01b038416908363ffffffff6114c816565b838360088110611d9f57fe5b60200201516001600160a01b0316633cfcef64826000604051908082528060200260200182016040528015611dde578160200160208202803883390190505b506040518363ffffffff1660e01b81526004018083815260200180602001828103825283818151815260200191508051906020019060200280838360005b83811015611e34578181015183820152602001611e1c565b505050509050019350505050602060405180830381600087803b158015611e5a57600080fd5b505af1158015611e6e573d6000803e3d6000fd5b505050506040513d6020811015611e8457600080fd5b5061088f945050505050565b600101611c37565b50505b61088f8585858585611f8e565b611eb06145f3565b5060408051610100810182527378751b12da02728f467a44eac40f5cbc16bd793481527312b98c621e8754ae70d0fdbbc73d6208bc3e3ca660208201527363d27b3da94a9e871222cb0a32232674b02d2f2d91810191909152731846bdfdb6a0f5c473dec610144513bd071999fb606082015273cddb1bceb7a1979c6caa0229820707429dd3ec6c60808201527342740698959761baf1b06baa51efbd88cb1d862b60a08201527310ec0d497824e342bcb0edce00959142aaa766dd60c082015273eb66acc3d011056b00ea521f8203580c2e5d399160e082015290565b61088f85858585855b836001600160a01b0316856001600160a01b03161415611fb65761088f565b611fc88161080063ffffffff610ff716565b1515611fde82634000000063ffffffff610ff716565b1515141561237157611fee614612565b611ff661237e565b905060005b600d8110156121ab578181600d811061201057fe5b60200201516001600160a01b0316876001600160a01b031614156121a35760008282600d811061203c57fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561207957600080fd5b505afa15801561208d573d6000803e3d6000fd5b505050506040513d60208110156120a357600080fd5b505190508282600d81106120b357fe5b60200201516001600160a01b0316632e1a7d4d876040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156120fd57600080fd5b505af1158015612111573d6000803e3d6000fd5b505050506108788188836001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b03166001600160a01b0316815260200191505060206040518083038186803b15801561217057600080fd5b505afa158015612184573d6000803e3d6000fd5b505050506040513d602081101561219a57600080fd5b50518888611f97565b600101611ffb565b5060005b600d81101561236e578181600d81106121c457fe5b60200201516001600160a01b0316866001600160a01b031614156123665760008282600d81106121f057fe5b60200201516001600160a01b031663fc0c546a6040518163ffffffff1660e01b815260040160206040518083038186803b15801561222d57600080fd5b505afa158015612241573d6000803e3d6000fd5b505050506040513d602081101561225757600080fd5b5051905061226888828888886124eb565b604080516370a0823160e01b815230600482015290516000916001600160a01b038416916370a0823191602480820192602092909190829003018186803b1580156122b257600080fd5b505afa1580156122c6573d6000803e3d6000fd5b505050506040513d60208110156122dc57600080fd5b505190506122ef8484600d8110611d7757fe5b8383600d81106122fb57fe5b60200201516001600160a01b031663b6b55f25826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561234557600080fd5b505af1158015612359573d6000803e3d6000fd5b505050505050505061088f565b6001016121af565b50505b61088f85858585856124eb565b612386614612565b50604080516101a0810182527316de59092dae5ccf4a1e6439d611fd0653f0bd0181527304aa51bbcb46541455ccf1b8bef2ebc5d3787ec960208201527373a052500105205d34daf004eab301916da8190f918101919091527383f798e925bcd4017eb265844fddabb448f1707d606082015273d6ad7a6750a7593e092a9b218d66c0a814a3436e608082015273f61718057901f84c4eec4339ef8f0d86d2b4560060a08201527304bc0ab673d88ae9dbc9da2380cb6b79c4bca9ae60c082015273c2cb1040220768554cf699b0d863a3cd4324ce3260e082015273e6354ed5bc4b393a5aad09f21c46e101e692d4476101008201527326ea744e5b887e5205727f55dfbe8685e3b219516101208201527399d1fa417f94dcd62bfe781a1213c092a47041bc610140820152739777d7e2b60bb01759d0e2f8be2095df444cb07e610160820152731be5d71f2da660bfdee8012ddc58d024448a0a5961018082015290565b61088f85858585855b836001600160a01b0316856001600160a01b031614156125135761088f565b61252481601063ffffffff610ff716565b151561253a82634000000063ffffffff610ff716565b151514156126ce57600061254d866126db565b90506001600160a01b038082161461260357856001600160a01b031663db006a75856040518263ffffffff1660e01b815260040180828152602001915050602060405180830381600087803b1580156125a557600080fd5b505af11580156125b9573d6000803e3d6000fd5b505050506040513d60208110156125cf57600080fd5b50600090506125ed6001600160a01b0383163063ffffffff61068d16565b90506125fc82878387876124f4565b505061088f565b61260c856126db565b90506001600160a01b03808216146126cc5761262b86828686866128cd565b60006126466001600160a01b0383163063ffffffff61068d16565b905061265a826001600160a01b0316610914565b156112a857734ddc2d193948926d02f9b1fe9e1daa0718270ed56001600160a01b0316631249c58b826040518263ffffffff1660e01b81526004016000604051808303818588803b1580156126ae57600080fd5b505af11580156126c2573d6000803e3d6000fd5b50505050506125fc565b505b61088f85858585856128cd565b60006001600160a01b038216734ddc2d193948926d02f9b1fe9e1daa0718270ed5141561270a5750600061094b565b6001600160a01b038216735d3a536e4d6dbd6114cc1ead35777bab948e36431415612744575060008051602061466783398151915261094b565b6001600160a01b038216736c8c6b02e7b2be14d4fa6022dfd6d75921d90e4e14156127845750730d8775f648430679a709e98d2b0cb6250d2887ef61094b565b6001600160a01b03821673158079ee67fce2f58472a96584a73c7ab9ac95c114156127c45750731985365e9f78359a9b6ad760e32412f4a445e86261094b565b6001600160a01b0382167339aa39c021dfbae8fac545936693ac917d5e75631415612804575073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4861094b565b6001600160a01b03821673c11b1268c1a384e55c48c2391d8d480264a3a7f414156128445750732260fac5e5542a773aa44fbcfedf7c193bc2c59961094b565b6001600160a01b03821673b3319f5d18bc0d84dd1b4825dcde5d5f7266d4071415612884575073e41d2489571d322189246dafa5ebde1f4699f49861094b565b6001600160a01b03821673f650c3d88d12db855b8bf7d11be6c55a4e07dcc914156128c4575073dac17f958d2ee523a2206206994597c13d831ec761094b565b50600019919050565b61088f8585858585836001600160a01b0316856001600160a01b031614156128f45761088f565b61290581602063ffffffff610ff716565b151561291b82634000000063ffffffff610ff716565b15151415612bc257600061292e86612bcf565b90506001600160a01b0380821614612a7e57612952816001600160a01b0316610914565b156129d8576040805163081a6b2560e41b81523060048201526024810186905290516001600160a01b038816916381a6b2509160448083019260209291908290030181600087803b1580156129a657600080fd5b505af11580156129ba573d6000803e3d6000fd5b505050506040513d60208110156129d057600080fd5b50612a549050565b60408051632770a7eb60e21b81523060048201526024810186905290516001600160a01b03881691639dc29fac9160448083019260209291908290030181600087803b158015612a2757600080fd5b505af1158015612a3b573d6000803e3d6000fd5b505050506040513d6020811015612a5157600080fd5b50505b6000612a6f6001600160a01b0383163063ffffffff61068d16565b90506125fc8287838787612f45565b612a8785612bcf565b90506001600160a01b0380821614612bc057612aa68682868686612f45565b6000612ac16001600160a01b0383163063ffffffff61068d16565b9050612ad5826001600160a01b0316610914565b15612b575760408051638f6ede1f60e01b815230600482015290516001600160a01b03881691638f6ede1f91849160248082019260209290919082900301818588803b158015612b2457600080fd5b505af1158015612b38573d6000803e3d6000fd5b50505050506040513d6020811015612b4f57600080fd5b506125fc9050565b612b716001600160a01b038316878363ffffffff6114c816565b604080516340c10f1960e01b81523060048201526024810183905290516001600160a01b038816916340c10f199160448083019260209291908290030181600087803b15801561130857600080fd5b505b61088f8585858585612f45565b6000612be3826001600160a01b0316610914565b15612bf1575060001961094b565b60408051600481526024810182526020810180516001600160e01b03166306fdde0360e01b178152915181516000936060936001600160a01b0388169361138893919290918291908083835b60208310612c5c5780518252601f199092019160209182019101612c3d565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303818686fa925050503d8060008114612cbd576040519150601f19603f3d011682016040523d82523d6000602084013e612cc2565b606091505b509150915081612cd8576000199250505061094b565b6000805b8251816006011015612e3157828160000181518110612cf757fe5b6020910101516001600160f81b031916602360f91b148015612d3a5750828160010181518110612d2357fe5b6020910101516001600160f81b031916607560f81b145b8015612d675750828160020181518110612d5057fe5b6020910101516001600160f81b031916601b60fa1b145b8015612d945750828160030181518110612d7d57fe5b6020910101516001600160f81b031916606360f81b145b8015612dc15750828160040181518110612daa57fe5b6020910101516001600160f81b031916603960f91b145b8015612dee5750828160050181518110612dd757fe5b6020910101516001600160f81b031916607560f81b145b8015612e1b5750828160060181518110612e0457fe5b6020910101516001600160f81b031916606d60f81b145b15612e295760019150612e31565b600101612cdc565b5080612e4457600019935050505061094b565b60408051600481526024810182526020810180516001600160e01b031663797bf38560e01b178152915181516001600160a01b038916936113889392918291908083835b60208310612ea75780518252601f199092019160209182019101612e88565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303818686fa925050503d8060008114612f08576040519150601f19603f3d011682016040523d82523d6000602084013e612f0d565b606091505b50909350915082612f2557600019935050505061094b565b818060200190516020811015612f3a57600080fd5b505195945050505050565b61088f85858585855b836001600160a01b0316856001600160a01b03161415612f6d5761088f565b612f7e81608063ffffffff610ff716565b1515612f9482634000000063ffffffff610ff716565b151514156131e4576000612fa7866131f1565b90506001600160a01b038082161461302a57856001600160a01b031663db006a75856040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b158015612fff57600080fd5b505af1158015613013573d6000803e3d6000fd5b505050506130248186868686612f4e565b5061088f565b613033856131f1565b90506001600160a01b03808216146131e2576130528682868686613615565b600061306d6001600160a01b0383163063ffffffff61068d16565b905061310273398ec7346dcd622edc5ae82352f02be94c62d1196001600160a01b031663f2f4eb266040518163ffffffff1660e01b815260040160206040518083038186803b1580156130bf57600080fd5b505afa1580156130d3573d6000803e3d6000fd5b505050506040513d60208110156130e957600080fd5b50516001600160a01b038416908363ffffffff6114c816565b73398ec7346dcd622edc5ae82352f02be94c62d11963d2d0e06661312e6001600160a01b038516610914565b61313957600061313b565b825b61314d856001600160a01b0316610914565b613157578461316d565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee5b604080516001600160e01b031960e086901b1681526001600160a01b0390921660048301526024820186905261044d604483015251606480830192600092919082900301818588803b1580156131c257600080fd5b505af11580156131d6573d6000803e3d6000fd5b5050505050505061088f565b505b61088f8585858585613615565b60006001600160a01b038216733a3a65aab0dd2a17e3f1947ba16138cd37d08c0414156132205750600061094b565b6001600160a01b03821673fc1e690f61efd961294b3e1ce3313fbd8aa4f85d141561325a575060008051602061466783398151915261094b565b6001600160a01b038216739ba00d6856a4edf4665bca2c2309936572473b7e141561329a575073a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4861094b565b6001600160a01b03821673625ae63000f46200499120b906716420bd05924014156132da57507357ab1ec28d129707052df4df418d58a2d46d5f5161094b565b6001600160a01b038216736ee0f7bb50a54ab5253da0667b0dc2ee526c30a8141561331a5750734fabb145d64652a948d72533023f6e7a623c7c5361094b565b6001600160a01b038216734da9b813057d04baef4e5800e36083717b4a0341141561335557506e085d4780b73119b644ae5ecd22b37661094b565b6001600160a01b0382167371fc860f7d3a592a4a98740e39db31d25db65ae81415613395575073dac17f958d2ee523a2206206994597c13d831ec761094b565b6001600160a01b03821673e1ba0fb44ccb0d11b80f92f4f8ed94ca3ff51d0014156133d55750730d8775f648430679a709e98d2b0cb6250d2887ef61094b565b6001600160a01b038216739d91be44c06d373a8a226e1f3b146956083803eb1415613415575073dd974d5c2e2928dea5f71b9825b8b646686bd20061094b565b6001600160a01b038216737d2d3688df45ce7c552e19c27e007673da9204b8141561345557507380fb784b7ed66730e8b1dbd9820afd29931aab0361094b565b6001600160a01b03821673a64bd6c70cb9051f6a9ba1f163fdc07e0dfb5f841415613495575073514910771af9ca656af840dff83e8264ecf986ca61094b565b6001600160a01b038216736fce4a401b6b80ace52baaefe4421bd188e76f6f14156134d55750730f5d2fb29fb7d3cfee444a200298f468908cc94261094b565b6001600160a01b038216737deb5e830be29f91e298ba5ff1356bb7f814699814156135155750739f8f72aa9304c8b593d555f12ef6589cc3a579a261094b565b6001600160a01b0382167371010a9d003445ac60c4e6a7017c1e89a477b43814156135555750731985365e9f78359a9b6ad760e32412f4a445e86261094b565b6001600160a01b03821673328c4c80bc7aca0834db37e6600a6c49e12da4de1415613595575073c011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f61094b565b6001600160a01b03821673fc4b8ed459e00e5400be803a9bb3954234fd50e314156135d55750732260fac5e5542a773aa44fbcfedf7c193bc2c59961094b565b6001600160a01b038216736fb0855c404e09c47c3fbca25f08d4e41f9f062f14156128c4575073e41d2489571d322189246dafa5ebde1f4699f49861094b565b836001600160a01b0316856001600160a01b031614156136345761088f565b6136468161040063ffffffff610ff716565b151561365c82634000000063ffffffff610ff716565b15151415613933576001600160a01b038516736a4ffaafa8dd400676df8076ad6c724867b0e2e814156137e957736a4ffaafa8dd400676df8076ad6c724867b0e2e86001600160a01b0316637f8661a1846040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156136e357600080fd5b505af11580156136f7573d6000803e3d6000fd5b5050604080516370a0823160e01b815230600482015290516000935073b683d83a532e2cb7dfa5275eed3698436371cc9f92506370a0823191602480820192602092909190829003018186803b15801561375057600080fd5b505afa158015613764573d6000803e3d6000fd5b505050506040513d602081101561377a57600080fd5b5051905080156137ce5760606137a873b683d83a532e2cb7dfa5275eed3698436371cc9f87846001876102da565b9150506137cc73b683d83a532e2cb7dfa5275eed3698436371cc9f87848487610739565b505b6130246000805160206146678339815191528686868661393c565b6001600160a01b038416736a4ffaafa8dd400676df8076ad6c724867b0e2e81415613933576138298560008051602061466783398151915285858561393c565b604080516370a0823160e01b81523060048201529051600091600080516020614667833981519152916370a0823191602480820192602092909190829003018186803b15801561387857600080fd5b505afa15801561388c573d6000803e3d6000fd5b505050506040513d60208110156138a257600080fd5b505190506138d9600080516020614667833981519152736a4ffaafa8dd400676df8076ad6c724867b0e2e88363ffffffff6114c816565b736a4ffaafa8dd400676df8076ad6c724867b0e2e86001600160a01b031663049878f3826040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561184557600080fd5b61088f85858585855b836001600160a01b0316856001600160a01b0316141561395b5761088f565b61396c81604063ffffffff610ff716565b151561398282634000000063ffffffff610ff716565b15151415613bf0576001600160a01b0385167306af07097c9eeb7fd685c692751d5c66db49c2151415613aa7576040805163ef693bed60e01b81523060048201526024810185905290517306af07097c9eeb7fd685c692751d5c66db49c2159163ef693bed91604480830192600092919082900301818387803b158015613a0857600080fd5b505af1158015613a1c573d6000803e3d6000fd5b5050604080516370a0823160e01b8152306004820152905161172d93506000805160206146678339815191529250879183916370a0823191602480820192602092909190829003018186803b158015613a7457600080fd5b505afa158015613a88573d6000803e3d6000fd5b505050506040513d6020811015613a9e57600080fd5b50518585613bf9565b6001600160a01b0384167306af07097c9eeb7fd685c692751d5c66db49c2151415613bf057613ae785600080516020614667833981519152858585613bf9565b604080516370a0823160e01b81523060048201529051600091600080516020614667833981519152916370a0823191602480820192602092909190829003018186803b158015613b3657600080fd5b505afa158015613b4a573d6000803e3d6000fd5b505050506040513d6020811015613b6057600080fd5b50519050613b976000805160206146678339815191527306af07097c9eeb7fd685c692751d5c66db49c2158363ffffffff6114c816565b60408051633b4da69f60e01b81523060048201526024810183905290517306af07097c9eeb7fd685c692751d5c66db49c21591633b4da69f91604480830192600092919082900301818387803b15801561184557600080fd5b61088f85858585855b836001600160a01b0316856001600160a01b03161415613c185761088f565b613c2e816502000000000063ffffffff610ff716565b1515613c4482634000000063ffffffff610ff716565b15151415614444576001600160a01b03851673e2f2a5c287993345a840db3b0845fbc70f5935a51415614187576001600160a01b03841673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481480613cb257506001600160a01b038416600080516020614667833981519152145b80613cd957506001600160a01b03841673dac17f958d2ee523a2206206994597c13d831ec7145b80613cfb57506001600160a01b0384166e085d4780b73119b644ae5ecd22b376145b15613efb5760408051633b3fb85360e21b81526001600160a01b03878116600483015260248201869052861660448201529051600091734c5e03065bc52cce84f3ac94df14bbac27eac89b9163ecfee14c916064808201928692909190829003018186803b158015613d6c57600080fd5b505afa158015613d80573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526060811015613da957600080fd5b815160208301805160405192949293830192919084600160201b821115613dcf57600080fd5b908301906020820185811115613de457600080fd5b8251600160201b811182820188101715613dfd57600080fd5b82525081516020918201929091019080838360005b83811015613e2a578181015183820152602001613e12565b50505050905090810190601f168015613e575780820380516001836020036101000a031916815260200191505b5060408181526020928301516301e9a69560e41b83526001600160a01b038d16600484015260248301819052905190975073e2f2a5c287993345a840db3b0845fbc70f5935a59650631e9a695095506044808301955092935091908290030181600087803b158015613ec857600080fd5b505af1158015613edc573d6000803e3d6000fd5b505050506040513d6020811015613ef257600080fd5b5061172d915050565b60408051633b3fb85360e21b81526001600160a01b03871660048201526024810185905260008051602061466783398151915260448201529051600091734c5e03065bc52cce84f3ac94df14bbac27eac89b9163ecfee14c916064808201928692909190829003018186803b158015613f7357600080fd5b505afa158015613f87573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526060811015613fb057600080fd5b815160208301805160405192949293830192919084600160201b821115613fd657600080fd5b908301906020820185811115613feb57600080fd5b8251600160201b81118282018810171561400457600080fd5b82525081516020918201929091019080838360005b83811015614031578181015183820152602001614019565b50505050905090810190601f16801561405e5780820380516001836020036101000a031916815260200191505b5060408181526020928301516301e9a69560e41b8352600080516020614667833981519152600484015260248301819052905190975073e2f2a5c287993345a840db3b0845fbc70f5935a59650631e9a695095506044808301955092935091908290030181600087803b1580156140d457600080fd5b505af11580156140e8573d6000803e3d6000fd5b505050506040513d60208110156140fe57600080fd5b5050604080516370a0823160e01b815230600482015290516130249160008051602061466783398151915291889183916370a0823191602480820192602092909190829003018186803b15801561415457600080fd5b505afa158015614168573d6000803e3d6000fd5b505050506040513d602081101561417e57600080fd5b5051868661444d565b6001600160a01b03841673e2f2a5c287993345a840db3b0845fbc70f5935a51415614444576001600160a01b03851673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4814806141ed57506001600160a01b038516600080516020614667833981519152145b8061421457506001600160a01b03851673dac17f958d2ee523a2206206994597c13d831ec7145b8061423657506001600160a01b0385166e085d4780b73119b644ae5ecd22b376145b1561430c576142696001600160a01b03861673e2f2a5c287993345a840db3b0845fbc70f5935a58563ffffffff6114c816565b60408051631ba0488760e21b81526001600160a01b0387811660048301528616602482015260448101859052306064820152905173e2f2a5c287993345a840db3b0845fbc70f5935a591636e81221c9160848083019260209291908290030181600087803b1580156142da57600080fd5b505af11580156142ee573d6000803e3d6000fd5b505050506040513d602081101561430457600080fd5b5061172d9050565b6143278560008051602061466783398151915285858561444d565b604080516370a0823160e01b8152306004820152905173e2f2a5c287993345a840db3b0845fbc70f5935a591636e81221c9160008051602061466783398151915291889183916370a08231916024808301926020929190829003018186803b15801561439257600080fd5b505afa1580156143a6573d6000803e3d6000fd5b505050506040513d60208110156143bc57600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0394851660048201529290931660248301526044820152306064820152905160848083019260209291908290030181600087803b15801561441a57600080fd5b505af115801561442e573d6000803e3d6000fd5b505050506040513d60208110156125fc57600080fd5b61088f85858585855b836001600160a01b0316856001600160a01b0316141561446c5761088f565b61088f8585858585600154614494906001600160a01b0387811691168563ffffffff6114c816565b6001546001600160a01b039081169063e2a7515e906144b4908816610914565b6144bf5760006144c1565b845b878787600088886040518863ffffffff1660e01b815260040180876001600160a01b03166001600160a01b03168152602001866001600160a01b03166001600160a01b0316815260200185815260200184815260200180602001838152602001828103825284818151815260200191508051906020019060200280838360005b83811015614559578181015183820152602001614541565b505050509050019750505050505050506020604051808303818588803b15801561458257600080fd5b505af1158015614596573d6000803e3d6000fd5b50505050506040513d60208110156145ad57600080fd5b50505050505050565b6040518060e001604052806007906020820280388339509192915050565b604051806103600160405280601b906020820280388339509192915050565b6040518061010001604052806008906020820280388339509192915050565b604051806101a00160405280600d90602082028038833950919291505056fe4f6e6553706c69743a2061637475616c2072657475726e20616d6f756e74206973206c657373207468616e206d696e52657475726e0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f57726f6e6720757365616765206f66204554482e756e6976657273616c5472616e7366657246726f6d28294f6e6553706c69743a20446f206e6f7420757365206d756c74697061746820776974682065616368206f746865725361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a265627a7a72315820449cfd47120284ae61b36d9bc7383c4d74daab37158983094b3c5f55cde7670c64736f6c63430005110032
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004c9327ad39d41bb6c39c300fe6742914f6e9e6ea00000000000000000000000068c70d41b193a4a86e56e9020aa4c910e4abbaf3
-----Decoded View---------------
Arg [0] : _oneSplitView (address): 0x4C9327aD39d41Bb6c39C300FE6742914F6e9e6Ea
Arg [1] : _oneSplit (address): 0x68C70d41B193A4a86e56E9020aa4C910E4aBBAf3
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000004c9327ad39d41bb6c39c300fe6742914f6e9e6ea
Arg [1] : 00000000000000000000000068c70d41b193a4a86e56e9020aa4c910e4abbaf3
Deployed Bytecode Sourcemap
189449:3103:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;190089:10;190103:9;190089:23;;190081:32;;;;;;189449:3103;190129:515;;8:9:-1;5:2;;;30:1;27;20:12;5:2;190129:515:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;190129: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;190129:515:0;;;;;;;;;;;;;;;;;;189794:25;;8:9:-1;5:2;;;30:1;27;20:12;5:2;189794:25:0;;;:::i;:::-;;;;-1:-1:-1;;;;;189794:25:0;;;;;;;;;;;;;;190652:627;;8:9:-1;5:2;;;30:1;27;20:12;5:2;190652:627:0;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;;190652: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;190652:627:0;;;;;;;;;;;;;;;;;;;191287:798;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;-1:-1;;;;;191287:798:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;5:28;;2:2;;;46:1;43;36:12;2:2;191287:798:0;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;191287:798: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;191287:798:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;81:16;;74:27;;;;-1:-1;191287:798:0;;-1:-1:-1;;191287:798:0;;;-1:-1:-1;191287:798:0;;-1:-1:-1;;191287:798:0:i;:::-;;;;;;;;;;;;;;;;189754:33;;8:9:-1;5:2;;;30:1;27;20:12;5:2;189754:33:0;;;:::i;190129:515::-;190351:20;190386:29;190476:160;190515:9;190539;190563:6;190584:5;190604;190624:1;190476:24;:160::i;:::-;190443:193;;;;-1:-1:-1;190129:515:0;;-1:-1:-1;;;;;;;190129:515:0:o;189794:25::-;;;-1:-1:-1;;;;;189794:25:0;;:::o;190652:627::-;190930:20;191069:12;;:202;;;-1:-1:-1;;;191069:202:0;;-1:-1:-1;;;;;191069:202:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;190930:20;;191005:29;;191069:12;;:37;;:202;;;;;190930:20;;191069:202;;;;;;;:12;:202;;;5:2:-1;;;;30:1;27;20:12;5:2;191069:202:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;191069:202:0;;;;;;39:16:-1;36:1;17:17;2:54;101:4;191069: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;191069: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;191069:202:0;;421:4:-1;412:14;;;;191069:202:0;;;;;412:14:-1;191069: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;191069:202:0;;;;;;;;;;;191062:209;;;;;;190652:627;;;;;;;;;;:::o;191287:798::-;191502:20;191535:66;-1:-1:-1;;;;;191535:31:0;;191567:10;191587:4;191594:6;191535:66;:31;:66;:::i;:::-;191612:17;191632:43;-1:-1:-1;;;;;191632:28:0;;191669:4;191632:43;:28;:43;:::i;:::-;191612:63;;191686:59;191692:9;191703;191714;191725:12;191739:5;191686;:59::i;:::-;191773:43;-1:-1:-1;;;;;191773:28:0;;191810:4;191773:43;:28;:43;:::i;:::-;191758:58;;191851:9;191835:12;:25;;191827:91;;;;-1:-1:-1;;;191827:91:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;191929:53;-1:-1:-1;;;;;191929:27:0;;191957:10;191969:12;191929:53;:27;:53;:::i;:::-;-1:-1:-1;191993:84:0;192021:10;192033:43;-1:-1:-1;;;;;192033:28:0;;192070:4;192033:43;:28;:43;:::i;:::-;-1:-1:-1;;;;;191993:27:0;;;:84;;:27;:84;:::i;:::-;;191287:798;;;;;;;;;:::o;189754:33::-;;;-1:-1:-1;;;;;189754:33:0;;:::o;34068:617::-;34179:11;34175:50;;34207:7;;34175:50;34241:12;34247:5;34241;:12::i;:::-;34237:441;;;-1:-1:-1;;;;;34278:18:0;;34286:10;34278:18;:41;;;;;34313:6;34300:9;:19;;34278:41;34270:97;;;;-1:-1:-1;;;34270:97:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;34386:19:0;;34400:4;34386:19;34382:97;;34426:37;;-1:-1:-1;;;;;34426:29:0;;;:37;;;;;34456:6;;34426:37;;;;34456:6;34426:29;:37;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;34426:37:0;34382:97;34509:6;34497:9;:18;34493:101;;;34536:10;:42;34556:21;:9;34570:6;34556:21;:13;:21;:::i;:::-;34536:42;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;34536:42:0;34493:101;34237:441;;;34626:40;-1:-1:-1;;;;;34626:22:0;;34649:4;34655:2;34659:6;34626:40;:22;:40;:::i;:::-;34068:617;;;;:::o;35670:228::-;35748:7;35772:12;35778:5;35772;:12::i;:::-;35768:123;;;-1:-1:-1;;;;;;35808:11:0;;;35801:18;;35768:123;35859:5;-1:-1:-1;;;;;35859:15:0;;35875:3;35859:20;;;;;;;;;;;;;-1:-1:-1;;;;;35859:20:0;-1:-1:-1;;;;;35859:20:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;35859:20:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;35859:20:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;35859:20:0;;-1:-1:-1;35768:123:0;35670:228;;;;:::o;126193:1341::-;126378:15;126396:25;126415:5;126396:18;:25::i;:::-;126378:43;-1:-1:-1;;;;;;126438:21:0;;;;;;:59;;;126464:33;126477:9;126488:8;126464:12;:33::i;:::-;126463:34;126438:59;:97;;;;;126502:33;126515:8;126525:9;126502:12;:33::i;:::-;126501:34;126438:97;126434:942;;;126552:21;126590:12;:19;126576:34;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;126576:34:0;-1:-1:-1;126552:58:0;-1:-1:-1;126630:6:0;126625:114;126646:12;:19;126642:1;:23;126625:114;;;126701:12;126714:1;126701:15;;;;;;;;;;;;;;126719:4;126701:22;126691:4;126696:1;126691:7;;;;;;;;;;;;;;;;;:32;126667:3;;126625:114;;;;126753:153;126783:9;126811:8;126838:6;126863:4;126886:5;126753:11;:153::i;:::-;126921:23;126947:37;126971:12;126947:23;:37::i;:::-;126921:63;-1:-1:-1;127006:6:0;127001:121;127022:12;:19;127018:1;:23;127001:121;;;127097:1;127078:12;127091:1;127078:15;;;;;;;;;;;;;;:20;;127102:4;127077:29;127067:4;127072:1;127067:7;;;;;;;;;;;;;;;;;:39;127043:3;;127001:121;;;-1:-1:-1;127136:207:0;127166:8;127193:9;127221:42;-1:-1:-1;;;;;127221:27:0;;127257:4;127221:42;:27;:42;:::i;:::-;127282:4;127313:15;127305:5;:23;127136:11;:207::i;:::-;127358:7;;;;;126434:942;127388:138;127414:9;127438;127462:6;127483:12;127510:5;127388:11;:138::i;:::-;126193:1341;;;;;;;:::o;33712:348::-;33798:4;33819:11;33815:55;;-1:-1:-1;33854:4:0;33847:11;;33815:55;33886:12;33892:5;33886;:12::i;:::-;33882:171;;;33915:37;;-1:-1:-1;;;;;33915:29:0;;;:37;;;;;33945:6;;33915:37;;;;33945:6;33915:29;:37;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;33915:37:0;33882:171;;;33985:30;-1:-1:-1;;;;;33985:18:0;;34004:2;34008:6;33985:30;:18;:30;:::i;:::-;-1:-1:-1;34037:4:0;33882:171;33712:348;;;;;:::o;36488:166::-;36539:4;-1:-1:-1;;;;;36564:39:0;;;;:81;;-1:-1:-1;;;;;;36607:38:0;;33660:42;36607:38;36564:81;36556:90;;36488:166;;;;:::o;11008:136::-;11066:7;11093:43;11097:1;11100;11093:43;;;;;;;;;;;;;;;;;:3;:43::i;30367:204::-;30494:68;;;-1:-1:-1;;;;;30494:68:0;;;;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;30494:68:0;;;;;;;;25:18:-1;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;30468:95:0;;30487:5;;30468:18;:95::i;121285:903::-;121350:15;121378:26;;:::i;:::-;:334;;;;;;;;5201:5;121378:334;;;;5674:7;121378:334;;;;5769:7;121378:334;;;;7179:11;121378:334;;;;7278:11;121378:334;;;;7377:12;121378:334;;;;7479:12;121378:334;;;;;121725:29;;:::i;:::-;-1:-1:-1;121725:184:0;;;;;;;;44035:42;121725:184;;-1:-1:-1;;;;;;;;;;;121725:184:0;;;;44599:42;121725:184;;;;;;;44688:42;121725:184;;;;45223:42;121725:184;;;;45312:42;121725:184;;;;45134:42;121725:184;;;;-1:-1:-1;121922:259:0;121943:15;121939:1;:19;121922:259;;;121984:24;121996:8;122005:1;121996:11;;;;;;;;;;;121984:5;;:24;:11;:24;:::i;:::-;121980:190;;;-1:-1:-1;;;;;122037:21:0;;;122029:80;;;;-1:-1:-1;;;122029:80:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;122139:12;122152:1;122139:15;;;;;;;;;;;122128:26;;121980:190;121960:3;;121922:259;;;;121285:903;;;;;:::o;58389:162::-;58463:4;58489:14;:6;-1:-1:-1;;;;;58489:12:0;;:14::i;:::-;:32;;;;;58507:14;:6;-1:-1:-1;;;;;58507:12:0;;:14::i;:::-;58488:54;;;-1:-1:-1;;;;;;;58526:16:0;;;;;;;58389:162::o;184604:328::-;184789:135;184812:9;184836;184860:6;184881:12;184908:5;184789:8;:135::i;122196:1316::-;122282:13;122308:40;;:::i;:::-;:1027;;;;;;;;4348:4;122308:1027;;;;4406:4;122308:1027;;;;4777:4;122308:1027;;;;4835:4;122308:1027;;;;5411:6;122308:1027;;;;5476:6;122308:1027;;;;5538:6;122308:1027;;;;5606:6;122308:1027;;;;5865:7;122308:1027;;;;5997:8;122308:1027;;;;6136:8;122308:1027;;;;6263:8;122308:1027;;;;6460:9;122308:1027;;;;6528:9;122308:1027;;;;6600:9;122308:1027;;;;6672:9;122308:1027;;;;6745:10;122308:1027;;;;6964:10;122308:1027;;;;-1:-1:-1;;;122308:1027:0;;;;7105:11;122308:1027;;;;7576:12;122308:1027;;;;7642:12;122308:1027;;;;7784:13;122308:1027;;;;7856:13;122308:1027;;;;123291:1;122308:1027;;;;123307:1;122308:1027;;;;123323:1;122308:1027;;;;;123353:6;123362:1;123353:10;;123348:157;123369:12;:19;123365:1;:23;123348:157;;;123432:1;123414:12;123427:1;123414:15;;;;;;;;;;;;;;:19;123410:84;;;123463:12;123476:1;123463:15;;;;;;;;;;;123454:24;;;;123410:84;123390:3;;123348:157;;;;122196:1316;;;;:::o;30183:176::-;30292:58;;;-1:-1:-1;;;;;30292:58:0;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;30292:58:0;;;;;;;;25:18:-1;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;30266:85:0;;30285:5;;30266:18;:85::i;:::-;30183:176;;;:::o;11481:192::-;11567:7;11603:12;11595:6;;;;11587:29;;;;-1:-1:-1;;;11587:29: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;11587:29:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;11639:5:0;;;11481:192::o;32222:1114::-;32826:27;32834:5;-1:-1:-1;;;;;32826:25:0;;:27::i;:::-;32818:71;;;;;-1:-1:-1;;;32818:71:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;32963:12;32977:23;33012:5;-1:-1:-1;;;;;33004:19:0;33024:4;33004: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;;;33004: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;;32962:67:0;;;;33048:7;33040:52;;;;;-1:-1:-1;;;33040:52:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;33109:17;;:21;33105:224;;33251:10;33240:30;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;33240:30:0;33232:85;;;;-1:-1:-1;;;33232:85:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;43530:117;43621:12;43620:19;;;43530:117::o;184940:1928::-;185144:9;-1:-1:-1;;;;;185131:22:0;:9;-1:-1:-1;;;;;185131:22:0;;185127:61;;;185170:7;;185127:61;185250:29;:5;7921:13;185250:29;:11;:29;:::i;:::-;185204:75;;:42;:5;6896:10;185204:42;:11;:42;:::i;:::-;:75;;;185200:1503;;;185296:17;185316:33;185339:9;185316:22;:33::i;:::-;185296:53;-1:-1:-1;;;;;;185368:24:0;;;;185364:533;;185426:9;-1:-1:-1;;;;;185413:31:0;;185445:6;185413:39;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;185413:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;185413:39:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;185471:15:0;;-1:-1:-1;185489:44:0;-1:-1:-1;;;;;185489:29:0;;185527:4;185489:44;:29;:44;:::i;:::-;185471:62;-1:-1:-1;;;;;;185556:18:0;;44247:42;185556:18;185552:89;;;44247:42;-1:-1:-1;;;;;185599:13:0;;185613:7;185599:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;185599:22:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;185599:22:0;;;;185552:89;185659:222;-1:-1:-1;;;;;185691:18:0;;44247:42;185691:18;185690:47;;185727:10;185690:47;;;44035:42;185690:47;185760:9;185792:7;185822:12;185857:5;185659:8;:222::i;:::-;185364:533;;185926:33;185949:9;185926:22;:33::i;:::-;185913:46;-1:-1:-1;;;;;;185978:24:0;;;;185974:718;;186023:224;186057:9;-1:-1:-1;;;;;186090:18:0;;44247:42;186090:18;186089:47;;186126:10;186089:47;;;44035:42;186089:47;186159:6;186188:12;186223:5;186023:11;:224::i;:::-;186268:24;186295:83;186372:4;-1:-1:-1;;;;;186297:18:0;;44247:42;186297:18;186296:47;;186333:10;186296:47;;;44035:42;186296:47;-1:-1:-1;;;;;186295:68:0;;:83;:68;:83;:::i;:::-;186268:110;;186397:103;186520:65;-1:-1:-1;;;;;186520:27:0;;186556:9;186568:16;186520:65;:27;:65;:::i;:::-;186617:9;-1:-1:-1;;;;;186604:29:0;;186634:16;186604:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;186604:47:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;186604:47:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;186670:7:0;;-1:-1:-1;;;186670:7:0;185974:718;185200:1503;;186722:138;186748:9;186772;186796:6;186817:12;186844:5;186722:11;:138::i;27212:619::-;27272:4;27740:20;;27583:66;27780:23;;;;;;:42;;-1:-1:-1;27807:15:0;;;27780:42;27772:51;27212:619;-1:-1:-1;;;;27212:619:0:o;180555:455::-;180727:128;;;-1:-1:-1;;;;;180727:128:0;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;180727:128:0;;;;;;;25:18:-1;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;180678:188:0;;;;180623:6;;;;180657:17;;180503:42;;180727:128;;180678:188;;;;25:18:-1;180678:188:0;;25:18:-1;36:153;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;;;180678:188: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;;180642:224:0;;;;180884:7;180883:8;:28;;;-1:-1:-1;180895:11:0;;:16;180883:28;180879:78;;;-1:-1:-1;;180928:17:0;;;;;;180879:78;180987:4;180976:26;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;180976:26:0;;180555:455;-1:-1:-1;;;;180555:455:0:o;172000:329::-;172185:136;172209:9;172233;172257:6;172278:12;172305:5;172185:9;:136::i;35144:518::-;35237:12;35243:5;35237;:12::i;:::-;35232:423;;35270:11;35266:101;;35302:24;-1:-1:-1;;;;;35302:17:0;;35320:2;35324:1;35302:24;:17;:24;:::i;:::-;35345:7;;35266:101;35403:34;;;-1:-1:-1;;;35403:34:0;;35427:4;35403:34;;;;-1:-1:-1;;;;;35403:34:0;;;;;;;;;35383:17;;35403:15;;;;;:34;;;;;;;;;;;;;;:15;:34;;;5:2:-1;;;;30:1;27;20:12;5:2;35403:34:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;35403:34:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;35403:34:0;;-1:-1:-1;35456:18:0;;;35452:192;;;35499:13;;35495:86;;35537:24;-1:-1:-1;;;;;35537:17:0;;35555:2;35559:1;35537:24;:17;:24;:::i;:::-;35599:29;-1:-1:-1;;;;;35599:17:0;;35617:2;35621:6;35599:29;:17;:29;:::i;172337:1972::-;172542:9;-1:-1:-1;;;;;172529:22:0;:9;-1:-1:-1;;;;;172529:22:0;;172525:61;;;172568:7;;172525:61;172648:30;:5;5925:7;172648:30;:11;:30;:::i;:::-;172602:76;;:42;:5;6896:10;172602:42;:11;:42;:::i;:::-;:76;;;172598:1546;;;-1:-1:-1;;;;;172699:17:0;;44247:42;172699:17;172695:334;;;172751:29;;;-1:-1:-1;;;172751:29:0;;172774:4;172751:29;;;;;;44247:42;;172737:13;;44247:42;;172751:14;;:29;;;;;;;;;;;;;;44247:42;172751:29;;;5:2:-1;;;;30:1;27;20:12;5:2;172751:29:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;172751:29:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;172751:29:0;172737:44;;;-1:-1:-1;;;;;;172737:44:0;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;172737:44:0;;;;;;;-1:-1:-1;172737:44:0;;;;5:2:-1;;;;30:1;27;20:12;5:2;172737:44:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;172737:44:0;;;;172800:188;44035:42;172868:9;172900:6;172929:12;172964:5;172800:11;:188::i;:::-;173007:7;;172695:334;-1:-1:-1;;;;;173049:29:0;;44160:42;173049:29;173045:370;;;173125:41;;;-1:-1:-1;;;173125:41:0;;173160:4;173125:41;;;;;;44160:42;;173099:25;;44160:42;;173125:26;;:41;;;;;;;;;;;;;;44160:42;173125:41;;;5:2:-1;;;;30:1;27;20:12;173045:370:0;-1:-1:-1;;;;;173435:17:0;;44247:42;173435:17;173431:331;;;173473:186;173505:9;44035:42;173571:6;173600:12;173635:5;173473:9;:186::i;:::-;44247:42;-1:-1:-1;;;;;173678:12:0;;173697:21;173678:43;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;173678:43:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;173678:43:0;;;;;173740:7;;173431:331;-1:-1:-1;;;;;173782:29:0;;44160:42;173782:29;173778:355;;;173832:186;173864:9;44035:42;173930:6;173959:12;173994:5;173832:9;:186::i;:::-;44160:42;-1:-1:-1;;;;;174037:24:0;;174068:21;174037:55;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;173778:355:0;174163:138;174189:9;174213;174237:6;174258:12;174285:5;174163:11;:138::i;30579:621::-;30949:10;;;30948:62;;-1:-1:-1;30965:39:0;;;-1:-1:-1;;;30965:39:0;;30989:4;30965:39;;;;-1:-1:-1;;;;;30965:39:0;;;;;;;;;:15;;;;;;:39;;;;;;;;;;;;;;;:15;:39;;;5:2:-1;;;;30:1;27;20:12;5:2;30965:39:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;30965:39:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;30965:39:0;:44;30948:62;30940:152;;;;-1:-1:-1;;;30940:152:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;31129:62;;;-1:-1:-1;;;;;31129:62:0;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;31129:62:0;;;;;;;;25:18:-1;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;31103:89:0;;31122:5;;31103:18;:89::i;160399:329::-;160584:136;160608:9;160632;160656:6;160677:12;160704:5;160736:1426;160977:30;:5;6394:8;160977:30;:11;:30;:::i;:::-;160976:31;160930:42;:5;6896:10;160930:42;:11;:42;:::i;:::-;160929:43;:78;160925:1148;;;161024:22;;:::i;:::-;161049:13;:11;:13::i;:::-;161024:38;-1:-1:-1;161084:6:0;161079:401;161100:13;161096:1;:17;161079:401;;;161163:6;161170:1;161163:9;;;;;;;;;;;-1:-1:-1;;;;;161143:30:0;:9;-1:-1:-1;;;;;161143:30:0;;161139:326;;;161198:17;161218:6;161225:1;161218:9;;;;;;;;;;;-1:-1:-1;;;;;161218:15:0;;:17;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;161218:17:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;161218:17:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;161218:17:0;;-1:-1:-1;161258:14:0;161275:6;161282:1;161275:9;;;;;;;;;;;-1:-1:-1;;;;;161275:25:0;;161301:6;161309:4;161329:1;161315:16;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;161315:16:0;;161275:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;161275:57:0;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;161275:57:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;161275:57:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;161275:57:0;;-1:-1:-1;161355:61:0;161365:10;161377:9;161275:57;161396:12;161410:5;161355:9;:61::i;:::-;161439:7;;;;;;161139:326;161115:3;;161079:401;;;-1:-1:-1;161501:6:0;161496:566;161517:13;161513:1;:17;161496:566;;;161580:6;161587:1;161580:9;;;;;;;;;;;-1:-1:-1;;;;;161560:30:0;:9;-1:-1:-1;;;;;161560:30:0;;161556:491;;;161615:17;161635:6;161642:1;161635:9;;;;;;;;;;;-1:-1:-1;;;;;161635:15:0;;:17;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;161635:17:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;161635:17:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;161635:17:0;;-1:-1:-1;161675:63:0;161687:9;161635:17;161710:6;161718:12;161732:5;161675:11;:63::i;:::-;161791:35;;;-1:-1:-1;;;161791:35:0;;161820:4;161791:35;;;;;;161763:25;;-1:-1:-1;;;;;161791:20:0;;;;;:35;;;;;;;;;;;;;;;:20;:35;;;5:2:-1;;;;30:1;27;20:12;5:2;161791:35:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;161791:35:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;161791:35:0;;-1:-1:-1;161849:66:0;161885:6;161892:1;161885:9;;;;;;;;;;;-1:-1:-1;;;;;161849:27:0;;;161897:17;161849:66;:27;:66;:::i;:::-;161938:6;161945:1;161938:9;;;;;;;;;;;-1:-1:-1;;;;;161938:23:0;;161962:17;161995:1;161981:16;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;161981:16:0;;161938:60;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;161938:60:0;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;161938:60:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;161938:60:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;162021:7:0;;-1:-1:-1;;;;;162021:7:0;161556:491;161532:3;;161496:566;;;;160925:1148;;162092:62;162104:9;162115;162126:6;162134:12;162148:5;162092:11;:62::i;156542:716::-;156587:15;;:::i;:::-;-1:-1:-1;156682:568:0;;;;;;;;156729:42;156682:568;;156793:42;156682:568;;;;156857:42;156682:568;;;;;;;156921:42;156682:568;;;;156985:42;156682:568;;;;157049:42;156682:568;;;;157132:42;156682:568;;;;157196:42;156682:568;;;;156542:716;:::o;154082:330::-;154267:137;154292:9;154316;154340:6;154361:12;154388:5;154420:1465;154626:9;-1:-1:-1;;;;;154613:22:0;:9;-1:-1:-1;;;;;154613:22:0;;154609:61;;;154652:7;;154609:61;154732:31;:5;5343;154732:31;:11;:31;:::i;:::-;154686:77;;:42;:5;6896:10;154686:42;:11;:42;:::i;:::-;:77;;;154682:1114;;;154780:25;;:::i;:::-;154808:10;:8;:10::i;:::-;154780:38;-1:-1:-1;154840:6:0;154835:387;154856:14;154852:1;:18;154835:387;;;154920:7;154928:1;154920:10;;;;;;;;;;;-1:-1:-1;;;;;154900:31:0;:9;-1:-1:-1;;;;;154900:31:0;;154896:311;;;154956:17;154976:7;154984:1;154976:10;;;;;;;;;;;-1:-1:-1;;;;;154976:16:0;;:18;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;154976:18:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;154976:18:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;154976:18:0;;-1:-1:-1;155017:7:0;155025:1;155017:10;;;;;;;;;;;-1:-1:-1;;;;;155017:19:0;;155037:6;155017:27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155017:27:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;155017:27:0;;;;155067:91;155078:10;155090:9;155101:10;-1:-1:-1;;;;;155101:20:0;;155130:4;155101:35;;;;;;;;;;;;;-1:-1:-1;;;;;155101:35:0;-1:-1:-1;;;;;155101:35:0;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155101:35:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;155101:35:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;155101:35:0;155138:12;155152:5;155067:10;:91::i;154896:311::-;154872:3;;154835:387;;;-1:-1:-1;155243:6:0;155238:547;155259:14;155255:1;:18;155238:547;;;155323:7;155331:1;155323:10;;;;;;;;;;;-1:-1:-1;;;;;155303:31:0;:9;-1:-1:-1;;;;;155303:31:0;;155299:471;;;155359:17;155379:7;155387:1;155379:10;;;;;;;;;;;-1:-1:-1;;;;;155379:16:0;;:18;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155379:18:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;155379:18:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;155379:18:0;;-1:-1:-1;155420:63:0;155432:9;155379:18;155455:6;155463:12;155477:5;155420:11;:63::i;:::-;155536:35;;;-1:-1:-1;;;155536:35:0;;155565:4;155536:35;;;;;;155508:25;;-1:-1:-1;;;;;155536:20:0;;;;;:35;;;;;;;;;;;;;;;:20;:35;;;5:2:-1;;;;30:1;27;20:12;5:2;155536:35:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;155536:35:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;155536:35:0;;-1:-1:-1;155594:67:0;155630:7;155638:1;155630:10;;;;;;155594:67;155684:7;155692:1;155684:10;;;;;;;;;;;-1:-1:-1;;;;;155684:18:0;;155703:17;155684:37;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;155684:37:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;155684:37:0;;;;155744:7;;;;;;155299:471;155275:3;;155238:547;;;;154682:1114;;155815:62;155827:9;155838;155849:6;155857:12;155871:5;155815:11;:62::i;149647:943::-;149689:17;;:::i;:::-;-1:-1:-1;149719:863:0;;;;;;;;149748:42;149719:863;;149813:42;149719:863;;;;149878:42;149719:863;;;;;;;149943:42;149719:863;;;;150008:42;149719:863;;;;150073:42;149719:863;;;;150138:42;149719:863;;;;150203:42;149719:863;;;;150268:42;149719:863;;;;150333:42;149719:863;;;;150398:42;149719:863;;;;150463:42;149719:863;;;;150528:42;149719:863;;;;149647:943;:::o;132144:333::-;132329:140;132357:9;132381;132405:6;132426:12;132453:5;132485:1813;132694:9;-1:-1:-1;;;;;132681:22:0;:9;-1:-1:-1;;;;;132681:22:0;;132677:61;;;132720:7;;132677:61;132800:34;:5;4896:4;132800:34;:11;:34;:::i;:::-;132754:80;;:42;:5;6896:10;132754:42;:11;:42;:::i;:::-;:80;;;132750:1383;;;132851:17;132871:38;132899:9;132871:27;:38::i;:::-;132851:58;-1:-1:-1;;;;;;132928:24:0;;;;132924:431;;132996:9;-1:-1:-1;;;;;132973:41:0;;133015:6;132973:49;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;132973:49:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;132973:49:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;133041:24:0;;-1:-1:-1;133068:44:0;-1:-1:-1;;;;;133068:29:0;;133106:4;133068:44;:29;:44;:::i;:::-;133041:71;;133140:199;133176:10;133209:9;133241:16;133280:12;133315:5;133140:13;:199::i;:::-;133133:206;;;;132924:431;133384:38;133412:9;133384:27;:38::i;:::-;133371:51;-1:-1:-1;;;;;;133441:24:0;;;;133437:685;;133486:187;133520:9;133552:10;133585:6;133614:12;133649:5;133486:11;:187::i;:::-;133694:24;133721:44;-1:-1:-1;;;;;133721:29:0;;133759:4;133721:44;:29;:44;:::i;:::-;133694:71;;133790:18;:10;-1:-1:-1;;;;;133790:16:0;;:18::i;:::-;133786:296;;;47541:42;-1:-1:-1;;;;;133833:9:0;;133849:16;133833:35;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;133833:35:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;133833:35:0;;;;;133786:296;;133437:685;132750:1383;;134152:138;134178:9;134202;134226:6;134247:12;134274:5;134152:11;:138::i;127654:1409::-;127727:6;-1:-1:-1;;;;;127750:59:0;;127766:42;127750:59;127746:115;;;-1:-1:-1;127847:1:0;127833:16;;127746:115;-1:-1:-1;;;;;127875:59:0;;127891:42;127875:59;127871:156;;;-1:-1:-1;;;;;;;;;;;;127958:57:0;;127871:156;-1:-1:-1;;;;;128041:59:0;;128057:42;128041:59;128037:156;;;-1:-1:-1;128138:42:0;128124:57;;128037:156;-1:-1:-1;;;;;128207:59:0;;128223:42;128207:59;128203:156;;;-1:-1:-1;128304:42:0;128290:57;;128203:156;-1:-1:-1;;;;;128373:59:0;;128389:42;128373:59;128369:157;;;-1:-1:-1;128471:42:0;128457:57;;128369:157;-1:-1:-1;;;;;128540:59:0;;128556:42;128540:59;128536:157;;;-1:-1:-1;128638:42:0;128624:57;;128536:157;-1:-1:-1;;;;;128707:59:0;;128723:42;128707:59;128703:156;;;-1:-1:-1;128804:42:0;128790:57;;128703:156;-1:-1:-1;;;;;128873:59:0;;128889:42;128873:59;128869:157;;;-1:-1:-1;128971:42:0;128957:57;;128869:157;-1:-1:-1;;;127654:1409:0;;;:::o;139325:332::-;139510:139;139537:9;139561;139585:6;139606:12;139633:5;139873:9;-1:-1:-1;;;;;139860:22:0;:9;-1:-1:-1;;;;;139860:22:0;;139856:61;;;139899:7;;139856:61;139979:33;:5;4956:4;139979:33;:11;:33;:::i;:::-;139933:79;;:42;:5;6896:10;139933:42;:11;:42;:::i;:::-;:79;;;139929:1618;;;140029:17;140049:26;140065:9;140049:15;:26::i;:::-;140029:46;-1:-1:-1;;;;;;140094:24:0;;;;140090:626;;140143:18;:10;-1:-1:-1;;;;;140143:16:0;;:18::i;:::-;140139:245;;;140186:68;;;-1:-1:-1;;;140186:68:0;;140240:4;140186:68;;;;;;;;;;;;-1:-1:-1;;;;;140186:45:0;;;;;:68;;;;;;;;;;;;;;-1:-1:-1;140186:45:0;:68;;;5:2:-1;;;;30:1;27;20:12;5:2;140186:68:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;140186:68:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;140139:245:0;;-1:-1:-1;140139:245:0;;140303:61;;;-1:-1:-1;;;140303:61:0;;140350:4;140303:61;;;;;;;;;;;;-1:-1:-1;;;;;140303:38:0;;;;;:61;;;;;;;;;;;;;;-1:-1:-1;140303:38:0;:61;;;5:2:-1;;;;30:1;27;20:12;5:2;140303:61:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;140303:61:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;140139:245:0;140404:24;140431:44;-1:-1:-1;;;;;140431:29:0;;140469:4;140431:44;:29;:44;:::i;:::-;140404:71;;140503:197;140537:10;140570:9;140602:16;140641:12;140676:5;140503:11;:197::i;140090:626::-;140745:26;140761:9;140745:15;:26::i;:::-;140732:39;-1:-1:-1;;;;;;140790:24:0;;;;140786:750;;140835:187;140869:9;140901:10;140934:6;140963:12;140998:5;140835:11;:187::i;:::-;141043:24;141070:44;-1:-1:-1;;;;;141070:29:0;;141108:4;141070:44;:29;:44;:::i;:::-;141043:71;;141139:18;:10;-1:-1:-1;;;;;141139:16:0;;:18::i;:::-;141135:361;;;141182:86;;;-1:-1:-1;;;141182:86:0;;141262:4;141182:86;;;;;;-1:-1:-1;;;;;141182:47:0;;;;;141236:16;;141182:86;;;;;;;;;;;;;;;141236:16;141182:47;:86;;;5:2:-1;;;;30:1;27;20:12;5:2;141182:86:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;141182:86:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;141135:361:0;;-1:-1:-1;141135:361:0;;141317:65;-1:-1:-1;;;;;141317:27:0;;141353:9;141365:16;141317:65;:27;:65;:::i;:::-;141405:71;;;-1:-1:-1;;;141405:71:0;;141452:4;141405:71;;;;;;;;;;;;-1:-1:-1;;;;;141405:38:0;;;;;:71;;;;;;;;;;;;;;-1:-1:-1;141405:38:0;:71;;;5:2:-1;;;;30:1;27;20:12;140786:750:0;139929:1618;;141566:138;141592:9;141616;141640:6;141661:12;141688:5;141566:11;:138::i;135126:1173::-;135187:6;135210:13;:5;-1:-1:-1;;;;;135210:11:0;;:13::i;:::-;135206:63;;;-1:-1:-1;;;135240:17:0;;135206:63;135353:57;;;22:32:-1;6:49;;135353:57:0;;;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;135317:94:0;;;;135282:12;;135296:17;;-1:-1:-1;;;;;135317:25:0;;;135347:4;;135353:57;;135317:94;;;;25:18:-1;135317:94:0;;25:18:-1;36:153;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;;;135317:94: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;;135281:130:0;;;;135427:7;135422:58;;-1:-1:-1;;135451:17:0;;;;;;135422:58;135492:13;;135524:414;135549:4;:11;135541:1;135545;135541:5;:19;135524:414;;;135586:4;135591:1;135595;135591:5;135586:11;;;;;;;;;;;;;-1:-1:-1;;;;;;135586:11:0;-1:-1:-1;;;135586:18:0;:57;;;;;135625:4;135630:1;135634;135630:5;135625:11;;;;;;;;;;;;;-1:-1:-1;;;;;;135625:11:0;-1:-1:-1;;;135625:18:0;135586:57;:96;;;;;135664:4;135669:1;135673;135669:5;135664:11;;;;;;;;;;;;;-1:-1:-1;;;;;;135664:11:0;-1:-1:-1;;;135664:18:0;135586:96;:135;;;;;135703:4;135708:1;135712;135708:5;135703:11;;;;;;;;;;;;;-1:-1:-1;;;;;;135703:11:0;-1:-1:-1;;;135703:18:0;135586:135;:174;;;;;135742:4;135747:1;135751;135747:5;135742:11;;;;;;;;;;;;;-1:-1:-1;;;;;;135742:11:0;-1:-1:-1;;;135742:18:0;135586:174;:213;;;;;135781:4;135786:1;135790;135786:5;135781:11;;;;;;;;;;;;;-1:-1:-1;;;;;;135781:11:0;-1:-1:-1;;;135781:18:0;135586:213;:252;;;;;135820:4;135825:1;135829;135825:5;135820:11;;;;;;;;;;;;;-1:-1:-1;;;;;;135820:11:0;-1:-1:-1;;;135820:18:0;135586:252;135582:345;;;135883:4;135872:15;;135906:5;;135582:345;135562:3;;135524:414;;;;135953:8;135948:59;;-1:-1:-1;;135978:17:0;;;;;;;135948:59;136073:103;;;22:32:-1;6:49;;136073:103:0;;;;;49:4:-1;25:18;;61:17;;-1:-1;;;;;182:15;-1:-1;;;179:29;160:49;;136037:140:0;;;;-1:-1:-1;;;;;136037:25:0;;;136067:4;;136073:103;136037:140;;;25:18:-1;136037:140:0;;25:18:-1;36:153;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;;;136037:140: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;-1:-1;136019:158:0;;-1:-1:-1;136019:158:0;-1:-1:-1;136019:158:0;136188:58;;-1:-1:-1;;136217:17:0;;;;;;;136188:58;136276:4;136265:26;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;136265:26:0;;135126:1173;-1:-1:-1;;;;;135126:1173:0:o;167884:329::-;168069:136;168093:9;168117;168141:6;168162:12;168189:5;168221:1685;168426:9;-1:-1:-1;;;;;168413:22:0;:9;-1:-1:-1;;;;;168413:22:0;;168409:61;;;168452:7;;168409:61;168532:30;:5;5070:4;168532:30;:11;:30;:::i;:::-;168486:76;;:42;:5;6896:10;168486:42;:11;:42;:::i;:::-;:76;;;168482:1259;;;168579:17;168599:34;168623:9;168599:23;:34::i;:::-;168579:54;-1:-1:-1;;;;;;168652:24:0;;;;168648:323;;168716:9;-1:-1:-1;;;;;168697:37:0;;168735:6;168697:45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;168697:45:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;168697:45:0;;;;168770:185;168802:10;168835:9;168867:6;168896:12;168931:5;168770:9;:185::i;:::-;168763:192;;;168648:323;169000:34;169024:9;169000:23;:34::i;:::-;168987:47;-1:-1:-1;;;;;;169053:24:0;;;;169049:681;;169098:187;169132:9;169164:10;169197:6;169226:12;169261:5;169098:11;:187::i;:::-;169306:24;169333:44;-1:-1:-1;;;;;169333:29:0;;169371:4;169333:44;:29;:44;:::i;:::-;169306:71;;169398:58;47337:42;-1:-1:-1;;;;;169426:9:0;;:11;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;169426:11:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;169426:11:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;169426:11:0;-1:-1:-1;;;;;169398:27:0;;;169439:16;169398:58;:27;:58;:::i;:::-;47337:42;169475:12;169494:18;-1:-1:-1;;;;;169494:16:0;;;:18::i;:::-;:41;;169534:1;169494:41;;;169515:16;169494:41;169559:18;:10;-1:-1:-1;;;;;169559:16:0;;:18::i;:::-;:45;;169594:10;169559:45;;;44035:42;169559:45;169475:214;;;-1:-1:-1;;;;;;169475:214:0;;;;;;;-1:-1:-1;;;;;169475:214:0;;;;;;;;;;;;;169666:4;169475:214;;;;;;;;;;-1:-1:-1;;169475:214:0;;;;;;;;;;;;5:2:-1;;;;30:1;27;20:12;5:2;169475:214:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;169475:214:0;;;;;169708:7;;;;169049:681;168482:1259;;169760:138;169786:9;169810;169834:6;169855:12;169882:5;169760:11;:138::i;162274:2905::-;162343:6;-1:-1:-1;;;;;162366:59:0;;162382:42;162366:59;162362:115;;;-1:-1:-1;162463:1:0;162449:16;;162362:115;-1:-1:-1;;;;;162491:59:0;;162507:42;162491:59;162487:156;;;-1:-1:-1;;;;;;;;;;;;162574:57:0;;162487:156;-1:-1:-1;;;;;162657:59:0;;162673:42;162657:59;162653:157;;;-1:-1:-1;162755:42:0;162741:57;;162653:157;-1:-1:-1;;;;;162824:59:0;;162840:42;162824:59;162820:157;;;-1:-1:-1;162922:42:0;162908:57;;162820:157;-1:-1:-1;;;;;162991:59:0;;163007:42;162991:59;162987:157;;;-1:-1:-1;163089:42:0;163075:57;;162987:157;-1:-1:-1;;;;;163158:59:0;;163174:42;163158:59;163154:157;;;-1:-1:-1;163256:42:0;163242:57;;163154:157;-1:-1:-1;;;;;163325:59:0;;163341:42;163325:59;163321:157;;;-1:-1:-1;163423:42:0;163409:57;;163321:157;-1:-1:-1;;;;;163492:59:0;;163508:42;163492:59;163488:156;;;-1:-1:-1;163589:42:0;163575:57;;163488:156;-1:-1:-1;;;;;163658:59:0;;163674:42;163658:59;163654:156;;;-1:-1:-1;163755:42:0;163741:57;;163654:156;-1:-1:-1;;;;;163824:59:0;;163840:42;163824:59;163820:157;;;-1:-1:-1;163922:42:0;163908:57;;163820:157;-1:-1:-1;;;;;163991:59:0;;164007:42;163991:59;163987:157;;;-1:-1:-1;164089:42:0;164075:57;;163987:157;-1:-1:-1;;;;;164158:59:0;;164174:42;164158:59;164154:157;;;-1:-1:-1;164256:42:0;164242:57;;164154:157;-1:-1:-1;;;;;164325:59:0;;164341:42;164325:59;164321:156;;;-1:-1:-1;164422:42:0;164408:57;;164321:156;-1:-1:-1;;;;;164491:59:0;;164507:42;164491:59;164487:156;;;-1:-1:-1;164588:42:0;164574:57;;164487:156;-1:-1:-1;;;;;164657:59:0;;164673:42;164657:59;164653:156;;;-1:-1:-1;164754:42:0;164740:57;;164653:156;-1:-1:-1;;;;;164823:59:0;;164839:42;164823:59;164819:157;;;-1:-1:-1;164921:42:0;164907:57;;164819:157;-1:-1:-1;;;;;164990:59:0;;165006:42;164990:59;164986:156;;;-1:-1:-1;165087:42:0;165073:57;;147491:1707;147693:9;-1:-1:-1;;;;;147680:22:0;:9;-1:-1:-1;;;;;147680:22:0;;147676:61;;;147719:7;;147676:61;147799:30;:5;5284;147799:30;:11;:30;:::i;:::-;147753:76;;:42;:5;6896:10;147753:42;:11;:42;:::i;:::-;:76;;;147749:1360;;;-1:-1:-1;;;;;147850:25:0;;145442:42;147850:25;147846:913;;;145442:42;-1:-1:-1;;;;;147896:9:0;;147906:6;147896:17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;147896:17:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;147955:28:0;;;-1:-1:-1;;;147955:28:0;;147977:4;147955:28;;;;;;147934:18;;-1:-1:-1;145530:42:0;;-1:-1:-1;147955:13:0;;:28;;;;;;;;;;;;;;;145530:42;147955:28;;;5:2:-1;;;;30:1;27;20:12;5:2;147955:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;147955:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;147955:28:0;;-1:-1:-1;148006:14:0;;148002:534;;148047:32;148083:203;145530:42;148157:9;148193:10;148230:1;148258:5;148083:17;:203::i;:::-;148045:241;;;148311:205;145530:42;148373:9;148409:10;148446:15;148488:5;148311;:205::i;:::-;148002:534;;148563:180;-1:-1:-1;;;;;;;;;;;148623:9:0;148655:6;148684:12;148719:5;148563:11;:180::i;147846:913::-;-1:-1:-1;;;;;148779:25:0;;145442:42;148779:25;148775:323;;;148825:56;148837:9;-1:-1:-1;;;;;;;;;;;148853:6:0;148861:12;148875:5;148825:11;:56::i;:::-;148923:28;;;-1:-1:-1;;;148923:28:0;;148945:4;148923:28;;;;;;148902:18;;-1:-1:-1;;;;;;;;;;;44422:42:0;148923:13;;:28;;;;;;;;;;;;;;;44422:42;148923:28;;;5:2:-1;;;;30:1;27;20:12;5:2;148923:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;148923:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;148923:28:0;;-1:-1:-1;148970:47:0;-1:-1:-1;;;;;;;;;;;145442:42:0;148923:28;148970:47;:20;:47;:::i;:::-;145442:42;-1:-1:-1;;;;;149036:9:0;;149046:10;149036:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;148775:323:0;149128:62;149140:9;149151;149162:6;149170:12;149184:5;143772:1337;143974:9;-1:-1:-1;;;;;143961:22:0;:9;-1:-1:-1;;;;;143961:22:0;;143957:61;;;144000:7;;143957:61;144080:30;:5;5013:4;144080:30;:11;:30;:::i;:::-;144034:76;;:42;:5;6896:10;144034:42;:11;:42;:::i;:::-;:76;;;144030:914;;;-1:-1:-1;;;;;144131:25:0;;44334:42;144131:25;144127:328;;;144177:32;;;-1:-1:-1;;;144177:32:0;;144195:4;144177:32;;;;;;;;;;;;44334:42;;144177:9;;:32;;;;;-1:-1:-1;;144177:32:0;;;;;;;-1:-1:-1;44334:42:0;144177:32;;;5:2:-1;;;;30:1;27;20:12;5:2;144177:32:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;-1:-1;;144329:28:0;;;-1:-1:-1;;;144329:28:0;;144351:4;144329:28;;;;;;144237:202;;-1:-1:-1;;;;;;;;;;;;44422:42:0;-1:-1:-1;144297:9:0;;44422:42;;144329:13;;:28;;;;;;;;;;;;;;;44422:42;144329:28;;;5:2:-1;;;;30:1;27;20:12;5:2;144329:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;144329:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;144329:28:0;144380:12;144415:5;144237:11;:202::i;144127:328::-;-1:-1:-1;;;;;144475:25:0;;44334:42;144475:25;144471:462;;;144521:180;144555:9;-1:-1:-1;;;;;;;;;;;144613:6:0;144642:12;144677:5;144521:11;:180::i;:::-;144743:28;;;-1:-1:-1;;;144743:28:0;;144765:4;144743:28;;;;;;144722:18;;-1:-1:-1;;;;;;;;;;;44422:42:0;144743:13;;:28;;;;;;;;;;;;;;;44422:42;144743:28;;;5:2:-1;;;;30:1;27;20:12;5:2;144743:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;144743:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;144743:28:0;;-1:-1:-1;144790:47:0;-1:-1:-1;;;;;;;;;;;44334:42:0;144743:28;144790:47;:20;:47;:::i;:::-;144856:36;;;-1:-1:-1;;;144856:36:0;;144874:4;144856:36;;;;;;;;;;;;44334:42;;144856:9;;:36;;;;;-1:-1:-1;;144856:36:0;;;;;;;-1:-1:-1;44334:42:0;144856:36;;;5:2:-1;;;;30:1;27;20:12;144471:462:0;144963:138;144989:9;145013;145037:6;145058:12;145085:5;177461:2443;177663:9;-1:-1:-1;;;;;177650:22:0;:9;-1:-1:-1;;;;;177650:22:0;;177646:61;;;177689:7;;177646:61;177769:38;:5;7784:13;177769:38;:11;:38;:::i;:::-;177723:84;;:42;:5;6896:10;177723:42;:11;:42;:::i;:::-;:84;;;177719:2020;;;-1:-1:-1;;;;;177828:25:0;;47981:42;177828:25;177824:935;;;-1:-1:-1;;;;;177878:17:0;;44599:42;177878:17;;:37;;-1:-1:-1;;;;;;177899:16:0;;-1:-1:-1;;;;;;;;;;;177899:16:0;177878:37;:58;;;-1:-1:-1;;;;;;177919:17:0;;44688:42;177919:17;177878:58;:79;;;-1:-1:-1;;;;;;177940:17:0;;44777:42;177940:17;177878:79;177874:845;;;178004:59;;;-1:-1:-1;;;178004:59:0;;-1:-1:-1;;;;;178004:59:0;;;;;;;;;;;;;;;;;;;;;177986:14;;48117:42;;178004:29;;:59;;;;;177986:14;;178004:59;;;;;;;;48117:42;178004:59;;;5:2:-1;;;;30:1;27;20:12;5:2;178004:59:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;178004:59:0;;;;;;39:16:-1;36:1;17:17;2:54;101:4;178004:59: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;178004:59: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;213:10;;-1:-1;;;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;372:25;;-1:-1;178004:59:0;;420:4:-1;411:14;;;;178004:59:0;;;;;411:14:-1;178004:59: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;178004:59:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;178004:59:0;;;;;;;;;-1:-1:-1;;;178086:103:0;;-1:-1:-1;;;;;178086:103:0;;;;;;;;;;;;;;178004:59;;-1:-1:-1;47981:42:0;;-1:-1:-1;178086:11:0;;-1:-1:-1;178086:103:0;;;;;-1:-1:-1;178004:59:0;;-1:-1:-1;178086:103:0;;;;;;;-1:-1:-1;47981:42:0;178086:103;;;5:2:-1;;;;30:1;27;20:12;5:2;178086:103:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;178086:103:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;177874:845:0;;-1:-1:-1;;177874:845:0;;178277:53;;;-1:-1:-1;;;178277:53:0;;-1:-1:-1;;;;;178277:53:0;;;;;;;;;;;;-1:-1:-1;;;;;;;;;;;178277:53:0;;;;;;178259:14;;48117:42;;178277:29;;:53;;;;;178259:14;;178277:53;;;;;;;;48117:42;178277:53;;;5:2:-1;;;;30:1;27;20:12;5:2;178277:53:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;178277:53:0;;;;;;39:16:-1;36:1;17:17;2:54;101:4;178277:53: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;178277:53: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;213:10;;-1:-1;;;244:29;;285:43;;;282:58;-1:-1;233:115;230:2;;;361:1;358;351:12;230:2;372:25;;-1:-1;178277:53:0;;420:4:-1;411:14;;;;178277:53:0;;;;;411:14:-1;178277:53: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;178277:53:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;178277:53:0;;;;;;;;;-1:-1:-1;;;178353:97:0;;-1:-1:-1;;;;;;;;;;;178353:97:0;;;;;;;;;;;;178277:53;;-1:-1:-1;47981:42:0;;-1:-1:-1;178353:11:0;;-1:-1:-1;178353:97:0;;;;;-1:-1:-1;178277:53:0;;-1:-1:-1;178353:97:0;;;;;;;-1:-1:-1;47981:42:0;178353:97;;;5:2:-1;;;;30:1;27;20:12;5:2;178353:97:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;178353:97:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;178577:28:0;;;-1:-1:-1;;;178577:28:0;;178599:4;178577:28;;;;;;178473:226;;-1:-1:-1;;;;;;;;;;;44422:42:0;178541:9;;44422:42;;178577:13;;:28;;;;;178353:97;;178577:28;;;;;;;;44422:42;178577:28;;;5:2:-1;;;;30:1;27;20:12;5:2;178577:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;178577:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;178577:28:0;178632:12;178671:5;178473:11;:226::i;177824:935::-;-1:-1:-1;;;;;178779:25:0;;47981:42;178779:25;178775:953;;;-1:-1:-1;;;;;178829:17:0;;44599:42;178829:17;;:37;;-1:-1:-1;;;;;;178850:16:0;;-1:-1:-1;;;;;;;;;;;178850:16:0;178829:37;:58;;;-1:-1:-1;;;;;;178870:17:0;;44688:42;178870:17;178829:58;:79;;;-1:-1:-1;;;;;;178891:17:0;;44777:42;178891:17;178829:79;178825:863;;;178933:49;-1:-1:-1;;;;;178933:26:0;;47981:42;178975:6;178933:49;:26;:49;:::i;:::-;179005:177;;;-1:-1:-1;;;179005:177:0;;-1:-1:-1;;;;;179005:177:0;;;;;;;;;;;;;;;;;;;179154:4;179005:177;;;;;;47981:42;;179005:9;;:177;;;;;;;;;;;;;;-1:-1:-1;47981:42:0;179005:177;;;5:2:-1;;;;30:1;27;20:12;5:2;179005:177:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;179005:177:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;178825:863:0;;-1:-1:-1;178825:863:0;;179248:204;179286:9;-1:-1:-1;;;;;;;;;;;179352:6:0;179385:12;179424:5;179248:11;:204::i;:::-;179577:28;;;-1:-1:-1;;;179577:28:0;;179599:4;179577:28;;;;;;47981:42;;179475:9;;-1:-1:-1;;;;;;;;;;;44422:42:0;179541:9;;44422:42;;179577:13;;:28;;;;;;;;;;;;;;44422:42;179577:28;;;5:2:-1;;;;30:1;27;20:12;5:2;179577:28:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;179577:28:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;179577:28:0;179475:193;;;-1:-1:-1;;;;;;179475:193:0;;;;;;;-1:-1:-1;;;;;179475:193:0;;;;;;;;;;;;;;;;;;;179640:4;179475:193;;;;;;;;;;;179577:28;;179475:193;;;;;;;-1:-1:-1;179475:193:0;;;;5:2:-1;;;;30:1;27;20:12;5:2;179475:193:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;179475:193:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;178775:953:0;179758:138;179784:9;179808;179832:6;179853:12;179880:5;99687:437;99923:9;-1:-1:-1;;;;;99910:22:0;:9;-1:-1:-1;;;;;99910:22:0;;99906:61;;;99949:7;;99906:61;99979:137;100004:9;100028;100052:6;100073:12;100100:5;192318:8;;192283:53;;-1:-1:-1;;;;;192283:26:0;;;;192318:8;192329:6;192283:53;:26;:53;:::i;:::-;192347:8;;-1:-1:-1;;;;;192347:8:0;;;;:13;;192367:17;;:15;;;:17::i;:::-;:30;;192396:1;192367:30;;;192387:6;192367:30;192413:9;192437;192461:6;192482:1;192498:12;192525:5;192347:194;;;;;;;;;;;;;-1:-1:-1;;;;;192347:194:0;-1:-1:-1;;;;;192347:194:0;;;;;;-1:-1:-1;;;;;192347:194:0;-1:-1:-1;;;;;192347:194: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;192347:194:0;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;192347:194:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;192347:194:0;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;;;;;;;192093:456:0:o;189449:3103::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;-1:-1;189449:3103:0;;;-1:-1:-1;;189449:3103:0:o;:::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;-1:-1;189449:3103:0;;;-1:-1:-1;;189449:3103:0:o;:::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;-1:-1;189449:3103:0;;;-1:-1:-1;;189449:3103:0:o;:::-;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;-1:-1;189449:3103:0;;;-1:-1:-1;;189449:3103:0:o
Swarm Source
bzzr://449cfd47120284ae61b36d9bc7383c4d74daab37158983094b3c5f55cde7670c
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.