In this guide we will take a look at the following:
- What is Dexter.
- How we trade XTZ/Tokens and what "Slippage" is.
- How we become Liquidity providers (LP) and what do we earn from doing so.
- How we remove liquidity and take our assets back.
- What "impermanent loss" and "arbitrage" are.
Hint: Things are not as complicated as you may think.
What is Dexter;
Dexter, just like the title claims, is the first decentralized exchange on Tezos, where you can easily trade between your XTZ and different Tezos tokens like tzBTC (wrapped Bitcoin) or USDtz (Dollar pegged stablecoin), ETHtz (wrapped ETH) and soon XTZGold, XTZSilver and many more. In Dexter you can also become a liquidity provider, and earn proportional rewards from the 0.3% fees that traders pay in every trade.
Being decentralized, Dexter doen't require KYC, all the trades happen from inside our wallet (non custodial) and it removes the need of a centralized order book, letting the users to set the exchange rates through the trades they perform. All these may sound Greek to you if you have never had experience with a dex or providing liquidity before, but they are much simpler than they sound. So let's see it in action, starting with the suggested wallets you can use.
- Temple (ex."Thanos") (Web wallet, works as a browser extention, supports ledger devices. Similar to metamask for Ethereum)
- Kukai (Web wallet, supports Ledger devices, has a DirectAuth feature)
- Galleon (Desktop wallet, supports Ledger devices, can also be used to mint wXTZ)
- Magma Wallet (Mobile wallet, very user friendly and easy to use, made by Camlcase, the same company that created Dexter.)
In this guide we will look into using Dexter on a PC with the Temple wallet. For the mobile version through the Magma wallet I will make a seperate guide/review in the future.
Connecting Temple Wallet to Dexter
Once we have installed Temple wallet in our browser, we go to app.dexter.exchange, click on "Connect Wallet"(1), then on "Temple Wallet"(2), then we need to "Confirm"(3) in the pop up window, and finally click "Done"(4).
We have now successfully connected our wallet and we are ready to begin. For start, let's look into the Exchange part and later we will talk about Liquidity providing.
1) The coin/Token we will give.
2) The coin/Token we will get.
3) The exchange rate of the trade.
4) Estimated Slippage (Will explain it right after).
5) Our wallet balance (coins and tokens).
6) Most recent transactions we have made.
Slippage is the (possible) difference between the price we intend to execute a trade, and the price it is actually executed.
Since many trades might be happening at the same time, we need to set an acceptable margin in which the trades can proceed normally. The estimated slippage of a trade, changes depending on the amount we want to trade. That happens because the trades and the exchange rates are directly connected to the reserves of liquidity that the specific pair has.
The default slippage setting in Dexter is 0.5% and we can change it by clicking on "advanced options" and then set the percentage we want.
Now that we understand Slippage, we can proceed with our first trade. In our example we will trade 10 XTZ for 22.64 USDtz. So once we have typed the amount, we click "Exchange" (1), and then click "Confirm" (2) on the new window that opens up.
After that we wait for the transaction to be completed, and the tokens to show up in our wallet balance.
That's it! The tokens are now in our wallet. We can trade any pair of coins/Tokens in exactly the same way. As we said before, for every trade we perform, we pay a fee of 0.3% which is paid to the people that provide liquidity to the exchange. So let's see how we can also become Liquidity providers.
We click on the "Liquidity Pool" tab.
Adding liquidity to the exchange, can only be done in pairs of coins/tokens and the amounts of both must be of equal value. A pair could be XTZ/USDtz or XTZ/tzBTC etc
So if for example we want to provide liquidity to the XTZ/USDtz pair and we want to add 5 XTZ, we will have to add the equivalent in value USDtz based on their exchange rate of that moment (1). For the assets we provide as liquidity, we get a number of pool tokens (2) which represents the percentage of liquidity we have added to that pairs' pools.
So we click on "Add liquidity" and then "Confirm" on the window that pops up.
Once the transaction is complete, we can see our pool tokens here:
Piece of cake, right!? Now our assets have been added as liquidity to that specific pair, and for as long as we leave our assets in the liquidity pools, we will be getting proportional rewards for every trade that happens in that pair. In the example above we can see that our pool tokens represent 0.01% of the total liquidity pools, so for every trade that happens between XTZ/USDtz (and vive verca), we get 0.01% of the fees that the traders pay! So the more liquidity we provide, the bigger rewards we get!
To check the total of every pairs' liquidity pools we can go to the "Pool Data' tab.
It is impotant to note that all the XTZ we provide as liquidity, are automatically staked and we receive staking rewards for them, straight to our wallet. So on top of the rewards from the fees, we also get staking rewards!
To redeem our pool tokens and get back our assets we go to the "Remove liquidity" tab (1), we type the number of pool tokens we want to redeem (2), and then click the "Redeem pool tokens" button (3) and "Confirm" in the pop up window (4).
Impermanent loss, Arbitrage and more
An important part we need to understand, and which you might have heard a lot around Liquidity providing, is the term "Impermanent Loss". The simplest explanation I could give you on impermanent loss is:
Impermanent loss is the difference between the profits we would have by simply holding 2 assets for a specific period of time, compared to the profits we would get if we provided those 2 assets as liquidity in that same period of time.
Let's see a few things in a little more detail and then we will also see an example with numbers to understand it better.
In Dexter, every pair of coins/Tokens has 2 pools, for example the pair of XTZ/USDtz has a pool for the XTZ coins and a seperate pool for the USDtz tokens. The ratio between these 2 pools is what determines the exchange rate between these 2 assets. So let's say if the XTZ pool has a reserve of 100.000 XTZ and the pool of USDtz has a reserve of 200.000 USDtz, then the exchange rate between these assets will be 1 XTZ = 2 USDtz (keep in mind USDtz is a stable coin and 1 USDtz represents $1)
So now lets say that the price of XTZ in other exchanges (Kraken, Coinbase etc) goes from $2 to $3. This price raise will lead to traders that hold USDtz, to trade them for XTZ because the price of XTZ in Dexter is still at $2 (2USDtz). This difference in price between Exchanges, gives the opportunity to traders to buy XTZ for $2 in one exchange and then go sell it for $3 in the other exchange. These differences in the price of an asset between various exchanges is also known as arbitrage opportunities.
So when these trades happen in Dexter, what actually happens is the traders give their USDtz (which go into the USDtz pool of the pair) and they get XTZ (which come out of the XTZ pool of that pair). That leads to a change in the ratio between the 2 pools, and also a change in the exchange rate of these 2 assets in Dexter. The trades will go on until the exchange rate of Dexter comes close to the exchange rate of the other exchanges and there is no longer an arbitrage opportunity. And that's pretty much how the automated market making works in Dexter.
As we said before, when we provide our assets as liquidity to Dexter, we do it at the exchange rate the assets have in that moment. In return we get pool tokens that represent the percentage of our contribution to the 2 pools of the pair. So when the reserves in the pools change, the same thing happens to the assets that correspond to our pool tokens. Let's jump into an example with numbers to understand it better and see where exactly the impermanent loss is.
1) The exchange rate for the pair XTZ / USDtz is 1 XTZ= 2 USDtz.
2) We provide liquidity with 10 XTZ and 20 USDtz which are worth 10*2=$20 and 20*1=$20 so in total 20+20=$40
3) We receive a number of pool tokens for our contribution.
4) After a while, the exchange rate goes to 1 XTZ = $3 and the reserves in the pools of the pair change accordingly.
5) Because of the change in the reserves, our Pool tokens now correspond to 7 ΧΤΖ and 21 USDtz.
6) So at this point, if we redeem our pool tokens, our assets wil be worth 7 ΧΤΖ * $3 = $21 and 21 USDtz * $1 = $21 so in total 21+21= $42
7) If we had just kept the assets in our wallet instead of providing them as liquidity, we would now have: 10 ΧΤΖ * $3 = $30 and 20 USDtz * $1 = $20 so in total 30+20=$50
8) As we see, by providing those starting assets we had to the liquidity pools, we have $8 less profit compared to if we just kept them in our wallet. That's exactly what impermanent loss is.
They call it impermanent because the assets are volatile, so if you don't redeem your pool tokens and the exchange rate drops back down, then you won't have lost any profits and you will be at the same level, with the huge difference that for the whole period that your assets have been sitting in the liquidity pools, you have gained a lot of rewards from the trading fees!
Even in the case that the exchange rate doesn't come back down, if the pair you have chosen to proide liquidity to, has a lot of trades, the rewards from the fees will probably cover the impermanent loss. So depending on the case, impermanent loss is not as bad as it sounds.
That's all folks! Feel free to reach out if you think I left out anything important. You can also find more info about Dexter at dexter.exchange/docs/dexter-intro/.
Heya! I am Crypt0nio and I am a Tezos enthusiast. You can easily find me on Twitter with the twitter handle @Crypt0nio.