From dac0029d16ffe31fba2e6241f99893ea9a26926e Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 15 May 2018 13:04:49 +0200 Subject: ABI encoding functions are pure and should be usable in constants. --- test/libsolidity/syntaxTests/constants/abi_encoding_constant.sol | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/libsolidity/syntaxTests/constants/abi_encoding_constant.sol (limited to 'test/libsolidity/syntaxTests/constants') diff --git a/test/libsolidity/syntaxTests/constants/abi_encoding_constant.sol b/test/libsolidity/syntaxTests/constants/abi_encoding_constant.sol new file mode 100644 index 00000000..dd6968a0 --- /dev/null +++ b/test/libsolidity/syntaxTests/constants/abi_encoding_constant.sol @@ -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)); +} +// ---- -- cgit