@gnosis.pm/pm-contracts
Version:
Collection of smart contracts for the Gnosis prediction market platform
961 lines (960 loc) • 291 kB
JSON
{
"contractName": "MajorityOracle",
"abi": [
{
"constant": true,
"inputs": [
{
"name": "",
"type": "uint256"
}
],
"name": "oracles",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "masterCopy",
"outputs": [
{
"name": "",
"type": "address"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getStatusAndOutcome",
"outputs": [
{
"name": "outcomeSet",
"type": "bool"
},
{
"name": "outcome",
"type": "int256"
}
],
"payable": false,
"stateMutability": "view",
"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\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"oracles\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getStatusAndOutcome\",\"outputs\":[{\"name\":\"outcomeSet\",\"type\":\"bool\"},{\"name\":\"outcome\",\"type\":\"int256\"}],\"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\":\"masterCopy\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"isOutcomeSet\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Stefan George - <stefan@gnosis.pm>\",\"methods\":{\"getOutcome()\":{\"details\":\"Returns winning outcome\",\"return\":\"Outcome\"},\"getStatusAndOutcome()\":{\"details\":\"Allows to registers oracles for a majority vote\",\"return\":\"Is outcome set?Outcome\"},\"isOutcomeSet()\":{\"details\":\"Returns if winning outcome is set\",\"return\":\"Is outcome set?\"}},\"title\":\"Majority oracle contract - Allows to resolve an event based on multiple oracles with majority vote\"},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/MajorityOracle.sol\":\"MajorityOracle\"},\"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": "0x608060405234801561001057600080fd5b50610586806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80635b69a7d81461005c5780636bcc035a146100ca5780637e7e4b47146100f3578063a619486e14610111578063ccdf68f31461015b575b600080fd5b6100886004803603602081101561007257600080fd5b810190808035906020019092919050505061017d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100d26101b9565b60405180831515151581526020018281526020019250505060405180910390f35b6100fb61050b565b6040518082815260200191505060405180910390f35b610119610520565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610163610545565b604051808215151515815260200191505060405180910390f35b6001818154811061018a57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600060606001805490506040519080825280602002602001820160405280156101f45781602001602082028038833980820191505090505b509050606060018054905060405190808252806020026020018201604052801561022d5781602001602082028038833980820191505090505b509050600092505b600180549050831015610479576001838154811061024f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ccdf68f36040518163ffffffff1660e01b815260040160206040518083038186803b1580156102bf57600080fd5b505afa1580156102d3573d6000803e3d6000fd5b505050506040513d60208110156102e957600080fd5b81019080805190602001909291905050501561046c5760006001848154811061030e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637e7e4b476040518163ffffffff1660e01b815260040160206040518083038186803b15801561037e57600080fd5b505afa158015610392573d6000803e3d6000fd5b505050506040513d60208110156103a857600080fd5b8101908080519060200190929190505050905060008090505b848111610469578381815181106103d457fe5b60200260200101518214156104085760018382815181106103f157fe5b602002602001018181510191508181525050610469565b600083828151811061041657fe5b6020026020010151141561045c578184828151811061043157fe5b602002602001018181525050600183828151811061044b57fe5b602002602001018181525050610469565b80806001019150506103c1565b50505b8280600101935050610235565b60008090506000809050600094505b6001805490508510156104d757818386815181106104a257fe5b602002602001015111156104ca578285815181106104bc57fe5b602002602001015191508490505b8480600101955050610488565b60018054905060028302111561050257600196508381815181106104f757fe5b602002602001015195505b50505050509091565b6000806105166101b9565b9150508091505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806105506101b9565b509050809150509056fea165627a7a72305820540524403074dd263f93967800c60d0bba6cd959d569737bff668e95af7ad8cf0029",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c80635b69a7d81461005c5780636bcc035a146100ca5780637e7e4b47146100f3578063a619486e14610111578063ccdf68f31461015b575b600080fd5b6100886004803603602081101561007257600080fd5b810190808035906020019092919050505061017d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100d26101b9565b60405180831515151581526020018281526020019250505060405180910390f35b6100fb61050b565b6040518082815260200191505060405180910390f35b610119610520565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610163610545565b604051808215151515815260200191505060405180910390f35b6001818154811061018a57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600060606001805490506040519080825280602002602001820160405280156101f45781602001602082028038833980820191505090505b509050606060018054905060405190808252806020026020018201604052801561022d5781602001602082028038833980820191505090505b509050600092505b600180549050831015610479576001838154811061024f57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ccdf68f36040518163ffffffff1660e01b815260040160206040518083038186803b1580156102bf57600080fd5b505afa1580156102d3573d6000803e3d6000fd5b505050506040513d60208110156102e957600080fd5b81019080805190602001909291905050501561046c5760006001848154811061030e57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637e7e4b476040518163ffffffff1660e01b815260040160206040518083038186803b15801561037e57600080fd5b505afa158015610392573d6000803e3d6000fd5b505050506040513d60208110156103a857600080fd5b8101908080519060200190929190505050905060008090505b848111610469578381815181106103d457fe5b60200260200101518214156104085760018382815181106103f157fe5b602002602001018181510191508181525050610469565b600083828151811061041657fe5b6020026020010151141561045c578184828151811061043157fe5b602002602001018181525050600183828151811061044b57fe5b602002602001018181525050610469565b80806001019150506103c1565b50505b8280600101935050610235565b60008090506000809050600094505b6001805490508510156104d757818386815181106104a257fe5b602002602001015111156104ca578285815181106104bc57fe5b602002602001015191508490505b8480600101955050610488565b60018054905060028302111561050257600196508381815181106104f757fe5b602002602001015195505b50505050509091565b6000806105166101b9565b9150508091505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806105506101b9565b509050809150509056fea165627a7a72305820540524403074dd263f93967800c60d0bba6cd959d569737bff668e95af7ad8cf0029",
"sourceMap": "961:1972:20:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;961:1972:20;;;;;;;",
"deployedSourceMap": "961:1972:20:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;961:1972:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;180:23;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;180:23:20;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1188:1255;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2761:170;;;:::i;:::-;;;;;;;;;;;;;;;;;;;205:25:29;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;2528:166:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;180:23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1188:1255::-;1264:15;1281:11;1308:6;1324:21;1358:7;:14;;;;1348:25;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;1348:25:20;;;;1324:49;;1383:25;1422:7;:14;;;;1411:26;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;148:4;140:6;136:17;126:27;;0:157;1411:26:20;;;;1383:54;;1456:1;1452:5;;1447:543;1463:7;:14;;;;1459:1;:18;1447:543;;;1500:7;1508:1;1500:10;;;;;;;;;;;;;;;;;;;;;;;;;:23;;;:25;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1500:25:20;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1500:25:20;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1500:25:20;;;;;;;;;;;;;;;;1496:494;;;1545:12;1560:7;1568:1;1560:10;;;;;;;;;;;;;;;;;;;;;;;;;:21;;;:23;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1560:23:20;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1560:23:20;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;1560:23:20;;;;;;;;;;;;;;;;1545:38;;1606:6;1615:1;1606:10;;1601:375;1623:1;1618;:6;1601:375;;1667:8;1676:1;1667:11;;;;;;;;;;;;;;1655:8;:23;1651:325;;;1724:1;1706:11;1718:1;1706:14;;;;;;;;;;;;;:19;;;;;;;;;;;1751:5;;1651:325;1827:1;1809:11;1821:1;1809:14;;;;;;;;;;;;;;:19;1805:171;;;1870:8;1856;1865:1;1856:11;;;;;;;;;;;;;:22;;;;;1921:1;1904:11;1916:1;1904:14;;;;;;;;;;;;;:18;;;;;1948:5;;1805:171;1626:3;;;;;;;1601:375;;;;1496:494;;1479:3;;;;;;;1447:543;;;1999:23;2025:1;1999:27;;2036:17;2056:1;2036:21;;2076:1;2072:5;;2067:192;2083:7;:14;;;;2079:1;:18;2067:192;;;2137:18;2120:11;2132:1;2120:14;;;;;;;;;;;;;;:35;2116:143;;;2196:11;2208:1;2196:14;;;;;;;;;;;;;;2175:35;;2243:1;2228:16;;2116:143;2099:3;;;;;;;2067:192;;;2333:7;:14;;;;2329:1;2308:18;:22;:39;2304:133;;;2376:4;2363:17;;2404:8;2413:12;2404:22;;;;;;;;;;;;;;2394:32;;2304:133;1188:1255;;;;;;;:::o;2761:170::-;2828:3;2850:18;2872:21;:19;:21::i;:::-;2847:46;;;2910:14;2903:21;;;2761:170;:::o;205:25:29:-;;;;;;;;;;;;;:::o;2528:166:20:-;2597:4;2618:15;2639:21;:19;:21::i;:::-;2617:43;;;2677:10;2670:17;;;2528:166;:::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,