FacilityRegistry — the settlement gate
Registers facility occurrences and gates their settlement.
Why the due-time gate exists
The occurrence's due date was recorded but not enforced for most of this project's life. An external review rejected the corpus over it: a production payment could settle at world-time 30 against a day-60 due date and be marked performed. The fix was made at the primitive level, not the fixture level, and rippled through eighteen fixtures.
The contract enforces it first, unconditionally, before it looks at anything else — the same order as the proved primitive.
if (block.timestamp < o.dueAt) revert Premature(o.dueAt, uint64(block.timestamp));Append-only receipts
Settlement writes a receipt naming who actually collected. Nothing rewrites it.
That matters because of a laundering attack found in review: a monitor that checked the current owner could be defeated by transferring the claim after a wrong-owner collection. Judging on immutable receipts instead of mutable ownership closes it, and there is a theorem — the verdict is unchanged by any reassignment.
Tests
| Test | Discharges |
|---|---|
| refuses settlement before due | settlement_never_premature |
| settles at the due time | vpp_second_installment_ok |
| refuses a replay | alreadyPerformed |
| refuses collection by a stranger | subrogation_violation_needs_wrong_owner |
| records who collected, immutably | link_violation_immune_to_reassignment |
| due times are independent per occurrence | vpp_premature_second_installment_rejected |