Merkle Distributor
Introduction
The Merkle Distributor provides a modular and efficient solution for token distribution using merkle proofs, supporting various token standards and customizable distribution patterns.
π Quick Start
What is a Merkle Distributor?
A Merkle Distributor is a smart contract system that enables efficient and verifiable token airdrops. Instead of storing all recipient data on-chain, it uses a Merkle tree where only the root is stored, significantly reducing gas costs while maintaining security.
Key Benefits
β Gas Efficient - Only stores Merkle root on-chain
β Verifiable - Claims are cryptographically proven
β Flexible - Supports multiple token types and distribution patterns
β Secure - Built with security best practices
π System Overview
Architecture Diagram
Core Components
Base Contract - Core distribution logic
Extensions - Token-specific implementations
Custom Extensions - Special use cases
π§ Core Contracts
BaseMerkleDistributor
The foundation contract providing core distribution functionality.
Key Features
Storage Pattern (ERC7201)
The contract uses ERC7201 storage pattern:
Claim Mechanism
Two ways to claim tokens:
Direct Claim - Recipients claim their own tokens
Delegate Claim - Authorized delegate claims for recipients
Security Features
Reentrancy protection on all claim functions
Double-claim prevention via leaf tracking
Time-based access control
Owner-only administrative functions
π Extension Contracts
ERC20 Extensions
TokenTableMerkleDistributor
Standard ERC20 token distribution with time-locked claims.
TokenTableNativeMerkleDistributor
Distributes native tokens (ETH) with similar functionality.
Special Features:
Handles ETH transfers
receive()
function for accepting ETHNative token withdrawal support
ERC721 Extensions
SimpleERC721MerkleDistributor
Mints new NFTs to recipients.
Key Behavior:
Creates new tokens via
safeMint
No withdrawal function (mints are permanent)
SimpleNoMintERC721MerkleDistributor
Distributes pre-existing NFTs.
Key Behavior:
Transfers NFTs held by contract
Owner can withdraw specific token IDs
Repurposes
amount
parameter astokenId
Custom Extensions
CustomFeesNativeMerkleDistributor
Native token distributor with fee threshold logic.
Features:
Configurable
feelessThreshold
Claims below threshold bypass fees
Modified claim flow for fee handling
NFTGatedMerkleDistributor
Claims gated by NFT ownership.
Special Features:
Claims tied to NFT ownership
Delegate.xyz integration
Auto-recipient from NFT owner
π° Fee System
Overview
The fee system provides flexible fee collection for claims.
Components
Configuration
Fee Collector - Address that receives fees
Fee Token - Native or ERC20 token for fees
Fee Calculation - External
ITTUFeeCollector
interface
π Security
Access Control
Owner
Set parameters, withdraw tokens, configure extensions
Delegate
Claim on behalf of recipients
Users
Claim their allocated tokens
Security Features
Reentrancy Guards - All state-changing functions protected
Leaf Tracking - Prevents double claims
Time Windows - Enforced distribution periods
Proof Verification - Cryptographic claim validation
π‘ Events & Errors
Events
ClaimDelegateSet
Delegate address updated
Claimed
Successful token claim
Errors
UnsupportedOperation
Operation not allowed
0x9ba6061b
TimeInactive
Outside claim window
0x0c143eb8
InvalidProof
Merkle proof invalid
0x09bde339
LeafUsed
Already claimed
0x0e4b0ab2
IncorrectFees
Fee amount mismatch
0x1669aa83
Last updated
Was this helpful?