0xcA11bde05977b3631167028862bE2a173976CA11
Deployment Status: Default preinstall
Repository: github.com/mds1/multicall
Key Features
- Gas Efficiency: Save on base transaction costs by batching calls
- Atomic Execution: All calls succeed or all revert together (optional)
- State Consistency: Read multiple values from the same block
- Flexible Error Handling: Choose between strict or permissive execution
- Value Forwarding: Send ETH/native tokens with calls
Core Methods
aggregate
Execute multiple calls and revert if any fail.
tryAggregate
Execute multiple calls, returning success status for each.
aggregate3
Most flexible method with per-call configuration.
aggregate3Value
Like aggregate3 but allows sending value with each call.
Usage Examples
Basic Batch Calls
Complex DeFi Operations
Combine multiple DeFi operations atomically:Reading Protocol State
Get consistent protocol state in one call:Advanced Features
Value Forwarding
Send native tokens with calls usingaggregate3Value
:
Error Handling Strategies
Common Use Cases
Token Balance Queries
Token Balance Queries
Query multiple token balances for multiple users efficiently.
DEX Price Aggregation
DEX Price Aggregation
Fetch prices from multiple DEXs in a single call for best execution.
Governance Voting
Governance Voting
Cast votes on multiple proposals in one transaction.
DeFi Position Management
DeFi Position Management
Claim rewards, compound, and rebalance positions atomically.
NFT Batch Operations
NFT Batch Operations
Mint, transfer, or approve multiple NFTs efficiently.
Gas Optimization
Multicall3 saves gas through:- Base Fee Savings: Pay the 21,000 gas base fee only once
- Storage Optimization: Warm storage slots across calls
- Reduced State Changes: Fewer transaction state transitions
Best Practices
- Batch Size: Optimal batch size is 10-50 calls depending on complexity
- Gas Limits: Set appropriate gas limits for complex batches
- Error Handling: Use
allowFailure
wisely based on criticality - Return Data: Decode return data carefully, checking success flags
- Reentrancy: Be aware of potential reentrancy in batched calls
Comparison with Alternatives
Feature | Multicall3 | Multicall2 | Manual Batching |
---|---|---|---|
Gas Efficiency | Excellent | Good | Poor |
Error Handling | Flexible | Basic | N/A |
Value Support | Yes | No | Yes |
Deployment | Standard address | Varies | N/A |
Block Consistency | Yes | Yes | No |
Integration Libraries
Popular libraries with Multicall3 support:- ethers-rs: Rust implementation
- web3.py: Python Web3 library
- viem: TypeScript alternative to ethers
- wagmi: React hooks for Ethereum