Dexter User Guide 2: How To Add Liquidity To Dexter
Note from the Author — We will start with a brief introduction to Constant Product Market Makers, Liquidity pools and explore the important area of impermanent loss before jumping into the user-guide.
This Part 2 guide will concern adding liquidity to Dexter with the XTZ/tzBTC pair and follows on from in Part 1 here, where we looked at making transactions on Dexter.
The next guide which follows this one, will cover removing liquidity, making a new transaction and then adding liquidity to a new pair XTZ/ETHtz.
Please Note: No websites, programs or applications talked about in this tutorial represent endorsements of any kind, thorough research into any applications used on the Internet is to be advised.
This guide represents our own experience ONLY and other users may have different experiences. Users should always undertake their own research and be responsible for their own funds.
XTZ.News makes no representations or warranties of any kind, expressed or implied, about the reliability or suitability of the applications mentioned. This tutorial was written as a user-guide to help people understand Tezos wallet and exchange functions ONLY and does not represent any kind of financial advice.
Automated Market Makers (AMMs) And Constant Product Market Makers (CPMMs)
As already mentioned in the part 1 guide to this series here, Dexter is a decentralized exchange running on Tezos. Dexter is what is called by many an AMM (Automated Market Maker) exchange, but Dexter is also classed as a CPMM (Constant Product Market Maker) exchange.
We covered Automated Market Makers briefly in part 1, but what are Constant Product Market Makers?
Constant Product Market Makers are probably the most popular type of Automated Market Maker exchange and this category includes well-known decentralized exchanges such as Uniswap and Bancor. Dexter is also a type of Constant Product Market Maker.
Constant Product Market Makers work to a formula that is X * Y = K this establishes a price range for two assets (trading on the exchange) according to the available quantity (or liquidity) for each asset.
As Dexter charges a 0.3% trading fee that is added to the liquidity pool, each trade actually increases K in this formula. This is the fee that is used to incentivize liquidity providers to provide liquidity to the different token pools, as they will receive a share of the liquidity pool (including fees gained) they provide when they take their liquidity back out.
This fee is added to the combined value of the liquidity pool, which we will come onto later.
How this works in practice is that when the supply of token X increases, the token supply of Y must decrease, and vice-versa, to maintain the constant product K. This in turn effects the price of these assets.
Introducing Liquidity Pools
As mentioned in part 1, liquidity pools help to make the market. Liquidity providers are users of the decentralized exchange who are incentivized by the receipt of trading fees that get added to the total liquidity of a pool.
These liquidity providers relate to both X and Y in the above formula, as liquidity providers have to provide liquidity on both assets. A liquidity pool represents the liquidity on a specific pair i.e. XTZ/tzBTC or XTZ/ETHtz provided by all participants.
Dexter has trading fees of 0.3% and as trading takes place on a pair, these fees get added to the liquidity pool of that pair in the form of liquidity pool tokens.
Each liquidity provider in a pool can receive a portion of these trading fees depending on how much liquidity they provided in relation to the overall pool. The higher the percentage of the liquidity they provide to a pool, the higher the percentage of trading fees that have accumulated they can receive.
If they provided 5% of the total liquidity pool size in XTZ and tzBTC for a certain period. Then they would earn 5% of all fees that traders paid during that period in that particular pair (in proportion to the rest of the pool). As there is more volume, more fees are paid and therefore you can earn more as a liquidity provider with these conditions.
Being Aware Of ‘Impermanent Loss’
When using decentralized exchanges it’s important to be aware of impermanent loss. This is when you provide liquidity and the price of your deposited assets changes compared to the original price of when you deposited them.
It is basically a metric to determine if you would have been better off to simply hold on to your assets, rather than deposit into liquidity pools.
According to Binance:
“Impermanent loss happens when the price of your tokens changes compared to when you deposited them in the pool. The larger the change is, the bigger the loss. “
In order to mitigate this Dexter provides users with a percentage of the transaction fees (0.3%) in ratio to the amount of users providing liquidity to that pool and the amount of liquidity each of the users added. Users can also stake their XTZ on the platform.
Impermenant loss can happen if assets move price significantly in either direction (Up/Down) and the more divergence in the prices of the assets you deposited into the liquidity pools (in either direction), the greater any impermanent loss will be.
With this in mind, depositing liquidity into more stable assets, such as stablecoins will often result in less impermanent loss, as there will often be less divergence in the price ranges of these pools.
The loss is described as ‘impermanent’ as if the prices of the assets return to the original state as to when you deposited them, then this loss will no longer be relevant and the liquidity provider will still be entitled to their share of the trading fees in the overall pool that had been accumulated in the meantime.
The ‘impermanent loss’ will only become realized once the liquidity provider removes their liquidity from the pool when in an impermanent loss situation.
Impermanent loss can sometimes be counter-acted with the trading fees accrued by being a liquidity provider. In fact, if the pair has enough trading activity it can still be profitable to have added liquidity even with impermanent loss as trading fees accrue to the liquidity provider, but this of course depends on volumes.
Being Aware Of The Market Price
Before adding liquidity check that the price is within acceptable levels according to the market price on other exchanges.
Adding Liquidity To Dexter
In the following guide you will be shown the following:
- How to add liquidity to Dexter for a certain pair (tzBTC/XTZ)
In the next guide which follows this one (Part 3) we will remove the liquidity, make a transaction and then add liquidity to a new pair
- How to remove liquidity for a certain pair (tzBTC/XTZ)
- How to make a trade into a different token (tzBTC > ETHtz)
- How to add liquidity to new pair (ETHtz/XTZ)
In order to add liquidity to Dexter you first need to connect your preferred wallet to the Dexter platform.
As mentioned in the part 1 user guide you can connect many different wallets to Dexter including Thanos (now called Temple), Magma, Kukai and you can also now connect the Galleon wallet to Dexter too. You can also connect other wallets such as Airgap by using the Beacon extension option.
In part 1, it was shown how to make trades on Dexter using the Kukai wallet, and in the process transactions were made to ensure both tzBTC and XTZ assets were in the wallet, in order to be able to provide liquidity to the tzBTC/XTZ pair in this guide (part 2).
With this in mind, the Kukai wallet will be used for this tutorial and it will be presumed by this point you are already familiar with Kukai and have funds in the wallet for both XTZ and tzBTC.
It is recommended that you read the Kukai wallet user guide here and also the Dexter user guide part 1 here, before moving onto the actions in this guide if you don’t have funds ready to add liquidity on Dexter, but wish to add liquidity.
Upon visiting Dexter for the first time you will be presented with a screen similar to the one below where you can learn more about the exchange, once you have read the information you can click on ‘Use Dexter’ as highlighted:
This will then take you into the Dexter exchange where you will be able to ‘Connect Wallet’:
Here you will be given the option to choose the type of Tezos wallet you would like to connect. We are going to be using the Kukai wallet in this example, so we will choose the Kukai option here:
This will take you to the following Kukai page where it will tell you to access the wallet in order to complete the pairing to Dexter.
We are going to select the ‘DirectAuth’ option here as we will be connecting to the Kukai wallet via Twitter.
Once clicking ‘DirectAuth’, we will select the Twitter option shown here:
Once we have signed in we will need to authorize the Kukai wallet app within Twitter:
Once we have authorized the Kukai wallet app within Twitter, the wallet will load up and will start pairing with the Dexter exchange:
The wallet will then pair, and once it is done it will let you know that the pairing has been completed.
Next, permission will be requested to use Kukai on the Dexter exchange.
Simply select the Kukai wallet account you would like to connect to Dexter (if you only have one Kukai wallet account, that will be the default one already selected here), and then click ‘Approve’:
PLEASE NOTE: It’s important to keep your Kukai wallet window open as you will later need to go back into it to authorize any transactions made later.
You can then go back to the Dexter Exchange, with your Kukai wallet, used with Twitter connected.
As already mentioned it will be presumed that you read user guide 1 and that you already have XTZ and tzBTC funds in your account by this point.
This is because you need funds in two different token types (i.e. XTZ and tzBTC, or XTZ and ETHtz) to add liquidity into Dexter to a ‘pair’.
If you need to understand how to transact on Dexter in order to gain funds in two different token types, please read user guide 1, where these steps are outlined.
By this point you should be signed into Dexter with your Kukai wallet and have funds in two different token types, as mentioned we will be using the example of XTZ and tzBTC to start off with.
You can see our starting token balances here:
Now, you will need to click on the ‘Liquidity Pool’ option shown here:
This will then take you into the liquidity pool section, shown here:
You will then need to state how much liquidity you would like to add. You can do this by adding a number to one of the tokens within the pair. As you add a number to one token in the pair, the other token will change to match the value that you entered.
This is because both tokens need to be the same value to get added to the pair, and you will need to add equal amounts to both tokens in the pair.
You can also select the ‘Max’ option, but we always advise that you leave some XTZ left in the account in order to cover any transaction fees etc.
In this example, we will look to add 5 XTZ worth of liquidity. As we type in 5 into the XTZ section, you will see that the tzBTC section automatically calculated a matching value to add for that token too:
You will notice that Dexter will give you a USD price underneath both tokens in the pair and these should match up. Just below this, you will see the conversion rate for the pair.
It will also tell you how many liquidity tokens this amount of liquidity you are depositing will add up to, and what percentage of the pool’s liquidity you will have a share in.
Once you are happy with the figures, you can then select the ‘Add Liquidity’ option shown here:
This will then send confirmation to your Kukai wallet for you to approve:
Here, you will need to go back to your Kukai wallet to preview the liquidity deposit, if you are happy you can select ‘Preview’:
After this, you will then be asked to confirm the liquidity deposit. If you are happy with this, then you can select ‘Confirm’:
You will then be taken to approve the Kukai wallet to take the actions on Twitter:
Once approved on Twitter, the Kukai wallet will proceed to sign the transaction:
Dexter will also let you know that the transaction is pending on the blockchain:
If everything goes through correctly, you will be notified that the addition of liquidity has been successful.
You will also be able to see that you have added liquidity in the ‘Recent Transactions’ section down the left-hand side.
Selecting ‘My Pooled Tokens’ on the view above will take you to an area where you can see how many liquidity tokens you have in different pairs and how much they are redeemable for in the different pairs tokens.
I.e. if you added liquidity to the tzBTC/XTZ pair you will see your liquidity tokens redeemable amounts for both tzBTC and XTZ.
Now you will be able to start earning pool tokens for your liquidity. As people make more and more transactions for the pair you added liquidity for, transaction fees will be added to the total liquidity pool for the pair (0.3%).
Your liquidity tokens represent your share in the total liquidity pool. If the price of the assets diverged significantly from when you deposited them into the liquidity pool these could be some impermanent loss so always bear this in mind.
When you remove your liquidity (depending on how many transactions have taken place, and fees collected) you will be able to redeem your original liquidity pool tokens, plus your share of any transaction fee liquidity pool tokens that got added on top.
As mentioned, we will be covering how to remove liquidity, make a transaction and then add liquidity to a new pair XTZ/ETHtz in the next guide.
Any content found on this website named xtz.news is an opinion of the author who produced the content and is for information purposes only. Any information, or content found within the website xtz.news is not intended to be investment or financial advice. Find our full disclaimer here.