0

I created a token on the Goerli Testnet and then made a pool of it with ETH on Uniswap. How can I find my pool contract address?

2 Answers 2

1

Did you call the function "createPool()" from Uniswap v3?

If you look at this function,

    function createPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external override noDelegateCall returns (address pool) {

it returns the address of the newly created pool. So look at the return value of the transaction where you called 'createPool()'. You can find the return value on a block explorer like etherscan. Hope this helps

4
  • I found this function in the documentation but I don't know where to use this code. I created the token using remix.ethereum where not much code was needed. So where do I have to use this code? @OlivierD
    – Abdullah
    Oct 12, 2022 at 19:51
  • Then you need to find the addresses of the uniswap V3 contracts on Goerli, and create the pool by calling the createPool function with your 2 tokens addresses. Or you can go on uniswap v3 app, click on the "Pool" tab, then on the 'more' drop down and click on "create a pool". Those links will help you: youtube.com/watch?v=XtwE6tpUVX0&ab_channel=JamesBachini and docs.uniswap.org/protocol/reference/deployments Don't forget to give an upvote if my answer helped so it can help others. Thanks Oct 12, 2022 at 22:27
  • I did go to v3 app and created a pool and added liquidity. But I don't know how to get its contract address. After asking James (whose video you linked) I think I got the pool contract address from etherscan but now If I search it on info.uniswap it doesn't show up. Is it because the pool is on Goerli Testnet or am I doing something wrong? @OlivierD
    – Abdullah
    Oct 13, 2022 at 6:24
  • answer marked accepted but can't upvote because don't have enough reputation. Thanks for the help
    – Abdullah
    Oct 13, 2022 at 6:40
1
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol";

uint24 fee=3000 // define fee here

//https://etherscan.io/address/0x1f98431c8ad98523631ae4a59f267346ea31f984#:~:text=Uniswap%20V3%3A%20Factory%20%7C%20Address%200x1f98431c8ad98523631ae4a59f267346ea31f984%20%7C%20Etherscan
address factoryAddress=0x1F98431c8aD98523631AE4a59f267346ea31F984

address yourPoolAddress=IUniswapV3Factory(factoryAddress).getPool(firstTokenAddress, 
                                                    secondTokenAddress,
                                                    fee)

uniswap deployment addresses

  • from front end, we need to create UniswapV3Factory and call the getPool function. to create the contract we need address of contract,provider and abi of the contract:

    const { abi: UniswapV3Factory } = require('@uniswap/v3-core/artifacts/contracts/UniswapV3Factory.sol/UniswapV3Factory.json')
    
    const address0 = getAddressFirstTokenContract
    const address1 = getAddressSecondTokenContract
    // this is same as above I placed
    const factoryAddress = '0x1F98431c8aD98523631AE4a59f267346ea31F984'
    
    
    
    const factoryContract = new ethers.Contract(
          factoryAddress,
          UniswapV3Factory,
          // define your provider
          provider
    )
    

call the contract function:

// contract functions are async
   const yourPoolAddress = await factoryContract.getPool(address0, address1, 300)

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.