Skip to content

Feat FLY2217 prioritize pegin contract funds in hot-to-cold transfers#926

Merged
AndresQuijano merged 4 commits intohot-cold-walletfrom
feat_fly2217_prioritize_pegin_contract_funds
Mar 5, 2026
Merged

Feat FLY2217 prioritize pegin contract funds in hot-to-cold transfers#926
AndresQuijano merged 4 commits intohot-cold-walletfrom
feat_fly2217_prioritize_pegin_contract_funds

Conversation

@AndresQuijano
Copy link
Copy Markdown
Contributor

@AndresQuijano AndresQuijano commented Mar 3, 2026

What

Gives priority to the funds in the contract when transferring funds from RSK hot to cold wallet.

Why

Avoid creating a honeypot in the contract.

Note

Depends on #925

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change
  • Documentation update
  • Refactoring (no functional changes, no api changes)
  • Performance improvement
  • Test updates
  • Security fix
  • Deployment/Infrastructure changes

Affected part of the project

  • Management UI / API
  • PegIn flow
  • PegOut flow
  • Utility scripts
  • Configuration files
  • Metrics and alerting
  • Hot to cold wallet flow

Related Issues

Jira ticket FLY-2217

How to test

This is my suggestion:

  1. Start the local env without the LPS
  2. Modify internal/adapters/entrypoints/watcher/common.go so transferColdWalletInterval is 1 minute or even 30 seconds.
  3. Check the balance of the contract for the LPS (must be 0)
cast call --rpc-url http://localhost:4444 \
  0x8901a2Bbf639bFD21A97004BA4D7aE2BD00B8DA8 \
  "getBalance(address)(uint256)" \
  0x9D93929A9099be4355fC2389FbF253982F9dF47c
  1. Deposit some funds
cast send \
  --rpc-url http://localhost:4444 \
  --private-key 0x87ce4239eef3d02cf31223490cd686f6a3d2d338af58646ea36be24c04a926b2 \
  0x8901a2Bbf639bFD21A97004BA4D7aE2BD00B8DA8 \
  "deposit()" \
  --value 0.5ether \
  --legacy
  1. Verify they landed with the same command on step 3
  2. Start the LPS in local without docker
  3. Check the log and look for something like this:
    INFO[0030] TransferExcessToColdWallet: withdrawing 500000000000000000 wei from pegin contract
    INFO[0030] Executing Withdraw transaction...
    INFO[0030] Transaction Withdraw (0x2bf548a547adbb4ba21a752936e2dba09dd4ff853531c38dc30769d72ed17694) executed successfully
  4. Check again the balance in the contract with the same command on step 3.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 3, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

@AndresQuijano AndresQuijano marked this pull request as ready for review March 3, 2026 21:00
@AndresQuijano AndresQuijano requested a review from a team as a code owner March 3, 2026 21:00
@AndresQuijano AndresQuijano force-pushed the feat_fly2164_cold_wallet_funding_alert branch from b8bbbdf to ec4a68d Compare March 4, 2026 18:48
@AndresQuijano AndresQuijano force-pushed the feat_fly2217_prioritize_pegin_contract_funds branch from 40a7c90 to fc9e27e Compare March 4, 2026 18:53
Base automatically changed from feat_fly2164_cold_wallet_funding_alert to hot-cold-wallet March 5, 2026 14:20
@AndresQuijano AndresQuijano merged commit 8e87e96 into hot-cold-wallet Mar 5, 2026
5 checks passed
@AndresQuijano AndresQuijano deleted the feat_fly2217_prioritize_pegin_contract_funds branch March 5, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants