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
| name | value | purpose |
|---|
| MAX_LEVERAGE | 5 | maximum leverage per position |
| LONG_CAP_BPS | 4000 (40%) | per-band borrow cap relative to band capacity |
| BORROW_FEE_BPS | 100 (1%) | origination fee paid to stakers at open |
| CLOSE_FEE_BPS | 100 (1%) | fee on close surplus paid to stakers |
| SWAP_FEE_BPS | 100 (unused in v0.1) | placeholder for direct-swap LP fee |
| MIN_COLLATERAL_VALUE | 0.01 ETH | minimum collateral per position |
liquidation
| name | value | purpose |
|---|
| LIQUIDATION_HEALTH_BPS | 10500 (105%) | health threshold for liquidation |
| CLOSE_COOLDOWN_BLOCKS | 2 | blocks before user-close is allowed |
| LIQ_COOLDOWN_BLOCKS | 2 | blocks before auto-liquidation is allowed (D4) |
| MAX_LIQS_PER_SWAP | 10 | liquidations triggered by one external swap |
| MAX_LIQS_PER_BLOCK | 5 | liquidations across all swaps in one block |
| MAX_SCAN_PER_SWAP | 64 | positions scanned per liquidation pass |
defenses
| name | value | defense |
|---|
| MAX_OPEN_DEVIATION_BPS | 5000 ticks (~65% deviation) | D1 / D6 — spot-TWAP gate |
| MAX_LIQ_SPOT_DEVIATION | 1500 ticks (~16% deviation) | M-01 — sandwich-defer |
| MAX_CURVE_ADVANCE_PER_BLOCK | 5 ETH | D7 — per-block pump cap |
| MAX_TOTAL_BORROW | 200 ETH | D8 — absolute borrow ceiling |
| BAD_DEBT_PAUSE_THRESHOLD | 5 ETH | D9 — auto-pause threshold |
| FUNDING_RATE_PER_SECOND_E18 | 50% APR | D10 — funding accrual rate |
| STAKING_CALL_GAS_LIMIT | 100,000 | M-02 — staking call gas cap |
curve / bands
| name | value | purpose |
|---|
| TOTAL_SUPPLY | 1,000,000 PERP | fixed token supply |
| VIRTUAL_ETH (V) | 10 ETH | virtual reserve in curve formula |
| K | 10,000,000 | constant-product invariant |
| TICK_WIDTH_ETH | 5 ETH | cumulative-ETH width per band |
| NUM_INITIAL_BANDS | 300 | number of v4 LP positions |
| MAX_BORROW_BANDS | 5 | bands a single open's borrow walk touches |
TWAP
| name | value | purpose |
|---|
| TWAP_SECONDS | 300 | TWAP window for health + gates |
| OBS_BUFFER_SIZE | 64 | ring buffer length (one obs / second max) |