osmosis-frontend icon indicating copy to clipboard operation
osmosis-frontend copied to clipboard

Fix pricing issues where token out value is greater than token in value in USDC

Open p0mvn opened this issue 11 months ago • 3 comments

For many token pairs, we have USDC value of token out displayed as being greater than the value of token in.

This should be impossible and the issue stems from various levels of caches of prices at many different layers of abstraction.

I tried various things such as increasing token in amount so that the chosen route for prices is over higher liquidity pools. I think the reason is caching. We cache prices in SQS. There is also a FE prices cache. I tried lowering the FE cache ttl. It felt like it made things better though still present.

As a result, I think we should follow this bullet proof approach of converting all value into a single token and only then converting to USDC.

We can fix issues around pricing in quotes where it looks as if you get out more in USDC terms by using 2 prices

  1. between token in and USDC (do a separate query)
  2. Between token in and out (returned as part of the quote) We compute token in value by using 1) . For token out, we first multiply by 2). Then, by 1)

Acceptance Criteria

  • Suggested design implemented

p0mvn avatar Mar 18 '24 05:03 p0mvn