Skip to main content
Multicall3 is a utility contract that enables batching multiple contract calls into a single transaction. This provides gas savings, atomic execution, and simplified interaction patterns for complex multi-step operations. Contract Address: 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 using aggregate3Value:

Error Handling Strategies

Common Use Cases

Query multiple token balances for multiple users efficiently.
Fetch prices from multiple DEXs in a single call for best execution.
Cast votes on multiple proposals in one transaction.
Claim rewards, compound, and rebalance positions atomically.
Mint, transfer, or approve multiple NFTs efficiently.

Gas Optimization

Multicall3 saves gas through:
  1. Base Fee Savings: Pay the 21,000 gas base fee only once
  2. Storage Optimization: Warm storage slots across calls
  3. Reduced State Changes: Fewer transaction state transitions
Typical savings: 20-40% for batching 5+ calls

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

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

Troubleshooting

Further Reading