Each LP token’s net asset value in US dollars. lp=TotalSupplyLP
LP
total LP tokens’ net asset value, in USD, equal to LP’s cash after instantly closing all user positions without fee
s
net position of each currency in USD for all users. = (loi-soi)
pr
a risk management parameter for each currency. pr ∈(0,1)
poracle
Oracle price of each currency
pexec
execution price of each currency
When calculating the mint and redeem process, Symmetry's algorithm looks at its impact on the overall welfare of the LP holders. Specifically:
When a liquidity provider mints lp tokens, it reduces the risk (or does not change the risk) other LPs take (from acting as the counterparty of traders). Therefore, lpmint=lporacle
When a liquidity provider redeems lp tokens, it adds risks (or does not change the risks) other LPs take. Therefore, lpredeem≤lporacle
Let's go through the calculation with examples. Note: the following examples do NOTincludegas fees.
If someone wants to mint 250,000 lp, how much USDC would he need (assuming the USDC's price remains at $1)?
lporacle=1,000,000100,000,000=$100
250,000×lporacle=$25,000,000=
Redeem
If someone wants to redeem 250,000 lp, how much USDC could he get (assuming the USDC's price remains at $1)?
The maximum liquidity available for redemption is LP−∑∣s∣=$90,000,000.
lporacle=1,000,000100,000,000=$100
Every lp can be viewed as holding 0 BTC-USDC position and 1,000,000−10,000,000=$−10 ETH-USDC position. Thus, 250,000 lp would hold 0 BTC-USDC position and $-2,500,000 ETH-USDC position.
To close $-2,500,000 ETH-USDC position:
LP=100,000,000−250,000×100=$75,000,000,
s=−10,000,000+2,500,000=$−7,500,000
T=$−2,500,000
pmid=poracle⋅(1+pr⋅LPλ⋅s)=$1,986.67
pmid′=poracle⋅(1+pr⋅LPλ⋅(s+T))=$1,982.22
pexec=$1,984.44
The calculation assumes 0 trading fees and 0 gas fees.
slippage=1,984.44−2,000=$−15.56
PnL=2,0002,500,000×(1,984.44−2,000)=$−19,444.44
Adding in the 0.1% redemption fee:
250,000×lpredeem=(250,000×100−19,444.44)×(1−0.1%)=24,955,575, which is less than 25,000,000.
Further elaborations on trading prices are explained here.