Problem
Under-collateralised positions sit on the edge with no path to forced close. The whole risk side of the exchange is missing — losses past collateral cannot be socialised, and there's no incentive payout to keep the system solvent.
Proposal
New subcommand on perplex-cli:
perplex-cli risk --edge-url ... --account 0x... --bearer $JWT
Per block (anvil tick / Sepolia block):
- Pull every open position from the edge (
/v1/positions/all — new internal endpoint, gated by an admin JWT claim).
- For each, compute health factor = (collateral + unrealised PnL) / (notional * mmRatioBps / 10000).
- If
health < 1, submit a reduce-only IOC market order on behalf of the liquidator wallet, marked liquidation: true.
- On-chain: pay
liqBonusBps of notional from the closed position's collateral to the liquidator's address.
Acceptance
Notes
This is the biggest remaining production-blocker. Until it ships, a wallet with a busted position can hold a stale entry forever and erode the vault.
Problem
Under-collateralised positions sit on the edge with no path to forced close. The whole risk side of the exchange is missing — losses past collateral cannot be socialised, and there's no incentive payout to keep the system solvent.
Proposal
New subcommand on perplex-cli:
Per block (anvil tick / Sepolia block):
/v1/positions/all— new internal endpoint, gated by an admin JWT claim).health < 1, submit a reduce-only IOC market order on behalf of the liquidator wallet, markedliquidation: true.liqBonusBpsof notional from the closed position's collateral to the liquidator's address.Acceptance
perplex-cli riskruns continuously, logs every health check.:9101(or similar) — positions scanned per block, liquidations triggered, bonus paid in USDC.Notes
This is the biggest remaining production-blocker. Until it ships, a wallet with a busted position can hold a stale entry forever and erode the vault.