Token liquidity, AMM & Presales

Dexpanse
17 min readFeb 11, 2022

--

Disclaimer: This article is for educational purposes only. Dexpanse does not endorse or is not in any way associated with any of the tokens, platforms, services or projects mentioned in this article, nor does Dexpanse take any responsibility for the proper functioning of these services and platforms. The information provided through Dexpanse does not constitute advice or recommendation of investment or trading. Dexpanse does not take responsibility for any of your investment decisions. Please seek professional advice before taking financial risks.

Suppose that you’ve created a token (we will explain how to do that in a future article), let’s name it “Best Token“ — BST and now you want others to be able to buy your token. Great! …but how do you enable others to buy and sell Best Token. Well… you could redistribute or sell the token yourself, but then if anybody wanted to buy or sell it, they would need to actively find a willing person to take part in the transaction, and that person would have to agree on a price — a very bothersome process, which can hardly be reminiscent of an open market. You could list your token on one of the major exchanges, such as Binance, but this can be a very costly and resource consuming thing to do. Fortunately, there is a third way that’s relatively simple and efficient and it involves providing liquidity through an Automated Market Maker (AMM) protocol.

Automated Market Makers

In a traditional trading environment in order for a transaction to happen, two parties must be willing to complete a transaction under previously agreed upon conditions. With the help of an AMM, you do not need another party to complete a transaction. Instead you interact with a smartcontract that trades with you through the use of an internal algorithm . The AMM is essentially software code that “owns” a certain amount of a pair of tokens and enables users to interact with it to swap one token for another from its liquidity pool (its stock of tokens).

Example: Buying from an AMM

