i come across a scenario that a we will be enabling people to mint their ERC20 and on one page we will show them the total price in USD for their ERC20. a few question in my mind,

  1. if uniswap is the source of truth of price, does it mean that if the new ERC20 didn't have a LP on Uniswap then api will return nothing?
  2. assuming someone now enlist a new LP $ERC20-$USDC at 1:100 with a total of USD200 TVL (without any trading vol.), will the api return the price of $ERC20 at $100 accordingly?

since this seems to be quite an edge case specific for new token, so hope you dont mind i rise my questions here. much appreciated.


1 Answer 1


To fetch price from uniswap you usually calculate it from the LP's reserves through the getReserves() function. If there isn't a LP contract, you obviously can't call this function.

To calculate the price using fixed constant product rule, 1 * 100 = $100 so yes, the price would be $100.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.