Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLAST quoterV2 - quoteExactInputSingle call exception #7

Open
gamebak opened this issue Apr 10, 2024 · 1 comment
Open

BLAST quoterV2 - quoteExactInputSingle call exception #7

gamebak opened this issue Apr 10, 2024 · 1 comment

Comments

@gamebak
Copy link

gamebak commented Apr 10, 2024

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
Copy link
Author

gamebak commented Aug 9, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant