Uniswap / Uniswap/interface

multicall problem with v2 / v3 token

Open
#5,342 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
5.5k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

currently this code works fine if I try to swap V3 tokens like UNI or USDC and WETH in the Goerli testnet:

..
const swapRouterContract = new ethers.Contract(
    V3SwapRouterAddress,
    V3SwapRouterABI.concat(PeripheryPaymentsABI).concat(MulticallABI)
)
..

     const params2 = {
        tokenIn: WETHAddress,
        tokenOut: ZETAAddress,
        fee: 3000,
        recipient: WALLET_ADDRESS,
        deadline: expiryDate,
        amountIn: ethers.utils.parseEther('0.0001'),
        amountOutMinimum: 0,
        sqrtPriceLimitX96: 0,
    }
    const encData2 = swapRouterContract.interface.encodeFunctionData("exactInputSingle", [params2])

    const calls = [encData2]
    const encMultiCall = swapRouterContract.interface.encodeFunctionData("multicall", [calls])


    const txArgs = {
        to: V3SwapRouterAddress,
        from: WALLET_ADDRESS,
        data: encMultiCall
    }

    const tx = await signer.sendTransaction(txArgs)
    console.log('tx', tx)
    const receipt = await tx.wait()
    console.log('receipt', receipt) 

If I try with smart contracts like ZETA I get the following error:

reason: 'execution reverted',
 code: 'UNPREDICTABLE_GAS_LIMIT',

I also use the getPool() function and with both UNI and ZETA it gives me the correct pairPool

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files or tests; start by locating the V3SwapRouter, Multicall, and exactInputSingle integration in the interface. Compare the encoded transaction and execution path for ZETA against the working UNI or USDC cases, then verify the transaction no longer reverts during gas estimation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.