Ethereum: TransactionRevertInstructionError: Transaction has been reverted by the EVM

Ethereum revertentinstructionerror transaction: The transaction was restored by EVM

I experienced a mistake while I try to use ADD -Liquidity with Uniswap V2 on Seolia Testnet using Web3.Js. The error is caused by the virtual car withdrawal transaction (EVM). Here you can find a detailed explanation of the question and potential solutions.

question:

When you try to execute “addliquide” on the Uniswap V2 interface, EVM returns to the transaction. This can happen for several reasons, for example:

  • There is not enough liquidity in the pool.

  • The balance or addresses of incorrect tokens.

3.

  • Incorrect gas restrictions.

The code is:

Here is a sample of truffle contract and details on the Web3.JS that reproduces the problem:

`JavaScript

// Seolia axis binding.js

Const web3 = necessary ('web3');

Constru trufe = need ('truffle');

Const web3 = new web3 (new web3.providers.httpProvider ("

Module.exports = {{

Service providers: [], // no service provider and EVM will restore the transaction

Networks: {

Development: {

Host: "Localhost",

Port: 8545,

Gas: 2000000

},

Seolia: {network_id: 1}

},

Contracts: {

Addliquidity: you need ('./ addliquidity.json')

}

};

JavaScript

// addliquidity.js

Const web3 = necessary ('web3');

Const contract = new web3.etth.contract (claim.resolve ('./ addliquidee'), '0x ...');

Contract.Methods.addliquidity (address, amount, quantity, price). Send ({from: '0x ...', value: '0.1'})

.Hen ((result) => {{{{

console.log (result.status);

if (result.status === 'success') {

contract.funcias.getbalance.Call (title)

.Then ((balance) => {{{{

console.log (Balance: $ {Balance});

});

} Else {

Discard a new error ("error");

}

})

.catch ((error) => {{{

Console.error (error);

Throwing error;

});

Potential solutions:

To solve the problem, make sure that:

  • Enter a service provider

    : Add a painting "service providers" to the URL of the EVM provider (for example,https: // api.seolia.io`in the configuration of the truffle.

JavaScript

// Seolia axis binding.js

Const web3 = necessary ('web3');

Constru trufe = need ('truffle');

Const web3 = new web3 (new web3.providers.httpProvider ("

Module.exports = {{

Service providers: [],

Networks: {

Development: {

Host: "Localhost",

Port: 8545,

Gas: 2000000

},

Seolia: {network_id: 1}

},

Contracts: {

Addliquidity: you need ('./ addliquidity.json')

}

};

  • Valid external calls : Make sure that the "external -Call" feature is implemented in the contract to validate the external transactions.

JavaScript

// addliquidity.js

Const web3 = necessary ('web3');

Const contract = new web3.etth.contract (claim.resolve ('./ addliquidee'), '0x ...');

Contract.Methods.addliquidity (address, amount, quantity, price)

.Call ({from: '0x ...'})

.Hen ((result) => {{{{

console.log (result.status);

if (result.status === 'success') {

contract.funcias.getbalance.Call (title)

.Then ((balance) => {{{{

console.log (Balance: $ {Balance});

});

} Else {

Discard a new error ("error");

}

})

.catch ((error) => {{{

Console.error (error);

Throwing error;

});

  • Increasing gas limits : Configure larger gas restrictions to prevent EVM from returning due to inadequate funds or transaction complexity.

` JavaScript

// Seolia axis binding.js

Const web3 = necessary (‘web3’);

Constru trufe = need (‘truffle’);

Const web3 = new web3 (new web3.providers.httpprovider (“

module.

Ethereum Cgminer

Leave a Reply

Shopping cart

0
image/svg+xml

No products in the cart.

Continue Shopping