{"version":3,"file":"pool_accounting.mjs","names":["balance.Balance","table.Table"],"sources":["../../../src/contracts/deepbook_predict/pool_accounting.ts"],"sourcesContent":["/**************************************************************\n * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *\n **************************************************************/\n\n/**\n * Pool-owned expiry registration and cash-flow accounting.\n *\n * This module owns pool idle USDC custody, the durable set of expiries registered\n * to a pool, the active expiry index used for valuation, USDC sent from the main\n * pool into each expiry, USDC received back from each expiry, snapshotted lifetime\n * fee-incentive caps and allocations, terminal cash watermarks, and per-expiry cap\n * checks. It does not classify expiry-local liabilities or apply PLP reserve\n * policy; PoolVault uses the aggregate profit basis to price PLP and decide\n * protocol reserve transfers.\n */\n\nimport { MoveStruct } from '../utils/index.js';\nimport { bcs } from '@mysten/sui/bcs';\nimport { U64 } from '../../bcs/integers.js';\nimport * as balance from './deps/sui/balance.js';\nimport * as table from './deps/sui/table.js';\nconst $moduleName = '@local-pkg/deepbook_predict::pool_accounting';\nexport const ActiveExpiry = new MoveStruct({\n\tname: `${$moduleName}::ActiveExpiry`,\n\tfields: {\n\t\texpiry_market_id: bcs.Address,\n\t\texpiry_ms: U64,\n\t},\n});\nexport const Ledger = new MoveStruct({\n\tname: `${$moduleName}::Ledger`,\n\tfields: {\n\t\t/** Idle LP-owned USDC available for withdrawals and expiry funding. */\n\t\tidle_balance: balance.Balance,\n\t\t/** Expiry markets that still contribute active pool valuation/risk. */\n\t\tactive_expiry_markets: bcs.vector(ActiveExpiry),\n\t\t/**\n\t\t * Permanent per-expiry accounting rows. Presence means the expiry belongs to this\n\t\t * pool.\n\t\t */\n\t\tregistered_expiries: table.Table,\n\t\t/** Pricing debit basis: USDC sent to expiries plus materialized terminal profit. */\n\t\tprofit_basis_debits: U64,\n\t\t/** Pricing credit basis: all USDC received back from expiries. */\n\t\tprofit_basis_credits: U64,\n\t\t/**\n\t\t * Aggregate terminal losses that later terminal profits must recover first; losses\n\t\t * do not claw back profit that was already materialized.\n\t\t */\n\t\tnet_losses_to_fill: U64,\n\t\t/**\n\t\t * Protocol profit already materialized into the debit basis but not yet physically\n\t\t * moved to the reserve because idle was deployed in other active markets at\n\t\t * materialization. Excluded from LP value until drained.\n\t\t */\n\t\tpending_protocol_profit: U64,\n\t},\n});\nexport const RegisteredExpiry = new MoveStruct({\n\tname: `${$moduleName}::RegisteredExpiry`,\n\tfields: {\n\t\t/** USDC pool allocation cap snapshotted when this expiry was created. */\n\t\tmax_expiry_allocation: U64,\n\t\t/** Minimum USDC cash target snapshotted when this expiry was created. */\n\t\tinitial_expiry_cash: U64,\n\t\t/** USDC sent from the main pool into this expiry. */\n\t\tsent_to_expiry: U64,\n\t\t/** USDC returned from this expiry to the main pool. */\n\t\treceived_from_expiry: U64,\n\t\t/** Absolute lifetime fee-incentive cap snapshotted when this expiry was registered. */\n\t\tfee_incentive_lifetime_cap: U64,\n\t\t/** Lifetime sponsor-funded fee incentives allocated to this expiry. */\n\t\tfee_incentives_allocated: U64,\n\t\t/** True once this expiry has started terminal profit/loss accounting. */\n\t\tterminal_accounting_started: bcs.bool(),\n\t\t/** Received amount already consumed by terminal accounting. */\n\t\tterminal_received_watermark: U64,\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,cAAc;AACpB,MAAa,eAAe,IAAI,WAAW;CAC1C,MAAM,GAAG,YAAY;CACrB,QAAQ;EACP,kBAAkB,IAAI;EACtB,WAAW;EACX;CACD,CAAC;AACF,MAAa,SAAS,IAAI,WAAW;CACpC,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,cAAcA;EAEd,uBAAuB,IAAI,OAAO,aAAa;EAK/C,qBAAqBC;EAErB,qBAAqB;EAErB,sBAAsB;EAKtB,oBAAoB;EAMpB,yBAAyB;EACzB;CACD,CAAC;AACF,MAAa,mBAAmB,IAAI,WAAW;CAC9C,MAAM,GAAG,YAAY;CACrB,QAAQ;EAEP,uBAAuB;EAEvB,qBAAqB;EAErB,gBAAgB;EAEhB,sBAAsB;EAEtB,4BAA4B;EAE5B,0BAA0B;EAE1B,6BAA6B,IAAI,MAAM;EAEvC,6BAA6B;EAC7B;CACD,CAAC"}