Skip to content

Add an invoice cancellation function allowing admins to cancel a registered invoice before it reaches funding target #404

Description

@Chucks1093

Summary

There is no mechanism to cancel an invoice that was registered in error or needs to be withdrawn before funding completes. A cancel_invoice function that transitions the invoice to Cancelled status and enables investor refunds should be added.

Scope

  • Add cancel_invoice(invoice_id: BytesN<32>) callable only by the protocol admin
  • Allow cancellation only when status is Open
  • Transition the invoice status to Cancelled
  • Panic with InvalidInvoiceStatus if the invoice is already Funded or Settled
  • Emit an invoice_cancelled event with invoice_id and the cancelling admin address

Acceptance Criteria

  • Status transitions to Cancelled on successful cancellation
  • Cancellation of a Funded invoice panics with InvalidInvoiceStatus
  • Cancellation of a Settled invoice panics with InvalidInvoiceStatus
  • Non-admin caller panics with Unauthorized
  • invoice_cancelled event emitted with correct fields

ETA: 24 hours


Coordinate on Telegram

Activity

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

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions