Skip to content

Instantly share code, notes, and snippets.

@thatguyintech
Created January 26, 2022 08:38
Show Gist options
  • Save thatguyintech/e9b7f0c972aaba0a427858fdc991853d to your computer and use it in GitHub Desktop.
Save thatguyintech/e9b7f0c972aaba0a427858fdc991853d to your computer and use it in GitHub Desktop.
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract GasLimits {
constructor() {}
function burnGas(uint256 gas) public view returns (uint256) {
uint256 endGas = gasleft() - gas;
while (gasleft() > endGas) {}
return gasleft();
}
function getGasLimit() public view returns (uint256) {
return gasleft();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment