Skip to content

Instantly share code, notes, and snippets.

@zac-williamson
Created December 22, 2021 10:07
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 zac-williamson/dfbbfc9bf0013e5b7432fa5c238293a4 to your computer and use it in GitHub Desktop.
Save zac-williamson/dfbbfc9bf0013e5b7432fa5c238293a4 to your computer and use it in GitHub Desktop.
Expensive constants
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Test {
bytes32 private constant CONST = keccak256(abi.encodePacked("Hello World"));
function bar() public pure returns (bytes32) {
return CONST;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment