Uniswap / smart-order-router

GNU General Public License v3.0
413 stars 420 forks source link

How to debug `Error: Failed to get 2 quotes. Reasons: Error, Error` #192

Closed clemsos closed 1 year ago

clemsos commented 1 year ago

I am trying to use the AlphaRouter to get an EXACT_OUTPUT and it works for some (like WETH > DAI) but fails for other (like DAI > WETH).

I am getting a Error: Failed to get 2 quotes. Reasons: Error, Error and after many hours, no real clue how to debug. How can I know why/what is happening?

I have tried set up the tenderly simulator to debug but also didn't manage to plug it properly.

Here is the hardhat script I am using

/**
 * Simple script to retrieve a Uniswap route using ther smart router
 * */
const { ethers } = require('hardhat')
const { AlphaRouter, nativeOnChain, SwapType } = require('@uniswap/smart-order-router')
const { Token, CurrencyAmount, TradeType, Percent  } = require('@uniswap/sdk-core')
const { encodeRouteToPath } = require('@uniswap/v3-sdk')
const JSBI  = require('jsbi')
const { DAI, WETH, SHIBA_INU, USDC } = require('../../test/helpers')

// parse tokens
const getTokens = (chainId) => ({
  native: nativeOnChain(chainId),
  dai: new Token(chainId, DAI, 18, 'DAI'),
  weth: new Token(chainId, WETH, 18, 'WETH'),
  shiba: new Token(chainId, SHIBA_INU, 18, 'SHIBA'),
  usdc: new Token(chainId, USDC, 6, 'USDC')
})

async function main({
  keyPrice = ethers.utils.parseEther('.00001')
} = {}) {

  // parse tokens
  const { chainId } = await ethers.provider.getNetwork()
  const tokens = getTokens(chainId)

  // pick tokens to swap
  const tokenIn = tokens.native
  const tokenOut = tokens.dai

  // init router
  const router = new AlphaRouter({ 
    chainId, 
    provider: ethers.provider,
  })

  // parse router args 
  const [signer] = await ethers.getSigners()
  const outputAmount = CurrencyAmount.fromRawAmount(tokenOut, JSBI.BigInt(keyPrice))
  const args = {
    outputAmount,
    quoteCurrency: tokenIn,
    swapType: TradeType.EXACT_OUTPUT,
   // same result with or without this swapConfig param
    swapConfig: {
      type: SwapType.UNIVERSAL_ROUTE,
      recipient: signer.address,
            slippageTolerance: new Percent(100, 100),
            deadline: Date.now() + 1800
    }
  }

  // call router
  const route = await router.route(
    ...Object.values(args)
  )

  // show results
  const bestRoute = route.route[0].route
  console.log(route.route[0].route)

  // parse path
  const path = encodeRouteToPath(bestRoute, TradeType.EXACT_OUTPUT)
  console.log(path)

  // log some prices
  console.log(`Quote Exact In: ${route.quote.toFixed(2)}`);
  console.log(`Gas Adjusted Quote In: ${route.quoteGasAdjusted.toFixed(2)}`);
  console.log(`Gas Used USD: ${route.estimatedGasUsedUSD.toFixed(6)}`);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    // eslint-disable-next-line no-console
    console.error(error)
    process.exit(1)
  })

the log (here using native ETH on mainnet, but same result with several other pairs)

{
  tokenIn: ExtendedEther {
    chainId: 1,
    decimals: 18,
    symbol: 'ETH',
    name: 'Ether',
    isNative: true,
    isToken: false
  },
  tokenOut: Token {
    chainId: 1,
    decimals: 18,
    symbol: 'DAI',
    name: undefined,
    isNative: false,
    isToken: true,
    address: '0x6B175474E89094C44Da98b954EedeAC495271d0F'
  }
}
Error: Failed to get 2 quotes. Reasons: Error, Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:731:17)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:55:17)
clemsos commented 1 year ago

I just tested with a bunch of pairs (permutations of ETH, WETH, USDC, DAI, SHIBA, UDT) and I can't figure out why some are failing and some are not. Any ideas? Thanks !

-------------------------
ETH > DAI
Error: Failed to get 2 quotes. Reasons: Error, Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
ETH > WETH
Error: Invariant failed: ADDRESSES
    at invariant (/Users/clement/Dev/unlock/unlock/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:14:11)
    at Token.sortsBefore (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/sdk-core/src/entities/token.ts:59:5)
    at V3PoolProvider.getPoolAddress (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/v3/pool-provider.ts:218:37)
    at CachingV3PoolProvider.getPoolAddress (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/v3/caching-pool-provider.ts:122:30)
    at /Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/functions/get-candidate-pools.ts:328:62
    at arrayMap (/Users/clement/Dev/unlock/unlock/node_modules/lodash/lodash.js:653:23)
    at Function.map (/Users/clement/Dev/unlock/unlock/node_modules/lodash/lodash.js:9622:14)
    at getV3CandidatePools (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/functions/get-candidate-pools.ts:325:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1201:46)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
