Jump to content

Calculating the number of LPs returned or the pair quantities for 1 LP.


inXs

Recommended Posts

I am trying to figure out how to calculate LPs.

For instance, the current prices are

SGB = $0.2314
CAND = $1

How do I calculate the number of SGB and CAND needed for 1 SGB/CAND LP?
e.g. What formula is being used to calculate the following?

According to FlareX Liquidity SGB/CAND pool the Remove of 1 LP is...
1 SGB/CAND LP = 3.2149 SGB + 0.395 CAND

Link to comment
Share on other sites

34 minutes ago, inXs said:

I am trying to figure out how to calculate LPs.

For instance, the current prices are

SGB = $0.2314
CAND = $1

How do I calculate the number of SGB and CAND needed for 1 SGB/CAND LP?
e.g. What formula is being used to calculate the following?

According to FlareX Liquidity SGB/CAND pool the Remove of 1 LP is...
1 SGB/CAND LP = 3.2149 SGB + 0.395 CAND

you should look at the totalSupply and the total reserve of both tokens:

totSupply = 7,373,128.19 

reserve_SGB = 23,899,445.776

reserve_CAND = 2,889,250.578

1 SGB/CAND LP = (reserve_SGB/totalSupply) SGB + (reserve_CAND/totalSupply) CAND

Link to comment
Share on other sites

39 minutes ago, jn_r said:

you should look at the totalSupply and the total reserve of both tokens:

totSupply = 7,373,128.19 

reserve_SGB = 23,899,445.776

reserve_CAND = 2,889,250.578

1 SGB/CAND LP = (reserve_SGB/totalSupply) SGB + (reserve_CAND/totalSupply) CAND

Thanks jn_r !

I am not sure where these reserve and supply numbers are listed if not yet participating in the LP.

Link to comment
Share on other sites

3 minutes ago, inXs said:

Thanks jn_r !

I am not sure where these reserve and supply numbers are listed if not yet participating in the LP.

you can find the on songbird explorer. The CAND/SGB LP address is 0x47C830E141234d029D953dF39B13d7728eB9f2d4

The amount of tokens can be found here: https://songbird-explorer.flare.network/address/0x47C830E141234d029D953dF39B13d7728eB9f2d4/tokens

And the total Supply can be found here: https://songbird-explorer.flare.network/token/0x47C830E141234d029D953dF39B13d7728eB9f2d4/token-transfers

If the liquidity pool does not exist yet, that's an edge case. The first person decides on the price and stakes an amount of tokenx and an amount of tokeny. In that case a number must be chosen, they usually take something like the sqrt from (amount_tokenx * amount_tokeny)

Link to comment
Share on other sites

You normally don't think about how many LP tokens you want to buy. You think in terms of how much you want to put in. So if you want to put in $100-worth into the pool, you can go to the provide liquidity page and put in 50 for CAND (half of the $100) and it will tell you how much SGB you need to provide to match it. Alternatively, if you know you want to put in a certain amount of SGB, enter that and it will tell you how much CAND you need to add. However much you provide, both sides will have the same dollar value.

Link to comment
Share on other sites

 

Thanks again jn_r !!  I don't want to waste your time and got my main questions down to these...

1. Where did you find the SGB/CAND address?

2. You introduced a new term "amount of tokens".  Is "amount of tokens" the same as "total supply" in your formula?

3.  Is this correct?  "Total Supply" is the number of LP tokens (SGB/CAND in our case), and not the supply of SGB.
Although you mentioned "you should look at the totalSupply and the total reserve of both tokens:"  Made me think of the total supply of SGB and the total supply of CAND.  but instead you provided a link to the "Total Supply" of SGB/CAND LPs?

4.  Is the following formula correct?
In your formula I wasn't sure if the "SGB" and "CAND" that are listed outside the parenthesis were comments or a quantity, or price.  I removed them and added "LP" to total supply for the SGB/CAND pair in my interpretation below.

1 SGB/CAND LP = (reserveSGB / Total LP supply) + (reserveCAND / Total LP supply)

And thank you for the time you spent on me already jr_n

Screenshot 2022-01-17 104015.jpg

Edited by inXs
Link to comment
Share on other sites

5 hours ago, inXs said:

1. Where did you find the SGB/CAND address?

One way is checking #setup-guides in the discord, another is after having done a transaction to the LP, check with which account your own account transacted via the songbird-explorer. 

5 hours ago, inXs said:

2. You introduced a new term "amount of tokens".  Is "amount of tokens" the same as "total supply" in your formula?

No, it's not. the LP is a contract that holds these tokens itself. The LP contract holds 2 'buckets' of tokens. When you 'swap', you add a little to the tokenA token and you take a little from the tokenB bucket. you can find the amount of these token buckets also in songbird-explorer, under the specifics of the LP in question via the button 'tokens'.

5 hours ago, inXs said:

3.  Is this correct?  "Total Supply" is the number of LP tokens (SGB/CAND in our case), and not the supply of SGB.
Although you mentioned "you should look at the totalSupply and the total reserve of both tokens:"  Made me think of the total supply of SGB and the total supply of CAND.  but instead you provided a link to the "Total Supply" of SGB/CAND LPs?

That is correct. The 2 buckets are separate from the totalSupply of the LP token itself.

5 hours ago, inXs said:

4.  Is the following formula correct?
In your formula I wasn't sure if the "SGB" and "CAND" that are listed outside the parenthesis were comments or a quantity, or price.  I removed them and added "LP" to total supply for the SGB/CAND pair in my interpretation below.

1 SGB/CAND LP = (reserveSGB / Total LP supply) + (reserveCAND / Total LP supply)

No, it was meant as 1 LP token is equal to so many SGB tokens and so many CAND tokens. Meaning, if you remove 1 LP token then you would receive so many SGB tokens and so many CAND tokens.

 

I think Brianwalden does have a point :-) the LP tokens in itself don't mean much.

Anyways, if you want to know more, there is lots of information to be found on the internet on how AMM's (Automated Market Maker) work, if you find that interesting it's worth to watch or read a view. 

Edited by jn_r
Link to comment
Share on other sites

×
×
  • Create New...