---
eip: 7444
label: ERC-7444
title: Time Locks Maturity
status: Draft
type: Standards Track
category: ERC
created: 2023-06-05
requires: 165
official: https://eips.ethereum.org/EIPS/eip-7444
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7444.md
canonical: https://eips.huatuo.xyz/ja/eip-7444/
lang: ja
tldr: 関数 1 つのインターフェース getMaturity(id)。タイムロックされたポジションがいつアンロックされるかを Unix タイムスタンプで誰にでも教え、ロックされた資産を一貫して評価・取引できるようにする。
tags: [defi, timelock, vesting, interface]
---

# ERC-7444: Time Locks Maturity

> Interface for conveying the date upon which a time-locked system becomes unlocked

**TL;DR:** 関数 1 つのインターフェース getMaturity(id)。タイムロックされたポジションがいつアンロックされるかを Unix タイムスタンプで誰にでも教え、ロックされた資産を一貫して評価・取引できるようにする。

## 何を解決するのか

タイムロックは DeFi のあらゆる場所にあります。ベスティングスケジュール、投票用にエスクローされたトークン、ロックされた流動性、債券などです。ロックされたポジションの権利自体が、たとえば [ERC-721](/eip-721/) や [ERC-1155](/eip-1155/) トークンとして譲渡可能であることも非常によくあります。そうしたポジションの価格を付けるには、いつアンロックされるかを知る必要があります。価値が残り時間に大きく左右されるからです。現状では、プロトコルごとにその日付の公開方法が異なり、そもそも公開していない場合もあるため、マーケットプレイス、レンディングプロトコル、評価ツールは、それぞれに専用のコードを書かなければなりません。

ERC-7444 は、それらすべてが必要とする唯一の情報、つまり満期日を標準化します。

## 仕組み

準拠するコントラクトは [ERC-165](/eip-165/) に対応し、次を実装します。

```solidity
function getMaturity(bytes32 id) external view returns (uint256 maturity);
```

- `id` は特定のロックを識別します。ID の導出方法は実装に任されています（ハッシュ、`bytes32` にキャストしたトークン ID など）。
- `maturity` は秒単位の Unix タイムスタンプで、`block.timestamp` と同じ単位です。
- 1 つの代替可能資産を単一のスケジュールでロックするシングルトンコントラクトでは、`id` は無視すべきで、呼び出し側は `0x0` を渡すべきです。

この標準は、既存の NFT ベースのロックシステムに対して `getMaturity` に答える別のコントラクトをデプロイすることで、後付けできます。

根拠の節では、満期までの時間が Black-Scholes のようなオプション型の価格モデルの重要な入力であり、だからこそ共通の読み取り方法が重要だと指摘しています。

## サンプルコード

このインターフェースを実装する最小限のロッカー:

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

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

interface IERC7444 {
    function getMaturity(bytes32 id) external view returns (uint256 maturity);
}

contract SimpleLocker is IERC7444 {
    struct Lock { address owner; uint256 amount; uint256 maturity; }

    IERC20 public immutable token;
    mapping(bytes32 => Lock) public locks;
    uint256 private nonce;

    constructor(IERC20 _token) { token = _token; }

    function deposit(uint256 amount, uint256 period) external returns (bytes32 id) {
        id = keccak256(abi.encode(msg.sender, nonce++));
        locks[id] = Lock(msg.sender, amount, block.timestamp + period);
        require(token.transferFrom(msg.sender, address(this), amount), "transfer");
    }

    function withdraw(bytes32 id) external {
        Lock memory l = locks[id];
        require(msg.sender == l.owner, "owner");
        require(block.timestamp >= l.maturity, "locked");
        delete locks[id];
        require(token.transfer(msg.sender, l.amount), "transfer");
    }

    function getMaturity(bytes32 id) external view returns (uint256) {
        return locks[id].maturity;
    }

    function supportsInterface(bytes4 i) external pure returns (bool) {
        return i == type(IERC7444).interfaceId || i == 0x01ffc9a7; // ERC-165
    }
}
```

## 知っておくべきこと

- ステータスは **Draft** です。
- プロトコルによってはロックを延長できます。`getMaturity` は現在の値しか返さないため、ポジションを取引したり担保に貸し出したりする直前に確認してください。
- 仕様の文章にあるリファレンス実装には誤字があり、`withdraw` の満期チェックが逆になっています。説明用と考え、そのままコピーしないでください。
- 戻り値 `0` は通常、その ID が存在しないことを意味しますが、仕様は定義していないため、実装をまたいで頼らないでください。


---

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