Part III · Tokens and allowances
Approval is not payment
Three roles: holder, spender, recipient. Approving and spending are two separate actions.
Why do wallets keep asking you to “approve” rather than “pay”?
Many decentralised exchanges and services first ask the holder to approve a smart contract to use up to some amount of a token (approve), and only later, when you act, does that contract call transferFrom.
approveis not a payment: it only writes into the token contract “B may move up to this much of A’s tokens”. Balances do not change at all.- What actually moves balances is a later
transferFrom(move) orburnFrom(destroy) sent by the spender. - An approval stays valid until the allowance is used up or the holder sends another
approveto change it.
So although an approval is not “money already gone”, a long-lived approval is a standing permission for future deductions.
The real history of allowance(A, B) on MBox-Burn in the lab. Approving and spending are different transactions; revoking takes another approve(B, 0), effective only once it is mined.
Open the full-size diagram in a new tabAn allowance is an overwritable “remaining amount”
- After part of it is used, the rest stays valid: in the lab B burned 100 and 400 remained.
- A new
approveoverwrites; it does not add. If the allowance is 100 and youapprove(B, 500), the result is 500, not 600. - To clear it, send
approve(B, 0).
Three risks and one habit
- Too large an allowance: if the approved contract has a bug or malicious logic, a bigger allowance means a bigger possible loss.
- Approving the wrong address: a familiar name does not make an address trustworthy (remember Chapter 9: names are not unique).
- Forgotten approvals: after you stop using a service, the allowance may still be usable.
One habit: at the end of every experiment, check allowance; when it is no longer needed, send approve(spender, 0) to revoke it.
Everyday analogy
You authorise a food-delivery platform to deduct “up to 100 loyalty points a month”. Nothing is deducted at that moment; points are only taken when the platform actually places an order. Later you stop using it and set the deductible limit to 0. That withdraws permission; it does not hand 100 points to anyone.
The next chapter is this whole process as a real experiment on Sepolia.