In decentralized exchanges like Uniswap and PancakeSwap, token prices are determined by the constant product formula (x*y=k) in liquidity pools, where the product of the two token reserves remains constant; to control token price, creators must be the first liquidity provider and deploy the pool with appropriate asset ratios, then they can influence price through techniques like setting price floors by locking LP tokens, burning tokens to reduce supply, or conducting buybacks, though larger market caps make price control increasingly difficult as the market ultimately determines value.
Setting Token Prices in Liquidity Pools: Uniswap & PancakeSwap
Added:after you launch your token how can you control its price you might want to control the price at the beginning when you list the token as well as later i'm going to show you how to do this in this video what i will explain applies to uni swap and any of its forks like sushi sua pancake swab etc if you don't know me i'm julian and on eat the blocks i teach blockchain development [Music] before i show you how to control the price of your token you need to understand how the price of tokens is a determined on the decentralized exchanges in a decentralized exchange like uni swap or pancake swap markets are organized in a liquidity pools in each liquidity pool you have two assets for example cake and bnb bnb and busd etc in each liquidity pool traders can buy in both directions for example for the pool cake bnb you can buy some cake by providing some bnb or you can buy some bnb by providing some cake what makes this liquidity pool so special is the concept of automated market maker in an automated market maker the price of the token is determined by a formula this formula is called the constant product formula it's extremely important that you understand this formula if you want to control the price of your token the constant product formula says that at any point the product of the two token reserves must always equal the same amount for example if the two tokens are usdc and cake token and you have 1 000 tokens of each in the pool the product is equal to 1 million if you want to buy some cake tokens after the trade we're going to have less cake tokens and more usdc in the pool we are going to move on the left on this chart for example if you want to buy 200 cake tokens this is the equation that we have to solve which can be rearranged to find the final number of usdc that we have in the pool we also know that before the trade we had 1000 usdc in the pool so we compute the difference and we find the amount of usdc that was necessary to pay in order to buy cake tokens so that's 250 usdc and if you want to calculate the average price that you paid for each cake token but you just divide the number of usdc token that you paid by the number of cake tokens that you got in exchange the average price is 125 per cake token now what if instead of 200k tokens you wanted to buy 500 in this case you would pay 1 000 usdc which means 2 per token so here we learn two important things first the token price depends on the number of tokens you buy which means when someone asks what's the price of a token we cannot give an absolute answer it depends on how much they want to buy second the more token you buy the more expensive the average price will be that's what we call sleepage and at some point the price becomes infinite this guarantees that there will always be a price at which you can buy tokens even though they might not be the quantity of tokens that you want last thing about token prices when someone adds liquidity to the liquidity pool the pricing curve moves upward which means there will be slippage or in other words the price will increase more slowly as you buy more tokens that's it for the basics of token price next we will see how you can set the initial price when you just list your token [Music] to set the initial price for your token you will need to deploy a liquidity to pull on a dex like pancake swap or uni swap and be the first one to provide liquidity once you have deployed your token anybody can deploy a liquidity pool and it doesn't matter who deploys the liquidity pool first however it does matter that you are the first one to provide liquidity an easy way to make sure that you are the first one would be to create a token where you initially own 100 of the total supply to provide liquidity to a liquidity pool you need to have the two assets of the liquidity pool if you are the only owner of the token you are the only one who can provide liquidity at this time the next question is how much liquidity to provide initially to answer this question first we need to understand what happens when you provide liquidity when you provide liquidity you provide the same value of the two assets for example if the assets of our liquidity pool are our token and usdc when you provide liquidity you will provide the same value of tokens via usdc but how can you tell if you provide the same value at the beginning there is no price whatever amounts you send will be considered to have the same value if you send 1 000 usdc and 1000 token that means the initial price of your token is one dollar if you send 10 000 usdc and 1000 token that means the initial price of your token is 10 etc but how can you decide between all these different combinations this is an optimization problem there is no perfect answer what you can do is start with the market cap of the token which value do you think your project should have initially 1 million 2 million 3 million let's say 1 million then you have to decide which price you want initially per token if you want one dollar per token that means the total supply of the token should be one million because one million times one dollar per token equals a one million dollar market cap then you have to decide what is the portion of the total supply that you'll provide as liquidity if you decide to provide 10 percent in our example it means you would provide 100 000 usdc as well as 100 000 tokens in general investors prefer that you provide a large share of the total supply as liquidity because it reduces the risk that that you could destroy the token price in the future for example don't try something crazy like having a 100 billion dollar market cap and provide just a tiny fraction of the liquidity in a decks in this case your market cap is just theoretical and investor notice of course now you know how to set up the initial price but on a practical basis how do you do it you can do it programmatically if you want by calling the add liquidity function of the router smart contract but the most simple is simply to use the interface of your decks this is pancake swap and it works exactly like a uni swap there is a menu to provide liquidity you have to select two assets of the pool the order doesn't matter for your token you have to copy paste the address you type the amount you want for each asset you validate and metamask will ask you to confirm some transactions there should be three transactions one to approve your token to be spent by the dex one to approve the other asset to be spent by the dex and the call to the add liquidity function of the router after that you will receive what is called some lp tokens to your address at any time you can redeem these tokens against the assets that you initially provided you will not get back exactly the amount that you provided but it will depend on the current price at the moment of withdrawing your liquidity you will also collect your share of the trading fees at the moment of restoring your liquidity so that's it for setting up the initial price of your token and next i'm going to show you how you can manage the price during the lifetime of the token [Music] after you created the liquidity pool and provided the initial liquidity anybody is free to buy or sell your tokens which will make the price flip to it in other words you lose control of the price but there are still a couple of techniques you can use to influence the price in a positive way and i'm going to show you this the first technique is to set a price floor with a price floor you can guarantee that the price of the token will not go below a certain value to do this the first step is to provide 100 of the total supply of the token as liquidity in our previous example we had a token with a total supply of one million and an initial price of one dollar if you want to set a price of one dollar you will need to provide to the liquidity pool 1 million tokens and 1 million usdc at the beginning nobody can sell the token since the entire supply was provided as liquidity traders can only buy the token as they buy tokens there will be less tokens and more usdc in the pool which will make the price of the token go up above one dollar in the future in the worst case scenario if all buyers sell their tokens we will go back to the initial situation with 1 million usdc and 1 million tokens in the pool with a token price of 1 however there is a flow in the system what if you the provider of the initial liquidity decide to withdraw your liquidity you would destroy the price floor it's not enough to just promise your community that you will not withdraw the liquidity we're crypto people and we don't rely on any individual we only trust code if you want to do a real price floor you need to lock the lp token in a smart contract if you log the lp token forever it means you will never be able to sell your tokens it's as if you made a donation of the entire supply along with the usdc you provided it's probably not what you want instead you could lock the lp tokens for a certain time with a timelock contract i provided the code for this in the github repo of eat the blocks all you have to do is to send your lp tokens to this timelock contract and specify a duration a lp token respect the interface of es20 token so it's very easy to manipulate and once you reach expiration you can withdraw your lp tokens but that also means that the price floor of your token is only valid up to the expiration of the time lock after you can do whatever you want with the lp tokens there is no guarantee for your traders anymore you could do something a bit more sophisticated where you release only a part of the lp tokens at a different expiration dates but i'll leave this to you as an exercise what else can you do to support the price of your token you could burn some of the tokens which simply mean you send some tokens to an address that nobody controls like the zero address that would decrease the total supply of tokens in circulation which would increase the price of the token but there were a couple of studies that showed that token burns weren't very effective to support the price of tokens and the last possibility is to do token buybacks with stock and buybacks you simply buy some of your own token in the liquidity pool you can do this with your own money of course but you can also use the profits of your project for this for example if you project earn some trading fees you could use this money for buying your token in d5 there are a couple of projects which did this and outside of d5 we also have a couple of examples of this like apple which is famous for using a treasury to do stock buybacks now you understand how the price of a token is a determined you also know how to set the initial price of a token and how to influence its price after keep in mind that the bigger the market cap of your token the more difficult it will be to control its price at some point once the market cap becomes too big it becomes impossible to control the price of your token ultimately the market decides what's the price of token and as the creator of the token the best thing you can do is just build useful features communicate well and convince the market that your token has some value next if you need a refresher on how you can create your own token you can watch this video this is a tutorial for beginner where we create a bep20 token for the binance machine i will see you there
Up Next

What Is Gas? Ethereum Transaction Fees Explained
@Finematics
331.9K views•2021-02-20

Torrent File Format & Bencoding: A Technical Deep Dive
@AsliEngineering
12.5K views•2022-08-08

Solidity Timelock Contract Tutorial: Delaying Transactions Securely
@EatTheBlocks
6.7K views•2022-08-02

Understanding Ethereum: A Comprehensive Beginner's Overview
@99Bitcoins
3.1M views•2018-06-26
Related Study Plans & Knowledge Roadmaps
Structured learning paths in Blockchain & Crypto













![[TUTORIAL] COMO PEGAR SEU ENDEREÇO BEP-20 ( BINANCE SMARTCHAIN ) & ERC-20 (ETHEREUM) #TRUSTWALLET](https://i.ytimg.com/vi_webp/oMwuaaV1e4g/maxresdefault.webp)















![Impermanent Loss Einfach Erklärt auf deutsch [Bitcoin, Uniswap, DeFi, DeFi-Chain]](https://i.ytimg.com/vi_webp/uvzEN67nMrE/maxresdefault.webp)









