Part III · Tokens and allowances

Lab: MBox-Burn, burning and revoking

By KangPublished: Chain snapshot: , block 12117419

Burning really lowers total supply; revoking an allowance changes only the allowance, never balances.

Deploying a burnable token

The deployed MBox has no burn function and cannot get one later, so a separate token with burn / burnFrom was deployed:

Right after deployment, A burned 1,000 of its own tokens: totalSupply fell from 1,000,000 to 999,000. The old MBox contract was not touched.

burn is not “transfer to 0x0”

  • burn lowers both the holder’s balance and totalSupply, and emits Transfer(holder → 0x0, amount).
  • A plain transfer to the zero address (if a contract allows it) changes balances only and does not lower totalSupply.

Both can show a “transfer to 0x0” event in an explorer. Whether supply actually fell must be read from totalSupply(), not inferred from the event. This lab used a dedicated burn, so supply really went down.

approve 500, burnFrom 100

  1. A first sent B 0.0001 SepETH to pay for test gas (B never used a faucet).
  2. A called approve(B, 500): allowance 500, balances unchanged.
  3. B called burnFrom(A, 100): A lost 100, supply fell another 100 to 998,900, and 400 of the allowance remained.

Two transferFrom calls in Chapter 12 later used 300 of those 400, leaving 100. That 100 allowance stayed in place after the lab; nobody cleared it.

D-01: revoking the leftover 100

The P0 review recorded this leftover allowance as a Low finding (F-ALLOW-001): not a compromised contract but a leftover from the experiment. If B signed, it could still move up to 100 test tokens. Decision D-01 approved revoking it. After re-reading the allowance, nonce and balances and simulating again, A broadcast exactly one approve(B, 0):

View transaction on Sepolia Etherscan (opens in a new tab): 0x4571e581958308c820ab16da26aa9d1a2622caa7c720ebe164b5d2c29a3747f2
  • Block 12117312, status success; gasUsed 24,538, effective gas price 69 wei, fee 1,693,122 wei
  • allowance(A, B): 100 → 0
  • Balances and supply unchanged: A 998,800, B 100, totalSupply 998,900
  • A’s nonce 19 → 20

All MBox-Burn transactions

B’s two transferFrom calls are in Chapter 12.

MBox-Burn at the snapshot

Item Value
totalSupply 998,900
balanceOf(A) 998,800
balanceOf(B) 100
allowance(A, B) 0 (revoked)

998,900 = 1,000,000 − 1,000 (A’s own burn) − 100 (B’s burnFrom).

Three things you can check yourself

  • Transaction details: the network is Sepolia, the sender is A, the target is the MBox-Burn contract, the status is success.
  • Event or contract read: the Approval event, or read allowance(A, B) directly and see that it is 0.
  • Balances and supply: changing an allowance should not change the holder’s assets.