admin管理员组

文章数量:1356877

TypeScript with Ethers Version [email protected]

Hello !!

Error: "missing revert data in call exception; Transaction reverted without a reason string"

El Error se produce en la funcion "V2Router.getAmountsOut"

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 );

const amountsOut = await V2Router.getAmountsOut(1000, [tokenIn, tokenOut]);

if (!amountsOut || amountsOut.length !== 2) {

return getBigNumber(0); }

return amountsOut[1]; };

Log:

[WARN] error - Error en GetPrice: missing revert data in call exception; Transaction reverted without a reason string

Similars: .js/discussions/2849

TypeScript with Ethers Version [email protected]

Hello !!

Error: "missing revert data in call exception; Transaction reverted without a reason string"

El Error se produce en la funcion "V2Router.getAmountsOut"

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 );

const amountsOut = await V2Router.getAmountsOut(1000, [tokenIn, tokenOut]);

if (!amountsOut || amountsOut.length !== 2) {

return getBigNumber(0); }

return amountsOut[1]; };

Log:

[WARN] error - Error en GetPrice: missing revert data in call exception; Transaction reverted without a reason string

Similars: https://github./ethers-io/ethers.js/discussions/2849

Share Improve this question asked Jul 5, 2022 at 17:47 Julio SardaJulio Sarda 291 gold badge1 silver badge4 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

The result of calling a function that existed in the ABI I was using, but not in the actual contract deployed on the Blockchain. In other words, I supplied the wrong contract address when I created the contract using new ethers.Contract(address, ABI, signer)

One of the cause may be the Rpc Endpoint, try changing your rpc endpoint to the API_KEY only. Like your Your URL would be something like "https://eth-goerli.g.alchemy./v2/YOUR_API_KEY", try it only with YOUR_API_KEY.

This also happens when wrong arguments are passed in your contract methods. Refer to this answer for more info

本文标签: javascriptError quotmissing revert data in call exceptionquot with ethers569Stack Overflow