0

Newbe here. I am testing a smart contract on Remix. When I try to burn ERC20 tokens by sending them to the 0 address I get the following error

transact to Ex.transfer errored: Error: data out-of-bounds (length=64, offset=96, code=BUFFER_OVERRUN, version=abi/5.0.7)

Here the line of code that causes it (if I comment this out, there is no error):

emit Transfer(msg.sender, address(0), amount);

amount is uint256. Am I doing anything wrong? Are the arguments wrong? I have seen the exact same code on smart contracts that have been deployed and are running fine.

Remix settings:

Compiler version: tried 0.7.0 and 0.8.3

EVM version: tried compiler default and istanbul

environment: tried JavaScript VM and ganache local provider. With JS I get said error, with ganache I don't get the error message in Remix but the transaction stays pending in Remix

In case I haven't provided all necessary information I apologize. Please let me know if you need additional information.

Edit:

Minimum example to reproduce the error:

function testEmit(uint256 amount) public  {
        emit Transfer(msg.sender, address(0), amount);
    }
3
  • I tried with a function emitting just Transfer event and it works as expected, using solc v0.8.1. The contract has to be doing something else. – Ismael Apr 17 at 0:32
  • i added the minimum example that reproduces the error on Remix - any ideas? – Nik Apr 17 at 9:07
  • How is Transfer event declared? I use openzeppelin's ERC20 contract for the definition. I've tested with the same function and it works. – Ismael Apr 18 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.