How the vested parimutuel works
This is the mechanism of The Vested Parimutuel, as the contracts in this repository implement it. Nothing below is a simplification of the paper for a website; where a number is floored the text says so, because the settler floors there too.
What a classic pool gets wrong
In a classic pool the payout is floor(pool × stake / winningPrincipal). Every winning unit takes the same share of the same pool, and the pool does not remember when any of it arrived. A unit staked one second before the freeze is worth exactly as much as a unit staked at the open.
That is not a rounding detail. The people who staked first are the ones who moved the price to somewhere worth betting into, and the classic rule pays them for it with a multiple that falls every time somebody else agrees with them. Late money is not just cheap: it is paid out of the early money’s return.
Rule 1 — stake vests into the opposing books
A stake on an outcome is assigned, in full, to every opposing branch the moment it lands. Stake on above vests into the below book; in an n-way market it vests into all of the other books at once.
Vesting is what makes timing matter. What a position is paid is its own accepted principal plus what vested to it from stake that arrived after it. Nothing that was already down can take from it, and nothing it does can take from anyone who was there first.
Rule 2 — a book can only accept what the other side can cover
Each book carries a capacity C_w = κ · P_w: kappa times its own accepted principal. What it has already absorbed is V_w, and the difference is its headroom:
H_w = C_w − V_w
Because a stake vests into the opposing books, the room it needs is their headroom, not its own. The tightest opposing book decides, and a stake larger than that room is accepted only in part:
accepted = D_w > H_w ? floor(c × H_w / D_w) : c
D_w is the whole vintage’s offered demand against that book, this entry’s own c included: enter adds c to every opposing book’s demand the moment the entry lands, and the vintage is finalized against that. So c is on both sides of the test and in the denominator — an offer of 20,000 into 15,000 of headroom with nothing else queued is accepted at 15,000, not refused and not taken whole. What the entry actually takes is the smallest of these caps across the opposing books, computed in one pass.
The remainder is refused, not failed. The transaction succeeds, the escrow holds the offer, and the part the books could not cover is pulled back with withdrawRefund — or paid alongside the settlement by claim, whichever comes first. Nowhere on this surface is a refusal drawn as an error, because it is not one.
Kappa is 30 for binary markets and unbounded for n-way ones. A consequence worth seeing: with κ = 30 a book cannot get more than about 30 to 1 against the other side, because long before that the opposing book has run out of capacity to accept the flow. The market’s own capacity is what stops the price running away.
Vintages — everything in one block arrives at once
Entries in the same block form one vintage, and entries in the same vintage never vest to each other. Without that, the order of two transactions inside a block — which is not something either sender chose — would decide which of them was paid by the other.
A vintage is rationed against the headroom as it stood when the vintage opened, with the whole vintage’s demand in the denominator. Headroom that one entry leaves unused because a different book cut it is not handed back round within the vintage. The vintage is finalized lazily, by the first transaction of a later block that touches the market, which is why an entry’s accepted amount is not knowable in the transaction that made it.
Settlement
Each book keeps a reward-per-share accumulator A_w in fixed point at S = 1e18. A position records the accumulator of its outcome at entry, and what it is paid if its outcome happens is:
payout = floor(s × (S + A_ω(T) − A_ω(τ)) / S)
which is its accepted principal plus floor(s × ΔA / S) — the two are the same integer, and the split is how this surface shows it. Claims are independent: what one position is paid does not depend on whether any other has claimed.
Flooring each payout separately guarantees the distributed total never exceeds the pool. What is left is the residue: typically a few millionths of a USDC, swept by an owner named at the market’s creation and not before every winning position has claimed, because the sum of the floors is not known until the last one does.
Resolution, and what happens if the feed goes quiet
The freeze is fixed when the market is created and never moves. Entries at or after it are refused outright, which means the accumulator is frozen at the freeze by construction: a resolver that is slow costs nobody anything, because there is nothing left that could change the answer.
Resolution is permissionless. Anyone may call the resolver once the freeze has passed; the caller has no say in the answer and earns nothing for making the call. The resolver reads a price feed through an IPriceOracle adapter and compares it against a strike registered in the same transaction that opened the market, so there is no window in which stake can land against rules nobody has committed to.
If the last reading is older than the market’s staleness bound, resolution revertsrather than settling — a keeper retrying through a brief outage cannot void a good market by accident. Voiding on a stale feed is a separate, deliberate call, and it refunds every position at its accepted principal. After the market’s void timeout, anyone may void it.
Glossary
- book
- A single outcome’s accepted principal,
P_w, and the scalars that govern whether it can take more. - headroom
H_w = C_w − V_w. The room a book still has to accept stake. When it runs out a stake is refused and refunded.- vintage
- The entries of one block. They are rationed together and never vest to each other. Vintage 0 is the creator’s seed.
- kappa
- The capacity coefficient. 30 for binary markets, unbounded for n-way ones.
- residue
- What per-position flooring leaves behind, swept by an owner fixed at creation.
- accepted against offered
- An entry offers c and has accepted s ≤ c. The difference is refused for want of headroom and refunds. Every amount on this surface says which of the two it is.
Read the paper
The proofs, the fixed-point argument for the seed clamp, and the full treatment of the exit and void cases are in the paper this implementation follows.
The Vested Parimutuel