ERC-6268 · Stagnant · ERC · 2022-01-06
ERC-6268: Untransferability Indicator for EIP-1155
A small ERC-1155 extension that lets a contract mark token IDs as locked (non-transferable), giving soulbound semantics to fungible and semi-fungible tokens.
What problem does it solve?
Soulbound tokens (SBTs) are tokens that cannot be transferred once issued: credentials, memberships, attendance badges, reputation points. ERC-5192 standardised a "locked" flag for single NFTs (ERC-721), but there was no equivalent for ERC-1155, where one token ID can have many identical copies.
ERC-6268 fills that gap with a minimal, fungibility-agnostic indicator. A wallet or marketplace can ask the contract whether a given ID is locked and hide transfer or listing actions accordingly.
How it works
A compliant contract is a normal ERC-1155 token that also:
- Returns
truefromsupportsInterface(0xd87116f3)(ERC-165). - Implements
locked(id)andlockedBatch(ids). - For any ID where
locked(id)istrue, makes every transfer function revert, includingsafeTransferFromandsafeBatchTransferFrom. - Emits
LockedSingle/LockedBatchwhen an ID becomes locked, andUnlockedSingle/UnlockedBatchwhen it becomes unlocked. These should also be emitted at mint to announce the initial status.
Locking is per token ID, not per holder: every holder's balance of a locked ID is frozen.
interface IERC6268 {
event LockedSingle(uint256 _id);
event LockedBatch(uint256[] _ids);
event UnlockedSingle(uint256 _id);
event UnlockedBatch(uint256[] _ids);
function locked(uint256 _id) external view returns (bool);
function lockedBatch(uint256[] calldata _ids) external view returns (bool);
}
Sample code
A badge contract where ID 1 is soulbound and ID 2 is freely tradable (OpenZeppelin v5):
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {ERC1155} from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract Badges is ERC1155 {
event LockedSingle(uint256 _id);
event UnlockedSingle(uint256 _id);
mapping(uint256 => bool) private _locked;
constructor() ERC1155("https://example.com/{id}.json") {
_locked[1] = true;
emit LockedSingle(1);
emit UnlockedSingle(2);
}
function locked(uint256 id) public view returns (bool) {
return _locked[id];
}
function supportsInterface(bytes4 iid) public view override returns (bool) {
return iid == 0xd87116f3 || super.supportsInterface(iid);
}
// Allow mint (from == 0) but block transfers and burns of locked IDs.
function _update(address from, address to, uint256[] memory ids, uint256[] memory values)
internal override
{
if (from != address(0)) {
for (uint256 i; i < ids.length; ++i) require(!_locked[ids[i]], "soulbound");
}
super._update(from, to, ids, values);
}
}
(lockedBatch and minting functions omitted for brevity.)
Things to know
- Status: Stagnant. The Rationale and Security Considerations sections only say "needs discussion".
- The semantics of
lockedBatchare underspecified: it takes an array but returns a singlebool, and the spec does not say whether that means "all locked" or "any locked". Implementations must pick and document a rule. - The spec also says queries about tokens "assigned to the zero address" should throw, which maps awkwardly onto ERC-1155 balances; treat that note with care.
- For single NFTs, use ERC-5192 instead.