UNPKG

kleros-interaction-2

Version:
863 lines 30.7 kB
{ "contractName": "ConstantNG", "abi": [ { "constant": false, "inputs": [ { "name": "_block", "type": "uint256" } ], "name": "getUncorrelatedRN", "outputs": [ { "name": "RN", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_block", "type": "uint256" } ], "name": "requestRN", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": true, "inputs": [], "name": "number", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_number", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "constant": false, "inputs": [ { "name": "_block", "type": "uint256" } ], "name": "contribute", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": false, "inputs": [ { "name": "_block", "type": "uint256" } ], "name": "getRN", "outputs": [ { "name": "RN", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], "bytecode": "0x608060405234801561001057600080fd5b506040516020806101a48339810160405251600055610170806100346000396000f30060806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631c73601e81146100715780637b9c34e01461009b5780638381f58a146100a8578063c1cbbca7146100bd578063ca4742f1146100c8575b600080fd5b34801561007d57600080fd5b506100896004356100e0565b60408051918252519081900360200190f35b6100a660043561012f565b005b3480156100b457600080fd5b50610089610137565b6100a6600435610134565b3480156100d457600080fd5b5061008960043561013d565b6000806100ec8361013d565b90508015156100fe5760009150610129565b604080516c010000000000000000000000003302815260148101839052905190819003603401902091505b50919050565b610134815b50565b60005481565b50600054905600a165627a7a72305820002fddd01e301cd2a3e86bea4363ee1bc49338a3fc6296a1b92dcd24df8cdbfc0029", "deployedBytecode": "0x60806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631c73601e81146100715780637b9c34e01461009b5780638381f58a146100a8578063c1cbbca7146100bd578063ca4742f1146100c8575b600080fd5b34801561007d57600080fd5b506100896004356100e0565b60408051918252519081900360200190f35b6100a660043561012f565b005b3480156100b457600080fd5b50610089610137565b6100a6600435610134565b3480156100d457600080fd5b5061008960043561013d565b6000806100ec8361013d565b90508015156100fe5760009150610129565b604080516c010000000000000000000000003302815260148101839052905190819003603401902091505b50919050565b610134815b50565b60005481565b50600054905600a165627a7a72305820002fddd01e301cd2a3e86bea4363ee1bc49338a3fc6296a1b92dcd24df8cdbfc0029", "sourceMap": "245:743:54:-;;;388:66;8:9:-1;5:2;;;30:1;27;20:12;5:2;388:66:54;;;;;;;;;;;;;431:6;:16;245:743;;;;;;", "deployedSourceMap": "245:743:54:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1102:216:55;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1102:216:55;;;;;;;;;;;;;;;;;;;;;423:82;;;;;;;;279:18:54;;8:9:-1;5:2;;;30:1;27;20:12;5:2;279:18:54;;;;618:50;;;;;;902:83;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;902:83:54;;;;;1102:216:55;1158:7;1177:11;1191:13;1197:6;1191:5;:13::i;:::-;1177:27;-1:-1:-1;1218:11:55;;1214:97;;;1246:1;1239:8;;;;1214:97;1282:28;;;;1292:10;1282:28;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1214:97:55;1102:216;;;;:::o;423:82::-;480:18;491:6;480:18;423:82;:::o;279:18:54:-;;;;:::o;902:83::-;-1:-1:-1;946:7:54;972:6;;902:83::o", "source": "/**\n* @title Constant Number Generator\n* @author Clément Lesaege - <clement@lesaege.com>\n* @dev A Random Number Generator which always return the same number. Usefull in order to make tests.\n*/\n\npragma solidity ^0.4.15;\nimport \"./RNG.sol\";\n\ncontract ConstantNG is RNG {\n\n uint public number;\n\n /** @dev Constructor.\n * @param _number The number to always return.\n */\n constructor(uint _number) public {\n number = _number;\n }\n\n /** @dev Contribute to the reward of a random number. All the ETH will be lost forever.\n * @param _block Block the random number is linked to.\n */\n function contribute(uint _block) public payable {}\n\n\n /** @dev Get the \"random number\" (which is always the same).\n * @param _block Block the random number is linked to.\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\n */\n function getRN(uint _block) public returns (uint RN) {\n return number;\n }\n\n}\n", "sourcePath": "/private/tmp/kleros-interaction/contracts/standard/rng/ConstantNG.sol", "ast": { "absolutePath": "/private/tmp/kleros-interaction/contracts/standard/rng/ConstantNG.sol", "exportedSymbols": { "ConstantNG": [ 18392 ] }, "id": 18393, "nodeType": "SourceUnit", "nodes": [ { "id": 18360, "literals": [ "solidity", "^", "0.4", ".15" ], "nodeType": "PragmaDirective", "src": "199:24:54" }, { "absolutePath": "/private/tmp/kleros-interaction/contracts/standard/rng/RNG.sol", "file": "./RNG.sol", "id": 18361, "nodeType": "ImportDirective", "scope": 18393, "sourceUnit": 18446, "src": "224:19:54", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 18362, "name": "RNG", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 18445, "src": "268:3:54", "typeDescriptions": { "typeIdentifier": "t_contract$_RNG_$18445", "typeString": "contract RNG" } }, "id": 18363, "nodeType": "InheritanceSpecifier", "src": "268:3:54" } ], "contractDependencies": [ 18445 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 18392, "linearizedBaseContracts": [ 18392, 18445 ], "name": "ConstantNG", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 18365, "name": "number", "nodeType": "VariableDeclaration", "scope": 18392, "src": "279:18:54", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18364, "name": "uint", "nodeType": "ElementaryTypeName", "src": "279:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 18374, "nodeType": "Block", "src": "421:33:54", "statements": [ { "expression": { "argumentTypes": null, "id": 18372, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 18370, "name": "number", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18365, "src": "431:6:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 18371, "name": "_number", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18367, "src": "440:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "431:16:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 18373, "nodeType": "ExpressionStatement", "src": "431:16:54" } ] }, "documentation": "@dev Constructor.\n @param _number The number to always return.", "id": 18375, "implemented": true, "isConstructor": true, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 18368, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18367, "name": "_number", "nodeType": "VariableDeclaration", "scope": 18375, "src": "400:12:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18366, "name": "uint", "nodeType": "ElementaryTypeName", "src": "400:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "399:14:54" }, "payable": false, "returnParameters": { "id": 18369, "nodeType": "ParameterList", "parameters": [], "src": "421:0:54" }, "scope": 18392, "src": "388:66:54", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 18380, "nodeType": "Block", "src": "666:2:54", "statements": [] }, "documentation": "@dev Contribute to the reward of a random number. All the ETH will be lost forever.\n @param _block Block the random number is linked to.", "id": 18381, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "contribute", "nodeType": "FunctionDefinition", "parameters": { "id": 18378, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18377, "name": "_block", "nodeType": "VariableDeclaration", "scope": 18381, "src": "638:11:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18376, "name": "uint", "nodeType": "ElementaryTypeName", "src": "638:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "637:13:54" }, "payable": true, "returnParameters": { "id": 18379, "nodeType": "ParameterList", "parameters": [], "src": "666:0:54" }, "scope": 18392, "src": "618:50:54", "stateMutability": "payable", "superFunction": 18399, "visibility": "public" }, { "body": { "id": 18390, "nodeType": "Block", "src": "955:30:54", "statements": [ { "expression": { "argumentTypes": null, "id": 18388, "name": "number", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18365, "src": "972:6:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 18387, "id": 18389, "nodeType": "Return", "src": "965:13:54" } ] }, "documentation": "@dev Get the \"random number\" (which is always the same).\n @param _block Block the random number is linked to.\n @return RN Random Number. If the number is not ready or has not been required 0 instead.", "id": 18391, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "getRN", "nodeType": "FunctionDefinition", "parameters": { "id": 18384, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18383, "name": "_block", "nodeType": "VariableDeclaration", "scope": 18391, "src": "917:11:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18382, "name": "uint", "nodeType": "ElementaryTypeName", "src": "917:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "916:13:54" }, "payable": false, "returnParameters": { "id": 18387, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18386, "name": "RN", "nodeType": "VariableDeclaration", "scope": 18391, "src": "946:7:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18385, "name": "uint", "nodeType": "ElementaryTypeName", "src": "946:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "945:9:54" }, "scope": 18392, "src": "902:83:54", "stateMutability": "nonpayable", "superFunction": 18416, "visibility": "public" } ], "scope": 18393, "src": "245:743:54" } ], "src": "199:790:54" }, "legacyAST": { "absolutePath": "/private/tmp/kleros-interaction/contracts/standard/rng/ConstantNG.sol", "exportedSymbols": { "ConstantNG": [ 18392 ] }, "id": 18393, "nodeType": "SourceUnit", "nodes": [ { "id": 18360, "literals": [ "solidity", "^", "0.4", ".15" ], "nodeType": "PragmaDirective", "src": "199:24:54" }, { "absolutePath": "/private/tmp/kleros-interaction/contracts/standard/rng/RNG.sol", "file": "./RNG.sol", "id": 18361, "nodeType": "ImportDirective", "scope": 18393, "sourceUnit": 18446, "src": "224:19:54", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 18362, "name": "RNG", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 18445, "src": "268:3:54", "typeDescriptions": { "typeIdentifier": "t_contract$_RNG_$18445", "typeString": "contract RNG" } }, "id": 18363, "nodeType": "InheritanceSpecifier", "src": "268:3:54" } ], "contractDependencies": [ 18445 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 18392, "linearizedBaseContracts": [ 18392, 18445 ], "name": "ConstantNG", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 18365, "name": "number", "nodeType": "VariableDeclaration", "scope": 18392, "src": "279:18:54", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18364, "name": "uint", "nodeType": "ElementaryTypeName", "src": "279:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 18374, "nodeType": "Block", "src": "421:33:54", "statements": [ { "expression": { "argumentTypes": null, "id": 18372, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 18370, "name": "number", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18365, "src": "431:6:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 18371, "name": "_number", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18367, "src": "440:7:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "431:16:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 18373, "nodeType": "ExpressionStatement", "src": "431:16:54" } ] }, "documentation": "@dev Constructor.\n @param _number The number to always return.", "id": 18375, "implemented": true, "isConstructor": true, "isDeclaredConst": false, "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 18368, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18367, "name": "_number", "nodeType": "VariableDeclaration", "scope": 18375, "src": "400:12:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18366, "name": "uint", "nodeType": "ElementaryTypeName", "src": "400:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "399:14:54" }, "payable": false, "returnParameters": { "id": 18369, "nodeType": "ParameterList", "parameters": [], "src": "421:0:54" }, "scope": 18392, "src": "388:66:54", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 18380, "nodeType": "Block", "src": "666:2:54", "statements": [] }, "documentation": "@dev Contribute to the reward of a random number. All the ETH will be lost forever.\n @param _block Block the random number is linked to.", "id": 18381, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "contribute", "nodeType": "FunctionDefinition", "parameters": { "id": 18378, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18377, "name": "_block", "nodeType": "VariableDeclaration", "scope": 18381, "src": "638:11:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18376, "name": "uint", "nodeType": "ElementaryTypeName", "src": "638:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "637:13:54" }, "payable": true, "returnParameters": { "id": 18379, "nodeType": "ParameterList", "parameters": [], "src": "666:0:54" }, "scope": 18392, "src": "618:50:54", "stateMutability": "payable", "superFunction": 18399, "visibility": "public" }, { "body": { "id": 18390, "nodeType": "Block", "src": "955:30:54", "statements": [ { "expression": { "argumentTypes": null, "id": 18388, "name": "number", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 18365, "src": "972:6:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "functionReturnParameters": 18387, "id": 18389, "nodeType": "Return", "src": "965:13:54" } ] }, "documentation": "@dev Get the \"random number\" (which is always the same).\n @param _block Block the random number is linked to.\n @return RN Random Number. If the number is not ready or has not been required 0 instead.", "id": 18391, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "getRN", "nodeType": "FunctionDefinition", "parameters": { "id": 18384, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18383, "name": "_block", "nodeType": "VariableDeclaration", "scope": 18391, "src": "917:11:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18382, "name": "uint", "nodeType": "ElementaryTypeName", "src": "917:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "916:13:54" }, "payable": false, "returnParameters": { "id": 18387, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 18386, "name": "RN", "nodeType": "VariableDeclaration", "scope": 18391, "src": "946:7:54", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 18385, "name": "uint", "nodeType": "ElementaryTypeName", "src": "946:4:54", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "945:9:54" }, "scope": 18392, "src": "902:83:54", "stateMutability": "nonpayable", "superFunction": 18416, "visibility": "public" } ], "scope": 18393, "src": "245:743:54" } ], "src": "199:790:54" }, "compiler": { "name": "solc", "version": "0.4.24+commit.e67f0147.Emscripten.clang" }, "networks": {}, "schemaVersion": "2.0.1", "updatedAt": "2018-11-02T14:04:11.085Z" }