-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
contract TestCheatcodes { | ||
address constant CHEATCODE_ADDRESS = | ||
0x7109709ECfa91a80626fF3989D68f67F5b1DD12D; | ||
|
||
function deal() external { | ||
(bool success, ) = CHEATCODE_ADDRESS.call( | ||
abi.encodeWithSignature("deal(address,uint)", msg.sender, 1_000_000) | ||
); | ||
require(success, "deal failed"); | ||
} | ||
|
||
function testDeal(address account) external { | ||
uint balanceBefore = address(account).balance; | ||
(bool success, ) = CHEATCODE_ADDRESS.call( | ||
abi.encodeWithSignature("deal(address,uint)", account, 1_000_000) | ||
); | ||
require(success, "deal failed"); | ||
uint balanceAfter = address(account).balance; | ||
require(balanceAfter == balanceBefore + 1_000_000, "balance mismatch"); | ||
} | ||
} |
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