foundry_cheatcodes_spec/
vm.rs

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
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
// We don't document function parameters individually so we can't enable `missing_docs` for this
// module. Instead, we emit custom diagnostics in `#[derive(Cheatcode)]`.
#![allow(missing_docs)]

use super::*;
use crate::Vm::ForgeContext;
use alloy_sol_types::sol;
use foundry_macros::Cheatcode;
use std::fmt;

sol! {
// Cheatcodes are marked as view/pure/none using the following rules:
// 0. A call's observable behaviour includes its return value, logs, reverts and state writes,
// 1. If you can influence a later call's observable behaviour, you're neither `view` nor `pure`
//    (you are modifying some state be it the EVM, interpreter, filesystem, etc),
// 2. Otherwise if you can be influenced by an earlier call, or if reading some state, you're `view`,
// 3. Otherwise you're `pure`.

/// Foundry cheatcodes interface.
#[derive(Debug, Cheatcode)] // Keep this list small to avoid unnecessary bloat.
#[sol(abi)]
interface Vm {
    //  ======== Types ========

    /// Error thrown by cheatcodes.
    error CheatcodeError(string message);

    /// A modification applied to either `msg.sender` or `tx.origin`. Returned by `readCallers`.
    enum CallerMode {
        /// No caller modification is currently active.
        None,
        /// A one time broadcast triggered by a `vm.broadcast()` call is currently active.
        Broadcast,
        /// A recurrent broadcast triggered by a `vm.startBroadcast()` call is currently active.
        RecurrentBroadcast,
        /// A one time prank triggered by a `vm.prank()` call is currently active.
        Prank,
        /// A recurrent prank triggered by a `vm.startPrank()` call is currently active.
        RecurrentPrank,
    }

    /// The kind of account access that occurred.
    enum AccountAccessKind {
        /// The account was called.
        Call,
        /// The account was called via delegatecall.
        DelegateCall,
        /// The account was called via callcode.
        CallCode,
        /// The account was called via staticcall.
        StaticCall,
        /// The account was created.
        Create,
        /// The account was selfdestructed.
        SelfDestruct,
        /// Synthetic access indicating the current context has resumed after a previous sub-context (AccountAccess).
        Resume,
        /// The account's balance was read.
        Balance,
        /// The account's codesize was read.
        Extcodesize,
        /// The account's codehash was read.
        Extcodehash,
        /// The account's code was copied.
        Extcodecopy,
    }

    /// Forge execution contexts.
    enum ForgeContext {
        /// Test group execution context (test, coverage or snapshot).
        TestGroup,
        /// `forge test` execution context.
        Test,
        /// `forge coverage` execution context.
        Coverage,
        /// `forge snapshot` execution context.
        Snapshot,
        /// Script group execution context (dry run, broadcast or resume).
        ScriptGroup,
        /// `forge script` execution context.
        ScriptDryRun,
        /// `forge script --broadcast` execution context.
        ScriptBroadcast,
        /// `forge script --resume` execution context.
        ScriptResume,
        /// Unknown `forge` execution context.
        Unknown,
    }

    /// An Ethereum log. Returned by `getRecordedLogs`.
    struct Log {
        /// The topics of the log, including the signature, if any.
        bytes32[] topics;
        /// The raw data of the log.
        bytes data;
        /// The address of the log's emitter.
        address emitter;
    }

    /// Gas used. Returned by `lastCallGas`.
    struct Gas {
        /// The gas limit of the call.
        uint64 gasLimit;
        /// The total gas used.
        uint64 gasTotalUsed;
        /// DEPRECATED: The amount of gas used for memory expansion. Ref: <https://github.com/foundry-rs/foundry/pull/7934#pullrequestreview-2069236939>
        uint64 gasMemoryUsed;
        /// The amount of gas refunded.
        int64 gasRefunded;
        /// The amount of gas remaining.
        uint64 gasRemaining;
    }

    /// An RPC URL and its alias. Returned by `rpcUrlStructs`.
    struct Rpc {
        /// The alias of the RPC URL.
        string key;
        /// The RPC URL.
        string url;
    }

    /// An RPC log object. Returned by `eth_getLogs`.
    struct EthGetLogs {
        /// The address of the log's emitter.
        address emitter;
        /// The topics of the log, including the signature, if any.
        bytes32[] topics;
        /// The raw data of the log.
        bytes data;
        /// The block hash.
        bytes32 blockHash;
        /// The block number.
        uint64 blockNumber;
        /// The transaction hash.
        bytes32 transactionHash;
        /// The transaction index in the block.
        uint64 transactionIndex;
        /// The log index.
        uint256 logIndex;
        /// Whether the log was removed.
        bool removed;
    }

    /// A single entry in a directory listing. Returned by `readDir`.
    struct DirEntry {
        /// The error message, if any.
        string errorMessage;
        /// The path of the entry.
        string path;
        /// The depth of the entry.
        uint64 depth;
        /// Whether the entry is a directory.
        bool isDir;
        /// Whether the entry is a symlink.
        bool isSymlink;
    }

    /// Metadata information about a file.
    ///
    /// This structure is returned from the `fsMetadata` function and represents known
    /// metadata about a file such as its permissions, size, modification
    /// times, etc.
    struct FsMetadata {
        /// True if this metadata is for a directory.
        bool isDir;
        /// True if this metadata is for a symlink.
        bool isSymlink;
        /// The size of the file, in bytes, this metadata is for.
        uint256 length;
        /// True if this metadata is for a readonly (unwritable) file.
        bool readOnly;
        /// The last modification time listed in this metadata.
        uint256 modified;
        /// The last access time of this metadata.
        uint256 accessed;
        /// The creation time listed in this metadata.
        uint256 created;
    }

    /// A wallet with a public and private key.
    struct Wallet {
        /// The wallet's address.
        address addr;
        /// The wallet's public key `X`.
        uint256 publicKeyX;
        /// The wallet's public key `Y`.
        uint256 publicKeyY;
        /// The wallet's private key.
        uint256 privateKey;
    }

    /// The result of a `tryFfi` call.
    struct FfiResult {
        /// The exit code of the call.
        int32 exitCode;
        /// The optionally hex-decoded `stdout` data.
        bytes stdout;
        /// The `stderr` data.
        bytes stderr;
    }

    /// Information on the chain and fork.
    struct ChainInfo {
        /// The fork identifier. Set to zero if no fork is active.
        uint256 forkId;
        /// The chain ID of the current fork.
        uint256 chainId;
    }

    /// The storage accessed during an `AccountAccess`.
    struct StorageAccess {
        /// The account whose storage was accessed.
        address account;
        /// The slot that was accessed.
        bytes32 slot;
        /// If the access was a write.
        bool isWrite;
        /// The previous value of the slot.
        bytes32 previousValue;
        /// The new value of the slot.
        bytes32 newValue;
        /// If the access was reverted.
        bool reverted;
    }

    /// The result of a `stopAndReturnStateDiff` call.
    struct AccountAccess {
        /// The chain and fork the access occurred.
        ChainInfo chainInfo;
        /// The kind of account access that determines what the account is.
        /// If kind is Call, DelegateCall, StaticCall or CallCode, then the account is the callee.
        /// If kind is Create, then the account is the newly created account.
        /// If kind is SelfDestruct, then the account is the selfdestruct recipient.
        /// If kind is a Resume, then account represents a account context that has resumed.
        AccountAccessKind kind;
        /// The account that was accessed.
        /// It's either the account created, callee or a selfdestruct recipient for CREATE, CALL or SELFDESTRUCT.
        address account;
        /// What accessed the account.
        address accessor;
        /// If the account was initialized or empty prior to the access.
        /// An account is considered initialized if it has code, a
        /// non-zero nonce, or a non-zero balance.
        bool initialized;
        /// The previous balance of the accessed account.
        uint256 oldBalance;
        /// The potential new balance of the accessed account.
        /// That is, all balance changes are recorded here, even if reverts occurred.
        uint256 newBalance;
        /// Code of the account deployed by CREATE.
        bytes deployedCode;
        /// Value passed along with the account access
        uint256 value;
        /// Input data provided to the CREATE or CALL
        bytes data;
        /// If this access reverted in either the current or parent context.
        bool reverted;
        /// An ordered list of storage accesses made during an account access operation.
        StorageAccess[] storageAccesses;
        /// Call depth traversed during the recording of state differences
        uint64 depth;
    }

    /// The result of the `stopDebugTraceRecording` call
    struct DebugStep {
        /// The stack before executing the step of the run.
        /// stack\[0\] represents the top of the stack.
        /// and only stack data relevant to the opcode execution is contained.
        uint256[] stack;
        /// The memory input data before executing the step of the run.
        /// only input data relevant to the opcode execution is contained.
        ///
        /// e.g. for MLOAD, it will have memory\[offset:offset+32\] copied here.
        /// the offset value can be get by the stack data.
        bytes memoryInput;
        /// The opcode that was accessed.
        uint8 opcode;
        /// The call depth of the step.
        uint64 depth;
        /// Whether the call end up with out of gas error.
        bool isOutOfGas;
        /// The contract address where the opcode is running
        address contractAddr;
    }

    /// The transaction type (`txType`) of the broadcast.
    enum BroadcastTxType {
        /// Represents a CALL broadcast tx.
        Call,
        /// Represents a CREATE broadcast tx.
        Create,
        /// Represents a CREATE2 broadcast tx.
        Create2
    }

    /// Represents a transaction's broadcast details.
    struct BroadcastTxSummary {
        /// The hash of the transaction that was broadcasted
        bytes32 txHash;
        /// Represent the type of transaction among CALL, CREATE, CREATE2
        BroadcastTxType txType;
        /// The address of the contract that was called or created.
        /// This is address of the contract that is created if the txType is CREATE or CREATE2.
        address contractAddress;
        /// The block number the transaction landed in.
        uint64 blockNumber;
        /// Status of the transaction, retrieved from the transaction receipt.
        bool success;
    }

    /// Holds a signed EIP-7702 authorization for an authority account to delegate to an implementation.
    struct SignedDelegation {
        /// The y-parity of the recovered secp256k1 signature (0 or 1).
        uint8 v;
        /// First 32 bytes of the signature.
        bytes32 r;
        /// Second 32 bytes of the signature.
        bytes32 s;
        /// The current nonce of the authority account at signing time.
        /// Used to ensure signature can't be replayed after account nonce changes.
        uint64 nonce;
        /// Address of the contract implementation that will be delegated to.
        /// Gets encoded into delegation code: 0xef0100 || implementation.
        address implementation;
    }

    // ======== EVM ========

    /// Gets the address for a given private key.
    #[cheatcode(group = Evm, safety = Safe)]
    function addr(uint256 privateKey) external pure returns (address keyAddr);

    /// Dump a genesis JSON file's `allocs` to disk.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function dumpState(string calldata pathToStateJson) external;

    /// Gets the nonce of an account.
    #[cheatcode(group = Evm, safety = Safe)]
    function getNonce(address account) external view returns (uint64 nonce);

    /// Get the nonce of a `Wallet`.
    #[cheatcode(group = Evm, safety = Safe)]
    function getNonce(Wallet calldata wallet) external returns (uint64 nonce);

    /// Loads a storage slot from an address.
    #[cheatcode(group = Evm, safety = Safe)]
    function load(address target, bytes32 slot) external view returns (bytes32 data);

    /// Load a genesis JSON file's `allocs` into the in-memory EVM state.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function loadAllocs(string calldata pathToAllocsJson) external;

    // -------- Record Debug Traces --------

    /// Records the debug trace during the run.
    #[cheatcode(group = Evm, safety = Safe)]
    function startDebugTraceRecording() external;

    /// Stop debug trace recording and returns the recorded debug trace.
    #[cheatcode(group = Evm, safety = Safe)]
    function stopAndReturnDebugTraceRecording() external returns (DebugStep[] memory step);


    /// Clones a source account code, state, balance and nonce to a target account and updates in-memory EVM state.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function cloneAccount(address source, address target) external;

    // -------- Record Storage --------

    /// Records all storage reads and writes.
    #[cheatcode(group = Evm, safety = Safe)]
    function record() external;

    /// Gets all accessed reads and write slot from a `vm.record` session, for a given address.
    #[cheatcode(group = Evm, safety = Safe)]
    function accesses(address target) external returns (bytes32[] memory readSlots, bytes32[] memory writeSlots);

    /// Record all account accesses as part of CREATE, CALL or SELFDESTRUCT opcodes in order,
    /// along with the context of the calls
    #[cheatcode(group = Evm, safety = Safe)]
    function startStateDiffRecording() external;

    /// Returns an ordered array of all account accesses from a `vm.startStateDiffRecording` session.
    #[cheatcode(group = Evm, safety = Safe)]
    function stopAndReturnStateDiff() external returns (AccountAccess[] memory accountAccesses);

    // -------- Recording Map Writes --------

    /// Starts recording all map SSTOREs for later retrieval.
    #[cheatcode(group = Evm, safety = Safe)]
    function startMappingRecording() external;

    /// Stops recording all map SSTOREs for later retrieval and clears the recorded data.
    #[cheatcode(group = Evm, safety = Safe)]
    function stopMappingRecording() external;

    /// Gets the number of elements in the mapping at the given slot, for a given address.
    #[cheatcode(group = Evm, safety = Safe)]
    function getMappingLength(address target, bytes32 mappingSlot) external returns (uint256 length);

    /// Gets the elements at index idx of the mapping at the given slot, for a given address. The
    /// index must be less than the length of the mapping (i.e. the number of keys in the mapping).
    #[cheatcode(group = Evm, safety = Safe)]
    function getMappingSlotAt(address target, bytes32 mappingSlot, uint256 idx) external returns (bytes32 value);

    /// Gets the map key and parent of a mapping at a given slot, for a given address.
    #[cheatcode(group = Evm, safety = Safe)]
    function getMappingKeyAndParentOf(address target, bytes32 elementSlot)
        external
        returns (bool found, bytes32 key, bytes32 parent);

    // -------- Block and Transaction Properties --------

    /// Sets `block.chainid`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function chainId(uint256 newChainId) external;

    /// Sets `block.coinbase`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function coinbase(address newCoinbase) external;

    /// Sets `block.difficulty`.
    /// Not available on EVM versions from Paris onwards. Use `prevrandao` instead.
    /// Reverts if used on unsupported EVM versions.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function difficulty(uint256 newDifficulty) external;

    /// Sets `block.basefee`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function fee(uint256 newBasefee) external;

    /// Sets `block.prevrandao`.
    /// Not available on EVM versions before Paris. Use `difficulty` instead.
    /// If used on unsupported EVM versions it will revert.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function prevrandao(bytes32 newPrevrandao) external;
    /// Sets `block.prevrandao`.
    /// Not available on EVM versions before Paris. Use `difficulty` instead.
    /// If used on unsupported EVM versions it will revert.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function prevrandao(uint256 newPrevrandao) external;

    /// Sets the blobhashes in the transaction.
    /// Not available on EVM versions before Cancun.
    /// If used on unsupported EVM versions it will revert.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function blobhashes(bytes32[] calldata hashes) external;

    /// Gets the blockhashes from the current transaction.
    /// Not available on EVM versions before Cancun.
    /// If used on unsupported EVM versions it will revert.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function getBlobhashes() external view returns (bytes32[] memory hashes);

    /// Sets `block.height`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function roll(uint256 newHeight) external;

    /// Gets the current `block.number`.
    /// You should use this instead of `block.number` if you use `vm.roll`, as `block.number` is assumed to be constant across a transaction,
    /// and as a result will get optimized out by the compiler.
    /// See https://github.com/foundry-rs/foundry/issues/6180
    #[cheatcode(group = Evm, safety = Safe)]
    function getBlockNumber() external view returns (uint256 height);

    /// Sets `tx.gasprice`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function txGasPrice(uint256 newGasPrice) external;

    /// Sets `block.timestamp`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function warp(uint256 newTimestamp) external;

    /// Gets the current `block.timestamp`.
    /// You should use this instead of `block.timestamp` if you use `vm.warp`, as `block.timestamp` is assumed to be constant across a transaction,
    /// and as a result will get optimized out by the compiler.
    /// See https://github.com/foundry-rs/foundry/issues/6180
    #[cheatcode(group = Evm, safety = Safe)]
    function getBlockTimestamp() external view returns (uint256 timestamp);

    /// Sets `block.blobbasefee`
    #[cheatcode(group = Evm, safety = Unsafe)]
    function blobBaseFee(uint256 newBlobBaseFee) external;

    /// Gets the current `block.blobbasefee`.
    /// You should use this instead of `block.blobbasefee` if you use `vm.blobBaseFee`, as `block.blobbasefee` is assumed to be constant across a transaction,
    /// and as a result will get optimized out by the compiler.
    /// See https://github.com/foundry-rs/foundry/issues/6180
    #[cheatcode(group = Evm, safety = Safe)]
    function getBlobBaseFee() external view returns (uint256 blobBaseFee);

    /// Set blockhash for the current block.
    /// It only sets the blockhash for blocks where `block.number - 256 <= number < block.number`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function setBlockhash(uint256 blockNumber, bytes32 blockHash) external;

    // -------- Account State --------

    /// Sets an address' balance.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function deal(address account, uint256 newBalance) external;

    /// Sets an address' code.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function etch(address target, bytes calldata newRuntimeBytecode) external;

    /// Resets the nonce of an account to 0 for EOAs and 1 for contract accounts.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function resetNonce(address account) external;

    /// Sets the nonce of an account. Must be higher than the current nonce of the account.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function setNonce(address account, uint64 newNonce) external;

    /// Sets the nonce of an account to an arbitrary value.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function setNonceUnsafe(address account, uint64 newNonce) external;

    /// Stores a value to an address' storage slot.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function store(address target, bytes32 slot, bytes32 value) external;

    /// Marks the slots of an account and the account address as cold.
    #[cheatcode(group = Evm, safety = Unsafe, status = Experimental)]
    function cool(address target) external;

    // -------- Call Manipulation --------
    // --- Mocks ---

    /// Clears all mocked calls.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function clearMockedCalls() external;

    /// Mocks a call to an address, returning specified data.
    /// Calldata can either be strict or a partial match, e.g. if you only
    /// pass a Solidity selector to the expected calldata, then the entire Solidity
    /// function will be mocked.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCall(address callee, bytes calldata data, bytes calldata returnData) external;

    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCall(address callee, uint256 msgValue, bytes calldata data, bytes calldata returnData) external;

    /// Mocks a call to an address, returning specified data.
    /// Calldata can either be strict or a partial match, e.g. if you only
    /// pass a Solidity selector to the expected calldata, then the entire Solidity
    /// function will be mocked.
    ///
    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCall(address callee, bytes4 data, bytes calldata returnData) external;

    /// Mocks a call to an address with a specific `msg.value`, returning specified data.
    /// Calldata match takes precedence over `msg.value` in case of ambiguity.
    ///
    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCall(address callee, uint256 msgValue, bytes4 data, bytes calldata returnData) external;

    /// Mocks multiple calls to an address, returning specified data for each call.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCalls(address callee, bytes calldata data, bytes[] calldata returnData) external;

    /// Mocks multiple calls to an address with a specific `msg.value`, returning specified data for each call.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCalls(address callee, uint256 msgValue, bytes calldata data, bytes[] calldata returnData) external;

    /// Reverts a call to an address with specified revert data.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCallRevert(address callee, bytes calldata data, bytes calldata revertData) external;

    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCallRevert(address callee, uint256 msgValue, bytes calldata data, bytes calldata revertData)
        external;

    /// Reverts a call to an address with specified revert data.
    ///
    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCallRevert(address callee, bytes4 data, bytes calldata revertData) external;

    /// Reverts a call to an address with a specific `msg.value`, with specified revert data.
    ///
    /// Overload to pass the function selector directly `token.approve.selector` instead of `abi.encodeWithSelector(token.approve.selector)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockCallRevert(address callee, uint256 msgValue, bytes4 data, bytes calldata revertData)
        external;

    /// Whenever a call is made to `callee` with calldata `data`, this cheatcode instead calls
    /// `target` with the same calldata. This functionality is similar to a delegate call made to
    /// `target` contract from `callee`.
    /// Can be used to substitute a call to a function with another implementation that captures
    /// the primary logic of the original function but is easier to reason about.
    /// If calldata is not a strict match then partial match by selector is attempted.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function mockFunction(address callee, address target, bytes calldata data) external;

    // --- Impersonation (pranks) ---

    /// Sets the *next* call's `msg.sender` to be the input address.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function prank(address msgSender) external;

    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function startPrank(address msgSender) external;

    /// Sets the *next* call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function prank(address msgSender, address txOrigin) external;

    /// Sets all subsequent calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function startPrank(address msgSender, address txOrigin) external;

    /// Sets the *next* delegate call's `msg.sender` to be the input address.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function prank(address msgSender, bool delegateCall) external;

    /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function startPrank(address msgSender, bool delegateCall) external;

    /// Sets the *next* delegate call's `msg.sender` to be the input address, and the `tx.origin` to be the second input.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function prank(address msgSender, address txOrigin, bool delegateCall) external;

    /// Sets all subsequent delegate calls' `msg.sender` to be the input address until `stopPrank` is called, and the `tx.origin` to be the second input.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function startPrank(address msgSender, address txOrigin, bool delegateCall) external;

    /// Resets subsequent calls' `msg.sender` to be `address(this)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function stopPrank() external;

    /// Reads the current `msg.sender` and `tx.origin` from state and reports if there is any active caller modification.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function readCallers() external returns (CallerMode callerMode, address msgSender, address txOrigin);

    // ----- Arbitrary Snapshots -----

    /// Snapshot capture an arbitrary numerical value by name.
    /// The group name is derived from the contract name.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function snapshotValue(string calldata name, uint256 value) external;

    /// Snapshot capture an arbitrary numerical value by name in a group.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function snapshotValue(string calldata group, string calldata name, uint256 value) external;

    // -------- Gas Snapshots --------

    /// Snapshot capture the gas usage of the last call by name from the callee perspective.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed);

    /// Snapshot capture the gas usage of the last call by name in a group from the callee perspective.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed);

    /// Start a snapshot capture of the current gas usage by name.
    /// The group name is derived from the contract name.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function startSnapshotGas(string calldata name) external;

    /// Start a snapshot capture of the current gas usage by name in a group.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function startSnapshotGas(string calldata group, string calldata name) external;

    /// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function stopSnapshotGas() external returns (uint256 gasUsed);

    /// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start.
    /// The group name is derived from the contract name.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed);

    /// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed);

    // -------- State Snapshots --------

    /// `snapshot` is being deprecated in favor of `snapshotState`. It will be removed in future versions.
    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `snapshotState`")))]
    function snapshot() external returns (uint256 snapshotId);

    /// Snapshot the current state of the evm.
    /// Returns the ID of the snapshot that was created.
    /// To revert a snapshot use `revertToState`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function snapshotState() external returns (uint256 snapshotId);

    /// `revertTo` is being deprecated in favor of `revertToState`. It will be removed in future versions.
    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToState`")))]
    function revertTo(uint256 snapshotId) external returns (bool success);

    /// Revert the state of the EVM to a previous snapshot
    /// Takes the snapshot ID to revert to.
    ///
    /// Returns `true` if the snapshot was successfully reverted.
    /// Returns `false` if the snapshot does not exist.
    ///
    /// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function revertToState(uint256 snapshotId) external returns (bool success);

    /// `revertToAndDelete` is being deprecated in favor of `revertToStateAndDelete`. It will be removed in future versions.
    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `revertToStateAndDelete`")))]
    function revertToAndDelete(uint256 snapshotId) external returns (bool success);

    /// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots
    /// Takes the snapshot ID to revert to.
    ///
    /// Returns `true` if the snapshot was successfully reverted and deleted.
    /// Returns `false` if the snapshot does not exist.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function revertToStateAndDelete(uint256 snapshotId) external returns (bool success);

    /// `deleteSnapshot` is being deprecated in favor of `deleteStateSnapshot`. It will be removed in future versions.
    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshot`")))]
    function deleteSnapshot(uint256 snapshotId) external returns (bool success);

    /// Removes the snapshot with the given ID created by `snapshot`.
    /// Takes the snapshot ID to delete.
    ///
    /// Returns `true` if the snapshot was successfully deleted.
    /// Returns `false` if the snapshot does not exist.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function deleteStateSnapshot(uint256 snapshotId) external returns (bool success);

    /// `deleteSnapshots` is being deprecated in favor of `deleteStateSnapshots`. It will be removed in future versions.
    #[cheatcode(group = Evm, safety = Unsafe, status = Deprecated(Some("replaced by `deleteStateSnapshots`")))]
    function deleteSnapshots() external;

    /// Removes _all_ snapshots previously created by `snapshot`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function deleteStateSnapshots() external;

    // -------- Forking --------
    // --- Creation and Selection ---

    /// Returns the identifier of the currently active fork. Reverts if no fork is currently active.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function activeFork() external view returns (uint256 forkId);

    /// Creates a new fork with the given endpoint and the _latest_ block and returns the identifier of the fork.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function createFork(string calldata urlOrAlias) external returns (uint256 forkId);
    /// Creates a new fork with the given endpoint and block and returns the identifier of the fork.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function createFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
    /// Creates a new fork with the given endpoint and at the block the given transaction was mined in,
    /// replays all transaction mined in the block before the transaction, and returns the identifier of the fork.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function createFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);

    /// Creates and also selects a new fork with the given endpoint and the latest block and returns the identifier of the fork.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function createSelectFork(string calldata urlOrAlias) external returns (uint256 forkId);
    /// Creates and also selects a new fork with the given endpoint and block and returns the identifier of the fork.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function createSelectFork(string calldata urlOrAlias, uint256 blockNumber) external returns (uint256 forkId);
    /// Creates and also selects new fork with the given endpoint and at the block the given transaction was mined in,
    /// replays all transaction mined in the block before the transaction, returns the identifier of the fork.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function createSelectFork(string calldata urlOrAlias, bytes32 txHash) external returns (uint256 forkId);

    /// Updates the currently active fork to given block number
    /// This is similar to `roll` but for the currently active fork.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function rollFork(uint256 blockNumber) external;
    /// Updates the currently active fork to given transaction. This will `rollFork` with the number
    /// of the block the transaction was mined in and replays all transaction mined before it in the block.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function rollFork(bytes32 txHash) external;
    /// Updates the given fork to given block number.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function rollFork(uint256 forkId, uint256 blockNumber) external;
    /// Updates the given fork to block number of the given transaction and replays all transaction mined before it in the block.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function rollFork(uint256 forkId, bytes32 txHash) external;

    /// Takes a fork identifier created by `createFork` and sets the corresponding forked state as active.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function selectFork(uint256 forkId) external;

    /// Fetches the given transaction from the active fork and executes it on the current state.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function transact(bytes32 txHash) external;
    /// Fetches the given transaction from the given fork and executes it on the current state.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function transact(uint256 forkId, bytes32 txHash) external;

    /// Performs an Ethereum JSON-RPC request to the current fork URL.
    #[cheatcode(group = Evm, safety = Safe)]
    function rpc(string calldata method, string calldata params) external returns (bytes memory data);

    /// Performs an Ethereum JSON-RPC request to the given endpoint.
    #[cheatcode(group = Evm, safety = Safe)]
    function rpc(string calldata urlOrAlias, string calldata method, string calldata params)
        external
        returns (bytes memory data);

    /// Gets all the logs according to specified filter.
    #[cheatcode(group = Evm, safety = Safe)]
    function eth_getLogs(uint256 fromBlock, uint256 toBlock, address target, bytes32[] memory topics)
        external
        returns (EthGetLogs[] memory logs);

    // --- Behavior ---

    /// In forking mode, explicitly grant the given address cheatcode access.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function allowCheatcodes(address account) external;

    /// Marks that the account(s) should use persistent storage across fork swaps in a multifork setup
    /// Meaning, changes made to the state of this account will be kept when switching forks.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function makePersistent(address account) external;
    /// See `makePersistent(address)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function makePersistent(address account0, address account1) external;
    /// See `makePersistent(address)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function makePersistent(address account0, address account1, address account2) external;
    /// See `makePersistent(address)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function makePersistent(address[] calldata accounts) external;

    /// Revokes persistent status from the address, previously added via `makePersistent`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function revokePersistent(address account) external;
    /// See `revokePersistent(address)`.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function revokePersistent(address[] calldata accounts) external;

    /// Returns true if the account is marked as persistent.
    #[cheatcode(group = Evm, safety = Unsafe)]
    function isPersistent(address account) external view returns (bool persistent);

    // -------- Record Logs --------

    /// Record all the transaction logs.
    #[cheatcode(group = Evm, safety = Safe)]
    function recordLogs() external;

    /// Gets all the recorded logs.
    #[cheatcode(group = Evm, safety = Safe)]
    function getRecordedLogs() external returns (Log[] memory logs);

    // -------- Gas Metering --------

    // It's recommend to use the `noGasMetering` modifier included with forge-std, instead of
    // using these functions directly.

    /// Pauses gas metering (i.e. gas usage is not counted). Noop if already paused.
    #[cheatcode(group = Evm, safety = Safe)]
    function pauseGasMetering() external;

    /// Resumes gas metering (i.e. gas usage is counted again). Noop if already on.
    #[cheatcode(group = Evm, safety = Safe)]
    function resumeGasMetering() external;

    /// Reset gas metering (i.e. gas usage is set to gas limit).
    #[cheatcode(group = Evm, safety = Safe)]
    function resetGasMetering() external;

    // -------- Gas Measurement --------

    /// Gets the gas used in the last call from the callee perspective.
    #[cheatcode(group = Evm, safety = Safe)]
    function lastCallGas() external view returns (Gas memory gas);

    // ======== Test Assertions and Utilities ========

    /// If the condition is false, discard this run's fuzz inputs and generate new ones.
    #[cheatcode(group = Testing, safety = Safe)]
    function assume(bool condition) external pure;

    /// Discard this run's fuzz inputs and generate new ones if next call reverted.
    #[cheatcode(group = Testing, safety = Safe)]
    function assumeNoRevert() external pure;

    /// Writes a breakpoint to jump to in the debugger.
    #[cheatcode(group = Testing, safety = Safe)]
    function breakpoint(string calldata char) external pure;

    /// Writes a conditional breakpoint to jump to in the debugger.
    #[cheatcode(group = Testing, safety = Safe)]
    function breakpoint(string calldata char, bool value) external pure;

    /// Returns the Foundry version.
    /// Format: <cargo_version>+<git_sha>+<build_timestamp>
    /// Sample output: 0.2.0+faa94c384+202407110019
    /// Note: Build timestamps may vary slightly across platforms due to separate CI jobs.
    /// For reliable version comparisons, use YYYYMMDD0000 format (e.g., >= 202407110000)
    /// to compare timestamps while ignoring minor time differences.
    #[cheatcode(group = Testing, safety = Safe)]
    function getFoundryVersion() external view returns (string memory version);

    /// Returns the RPC url for the given alias.
    #[cheatcode(group = Testing, safety = Safe)]
    function rpcUrl(string calldata rpcAlias) external view returns (string memory json);

    /// Returns all rpc urls and their aliases `[alias, url][]`.
    #[cheatcode(group = Testing, safety = Safe)]
    function rpcUrls() external view returns (string[2][] memory urls);

    /// Returns all rpc urls and their aliases as structs.
    #[cheatcode(group = Testing, safety = Safe)]
    function rpcUrlStructs() external view returns (Rpc[] memory urls);

    /// Suspends execution of the main thread for `duration` milliseconds.
    #[cheatcode(group = Testing, safety = Safe)]
    function sleep(uint256 duration) external;

    /// Expects a call to an address with the specified calldata.
    /// Calldata can either be a strict or a partial match.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCall(address callee, bytes calldata data) external;

    /// Expects given number of calls to an address with the specified calldata.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCall(address callee, bytes calldata data, uint64 count) external;

    /// Expects a call to an address with the specified `msg.value` and calldata.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCall(address callee, uint256 msgValue, bytes calldata data) external;

    /// Expects given number of calls to an address with the specified `msg.value` and calldata.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCall(address callee, uint256 msgValue, bytes calldata data, uint64 count) external;

    /// Expect a call to an address with the specified `msg.value`, gas, and calldata.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data) external;

    /// Expects given number of calls to an address with the specified `msg.value`, gas, and calldata.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCall(address callee, uint256 msgValue, uint64 gas, bytes calldata data, uint64 count) external;

    /// Expect a call to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data) external;

    /// Expect given number of calls to an address with the specified `msg.value` and calldata, and a *minimum* amount of gas.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectCallMinGas(address callee, uint256 msgValue, uint64 minGas, bytes calldata data, uint64 count)
        external;

    /// Prepare an expected log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.).
    /// Call this function, then emit an event, then call a function. Internally after the call, we check if
    /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans).
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;

    /// Same as the previous method, but also checks supplied address against emitting contract.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmit(bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)
        external;

    /// Prepare an expected log with all topic and data checks enabled.
    /// Call this function, then emit an event, then call a function. Internally after the call, we check if
    /// logs were emitted in the expected order with the expected topics and data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmit() external;

    /// Same as the previous method, but also checks supplied address against emitting contract.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmit(address emitter) external;

    /// Prepare an expected anonymous log with (bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData.).
    /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if
    /// logs were emitted in the expected order with the expected topics and data (as specified by the booleans).
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData) external;

    /// Same as the previous method, but also checks supplied address against emitting contract.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmitAnonymous(bool checkTopic0, bool checkTopic1, bool checkTopic2, bool checkTopic3, bool checkData, address emitter)
        external;

    /// Prepare an expected anonymous log with all topic and data checks enabled.
    /// Call this function, then emit an anonymous event, then call a function. Internally after the call, we check if
    /// logs were emitted in the expected order with the expected topics and data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmitAnonymous() external;

    /// Same as the previous method, but also checks supplied address against emitting contract.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectEmitAnonymous(address emitter) external;

    /// Expects an error on next call with any revert data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectRevert() external;

    /// Expects an error on next call that exactly matches the revert data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectRevert(bytes4 revertData) external;

    /// Expects an error on next call that exactly matches the revert data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectRevert(bytes calldata revertData) external;

    /// Expects an error with any revert data on next call to reverter address.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectRevert(address reverter) external;

    /// Expects an error from reverter address on next call, with any revert data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectRevert(bytes4 revertData, address reverter) external;

    /// Expects an error from reverter address on next call, that exactly matches the revert data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectRevert(bytes calldata revertData, address reverter) external;

    /// Expects an error on next call that starts with the revert data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectPartialRevert(bytes4 revertData) external;

    /// Expects an error on next call to reverter address, that starts with the revert data.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectPartialRevert(bytes4 revertData, address reverter) external;

    /// Expects an error on next cheatcode call with any revert data.
    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
    function _expectCheatcodeRevert() external;

    /// Expects an error on next cheatcode call that starts with the revert data.
    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
    function _expectCheatcodeRevert(bytes4 revertData) external;

    /// Expects an error on next cheatcode call that exactly matches the revert data.
    #[cheatcode(group = Testing, safety = Unsafe, status = Internal)]
    function _expectCheatcodeRevert(bytes calldata revertData) external;

    /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the current subcontext. If any other
    /// memory is written to, the test will fail. Can be called multiple times to add more ranges to the set.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectSafeMemory(uint64 min, uint64 max) external;

    /// Stops all safe memory expectation in the current subcontext.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function stopExpectSafeMemory() external;

    /// Only allows memory writes to offsets [0x00, 0x60) ∪ [min, max) in the next created subcontext.
    /// If any other memory is written to, the test will fail. Can be called multiple times to add more ranges
    /// to the set.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function expectSafeMemoryCall(uint64 min, uint64 max) external;

    /// Marks a test as skipped. Must be called at the top level of a test.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function skip(bool skipTest) external;

    /// Marks a test as skipped with a reason. Must be called at the top level of a test.
    #[cheatcode(group = Testing, safety = Unsafe)]
    function skip(bool skipTest, string calldata reason) external;

    /// Asserts that the given condition is true.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertTrue(bool condition) external pure;

    /// Asserts that the given condition is true and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertTrue(bool condition, string calldata error) external pure;

    /// Asserts that the given condition is false.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertFalse(bool condition) external pure;

    /// Asserts that the given condition is false and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertFalse(bool condition, string calldata error) external pure;

    /// Asserts that two `bool` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bool left, bool right) external pure;

    /// Asserts that two `bool` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bool left, bool right, string calldata error) external pure;

    /// Asserts that two `uint256` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(uint256 left, uint256 right) external pure;

    /// Asserts that two `uint256` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(uint256 left, uint256 right, string calldata error) external pure;

    /// Asserts that two `int256` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(int256 left, int256 right) external pure;

    /// Asserts that two `int256` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(int256 left, int256 right, string calldata error) external pure;

    /// Asserts that two `address` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(address left, address right) external pure;

    /// Asserts that two `address` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(address left, address right, string calldata error) external pure;

    /// Asserts that two `bytes32` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes32 left, bytes32 right) external pure;

    /// Asserts that two `bytes32` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes32 left, bytes32 right, string calldata error) external pure;

    /// Asserts that two `string` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(string calldata left, string calldata right) external pure;

    /// Asserts that two `string` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(string calldata left, string calldata right, string calldata error) external pure;

    /// Asserts that two `bytes` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes calldata left, bytes calldata right) external pure;

    /// Asserts that two `bytes` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes calldata left, bytes calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `bool` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bool[] calldata left, bool[] calldata right) external pure;

    /// Asserts that two arrays of `bool` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `uint256 values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(uint256[] calldata left, uint256[] calldata right) external pure;

    /// Asserts that two arrays of `uint256` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `int256` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(int256[] calldata left, int256[] calldata right) external pure;

    /// Asserts that two arrays of `int256` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `address` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(address[] calldata left, address[] calldata right) external pure;

    /// Asserts that two arrays of `address` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(address[] calldata left, address[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `bytes32` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes32[] calldata left, bytes32[] calldata right) external pure;

    /// Asserts that two arrays of `bytes32` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `string` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(string[] calldata left, string[] calldata right) external pure;

    /// Asserts that two arrays of `string` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(string[] calldata left, string[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `bytes` values are equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes[] calldata left, bytes[] calldata right) external pure;

    /// Asserts that two arrays of `bytes` values are equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure;

    /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure;

    /// Asserts that two `uint256` values are equal, formatting them with decimals in failure message.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;

    /// Asserts that two `int256` values are equal, formatting them with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEqDecimal(int256 left, int256 right, uint256 decimals) external pure;

    /// Asserts that two `int256` values are equal, formatting them with decimals in failure message.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;

    /// Asserts that two `bool` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bool left, bool right) external pure;

    /// Asserts that two `bool` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bool left, bool right, string calldata error) external pure;

    /// Asserts that two `uint256` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(uint256 left, uint256 right) external pure;

    /// Asserts that two `uint256` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(uint256 left, uint256 right, string calldata error) external pure;

    /// Asserts that two `int256` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(int256 left, int256 right) external pure;

    /// Asserts that two `int256` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(int256 left, int256 right, string calldata error) external pure;

    /// Asserts that two `address` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(address left, address right) external pure;

    /// Asserts that two `address` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(address left, address right, string calldata error) external pure;

    /// Asserts that two `bytes32` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes32 left, bytes32 right) external pure;

    /// Asserts that two `bytes32` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes32 left, bytes32 right, string calldata error) external pure;

    /// Asserts that two `string` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(string calldata left, string calldata right) external pure;

    /// Asserts that two `string` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(string calldata left, string calldata right, string calldata error) external pure;

    /// Asserts that two `bytes` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes calldata left, bytes calldata right) external pure;

    /// Asserts that two `bytes` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes calldata left, bytes calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `bool` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bool[] calldata left, bool[] calldata right) external pure;

    /// Asserts that two arrays of `bool` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bool[] calldata left, bool[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `uint256` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(uint256[] calldata left, uint256[] calldata right) external pure;

    /// Asserts that two arrays of `uint256` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(uint256[] calldata left, uint256[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `int256` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(int256[] calldata left, int256[] calldata right) external pure;

    /// Asserts that two arrays of `int256` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(int256[] calldata left, int256[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `address` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(address[] calldata left, address[] calldata right) external pure;

    /// Asserts that two arrays of `address` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(address[] calldata left, address[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `bytes32` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes32[] calldata left, bytes32[] calldata right) external pure;

    /// Asserts that two arrays of `bytes32` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes32[] calldata left, bytes32[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `string` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(string[] calldata left, string[] calldata right) external pure;

    /// Asserts that two arrays of `string` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(string[] calldata left, string[] calldata right, string calldata error) external pure;

    /// Asserts that two arrays of `bytes` values are not equal.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes[] calldata left, bytes[] calldata right) external pure;

    /// Asserts that two arrays of `bytes` values are not equal and includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEq(bytes[] calldata left, bytes[] calldata right, string calldata error) external pure;

    /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals) external pure;

    /// Asserts that two `uint256` values are not equal, formatting them with decimals in failure message.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEqDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;

    /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEqDecimal(int256 left, int256 right, uint256 decimals) external pure;

    /// Asserts that two `int256` values are not equal, formatting them with decimals in failure message.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertNotEqDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGt(uint256 left, uint256 right) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGt(uint256 left, uint256 right, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be greater than second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGt(int256 left, int256 right) external pure;

    /// Compares two `int256` values. Expects first value to be greater than second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGt(int256 left, int256 right, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGtDecimal(uint256 left, uint256 right, uint256 decimals) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be greater than second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGtDecimal(int256 left, int256 right, uint256 decimals) external pure;

    /// Compares two `int256` values. Expects first value to be greater than second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGe(uint256 left, uint256 right) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGe(uint256 left, uint256 right, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGe(int256 left, int256 right) external pure;

    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGe(int256 left, int256 right, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGeDecimal(uint256 left, uint256 right, uint256 decimals) external pure;

    /// Compares two `uint256` values. Expects first value to be greater than or equal to second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGeDecimal(int256 left, int256 right, uint256 decimals) external pure;

    /// Compares two `int256` values. Expects first value to be greater than or equal to second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertGeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be less than second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLt(uint256 left, uint256 right) external pure;

    /// Compares two `uint256` values. Expects first value to be less than second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLt(uint256 left, uint256 right, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be less than second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLt(int256 left, int256 right) external pure;

    /// Compares two `int256` values. Expects first value to be less than second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLt(int256 left, int256 right, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be less than second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLtDecimal(uint256 left, uint256 right, uint256 decimals) external pure;

    /// Compares two `uint256` values. Expects first value to be less than second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLtDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be less than second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLtDecimal(int256 left, int256 right, uint256 decimals) external pure;

    /// Compares two `int256` values. Expects first value to be less than second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLtDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLe(uint256 left, uint256 right) external pure;

    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLe(uint256 left, uint256 right, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be less than or equal to second.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLe(int256 left, int256 right) external pure;

    /// Compares two `int256` values. Expects first value to be less than or equal to second.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLe(int256 left, int256 right, string calldata error) external pure;

    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLeDecimal(uint256 left, uint256 right, uint256 decimals) external pure;

    /// Compares two `uint256` values. Expects first value to be less than or equal to second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLeDecimal(uint256 left, uint256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `int256` values. Expects first value to be less than or equal to second.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLeDecimal(int256 left, int256 right, uint256 decimals) external pure;

    /// Compares two `int256` values. Expects first value to be less than or equal to second.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertLeDecimal(int256 left, int256 right, uint256 decimals, string calldata error) external pure;

    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta) external pure;

    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbs(uint256 left, uint256 right, uint256 maxDelta, string calldata error) external pure;

    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta) external pure;

    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbs(int256 left, int256 right, uint256 maxDelta, string calldata error) external pure;

    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbsDecimal(uint256 left, uint256 right, uint256 maxDelta, uint256 decimals) external pure;

    /// Compares two `uint256` values. Expects difference to be less than or equal to `maxDelta`.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbsDecimal(
        uint256 left,
        uint256 right,
        uint256 maxDelta,
        uint256 decimals,
        string calldata error
    ) external pure;

    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbsDecimal(int256 left, int256 right, uint256 maxDelta, uint256 decimals) external pure;

    /// Compares two `int256` values. Expects difference to be less than or equal to `maxDelta`.
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqAbsDecimal(
        int256 left,
        int256 right,
        uint256 maxDelta,
        uint256 decimals,
        string calldata error
    ) external pure;

    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta) external pure;

    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRel(uint256 left, uint256 right, uint256 maxPercentDelta, string calldata error) external pure;

    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta) external pure;

    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    /// Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRel(int256 left, int256 right, uint256 maxPercentDelta, string calldata error) external pure;

    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRelDecimal(
        uint256 left,
        uint256 right,
        uint256 maxPercentDelta,
        uint256 decimals
    ) external pure;

    /// Compares two `uint256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRelDecimal(
        uint256 left,
        uint256 right,
        uint256 maxPercentDelta,
        uint256 decimals,
        string calldata error
    ) external pure;

    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    /// Formats values with decimals in failure message.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRelDecimal(
        int256 left,
        int256 right,
        uint256 maxPercentDelta,
        uint256 decimals
    ) external pure;

    /// Compares two `int256` values. Expects relative difference in percents to be less than or equal to `maxPercentDelta`.
    /// `maxPercentDelta` is an 18 decimal fixed point number, where 1e18 == 100%
    /// Formats values with decimals in failure message. Includes error message into revert string on failure.
    #[cheatcode(group = Testing, safety = Safe)]
    function assertApproxEqRelDecimal(
        int256 left,
        int256 right,
        uint256 maxPercentDelta,
        uint256 decimals,
        string calldata error
    ) external pure;

    // ======== OS and Filesystem ========

    // -------- Metadata --------

    /// Returns true if the given path points to an existing entity, else returns false.
    #[cheatcode(group = Filesystem)]
    function exists(string calldata path) external view returns (bool result);

    /// Given a path, query the file system to get information about a file, directory, etc.
    #[cheatcode(group = Filesystem)]
    function fsMetadata(string calldata path) external view returns (FsMetadata memory metadata);

    /// Returns true if the path exists on disk and is pointing at a directory, else returns false.
    #[cheatcode(group = Filesystem)]
    function isDir(string calldata path) external view returns (bool result);

    /// Returns true if the path exists on disk and is pointing at a regular file, else returns false.
    #[cheatcode(group = Filesystem)]
    function isFile(string calldata path) external view returns (bool result);

    /// Get the path of the current project root.
    #[cheatcode(group = Filesystem)]
    function projectRoot() external view returns (string memory path);

    /// Returns the time since unix epoch in milliseconds.
    #[cheatcode(group = Filesystem)]
    function unixTime() external view returns (uint256 milliseconds);

    // -------- Reading and writing --------

    /// Closes file for reading, resetting the offset and allowing to read it from beginning with readLine.
    /// `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function closeFile(string calldata path) external;

    /// Copies the contents of one file to another. This function will **overwrite** the contents of `to`.
    /// On success, the total number of bytes copied is returned and it is equal to the length of the `to` file as reported by `metadata`.
    /// Both `from` and `to` are relative to the project root.
    #[cheatcode(group = Filesystem)]
    function copyFile(string calldata from, string calldata to) external returns (uint64 copied);

    /// Creates a new, empty directory at the provided path.
    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
    /// - User lacks permissions to modify `path`.
    /// - A parent of the given path doesn't exist and `recursive` is false.
    /// - `path` already exists and `recursive` is false.
    /// `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function createDir(string calldata path, bool recursive) external;

    /// Reads the directory at the given path recursively, up to `maxDepth`.
    /// `maxDepth` defaults to 1, meaning only the direct children of the given directory will be returned.
    /// Follows symbolic links if `followLinks` is true.
    #[cheatcode(group = Filesystem)]
    function readDir(string calldata path) external view returns (DirEntry[] memory entries);
    /// See `readDir(string)`.
    #[cheatcode(group = Filesystem)]
    function readDir(string calldata path, uint64 maxDepth) external view returns (DirEntry[] memory entries);
    /// See `readDir(string)`.
    #[cheatcode(group = Filesystem)]
    function readDir(string calldata path, uint64 maxDepth, bool followLinks)
        external
        view
        returns (DirEntry[] memory entries);

    /// Reads the entire content of file to string. `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function readFile(string calldata path) external view returns (string memory data);

    /// Reads the entire content of file as binary. `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function readFileBinary(string calldata path) external view returns (bytes memory data);

    /// Reads next line of file to string.
    #[cheatcode(group = Filesystem)]
    function readLine(string calldata path) external view returns (string memory line);

    /// Reads a symbolic link, returning the path that the link points to.
    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
    /// - `path` is not a symbolic link.
    /// - `path` does not exist.
    #[cheatcode(group = Filesystem)]
    function readLink(string calldata linkPath) external view returns (string memory targetPath);

    /// Removes a directory at the provided path.
    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
    /// - `path` doesn't exist.
    /// - `path` isn't a directory.
    /// - User lacks permissions to modify `path`.
    /// - The directory is not empty and `recursive` is false.
    /// `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function removeDir(string calldata path, bool recursive) external;

    /// Removes a file from the filesystem.
    /// This cheatcode will revert in the following situations, but is not limited to just these cases:
    /// - `path` points to a directory.
    /// - The file doesn't exist.
    /// - The user lacks permissions to remove the file.
    /// `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function removeFile(string calldata path) external;

    /// Writes data to file, creating a file if it does not exist, and entirely replacing its contents if it does.
    /// `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function writeFile(string calldata path, string calldata data) external;

    /// Writes binary data to a file, creating a file if it does not exist, and entirely replacing its contents if it does.
    /// `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function writeFileBinary(string calldata path, bytes calldata data) external;

    /// Writes line to file, creating a file if it does not exist.
    /// `path` is relative to the project root.
    #[cheatcode(group = Filesystem)]
    function writeLine(string calldata path, string calldata data) external;

    /// Gets the artifact path from code (aka. creation code).
    #[cheatcode(group = Filesystem)]
    function getArtifactPathByCode(bytes calldata code) external view returns (string memory path);

    /// Gets the artifact path from deployed code (aka. runtime code).
    #[cheatcode(group = Filesystem)]
    function getArtifactPathByDeployedCode(bytes calldata deployedCode) external view returns (string memory path);

    /// Gets the creation bytecode from an artifact file. Takes in the relative path to the json file or the path to the
    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
    #[cheatcode(group = Filesystem)]
    function getCode(string calldata artifactPath) external view returns (bytes memory creationBytecode);

    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
    #[cheatcode(group = Filesystem)]
    function deployCode(string calldata artifactPath) external returns (address deployedAddress);

    /// Deploys a contract from an artifact file. Takes in the relative path to the json file or the path to the
    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
    ///
    /// Additionally accepts abi-encoded constructor arguments.
    #[cheatcode(group = Filesystem)]
    function deployCode(string calldata artifactPath, bytes calldata constructorArgs) external returns (address deployedAddress);

    /// Gets the deployed bytecode from an artifact file. Takes in the relative path to the json file or the path to the
    /// artifact in the form of <path>:<contract>:<version> where <contract> and <version> parts are optional.
    #[cheatcode(group = Filesystem)]
    function getDeployedCode(string calldata artifactPath) external view returns (bytes memory runtimeBytecode);

    /// Returns the most recent broadcast for the given contract on `chainId` matching `txType`.
    ///
    /// For example:
    ///
    /// The most recent deployment can be fetched by passing `txType` as `CREATE` or `CREATE2`.
    ///
    /// The most recent call can be fetched by passing `txType` as `CALL`.
    #[cheatcode(group = Filesystem)]
    function getBroadcast(string memory contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary memory);

    /// Returns all broadcasts for the given contract on `chainId` with the specified `txType`.
    ///
    /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.
    #[cheatcode(group = Filesystem)]
    function getBroadcasts(string memory contractName, uint64 chainId, BroadcastTxType txType) external view returns (BroadcastTxSummary[] memory);

    /// Returns all broadcasts for the given contract on `chainId`.
    ///
    /// Sorted such that the most recent broadcast is the first element, and the oldest is the last. i.e descending order of BroadcastTxSummary.blockNumber.
    #[cheatcode(group = Filesystem)]
    function getBroadcasts(string memory contractName, uint64 chainId) external view returns (BroadcastTxSummary[] memory);

    /// Returns the most recent deployment for the current `chainId`.
    #[cheatcode(group = Filesystem)]
    function getDeployment(string memory contractName) external view returns (address deployedAddress);

    /// Returns the most recent deployment for the given contract on `chainId`
    #[cheatcode(group = Filesystem)]
    function getDeployment(string memory contractName, uint64 chainId) external view returns (address deployedAddress);

    /// Returns all deployments for the given contract on `chainId`
    ///
    /// Sorted in descending order of deployment time i.e descending order of BroadcastTxSummary.blockNumber.
    ///
    /// The most recent deployment is the first element, and the oldest is the last.
    #[cheatcode(group = Filesystem)]
    function getDeployments(string memory contractName, uint64 chainId) external view returns (address[] memory deployedAddresses);

    // -------- Foreign Function Interface --------

    /// Performs a foreign function call via the terminal.
    #[cheatcode(group = Filesystem)]
    function ffi(string[] calldata commandInput) external returns (bytes memory result);

    /// Performs a foreign function call via terminal and returns the exit code, stdout, and stderr.
    #[cheatcode(group = Filesystem)]
    function tryFfi(string[] calldata commandInput) external returns (FfiResult memory result);

    // -------- User Interaction --------

    /// Prompts the user for a string value in the terminal.
    #[cheatcode(group = Filesystem)]
    function prompt(string calldata promptText) external returns (string memory input);

    /// Prompts the user for a hidden string value in the terminal.
    #[cheatcode(group = Filesystem)]
    function promptSecret(string calldata promptText) external returns (string memory input);

    /// Prompts the user for hidden uint256 in the terminal (usually pk).
    #[cheatcode(group = Filesystem)]
    function promptSecretUint(string calldata promptText) external returns (uint256);

    /// Prompts the user for an address in the terminal.
    #[cheatcode(group = Filesystem)]
    function promptAddress(string calldata promptText) external returns (address);

    /// Prompts the user for uint256 in the terminal.
    #[cheatcode(group = Filesystem)]
    function promptUint(string calldata promptText) external returns (uint256);

    // ======== Environment Variables ========

    /// Sets environment variables.
    #[cheatcode(group = Environment)]
    function setEnv(string calldata name, string calldata value) external;

    /// Gets the environment variable `name` and returns true if it exists, else returns false.
    #[cheatcode(group = Environment)]
    function envExists(string calldata name) external view returns (bool result);

    /// Gets the environment variable `name` and parses it as `bool`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envBool(string calldata name) external view returns (bool value);
    /// Gets the environment variable `name` and parses it as `uint256`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envUint(string calldata name) external view returns (uint256 value);
    /// Gets the environment variable `name` and parses it as `int256`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envInt(string calldata name) external view returns (int256 value);
    /// Gets the environment variable `name` and parses it as `address`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envAddress(string calldata name) external view returns (address value);
    /// Gets the environment variable `name` and parses it as `bytes32`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envBytes32(string calldata name) external view returns (bytes32 value);
    /// Gets the environment variable `name` and parses it as `string`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envString(string calldata name) external view returns (string memory value);
    /// Gets the environment variable `name` and parses it as `bytes`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envBytes(string calldata name) external view returns (bytes memory value);

    /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envBool(string calldata name, string calldata delim) external view returns (bool[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envUint(string calldata name, string calldata delim) external view returns (uint256[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envInt(string calldata name, string calldata delim) external view returns (int256[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envAddress(string calldata name, string calldata delim) external view returns (address[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envBytes32(string calldata name, string calldata delim) external view returns (bytes32[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envString(string calldata name, string calldata delim) external view returns (string[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`.
    /// Reverts if the variable was not found or could not be parsed.
    #[cheatcode(group = Environment)]
    function envBytes(string calldata name, string calldata delim) external view returns (bytes[] memory value);

    /// Gets the environment variable `name` and parses it as `bool`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, bool defaultValue) external view returns (bool value);
    /// Gets the environment variable `name` and parses it as `uint256`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, uint256 defaultValue) external view returns (uint256 value);
    /// Gets the environment variable `name` and parses it as `int256`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, int256 defaultValue) external view returns (int256 value);
    /// Gets the environment variable `name` and parses it as `address`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, address defaultValue) external view returns (address value);
    /// Gets the environment variable `name` and parses it as `bytes32`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, bytes32 defaultValue) external view returns (bytes32 value);
    /// Gets the environment variable `name` and parses it as `string`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata defaultValue) external view returns (string memory value);
    /// Gets the environment variable `name` and parses it as `bytes`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, bytes calldata defaultValue) external view returns (bytes memory value);

    /// Gets the environment variable `name` and parses it as an array of `bool`, delimited by `delim`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata delim, bool[] calldata defaultValue)
        external view
        returns (bool[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `uint256`, delimited by `delim`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata delim, uint256[] calldata defaultValue)
        external view
        returns (uint256[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `int256`, delimited by `delim`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata delim, int256[] calldata defaultValue)
        external view
        returns (int256[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `address`, delimited by `delim`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata delim, address[] calldata defaultValue)
        external view
        returns (address[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `bytes32`, delimited by `delim`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata delim, bytes32[] calldata defaultValue)
        external view
        returns (bytes32[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `string`, delimited by `delim`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata delim, string[] calldata defaultValue)
        external view
        returns (string[] memory value);
    /// Gets the environment variable `name` and parses it as an array of `bytes`, delimited by `delim`.
    /// Reverts if the variable could not be parsed.
    /// Returns `defaultValue` if the variable was not found.
    #[cheatcode(group = Environment)]
    function envOr(string calldata name, string calldata delim, bytes[] calldata defaultValue)
        external view
        returns (bytes[] memory value);

    /// Returns true if `forge` command was executed in given context.
    #[cheatcode(group = Environment)]
    function isContext(ForgeContext context) external view returns (bool result);

    // ======== Scripts ========

    // -------- Broadcasting Transactions --------

    /// Has the next call (at this call depth only) create transactions that can later be signed and sent onchain.
    ///
    /// Broadcasting address is determined by checking the following in order:
    /// 1. If `--sender` argument was provided, that address is used.
    /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used.
    /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used.
    #[cheatcode(group = Scripting)]
    function broadcast() external;

    /// Has the next call (at this call depth only) create a transaction with the address provided
    /// as the sender that can later be signed and sent onchain.
    #[cheatcode(group = Scripting)]
    function broadcast(address signer) external;

    /// Has the next call (at this call depth only) create a transaction with the private key
    /// provided as the sender that can later be signed and sent onchain.
    #[cheatcode(group = Scripting)]
    function broadcast(uint256 privateKey) external;

    /// Has all subsequent calls (at this call depth only) create transactions that can later be signed and sent onchain.
    ///
    /// Broadcasting address is determined by checking the following in order:
    /// 1. If `--sender` argument was provided, that address is used.
    /// 2. If exactly one signer (e.g. private key, hw wallet, keystore) is set when `forge broadcast` is invoked, that signer is used.
    /// 3. Otherwise, default foundry sender (1804c8AB1F12E6bbf3894d4083f33e07309d1f38) is used.
    #[cheatcode(group = Scripting)]
    function startBroadcast() external;

    /// Has all subsequent calls (at this call depth only) create transactions with the address
    /// provided that can later be signed and sent onchain.
    #[cheatcode(group = Scripting)]
    function startBroadcast(address signer) external;

    /// Has all subsequent calls (at this call depth only) create transactions with the private key
    /// provided that can later be signed and sent onchain.
    #[cheatcode(group = Scripting)]
    function startBroadcast(uint256 privateKey) external;

    /// Stops collecting onchain transactions.
    #[cheatcode(group = Scripting)]
    function stopBroadcast() external;

    /// Takes a signed transaction and broadcasts it to the network.
    #[cheatcode(group = Scripting)]
    function broadcastRawTransaction(bytes calldata data) external;

    /// Sign an EIP-7702 authorization for delegation
    #[cheatcode(group = Scripting)]
    function signDelegation(address implementation, uint256 privateKey) external returns (SignedDelegation memory signedDelegation);

    /// Designate the next call as an EIP-7702 transaction
    #[cheatcode(group = Scripting)]
    function attachDelegation(SignedDelegation memory signedDelegation) external;

    /// Sign an EIP-7702 authorization and designate the next call as an EIP-7702 transaction
    #[cheatcode(group = Scripting)]
    function signAndAttachDelegation(address implementation, uint256 privateKey) external returns (SignedDelegation memory signedDelegation);

    /// Returns addresses of available unlocked wallets in the script environment.
    #[cheatcode(group = Scripting)]
    function getWallets() external returns (address[] memory wallets);

    // ======== Utilities ========

    // -------- Strings --------

    /// Converts the given value to a `string`.
    #[cheatcode(group = String)]
    function toString(address value) external pure returns (string memory stringifiedValue);
    /// Converts the given value to a `string`.
    #[cheatcode(group = String)]
    function toString(bytes calldata value) external pure returns (string memory stringifiedValue);
    /// Converts the given value to a `string`.
    #[cheatcode(group = String)]
    function toString(bytes32 value) external pure returns (string memory stringifiedValue);
    /// Converts the given value to a `string`.
    #[cheatcode(group = String)]
    function toString(bool value) external pure returns (string memory stringifiedValue);
    /// Converts the given value to a `string`.
    #[cheatcode(group = String)]
    function toString(uint256 value) external pure returns (string memory stringifiedValue);
    /// Converts the given value to a `string`.
    #[cheatcode(group = String)]
    function toString(int256 value) external pure returns (string memory stringifiedValue);

    /// Parses the given `string` into `bytes`.
    #[cheatcode(group = String)]
    function parseBytes(string calldata stringifiedValue) external pure returns (bytes memory parsedValue);
    /// Parses the given `string` into an `address`.
    #[cheatcode(group = String)]
    function parseAddress(string calldata stringifiedValue) external pure returns (address parsedValue);
    /// Parses the given `string` into a `uint256`.
    #[cheatcode(group = String)]
    function parseUint(string calldata stringifiedValue) external pure returns (uint256 parsedValue);
    /// Parses the given `string` into a `int256`.
    #[cheatcode(group = String)]
    function parseInt(string calldata stringifiedValue) external pure returns (int256 parsedValue);
    /// Parses the given `string` into a `bytes32`.
    #[cheatcode(group = String)]
    function parseBytes32(string calldata stringifiedValue) external pure returns (bytes32 parsedValue);
    /// Parses the given `string` into a `bool`.
    #[cheatcode(group = String)]
    function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue);

    /// Converts the given `string` value to Lowercase.
    #[cheatcode(group = String)]
    function toLowercase(string calldata input) external pure returns (string memory output);
    /// Converts the given `string` value to Uppercase.
    #[cheatcode(group = String)]
    function toUppercase(string calldata input) external pure returns (string memory output);
    /// Trims leading and trailing whitespace from the given `string` value.
    #[cheatcode(group = String)]
    function trim(string calldata input) external pure returns (string memory output);
    /// Replaces occurrences of `from` in the given `string` with `to`.
    #[cheatcode(group = String)]
    function replace(string calldata input, string calldata from, string calldata to) external pure returns (string memory output);
    /// Splits the given `string` into an array of strings divided by the `delimiter`.
    #[cheatcode(group = String)]
    function split(string calldata input, string calldata delimiter) external pure returns (string[] memory outputs);
    /// Returns the index of the first occurrence of a `key` in an `input` string.
    /// Returns `NOT_FOUND` (i.e. `type(uint256).max`) if the `key` is not found.
    /// Returns 0 in case of an empty `key`.
    #[cheatcode(group = String)]
    function indexOf(string calldata input, string calldata key) external pure returns (uint256);
    /// Returns true if `search` is found in `subject`, false otherwise.
    #[cheatcode(group = String)]
    function contains(string calldata subject, string calldata search) external returns (bool result);

    // ======== JSON Parsing and Manipulation ========

    // -------- Reading --------

    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/parse-json to understand the
    // limitations and caveats of the JSON parsing cheats.

    /// Checks if `key` exists in a JSON object
    /// `keyExists` is being deprecated in favor of `keyExistsJson`. It will be removed in future versions.
    #[cheatcode(group = Json, status = Deprecated(Some("replaced by `keyExistsJson`")))]
    function keyExists(string calldata json, string calldata key) external view returns (bool);
    /// Checks if `key` exists in a JSON object.
    #[cheatcode(group = Json)]
    function keyExistsJson(string calldata json, string calldata key) external view returns (bool);

    /// ABI-encodes a JSON object.
    #[cheatcode(group = Json)]
    function parseJson(string calldata json) external pure returns (bytes memory abiEncodedData);
    /// ABI-encodes a JSON object at `key`.
    #[cheatcode(group = Json)]
    function parseJson(string calldata json, string calldata key) external pure returns (bytes memory abiEncodedData);

    // The following parseJson cheatcodes will do type coercion, for the type that they indicate.
    // For example, parseJsonUint will coerce all values to a uint256. That includes stringified numbers '12.'
    // and hex numbers '0xEF.'.
    // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not
    // a JSON object.

    /// Parses a string of JSON data at `key` and coerces it to `uint256`.
    #[cheatcode(group = Json)]
    function parseJsonUint(string calldata json, string calldata key) external pure returns (uint256);
    /// Parses a string of JSON data at `key` and coerces it to `uint256[]`.
    #[cheatcode(group = Json)]
    function parseJsonUintArray(string calldata json, string calldata key) external pure returns (uint256[] memory);
    /// Parses a string of JSON data at `key` and coerces it to `int256`.
    #[cheatcode(group = Json)]
    function parseJsonInt(string calldata json, string calldata key) external pure returns (int256);
    /// Parses a string of JSON data at `key` and coerces it to `int256[]`.
    #[cheatcode(group = Json)]
    function parseJsonIntArray(string calldata json, string calldata key) external pure returns (int256[] memory);
    /// Parses a string of JSON data at `key` and coerces it to `bool`.
    #[cheatcode(group = Json)]
    function parseJsonBool(string calldata json, string calldata key) external pure returns (bool);
    /// Parses a string of JSON data at `key` and coerces it to `bool[]`.
    #[cheatcode(group = Json)]
    function parseJsonBoolArray(string calldata json, string calldata key) external pure returns (bool[] memory);
    /// Parses a string of JSON data at `key` and coerces it to `address`.
    #[cheatcode(group = Json)]
    function parseJsonAddress(string calldata json, string calldata key) external pure returns (address);
    /// Parses a string of JSON data at `key` and coerces it to `address[]`.
    #[cheatcode(group = Json)]
    function parseJsonAddressArray(string calldata json, string calldata key)
        external
        pure
        returns (address[] memory);
    /// Parses a string of JSON data at `key` and coerces it to `string`.
    #[cheatcode(group = Json)]
    function parseJsonString(string calldata json, string calldata key) external pure returns (string memory);
    /// Parses a string of JSON data at `key` and coerces it to `string[]`.
    #[cheatcode(group = Json)]
    function parseJsonStringArray(string calldata json, string calldata key) external pure returns (string[] memory);
    /// Parses a string of JSON data at `key` and coerces it to `bytes`.
    #[cheatcode(group = Json)]
    function parseJsonBytes(string calldata json, string calldata key) external pure returns (bytes memory);
    /// Parses a string of JSON data at `key` and coerces it to `bytes[]`.
    #[cheatcode(group = Json)]
    function parseJsonBytesArray(string calldata json, string calldata key) external pure returns (bytes[] memory);
    /// Parses a string of JSON data at `key` and coerces it to `bytes32`.
    #[cheatcode(group = Json)]
    function parseJsonBytes32(string calldata json, string calldata key) external pure returns (bytes32);
    /// Parses a string of JSON data at `key` and coerces it to `bytes32[]`.
    #[cheatcode(group = Json)]
    function parseJsonBytes32Array(string calldata json, string calldata key)
        external
        pure
        returns (bytes32[] memory);

    /// Parses a string of JSON data and coerces it to type corresponding to `typeDescription`.
    #[cheatcode(group = Json)]
    function parseJsonType(string calldata json, string calldata typeDescription) external pure returns (bytes memory);
    /// Parses a string of JSON data at `key` and coerces it to type corresponding to `typeDescription`.
    #[cheatcode(group = Json)]
    function parseJsonType(string calldata json, string calldata key, string calldata typeDescription) external pure returns (bytes memory);
    /// Parses a string of JSON data at `key` and coerces it to type array corresponding to `typeDescription`.
    #[cheatcode(group = Json)]
    function parseJsonTypeArray(string calldata json, string calldata key, string calldata typeDescription)
        external
        pure
        returns (bytes memory);

    /// Returns an array of all the keys in a JSON object.
    #[cheatcode(group = Json)]
    function parseJsonKeys(string calldata json, string calldata key) external pure returns (string[] memory keys);

    // -------- Writing --------

    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/serialize-json to understand how
    // to use the serialization cheats.

    /// Serializes a key and value to a JSON object stored in-memory that can be later written to a file.
    /// Returns the stringified version of the specific JSON file up to that moment.
    #[cheatcode(group = Json)]
    function serializeJson(string calldata objectKey, string calldata value) external returns (string memory json);

    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeBool(string calldata objectKey, string calldata valueKey, bool value)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeUint(string calldata objectKey, string calldata valueKey, uint256 value)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeUintToHex(string calldata objectKey, string calldata valueKey, uint256 value)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeInt(string calldata objectKey, string calldata valueKey, int256 value)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeAddress(string calldata objectKey, string calldata valueKey, address value)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32 value)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeString(string calldata objectKey, string calldata valueKey, string calldata value)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeBytes(string calldata objectKey, string calldata valueKey, bytes calldata value)
        external
        returns (string memory json);

    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeBool(string calldata objectKey, string calldata valueKey, bool[] calldata values)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeUint(string calldata objectKey, string calldata valueKey, uint256[] calldata values)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeInt(string calldata objectKey, string calldata valueKey, int256[] calldata values)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeAddress(string calldata objectKey, string calldata valueKey, address[] calldata values)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeBytes32(string calldata objectKey, string calldata valueKey, bytes32[] calldata values)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeString(string calldata objectKey, string calldata valueKey, string[] calldata values)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeBytes(string calldata objectKey, string calldata valueKey, bytes[] calldata values)
        external
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeJsonType(string calldata typeDescription, bytes memory value)
        external
        pure
        returns (string memory json);
    /// See `serializeJson`.
    #[cheatcode(group = Json)]
    function serializeJsonType(string calldata objectKey, string calldata valueKey, string calldata typeDescription, bytes memory value)
        external
        returns (string memory json);

    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/write-json to understand how
    // to use the JSON writing cheats.

    /// Write a serialized JSON object to a file. If the file exists, it will be overwritten.
    #[cheatcode(group = Json)]
    function writeJson(string calldata json, string calldata path) external;

    /// Write a serialized JSON object to an **existing** JSON file, replacing a value with key = <value_key.>
    /// This is useful to replace a specific value of a JSON file, without having to parse the entire thing.
    #[cheatcode(group = Json)]
    function writeJson(string calldata json, string calldata path, string calldata valueKey) external;

    // ======== TOML Parsing and Manipulation ========

    // -------- Reading --------

    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/parse-toml to understand the
    // limitations and caveats of the TOML parsing cheat.

    /// Checks if `key` exists in a TOML table.
    #[cheatcode(group = Toml)]
    function keyExistsToml(string calldata toml, string calldata key) external view returns (bool);

    /// ABI-encodes a TOML table.
    #[cheatcode(group = Toml)]
    function parseToml(string calldata toml) external pure returns (bytes memory abiEncodedData);

    /// ABI-encodes a TOML table at `key`.
    #[cheatcode(group = Toml)]
    function parseToml(string calldata toml, string calldata key) external pure returns (bytes memory abiEncodedData);

    // The following parseToml cheatcodes will do type coercion, for the type that they indicate.
    // For example, parseTomlUint will coerce all values to a uint256. That includes stringified numbers '12.'
    // and hex numbers '0xEF.'.
    // Type coercion works ONLY for discrete values or arrays. That means that the key must return a value or array, not
    // a TOML table.

    /// Parses a string of TOML data at `key` and coerces it to `uint256`.
    #[cheatcode(group = Toml)]
    function parseTomlUint(string calldata toml, string calldata key) external pure returns (uint256);
    /// Parses a string of TOML data at `key` and coerces it to `uint256[]`.
    #[cheatcode(group = Toml)]
    function parseTomlUintArray(string calldata toml, string calldata key) external pure returns (uint256[] memory);
    /// Parses a string of TOML data at `key` and coerces it to `int256`.
    #[cheatcode(group = Toml)]
    function parseTomlInt(string calldata toml, string calldata key) external pure returns (int256);
    /// Parses a string of TOML data at `key` and coerces it to `int256[]`.
    #[cheatcode(group = Toml)]
    function parseTomlIntArray(string calldata toml, string calldata key) external pure returns (int256[] memory);
    /// Parses a string of TOML data at `key` and coerces it to `bool`.
    #[cheatcode(group = Toml)]
    function parseTomlBool(string calldata toml, string calldata key) external pure returns (bool);
    /// Parses a string of TOML data at `key` and coerces it to `bool[]`.
    #[cheatcode(group = Toml)]
    function parseTomlBoolArray(string calldata toml, string calldata key) external pure returns (bool[] memory);
    /// Parses a string of TOML data at `key` and coerces it to `address`.
    #[cheatcode(group = Toml)]
    function parseTomlAddress(string calldata toml, string calldata key) external pure returns (address);
    /// Parses a string of TOML data at `key` and coerces it to `address[]`.
    #[cheatcode(group = Toml)]
    function parseTomlAddressArray(string calldata toml, string calldata key)
        external
        pure
        returns (address[] memory);
    /// Parses a string of TOML data at `key` and coerces it to `string`.
    #[cheatcode(group = Toml)]
    function parseTomlString(string calldata toml, string calldata key) external pure returns (string memory);
    /// Parses a string of TOML data at `key` and coerces it to `string[]`.
    #[cheatcode(group = Toml)]
    function parseTomlStringArray(string calldata toml, string calldata key) external pure returns (string[] memory);
    /// Parses a string of TOML data at `key` and coerces it to `bytes`.
    #[cheatcode(group = Toml)]
    function parseTomlBytes(string calldata toml, string calldata key) external pure returns (bytes memory);
    /// Parses a string of TOML data at `key` and coerces it to `bytes[]`.
    #[cheatcode(group = Toml)]
    function parseTomlBytesArray(string calldata toml, string calldata key) external pure returns (bytes[] memory);
    /// Parses a string of TOML data at `key` and coerces it to `bytes32`.
    #[cheatcode(group = Toml)]
    function parseTomlBytes32(string calldata toml, string calldata key) external pure returns (bytes32);
    /// Parses a string of TOML data at `key` and coerces it to `bytes32[]`.
    #[cheatcode(group = Toml)]
    function parseTomlBytes32Array(string calldata toml, string calldata key)
        external
        pure
        returns (bytes32[] memory);

    /// Parses a string of TOML data and coerces it to type corresponding to `typeDescription`.
    #[cheatcode(group = Toml)]
    function parseTomlType(string calldata toml, string calldata typeDescription) external pure returns (bytes memory);
    /// Parses a string of TOML data at `key` and coerces it to type corresponding to `typeDescription`.
    #[cheatcode(group = Toml)]
    function parseTomlType(string calldata toml, string calldata key, string calldata typeDescription) external pure returns (bytes memory);
    /// Parses a string of TOML data at `key` and coerces it to type array corresponding to `typeDescription`.
    #[cheatcode(group = Toml)]
    function parseTomlTypeArray(string calldata toml, string calldata key, string calldata typeDescription)
        external
        pure
        returns (bytes memory);

    /// Returns an array of all the keys in a TOML table.
    #[cheatcode(group = Toml)]
    function parseTomlKeys(string calldata toml, string calldata key) external pure returns (string[] memory keys);

    // -------- Writing --------

    // NOTE: Please read https://book.getfoundry.sh/cheatcodes/write-toml to understand how
    // to use the TOML writing cheat.

    /// Takes serialized JSON, converts to TOML and write a serialized TOML to a file.
    #[cheatcode(group = Toml)]
    function writeToml(string calldata json, string calldata path) external;

    /// Takes serialized JSON, converts to TOML and write a serialized TOML table to an **existing** TOML file, replacing a value with key = <value_key.>
    /// This is useful to replace a specific value of a TOML file, without having to parse the entire thing.
    #[cheatcode(group = Toml)]
    function writeToml(string calldata json, string calldata path, string calldata valueKey) external;

    // ======== Cryptography ========

    // -------- Key Management --------

    /// Derives a private key from the name, labels the account with that name, and returns the wallet.
    #[cheatcode(group = Crypto)]
    function createWallet(string calldata walletLabel) external returns (Wallet memory wallet);

    /// Generates a wallet from the private key and returns the wallet.
    #[cheatcode(group = Crypto)]
    function createWallet(uint256 privateKey) external returns (Wallet memory wallet);

    /// Generates a wallet from the private key, labels the account with that name, and returns the wallet.
    #[cheatcode(group = Crypto)]
    function createWallet(uint256 privateKey, string calldata walletLabel) external returns (Wallet memory wallet);

    /// Signs data with a `Wallet`.
    #[cheatcode(group = Crypto)]
    function sign(Wallet calldata wallet, bytes32 digest) external returns (uint8 v, bytes32 r, bytes32 s);

    /// Signs data with a `Wallet`.
    ///
    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
    /// signature's `s` value, and the recovery id `v` in a single bytes32.
    /// This format reduces the signature size from 65 to 64 bytes.
    #[cheatcode(group = Crypto)]
    function signCompact(Wallet calldata wallet, bytes32 digest) external returns (bytes32 r, bytes32 vs);

    /// Signs `digest` with `privateKey` using the secp256k1 curve.
    #[cheatcode(group = Crypto)]
    function sign(uint256 privateKey, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);

    /// Signs `digest` with `privateKey` using the secp256k1 curve.
    ///
    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
    /// signature's `s` value, and the recovery id `v` in a single bytes32.
    /// This format reduces the signature size from 65 to 64 bytes.
    #[cheatcode(group = Crypto)]
    function signCompact(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);

    /// Signs `digest` with signer provided to script using the secp256k1 curve.
    ///
    /// If `--sender` is provided, the signer with provided address is used, otherwise,
    /// if exactly one signer is provided to the script, that signer is used.
    ///
    /// Raises error if signer passed through `--sender` does not match any unlocked signers or
    /// if `--sender` is not provided and not exactly one signer is passed to the script.
    #[cheatcode(group = Crypto)]
    function sign(bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);

    /// Signs `digest` with signer provided to script using the secp256k1 curve.
    ///
    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
    /// signature's `s` value, and the recovery id `v` in a single bytes32.
    /// This format reduces the signature size from 65 to 64 bytes.
    ///
    /// If `--sender` is provided, the signer with provided address is used, otherwise,
    /// if exactly one signer is provided to the script, that signer is used.
    ///
    /// Raises error if signer passed through `--sender` does not match any unlocked signers or
    /// if `--sender` is not provided and not exactly one signer is passed to the script.
    #[cheatcode(group = Crypto)]
    function signCompact(bytes32 digest) external pure returns (bytes32 r, bytes32 vs);

    /// Signs `digest` with signer provided to script using the secp256k1 curve.
    ///
    /// Raises error if none of the signers passed into the script have provided address.
    #[cheatcode(group = Crypto)]
    function sign(address signer, bytes32 digest) external pure returns (uint8 v, bytes32 r, bytes32 s);

    /// Signs `digest` with signer provided to script using the secp256k1 curve.
    ///
    /// Returns a compact signature (`r`, `vs`) as per EIP-2098, where `vs` encodes both the
    /// signature's `s` value, and the recovery id `v` in a single bytes32.
    /// This format reduces the signature size from 65 to 64 bytes.
    ///
    /// Raises error if none of the signers passed into the script have provided address.
    #[cheatcode(group = Crypto)]
    function signCompact(address signer, bytes32 digest) external pure returns (bytes32 r, bytes32 vs);

    /// Signs `digest` with `privateKey` using the secp256r1 curve.
    #[cheatcode(group = Crypto)]
    function signP256(uint256 privateKey, bytes32 digest) external pure returns (bytes32 r, bytes32 s);

    /// Derives secp256r1 public key from the provided `privateKey`.
    #[cheatcode(group = Crypto)]
    function publicKeyP256(uint256 privateKey) external pure returns (uint256 publicKeyX, uint256 publicKeyY);

    /// Derive a private key from a provided mnenomic string (or mnenomic file path)
    /// at the derivation path `m/44'/60'/0'/0/{index}`.
    #[cheatcode(group = Crypto)]
    function deriveKey(string calldata mnemonic, uint32 index) external pure returns (uint256 privateKey);
    /// Derive a private key from a provided mnenomic string (or mnenomic file path)
    /// at `{derivationPath}{index}`.
    #[cheatcode(group = Crypto)]
    function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index)
        external
        pure
        returns (uint256 privateKey);
    /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language
    /// at the derivation path `m/44'/60'/0'/0/{index}`.
    #[cheatcode(group = Crypto)]
    function deriveKey(string calldata mnemonic, uint32 index, string calldata language)
        external
        pure
        returns (uint256 privateKey);
    /// Derive a private key from a provided mnenomic string (or mnenomic file path) in the specified language
    /// at `{derivationPath}{index}`.
    #[cheatcode(group = Crypto)]
    function deriveKey(string calldata mnemonic, string calldata derivationPath, uint32 index, string calldata language)
        external
        pure
        returns (uint256 privateKey);

    /// Adds a private key to the local forge wallet and returns the address.
    #[cheatcode(group = Crypto)]
    function rememberKey(uint256 privateKey) external returns (address keyAddr);

    /// Derive a set number of wallets from a mnemonic at the derivation path `m/44'/60'/0'/0/{0..count}`.
    ///
    /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned.
    #[cheatcode(group = Crypto)]
    function rememberKeys(string calldata mnemonic, string calldata derivationPath, uint32 count) external returns (address[] memory keyAddrs);

    /// Derive a set number of wallets from a mnemonic in the specified language at the derivation path `m/44'/60'/0'/0/{0..count}`.
    ///
    /// The respective private keys are saved to the local forge wallet for later use and their addresses are returned.
    #[cheatcode(group = Crypto)]
    function rememberKeys(string calldata mnemonic, string calldata derivationPath, string calldata language, uint32 count)
        external
        returns (address[] memory keyAddrs);

    // -------- Uncategorized Utilities --------

    /// Labels an address in call traces.
    #[cheatcode(group = Utilities)]
    function label(address account, string calldata newLabel) external;

    /// Gets the label for the specified address.
    #[cheatcode(group = Utilities)]
    function getLabel(address account) external view returns (string memory currentLabel);

    /// Compute the address a contract will be deployed at for a given deployer address and nonce.
    #[cheatcode(group = Utilities)]
    function computeCreateAddress(address deployer, uint256 nonce) external pure returns (address);

    /// Compute the address of a contract created with CREATE2 using the given CREATE2 deployer.
    #[cheatcode(group = Utilities)]
    function computeCreate2Address(bytes32 salt, bytes32 initCodeHash, address deployer) external pure returns (address);

    /// Compute the address of a contract created with CREATE2 using the default CREATE2 deployer.
    #[cheatcode(group = Utilities)]
    function computeCreate2Address(bytes32 salt, bytes32 initCodeHash) external pure returns (address);

    /// Encodes a `bytes` value to a base64 string.
    #[cheatcode(group = Utilities)]
    function toBase64(bytes calldata data) external pure returns (string memory);

    /// Encodes a `string` value to a base64 string.
    #[cheatcode(group = Utilities)]
    function toBase64(string calldata data) external pure returns (string memory);

    /// Encodes a `bytes` value to a base64url string.
    #[cheatcode(group = Utilities)]
    function toBase64URL(bytes calldata data) external pure returns (string memory);

    /// Encodes a `string` value to a base64url string.
    #[cheatcode(group = Utilities)]
    function toBase64URL(string calldata data) external pure returns (string memory);

    /// Returns ENS namehash for provided string.
    #[cheatcode(group = Utilities)]
    function ensNamehash(string calldata name) external pure returns (bytes32);

    /// Returns a random uint256 value.
    #[cheatcode(group = Utilities)]
    function randomUint() external returns (uint256);

    /// Returns random uint256 value between the provided range (=min..=max).
    #[cheatcode(group = Utilities)]
    function randomUint(uint256 min, uint256 max) external returns (uint256);

    /// Returns a random `uint256` value of given bits.
    #[cheatcode(group = Utilities)]
    function randomUint(uint256 bits) external view returns (uint256);

    /// Returns a random `address`.
    #[cheatcode(group = Utilities)]
    function randomAddress() external returns (address);

    /// Returns a random `int256` value.
    #[cheatcode(group = Utilities)]
    function randomInt() external view returns (int256);

    /// Returns a random `int256` value of given bits.
    #[cheatcode(group = Utilities)]
    function randomInt(uint256 bits) external view returns (int256);

    /// Returns a random `bool`.
    #[cheatcode(group = Utilities)]
    function randomBool() external view returns (bool);

    /// Returns a random byte array value of the given length.
    #[cheatcode(group = Utilities)]
    function randomBytes(uint256 len) external view returns (bytes memory);

    /// Returns a random fixed-size byte array of length 4.
    #[cheatcode(group = Utilities)]
    function randomBytes4() external view returns (bytes4);

    /// Returns a random fixed-size byte array of length 8.
    #[cheatcode(group = Utilities)]
    function randomBytes8() external view returns (bytes8);

    /// Pauses collection of call traces. Useful in cases when you want to skip tracing of
    /// complex calls which are not useful for debugging.
    #[cheatcode(group = Utilities)]
    function pauseTracing() external view;

    /// Unpauses collection of call traces.
    #[cheatcode(group = Utilities)]
    function resumeTracing() external view;

    /// Utility cheatcode to copy storage of `from` contract to another `to` contract.
    #[cheatcode(group = Utilities)]
    function copyStorage(address from, address to) external;

    /// Utility cheatcode to set arbitrary storage for given target address.
    #[cheatcode(group = Utilities)]
    function setArbitraryStorage(address target) external;
}
}

impl PartialEq for ForgeContext {
    // Handles test group case (any of test, coverage or snapshot)
    // and script group case (any of dry run, broadcast or resume).
    fn eq(&self, other: &Self) -> bool {
        match (self, other) {
            (_, Self::TestGroup) => {
                matches!(self, Self::Test | Self::Snapshot | Self::Coverage)
            }
            (_, Self::ScriptGroup) => {
                matches!(self, Self::ScriptDryRun | Self::ScriptBroadcast | Self::ScriptResume)
            }
            (Self::Test, Self::Test) |
            (Self::Snapshot, Self::Snapshot) |
            (Self::Coverage, Self::Coverage) |
            (Self::ScriptDryRun, Self::ScriptDryRun) |
            (Self::ScriptBroadcast, Self::ScriptBroadcast) |
            (Self::ScriptResume, Self::ScriptResume) |
            (Self::Unknown, Self::Unknown) => true,
            _ => false,
        }
    }
}

impl fmt::Display for Vm::CheatcodeError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        self.message.fmt(f)
    }
}

impl fmt::Display for Vm::VmErrors {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::CheatcodeError(err) => err.fmt(f),
        }
    }
}

#[track_caller]
const fn panic_unknown_safety() -> ! {
    panic!("cannot determine safety from the group, add a `#[cheatcode(safety = ...)]` attribute")
}