Number Systems
Perpl uses four purpose-built integer representations — each sized exactly for its job. The choice of decimal split between price and size is a fundamental tradeoff baked into every market on the exchange.
Why integers?
EVM smart contracts don't have floating point. Every price, size, and balance is an unsigned integer. The question is how many of those integers represent whole units versus fractional parts — the decimal placement is a design choice fixed at deployment time.
A naive approach uses one representation for everything. Perpl uses four, each with the right bit width and decimal precision for its specific role.
The four number systems
Collateral, fees, PnL
Lot sizes, position sizes
Mark price, oracle, entry
Orderbook price slots
The precision budget
CNS (collateral) is always 6 decimal places — USDC has 6 decimals, and that's fixed. When the contract computes PnL as price × size, the result must land in CNS. That means price and size decimals together can't exceed 6:
d_p + d_l ≤ 6
d_p ≥ 0, d_l ≥ 0 Both live perps use the full budget (d_p + d_l = 6). Using fewer wastes precision; using more causes truncation errors.
This means every market is making a tradeoff: more price precision means less size precision, and vice versa. The split is chosen once at market creation and can't change. Using fewer than all 6 decimals is allowed but wastes precision that could otherwise be allocated to price or size granularity.
size = 2.50000 BTC → LNS = 250,000
raw product = 950,001 × 250,000
= 237,500,250,000
÷ 106 = $237,500.25 USDC ✓
size = 5,000 MON → LNS = 5,000
raw product = 40,000 × 5,000
= 200,000,000
÷ 106 = $200.00 USDC ✓
Why BTC and MON look so different
At ~$95,000, Bitcoin needs fine size granularity — you want to let traders buy $1 worth of BTC, which means 0.00001 BTC minimum lots (5 size decimals). Price ticks of $0.10 are more than adequate at that scale. So BTC uses 1 price decimal, 5 size decimals.
Monad at ~$0.04 has the opposite problem. A $0.10 price tick would be 250% of the entire asset price — the tick is larger than the price itself. You need $0.000001 ticks to express meaningful price moves. And whole-MON lot sizes ($0.04 each) are still small enough for retail. So MON uses 6 price decimals, 0 size decimals.
The ONS range tradeoff
Prices in the orderbook are stored as 24-bit offsets (ONS) from a base price. This caps the total representable price range at 16,777,215 ticks. More price decimals means smaller ticks, which means the total range shrinks:
BTC at 1 price decimal: each tick is $0.10, so the range spans $1,677,721 — enough to cover BTC from near zero to multiples of today's price. MON at 6 price decimals: each tick is $0.000001, so the range spans $16.78 — fine at $0.04 but requires a base price update if MON ever rallies significantly.