Skip to content

Implement creator-controlled invoice pause with time-locked auto-resume and audit trail #164

@Kingsman-99

Description

@Kingsman-99

Description

Implement a creator-controlled pause mechanism for invoices that includes: optional time-locked auto-resume, a pause reason string stored on-chain, a full pause/resume audit trail emitted as events, and a global admin override to force-resume any paused invoice.

Acceptance Criteria

  • Add pause_invoice(creator: Address, invoice_id: u64, reason: String, auto_resume_at: Option<u64>) — sets invoice.frozen = true, stores reason and auto_resume_at in persistent storage, emits a paused event
  • Add resume_invoice(creator: Address, invoice_id: u64) — sets invoice.frozen = false, clears stored reason/auto_resume_at, emits a resumed event
  • Add admin_force_resume(admin: Address, invoice_id: u64) — admin override, emits force_resumed event with admin address
  • _pay checks auto_resume_at: if ledger.timestamp() >= auto_resume_at, automatically sets frozen = false before proceeding (lazy auto-resume)
  • _pay panics with "invoice is frozen" only when frozen and auto-resume time has not yet passed
  • get_invoice_ext returns pause_reason: Option<String> and auto_resume_at: Option<u64>
  • Events must follow the existing events:: module pattern in contracts/split/src/events.rs
  • Test test_pause_blocks_payment_with_reason
  • Test test_auto_resume_allows_payment_after_timestamp
  • Test test_admin_force_resume_overrides_creator_pause
  • Test test_resume_clears_stored_reason

Context

  • frozen field already exists on Invoice in types.rs
  • Events module is contracts/split/src/events.rs — follow existing patterns for topic/data structure
  • require_admin helper is available in lib.rs
  • String in Soroban is soroban_sdk::String, not std — use String::from_str(&env, "...")

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignenhancementNew feature or requestgrantfoxIssue for GrantFox program

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions