mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Automated ABI Json tests.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
contract test {
|
||||
function f(uint a) public returns (uint d) { return a * 7; }
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,27 @@
|
||||
contract test {
|
||||
constructor(uint param1, test param2, bool param3) public {}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "param1",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "name": "param2",
|
||||
// "type": "address"
|
||||
// },
|
||||
// {
|
||||
// "name": "param3",
|
||||
// "type": "bool"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "constructor"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,4 @@
|
||||
contract test { }
|
||||
// ----
|
||||
// :test
|
||||
// []
|
||||
@@ -0,0 +1,40 @@
|
||||
contract test {
|
||||
function f(uint, uint k) public returns (uint ret_k, uint ret_g) {
|
||||
uint g = 8;
|
||||
ret_k = k;
|
||||
ret_g = g;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "name": "k",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "ret_k",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "name": "ret_g",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,30 @@
|
||||
contract test {
|
||||
function f(uint k) public returns (uint) {
|
||||
return k;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "k",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,57 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
contract C {
|
||||
struct S { uint a; T[] sub; bytes b; }
|
||||
struct T { uint[2] x; }
|
||||
event E(T t, S s);
|
||||
}
|
||||
// ----
|
||||
// :C
|
||||
// [
|
||||
// {
|
||||
// "anonymous": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "x",
|
||||
// "type": "uint256[2]"
|
||||
// }
|
||||
// ],
|
||||
// "indexed": false,
|
||||
// "name": "t",
|
||||
// "type": "tuple"
|
||||
// },
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "x",
|
||||
// "type": "uint256[2]"
|
||||
// }
|
||||
// ],
|
||||
// "name": "sub",
|
||||
// "type": "tuple[]"
|
||||
// },
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "bytes"
|
||||
// }
|
||||
// ],
|
||||
// "indexed": false,
|
||||
// "name": "s",
|
||||
// "type": "tuple"
|
||||
// }
|
||||
// ],
|
||||
// "name": "E",
|
||||
// "type": "event"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,75 @@
|
||||
contract test {
|
||||
function f(uint a) public returns (uint d) { return a * 7; }
|
||||
event e1(uint b, address indexed c);
|
||||
event e2();
|
||||
event e2(uint a);
|
||||
event e3() anonymous;
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "anonymous": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "indexed": false,
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "indexed": true,
|
||||
// "name": "c",
|
||||
// "type": "address"
|
||||
// }
|
||||
// ],
|
||||
// "name": "e1",
|
||||
// "type": "event"
|
||||
// },
|
||||
// {
|
||||
// "anonymous": false,
|
||||
// "inputs": [],
|
||||
// "name": "e2",
|
||||
// "type": "event"
|
||||
// },
|
||||
// {
|
||||
// "anonymous": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "indexed": false,
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "e2",
|
||||
// "type": "event"
|
||||
// },
|
||||
// {
|
||||
// "anonymous": true,
|
||||
// "inputs": [],
|
||||
// "name": "e3",
|
||||
// "type": "event"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,13 @@
|
||||
contract test {
|
||||
event e() anonymous;
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "anonymous": true,
|
||||
// "inputs": [],
|
||||
// "name": "e",
|
||||
// "type": "event"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,22 @@
|
||||
contract test {
|
||||
function g(function(uint) external returns (uint) x) public {}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "x",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ],
|
||||
// "name": "g",
|
||||
// "outputs": [],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,12 @@
|
||||
contract test {
|
||||
function() external {}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "fallback"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,119 @@
|
||||
contract Base {
|
||||
function baseFunction(uint p) public returns (uint i) { return p; }
|
||||
event baseEvent(bytes32 indexed evtArgBase);
|
||||
}
|
||||
contract Derived is Base {
|
||||
function derivedFunction(bytes32 p) public returns (bytes32 i) { return p; }
|
||||
event derivedEvent(uint indexed evtArgDerived);
|
||||
}
|
||||
// ----
|
||||
// :Base
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "p",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "baseFunction",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "i",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "anonymous": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "indexed": true,
|
||||
// "name": "evtArgBase",
|
||||
// "type": "bytes32"
|
||||
// }
|
||||
// ],
|
||||
// "name": "baseEvent",
|
||||
// "type": "event"
|
||||
// }
|
||||
// ]
|
||||
//
|
||||
//
|
||||
// :Derived
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "p",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "baseFunction",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "i",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "p",
|
||||
// "type": "bytes32"
|
||||
// }
|
||||
// ],
|
||||
// "name": "derivedFunction",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "i",
|
||||
// "type": "bytes32"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "anonymous": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "indexed": true,
|
||||
// "name": "evtArgDerived",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "derivedEvent",
|
||||
// "type": "event"
|
||||
// },
|
||||
// {
|
||||
// "anonymous": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "indexed": true,
|
||||
// "name": "evtArgBase",
|
||||
// "type": "bytes32"
|
||||
// }
|
||||
// ],
|
||||
// "name": "baseEvent",
|
||||
// "type": "event"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,34 @@
|
||||
library test {
|
||||
struct StructType { uint a; }
|
||||
function f(StructType storage b, uint[] storage c, test d) public returns (uint[] memory e, StructType storage f) { f = f; }
|
||||
function f1(uint[] memory c, test d) public pure returns (uint[] memory e) { }
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": true,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "c",
|
||||
// "type": "uint256[]"
|
||||
// },
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "test"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f1",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "e",
|
||||
// "type": "uint256[]"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "pure",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,50 @@
|
||||
contract test {
|
||||
function f(uint a) public returns (uint d) { return a * 7; }
|
||||
function g(uint b) public returns (uint e) { return b * 8; }
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "g",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "e",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,51 @@
|
||||
// methods are expected to be in alphabetical order
|
||||
contract test {
|
||||
function f(uint a) public returns (uint d) { return a * 7; }
|
||||
function c(uint b) public returns (uint e) { return b * 8; }
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "c",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "e",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,32 @@
|
||||
contract test {
|
||||
function f(uint a, uint b) public returns (uint d) { return a + b; }
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,12 @@
|
||||
contract test {
|
||||
function () external payable {}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "payable": true,
|
||||
// "stateMutability": "payable",
|
||||
// "type": "fallback"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,27 @@
|
||||
contract test {
|
||||
constructor(uint param1, test param2, bool param3) public payable {}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "param1",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "name": "param2",
|
||||
// "type": "address"
|
||||
// },
|
||||
// {
|
||||
// "name": "param3",
|
||||
// "type": "bool"
|
||||
// }
|
||||
// ],
|
||||
// "payable": true,
|
||||
// "stateMutability": "payable",
|
||||
// "type": "constructor"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,26 @@
|
||||
contract test {
|
||||
function f() public {}
|
||||
function g() public payable {}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs": [],
|
||||
// "name": "f",
|
||||
// "outputs": [],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs": [],
|
||||
// "name": "g",
|
||||
// "outputs": [],
|
||||
// "payable": true,
|
||||
// "stateMutability": "payable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,54 @@
|
||||
contract test {
|
||||
function foo(uint a, uint b) public returns (uint d) { return a + b; }
|
||||
function boo(uint32 a) public pure returns (uint b) { return a * 4; }
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "foo",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "constant": true,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint32"
|
||||
// }
|
||||
// ],
|
||||
// "name": "boo",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "pure",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,40 @@
|
||||
// bug #1801
|
||||
contract test {
|
||||
enum ActionChoices { GoLeft, GoRight, GoStraight, Sit }
|
||||
constructor(ActionChoices param) public {}
|
||||
function ret() public returns (ActionChoices) {
|
||||
ActionChoices action = ActionChoices.GoLeft;
|
||||
return action;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs": [],
|
||||
// "name": "ret",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "",
|
||||
// "type": "uint8"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "param",
|
||||
// "type": "uint8"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "constructor"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,48 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
contract C {
|
||||
struct S { uint a; T[] sub; }
|
||||
struct T { uint[2] x; }
|
||||
function f() public returns (uint x, S memory s) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// :C
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs": [],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "x",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "x",
|
||||
// "type": "uint256[2]"
|
||||
// }
|
||||
// ],
|
||||
// "name": "sub",
|
||||
// "type": "tuple[]"
|
||||
// }
|
||||
// ],
|
||||
// "name": "s",
|
||||
// "type": "tuple"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,40 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
contract C {
|
||||
struct S { C[] x; C y; }
|
||||
function f() public returns (S memory s, C c) {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// :C
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs": [],
|
||||
// "name": "f",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "x",
|
||||
// "type": "address[]"
|
||||
// },
|
||||
// {
|
||||
// "name": "y",
|
||||
// "type": "address"
|
||||
// }
|
||||
// ],
|
||||
// "name": "s",
|
||||
// "type": "tuple"
|
||||
// },
|
||||
// {
|
||||
// "name": "c",
|
||||
// "type": "address"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,31 @@
|
||||
// bug #1801
|
||||
contract test {
|
||||
function f(string calldata a, bytes calldata b, uint[] calldata c) external {}
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "string"
|
||||
// },
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "bytes"
|
||||
// },
|
||||
// {
|
||||
// "name": "c",
|
||||
// "type": "uint256[]"
|
||||
// }
|
||||
// ],
|
||||
// "name": "f",
|
||||
// "outputs": [],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,48 @@
|
||||
pragma experimental ABIEncoderV2;
|
||||
library L {
|
||||
struct S { uint a; T[] sub; bytes b; }
|
||||
struct T { uint[2] x; }
|
||||
function f(L.S storage s) public view {}
|
||||
function g(L.S memory s) public view {}
|
||||
}
|
||||
// ----
|
||||
// :L
|
||||
// [
|
||||
// {
|
||||
// "constant": true,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "components":
|
||||
// [
|
||||
// {
|
||||
// "name": "x",
|
||||
// "type": "uint256[2]"
|
||||
// }
|
||||
// ],
|
||||
// "name": "sub",
|
||||
// "type": "tuple[]"
|
||||
// },
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "bytes"
|
||||
// }
|
||||
// ],
|
||||
// "name": "s",
|
||||
// "type": "tuple"
|
||||
// }
|
||||
// ],
|
||||
// "name": "g",
|
||||
// "outputs": [],
|
||||
// "payable": false,
|
||||
// "stateMutability": "view",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
@@ -0,0 +1,54 @@
|
||||
contract test {
|
||||
function foo(uint a, uint b) public returns (uint d) { return a + b; }
|
||||
function boo(uint32 a) public view returns(uint b) { return a * 4; }
|
||||
}
|
||||
// ----
|
||||
// :test
|
||||
// [
|
||||
// {
|
||||
// "constant": false,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint256"
|
||||
// },
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "name": "foo",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "d",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "nonpayable",
|
||||
// "type": "function"
|
||||
// },
|
||||
// {
|
||||
// "constant": true,
|
||||
// "inputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "a",
|
||||
// "type": "uint32"
|
||||
// }
|
||||
// ],
|
||||
// "name": "boo",
|
||||
// "outputs":
|
||||
// [
|
||||
// {
|
||||
// "name": "b",
|
||||
// "type": "uint256"
|
||||
// }
|
||||
// ],
|
||||
// "payable": false,
|
||||
// "stateMutability": "view",
|
||||
// "type": "function"
|
||||
// }
|
||||
// ]
|
||||
Reference in New Issue
Block a user