---
eip: 5753
label: ERC-5753
title: Lockable Extension for EIP-721
status: Stagnant
type: Standards Track
category: ERC
created: 2022-10-05
requires: 165, 721
official: https://eips.ethereum.org/EIPS/eip-5753
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5753.md
canonical: https://eips.huatuo.xyz/zh/eip-5753/
lang: zh
tldr: 一项 ERC-721 扩展，让所有者在自己的钱包里锁定 NFT，在指定的解锁者地址释放它之前阻止转移，使 NFT 可以在不离开持有者钱包的情况下用作抵押或出租。
tags: [nft, erc-721, locking, collateral, rental]
---

# ERC-5753: Lockable Extension for EIP-721

> Interface for disabling token transfers (locking) and re-enabling them (unlocking).

**TL;DR:** 一项 ERC-721 扩展，让所有者在自己的钱包里锁定 NFT，在指定的解锁者地址释放它之前阻止转移，使 NFT 可以在不离开持有者钱包的情况下用作抵押或出租。

## 它解决什么问题？

在 DeFi 中，把代币用作抵押通常意味着把它存入借贷合约。这对 ETH 或 ERC-20 代币行得通，但 NFT 的效用取决于它*放在哪里*：在社交媒体上验证过的头像、需要持有代币才能进入的 Discord 角色、游戏道具。把 NFT 转入托管合约会破坏这一切。

ERC-5753 提出了另一种模式：NFT 留在所有者的钱包里，但被**锁定**，只有指定的**解锁者（unlocker）**才能释放或转移它。规范列出了这些用途：

- 无需托管的 NFT 抵押贷款
- 无需大额抵押的租赁（租户持有代币但不能出售）
- 分期付款购买
- 额外的安全性：把贵重的 NFT 锁在热钱包里，并以冷钱包作为解锁者
- 非托管质押，以及活动期间无法转售的活动门票

## 它如何运作

该接口在 [ERC-721](/eip-721/) 之上增加三个函数和两个事件：

```solidity
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);
}
```

规范中的规则：

- `getLocked` 对已锁定的代币返回其解锁者，未锁定则返回 `address(0)`。
- 锁定期间，每一次 ERC-721 转移都**必须 revert**，除非由解锁者发起，并且 `approve` 必须 revert。
- `getApproved` 应返回解锁者，使其可以用标准的转移调用来移动代币。
- 对已锁定的代币调用 `lock` 必须 revert。
- 如果解锁者转移了代币，转移之后它就变为未锁定。
- 以 `address(1)` 作为解锁者进行锁定，会永久锁定代币。
- `supportsInterface(0x72b68110)` 必须返回 `true`（[ERC-165](/eip-165/)）。

市场应检查 `getLocked`，并隐藏已锁定代币的挂单，因为这类订单无法成交。

## 示例代码

借贷协议检查并使用锁定（ethers v6）：

```ts
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.
```

## 需要注意

- **状态：Stagnant。** 它没有向 Final 推进，如果重启，接口 ID 和细节仍可能变化。
- 锁定只由代币合约自身强制执行。集合必须在部署时就带有该扩展；你无法把它添加到已有的 NFT 上。
- 解锁者的权力很大：它可以随时转移代币。用户应该只指定自己信任的合约或钱包。
- 相关做法：[ERC-5192](/eip-5192/) 把代币标记为永久灵魂绑定，[ERC-4907](/eip-4907/) 则为租赁增加一个独立的限时"用户"角色，而不是锁定。


---

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