eliza icon indicating copy to clipboard operation
eliza copied to clipboard

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

Open monilpat opened this issue 1 year ago • 0 comments


Relates to:

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


Risks

Risk Level: Medium

  • Impact on transaction accuracy due to potential mapping mismatches between CSV headers and object fields.
  • Dependencies on external Coinbase SDK stability.

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

  • Dynamic CSV appending:
Address,Amount,Status,Error Code,Transaction URL
0xA0ba2ACB5846A54834173fB0DD9444F756810f06,0.0001,Success,,https://basescan.org/tx/0x420332...
0xF14F2c49aa90BaFA223EE074C1C33b59891826bF,0.0001,Failed,Insufficient Funds,

Screen Recording:


Deploy Notes

  • Verify CSV file path in src/plugins/transactions.csv is accessible.
  • Ensure wallet initialization works seamlessly for networks without pre-generated wallet details.

Database changes

  • None.

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


monilpat avatar Nov 24 '24 20:11 monilpat