Skip to content

fix(recurring): guard rescueTokens with nonReentrant - #1755

Closed
LeoSlrRf wants to merge 1 commit into
feat/req-429-schedule-key-replayfrom
feat/req-429-fee-rescue
Closed

fix(recurring): guard rescueTokens with nonReentrant#1755
LeoSlrRf wants to merge 1 commit into
feat/req-429-schedule-key-replayfrom
feat/req-429-fee-rescue

Conversation

@LeoSlrRf

@LeoSlrRf LeoSlrRf commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Add rescueTokens function and zero-address fee validation to ERC20RecurringPaymentProxy

Adds a guard that reverts payment execution when feeAmount is non-zero but feeAddress is the zero address, preventing fees from being burned unintentionally.

Introduces a rescueTokens function allowing the contract owner to recover ERC20 tokens that have accumulated in the contract. The function enforces non-zero addresses for both the token and recipient, and is protected by onlyOwner and nonReentrant modifiers.

Tests cover:

  • Revert when feeAmount > 0 and feeAddress is the zero address
  • Successful token rescue by the owner
  • Revert when a non-owner attempts to rescue tokens
  • Revert when the rescue destination is the zero address

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR protects owner token rescues with the contract’s shared reentrancy guard and validates that nonzero fees have a nonzero destination.

  • Adds an owner-only rescueTokens function with zero-address and transfer-result checks.
  • Rejects recurring-payment permits that specify a nonzero fee without a fee recipient.
  • Adds tests covering fee-recipient validation, successful residual-token rescue, access control, and zero-address rescue rejection.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security defects identified.

The owner-only rescue operation shares the existing reentrancy guard with payment execution, validates both addresses, checks transfer success, and the fee-address check executes before funds or payment state are changed.

Important Files Changed

Filename Overview
packages/smart-contracts/src/contracts/ERC20RecurringPaymentProxy.sol Adds guarded owner token rescue and validates nonzero fee destinations before funds are pulled.
packages/smart-contracts/test/contracts/ERC20RecurringPaymentProxy.test.ts Adds focused coverage for invalid fee destinations and rescue-token authorization and validation.

Reviews (1): Last reviewed commit: "fix(recurring): guard rescueTokens with ..." | Re-trigger Greptile

@LeoSlrRf LeoSlrRf closed this Aug 24, 2026
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.

1 participant