Skip to content

Multi-issue: rename plans, pagination, per-token volume, bulk cancel - #140

Open
samolusey wants to merge 3 commits into
stellar-sub:mainfrom
samolusey:issue-no-68-62-61-60
Open

samolusey wants to merge 3 commits into
stellar-sub:mainfrom
samolusey:issue-no-68-62-61-60

Conversation

@samolusey

Copy link
Copy Markdown

Summary

This PR addresses four issues to improve the plan and subscription contracts:

#61: Plan renaming without changing financial terms

  • Added rename_plan(merchant, plan_id, name) to allow merchants to fix typos
  • Same name validation as plan creation (1-64 bytes)
  • Emits PlanRenamed event
  • Does not affect existing subscriptions

#62: Pagination for plan listings

  • Added get_plans_by_merchant_page(merchant, cursor, page_size) with cursor-based pagination
  • Added get_active_plans_page(cursor, page_size) for active-only plans
  • Page size capped at 1-1000 to prevent resource exhaustion
  • Cursor-based pagination returns next_cursor (0 = no more pages)

#68: Per-token volume tracking in registry

  • Added token field to SubscriptionRecord so registry knows which token each subscription uses
  • Added get_token_volume(token) to query total volume per token
  • This fixes the caveat in docs/registry.md where volume was meaninglessly summed across tokens
  • Updated subscription contract to pass token when registering subscriptions

#60: Bulk subscription cancellation with work-bounding

  • Added cancel_all(subscriber, token) to cancel all open subscriptions for a token
  • Work-limited to 10 subscriptions per call to prevent resource exhaustion
  • Returns (count_processed, has_more) to support pagination
  • Reuses single-cancel logic to enforce REVOCATION uniformly
  • Failures in allowance/registry updates don't block cancellation

Test plan

  • All contracts compile with make check
  • Pagination handles edge cases: empty results, partial pages, exact boundaries
  • rename_plan validates name length and requires merchant auth
  • Per-token volume calculation is accurate across multiple tokens
  • cancel_all processes subscriptions in batches and can be called repeatedly
  • Final subscriptions (Cancelled/Exhausted) are not affected by cancel_all

Closes #68
Closes #62
Closes #61
Closes #60

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@samolusey Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant