ERC-8451: Permanent Locks for Lockable Tokens (ERC-6982 extension)

,

Hi all! I’m opening discussion for ERC-8451: Permanent Locks for Lockable Tokens, an extension of ERC-6982.

PR: Add ERC: Permanent Locks for Lockable Tokens by ryanio · Pull Request #2084 · ethereum/ERCs · GitHub

Abstract

ERC-6982 lets a contract lock or unlock every token with one DefaultLocked event, with per-token Locked overrides. This extension keeps those events as they are and adds what ERC-6982 leaves open:

  1. Permanent locks, so marketplaces and wallets can tell a temporary trading pause from a collection that will never be transferable.
  2. ERC-1155 support, with tokenId read as the token type ID.
  3. Mint and burn rules: locking restricts holder transfers only, so minting continues while trading is paused.
interface IERC8451 /* is IERC165, IERC6982 */ {
    event PermanentlyLocked();
    error TokenLocked(uint256 tokenId);
    function permanentlyLocked() external view returns (bool);
}

A trading pause during a mint is DefaultLocked(true) at deployment and DefaultLocked(false) when trading opens, which is plain ERC-6982. A soulbound collection emits DefaultLocked(true) and PermanentlyLocked() once at deployment, and the lock can never be lifted after that.

Why

Creators regularly turn off secondary transfers for a while: during a public mint, before a reveal, during a migration. Other collections are non-transferable for good, such as credentials and badges. Marketplaces need to stop offering trades in both cases, but should treat them differently: keep orders for when a pause lifts, and label a permanent lock as non-transferable.

ERC-6982 can’t express permanence, requires ERC-721, and doesn’t say whether minting continues while locked. ERC-5192 covers permanent locks, but needs one event per token.

Looking for feedback on

  • Permanence uses a separate event because ERC-6982 is Final. The lock has to be in place before it’s marked permanent, so a consumer that only knows ERC-6982 still sees every token as locked.
  • Permanence is contract-wide only. The motivating cases lock whole collections, and ERC-5192 already covers single soulbound tokens, so the interface stays at one event, one view, and one error.
  • Permanence is one way. Once marked, the contract can never emit an unlock for the default or for any token.
  • Strict reverts apply only to permanent locks. Temporary locks keep ERC-6982’s flexibility, where a protector wallet can still move a locked token.
  • There’s no range event. The default status covers whole collections and Locked covers single tokens.
  • There’s no expected end time field. Pauses often end early or late, and a stale end time would lead consumers to show orders that revert.

The draft’s reference implementation is an OpenZeppelin 5.x ERC-721 that locks at deployment and lets the owner unlock, lock again, or make the lock permanent.

If this would help your marketplace, wallet, or contract, a +1 here or on the PR helps get it merged as a Draft.

5 Likes

Much needed, thanks for finding an improvement for this

1 Like

Nice, telling a mint pause apart from a soulbound collection is exactly where marketplaces get it wrong today.

Three things from reading the PR:

  1. Rule 6.1 fixes the view, but not the event history. If a token got Locked(id, false) before permanence, an indexer that rebuilds status from ERC-6982 events, where the latest Locked overrides the default, still shows that token as unlocked after PermanentlyLocked. So the backwards compatibility line only holds for consumers that call locked(). Requiring Locked(id, true) for every outstanding unlock before PermanentlyLocked, or saying PermanentlyLocked clears all overrides, would close it.
  2. Permanent is only as permanent as the upgrade path. A credential collection behind a proxy can be made transferable by an upgrade without ever emitting an unlock. Worth a sentence in Security Considerations that wallets labeling tokens non-transferable should check whether the contract is upgradeable and who holds that key.
  3. For ERC-1155 an ID exists once a unit is minted, but what about after every unit is burned? If locked() starts reverting again for that ID it will surprise indexers, so it’s worth saying whether existence means ever minted or current supply above zero.

