# perp-protocol-design-review

> Solvency-focused review of perp/margin protocols: margin, funding, liquidation, insurance fund, ADL.

perp-protocol-design-review is a paid AI agent skill on Agensi by BanditXBT, in Security. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $4.2 (one-time purchase)
- Creator: [BanditXBT](https://www.agensi.io/creators/banditxbt)
- Category: [Security](https://www.agensi.io/skills/security)
- Version: 1.0
- Last updated: 2026-11-21
- Security: scan passed (2026-11-21); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/perp-protocol-design-review
- Tags: web3-crypto, trading-investing, security

## About this skill

A perp venue is a solvency machine: every unit of unrealized profit is someone's loss or the pool's liability. Review whether that books always balance under stress.

- **Orderbook / matching engine** (on- or off-chain): counterparties are traders; protocol bears only bad debt.
- **Oracle-priced pool** (LP/vault is counterparty): LPs are short trader PnL; price manipulation and skew become LP losses.
- **vAMM / virtual curve:** price impact from curve; funding anchors mark to index.
State who is the counterparty to each trade and who absorbs shortfall.

1. **Conservation:** total collateral + insurance ≈ Σ(user equity) + protocol liabilities; zero-sum PnL across longs/shorts net of fees.
2. **No free money:** open then immediately close at the same price returns ≤ initial collateral minus fees.
3. **Margin:** `equity ≥ initial margin` to open or increase; `equity < maintenance margin` ⇒ liquidatable; liquidation must move account to a *safer* state.
4. **OI & risk caps:** per-market OI, per-account size, skew/imbalance limits are enforced on every path (including partial close, collateral withdrawal, and order execution by keepers).
5. **Funding:** payments net to ~zero between longs and shorts (or are accounted for if pool is counterparty); accrual is time-weighted and cannot be skipped or double-counted.

- **Mark vs. index vs. last price:** liquidation and PnL should use a manipulation-resistant mark (index with premium/TWAP clamp), not last trade. Check price-source switching and fallback behavior.
- **Funding rate:** formula (premium/skew-based), clamp, interval, sign convention, max rate; behavior at extreme skew; precision and rounding; funding applied before margin checks.
- **Margin model:** isolated vs. cross; per-asset haircuts on collateral; collateral that correlates with the position (wrong-way risk: ETH collateral long ETH); unrealized-PnL counted as collateral?
- **Liquidation:** trigger, close factor (partial vs. full), penalty/fee split (liquidator vs. insurance), minimum position size so liquidations remain profitable under gas, keeper incentive vs. gas on each chain, behavior when liquidation is *unprofitable* (bad debt accrues). Self-liquidation to capture the fee; liquidation of positions at the same oracle tick used to open.
- **Insurance fund & socialization:** order of loss absorption (liquidation penalty → insurance → LP/vault → ADL or socialized loss). ADL rules should be deterministic and ranked by profit×leverage. Attack: drain insurance fund via coordinated bad-debt creation.
- **Order lifecycle:** keeper-executed orders (two-step request/execute) with price-at-execution vs. price-at-request; stale-order replay; cancellation griefing; front-running of oracle updates (latency arbitrage against pull oracles such as Pyth: attacker picks which signed price to submit within the allowed window).
- **Fees & rebates:** exploitable with wash trading, self-referral, negative-fee maker rebates.
- **Admin/risk params:** who can change leverage, caps, oracle, fee? Timelock? Can an update instantly make healthy accounts liquidatable?
- **Chain specifics:** sequencer downtime (grace period before liquidations resume), block time/latency vs. funding interval, gas auction dynamics on congested chains.

## Requires

Nothing beyond your AI agent.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the perp-protocol-design-review skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What does perp-protocol-design-review do?

Solvency-focused review of perp/margin protocols: margin, funding, liquidation, insurance fund, ADL.

### Which AI agents support perp-protocol-design-review?

This skill uses the open SKILL.md standard. Use it through an MCP-compatible agent connected to Agensi, and check the compatibility information on this page for confirmed agents and required capabilities.

### How do I use perp-protocol-design-review?

Connect your AI agent to Agensi through MCP, then ask it to use perp-protocol-design-review on your task. Your agent loads the latest approved version each time. Paid skills require a purchase or active subscription. Skill files are not available for download; your licence does not allow you to save, copy or export any part of a skill.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
