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.
- ✅ 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
- The contract uses:
MerkleProof
for validating whitelistEIP712
&ECDSA
for verifying claims via off-chain signaturesSafeERC20
for safe token transfers
- A user must:
- Have a valid Merkle proof
- Provide a valid EIP-712 signature
- Have not claimed before
$ forge build
$ forge test
$ forge fmt
$ forge snapshot
$ anvil
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
$ cast <subcommand>
$ forge --help
$ anvil --help
$ cast --help