Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Jun 19, 2023
1 parent ac28fae commit 0244cae
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/cli/src/commands/gas-report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ import stripAnsi from "strip-ansi";

/**
* Print the gas report to the console, save it to a file and compare it to a previous gas report if provided.
* Requires forge to be installed, and gas test files including `// !gasreport` comments, like this:
*
* Requires foundry to be installed. Inherit from GasReporter and use startGasReport/endGasReport to measure gas used.
*
* ```solidity
* contract GasTest is DSTestPlus {
* contract MyContractTest is Test, GasReporter {
* function testBuffer() public pure {
* // !gasreport allocate a buffer
* startGasReport("allocate a buffer");
* Buffer buffer = Buffer_.allocate(32);
* endGasReport();
*
* bytes32 value = keccak256("some data");
*
* // !gasreport append 32 bytes to a buffer
* startGasReport("append 32 bytes to a buffer");
* buffer.append(value);
* endGasReport();
* }
* }
* ```
Expand Down

0 comments on commit 0244cae

Please sign in to comment.