Skip to main content

derive_outcome_settlements

Function derive_outcome_settlements 

Source
pub fn derive_outcome_settlements(meta: &OutcomeMeta) -> Vec<OutcomeSettlement>
Expand description

Derives per-side settlement values from an outcomeMeta snapshot.

Returns one OutcomeSettlement for every side of every outcome whose resolution can be inferred from the snapshot:

  • For each question with non-empty settled_named_outcomes, every named outcome and the fallback are emitted: the winning named outcomes get Yes -> 1, No -> 0, every other named outcome and the fallback get Yes -> 0, No -> 1.
  • Standalone outcomes (not referenced by any question) are skipped because the venue does not expose their resolution in outcomeMeta. They will need a separate signal (status flag, fill, or position-state event).

Outcomes referenced by a question that has not yet settled are also skipped. This lets a caller poll outcomeMeta and emit settlement events when entries first appear in the result.