Asymmetric Withdrawals on BEPSwap

Asymmetric Withdrawals are coming to BEPSwap

THORChain
THORChain
3 min readOct 29, 2019

--

Staking in BEPSwap Pools

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 staking
  • r: Rune staked
  • T: Token Balance after staking
  • t: 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 as BNB.XRP
  • W : Withdraw Basis Points
  • A : 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 Units
  • P: 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.

A visualisation of how this could look like in the interface.

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.

--

--

THORChain
THORChain

The official team for THORChain — the decentralized liquidity network.