Skip to content

Commit c354d9d

Browse files
authored
Update create-wallet.md (#1338)
The guidance provided by the foundry book informs us to setup our tests via ``` contract MyTest is Test { ... } ``` However, given the inheritance and import structures of `forge-std/Test.sol`, the documentation to create a wallet produces the following error: ``` Compiler run failed: Error (7920): Identifier not found or not unique. --> test/MyTest.t.sol:86:5: | 86 | Wallet memory _w = vm.createWallet(100); | ^^^^^^ Error: ``` Instead, in order to store the result returned by `vm.createWallet`, I had to reference the `Wallet` type through the `Vm` interface, like so: ``` Vm.Wallet memory _w = vm.createWallet(100); ```
1 parent 4317603 commit c354d9d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cheatcodes/create-wallet.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Creates a new Wallet struct when given a parameter to derive the private key fro
3636
#### `uint256`
3737

3838
```solidity
39-
Wallet memory wallet = vm.createWallet(uint256(keccak256(bytes("1"))));
39+
Vm.Wallet memory wallet = vm.createWallet(uint256(keccak256(bytes("1"))));
4040
4141
emit log_uint(wallet.privateKey); // uint256(keccak256(bytes("1")))
4242
@@ -58,7 +58,7 @@ emit log_string(vm.getLabel(wallet.addr)); // ""
5858
#### `string`
5959

6060
```solidity
61-
Wallet memory wallet = vm.createWallet("bob's wallet");
61+
Vm.Wallet memory wallet = vm.createWallet("bob's wallet");
6262
6363
emit log_uint(wallet.privateKey); // uint256(keccak256(bytes("bob's wallet")))
6464
@@ -80,7 +80,7 @@ emit log_string(vm.getLabel(wallet.addr)); // "bob's wallet"
8080
#### `uint256` and `string`
8181

8282
```solidity
83-
Wallet memory wallet = vm.createWallet(uint256(keccak256(bytes("1"))), "bob's wallet");
83+
Vm.Wallet memory wallet = vm.createWallet(uint256(keccak256(bytes("1"))), "bob's wallet");
8484
8585
emit log_uint(wallet.privateKey); // uint256(keccak256(bytes("1")))
8686

0 commit comments

Comments
 (0)