Skip to content

A clean and secure ERC20 implementation written in Solidity and tested with Foundry. Demonstrates smart contract best practices, unit testing, and deployment scripting.

Notifications You must be signed in to change notification settings

etherzeth/NovaERC20

Repository files navigation

NovaToken (NOVA)

NovaToken is a custom ERC20 token built using Solidity, OpenZeppelin, and Foundry.
This project demonstrates a clean, production-style implementation of an ERC20 token, complete with unit tests, deployment scripting, and a professional development workflow.


🚀 Features

  • Fully compliant ERC20 token
  • Owner-only minting
  • Self burn functionality (msg.sender burns their own tokens)
  • Uses OpenZeppelin for industry-standard security
  • Fully tested using Foundry
  • Includes a deployment script for testnet broadcasting
  • Clean, modular, beginner-friendly structure

🛠 Tech Stack

  • Solidity ^0.8.19
  • Foundry (Forge, Cast, Anvil)
  • OpenZeppelin Contracts
  • Ethereum Testnets (Sepolia / Base Sepolia / Mantle)

📦 Smart Contract

Location: src/NovaToken.sol

Key functions:

  • mint(address to, uint256 amount) — Owner only
  • burn(uint256 amount) — Token holder only
  • Inherits from ERC20 and Ownable (OpenZeppelin)

Constructor:

  • Name: NovaToken
  • Symbol: NOVA
  • Decimals: 18 (ERC20 standard)

🧪 Testing

Test file: test/NovaToken.t.sol

Test coverage includes:

  • Minting by owner
  • Revert on mint by non-owner
  • Burning tokens
  • Transferring tokens

Run all tests:

forge test -vv

Foundry cheatcodes used:

  • vm.prank
  • vm.startPrank
  • vm.expectRevert
  • assertEq
  • assertTrue

📜 Deployment

Deployment script: script/DeployNovaToken.s.sol

Deploy to testnet:

forge script script/DeployNovaToken.s.sol --rpc-url <YOUR_RPC_URL> --private-key <YOUR_PRIVATE_KEY> --broadcast

This command will broadcast a live transaction and deploy NovaToken on the selected network.


🌐 Deployed Contract (Testnet)

Network: Sepolia
Contract Address: 0xDd330eCB7068D207CF17AfcBAcfeC00276B93f9f
Transaction Hash: 0x6d214b0b5626f1726f51d3df40dedab086cd6f663662d271c5f4b9067adf2a18

Explorer:
https://sepolia.etherscan.io/


📁 Project Structure

├── src/
│   └── NovaToken.sol
├── test/
│   └── NovaToken.t.sol
├── script/
│   └── DeployNovaToken.s.sol
├── lib/
│   └── openzeppelin-contracts/
├── foundry.toml
└── README.md

🔧 Useful Foundry Commands

Build the project:

forge build

Run tests:

forge test

Run tests with logs:

forge test -vv

Format Solidity files:

forge fmt

Generate gas snapshots:

forge snapshot

Start a local Ethereum node:

anvil

Interact with contracts using Cast:

cast <subcommand>

📚 References


Summary

NovaToken demonstrates:

  • Clean ERC20 implementation
  • Access-controlled minting
  • Safe burn functionality
  • Professional Foundry-based tests
  • Automated testnet deployment
  • Clean and modular repository structure

This project forms a strong foundation for advanced smart contract development such as staking, vesting, AMMs, lending pools, and options protocols.

About

A clean and secure ERC20 implementation written in Solidity and tested with Foundry. Demonstrates smart contract best practices, unit testing, and deployment scripting.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published