Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/cheatcodes/get-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ assembly {
vm.etch(targetAddr, deployed.code);
```


### Supported formats

You can fetch artifacts by either contract path or contract name. Fetching artifacts for a specific version is also supported. If not provided, cheatcode will default to the version of a test being executed or the only version artifact was compiled with.
```solidity
vm.getCode("MyContract.sol:MyContract");
vm.getCode("MyContract");
vm.getCode("MyContract.sol:0.8.18");
vm.getCode("MyContract:0.8.18");
```

### SEE ALSO

[`getDeployedCode`](./get-deployed-code.md)
Expand Down
11 changes: 11 additions & 0 deletions src/cheatcodes/get-deployed-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ vm.etch(overrideAddress, code);
assertEq(overrideAddress.code, code);
```

### Supported formats

You can fetch artifacts by either contract path or contract name. Fetching artifacts for a specific version is also supported. If not provided, cheatcode will default to the version of a test being executed or the only version artifact was compiled with.
```solidity
vm.getDeployedCode("MyContract.sol:MyContract");
vm.getDeployedCode("MyContract");
vm.getDeployedCode("MyContract.sol:0.8.18");
vm.getDeployedCode("MyContract:0.8.18");
```


### SEE ALSO

Forge Standard Library
Expand Down