Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get pool with ETH in Uniswap v3?

I want to get pool with ETH (ETH/UNI, ETH/USDC, ...).

I tried to call getPool() function of uniswap factory contract with 0x0000000000000000000000000000000000000000, but it returns 0x0, which means there is no pool.

like image 965
Lazaro Nascimento Avatar asked Sep 20 '25 13:09

Lazaro Nascimento


1 Answers

There are no pools with ETH in Uniswap v3 (or Uniswap v2 for that matter), only pools with WETH (ERC-20 wrapped ETH). The address of the WETH token depends on the network. For the Ethereum mainnet the WETH address is 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2. Use this address as an argument for the getPool function.

For instance, to get the UNI/WETH 0.3% pool (UNI token address is 0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984 on the mainnet), call:

getPool('0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984',
        '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
        3000)

Something to note: the pool addresses are deterministic and can be computed off-chain. See here for example code.

like image 82
kfx Avatar answered Sep 22 '25 07:09

kfx