ABI encoding functions are pure and should be usable in constants.

This commit is contained in:
chriseth
2018-05-15 14:45:54 +02:00
parent dce6224052
commit dac0029d16
5 changed files with 18 additions and 3 deletions
@@ -0,0 +1,7 @@
contract C {
bytes32 constant a = keccak256(abi.encode(1, 2));
bytes32 constant b = keccak256(abi.encodePacked(uint(1), a));
bytes32 constant c = keccak256(abi.encodeWithSelector(0x12345678, b, 2));
bytes32 constant d = keccak256(abi.encodeWithSignature("f()", 1, 2));
}
// ----