Uniswap / docs

📓 Uniswap V3 docs website
https://docs.uniswap.org
317 stars 526 forks source link

Receiving a wallet address vs contract address using V3Pool #711

Open Luca-Blight opened 4 months ago

Luca-Blight commented 4 months ago

sample of the code that generates the address:

 const poolAddresses = validTokenPairs.map(([tokenA, tokenB]) =>
    V3Pool.getAddress(tokenA!, tokenB!, feeAmount!)
  );

  const poolInfoPromises = poolAddresses.map((poolAddress, index) => {
    const [tokenA, tokenB] = validTokenPairs[index];
    console.log(`Fetching pool data for address: ${poolAddress}`);
    console.log(`Token A: ${tokenA?.address}`);
    console.log(`Token B: ${tokenB?.address}`);
    console.log(`Fee Amount: ${feeAmount}`);

    return getPoolInfo(poolAddress, feeAmount).catch((error) => {
      console.error("🚀 ~ poolAddress, failed to fetch pool data:", poolAddress, error);
      return undefined;
    }); 

token info used and address returned:

Fetching pool data for address: 0xd1D52bCd48488104b2FdBcA23977C89c6f4Cc631 Token A: 0x408e41876cCCDC0F92210600ef50372656052a38 Token B: 0x0000000000085d4780B73119b644AE5ecd22b376 Fee Amount: 3000

Error when calling contract instance functions:

[ etchPoolData ~ error: Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="slot0()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)](error: Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] reason: null, code: 'CALL_EXCEPTION', method: 'slot0()', data: '0x', errorArgs: null, errorName: null, errorSignature: null, address: '0xd1D52bCd48488104b2FdBcA23977C89c6f4Cc631', args: [], transaction: { data: '0x3850c7bd', to: '0xd1D52bCd48488104b2FdBcA23977C89c6f4Cc631' }