---
eip: 6982
label: ERC-6982
title: Efficient Default Lockable Tokens
status: Final
type: Standards Track
category: ERC
created: 2023-05-02
requires: 165, 721
official: https://eips.ethereum.org/EIPS/eip-6982
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6982.md
canonical: https://eips.huatuo.xyz/eip-6982/
lang: en
tldr: "A gas-efficient lock-status interface for ERC-721: one DefaultLocked event sets the status for every token, and per-token Locked events are emitted only when a token differs from the default."
tags: [nft, lockable, soulbound, gas, erc-165]
---

# ERC-6982: Efficient Default Lockable Tokens

> A gas-efficient approach to lockable ERC-721 tokens

**TL;DR:** A gas-efficient lock-status interface for ERC-721: one DefaultLocked event sets the status for every token, and per-token Locked events are emitted only when a token differs from the default.

## What problem does it solve?

Lockable and soulbound NFT standards such as [ERC-5192](/eip-5192/) require an event for each token when it is minted, so indexers know it is locked. For a collection where *every* token is locked forever (badges, credentials), that is one extra event per mint that carries no new information and just costs gas.

ERC-6982 flips the model: declare the default once for the whole contract, then only emit events for tokens whose status deviates.

## How it works

Two events and two view functions ([ERC-165](/eip-165/) ID `0x6b61a747`):

| Member | Rule |
| --- | --- |
| `DefaultLocked(bool locked)` | Must be emitted at deployment to set the default for all tokens, and again whenever the default changes |
| `Locked(uint256 indexed tokenId, bool locked)` | Must be emitted when one token's status changes; it overrides the default for that token |
| `defaultLocked()` | Returns the default given by the latest `DefaultLocked` event |
| `locked(tokenId)` | Returns the token's status: its own last `Locked` value, or the current default if it has none. Must revert for non-existent tokens |

An indexer reconstructs status like this: start from the latest `DefaultLocked`, then apply each token's `Locked` events. Because `DefaultLocked` can be re-emitted at any time (for example after a reveal), a whole collection can switch status with one event instead of thousands.

"Locked" mainly signals that the token should not be traded on marketplaces and exchanges. It does not have to mean fully non-transferable: an implementation may still allow transfers under special conditions. The spec cites Cruna, where a locked token can still be moved if the transfer is initiated by a designated "protector" wallet.

## Sample code

A staking-style collection: unlocked by default, locked while staked:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";

interface IERC6982 {
    event DefaultLocked(bool locked);
    event Locked(uint256 indexed tokenId, bool locked);
    function defaultLocked() external view returns (bool);
    function locked(uint256 tokenId) external view returns (bool);
}

contract StakeableNFT is ERC721, IERC6982 {
    mapping(uint256 => bool) private _locked;
    address public immutable pool;

    constructor(address pool_) ERC721("Stakeable", "STK") {
        pool = pool_;
        emit DefaultLocked(false);
    }

    function defaultLocked() external pure returns (bool) { return false; }

    function locked(uint256 tokenId) external view returns (bool) {
        _requireOwned(tokenId);
        return _locked[tokenId];
    }

    function setLocked(uint256 tokenId, bool value) external {
        require(msg.sender == pool, "only pool");
        _requireOwned(tokenId);
        _locked[tokenId] = value;
        emit Locked(tokenId, value);
    }

    function _update(address to, uint256 tokenId, address auth) internal override returns (address) {
        require(!_locked[tokenId], "locked");
        return super._update(to, tokenId, auth);
    }

    function supportsInterface(bytes4 id) public view override returns (bool) {
        return id == 0x6b61a747 || super.supportsInterface(id);
    }
}
```

## Things to know

- Status is **Final**.
- If you change the default, any token with its own `Locked` event keeps that override. Indexers must not assume a new `DefaultLocked` resets every token.
- The sample lets the owner keep the NFT in their wallet while staked, which is the use case of the reference implementation.
- Comparable standards: [ERC-5192](/eip-5192/) (per-token events), [ERC-6454](/eip-6454/) (`isTransferable` check), [ERC-7066](/eip-7066/) (lock with an unlocker address).


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-6982