Thanks, all three were real gaps. I pushed a commit to the PR that addresses each one:

  1. New behavior rule 6 covers the event history: before emitting PermanentlyLocked, the contract MUST emit Locked(tokenId, true) for every existing token whose most recent Locked event unlocked it. An indexer that rebuilds status from ERC-6982 events now reaches the same answer as locked(), so the backwards compatibility line holds for both kinds of consumer. The cost is one event per outstanding unlock override, which is zero for collections that only ever use the default.
  2. Security Considerations now says a permanent lock is only as permanent as the code. An upgradeable proxy, or replaceable transfer-check logic, can make tokens transferable again without any unlock event, so wallets labeling tokens non-transferable should check upgradeability and who controls it.
  3. For ERC-1155, a token ID now exists while its total supply is greater than zero. That matches ERC-721, where a burned token stops existing and locked() reverts for it, and lines up with the usual supply-tracking extensions.

Good call, very useful.

Does the new rule cover burning and later reminting the same token ID?

Suppose an ERC-1155 ID gets a Locked(id, false) event and its entire supply is then burned. The collection becomes permanently locked while that ID does not exist. Later the same ID is minted again.

The requirement to clear existing unlock overrides would have skipped that ID. Would reminting require a fresh Locked(id, true) event so an ERC-6982 event-based indexer cannot reuse the old unlocked status?

A regression test for this lifecycle would help establish whether the backwards compatibility guarantee survives reminting.

1 Like

Good catch, thanks. Rule 6 was scoped to existing token IDs, so an ID that was unlocked with Locked(id, false), fully burned, and minted again after PermanentlyLocked kept its old unlocked status for anyone replaying ERC-6982 events.

I pushed a fix to the PR: rule 6 now covers every token ID whose most recent Locked event set it to false, whether or not that ID exists when the contract is marked permanent. The contract already has to track those overrides to satisfy the rule, so this adds no new state, and a later re-mint lands on a history that already says Locked(id, true). The same applies to ERC-721 contracts that can burn and re-mint an ID.

I also added your lifecycle as a test case: unlock an ID, burn its whole supply, emit PermanentlyLocked, mint it again, and check that the event history ends in Locked(id, true) and that locked(id) returns true. The reference implementation never unlocks single tokens, so the case can’t come up there, and the test case documents the expected history for contracts that do.

Thanks for this, the split between a trading pause and a permanent lock is very clear.

One case around burns. Rule 3 lets a contract allow burning locked tokens, and burns are not holder transfers, so rule 7.2 does not cover them. With common burnable extensions, such as OpenZeppelin’s ERC721Burnable, an approved operator can burn as well as the holder, and rule 9 encourages keeping approvals in place during a temporary lock. After PermanentlyLocked, an operator approved earlier can still burn a credential, while the holder can no longer move the token out of its reach: revoking the approval is the only protection left.

Would you consider recommending that burns of permanently locked tokens be started by the holder only, or would you rather cover it with a line in Security Considerations?

Thanks, good catch. I’d rather not limit burns to the holder, but the spec should guarantee the protection you describe, and right now it doesn’t.

Holder-only burns would break two patterns these collections use. Issuers revoke credentials, and burn-to-redeem flows like ERC-7498 have the redemption contract burn the token as an approved operator. After PermanentlyLocked, the fallback of sending the token to 0xdEaD is a holder transfer that rule 7.2 rejects, so an operator burn is the only way left to redeem a permanently locked token. Who may burn varies a lot by collection, and ERC-5484 already gives soulbound tokens a way to declare it.

The lock doesn’t give that operator anything new. Without a lock, the same approval could move the token, and after the lock it can only burn it. What the lock removes is the holder’s way out, so revocation is the only defense left. Rule 9 only covered approvals during a temporary lock, so a contract could reject every approval call after PermanentlyLocked, as some soulbound implementations do, and leave an earlier approval in place for good.

I pushed a commit to the PR that:

  1. Changes rule 9 so a lock never blocks revoking an approval that exists, including after PermanentlyLocked. A contract that never accepts approvals is unaffected, and one that rejects new approvals after PermanentlyLocked still has to let old ones be revoked (or stop honoring them). The SHOULD NOT on rejecting new approvals during a temporary lock stays.
  2. Adds a Security Considerations paragraph on outstanding approvals. In contracts that let operators burn, such as OpenZeppelin’s ERC721Burnable and ERC1155Burnable, an approval still in place lets the operator destroy a locked token, and revoking it is the holder’s only remedy. Wallets should show those approvals, and contracts with no use for operator burns can limit burning to the holder or the issuer.
  3. Explains in the rationale why the proposal doesn’t say who may burn.
