【问题标题】:Trying to fetch spot price using uniswap SDK but transaction is throwing error LOK?尝试使用 uniswap SDK 获取现货价格但交易抛出错误 LOK?
【发布时间】:2023-02-07 14:20:29
【问题描述】:


  const quotedAmountOut = await quoterContract.callStatic.quoteExactInputSingle(
    immutables.token0,
    immutables.token1,
    immutables.fee,
    amountIn,
    0
  )
  

我创建了两个 erc20 虚拟令牌并使用 uniswapV3Factory createPool() 方法为它们创建了一个池并获得了池地址。但是当我想使用上面的脚本获取我使用过的代币的现货价格时,它会抛出以下错误:


Error: call revert exception; VM Exception while processing transaction: reverted with reason string "LOK" [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="quoteExactInputSingle(address,address,uint24,uint256,uint160)", data="0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034c4f4b0000000000000000000000000000000000000000000000000000000000", errorArgs=["LOK"], errorName="Error", errorSignature="Error(string)", reason="LOK", code=CALL_EXCEPTION, version=abi/5.7.0)
    at Logger.makeError (/Users/apple/Desktop/solidity/deploy/node_modules/@ethersproject/contracts/lib/index.js:20:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'LOK',
  code: 'CALL_EXCEPTION',
  method: 'quoteExactInputSingle(address,address,uint24,uint256,uint160)',
  data: '0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000034c4f4b0000000000000000000000000000000000000000000000000000000000',
  errorArgs: [ 'LOK' ],
  errorName: 'Error',
  errorSignature: 'Error(string)',
  address: '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6',
  args: [
    '<Token-1-Address>',
    '<Token-2-Address>',
    500,
    BigNumber { _hex: '0x0de0b6b3a7640000', _isBigNumber: true },
    0
  ],
  transaction: {
    data: '0xf7729d4300000000000000000000000008a2e53a8ddd2dd1d895c18928fc63778d97a55a0000000000000000000000006d7a02e23505a74143199abb5fb07e6ea20c6d6300000000000000000000000000000000000000000000000000000000000001f40000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000',
    to: '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6'
  }
}

【问题讨论】:

    标签: node.js typescript uniswap


    【解决方案1】:

    我发现这里的问题是你提供的代币地址,比如 token0 是 WETH9 你必须提供准确的 WETH9 代币地址,你可以在 etherscan.io 上找到它

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-21
      • 2020-12-23
      • 1970-01-01
      • 2016-05-12
      • 1970-01-01
      • 2021-04-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多