UNPKG

@gnosis.pm/pm-contracts

Version:

Collection of smart contracts for the Gnosis prediction market platform

1,215 lines (1,214 loc) 80.6 kB
{ "contractName": "DifficultyOracle", "abi": [ { "constant": true, "inputs": [], "name": "difficulty", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "blockNumber", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "inputs": [ { "name": "_blockNumber", "type": "uint256" } ], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "difficulty", "type": "uint256" } ], "name": "OutcomeAssignment", "type": "event" }, { "constant": false, "inputs": [], "name": "setOutcome", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "isOutcomeSet", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "getOutcome", "outputs": [ { "name": "", "type": "int256" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.6+commit.b259423e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":false,\"inputs\":[],\"name\":\"setOutcome\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"difficulty\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"blockNumber\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getOutcome\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOutcomeSet\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_blockNumber\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"difficulty\",\"type\":\"uint256\"}],\"name\":\"OutcomeAssignment\",\"type\":\"event\"}],\"devdoc\":{\"author\":\"Stefan George - <stefan@gnosis.pm>\",\"methods\":{\"constructor\":{\"details\":\"Contract constructor validates and sets target block number\",\"params\":{\"_blockNumber\":\"Target block number\"}},\"getOutcome()\":{\"details\":\"Returns difficulty\",\"return\":\"Outcome\"},\"isOutcomeSet()\":{\"details\":\"Returns if difficulty is set\",\"return\":\"Is outcome set?\"},\"setOutcome()\":{\"details\":\"Sets difficulty as winning outcome for specified block\"}},\"title\":\"Difficulty oracle contract - Oracle to resolve difficulty events at given block\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/DifficultyOracle.sol\":\"DifficultyOracle\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/DifficultyOracle.sol\":{\"keccak256\":\"0x18ae9cab2afc6d83dfad172af16b5648188434c4e16ed1e00f28539185f5d066\",\"urls\":[\"bzzr://44b5c9682a99a1434b8b25e5f4159932f8820d447b633dc984263c0b9d6531e6\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol\":{\"keccak256\":\"0xf4d12f4a59c17e66dfa6791188f621a8914e2038a4e3f72d6fc9fb903ca8e18e\",\"urls\":[\"bzzr://a477ccd203e677cc904b1a4f8fcc85251c5b5e09c5c10eed27e01318584b16d1\"]},\"@gnosis.pm/util-contracts/contracts/Proxy.sol\":{\"keccak256\":\"0xeab0e83a9ec9e7f052c0455a11577061ec6d1994db08dae429abd6faaabf6555\",\"urls\":[\"bzzr://b2c1273d4ec30e2f9e768eea8c510f8493a7359b03e01923d93eea86b57ec145\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b506040516020806101f38339810180604052602081101561003057600080fd5b810190808051906020019092919050505043811161004d57600080fd5b806000819055505061018f806100646000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80630537665d1461005c57806319cae4621461006657806357e871e7146100845780637e7e4b47146100a2578063ccdf68f3146100c0575b600080fd5b6100646100e2565b005b61006e610141565b6040518082815260200191505060405180910390f35b61008c610147565b6040518082815260200191505060405180910390f35b6100aa61014d565b6040518082815260200191505060405180910390f35b6100c8610157565b604051808215151515815260200191505060405180910390f35b60005443101580156100f657506000600154145b6100ff57600080fd5b446001819055507f39972cb21edd888c2061a2b4b37874524bbc055cfeaa3054682ba5369f5029aa6001546040518082815260200191505060405180910390a1565b60015481565b60005481565b6000600154905090565b6000806001541190509056fea165627a7a723058205336a64a8c9d2d2e7d50564cd774a5a75a46706111b37a6e21b4378caad047c60029", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80630537665d1461005c57806319cae4621461006657806357e871e7146100845780637e7e4b47146100a2578063ccdf68f3146100c0575b600080fd5b6100646100e2565b005b61006e610141565b6040518082815260200191505060405180910390f35b61008c610147565b6040518082815260200191505060405180910390f35b6100aa61014d565b6040518082815260200191505060405180910390f35b6100c8610157565b604051808215151515815260200191505060405180910390f35b60005443101580156100f657506000600154145b6100ff57600080fd5b446001819055507f39972cb21edd888c2061a2b4b37874524bbc055cfeaa3054682ba5369f5029aa6001546040518082815260200191505060405180910390a1565b60015481565b60005481565b6000600154905090565b6000806001541190509056fea165627a7a723058205336a64a8c9d2d2e7d50564cd774a5a75a46706111b37a6e21b4378caad047c60029", "sourceMap": "196:1306:16:-;;;566:180;8:9:-1;5:2;;;30:1;27;20:12;5:2;566:180:16;;;;;;;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;566:180:16;;;;;;;;;;;;;;;;690:12;675;:27;667:36;;;;;;727:12;713:11;:26;;;;566:180;196:1306;;;;;;", "deployedSourceMap": "196:1306:16:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;196:1306:16;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;820:260;;;:::i;:::-;;376:22;;;:::i;:::-;;;;;;;;;;;;;;;;;;;347:23;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1385:115;;;:::i;:::-;;;;;;;;;;;;;;;;;;;1160:163;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;820:260;959:11;;943:12;:27;;:46;;;;;988:1;974:10;;:15;943:46;935:55;;;;;;1013:16;1000:10;:29;;;;1044;1062:10;;1044:29;;;;;;;;;;;;;;;;;;820:260::o;376:22::-;;;;:::o;347:23::-;;;;:::o;1385:115::-;1452:3;1482:10;;1471:22;;1385:115;:::o;1160:163::-;1229:4;1315:1;1302:10;;:14;1295:21;;1160:163;:::o", "source": "pragma solidity ^0.5.0;\nimport \"../Oracles/Oracle.sol\";\n\n\n/// @title Difficulty oracle contract - Oracle to resolve difficulty events at given block\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract DifficultyOracle is Oracle {\n\n /*\n * Events\n */\n event OutcomeAssignment(uint difficulty);\n\n /*\n * Storage\n */\n uint public blockNumber;\n uint public difficulty;\n\n /*\n * Public functions\n */\n /// @dev Contract constructor validates and sets target block number\n /// @param _blockNumber Target block number\n constructor(uint _blockNumber)\n public\n {\n // Block has to be in the future\n require(_blockNumber > block.number);\n blockNumber = _blockNumber;\n }\n\n /// @dev Sets difficulty as winning outcome for specified block\n function setOutcome()\n public\n {\n // Block number was reached and outcome was not set yet\n require(block.number >= blockNumber && difficulty == 0);\n difficulty = block.difficulty;\n emit OutcomeAssignment(difficulty);\n }\n\n /// @dev Returns if difficulty is set\n /// @return Is outcome set?\n function isOutcomeSet()\n public\n view\n returns (bool)\n {\n // Difficulty is always bigger than 0\n return difficulty > 0;\n }\n\n /// @dev Returns difficulty\n /// @return Outcome\n function getOutcome()\n public\n view\n returns (int)\n {\n return int(difficulty);\n }\n}\n", "sourcePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/DifficultyOracle.sol", "ast": { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/DifficultyOracle.sol", "exportedSymbols": { "DifficultyOracle": [ 3945 ] }, "id": 3946, "nodeType": "SourceUnit", "nodes": [ { "id": 3872, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:16" }, { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol", "file": "../Oracles/Oracle.sol", "id": 3873, "nodeType": "ImportDirective", "scope": 3946, "sourceUnit": 4842, "src": "24:31:16", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 3874, "name": "Oracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "225:6:16", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } }, "id": 3875, "nodeType": "InheritanceSpecifier", "src": "225:6:16" } ], "contractDependencies": [ 4841 ], "contractKind": "contract", "documentation": "@title Difficulty oracle contract - Oracle to resolve difficulty events at given block\n @author Stefan George - <stefan@gnosis.pm>", "fullyImplemented": true, "id": 3945, "linearizedBaseContracts": [ 3945, 4841 ], "name": "DifficultyOracle", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 3879, "name": "OutcomeAssignment", "nodeType": "EventDefinition", "parameters": { "id": 3878, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3877, "indexed": false, "name": "difficulty", "nodeType": "VariableDeclaration", "scope": 3879, "src": "293:15:16", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3876, "name": "uint", "nodeType": "ElementaryTypeName", "src": "293:4:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "292:17:16" }, "src": "269:41:16" }, { "constant": false, "id": 3881, "name": "blockNumber", "nodeType": "VariableDeclaration", "scope": 3945, "src": "347:23:16", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3880, "name": "uint", "nodeType": "ElementaryTypeName", "src": "347:4:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 3883, "name": "difficulty", "nodeType": "VariableDeclaration", "scope": 3945, "src": "376:22:16", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3882, "name": "uint", "nodeType": "ElementaryTypeName", "src": "376:4:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 3899, "nodeType": "Block", "src": "616:130:16", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3892, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3889, "name": "_blockNumber", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3885, "src": "675:12:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 3890, "name": "block", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7910, "src": "690:5:16", "typeDescriptions": { "typeIdentifier": "t_magic_block", "typeString": "block" } }, "id": 3891, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "690:12:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "675:27:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 3888, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 7923, 7924 ], "referencedDeclaration": 7923, "src": "667:7:16", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 3893, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "667:36:16", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3894, "nodeType": "ExpressionStatement", "src": "667:36:16" }, { "expression": { "argumentTypes": null, "id": 3897, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 3895, "name": "blockNumber", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3881, "src": "713:11:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 3896, "name": "_blockNumber", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3885, "src": "727:12:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "713:26:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 3898, "nodeType": "ExpressionStatement", "src": "713:26:16" } ] }, "documentation": "@dev Contract constructor validates and sets target block number\n @param _blockNumber Target block number", "id": 3900, "implemented": true, "kind": "constructor", "modifiers": [], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 3886, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3885, "name": "_blockNumber", "nodeType": "VariableDeclaration", "scope": 3900, "src": "578:17:16", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3884, "name": "uint", "nodeType": "ElementaryTypeName", "src": "578:4:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "577:19:16" }, "returnParameters": { "id": 3887, "nodeType": "ParameterList", "parameters": [], "src": "616:0:16" }, "scope": 3945, "src": "566:180:16", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 3923, "nodeType": "Block", "src": "861:219:16", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_bool", "typeString": "bool" }, "id": 3911, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3907, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 3904, "name": "block", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7910, "src": "943:5:16", "typeDescriptions": { "typeIdentifier": "t_magic_block", "typeString": "block" } }, "id": 3905, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "number", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "943:12:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">=", "rightExpression": { "argumentTypes": null, "id": 3906, "name": "blockNumber", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3881, "src": "959:11:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "943:27:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "nodeType": "BinaryOperation", "operator": "&&", "rightExpression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3910, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3908, "name": "difficulty", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3883, "src": "974:10:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 3909, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "988:1:16", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "974:15:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "src": "943:46:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 3903, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 7923, 7924 ], "referencedDeclaration": 7923, "src": "935:7:16", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 3912, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "935:55:16", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3913, "nodeType": "ExpressionStatement", "src": "935:55:16" }, { "expression": { "argumentTypes": null, "id": 3917, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 3914, "name": "difficulty", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3883, "src": "1000:10:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 3915, "name": "block", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7910, "src": "1013:5:16", "typeDescriptions": { "typeIdentifier": "t_magic_block", "typeString": "block" } }, "id": 3916, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "difficulty", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1013:16:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "1000:29:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 3918, "nodeType": "ExpressionStatement", "src": "1000:29:16" }, { "eventCall": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 3920, "name": "difficulty", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3883, "src": "1062:10:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 3919, "name": "OutcomeAssignment", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3879, "src": "1044:17:16", "typeDescriptions": { "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$returns$__$", "typeString": "function (uint256)" } }, "id": 3921, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1044:29:16", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 3922, "nodeType": "EmitStatement", "src": "1039:34:16" } ] }, "documentation": "@dev Sets difficulty as winning outcome for specified block", "id": 3924, "implemented": true, "kind": "function", "modifiers": [], "name": "setOutcome", "nodeType": "FunctionDefinition", "parameters": { "id": 3901, "nodeType": "ParameterList", "parameters": [], "src": "839:2:16" }, "returnParameters": { "id": 3902, "nodeType": "ParameterList", "parameters": [], "src": "861:0:16" }, "scope": 3945, "src": "820:260:16", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 3933, "nodeType": "Block", "src": "1239:84:16", "statements": [ { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3931, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 3929, "name": "difficulty", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3883, "src": "1302:10:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 3930, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "1315:1:16", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "1302:14:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 3928, "id": 3932, "nodeType": "Return", "src": "1295:21:16" } ] }, "documentation": "@dev Returns if difficulty is set\n @return Is outcome set?", "id": 3934, "implemented": true, "kind": "function", "modifiers": [], "name": "isOutcomeSet", "nodeType": "FunctionDefinition", "parameters": { "id": 3925, "nodeType": "ParameterList", "parameters": [], "src": "1181:2:16" }, "returnParameters": { "id": 3928, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3927, "name": "", "nodeType": "VariableDeclaration", "scope": 3934, "src": "1229:4:16", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 3926, "name": "bool", "nodeType": "ElementaryTypeName", "src": "1229:4:16", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "1228:6:16" }, "scope": 3945, "src": "1160:163:16", "stateMutability": "view", "superFunction": 4835, "visibility": "public" }, { "body": { "id": 3943, "nodeType": "Block", "src": "1461:39:16", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 3940, "name": "difficulty", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 3883, "src": "1482:10:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 3939, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1478:3:16", "typeDescriptions": { "typeIdentifier": "t_type$_t_int256_$", "typeString": "type(int256)" }, "typeName": "int" }, "id": 3941, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1478:15:16", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "functionReturnParameters": 3938, "id": 3942, "nodeType": "Return", "src": "1471:22:16" } ] }, "documentation": "@dev Returns difficulty\n @return Outcome", "id": 3944, "implemented": true, "kind": "function", "modifiers": [], "name": "getOutcome", "nodeType": "FunctionDefinition", "parameters": { "id": 3935, "nodeType": "ParameterList", "parameters": [], "src": "1404:2:16" }, "returnParameters": { "id": 3938, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3937, "name": "", "nodeType": "VariableDeclaration", "scope": 3944, "src": "1452:3:16", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id": 3936, "name": "int", "nodeType": "ElementaryTypeName", "src": "1452:3:16", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "value": null, "visibility": "internal" } ], "src": "1451:5:16" }, "scope": 3945, "src": "1385:115:16", "stateMutability": "view", "superFunction": 4840, "visibility": "public" } ], "scope": 3946, "src": "196:1306:16" } ], "src": "0:1503:16" }, "legacyAST": { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/DifficultyOracle.sol", "exportedSymbols": { "DifficultyOracle": [ 3945 ] }, "id": 3946, "nodeType": "SourceUnit", "nodes": [ { "id": 3872, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:16" }, { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol", "file": "../Oracles/Oracle.sol", "id": 3873, "nodeType": "ImportDirective", "scope": 3946, "sourceUnit": 4842, "src": "24:31:16", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 3874, "name": "Oracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "225:6:16", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } }, "id": 3875, "nodeType": "InheritanceSpecifier", "src": "225:6:16" } ], "contractDependencies": [ 4841 ], "contractKind": "contract", "documentation": "@title Difficulty oracle contract - Oracle to resolve difficulty events at given block\n @author Stefan George - <stefan@gnosis.pm>", "fullyImplemented": true, "id": 3945, "linearizedBaseContracts": [ 3945, 4841 ], "name": "DifficultyOracle", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 3879, "name": "OutcomeAssignment", "nodeType": "EventDefinition", "parameters": { "id": 3878, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 3877, "indexed": false, "name": "difficulty", "nodeType": "VariableDeclaration", "scope": 3879, "src": "293:15:16", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3876, "name": "uint", "nodeType": "ElementaryTypeName", "src": "293:4:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "292:17:16" }, "src": "269:41:16" }, { "constant": false, "id": 3881, "name": "blockNumber", "nodeType": "VariableDeclaration", "scope": 3945, "src": "347:23:16", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3880, "name": "uint", "nodeType": "ElementaryTypeName", "src": "347:4:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 3883, "name": "difficulty", "nodeType": "VariableDeclaration", "scope": 3945, "src": "376:22:16", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 3882, "name": "uint", "nodeType": "ElementaryTypeName", "src": "376:4:16", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "public" }, { "body": { "id": 3899, "nodeType": "Block", "src": "616:130:16", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 3892, "isConstant": false, "isLValue": false,