The SelfPeggingAsset contract exposes the primary trading and liquidity management functions for interacting with Tapio pools. This section details the available functions for minting SPAs, executing swaps, and redeeming assets, along with their parameters and return values for integration into trading interfaces and DeFi applications.
User Operations
Adds liquidity to the pool by depositing tokens in the amounts specified in _amounts. Returns the amount of SPA tokens minted, which must be at least _minMintAmount.
Copy function mint ( uint256 [] calldata _amounts , uint256 _minMintAmount ) external returns ( uint256 );
Parameters
Unconverted token balances used to mint pool token
Minimum amount of pool token to mint
Returns
The amount of pool tokens minted
Exchange between two underlying tokens.
Copy function swap ( uint256 _i , uint256 _j , uint256 _dx , uint256 _minDy ) external returns ( uint256 );
Parameters
Unconverted amount of token _i to swap in
Minimum token _j to swap out in converted balance
Returns
redeemProportion
Redeems pool token to underlying tokens proportionally.
Parameters
Amount of pool token to redeem
Minimum amount of underlying tokens to get
Returns
An array of the amounts of each token to redeem
Redeem pool token to one specific underlying token.
Parameters
Amount of pool token to redeem
Index of the token to redeem to
Minimum amount of the underlying token to redeem to
Returns
Redeems underlying tokens.
Parameters
Amounts of underlying tokens to redeem to
Maximum of pool token to redeem
Returns
Governance Functions
Pause mint/swap/redeem actions.
Access: only Owner (via Keeper)
Unpause mint/swap/redeem actions.
Access: only Owner (via Keeper)
Updates the mint fee on pool.
Parameters
The new mint fee value. Uses 10 decimal precision (denominator = 10^10). Examples: 1e6 = 0.01%, 1e7 = 0.1%, 1e8 = 1%
Access: only Owner (via Keeper)
Updates the swap fee on pool.
Parameters
The new swap fee value. Uses 10 decimal precision (denominator = 10^10). Examples: 1e6 = 0.01%, 1e7 = 0.1%, 1e8 = 1%
Access: only Owner (via Keeper)
Updates the redeem fee on pool.
Parameters
The new redeem fee value. Uses 10 decimal precision (denominator = 10^10). Examples: 1e6 = 0.01%, 1e7 = 0.1%, 1e8 = 1%
Access: only Owner (via Keeper)
setOffPegFeeMultiplier
Updates the off peg fee multiplier of pool.
Parameters
The new off peg fee multiplier value
Access: only Owner (via Keeper)
setExchangeRateFeeFactor
Updates the exchange rate fee factor of pool.
Parameters
The new exchange rate fee factor value
Access: only Owner (via Keeper)
Updates the decay period
Parameters
The new decay period value
Access: only Owner (via Keeper)
setRateChangeSkipPeriod
Updates the rate change skip period of pool.
Parameters
The new rate change skip period value
Access: only Owner (via Keeper)
updateFeeErrorMargin
Updates the fee error margin of pool.
Parameters
The new fee error margin value
Access: only Owner (via Keeper)
updateYieldErrorMargin
Updates yield error margin of pool.
Parameters
The new yield error margin value
Access: only Owner (via Keeper)
Distribute losses by rebasing negatively
Access: only Owner (via Keeper)
Computes the output amount after the swap.
Parameters
Unconverted amount of token _i to swap in
Returns
Unconverted amount of token _j to swap out
The amount of fees charged
Compute the amount of pool token that can be minted.
Parameters
Unconverted token balances
Returns
The amount of pool tokens to be minted
The amount of fees charged
Get the current A value from the controller if set, or use the local value.
Returns
Returns the array of token addresses in the pool.
Returns
Array of token addresses in the pool
getRedeemProportionAmount
Computes the amounts of underlying tokens when redeeming pool token.
Parameters
Amount of pool tokens to redeem
Returns
An array of the amounts of each token to redeem
The amount of fee charged
getRedeemSingleAmount
Computes the amount when redeeming pool token to one specific underlying token.
Parameters
Amount of pool token to redeem
Index of the underlying token to redeem to
Returns
The amount of single token that will be redeemed
The amount of pool token charged for redemption fee
getRedeemMultiAmount
Compute the amount of pool token that needs to be redeemed.
Parameters
Unconverted token balances
Returns
The amount of pool token that needs to be redeemed
The amount of pool token charged for redemption fee
Last updated 6 months ago