This project implements an advanced NFT smart contract on Ethereum using Solidity. It features a Merkle-tree-based whitelist, gas optimization with BitMaps, commit-reveal randomness, a multicall interface, and a secure pull-based withdrawal system.
- Only addresses in the Merkle Tree can mint.
- Leaf format:
keccak256(abi.encodePacked(index, address)). - Prevents double claiming using BitMaps and Mapping for gas comparison.
- Two minting methods:
merkleMintWithMapping(): Tracks claims with a mapping.merkleMintWithBitmap(): Tracks claims with a BitMap.
- Compare gas usage between both.
- Users
commita hash of a secret and salt. - After 10 blocks, users
revealthe secret to mint a random NFT ID.
- Batch multiple
transferFrom()or other safe actions in a single transaction. - Minting is protected from abuse via multicall.
- Sale phases:
CLOSEDPRESALEPUBLICSOLD_OUT
- Contract logic is restricted based on sale phase.
- Secure pull pattern for fund distribution.
- Owner can deposit ETH to contributors.
- Each address can withdraw their allocated amount independently.
Recommended testing with Hardhat:
npm install
npx hardhat test