Skip to main content
This guide provides an in-depth look at the EVM plugin’s architecture, components, and implementation details.

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

  1. Always validate addresses before executing transactions
  2. Use gas buffers (typically 20%) for reliable execution
  3. Implement retry logic for network failures
  4. Cache frequently accessed data to reduce RPC calls
  5. Use simulation before executing expensive operations
  6. Monitor gas prices and adjust limits accordingly
  7. Handle slippage appropriately for swaps
  8. 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