v3-periphery icon indicating copy to clipboard operation
v3-periphery copied to clipboard

BLAST quoterV2 - quoteExactInputSingle call exception

Open gamebak opened this issue 1 year ago • 1 comments

Hello, I've been trying and trying stuff to get the Blast quoterV2 to return prices, but with no luck. Only getting "Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="quoteExactInputSingle((address,address,uint256,uint24,uint160))", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.7.0)"

I'm using quoterV2 address as mentioned in the docs: '0xd93a91442afd80243cf12f7110f48ab276fff33f'

I don't know what I'm doing wrong, please help.

async function getQuoterV2()
{
    const sushiAbi = [
      {
        "inputs": [
          {
            "components": [
              {"internalType": "address", "name": "tokenIn", "type": "address"},
              {"internalType": "address", "name": "tokenOut", "type": "address"},
              {"internalType": "uint256", "name": "amountIn", "type": "uint256"},
              {"internalType": "uint24", "name": "fee", "type": "uint24"},
              {"internalType": "uint160", "name": "sqrtPriceLimitX96", "type": "uint160"}
            ],
            "internalType": "struct IQuoterV2.QuoteExactInputSingleParams",
            "name": "params",
            "type": "tuple"
          }
        ],
        "name": "quoteExactInputSingle",
        "outputs": [
          {"internalType": "uint256", "name": "amountOut", "type": "uint256"},
          {"internalType": "uint160", "name": "sqrtPriceX96After", "type": "uint160"},
          {"internalType": "uint32", "name": "initializedTicksCrossed", "type": "uint32"},
          {"internalType": "uint256", "name": "gasEstimate", "type": "uint256"}
        ],
        "stateMutability": "nonpayable",
        "type": "function"
      }
    ];

    const quoterV2Contract = new ethers.Contract(this.quoterV2, sushiAbi, this.provider);
    const params = {
      tokenIn: '0x4300000000000000000000000000000000000004', //weth
      tokenOut: '0x4300000000000000000000000000000000000003', //usdb
      amountIn: ethers.utils.parseUnits(amount.toString(), 18), // 1 = 0x016345785d8a0000 
      fee: 3000,
      sqrtPriceLimitX96: '0'
    };

    const result = await quoterV2Contract.callStatic.quoteExactInputSingle(params);
    return result;
}

gamebak avatar Apr 10 '24 14:04 gamebak

Thanks for trying to provide a solution but I want to say that this code actually works in the rest of the chains. For some reason, only in Blast it fails and I tried many times to get it to work.

  1. I'll give it a try to see if the static call will make a difference
  2. The code provided by me was simplified in order to highlight my problem, I missed the async and ethers.parseEther('1') it's not fixing anything

gamebak avatar Aug 09 '24 23:08 gamebak