Can't burnFrom using ERC20PresetMinterPauser

Hi,

So I’ve deployed an ERC20 using the ERC20PresetMinterPauser.sol contract. When I try to use the burnFrom function I get an error.

:computer: Environment
Contract Version v3.2.0
Remix, Javascript VM

:memo:Details
I mint some tokens to an address, and then when I use the burnFrom function for that address, I get this error:
“ERC20: burn amount exceeds allowance”.

I can use the burn function, but not the burnFrom function.

Any ideas? Thanks!

1 Like

Hi @pmk,

The caller of burnFrom doesn’t have a sufficient enough allowance.

I assume that you have a contract function performing burnFrom. The token holder needs to approve an allowance to the contract doing the burning. Just like when approving an allowance for transferFrom, see example: Example on how to use ERC20 token in another contract

@abcoathup

So, even though the deployer of the contract is the admin and owner of it, it has to give itself permission to use the “burnForm” through the “increaseAllowance” function?

1 Like

Hi @pmk,

burnFrom allows the burning of tokens where a token holder has approved an allowance that can be used to burn their tokens.

To burn any accounts tokens, you could create functionality that calls _burn protected by Access Control. Though token holders would be rightly cautious under what circumstances their tokens could be burnt by a central authority. You would need to explain to your community when and how this would be used.

1 Like