2019-07-21 14:58:48 +00:00
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
|
2019-02-06 11:10:48 +00:00
|
|
|
contract C {
|
2019-07-21 14:58:48 +00:00
|
|
|
struct S {
|
|
|
|
uint a;
|
|
|
|
uint b;
|
|
|
|
}
|
|
|
|
struct T {
|
|
|
|
uint a;
|
|
|
|
uint b;
|
|
|
|
string s;
|
|
|
|
}
|
2019-05-15 10:01:14 +00:00
|
|
|
uint public state = 0;
|
2019-07-21 14:58:48 +00:00
|
|
|
bool[2][] flags;
|
2019-07-13 10:33:28 +00:00
|
|
|
constructor(uint _state) public payable {
|
2019-05-15 10:01:14 +00:00
|
|
|
state = _state;
|
|
|
|
}
|
2019-07-13 10:33:28 +00:00
|
|
|
function balance() payable public returns (uint256) {
|
|
|
|
return address(this).balance;
|
|
|
|
}
|
2019-07-13 11:31:55 +00:00
|
|
|
function e(uint a) public {
|
|
|
|
state = a;
|
|
|
|
}
|
2019-04-11 18:25:20 +00:00
|
|
|
function f() payable public returns (uint) {
|
2019-02-28 13:16:16 +00:00
|
|
|
return 2;
|
2019-02-06 11:10:48 +00:00
|
|
|
}
|
2019-07-21 14:58:48 +00:00
|
|
|
function f(uint a) public returns (uint, uint) {
|
|
|
|
return (a, a);
|
|
|
|
}
|
2019-04-11 18:25:20 +00:00
|
|
|
function g() public returns (uint, uint) {
|
|
|
|
return (2, 3);
|
2019-02-06 11:10:48 +00:00
|
|
|
}
|
2019-04-11 18:25:20 +00:00
|
|
|
function h(uint x, uint y) public returns (uint) {
|
|
|
|
return x - y;
|
2019-02-21 00:13:14 +00:00
|
|
|
}
|
2019-02-28 13:16:16 +00:00
|
|
|
function j(bool b) public returns (bool) {
|
2019-02-21 22:25:12 +00:00
|
|
|
return !b;
|
|
|
|
}
|
2019-04-11 18:25:20 +00:00
|
|
|
function k(bytes32 b) public returns (bytes32, bytes32) {
|
|
|
|
return (b, b);
|
2019-02-28 13:16:16 +00:00
|
|
|
}
|
2019-04-11 18:25:20 +00:00
|
|
|
function l() public returns (uint256) {
|
2019-02-25 17:10:09 +00:00
|
|
|
return msg.data.length;
|
|
|
|
}
|
2019-04-11 18:25:20 +00:00
|
|
|
function m(bytes memory b) public returns (bytes memory) {
|
|
|
|
return b;
|
|
|
|
}
|
2019-05-06 08:08:10 +00:00
|
|
|
function n() public returns (string memory) {
|
|
|
|
return "any";
|
|
|
|
}
|
|
|
|
function o() public returns (string memory, string memory) {
|
|
|
|
return ("any", "any");
|
|
|
|
}
|
|
|
|
function p() public returns (string memory, uint, string memory) {
|
|
|
|
return ("any", 42, "any");
|
|
|
|
}
|
2019-06-04 07:35:57 +00:00
|
|
|
function q(uint a) public returns (uint d) {
|
|
|
|
return a * 7;
|
|
|
|
}
|
2019-07-21 14:58:48 +00:00
|
|
|
function r() public returns (bool[3] memory) {
|
|
|
|
return [true, false, true];
|
|
|
|
}
|
|
|
|
function s() public returns (uint[2] memory, uint) {
|
|
|
|
return ([uint(123), 456], 789);
|
|
|
|
}
|
|
|
|
function t1() public returns (S memory) {
|
|
|
|
return S(23, 42);
|
|
|
|
}
|
|
|
|
function t2() public returns (T memory) {
|
|
|
|
return T(23, 42, "any");
|
|
|
|
}
|
|
|
|
function u() public returns (T[2] memory) {
|
|
|
|
return [T(23, 42, "any"), T(555, 666, "any")];
|
|
|
|
}
|
|
|
|
function v() public returns (bool[2][] memory) {
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
function w1() public returns (string[1] memory) {
|
|
|
|
return ["any"];
|
|
|
|
}
|
|
|
|
function w2() public returns (string[2] memory) {
|
|
|
|
return ["any", "any"];
|
|
|
|
}
|
|
|
|
function w3() public returns (string[3] memory) {
|
|
|
|
return ["any", "any", "any"];
|
|
|
|
}
|
|
|
|
function x() public returns (string[2] memory, string[3] memory) {
|
|
|
|
return (["any", "any"], ["any", "any", "any"]);
|
|
|
|
}
|
2019-02-06 11:10:48 +00:00
|
|
|
}
|
|
|
|
// ----
|
2019-07-13 10:33:28 +00:00
|
|
|
// constructor(), 2 ether: 3 ->
|
2019-05-15 10:01:14 +00:00
|
|
|
// state() -> 3
|
2019-07-13 10:33:28 +00:00
|
|
|
// balance() -> 2
|
2019-04-11 18:25:20 +00:00
|
|
|
// _() -> FAILURE
|
2019-07-13 11:31:55 +00:00
|
|
|
// e(uint256): 4
|
2019-02-28 13:16:16 +00:00
|
|
|
// f() -> 2
|
2019-07-21 14:58:48 +00:00
|
|
|
// f(uint256): 3 -> 3, 3
|
2019-04-11 18:25:20 +00:00
|
|
|
// f(), 1 ether -> 2
|
|
|
|
// g() -> 2, 3
|
2019-07-21 14:58:48 +00:00
|
|
|
// g1() -> FAILURE
|
2019-04-11 18:25:20 +00:00
|
|
|
// h(uint256,uint256): 1, -2 -> 3
|
2019-02-28 13:16:16 +00:00
|
|
|
// j(bool): true -> false
|
2019-04-11 18:25:20 +00:00
|
|
|
// k(bytes32): 0x10 -> 0x10, 0x10
|
2019-07-21 14:58:48 +00:00
|
|
|
// l(): hex"4200efef" -> 8
|
2019-04-11 18:25:20 +00:00
|
|
|
// m(bytes): 32, 32, 0x20 -> 32, 32, 0x20
|
|
|
|
// m(bytes): 32, 3, hex"AB33BB" -> 32, 3, left(0xAB33BB)
|
|
|
|
// m(bytes): 32, 3, hex"AB33FF" -> 32, 3, hex"ab33ff0000000000000000000000000000000000000000000000000000000000"
|
2019-05-06 08:08:10 +00:00
|
|
|
// n() -> 0x20, 3, "any"
|
|
|
|
// o() -> 0x40, 0x80, 3, "any", 3, "any"
|
|
|
|
// p() -> 0x60, 0x2a, 0xa0, 3, "any", 3, "any"
|
2019-06-04 07:35:57 +00:00
|
|
|
// q(uint256): 99 -> 693
|
2019-07-21 14:58:48 +00:00
|
|
|
// r() -> true, false, true
|
|
|
|
// s() -> 123, 456, 789
|
|
|
|
// t1() -> 23, 42
|
|
|
|
// t2() -> 0x20, 23, 42, 0x60, 3, "any"
|
|
|
|
// v() -> 32, 0
|
|
|
|
// w1() -> 0x20, 0x20, 3, "any"
|
|
|
|
// w2() -> 0x20, 0x40, 0x80, 3, "any", 3, "any"
|
|
|
|
// w3() -> 0x20, 0x60, 0xa0, 0xe0, 3, "any", 3, "any", 3, "any"
|
|
|
|
// x() -> 0x40, 0x0100, 0x40, 0x80, 3, "any", 3, "any", 0x60, 0xa0, 0xe0, 3, "any", 3, "any", 3, "any"
|