ai16z / eliza

Conversational Agent for Twitter and Discord
https://ai16z.github.io/eliza/
MIT License
2.36k stars 665 forks source link

feat: implement coinbase mass payments across base/sol/eth/pol/arb #569

Closed monilpat closed 4 days ago

monilpat commented 4 days ago

Relates to:

Issue: Ensure dynamic parsing, validation, and execution for mass payouts using Coinbase SDK.


Risks

Risk Level: Medium


Background

What does this PR do?

This PR implements dynamic mass payout capabilities using the Coinbase SDK. Key updates include:

  1. Parsing transferTemplate details to dynamically construct transactions for processing.
  2. Validating input parameters (e.g., receivingAddresses, network) to ensure they comply with supported formats and networks.
  3. Appending all processed transactions (successes and failures) to a CSV file dynamically created in src/plugins/transactions.csv.
  4. Generating wallet details dynamically if not already present.
  5. If a wallet is not pre-configured:
    • A new wallet is generated and saved to characters/charactername.character.json under settings.secrets.
    • If the character file does not exist, the wallet details are saved to a character-seed.txt file, and a note is added to move these details manually to the character's settings or environment variables.

What kind of change is this?

Improvements: Adds dynamic appending and parsing of CSV data.
Features: Introduces mass payouts using Coinbase SDK for supported networks.


Documentation changes needed?

Yes. The changes require an update to project documentation to reflect:

  1. New transferTemplate structure for mass payouts.
  2. Supported networks (base, sol, eth, arb, pol).
  3. Steps to validate environment variables for COINBASE_API_KEY and COINBASE_PRIVATE_KEY.
  4. Guidance for handling dynamically generated wallets (e.g., adding details from character-seed.txt to settings.secrets or .env).

Testing

Where should a reviewer start?

  1. massPayoutProvider.get function for dynamic parsing and handling of CSV records.
  2. executeMassPayout logic for sequential processing of transactions.
  3. Integration of Coinbase SDK for wallet initialization and balance checks.

Detailed testing steps

  1. Setup Environment Variables:

    • Ensure COINBASE_API_KEY and COINBASE_PRIVATE_KEY are set in the .env file or runtime settings.
  2. Process Mass Payout Transactions:

    • Execute a payout request using the SEND_MASS_PAYOUT action.
    • Validate successful transactions are logged in the CSV file.
  3. Wallet Generation:

    • Remove COINBASE_GENERATED_WALLET_HEX_SEED and COINBASE_GENERATED_WALLET_ID from your configuration.
    • Verify that a new wallet is created and stored in characters/charactername.character.json under settings.secrets.
    • If the character file does not exist, confirm that the wallet details are written to charactername-seed.txt with instructions to move them manually.
  4. Validate Edge Cases:

    • Process invalid addresses.
    • Handle insufficient wallet balances.
    • Verify proper CSV appending and transaction updates.

Screenshots

https://drive.google.com/file/d/160rreXAoKBj9db8lIMjF5LW8EmAihQmi/view?usp=sharing


After

Screen Recording:


Deploy Notes


Database changes


Deployment instructions

  1. Deploy as part of the next release cycle.
  2. Monitor logs for unexpected behaviors during payout execution.
  3. Validate that all necessary environment variables are set and accessible.
  4. Ensure new wallets are properly stored or manually moved to character configurations.

[Discord](https://discord.gg/ai16z) username

0x8664


lalalune commented 4 days ago

Very cool but we should think about adding this to the db

monilpat commented 3 days ago

Very cool but we should think about adding this to the db

Thanks for the review - yeah totally the csv was an interim patch, it definitely should be part of the db :)