UNPKG

@gnosis.pm/pm-contracts

Version:

Collection of smart contracts for the Gnosis prediction market platform

1,129 lines 281 kB
{ "contractName": "MajorityOracleData", "abi": [ { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "oracles", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.6+commit.b259423e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"oracles\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/MajorityOracle.sol\":\"MajorityOracleData\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/MajorityOracle.sol\":{\"keccak256\":\"0x2662717bba85076a2beb5166630f415997b78174a11713845af147d2acfed289\",\"urls\":[\"bzzr://8172948c09ee1cc3a5bafe2fd38e97215b408cace6b61fbae6444cfb8bab5fa4\"]},\"/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": "0x608060405234801561001057600080fd5b5060ff8061001f6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80635b69a7d814602d575b600080fd5b605660048036036020811015604157600080fd5b81019080803590602001909291905050506098565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000818154811060a457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea165627a7a7230582073917a4287cb0d8804b051c9e0550c31efe7b92b421ea8ec4df43f2d53ef3b360029", "deployedBytecode": "0x6080604052348015600f57600080fd5b506004361060285760003560e01c80635b69a7d814602d575b600080fd5b605660048036036020811015604157600080fd5b81019080803590602001909291905050506098565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000818154811060a457fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea165627a7a7230582073917a4287cb0d8804b051c9e0550c31efe7b92b421ea8ec4df43f2d53ef3b360029", "sourceMap": "114:92:20:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;114:92:20;;;;;;;", "deployedSourceMap": "114:92:20:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;114:92:20;;;;;;;;;;;;;;;;;;;180:23;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;180:23:20;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o", "source": "pragma solidity ^0.5.0;\nimport \"../Oracles/Oracle.sol\";\nimport \"@gnosis.pm/util-contracts/contracts/Proxy.sol\";\n\n\ncontract MajorityOracleData {\n\n /*\n * Storage\n */\n Oracle[] public oracles;\n}\n\ncontract MajorityOracleProxy is Proxy, MajorityOracleData {\n\n /// @dev Allows to create an oracle for a majority vote based on other oracles\n /// @param _oracles List of oracles taking part in the majority vote\n constructor(address proxied, Oracle[] memory _oracles)\n Proxy(proxied)\n public\n {\n // At least 2 oracles should be defined\n require(_oracles.length > 2);\n for (uint i = 0; i < _oracles.length; i++)\n // Oracle address cannot be null\n require(address(_oracles[i]) != address(0));\n oracles = _oracles;\n }\n}\n\n/// @title Majority oracle contract - Allows to resolve an event based on multiple oracles with majority vote\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract MajorityOracle is Proxied, Oracle, MajorityOracleData {\n\n /*\n * Public functions\n */\n /// @dev Allows to registers oracles for a majority vote\n /// @return Is outcome set?\n /// @return Outcome\n function getStatusAndOutcome()\n public\n view\n returns (bool outcomeSet, int outcome)\n {\n uint i;\n int[] memory outcomes = new int[](oracles.length);\n uint[] memory validations = new uint[](oracles.length);\n for (i = 0; i < oracles.length; i++)\n if (oracles[i].isOutcomeSet()) {\n int _outcome = oracles[i].getOutcome();\n for (uint j = 0; j <= i; j++)\n if (_outcome == outcomes[j]) {\n validations[j] += 1;\n break;\n }\n else if (validations[j] == 0) {\n outcomes[j] = _outcome;\n validations[j] = 1;\n break;\n }\n }\n uint outcomeValidations = 0;\n uint outcomeIndex = 0;\n for (i = 0; i < oracles.length; i++)\n if (validations[i] > outcomeValidations) {\n outcomeValidations = validations[i];\n outcomeIndex = i;\n }\n // There is a majority vote\n if (outcomeValidations * 2 > oracles.length) {\n outcomeSet = true;\n outcome = outcomes[outcomeIndex];\n }\n }\n\n /// @dev Returns if winning outcome is set\n /// @return Is outcome set?\n function isOutcomeSet()\n public\n view\n returns (bool)\n {\n (bool outcomeSet, ) = getStatusAndOutcome();\n return outcomeSet;\n }\n\n /// @dev Returns winning outcome\n /// @return Outcome\n function getOutcome()\n public\n view\n returns (int)\n {\n (, int winningOutcome) = getStatusAndOutcome();\n return winningOutcome;\n }\n}\n", "sourcePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/MajorityOracle.sol", "ast": { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/MajorityOracle.sol", "exportedSymbols": { "MajorityOracle": [ 4772 ], "MajorityOracleData": [ 4527 ], "MajorityOracleProxy": [ 4579 ] }, "id": 4773, "nodeType": "SourceUnit", "nodes": [ { "id": 4521, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:20" }, { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol", "file": "../Oracles/Oracle.sol", "id": 4522, "nodeType": "ImportDirective", "scope": 4773, "sourceUnit": 4842, "src": "24:31:20", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@gnosis.pm/util-contracts/contracts/Proxy.sol", "file": "@gnosis.pm/util-contracts/contracts/Proxy.sol", "id": 4523, "nodeType": "ImportDirective", "scope": 4773, "sourceUnit": 6829, "src": "56:55:20", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4527, "linearizedBaseContracts": [ 4527 ], "name": "MajorityOracleData", "nodeType": "ContractDefinition", "nodes": [ { "constant": false, "id": 4526, "name": "oracles", "nodeType": "VariableDeclaration", "scope": 4527, "src": "180:23:20", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_storage", "typeString": "contract Oracle[]" }, "typeName": { "baseType": { "contractScope": null, "id": 4524, "name": "Oracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "180:6:20", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } }, "id": 4525, "length": null, "nodeType": "ArrayTypeName", "src": "180:8:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_storage_ptr", "typeString": "contract Oracle[]" } }, "value": null, "visibility": "public" } ], "scope": 4773, "src": "114:92:20" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4528, "name": "Proxy", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 6828, "src": "240:5:20", "typeDescriptions": { "typeIdentifier": "t_contract$_Proxy_$6828", "typeString": "contract Proxy" } }, "id": 4529, "nodeType": "InheritanceSpecifier", "src": "240:5:20" }, { "arguments": null, "baseName": { "contractScope": null, "id": 4530, "name": "MajorityOracleData", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4527, "src": "247:18:20", "typeDescriptions": { "typeIdentifier": "t_contract$_MajorityOracleData_$4527", "typeString": "contract MajorityOracleData" } }, "id": 4531, "nodeType": "InheritanceSpecifier", "src": "247:18:20" } ], "contractDependencies": [ 4527, 6798, 6828 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 4579, "linearizedBaseContracts": [ 4579, 4527, 6828, 6798 ], "name": "MajorityOracleProxy", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 4577, "nodeType": "Block", "src": "526:274:20", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4546, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4543, "name": "_oracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4536, "src": "592:8:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_memory_ptr", "typeString": "contract Oracle[] memory" } }, "id": 4544, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "592:15:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": ">", "rightExpression": { "argumentTypes": null, "hexValue": "32", "id": 4545, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "610:1:20", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "src": "592:19:20", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 4542, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 7923, 7924 ], "referencedDeclaration": 7923, "src": "584:7:20", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 4547, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "584:28:20", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 4548, "nodeType": "ExpressionStatement", "src": "584:28:20" }, { "body": { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_address", "typeString": "address" }, "id": 4569, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 4562, "name": "_oracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4536, "src": "738:8:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_memory_ptr", "typeString": "contract Oracle[] memory" } }, "id": 4564, "indexExpression": { "argumentTypes": null, "id": 4563, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4550, "src": "747:1:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "738:11:20", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } ], "id": 4561, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "730:7:20", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 4565, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "730:20:20", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "nodeType": "BinaryOperation", "operator": "!=", "rightExpression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "hexValue": "30", "id": 4567, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "762:1:20", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" } ], "id": 4566, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "754:7:20", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 4568, "isConstant": false, "isLValue": false, "isPure": true, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "754:10:20", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, "src": "730:34:20", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 4560, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 7923, 7924 ], "referencedDeclaration": 7923, "src": "722:7:20", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 4570, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "722:43:20", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 4571, "nodeType": "ExpressionStatement", "src": "722:43:20" }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 4556, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 4553, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4550, "src": "639:1:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "<", "rightExpression": { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4554, "name": "_oracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4536, "src": "643:8:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_memory_ptr", "typeString": "contract Oracle[] memory" } }, "id": 4555, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "643:15:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "639:19:20", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "id": 4572, "initializationExpression": { "assignments": [ 4550 ], "declarations": [ { "constant": false, "id": 4550, "name": "i", "nodeType": "VariableDeclaration", "scope": 4572, "src": "627:6:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4549, "name": "uint", "nodeType": "ElementaryTypeName", "src": "627:4:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 4552, "initialValue": { "argumentTypes": null, "hexValue": "30", "id": 4551, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "636:1:20", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "nodeType": "VariableDeclarationStatement", "src": "627:10:20" }, "loopExpression": { "expression": { "argumentTypes": null, "id": 4558, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "UnaryOperation", "operator": "++", "prefix": false, "src": "660:3:20", "subExpression": { "argumentTypes": null, "id": 4557, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4550, "src": "660:1:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 4559, "nodeType": "ExpressionStatement", "src": "660:3:20" }, "nodeType": "ForStatement", "src": "622:143:20" }, { "expression": { "argumentTypes": null, "id": 4575, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 4573, "name": "oracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4526, "src": "775:7:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_storage", "typeString": "contract Oracle[] storage ref" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 4574, "name": "_oracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4536, "src": "785:8:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_memory_ptr", "typeString": "contract Oracle[] memory" } }, "src": "775:18:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_storage", "typeString": "contract Oracle[] storage ref" } }, "id": 4576, "nodeType": "ExpressionStatement", "src": "775:18:20" } ] }, "documentation": "@dev Allows to create an oracle for a majority vote based on other oracles\n @param _oracles List of oracles taking part in the majority vote", "id": 4578, "implemented": true, "kind": "constructor", "modifiers": [ { "arguments": [ { "argumentTypes": null, "id": 4539, "name": "proxied", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4533, "src": "498:7:20", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } } ], "id": 4540, "modifierName": { "argumentTypes": null, "id": 4538, "name": "Proxy", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 6828, "src": "492:5:20", "typeDescriptions": { "typeIdentifier": "t_type$_t_contract$_Proxy_$6828_$", "typeString": "type(contract Proxy)" } }, "nodeType": "ModifierInvocation", "src": "492:14:20" } ], "name": "", "nodeType": "FunctionDefinition", "parameters": { "id": 4537, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 4533, "name": "proxied", "nodeType": "VariableDeclaration", "scope": 4578, "src": "441:15:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 4532, "name": "address", "nodeType": "ElementaryTypeName", "src": "441:7:20", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 4536, "name": "_oracles", "nodeType": "VariableDeclaration", "scope": 4578, "src": "458:24:20", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_memory_ptr", "typeString": "contract Oracle[]" }, "typeName": { "baseType": { "contractScope": null, "id": 4534, "name": "Oracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "458:6:20", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } }, "id": 4535, "length": null, "nodeType": "ArrayTypeName", "src": "458:8:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_storage_ptr", "typeString": "contract Oracle[]" } }, "value": null, "visibility": "internal" } ], "src": "440:43:20" }, "returnParameters": { "id": 4541, "nodeType": "ParameterList", "parameters": [], "src": "526:0:20" }, "scope": 4579, "src": "429:371:20", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" } ], "scope": 4773, "src": "208:594:20" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 4580, "name": "Proxied", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 6798, "src": "988:7:20", "typeDescriptions": { "typeIdentifier": "t_contract$_Proxied_$6798", "typeString": "contract Proxied" } }, "id": 4581, "nodeType": "InheritanceSpecifier", "src": "988:7:20" }, { "arguments": null, "baseName": { "contractScope": null, "id": 4582, "name": "Oracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "997:6:20", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } }, "id": 4583, "nodeType": "InheritanceSpecifier", "src": "997:6:20" }, { "arguments": null, "baseName": { "contractScope": null, "id": 4584, "name": "MajorityOracleData", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4527, "src": "1005:18:20", "typeDescriptions": { "typeIdentifier": "t_contract$_MajorityOracleData_$4527", "typeString": "contract MajorityOracleData" } }, "id": 4585, "nodeType": "InheritanceSpecifier", "src": "1005:18:20" } ], "contractDependencies": [ 4527, 4841, 6798 ], "contractKind": "contract", "documentation": "@title Majority oracle contract - Allows to resolve an event based on multiple oracles with majority vote\n @author Stefan George - <stefan@gnosis.pm>", "fullyImplemented": true, "id": 4772, "linearizedBaseContracts": [ 4772, 4527, 4841, 6798 ], "name": "MajorityOracle", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 4744, "nodeType": "Block", "src": "1298:1145:20", "statements": [ { "assignments": [ 4593 ], "declarations": [ { "constant": false, "id": 4593, "name": "i", "nodeType": "VariableDeclaration", "scope": 4744, "src": "1308:6:20", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 4592, "name": "uint", "nodeType": "ElementaryTypeName", "src": "1308:4:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "id": 4594, "initialValue": null, "nodeType": "VariableDeclarationStatement", "src": "1308:6:20" }, { "assignments": [ 4598 ], "declarations": [ { "constant": false, "id": 4598, "name": "outcomes", "nodeType": "VariableDeclaration", "scope": 4744, "src": "1324:21:20", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_int256_$dyn_memory_ptr", "typeString": "int256[]" }, "typeName": { "baseType": { "id": 4596, "name": "int", "nodeType": "ElementaryTypeName", "src": "1324:3:20", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "id": 4597, "length": null, "nodeType": "ArrayTypeName", "src": "1324:5:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr", "typeString": "int256[]" } }, "value": null, "visibility": "internal" } ], "id": 4605, "initialValue": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 4602, "name": "oracles", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 4526, "src": "1358:7:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_Oracle_$4841_$dyn_storage", "typeString": "contract Oracle[] storage ref" } }, "id": 4603, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "memberName": "length", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1358:14:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "id": 4601, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "NewExpression", "src": "1348:9:20", "typeDescriptions": { "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_int256_$dyn_memory_$", "typeString": "function (uint256) pure returns (int256[] memory)" }, "typeName": { "baseType": { "id": 4599, "name": "int", "nodeType": "ElementaryTypeName", "src": "1352:3:20", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "id": 4600, "length": null, "nodeType": "ArrayTypeName", "src": "1352:5:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_int256_$dyn_storage_ptr", "typeString": "int256[]" } } }, "id": 4604, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1348:25:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_int256_$dyn_memory", "typeString": "int256[] memory" } }, "nodeType": "VariableDeclarationStatement", "src": "1324:49:20" }, { "assignments": [ 4609 ], "declarations": [ { "constant": false, "id": 4609, "name": "validations", "nodeType": "VariableDeclaration", "scope": 4744, "src": "1383:25:20", "stateVariable": false, "storageLocation": "memory", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", "typeString": "uint256[]" }, "typeName": { "baseType": { "id": 4607, "name": "uint", "nodeType": "ElementaryTypeName", "src": "1383:4:20", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 4608, "length": null, "nodeType": "ArrayTypeName", "src": "1383:6:20", "typeDescriptions": { "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", "typeString": "uint256[]" } }, "value": null, "visibility": "internal" } ], "id": 4616, "initialVal