Skip to content

Commit 0e77914

Browse files
committed
refactor(cheatcodes): improve overview page and remove category index pages
- Remove cheatcode category index pages (environment, assertions, etc.) - Add redirects for removed pages to overview - Update sidebar to remove links from category headers - Replace overview page content with Cards component - Add search hint tip - Remove Vm.sol generation (no longer embedded, now links to GitHub) - Streamline Forge Std and Contributing sections
1 parent f330a68 commit 0e77914

File tree

14 files changed

+77
-2659
lines changed

14 files changed

+77
-2659
lines changed

scripts/gen_output.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ source "$SCRIPTS/gen_output/cast.sh"
77
source "$SCRIPTS/gen_output/chisel.sh"
88
source "$SCRIPTS/gen_output/forge.sh"
99
source "$SCRIPTS/gen_output/help.sh"
10-
source "$SCRIPTS/gen_output/vm.sh"
11-
1210
need_cmd git
1311
need_cmd mktemp
1412
need_cmd sed
@@ -22,4 +20,3 @@ gen_help
2220
gen_cast
2321
gen_chisel
2422
gen_forge
25-
gen_vm

scripts/gen_output/vm.sh

Lines changed: 0 additions & 15 deletions
This file was deleted.

sidebar/cmd-reference.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export const cmdReference: SidebarItem[] = [
44
{ text: 'Overview', link: '/reference/cheatcodes/overview'},
55
{
66
text: 'Environment',
7-
link: '/reference/cheatcodes/environment',
87
collapsed: true,
98
items: [
109
{ text: 'warp', link: '/reference/cheatcodes/warp' },
@@ -51,7 +50,6 @@ export const cmdReference: SidebarItem[] = [
5150
},
5251
{
5352
text: 'Assertions',
54-
link: '/reference/cheatcodes/assertions',
5553
collapsed: true,
5654
items: [
5755
{ text: 'expectRevert', link: '/reference/cheatcodes/expect-revert' },
@@ -61,7 +59,6 @@ export const cmdReference: SidebarItem[] = [
6159
},
6260
{
6361
text: 'Fuzzer',
64-
link: '/reference/cheatcodes/fuzzer',
6562
collapsed: true,
6663
items: [
6764
{ text: 'assume', link: '/reference/cheatcodes/assume' },
@@ -70,7 +67,6 @@ export const cmdReference: SidebarItem[] = [
7067
},
7168
{
7269
text: 'Forking',
73-
link: '/reference/cheatcodes/forking',
7470
collapsed: true,
7571
items: [
7672
{ text: 'createFork', link: '/reference/cheatcodes/create-fork' },
@@ -87,7 +83,6 @@ export const cmdReference: SidebarItem[] = [
8783
},
8884
{
8985
text: 'External',
90-
link: '/reference/cheatcodes/external',
9186
collapsed: true,
9287
items: [
9388
{ text: 'ffi', link: '/reference/cheatcodes/ffi' },
@@ -120,7 +115,6 @@ export const cmdReference: SidebarItem[] = [
120115
},
121116
{
122117
text: 'Signing',
123-
link: '/reference/cheatcodes/signing',
124118
collapsed: true,
125119
items: [
126120
{ text: 'sign', link: '/reference/cheatcodes/sign' },
@@ -129,7 +123,6 @@ export const cmdReference: SidebarItem[] = [
129123
},
130124
{
131125
text: 'Utilities',
132-
link: '/reference/cheatcodes/utilities',
133126
collapsed: true,
134127
items: [
135128
{ text: 'addr', link: '/reference/cheatcodes/addr' },

src/pages.gen.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ type Page =
158158
| { path: '/reference/cheatcodes/active-fork'; render: 'static' }
159159
| { path: '/reference/cheatcodes/addr'; render: 'static' }
160160
| { path: '/reference/cheatcodes/allow-cheatcodes'; render: 'static' }
161-
| { path: '/reference/cheatcodes/assertions'; render: 'static' }
162161
| { path: '/reference/cheatcodes/assume-no-revert'; render: 'static' }
163162
| { path: '/reference/cheatcodes/assume'; render: 'static' }
164163
| { path: '/reference/cheatcodes/breakpoint'; render: 'static' }
@@ -181,17 +180,13 @@ type Page =
181180
| { path: '/reference/cheatcodes/env-or'; render: 'static' }
182181
| { path: '/reference/cheatcodes/env-string'; render: 'static' }
183182
| { path: '/reference/cheatcodes/env-uint'; render: 'static' }
184-
| { path: '/reference/cheatcodes/environment'; render: 'static' }
185183
| { path: '/reference/cheatcodes/etch'; render: 'static' }
186184
| { path: '/reference/cheatcodes/expect-call'; render: 'static' }
187185
| { path: '/reference/cheatcodes/expect-emit'; render: 'static' }
188186
| { path: '/reference/cheatcodes/expect-revert'; render: 'static' }
189-
| { path: '/reference/cheatcodes/external'; render: 'static' }
190187
| { path: '/reference/cheatcodes/fee'; render: 'static' }
191188
| { path: '/reference/cheatcodes/ffi'; render: 'static' }
192-
| { path: '/reference/cheatcodes/forking'; render: 'static' }
193189
| { path: '/reference/cheatcodes/fs'; render: 'static' }
194-
| { path: '/reference/cheatcodes/fuzzer'; render: 'static' }
195190
| { path: '/reference/cheatcodes/gas-snapshots'; render: 'static' }
196191
| { path: '/reference/cheatcodes/get-block-number'; render: 'static' }
197192
| { path: '/reference/cheatcodes/get-block-timestamp'; render: 'static' }
@@ -245,7 +240,6 @@ type Page =
245240
| { path: '/reference/cheatcodes/set-nonce'; render: 'static' }
246241
| { path: '/reference/cheatcodes/sign-delegation'; render: 'static' }
247242
| { path: '/reference/cheatcodes/sign'; render: 'static' }
248-
| { path: '/reference/cheatcodes/signing'; render: 'static' }
249243
| { path: '/reference/cheatcodes/skip'; render: 'static' }
250244
| { path: '/reference/cheatcodes/sleep'; render: 'static' }
251245
| { path: '/reference/cheatcodes/start-broadcast'; render: 'static' }
@@ -260,7 +254,6 @@ type Page =
260254
| { path: '/reference/cheatcodes/transact'; render: 'static' }
261255
| { path: '/reference/cheatcodes/tx-gas-price'; render: 'static' }
262256
| { path: '/reference/cheatcodes/unix-time'; render: 'static' }
263-
| { path: '/reference/cheatcodes/utilities'; render: 'static' }
264257
| { path: '/reference/cheatcodes/warp'; render: 'static' }
265258
| { path: '/reference/cheatcodes/write-json'; render: 'static' }
266259
| { path: '/reference/cheatcodes/write-toml'; render: 'static' }

src/pages/reference/cheatcodes/assertions.mdx

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/pages/reference/cheatcodes/environment.mdx

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/pages/reference/cheatcodes/external.mdx

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/pages/reference/cheatcodes/forking.mdx

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/pages/reference/cheatcodes/fuzzer.mdx

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 69 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
import { Cards, Card } from 'vocs'
2+
13
## Cheatcodes Reference
24

35
Cheatcodes give you powerful assertions, the ability to alter the state of the EVM, mock data, and more.
46

57
Cheatcodes are made available through use of the cheatcode address (`0x7109709ECfa91a80626fF3989D68f67F5b1DD12D`).
68

9+
:::tip[Finding Cheatcodes]
10+
Use the sidebar to browse cheatcodes by category, or press `Ctrl+K` / `Cmd+K` to search for a specific cheatcode.
11+
:::
12+
713
:::note
814
If you encounter errors for this address when using fuzzed addresses in your tests, you may wish to
915
exclude it from your fuzz tests by using the following line:
@@ -16,35 +22,69 @@ exclude it from your fuzz tests by using the following line:
1622

1723
You can also access cheatcodes easily via `vm` available in Forge Standard Library's [`Test`](/reference/forge-std/overview) contract.
1824

19-
### Forge Standard Library Cheatcodes
20-
21-
Forge Std implements wrappers around cheatcodes, which combine multiple standard cheatcodes to improve development experience. These are not technically cheatcodes, but rather compositions of Forge's cheatcodes.
22-
23-
You can view the list of Forge Standard Library's cheatcode wrappers [in the references section](/reference/forge-std/std-cheats.mdx). You can reference the [Forge Std source code](https://github.com/foundry-rs/forge-std/blob/master/src/Test.sol) to learn more about how the wrappers work under the hood.
24-
25-
### Cheatcode Types
26-
27-
Below are some subsections for the different Forge cheatcodes.
28-
29-
- [Environment](/reference/cheatcodes/environment.mdx): Cheatcodes that alter the state of the EVM.
30-
- [Assertions](/reference/cheatcodes/assertions.mdx): Cheatcodes that are powerful assertions
31-
- [Fuzzer](/reference/cheatcodes/fuzzer.mdx): Cheatcodes that configure the fuzzer
32-
- [External](/reference/cheatcodes/external.mdx): Cheatcodes that interact with external state (files, commands, ...)
33-
- [Signing](/reference/cheatcodes/signing.mdx): Cheatcodes for signing
34-
- [Utilities](/reference/cheatcodes/utilities.mdx): Smaller utility cheatcodes
35-
- [Forking](/reference/cheatcodes/forking.mdx): Forking mode cheatcodes
36-
- [State snapshots](/reference/cheatcodes/state-snapshots.mdx): State snapshot cheatcodes
37-
- [RPC](/reference/cheatcodes/rpc.mdx): RPC related cheatcodes
38-
- [File](/reference/cheatcodes/fs.mdx): Cheatcodes for working with files
39-
40-
### Add a new cheatcode
41-
42-
If you need a new feature, consider [contributing to the Foundry's codebase](https://github.com/foundry-rs/foundry) to add the cheatcode.
25+
### Cheatcode Categories
26+
27+
<Cards>
28+
<Card
29+
title="Environment"
30+
description="Manipulate the EVM state: block timestamp, number, msg.sender, storage, balances, and more."
31+
to="/reference/cheatcodes/warp"
32+
/>
33+
<Card
34+
title="Assertions"
35+
description="Expect reverts, events, and calls in your tests."
36+
to="/reference/cheatcodes/expect-revert"
37+
/>
38+
<Card
39+
title="Fuzzer"
40+
description="Control fuzzer behavior with assumptions and constraints."
41+
to="/reference/cheatcodes/assume"
42+
/>
43+
<Card
44+
title="Forking"
45+
description="Create and manage forks of live networks."
46+
to="/reference/cheatcodes/create-fork"
47+
/>
48+
<Card
49+
title="External"
50+
description="Interact with the outside world: run commands, read environment variables, parse JSON/TOML."
51+
to="/reference/cheatcodes/ffi"
52+
/>
53+
<Card
54+
title="Signing"
55+
description="Sign messages and EIP-7702 delegations."
56+
to="/reference/cheatcodes/sign"
57+
/>
58+
<Card
59+
title="Utilities"
60+
description="Helper functions for addresses, labels, parsing, and wallets."
61+
to="/reference/cheatcodes/addr"
62+
/>
63+
<Card
64+
title="Files"
65+
description="Read and write files from your tests and scripts."
66+
to="/reference/cheatcodes/fs"
67+
/>
68+
<Card
69+
title="RPC"
70+
description="Register and interact with RPC endpoints."
71+
to="/reference/cheatcodes/rpc"
72+
/>
73+
<Card
74+
title="State Snapshots"
75+
description="Snapshot and restore EVM state."
76+
to="/reference/cheatcodes/state-snapshots"
77+
/>
78+
</Cards>
79+
80+
### Forge Standard Library
81+
82+
Forge Std implements wrappers around cheatcodes, which combine multiple standard cheatcodes to improve development experience. See [Std Cheats](/reference/forge-std/std-cheats) for more details.
83+
84+
### Contributing
85+
86+
If you need a new cheatcode, consider [contributing to the Foundry codebase](https://github.com/foundry-rs/foundry).
4387

4488
### Cheatcodes Interface
4589

46-
This is a Solidity interface for all of the cheatcodes present in Forge.
47-
48-
```solidity
49-
// [!include ~/snippets/output/vm/Vm.sol]
50-
```
90+
The complete Solidity interface for all cheatcodes is available in the [forge-std repository](https://github.com/foundry-rs/forge-std/blob/master/src/Vm.sol).

0 commit comments

Comments
 (0)