Docs
Reference

Accounting

Torq accounting model, state ownership, reconciliation, invariants, value flows, and failure handling.

Torq accounting explains where value is, who owns the state, which movements are allowed, and how the product reconciles after a write.

The active accounting model is V2 only. It follows the same truth path as the rest of the product:

Chain -> Indexer -> Projector -> Postgres -> API -> Frontend

Accounting flow

Value movement is tracked by custody, capacity, debt, fees, redemption, and recovery state

Deposit

Investor assets enter the vault boundary.

Allocate

Vault capacity becomes available to approved markets.

Borrow

Borrower draws from an attached credit facility.

Repay

Principal and fee components return through the market path.

Redeem

Exit requests and claims move through queue-aware settlement.

Recover

Liquidation or loss recovery resolves stressed state.

Accounting context

Aave-style accounting often centers on pool supply, borrow balances, collateral, interest, and liquidations. Morpho-style vault accounting also includes vault assets, adapters, caps, allocation, and reporting. Torq accounting is organized around governed facilities: vault custody, market capacity, borrower partition debt, collateral, fee realization, redemption queues, tranches, recovery, and post-write reconciliation.

Accounting model

AreaPlain meaningTorq model
CustodyWhere assets are held.Vault and market contracts own value-moving state; Postgres records projected application truth.
CapacityHow much credit can be used.Facility commitments, vault commitments, and market partitions determine available draw capacity.
DebtWhat the borrower owes.Borrower debt is projected from active shared-market state and repay events.
CollateralWhat secures the borrow.Collateral deposits and withdrawals are tracked by market and borrower partition.
FeesWho earns or collects fees.Vault fees, spread fees, reserve factors, fee collectors, and protocol fee paths are explicit.
RedemptionHow lenders exit.Queue and claim state determine redemption status.
RecoveryHow stressed positions are resolved.Liquidation and loss recovery update partition-local state.
What this means

Torq accounting is not a spreadsheet attached to the app. It is a set of invariants and projected records that the app must reread before calling work complete.

State ownership

StateOwner
Value-moving balancesActive V2 contracts.
Application-visible current stateDomain projectors and Postgres current tables.
API responsesGraphQL and operator APIs reading Postgres.
Frontend displayWorkspaces consuming API state.
Accounting evidenceAccounting inventory, invariants, replay, reconciliation, and proof artifacts.

Reconciliation

Reconciliation means comparing the expected accounting result with the observed projected result.

The minimum product standard is:

  1. Transaction or persisted write completes.
  2. Affected entity is indexed.
  3. Projector updates current-state rows.
  4. API returns the updated persisted state.
  5. Workspace displays the updated state.
  6. Any mismatch remains visible as pending, stale, blocked, or failed.

Invariants

Invariant familyPlain meaning
GlobalTotals should reconcile across custody and projected state.
CustodyAssets should not disappear between vault, market, borrower, and settlement paths.
CapacityBorrow capacity should match vault and market constraints.
DebtBorrower debt should not be locally invented by the frontend.
CollateralCollateral should support debt under configured safety rules.
FeeFee realization should be explicit and traceable.
RedeemQueue and claim state should explain exit availability.
TrancheSenior/Junior share accounting should remain separated where active.
LiquidationRecovery should stay bounded and partition-local.
NAVValuation-sensitive state should respect freshness and report fields.
IndexingApplication truth should come through projector-owned state.
UIScreens should not replace stale state with local guesses.

Value flows

FlowWhat changes
DepositLender assets move into vault custody and position state updates after projection.
AllocateVault capacity becomes available to a configured market.
BorrowLoan assets move to borrower and debt increases.
RepayDebt decreases and fee components are realized according to active rules.
RedeemShare or claim state changes according to queue and vault liquidity.
LiquidateDebt and collateral settle through bounded recovery logic.
Fee collectProtocol or vault fee balances move to configured recipient paths.

Failure handling

FailureAccounting handling
Wallet failureNo completed value movement is assumed.
Partial projectionProduct state remains pending or stale.
Oracle staleRisk-increasing accounting moves can be blocked.
Fee mismatchReconciliation should fail until the projected fee path matches expected state.
Queue mismatchRedemption state should remain unresolved until current rows reconcile.

For reviewers

Accounting evidence is in docs/accounting/accounting-inventory.md, docs/accounting/accounting-invariants.md, docs/accounting/accounting-inventory.json, docs/accounting/transition-mutation-matrix.json, docs/accounting/replay-and-reconciliation-rules.json, and the active V2 contract inventory.

On this page