2020-09-25 10:15:31 +00:00
|
|
|
bytes constant a = "\x03\x01\x02";
|
|
|
|
bytes constant b = hex"030102";
|
|
|
|
string constant c = "hello";
|
|
|
|
uint256 constant x = 56;
|
|
|
|
enum ActionChoices {GoLeft, GoRight, GoStraight, Sit}
|
2020-09-25 10:21:55 +00:00
|
|
|
ActionChoices constant choices = ActionChoices.GoRight;
|
2020-09-25 10:15:31 +00:00
|
|
|
bytes32 constant st = "abc\x00\xff__";
|
|
|
|
|
|
|
|
contract C {
|
|
|
|
function f() public returns (bytes memory) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
function g() public returns (bytes memory) {
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
function h() public returns (bytes memory) {
|
|
|
|
return bytes(c);
|
|
|
|
}
|
|
|
|
|
|
|
|
function i() public returns (uint, ActionChoices, bytes32) {
|
|
|
|
return (x, choices, st);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ====
|
2020-11-21 13:54:16 +00:00
|
|
|
// compileToEwasm: also
|
2021-03-12 23:02:36 +00:00
|
|
|
// compileViaYul: also
|
2020-09-25 10:15:31 +00:00
|
|
|
// ----
|
|
|
|
// f() -> 0x20, 3, "\x03\x01\x02"
|
|
|
|
// g() -> 0x20, 3, "\x03\x01\x02"
|
|
|
|
// h() -> 0x20, 5, "hello"
|
2020-09-25 10:21:55 +00:00
|
|
|
// i() -> 0x38, 1, 0x61626300ff5f5f00000000000000000000000000000000000000000000000000
|