Skip to main content

Command Palette

Search for a command to run...

Building an ERC20 Token Vesting Contract in Solidity

etherum solidity project

Published
2 min read
H

I am a software engineer with a strong background in competitive programming and backend focused development.

I graduated in IT from Army Institute of Technology, Pune (2025) and currently work at NxtWave, where I build and review technical content around data structures, algorithms, and problem solving.

My recent work is focused on smart contract and protocol development using Solidity and Foundry. I enjoy building systems where correctness, security, and clear invariants matter such as token vesting, staking mechanisms, and upgradeable protocols.

Earlier, I spent several years in competitive programming (Codeforces Expert, 5★ CodeChef), which shaped how I approach problem solving, edge cases, and testing.

On this blog, I write about the design and implementation of smart contracts, testing strategies, and engineering tradeoffs I encounter while building Web3 protocols.

Building an ERC20 Token Vesting Contract in Solidity

Token distribution is one of the most sensitive parts of any Web3 project.
If done incorrectly, it can lead to early sell-offs, broken incentives, and loss of trust.

I wanted to understand how real projects handle this problem, so I built an ERC20 token vesting contract from scratch.

The problem

Sending tokens directly to contributors or advisors gives no guarantee that:

  • Tokens stay locked

  • Incentives remain aligned

  • Funds are protected if someone exits early

Most serious projects solve this using vesting contracts.

What I built

A Solidity-based ERC20 vesting contract that:

  • Locks tokens until a cliff period

  • Releases tokens gradually over a fixed duration

  • Lets beneficiaries claim only what’s vested

  • Allows the owner to revoke unvested tokens

  • Is fully covered with Foundry tests

images

vvbb.png

Key learnings

  • How cliff and linear vesting are calculated on-chain

  • Why time-based edge cases can easily introduce bugs

  • How testing improves confidence in financial smart contracts

What’s next

I plan to add:

  • A simple frontend dashboard

  • Support for multiple beneficiaries

  • Better UX for claiming tokens

Code

GitHub: https://github.com/harshkumarrai/ethereum-solidity-projects-/tree/master/Projects/erc20%20%2B%20vesting%20project

Deploy link : https://vesting-rf6y7hrtu-harsh-kumar-rais-projects.vercel.app/
Project focus: Smart contract design & security.
Basic frontend added only for interaction.

Building slowly, understanding deeply, and learning in public.