BEPSwap Pools
One of the key aspects of BEPSwap’s liquidity pools is that it is completely price-nuetral. BEPSwap does not impose a price on pools, the market decides to price the pools and the ratio of assets in the pools adjust accordingly.
Thus users can stake asymmetrically, where they can stake as little or as much assets as they like. They may do this simply because they deem the cost of switching assets is too high, or they think they can stake in a pool AND correct the price at the same time.
When staking asymmetrically, the user simply sends in assets to a pool in a valid staking transaction and the statechain updates pool balances and stake units accordingly.
The formula for calculating ownership of a pool is:
((R + T) (r T + R t))/(4 R T)
R
: Rune Balance after stakingr
: Rune stakedT
: Token Balance after stakingt
: Token staked
As can be seen, as long as either r
or t
is non-zero, then the stake units can be calculated. The staker now owns an equal share of both sides of the pool.
As the pool accrues fees, the staker gets to earn those fees as well, through ownership of the pool and everything in it.
Withdrawing
When the staker goes to withdraw, the statechain allows them to specify three parameters:
Asset
: Asset, such asBNB.XRP
W
: Withdraw Basis PointsA
: Asymmetry
WITHDRAW:BNB.XRP:10000:1.0
Withdraw Basis Points
This allows them to set units from 0 to 10000 (100%) in how much they want to withdraw, which is very precise. This is envisaged to be used by staking pools, exchanges and stakers withdrawing daily earned fees, which can be small.
Asymmetry
The third parameter is the asymmetry, which allows them to set how they want to withdraw, from -1 to 1 or any decimal place in-between.
- Setting
-1.0
means they will withdraw 100% in Rune. - Setting
0
or blank, means they will withdraw equally on both sides - Setting
1.0
means they will withdraw 100% in the asset.
They can also set any amount of partial withdrawals, such as 0.42
which is 60% in the token and 40% in Rune.
The equation to do this is given by:
(S * R * W * ((-1*A* (P - S * W)^2) / (P * ((-1*A-1) * S * W + P)^2) + 1/P))
S
: Stake UnitsP
: Pool Units
Conceptually, this is a withdrawal of everything, followed immediately by a swap of the desired amount. The equation that accounts for the parameters above as well as the XYK formula.
Considerations
The only consideration to have, is that by doing an asymmetric stake or withdrawal that shifts the pool price away from market price, it means the staker will be exposed to arbitrage as the market corrects.
Having said that, the total amount of arbitrage cost will be the same as if they had performed a swap at the same time. Additionally this cost becomes negligible at when the pools become very deep in liquidity.
The team look forward to seeing the community build on these features.
Community
Stay in touch!
- Twitter: https://twitter.com/thorchain_org
- Telegram Community: https://t.me/thorchain_org
- Telegram Announcements: https://t.me/thorchain
- Reddit: https://reddit.com/r/thorchain
- Github: https://github.com/thorchain
- Medium: https://medium.com/thorchain