ETH > SHIBA
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
ETH > USDC
Quote Exact In: 0.00
Gas Adjusted Quote In: 0.01
Gas Used USD: 7.287045
-------------------------
ETH > UDT
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
DAI > ETH
Quote Exact In: 12164.66
Gas Adjusted Quote In: 12171.94
Gas Used USD: 7.287045
-------------------------
DAI > WETH
Quote Exact In: 12164.66
Gas Adjusted Quote In: 12171.94
Gas Used USD: 7.287045
-------------------------
DAI > SHIBA
Error: Failed to get 3 quotes. Reasons: Error, Error, Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
DAI > USDC
Quote Exact In: 10.00
Gas Adjusted Quote In: 17.28
Gas Used USD: 7.287045
-------------------------
DAI > UDT
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
WETH > ETH
Error: Invariant failed: ADDRESSES
    at invariant (/Users/clement/Dev/unlock/unlock/node_modules/tiny-invariant/dist/tiny-invariant.cjs.js:14:11)
    at Token.sortsBefore (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/sdk-core/src/entities/token.ts:59:5)
    at V3PoolProvider.getPoolAddress (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/v3/pool-provider.ts:218:37)
    at CachingV3PoolProvider.getPoolAddress (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/v3/caching-pool-provider.ts:122:30)
    at /Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/functions/get-candidate-pools.ts:328:62
    at arrayMap (/Users/clement/Dev/unlock/unlock/node_modules/lodash/lodash.js:653:23)
    at Function.map (/Users/clement/Dev/unlock/unlock/node_modules/lodash/lodash.js:9622:14)
    at getV3CandidatePools (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/functions/get-candidate-pools.ts:325:28)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1201:46)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
