eliza icon indicating copy to clipboard operation
eliza copied to clipboard

feat(plugin-sui): Add movepump action

Open ChainRex opened this issue 11 months ago • 5 comments

Relates to

Risks

Medium:

  • Financial transactions involving user funds
  • Integration with external MovePump contract
  • Complex multi-step transaction process

Background

What does this PR do?

This PR implements token creation for MovePump on Sui Network. The implementation follows a three-step process:

  • Update coin template bytecode with custom token metadata
  • Publish new coin package to Sui network
  • Create token on MovePump

What kind of change is this?

Features (non-breaking change which adds functionality)

Documentation changes needed?

Testing

Where should a reviewer start?

  1. Review the main implementation in src/actions/movepump.ts
  2. Check bytecode update logic in src/utils.ts
  3. Review token template in src/template/template_coin/

Detailed testing steps

1. (Optional) Verify Template Bytecode

  1. Compile the template_coin contract:
cd template/template_coin
sui move build
  1. Generate bytecode and compare with constant:
xxd -c 0 -p build/template_coin/bytecode_modules/template_coin.mv | head -n 1
  1. Verify the output matches TEMPLATE_COIN_BYTECODE in src/template/bytecode.ts

2. Test Token Creation via Bot Chat

  1. Start conversation with Bot using this example format:
Create a new token called MyToken with symbol MTK on MovePump and buy 1 MTK. Here's the token info:
Description: My first token on MovePump
Image: https://example.com/token.png
Website: https://mytoken.com
Twitter: https://twitter.com/mytoken
Telegram: https://t.me/mytoken
  1. Bot will process the request and return a response like:
Token MyToken (MTK) created successfully on MovePump!
Module ID: 0x[module_id]
Transaction: [transaction_hash]
View at: https://movepump.com/token/0x[module_id]::mtk::MTK
  1. Visit the returned MovePump URL

ChainRex avatar Jan 15 '25 07:01 ChainRex

POW pow

Transaction:https://suiscan.xyz/mainnet/tx/3G7PqwkDtCtZNvwXSM4cb7RVJPuZvLYycotf8P4rQ8L6 Token:https://movepump.com/token/0xf94928f8da383439908b5d0ae32dfaf51ff74a95f9ef46f9d1b97b007f5d68b4::eliza::ELIZA

ChainRex avatar Jan 15 '25 08:01 ChainRex

@coderabbitai review

ChainRex avatar Jan 15 '25 08:01 ChainRex

📝 Walkthrough

Walkthrough

The pull request introduces a new feature for creating and buying tokens on the MovePump platform within the Sui plugin. It adds a comprehensive implementation for token creation, including new dependencies, bytecode management, and a dedicated action for token generation. The changes span multiple files, introducing new modules, utility functions, and configuration settings to support this functionality.

Changes

File Change Summary
packages/plugin-sui/README.md Added "Create and Buy Token on MovePump" feature section, new CREATE_AND_BUY_TOKEN action, and dependencies @mysten/move-bytecode-template and @mysten/bcs
packages/plugin-sui/package.json Added dependencies @mysten/bcs@^1.2.1 and @mysten/move-bytecode-template@^0.1.0
packages/plugin-sui/src/actions/movepump.ts New file implementing token creation and buying functionality with interfaces, validation, and transaction handling
packages/plugin-sui/src/index.ts Added movepump action to suiPlugin object
packages/plugin-sui/src/move_bytecode_template.js New WASM-based module for Move bytecode manipulation with serialization, deserialization, and constant update functions
packages/plugin-sui/src/template/bytecode.ts Added TEMPLATE_COIN_BYTECODE constant
packages/plugin-sui/src/utils.ts Added TokenMetadata interface and updateTokenBytecode function for bytecode manipulation
packages/plugin-sui/src/template/template_coin/ New Move package with configuration and source files for token template

Finishing Touches

  • [ ] 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jan 15 '25 08:01 coderabbitai[bot]

Is there a reason you're specifically using bytecode moves instead of a more readable form of code?

0xSero avatar Jan 15 '25 12:01 0xSero

Is there a reason you're specifically using bytecode moves instead of a more readable form of code?

  1. Move contracts cannot deploy other contracts at runtime.Each new contract must be compiled before deployment
  2. Sui officially provides Move Bytecode Template library for modifying pre-compiled bytecode.

ChainRex avatar Jan 15 '25 15:01 ChainRex

@ChainRex where did you get the bytecode from? can you do remote fetch?

wtfsayo avatar Jan 16 '25 14:01 wtfsayo

Hello,

We are changing our plugin development strategy to be more scalable. We have moved the plugins out into their own repos and we're looking for people to either maintain those or own them on their own Github.

If you'd like to be a maintainer, file an issue in the plugin repo and join our Discord https://discord.gg/elizaos to coordinate.

If you'd like to control the plugin on your own Github, please add an issue to the plugin repo pointing to your repo, and add a modification to the registry. Submit a PR to edit the registry here: https://github.com/elizaos-plugins/registry

Closing this PR for now. Let us know if you have any questions.

odilitime avatar Feb 06 '25 23:02 odilitime