NablaBackstopPool

The backstop pool takes most of the risk of a set of swap pools backed by it. Whenever a swap pool is low on reserves and a LPer wants to withdraw some liquidity, they can conduct an insurance withdrawal (burn swap pool shares, reimbursed in backstop liquidity) to avoid paying a high slippage. The backstop pool owns all excess liquidity in its swap pools, but is also liable for potential liquidity gaps. In return, the backstop pool receives a cut of the swap fees.


Withdrawal

struct Withdrawal {
  uint128 startClaimPeriod;
  uint128 endClaimPeriod;
  uint256 sharesToBurn;
}

SwapPoolConfig

struct SwapPoolConfig {
  uint128 insuranceFeeBps;
  bool isCovered;
}

router

contract IRouter router

router instance for this backstop pool


getBackedPool

function getBackedPool(uint256 _index) external view returns (address swapPool_)

enumerate swap pools backed by this backstop pool

Parameters

Return Values


getBackedPoolCount

function getBackedPoolCount() external view returns (uint256 count_)

get swap pool count backed by this backstop pool

Return Values


getInsuranceFee

function getInsuranceFee(address _swapPool) external view returns (uint256 feeBps_)

get insurance withdrawal fee for a given swap pool

Parameters

Return Values


deposit

function deposit(uint256 _depositAmount, uint256 _minLPAmountOut, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 sharesToMint_)

Deposits amount of tokens into pool Will change cov ratio of pool, will increase delta to 0

By calling this function the price feeds get updated (IPriceOracleAdapter.updatePriceFeeds)

Parameters

Return Values


initiateWithdraw

function initiateWithdraw(uint256 _sharesToBurn) external returns (bool success_)

Starts the withdrawal process or overrides an existing one The user must finalize the withdrawal after the delay period has passed but before the claim period ends through finalizeWithdrawBackstopLiquidity() or finalizeWithdrawExcessSwapLiquidity()

Parameters

Return Values


cancelWithdraw

function cancelWithdraw() external returns (bool success_)

Cancels an initiated withdrawal

Return Values


finalizeWithdrawBackstopLiquidity

function finalizeWithdrawBackstopLiquidity(uint256 _minimumAmount, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 payoutAmount_)

Finalizes the withdrawal process after the delay period has passed but before the claim period ends Withdraws backstop liquidity amount of asset ensuring minimum amount required

By calling this function the price feeds get updated (IPriceOracleAdapter.updatePriceFeeds)

Parameters

Return Values


redeemSwapPoolShares

function redeemSwapPoolShares(address _swapPool, uint256 _shares, uint256 _minAmountOut, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 amountOut_)

Withdraw from a swap pool using backstop liquidity without slippage (backstop burn) only possible if swap pool's coverage ratio < 100%

By calling this function the price feeds get updated (IPriceOracleAdapter.updatePriceFeeds)

Parameters

Return Values


finalizeWithdrawExcessSwapLiquidity

function finalizeWithdrawExcessSwapLiquidity(address _swapPool, uint256 _minAmount, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 swapAmount_)

Finalizes the withdrawal process after the delay period has passed but before the claim period ends Withdraw from backstop pool, but receive excess liquidity of a swap pool instead of backstop liquidity

By calling this function the price feeds get updated (IPriceOracleAdapter.updatePriceFeeds)

Parameters

Return Values


redeemCrossSwapPoolShares

function redeemCrossSwapPoolShares(address _swapPool, address _targetSwapPool, uint256 _shares, uint256 _minAmount, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 finalAmount_)

getTotalPoolWorth

function getTotalPoolWorth(uint256[] _allTokenPrices) public view returns (int256 value_, int256 totalExcessLiquidity_)

return worth of the whole backstop pool in asset(), incl. all swap pools' excess liquidity and the backstop pool's liabilities this is a fixed point number, using the backstop pool decimals

ignoring if pools are paused or not, since liabilities still apply and we don't want the backstop pool worth to jump

Parameters

Return Values


sharesTargetWorth

function sharesTargetWorth(uint256 _sharesToBurn, uint256[] _allTokenPrices) public view returns (uint256 amount_)

Returns the worth of an amount of pool shares (LP tokens) in underlying principle

Parameters

Return Values


getPoolState

function getPoolState(uint256[] _allTokenPrices) external view returns (uint256 reserves_, int256 totalPoolWorth_, uint256 totalSupply_)

returns the backstop pool state

Parameters

Return Values


getWithdrawal

function getWithdrawal(address _sender) external view returns (uint128 startClaimPeriod_, uint128 endClaimPeriod_, uint256 sharesToBurn_)

Get information about a user's initiated withdrawal

Parameters

Return Values


getWithdrawalDelayAndClaimPeriod

function getWithdrawalDelayAndClaimPeriod() external view returns (uint128 delay_, uint128 claimPeriod_)

Get the delay and claim period for withdrawals

Return Values

Last updated