function foo() public {
uint256 initialGas = gasleft();
/*
Your function logic here
*/
uint256 gasUsed = initialGas - gasleft();
uint256 gasPrice = tx.gasprice;
emit GasUsed(gasUsed, gasPrice);
}
Last active
August 2, 2024 12:05
-
-
Save ammarhaiderak/88971810b97b9fe557dcb25af13d6e3d to your computer and use it in GitHub Desktop.
Solidity Cheatsheet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment