Swapping is one of the two primary ways to interact with Stabull pools. Users select an asset that they currently hold (input) and a token they would like to swap for (output). The user also specifies an amount of the input or output token they would like to swap forr. A successfully executed swap transaction will transfer the input token from the user to the pool contact, and the desired output token from the pool to the user (in a single transaction). The amount of output token received for every input token is known as the swap rate, and is determined by the pool invariant (the pricing curve). Additionally, a swap fee is collected and split between liquidity providers and the protocol.
For more details on how to complete a swap on Stabull see this knowledgebase article, or watch this video.
Fees
Stabull's swap fee is currently set to 0.05%. The fee is collected in the output token during the swap transaction.
How is the fee allocated? 50% of the fee is distributed in specie to liquidity providers proportional to their contribution to reserves. The remaining portion of the swap fee is used by the protocol (protocolFee
).
Liquidity Providers
50%
Treasury
25%
Insurance Fund
25%
The swap fee and its allocation can be amended by governance proposal.
When do LPs realise their fee revenue? At present, fee revenue is realised when liquidity is withdrawn. For example, a swap of 130 NZDS for 100 USDC, will result in 0.05 USDC of fee revenue and be added to the pool reserves. Each LP token holder will now own the same share of a (slightly) bigger pie. When they withdraw they get a little bit more than if the swap had not occured.
Multihop Swaps
Despite assets being paired with USDC in their pool, it is possible to swap between non-paired assets in a single transaction, known as a multihop swap. This is performed by Stabell's router contract, which finds the most cost effective route between multiple pools.
For example a swap from TRYB to EURS will be routed through (1) the TRYB/USDC pool, and (2) the EURS/USDC pool. Both intermediary swaps will incur the swap fee to compensate the LPs of each pool.
Last updated