This project implements a token airdrop system for Bored Ape Yacht Club (BAYC) NFT holders using a Merkle tree for efficient verification.
The project consists of three main components:
ApeCoin
: An ERC20 token contract.BoredApeAirdrop
: A contract managing the airdrop of ApeCoin tokens to eligible BAYC holders.- Test suite: Comprehensive tests for the smart contracts.
ApeCoin
is an ERC20 token with the following features:
- Symbol: AP
- Name: Apes
- Initial supply: 100,000 tokens (minted to the contract deployer)
- Minting function (restricted to the owner)
BoredApeAirdrop
manages the distribution of ApeCoin tokens to eligible BAYC holders:
- Uses a Merkle tree for efficient verification of eligible addresses and amounts
- Requires claimants to own at least one BAYC NFT
- Prevents double-claiming
- Allows the owner to withdraw remaining tokens
project-root/
│
├── contracts/
│ ├── ApeCoin.sol
│ └── BoredApeAirdrop.sol
│
├── test/
│ └── BoredApeAirdrop.ts
│
│
├── hardhat.config.js
├── package.json
└── README.md
- Clone the repository
- Install dependencies:
npm install
- Compile contracts:
npx hardhat compile
- Run tests:
npx hardhat test
- Deploy the
ApeCoin
contract - Generate the Merkle tree root and proofs for eligible addresses
- Deploy the
BoredApeAirdrop
contract with the ApeCoin address and Merkle root - Transfer ApeCoin tokens to the BoredApeAirdrop contract
- Eligible users can claim their tokens by calling
ClaimAirdrop
with their proof and amount
The test suite covers:
- Contract deployment
- Airdrop claiming for eligible addresses
- Invalid claim attempts
Run tests with: npx hardhat test
- Ensure the Merkle tree is generated correctly and securely
- Keep the contract owner's private key secure
- Consider implementing a pause mechanism for emergency situations
This project is licensed under the MIT License.