liquidation-cascade
Skill36 starsChanged 5 months agoMITView on GitHub
Detect cascading liquidations and socialized bad debt — correlated collateral (multiple LSTs/stables), bad debt socialized across unrelated markets, oracle flash-crash triggering mass liquidation, insurance-fund depletion ordering, liquidation incentives too low to clear bad debt, and depeg cascades. Activate whenever a lending/perp/CDP protocol liquidates positions, prices collateral, or has shared-risk pools.
In this repository44 other files it gives its agents.
- access-controlSkill
- approval-issuesSkill
- caching-and-incrementalSkill
- centralization-riskSkill
- confidence-scoringSkill
- cosmwasmSkill
- cross-chain-messagingSkill
- cross-contract-stateSkill
- delegatecall-risksSkill
- diamond-eip2535Skill
- dos-vectorsSkill
- erc1271-contract-signaturesSkill
- erc4337-account-abstractionSkill
- erc4626-inflationSkill
- false-positive-feedback-loopSkill
- fee-on-transferSkill
- flash-loan-attacksSkill
- initializationSkill
- inline-assemblySkill
- integer-issuesSkill
- intents-erc7683Skill
- known-good-comparisonSkill
- mev-frontrunningSkill
- mev-pbsSkill
- multi-pass-self-critiqueSkill
- oracle-manipulationSkill
- oracle-redundancySkill
- permit2-patternsSkill
- pragma-and-addressesSkill
- progress-and-streamingSkill
- reentrancySkill
- restaking-eigenlayerSkill
- selfdestruct-eip6780Skill
- signature-malleabilitySkill
- signature-replaySkill
- solana-anchorSkill
- storage-layoutSkill
- stylus-rustSkill
- token-compatibilitySkill
- tx-context-misuseSkill
- unchecked-callsSkill
- ve-lock-governanceSkill
- vyper-specificSkill
- zk-verifier-bugsSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 40
If the liquidation bonus < gas + slippage to unwind seized collateral, liquidators don't act.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Liquidation cascade detection
When this applies
Trigger on any of:
- Lending / CDP / perp markets with liquidation and a liquidation bonus
- Multiple collateral assets that are correlated (stETH/rETH/cbETH, USDC/DAI/USDT)
- A single insurance fund or backstop covering many isolated or pooled markets
- Bad-debt handling that socializes losses across lenders/LPs
- Collateral priced from a feed that can flash-crash or depeg
- Liquidation incentives or close factors set by governance
Detection patterns
Correlated collateral, no concentration cap (HIGH)
// stETH, rETH, cbETH all accepted, all priced off ETH-correlated feeds
collateralFactor[stETH] = 0.9e18;
collateralFactor[rETH] = 0.9e18;Signal: treating correlated LSTs as independent diversification. A single LST depeg (stETH 2022, or an LRT slashing event) crashes many positions at once, overwhelming liquidation throughput. Cap aggregate exposure per risk-cluster, not per token.
Bad debt socialized across markets (HIGH)
A loss in one risky isolated market draining a shared insurance fund or pool that also backs blue-chip markets. Signal: one toxic listing can impair unrelated depositors (the Mango / cross-margin contagion class). Isolate bad debt to the originating market.
Oracle flash-crash mass liquidation (HIGH)
uint256 price = oracle.getPrice(collateral); // single-block spot, no bounds
if (debt > price * collateral * cf) liquidate();Signal: a momentary depeg / wick (or manipulated feed) marks thousands of healthy positions liquidatable in one block; liquidators race, price gaps, and survivors eat bad debt. Use TWAP / deviation circuit breakers before liquidating en masse.
Liquidation incentive too low → stuck bad debt (MEDIUM)
If the liquidation bonus < gas + slippage to unwind seized collateral, liquidators don't act; positions go underwater and bad debt accrues silently. Signal: fixed small bonus on illiquid or volatile collateral.
Insurance-fund depletion ordering (MEDIUM / HIGH)
Order of loss absorption matters: if the fund pays liquidator bonuses before covering bad debt, or if multiple markets draw from it without priority, a run drains it. Define and bound the waterfall.
Depeg cascade (HIGH)
Stablecoin-collateralized debt where the stable depegs: liquidations sell the depegging asset, deepening the depeg, triggering more liquidations (UST May 2022). Flag self-reinforcing sell pressure with no circuit breaker.
Severity rubric
| Pattern | Severity | Notes |
| Toxic-market bad debt socialized to all depositors | High | Cross-market contagion |
| Correlated collateral, no cluster cap | High | Simultaneous mass insolvency |
| Spot-oracle flash-crash mass liquidation | High | One-block cascade |
| Self-reinforcing depeg cascade | High | No circuit breaker |
| Insurance-fund waterfall ordering flaw | Medium | Run-depletable |
| Liquidation bonus too low → stuck bad debt | Medium | Slow accrual |
Remediation patterns
- Isolate bad debt per market (Compound III / Morpho-style isolation, Aave isolation mode + debt ceilings); never let a risky listing impair blue-chip depositors.
- Risk-cluster caps — bound aggregate exposure to correlated assets (all LSTs as one bucket), not per-token.
- Circuit breakers — pause liquidations on excessive deviation; use TWAP/median so a single wick can't mass-liquidate.
- Right-size liquidation incentives to gas + realistic unwind slippage on the actual collateral liquidity.
- Define the loss waterfall explicitly (insurance fund → socialization → governance backstop) with per-market accounting.
False-positive notes
- A protocol with hard per-market debt ceilings and isolated collateral already bounds contagion; note rather than escalate.
- Single-collateral, deeply-liquid markets (e.g. WETH-only) carry low cascade risk.
- A bonus that looks low but on a highly liquid asset may still clear — judge against real unwind cost.
Related
- [[oracle-redundancy]] — flash-crash protection and staleness gating
- [[oracle-manipulation]] — manipulated marks trigger false liquidations
- [[centralization-risk]] — governance-set risk params and pause keys
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

