EIPs Explained

ERC-5725 · Final · ERC · 2022-09-08

ERC-5725: Transferable Vesting NFT

An ERC-721 extension where each NFT represents tokens that unlock over time, giving vesting and timelock contracts one transferable, queryable interface.

What problem does it solve?

Team allocations, investor deals and token sales usually release tokens gradually. Every project wrote its own vesting or timelock contract, each with different function names, so wallets, dashboards and marketplaces could not show or interact with them generically. Vesting tied to one address also could not be transferred or sold.

ERC-5725 turns a vesting position into an ERC-721 NFT. The NFT holder receives the underlying tokens (usually ERC-20) as they unlock, and because it is an NFT, the position can move between wallets or be traded on existing marketplaces.

How it works

Each tokenId has a payout token and a deterministic release curve between vestingStart and vestingEnd. The curve can be linear, cliff, exponential or any custom deterministic shape. The interface exposes:

Function Meaning
vestedPayout(id) Total unlocked so far, including already claimed
vestedPayoutAtTime(id, ts) Same, at any past or future timestamp (0 before mint)
vestingPayout(id) Still locked; vested + vesting = total
claimedPayout(id) Already withdrawn
claimablePayout(id) Available to claim right now
vestingPeriod(id) (start, end) unix timestamps
payoutToken(id) Address of the token being paid out
claim(id) Send the claimable amount to the caller

Claiming is restricted to the owner or approved addresses. Claim approval is separate from NFT transfer approval: setClaimApproval / setClaimApprovalForAll let someone claim on your behalf without being able to move the NFT. PayoutClaimed, ClaimApproval and ClaimApprovalForAll events make activity indexable.

Timestamps rather than block numbers are used so the same interface works across EVM chains with different block times. Because vestedPayoutAtTime is deterministic, a UI can sample it across the vesting period to draw the release curve.

Sample code

Reading a vesting NFT and claiming (ethers v6):

import { Contract, Wallet, JsonRpcProvider, formatUnits } from "ethers";

const abi = [
  "function claimablePayout(uint256) view returns (uint256)",
  "function vestingPeriod(uint256) view returns (uint256,uint256)",
  "function vestedPayoutAtTime(uint256,uint256) view returns (uint256)",
  "function claim(uint256)",
];
const provider = new JsonRpcProvider(process.env.RPC_URL);
const signer = new Wallet(process.env.PRIVATE_KEY!, provider);
const vesting = new Contract(process.env.VESTING_NFT!, abi, signer);

const id = 1n;
const [start, end] = await vesting.vestingPeriod(id);
const mid = (start + end) / 2n;
console.log("vested at midpoint:", formatUnits(await vesting.vestedPayoutAtTime(id, mid), 18));

if ((await vesting.claimablePayout(id)) > 0n) {
  await (await vesting.claim(id)).wait();
}

Things to know

  • Status: Final. The ERC-165 interface ID given in the spec is 0xbd3a202b.
  • Implementations must track claimed amounts per NFT so a holder can never withdraw more than the schedule allows, even across transfers.
  • When buying a vesting NFT, check claimablePayout first: the seller can claim right up to the sale, and you only receive what remains.
  • Historical claims are not queryable on-chain; rebuild them from PayoutClaimed events.
  • Rentals and multi-recipient schedules are out of scope and left to extensions.

#nft #vesting #defi #erc721 #timelock

Details

Authors
Apeguru (@Apegurus), Marco De Vries <[email protected]>, Mario <[email protected]>, DeFiFoFum (@DeFiFoFum), Elliott Green (@elliott-green)
Status
Final
Type
Standards Track / ERC
Created
2022-09-08
Requires

Machine-readable: Markdown · JSON