Maths
Every formula here is taken from the deployed source: ShortBook.sol, PriceFeed.sol and the Payoff library. All rates are in basis points (1 bp = 0.01%, BPS = 10,000). All amounts are in wei (1 HYPE = 1018 wei). Division rounds down.
Variables
| Symbol | Meaning | Source |
|---|---|---|
stake | HYPE the shorter puts at risk, and the amount of backer HYPE locked | openShort argument |
K | Strike price, fixed at open | _strike |
S | Settlement price, the 15 minute median at expiry | settle |
free, locked | A book's free and locked backer HYPE | Book |
u | Utilisation in bps, after this ticket locks | _premiumBps |
premBaseBps | Base 6 hour premium | params |
premSlopeBps | Extra 6 hour premium per 100% utilisation | params |
utilCapBps | Utilisation used in the premium is capped here | params |
momentum1hBps, momentum6hBps | Momentum weights. 5000 = 0.5 bp of premium per 1 bp of drop | params |
momentumCapBps | Cap on the momentum add-on | params |
feeBpsShort, feeBpsLong | Fee for 6 hour and 24 hour tickets | params |
refRes | Reference reserve: lowest pool reserve recorded over the last ~7 hours | PriceFeed.refReserve |
Shorter payout
else: payout = min( ⌊stake × (2K − S) / K⌋, 2 × stake )
stake × (1 − move) with move = (S − K) / K, clamped to [0, 2 × stake].Backers, treasury and slices
toBackers = 2 × stake − payout + premium + (fee − treasury)
slice crediti = ⌊toBackers × amounti / stake⌋ (last slice: toBackers − sum of the others)
The HYPE balances because the contract holds stake + premium + fee from the shorter plus stake locked from backers: payout + toBackers + treasury = 2 × stake + premium + fee.
Premium
base6h = premBaseBps + ⌊premSlopeBps × u / 10000⌋
base = base6h for 6 hours, 2 × base6h for 24 hours
premiumBps = base + momentum
premium = ⌊stake × premiumBps / 10000⌋
lockedafter = locked + stake and freeafter = free − stake. The momentum add-on is not doubled for 24 hours.With today's values (base 10, slope 30, cap 6000) the base 6 hour premium runs from 10 bps on an empty book to 28 bps at 60% utilisation and above. 24 hours runs from 20 to 56 bps.
Momentum add-on
Momentum charges more when the coin has been falling, because falls are what backers pay out on.
r6h = (med − p6h) × 10000 / p6h
momentum = min( ⌊momentum1hBps × max(0, −r1h) / 10000⌋ + ⌊momentum6hBps × max(0, −r6h) / 10000⌋, momentumCapBps )
med is the current 15 minute median. p1h and p6h are the latest samples at or before 1 hour and 6 hours ago.Momentum is only active when all of these hold, otherwise it is zero:
- the market's first sample is at least 6 hours old,
- the current 15 minute window is continuous and has a non-zero median,
- samples exist at or before 1 hour ago and 6 hours ago.
Today's weights: 5000 for 1 hour (0.5 bp per bp of drop), 2500 for 6 hours (0.25 bp per bp), capped at 100 bps. Rises add nothing.
Fee and total cost
cost = stake + premium + fee
openShort is refunded.Strike, settlement price and expiry
S = median of samples in [expiry − 900, expiry]
expiry = ⌈(now + term) / 300⌉ × 300
Caps at open
openStake + stake ≤ ⌊refRes × oiCapBps / 10000⌋
refRes ≥ reserveFloor
Results and bounds
| Formula | |
|---|---|
| Shorter net | payout − stake − premium − fee |
| Shorter max loss | stake + premium + fee (when S ≥ 2K) |
| Shorter max gain | stake − premium − fee (when S = 0) |
| Backers' net | stake − payout + premium + fee − ⌊fee/2⌋ |
| Backers' max loss | stake − premium − (fee − ⌊fee/2⌋) (when S = 0) |
| Utilisation shown in the app | ⌊locked × 10000 / (free + locked)⌋ |
Price and reserve units
The price feed reads sqrtPriceX96 and in-range liquidity L from Uniswap v4's StateView. Prices are HYPE base units per token base unit, scaled by 1036. Reserves are the virtual HYPE of in-range liquidity at the current price.
HYPE is currency1: price = (√P2 / 296) × 1036 / 296, reserve = L × √P / 296
