Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x611a0161 | 12459105 | 1238 days ago | IN | 0 ETH | 0.21506778 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
ProportionalLiquidity
Compiler Version
v0.7.3+commit.9bfce1f6
Contract Source Code (Solidity Multiple files format)
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; import "./Assimilators.sol"; import "./Storage.sol"; import "./UnsafeMath64x64.sol"; import "./ABDKMath64x64.sol"; import "./CurveMath.sol"; library ProportionalLiquidity { using ABDKMath64x64 for uint256; using ABDKMath64x64 for int128; using UnsafeMath64x64 for int128; event Transfer(address indexed from, address indexed to, uint256 value); int128 public constant ONE = 0x10000000000000000; int128 public constant ONE_WEI = 0x12; function proportionalDeposit(Storage.Curve storage curve, uint256 _deposit) external returns (uint256 curves_, uint256[] memory) { int128 __deposit = _deposit.divu(1e18); uint256 _length = curve.assets.length; uint256[] memory deposits_ = new uint256[](_length); (int128 _oGLiq, int128[] memory _oBals) = getGrossLiquidityAndBalancesForDeposit(curve); // Needed to calculate liquidity invariant (int128 _oGLiqProp, int128[] memory _oBalsProp) = getGrossLiquidityAndBalances(curve); // No liquidity, oracle sets the ratio if (_oGLiq == 0) { for (uint256 i = 0; i < _length; i++) { // Variable here to avoid stack-too-deep errors int128 _d = __deposit.mul(curve.weights[i]); deposits_[i] = Assimilators.intakeNumeraire(curve.assets[i].addr, _d.add(ONE_WEI)); } } else { // We already have an existing pool ratio // which must be respected int128 _multiplier = __deposit.div(_oGLiq); uint256 _baseWeight = curve.weights[0].mulu(1e18); uint256 _quoteWeight = curve.weights[1].mulu(1e18); for (uint256 i = 0; i < _length; i++) { deposits_[i] = Assimilators.intakeNumeraireLPRatio( curve.assets[i].addr, _baseWeight, _quoteWeight, _oBals[i].mul(_multiplier).add(ONE_WEI) ); } } int128 _totalShells = curve.totalSupply.divu(1e18); int128 _newShells = __deposit; if (_totalShells > 0) { _newShells = __deposit.div(_oGLiq); _newShells = _newShells.mul(_totalShells); } requireLiquidityInvariant(curve, _totalShells, _newShells, _oGLiqProp, _oBalsProp); mint(curve, msg.sender, curves_ = _newShells.mulu(1e18)); return (curves_, deposits_); } function viewProportionalDeposit(Storage.Curve storage curve, uint256 _deposit) external view returns (uint256 curves_, uint256[] memory) { int128 __deposit = _deposit.divu(1e18); uint256 _length = curve.assets.length; (int128 _oGLiq, int128[] memory _oBals) = getGrossLiquidityAndBalancesForDeposit(curve); uint256[] memory deposits_ = new uint256[](_length); // No liquidity if (_oGLiq == 0) { for (uint256 i = 0; i < _length; i++) { deposits_[i] = Assimilators.viewRawAmount( curve.assets[i].addr, __deposit.mul(curve.weights[i]).add(ONE_WEI) ); } } else { // We already have an existing pool ratio // this must be respected int128 _multiplier = __deposit.div(_oGLiq); uint256 _baseWeight = curve.weights[0].mulu(1e18); uint256 _quoteWeight = curve.weights[1].mulu(1e18); // Deposits into the pool is determined by existing LP ratio for (uint256 i = 0; i < _length; i++) { deposits_[i] = Assimilators.viewRawAmountLPRatio( curve.assets[i].addr, _baseWeight, _quoteWeight, _oBals[i].mul(_multiplier).add(ONE_WEI) ); } } int128 _totalShells = curve.totalSupply.divu(1e18); int128 _newShells = __deposit; if (_totalShells > 0) { _newShells = __deposit.div(_oGLiq); _newShells = _newShells.mul(_totalShells); } curves_ = _newShells.mulu(1e18); return (curves_, deposits_); } function emergencyProportionalWithdraw(Storage.Curve storage curve, uint256 _withdrawal) external returns (uint256[] memory) { uint256 _length = curve.assets.length; (, int128[] memory _oBals) = getGrossLiquidityAndBalances(curve); uint256[] memory withdrawals_ = new uint256[](_length); int128 _totalShells = curve.totalSupply.divu(1e18); int128 __withdrawal = _withdrawal.divu(1e18); int128 _multiplier = __withdrawal.div(_totalShells); for (uint256 i = 0; i < _length; i++) { withdrawals_[i] = Assimilators.outputNumeraire( curve.assets[i].addr, msg.sender, _oBals[i].mul(_multiplier) ); } burn(curve, msg.sender, _withdrawal); return withdrawals_; } function proportionalWithdraw(Storage.Curve storage curve, uint256 _withdrawal) external returns (uint256[] memory) { uint256 _length = curve.assets.length; (int128 _oGLiq, int128[] memory _oBals) = getGrossLiquidityAndBalances(curve); uint256[] memory withdrawals_ = new uint256[](_length); int128 _totalShells = curve.totalSupply.divu(1e18); int128 __withdrawal = _withdrawal.divu(1e18); int128 _multiplier = __withdrawal.div(_totalShells); for (uint256 i = 0; i < _length; i++) { withdrawals_[i] = Assimilators.outputNumeraire( curve.assets[i].addr, msg.sender, _oBals[i].mul(_multiplier) ); } requireLiquidityInvariant(curve, _totalShells, __withdrawal.neg(), _oGLiq, _oBals); burn(curve, msg.sender, _withdrawal); return withdrawals_; } function viewProportionalWithdraw(Storage.Curve storage curve, uint256 _withdrawal) external view returns (uint256[] memory) { uint256 _length = curve.assets.length; (, int128[] memory _oBals) = getGrossLiquidityAndBalances(curve); uint256[] memory withdrawals_ = new uint256[](_length); int128 _multiplier = _withdrawal.divu(1e18).div(curve.totalSupply.divu(1e18)); for (uint256 i = 0; i < _length; i++) { withdrawals_[i] = Assimilators.viewRawAmount(curve.assets[i].addr, _oBals[i].mul(_multiplier)); } return withdrawals_; } function getGrossLiquidityAndBalancesForDeposit(Storage.Curve storage curve) internal view returns (int128 grossLiquidity_, int128[] memory) { uint256 _length = curve.assets.length; int128[] memory balances_ = new int128[](_length); uint256 _baseWeight = curve.weights[0].mulu(1e18); uint256 _quoteWeight = curve.weights[1].mulu(1e18); for (uint256 i = 0; i < _length; i++) { int128 _bal = Assimilators.viewNumeraireBalanceLPRatio(_baseWeight, _quoteWeight, curve.assets[i].addr); balances_[i] = _bal; grossLiquidity_ += _bal; } return (grossLiquidity_, balances_); } function getGrossLiquidityAndBalances(Storage.Curve storage curve) internal view returns (int128 grossLiquidity_, int128[] memory) { uint256 _length = curve.assets.length; int128[] memory balances_ = new int128[](_length); for (uint256 i = 0; i < _length; i++) { int128 _bal = Assimilators.viewNumeraireBalance(curve.assets[i].addr); balances_[i] = _bal; grossLiquidity_ += _bal; } return (grossLiquidity_, balances_); } function requireLiquidityInvariant( Storage.Curve storage curve, int128 _curves, int128 _newShells, int128 _oGLiq, int128[] memory _oBals ) private view { (int128 _nGLiq, int128[] memory _nBals) = getGrossLiquidityAndBalances(curve); int128 _beta = curve.beta; int128 _delta = curve.delta; int128[] memory _weights = curve.weights; int128 _omega = CurveMath.calculateFee(_oGLiq, _oBals, _beta, _delta, _weights); int128 _psi = CurveMath.calculateFee(_nGLiq, _nBals, _beta, _delta, _weights); CurveMath.enforceLiquidityInvariant(_curves, _newShells, _oGLiq, _nGLiq, _omega, _psi); } function burn( Storage.Curve storage curve, address account, uint256 amount ) private { curve.balances[account] = burnSub(curve.balances[account], amount); curve.totalSupply = burnSub(curve.totalSupply, amount); emit Transfer(msg.sender, address(0), amount); } function mint( Storage.Curve storage curve, address account, uint256 amount ) private { curve.totalSupply = mintAdd(curve.totalSupply, amount); curve.balances[account] = mintAdd(curve.balances[account], amount); emit Transfer(address(0), msg.sender, amount); } function mintAdd(uint256 x, uint256 y) private pure returns (uint256 z) { require((z = x + y) >= x, "Curve/mint-overflow"); } function burnSub(uint256 x, uint256 y) private pure returns (uint256 z) { require((z = x - y) <= x, "Curve/burn-underflow"); } }
// SPDX-License-Identifier: BSD-4-Clause /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity ^0.7.0; /** * Smart contract library of mathematical functions operating with signed * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is * basically a simple fraction whose numerator is signed 128-bit integer and * denominator is 2^64. As long as denominator is always the same, there is no * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are * represented by int128 type holding only the numerator. */ library ABDKMath64x64 { /* * Minimum value signed 64.64-bit fixed point number may have. */ int128 private constant MIN_64x64 = -0x80000000000000000000000000000000; /* * Maximum value signed 64.64-bit fixed point number may have. */ int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Convert signed 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromInt (int256 x) internal pure returns (int128) { require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); } /** * Convert signed 64.64 fixed point number into signed 64-bit integer number * rounding down. * * @param x signed 64.64-bit fixed point number * @return signed 64-bit integer number */ function toInt (int128 x) internal pure returns (int64) { return int64 (x >> 64); } /** * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromUInt (uint256 x) internal pure returns (int128) { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); } /** * Convert signed 64.64 fixed point number into unsigned 64-bit integer * number rounding down. Revert on underflow. * * @param x signed 64.64-bit fixed point number * @return unsigned 64-bit integer number */ function toUInt (int128 x) internal pure returns (uint64) { require (x >= 0); return uint64 (x >> 64); } /** * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point * number rounding down. Revert on overflow. * * @param x signed 128.128-bin fixed point number * @return signed 64.64-bit fixed point number */ function from128x128 (int256 x) internal pure returns (int128) { int256 result = x >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Convert signed 64.64 fixed point number into signed 128.128 fixed point * number. * * @param x signed 64.64-bit fixed point number * @return signed 128.128 fixed point number */ function to128x128 (int128 x) internal pure returns (int256) { return int256 (x) << 64; } /** * Calculate x + y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function add (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) + y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x - y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sub (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) - y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x * y rounding down. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function mul (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) * y >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point * number and y is signed 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y signed 256-bit integer number * @return signed 256-bit integer number */ function muli (int128 x, int256 y) internal pure returns (int256) { if (x == MIN_64x64) { require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu (x, uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000); return -int256 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int256 (absoluteResult); } } } /** * Calculate x * y rounding down, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y unsigned 256-bit integer number * @return unsigned 256-bit integer number */ function mulu (int128 x, uint256 y) internal pure returns (uint256) { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (x) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (x) * (y >> 128); require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); hi <<= 64; require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo); return hi + lo; } /** * Calculate x / y rounding towards zero. Revert on overflow or when y is * zero. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function div (int128 x, int128 y) internal pure returns (int128) { require (y != 0); int256 result = (int256 (x) << 64) / y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x / y rounding towards zero, where x and y are signed 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x signed 256-bit integer number * @param y signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function divi (int256 x, int256 y) internal pure returns (int128) { require (y != 0); bool negativeResult = false; if (x < 0) { x = -x; // We rely on overflow behavior here negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint128 absoluteResult = divuu (uint256 (x), uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x80000000000000000000000000000000); return -int128 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128 (absoluteResult); // We rely on overflow behavior here } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function divu (uint256 x, uint256 y) internal pure returns (int128) { require (y != 0); uint128 result = divuu (x, y); require (result <= uint128 (MAX_64x64)); return int128 (result); } /** * Calculate -x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function neg (int128 x) internal pure returns (int128) { require (x != MIN_64x64); return -x; } /** * Calculate |x|. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function abs (int128 x) internal pure returns (int128) { require (x != MIN_64x64); return x < 0 ? -x : x; } /** * Calculate 1 / x rounding towards zero. Revert on overflow or when x is * zero. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function inv (int128 x) internal pure returns (int128) { require (x != 0); int256 result = int256 (0x100000000000000000000000000000000) / x; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function avg (int128 x, int128 y) internal pure returns (int128) { return int128 ((int256 (x) + int256 (y)) >> 1); } /** * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down. * Revert on overflow or in case x * y is negative. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function gavg (int128 x, int128 y) internal pure returns (int128) { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); } /** * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y uint256 value * @return signed 64.64-bit fixed point number */ function pow (int128 x, uint256 y) internal pure returns (int128) { uint256 absoluteResult; bool negativeResult = false; if (x >= 0) { absoluteResult = powu (uint256 (x) << 63, y); } else { // We rely on overflow behavior here absoluteResult = powu (uint256 (uint128 (-x)) << 63, y); negativeResult = y & 1 > 0; } absoluteResult >>= 63; if (negativeResult) { require (absoluteResult <= 0x80000000000000000000000000000000); return -int128 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128 (absoluteResult); // We rely on overflow behavior here } } /** * Calculate sqrt (x) rounding down. Revert if x < 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sqrt (int128 x) internal pure returns (int128) { require (x >= 0); return int128 (sqrtu (uint256 (x) << 64)); } /** * Calculate binary logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function log_2 (int128 x) internal pure returns (int128) { require (x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 result = msb - 64 << 64; uint256 ux = uint256 (x) << uint256 (127 - msb); for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) { ux *= ux; uint256 b = ux >> 255; ux >>= 127 + b; result += bit * int256 (b); } return int128 (result); } /** * Calculate natural logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function ln (int128 x) internal pure returns (int128) { require (x > 0); return int128 ( uint256 (log_2 (x)) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128); } /** * Calculate binary exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp_2 (int128 x) internal pure returns (int128) { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128; if (x & 0x4000000000000000 > 0) result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128; if (x & 0x2000000000000000 > 0) result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128; if (x & 0x1000000000000000 > 0) result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128; if (x & 0x800000000000000 > 0) result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128; if (x & 0x400000000000000 > 0) result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128; if (x & 0x200000000000000 > 0) result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128; if (x & 0x100000000000000 > 0) result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128; if (x & 0x80000000000000 > 0) result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128; if (x & 0x40000000000000 > 0) result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128; if (x & 0x20000000000000 > 0) result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128; if (x & 0x10000000000000 > 0) result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128; if (x & 0x8000000000000 > 0) result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128; if (x & 0x4000000000000 > 0) result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128; if (x & 0x2000000000000 > 0) result = result * 0x1000162E525EE054754457D5995292026 >> 128; if (x & 0x1000000000000 > 0) result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128; if (x & 0x800000000000 > 0) result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128; if (x & 0x400000000000 > 0) result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128; if (x & 0x200000000000 > 0) result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128; if (x & 0x100000000000 > 0) result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128; if (x & 0x80000000000 > 0) result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128; if (x & 0x40000000000 > 0) result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128; if (x & 0x20000000000 > 0) result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128; if (x & 0x10000000000 > 0) result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128; if (x & 0x8000000000 > 0) result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128; if (x & 0x4000000000 > 0) result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128; if (x & 0x2000000000 > 0) result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128; if (x & 0x1000000000 > 0) result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128; if (x & 0x800000000 > 0) result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128; if (x & 0x400000000 > 0) result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128; if (x & 0x200000000 > 0) result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128; if (x & 0x100000000 > 0) result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128; if (x & 0x80000000 > 0) result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128; if (x & 0x40000000 > 0) result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128; if (x & 0x20000000 > 0) result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128; if (x & 0x10000000 > 0) result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128; if (x & 0x8000000 > 0) result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128; if (x & 0x4000000 > 0) result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128; if (x & 0x2000000 > 0) result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128; if (x & 0x1000000 > 0) result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128; if (x & 0x800000 > 0) result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128; if (x & 0x400000 > 0) result = result * 0x100000000002C5C85FDF477B662B26945 >> 128; if (x & 0x200000 > 0) result = result * 0x10000000000162E42FEFA3AE53369388C >> 128; if (x & 0x100000 > 0) result = result * 0x100000000000B17217F7D1D351A389D40 >> 128; if (x & 0x80000 > 0) result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128; if (x & 0x40000 > 0) result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128; if (x & 0x20000 > 0) result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128; if (x & 0x10000 > 0) result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128; if (x & 0x8000 > 0) result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128; if (x & 0x4000 > 0) result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128; if (x & 0x2000 > 0) result = result * 0x1000000000000162E42FEFA39F02B772C >> 128; if (x & 0x1000 > 0) result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128; if (x & 0x800 > 0) result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128; if (x & 0x400 > 0) result = result * 0x100000000000002C5C85FDF473DEA871F >> 128; if (x & 0x200 > 0) result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128; if (x & 0x100 > 0) result = result * 0x100000000000000B17217F7D1CF79E949 >> 128; if (x & 0x80 > 0) result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128; if (x & 0x40 > 0) result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128; if (x & 0x20 > 0) result = result * 0x100000000000000162E42FEFA39EF366F >> 128; if (x & 0x10 > 0) result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128; if (x & 0x8 > 0) result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128; if (x & 0x4 > 0) result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128; if (x & 0x2 > 0) result = result * 0x1000000000000000162E42FEFA39EF358 >> 128; if (x & 0x1 > 0) result = result * 0x10000000000000000B17217F7D1CF79AB >> 128; result >>= uint256 (63 - (x >> 64)); require (result <= uint256 (MAX_64x64)); return int128 (result); } /** * Calculate natural exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp (int128 x) internal pure returns (int128) { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow return exp_2 ( int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128)); } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return unsigned 64.64-bit fixed point number */ function divuu (uint256 x, uint256 y) private pure returns (uint128) { require (y != 0); uint256 result; if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) result = (x << 64) / y; else { uint256 msb = 192; uint256 xc = x >> 192; if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1); require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 hi = result * (y >> 128); uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 xh = x >> 192; uint256 xl = x << 64; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here lo = hi << 128; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here assert (xh == hi >> 128); result += xl / y; } require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return uint128 (result); } /** * Calculate x^y assuming 0^0 is 1, where x is unsigned 129.127 fixed point * number and y is unsigned 256-bit integer number. Revert on overflow. * * @param x unsigned 129.127-bit fixed point number * @param y uint256 value * @return unsigned 129.127-bit fixed point number */ function powu (uint256 x, uint256 y) private pure returns (uint256) { if (y == 0) return 0x80000000000000000000000000000000; else if (x == 0) return 0; else { int256 msb = 0; uint256 xc = x; if (xc >= 0x100000000000000000000000000000000) { xc >>= 128; msb += 128; } if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 xe = msb - 127; if (xe > 0) x >>= uint256 (xe); else x <<= uint256 (-xe); uint256 result = 0x80000000000000000000000000000000; int256 re = 0; while (y > 0) { if (y & 1 > 0) { result = result * x; y -= 1; re += xe; if (result >= 0x8000000000000000000000000000000000000000000000000000000000000000) { result >>= 128; re += 1; } else result >>= 127; if (re < -127) return 0; // Underflow require (re < 128); // Overflow } else { x = x * x; y >>= 1; xe <<= 1; if (x >= 0x8000000000000000000000000000000000000000000000000000000000000000) { x >>= 128; xe += 1; } else x >>= 127; if (xe < -127) return 0; // Underflow require (xe < 128); // Overflow } } if (re > 0) result <<= uint256 (re); else if (re < 0) result >>= uint256 (-re); return result; } } /** * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer * number. * * @param x unsigned 256-bit integer number * @return unsigned 128-bit integer number */ function sqrtu (uint256 x) private pure returns (uint128) { if (x == 0) return 0; else { uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x8) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return uint128 (r < r1 ? r : r1); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.3; import "./Address.sol"; import "./IAssimilator.sol"; import "./ABDKMath64x64.sol"; library Assimilators { using ABDKMath64x64 for int128; using Address for address; IAssimilator public constant iAsmltr = IAssimilator(address(0)); function delegate(address _callee, bytes memory _data) internal returns (bytes memory) { require(_callee.isContract(), "Assimilators/callee-is-not-a-contract"); // solhint-disable-next-line (bool _success, bytes memory returnData_) = _callee.delegatecall(_data); // solhint-disable-next-line assembly { if eq(_success, 0) { revert(add(returnData_, 0x20), returndatasize()) } } return returnData_; } function getRate(address _assim) internal view returns (uint256 amount_) { amount_ = IAssimilator(_assim).getRate(); } function viewRawAmount(address _assim, int128 _amt) internal view returns (uint256 amount_) { amount_ = IAssimilator(_assim).viewRawAmount(_amt); } function viewRawAmountLPRatio( address _assim, uint256 _baseWeight, uint256 _quoteWeight, int128 _amount ) internal view returns (uint256 amount_) { amount_ = IAssimilator(_assim).viewRawAmountLPRatio(_baseWeight, _quoteWeight, address(this), _amount); } function viewNumeraireAmount(address _assim, uint256 _amt) internal view returns (int128 amt_) { amt_ = IAssimilator(_assim).viewNumeraireAmount(_amt); } function viewNumeraireAmountAndBalance(address _assim, uint256 _amt) internal view returns (int128 amt_, int128 bal_) { (amt_, bal_) = IAssimilator(_assim).viewNumeraireAmountAndBalance(address(this), _amt); } function viewNumeraireBalance(address _assim) internal view returns (int128 bal_) { bal_ = IAssimilator(_assim).viewNumeraireBalance(address(this)); } function viewNumeraireBalanceLPRatio( uint256 _baseWeight, uint256 _quoteWeight, address _assim ) internal view returns (int128 bal_) { bal_ = IAssimilator(_assim).viewNumeraireBalanceLPRatio(_baseWeight, _quoteWeight, address(this)); } function intakeRaw(address _assim, uint256 _amt) internal returns (int128 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.intakeRaw.selector, _amt); amt_ = abi.decode(delegate(_assim, data), (int128)); } function intakeRawAndGetBalance(address _assim, uint256 _amt) internal returns (int128 amt_, int128 bal_) { bytes memory data = abi.encodeWithSelector(iAsmltr.intakeRawAndGetBalance.selector, _amt); (amt_, bal_) = abi.decode(delegate(_assim, data), (int128, int128)); } function intakeNumeraire(address _assim, int128 _amt) internal returns (uint256 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.intakeNumeraire.selector, _amt); amt_ = abi.decode(delegate(_assim, data), (uint256)); } function intakeNumeraireLPRatio( address _assim, uint256 _baseWeight, uint256 _quoteWeight, int128 _amount ) internal returns (uint256 amt_) { bytes memory data = abi.encodeWithSelector( iAsmltr.intakeNumeraireLPRatio.selector, _baseWeight, _quoteWeight, address(this), _amount ); amt_ = abi.decode(delegate(_assim, data), (uint256)); } function outputRaw( address _assim, address _dst, uint256 _amt ) internal returns (int128 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.outputRaw.selector, _dst, _amt); amt_ = abi.decode(delegate(_assim, data), (int128)); amt_ = amt_.neg(); } function outputRawAndGetBalance( address _assim, address _dst, uint256 _amt ) internal returns (int128 amt_, int128 bal_) { bytes memory data = abi.encodeWithSelector(iAsmltr.outputRawAndGetBalance.selector, _dst, _amt); (amt_, bal_) = abi.decode(delegate(_assim, data), (int128, int128)); amt_ = amt_.neg(); } function outputNumeraire( address _assim, address _dst, int128 _amt ) internal returns (uint256 amt_) { bytes memory data = abi.encodeWithSelector(iAsmltr.outputNumeraire.selector, _dst, _amt.abs()); amt_ = abi.decode(delegate(_assim, data), (uint256)); } }
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.3; import "./Storage.sol"; import "./UnsafeMath64x64.sol"; import "./ABDKMath64x64.sol"; library CurveMath { int128 private constant ONE = 0x10000000000000000; int128 private constant MAX = 0x4000000000000000; // .25 in layman's terms int128 private constant MAX_DIFF = -0x10C6F7A0B5EE; int128 private constant ONE_WEI = 0x12; using ABDKMath64x64 for int128; using UnsafeMath64x64 for int128; using ABDKMath64x64 for uint256; // This is used to prevent stack too deep errors function calculateFee( int128 _gLiq, int128[] memory _bals, Storage.Curve storage curve, int128[] memory _weights ) internal view returns (int128 psi_) { int128 _beta = curve.beta; int128 _delta = curve.delta; psi_ = calculateFee(_gLiq, _bals, _beta, _delta, _weights); } function calculateFee( int128 _gLiq, int128[] memory _bals, int128 _beta, int128 _delta, int128[] memory _weights ) internal pure returns (int128 psi_) { uint256 _length = _bals.length; for (uint256 i = 0; i < _length; i++) { int128 _ideal = _gLiq.mul(_weights[i]); psi_ += calculateMicroFee(_bals[i], _ideal, _beta, _delta); } } function calculateMicroFee( int128 _bal, int128 _ideal, int128 _beta, int128 _delta ) private pure returns (int128 fee_) { if (_bal < _ideal) { int128 _threshold = _ideal.mul(ONE - _beta); if (_bal < _threshold) { int128 _feeMargin = _threshold - _bal; fee_ = _feeMargin.div(_ideal); fee_ = fee_.mul(_delta); if (fee_ > MAX) fee_ = MAX; fee_ = fee_.mul(_feeMargin); } else fee_ = 0; } else { int128 _threshold = _ideal.mul(ONE + _beta); if (_bal > _threshold) { int128 _feeMargin = _bal - _threshold; fee_ = _feeMargin.div(_ideal); fee_ = fee_.mul(_delta); if (fee_ > MAX) fee_ = MAX; fee_ = fee_.mul(_feeMargin); } else fee_ = 0; } } function calculateTrade( Storage.Curve storage curve, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals, int128 _inputAmt, uint256 _outputIndex ) internal view returns (int128 outputAmt_) { outputAmt_ = -_inputAmt; int128 _lambda = curve.lambda; int128[] memory _weights = curve.weights; int128 _omega = calculateFee(_oGLiq, _oBals, curve, _weights); int128 _psi; for (uint256 i = 0; i < 32; i++) { _psi = calculateFee(_nGLiq, _nBals, curve, _weights); int128 prevAmount; { prevAmount = outputAmt_; outputAmt_ = _omega < _psi ? -(_inputAmt + _omega - _psi) : -(_inputAmt + _lambda.mul(_omega - _psi)); } if (outputAmt_ / 1e13 == prevAmount / 1e13) { _nGLiq = _oGLiq + _inputAmt + outputAmt_; _nBals[_outputIndex] = _oBals[_outputIndex] + outputAmt_; enforceHalts(curve, _oGLiq, _nGLiq, _oBals, _nBals, _weights); enforceSwapInvariant(_oGLiq, _omega, _nGLiq, _psi); return outputAmt_; } else { _nGLiq = _oGLiq + _inputAmt + outputAmt_; _nBals[_outputIndex] = _oBals[_outputIndex].add(outputAmt_); } } revert("Curve/swap-convergence-failed"); } function calculateLiquidityMembrane( Storage.Curve storage curve, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals ) internal view returns (int128 curves_) { enforceHalts(curve, _oGLiq, _nGLiq, _oBals, _nBals, curve.weights); int128 _omega; int128 _psi; { int128 _beta = curve.beta; int128 _delta = curve.delta; int128[] memory _weights = curve.weights; _omega = calculateFee(_oGLiq, _oBals, _beta, _delta, _weights); _psi = calculateFee(_nGLiq, _nBals, _beta, _delta, _weights); } int128 _feeDiff = _psi.sub(_omega); int128 _liqDiff = _nGLiq.sub(_oGLiq); int128 _oUtil = _oGLiq.sub(_omega); int128 _totalShells = curve.totalSupply.divu(1e18); int128 _curveMultiplier; if (_totalShells == 0) { curves_ = _nGLiq.sub(_psi); } else if (_feeDiff >= 0) { _curveMultiplier = _liqDiff.sub(_feeDiff).div(_oUtil); } else { _curveMultiplier = _liqDiff.sub(curve.lambda.mul(_feeDiff)); _curveMultiplier = _curveMultiplier.div(_oUtil); } if (_totalShells != 0) { curves_ = _totalShells.mul(_curveMultiplier); enforceLiquidityInvariant(_totalShells, curves_, _oGLiq, _nGLiq, _omega, _psi); } } function enforceSwapInvariant( int128 _oGLiq, int128 _omega, int128 _nGLiq, int128 _psi ) private pure { int128 _nextUtil = _nGLiq - _psi; int128 _prevUtil = _oGLiq - _omega; int128 _diff = _nextUtil - _prevUtil; require(0 < _diff || _diff >= MAX_DIFF, "Curve/swap-invariant-violation"); } function enforceLiquidityInvariant( int128 _totalShells, int128 _newShells, int128 _oGLiq, int128 _nGLiq, int128 _omega, int128 _psi ) internal pure { if (_totalShells == 0 || 0 == _totalShells + _newShells) return; int128 _prevUtilPerShell = _oGLiq.sub(_omega).div(_totalShells); int128 _nextUtilPerShell = _nGLiq.sub(_psi).div(_totalShells.add(_newShells)); int128 _diff = _nextUtilPerShell - _prevUtilPerShell; require(0 < _diff || _diff >= MAX_DIFF, "Curve/liquidity-invariant-violation"); } function enforceHalts( Storage.Curve storage curve, int128 _oGLiq, int128 _nGLiq, int128[] memory _oBals, int128[] memory _nBals, int128[] memory _weights ) private view { uint256 _length = _nBals.length; int128 _alpha = curve.alpha; for (uint256 i = 0; i < _length; i++) { int128 _nIdeal = _nGLiq.mul(_weights[i]); if (_nBals[i] > _nIdeal) { int128 _upperAlpha = ONE + _alpha; int128 _nHalt = _nIdeal.mul(_upperAlpha); if (_nBals[i] > _nHalt) { int128 _oHalt = _oGLiq.mul(_weights[i]).mul(_upperAlpha); if (_oBals[i] < _oHalt) revert("Curve/upper-halt"); if (_nBals[i] - _nHalt > _oBals[i] - _oHalt) revert("Curve/upper-halt"); } } else { int128 _lowerAlpha = ONE - _alpha; int128 _nHalt = _nIdeal.mul(_lowerAlpha); if (_nBals[i] < _nHalt) { int128 _oHalt = _oGLiq.mul(_weights[i]); _oHalt = _oHalt.mul(_lowerAlpha); if (_oBals[i] > _oHalt) revert("Curve/lower-halt"); if (_nHalt - _nBals[i] > _oHalt - _oBals[i]) revert("Curve/lower-halt"); } } } } }
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.3; interface IAssimilator { function getRate() external view returns (uint256); function intakeRaw(uint256 amount) external returns (int128); function intakeRawAndGetBalance(uint256 amount) external returns (int128, int128); function intakeNumeraire(int128 amount) external returns (uint256); function intakeNumeraireLPRatio( uint256, uint256, address, int128 ) external returns (uint256); function outputRaw(address dst, uint256 amount) external returns (int128); function outputRawAndGetBalance(address dst, uint256 amount) external returns (int128, int128); function outputNumeraire(address dst, int128 amount) external returns (uint256); function viewRawAmount(int128) external view returns (uint256); function viewRawAmountLPRatio( uint256, uint256, address, int128 ) external view returns (uint256); function viewNumeraireAmount(uint256) external view returns (int128); function viewNumeraireBalanceLPRatio( uint256, uint256, address ) external view returns (int128); function viewNumeraireBalance(address) external view returns (int128); function viewNumeraireAmountAndBalance(address, uint256) external view returns (int128, int128); }
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.3; interface IOracle { function acceptOwnership() external; function accessController() external view returns (address); function aggregator() external view returns (address); function confirmAggregator(address _aggregator) external; function decimals() external view returns (uint8); function description() external view returns (string memory); function getAnswer(uint256 _roundId) external view returns (int256); function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function getTimestamp(uint256 _roundId) external view returns (uint256); function latestAnswer() external view returns (int256); function latestRound() external view returns (uint256); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestTimestamp() external view returns (uint256); function owner() external view returns (address); function phaseAggregators(uint16) external view returns (address); function phaseId() external view returns (uint16); function proposeAggregator(address _aggregator) external; function proposedAggregator() external view returns (address); function proposedGetRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function proposedLatestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function setController(address _accessController) external; function transferOwnership(address _to) external; function version() external view returns (uint256); }
// SPDX-License-Identifier: MIT // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. pragma solidity ^0.7.3; import "./IOracle.sol"; import "./Assimilators.sol"; contract Storage { struct Curve { // Curve parameters int128 alpha; int128 beta; int128 delta; int128 epsilon; int128 lambda; int128[] weights; // Assets and their assimilators Assimilator[] assets; mapping(address => Assimilator) assimilators; // Oracles to determine the price // Note that 0'th index should always be USDC 1e18 // Oracle's pricing should be denominated in Currency/USDC mapping(address => IOracle) oracles; // ERC20 Interface uint256 totalSupply; mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowances; } struct Assimilator { address addr; uint8 ix; } // Curve parameters Curve public curve; // Ownable address public owner; string public name; string public symbol; uint8 public constant decimals = 18; address[] public derivatives; address[] public numeraires; address[] public reserves; // Curve operational state bool public frozen = false; bool public emergency = false; bool public whitelistingStage = true; bool internal notEntered = true; mapping(address => uint256) public whitelistedDeposited; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.3; library UnsafeMath64x64 { /** * Calculate x * y rounding down. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function us_mul (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) * y >> 64; return int128 (result); } /** * Calculate x / y rounding towards zero. Revert on overflow or when y is * zero. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function us_div (int128 x, int128 y) internal pure returns (int128) { int256 result = (int256 (x) << 64) / y; return int128 (result); } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"ONE","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_WEI","outputs":[{"internalType":"int128","name":"","type":"int128"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
611a01610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100875760003560e01c8063822f39d511610065578063822f39d5146101ba578063b909f732146101dd578063c2ee3a08146101fc578063d4e2e7621461020457610087565b8063445cc62b1461008c57806344fd3db01461011757806360ee358e14610197575b600080fd5b81801561009857600080fd5b506100bc600480360360408110156100af57600080fd5b5080359060200135610234565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156101025781810151838201526020016100ea565b50505050905001935050505060405180910390f35b81801561012357600080fd5b506101476004803603604081101561013a57600080fd5b5080359060200135610526565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561018357818101518382015260200161016b565b505050509050019250505060405180910390f35b610147600480360360408110156101ad57600080fd5b5080359060200135610676565b6100bc600480360360408110156101d057600080fd5b5080359060200135610790565b6101e56109f8565b60408051600f9290920b8252519081900360200190f35b6101e56109fd565b81801561021057600080fd5b506101476004803603604081101561022757600080fd5b5080359060200135610a05565b600060608161024b84670de0b6b3a7640000610b00565b600486015490915060608167ffffffffffffffff8111801561026c57600080fd5b50604051908082528060200260200182016040528015610296578160200160208202803683370190505b509050600060606102a689610b3e565b91509150600060606102b78b610c46565b9150915083600f0b600014156103735760005b8681101561036d5760006103108d60030183815481106102e657fe5b60009182526020909120600282040154600f8c810b926001166010026101000a909104900b610d09565b905061034d8d600401838154811061032457fe5b6000918252602090912001546001600160a01b0316610348600f84900b6012610d40565b610d73565b87838151811061035957fe5b6020908102919091010152506001016102ca565b50610499565b6000610383600f89900b86610ddb565b905060006103d7670de0b6b3a76400008e6003016000815481106103a357fe5b90600052602060002090600291828204019190066010029054906101000a9004600f0b600f0b610e2d90919063ffffffff16565b905060006103f7670de0b6b3a76400008f6003016001815481106103a357fe5b905060005b89811015610494576104758f600401828154811061041657fe5b9060005260206000200160000160009054906101000a90046001600160a01b0316848461047060126104678a8e898151811061044e57fe5b6020026020010151600f0b610d0990919063ffffffff16565b600f0b90610d40565b610e95565b89828151811061048157fe5b60209081029190910101526001016103fc565b505050505b60078b01546000906104b390670de0b6b3a7640000610b00565b9050876000600f83900b13156104e4576104d1600f8a900b87610ddb565b90506104e1600f82900b83610d09565b90505b6104f18d83838787610f14565b6105148d3361050c600f85900b670de0b6b3a7640000610e2d565b9d508d610ff7565b50949750505050505050509250929050565b600482015460609060008261053a86610c46565b9150915060608367ffffffffffffffff8111801561055757600080fd5b50604051908082528060200260200182016040528015610581578160200160208202803683370190505b50905060006105a5670de0b6b3a76400008960070154610b0090919063ffffffff16565b905060006105bb88670de0b6b3a7640000610b00565b905060006105cd600f83900b84610ddb565b905060005b87811015610642576106238b60040182815481106105ec57fe5b9060005260206000200160000160009054906101000a90046001600160a01b03163361061e858a868151811061044e57fe5b611087565b85828151811061062f57fe5b60209081029190910101526001016105d2565b5061065b8a8461065485600f0b611122565b8989610f14565b6106668a338b611144565b5091955050505050505b92915050565b60048201546060908161068885610c46565b91505060608267ffffffffffffffff811180156106a457600080fd5b506040519080825280602002602001820160405280156106ce578160200160208202803683370190505b50905060006107106106f5670de0b6b3a76400008960070154610b0090919063ffffffff16565b61070788670de0b6b3a7640000610b00565b600f0b90610ddb565b905060005b848110156107845761076588600401828154811061072f57fe5b9060005260206000200160000160009054906101000a90046001600160a01b03166107608487858151811061044e57fe5b6111d5565b83828151811061077157fe5b6020908102919091010152600101610715565b50909695505050505050565b60006060816107a784670de0b6b3a7640000610b00565b6004860154909150600060606107bc88610b3e565b9150915060608367ffffffffffffffff811180156107d957600080fd5b50604051908082528060200260200182016040528015610803578160200160208202803683370190505b50905082600f0b600014156108b65760005b848110156108b0576108918a600401828154811061082f57fe5b9060005260206000200160000160009054906101000a90046001600160a01b031661076060126104678e600301868154811061086757fe5b60009182526020909120600282040154600f8d810b926001166010026101000a909104900b610d09565b82828151811061089d57fe5b6020908102919091010152600101610815565b50610986565b60006108c6600f87900b85610ddb565b905060006108e6670de0b6b3a76400008c6003016000815481106103a357fe5b90506000610906670de0b6b3a76400008d6003016001815481106103a357fe5b905060005b87811015610981576109628d600401828154811061092557fe5b9060005260206000200160000160009054906101000a90046001600160a01b0316848461095d60126104678a8d898151811061044e57fe5b611251565b85828151811061096e57fe5b602090810291909101015260010161090b565b505050505b60078901546000906109a090670de0b6b3a7640000610b00565b9050856000600f83900b13156109d1576109be600f88900b86610ddb565b90506109ce600f82900b83610d09565b90505b6109e7600f82900b670de0b6b3a7640000610e2d565b9b929a509198505050505050505050565b601281565b600160401b81565b600482015460609081610a1785610c46565b91505060608267ffffffffffffffff81118015610a3357600080fd5b50604051908082528060200260200182016040528015610a5d578160200160208202803683370190505b5090506000610a81670de0b6b3a76400008860070154610b0090919063ffffffff16565b90506000610a9787670de0b6b3a7640000610b00565b90506000610aa9600f83900b84610ddb565b905060005b86811015610ae757610ac88a60040182815481106105ec57fe5b858281518110610ad457fe5b6020908102919091010152600101610aae565b50610af389338a611144565b5091979650505050505050565b600081610b0c57600080fd5b6000610b1884846112dc565b905060016001607f1b036001600160801b0382161115610b3757600080fd5b9392505050565b6004810154600090606090818167ffffffffffffffff81118015610b6157600080fd5b50604051908082528060200260200182016040528015610b8b578160200160208202803683370190505b5090506000610bac670de0b6b3a7640000876003016000815481106103a357fe5b90506000610bcc670de0b6b3a7640000886003016001815481106103a357fe5b905060005b84811015610c3a576000610c0984848b6004018581548110610bef57fe5b6000918252602090912001546001600160a01b0316611426565b905080858381518110610c1857fe5b600f92830b90920b602092830291909101909101529690960195600101610bd1565b50919350505050915091565b6004810154600090606090818167ffffffffffffffff81118015610c6957600080fd5b50604051908082528060200260200182016040528015610c93578160200160208202803683370190505b50905060005b82811015610d00576000610ccf876004018381548110610cb557fe5b6000918252602090912001546001600160a01b03166114a8565b905080838381518110610cde57fe5b600f92830b90920b602092830291909101909101529490940193600101610c99565b50915050915091565b6000600f83810b9083900b0260401d60016001607f1b03198112801590610d37575060016001607f1b038113155b610b3757600080fd5b6000600f83810b9083900b0160016001607f1b03198112801590610d37575060016001607f1b03811315610b3757600080fd5b60408051600f83900b6024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316624e387960e31b179052600090610dbd8482611529565b8060200190516020811015610dd157600080fd5b5051949350505050565b600081600f0b60001415610dee57600080fd5b600082600f0b604085600f0b901b81610e0357fe5b05905060016001607f1b03198112801590610d37575060016001607f1b03811315610b3757600080fd5b600081610e3c57506000610670565b600083600f0b1215610e4d57600080fd5b600f83900b6001600160801b038316810260401c90608084901c026001600160c01b03811115610e7c57600080fd5b60401b8119811115610e8d57600080fd5b019392505050565b604080516024810185905260448101849052306064820152600f83900b6084808301919091528251808303909101815260a49091019091526020810180516001600160e01b031663df4efe4960e01b179052600090610ef48682611529565b8060200190516020811015610f0857600080fd5b50519695505050505050565b60006060610f2187610c46565b885460018a015460038b01805460408051602080840282018101909252828152969850949650600160801b909304600f90810b9592900b9360609390830182828015610fb257602002820191906000526020600020906000905b82829054906101000a9004600f0b600f0b81526020019060100190602082600f01049283019260010382029150808411610f7b5790505b505050505090506000610fc88888868686611638565b90506000610fd98787878787611638565b9050610fe98b8b8b8a86866116ab565b505050505050505050505050565b61100583600701548261176b565b60078401556001600160a01b038216600090815260088401602052604090205461102f908261176b565b6001600160a01b03831660009081526008850160209081526040808320939093558251848152925133937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92908290030190a3505050565b600060606337e1c82960e11b846110a1600f86900b6117b9565b60405160240180836001600160a01b0316815260200182600f0b815260200192505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505090506111038582611529565b806020019051602081101561111757600080fd5b505195945050505050565b6000600f82900b60016001607f1b0319141561113d57600080fd5b5060000390565b6001600160a01b038216600090815260088401602052604090205461116990826117e3565b6001600160a01b0383166000908152600885016020526040902055600783015461119390826117e3565b600784015560408051828152905160009133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3505050565b6000826001600160a01b0316636b677a8f836040518263ffffffff1660e01b81526004018082600f0b815260200191505060206040518083038186803b15801561121e57600080fd5b505afa158015611232573d6000803e3d6000fd5b505050506040513d602081101561124857600080fd5b50519392505050565b604080516208c23d60e51b81526004810185905260248101849052306044820152600f83900b606482015290516000916001600160a01b0387169163011847a091608480820192602092909190829003018186803b1580156112b257600080fd5b505afa1580156112c6573d6000803e3d6000fd5b505050506040513d602081101561111757600080fd5b6000816112e857600080fd5b60006001600160c01b03841161130d5782604085901b8161130557fe5b049050611412565b60c084811c6401000000008110611326576020918201911c5b620100008110611338576010918201911c5b6101008110611349576008918201911c5b60108110611359576004918201911c5b60048110611369576002918201911c5b60028110611378576001820191505b60bf820360018603901c6001018260ff0387901b8161139357fe5b0492506001600160801b038311156113aa57600080fd5b608085901c83026001600160801b038616840260c088901c604089901b828110156113d6576001820391505b608084901b929003828110156113ed576001820391505b829003608084901c82146113fd57fe5b88818161140657fe5b04870196505050505050505b6001600160801b03811115610b3757600080fd5b60408051630173deed60e21b8152600481018590526024810184905230604482015290516000916001600160a01b038416916305cf7bb491606480820192602092909190829003018186803b15801561147e57600080fd5b505afa158015611492573d6000803e3d6000fd5b505050506040513d6020811015610dd157600080fd5b6000816001600160a01b031663ac969a73306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156114f757600080fd5b505afa15801561150b573d6000803e3d6000fd5b505050506040513d602081101561152157600080fd5b505192915050565b606061153d836001600160a01b0316611832565b6115785760405162461bcd60e51b81526004018080602001828103825260258152602001806119a76025913960400191505060405180910390fd5b60006060846001600160a01b0316846040518082805190602001908083835b602083106115b65780518252601f199092019160209182019101611597565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611616576040519150601f19603f3d011682016040523d82523d6000602084013e61161b565b606091505b50915091506000821415611630573d60208201fd5b949350505050565b8351600090815b818110156116a057600061167285838151811061165857fe5b60200260200101518a600f0b610d0990919063ffffffff16565b905061169388838151811061168357fe5b6020026020010151828989611838565b909301925060010161163f565b505095945050505050565b85600f0b600014806116c05750858501600f0b155b156116ca57611763565b60006116de87610707600f88900b86611950565b905060006117016116f3600f8a900b89610d40565b610707600f88900b86611950565b9050818103600f81900b6000128061172457506510c6f7a0b5ed19600f82900b12155b61175f5760405162461bcd60e51b81526004018080602001828103825260238152602001806119846023913960400191505060405180910390fd5b5050505b505050505050565b80820182811015610670576040805162461bcd60e51b815260206004820152601360248201527243757276652f6d696e742d6f766572666c6f7760681b604482015290519081900360640190fd5b6000600f82900b60016001607f1b031914156117d457600080fd5b600082600f0b1261113d575090565b80820382811115610670576040805162461bcd60e51b815260206004820152601460248201527343757276652f6275726e2d756e646572666c6f7760601b604482015290519081900360640190fd5b3b151590565b600083600f0b85600f0b12156118cb57600061185f600f86900b600160401b869003610d09565b905080600f0b86600f0b12156118c057858103611880600f82900b87610ddb565b9250611890600f84900b85610d09565b92506001603e1b600f84900b13156118aa576001603e1b92505b6118b8600f84900b82610d09565b9250506118c5565b600091505b50611630565b60006118e1600f86900b600160401b8601610d09565b905080600f0b86600f0b131561194257808603611902600f82900b87610ddb565b9250611912600f84900b85610d09565b92506001603e1b600f84900b131561192c576001603e1b92505b61193a600f84900b82610d09565b925050611947565b600091505b50949350505050565b6000600f82810b9084900b0360016001607f1b03198112801590610d37575060016001607f1b03811315610b3757600080fdfe43757276652f6c69717569646974792d696e76617269616e742d76696f6c6174696f6e417373696d696c61746f72732f63616c6c65652d69732d6e6f742d612d636f6e7472616374a2646970667358221220f2fb47f787d5e22a7b989dab6b571dafd3913c84f23897329319dcb0ed27be1864736f6c63430007030033
Deployed Bytecode
0x7303416eed4ecd6ecdf95ac106ca0572469d18b5cb30146080604052600436106100875760003560e01c8063822f39d511610065578063822f39d5146101ba578063b909f732146101dd578063c2ee3a08146101fc578063d4e2e7621461020457610087565b8063445cc62b1461008c57806344fd3db01461011757806360ee358e14610197575b600080fd5b81801561009857600080fd5b506100bc600480360360408110156100af57600080fd5b5080359060200135610234565b6040518083815260200180602001828103825283818151815260200191508051906020019060200280838360005b838110156101025781810151838201526020016100ea565b50505050905001935050505060405180910390f35b81801561012357600080fd5b506101476004803603604081101561013a57600080fd5b5080359060200135610526565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561018357818101518382015260200161016b565b505050509050019250505060405180910390f35b610147600480360360408110156101ad57600080fd5b5080359060200135610676565b6100bc600480360360408110156101d057600080fd5b5080359060200135610790565b6101e56109f8565b60408051600f9290920b8252519081900360200190f35b6101e56109fd565b81801561021057600080fd5b506101476004803603604081101561022757600080fd5b5080359060200135610a05565b600060608161024b84670de0b6b3a7640000610b00565b600486015490915060608167ffffffffffffffff8111801561026c57600080fd5b50604051908082528060200260200182016040528015610296578160200160208202803683370190505b509050600060606102a689610b3e565b91509150600060606102b78b610c46565b9150915083600f0b600014156103735760005b8681101561036d5760006103108d60030183815481106102e657fe5b60009182526020909120600282040154600f8c810b926001166010026101000a909104900b610d09565b905061034d8d600401838154811061032457fe5b6000918252602090912001546001600160a01b0316610348600f84900b6012610d40565b610d73565b87838151811061035957fe5b6020908102919091010152506001016102ca565b50610499565b6000610383600f89900b86610ddb565b905060006103d7670de0b6b3a76400008e6003016000815481106103a357fe5b90600052602060002090600291828204019190066010029054906101000a9004600f0b600f0b610e2d90919063ffffffff16565b905060006103f7670de0b6b3a76400008f6003016001815481106103a357fe5b905060005b89811015610494576104758f600401828154811061041657fe5b9060005260206000200160000160009054906101000a90046001600160a01b0316848461047060126104678a8e898151811061044e57fe5b6020026020010151600f0b610d0990919063ffffffff16565b600f0b90610d40565b610e95565b89828151811061048157fe5b60209081029190910101526001016103fc565b505050505b60078b01546000906104b390670de0b6b3a7640000610b00565b9050876000600f83900b13156104e4576104d1600f8a900b87610ddb565b90506104e1600f82900b83610d09565b90505b6104f18d83838787610f14565b6105148d3361050c600f85900b670de0b6b3a7640000610e2d565b9d508d610ff7565b50949750505050505050509250929050565b600482015460609060008261053a86610c46565b9150915060608367ffffffffffffffff8111801561055757600080fd5b50604051908082528060200260200182016040528015610581578160200160208202803683370190505b50905060006105a5670de0b6b3a76400008960070154610b0090919063ffffffff16565b905060006105bb88670de0b6b3a7640000610b00565b905060006105cd600f83900b84610ddb565b905060005b87811015610642576106238b60040182815481106105ec57fe5b9060005260206000200160000160009054906101000a90046001600160a01b03163361061e858a868151811061044e57fe5b611087565b85828151811061062f57fe5b60209081029190910101526001016105d2565b5061065b8a8461065485600f0b611122565b8989610f14565b6106668a338b611144565b5091955050505050505b92915050565b60048201546060908161068885610c46565b91505060608267ffffffffffffffff811180156106a457600080fd5b506040519080825280602002602001820160405280156106ce578160200160208202803683370190505b50905060006107106106f5670de0b6b3a76400008960070154610b0090919063ffffffff16565b61070788670de0b6b3a7640000610b00565b600f0b90610ddb565b905060005b848110156107845761076588600401828154811061072f57fe5b9060005260206000200160000160009054906101000a90046001600160a01b03166107608487858151811061044e57fe5b6111d5565b83828151811061077157fe5b6020908102919091010152600101610715565b50909695505050505050565b60006060816107a784670de0b6b3a7640000610b00565b6004860154909150600060606107bc88610b3e565b9150915060608367ffffffffffffffff811180156107d957600080fd5b50604051908082528060200260200182016040528015610803578160200160208202803683370190505b50905082600f0b600014156108b65760005b848110156108b0576108918a600401828154811061082f57fe5b9060005260206000200160000160009054906101000a90046001600160a01b031661076060126104678e600301868154811061086757fe5b60009182526020909120600282040154600f8d810b926001166010026101000a909104900b610d09565b82828151811061089d57fe5b6020908102919091010152600101610815565b50610986565b60006108c6600f87900b85610ddb565b905060006108e6670de0b6b3a76400008c6003016000815481106103a357fe5b90506000610906670de0b6b3a76400008d6003016001815481106103a357fe5b905060005b87811015610981576109628d600401828154811061092557fe5b9060005260206000200160000160009054906101000a90046001600160a01b0316848461095d60126104678a8d898151811061044e57fe5b611251565b85828151811061096e57fe5b602090810291909101015260010161090b565b505050505b60078901546000906109a090670de0b6b3a7640000610b00565b9050856000600f83900b13156109d1576109be600f88900b86610ddb565b90506109ce600f82900b83610d09565b90505b6109e7600f82900b670de0b6b3a7640000610e2d565b9b929a509198505050505050505050565b601281565b600160401b81565b600482015460609081610a1785610c46565b91505060608267ffffffffffffffff81118015610a3357600080fd5b50604051908082528060200260200182016040528015610a5d578160200160208202803683370190505b5090506000610a81670de0b6b3a76400008860070154610b0090919063ffffffff16565b90506000610a9787670de0b6b3a7640000610b00565b90506000610aa9600f83900b84610ddb565b905060005b86811015610ae757610ac88a60040182815481106105ec57fe5b858281518110610ad457fe5b6020908102919091010152600101610aae565b50610af389338a611144565b5091979650505050505050565b600081610b0c57600080fd5b6000610b1884846112dc565b905060016001607f1b036001600160801b0382161115610b3757600080fd5b9392505050565b6004810154600090606090818167ffffffffffffffff81118015610b6157600080fd5b50604051908082528060200260200182016040528015610b8b578160200160208202803683370190505b5090506000610bac670de0b6b3a7640000876003016000815481106103a357fe5b90506000610bcc670de0b6b3a7640000886003016001815481106103a357fe5b905060005b84811015610c3a576000610c0984848b6004018581548110610bef57fe5b6000918252602090912001546001600160a01b0316611426565b905080858381518110610c1857fe5b600f92830b90920b602092830291909101909101529690960195600101610bd1565b50919350505050915091565b6004810154600090606090818167ffffffffffffffff81118015610c6957600080fd5b50604051908082528060200260200182016040528015610c93578160200160208202803683370190505b50905060005b82811015610d00576000610ccf876004018381548110610cb557fe5b6000918252602090912001546001600160a01b03166114a8565b905080838381518110610cde57fe5b600f92830b90920b602092830291909101909101529490940193600101610c99565b50915050915091565b6000600f83810b9083900b0260401d60016001607f1b03198112801590610d37575060016001607f1b038113155b610b3757600080fd5b6000600f83810b9083900b0160016001607f1b03198112801590610d37575060016001607f1b03811315610b3757600080fd5b60408051600f83900b6024808301919091528251808303909101815260449091019091526020810180516001600160e01b0316624e387960e31b179052600090610dbd8482611529565b8060200190516020811015610dd157600080fd5b5051949350505050565b600081600f0b60001415610dee57600080fd5b600082600f0b604085600f0b901b81610e0357fe5b05905060016001607f1b03198112801590610d37575060016001607f1b03811315610b3757600080fd5b600081610e3c57506000610670565b600083600f0b1215610e4d57600080fd5b600f83900b6001600160801b038316810260401c90608084901c026001600160c01b03811115610e7c57600080fd5b60401b8119811115610e8d57600080fd5b019392505050565b604080516024810185905260448101849052306064820152600f83900b6084808301919091528251808303909101815260a49091019091526020810180516001600160e01b031663df4efe4960e01b179052600090610ef48682611529565b8060200190516020811015610f0857600080fd5b50519695505050505050565b60006060610f2187610c46565b885460018a015460038b01805460408051602080840282018101909252828152969850949650600160801b909304600f90810b9592900b9360609390830182828015610fb257602002820191906000526020600020906000905b82829054906101000a9004600f0b600f0b81526020019060100190602082600f01049283019260010382029150808411610f7b5790505b505050505090506000610fc88888868686611638565b90506000610fd98787878787611638565b9050610fe98b8b8b8a86866116ab565b505050505050505050505050565b61100583600701548261176b565b60078401556001600160a01b038216600090815260088401602052604090205461102f908261176b565b6001600160a01b03831660009081526008850160209081526040808320939093558251848152925133937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92908290030190a3505050565b600060606337e1c82960e11b846110a1600f86900b6117b9565b60405160240180836001600160a01b0316815260200182600f0b815260200192505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b03838183161783525050505090506111038582611529565b806020019051602081101561111757600080fd5b505195945050505050565b6000600f82900b60016001607f1b0319141561113d57600080fd5b5060000390565b6001600160a01b038216600090815260088401602052604090205461116990826117e3565b6001600160a01b0383166000908152600885016020526040902055600783015461119390826117e3565b600784015560408051828152905160009133917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3505050565b6000826001600160a01b0316636b677a8f836040518263ffffffff1660e01b81526004018082600f0b815260200191505060206040518083038186803b15801561121e57600080fd5b505afa158015611232573d6000803e3d6000fd5b505050506040513d602081101561124857600080fd5b50519392505050565b604080516208c23d60e51b81526004810185905260248101849052306044820152600f83900b606482015290516000916001600160a01b0387169163011847a091608480820192602092909190829003018186803b1580156112b257600080fd5b505afa1580156112c6573d6000803e3d6000fd5b505050506040513d602081101561111757600080fd5b6000816112e857600080fd5b60006001600160c01b03841161130d5782604085901b8161130557fe5b049050611412565b60c084811c6401000000008110611326576020918201911c5b620100008110611338576010918201911c5b6101008110611349576008918201911c5b60108110611359576004918201911c5b60048110611369576002918201911c5b60028110611378576001820191505b60bf820360018603901c6001018260ff0387901b8161139357fe5b0492506001600160801b038311156113aa57600080fd5b608085901c83026001600160801b038616840260c088901c604089901b828110156113d6576001820391505b608084901b929003828110156113ed576001820391505b829003608084901c82146113fd57fe5b88818161140657fe5b04870196505050505050505b6001600160801b03811115610b3757600080fd5b60408051630173deed60e21b8152600481018590526024810184905230604482015290516000916001600160a01b038416916305cf7bb491606480820192602092909190829003018186803b15801561147e57600080fd5b505afa158015611492573d6000803e3d6000fd5b505050506040513d6020811015610dd157600080fd5b6000816001600160a01b031663ac969a73306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b1580156114f757600080fd5b505afa15801561150b573d6000803e3d6000fd5b505050506040513d602081101561152157600080fd5b505192915050565b606061153d836001600160a01b0316611832565b6115785760405162461bcd60e51b81526004018080602001828103825260258152602001806119a76025913960400191505060405180910390fd5b60006060846001600160a01b0316846040518082805190602001908083835b602083106115b65780518252601f199092019160209182019101611597565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114611616576040519150601f19603f3d011682016040523d82523d6000602084013e61161b565b606091505b50915091506000821415611630573d60208201fd5b949350505050565b8351600090815b818110156116a057600061167285838151811061165857fe5b60200260200101518a600f0b610d0990919063ffffffff16565b905061169388838151811061168357fe5b6020026020010151828989611838565b909301925060010161163f565b505095945050505050565b85600f0b600014806116c05750858501600f0b155b156116ca57611763565b60006116de87610707600f88900b86611950565b905060006117016116f3600f8a900b89610d40565b610707600f88900b86611950565b9050818103600f81900b6000128061172457506510c6f7a0b5ed19600f82900b12155b61175f5760405162461bcd60e51b81526004018080602001828103825260238152602001806119846023913960400191505060405180910390fd5b5050505b505050505050565b80820182811015610670576040805162461bcd60e51b815260206004820152601360248201527243757276652f6d696e742d6f766572666c6f7760681b604482015290519081900360640190fd5b6000600f82900b60016001607f1b031914156117d457600080fd5b600082600f0b1261113d575090565b80820382811115610670576040805162461bcd60e51b815260206004820152601460248201527343757276652f6275726e2d756e646572666c6f7760601b604482015290519081900360640190fd5b3b151590565b600083600f0b85600f0b12156118cb57600061185f600f86900b600160401b869003610d09565b905080600f0b86600f0b12156118c057858103611880600f82900b87610ddb565b9250611890600f84900b85610d09565b92506001603e1b600f84900b13156118aa576001603e1b92505b6118b8600f84900b82610d09565b9250506118c5565b600091505b50611630565b60006118e1600f86900b600160401b8601610d09565b905080600f0b86600f0b131561194257808603611902600f82900b87610ddb565b9250611912600f84900b85610d09565b92506001603e1b600f84900b131561192c576001603e1b92505b61193a600f84900b82610d09565b925050611947565b600091505b50949350505050565b6000600f82810b9084900b0360016001607f1b03198112801590610d37575060016001607f1b03811315610b3757600080fdfe43757276652f6c69717569646974792d696e76617269616e742d76696f6c6174696f6e417373696d696c61746f72732f63616c6c65652d69732d6e6f742d612d636f6e7472616374a2646970667358221220f2fb47f787d5e22a7b989dab6b571dafd3913c84f23897329319dcb0ed27be1864736f6c63430007030033
Deployed Bytecode Sourcemap
203:9373:6:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;527:1997;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;527:1997:6;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5134:933;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5134:933:6;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6073:632;;;;;;;;;;;;;;;;-1:-1:-1;6073:632:6;;;;;;;:::i;2530:1756::-;;;;;;;;;;;;;;;;-1:-1:-1;2530:1756:6;;;;;;;:::i;483:37::-;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;429:48;;;:::i;4292:836::-;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4292:836:6;;;;;;;:::i;527:1997::-;637:15;654:16;637:15;705:19;:8;719:4;705:13;:19::i;:::-;753:12;;;:19;686:38;;-1:-1:-1;783:26:6;753:19;812:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;812:22:6;;783:51;;846:13;861:22;887:45;926:5;887:38;:45::i;:::-;845:87;;;;995:17;1014:26;1044:35;1073:5;1044:28;:35::i;:::-;994:85;;;;1141:6;:11;;1151:1;1141:11;1137:936;;;1173:9;1168:278;1192:7;1188:1;:11;1168:278;;;1288:9;1300:31;1314:5;:13;;1328:1;1314:16;;;;;;;;;;;;;;;;;;;;;;1300:13;;;;1314:16;;;;;;;;;;;1300:13;:31::i;:::-;1288:43;;1364:67;1393:5;:12;;1406:1;1393:15;;;;;;;;;;;;;;;;;:20;-1:-1:-1;;;;;1393:20:6;1415:15;:6;;;;516:4;1415:6;:15::i;:::-;1364:28;:67::i;:::-;1349:9;1359:1;1349:12;;;;;;;;;;;;;;;;;:82;-1:-1:-1;1201:3:6;;1168:278;;;;1137:936;;;1569:18;1590:21;:13;;;;1604:6;1590:13;:21::i;:::-;1569:42;;1626:19;1648:27;1670:4;1648:5;:13;;1662:1;1648:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:21;;;;:27;;;;:::i;:::-;1626:49;;1689:20;1712:27;1734:4;1712:5;:13;;1726:1;1712:16;;;;;;;:27;1689:50;;1759:9;1754:309;1778:7;1774:1;:11;1754:309;;;1825:223;1882:5;:12;;1895:1;1882:15;;;;;;;;;;;;;;;:20;;;;;;;;;;-1:-1:-1;;;;;1882:20:6;1924:11;1957:12;1991:39;516:4;1991:26;2005:11;1991:6;1998:1;1991:9;;;;;;;;;;;;;;:13;;;;:26;;;;:::i;:::-;:30;;;;:39::i;:::-;1825:35;:223::i;:::-;1810:9;1820:1;1810:12;;;;;;;;;;;;;;;;;:238;1787:3;;1754:309;;;;1137:936;;;;2105:17;;;;2083:19;;2105:28;;2128:4;2105:22;:28::i;:::-;2083:50;-1:-1:-1;2164:9:6;2144:17;2188:16;;;;;2184:136;;;2233:21;:13;;;;2247:6;2233:13;:21::i;:::-;2220:34;-1:-1:-1;2281:28:6;:14;;;;2296:12;2281:14;:28::i;:::-;2268:41;;2184:136;2330:82;2356:5;2363:12;2377:10;2389;2401;2330:25;:82::i;:::-;2423:56;2428:5;2435:10;2457:21;:15;;;;2473:4;2457:15;:21::i;:::-;2447:31;;;2423:4;:56::i;:::-;-1:-1:-1;2507:9:6;;-1:-1:-1;;;;;;;;527:1997:6;;;;;:::o;5134:933::-;5298:12;;;:19;5248:16;;5280:15;5248:16;5370:35;5298:5;5370:28;:35::i;:::-;5328:77;;;;5416:29;5462:7;5448:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;5448:22:6;;5416:54;;5481:19;5503:28;5526:4;5503:5;:17;;;:22;;:28;;;;:::i;:::-;5481:50;-1:-1:-1;5541:19:6;5563:22;:11;5580:4;5563:16;:22::i;:::-;5541:44;-1:-1:-1;5596:18:6;5617:30;:16;;;;5634:12;5617:16;:30::i;:::-;5596:51;;5663:9;5658:233;5682:7;5678:1;:11;5658:233;;;5728:152;5774:5;:12;;5787:1;5774:15;;;;;;;;;;;;;;;:20;;;;;;;;;;-1:-1:-1;;;;;5774:20:6;5812:10;5840:26;5854:11;5840:6;5847:1;5840:9;;;;;;;:26;5728:28;:152::i;:::-;5710:12;5723:1;5710:15;;;;;;;;;;;;;;;;;:170;5691:3;;5658:233;;;;5901:82;5927:5;5934:12;5948:18;:12;:16;;;:18::i;:::-;5968:6;5976;5901:25;:82::i;:::-;5994:36;5999:5;6006:10;6018:11;5994:4;:36::i;:::-;-1:-1:-1;6048:12:6;;-1:-1:-1;;;;;;5134:933:6;;;;;:::o;6073:632::-;6254:12;;;:19;6204:16;;;6313:35;6254:5;6313:28;:35::i;:::-;6284:64;;;6359:29;6405:7;6391:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6391:22:6;;6359:54;;6424:18;6445:56;6472:28;6495:4;6472:5;:17;;;:22;;:28;;;;:::i;:::-;6445:22;:11;6462:4;6445:16;:22::i;:::-;:26;;;;:56::i;:::-;6424:77;;6517:9;6512:157;6536:7;6532:1;:11;6512:157;;;6582:76;6609:5;:12;;6622:1;6609:15;;;;;;;;;;;;;;;:20;;;;;;;;;;-1:-1:-1;;;;;6609:20:6;6631:26;6645:11;6631:6;6638:1;6631:9;;;;;;;:26;6582;:76::i;:::-;6564:12;6577:1;6564:15;;;;;;;;;;;;;;;;;:94;6545:3;;6512:157;;;-1:-1:-1;6686:12:6;;6073:632;-1:-1:-1;;;;;;6073:632:6:o;2530:1756::-;2657:15;2674:16;2657:15;2725:19;:8;2739:4;2725:13;:19::i;:::-;2773:12;;;:19;2706:38;;-1:-1:-1;2755:15:6;2819:22;2845:45;2773:5;2845:38;:45::i;:::-;2803:87;;;;2901:26;2944:7;2930:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2930:22:6;;2901:51;;2991:6;:11;;3001:1;2991:11;2987:966;;;3023:9;3018:238;3042:7;3038:1;:11;3018:238;;;3089:152;3137:5;:12;;3150:1;3137:15;;;;;;;;;;;;;;;:20;;;;;;;;;;-1:-1:-1;;;;;3137:20:6;3179:44;516:4;3179:31;3193:5;:13;;3207:1;3193:16;;;;;;;;;;;;;;;;;;;;;;3179:13;;;;3193:16;;;;;;;;;;;3179:13;:31::i;3089:152::-;3074:9;3084:1;3074:12;;;;;;;;;;;;;;;;;:167;3051:3;;3018:238;;;;2987:966;;;3378:18;3399:21;:13;;;;3413:6;3399:13;:21::i;:::-;3378:42;;3435:19;3457:27;3479:4;3457:5;:13;;3471:1;3457:16;;;;;;;:27;3435:49;;3498:20;3521:27;3543:4;3521:5;:13;;3535:1;3521:16;;;;;;;:27;3498:50;;3641:9;3636:307;3660:7;3656:1;:11;3636:307;;;3707:221;3762:5;:12;;3775:1;3762:15;;;;;;;;;;;;;;;:20;;;;;;;;;;-1:-1:-1;;;;;3762:20:6;3804:11;3837:12;3871:39;516:4;3871:26;3885:11;3871:6;3878:1;3871:9;;;;;;;:39;3707:33;:221::i;:::-;3692:9;3702:1;3692:12;;;;;;;;;;;;;;;;;:236;3669:3;;3636:307;;;;2987:966;;;;3985:17;;;;3963:19;;3985:28;;4008:4;3985:22;:28::i;:::-;3963:50;-1:-1:-1;4044:9:6;4024:17;4068:16;;;;;4064:136;;;4113:21;:13;;;;4127:6;4113:13;:21::i;:::-;4100:34;-1:-1:-1;4161:28:6;:14;;;;4176:12;4161:14;:28::i;:::-;4148:41;;4064:136;4220:21;:15;;;;4236:4;4220:15;:21::i;:::-;4210:31;4269:9;;-1:-1:-1;2530:1756:6;;-1:-1:-1;;;;;;;;;2530:1756:6:o;483:37::-;516:4;483:37;:::o;429:48::-;-1:-1:-1;;;429:48:6;:::o;4292:836::-;4465:12;;;:19;4415:16;;;4524:35;4465:5;4524:28;:35::i;:::-;4495:64;;;4570:29;4616:7;4602:22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4602:22:6;;4570:54;;4635:19;4657:28;4680:4;4657:5;:17;;;:22;;:28;;;;:::i;:::-;4635:50;-1:-1:-1;4695:19:6;4717:22;:11;4734:4;4717:16;:22::i;:::-;4695:44;-1:-1:-1;4750:18:6;4771:30;:16;;;;4788:12;4771:16;:30::i;:::-;4750:51;;4817:9;4812:233;4836:7;4832:1;:11;4812:233;;;4882:152;4928:5;:12;;4941:1;4928:15;;;;;;;4882:152;4864:12;4877:1;4864:15;;;;;;;;;;;;;;;;;:170;4845:3;;4812:233;;;;5055:36;5060:5;5067:10;5079:11;5055:4;:36::i;:::-;-1:-1:-1;5109:12:6;;4292:836;-1:-1:-1;;;;;;;4292:836:6:o;8214:203:0:-;8274:6;8297;8288:16;;;;;;8310:14;8327:12;8334:1;8337;8327:5;:12::i;:::-;8310:29;-1:-1:-1;;;;;;;;;;;8354:29:0;;;;8345:39;;;;;;8405:6;8214:203;-1:-1:-1;;;8214:203:0:o;6711:695:6:-;6908:12;;;:19;6835:22;;6859:15;;;6908:19;6966:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;6966:21:6;;6938:49;;6997:19;7019:27;7041:4;7019:5;:13;;7033:1;7019:16;;;;;;;:27;6997:49;;7056:20;7079:27;7101:4;7079:5;:13;;7093:1;7079:16;;;;;;;:27;7056:50;;7122:9;7117:237;7141:7;7137:1;:11;7117:237;;;7169:11;7183:89;7224:11;7237:12;7251:5;:12;;7264:1;7251:15;;;;;;;;;;;;;;;;;:20;-1:-1:-1;;;;;7251:20:6;7183:40;:89::i;:::-;7169:103;;7302:4;7287:9;7297:1;7287:12;;;;;;;;:19;;;;;;;:12;;;;;;;;;;;:19;7320:23;;;;;7150:3;;7117:237;;;-1:-1:-1;7389:9:6;;-1:-1:-1;;;;6711:695:6;;;:::o;7412:532::-;7599:12;;;:19;7526:22;;7550:15;;;7599:19;7657:21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;7657:21:6;;7629:49;;7694:9;7689:203;7713:7;7709:1;:11;7689:203;;;7741:11;7755:55;7789:5;:12;;7802:1;7789:15;;;;;;;;;;;;;;;;;:20;-1:-1:-1;;;;;7789:20:6;7755:33;:55::i;:::-;7741:69;;7840:4;7825:9;7835:1;7825:12;;;;;;;;:19;;;;;;;:12;;;;;;;;;;;:19;7858:23;;;;;7722:3;;7689:203;;;-1:-1:-1;7927:9:6;-1:-1:-1;;7412:532:6;;;:::o;4166:197:0:-;4223:6;4253:13;:9;;;:13;;;;;4270:2;4253:19;-1:-1:-1;;;;;;4287:19:0;;;;;:42;;-1:-1:-1;;;;;;4310:19:0;;;4287:42;4278:52;;;;;3344:191;3401:6;3431:13;:9;;;:13;;;;;-1:-1:-1;;;;;;3459:19:0;;;;;:42;;-1:-1:-1;;;;;;3482:19:0;;;3450:52;;;;;3479:248:2;3595:62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3595:62:2;-1:-1:-1;;;3595:62:2;;;3551:12;;3686:22;3695:6;3595:62;3686:8;:22::i;:::-;3675:45;;;;;;;;;;;;;;;-1:-1:-1;3675:45:2;;3479:248;-1:-1:-1;;;;3479:248:2:o;6651:222:0:-;6708:6;6731:1;:6;;6736:1;6731:6;;6722:16;;;;;;6744:13;6781:1;6760:22;;6775:2;6769:1;6761:10;;:16;;6760:22;;;;;;;-1:-1:-1;;;;;;;6797:19:0;;;;;:42;;-1:-1:-1;;;;;;6820:19:0;;;6788:52;;;;;5938:455;5997:7;6016:6;6012:20;;-1:-1:-1;6031:1:0;6024:8;;6012:20;6053:1;6048;:6;;;;6039:16;;;;;;6076:11;;;;-1:-1:-1;;;;;6091:38:0;;6076:54;;6135:2;6075:62;;6176:3;6171:8;;;6156:24;-1:-1:-1;;;;;6196:56:0;;;6187:66;;;;;;6266:2;6259:9;6296:71;;6284:83;;;6275:93;;;;;;6381:7;;5938:455;-1:-1:-1;;;5938:455:0:o;3733:497:2:-;3952:208;;;;;;;;;;;;;;;4116:4;3952:208;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;3952:208:2;-1:-1:-1;;;3952:208:2;;;3896:12;;4189:22;4198:6;3952:208;4189:8;:22::i;:::-;4178:45;;;;;;;;;;;;;;;-1:-1:-1;4178:45:2;;3733:497;-1:-1:-1;;;;;;3733:497:2:o;7950:689:6:-;8158:13;8173:22;8199:35;8228:5;8199:28;:35::i;:::-;8260:10;;8296:11;;;;8344:13;;;8317:40;;;;;;;;;;;;;;;;;;;8157:77;;-1:-1:-1;8157:77:6;;-1:-1:-1;;;;8260:10:6;;;;;;;;8296:11;;;;8317:24;;:40;;;8344:13;8317:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8368:13;8384:63;8407:6;8415;8423:5;8430:6;8438:8;8384:22;:63::i;:::-;8368:79;;8458:11;8472:63;8495:6;8503;8511:5;8518:6;8526:8;8472:22;:63::i;:::-;8458:77;;8546:86;8582:7;8591:10;8603:6;8611;8619;8627:4;8546:35;:86::i;:::-;7950:689;;;;;;;;;;;;:::o;8969:318::-;9113:34;9121:5;:17;;;9140:6;9113:7;:34::i;:::-;9093:17;;;:54;-1:-1:-1;;;;;9192:23:6;;;;;;:14;;;:23;;;;;;9184:40;;9217:6;9184:7;:40::i;:::-;-1:-1:-1;;;;;9158:23:6;;;;;;:14;;;:23;;;;;;;;:66;;;;9240:40;;;;;;;9261:10;;9240:40;;;;;;;;;8969:318;;;:::o;4929:304:2:-;5045:12;5069:17;-1:-1:-1;;;5146:4:2;5152:10;:8;;;;;:10::i;:::-;5089:74;;;;;;-1:-1:-1;;;;;5089:74:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;5089:74:2;;;;;;;-1:-1:-1;;;;;5089:74:2;;;;;;;;;;;5069:94;;5192:22;5201:6;5209:4;5192:8;:22::i;:::-;5181:45;;;;;;;;;;;;;;;-1:-1:-1;5181:45:2;;4929:304;-1:-1:-1;;;;;4929:304:2:o;8577:105:0:-;8624:6;8647:14;;;;-1:-1:-1;;;;;;8647:14:0;;8638:24;;;;;;-1:-1:-1;8675:2:0;;;8577:105::o;8645:318:6:-;-1:-1:-1;;;;;8803:23:6;;;;;;:14;;;:23;;;;;;8795:40;;8828:6;8795:7;:40::i;:::-;-1:-1:-1;;;;;8769:23:6;;;;;;:14;;;:23;;;;;:66;8874:17;;;;8866:34;;8893:6;8866:7;:34::i;:::-;8846:17;;;:54;8916:40;;;;;;;;8945:1;;8925:10;;8916:40;;;;;;;;;8645:318;;;:::o;1593:159:2:-;1668:15;1718:6;-1:-1:-1;;;;;1705:34:2;;1740:4;1705:40;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1705:40:2;;1593:159;-1:-1:-1;;;1593:159:2:o;1758:302::-;1961:92;;;-1:-1:-1;;;1961:92:2;;;;;;;;;;;;;;2038:4;1961:92;;;;;;;;;;;;;;1924:15;;-1:-1:-1;;;;;1961:41:2;;;;;:92;;;;;;;;;;;;;;;:41;:92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;20427:1218:0;20487:7;20511:6;20502:16;;;;;;20525:14;-1:-1:-1;;;;;20550:1:0;:55;20546:1005;;20634:1;20628:2;20623:1;:7;;20622:13;;;;;;20613:22;;20546:1005;;;20668:3;20692:8;;;20718:11;20712:17;;20708:48;;20740:2;20744:9;;;;20733;20708:48;20773:7;20767:2;:13;20763:44;;20791:2;20795:9;;;;20784;20763:44;20824:5;20818:2;:11;20814:40;;20840:1;20843:8;;;;20833;20814:40;20871:4;20865:2;:10;20861:39;;20886:1;20889:8;;;;20879;20861:39;20917:3;20911:2;:9;20907:38;;20931:1;20934:8;;;;20924;20907:38;20962:3;20956:2;:9;20952:23;;20974:1;20967:8;;;;20952:23;21061:3;21055;:9;21050:1;21046;:5;:18;;21068:1;21045:24;21037:3;21031;:9;21026:1;:14;;21025:45;;;;;;21016:54;;-1:-1:-1;;;;;21087:6:0;:44;;21078:54;;;;;;21169:3;21164:8;;;21154:19;;-1:-1:-1;;;;;21204:38:0;;21194:49;;21270:3;21265:8;;;21299:2;21294:7;;;21314;;;21310:20;;;21329:1;21323:7;;;;21310:20;21402:3;21396:9;;;;21338:8;;21417:7;;;21413:20;;;21432:1;21426:7;;;;21413:20;21441:8;;;21515:3;21509:9;;;21503:15;;21495:24;;;;21543:1;21538:2;:6;;;;;;21528:16;;;;20546:1005;;;;;;;-1:-1:-1;;;;;21566:6:0;:44;;21557:54;;;;;2660:276:2;2839:90;;;-1:-1:-1;;;2839:90:2;;;;;;;;;;;;;;2923:4;2839:90;;;;;;2809:11;;-1:-1:-1;;;;;2839:48:2;;;;;:90;;;;;;;;;;;;;;;:48;:90;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2492:162;2561:11;2604:6;-1:-1:-1;;;;;2591:41:2;;2641:4;2591:56;;;;;;;;;;;;;-1:-1:-1;;;;;2591:56:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2591:56:2;;2492:162;-1:-1:-1;;2492:162:2:o;950:501::-;1023:12;1055:20;:7;-1:-1:-1;;;;;1055:18:2;;:20::i;:::-;1047:70;;;;-1:-1:-1;;;1047:70:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1166:13;1181:24;1209:7;-1:-1:-1;;;;;1209:20:2;1230:5;1209:27;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1209:27:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1165:71;;;;1323:1;1313:8;1310:15;1307:2;;;1375:16;1368:4;1355:11;1351:22;1344:48;1307:2;1433:11;950:501;-1:-1:-1;;;;950:501:2:o;1555:426:3:-;1779:12;;1738:11;;;1802:173;1826:7;1822:1;:11;1802:173;;;1854:13;1870:22;1880:8;1889:1;1880:11;;;;;;;;;;;;;;1870:5;:9;;;;:22;;;;:::i;:::-;1854:38;;1914:50;1932:5;1938:1;1932:8;;;;;;;;;;;;;;1942:6;1950:5;1957:6;1914:17;:50::i;:::-;1906:58;;;;-1:-1:-1;1835:3:3;;1802:173;;;;1555:426;;;;;;;;:::o;6173:595::-;6388:12;:17;;6404:1;6388:17;:51;;;-1:-1:-1;6414:25:3;;;6409:30;;;6388:51;6384:64;;;6441:7;;6384:64;6458:24;6485:36;6508:12;6485:18;:10;;;;6496:6;6485:10;:18::i;:36::-;6458:63;-1:-1:-1;6532:24:3;6559:50;6580:28;:16;;;;6597:10;6580:16;:28::i;:::-;6559:16;:10;;;;6570:4;6559:10;:16::i;:50::-;6532:77;-1:-1:-1;6635:37:3;;;6691:9;;;;6620:12;6691:9;;:30;;-1:-1:-1;;;6704:17:3;;;;;;6691:30;6683:78;;;;-1:-1:-1;;;6683:78:3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6173:595;;;;;;;;;;:::o;9293:137:6:-;9388:5;;;9383:16;;;;9375:48;;;;;-1:-1:-1;;;9375:48:6;;;;;;;;;;;;-1:-1:-1;;;9375:48:6;;;;;;;;;;;;;;8843:117:0;8890:6;8913:14;;;;-1:-1:-1;;;;;;8913:14:0;;8904:24;;;;;;8945:1;8941;:5;;;:14;;-1:-1:-1;8954:1:0;8843:117::o;9436:138:6:-;9531:5;;;9526:16;;;;9518:49;;;;;-1:-1:-1;;;9518:49:6;;;;;;;;;;;;-1:-1:-1;;;9518:49:6;;;;;;;;;;;;;;726:413:1;1086:20;1124:8;;;726:413::o;1987:938:3:-;2131:11;2165:6;2158:13;;:4;:13;;;2154:765;;;2187:17;2207:23;:10;;;;-1:-1:-1;;;2218:11:3;;;2207:10;:23::i;:::-;2187:43;;2256:10;2249:17;;:4;:17;;;2245:287;;;2306:17;;;2349:22;:14;;;;2364:6;2349:14;:22::i;:::-;2342:29;-1:-1:-1;2396:16:3;:8;;;;2405:6;2396:8;:16::i;:::-;2389:23;-1:-1:-1;;;;2435:10:3;;;;;2431:26;;;-1:-1:-1;;;2447:10:3;;2431:26;2483:20;:8;;;;2492:10;2483:8;:20::i;:::-;2476:27;;2245:287;;;;2531:1;2524:8;;2245:287;2154:765;;;;2563:17;2583:23;:10;;;;-1:-1:-1;;;2594:11:3;;2583:10;:23::i;:::-;2563:43;;2632:10;2625:17;;:4;:17;;;2621:287;;;2682:17;;;2725:22;:14;;;;2740:6;2725:14;:22::i;:::-;2718:29;-1:-1:-1;2772:16:3;:8;;;;2781:6;2772:8;:16::i;:::-;2765:23;-1:-1:-1;;;;2811:10:3;;;;;2807:26;;;-1:-1:-1;;;2823:10:3;;2807:26;2859:20;:8;;;;2868:10;2859:8;:20::i;:::-;2852:27;;2621:287;;;;2907:1;2900:8;;2621:287;2154:765;1987:938;;;;;;:::o;3748:191:0:-;3805:6;3835:13;;;;:9;;;;:13;-1:-1:-1;;;;;;3863:19:0;;;;;:42;;-1:-1:-1;;;;;;3886:19:0;;;3854:52;;;;
Swarm Source
ipfs://f2fb47f787d5e22a7b989dab6b571dafd3913c84f23897329319dcb0ed27be18
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 27 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.