Appearance
Perp settlement
How a perp opens, where it busts, and how each of its three endings is paid.
Live on the testnetOpen
open(order, price, signature) checks the order's signature, the market, the price, the leverage (1× to 1000×), the margin (at least $1), the size ($2,000,000 at most) and the open-interest cap. The margin then moves from the balance to the Vault's held account, and the position's terms are stored with it: the deadband, the base rate, the impact, the win fee and the holdback curve in force.
The bust price
distance = entry / leverage − entry × 0.05%
bust = entry − distance (long) entry + distance (short)The 0.05% buffer means a position is liquidated slightly before its margin is fully used up by the move. The buffer is the pool's protection against a price that jumps past the bust price between two readings.
The three endings
A close at a loss
loss = min( size × move against , margin )
returns = margin − lossNothing is charged on top.
A close at a gain
The margin comes back with the profit the win charge leaves. There is no cap on a perp's profit.
A liquidation
The whole margin is forfeited. A liquidation happens when:
- the server sees the mid reach the bust price and sends
liquidate(id, price)with that price; or - a close lands at or past the bust price, which settles as a liquidation.
The server checks every open perp on every change of the quote. A once-a-second pass over the recorded prices is the safety net for a bust reached while the server was down.
What reaches the pool
The margin is held until the position ends. Then one settlement returns what is left of it, moves the loss to the pool, and credits a profit in full. As on a fuse, 2% of a loss the pool gained is the stakers' and dev's fee, and points are earned on the margin lost.
Separate from fuses, on purpose
PerpMarket is its own contract behind its own proxy, and a second poster on the Vault. Its position ids start at 1,000,000,000,001 so they never collide with a fuse's. It reads the limits it shares with fuses from Params and keeps its own terms itself. Its open interest is counted over perps alone.