Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

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

TestDischarges
refuses settlement before duesettlement_never_premature
settles at the due timevpp_second_installment_ok
refuses a replayalreadyPerformed
refuses collection by a strangersubrogation_violation_needs_wrong_owner
records who collected, immutablylink_violation_immune_to_reassignment
due times are independent per occurrencevpp_premature_second_installment_rejected