Let’s see how this would look like with Best Token as an example. Presuming that you’ve created Best Token on the Binance Smart Chain, an AMM for your token would probably contain a BST/BNB (https://academy.binance.com/en/articles/what-is-bnb) or a BST/BUSD pair (https://academy.binance.com/en/articles/what-is-busd). To make things a little bit easier we will choose the BST/BUSD pair, as the price of 1 BUSD is pegged to the value of 1 US dollar and hence is not as volatile.

One of the most basic algorithms for determining prices for transactions on AMM’s is:

x * y = k

where x and y are the respective supplies of tokens in the pair and k is a constant. Now, let’s assume that our AMM initially owns 1,000 BUSD and 100 BST (meaning that 1 BST is worth a whooping 10 USD!). Thus, it is easy to figure out the value of the constant k which must be 100,000 (1,000 * 100). If Alice wants to buy 10 BST then we can easily calculate how much BUSD she has to pay, since we know that the value of k must remain constant and that after the transaction 90 BST will be left in the liquidity pool:

AMM_BUSD_SUPPLY * AMM_BST_SUPPLY = k
AMM_BUSD_SUPPLY * 90 = 100,000
AMM_BUSD_SUPPLY = 100,000 / 90
AMM_BUSD_SUPPLY = 1,111.11 (rounded up to 2 decimal places)

Since the initial amount of BUSD in the pool was 1,000, it can be resolved that Alice must pay 111.11 BUSD to receive 10 BST, and so the unit price per BST which Alice paid is 11.11 BUSD. Also, since after Alice’s transaction the liquidity pool is composed of 1,111.11 BUSD and 90 BST, we can easily figure out that 1 BST is now worth around 12.35 BUSD.

BST_UNIT_WORTH = AMM_BUSD_SUPPLY / AMM_BST_SUPPLY
BST_UNIT_WORTH = 1,111.11 / 90
BST_UNIT_WORTH = 12.35 (rounded up to 2 decimal places)

Low liquidity problems

As you’ve probably noticed the price that Alice paid is in contradiction to what we established earlier when we wrote that 1 BST is worth 10 BUSD. The cause of this price inconsistency is called slippage (https://academy.binance.com/en/articles/bid-ask-spread-and-slippage-explained). Because every trade transaction with the AMM actually changes the contents of its liquidity pool, the transaction itself effects the price of the tokens purchased (or sold). The bigger the transaction, the bigger the slippage. Of course with relatively small transactions carried out on AMM’s with large liquidity pools the slippage will be negligible. However, remember that since a token, an AMM instance, or even an entire decentralized exchange protocol can be created by anyone, in some cases the liquidity can be very small, so always make sure to verify it before carrying out any transaction.

It is also worth noting that slippage caused by low liquidity is detrimental regardless if we are selling the token or buying it. Coming back to our example, we have previously established that 1 BST is worth 12.35 BUSD after Alice’s transaction. Now let us say that Bob who has earlier acquired 20 BST wants to sell his assets. By simply multiplying the amount of BST he wants to sell by the unit worth of 1 BST on this AMM we would expect that he’d receive 247 BUSD.

20 * 12.35 = 247

Putting our newly found knowledge to use, we can calculate how much BUSD Bob will actually receive:

AMM_BUSD_SUPPLY * AMM_BST_SUPPLY = k
AMM_BUSD_SUPPLY * (90 + 20) = 100,000
AMM_BUSD_SUPPLY = 100,000 / 110
AMM_BUSD_SUPPLY = 909.09 (rounded up to 2 decimal places)

Before the transaction, the supply of BUSD in the AMM was 1,111.11, and after completing the transaction it must be equal to 909.09, so Bob will receive 202.02 BUSD, instead of the 247 we would potentially expect.

Please note that we have used relatively small numbers in our example to improve its readability, however in most real case scenarios the supply of tokens in a given liquidity pool is often gargantuan (for instance 10¹⁵), and meme tokens generally have unit prices at minuscule fractions of a US cent. Additionally, many tokens incorporate additional “taxes” — fees that are added to the price of each transaction and so the actual amount of tokens that one receives after interacting with an AMM might be a bit smaller than what was calculated through the AMM algorithm.

Maintaining and adding liquidity

As you might have figured out by now, due to the very nature of the basic AMM algorithm it is impossible to completely deplete a liquidity pool of one token just by trading with it. The price will just increase exponentially to infinity as we buy more of the token. This can be quickly illustrated with an example. If, after Alice’s and Bob’s transactions, Carol wants to buy 100 BST then we can quickly calculate how much she will have to pay.

AMM_BUSD_SUPPLY * AMM_BST_SUPPLY = k
AMM_BUSD_SUPPLY * (110–100) = 100,000
AMM_BUSD_SUPPLY * 10 = 100,000
AMM_BUSD_SUPPLY = 100,000 / 10
AMM_BUSD_SUPPLY = 10,000

Since we had 909.09 BUSD in the pool before, we concur that Carol has to pay 9090.91 BUSD for 100 BST, thus achieving a not-so-great unit price of about 90.91 BUSD per BST token. But, let’s take this even further, shall we? What if Carol wanted to buy 9.99 of the remaining 10 BST in the AMM?

AMM_BUSD_SUPPLY * AMM_BST_SUPPLY = k
AMM_BUSD_SUPPLY * (10–9.99) = 100,000
AMM_BUSD_SUPPLY * 0.01 = 100,000
AMM_BUSD_SUPPLY = 100,000 / 0.01
AMM_BUSD_SUPPLY = 10,000,000

Subtracting the 10,000 BUSD which were already in the liquidity pool, we observe that Carol must now pay a mind-blowing 9,990,000 BUSD to buy 9.99 BST. This means that after the transaction the unit worth of 1 BST is now way above that of Bitcoin (at least according to February 2022 prices)!

While such volatility might be great for people like Alice who have bought the token early and can now sell at a massively inflated price, it severely hinders the market growth of the token and can scare off potential investors. One way to deal with this problem is with arbitrage (https://academy.binance.com/en/articles/what-is-arbitrage-trading). If our token is available on multiple exchanges (decentralized or not) then any significant divergence in the price of the token on a given AMM from other markets will work as a powerful incentive for traders to buy/sell the token to even out any price differences across exchanges and earn some additional low-risk funds.

However, let’s assume that we have only created one AMM for Best Token, and that it is not listed anywhere else. Well, we can always add liquidity. Even better, anyone can add liquidity! In practice, this means adding an equal value’s worth of each of a token pair to the liquidity pool. Returning to our example, if we were to add liquidity to the BST/BUSD pair before Alice’s, Bob’s and Carol’s transactions, we would have to add BST and BUSD in amounts corresponding to the 100:1,000 proportion. So, for each BST that we would like to add to the pair, we would need to add 10 BUSD. Thus, to increase the liquidity by 20% we would have to add 20 BST and 200 BUSD to the AMM. As you can quickly ascertain, such a transaction does not alter the relative worth of the token, but it does change the value of k. So, to reiterate, k is constant for buy/sell transactions with the AMM, but if liquidity is added (or subtracted) then k does change.

But why would anybody else, apart from the token creator, want to add liquidity to an AMM? Perhaps surprisingly, taxes are the answer. Most decentralized AMM protocols have inbuilt functions that collect an additional percentage fee for each buy/sell transaction and then redistribute these funds to so-called liquidity providers. The AMM knows which wallet addresses should be rewarded thanks to LP tokens. Every time a user adds liquidity they receive LP tokens in an amount corresponding to the amount of liquidity that they added. The rewards from liquidity provider taxes are then calculated based on the percentage of LP tokens that a given wallet address holds.

The unnecessary, intermediate section: the section in this block is optional for reading and can be skipped, it explores some of the technicalities of adding liquidity and the risk associated with impermanent loss.Adding Liquidity — Example
For example, if Dan decided to add the aforementioned 20% additional liquidity before Alice’s transaction, he would receive a number of LP tokens amounting to 1/6th of the total number of LP tokens minted (0.2 of 1.2 is 1/6). Now, supposing that our AMM has a 0.3% LP provider fee (the value of Uniswap's initial fee) and Alice’s transaction was worth 111.11 BUSD, then we can calculate that the LP provider fee from this transaction is around 0.33 BUSD, out of which 1/6th (around 0.055 BUSD) will be rewarded to DAN. While this might not seem as much, multiple small fees can quickly add up to significant returns on active AMM.
Of course it should be stated that you can use your LP tokens at any moment to get back your added liquidity (along with your accumulated fees). But, there is a caveat - you do not receive the same exact amounts of both tokens of the pair that you had earlier added. Your stock of owned LP tokens represents a percentage of the total liquidity owned, and what you receive back when withdrawing liquidity is that same percentage amount of the total number of each of the tokens in the AMM. Let’s return to our example again. Supposing that nobody else added any more liquidity (nor withdrew any) after Dan, but that through a myriad of buy/sell transaction, and a great marketing success of Best Token, the AMM has now come to contain 20 BST and 7,200 BUSD (note, that after Dan added his liquidity the k constant was 120 * 1,200 = 144,000 and it is still the same: 20 * 7,200 = 144,000 ). If Dan now wants to return his LP tokens, then he will still receive 1/6th of the total liquidity, which now corresponds to about 3.33 BST and 1,200 BUSD, a completely different set than the 20 BST and 200 BUSD that he had previously invested. Additionally, Dan will receive 1/6th of all the accumulated LP provider fees accrued during this time.Impermanent Loss
Unfortunately, providing liquidity is not without risk, as any change in the price ratio between the token pair will actually diminish our returns, and can even lead to significant losses through a process called Impermanent Loss. This can be very easily illustrated with Dan’s case. After returning his LP token’s Dan can now sell his remaining 3.33 BST and combine that with the 1,200 BUSD received to consolidate his earnings. We can thus easily calculate that Dan’s investment has generated a total of 2,199 BUSD.
new AMM_BST_SUPPLY = 20 - 3.33 = 16.67
new AMM_BUSD_SUPPLY = 7,200 - 1,200 = 6,000
new constant k = 16.67 * 6,000 = 100,020
NOTE: the variation of k from 100,000 is due to our previous rounding to 2 decimal places)
AMM_BUSD_SUPPLY * AMM_BST_SUPPLY = k
AMM_BUSD_SUPPLY * (16.67 + 3.33) = 100,020
AMM_BUSD_SUPPLY * 20 = 100,020
AMM_BUSD_SUPPLY = 100,020 / 20
AMM_BUSD_SUPPLY = 5,001
DAN receives: 6,000 - 5,001 = 999 [BUSD]However, if in an alternate reality Dan had refrained from adding liquidity and had held his tokens and had the price of BST still gone up to 360 BUSD (7,200 / 20 = 360) only with lower liquidity, then he would have kept his 200 BUSD and additionally could now receive 3,272.43 BUSD by selling his 20 BST.AMM_BUSD_SUPPLY * AMM_BST_SUPPLY = k
AMM_BUSD_SUPPLY * (16.67 + 20) = 100,020
AMM_BUSD_SUPPLY * 36.67 = 100,020
AMM_BUSD_SUPPLY = 100,020 / 36.67
AMM_BUSD_SUPPLY = 2,727.57 (rounded up to 2 decimal places)
6,000 - 2,727.57 = 3,272.43 [BUSD]Thus, if Dan had kept his tokens, he would now have 3,472.43 BUSD, much more than the 2,199 earned by adding liquidity. Of course, Dan’s accrued fee’s as one of the principal liquidity providers are not taken into account here. Nevertheless, impermanent loss is a risk that one must take into consideration when adding liquidity to an AMM. More information on this matter can be found here: https://academy.binance.com/en/articles/impermanent-loss-explained.

The specific way that liquidity and LP tokens work leads us to two more major issues that need to be addressed. First, something that you might have already asked yourself in you head — how do I get the initial liquidity into the AMM in the first place and do I have to pay all of it upfront? Before we get down to answering that question let’s first quickly identify the second issue. You see, the problem is that LP tokens are also minted when the initial liquidity is provided to the AMM. This brings about a very serious risk, as anybody who controls these LP tokens can withdraw all of the liquidity instantly. So, if nobody else has added liquidity to the AMM, after some people have invested in the token, a mischievous token creator can return all of their LP tokens and withdraw all of the tokens from both pairs in the liquidity pool. This is known as a rug-pull and is a very popular scam that you must be wary of (https://academy.binance.com/en/glossary/rug-pull). Fortunately, there is a simple way to solve both of these issues. The answer is Dexpanse’s Presale service.

Presales

The interface of Dexpanse’s presale service
Dexpanse’s presale service

Who said that you need to collect all the funds needed for initial liquidity yourself? This is exactly what presale platforms (or launchpads) are for. Through marketing and by having a genuinely good idea and roadmap you can create a vigorous community of followers who will want to invest in your project. A presale enables them to buy your token at a set, discounted price before the token is actually launched on an AMM and open for trading. With Dexpanse’s Presale Service (https://dexpanse.io/presales/) you can safely create and schedule a presale for your token in mere minutes with no coding knowledge required.

However, before we get into the details, we must still address the first aforementioned issue of avoiding rugpulls, how does a Dexpanse presale help with that? The answer is locking liquidity — Dexpanse’s Locker service, which is also integrated into the Presale service, enables the presale creator to lock the LP tokens minted as a result of creating the initial liquidity. As this process is ingrained into the blockchain itself, there is no way that anybody can unlock these LP tokens before that time passes. By having the LP tokens locked, presale participants and other future investors of the project can rest easy, knowing that all the liquidity will not be abruptly stolen. Is is very important to note that this does not mean that a project is necessarily safe as scammers can find other ways to steal invested funds. Always do your own research before investing in any given project or token. Having said that, let us now explore the process of creating a presale on Dexpanse in more detail.

The token address verification system on Dexpanse
The token address verification system on Dexpanse

Well, first things first and, as was stated at the beginning of this article, you must already have a token to be able to create a presale for it (https://expanse13.atlassian.net/wiki/spaces/EXPANSE/pages/11206678). After connecting your virtual wallet and confirming that you do actually own a given amount of the tokens, you can now proceed to fill in all of the following parameters. To illustrate what each presale parameter actually means and does a little bit easier, we will pretend that we are creating a presale for Best Token.

Basic presale parameters on Dexpanse’s presale platform
Basic presale parameters on Dexpanse’s presale platform
  • Token address — the actual address of Best Token. Remember to be on the correct network on Metamask (or different supported wallet)!
  • Base token to use — The base token that you want to pair with Best Token. You are not constrained to the BST/BUSD pair. Dexpanse currently supports BNB, BUSD and USDT as base tokens on the Binance Smart Chain network
  • Softcap — the amount of BUSD (or other chosen base tokens) that needs to be raised for the presale to be considered successful. If the softcap is not reached by the end of the presale, then the presale is considered as failed and all participants can recover their funds.
  • Hardcap — the maximum amount of BUSD (or other chosen base tokens) that can be raised in the presale. Once the hardcap is reached, the presale ends and participants can then withdraw however many Best Tokens they bought.
  • Spend limit — the maximum amount of BUSD (or other chosen base tokens) that one presale participant can spend in the presale. In the example from the screenshots, we can see that this parameter is set to 1000 and, knowing that the Presale rate (will be explained later) is 1 BUSD = 0.10 BST, we can deduce that each presale participant can buy 100 BST.
  • Number of tokens for sale — this is the number of Best Tokens that we wish to put up for sale for the presale participants. The slider below the input represents this number as a percentage of the total supply of Best Token. Note that this number only represents the number of tokens that are sold to other users in the presale, and we must still have enough tokens left for initial liquidity.
  • Presale rate — this is not a parameter that we can change directly, but it is rather calculated by dividing the number of tokens for sale by the hardcap. It represents the actual rate (price) at which presale participants will buy Best Token. Based on the screenshot above, we see that each presale participant will be able to buy 0.1 BST for each BUSD, or in other words, will have to pay 10 BUSD for each 1 BST bought.
More presale parameters on Dexpanse.
More presale parameters on Dexpanse.
  • Listing rate — this is the initial price (or rather liquidity pool ratio) that Best Token will have on the created AMM just after the presale has finished. Looking at the listing rate of 0.08 from the screenshot above, it basically means that once the presale is completed one will be able to exchange 1 BUSD for 0.08 BST on the chosen Dex (decentralized exchange), minus slippage of course. Or to turn this around: 1 BST will be worth 12.5 BUSD. Moving the slider to the right allows you to reduce the initial price after adding liquidity, where 0% (when the slider is on the far left) indicates an identical price to the presale price, and moving the slider all the way to the right increases the initial price by 60%.
  • To be used for liquidity (Liquidity Percent) — this is a percentage value representing what part of the collected BUSD (or other chosen base token) will be used for providing initial liquidity. So, supposing that we left this value at 70% and that the Best Token presale was a great sucess in which the hardcap of 60,000 BUSD was reached in mere minutes, we can calculate that 42,000 BUSD will be inserted into the AMM as initial liquidity.
  • Presale start — this is simply the date and time (in our system local time) that we want to schedule for the start of our presale.
  • Presale end — this is simply the date and time (in our system local time) that we want to schedule for the end of our presale.
  • Liquidity lock duration — the time duration that the LP tokens minted as a result of providing initial liquidity will be locked for. Remember that you should have a good reason (such as potential liquidity migration) for setting this parameter at a low value, as otherwise it might make potential investors lose trust in your project.
  • Dex to use — the decentralized exchange protocol to be used to create the AMM. At the moment most blockchains have one leading dex, such as Pancakeswap (https://pancakeswap.finance/) on Binance Smart Chain. However, in some cases there is fierce competition, such as Sushiswap and Uniswap on Ethereum. Dexpanse’s platform will strive to offer as many verified dexes as possible.
  • Unsold token strategy — if the presale ends in success but the hardcap is not reached (i.e. you did not sell all of the tokens that were available to be sold), then the remaining tokens can either be refunded to you — the presale owner or they can be burned, in which case nobody will ever be able to claim them.
  • Whitelist — you have a choice to make the presale private. By turning on the whitelist feature, you can choose (by inputting their wallet addresses) which users will be able to take part in the presale. Note, that you can start the presale as private, and then after a set amount of time disable the whitelist feature to let anybody take part.
Dexpanse’s presale simulator
Dexpanse’s presale simulator

After having input the aforementioned parameters you can now use Dexpanse’s simulator feature to check how much liquidity will be generated and what the fees will be depending on the final state of the presale. It is also worth noting that Dexpanse’s platform enables you to input some additional data concerning your token that will be visible to the presale participants. This data includes: the token logo, a short description and the token’s website and social media pages

Why choose Dexpanse?

A man using Dexpanse
Dexpanse is the right choice!

At Dexpanse we believe in transparency and providing streamlined, secure services. Because of that, unlike many of our competitors, we do not charge any token fees whatsoever. Why is this important, you may ask? Well, as can be easily seen by exploring a given blockchain — the tokens acquired through these fees are often quickly dumped (sold, all at once) right after the presale finishes, which results in an almost immediate reduction in price and can scare of many would-be investors. Dexpanse charges a small, flat fee to create a presale, and only if that presale is successful will Dexpanse then charge an additional fee that is calculated as a small percentage of the total amount of base tokens collected (in the BST/BUSD presale it would be 2% of the total BUSD collected). This fee has no effect on the actual liquidity of the AMM and does not impact the token’s economy in any way.

As always, we are open to comments, suggestions, and will gladly answer any of your questions, so please do not hesitate to contact us at team@dexpanse.io

-Dexpanse Team

--

--

Dexpanse
Dexpanse

Written by Dexpanse

Dexpanse: the ultimate decentralized platform. With us you will be able to create your own tokens, launch them in a presale or just learn about the Defi world.

No responses yet