I need Uniswap liquidity pool addresses to develop my project. Can anyone tell me how to get the full list of these addresses?
4 Answers
There's a website for this, built and maintained by Uniswap Labs. It's info.uniswap.org:
Alternatively you might use the Uniswap V3 subgraph.
-
Thank you for the information. I am also looking for the addresses on the testnets. Can you help me on that?– notoothCommented Sep 25, 2021 at 22:19
-
You might have some luck checking out the events emitted by the factory contract. Check out the deployment addresses and more generally the Uniswap docs. Commented Sep 25, 2021 at 22:52
-
I've clicked on the USDC/ETH pool, now how do I get its address? Commented May 22 at 22:51
For developers trying to get a testnet pool contract address, Uniswap's factory contract method getPool can be used.
Note: as of writing this, the Etherscan page for a transaction only shows the token addresses & the Uniswap router contract address, NOT the pool address
Example JS snippet to get the UNI/WETH (0.3%)
pool address on Goerli (note: im using Ethers & Alchemy below, but you can also use your
own preferred alternatives such as Web3js or Infura):
const ethers = require('ethers');
// The variables you need to plug in first.
// If you dont know how to get these, see the extra info listed under this code snippet.
const token1Address = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984';
const token2Address = '0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6';
const factoryAddress = '0x1F98431c8aD98523631AE4a59f267346ea31F984';
const factoryAbi = [...]; // Use raw ABI listed on goerli etherscan. Dont import ABI from the Uniswap SDK npm package, because mainnet & testnet ABI's are likely different
const providerUrl = 'https://eth-goerli.g.alchemy.com/v2/YOUR_API_KEY_HERE'; // Replace with your api key
const poolBips = 3000; // 0.3%. This is measured in hundredths of a bip
const provider = new ethers.providers.JsonRpcProvider(providerUrl);
const factoryContract = new ethers.Contract(factoryAddress, factoryAbi, provider);
(async () => {
const poolAddress = await factoryContract.functions.getPool(token1Address, token2Address, 3000);
console.log(poolAddress);
})();
Extra info (incase you dont know how to get the above variables):
Variable | Description | Goerli example value | How to get | Notes |
---|---|---|---|---|
token1Address |
Contract address of 1 of the 2 pool tokens | "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984" |
Search token on the mainnet Uniswap info website | |
token2Address |
Contract address of 1 of the 2 pool tokens | "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6" |
Search token on the mainnet Uniswap info website | |
factoryAddress |
Uniswap factory contract address | "0x1F98431c8aD98523631AE4a59f267346ea31F984" |
Testnet address is listed on the mainnet Uniswap documentation | |
factoryAbi |
Uniswap factory ABI (JS object, not a JSON string) | - | Put above address (for the factory) into testnet explorer (e.g.: goerli etherscan website). The ABI will then be listed (might need to click "contract" tab to see it) | JS object (not json string) |
providerUrl |
The https url your using to connect to the testnet | - | Listed on your node provider website | Usually Infura or Alchemy |
poolBips |
The uniswap pool fee bracket (measured in hundreds of a bip) | 3000 |
E.g.: if the pool fee is 0.3% , this value is 3 * 10 * 100 (convert % to bips, then bips to hundredths) |
As of writing, this is currently measured in hundredths of a bip, NOT percent or bips |
In case you want to get the pool address using etherscan here is how you can get it
- Get the addresses of the two tokens for which you want to get the pool address
In my case, I did a small transaction using uniswap UI on the goerli testnet and then coped the contract addresses for each token (click on Dai and weth and copy contract addresses)
https://goerli.etherscan.io/tx/0x57e299098f729aadc0a4ab8a3e8165ea62c13cfb5253247a1a3d4006026c2924
- Afterward, go on the uniswap v3 factory page on the etherscan, and under
read contract
add the addresses for each token. The third field represents the fee for the pool.
In my case, I used 3000 (which represents a 0.3% pool fee) and click on the query
https://goerli.etherscan.io/address/0x1f98431c8ad98523631ae4a59f267346ea31f984#readContract
NOTE: if the pool doesn't exist you will get 0x0000000000000000000000000000000000000000
- Go to https://info.uniswap.org
- Find the pool you want
- The pool address is in the URL. For example, this is the URL for one of the USDC/ETH pools: https://info.uniswap.org/#/pools/0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640