Can anyone call the Burn function in ERC20PresetMinterPauser?

Can anyone who owns the token call the burn function or can only the deployer/owner of the contract call the burn function? (ERC20PresetMinterPauser contract).

I want to effectively reduce the Total Supply through the burn function.

:computer: Environment

:memo:Details

:1234: Code to reproduce

1 Like

The ERC20PresetMinterPauser contract inherits from the ERC20Burnable contract which exposes the burn() method that can be called by anyone to burn their own tokens:

function burn(uint256 amount) public virtual {
    _burn(_msgSender(), amount); // _msgSender() here equals to the caller
}

Short answer is then that anybody can call burn(), but cannot burn other people’s tokens. When this happens, the totalSupply is reduced.

1 Like