PerpLandperpland

parameters

Every constant in PerpLandHook.sol, what it does, and how we picked it. These are v0.1 placeholders. Production values should be derived from your actual launch token supply, expected volume, and risk tolerance.

economics

namevaluepurpose
MAX_LEVERAGE5maximum leverage per position
LONG_CAP_BPS4000 (40%)per-band borrow cap relative to band capacity
BORROW_FEE_BPS100 (1%)origination fee paid to stakers at open
CLOSE_FEE_BPS100 (1%)fee on close surplus paid to stakers
SWAP_FEE_BPS100 (unused in v0.1)placeholder for direct-swap LP fee
MIN_COLLATERAL_VALUE0.01 ETHminimum collateral per position

liquidation

namevaluepurpose
LIQUIDATION_HEALTH_BPS10500 (105%)health threshold for liquidation
CLOSE_COOLDOWN_BLOCKS2blocks before user-close is allowed
LIQ_COOLDOWN_BLOCKS2blocks before auto-liquidation is allowed (D4)
MAX_LIQS_PER_SWAP10liquidations triggered by one external swap
MAX_LIQS_PER_BLOCK5liquidations across all swaps in one block
MAX_SCAN_PER_SWAP64positions scanned per liquidation pass

defenses

namevaluedefense
MAX_OPEN_DEVIATION_BPS5000 ticks (~65% deviation)D1 / D6 — spot-TWAP gate
MAX_LIQ_SPOT_DEVIATION1500 ticks (~16% deviation)M-01 — sandwich-defer
MAX_CURVE_ADVANCE_PER_BLOCK5 ETHD7 — per-block pump cap
MAX_TOTAL_BORROW200 ETHD8 — absolute borrow ceiling
BAD_DEBT_PAUSE_THRESHOLD5 ETHD9 — auto-pause threshold
FUNDING_RATE_PER_SECOND_E1850% APRD10 — funding accrual rate
STAKING_CALL_GAS_LIMIT100,000M-02 — staking call gas cap

curve / bands

namevaluepurpose
TOTAL_SUPPLY1,000,000 PERPfixed token supply
VIRTUAL_ETH (V)10 ETHvirtual reserve in curve formula
K10,000,000constant-product invariant
TICK_WIDTH_ETH5 ETHcumulative-ETH width per band
NUM_INITIAL_BANDS300number of v4 LP positions
MAX_BORROW_BANDS5bands a single open's borrow walk touches

TWAP

namevaluepurpose
TWAP_SECONDS300TWAP window for health + gates
OBS_BUFFER_SIZE64ring buffer length (one obs / second max)