Swaps

Swappers can exchange assets – either an external asset for the native asset like Binance Coin for Rune or 2 external assets like BNB for Bitcoin. Swaps are made across liquidity pools. The larger the value of the liquidity pools, the lower the slippage cost to Swappers.


BNB to RUNE

Swap
Swap BNB
For RUNE
0.0
Output calculation
RUNE Output = (BNB Amt * RUNE Balance * BNB Balance) /
(BNB Amt + BNB Balance)2
0.0 = (500.0 * NaNt * NaNt) / (500.0 + NaNt)2
Value
$0.00
$0.00
Slippage
$0.0 or 0%
RUNE Value Swapped - BNB Value Swapped
$0.0 - $0.0
Pool
BNB
RUNE
Price
$0.00
$0.00
Balance
NaNt
NaNt
Value
$2.5m
$2.5m
Total Value
$5.0m
BNBRUNESlippage
Swap BNB ValueTotal Pool Value

BNB to BTC

Swap
Swap BNB
For BTC
0.0
Output calculation
BTC Output = (BNB Amt * BTC Balance * BNB Balance) /
(BNB Amt + BNB Balance)2
0.0 = (500.0 * NaNt * NaNt) / (500.0 + NaNt)2
Value
$0.00
$0.00
Slippage
$0.0 or 0%
BTC Value Swapped - BNB Value Swapped
$0.0 - $0.0
Input Pool
BNB
RUNE
Price
$0.00
$0.00
Balance
NaNt
NaNt
Value
$3.8m
$3.8m
Total Value
$7.5m
Output Pool
RUNE
BTC
Price
$0.00
$0.00
Balance
NaNt
NaNt
Value
$4.8m
$4.8m
Total Value
$9.5m
Total Pools Value
$17.0m
BNBRUNESlippage
Swap BNB ValueTotal Pool Value

Explainer

You can swap between—

  • an external asset & Rune e.g. Binance Coin to Rune
  • or 2 external assets e.g. Binance Coin to Bitcoin

Swaps happen between assets in liquidity pools.

Swappers may experience a loss of value during a swap – that is, the assets the receive may be worth less than the value they sent. This is called Slippage.

Example: External Asset (Binance Coin) to Rune

We're going to swap using a pool that has $2.5m worth of BNB and $2.5m worth of RUNE. When we swap, we take RUNE out from the pool, and add BNB into the pool.

We're going to swap 500 BNB. For that, we'll receive 93.3k RUNE.

Swap BNB for RUNE
Swap BNB for RUNE

At the time of writing, 1 BNB is worth $15.01. So the value of the BNB we're swapping is 500 x $15.01 = $7,505. On the other hand, 1 RUNE is currently worth $0.08. So the value of the RUNE we'll receive is 93.3k x $0.08 = $7,461.

Swap Value
Swap Value

So you swap in $7,505 of BNB and receive $7,461 of RUNE. Why do we receive less than we put in? This is called Slippage and is a by-product of the system. When you swap assets, it causes the price to change.

Slippage

You can think of Slippage as a fee. In fact, the Slippage is collected by THORChain and used to reward Node Operators and Liquidity Providers. It's fundamental to the functioning of the network.

Here you can see Slippage as a proportion of BNB/RUNE swap value.

As we increase swap value, the Slippage increases.

Slippage is affected by the proportion of Swap Value to Total Pool Value.

If Swap Value is high relative to Total Pool Value, Slippage will be high.

High swap value, low pool value, high slippage
High swap value, low pool value, high slippage

If Swap Value is low relative to Total Pool Value, Slippage will be low.

Low swap value, high total value, low slippage
Low swap value, high total value, low slippage

This is why it is important to have a lot of value in liquidity pools.

This is also why it's important that THORChain gives rewards to Liquidity Providers. Otherwise it would be difficult to create high value – "deep" – pools. If pools didn't have a lot of value, slippage would be high and THORChain wouldn't be an attractive place to swap assets.

Example: External Asset (Binance Coin) to External Asset (Bitcoin)

THORChain also enables users to swap between external assets. For example, to swap BNB for BTC.

Whereas swapping between external assets and RUNE only requires 1 pool, swapping between 2 external assets requires 2 pools. This is because RUNE acts as an 'settlement' asset in the middle. To swap from BNB to BTC, you first swap between BNB and RUNE in the first pool and then RUNE and BTC in the second pool.

Let's run through another example.

We're going to swap 500 BNB. For that, we'll receive 1 BTC. Note these numbers are based on the exchange rate at time of writing, April 2020.

1 BNB is worth $15.01. So the value of the BNB we're swapping is 500 x $15.01 = $7,100. On the other hand, 1 BTC is currently worth $7,001. So the value of the BTC we'll receive is 1 x $7,001 = $7,001.

So you swap in $7,100 of BNB and receive $7,001 of BTC. As with the BNB to RUNE swap in the previous example, there is a Slippage of about $99.

This Slippage also depends on the amount of BNB being swapped in relation to the total size of the swap pools.

If BNB Swap Value is high relative to Total Pools Value, Slippage will be high.

If BNB Swap Value is low relative to Total Pools Value, Slippage will be low.

This Spotlight was commissioned by the THORChain team to help spread knowledge and develop the community. Members of the Rebase team had holdings of RUNE exceeding $100 in value throughout the project.

Interested in commissioning some crypto research or education?

Drop us an email

Follow Rebase on Twitter

Follow Us
© 2019—2022 Copyright Rebase