⚖️ Variants (Positions)
Variants add semantic positions to commitments.
This allows the same digest to represent multiple economic meanings without creating separate commitment systems.
Examples:
- 📈 Long / Short
- 🗳 Yes / No
- ⚖ For / Against / Abstain
- ➕ Positive / Negative
The commitment engine remains the same.
Only the semantic position changes.
This is handled through traits:
CommitVariant🎯 Direct commitment variants per digestIndexVariant🧺 Variant-aware weighted index entriesPoolVariant🏊 Variant-aware managed pool slots
which extend direct commitments, indexes, and pools with variant-aware balance positions.
🧠 What a Variant Really Is
A variant is not a separate commitment.
It is:
a balance position inside a digest
Think of it like:
Digest
|-- Variant 0
|-- Variant 1
|-- Variant 2
Each variant has its own independent balance.
So:
one digest -> multiple balances
Conceptually:
Digest -> Vec<Balance>
This means:
same digest, different variant = different economic state
🧾 CommitVariant
This is the base variant layer for direct commitments.
Instead of:
Alice -> Digest
it becomes:
Alice -> Digest -> Variant
Example:
Validator A
|-- Positive
|-- Negative
or
Prediction Market
|-- YES
|-- NO
The digest remains singular. Only the internal balance position changes.
Each commitment selects which variant it belongs to.
| Method | Trait | Purpose |
|---|---|---|
place_commit() | Commitment | Default commitment path - commits using a default / no-op variant |
place_commit_of_variant(...) | CommitVariant | Places commitment directly into a specific variant |
The important distinction is:
Commitment::place_commit() -> default variant
CommitVariant::place_commit_of_variant() -> explicit variant
🧺 IndexVariant
Indexes support variants at the entry level.
Each entry contains:
Entry Digest + Variant
So:
Index
|-- Entry A -> Variant X
|-- Entry B -> Variant Y
|-- Entry C -> Variant Z
This means an index distributes across:
digest + variant
not just digest.
Example:
BTC -> Long
ETH -> Short
DOT -> Long
Each entry stores:
- digest identity
- share weight
- semantic variant
This makes grouped directional exposure possible.
🏊 PoolVariant
Pools work the same way.
Each pool slot contains:
Slot Digest + Variant
So:
Pool
|-- Slot A -> Variant 0
|-- Slot B -> Variant 1
|-- Slot C -> Variant 0
This allows managers to rebalance across:
digest + variant
positions.
Example:
increase Long exposure
reduce Short exposure
without changing pool architecture.
Pools become direction-aware while preserving the same top-level balance model.
🧩 How Variants Are Plugged In
Variants are not hardcoded by the pallet.
They are configured through pallet Config trait.
The pallet only sees variant index
The type resolution gives meaning.
Example:
0 = Long
1 = Short
or
0 = YES
1 = NO
So the pallet routes balances, while the runtime defines semantics.
📌 In One Sentence
Variant = semantic side of a digest
or more precisely:
Digest = shared target
Variant = balance position inside that target
This adds economic meaning without changing commitment architecture.
🚀 Next Step
Now we move into how digests hold real-time value and evolve lazily over time.
👉 Architecture -> Lazy Digests