Stableswap
This section contains a full API reference of all public functions & events related to Connext's stableswap contracts.
Events
TokenSwap
AddLiquidity
RemoveLiquidity
RemoveLiquidityOne
Getters
getSwapStorage
Return Stable swap storage
Parameters
Return Values
getSwapLPToken
Return LP token for canonical Id
Parameters
Return Values
getSwapA
Return A, the amplification coefficient _ n _ (n - 1)
See the StableSwap paper for details
Parameters
Return Values
getSwapAPrecise
Return A in its raw precision form
See the StableSwap paper for details
Parameters
Return Values
getSwapToken
Return address of the pooled token at given index. Reverts if tokenIndex is out of range.
Parameters
Return Values
getSwapTokenIndex
Return the index of the given token address. Reverts if no matching token is found.
Parameters
Return Values
getSwapTokenBalance
Return current balance of the pooled token at given index
Parameters
Return Values
getSwapVirtualPrice
Get the virtual price, to help calculate profit
Parameters
Return Values
calculateSwap
Calculate amount of tokens you receive on swap
Parameters
Return Values
calculateSwapTokenAmount
A simple method to calculate prices from deposits or withdrawals, excluding fees but including slippage. This is helpful as an input into the various "min" parameters on calls to fight front-running
This shouldn't be used outside frontends for user estimates.
Parameters
Return Values
calculateRemoveSwapLiquidity
A simple method to calculate amount of each underlying tokens that is returned upon burning given amount of LP tokens
Parameters
Return Values
calculateRemoveSwapLiquidityOneToken
Calculate the amount of underlying token available to withdraw when withdrawing via only single token
Parameters
Return Values
Functions
swap
Swap two tokens using this pool
Parameters
swapExact
Swap two tokens using this pool
Parameters
swapExactOut
Swap two tokens using this pool
Parameters
addSwapLiquidity
Add liquidity to the pool with the given amounts of tokens
Parameters
Return Values
removeSwapLiquidity
Burn LP tokens to remove liquidity from the pool. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.
Liquidity can always be removed, even when the pool is paused.
Parameters
Return Values
removeSwapLiquidityOneToken
Remove liquidity from the pool all in one token. Withdraw fee that decays linearly over period of 4 weeks since last deposit will apply.
Parameters
Return Values
Last updated