Ledger and Accounting
Multiswap treats market structure as an accounting problem.
The protocol records token custody and internal economic claims in a hierarchical ledger. Pools, reserve groups, claim-token groups, protocol accounts, stake accounts, rewards, surplus, and treasury balances are represented as explicit accounts rather than inferred only from ERC-20 transfers.
Debit and credit orientation
Ledger accounts can be debit-normal or credit-normal.
- Reserve and asset accounts are debit-normal.
- Claim and liability accounts are credit-normal.
This allows one transfer primitive to represent custody movement, claim issuance, claim retirement, and internal reclassification while preserving the account tree.
Pool accounts
Pool initialization creates the core accounting structure:
Pool
├── Reserve Assets
├── Claim Tokens
└── Protocol
The target token has its own pool and stake subaccounts. Additional modules add deposit, receipt, surplus, rewards, and treasury relationships as required by the pool lifecycle.
Reserve, scale, and target scale
For each reserve asset, the protocol tracks:
- reserve balance,
- scale,
- target scale,
- fee,
- stableness.
price in scale units = scale / reserve
Reserve is a token amount. Scale and target scale are accounting values stored as packed Float values.
Quote output as accounting instruction
A QuoteItem is a prepared set of ledger movements:
reserves
surplus
rewards
treasury
valueChange
valueFlow
Pay legs move assets from the payer into pool accounts. Receive legs move assets from pool accounts to the recipient. The ledger’s debit and credit semantics handle whether a claim token is transferred, minted, or burned.
Why this matters
The quote exposes the proposed accounting result before state changes. Integrators can inspect both user output and the internal destinations of value, while protocol invariants can be tested against explicit debits, credits, value flow, and scale changes.