{"eip":1132,"title":"Extending ERC20 with token locking capability","description":"An extension to the ERC20 standard with methods for time-locking of tokens within a contract.","authors":["nitika-goel \u003cnitika@govblocks.io\u003e"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2018-06-03","discussionsTo":"https://github.com/ethereum/EIPs/issues/1132","repo":"ERCs","label":"ERC-1132","officialUrl":"https://eips.ethereum.org/EIPS/eip-1132","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1132.md","url":"https://eips.huatuo.xyz/eip-1132/","tldr":{"en":"An ERC-20 extension that lets tokens be time-locked for a named reason inside the token contract itself, so holders keep them in their own balance instead of sending them to an escrow.","ja":"トークン自体のコントラクト内で、名前付きの理由でトークンを時間ロックできる ERC-20 の拡張。保有者は、エスクローに送らずに、自分の残高に保持したままにできる。","ko":"토큰 컨트랙트 자체에서 지정한 사유로 토큰을 시간 잠금할 수 있게 하는 ERC-20 확장. 보유자는 토큰을 에스크로로 보내지 않고 자기 잔액에 그대로 둘 수 있다.","zh":"ERC-20 的一项扩展，允许在代币合约内部以指定原因对代币进行时间锁定，持有者无需把代币转入托管合约，仍保留在自己的余额中。"},"tags":["token","erc20","locking","vesting","governance"],"explainers":{"en":{"lang":"en","tldr":"An ERC-20 extension that lets tokens be time-locked for a named reason inside the token contract itself, so holders keep them in their own balance instead of sending them to an escrow.","tags":["token","erc20","locking","vesting","governance"],"related":[20,900],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1132/","markdown":"## What problem does it solve?\n\nMany apps need users to lock tokens for a while: vesting schedules, governance voting, or showing \"skin in the game\" as a claim assessor. The usual way is to transfer tokens to a staking or escrow contract ([ERC-900](/eip-900/) style). That has costs:\n\n- users must trust the escrow and approve it first,\n- extra transfers cost gas,\n- tokens disappear from `balanceOf`, so wallets show a misleading balance,\n- users must remember to claim them back, and cannot use locked tokens elsewhere in the same app.\n\nERC-1132 keeps the tokens in the holder's account and records locks inside the token contract, each tagged with a `bytes32` **reason** (for example `\"GOV\"` or `\"CLAIM_ASSESS\"`).\n\n## How it works\n\nThe extension adds these functions to an ERC-20 token:\n\n| Function | Purpose |\n| --- | --- |\n| `lock(reason, amount, time)` | Lock `amount` of the caller's tokens for `time` seconds under `reason` |\n| `tokensLocked(of, reason)` | Amount currently locked for a reason |\n| `tokensLockedAtTime(of, reason, time)` | Amount that will still be locked at a future timestamp |\n| `totalBalanceOf(of)` | Locked + transferable balance |\n| `extendLock(reason, time)` | Push the unlock time further out |\n| `increaseLockAmount(reason, amount)` | Add more tokens to an existing lock |\n| `tokensUnlockable(of, reason)` / `getUnlockableTokens(of)` | Tokens whose lock has expired |\n| `unlock(of)` | Release all expired locks back to the transferable balance |\n\nEvents `Locked` and `Unlocked` let wallets and indexers track lock status the same way `Transfer` tracks balances.\n\nBecause one lock can be read by many parts of an app, a user who locks tokens for *n* days can, for example, cast several votes during that period, which a one-shot staking transfer does not easily allow.\n\n## Sample code\n\nUsing a lockable token from another contract:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface ILockableToken {\n    function lock(bytes32 reason, uint256 amount, uint256 time) external returns (bool);\n    function tokensLocked(address of_, bytes32 reason) external view returns (uint256);\n    function totalBalanceOf(address of_) external view returns (uint256);\n    function unlock(address of_) external returns (uint256);\n}\n\ncontract Voting {\n    ILockableToken public immutable token;\n    bytes32 public constant GOV = \"GOV\";\n\n    constructor(ILockableToken t) { token = t; }\n\n    // Voting weight = tokens the voter has locked for governance.\n    function weight(address voter) external view returns (uint256) {\n        return token.tokensLocked(voter, GOV);\n    }\n}\n```\n\nThe user locks directly on the token (the lock is on `msg.sender`'s own tokens):\n\n```ts\nawait token.lock(encodeBytes32String(\"GOV\"), parseUnits(\"100\", 18), 7n * 24n * 3600n);\n```\n\n## Things to know\n\n- Status is **Stagnant**. It was not finalised, so interfaces in the wild may differ from the one above.\n- The spec mixes `uint256` and `bytes32` for the reason in the event signatures; check the actual contract you integrate with.\n- `transfer` must be overridden so that only the unlocked part of the balance can move. The spec leaves this to implementations, so audit it carefully.\n- Locks are keyed by reason; to change an existing lock use `increaseLockAmount` or `extendLock`.\n"},"ja":{"lang":"ja","tldr":"トークン自体のコントラクト内で、名前付きの理由でトークンを時間ロックできる ERC-20 の拡張。保有者は、エスクローに送らずに、自分の残高に保持したままにできる。","tags":["token","erc20","locking","vesting","governance"],"related":[20,900],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1132/","markdown":"## 何を解決するのか\n\n多くのアプリは、ユーザーにトークンをしばらくロックしてもらう必要があります。ベスティングのスケジュール、ガバナンスの投票、あるいはクレーム査定者として「身銭を切っている」ことを示す場合などです。通常の方法は、ステーキングやエスクローのコントラクト（[ERC-900](/eip-900/) のような形式）にトークンを送ることです。これにはコストがあります。\n\n- ユーザーはエスクローを信頼し、先に承認（approve）しなければならない\n- 余計な送金にガスがかかる\n- トークンが `balanceOf` から消えるため、ウォレットの残高表示が誤解を招く\n- ユーザーは取り戻す手続きを覚えておく必要があり、ロック中のトークンを同じアプリ内の別の場所で使えない\n\nERC-1132 は、トークンを保有者のアカウントに残したまま、トークンコントラクトの中にロックを記録します。各ロックには、`bytes32` の**理由**（たとえば `\"GOV\"` や `\"CLAIM_ASSESS\"`）が付けられます。\n\n## 仕組み\n\nこの拡張は、ERC-20 トークンに次の関数を追加します。\n\n| 関数 | 役割 |\n| --- | --- |\n| `lock(reason, amount, time)` | 呼び出し元のトークン `amount` を、`reason` のもとで `time` 秒間ロックする |\n| `tokensLocked(of, reason)` | ある理由で現在ロックされている量 |\n| `tokensLockedAtTime(of, reason, time)` | 将来のタイムスタンプ時点でもまだロックされている量 |\n| `totalBalanceOf(of)` | ロック中 + 送金可能な残高の合計 |\n| `extendLock(reason, time)` | ロック解除時刻をさらに先に延ばす |\n| `increaseLockAmount(reason, amount)` | 既存のロックにトークンを追加する |\n| `tokensUnlockable(of, reason)` / `getUnlockableTokens(of)` | ロックの期限が切れたトークン |\n| `unlock(of)` | 期限切れのロックをすべて解除し、送金可能な残高に戻す |\n\n`Locked` と `Unlocked` のイベントにより、`Transfer` が残高を追跡するのと同じように、ウォレットやインデクサーがロックの状態を追跡できます。\n\n1 つのロックをアプリの多くの部分から読み取れるため、*n* 日間トークンをロックしたユーザーは、たとえばその期間中に複数回の投票ができます。1 回限りのステーキング送金では、これは簡単にはできません。\n\n## サンプルコード\n\n別のコントラクトからロック可能なトークンを使う例:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface ILockableToken {\n    function lock(bytes32 reason, uint256 amount, uint256 time) external returns (bool);\n    function tokensLocked(address of_, bytes32 reason) external view returns (uint256);\n    function totalBalanceOf(address of_) external view returns (uint256);\n    function unlock(address of_) external returns (uint256);\n}\n\ncontract Voting {\n    ILockableToken public immutable token;\n    bytes32 public constant GOV = \"GOV\";\n\n    constructor(ILockableToken t) { token = t; }\n\n    // Voting weight = tokens the voter has locked for governance.\n    function weight(address voter) external view returns (uint256) {\n        return token.tokensLocked(voter, GOV);\n    }\n}\n```\n\nユーザーはトークンに対して直接ロックします（ロックされるのは `msg.sender` 自身のトークンです）。\n\n```ts\nawait token.lock(encodeBytes32String(\"GOV\"), parseUnits(\"100\", 18), 7n * 24n * 3600n);\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。確定しなかったため、実際に使われているインターフェースは上記と異なる場合があります。\n- 仕様書では、イベントのシグネチャにおける理由の型が `uint256` と `bytes32` で混在しています。連携する実際のコントラクトを確認してください。\n- 残高のうちロック解除された部分だけが移動できるように、`transfer` をオーバーライドする必要があります。仕様書はこれを実装に任せているため、慎重に監査してください。\n- ロックは理由ごとに管理されます。既存のロックを変更するには、`increaseLockAmount` または `extendLock` を使います。\n"},"ko":{"lang":"ko","tldr":"토큰 컨트랙트 자체에서 지정한 사유로 토큰을 시간 잠금할 수 있게 하는 ERC-20 확장. 보유자는 토큰을 에스크로로 보내지 않고 자기 잔액에 그대로 둘 수 있다.","tags":["token","erc20","locking","vesting","governance"],"related":[20,900],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1132/","markdown":"## 어떤 문제를 해결하나요?\n\n많은 앱은 사용자가 토큰을 일정 기간 잠가 두기를 요구합니다. 베스팅 일정, 거버넌스 투표, 또는 클레임 평가자로서 \"책임을 지고 있음\"을 보여 주는 경우 등입니다. 보통은 토큰을 스테이킹 또는 에스크로 컨트랙트([ERC-900](/eip-900/) 방식)로 전송합니다. 여기에는 비용이 따릅니다.\n\n- 사용자는 에스크로를 신뢰해야 하고 먼저 승인(approve)해야 합니다.\n- 추가 전송에 gas가 듭니다.\n- 토큰이 `balanceOf`에서 사라져서 지갑에 오해를 부르는 잔액이 표시됩니다.\n- 사용자는 토큰을 되찾는 것을 기억해야 하고, 잠긴 토큰을 같은 앱의 다른 곳에서 사용할 수 없습니다.\n\nERC-1132는 토큰을 보유자의 계정에 그대로 두고, 토큰 컨트랙트 안에 잠금을 기록합니다. 각 잠금에는 `bytes32` 타입의 **사유**(reason)가 붙습니다(예: `\"GOV\"` 또는 `\"CLAIM_ASSESS\"`).\n\n## 어떻게 동작하나요?\n\n이 확장은 ERC-20 토큰에 다음 함수를 추가합니다.\n\n| 함수 | 역할 |\n| --- | --- |\n| `lock(reason, amount, time)` | 호출자의 토큰 `amount`를 `reason` 아래에서 `time`초 동안 잠금 |\n| `tokensLocked(of, reason)` | 어떤 사유로 현재 잠겨 있는 양 |\n| `tokensLockedAtTime(of, reason, time)` | 미래의 타임스탬프에도 여전히 잠겨 있을 양 |\n| `totalBalanceOf(of)` | 잠긴 잔액 + 전송 가능한 잔액 |\n| `extendLock(reason, time)` | 잠금 해제 시각을 더 뒤로 미룸 |\n| `increaseLockAmount(reason, amount)` | 기존 잠금에 토큰을 더 추가 |\n| `tokensUnlockable(of, reason)` / `getUnlockableTokens(of)` | 잠금 기간이 끝난 토큰 |\n| `unlock(of)` | 만료된 잠금을 모두 해제해 전송 가능한 잔액으로 되돌림 |\n\n`Locked`와 `Unlocked` 이벤트 덕분에 지갑과 인덱서는 `Transfer`가 잔액을 추적하듯 잠금 상태를 추적할 수 있습니다.\n\n하나의 잠금을 앱의 여러 부분에서 읽을 수 있으므로, 토큰을 *n*일 동안 잠근 사용자는 예를 들어 그 기간 동안 여러 번 투표할 수 있습니다. 일회성 스테이킹 전송으로는 이를 하기 어렵습니다.\n\n## 샘플 코드\n\n다른 컨트랙트에서 잠금 가능한 토큰 사용하기:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface ILockableToken {\n    function lock(bytes32 reason, uint256 amount, uint256 time) external returns (bool);\n    function tokensLocked(address of_, bytes32 reason) external view returns (uint256);\n    function totalBalanceOf(address of_) external view returns (uint256);\n    function unlock(address of_) external returns (uint256);\n}\n\ncontract Voting {\n    ILockableToken public immutable token;\n    bytes32 public constant GOV = \"GOV\";\n\n    constructor(ILockableToken t) { token = t; }\n\n    // Voting weight = tokens the voter has locked for governance.\n    function weight(address voter) external view returns (uint256) {\n        return token.tokensLocked(voter, GOV);\n    }\n}\n```\n\n사용자는 토큰에서 직접 잠금을 겁니다(잠기는 것은 `msg.sender` 자신의 토큰입니다).\n\n```ts\nawait token.lock(encodeBytes32String(\"GOV\"), parseUnits(\"100\", 18), 7n * 24n * 3600n);\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 확정되지 않았으므로 실제로 쓰이는 인터페이스는 위의 것과 다를 수 있습니다.\n- 명세서는 이벤트 시그니처에서 reason에 `uint256`과 `bytes32`를 섞어 씁니다. 연동하는 실제 컨트랙트를 확인하세요.\n- 잔액 중 잠기지 않은 부분만 이동할 수 있도록 `transfer`를 오버라이드해야 합니다. 명세서는 이를 구현에 맡기고 있으므로 꼼꼼히 감사하세요.\n- 잠금은 사유별로 관리됩니다. 기존 잠금을 바꾸려면 `increaseLockAmount` 또는 `extendLock`을 사용하세요.\n"},"zh":{"lang":"zh","tldr":"ERC-20 的一项扩展，允许在代币合约内部以指定原因对代币进行时间锁定，持有者无需把代币转入托管合约，仍保留在自己的余额中。","tags":["token","erc20","locking","vesting","governance"],"related":[20,900],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1132/","markdown":"## 它解决什么问题？\n\n许多应用需要用户把代币锁定一段时间：归属（vesting）计划、治理投票，或作为理赔评估者展示\"利益相关\"。通常的做法是把代币转入质押或托管合约（[ERC-900](/eip-900/) 风格）。这样做有代价：\n\n- 用户必须信任托管合约，并且要先对它授权，\n- 额外的转账要消耗 gas，\n- 代币从 `balanceOf` 中消失，钱包显示的余额具有误导性，\n- 用户必须记得把代币取回，并且无法在同一应用的其他地方使用被锁定的代币。\n\nERC-1132 让代币留在持有者的账户中，并在代币合约内部记录锁定，每个锁定都带有一个 `bytes32` 类型的**原因**（reason），例如 `\"GOV\"` 或 `\"CLAIM_ASSESS\"`。\n\n## 它如何运作\n\n该扩展为 ERC-20 代币增加以下函数：\n\n| 函数 | 用途 |\n| --- | --- |\n| `lock(reason, amount, time)` | 以 `reason` 为原因，把调用者的 `amount` 数量代币锁定 `time` 秒 |\n| `tokensLocked(of, reason)` | 某个原因下当前被锁定的数量 |\n| `tokensLockedAtTime(of, reason, time)` | 在未来某个时间戳仍将被锁定的数量 |\n| `totalBalanceOf(of)` | 锁定余额 + 可转账余额 |\n| `extendLock(reason, time)` | 把解锁时间进一步推后 |\n| `increaseLockAmount(reason, amount)` | 向已有的锁定中追加代币 |\n| `tokensUnlockable(of, reason)` / `getUnlockableTokens(of)` | 锁定已到期的代币 |\n| `unlock(of)` | 把所有已到期的锁定释放回可转账余额 |\n\n`Locked` 和 `Unlocked` 事件让钱包和索引器可以跟踪锁定状态，就像 `Transfer` 跟踪余额一样。\n\n由于同一个锁定可以被应用的多个部分读取，锁定代币 *n* 天的用户，例如可以在这段时间内投多次票，而一次性的质押转账不容易做到这一点。\n\n## 示例代码\n\n从另一个合约中使用可锁定的代币：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface ILockableToken {\n    function lock(bytes32 reason, uint256 amount, uint256 time) external returns (bool);\n    function tokensLocked(address of_, bytes32 reason) external view returns (uint256);\n    function totalBalanceOf(address of_) external view returns (uint256);\n    function unlock(address of_) external returns (uint256);\n}\n\ncontract Voting {\n    ILockableToken public immutable token;\n    bytes32 public constant GOV = \"GOV\";\n\n    constructor(ILockableToken t) { token = t; }\n\n    // Voting weight = tokens the voter has locked for governance.\n    function weight(address voter) external view returns (uint256) {\n        return token.tokensLocked(voter, GOV);\n    }\n}\n```\n\n用户直接在代币上锁定（被锁定的是 `msg.sender` 自己的代币）：\n\n```ts\nawait token.lock(encodeBytes32String(\"GOV\"), parseUnits(\"100\", 18), 7n * 24n * 3600n);\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。它没有最终定稿，因此实际使用中的接口可能与上面的不同。\n- 规范在事件签名中，对 reason 混用了 `uint256` 和 `bytes32`；请检查你要集成的实际合约。\n- 必须重写 `transfer`，使得只有余额中未锁定的部分才能转移。规范把这一点留给实现者，因此请仔细审计。\n- 锁定按原因区分；若要修改已有的锁定，请使用 `increaseLockAmount` 或 `extendLock`。\n"}}}
