Skip to content

Instantly share code, notes, and snippets.

@kvhnuke
Last active February 6, 2019 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kvhnuke/020cc0f49cf34bbb41f6f54f4b1efee0 to your computer and use it in GitHub Desktop.
Save kvhnuke/020cc0f49cf34bbb41f6f54f4b1efee0 to your computer and use it in GitHub Desktop.
ABI Testing
pragma solidity ^0.5.0;
contract ABITester {
uint200 public const_abc;
bool public const_nice;
bool public const_nice2;
bytes32 public const_time;
bool public const_nicer;
uint[] public ArrUint;
bool[] public ArrBool;
bytes32[] public ArrBytes32;
uint168[] public ArrUint168;
constructor(uint200 abc, bool nice, bool nice2, bytes32 time, bool nicer) payable public {
const_abc = abc;
const_nice = nice;
const_nice2 = nice2;
const_time = time;
const_nicer = nicer;
}
function funcUintArray(uint[] memory arrUint) public {
for(uint i = 0; i< arrUint.length; i++){
ArrUint[i] = arrUint[i];
}
}
function funcBoolArray(bool[] memory arrBool) public {
for(uint i = 0; i< arrBool.length; i++){
ArrBool[i] = arrBool[i];
}
}
function funcBytes32Array(bytes32[] memory arrBytes32) public {
for(uint i = 0; i< arrBytes32.length; i++){
ArrBytes32[i] = arrBytes32[i];
}
}
function funcUint168Array(uint168[] memory arrUint168) public {
for(uint i = 0; i< arrUint168.length; i++){
ArrUint168[i] = arrUint168[i];
}
}
function funcSetTime(bytes32 _time) public payable {
const_time = _time;
}
function funcSetNicer(bool _nicer) public {
const_nicer = _nicer;
}
}
@kvhnuke
Copy link
Author

kvhnuke commented Feb 5, 2019

[
	{
		"constant": false,
		"inputs": [
			{
				"name": "arrBytes32",
				"type": "bytes32[]"
			}
		],
		"name": "funcBytes32Array",
		"outputs": [],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "const_time",
		"outputs": [
			{
				"name": "",
				"type": "bytes32"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_time",
				"type": "bytes32"
			}
		],
		"name": "funcSetTime",
		"outputs": [],
		"payable": true,
		"stateMutability": "payable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "arrBool",
				"type": "bool[]"
			}
		],
		"name": "funcBoolArray",
		"outputs": [],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "_nicer",
				"type": "bool"
			}
		],
		"name": "funcSetNicer",
		"outputs": [],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "const_nice",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "const_nice2",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "arrUint168",
				"type": "uint168[]"
			}
		],
		"name": "funcUint168Array",
		"outputs": [],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"name": "ArrBool",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"name": "ArrUint168",
		"outputs": [
			{
				"name": "",
				"type": "uint168"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"name": "ArrBytes32",
		"outputs": [
			{
				"name": "",
				"type": "bytes32"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "const_nicer",
		"outputs": [
			{
				"name": "",
				"type": "bool"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": false,
		"inputs": [
			{
				"name": "arrUint",
				"type": "uint256[]"
			}
		],
		"name": "funcUintArray",
		"outputs": [],
		"payable": false,
		"stateMutability": "nonpayable",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [],
		"name": "const_abc",
		"outputs": [
			{
				"name": "",
				"type": "uint200"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"constant": true,
		"inputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"name": "ArrUint",
		"outputs": [
			{
				"name": "",
				"type": "uint256"
			}
		],
		"payable": false,
		"stateMutability": "view",
		"type": "function"
	},
	{
		"inputs": [
			{
				"name": "abc",
				"type": "uint200"
			},
			{
				"name": "nice",
				"type": "bool"
			},
			{
				"name": "nice2",
				"type": "bool"
			},
			{
				"name": "time",
				"type": "bytes32"
			},
			{
				"name": "nicer",
				"type": "bool"
			}
		],
		"payable": true,
		"stateMutability": "payable",
		"type": "constructor"
	}
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment