Skip to content

Instantly share code, notes, and snippets.

@Philogy
Created January 16, 2024 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Philogy/90e0a294b2587162ab14027c8f2fe14a to your computer and use it in GitHub Desktop.
Save Philogy/90e0a294b2587162ab14027c8f2fe14a to your computer and use it in GitHub Desktop.
Unable to deploy because of simulation script
// 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