Source Code
Overview
ETH Balance
ETH Value
$0.00View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Contract Name:
CoreV3
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.5;
import '../interfaces/IAsset.sol';
import '../libraries/DSMath.sol';
import '../libraries/SignedSafeMath.sol';
/**
* @title CoreV3
* @notice Handles math operations of Wombat protocol. Assume all params are signed integer with 18 decimals
* @dev Uses OpenZeppelin's SignedSafeMath and DSMath's WAD for calculations.
* Change log:
* - Move view functinos (quotes, high cov ratio fee) from the Pool contract to this contract
* - Add quote functions for cross chain swaps
*/
library CoreV3 {
using DSMath for uint256;
using SignedSafeMath for int256;
using SignedSafeMath for uint256;
int256 internal constant WAD_I = 10 ** 18;
uint256 internal constant WAD = 10 ** 18;
error CORE_UNDERFLOW();
error CORE_INVALID_VALUE();
error CORE_INVALID_HIGH_COV_RATIO_FEE();
error CORE_ZERO_LIQUIDITY();
error CORE_CASH_NOT_ENOUGH();
error CORE_COV_RATIO_LIMIT_EXCEEDED();
/*
* Public view functions
*/
/**
* This function calculate the exactly amount of liquidity of the deposit. Assumes r* = 1
*/
function quoteDepositLiquidity(
IAsset asset,
uint256 amount,
uint256 ampFactor,
int256 _equilCovRatio
) external view returns (uint256 lpTokenToMint, uint256 liabilityToMint) {
liabilityToMint = _equilCovRatio == WAD_I
? exactDepositLiquidityInEquilImpl(
amount.toInt256(),
int256(uint256(asset.cash())),
int256(uint256(asset.liability())),
ampFactor.toInt256()
).toUint256()
: exactDepositLiquidityImpl(
amount.toInt256(),
int256(uint256(asset.cash())),
int256(uint256(asset.liability())),
ampFactor.toInt256(),
_equilCovRatio
).toUint256();
// Calculate amount of LP to mint : ( deposit + reward ) * TotalAssetSupply / Liability
uint256 liability = asset.liability();
lpTokenToMint = (liability == 0 ? liabilityToMint : (liabilityToMint * asset.totalSupply()) / liability);
}
/**
* @notice Calculates fee and liability to burn in case of withdrawal
* @param asset The asset willing to be withdrawn
* @param liquidity The liquidity willing to be withdrawn
* @param _equilCovRatio global equilibrium coverage ratio
* @param withdrawalHaircutRate withdraw haircut rate
* @return amount Total amount to be withdrawn from Pool
* @return liabilityToBurn Total liability to be burned by Pool
* @return withdrawalHaircut Total withdrawal haircut
*/
function quoteWithdrawAmount(
IAsset asset,
uint256 liquidity,
uint256 ampFactor,
int256 _equilCovRatio,
uint256 withdrawalHaircutRate
) public view returns (uint256 amount, uint256 liabilityToBurn, uint256 withdrawalHaircut) {
liabilityToBurn = (asset.liability() * liquidity) / asset.totalSupply();
if (liabilityToBurn == 0) revert CORE_ZERO_LIQUIDITY();
amount = _equilCovRatio == WAD_I
? withdrawalAmountInEquilImpl(
-liabilityToBurn.toInt256(),
int256(uint256(asset.cash())),
int256(uint256(asset.liability())),
ampFactor.toInt256()
).toUint256()
: withdrawalAmountImpl(
-liabilityToBurn.toInt256(),
int256(uint256(asset.cash())),
int256(uint256(asset.liability())),
ampFactor.toInt256(),
_equilCovRatio
).toUint256();
// charge withdrawal haircut
if (withdrawalHaircutRate > 0) {
withdrawalHaircut = amount.wmul(withdrawalHaircutRate);
amount -= withdrawalHaircut;
}
}
function quoteWithdrawAmountFromOtherAsset(
IAsset fromAsset,
IAsset toAsset,
uint256 liquidity,
uint256 ampFactor,
uint256 scaleFactor,
uint256 haircutRate,
uint256 startCovRatio,
uint256 endCovRatio,
int256 _equilCovRatio,
uint256 withdrawalHaircutRate
) external view returns (uint256 finalAmount, uint256 withdrewAmount) {
// quote withdraw
uint256 withdrawalHaircut;
uint256 liabilityToBurn;
(withdrewAmount, liabilityToBurn, withdrawalHaircut) = quoteWithdrawAmount(
fromAsset,
liquidity,
ampFactor,
_equilCovRatio,
withdrawalHaircutRate
);
// quote swap
uint256 fromCash = fromAsset.cash() - withdrewAmount - withdrawalHaircut;
uint256 fromLiability = fromAsset.liability() - liabilityToBurn;
if (scaleFactor != WAD) {
// apply scale factor on from-amounts
fromCash = (fromCash * scaleFactor) / 1e18;
fromLiability = (fromLiability * scaleFactor) / 1e18;
withdrewAmount = (withdrewAmount * scaleFactor) / 1e18;
}
uint256 idealToAmount = swapQuoteFunc(
fromCash.toInt256(),
int256(uint256(toAsset.cash())),
fromLiability.toInt256(),
int256(uint256(toAsset.liability())),
withdrewAmount.toInt256(),
ampFactor.toInt256()
);
// remove haircut
finalAmount = idealToAmount - idealToAmount.wmul(haircutRate);
if (startCovRatio > 0 || endCovRatio > 0) {
// charge high cov ratio fee
uint256 fee = highCovRatioFee(
fromCash,
fromLiability,
withdrewAmount,
finalAmount,
startCovRatio,
endCovRatio
);
finalAmount -= fee;
}
}
/**
* @notice Quotes the actual amount user would receive in a swap, taking in account slippage and haircut
* @param fromAsset The initial asset
* @param toAsset The asset wanted by user
* @param fromAmount The amount to quote
* @return actualToAmount The actual amount user would receive
* @return haircut The haircut that will be applied
*/
function quoteSwap(
IAsset fromAsset,
IAsset toAsset,
int256 fromAmount,
uint256 ampFactor,
uint256 scaleFactor,
uint256 haircutRate
) external view returns (uint256 actualToAmount, uint256 haircut) {
// exact output swap quote should count haircut before swap
if (fromAmount < 0) {
fromAmount = fromAmount.wdiv(WAD_I - int256(haircutRate));
}
uint256 fromCash = uint256(fromAsset.cash());
uint256 fromLiability = uint256(fromAsset.liability());
uint256 toCash = uint256(toAsset.cash());
if (scaleFactor != WAD) {
// apply scale factor on from-amounts
fromCash = (fromCash * scaleFactor) / 1e18;
fromLiability = (fromLiability * scaleFactor) / 1e18;
fromAmount = (fromAmount * scaleFactor.toInt256()) / 1e18;
}
uint256 idealToAmount = swapQuoteFunc(
fromCash.toInt256(),
toCash.toInt256(),
fromLiability.toInt256(),
int256(uint256(toAsset.liability())),
fromAmount,
ampFactor.toInt256()
);
if ((fromAmount > 0 && toCash < idealToAmount) || (fromAmount < 0 && fromAsset.cash() < uint256(-fromAmount))) {
revert CORE_CASH_NOT_ENOUGH();
}
if (fromAmount > 0) {
// normal quote
haircut = idealToAmount.wmul(haircutRate);
actualToAmount = idealToAmount - haircut;
} else {
// exact output swap quote count haircut in the fromAmount
actualToAmount = idealToAmount;
haircut = uint256(-fromAmount).wmul(haircutRate);
}
}
/// @dev reverse quote is not supported
/// haircut is calculated in the fromToken when swapping tokens for credit
function quoteSwapTokensForCredit(
IAsset fromAsset,
uint256 fromAmount,
uint256 ampFactor,
uint256 scaleFactor,
uint256 haircutRate,
uint256 startCovRatio,
uint256 endCovRatio
) external view returns (uint256 creditAmount, uint256 fromTokenFee) {
if (fromAmount == 0) return (0, 0);
// haircut
fromTokenFee = fromAmount.wmul(haircutRate);
// high coverage ratio fee
uint256 fromCash = fromAsset.cash();
uint256 fromLiability = fromAsset.liability();
fromTokenFee += highCovRatioFee(
fromCash,
fromLiability,
fromAmount,
fromAmount - fromTokenFee, // calculate haircut in the fromAmount (exclude haircut)
startCovRatio,
endCovRatio
);
fromAmount -= fromTokenFee;
if (scaleFactor != WAD) {
// apply scale factor on from-amounts
fromCash = (fromCash * scaleFactor) / 1e18;
fromLiability = (fromLiability * scaleFactor) / 1e18;
fromAmount = (fromAmount * scaleFactor) / 1e18;
}
creditAmount = swapToCreditQuote(
fromCash.toInt256(),
fromLiability.toInt256(),
fromAmount.toInt256(),
ampFactor.toInt256()
);
}
/// @dev reverse quote is not supported
function quoteSwapCreditForTokens(
uint256 fromAmount,
IAsset toAsset,
uint256 ampFactor,
uint256 scaleFactor,
uint256 haircutRate
) external view returns (uint256 actualToAmount, uint256 toTokenFee) {
if (fromAmount == 0) return (0, 0);
uint256 toCash = toAsset.cash();
uint256 toLiability = toAsset.liability();
if (scaleFactor != WAD) {
// apply scale factor on from-amounts
fromAmount = (fromAmount * scaleFactor) / 1e18;
}
uint256 idealToAmount = swapFromCreditQuote(
toCash.toInt256(),
toLiability.toInt256(),
fromAmount.toInt256(),
ampFactor.toInt256()
);
if (fromAmount > 0 && toCash < idealToAmount) {
revert CORE_CASH_NOT_ENOUGH();
}
// normal quote
toTokenFee = idealToAmount.wmul(haircutRate);
actualToAmount = idealToAmount - toTokenFee;
}
function equilCovRatio(int256 D, int256 SL, int256 A) public pure returns (int256 er) {
int256 b = -(D.wdiv(SL));
er = _solveQuad(b, A);
}
/*
* Pure calculating functions
*/
/**
* @notice Core Wombat stableswap equation
* @dev This function always returns >= 0
* @param Ax asset of token x
* @param Ay asset of token y
* @param Lx liability of token x
* @param Ly liability of token y
* @param Dx delta x, i.e. token x amount inputted
* @param A amplification factor
* @return quote The quote for amount of token y swapped for token x amount inputted
*/
function swapQuoteFunc(
int256 Ax,
int256 Ay,
int256 Lx,
int256 Ly,
int256 Dx,
int256 A
) public pure returns (uint256 quote) {
if (Lx == 0 || Ly == 0) {
// in case div of 0
revert CORE_UNDERFLOW();
}
int256 D = Ax + Ay - A.wmul((Lx * Lx) / Ax + (Ly * Ly) / Ay); // flattened _invariantFunc
int256 rx_ = (Ax + Dx).wdiv(Lx);
int256 b = (Lx * (rx_ - A.wdiv(rx_))) / Ly - D.wdiv(Ly); // flattened _coefficientFunc
int256 ry_ = _solveQuad(b, A);
int256 Dy = Ly.wmul(ry_) - Ay;
return Dy.abs();
}
/**
* @dev Calculate the withdrawal amount for any r*
*/
function withdrawalAmountImpl(
int256 delta_i,
int256 A_i,
int256 L_i,
int256 A,
int256 _equilCovRatio
) public pure returns (int256 amount) {
int256 L_i_ = L_i + delta_i;
int256 r_i = A_i.wdiv(L_i);
int256 delta_D = delta_i.wmul(_equilCovRatio) - (delta_i * A) / _equilCovRatio; // The only line that is different
int256 b = -(L_i.wmul(r_i - A.wdiv(r_i)) + delta_D);
int256 c = A.wmul(L_i_.wmul(L_i_));
int256 A_i_ = _solveQuad(b, c);
amount = A_i - A_i_;
}
/**
* @dev should be used only when r* = 1
*/
function withdrawalAmountInEquilImpl(
int256 delta_i,
int256 A_i,
int256 L_i,
int256 A
) public pure returns (int256 amount) {
int256 L_i_ = L_i + delta_i;
int256 r_i = A_i.wdiv(L_i);
int256 rho = L_i.wmul(r_i - A.wdiv(r_i));
int256 beta = (rho + delta_i.wmul(WAD_I - A)) / 2;
int256 A_i_ = beta + (beta * beta + A.wmul(L_i_ * L_i_)).sqrt(beta);
// equilvalent to:
// int256 delta_D = delta_i.wmul(WAD_I - A);
// int256 b = -(L_i.wmul(r_i - A.wdiv(r_i)) + delta_D);
// int256 c = A.wmul(L_i_.wmul(L_i_));
// int256 A_i_ = _solveQuad(b, c);
amount = A_i - A_i_;
}
/**
* @notice return the deposit reward in token amount when target liquidity (LP amount) is known
*/
function exactDepositLiquidityImpl(
int256 D_i,
int256 A_i,
int256 L_i,
int256 A,
int256 _equilCovRatio
) public pure returns (int256 liquidity) {
if (L_i == 0) {
// if this is a deposit, there is no reward/fee
// if this is a withdrawal, it should have been reverted
return D_i;
}
if (A_i + D_i < 0) {
// impossible
revert CORE_UNDERFLOW();
}
int256 r_i = A_i.wdiv(L_i);
int256 k = D_i + A_i;
int256 b = k.wmul(_equilCovRatio) - (k * A) / _equilCovRatio + 2 * A.wmul(L_i); // The only line that is different
int256 c = k.wmul(A_i - (A * L_i) / r_i) - k.wmul(k) + A.wmul(L_i).wmul(L_i);
int256 l = b * b - 4 * A * c;
return (-b + l.sqrt(b)).wdiv(A) / 2;
}
/**
* @notice return the deposit reward in token amount when target liquidity (LP amount) is known
*/
function exactDepositLiquidityInEquilImpl(
int256 D_i,
int256 A_i,
int256 L_i,
int256 A
) public pure returns (int256 liquidity) {
if (L_i == 0) {
// if this is a deposit, there is no reward/fee
// if this is a withdrawal, it should have been reverted
return D_i;
}
if (A_i + D_i < 0) {
// impossible
revert CORE_UNDERFLOW();
}
int256 r_i = A_i.wdiv(L_i);
int256 k = D_i + A_i;
int256 b = k.wmul(WAD_I - A) + 2 * A.wmul(L_i);
int256 c = k.wmul(A_i - (A * L_i) / r_i) - k.wmul(k) + A.wmul(L_i).wmul(L_i);
int256 l = b * b - 4 * A * c;
return (-b + l.sqrt(b)).wdiv(A) / 2;
}
/**
* @notice quote swapping from tokens for credit
* @dev This function always returns >= 0
*/
function swapToCreditQuote(int256 Ax, int256 Lx, int256 Dx, int256 A) public pure returns (uint256 quote) {
int256 rx = Ax.wdiv(Lx);
int256 rx_ = (Ax + Dx).wdiv(Lx);
int256 x = rx_ - A.wdiv(rx_);
int256 y = rx - A.wdiv(rx);
// adjsut credit by 1 / (1 + A)
return ((Lx * (x - y)) / (WAD_I + A)).abs();
}
/**
* @notice quote swapping from credit for tokens
* @dev This function always returns >= 0
*/
function swapFromCreditQuote(
int256 Ax,
int256 Lx,
int256 delta_credit,
int256 A
) public pure returns (uint256 quote) {
int256 rx = Ax.wdiv(Lx);
// adjsut credit by 1 + A
int256 b = (delta_credit * (WAD_I + A)) / Lx - rx + A.wdiv(rx); // flattened _coefficientFunc
int256 rx_ = _solveQuad(b, A);
int256 Dx = Ax - Lx.wmul(rx_);
return Dx.abs();
}
function highCovRatioFee(
uint256 fromAssetCash,
uint256 fromAssetLiability,
uint256 fromAmount,
uint256 quotedToAmount,
uint256 startCovRatio,
uint256 endCovRatio
) public pure returns (uint256 fee) {
uint256 finalFromAssetCovRatio = (fromAssetCash + fromAmount).wdiv(fromAssetLiability);
if (finalFromAssetCovRatio > startCovRatio) {
// charge high cov ratio fee
uint256 feeRatio = _highCovRatioFee(
fromAssetCash.wdiv(fromAssetLiability),
finalFromAssetCovRatio,
startCovRatio,
endCovRatio
);
if (feeRatio > WAD) revert CORE_INVALID_HIGH_COV_RATIO_FEE();
fee = feeRatio.wmul(quotedToAmount);
}
}
/*
* Internal functions
*/
/**
* @notice Solve quadratic equation
* @dev This function always returns >= 0
* @param b quadratic equation b coefficient
* @param c quadratic equation c coefficient
* @return x
*/
function _solveQuad(int256 b, int256 c) internal pure returns (int256) {
return (((b * b) + (c * 4 * WAD_I)).sqrt(b) - b) / 2;
}
/**
* @notice Equation to get invariant constant between token x and token y
* @dev This function always returns >= 0
* @param Lx liability of token x
* @param rx cov ratio of token x
* @param Ly liability of token x
* @param ry cov ratio of token y
* @param A amplification factor
* @return The invariant constant between token x and token y ("D")
*/
function _invariantFunc(int256 Lx, int256 rx, int256 Ly, int256 ry, int256 A) internal pure returns (int256) {
int256 a = Lx.wmul(rx) + Ly.wmul(ry);
int256 b = A.wmul(Lx.wdiv(rx) + Ly.wdiv(ry));
return a - b;
}
/**
* @notice Equation to get quadratic equation b coefficient
* @dev This function can return >= 0 or <= 0
* @param Lx liability of token x
* @param Ly liability of token y
* @param rx_ new asset coverage ratio of token x
* @param D invariant constant
* @param A amplification factor
* @return The quadratic equation b coefficient ("b")
*/
function _coefficientFunc(int256 Lx, int256 Ly, int256 rx_, int256 D, int256 A) internal pure returns (int256) {
return (Lx * (rx_ - A.wdiv(rx_))) / Ly - D.wdiv(Ly);
}
function _targetedCovRatio(
int256 SL,
int256 delta_i,
int256 A_i,
int256 L_i,
int256 D,
int256 A
) internal pure returns (int256 r_i_) {
int256 r_i = A_i.wdiv(L_i);
int256 er = equilCovRatio(D, SL, A);
int256 er_ = _newEquilCovRatio(er, SL, delta_i);
int256 D_ = _newInvariantFunc(er_, A, SL, delta_i);
// Summation of k∈T\{i} is D - L_i.wmul(r_i - A.wdiv(r_i))
int256 b_ = (D - A_i + (L_i * A) / r_i - D_).wdiv(L_i + delta_i);
r_i_ = _solveQuad(b_, A);
}
function _newEquilCovRatio(int256 er, int256 SL, int256 delta_i) internal pure returns (int256 er_) {
er_ = (delta_i + SL.wmul(er)).wdiv(delta_i + SL);
}
function _newInvariantFunc(int256 er_, int256 A, int256 SL, int256 delta_i) internal pure returns (int256 D_) {
D_ = (SL + delta_i).wmul(er_ - A.wdiv(er_));
}
/**
* @notice Calculate the high cov ratio fee in the to-asset in a swap.
* @dev When cov ratio is in the range [startCovRatio, endCovRatio], the marginal cov ratio is
* (r - startCovRatio) / (endCovRatio - startCovRatio). Here we approximate the high cov ratio cut
* by calculating the "average" fee.
* Note: `finalCovRatio` should be greater than `initCovRatio`
*/
function _highCovRatioFee(
uint256 initCovRatio,
uint256 finalCovRatio,
uint256 startCovRatio,
uint256 endCovRatio
) internal pure returns (uint256 fee) {
if (finalCovRatio > endCovRatio) {
// invalid swap
revert CORE_COV_RATIO_LIMIT_EXCEEDED();
} else if (finalCovRatio <= startCovRatio || finalCovRatio <= initCovRatio) {
return 0;
}
// 1. Calculate the area of fee(r) = (r - startCovRatio) / (endCovRatio - startCovRatio)
// when r increase from initCovRatio to finalCovRatio
// 2. Then multiply it by (endCovRatio - startCovRatio) / (finalCovRatio - initCovRatio)
// to get the average fee over the range
uint256 a = initCovRatio <= startCovRatio ? 0 : (initCovRatio - startCovRatio) * (initCovRatio - startCovRatio);
uint256 b = (finalCovRatio - startCovRatio) * (finalCovRatio - startCovRatio);
fee = ((b - a) / (finalCovRatio - initCovRatio) / 2).wdiv(endCovRatio - startCovRatio);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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");
(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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.5;
import '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
interface IAsset is IERC20 {
function underlyingToken() external view returns (address);
function pool() external view returns (address);
function cash() external view returns (uint120);
function liability() external view returns (uint120);
function decimals() external view returns (uint8);
function underlyingTokenDecimals() external view returns (uint8);
function setPool(address pool_) external;
function underlyingTokenBalance() external view returns (uint256);
function transferUnderlyingToken(address to, uint256 amount) external;
function mint(address to, uint256 amount) external;
function burn(address to, uint256 amount) external;
function addCash(uint256 amount) external;
function removeCash(uint256 amount) external;
function addLiability(uint256 amount) external;
function removeLiability(uint256 amount) external;
}// SPDX-License-Identifier: GPL-3.0
/// math.sol -- mixin for inline numerical wizardry
// 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.8.5;
library DSMath {
uint256 public constant WAD = 10 ** 18;
// Babylonian Method
function sqrt(uint256 y) internal pure returns (uint256 z) {
if (y > 3) {
z = y;
uint256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
//rounds to zero if x*y < WAD / 2
function wmul(uint256 x, uint256 y) internal pure returns (uint256) {
return ((x * y) + (WAD / 2)) / WAD;
}
function wdiv(uint256 x, uint256 y) internal pure returns (uint256) {
return ((x * WAD) + (y / 2)) / y;
}
// Convert x to WAD (18 decimals) from d decimals.
function toWad(uint256 x, uint8 d) internal pure returns (uint256) {
if (d < 18) {
return x * 10 ** (18 - d);
} else if (d > 18) {
return (x / (10 ** (d - 18)));
}
return x;
}
// Convert x from WAD (18 decimals) to d decimals.
function fromWad(uint256 x, uint8 d) internal pure returns (uint256) {
if (d < 18) {
return (x / (10 ** (18 - d)));
} else if (d > 18) {
return x * 10 ** (d - 18);
}
return x;
}
function to128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, 'uint128 overflow');
return uint128(value);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.3.2 (utils/math/SignedSafeMath.sol)
pragma solidity ^0.8.5;
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SignedSafeMath` is no longer needed starting with Solidity 0.8. The compiler
* now has built in overflow checking.
*/
library SignedSafeMath {
int256 public constant WAD = 10 ** 18;
//rounds to zero if x*y < WAD / 2
function wdiv(int256 x, int256 y) internal pure returns (int256) {
return ((x * WAD) + (y / 2)) / y;
}
//rounds to zero if x*y < WAD / 2
function wmul(int256 x, int256 y) internal pure returns (int256) {
return ((x * y) + (WAD / 2)) / WAD;
}
// Babylonian Method (typecast as int)
function sqrt(int256 y) internal pure returns (int256 z) {
if (y > 3) {
z = y;
int256 x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
// Babylonian Method with initial guess (typecast as int)
function sqrt(int256 y, int256 guess) internal pure returns (int256 z) {
if (y > 3) {
if (guess > 0 && guess <= y) {
z = guess;
} else if (guess < 0 && -guess <= y) {
z = -guess;
} else {
z = y;
}
int256 x = (y / z + z) / 2;
while (x != z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
// Convert x to WAD (18 decimals) from d decimals.
function toWad(int256 x, uint8 d) internal pure returns (int256) {
if (d < 18) {
return x * int256(10 ** (18 - d));
} else if (d > 18) {
return (x / int256(10 ** (d - 18)));
}
return x;
}
// Convert x from WAD (18 decimals) to d decimals.
function fromWad(int256 x, uint8 d) internal pure returns (int256) {
if (d < 18) {
return (x / int256(10 ** (18 - d)));
} else if (d > 18) {
return x * int256(10 ** (d - 18));
}
return x;
}
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, 'value must be positive');
return uint256(value);
}
function toInt256(uint256 value) internal pure returns (int256) {
require(value <= uint256(type(int256).max), 'value must be positive');
return int256(value);
}
function abs(int256 value) internal pure returns (uint256) {
if (value < 0) {
return uint256(-value);
} else {
return uint256(value);
}
}
}{
"viaIR": true,
"optimizer": {
"enabled": true,
"runs": 1000
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"CORE_CASH_NOT_ENOUGH","type":"error"},{"inputs":[],"name":"CORE_COV_RATIO_LIMIT_EXCEEDED","type":"error"},{"inputs":[],"name":"CORE_INVALID_HIGH_COV_RATIO_FEE","type":"error"},{"inputs":[],"name":"CORE_INVALID_VALUE","type":"error"},{"inputs":[],"name":"CORE_UNDERFLOW","type":"error"},{"inputs":[],"name":"CORE_ZERO_LIQUIDITY","type":"error"},{"inputs":[{"internalType":"int256","name":"D","type":"int256"},{"internalType":"int256","name":"SL","type":"int256"},{"internalType":"int256","name":"A","type":"int256"}],"name":"equilCovRatio","outputs":[{"internalType":"int256","name":"er","type":"int256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"D_i","type":"int256"},{"internalType":"int256","name":"A_i","type":"int256"},{"internalType":"int256","name":"L_i","type":"int256"},{"internalType":"int256","name":"A","type":"int256"},{"internalType":"int256","name":"_equilCovRatio","type":"int256"}],"name":"exactDepositLiquidityImpl","outputs":[{"internalType":"int256","name":"liquidity","type":"int256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"D_i","type":"int256"},{"internalType":"int256","name":"A_i","type":"int256"},{"internalType":"int256","name":"L_i","type":"int256"},{"internalType":"int256","name":"A","type":"int256"}],"name":"exactDepositLiquidityInEquilImpl","outputs":[{"internalType":"int256","name":"liquidity","type":"int256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromAssetCash","type":"uint256"},{"internalType":"uint256","name":"fromAssetLiability","type":"uint256"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"quotedToAmount","type":"uint256"},{"internalType":"uint256","name":"startCovRatio","type":"uint256"},{"internalType":"uint256","name":"endCovRatio","type":"uint256"}],"name":"highCovRatioFee","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract IAsset","name":"asset","type":"IAsset"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"ampFactor","type":"uint256"},{"internalType":"int256","name":"_equilCovRatio","type":"int256"}],"name":"quoteDepositLiquidity","outputs":[{"internalType":"uint256","name":"lpTokenToMint","type":"uint256"},{"internalType":"uint256","name":"liabilityToMint","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IAsset","name":"fromAsset","type":"IAsset"},{"internalType":"contract IAsset","name":"toAsset","type":"IAsset"},{"internalType":"int256","name":"fromAmount","type":"int256"},{"internalType":"uint256","name":"ampFactor","type":"uint256"},{"internalType":"uint256","name":"scaleFactor","type":"uint256"},{"internalType":"uint256","name":"haircutRate","type":"uint256"}],"name":"quoteSwap","outputs":[{"internalType":"uint256","name":"actualToAmount","type":"uint256"},{"internalType":"uint256","name":"haircut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"contract IAsset","name":"toAsset","type":"IAsset"},{"internalType":"uint256","name":"ampFactor","type":"uint256"},{"internalType":"uint256","name":"scaleFactor","type":"uint256"},{"internalType":"uint256","name":"haircutRate","type":"uint256"}],"name":"quoteSwapCreditForTokens","outputs":[{"internalType":"uint256","name":"actualToAmount","type":"uint256"},{"internalType":"uint256","name":"toTokenFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IAsset","name":"fromAsset","type":"IAsset"},{"internalType":"uint256","name":"fromAmount","type":"uint256"},{"internalType":"uint256","name":"ampFactor","type":"uint256"},{"internalType":"uint256","name":"scaleFactor","type":"uint256"},{"internalType":"uint256","name":"haircutRate","type":"uint256"},{"internalType":"uint256","name":"startCovRatio","type":"uint256"},{"internalType":"uint256","name":"endCovRatio","type":"uint256"}],"name":"quoteSwapTokensForCredit","outputs":[{"internalType":"uint256","name":"creditAmount","type":"uint256"},{"internalType":"uint256","name":"fromTokenFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IAsset","name":"asset","type":"IAsset"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"ampFactor","type":"uint256"},{"internalType":"int256","name":"_equilCovRatio","type":"int256"},{"internalType":"uint256","name":"withdrawalHaircutRate","type":"uint256"}],"name":"quoteWithdrawAmount","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"liabilityToBurn","type":"uint256"},{"internalType":"uint256","name":"withdrawalHaircut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IAsset","name":"fromAsset","type":"IAsset"},{"internalType":"contract IAsset","name":"toAsset","type":"IAsset"},{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256","name":"ampFactor","type":"uint256"},{"internalType":"uint256","name":"scaleFactor","type":"uint256"},{"internalType":"uint256","name":"haircutRate","type":"uint256"},{"internalType":"uint256","name":"startCovRatio","type":"uint256"},{"internalType":"uint256","name":"endCovRatio","type":"uint256"},{"internalType":"int256","name":"_equilCovRatio","type":"int256"},{"internalType":"uint256","name":"withdrawalHaircutRate","type":"uint256"}],"name":"quoteWithdrawAmountFromOtherAsset","outputs":[{"internalType":"uint256","name":"finalAmount","type":"uint256"},{"internalType":"uint256","name":"withdrewAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"Ax","type":"int256"},{"internalType":"int256","name":"Lx","type":"int256"},{"internalType":"int256","name":"delta_credit","type":"int256"},{"internalType":"int256","name":"A","type":"int256"}],"name":"swapFromCreditQuote","outputs":[{"internalType":"uint256","name":"quote","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"Ax","type":"int256"},{"internalType":"int256","name":"Ay","type":"int256"},{"internalType":"int256","name":"Lx","type":"int256"},{"internalType":"int256","name":"Ly","type":"int256"},{"internalType":"int256","name":"Dx","type":"int256"},{"internalType":"int256","name":"A","type":"int256"}],"name":"swapQuoteFunc","outputs":[{"internalType":"uint256","name":"quote","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"Ax","type":"int256"},{"internalType":"int256","name":"Lx","type":"int256"},{"internalType":"int256","name":"Dx","type":"int256"},{"internalType":"int256","name":"A","type":"int256"}],"name":"swapToCreditQuote","outputs":[{"internalType":"uint256","name":"quote","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"delta_i","type":"int256"},{"internalType":"int256","name":"A_i","type":"int256"},{"internalType":"int256","name":"L_i","type":"int256"},{"internalType":"int256","name":"A","type":"int256"},{"internalType":"int256","name":"_equilCovRatio","type":"int256"}],"name":"withdrawalAmountImpl","outputs":[{"internalType":"int256","name":"amount","type":"int256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"int256","name":"delta_i","type":"int256"},{"internalType":"int256","name":"A_i","type":"int256"},{"internalType":"int256","name":"L_i","type":"int256"},{"internalType":"int256","name":"A","type":"int256"}],"name":"withdrawalAmountInEquilImpl","outputs":[{"internalType":"int256","name":"amount","type":"int256"}],"stateMutability":"pure","type":"function"}]Contract Creation Code
6080806040523461001a57611dfa9081610020823930815050f35b600080fdfe604060808152600436101561001357600080fd5b60003560e01c80631df0f4f214610ba95780631f86566214610b915780632841c1ad14610b795780632f6599bb14610b4f5780634c5b402d14610b375780635dbcd62c1461085557806362d2ab101461083d57806367146f2914610811578063691b5fb6146107f957806391810795146107b7578063d7454c5314610774578063df4912981461075c578063e02a44c6146103b4578063efd7af77146100f75763f50fc03e146100c257600080fd5b60c03660031901126100f2576020906100eb60a4356084356064356044356024356004356114ba565b9051908152f35b600080fd5b506101403660031901126100f25761010d610bde565b610115610bf4565b6064359061012e61012435610104358460443587610d6d565b92909180946001600160a01b038097169088519363961be39160e01b928386526020978887600481855afa96871561033457600097610391575b5061018690610181876001600160781b03809a16610d60565b610d60565b968b5190898260048163705727b560e01b968782525afa918215610386576101b9928991600091610369575b5016610d60565b99670de0b6b3a764000095608435670de0b6b3a763ffff19810161033f575b50506001600160ff1b03926101ef848a1115610cea565b8c5195865216938881600481885afa918215610334578991600093610315575b5061021c848d1115610cea565b60048d518097819382525afa91821561030a5786610284978b948d93610268988d6000936102d5575b50508061025761025f92891115610cea565b881115610cea565b169216886114ba565b9061027d61027860a43584610ca1565b611096565b0490610d60565b9360c4359081158015906102ca575b6102a5575b5050508351928352820152f35b916102bb9186866102c196989560e43594611bf8565b90610d60565b91388080610298565b5060e4351515610293565b61025f92935090816102fb92903d10610303575b6102f38183610c4a565b810190610c82565b91908d610245565b503d6102e9565b8b513d6000823e3d90fd5b61032d919350823d8411610303576102f38183610c4a565b913861020f565b8c513d6000823e3d90fd5b8780939c5061035982610360949f9c610359828592610ca1565b049c610ca1565b049838806101d8565b61038091508c8d3d10610303576102f38183610c4a565b386101b2565b8d513d6000823e3d90fd5b6101869197506103ad908a3d8c11610303576102f38183610c4a565b9690610168565b5060c03660031901126100f2576103c9610bde565b6103d1610bf4565b604435906000821261072b575b83519063961be39160e01b82526001600160a01b03916020816004818689165afa8015610720576001600160781b0391600091610701575b50169085519163705727b560e01b92838152602081600481888b165afa8015610658576001600160781b03916000916106e2575b5016918488519163961be39160e01b83521690602081600481855afa9081156106d7576000916106b8575b50608435670de0b6b3a76400008103610663575b506001600160781b036020916104a86001600160ff1b03861115610cea565b16946104bd6001600160ff1b03871115610cea565b6104d06001600160ff1b03861115610cea565b60048a518094819382525afa91821561065857610519938792600094610637575b50856001600160781b03606435956105126001600160ff1b03881115610cea565b16926114ba565b936000841392839286908461062d575b505082156105a8575b5050610598571561056f5750610561670de0b6b3a764000061055961027860a43585610ca1565b048092610d60565b905b82519182526020820152f35b90610592610278670de0b6b3a7640000929361058d60a43591610d4f565b610ca1565b04610563565b60048451631c4bd71760e01b8152fd5b60008512925090826105be575b50503880610532565b6020919250600487518094819363961be39160e01b8352165afa90811561062257600091610603575b506001600160781b036105f984610d4f565b91161038806105b5565b61061c915060203d602011610303576102f38183610c4a565b386105e7565b85513d6000823e3d90fd5b1092508538610529565b61065191945060203d602011610303576102f38183610c4a565b92386104f1565b88513d6000823e3d90fd5b670de0b6b3a76400006106af8282610695828261068e6020999f9c9b986001600160781b0399610ca1565b0499610ca1565b04976106aa6001600160ff1b03831115610cea565b611133565b05979150610489565b6106d1915060203d602011610303576102f38183610c4a565b38610475565b89513d6000823e3d90fd5b6106fb915060203d602011610303576102f38183610c4a565b3861044a565b61071a915060203d602011610303576102f38183610c4a565b38610416565b86513d6000823e3d90fd5b906107569061075161074761074160a4356110b8565b926110f4565b60028305906111ad565b611156565b906103de565b6020826100eb61076b36610c0a565b9291909161173c565b5060603660031901126100f2576020906100eb6024356107b26107ad61079b6004356110f4565b926107516044359460028305906111ad565b610d4f565b611cbd565b5060a03660031901126100f2576060906107e76107d2610bde565b60843590606435906044359060243590610d6d565b91929081519384526020840152820152f35b6020826100eb61080836610c28565b9392909261163e565b5060a03660031901126100f257610563610829610bf4565b608435906064359060443590600435611357565b6020826100eb61084c36610c28565b939290926118d9565b5060803660031901126100f25761086a610bde565b602435604435606435670de0b6b3a76400008103610a4557506001600160ff1b039061089882841115610cea565b845163961be39160e01b81526001600160a01b038516936020938483600481895afa928315610658576004968691600095610a26575b5089519788809263705727b560e01b82525afa908115610658576001600160a01b039661091e96600093610a01575b505061090b90851115610cea565b6001600160781b03809116921690611a7d565b61092b6000821215610cea565b915b169082519163705727b560e01b83526020928381600481855afa8015610622576001600160781b03916000916109e4575b501683816109765750505080915b8351928352820152f35b6004928651938480926318160ddd60e01b82525afa918215610622576000926109b3575b506109a86109ad9284610ca1565b610cca565b9161096c565b91508382813d83116109dd575b6109ca8183610c4a565b810103126100f2579051906109a861099a565b503d6109c0565b6109fb9150853d8711610303576102f38183610c4a565b3861095e565b61090b9293509081610a1e92903d10610303576102f38183610c4a565b9190386108fd565b610a3e919550823d8411610303576102f38183610c4a565b93386108ce565b6001600160ff1b0391610a5a83851115610cea565b855163961be39160e01b81526001600160a01b0386169460209485836004818a5afa9283156106d7576004978791600095610b18575b508a519889809263705727b560e01b82525afa9081156106d7576001600160a01b0397610ae097600093610af3575b5050610acd90851115610cea565b6001600160781b038091169216906118d9565b610aed6000821215610cea565b9161092d565b610acd9293509081610b1092903d10610303576102f38183610c4a565b919038610abf565b610b30919550823d8411610303576102f38183610c4a565b9338610a90565b6020826100eb610b4636610c0a565b92919091611a7d565b5060c03660031901126100f2576020906100eb60a435608435606435604435602435600435611bf8565b6020826100eb610b8836610c0a565b92919091611b8b565b6020826100eb610ba036610c0a565b92919091611b00565b5060e03660031901126100f257610563610bc1610bde565b60c4359060a43590608435906064359060443590602435906111c9565b600435906001600160a01b03821682036100f257565b602435906001600160a01b03821682036100f257565b60809060031901126100f25760043590602435906044359060643590565b60a09060031901126100f2576004359060243590604435906064359060843590565b90601f8019910116810190811067ffffffffffffffff821117610c6c57604052565b634e487b7160e01b600052604160045260246000fd5b908160209103126100f257516001600160781b03811681036100f25790565b81810292918115918404141715610cb457565b634e487b7160e01b600052601160045260246000fd5b8115610cd4570490565b634e487b7160e01b600052601260045260246000fd5b15610cf157565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f76616c7565206d75737420626520706f736974697665000000000000000000006044820152fd5b600160ff1b8114610cb45760000390565b91908203918211610cb457565b9491929093946000936001600160a01b0360009216956040805163705727b560e01b918282526020996004948b848781855afa93841561108c578894611069575b50610dc3906001600160781b03809516610ca1565b82516318160ddd60e01b81528c818881865afa90811561105f57899161102c575b50610dee91610cca565b9a8b1561100457908b91670de0b6b3a7640000998a8114600014610f1c5750610e216001600160ff1b0380941115610cea565b610e2a8d610d4f565b9584519763961be39160e01b895282898281875afa988915610f12578b99610eef575b5090829186518095819382525afa938415610ee65750928492610e90979592610e999997958b93610ec1575b5050610e8790871115610cea565b1692169061173c565b91821215610cea565b905b819580610ea757505050565b610ebe939650829450610278906105599293610ca1565b92565b610e879293509081610ede92903d10610303576102f38183610c4a565b919038610e79565b513d8a823e3d90fd5b8392919950610f0a90833d8511610303576102f38183610c4a565b989091610e4d565b86513d8d823e3d90fd5b9796959493929190610f3c6001600160ff1b03936107ad85821115610cea565b9584519763961be39160e01b895282898281875afa988915610ffa578c99610fd7575b5090829186518095819382525afa938415610fce5750928492610fa399979592610e909997958c93610fa9575b5050610f9a90871115610cea565b1692169061163e565b90610e9b565b610f9a9293509081610fc692903d10610303576102f38183610c4a565b919038610f8c565b513d8b823e3d90fd5b8392919950610ff290833d8511610303576102f38183610c4a565b989091610f5f565b86513d8e823e3d90fd5b8583517fd4b6d81b000000000000000000000000000000000000000000000000000000008152fd5b90508c81813d8311611058575b6110438183610c4a565b810103126110545751610dee610de4565b8880fd5b503d611039565b84513d8b823e3d90fd5b610dc3919450611085908d803d10610303576102f38183610c4a565b9390610dae565b83513d8a823e3d90fd5b906706f05b59d3b200008201809211610cb457565b91908201809211610cb457565b90670de0b6b3a764000060008382039312818412811691841390151617610cb457565b81810392916000138015828513169184121617610cb457565b90670de0b6b3a764000091828102928184051490151715610cb457565b908160011b916002830503610cb457565b908160021b916004830503610cb457565b818102929160008212600160ff1b821416610cb4578184051490151715610cb457565b8115610cd457600160ff1b8114600019831416610cb4570590565b9081670de0b6b3a764000001918212600116610cb457565b906706f05b59d3b200009160008382019384129112908015821691151617610cb457565b91909160008382019384129112908015821691151617610cb457565b909591938615611348576001600160a01b03610278916111f4670de0b6b3a76400009384928b610ca1565b049216916040519363961be39160e01b85526020918286600481885afa91821561131d57600496600093611329575b50836001600160781b03809416966040519889809263705727b560e01b82525afa90811561131d576112cf9a61127384611281968f9b9561127b966112889a600092611300575b5050169a610d60565b8d8a8a611bf8565b906110ab565b8098610d60565b938181036112d2575b50506112ca6001600160ff1b036112aa81841115610cea565b6112b681851115610cea565b6112c281861115610cea565b851115610cea565b611b00565b91565b816112f082826112e9826112f797989a999a610ca1565b0497610ca1565b0493610ca1565b04913880611291565b6113169250803d10610303576102f38183610c4a565b388061126a565b6040513d6000823e3d90fd5b611341919350843d8611610303576102f38183610c4a565b9138611223565b50505050505050600090600090565b9392919084156114ad576001600160a01b03169060405163961be39160e01b815260208082600481875afa91821561131d5760009261148e575b506004816001600160781b03809416956040519283809263705727b560e01b82525afa91821561131d57600092611471575b505016670de0b6b3a764000093848103611458575b50908561141c926114166001600160ff1b036113f681881115610cea565b61140281841115610cea565b61140e81851115610cea565b841115610cea565b84611b8b565b80941515918261144e575b505061143d576105596102786112cf9385610ca1565b6004604051631c4bd71760e01b8152fd5b1090508338611427565b611468859161141c949398610ca1565b049590916113d8565b6114879250803d10610303576102f38183610c4a565b38806113c3565b816114a69293503d8411610303576102f38183610c4a565b9038611391565b5050505050600090600090565b9390949180158015611624575b6115fa57838181926114d989896111ad565b97806114e58380611133565b906114ef91611156565b98670de0b6b3a7640000809a8c6115068880611133565b9061151091611156565b611519916111ad565b611523908a611133565b61152c90611189565b05611536916110db565b95611540916111ad565b611549906110f4565b60028205611556916111ad565b9061156091611156565b8061156a876110f4565b60028205611577916111ad565b9061158191611156565b61158a916110db565b61159391611133565b9061159d91611156565b916115a7906110f4565b600282056115b4916111ad565b906115be91611156565b6115c7916110db565b906115d191611cbd565b6115da91611133565b6115e390611189565b05906115ee916110db565b6115f79061162c565b90565b60046040517fae032660000000000000000000000000000000000000000000000000000000008152fd5b5083156114c7565b60008112156115f7576115f790610d4f565b92919382919461164e85826111ad565b9481611659886110f4565b60028205611666916111ad565b9061167091611156565b91670de0b6b3a76400009584838861168a81988297611133565b61169390611189565b059261169e91611133565b906116a891611156565b6116b1916110db565b92806116bc876110f4565b600282056116c9916111ad565b906116d391611156565b6116dc916110db565b6116e591611133565b6116ee90611189565b05906116f9916111ad565b61170290610d4f565b938061170d91611133565b61171690611189565b0561172091611133565b61172990611189565b0561173391611cbd565b6115f7916110db565b92909261174981846111ad565b9083611754866110f4565b60028205611761916111ad565b9061176b91611156565b8094611776856110f4565b90670de0b6b3a764000096808894936002869505611793916111ad565b9061179d91611156565b6117a6916110db565b6117af91611133565b6117b890611189565b05916117c3856110b8565b6117cc91611133565b6117d590611189565b056117df916111ad565b600290059283926117f08480611133565b92806117fb91611133565b61180491611133565b61180d90611189565b05611817916111ad565b906118219161182a565b611733916111ad565b9190600060038413156118ca575060008113806118c0575b1561188957915b60028061185f8561185a8186611156565b6111ad565b05915b84830361186e57505050565b91935090816118818561185a8185611156565b059190611862565b60008112806118ae575b156118a7576118a190610d4f565b91611849565b5081611849565b50826118b982610d4f565b1315611893565b5082811315611842565b9290506118d357565b60019150565b9092938215611a755760006118ee83866111ad565b126115fa578391836118ff846110f4565b6002820561190c916111ad565b9061191691611156565b94611920916111ad565b90670de0b6b3a764000080938282611939819587611133565b61194290611189565b059061194e8a87611133565b9061195891611156565b611961916110db565b8261196c888b611133565b61197590611189565b0561197f90611111565b611988916111ad565b96611993878a611133565b9061199d91611156565b6119a6916110db565b6119b09084611133565b6119b990611189565b0591806119c591611133565b6119ce90611189565b056119d8916110db565b91816119e48287611133565b6119ed90611189565b05906119f891611133565b611a0190611189565b05611a0b916111ad565b611a158280611133565b90611a1f84611122565b90611a2991611133565b611a32916110db565b611a3b82610d4f565b91611a459161182a565b611a4e916111ad565b611a57906110f4565b60028205611a64916111ad565b90611a6e91611156565b6002900590565b509250505090565b9190918115611af9576000611a9282856111ad565b126115fa57829082611aa3836110f4565b60028205611ab0916111ad565b90611aba91611156565b93611ac4916111ad565b670de0b6b3a764000080809381611ada896110b8565b611ae49086611133565b611aed90611189565b058261196c888b611133565b9250505090565b611b7a82611b74611b8093611b5d611b63611b4d6115f79a98610751611b869b61185a611b48611b2f896110f4565b92611b42866107516002820580976111ad565b996111ad565b6110f4565b611b5d816107516107478c6110f4565b906110db565b91611b5d816107516107478b6110f4565b90611133565b91611171565b90611156565b61162c565b90611bf1611bec82611b746115f7976107b2610751611be6611bd9611b869b611bd488611bc8670de0b6b3a76400009d8f610747610751916110f4565b958693611b748a611171565b6110db565b91610751610747866110f4565b906111ad565b611189565b05906110db565b90959492939195611c1481611c0f600099856110ab565b611c91565b91838311611c25575b505050505050565b611c3b9596975090611c3691611c91565b611cfa565b90670de0b6b3a764000091828111611c6757611c5a9161027891610ca1565b0490388080808080611c1d565b60046040517f5c7c5649000000000000000000000000000000000000000000000000000000008152fd5b90670de0b6b3a764000091828102928184041490151715610cb4576109a86115f7928260011c906110ab565b611cc78180611133565b908260021b9280840560041490151715610cb457611bd481611cf1611cf694611be66002976110f4565b61182a565b0590565b929182821115611d2e5760046040517fa6af4260000000000000000000000000000000000000000000000000000000008152fd5b808211801590611dba575b611db1576115f793611d8c92611d8391611d7d90848111611d9257611d7760005b610181611d678887610d60565b611d718988610d60565b90610ca1565b92610d60565b90610cca565b60011c92610d60565b90611c91565b611d77611dac611da28784610d60565b611d718885610d60565b611d5a565b50505050600090565b5083821115611d3956fea26469706673582212200781bd3aa07556046e3b5247e831256b3643fdd3f7f6acd9430b5d0ab9b4a8bf64736f6c63430008120033
Deployed Bytecode
0x604060808152600436101561001357600080fd5b60003560e01c80631df0f4f214610ba95780631f86566214610b915780632841c1ad14610b795780632f6599bb14610b4f5780634c5b402d14610b375780635dbcd62c1461085557806362d2ab101461083d57806367146f2914610811578063691b5fb6146107f957806391810795146107b7578063d7454c5314610774578063df4912981461075c578063e02a44c6146103b4578063efd7af77146100f75763f50fc03e146100c257600080fd5b60c03660031901126100f2576020906100eb60a4356084356064356044356024356004356114ba565b9051908152f35b600080fd5b506101403660031901126100f25761010d610bde565b610115610bf4565b6064359061012e61012435610104358460443587610d6d565b92909180946001600160a01b038097169088519363961be39160e01b928386526020978887600481855afa96871561033457600097610391575b5061018690610181876001600160781b03809a16610d60565b610d60565b968b5190898260048163705727b560e01b968782525afa918215610386576101b9928991600091610369575b5016610d60565b99670de0b6b3a764000095608435670de0b6b3a763ffff19810161033f575b50506001600160ff1b03926101ef848a1115610cea565b8c5195865216938881600481885afa918215610334578991600093610315575b5061021c848d1115610cea565b60048d518097819382525afa91821561030a5786610284978b948d93610268988d6000936102d5575b50508061025761025f92891115610cea565b881115610cea565b169216886114ba565b9061027d61027860a43584610ca1565b611096565b0490610d60565b9360c4359081158015906102ca575b6102a5575b5050508351928352820152f35b916102bb9186866102c196989560e43594611bf8565b90610d60565b91388080610298565b5060e4351515610293565b61025f92935090816102fb92903d10610303575b6102f38183610c4a565b810190610c82565b91908d610245565b503d6102e9565b8b513d6000823e3d90fd5b61032d919350823d8411610303576102f38183610c4a565b913861020f565b8c513d6000823e3d90fd5b8780939c5061035982610360949f9c610359828592610ca1565b049c610ca1565b049838806101d8565b61038091508c8d3d10610303576102f38183610c4a565b386101b2565b8d513d6000823e3d90fd5b6101869197506103ad908a3d8c11610303576102f38183610c4a565b9690610168565b5060c03660031901126100f2576103c9610bde565b6103d1610bf4565b604435906000821261072b575b83519063961be39160e01b82526001600160a01b03916020816004818689165afa8015610720576001600160781b0391600091610701575b50169085519163705727b560e01b92838152602081600481888b165afa8015610658576001600160781b03916000916106e2575b5016918488519163961be39160e01b83521690602081600481855afa9081156106d7576000916106b8575b50608435670de0b6b3a76400008103610663575b506001600160781b036020916104a86001600160ff1b03861115610cea565b16946104bd6001600160ff1b03871115610cea565b6104d06001600160ff1b03861115610cea565b60048a518094819382525afa91821561065857610519938792600094610637575b50856001600160781b03606435956105126001600160ff1b03881115610cea565b16926114ba565b936000841392839286908461062d575b505082156105a8575b5050610598571561056f5750610561670de0b6b3a764000061055961027860a43585610ca1565b048092610d60565b905b82519182526020820152f35b90610592610278670de0b6b3a7640000929361058d60a43591610d4f565b610ca1565b04610563565b60048451631c4bd71760e01b8152fd5b60008512925090826105be575b50503880610532565b6020919250600487518094819363961be39160e01b8352165afa90811561062257600091610603575b506001600160781b036105f984610d4f565b91161038806105b5565b61061c915060203d602011610303576102f38183610c4a565b386105e7565b85513d6000823e3d90fd5b1092508538610529565b61065191945060203d602011610303576102f38183610c4a565b92386104f1565b88513d6000823e3d90fd5b670de0b6b3a76400006106af8282610695828261068e6020999f9c9b986001600160781b0399610ca1565b0499610ca1565b04976106aa6001600160ff1b03831115610cea565b611133565b05979150610489565b6106d1915060203d602011610303576102f38183610c4a565b38610475565b89513d6000823e3d90fd5b6106fb915060203d602011610303576102f38183610c4a565b3861044a565b61071a915060203d602011610303576102f38183610c4a565b38610416565b86513d6000823e3d90fd5b906107569061075161074761074160a4356110b8565b926110f4565b60028305906111ad565b611156565b906103de565b6020826100eb61076b36610c0a565b9291909161173c565b5060603660031901126100f2576020906100eb6024356107b26107ad61079b6004356110f4565b926107516044359460028305906111ad565b610d4f565b611cbd565b5060a03660031901126100f2576060906107e76107d2610bde565b60843590606435906044359060243590610d6d565b91929081519384526020840152820152f35b6020826100eb61080836610c28565b9392909261163e565b5060a03660031901126100f257610563610829610bf4565b608435906064359060443590600435611357565b6020826100eb61084c36610c28565b939290926118d9565b5060803660031901126100f25761086a610bde565b602435604435606435670de0b6b3a76400008103610a4557506001600160ff1b039061089882841115610cea565b845163961be39160e01b81526001600160a01b038516936020938483600481895afa928315610658576004968691600095610a26575b5089519788809263705727b560e01b82525afa908115610658576001600160a01b039661091e96600093610a01575b505061090b90851115610cea565b6001600160781b03809116921690611a7d565b61092b6000821215610cea565b915b169082519163705727b560e01b83526020928381600481855afa8015610622576001600160781b03916000916109e4575b501683816109765750505080915b8351928352820152f35b6004928651938480926318160ddd60e01b82525afa918215610622576000926109b3575b506109a86109ad9284610ca1565b610cca565b9161096c565b91508382813d83116109dd575b6109ca8183610c4a565b810103126100f2579051906109a861099a565b503d6109c0565b6109fb9150853d8711610303576102f38183610c4a565b3861095e565b61090b9293509081610a1e92903d10610303576102f38183610c4a565b9190386108fd565b610a3e919550823d8411610303576102f38183610c4a565b93386108ce565b6001600160ff1b0391610a5a83851115610cea565b855163961be39160e01b81526001600160a01b0386169460209485836004818a5afa9283156106d7576004978791600095610b18575b508a519889809263705727b560e01b82525afa9081156106d7576001600160a01b0397610ae097600093610af3575b5050610acd90851115610cea565b6001600160781b038091169216906118d9565b610aed6000821215610cea565b9161092d565b610acd9293509081610b1092903d10610303576102f38183610c4a565b919038610abf565b610b30919550823d8411610303576102f38183610c4a565b9338610a90565b6020826100eb610b4636610c0a565b92919091611a7d565b5060c03660031901126100f2576020906100eb60a435608435606435604435602435600435611bf8565b6020826100eb610b8836610c0a565b92919091611b8b565b6020826100eb610ba036610c0a565b92919091611b00565b5060e03660031901126100f257610563610bc1610bde565b60c4359060a43590608435906064359060443590602435906111c9565b600435906001600160a01b03821682036100f257565b602435906001600160a01b03821682036100f257565b60809060031901126100f25760043590602435906044359060643590565b60a09060031901126100f2576004359060243590604435906064359060843590565b90601f8019910116810190811067ffffffffffffffff821117610c6c57604052565b634e487b7160e01b600052604160045260246000fd5b908160209103126100f257516001600160781b03811681036100f25790565b81810292918115918404141715610cb457565b634e487b7160e01b600052601160045260246000fd5b8115610cd4570490565b634e487b7160e01b600052601260045260246000fd5b15610cf157565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f76616c7565206d75737420626520706f736974697665000000000000000000006044820152fd5b600160ff1b8114610cb45760000390565b91908203918211610cb457565b9491929093946000936001600160a01b0360009216956040805163705727b560e01b918282526020996004948b848781855afa93841561108c578894611069575b50610dc3906001600160781b03809516610ca1565b82516318160ddd60e01b81528c818881865afa90811561105f57899161102c575b50610dee91610cca565b9a8b1561100457908b91670de0b6b3a7640000998a8114600014610f1c5750610e216001600160ff1b0380941115610cea565b610e2a8d610d4f565b9584519763961be39160e01b895282898281875afa988915610f12578b99610eef575b5090829186518095819382525afa938415610ee65750928492610e90979592610e999997958b93610ec1575b5050610e8790871115610cea565b1692169061173c565b91821215610cea565b905b819580610ea757505050565b610ebe939650829450610278906105599293610ca1565b92565b610e879293509081610ede92903d10610303576102f38183610c4a565b919038610e79565b513d8a823e3d90fd5b8392919950610f0a90833d8511610303576102f38183610c4a565b989091610e4d565b86513d8d823e3d90fd5b9796959493929190610f3c6001600160ff1b03936107ad85821115610cea565b9584519763961be39160e01b895282898281875afa988915610ffa578c99610fd7575b5090829186518095819382525afa938415610fce5750928492610fa399979592610e909997958c93610fa9575b5050610f9a90871115610cea565b1692169061163e565b90610e9b565b610f9a9293509081610fc692903d10610303576102f38183610c4a565b919038610f8c565b513d8b823e3d90fd5b8392919950610ff290833d8511610303576102f38183610c4a565b989091610f5f565b86513d8e823e3d90fd5b8583517fd4b6d81b000000000000000000000000000000000000000000000000000000008152fd5b90508c81813d8311611058575b6110438183610c4a565b810103126110545751610dee610de4565b8880fd5b503d611039565b84513d8b823e3d90fd5b610dc3919450611085908d803d10610303576102f38183610c4a565b9390610dae565b83513d8a823e3d90fd5b906706f05b59d3b200008201809211610cb457565b91908201809211610cb457565b90670de0b6b3a764000060008382039312818412811691841390151617610cb457565b81810392916000138015828513169184121617610cb457565b90670de0b6b3a764000091828102928184051490151715610cb457565b908160011b916002830503610cb457565b908160021b916004830503610cb457565b818102929160008212600160ff1b821416610cb4578184051490151715610cb457565b8115610cd457600160ff1b8114600019831416610cb4570590565b9081670de0b6b3a764000001918212600116610cb457565b906706f05b59d3b200009160008382019384129112908015821691151617610cb457565b91909160008382019384129112908015821691151617610cb457565b909591938615611348576001600160a01b03610278916111f4670de0b6b3a76400009384928b610ca1565b049216916040519363961be39160e01b85526020918286600481885afa91821561131d57600496600093611329575b50836001600160781b03809416966040519889809263705727b560e01b82525afa90811561131d576112cf9a61127384611281968f9b9561127b966112889a600092611300575b5050169a610d60565b8d8a8a611bf8565b906110ab565b8098610d60565b938181036112d2575b50506112ca6001600160ff1b036112aa81841115610cea565b6112b681851115610cea565b6112c281861115610cea565b851115610cea565b611b00565b91565b816112f082826112e9826112f797989a999a610ca1565b0497610ca1565b0493610ca1565b04913880611291565b6113169250803d10610303576102f38183610c4a565b388061126a565b6040513d6000823e3d90fd5b611341919350843d8611610303576102f38183610c4a565b9138611223565b50505050505050600090600090565b9392919084156114ad576001600160a01b03169060405163961be39160e01b815260208082600481875afa91821561131d5760009261148e575b506004816001600160781b03809416956040519283809263705727b560e01b82525afa91821561131d57600092611471575b505016670de0b6b3a764000093848103611458575b50908561141c926114166001600160ff1b036113f681881115610cea565b61140281841115610cea565b61140e81851115610cea565b841115610cea565b84611b8b565b80941515918261144e575b505061143d576105596102786112cf9385610ca1565b6004604051631c4bd71760e01b8152fd5b1090508338611427565b611468859161141c949398610ca1565b049590916113d8565b6114879250803d10610303576102f38183610c4a565b38806113c3565b816114a69293503d8411610303576102f38183610c4a565b9038611391565b5050505050600090600090565b9390949180158015611624575b6115fa57838181926114d989896111ad565b97806114e58380611133565b906114ef91611156565b98670de0b6b3a7640000809a8c6115068880611133565b9061151091611156565b611519916111ad565b611523908a611133565b61152c90611189565b05611536916110db565b95611540916111ad565b611549906110f4565b60028205611556916111ad565b9061156091611156565b8061156a876110f4565b60028205611577916111ad565b9061158191611156565b61158a916110db565b61159391611133565b9061159d91611156565b916115a7906110f4565b600282056115b4916111ad565b906115be91611156565b6115c7916110db565b906115d191611cbd565b6115da91611133565b6115e390611189565b05906115ee916110db565b6115f79061162c565b90565b60046040517fae032660000000000000000000000000000000000000000000000000000000008152fd5b5083156114c7565b60008112156115f7576115f790610d4f565b92919382919461164e85826111ad565b9481611659886110f4565b60028205611666916111ad565b9061167091611156565b91670de0b6b3a76400009584838861168a81988297611133565b61169390611189565b059261169e91611133565b906116a891611156565b6116b1916110db565b92806116bc876110f4565b600282056116c9916111ad565b906116d391611156565b6116dc916110db565b6116e591611133565b6116ee90611189565b05906116f9916111ad565b61170290610d4f565b938061170d91611133565b61171690611189565b0561172091611133565b61172990611189565b0561173391611cbd565b6115f7916110db565b92909261174981846111ad565b9083611754866110f4565b60028205611761916111ad565b9061176b91611156565b8094611776856110f4565b90670de0b6b3a764000096808894936002869505611793916111ad565b9061179d91611156565b6117a6916110db565b6117af91611133565b6117b890611189565b05916117c3856110b8565b6117cc91611133565b6117d590611189565b056117df916111ad565b600290059283926117f08480611133565b92806117fb91611133565b61180491611133565b61180d90611189565b05611817916111ad565b906118219161182a565b611733916111ad565b9190600060038413156118ca575060008113806118c0575b1561188957915b60028061185f8561185a8186611156565b6111ad565b05915b84830361186e57505050565b91935090816118818561185a8185611156565b059190611862565b60008112806118ae575b156118a7576118a190610d4f565b91611849565b5081611849565b50826118b982610d4f565b1315611893565b5082811315611842565b9290506118d357565b60019150565b9092938215611a755760006118ee83866111ad565b126115fa578391836118ff846110f4565b6002820561190c916111ad565b9061191691611156565b94611920916111ad565b90670de0b6b3a764000080938282611939819587611133565b61194290611189565b059061194e8a87611133565b9061195891611156565b611961916110db565b8261196c888b611133565b61197590611189565b0561197f90611111565b611988916111ad565b96611993878a611133565b9061199d91611156565b6119a6916110db565b6119b09084611133565b6119b990611189565b0591806119c591611133565b6119ce90611189565b056119d8916110db565b91816119e48287611133565b6119ed90611189565b05906119f891611133565b611a0190611189565b05611a0b916111ad565b611a158280611133565b90611a1f84611122565b90611a2991611133565b611a32916110db565b611a3b82610d4f565b91611a459161182a565b611a4e916111ad565b611a57906110f4565b60028205611a64916111ad565b90611a6e91611156565b6002900590565b509250505090565b9190918115611af9576000611a9282856111ad565b126115fa57829082611aa3836110f4565b60028205611ab0916111ad565b90611aba91611156565b93611ac4916111ad565b670de0b6b3a764000080809381611ada896110b8565b611ae49086611133565b611aed90611189565b058261196c888b611133565b9250505090565b611b7a82611b74611b8093611b5d611b63611b4d6115f79a98610751611b869b61185a611b48611b2f896110f4565b92611b42866107516002820580976111ad565b996111ad565b6110f4565b611b5d816107516107478c6110f4565b906110db565b91611b5d816107516107478b6110f4565b90611133565b91611171565b90611156565b61162c565b90611bf1611bec82611b746115f7976107b2610751611be6611bd9611b869b611bd488611bc8670de0b6b3a76400009d8f610747610751916110f4565b958693611b748a611171565b6110db565b91610751610747866110f4565b906111ad565b611189565b05906110db565b90959492939195611c1481611c0f600099856110ab565b611c91565b91838311611c25575b505050505050565b611c3b9596975090611c3691611c91565b611cfa565b90670de0b6b3a764000091828111611c6757611c5a9161027891610ca1565b0490388080808080611c1d565b60046040517f5c7c5649000000000000000000000000000000000000000000000000000000008152fd5b90670de0b6b3a764000091828102928184041490151715610cb4576109a86115f7928260011c906110ab565b611cc78180611133565b908260021b9280840560041490151715610cb457611bd481611cf1611cf694611be66002976110f4565b61182a565b0590565b929182821115611d2e5760046040517fa6af4260000000000000000000000000000000000000000000000000000000008152fd5b808211801590611dba575b611db1576115f793611d8c92611d8391611d7d90848111611d9257611d7760005b610181611d678887610d60565b611d718988610d60565b90610ca1565b92610d60565b90610cca565b60011c92610d60565b90611c91565b611d77611dac611da28784610d60565b611d718885610d60565b611d5a565b50505050600090565b5083821115611d3956fea26469706673582212200781bd3aa07556046e3b5247e831256b3643fdd3f7f6acd9430b5d0ab9b4a8bf64736f6c63430008120033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
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.