I am trying to burn erc20 token and get this error:
ContractExecutionError: Error happened while trying to execute a function inside a smart contract
at Function._isReverted (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:328:19)
at Web3RequestManager._processJsonRpcResponse (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:280:42)
at Web3RequestManager. (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:167:29)
at Generator.next ()
at fulfilled (/Users/giangtrinh/Desktop/spectre-bot/node_modules/web3-core/lib/commonjs/web3_request_manager.js:21:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
cause: [Eip838ExecutionError: execution reverted] {
cause: undefined,
code: -32000,
receipt: undefined,
data: undefined
},
code: 310,
receipt: undefined
}
Here is my code:
const tokenContract = new web3.eth.Contract(ERC20_ABI, tokenInfo.address, {
from: account,
gasPrice: '20000000000'
});
tokenContract.methods
.burn(stringAmount)
.send({
from: account,
chainId: chainId,
value: 0,
gasPrice,
})
.on("transactionHash", (hash) => {
console.log('hash', hash);
})
Some one help me plsssss !!!