DeFi Get All Pair Addresses

The endpoint:

GET ​/{token0_address}​/{token1_address}​/pairAddress
https://deep-index.moralis.io/api-docs/#/defi/getPairAddress
Returns the first created pair address for those two tokens.

There are a lot of tokens that create new pair addresses and then they migrate liquidity over from the first pair to the second, third, and so forth.

Moralis could add a query param that allows us to get all pair addresses, the most recently created pair address, or the pair address with the biggest value in its liquidity pool.

You can add a feature request here https://roadmap.moralis.io/b/feature-requests.

what is the advantage of creating new liquidity pairs for same tokens?

I was wondering the same thing. Who knows why projects would create new liquidity pairs.

The only conclusions I can come up with:

  • They chose a new liquidity locking service
  • They want to start fresh
  • They want to broadcast a new LP pair to reach more people

Hmmm not very sure what you mean, but people create liquidity pairs simply so that their token can be traded in the DEX

that way people who would like to buy a newly created token project will be able to buy the token w/ either native token or stablecoin :raised_hands:

To clarify, we are talking about same token pairs.

E.g., let’s say that you launched a YKS token on Ethereum.

You create a WETH/YKS pair.

Then you create another WETH/YKS pair and migrate liquidity over from the first pair to the second pair.

Can you give an example of a real set of tokens that has multiple pairs/pools? I am curious how this would be handled when querying the DEX’s API or contracts.

APE token on Ethereum 0x4d224452801aced8b2f0aebe155379bb5d594381

Has these liquidity pair addresses:

  • 2 WETH/APE Uniswap v3 pairs 0xac4b3dacb91461209ae9d41ec517c2b9cb1b7daf and 0xf79fc43494ce8a4613cb0b2a67a1b1207fd05d27
  • 2 USDC/APE Uniswap v3 pairs 0xb07fe2f407f971125d4eb1977f8acee8846c7324 and 0x429f1144e390a74785eeebf73f6ef565faa318b7

Querying Uniswap’s Factory contract’s getPool function, I can get both those pair addresses for wETH/APE, you just need to specify the right fee percentage for each pool.

My first assumption was that without specifying the percentages beforehand, I’m not sure how you would get each pool address(es). But it looks like Uniswapv3 uses 4 fixed percentages of 1%, 0.3%, 0.05% or 0.01%. So at least with v3, each pool address can be obtained by querying with each of these 4 numbers. And v2 just has the one pool I think for each pair of tokens.

Do you know of other token pair examples on other chains or on another DEX with multiple pools?

2 Likes