eliza icon indicating copy to clipboard operation
eliza copied to clipboard

feat: add coinbase ERC20, ERC721, and ERC1155 tokenContract deployment / invokement plugin

Open monilpat opened this issue 1 year ago • 0 comments

Pull Request Description

Relates to:

N/A - New feature implementation

Risks

Low - This PR adds new functionality without modifying existing features. The token contract plugin is only enabled when proper Coinbase credentials are present.

Background

What does this PR do?

This PR adds a new Coinbase token contract plugin that enables:

  1. Deployment of ERC20, ERC721, and ERC1155 token contracts
  2. Interaction with deployed smart contracts through method invocation
  3. Automatic logging of contract deployments and interactions to CSV files
  4. Integration with existing Coinbase wallet management system

What kind of change is this?

Features (non-breaking change which adds functionality)

  • Adds new token contract deployment capabilities
  • Adds contract interaction functionality
  • Extends existing Coinbase plugin suite

Documentation changes needed?

My changes require a change to the project documentation.

  • Added comprehensive documentation for the token contract plugin in docs/docs/packages/plugins.md
  • Updated plugin documentation with new features and usage examples
  • Added configuration instructions and best practices

Testing

Where should a reviewer start?

  1. Review the token contract plugin implementation:

    • packages/plugin-coinbase/src/plugins/tokenContract.ts
    • packages/plugin-coinbase/src/types.ts (new token contract types)
    • packages/plugin-coinbase/src/templates.ts (new templates)
  2. Review the integration:

    • agent/src/index.ts (plugin initialization)
    • packages/plugin-coinbase/src/index.ts (plugin exports)

Detailed testing steps

  1. Configure Coinbase credentials:

    export COINBASE_API_KEY=your_api_key
    export COINBASE_PRIVATE_KEY=your_private_key
    
  2. Test ERC20 token deployment:

    await runtime.triggerAction("DEPLOY_TOKEN_CONTRACT", {
      contractType: "ERC20",
      name: "TestToken",
      symbol: "TST",
      network: "base",
      totalSupply: 1000000
    });
    
  3. Test ERC721 (NFT) deployment:

    await runtime.triggerAction("DEPLOY_TOKEN_CONTRACT", {
      contractType: "ERC721",
      name: "TestNFT",
      symbol: "TNFT",
      network: "eth",
      baseURI: "https://api.test.com/metadata/"
    });
    
  4. Test contract interaction:

    await runtime.triggerAction("INVOKE_CONTRACT", {
      contractAddress: "0x123...",
      method: "transfer",
      abi: [...],
      args: {
        to: "0x456...",
        amount: "1000000000000000000"
      },
      network: "base"
    });
    
  5. Verify CSV logging:

    • Check contracts.csv for deployment records
    • Verify transaction details are properly logged

https://drive.google.com/file/d/1q5ezLF6KOgJdQ6x04m_lStiO2Y-jzCEq/view?usp=sharing

https://drive.google.com/file/d/1cFK9RbxTw7GaD3J0sfxva0t4UIuZrmpQ/view?usp=sharing

Files changed:

  1. packages/plugin-coinbase/src/plugins/tokenContract.ts (new)
  2. packages/plugin-coinbase/src/types.ts (updated)
  3. packages/plugin-coinbase/src/templates.ts (updated)
  4. packages/plugin-coinbase/src/index.ts (updated)
  5. agent/src/index.ts (updated)
  6. docs/docs/packages/plugins.md (updated)

Deploy Notes

No special deployment steps required. The plugin is automatically enabled when Coinbase credentials are present.

Discord username

N/A

monilpat avatar Dec 03 '24 00:12 monilpat