This repository demonstrates a Multi-Utility NFT contract with:
- Phased Minting (using Merkle Proofs).
- Discount Verification with Signatures.
- Vesting Integration (Sablier).
- Security Best Practices.
- A Foundry Test Suite (target: 80%+ Coverage).
-
src/InsomniaNFT.sol
Main NFT contract implementing:- Phased minting (phase 1: free for whitelisted users, phase 2: discounted, phase 3: open to all).
- Merkle proof verification.
- Signature checking for discount eligibility.
- Sablier vesting integration for mint fees.
-
src/InsomniaToken.sol
ERC20 token used for mint payments. -
test/
Foundry test contracts covering:- Minting phases.
- Merkle proof correctness.
- Signature validation.
- Vesting logic (Sablier).
- Additional edge cases.
-
script/Deploy.s.sol
A sample Foundry script to deploy both the ERC20 token and NFT contract on a chain.
-
Install Foundry (if not already installed):
curl -L https://foundry.paradigm.xyz | bash foundryup
-
Clone the repository:
git clone <REPO_LINK> cd insomnia-nft
-
Install Dependencies:
forge install
- This will download the required packages, including OpenZeppelin and Sablier (if configured).
-
Build & Test:
forge build forge test
To generate the coverage report, make sure you have llvm-cov or related requirements installed, then run:
forge coverage
Your goal is to achieve 80% or higher overall coverage.
The contract is designed with security in mind, addressing:
- Reentrancy protection (e.g., checks-effects-interactions, or modifiers like
nonReentrant
if needed). - Signature validation (to ensure discounted minting can’t be exploited).
- Merkle proof checks (preventing unauthorized mints).
- Access control using
Ownable
(limit certain functions to the contract owner). - Input validation and revert conditions.
This project is licensed under the MIT License. Feel free to use it as a reference or baseline for your own projects.