solidity/test/libsolidity/semanticTests/abiencodedecode/abi_encode_call_uint_bytes.sol

21 lines
805 B
Solidity
Raw Normal View History

2022-03-10 18:05:32 +00:00
contract C {
2022-03-10 18:05:51 +00:00
function removeSignature(bytes calldata x) external pure returns (bytes memory) {
return x[4:];
2022-03-10 18:05:32 +00:00
}
2022-03-10 18:05:51 +00:00
function g(bytes2, bytes2, bytes2) public {}
2022-03-10 18:05:32 +00:00
function h(uint16, uint16) public {}
function f() public returns (bytes memory) {
uint16 x = 0x1234;
2022-03-10 18:05:51 +00:00
return this.removeSignature(abi.encodeCall(this.g, (0x1234, "ab", bytes2(x))));
2022-03-10 18:05:32 +00:00
}
function f2() public returns (bytes memory) {
bytes2 x = 0x1234;
2022-03-10 18:05:51 +00:00
return this.removeSignature(abi.encodeCall(this.h, (0x1234, uint16(x))));
2022-03-10 18:05:32 +00:00
}
}
// ====
2022-03-10 18:05:51 +00:00
// EVMVersion: >homestead
2022-03-10 18:05:32 +00:00
// ----
2022-03-10 18:05:51 +00:00
// f() -> 0x20, 0x60, 0x1234000000000000000000000000000000000000000000000000000000000000, 0x6162000000000000000000000000000000000000000000000000000000000000, 0x1234000000000000000000000000000000000000000000000000000000000000
2022-03-10 18:05:32 +00:00
// f2() -> 0x20, 0x40, 0x1234, 0x1234