2018-03-21 17:38:06 +00:00
|
|
|
contract C {
|
|
|
|
uint x;
|
|
|
|
function gView() public view returns (uint) { return x; }
|
|
|
|
function gNonPayable() public returns (uint) { x = 4; return 0; }
|
|
|
|
|
2018-07-12 01:24:50 +00:00
|
|
|
function f1() view public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encode(gView());
|
|
|
|
}
|
2018-07-12 01:24:50 +00:00
|
|
|
function f2() view public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encodePacked(gView());
|
|
|
|
}
|
2018-07-12 01:24:50 +00:00
|
|
|
function f3() view public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encodeWithSelector(0x12345678, gView());
|
|
|
|
}
|
2018-07-12 01:24:50 +00:00
|
|
|
function f4() view public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encodeWithSignature("f(uint256)", gView());
|
|
|
|
}
|
2018-07-12 01:24:50 +00:00
|
|
|
function g1() public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encode(gNonPayable());
|
|
|
|
}
|
2018-07-12 01:24:50 +00:00
|
|
|
function g2() public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encodePacked(gNonPayable());
|
|
|
|
}
|
2018-07-12 01:24:50 +00:00
|
|
|
function g3() public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encodeWithSelector(0x12345678, gNonPayable());
|
|
|
|
}
|
2018-07-12 01:24:50 +00:00
|
|
|
function g4() public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encodeWithSignature("f(uint256)", gNonPayable());
|
|
|
|
}
|
|
|
|
// This will generate the only warning.
|
2018-07-12 01:24:50 +00:00
|
|
|
function check() public returns (bytes memory) {
|
2018-03-21 17:38:06 +00:00
|
|
|
return abi.encode(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// ----
|
2018-07-12 01:24:50 +00:00
|
|
|
// Warning: (1100-1184): Function state mutability can be restricted to pure
|