Skip to content

Cross-Invoice Split Linkage for Coordinated Payouts #522

Description

@Kingsman-99

Description

Some business workflows require that payout from Invoice B is triggered only after Invoice A is fully funded and released. A parent-child linkage between invoices should block child invoice release until the parent is finalised.

Technical Context

Add parent_invoice_id: Option<u64> to the Invoice struct in types.rs. In release_payment inside contracts/split/src/lib.rs, if parent_invoice_id is Some, look up the parent's status and return ParentInvoiceNotFinalised if it is not Finalised. Emit ChildInvoiceUnblocked(child_id, parent_id) from events.rs when the child is released.

Acceptance Criteria

  • A child invoice's release_payment is blocked until the parent is Finalised
  • Circular parent references (A → B → A) are detected and rejected at creation time
  • A child without a parent invoice releases normally
  • ChildInvoiceUnblocked event is emitted on the first successful child release
  • Max chain depth is capped to prevent deep recursion in the lookup
  • All CI checks (cargo build --target wasm32-unknown-unknown, cargo test, cargo clippy) pass and the branch has no merge conflicts

Activity

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

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptsfeatureNew contract feature or operation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions