2021-11-11 15:21:23 +00:00
|
|
|
interface I {
|
|
|
|
function fExternal(uint256 p, string memory t) external;
|
|
|
|
}
|
|
|
|
|
2021-12-20 18:30:53 +00:00
|
|
|
contract Other {
|
|
|
|
function fExternal(uint) external pure {}
|
|
|
|
function fPublic(uint) public pure {}
|
|
|
|
function fInternal(uint) internal pure {}
|
|
|
|
}
|
|
|
|
|
2021-11-11 15:21:23 +00:00
|
|
|
library L {
|
|
|
|
function fExternal(uint256 p, string memory t) external {}
|
2021-12-20 18:30:53 +00:00
|
|
|
function fInternal(uint256 p, string memory t) internal {}
|
2021-11-11 15:21:23 +00:00
|
|
|
}
|
|
|
|
|
2021-12-20 18:30:53 +00:00
|
|
|
contract Base {
|
|
|
|
function baseFunctionExternal(uint) external pure {}
|
|
|
|
}
|
2021-11-11 15:21:23 +00:00
|
|
|
|
2021-12-20 18:30:53 +00:00
|
|
|
contract C is Base {
|
2021-11-11 15:21:23 +00:00
|
|
|
function f(int a) public {}
|
|
|
|
function f2(int a, string memory b) public {}
|
|
|
|
function f4() public {}
|
|
|
|
|
2021-12-20 18:30:53 +00:00
|
|
|
function successFunctionArgsIntLiteralTuple() public view returns(bytes memory) {
|
2021-11-11 15:21:23 +00:00
|
|
|
return abi.encodeCall(this.f, (1));
|
|
|
|
}
|
2021-12-20 18:30:53 +00:00
|
|
|
function successFunctionArgsIntLiteral() public view returns(bytes memory) {
|
2021-11-11 15:21:23 +00:00
|
|
|
return abi.encodeCall(this.f, 1);
|
|
|
|
}
|
2021-12-20 18:30:53 +00:00
|
|
|
function successFunctionArgsLiteralTuple() public view returns(bytes memory) {
|
2021-11-11 15:21:23 +00:00
|
|
|
return abi.encodeCall(this.f2, (1, "test"));
|
|
|
|
}
|
2021-12-20 18:30:53 +00:00
|
|
|
function successFunctionArgsEmptyTuple() public view returns(bytes memory) {
|
2021-11-11 15:21:23 +00:00
|
|
|
return abi.encodeCall(this.f4, ());
|
|
|
|
}
|
2021-12-20 18:30:53 +00:00
|
|
|
function viaDeclaration() public pure returns (bytes memory) {
|
|
|
|
return bytes.concat(
|
|
|
|
abi.encodeCall(Other.fExternal, (1)),
|
|
|
|
abi.encodeCall(Other.fPublic, (1)),
|
|
|
|
abi.encodeCall(I.fExternal, (1, "123"))
|
|
|
|
);
|
|
|
|
}
|
|
|
|
function viaBaseDeclaration() public pure returns (bytes memory) {
|
|
|
|
return abi.encodeCall(Base.baseFunctionExternal, (1));
|
|
|
|
}
|
2021-11-11 15:21:23 +00:00
|
|
|
}
|
|
|
|
// ----
|