-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscenarios.py
More file actions
641 lines (610 loc) Β· 33.6 KB
/
scenarios.py
File metadata and controls
641 lines (610 loc) Β· 33.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
"""
scenarios.py
============
Historical DeFi crisis scenario library.
Each scenario defines parameters used by the NLP/script generator and EVM sandbox.
"""
from typing import Dict, Any, List
SCENARIOS: Dict[str, Dict[str, Any]] = {
"dex_arbitrage": {
"id": "dex_arbitrage",
"label": "βοΈ DEX Arbitrage",
"description": "Exploiting price differences for the same asset across decentralized exchanges. Monitor DEXs, detect token priced lower on Exchange A, buy on A, sell on B. Capture spread minus gas.",
"tags": ["arbitrage", "mev", "spread"],
"expected_outcomes": ["Arbitrage traders execute high volume swaps", "Pool price tightly tracking oracle"]
},
"sandwich_attack": {
"id": "sandwich_attack",
"label": "π₯ͺ Sandwich Attack (MEV)",
"description": "Extracting profit from large pending trades by placing trades before and after them. MEV searcher detects large trade in mempool, buys before, victim pushes price, MEV sells immediately after.",
"tags": ["mev", "sandwich", "frontrun", "slippage"],
"expected_outcomes": ["MEV bots massively increase swap frequency", "High retail slippage detected"]
},
"liquidation_sniping": {
"id": "liquidation_sniping",
"label": "π― Liquidation Sniping",
"description": "Liquidating undercollateralized loans to earn bonus reward. Monitor lending positions. Detect when collateral ratio falls. Repay debt, receive discounted collateral.",
"tags": ["liquidation", "mev", "lending"],
"expected_outcomes": ["MEV/Whale accounts trigger liquidations", "Sudden price drops due to collateral selloffs"]
},
"backrun_arbitrage": {
"id": "backrun_arbitrage",
"label": "π Backrun Arbitrage",
"description": "Profiting from price impact caused by large swaps. Large trade shifts AMM price. Bot executes trade immediately after to restore pool equilibrium and capture price difference.",
"tags": ["mev", "backrun", "arbitrage"],
"expected_outcomes": ["MEV bots follow whale transactions tightly", "Spread neutralizes rapidly"]
},
"stablecoin_peg_arb": {
"id": "stablecoin_peg_arb",
"label": "π΅ Stablecoin Peg Arbitrage",
"description": "Exploiting temporary deviation of stablecoin from 1 dollar peg. Stablecoin trades below peg. Whales/Arbs buy at discount, redeem or sell when peg restores.",
"tags": ["stablecoin", "depeg", "arbitrage"],
"expected_outcomes": ["Heavy buying pressure on USDC", "Whales and Institutions step in heavily"]
},
"spread_capture": {
"id": "spread_capture",
"label": "π Spread Capture (Market Making)",
"description": "Earning profit from continuous bid-ask spread. Post buy and sell orders simultaneously to earn the difference. Hedge exposure if necessary.",
"tags": ["market-making", "liquidity", "hedging"],
"expected_outcomes": ["Market Maker activity volume increases drastically", "Tiny, continuous, bidirectional swaps"]
},
"yield_farming": {
"id": "yield_farming",
"label": "π Yield Farming Panic",
"description": "Depositing funds in high APY protocols to earn rewards. Suddenly APY drops, causing a massive exit and panic selloff of the reward token.",
"tags": ["retail", "yield", "panic", "dump"],
"expected_outcomes": ["Retail traders mass exit positions", "Token liquidity drains rapidly"]
},
# ββ HISTORICAL CRISIS SCENARIOS ββββββββββββββββββββββββββββββββββ #
"bitcoin_halving": {
"id": "bitcoin_halving",
"label": "βοΈ Bitcoin Halving (2012β2024)",
"title": "Bitcoin Halving β Supply Shock Bull Run",
"description": (
"Simulate the supply-shock dynamics following a Bitcoin halving event. "
"Block rewards are cut by 50%, sharply reducing new token issuance. "
"Institutional and retail whales front-run the supply squeeze, purchasing "
"large positions. Oracle prices are pushed upward. Mirrors the 2016 "
"($650 β $20,000) and 2020 ($8,000 β $69,000) post-halving bull cycles."
),
"actor": "whale",
"tags": ["supply-shock", "bull-run", "bitcoin", "halving"],
"risk_focus": ["oracle", "supply", "liquidity"],
"steps": 80,
"actions": [
{"type": "swap", "token": "TOKEN", "amount": 500000, "speed": "rapid", "target": "pool"},
{"type": "deposit", "token": "TOKEN", "amount": 200000, "speed": "gradual", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 300000, "speed": "instant", "target": "pool"},
],
"market_events": [
{"type": "price_spike", "magnitude": 3.0, "duration_steps": 20},
{"type": "oracle_lag", "magnitude": 0.1, "duration_steps": 10},
{"type": "price_spike", "magnitude": 8.0, "duration_steps": 30},
],
"expected_outcomes": [
"Whale accumulation drives sustained price appreciation",
"Oracle price spikes 3xβ8x post-halving",
"Reduced token supply flow creates liquidity tightening"
]
},
"ico_boom_2017": {
"id": "ico_boom_2017",
"label": "π ICO Boom (2017)",
"title": "ICO Speculative Mania β ETH & Token Explosion",
"description": (
"Replicate the 2017 ICO mania when ETH surged from ~$8 to ~$1,400. "
"Retail speculators poured capital into every new token launch, driving "
"explosive price appreciation. Liquidity concentrates in a handful of "
"trending tokens while long-tailed ICO tokens see parabolic and then "
"catastrophic swings."
),
"actor": "retail",
"tags": ["speculative-mania", "ico", "ethereum", "retail"],
"risk_focus": ["liquidity", "volatility", "oracle"],
"steps": 60,
"actions": [
{"type": "swap", "token": "TOKEN", "amount": 5000, "speed": "rapid", "target": "pool"},
{"type": "swap", "token": "TOKEN", "amount": 10000, "speed": "instant", "target": "pool"},
{"type": "deposit", "token": "TOKEN", "amount": 8000, "speed": "rapid", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 20000, "speed": "instant", "target": "pool"},
],
"market_events": [
{"type": "hyperinflation", "magnitude": 0.5, "duration_steps": 15},
{"type": "price_spike", "magnitude": 5.0, "duration_steps": 20},
{"type": "price_spike", "magnitude": 10.0, "duration_steps": 10},
{"type": "liquidity_drain","magnitude": 0.4, "duration_steps": 15},
],
"expected_outcomes": [
"Extreme retail buy pressure drives oracle price 10x",
"Liquidity pools experience rapid inflow then fragmentation",
"Volatility spikes as speculative fever peaks"
]
},
"defi_summer_2020": {
"id": "defi_summer_2020",
"label": "π DeFi Summer (2020)",
"title": "DeFi Summer β Yield Farming Liquidity Surge",
"description": (
"Model the DeFi Summer 2020 regime where liquidity-mining incentives "
"drove 10xβ100x price increases for UNI, AAVE, COMP and similar tokens. "
"Yield farmers chase high APYs, depositing enormous capital, pushing "
"token prices skyward. When yields compress, rapid exit events and "
"liquidity crunches follow."
),
"actor": "retail",
"tags": ["yield-farming", "defi", "liquidity-mining", "apy"],
"risk_focus": ["yield", "liquidity", "oracle"],
"steps": 70,
"actions": [
{"type": "deposit", "token": "TOKEN", "amount": 50000, "speed": "gradual", "target": "vault"},
{"type": "borrow", "token": "TOKEN", "amount": 30000, "speed": "instant", "target": "vault"},
{"type": "deposit", "token": "TOKEN", "amount": 100000, "speed": "rapid", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 25000, "speed": "instant", "target": "pool"},
],
"market_events": [
{"type": "price_spike", "magnitude": 4.0, "duration_steps": 20},
{"type": "price_spike", "magnitude": 10.0, "duration_steps": 15},
{"type": "liquidity_drain","magnitude": 0.5, "duration_steps": 20},
{"type": "price_drop", "magnitude": 0.4, "duration_steps": 15},
],
"expected_outcomes": [
"TVL surges as yield farmers flood the protocol",
"Token price inflates 10x on liquidity-mining incentives",
"Sudden APY compression causes rapid capital exodus"
]
},
"nft_mania_2021": {
"id": "nft_mania_2021",
"label": "π¨ NFT Mania (2021)",
"title": "NFT Mania β Speculative Demand on ETH & SOL",
"description": (
"Simulate the 2021 NFT frenzy that drove Solana from ~$2 to ~$260 and "
"lifted Ethereum gas fees to record highs. Retail and whale actors compete "
"to accumulate NFT-linked tokens, minting artificial scarcity. "
"Network adoption explodes, driving oracle prices to unsustainable levels "
"before a sharp correction sets in."
),
"actor": "retail",
"tags": ["nft", "speculative-mania", "ethereum", "solana", "retail"],
"risk_focus": ["volatility", "oracle", "liquidity"],
"steps": 60,
"actions": [
{"type": "swap", "token": "ETH", "amount": 10000, "speed": "rapid", "target": "pool"},
{"type": "deposit", "token": "TOKEN", "amount": 5000, "speed": "instant", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 15000, "speed": "rapid", "target": "pool"},
],
"market_events": [
{"type": "price_spike", "magnitude": 15.0, "duration_steps": 20},
{"type": "oracle_lag", "magnitude": 0.1, "duration_steps": 5},
{"type": "price_spike", "magnitude": 30.0, "duration_steps": 10},
{"type": "price_drop", "magnitude": 0.5, "duration_steps": 15},
],
"expected_outcomes": [
"Oracle price surges 30x reflecting NFT-driven demand",
"Retail competition creates extreme gas price and slippage",
"Post-mania correction wipes 50% of speculative gains"
]
},
"tesla_btc_purchase_2021": {
"id": "tesla_btc_purchase_2021",
"label": "π Tesla BTC Purchase (2021)",
"title": "Tesla Bitcoin Purchase β Corporate Treasury Shock",
"description": (
"Model the market impact of Tesla's $1.5B BTC purchase in February 2021, "
"which caused a ~20% single-day price jump. An institutional whale enters "
"a massive position, signalling corporate treasury adoption. Other institutions "
"and retail traders rush to follow, amplifying the initial shock."
),
"actor": "whale",
"tags": ["corporate-adoption", "bitcoin", "institutional", "treasury"],
"risk_focus": ["oracle", "volatility", "liquidity"],
"steps": 40,
"actions": [
{"type": "swap", "token": "TOKEN", "amount": 1500000, "speed": "instant", "target": "pool"},
{"type": "deposit", "token": "TOKEN", "amount": 500000, "speed": "rapid", "target": "vault"},
],
"market_events": [
{"type": "price_spike", "magnitude": 1.2, "duration_steps": 5},
{"type": "oracle_lag", "magnitude": 0.0, "duration_steps": 3},
{"type": "price_spike", "magnitude": 1.4, "duration_steps": 10},
],
"expected_outcomes": [
"Single-day price jump of 20%+ on institutional buy signal",
"Copycat retail and institutional buying extends the rally",
"Oracle trails the rapid price movement causing brief lag"
]
},
"bitcoin_etf_approval_2024": {
"id": "bitcoin_etf_approval_2024",
"label": "π Bitcoin ETF Approval (2024)",
"title": "Bitcoin Spot ETF Approval β Institutional Inflows",
"description": (
"Simulate the January 2024 US spot Bitcoin ETF approval that unlocked "
"massive institutional access to BTC. Regulated ETF products channel "
"billions in fresh capital into the market. Liquidity deepens significantly "
"while oracle prices are pushed upward by sustained institutional demand."
),
"actor": "whale",
"tags": ["regulatory-approval", "etf", "bitcoin", "institutional"],
"risk_focus": ["liquidity", "oracle", "regulatory"],
"steps": 50,
"actions": [
{"type": "deposit", "token": "TOKEN", "amount": 5000000, "speed": "gradual", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 2000000, "speed": "rapid", "target": "pool"},
{"type": "deposit", "token": "TOKEN", "amount": 3000000, "speed": "slow", "target": "vault"},
],
"market_events": [
{"type": "price_spike", "magnitude": 1.5, "duration_steps": 15},
{"type": "oracle_lag", "magnitude": 0.1, "duration_steps": 5},
{"type": "price_spike", "magnitude": 2.0, "duration_steps": 20},
],
"expected_outcomes": [
"Institutional inflows drive sustained price appreciation",
"Liquidity depth increases significantly with ETF demand",
"Oracle adjusts upward in a controlled, sustained move"
]
},
"mt_gox_collapse_2014": {
"id": "mt_gox_collapse_2014",
"label": "π Mt. Gox Collapse (2014)",
"title": "Mt. Gox Exchange Collapse β 85% BTC Price Crash",
"description": (
"Replicate the catastrophic Mt. Gox failure of February 2014, where the "
"world's largest Bitcoin exchange halted withdrawals and declared insolvency "
"after ~850,000 BTC were found missing. Bitcoin fell ~85% from ~$1,200 to "
"~$180. Simulate mass withdrawals, forced liquidations, and a cascading "
"price collapse driven by counterparty panic."
),
"actor": "whale",
"tags": ["exchange-failure", "bitcoin", "hack", "insolvency", "collapse"],
"risk_focus": ["solvency", "liquidity", "oracle"],
"steps": 60,
"actions": [
{"type": "withdraw", "token": "TOKEN", "amount": 800000, "speed": "rapid", "target": "vault"},
{"type": "liquidate", "token": "TOKEN", "amount": 200000, "speed": "instant", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 100000, "speed": "rapid", "target": "pool"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.40, "duration_steps": 10},
{"type": "liquidity_drain","magnitude": 0.70, "duration_steps": 15},
{"type": "price_drop", "magnitude": 0.85, "duration_steps": 20},
],
"expected_outcomes": [
"85% oracle price collapse as exchange insolvency spreads",
"Mass withdrawal requests drain protocol liquidity",
"Cascading liquidations accelerate price discovery downward"
]
},
"dao_hack_2016": {
"id": "dao_hack_2016",
"label": "π DAO Hack (2016)",
"title": "TheDAO Reentrancy Exploit β ETH Smart Contract Drain",
"description": (
"Simulate the June 2016 DAO hack where an attacker exploited a reentrancy "
"vulnerability to drain 3.6M ETH (~$70M at the time) from TheDAO. ETH fell "
"~35%. The incident triggered an Ethereum hard fork, creating Ethereum Classic. "
"An attacker uses a flash loan to fund the exploit, repeatedly drains the vault "
"before reentrancy guards fire, then governance splits the community."
),
"actor": "whale",
"tags": ["smart-contract-exploit", "reentrancy", "ethereum", "dao", "flash-loan"],
"risk_focus": ["flash_loan", "governance", "solvency"],
"steps": 40,
"actions": [
{"type": "flash_loan", "token": "ETH", "amount": 3600000, "speed": "instant", "target": "vault"},
{"type": "drain", "token": "TOKEN", "amount": 3600000, "speed": "instant", "target": "pool"},
{"type": "governance_vote", "token": "TOKEN", "amount": 1, "speed": "rapid", "target": "vault"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.35, "duration_steps": 10},
{"type": "oracle_lag", "magnitude": 0.1, "duration_steps": 5},
],
"expected_outcomes": [
"Flash loan funded reentrancy drains vault in a single block",
"ETH oracle price drops 35% on exploit discovery",
"Governance emergency vote triggers protocol hard fork"
]
},
"china_crypto_ban_2021": {
"id": "china_crypto_ban_2021",
"label": "π¨π³ China Crypto Ban (2021)",
"title": "China Mining & Trading Ban β 50% BTC Crash",
"description": (
"Model the regulatory shock when China announced a blanket ban on crypto "
"mining and trading in MayβSeptember 2021. Bitcoin fell ~50%, hash rate "
"dropped ~50%, and Chinese miners dumped holdings to cover migration costs. "
"Simulate the sudden capital flight, whale sell-off, and regulatory-driven "
"liquidity crisis across the protocol."
),
"actor": "whale",
"tags": ["regulatory-crackdown", "china", "bitcoin", "mining-ban"],
"risk_focus": ["liquidity", "oracle", "regulatory"],
"steps": 50,
"actions": [
{"type": "withdraw", "token": "TOKEN", "amount": 300000, "speed": "rapid", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 200000, "speed": "instant", "target": "pool"},
{"type": "withdraw", "token": "TOKEN", "amount": 150000, "speed": "gradual", "target": "vault"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.30, "duration_steps": 10},
{"type": "liquidity_drain","magnitude": 0.40, "duration_steps": 15},
{"type": "price_drop", "magnitude": 0.50, "duration_steps": 20},
],
"expected_outcomes": [
"50% oracle price decline on regulatory exit shock",
"Mining token holders liquidate en masse",
"Liquidity drains as Chinese participants are forced to exit"
]
},
"terra_luna_collapse_2022": {
"id": "terra_luna_collapse_2022",
"label": "π Terra Luna Collapse (2022)",
"title": "Terra/LUNA Death Spiral β Algorithmic Stablecoin Collapse",
"description": (
"Replicate the May 2022 Terra ecosystem collapse where UST lost its $1 peg "
"and LUNA fell from ~$80 to near $0 within days. An attacker dumps UST, "
"triggering the algorithmic mint-burn death spiral. As UST depegs further, "
"the LUNA supply hyperinflates to absorb sell pressure, accelerating the "
"collapse. Panic selling and mass liquidations drain all liquidity."
),
"actor": "whale",
"tags": ["stablecoin-collapse", "death-spiral", "terra", "luna", "depeg", "algorithmic"],
"risk_focus": ["stablecoin", "liquidity", "oracle", "solvency"],
"steps": 80,
"actions": [
{"type": "swap", "token": "USDC", "amount": 500000000, "speed": "instant", "target": "pool"},
{"type": "withdraw", "token": "TOKEN", "amount": 50000000, "speed": "rapid", "target": "vault"},
{"type": "liquidate", "token": "TOKEN", "amount": 10000000, "speed": "instant", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 200000000, "speed": "rapid", "target": "pool"},
],
"market_events": [
{"type": "depeg", "magnitude": 0.20, "duration_steps": 10},
{"type": "price_drop", "magnitude": 0.60, "duration_steps": 15},
{"type": "liquidity_drain","magnitude": 0.80, "duration_steps": 20},
{"type": "depeg", "magnitude": 0.99, "duration_steps": 10},
{"type": "price_drop", "magnitude": 0.99, "duration_steps": 15},
],
"expected_outcomes": [
"UST depegs from $1 triggering algorithmic mint spiral",
"LUNA oracle price collapses 99% in days",
"Protocol liquidity fully drained as panic accelerates"
]
},
"ftx_collapse_2022": {
"id": "ftx_collapse_2022",
"label": "π¦ FTX Collapse (2022)",
"title": "FTX Exchange Bankruptcy β Market-Wide Contagion",
"description": (
"Simulate the November 2022 FTX collapse, where revelations of insolvency "
"and fraud caused FTT to fall from ~$25 to near $0 and BTC dropped ~25% "
"within days. Mass customer withdrawals exhausted liquidity. The contagion "
"spread to counterparties forcing emergency liquidations. Simulates a "
"confidence crisis-driven bank run on the protocol."
),
"actor": "whale",
"tags": ["exchange-bankruptcy", "ftx", "insolvency", "contagion", "fraud"],
"risk_focus": ["solvency", "liquidity", "oracle"],
"steps": 60,
"actions": [
{"type": "withdraw", "token": "TOKEN", "amount": 1000000, "speed": "rapid", "target": "vault"},
{"type": "liquidate", "token": "TOKEN", "amount": 500000, "speed": "instant", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 300000, "speed": "rapid", "target": "pool"},
{"type": "withdraw", "token": "TOKEN", "amount": 700000, "speed": "instant", "target": "vault"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.25, "duration_steps": 10},
{"type": "liquidity_drain","magnitude": 0.60, "duration_steps": 20},
{"type": "price_drop", "magnitude": 0.50, "duration_steps": 15},
],
"expected_outcomes": [
"FTT price collapses 99% on insolvency disclosure",
"BTC and wider market falls 25% on contagion fears",
"Mass bank-run withdrawals expose protocol insolvency"
]
},
"celsius_bankruptcy_2022": {
"id": "celsius_bankruptcy_2022",
"label": "π§ Celsius Bankruptcy (2022)",
"title": "Celsius Network Bankruptcy β Lending Platform Failure",
"description": (
"Model the June 2022 Celsius Network bankruptcy after it froze customer "
"withdrawals. Celsius had deployed user deposits into illiquid DeFi positions "
"and suffered heavy losses. $CEL token collapsed. Simulate the withdrawal "
"freeze, leveraged position unwind, and forced liquidation cascade that "
"exposed the platform's structural insolvency."
),
"actor": "whale",
"tags": ["lending-failure", "celsius", "bankruptcy", "liquidity-crisis", "leverage"],
"risk_focus": ["lending", "solvency", "liquidity"],
"steps": 60,
"actions": [
{"type": "withdraw", "token": "TOKEN", "amount": 2000000, "speed": "rapid", "target": "vault"},
{"type": "borrow", "token": "TOKEN", "amount": 1000000, "speed": "instant", "target": "vault"},
{"type": "liquidate", "token": "TOKEN", "amount": 500000, "speed": "rapid", "target": "vault"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.50, "duration_steps": 10},
{"type": "liquidity_drain","magnitude": 0.80, "duration_steps": 20},
{"type": "price_drop", "magnitude": 0.70, "duration_steps": 15},
],
"expected_outcomes": [
"CEL token collapses on withdrawal freeze announcement",
"Over-leveraged lending positions cascade into liquidation",
"80% liquidity drain exposes deep protocol insolvency"
]
},
"svb_collapse_2023": {
"id": "svb_collapse_2023",
"label": "ποΈ SVB Collapse β USDC Depeg (2023)",
"title": "Silicon Valley Bank Collapse β USDC Reserve Contagion",
"description": (
"Model the March 2023 SVB bank run and its downstream effect on USDC, "
"which temporarily depegged to ~$0.88 after Circle disclosed $3.3B of USDC "
"reserves were held at SVB. Institutional actors rushed to exit USDC "
"positions, overwhelming liquidity. Simulate the reserve-exposure panic, "
"mass USDC redemptions, and stablecoin depeg event."
),
"actor": "whale",
"tags": ["banking-contagion", "usdc", "depeg", "svb", "stablecoin"],
"risk_focus": ["stablecoin", "liquidity", "oracle"],
"steps": 40,
"actions": [
{"type": "withdraw", "token": "USDC", "amount": 3300000000, "speed": "instant", "target": "vault"},
{"type": "swap", "token": "USDC", "amount": 1000000000, "speed": "rapid", "target": "pool"},
],
"market_events": [
{"type": "depeg", "magnitude": 0.12, "duration_steps": 5},
{"type": "liquidity_drain","magnitude": 0.35, "duration_steps": 10},
{"type": "depeg", "magnitude": 0.06, "duration_steps": 5},
],
"expected_outcomes": [
"USDC depegs to $0.88 on reserve contagion disclosure",
"Mass institutional USDC redemptions drain protocol reserves",
"Peg partially restores after SVB backstop is confirmed"
]
},
"covid_crash_2020": {
"id": "covid_crash_2020",
"label": "π¦ COVID Market Crash (2020)",
"title": "COVID-19 Black Thursday β 50% BTC Crash in 48 Hours",
"description": (
"Replicate Black Thursday (March 12β13, 2020) when Bitcoin fell ~50% in "
"48 hours as global markets panic-sold all risk assets following COVID-19 "
"lockdown announcements. MakerDAO CDP liquidations overwhelmed the system, "
"ETH was auctioned for $0. Simulate the sudden global liquidity shock, "
"mass deleveraging, and cascading liquidation cascade."
),
"actor": "whale",
"tags": ["global-shock", "covid", "black-thursday", "liquidation", "bitcoin"],
"risk_focus": ["liquidity", "volatility", "solvency"],
"steps": 40,
"actions": [
{"type": "withdraw", "token": "TOKEN", "amount": 500000, "speed": "instant", "target": "vault"},
{"type": "liquidate", "token": "TOKEN", "amount": 200000, "speed": "rapid", "target": "vault"},
{"type": "swap", "token": "TOKEN", "amount": 300000, "speed": "instant", "target": "pool"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.30, "duration_steps": 5},
{"type": "price_drop", "magnitude": 0.50, "duration_steps": 5},
{"type": "liquidity_drain","magnitude": 0.60, "duration_steps": 10},
],
"expected_outcomes": [
"BTC falls 50% in under 48 hours on risk-off panic",
"Cascading liquidations overwhelm vault solvency mechanisms",
"60% liquidity drain in the critical 48-hour window"
]
},
"ronin_bridge_hack_2022": {
"id": "ronin_bridge_hack_2022",
"label": "π Ronin Bridge Hack (2022)",
"title": "Ronin Bridge Exploit β $600M Cross-Chain Theft",
"description": (
"Simulate the March 2022 Ronin Bridge exploit where the Lazarus Group "
"drained ~$600M (173,600 ETH + 25.5M USDC) by compromising 5 of 9 "
"validator private keys. AXS dropped sharply on the news. An attacker "
"exploits trusted bridge validator consensus to authorize fraudulent "
"withdrawals, draining the protocol entirely before detection."
),
"actor": "whale",
"tags": ["bridge-exploit", "ronin", "axs", "hack", "cross-chain"],
"risk_focus": ["flash_loan", "bridge", "liquidity", "solvency"],
"steps": 40,
"actions": [
{"type": "flash_loan", "token": "ETH", "amount": 173600, "speed": "instant", "target": "vault"},
{"type": "drain", "token": "TOKEN", "amount": 600000000, "speed": "instant", "target": "pool"},
{"type": "withdraw", "token": "USDC", "amount": 25500000, "speed": "instant", "target": "vault"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.40, "duration_steps": 5},
{"type": "liquidity_drain","magnitude": 0.80, "duration_steps": 10},
{"type": "price_drop", "magnitude": 0.60, "duration_steps": 10},
],
"expected_outcomes": [
"Bridge drained of $600M via compromised validator keys",
"AXS token price drops 40β60% on exploit announcement",
"Cross-chain liquidity permanently removed from protocol"
]
},
"poly_network_hack_2021": {
"id": "poly_network_hack_2021",
"label": "π·οΈ Poly Network Hack (2021)",
"title": "Poly Network Exploit β $600M Cross-Protocol Drain (Returned)",
"description": (
"Model the August 2021 Poly Network exploit where an attacker exploited "
"a smart contract vulnerability in cross-chain message verification to steal "
"~$600M across ETH, BSC, and Polygon. Uniquely, the attacker returned all "
"funds after negotiation. Simulate the initial exploit-and-drain attack, "
"the resulting price panic, and the eventual protocol recovery path."
),
"actor": "whale",
"tags": ["defi-exploit", "poly-network", "cross-chain", "flash-loan", "hack"],
"risk_focus": ["flash_loan", "oracle", "solvency"],
"steps": 40,
"actions": [
{"type": "flash_loan", "token": "ETH", "amount": 600000000, "speed": "instant", "target": "vault"},
{"type": "drain", "token": "TOKEN", "amount": 600000000, "speed": "instant", "target": "pool"},
{"type": "oracle_update", "token": "TOKEN", "amount": 0.01, "speed": "instant", "target": "vault"},
],
"market_events": [
{"type": "price_drop", "magnitude": 0.40, "duration_steps": 5},
{"type": "oracle_lag", "magnitude": 0.1, "duration_steps": 5},
{"type": "price_spike", "magnitude": 1.1, "duration_steps": 10},
],
"expected_outcomes": [
"All cross-chain pools drained in a single transaction bundle",
"Token prices drop 40% then partially recover on fund return",
"Oracle manipulation locks protocol state during attack window"
]
},
"mango_markets_exploit_2022": {
"id": "mango_markets_exploit_2022",
"label": "π₯ Mango Markets Exploit (2022)",
"title": "Mango Markets Oracle Manipulation β Governance Drain",
"description": (
"Replicate the October 2022 Mango Markets exploit where Avraham Eisenberg "
"used $10M USDC to manipulate the MNGO token price 10x via wash trades, "
"then used the inflated collateral value to borrow and drain $114M from "
"the DAO treasury. He then passed a governance vote to have all charges "
"dropped in exchange for partial fund return. Simulate price oracle "
"manipulation, collateral fraud, and governance capture."
),
"actor": "whale",
"tags": ["oracle-manipulation", "governance", "mango", "exploit", "collateral-fraud"],
"risk_focus": ["oracle", "governance", "flash_loan", "lending"],
"steps": 50,
"actions": [
{"type": "swap", "token": "TOKEN", "amount": 10000000, "speed": "instant", "target": "pool"},
{"type": "manipulate_price","token": "TOKEN", "amount": 10000000, "speed": "rapid", "target": "pool"},
{"type": "borrow", "token": "TOKEN", "amount": 114000000, "speed": "instant", "target": "vault"},
{"type": "drain", "token": "USDC", "amount": 114000000, "speed": "instant", "target": "pool"},
{"type": "governance_vote", "token": "TOKEN", "amount": 1, "speed": "rapid", "target": "vault"},
],
"market_events": [
{"type": "price_spike", "magnitude": 10.0, "duration_steps": 5},
{"type": "oracle_lag", "magnitude": 0.2, "duration_steps": 3},
{"type": "price_drop", "magnitude": 0.80, "duration_steps": 10},
{"type": "liquidity_drain","magnitude": 0.90, "duration_steps": 5},
],
"expected_outcomes": [
"MNGO oracle price pumped 10x via wash trades in minutes",
"Inflated collateral allows $114M treasury drain via borrow",
"Governance vote passes to legally protect attacker"
]
},
}
def list_scenarios() -> List[Dict[str, Any]]:
"""Return lightweight list for UI dropdown."""
return [
{
"id": s["id"],
"label": s["label"],
"description": s["description"],
"tags": s["tags"],
"expected_outcomes": s["expected_outcomes"],
}
for s in SCENARIOS.values()
]
def get_scenario(scenario_id: str) -> Dict[str, Any]:
if scenario_id not in SCENARIOS:
raise ValueError(f"Unknown scenario: {scenario_id}")
return SCENARIOS[scenario_id]