Created
January 16, 2024 21:25
-
-
Save Philogy/90e0a294b2587162ab14027c8f2fe14a to your computer and use it in GitHub Desktop.
Unable to deploy because of simulation script
This file contains hidden or 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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.20; | |
import {Script} from "forge-std/Script.sol"; | |
import {Test} from "forge-std/Test.sol"; | |
import {console2 as console} from "forge-std/console2.sol"; | |
contract Counter { | |
uint256 public count; | |
constructor(uint startCount) { count = startCount;} | |
function inc() external { | |
uint256 preGas = gasleft(); | |
count++; | |
uint256 afterGas = gasleft(); | |
require(preGas - afterGas > 5000, "count warm"); | |
} | |
} | |
/// @author philogy <https://github.com/philogy> | |
contract BrokenScript is Test, Script { | |
function run() public { | |
vm.startBroadcast(); | |
Counter c = new Counter(1); | |
c.inc(); | |
vm.stopBroadcast(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment