2

I've searched and found a couple examples, but they don't seem to work anymore with the uniswap API.

I'm looking to get the liquidity amounts of 2 tokens in a uniswap pool, and found through the documentation reserve0 and reserve1, but when I access these propteries, they dont produce a number on the pair

1 Answer 1

2

Rather than going to the contracts themselves, using the Uniswap v2 SubGraph, the query:

{
  pairs {
    id, 
    reserve0,
    reserve1
  }
}

...correctly returns the data for all pairs:

{
  "data": {
    "pairs": [
      {
        "id": "0x00004ee988665cdda9a1080d5792cecd16dc1220",
        "reserve0": "199.713907280830191521",
        "reserve1": "40.523599"
      },
      {
        "id": "0x0000871c95bb027c90089f4926fd1ba82cdd9a8b",
        "reserve0": "0.000000000000007155",
        "reserve1": "0.000000000000000141"
      },
      {
        "id": "0x00031554ee74e4a6d497677e5152d94c3dbe5f46",
        "reserve0": "0.000000000000020727",
        "reserve1": "0.000183887381173668"
      },
      .....

Change the query for the pair(s) you're interested in.

8
  • Thank you! That worked great Apr 30, 2021 at 18:43
  • Glad it worked! :-) Apr 30, 2021 at 18:44
  • What do exactly reserve1 and reserve0 stand for? Can I calculate the circulating supply of the token or market cap from this? or price?@RichardHorrocks
    – Mugetsu
    Jun 6, 2021 at 19:55
  • Hi @Mugetsu - reserve0 and reserve1 are the amounts of two tokens in a particular Uniswap liquidity pool. You can calculate the price on Uniswap using other available values, but this may or may not reflect the price in other markets (e.g. centralised exchanges). You can't work out the market cap or circulating supply from these values - they only represent what is available in this Uniswap liquidity pool (which might only be a small fraction of the overall circulating supply). Jun 6, 2021 at 20:00
  • Thank you for the response @RichardHorrocks! I find your account and all the questions/answers very informative. Just going through them <3. Could you possibly point me how I could find out the market cap and current circulating supply of the given token?
    – Mugetsu
    Jun 6, 2021 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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