Skip to main content

build_settlement_fills

Function build_settlement_fills 

Source
pub fn build_settlement_fills(
    settlements: &[OutcomeSettlement],
    spot_state: &SpotClearinghouseState,
    tracker: &mut OutcomeSettlementTracker,
    account_id: AccountId,
    ts: UnixNanos,
) -> Vec<FillReport>
Expand description

Materializes one closing [FillReport] per held outcome side token that has newly settled.

settlements is the output of derive_outcome_settlements. Each settlement is matched to a non-zero spot balance keyed by the +E token name (Hyperliquid’s spot-balance convention for outcome side tokens). Pairs already in tracker are skipped; pairs that emit a fill are recorded.

Returns the synthetic fills ready to be forwarded through the execution emitter. Returns an empty vector when no held outcome side token has settled this round.