Ethers Version ethers@5.6.9
Hello !!
Error in "V2Router.getAmountsOut"
missing revert data in call exception; Transaction reverted without a reason string
Any suggestion Please ?
Thanks !!
Code: ... import * as UniswapV2Router from "../../../abis/UniswapV2Router02.json"; ... export const getPriceOnUniV2 = async ( tokenIn: string, tokenOut: string, amountIn: BigNumber, routerAddress: string ): Promise => {
const V2Router = new ethers.Contract( routerAddress, UniswapV2Router.abi, maticProvider );
errReport.warn("Luego Contrato Router");
errReport.warn("TokenIn: ",tokenIn)
errReport.warn("TokenOut: ",tokenOut)
errReport.warn("AmountIn: ",amountIn)
errReport.warn("Antes GetAmountsOut");
const amountsOut = await V2Router.getAmountsOut(1000, [tokenIn, tokenOut]);
errReport.warn("amountsOut; ",amountsOut);
errReport.warn("Luego GetAmountsOut");
if (!amountsOut || amountsOut.length !== 2) {
errReport.warn("Error GetAmountsOut");
return getBigNumber(0); }
return amountsOut[1]; };
Log:
Errors 50:45.192] [WARN] error - Luego Contrato Router [2022-07-03T09:50:45.194] [WARN] error - TokenIn: 0x2791bca1f2de4661ed88a30c99a7a9449aa84174 [2022-07-03T09:50:45.194] [WARN] error - TokenOut: 0x8f3cf7ad23cd3cadbd9735aff958023239c6a063 [2022-07-03T09:50:45.194] [WARN] error - AmountIn: BigNumber { _hex: '0x04a817c800', _isBigNumber: true } [2022-07-03T09:50:45.194] [WARN] error - Antes GetAmountsOut [2022-07-03T09:50:47.098] [WARN] error - Error en GetPrice: missing revert data in call exception; Transaction reverted without a reason string [2022-07-03T09: