Skip to content

feat: transfer hoodi test tokens between in-network wallets#1398

Merged
MicBun merged 1 commit into
mainfrom
feat/hoodi-transfer-actions
Jun 22, 2026
Merged

feat: transfer hoodi test tokens between in-network wallets#1398
MicBun merged 1 commit into
mainfrom
feat/hoodi-transfer-actions

Conversation

@MicBun

@MicBun MicBun commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

resolves: https://github.com/truflation/website/issues/4070

What

Adds public hoodi_tt_transfer and hoodi_tt2_transfer actions so a wallet can send the hoodi test-token bridges' tokens to another in-network wallet, matching the existing sepolia_transfer / eth_truf_transfer wrappers. The hoodi bridges already expose balance/info/bridge actions; this adds the matching transfer action.

Details

  • Mirrors sepolia_transfer: recipient address + positive-amount validation, a per-bridge 1-token fee (18 decimals) paid to the block leader, and record_transaction_event.
  • TestHoodiTransferActions exercises a funded transfer (recipient balance + sender fee deduction), an insufficient-balance attempt, and an invalid recipient address. The existing sepolia_transfer suite continues to pass.

Deploy note

The embedded erc20-bridge/*.sql migrations are applied to a running node by the namespace owner via kwil-cli exec-sql --file internal/migrations/erc20-bridge/002-public-transfer-actions.sql --sync (idempotent CREATE OR REPLACE ACTION). They are not covered by scripts/migrate.sh, which globs only top-level internal/migrations/*.sql.

Summary by CodeRabbit

New Features

  • Added public token transfer actions for HOODI test tokens with built-in fee handling and recipient address validation

Tests

  • Added comprehensive test suite for HOODI token transfer functionality, covering balance verification, fee deduction, and error handling for invalid recipients and insufficient funds

@holdex

holdex Bot commented Jun 22, 2026

Copy link
Copy Markdown

Time Submission Status

Member # Time Running Total Status Last Update
MicBun 3h ✅ Submitted Jun 22, 2026, 12:01 PM

Submit or update total time with:

@holdex pr submit-time 2h

Add time on top of previous submission with:

@holdex pr add-time 1h30m

See available commands to help comply with our Guidelines.

@MicBun MicBun self-assigned this Jun 22, 2026
@MicBun MicBun added the type: feat New feature or request label Jun 22, 2026
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Two new public SQL actions, hoodi_tt_transfer and hoodi_tt2_transfer, are added to the erc20-bridge migration. Both follow the same pattern as existing transfer actions: address/amount validation, a fixed 1-token fee, leader presence check, fee and token transfers, and event emission. A new integration test TestHoodiTransferActions validates the hoodi_tt_transfer action end-to-end.

Changes

Hoodi TT/TT2 Transfer Actions

Layer / File(s) Summary
hoodi_tt_transfer and hoodi_tt2_transfer SQL actions
internal/migrations/erc20-bridge/002-public-transfer-actions.sql
Adds two new public actions mirroring the existing transfer action pattern: each validates the recipient Ethereum address (lowercased), enforces a positive amount, charges a fixed 1-token (18-decimal) fee from the caller's respective token balance, requires @leader_sender, transfers the fee to the leader, transfers the token to the recipient, and records a transaction event.
Integration test and helpers
tests/extensions/erc20/erc20_bridge_transfer_actions_test.go
Adds TestHoodiTransferActions with hoodi_tt-specific bridge constants, balance injection, wallet balance verification before and after transfer, and error assertions for insufficient funds (including the extra-fee condition) and invalid Ethereum address format. Adds callHoodiTransfer and callHoodiWalletBalance helper functions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • trufnetwork/node#1163: Modifies the same 002-public-transfer-actions.sql file using the identical transfer-action pattern to add sepolia_transfer and mainnet_transfer.
  • trufnetwork/node#1298: Introduced hoodi_tt/hoodi_tt2 ERC20 extension actions including hoodi_tt_wallet_balance and hoodi_tt2_wallet_balance, which the new transfer actions and tests depend on directly.

Suggested reviewers

  • pr-time-tracker

Poem

🐇 Hop, hop, hoodi tokens flow,
Two new actions steal the show!
Fee to leader, tokens to friend,
Address checked from start to end.
The test bunny nods — all green! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding transfer functionality for hoodi test tokens between wallets, which directly aligns with the PR's primary objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/hoodi-transfer-actions

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/extensions/erc20/erc20_bridge_transfer_actions_test.go (1)

390-435: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Add end-to-end coverage for hoodi_tt2_transfer as well.

Line 390 introduces integration coverage only for hoodi_tt_transfer, while this PR also adds hoodi_tt2_transfer. A mirrored TT2 test path would catch bridge wiring or action-name regressions before release.

Suggested follow-up (test shape)
+func TestHoodiTT2TransferActions(t *testing.T) {
+	seedAndRun(t, "hoodi_tt2_transfer_actions", func(ctx context.Context, platform *kwilTesting.Platform) error {
+		require.NoError(t, erc20shim.ForTestingInitializeExtension(ctx, platform))
+		// Inject TT2 balance, perform hoodi_tt2_transfer, assert sender/recipient balances,
+		// and validate insufficient-funds + invalid-address errors (mirroring TT coverage).
+		return nil
+	})
+}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/extensions/erc20/erc20_bridge_transfer_actions_test.go` around lines
390 - 435, Add a complementary test function that mirrors
TestHoodiTransferActions to provide end-to-end coverage for hoodi_tt2_transfer.
Create a new test function (similar to TestHoodiTransferActions) that uses
hoodi_tt2 chain, escrow, and ERC20 contract variables instead of their hoodi_tt
counterparts, and calls the hoodi_tt2_transfer action instead of
hoodi_tt_transfer, while maintaining the same test structure and assertions for
transfer validation, fee handling, and error cases. This ensures bridge wiring
and action-name regressions are caught for both transfer action variants before
release.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/extensions/erc20/erc20_bridge_transfer_actions_test.go`:
- Around line 390-435: Add a complementary test function that mirrors
TestHoodiTransferActions to provide end-to-end coverage for hoodi_tt2_transfer.
Create a new test function (similar to TestHoodiTransferActions) that uses
hoodi_tt2 chain, escrow, and ERC20 contract variables instead of their hoodi_tt
counterparts, and calls the hoodi_tt2_transfer action instead of
hoodi_tt_transfer, while maintaining the same test structure and assertions for
transfer validation, fee handling, and error cases. This ensures bridge wiring
and action-name regressions are caught for both transfer action variants before
release.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0373868-1e82-43cf-9499-9df3c2c47ae2

📥 Commits

Reviewing files that changed from the base of the PR and between 9c09216 and 3108cad.

📒 Files selected for processing (2)
  • internal/migrations/erc20-bridge/002-public-transfer-actions.sql
  • tests/extensions/erc20/erc20_bridge_transfer_actions_test.go

@MicBun

MicBun commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

@holdex pr submit-time 3h

@MicBun MicBun merged commit aecb30e into main Jun 22, 2026
10 checks passed
@MicBun MicBun deleted the feat/hoodi-transfer-actions branch June 22, 2026 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant