ERC-5753 · Stagnant · ERC · 2022-10-05
ERC-5753: Lockable Extension for EIP-721
An ERC-721 extension that lets an owner lock an NFT in their own wallet, blocking transfers until a designated unlocker address releases it, so NFTs can be used as collateral or rented without leaving the holder's wallet.
What problem does it solve?
In DeFi, using a token as collateral usually means depositing it into the lending contract. That works for ETH or ERC-20 tokens, but NFTs have utility that depends on where they sit: a profile picture verified on social media, a token-gated Discord role, a game item. Moving the NFT into an escrow contract breaks all of that.
ERC-5753 proposes a different pattern: the NFT stays in the owner's wallet but is locked, and only a named unlocker can release it or move it. The spec lists uses such as:
- NFT-collateralised loans without escrow
- Rentals without large collateral (the renter holds the token but cannot sell it)
- Pay-by-instalment purchases
- Extra safety: lock a valuable NFT in a hot wallet with a cold wallet as unlocker
- Non-custodial staking and event tickets that cannot be resold mid-event
How it works
The interface adds three functions and two events to ERC-721:
interface ILockable {
event Lock(address indexed unlocker, uint256 indexed id);
event Unlock(uint256 indexed id);
function lock(address unlocker, uint256 id) external;
function unlock(uint256 id) external;
function getLocked(uint256 tokenId) external view returns (address);
}
Rules from the spec:
getLockedreturns the unlocker for a locked token, oraddress(0)if unlocked.- While locked, every ERC-721 transfer must revert unless initiated by the unlocker, and
approvemust revert. getApprovedshould return the unlocker, so it can move the token with standard transfer calls.- Calling
lockon an already-locked token must revert. - If the unlocker transfers the token, it becomes unlocked after the transfer.
- Locking with
address(1)as unlocker locks the token permanently. supportsInterface(0x72b68110)must returntrue(ERC-165).
Marketplaces should check getLocked and hide listings for locked tokens, since such orders cannot be filled.
Sample code
A lending protocol checking and using a lock (ethers v6):
import { Contract, ZeroAddress } from "ethers";
const nft = new Contract(nftAddress, [
"function supportsInterface(bytes4) view returns (bool)",
"function getLocked(uint256) view returns (address)",
"function lock(address unlocker, uint256 id)",
], borrowerSigner);
if (!(await nft.supportsInterface("0x72b68110"))) throw new Error("not lockable");
if ((await nft.getLocked(tokenId)) !== ZeroAddress) throw new Error("already locked");
// Borrower locks the NFT with the lending contract as unlocker.
await (await nft.lock(lendingContract, tokenId)).wait();
// On repayment the lender calls unlock(id); on default it can transferFrom
// the NFT to itself, which also clears the lock.
Things to know
- Status: Stagnant. It has not progressed toward Final and the interface ID and details could still change if revived.
- Locking is enforced only by the token contract itself. A collection must be deployed with this extension; you cannot add it to an existing NFT.
- The unlocker is powerful: it can move the token at any time. Users should only name contracts or wallets they trust.
- Related approaches: ERC-5192 marks tokens as permanently soulbound, and ERC-4907 adds a separate time-limited "user" role for rentals instead of locking.