Architecture Overview
The EVM plugin follows a modular architecture with clear separation of concerns:Core Components
EVMService
The central service that manages blockchain connections and wallet data:Actions
Transfer Action
Handles native and ERC20 token transfers:Swap Action
Integrates with multiple DEX aggregators:Bridge Action
Cross-chain token transfers using LiFi:Providers
Wallet Provider
Supplies wallet balance information across all chains:Token Balance Provider
Dynamic provider for checking specific token balances:Templates
AI prompt templates for parameter extraction:Chain Configuration
The plugin supports dynamic chain configuration:Token Resolution
The plugin automatically resolves token symbols to addresses:Governance Implementation
The plugin includes comprehensive DAO governance support:Error Handling
Comprehensive error handling for common scenarios:Testing
The plugin includes comprehensive test coverage:Best Practices
- Always validate addresses before executing transactions
- Use gas buffers (typically 20%) for reliable execution
- Implement retry logic for network failures
- Cache frequently accessed data to reduce RPC calls
- Use simulation before executing expensive operations
- Monitor gas prices and adjust limits accordingly
- Handle slippage appropriately for swaps
- Validate token approvals before transfers
Troubleshooting
Common issues and solutions:- “Insufficient funds”: Check wallet balance includes gas costs
- “Invalid address”: Ensure address is checksummed correctly
- “Gas estimation failed”: Try with a fixed gas limit
- “Nonce too low”: Reset nonce or wait for pending transactions
- “Network error”: Check RPC endpoint availability