Skip to content

Commit 410c817

Browse files
feat(forge): add createWallet() cheat code for new Wallet struct (foundry-rs#5332)
* chore: add Wallet struct and other relevant functions to 'HEVM.sol' * feat: add 'HEVMCalls::GetNonce0' to env utils for Wallet, rename 'GetNonce' to 'GetNonce1' * feat: add CreateWallet/Sign to HEVM match in cheat utils * chore: add Wallet struct and other relevant functions to 'Cheats.sol' * test: add tests for 'createWallet' in Wallet.t.sol * test: add tests for getNonce/sign in Wallet.t.sol * chore: remove 'unwrap' after 'create_wallet' calls * style: forge fmt 'testdata/cheats/Wallet.t.sol' * test: add x & y to addr check to Wallet.t.sol * chore: rename 'cheats' to 'vm' in Wallet.t.sol * test: change pkSeed to uint256 to check whole private key range * Add 'bound' func, remove 'vm.assume(pk != 0)' * docs: add doc comments surrounding 'create_wallet'
1 parent 93ebcdd commit 410c817

File tree

6 files changed

+709
-25
lines changed

6 files changed

+709
-25
lines changed

crates/abi/abi/HEVM.sol

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ struct Log { bytes32[] topics; bytes data; }
22
struct Rpc { string name; string url; }
33
struct DirEntry { string errorMessage; string path; uint64 depth; bool isDir; bool isSymlink; }
44
struct FsMetadata { bool isDir; bool isSymlink; uint256 length; bool readOnly; uint256 modified; uint256 accessed; uint256 created; }
5+
struct Wallet { address addr; uint256 publicKeyX; uint256 publicKeyY; uint256 privateKey; }
56

67
allowCheatcodes(address)
78

@@ -57,6 +58,12 @@ deriveKey(string,uint32,string)(uint256)
5758
deriveKey(string,string,uint32,string)(uint256)
5859
rememberKey(uint256)(address)
5960

61+
createWallet(string)(Wallet)
62+
createWallet(uint256)(Wallet)
63+
createWallet(uint256,string)(Wallet)
64+
sign(Wallet,bytes32)(uint8,bytes32,bytes32)
65+
getNonce(Wallet)(uint64)
66+
6067
prank(address)
6168
prank(address,address)
6269
readCallers()(uint256,address,address)

0 commit comments

Comments
 (0)