Skip to content
This repository was archived by the owner on Feb 8, 2026. It is now read-only.

evm transfer native#97

Merged
webpiratt merged 1 commit into
mainfrom
eth-native-transfer
Jun 19, 2025
Merged

evm transfer native#97
webpiratt merged 1 commit into
mainfrom
eth-native-transfer

Conversation

@webpiratt

@webpiratt webpiratt commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Unified support for creating unsigned transactions for both native and ERC20 token transfers, enabling broader transaction capabilities.
  • Bug Fixes

    • Improved error messages for transaction creation.
  • Style

    • Minor formatting improvements for transaction estimation output.

@coderabbitai

coderabbitai Bot commented Jun 19, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A new global variable for the EVM zero address is introduced. The function for creating unsigned EVM transfers is renamed and refactored to handle both native and ERC20 token transfers, distinguishing between them based on the token address. Error messages and formatting are updated accordingly.

Changes

File(s) Change Summary
plugin/payroll/transaction.go Added evmZeroAddress variable, renamed and refactored evmMakeUnsignedErc20Transfer to evmMakeUnsignedTransfer to support both native and ERC20 transfers, updated related logic, error messages, and formatting.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant PayrollPlugin
    participant EVM

    Caller->>PayrollPlugin: genUnsignedTx(...)
    PayrollPlugin->>PayrollPlugin: evmMakeUnsignedTransfer(...)
    alt tokenID == evmZeroAddress
        PayrollPlugin->>EVM: Prepare native token transfer (set value, data nil)
    else tokenID != evmZeroAddress
        PayrollPlugin->>EVM: Prepare ERC20 transfer (pack transfer method in data, value zero)
    end
    PayrollPlugin-->>Caller: Return unsigned transaction bytes
Loading

Possibly related PRs

Poem

In the land of code where tokens flow,
A zero address now we know.
Native or ERC20, no more divide—
One function handles both with pride!
Transactions unified, what a sight,
The blockchain rabbit hops with delight!
🐇✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

level=warning msg="[runner] Can't run linter goanalysis_metalinter: buildir: failed to load package session: could not load export data: no export data for "github.com/vultisig/go-wrappers/go-dkls/sessions""
level=error msg="Running error: can't run linter goanalysis_metalinter\nbuildir: failed to load package session: could not load export data: no export data for "github.com/vultisig/go-wrappers/go-dkls/sessions""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21739c6 and 596c24c.

📒 Files selected for processing (1)
  • plugin/payroll/transaction.go (6 hunks)
🧰 Additional context used
🧠 Learnings (1)
plugin/payroll/transaction.go (1)
Learnt from: webpiratt
PR: vultisig/plugin#96
File: plugin/payroll/transaction.go:43-44
Timestamp: 2025-06-18T18:22:06.358Z
Learning: In the vultisig/plugin codebase, the hardcoded ethereumEvmChainID = big.NewInt(1) in plugin/payroll/transaction.go is intentional for the current implementation phase. The team is implementing ETH first, with plans to add other EVM chains later. The functions/methods are already designed to work with all EVM chains.
🔇 Additional comments (5)
plugin/payroll/transaction.go (5)

45-46: LGTM: Clean addition of zero address constant.

The global variable correctly represents the zero address for native EVM chain assets. Good practice using gcommon.HexToAddress for consistency.


332-332: LGTM: Function call and error message updates are consistent.

The function call and error message correctly reflect the renamed function evmMakeUnsignedTransfer.

Also applies to: 341-341


481-488: LGTM: Formatting improvements.

The indentation fixes improve code readability without changing functionality.


499-499: LGTM: Function rename aligns with expanded functionality.

The new name evmMakeUnsignedTransfer better reflects that the function now handles both native and ERC20 transfers.


512-531: LGTM: Clean logic for distinguishing transfer types.

The conditional logic correctly handles both native and ERC20 transfers:

  • Native transfers: value = amount, data = nil
  • ERC20 transfers: value = 0, data = packed transfer call

The implementation follows Ethereum standards properly.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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.

@webpiratt
webpiratt enabled auto-merge June 19, 2025 12:42

@johnnyluo johnnyluo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@webpiratt
webpiratt merged commit a8235b5 into main Jun 19, 2025
3 checks passed
@webpiratt
webpiratt deleted the eth-native-transfer branch June 19, 2025 21:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants