snapshotExpiryPricer function

MoveCallBuilder snapshotExpiryPricer({
  1. dynamic arguments,
  2. String? package,
  3. Map<String, dynamic>? config,
})

Freeze one snapshotted market's oracle state for this flush and stamp the market, capturing its cash rows and activating its payout-tree snapshot at this instant.

Holding SnapshotStage is what admits this call, and that potato cannot leave the transaction start_pool_valuation minted it in — so every Pricer here is loaded at one instant, which is what lets the valuation stage span transactions without mixing marks (audit L10). This stage reads oracles only — it never walks a payout tree — so all markets fit one PTB regardless of book size.

The oracle feeding this stage must have been written in an EARLIER transaction: pricing::resolve_live_pricer refuses a read stamped with the current transaction digest (RP-24), so a keeper cannot refresh and snapshot in one PTB.

A market already settled at snapshot time is recorded with no pricer, gets no stamp (settled flows never touch live NAV), and contributes 0. An expired-but-unsettled market aborts: it has no well-defined mark, and because this stage is atomic the abort reverts the whole snapshot transaction, so the flag is never left engaged. Settle it first, then start the flush; settlement is never blocked by a flush, so that ordering is always available.

Implementation

MoveCallBuilder snapshotExpiryPricer(
    {dynamic arguments, String? package, Map<String, dynamic>? config}) {
  final packageAddress = package ??
      (config?['predictPackageId'] as String?) ??
      '@local-pkg/deepbook_predict';
  return (tx) => tx.moveCall(
        '$packageAddress::plp::snapshot_expiry_pricer',
        arguments: normalizeMoveArguments(
            tx,
            withConfigDefaults(arguments, config, const {
              'vault': 'poolVault',
              'config': 'protocolConfig',
              'propbookRegistry': 'oracleRegistry'
            }),
            [
              null,
              null,
              null,
              null,
              null,
              null,
              null,
              null,
              '0x2::clock::Clock'
            ],
            [
              'vault',
              'Stage',
              'market',
              'config',
              'propbookRegistry',
              'pyth',
              'bsValues',
              'bsSvi'
            ]),
      );
}