INablaBackstopPool

CoverSwapWithdrawal

event CoverSwapWithdrawal(address sender, address swapPool, uint256 amountSwapShares, uint256 amountSwapTokens, uint256 amountBackstopTokens)

emitted when a swap pool LP withdraws from backstop pool

InsuranceFeeSet

event InsuranceFeeSet(address sender, address swapPool, uint256 insuranceFeeBps)

emitted when the insurance fee is set for a swap pool

Mint

event Mint(address sender, uint256 poolSharesMinted, uint256 amountPrincipleDeposited)

emitted on every deposit

SwapPoolAdded

event SwapPoolAdded(address sender, address swapPool)

emitted when a new swap pool is added to the backstop pool for coverage

WithdrawSwapLiquidity

event WithdrawSwapLiquidity(address sender, address swapPool, uint256 amountSwapTokens, uint256 amountBackstopTokens)

emitted when a backstop pool LP withdraws liquidity from swap pool

WithdrawalInitiated

event WithdrawalInitiated(address sender, uint256 sharesToBurn)

emitted when withdrawal is initiated

WithdrawBackstopLiquidity

event WithdrawBackstopLiquidity(address sender, uint256 sharesToBurn, uint256 payAmount)

emitted when a backstop pool LP withdraws liquidity from backstop pool

WithdrawalDelayAndClaimPeriodSet

event WithdrawalDelayAndClaimPeriodSet(address sender, uint256 delay, uint256 claimPeriod)

emitted when withdrawal delay and claim period are set

router

function router() external view returns (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

NameTypeDescription

_index

uint256

index of the swap pool in coveredSwapPools array

Return Values

NameTypeDescription

_swapPool

address

swap pool address

getBackedPoolCount

function getBackedPoolCount() external view returns (uint256 _count)

get swap pool count backed by this backstop pool

Return Values

NameTypeDescription

_count

uint256

number of swap pools

getInsuranceFee

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

get insurance withdrawal fee for a given swap pool

Parameters

NameTypeDescription

_swapPool

address

address of the swap pool

Return Values

NameTypeDescription

_feeBps

uint256

insurance witdrawal fee, in basis points (0.01%)

getTotalPoolWorth

function getTotalPoolWorth(uint256[] _allTokenPrices) external view returns (int256 _value)

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

Parameters

NameTypeDescription

_allTokenPrices

uint256[]

array of all token prices ([0] backstop pool token, [1] swap pool token_i, [2] swap pool token_i+1, ... [n] swap pool token_n) as within coveredSwapPools[]

Return Values

NameTypeDescription

_value

int256

total value of all backstop pool shares, in asset()

deposit

function deposit(uint256 _depositAmount, bytes[] _priceUpdateData) external payable returns (uint256 _sharesToMint, int256 _fee)

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 (IPriceOracleGetter.updatePriceFeeds)

Parameters

NameTypeDescription

_depositAmount

uint256

The amount to be deposited

_priceUpdateData

bytes[]

Array of price update data of all assets involved (backstop pool and all swapPools as within coveredSwapPools[])

Return Values

NameTypeDescription

_sharesToMint

uint256

Total number of pool lp tokens minted

_fee

int256

The fee due to slippage (will be zero)

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

NameTypeDescription

_sharesToBurn

uint256

The liquidity to be withdrawn, an amount of backstop pool LP tokens

Return Values

NameTypeDescription

success

bool

Confirmation of success

finalizeWithdrawBackstopLiquidity

function finalizeWithdrawBackstopLiquidity(uint256 _minimumAmount, 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

NameTypeDescription

_minimumAmount

uint256

Reject withdrawal if resulting amount is below

_priceUpdateData

bytes[]

Array of price update data of all assets involved (backstop pool and all swapPools as within coveredSwapPools[])

Return Values

NameTypeDescription

_payoutAmount

uint256

Amount of asset() tokens withdrawn

redeemSwapPoolShares

function redeemSwapPoolShares(address _swapPool, uint256 _shares, uint256 _minAmount, bytes[] _priceUpdateData) external payable returns (uint256 _netAmount)

withdraw from a swap pool using backstop liquidity without slippage only possible if swap pool's coverage ratio < 100%

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

Parameters

NameTypeDescription

_swapPool

address

swap pool address

_shares

uint256

number of swap pool shares to redeem

_minAmount

uint256

minimum amount of backstop liquidity to receive

_priceUpdateData

bytes[]

Array of price update data of all assets involved (backstop pool and this swapPool)

Return Values

NameTypeDescription

_netAmount

uint256

amount of backstop liquidity paid-out

finalizeWithdrawExcessSwapLiquidity

function finalizeWithdrawExcessSwapLiquidity(address _swapPool, uint256 _minAmount, 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

NameTypeDescription

_swapPool

address

swap pool address, must have a coverage ratio > 100%

_minAmount

uint256

minimum amount of swap pool liquidity to receive, uses decimals of swap pool

_priceUpdateData

bytes[]

Array of price update data of all assets involved (backstop pool and all swapPools as within coveredSwapPools[])

Return Values

NameTypeDescription

_swapAmount

uint256

amount of swap pool liquidity paid-out, uses decimals of swap pool

Last updated