OpenZeppelin / OpenZeppelin/openzeppelin-contracts

ERC20Vesting: vesting functionality for ERC20 tokens

Open
#4,441 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Solidity
Stars
27.2k
Forks
12.4k
Avg merge
2d 19h
Merged PRs (30d)
33

Description

🧐 Motivation
Escrowed tokens are omnipresent in DeFi, as governance, airdrops and liquidity mining use vesting to control dumping. I suggest adding an ERC20Vesting extension that easily allows vesting tokens.

📝 Details

Vesting can be used in particular in combination with ERC20Wrapper.
The vesting schedule is linear by default but can be overriden (we use some exponential for our own vesting schedule).
The logic when withdrawing isn't fixed: the extension returns the amount already vested and the amount remaining, up to the implementation to choose whether to allow early unlock and which penalty to apply.

I think it would make sense to add some additional virtual function to handle the data field, or to modify a schedule (eg, to allow partial withdrawal).
The function names differ from VestingWallet, maybe it would make sense to harmonize those.
Please give me feedback!

Draft implementation: https://github.com/Keref/openzeppelin-contracts/blob/master/contracts/token/ERC20/extensions/ERC20Vesting.sol

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked draft ERC20Vesting implementation and comparing it with the existing VestingWallet and ERC20Wrapper APIs. Clarify the vesting schedule, withdrawal behavior, data handling, and function naming before proposing an implementation; done requires agreement on the extension's scope and API.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.