-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REVM: Support cheatcodes in
setUp
(#997)
* fix: support cheatcodes in `setUp` * fix: subtract stipend without panic * chore: rename test * fix: set tx gas price to block basefee * fix: use `CALLER` for `is_success` check * chore: remove duplicate clap attribute * fix: set chain id correctly in fork mode * fix: separate evm block env from execution env * chore: clippy * refactor: block override without `block_env` fn
- Loading branch information
Showing
10 changed files
with
125 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Unlicense | ||
pragma solidity >=0.8.0; | ||
|
||
import "ds-test/test.sol"; | ||
import "./Cheats.sol"; | ||
|
||
contract CheatsSetupTest is DSTest { | ||
Cheats constant cheats = Cheats(HEVM_ADDRESS); | ||
|
||
function setUp() public { | ||
cheats.warp(10); | ||
cheats.roll(100); | ||
cheats.fee(1000); | ||
} | ||
|
||
function testCheatEnvironment() public { | ||
assertEq(block.timestamp, 10, "block timestamp was not persisted from setup"); | ||
assertEq(block.number, 100, "block number was not persisted from setup"); | ||
assertEq(block.basefee, 1000, "basefee was not persisted from setup"); | ||
} | ||
} |