Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Could not create a position for a pool with 1:1 ratio when token0.decimals != token1.decimals #8679

Open
BoThe1K opened this issue Sep 6, 2024 · 4 comments
Assignees

Comments

@BoThe1K
Copy link

BoThe1K commented Sep 6, 2024

Hi! I have used instructions https://docs.osmosis.zone/overview/integrate/pool-setup#join-pool for pool creation and created a supercharged liquidity pool with Osmosis token (6 decimals) and my ibc token (18 decimals) for the full range (-108000000 : 342000000) for 1:1 price ( I have expected that it will be 1:1):

https://www.mintscan.io/osmosis/address/osmo1yfuqh7z885u4jaj7su4a7qdd7psn3a420jy835

pool-id: 2168
position-id: 8138960

But pool showing current_tick is -108000001 (expected to be 0 as I wanted to 1:1)

pool:
  '@type': /osmosis.concentratedliquidity.v1beta1.Pool
  address: osmo1tjjxzr4fwmqnwe4mlqz8q6pwu4kexzjftpgq0jnglazfdg2lj0fq64rvs2
  current_sqrt_price: "0.000001000000000000000000000000000000"
  current_tick: "-108000001"
  current_tick_liquidity: "0.000000000000000000"
  exponent_at_price_one: "-6"
  id: "2168"
  incentives_address: osmo16eym3u4h2hx4rqg0kgtfulyfl0a2ahg07jjvmkgcp3qf0yy497hsdh3rve
  last_liquidity_update: "2024-09-06T14:35:21.230983192Z"
  spread_factor: "0.001000000000000000"
  spread_rewards_address: osmo1em89gxdw97jwc03dh3grcws0dht3ev62phaq55n0fewnsw96a0xsmjlymm
  tick_spacing: "100"
  token0: ibc/ABD49F44559CB3E557CC458459CB6A67CEBD66E23C7674A0B2B445230BDA1F6C
  token1: uosmo

So how to make it 1:1 ratio if there is a difference of the decimals?
Is this related to a decimals and I could only use a IBC token with 6 decimals as uosmo?

@mattverse mattverse self-assigned this Sep 10, 2024
@mattverse
Copy link
Member

Hello, after giving the pool a look, it seems like there were some transactions on the pool which moved the tick to -108000001?

Also a 1:1 price ratio would not necessarily mean that the tick should be always at 0, as it represents a price range and is based on logarithmic scale

@BoThe1K
Copy link
Author

BoThe1K commented Sep 11, 2024

@mattverse the problem that as a tick on -108000001 so we could swap in osmosis only and not our token (because we already on minimum tick at the start). We expecting that we could also swap our token to osmosis and viseversa until the price will reach 0 or some big number (infinite). Right now the maximum price is 10^12(at tick -108000000) for wei/uosmo which can't become bigger. but 1stos=10^18wei and 1osmo = 10^6uosmo. it means currently the maximum price can only lead to 1:1 for stos/osmo, we can't achieve 2:1 for stos:osmo

@mattverse
Copy link
Member

mattverse commented Sep 13, 2024

because we already on minimum tick at the start

Just for clarity, tick is at 0 upon initialization of a concentrated liquidity pool, https://github.com/osmosis-labs/osmosis/blob/main/x/concentrated-liquidity/model/pool.go#L47. By looking at the pool you have created, it seems that the reason that the tick is at -108000001 is because there were some swaps in the pool.

But regardless, if you guys want to resolve the issue of achieving a specific ratio, you guys should calculate and increase tick spacing of the pool, this should allow the price to move faster across ticks and help achieve higher stos ratio as you have mentioned

@alexstratos
Copy link

alexstratos commented Sep 16, 2024

so before I did the swap, the tick is at -108000000 at very beginning when I created the first position. you can see that when I created the position, https://www.mintscan.io/osmosis/tx/51DA6BA5BD25C8E93B5804A3AACD9BA576F3045D0321D27314D21CB673145FF0?height=20409100, the tx log shows that no osmo token was sent to the position at all, which only takes in 100stos token. At this time, the price of wei:uosmo is already 10^12.

so I swap osmo token in 2 times with total of 46.7*2 osmo. that swapped out 47stos in total. then I swap in 60stos which make the tick to -108000001 and drained the osmo in the pool.

You suggest that changing spacing will solve the problem, but I don't understand how? Do you mind to explain a bit more? Given that the tick spacing only changes the price changes speed instead enlarge the tick maximum range. Given that the current problem is the minimum tick of -108000001 only leads to a maximum price of 10^12.

Do you have any example of other pool that the token have different decimals?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage 🔍
Development

No branches or pull requests

4 participants
@mattverse @alexstratos @BoThe1K and others