Exit to App
How It Works

Double-Entry Ledger

Mathematical verification of balanced journal entries across all currency conversions.

Every settled trade generates a balanced double-entry accounting journal in PostgreSQL (packages/ledger/src/index.ts). Every transaction satisfies the fundamental invariant:

Account NameDirectionAssetPurpose
TREASURY_ASSET:<sellToken>CREDITSold AssetDeducts principal leaving the treasury balance.
FX_SETTLEMENT_CLEARING:<sellToken>DEBITSold AssetClearing account receiving net principal for exchange.
PROTOCOL_FEE_EXPENSE:<sellToken>DEBITSold AssetRecords 1 bps Textile network protocol fee.
TREASURY_ASSET:<buyToken>DEBITBought AssetCredits new currency acquired into the treasury.
FX_SETTLEMENT_CLEARING:<buyToken>CREDITBought AssetBalances the clearing leg upon settlement receipt.