Skip to content

docs(recurring): warn cancel does not drop allowance - #1757

Closed
LeoSlrRf wants to merge 1 commit into
feat/req-429-batch-triggerfrom
feat/req-429-cancel-schedule
Closed

docs(recurring): warn cancel does not drop allowance#1757
LeoSlrRf wants to merge 1 commit into
feat/req-429-batch-triggerfrom
feat/req-429-cancel-schedule

Conversation

@LeoSlrRf

@LeoSlrRf LeoSlrRf commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Add schedule cancellation for subscribers

Introduces cancelSchedule and cancelScheduleBatch functions that allow a subscriber to permanently block further payment triggers on their recurring payment schedules.

A new cancelledSchedules mapping tracks cancelled schedule keys. Both trigger entry points (triggerRecurringPayment and triggerRecurringPaymentBatch) now check this mapping before processing, reverting with ERC20RecurringPaymentProxy__Cancelled if the schedule has been cancelled.

Only the subscriber named in the permit can cancel their own schedule, enforced by _assertSubscriber, which reverts with ERC20RecurringPaymentProxy__NotSubscriber for any other caller. Cancellation is keyed on the schedule identity (not the deadline), so re-signing a permit with a new deadline does not bypass a prior cancellation.

Note: Cancellation does not revoke the subscriber's ERC-20 allowance to this contract. Subscribers should also set their token approval to zero in the same transaction. A relayer may still collect a due cycle if a trigger is included in the same block ahead of the cancellation call.

@greptile-apps

greptile-apps Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds subscriber-controlled cancellation for single-fee and batch recurring schedules while documenting that cancellation does not revoke ERC-20 allowance.

  • Records cancelled schedule keys and rejects subsequent trigger attempts.
  • Restricts cancellation to the schedule's declared subscriber.
  • Adds tests for both cancellation paths, authorization, and deadline re-signing.

Confidence Score: 4/5

The exported ABI must be updated before merging so package consumers can invoke the new cancellation entry points.

The Solidity implementation and tests add cancellation successfully, but the package artifact still exposes an ABI without either cancellation function, making the feature unavailable through the published integration surface.

Files Needing Attention: packages/smart-contracts/src/contracts/ERC20RecurringPaymentProxy.sol; packages/smart-contracts/src/lib/artifacts/ERC20RecurringPaymentProxy/0.1.0.json

Important Files Changed

Filename Overview
packages/smart-contracts/src/contracts/ERC20RecurringPaymentProxy.sol Adds correctly keyed, subscriber-only cancellation checks, but the new public API is absent from the package's committed exported ABI.
packages/smart-contracts/test/contracts/ERC20RecurringPaymentProxy.test.ts Adds focused coverage for single and batch cancellation, authorization, and cancellation persistence across deadline re-signing.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  S[Subscriber] --> C[cancelSchedule / cancelScheduleBatch]
  C --> K[Derive schedule key]
  K --> M[Mark key cancelled]
  R[Relayer trigger] --> T[Derive same key]
  T --> X{Cancelled?}
  X -->|Yes| E[Revert Cancelled]
  X -->|No| P[Continue payment checks]
Loading

Reviews (1): Last reviewed commit: "docs(recurring): warn cancel does not dr..." | Re-trigger Greptile

Comment on lines +454 to +465
function cancelSchedule(SchedulePermit calldata p) external {
_assertSubscriber(p.subscriber);
_cancel(_scheduleKeyFromPermit(p));
}

/**
* @notice Blocks further triggers for this batch schedule.
* @dev Does not revoke the subscriber's ERC-20 allowance to this contract. A relayer can
* still collect a due cycle if they include a trigger in the same block ahead of
* cancel. Also `approve` this proxy to 0 (or decrease) in the same wallet batch.
*/
function cancelScheduleBatch(SchedulePermitBatch calldata p) external {

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.

P1 Cancellation ABI remains stale

When a downstream client obtains ERC20RecurringPaymentProxy through the package's exported artifact, its committed ABI contains neither cancellation function, so the client cannot access or encode cancelSchedule or cancelScheduleBatch. Update the committed artifact alongside this public contract API.

Knowledge Base Used: Smart contracts and deployments

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Expected. The artifact will be included in a PR up the graphite stack

@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