Comment on page
AuroraSwap offers users a simple way to provide liquidity for tokens on Aurora via automated liquidity pools (LPs). To become a liquidity provider on AuroraSwap, a user must deposit equal values of two tokens. In return, they receive BRL-LP tokens (AuroraSwap Liquidity Pool tokens). BRL-LP tokens represent a proportional share of the given LP and liquidity providers may claim their underlying tokens anytime. Liquidity providers receive a 0.25% fee for every swap that is made in their pair. The 0.25% fee is directly added back to the LP, increasing the value of BRL-LP tokens. Liquidity providers can also participate in yield farming with supported LPs.
Anyone can make a LP on AuroraSwap, with any two tokens (on Aurora) of their choice. When an LP is created, the creator sets the price of the tokens. The amount of BRL-LP (B-LP) shares minted are based on the equation:
B-LP=sqrt(x∗y)B-LP = sqrt(x*y)B-LP=sqrt(x∗y)
Where x = number of $AAA tokens and y = number of $BBB tokens. Figure 1 shows a diagram of a liquidity provider creating a new liquidity pool with tokens $AAA and $BBB.
Figure 1. Creating a new LP on AuroraSwap.
Swap fees are directly accumulated in the LP. For each swap a 0.3% fee is charged to the trader in the token they are selling. This is added to the LP and slightly increases the LP's k value with every swap. 5/6 of the 0.3% fee goes to the liquidity providers and 1/6 of the 0.3% swap fee goes to the protocol fee vault. The protocol fee vault only receives their fees (in the form of BRL-LP tokens) when a liquidity provider enters or exits the LP. After sometime, swaps are made in the
$AAA/$BBB LP, increasing the LP's k value. The change in k and number of outstanding shares can be used to calculate the number of BRL-LP tokens that get minted into the protocol fee vault. The number of B-LP tokens to minted for the protocol fee vault can be calculated by the equation:
B-LP=s∗(sqrt(k2)−sqrt(k1))/(5∗sqrt(k2)+sqrt(k1))B-LP = s*(sqrt(k2)- sqrt(k1))/(5*sqrt(k2)+sqrt(k1))B-LP=s∗(sqrt(k2)−sqrt(k1))/(5∗sqrt(k2)+ sqrt(k1))
Where s is the number of outstanding B-LP tokens, k2 is the current
k value of the LP, and k1 is the k value of the LP at the last deposit/withdraw from the LP. Figure 2 shows a diagram of a liquidity provider depositing $AAA and $BBB tokens to the LP from Figure 1, after a swap has been made.
Figure 2. Adding liquidity to a AuroraSwap LP.
In Figure 2, a new liquidity provider deposits funds to the
$AAA/$BBB BRL-LP. The liquidity provider-must deposit
$AAA and $BBB tokens in the same proportion as the LP reserve. In the example above, the liquidity provider must deposit 0.00827 $BBB tokens for every 1 $AAA token they wish to deposit. The LP first mints BRL-LP tokens to the protocol fee vault, then calculates the number of BRL-LP tokens minted to the new liquidity provider with the equation: B-LP=x,deposited∗s/xB-LP=x,deposited*s/xB-LP=x,deposite d∗s/x
Where x,deposited is equal to the number of $AAA tokens deposited by the new liquidity provider, s is the number of outstanding BRL-LP shares (including the newly minted shares for the protocol fee vault), and x is the number of
$AAA tokens in the LP.