Burn ERC20 token fails

Created a ERC-20 token that is governed by a time lock and a multisig

I managed to make a mint proposal, it was signed, delayed by the time lock and executed.
When I tired to test the burn method, it fails.

:computer: Environment

multisig
time lock
mainnet (testnet worked)

:memo:Details

When i try to burn the minted tokens, the time lock fails the operation.
This is error i get "Error: Timelock execution would revert. Error: Transaction would revert: ERC20: burn amount exceeds allowance"

I minted 0.000000000000001000 new tokens -> they belong to the token smart contract it self.
(on the mint amount i chose 1000 - and it actually minted 1/10^15 of a token, on an 18 decimal token)
when trying burn the same amount of token i just minted i get the error "Error: Timelock execution would revert. Error: Transaction would revert: ERC20: burn amount exceeds allowance"

Looking at the code, i see we can't burn all the token but only a smaller amount
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance")

I tried with a small amount "999" and it failed again

Any ideas?

:1234: Code to reproduce

I'm assuming you're using openzeppelin-contracts' ERC20Burnable.sol and that you're trying to call burnFrom.

If that's the case, have you checked that the account whose tokens you're trying to burn has authorized the TimelockController to do so?

Hey Martin,

Yes, I am trying to burn the tokens on that are allocated to the token contract, and the token contract is owned by the time lock smart contract.

The first proposal of minting using the MultiSig -> Time Lock -> Token was executed properly.
I am trying to do the "opposite" test by trying to call the burnFrom the tokens i minted.

I keep getting this message
Error: Timelock execution would revert. Error: Transaction would revert: ERC20: burn amount exceeds allowance

Any idea?

Thanks!

Hi @nirhy! Even if the Timelock contract owns the token contract, if you want the Timelock to burn tokens owned by an account you need to previously authorize the Timelock to do so by calling approve(spender, amount) on the token contract, where spender in this case is the Timelock address and amount is the maximum amount of tokens you'll authorize it to burn. The sequence would be more or less (pseudocode):

1: token_holder = 0x123
2: timelock = 0x456

3: token_holder calls token_contract.approve(timelock, 100)
4: timelock calls token_contract.burnFrom(token_holder, 100)

The revert message you're getting happens if in line 4 of the pseudocode above you try to burn a number greater than the one approved in line 3 (in this case, 100).

Note 1: you can use Defender Admin to run step 3 as well: just create a custom admin action to call approve on the token contract from the account that owns the tokens to be burned and setting the spender argument to your timelock address.

Note 2: If, on the other hand, what you're trying to do is to burn tokens the Timelock itself holds, you should be calling burn instead of burnFrom.

Revisiting this:

I minted 0.000000000000001000 new tokens -> they belong to the token smart contract it self.

You can't burn an account's tokens without its permission, and given the account in this case is the token contract itself, you'd need to add some code to let the owner trigger a burn of the token contract's tokens (assuming your token contract is upgradeable).

All of the above of course provided I understood your situation correctly, let me know otherwise.