SwapPool
Swap pool contract. May or may not be covered by a backstop pool. Conceptionally, there are two ways to temporarily disable a pool: The owner can either pause the pool, disabling deposits, swaps & backstop, or the owner can set the pool cap to zero which only prevents deposits. The former is for security incidents, the latter for phasing out a pool.
SwapFees
totalLiabilities
The liabilities of the pool Cannot just use totalSupply() as the totalLiabilities will accumulate also the LP fees from swaps. This is fixed point number using the decimals of this pool
reserve
The amount of pool tokens usable for swaps This is fixed point number using the decimals of this pool
reserveWithSlippage
The amount of pool tokens plus the slippage The relationship with reserve is: reserveWithSlippage = slippageCurve.psi(reserve, totalLiabilities) However this relationship will never hold precisely and will deviate slightly for numerical reasons!! All code needs to work even if this relationship does not hold This is fixed point number using the decimals of this pool
maxCoverageRatioForSwapIn
safeRedeemPercentage
safeRedeemInterval
lastBackstopBurnTimestamp
lastAvailableAmountForSafeRedeem
protocolTreasury
lastDepositAt
lastDepositAmount
backstop
router
router instance for this swap pool
slippageCurve
deposit
Deposits amount of tokens into pool Will change cov ratio of pool, will increase delta to 0
Parameters
Return Values
quoteDeposit
Get a quote for the effective amount of tokens for a deposit
Parameters
Return Values
withdraw
Withdraws liquidity amount of asset ensuring minimum amount required
Parameters
Return Values
quoteWithdraw
Get a quote for the effective amount of tokens for a withdrawal
Parameters
Return Values
backstopBurn
Burns swap pool LP tokens of owner, will get compensated using backstop liquidity (reedem swap pool shares) Can only be invoked by backstop pool, disabled when pool is paused
Parameters
Return Values
getMaxRedeemSwapPoolShares
Get the maximum amount of swap pool LP tokens that can be burned (CR <= 100%)
Return Values
backstopDrain
For backstop pool to withdraw liquidity if swap pool's coverage ratio > 100% Can only be invoked by backstop pool
Parameters
Return Values
quoteBackstopDrain
Get a quote for the effective amount of tokens for a backstop drain
Parameters
Return Values
quoteSwapInto
Get a quote for the effective amount of tokens for a swap into
Parameters
Return Values
quoteSwapOut
Get a quote for the effective amount of tokens, incl. slippage and fees
Parameters
Return Values
coverage
returns pool coverage ratio
Return Values
getExcessLiquidity
Computes the excess liquidity that forms that valuation of the backstop pool is defined as b + C - B - L where
b is reserve
C is the amount of
asset()
tokens in the poolB is reserveWithSlippage
L is totalLiabilities The excess liquidity is a fixed point number using the decimals of this pool
Return Values
sharesTargetWorth
Returns the worth of an amount of pool shares (LP tokens) in underlying principle
Parameters
Return Values
swapFees
Return the configured swap fees for this pool
Return Values
depositingUnfreezesAt
Last updated