Skip to content

test(invoice-token): cross-contract integration test suite for escrow-triggered burn-on-settlement callback #382

Description

@chizzy192

Context & Problem Statement

During invoice escrow settlement, the escrow contract invokes burn or burn_from on the InvoiceToken contract to retire the tokenized invoice representations in exchange for distributed payout capital. While unit tests verify token burning in isolation, end-to-end integration tests proving cross-contract authorization, allowance consumption, and post-settlement transfer unlock are needed.

This issue introduces a MockSettlementEscrow contract harness in contracts/invoice-token/src/integration_test.rs to validate the complete escrow-to-token settlement flow.

Architectural Motivation & Technical Requirements

  • In contracts/invoice-token/src/integration_test.rs:
    • Implement a MockSettlementEscrow contract and setup harness.
    • Implement integration tests covering:
      • Happy-path burn_on_settlement and burn_from_on_settlement.
      • Allowance deduction and verification on burn_from.
      • Failure paths: InsufficientBalance, InvalidAmount, InsufficientAllowance, AllowanceExpired, Paused.
      • Verify that after full settlement, token transfers are unlocked and residual balances persist accurately.
  • Assert emitted event logs on both contracts.

Acceptance Criteria

  • Mock settlement escrow harness implemented.
  • Happy path and all 5 negative error paths covered.
  • Post-settlement transfer unlock explicitly verified.
  • cargo test -p invoice-token passes.

Target Branch: dev
Estimated Effort: 5–12 hours | Delivery: 3–5 days
Difficulty: Medium

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions