Skip to content

CodeComrade001/foundry-merkle-airdrop-cu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪂 Foundry Merkle Airdrop CU

A simple and gas-optimized Merkle tree–based airdrop contract built using Foundry.
Users can claim tokens if they are in a predefined Merkle tree and provide a valid EIP-712 signature.


📦 Features

  • ✅ Airdrop protected by a Merkle root (only whitelisted addresses can claim)
  • ✅ EIP-712 signature verification (ensures the claim is authorized)
  • ✅ Single-claim enforcement (no double-spending)
  • ✅ Uses OpenZeppelin libraries for security
  • ✅ Built and tested using Foundry

🧱 Contract Summary

  • The contract uses:
    • MerkleProof for validating whitelist
    • EIP712 & ECDSA for verifying claims via off-chain signatures
    • SafeERC20 for safe token transfers
  • A user must:
    1. Have a valid Merkle proof
    2. Provide a valid EIP-712 signature
    3. Have not claimed before

🧪 How to Test It

1. Clone & Install

Documentation

https://book.getfoundry.sh/

Usage

Build

$ forge build

Test

$ forge test

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Anvil

$ anvil

Deploy

$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>

Cast

$ cast <subcommand>

Help

$ forge --help
$ anvil --help
$ cast --help

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published