ADD: Asymmetric Withdrawals
We allow asymmetric stakes, we also allow asymmetric withdrawals.
The concept is essentially a clean withdrawal, then a swap from one asset to another. We can do both at the same time.
-
A
: Asymmetry (-1 : 0 : 1) in points of %, eg 50% is 0.5 in favour of token. (-1 is a full Rune withdrawal) -
W
: Withdraw Basis Points (0 : 10000) -
S
: Stake Units for that staker -
P
: Pool Units -
R
: Balance of Rune -
T
: Balance of Token
We first detect the side (negative favours Rune, positive favours Token).
Then we apply logic:
RUNE:
if(favoursRune, (withdrawal + swappedTokenToRune), else (withdrawal - swappedRuneToToken))
if(A<0, (S * R * W * ((-1*A* (P - S * W)^2) / (P * ((-1*A-1) * S * W + P)^2) + 1/P)), (R * S * W * (1 - A))/P)
TOKEN:
if(favoursToken, (withdrawal - swappedTokenToRune), else (withdrawal + swappedRuneToToken))
if(A<0, (T * S * W * (1 + A))/P, (S * T * W * ((A * (P - S * W)^2) / (P * ((A - 1) * S * W + P)^2) + 1/P)))