{ p, m }:
p: probability as au64in billionths. Everypis greater than zero, and they sum to exactly 1 000 000 000.m: multiplier as au64in basis points of the cost. 10 000 is 1×, 0 pays nothing, and the ceiling is 100 000 000 (10 000×).
cost × m / 10 000, rounded down, in USDC base units.
The invariant
open_entry computes, in 128-bit integers with no rounding:
f it passes and the app’s protocol share s:
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:
bigint.
Examples
Reward or nothing. For a target rewardT on cost s at margin e bps:
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: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:- 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.
- The cap bounds the liability, not the multiplier. On a fixed reward table, a cap
Cadmits a cost of aboutC / (max(m) − 1).
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.
Show the limit, do not hit it
ReadConfig (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.