مستندات دارا
مرجع فنیمالی
این صفحه فقط به انگلیسی موجود است.

Financial invariants

The PRD's invariants (../product/PRD.md §6), how each is enforced and which tests and checks prove it.

IDInvariantEnforced byProven by
INV-01On-chain supply ≤ approved backingIssuance refused above effective backing (issuance.checkLimits, capacity_exceeded); attestations count 35 days; shortfall blocks issuance and BUYReconciliation ledger_supply_within_unexpired_backing; alert DaraSupplyAboveBacking; TestPlatformLifecycle (issue 1000.001 refused)
INV-02Supply = HOT + COLD + Σ customers (closed holder set)AUTH_REQUIRED: only accounts the platform authorizes can hold; unknown holders raise CRITICALReconciliation onchain_supply_matches_ledger, no_supply_outside_known_trustlines, indexed_supply_matches_holdings; e2e outsider tests
INV-03BUY, SELL, TRANSFER, refill and sweep leave supply unchangedLedger posting rules (allowedKinds): only supply operations and clawbacks post to TOKEN_SUPPLYDemo steps 8 and 12; TestPlatformLifecycle reconcile after every step
INV-04Each approved issuance or burn changes supply exactly once by its amountSettlement posted once per intent (CAS on status, unique posting key); UNKNOWN attempts never rebuiltTestTimeoutAfterAcceptanceAppliesOnce, TestLostSubmissionExpiresThenRetriesOnce, TestClawback (exactly once)
INV-05Every ledger transaction balancesCode validation + deferred DB constraintTestValidationRejectsBadPostings, TestDatabaseEnforcesAppendOnlyAndBalance; reconciliation ledger_transactions_balanced
INV-06No customer cash or token position below zero; reserved ≤ totalNon-negative balance projections in the posting transactionTestConcurrentHoldsNeverOverspend, TestReversalCannotOverdrawCustomer; reconciliation ledger_restricted_non_negative
INV-07HOT reserved ≤ HOT on-chain balanceBUY reserves from TREASURY_AVAILABLE (non-negative) before signing; HOT is only debited by our intentsTestConcurrentBuysNeverOversellTheHotFloat; reconciliation balance_matches_ledger:HOT
INV-08One attestation backs at most one snapshot; one approved request yields at most one applied transactionUnique index on attestation reference; one intent per (purpose, source)Reserve tests in TestPlatformLifecycle; unique-constraint behaviour in the engine tests
INV-09A duplicated API request has one economic effectIdempotency keys stored with the response (byte-exact replay); domain uniqueness (a quote is used once)TestHTTPSecurity (replay, used quote), TestDuplicatePostingHasOneEffect
INV-10An UNKNOWN attempt is never rebuilt until proven EXPIREDExpiry proof requires a closed ledger past maxTime on a healthy nodeTestTimeoutAfterAcceptanceAppliesOnce (one attempt), TestLostSubmissionExpiresThenRetriesOnce

Additional rules added on Stellar: a clawback reduces supply exactly once and only after four-eyes and two issuer signatures (TestClawback); trustline authorization on-chain equals the customer's frozen state (trustline_states_match).