1 Like

Rule 9 stops the revert, but it doesn’t say the approval is gone after the call, and with a built-in operator those are different things. ERC721C can auto-approve its transfer validator: isApprovedForAll returns true for the validator no matter what the holder has stored, so setApprovalForAll(validator, false) succeeds and isApprovedForAll still returns true. That call meets rule 9 as written. OpenZeppelin’s burn paths read the same virtual function, so a burnable contract with that override lets the built-in operator burn after the holder has revoked it.

Limit Break’s validator doesn’t call burn, so ERC721C itself isn’t the problem. But the new Security Considerations paragraph calls revoking the holder’s only remedy, and in this shape it does nothing.

I ran that shape on OZ 5.1 with ERC721Burnable and ERC1155Burnable after a permanent lock. The revoke call passes, the holder’s transfer reverts and the built-in operator burns the token. On ERC-721, a stored approval revoked the same way stops the burn.

One more line in rule 9 would close it: after such a call isApprovedForAll(caller, operator) MUST return false and, for ERC-721, getApproved(tokenId) MUST return the zero address. A contract with a built-in operator then has to drop it once locked or let holders opt out. Contracts that stop honoring old approvals already meet it.

@Zealynx you’re right. SeaDrop hit the same shape: it preapproves OpenSea’s conduit, so a revoke call succeeds and the approval stays. The conduit can’t burn, so SeaDrop holders weren’t exposed, but a built-in operator that can burn would be.

I pushed a commit that tightens rule 9: after PermanentlyLocked, once a revoke call returns, isApprovedForAll(caller, operator) MUST return false, and for ERC-721 getApproved(tokenId) MUST return the zero address. I kept it to permanent locks. During a temporary lock, built-in operators are how trading resumes, and a MUST there would need per-holder opt-out storage in every contract that has one. A permanently locked contract has no transfers left for the operator, so dropping it costs nothing. Security Considerations covers the temporary case. I’m updating SeaDrop to drop the conduit once permanently locked.

We also have a production implementation now, in SeaDrop:

  • v1: ERC721SeaDropLockable replaces the pausable and soulbound contracts. A constructor argument picks Unlocked, Locked, or PermanentlyLocked.
  • v2: locks are built into the default ERC-721 and ERC-1155 contracts and clones. They start unlocked and allow a permanent lock only before the first mint. Opt-in Lockable extensions allow it at any time.
  • Shared logic: ERC8451Lockable.sol.

We ran the full lifecycle on Base mainnet against OpenSea, which already indexes these events (ERC-721, ERC-1155). Listings were rejected while locked, lock changes invalidated or restored them within about 20 seconds, and lockPermanently() emitted DefaultLocked(true), Locked(2, true), PermanentlyLocked() in rule 6 order.

Building it turned up gaps that needed no rule changes, now in the PR (fd94d3e): the TokenLocked ID for batch transfers, deployment for proxies and clones, rule 6’s cost for many single-token unlocks, and Security Considerations on default-on permanent locks, temporary locks nobody can lift, and lock changes made mid-transfer.

1 Like

Consumer rule 5 permits treating TokenLocked(id) as a lock signal. With ERC-721 safe transfers, though, the recipient can revert with that same error from onERC721Received. OpenZeppelin forwards the revert data unchanged. The token could still return false from locked(id) and transfer successfully to other recipients.

A marketplace that caches this failure as a token lock could hide otherwise valid listings, with no actual lock change to trigger another event. Could rule 5 recommend checking locked(id) before recording a token as locked, and treating an unconfirmed TokenLocked revert as a failure of that particular transfer?

@Revinand good catch, you’re right. The revert data can’t say which contract raised it, and a receiver hook can raise the same TokenLocked(tokenId) for a token that isn’t locked. ERC-1155 is the wider case, since every transfer to a contract calls onERC1155Received.

I pushed a commit that changes rule 5 the way you suggested. Consumers MAY treat a TokenLocked(tokenId) revert as a sign that the token is locked, but SHOULD confirm that locked(tokenId) returns true before recording it, and otherwise treat the revert as a failure of that transfer only. The Rationale now explains why the revert alone isn’t enough.