Skip to content

Latest commit

 

History

History
62 lines (45 loc) · 1.8 KB

File metadata and controls

62 lines (45 loc) · 1.8 KB

PR: feat/contracts-35-escrow-closure-finalization

Summary

Implements Escrow contract closure finalization with immutable close records and summary metadata.

What changed

  • contracts/escrow/src/lib.rs

    • EscrowContract now includes:
      • finalized_at: Option<u64>
      • finalized_by: Option<Address>
      • close_summary: Option<Symbol>
    • Added finalize_contract method with:
      • status precondition (Completed | Disputed)
      • one-time finalization guard (immutable once performed)
      • participant authorization guard (client/freelancer/arbiter)
    • Added read helpers:
      • is_finalized
      • get_close_summary
      • get_finalizer
  • contracts/escrow/src/test.rs

    • Added tests:
      • test_finalize_contract_success_and_immutable
      • test_finalize_contract_already_finalized
      • test_finalize_contract_not_ready
      • test_finalize_contract_unauthorized
  • README.md and docs/escrow/status-transition-guardrails.md

    • Documented finalization workflow and guardrails

Security notes

  • Finalization allowed only after final applicant status; prevents premature closure.
  • Finalization is immutable after the first call.
  • Caller must be a known contract participant.

Testing

Run:

cargo test

Result: 27 passed, 0 failed.

Attachment

Proof of successful build/tests

test-output-screenshot

To attach proof, run the test command locally and capture terminal output screenshot or log file, then add it here:

  • cargo test -- --nocapture (if needed)
  • Save screenshot or copy output to file
  • Attach the file via GitHub PR UI (choose image or link)

Next steps

  1. Review API naming and usability (e.g., contract ID usage as symbolic key currently simplified).
  2. Merge; pipeline should run fmt/build/test automatically.