eliza icon indicating copy to clipboard operation
eliza copied to clipboard

WIP: basic working plugin-evm functionality

Open yourbuddyconner opened this issue 1 year ago • 2 comments

Here's a PR description for the EVM plugin changes:

Background

What does this PR do?

This PR significantly enhances the EVM plugin functionality with several key improvements:

  1. Added core ERC-20 functionality:

    • Added ERC-20 ABI and contract interactions
    • Implemented token balance checking
    • Added support for token transfers
  2. Implemented new actions:

    • getBalance: Check ETH/token balances across chains
    • transfer: Native token and ERC-20 transfers
    • Enhanced bridge: Cross-chain token bridging via LiFi
    • Enhanced swap: DEX token swaps
    • via LiFi aggregation
Screenshot 2024-12-09 at 7 10 14 PM
  1. Fixed type safety issues and improved error handling

What kind of change is this?

  • Features (non-breaking change which adds functionality)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)

Risks

Medium:

  • Changes to core wallet functionality could impact transaction signing
  • Updates to bridge/swap logic could affect cross-chain operations
  • ERC-20 integration adds complexity to token handling

Testing

Where should a reviewer start?

  1. Review the core changes in:

    • src/actions/bridge.ts
    • src/actions/swap.ts
    • src/actions/transfer.ts
    • src/actions/getbalance.ts
  2. Check test implementation:

    • test/setup.ts - Test infrastructure
    • test/actions/bridge.test.ts - Bridge action tests
    • test/providers/wallet.test.ts - Wallet provider tests

Detailed testing steps

  1. Test basic ETH operations:
// Check balance
await getbalanceAction.handler(runtime, message, state);

// Transfer ETH
await transferAction.handler(runtime, message, state);
  1. Test ERC-20 operations:
// Check USDC balance
await getbalanceAction.handler(runtime, {
  chain: "ethereum",
  tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
});

// Bridge tokens
await bridgeAction.handler(runtime, {
  fromChain: "ethereum",
  toChain: "base",
  amount: "100",
  tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
});

Documentation changes needed?

Yes, documentation updates needed for:

  • New ERC-20 functionality
  • Updated action parameters
  • Testing setup and mocking

Deploy Notes

  • Requires environment variables:
    • EVM_PRIVATE_KEY
    • ETHERSCAN_API_KEY (optional, for token verification)
  • Dependencies on LiFi SDK and viem need to be properly versioned

Related to: #735

yourbuddyconner avatar Dec 10 '24 02:12 yourbuddyconner

Connecting this one, seems here is done most progress > https://github.com/ai16z/eliza/pull/864

0xCardiE avatar Dec 11 '24 14:12 0xCardiE

Would be cool to add crosschain zaps as well, interacting with main staking protocols to enable direct deposits from other chains

Slava-g1 avatar Dec 18 '24 00:12 Slava-g1

closing since old!

wtfsayo avatar Jan 15 '25 09:01 wtfsayo