ERC-8255 · Draft · ERC · 2026-05-06
ERC-8255: Expiring Token Approvals
An ERC-20 extension where every approval, including plain approve() and permit, automatically expires after a token-defined maximum duration, limiting the damage from forgotten or exploited allowances.
What problem does it solve?
ERC-20 allowances last forever. Users routinely grant huge or unlimited approvals to a protocol for a single swap, then forget about them. If that spender contract is later exploited, maliciously upgraded, or its front end is compromised, the attacker can drain every wallet that still has a live approval. Revocation tools exist, but they depend on users remembering to use them.
ERC-8255 makes approvals expire by default while keeping the existing approve / transferFrom ABI, so old wallets and apps keep working.
How it works
The token defines a constant maxApprovalDuration() in seconds.
approve(spender, amount)sets the allowance and an expiration ofblock.timestamp + maxApprovalDuration().- New
approveForDuration(spender, amount, duration)lets you choose a shorter lifetime (durationmust be ≤ the max).duration = 0creates an approval valid only within the current block, which is handy for approve-and-spend bundles. - If the token also supports ERC-2612,
permituses the default duration. Its signature format is unchanged, and the permitdeadlinestill only limits when the signature can be submitted, not how long the approval lasts. - An approval is expired when
expiration < block.timestamp. After that,allowance()returns 0 andtransferFromtreats it as zero. allowanceAndExpiration(owner, spender)returns(expiration, storedAllowance)even when expired, so UIs can show what happened.transferFromreduces the amount but never extends the expiration.
Legacy spenders. Old contracts that assume "approve once, use forever" would break. Tokens MAY keep a list of legacy-compatible spenders (set by an admin, by the spender itself, or both) that keep classic behaviour. The list must be empty by default and holders can always revoke.
Optional packing. Expiration (64 bits) and amount (192 bits) can share one storage slot, so the extension costs no extra storage per allowance; type(uint256).max can still be used as an "unlimited" sentinel.
Sample code
Requesting a short-lived approval and reading its status (ethers v6):
import { Contract } from "ethers";
const abi = [
"function maxApprovalDuration() view returns (uint32)",
"function approveForDuration(address spender, uint256 amount, uint32 duration) returns (bool)",
"function allowanceAndExpiration(address owner, address spender) view returns (uint64 expiration, uint256 allowance)",
];
const token = new Contract(tokenAddress, abi, signer);
const max = await token.maxApprovalDuration();
const duration = Math.min(600, Number(max)); // 10 minutes, capped by the token
await (await token.approveForDuration(router, amount, duration)).wait();
const [expiration, stored] = await token.allowanceAndExpiration(await signer.getAddress(), router);
console.log(`allowance ${stored} valid until ${new Date(Number(expiration) * 1000).toISOString()}`);
The packing used by the reference implementation:
uint256 packed = (uint256(expiration) << 192) | allowance; // 64-bit expiry | 192-bit amount
Things to know
- Status: Draft.
- Integrations that rely on a long-lived allowance must refresh it, check
allowanceAndExpiration, or ask to be treated as legacy-compatible. Patterns that approve exactly what is needed right before use already work. - Pick durations with slack for mempool delays and small
block.timestampvariation, or transactions may fail because an approval expired in transit. - Expiry shortens the risk window but does not fix the classic ERC-20 change-allowance race.
- Wallets should show the permit deadline and the resulting approval expiry as two different things.
- Upgrading an existing token can make old single-slot allowances read as expired (expiration 0) under the packed layout; the spec describes migration options.