Auditing Your Own Allowances Before Someone Else Does
Bottom line: Every live infinite approval is an unauthenticated key to your balance. Enumerate approvals, rank them by contract age, owner type and TVL at risk, and revoke everything you are not actively using. This is a 20-minute job that removes most of the tail risk from ordinary DeFi use.
Enumerate
Per chain, scan Approval events for your address:
1 | cast logs --from-block 0 --address $TOKEN \ |
Collect spender from topic3 and the amount from data. Do this per token you have ever touched — approvals live on the token, not the router.
Rank
| Signal | Worse |
|---|---|
| Amount | 2^256-1 |
| Spender age | newer |
| Spender owner | EOA |
| Spender audit | none |
| Last used | long ago |
An infinite approval to a contract created two weeks ago by an EOA with no audit is the top of the list regardless of amount.
Revoke
approve(spender, 0) per spender. Batch through a revoker contract to save gas: one transaction, a loop of zeroing approvals.
1 | function revoke(address[] calldata tokens, address spender) external { |
Some tokens require the allowance to be zeroed before a new approve (USDT-style). Zeroing is always safe for those; approve(x) alone reverts.
Policy that keeps the list short
- Exact-amount approvals for one-off swaps
- Capped approvals (not infinite) for routers used weekly
- Monthly sweep of anything untouched for 60 days
- Never approve a spender you found in a DM or a reply
The check worth automating
A nightly job comparing allowance(me, spender) for every known spender against last night’s snapshot, alerting on any increase. An increase you did not initiate is a compromised key or a phishing signature — that alert is worth more than the revocations combined.
Operating notes
Scan Approval events per token, not per router — approvals live on the token contract and a router-only scan misses most of them. Resolve topic3 into a spender address and join against creation block for age.
1 | cast logs --from-block 0 --address $TOKEN \ |
Rank by spender age, then owner type, then amount. An infinite approval to a two-week-old EOA-owned contract outranks a 500 USDC approval to a two-year-old audited router.
Revoke cheaply
Batch through a revoker contract: one transaction, loop of approve(spender, 0). Some tokens require the zeroing step before any new approve, so zeroing is never wasted.
The nightly diff
Snapshot every known allowance nightly and alert on any increase you did not initiate. An increase nobody claims is either a compromised key or a phishing signature, and it is the highest-value alert in the whole audit — the sweep is cleanup, the diff is detection.
FAQ
How do I find all the token approvals I’ve made?
Scan Approval events per token contract, filtering by your address as the owner topic. Approvals live on the token, not the router, so a router-only scan misses most of them. Collect the spender from topic3 and the amount from the event data, and repeat for every token you have ever touched.
Which approvals should I revoke first?
Rank by spender age, then owner type, then amount. An infinite approval to a contract created two weeks ago by an EOA with no audit is the top of the list regardless of amount. Revoke everything you are not actively using.
How do I revoke multiple approvals without paying gas for each one?
Batch through a revoker contract: one transaction containing a loop of approve(spender, 0) calls across the token list. Zeroing is always safe, and some tokens require the allowance to be zeroed before any new approve, so the zeroing step is never wasted.
Why does my approve transaction revert on some tokens?
Some tokens require the existing allowance to be zeroed before a new approve is set. Calling approve(x) directly on those reverts. Zeroing with approve(spender, 0) first is always safe for those tokens.
What should I automate in an allowance audit?
A nightly job comparing allowance(me, spender) for every known spender against the previous night’s snapshot, alerting on any increase. An increase you did not initiate means a compromised key or a phishing signature. That alert is worth more than the revocations combined — the sweep is cleanup, the diff is detection.











