Skip to main content
A reward table is an array of 1 to 32 reward levels { p, m }:
  • p: probability as a u64 in billionths. Every p is greater than zero, and they sum to exactly 1 000 000 000.
  • m: multiplier as a u64 in basis points of the cost. 10 000 is 1×, 0 pays nothing, and the ceiling is 100 000 000 (10 000×).
A level’s reward is cost × m / 10 000, rounded down, in USDC base units.

The invariant

open_entry computes, in 128-bit integers with no rounding:
and admits the reward table only if, for the app share f it passes and the app’s protocol share s:
That is the margin floor: the declared margin must cover the 100 bps vault margin floor, the protocol share and the app’s own share. s is 200 bps at the base and falls to 100 bps with the app’s cumulative volume; the program resolves it once per open, and the same s is used for the split and the cap (Protocol share tiers). At the base and with no app share, the floor is lhs ≤ 9 700 × 1e9, a 3 % margin. The program also derives the declared margin it stores in the entry:
No floating-point value is involved anywhere, and your client should not use one either. Build reward tables in bigint.
Round in the vault’s favour: round probabilities down, and if you round a multiplier up, derive the probability from the rounded multiplier. Put the remainder of 1 000 000 000 on the zero level so the sum is exact.

Examples

Reward or nothing. For a target reward T on cost s at margin e bps:
Three levels at a 3 % margin. Refused: pays more in rewards than it takes in costs. [{ p: 500_000_000n, m: 21_000n }, { p: 500_000_000n, m: 0n }] returns 105 % on average. open_entry fails with RewardTableOverpays. Refused: fair, but the margin does not cover the split. A reward table with a 2.5 % margin and no app share, opened by an app at the base protocol share, is fair but leaves the vault less than its 100 bps floor once the 200 bps protocol share is taken. open_entry fails with MarginFloor. The same table opens for an app whose volume has brought its protocol share to 150 bps or less.

How much a vault can back

The vault reserves each entry’s liability, its worst case net of what the cost brought in:
Admission then checks, against the vault as it stands at open: free_balance = assets − reserved liability − open vault credits. The per-entry cap uses the vault margin, net of shares, so inflating the declared margin does not widen it, and every basis point of app share narrows it. After a drawdown trip the cap is halved for 48 hours.

Sizing a reward

Two consequences matter for an interface:
  1. Only the top multiplier costs capital. A reward table that pays something 90 % of the time can be trivial to back; a single large reward decides what the vault must hold.
  2. The cap bounds the liability, not the multiplier. On a fixed reward table, a cap C admits a cost of about C / (max(m) − 1).
On an idle vault with a 3 % declared margin, the smallest a reward table can declare at the base protocol share, and no app share (vault margin 100 bps), the Kelly term binds first: 0.5 × 100 bps is 50 bps of the free balance, below the 150 bps bound on assets. The smallest vault that carries a reward-or-nothing entry is roughly liability / 0.005, with a vault credit of the cost less its 2 % protocol share: An app whose volume has lowered its protocol share and that declares the smallest margin it may, 100 bps above its own share, has the same 100 bps vault margin and needs about the same vaults: only the vault credit grows, by the share the tier takes off (at the 100 bps tier, the first row’s liability is 9.01 USDC).
The minimum margin returns the most reward per unit of budget and is the most demanding margin for capacity. Its vault margin is 100 bps, so the Kelly term of the per-entry cap is 50 bps of the free balance, against 75 bps at the app’s 3.5 % margin at the base protocol share (vault margin 150 bps). For the same liability, every vault size here is 1.5 times what a 3.5 % reward table needs at the base, and a given vault backs a top reward about two thirds as large: large top rewards at the minimum margin need a larger vault. A tier raises the vault margin of the same declared margin: at the 100 bps tier, 3.5 % leaves 250 bps and a Kelly term of 125 bps. Above a 5 % margin with no app share at the base protocol share, or above 4 % at the 100 bps tier, the 150 bps bound on assets binds first on an idle vault.
A table whose top level is above 100× resolves on the VRF route rather than by commit-reveal (Settlement and keepers); the caps are the same on both routes. Between an epoch’s close and its strike, a commit-reveal entry is sized on the assets that stay in the vault, without the withdrawals queued for that strike. As the vault fills up, the free balance shrinks with it, so the largest reward the vault accepts falls as utilisation rises.

Show the limit, do not hit it

Read Config (for the parameters) and Vault (for totalAssets, totalReservedLiability, openVaultCredits) and apply the checks above in integers to show users the largest reward, or the largest cost, the vault accepts right now. Then simulate the transaction before asking for a signature: the program is the authority, and the vault can move between your read and the user’s click.

Common refusals

The full list is on Errors.