WETH > DAI
Error: Failed to get 2 quotes. Reasons: Error, Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
WETH > SHIBA
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
WETH > USDC
Quote Exact In: 0.00
Gas Adjusted Quote In: 0.01
Gas Used USD: 7.287045
-------------------------
WETH > UDT
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
SHIBA > ETH
Error: Failed to get 2 quotes. Reasons: Error, Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
SHIBA > DAI
Error: Failed to get 3 quotes. Reasons: Error, Error, Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
SHIBA > WETH
Error: missing revert data in call exception; Transaction reverted without a reason string [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (data="0x", transaction={"to":"0x1F98415757620B543A52E61c46B32eB19261F984","data":"0x1749e1e300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000056000000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000000000000000000000000000160de4468586b6b2f8a92feb0c260fc6cfc743b1000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000000000000000000000000000ea5edef1c6ed1be1bcba4617a1c5a994e9018a43000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b410000000000000000000000000000000000000000000000000000000000000000000000000000000012b32f10a499bf40db334efe04226cca00bf2d9b000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b41000000000000000000000000000000000000000000000000000000000000000000000000000000005ed60a121159481675bad3e648ba4c89753e056f000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b410000000000000000000000000000000000000000000000000000000000000000000000000000000027c70cd1946795b66be9d954418546998b546634000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b41000000000000000000000000000000000000000000000000000000000000000000000000000000002de509bf0014ddf697b220be628213034d320ece000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b41000000000000000000000000000000000000000000000000000000000000000000000000000000009813037ee2218799597d83d4a5b6f3b6778218d9000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000","accessList":null}, error={"message":"request to https://cloudflare-eth.com/v1/mainnet failed, reason: getaddrinfo ENOTFOUND cloudflare-eth.com","type":"system","errno":"ENOTFOUND","code":"ENOTFOUND"}, code=CALL_EXCEPTION, version=providers/5.7.2)
    at Logger.makeError (/Users/clement/Dev/unlock/unlock/node_modules/@ethersproject/logger/src.ts/index.ts:269:28)
    at Logger.throwError (/Users/clement/Dev/unlock/unlock/node_modules/@ethersproject/logger/src.ts/index.ts:281:20)
    at checkError (/Users/clement/Dev/unlock/unlock/node_modules/ethers/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:66:16)
    at EthersProviderWrapper.<anonymous> (/Users/clement/Dev/unlock/unlock/node_modules/ethers/node_modules/@ethersproject/providers/src.ts/json-rpc-provider.ts:642:20)
    at step (/Users/clement/Dev/unlock/unlock/node_modules/ethers/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:48:23)
    at Object.throw (/Users/clement/Dev/unlock/unlock/node_modules/ethers/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:29:53)
    at rejected (/Users/clement/Dev/unlock/unlock/node_modules/ethers/node_modules/@ethersproject/providers/lib/json-rpc-provider.js:21:65)
    at processTicksAndRejections (node:internal/process/task_queues:96:5) {
  reason: 'missing revert data in call exception; Transaction reverted without a reason string',
  code: 'CALL_EXCEPTION',
  data: '0x',
  transaction: {
    to: '0x1F98415757620B543A52E61c46B32eB19261F984',
    data: '0x1749e1e300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002e00000000000000000000000000000000000000000000000000000000000000380000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000004c0000000000000000000000000000000000000000000000000000000000000056000000000000000000000000095ad61b0a150d79219dcf64e1e6cc01f0b64c4ce000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000000000000000000000000000160de4468586b6b2f8a92feb0c260fc6cfc743b1000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000000000000000000000000000ea5edef1c6ed1be1bcba4617a1c5a994e9018a43000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b410000000000000000000000000000000000000000000000000000000000000000000000000000000012b32f10a499bf40db334efe04226cca00bf2d9b000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b41000000000000000000000000000000000000000000000000000000000000000000000000000000005ed60a121159481675bad3e648ba4c89753e056f000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b410000000000000000000000000000000000000000000000000000000000000000000000000000000027c70cd1946795b66be9d954418546998b546634000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b41000000000000000000000000000000000000000000000000000000000000000000000000000000002de509bf0014ddf697b220be628213034d320ece000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b41000000000000000000000000000000000000000000000000000000000000000000000000000000009813037ee2218799597d83d4a5b6f3b6778218d9000000000000000000000000000000000000000000000000000000000005b8d80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000495d89b4100000000000000000000000000000000000000000000000000000000',
    accessList: null
  },
  error: FetchError: request to https://cloudflare-eth.com/v1/mainnet failed, reason: getaddrinfo ENOTFOUND cloudflare-eth.com
      at ClientRequest.<anonymous> (/Users/clement/Dev/unlock/unlock/node_modules/hardhat/node_modules/node-fetch/lib/index.js:1483:11)
      at ClientRequest.emit (node:events:527:28)
      at TLSSocket.socketErrorListener (node:_http_client:454:9)
      at TLSSocket.emit (node:events:527:28)
      at emitErrorNT (node:internal/streams/destroy:157:8)
      at emitErrorCloseNT (node:internal/streams/destroy:122:3)
      at processTicksAndRejections (node:internal/process/task_queues:83:21) {
    type: 'system',
    errno: 'ENOTFOUND',
    code: 'ENOTFOUND'
  }
}
-------------------------
SHIBA > USDC
Error: Failed to get 2 quotes. Reasons: Error, Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
SHIBA > UDT
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
USDC > ETH
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
USDC > DAI
Quote Exact In: 10.00
Gas Adjusted Quote In: 17.28
Gas Used USD: 7.287045
-------------------------
USDC > WETH
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
USDC > SHIBA
Quote Exact In: 0.00
Gas Adjusted Quote In: 7.28
Gas Used USD: 7.287045
-------------------------
USDC > UDT
Quote Exact In: 138.25
Gas Adjusted Quote In: 150.14
Gas Used USD: 11.889269
-------------------------
UDT > ETH
Quote Exact In: 1065.29
Gas Adjusted Quote In: 1065.92
Gas Used USD: 8.675953
-------------------------
UDT > DAI
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
UDT > WETH
Quote Exact In: 1065.29
Gas Adjusted Quote In: 1065.92
Gas Used USD: 8.675984
-------------------------
UDT > SHIBA
Error: Failed to get 1 quotes. Reasons: Error
    at Object.assign.retries (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:736:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OnChainQuoteProvider.getQuotesManyData (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/providers/on-chain-quote-provider.ts:437:9)
    at AlphaRouter.getV3Quotes (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1273:34)
    at async Promise.all (index 0)
    at AlphaRouter.route (/Users/clement/Dev/unlock/unlock/node_modules/@uniswap/smart-order-router/src/routers/alpha-router/alpha-router.ts:1012:45)
    at uniswap (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:51:17)
    at main (/Users/clement/Dev/unlock/unlock/smart-contracts/scripts/uniswap/route.js:77:7)
-------------------------
UDT > USDC
Quote Exact In: 0.73
Gas Adjusted Quote In: 1.60
Gas Used USD: 11.889312
clemsos commented 1 year ago

OK everyone... I was using cloudflare RPC provider that has a low cap on gas which lead the Uniswap Multicall to fail. Changing the RPC provider solved that (after 2 days of looking into it).

eyooooo commented 2 months ago

blast from the past on this issue :)

i ran into this issue while using Ganache or Anvil as a forked chain but it worked against a free alchemy node.

any idea why??? i turned the gas limit up to max (--gas-limit 18446744073709551615) in Anvil so would be weird that its a gas cap issue?

eyooooo commented 2 months ago

ok it seems it works if i use --disable-block-gas-limit instead of setting the gas-limit to the max. kinda stupid but whatever :P