UNPKG

@gnosis.pm/pm-contracts

Version:

Collection of smart contracts for the Gnosis prediction market platform

1,108 lines (1,107 loc) 255 kB
{ "contractName": "EventData", "abi": [ { "constant": true, "inputs": [], "name": "outcome", "outputs": [ { "name": "", "type": "int256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "oracle", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "outcomeTokens", "outputs": [ { "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "collateralToken", "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" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "outcomeToken", "type": "address" }, { "indexed": false, "name": "index", "type": "uint8" } ], "name": "OutcomeTokenCreation", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "buyer", "type": "address" }, { "indexed": false, "name": "collateralTokenCount", "type": "uint256" } ], "name": "OutcomeTokenSetIssuance", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "seller", "type": "address" }, { "indexed": false, "name": "outcomeTokenCount", "type": "uint256" } ], "name": "OutcomeTokenSetRevocation", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "outcome", "type": "int256" } ], "name": "OutcomeAssignment", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": true, "name": "receiver", "type": "address" }, { "indexed": false, "name": "winnings", "type": "uint256" } ], "name": "WinningsRedemption", "type": "event" } ], "metadata": "{\"compiler\":{\"version\":\"0.5.6+commit.b259423e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"outcome\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"oracle\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"outcomeTokens\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"collateralToken\",\"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\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"outcomeToken\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"index\",\"type\":\"uint8\"}],\"name\":\"OutcomeTokenCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"buyer\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"collateralTokenCount\",\"type\":\"uint256\"}],\"name\":\"OutcomeTokenSetIssuance\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"seller\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"outcomeTokenCount\",\"type\":\"uint256\"}],\"name\":\"OutcomeTokenSetRevocation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"outcome\",\"type\":\"int256\"}],\"name\":\"OutcomeAssignment\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"receiver\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"winnings\",\"type\":\"uint256\"}],\"name\":\"WinningsRedemption\",\"type\":\"event\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/Event.sol\":\"EventData\"},\"evmVersion\":\"petersburg\",\"libraries\":{},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/Event.sol\":{\"keccak256\":\"0xdcacfa25145426b5681ad7d8bafb3c117c92a37b7a0175d72a10b42f130fb8c1\",\"urls\":[\"bzzr://bd10fbdb82f0d50866442c9e95317b3176c8ee067def27d764529973fb36420a\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol\":{\"keccak256\":\"0xf4d12f4a59c17e66dfa6791188f621a8914e2038a4e3f72d6fc9fb903ca8e18e\",\"urls\":[\"bzzr://a477ccd203e677cc904b1a4f8fcc85251c5b5e09c5c10eed27e01318584b16d1\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Tokens/OutcomeToken.sol\":{\"keccak256\":\"0x3d4c9ec14a60cf7577d366da5116e919a4331da8d6d993174f7d599f84ae74e0\",\"urls\":[\"bzzr://20f87450259a3af24ff1769faa9ab3b714d01921e9d8fa4efa75a0c277837a8a\"]},\"@gnosis.pm/util-contracts/contracts/Proxy.sol\":{\"keccak256\":\"0xeab0e83a9ec9e7f052c0455a11577061ec6d1994db08dae429abd6faaabf6555\",\"urls\":[\"bzzr://b2c1273d4ec30e2f9e768eea8c510f8493a7359b03e01923d93eea86b57ec145\"]},\"openzeppelin-solidity/contracts/math/SafeMath.sol\":{\"keccak256\":\"0x4ccf2d7b51873db1ccfd54ca2adae5eac3b184f9699911ed4490438419f1c690\",\"urls\":[\"bzzr://1604f5b6d6e916c154efd8c6720cda069e5ba32dfa0a9dedf2b42e5b02d07f89\"]},\"openzeppelin-solidity/contracts/token/ERC20/ERC20.sol\":{\"keccak256\":\"0x852793a3c2f86d336a683b30d688ec3dcfc57451af5a2bf5975cda3b7191a901\",\"urls\":[\"bzzr://07fb42206812a17c1f71e548cfa5cec6f9aa1ae0ca5df870718ca4aa9759d1a5\"]},\"openzeppelin-solidity/contracts/token/ERC20/IERC20.sol\":{\"keccak256\":\"0x90e8c2521653bbb1768b05889c5760031e688d9cd361f167489b89215e201b95\",\"urls\":[\"bzzr://aa8b45b57edafc3d67bc5d916327ea16807fae33f753ca163ae0c4061b789766\"]}},\"version\":1}", "bytecode": "0x608060405234801561001057600080fd5b5061026a806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806327793f871461005c5780637dc0d1d01461007a5780638abe59ea146100c4578063b2016bd414610132578063ccdf68f31461017c575b600080fd5b61006461019e565b6040518082815260200191505060405180910390f35b6100826101a4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100f0600480360360208110156100da57600080fd5b81019080803590602001909291905050506101ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61013a610206565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61018461022b565b604051808215151515815260200191505060405180910390f35b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600381815481106101d757fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160149054906101000a900460ff168156fea165627a7a72305820e61c59682a1c2e1bb779745ddc4559569b0034d436225277663eadcbf8e18e120029", "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100575760003560e01c806327793f871461005c5780637dc0d1d01461007a5780638abe59ea146100c4578063b2016bd414610132578063ccdf68f31461017c575b600080fd5b61006461019e565b6040518082815260200191505060405180910390f35b6100826101a4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100f0600480360360208110156100da57600080fd5b81019080803590602001909291905050506101ca565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61013a610206565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61018461022b565b604051808215151515815260200191505060405180910390f35b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600381815481106101d757fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160149054906101000a900460ff168156fea165627a7a72305820e61c59682a1c2e1bb779745ddc4559569b0034d436225277663eadcbf8e18e120029", "sourceMap": "215:595:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;215:595:1;;;;;;;", "deployedSourceMap": "215:595:1:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;215:595:1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;748:18;;;:::i;:::-;;;;;;;;;;;;;;;;;;;692:20;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;772:35;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;772:35:1;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;658:28;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;718:24;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;748:18;;;;:::o;692:20::-;;;;;;;;;;;;;:::o;772:35::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;658:28::-;;;;;;;;;;;;;:::o;718:24::-;;;;;;;;;;;;;:::o", "source": "pragma solidity ^0.5.0;\nimport \"openzeppelin-solidity/contracts/token/ERC20/ERC20.sol\";\nimport \"../Tokens/OutcomeToken.sol\";\nimport \"../Oracles/Oracle.sol\";\nimport \"@gnosis.pm/util-contracts/contracts/Proxy.sol\";\n\n\ncontract EventData {\n\n /*\n * Events\n */\n event OutcomeTokenCreation(OutcomeToken outcomeToken, uint8 index);\n event OutcomeTokenSetIssuance(address indexed buyer, uint collateralTokenCount);\n event OutcomeTokenSetRevocation(address indexed seller, uint outcomeTokenCount);\n event OutcomeAssignment(int outcome);\n event WinningsRedemption(address indexed receiver, uint winnings);\n\n /*\n * Storage\n */\n ERC20 public collateralToken;\n Oracle public oracle;\n bool public isOutcomeSet;\n int public outcome;\n OutcomeToken[] public outcomeTokens;\n}\n\n/// @title Event contract - Provide basic functionality required by different event types\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract Event is EventData {\n\n /*\n * Public functions\n */\n /// @dev Buys equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1\n /// @param collateralTokenCount Number of collateral tokens\n function buyAllOutcomes(uint collateralTokenCount)\n public\n {\n // Transfer collateral tokens to events contract\n require(collateralToken.transferFrom(msg.sender, address(this), collateralTokenCount));\n // Issue new outcome tokens to sender\n for (uint8 i = 0; i < outcomeTokens.length; i++)\n outcomeTokens[i].issue(msg.sender, collateralTokenCount);\n emit OutcomeTokenSetIssuance(msg.sender, collateralTokenCount);\n }\n\n /// @dev Sells equal number of tokens of all outcomes, exchanging collateral tokens and sets of outcome tokens 1:1\n /// @param outcomeTokenCount Number of outcome tokens\n function sellAllOutcomes(uint outcomeTokenCount)\n public\n {\n // Revoke sender's outcome tokens of all outcomes\n for (uint8 i = 0; i < outcomeTokens.length; i++)\n outcomeTokens[i].revoke(msg.sender, outcomeTokenCount);\n // Transfer collateral tokens to sender\n require(collateralToken.transfer(msg.sender, outcomeTokenCount));\n emit OutcomeTokenSetRevocation(msg.sender, outcomeTokenCount);\n }\n\n /// @dev Sets winning event outcome\n function setOutcome()\n public\n {\n // Winning outcome is not set yet in event contract but in oracle contract\n require(!isOutcomeSet && oracle.isOutcomeSet());\n // Set winning outcome\n outcome = oracle.getOutcome();\n isOutcomeSet = true;\n emit OutcomeAssignment(outcome);\n }\n\n /// @dev Returns outcome count\n /// @return Outcome count\n function getOutcomeCount()\n public\n view\n returns (uint8)\n {\n return uint8(outcomeTokens.length);\n }\n\n /// @dev Returns outcome tokens array\n /// @return Outcome tokens\n function getOutcomeTokens()\n public\n view\n returns (OutcomeToken[] memory)\n {\n return outcomeTokens;\n }\n\n /// @dev Returns the amount of outcome tokens held by owner\n /// @return Outcome token distribution\n function getOutcomeTokenDistribution(address owner)\n public\n view\n returns (uint[] memory outcomeTokenDistribution)\n {\n outcomeTokenDistribution = new uint[](outcomeTokens.length);\n for (uint8 i = 0; i < outcomeTokenDistribution.length; i++)\n outcomeTokenDistribution[i] = outcomeTokens[i].balanceOf(owner);\n }\n\n /// @dev Calculates and returns event hash\n /// @return Event hash\n function getEventHash() public view returns (bytes32);\n\n /// @dev Exchanges sender's winning outcome tokens for collateral tokens\n /// @return Sender's winnings\n function redeemWinnings() public returns (uint);\n}\n", "sourcePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/Event.sol", "ast": { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Events/Event.sol", "exportedSymbols": { "Event": [ 392 ], "EventData": [ 204 ] }, "id": 393, "nodeType": "SourceUnit", "nodes": [ { "id": 160, "literals": [ "solidity", "^", "0.5", ".0" ], "nodeType": "PragmaDirective", "src": "0:23:1" }, { "absolutePath": "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol", "file": "openzeppelin-solidity/contracts/token/ERC20/ERC20.sol", "id": 161, "nodeType": "ImportDirective", "scope": 393, "sourceUnit": 7779, "src": "24:63:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Tokens/OutcomeToken.sol", "file": "../Tokens/OutcomeToken.sol", "id": 162, "nodeType": "ImportDirective", "scope": 393, "sourceUnit": 5794, "src": "88:36:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Oracles/Oracle.sol", "file": "../Oracles/Oracle.sol", "id": 163, "nodeType": "ImportDirective", "scope": 393, "sourceUnit": 4842, "src": "125:31:1", "symbolAliases": [], "unitAlias": "" }, { "absolutePath": "@gnosis.pm/util-contracts/contracts/Proxy.sol", "file": "@gnosis.pm/util-contracts/contracts/Proxy.sol", "id": 164, "nodeType": "ImportDirective", "scope": 393, "sourceUnit": 6829, "src": "157:55:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [], "contractDependencies": [], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 204, "linearizedBaseContracts": [ 204 ], "name": "EventData", "nodeType": "ContractDefinition", "nodes": [ { "anonymous": false, "documentation": null, "id": 170, "name": "OutcomeTokenCreation", "nodeType": "EventDefinition", "parameters": { "id": 169, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 166, "indexed": false, "name": "outcomeToken", "nodeType": "VariableDeclaration", "scope": 170, "src": "298:25:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_OutcomeToken_$5793", "typeString": "contract OutcomeToken" }, "typeName": { "contractScope": null, "id": 165, "name": "OutcomeToken", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5793, "src": "298:12:1", "typeDescriptions": { "typeIdentifier": "t_contract$_OutcomeToken_$5793", "typeString": "contract OutcomeToken" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 168, "indexed": false, "name": "index", "nodeType": "VariableDeclaration", "scope": 170, "src": "325:11:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" }, "typeName": { "id": 167, "name": "uint8", "nodeType": "ElementaryTypeName", "src": "325:5:1", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "value": null, "visibility": "internal" } ], "src": "297:40:1" }, "src": "271:67:1" }, { "anonymous": false, "documentation": null, "id": 176, "name": "OutcomeTokenSetIssuance", "nodeType": "EventDefinition", "parameters": { "id": 175, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 172, "indexed": true, "name": "buyer", "nodeType": "VariableDeclaration", "scope": 176, "src": "373:21:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 171, "name": "address", "nodeType": "ElementaryTypeName", "src": "373:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 174, "indexed": false, "name": "collateralTokenCount", "nodeType": "VariableDeclaration", "scope": 176, "src": "396:25:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 173, "name": "uint", "nodeType": "ElementaryTypeName", "src": "396:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "372:50:1" }, "src": "343:80:1" }, { "anonymous": false, "documentation": null, "id": 182, "name": "OutcomeTokenSetRevocation", "nodeType": "EventDefinition", "parameters": { "id": 181, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 178, "indexed": true, "name": "seller", "nodeType": "VariableDeclaration", "scope": 182, "src": "460:22:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 177, "name": "address", "nodeType": "ElementaryTypeName", "src": "460:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 180, "indexed": false, "name": "outcomeTokenCount", "nodeType": "VariableDeclaration", "scope": 182, "src": "484:22:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 179, "name": "uint", "nodeType": "ElementaryTypeName", "src": "484:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "459:48:1" }, "src": "428:80:1" }, { "anonymous": false, "documentation": null, "id": 186, "name": "OutcomeAssignment", "nodeType": "EventDefinition", "parameters": { "id": 185, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 184, "indexed": false, "name": "outcome", "nodeType": "VariableDeclaration", "scope": 186, "src": "537:11:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id": 183, "name": "int", "nodeType": "ElementaryTypeName", "src": "537:3:1", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "value": null, "visibility": "internal" } ], "src": "536:13:1" }, "src": "513:37:1" }, { "anonymous": false, "documentation": null, "id": 192, "name": "WinningsRedemption", "nodeType": "EventDefinition", "parameters": { "id": 191, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 188, "indexed": true, "name": "receiver", "nodeType": "VariableDeclaration", "scope": 192, "src": "580:24:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" }, "typeName": { "id": 187, "name": "address", "nodeType": "ElementaryTypeName", "src": "580:7:1", "stateMutability": "nonpayable", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 190, "indexed": false, "name": "winnings", "nodeType": "VariableDeclaration", "scope": 192, "src": "606:13:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 189, "name": "uint", "nodeType": "ElementaryTypeName", "src": "606:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "579:41:1" }, "src": "555:66:1" }, { "constant": false, "id": 194, "name": "collateralToken", "nodeType": "VariableDeclaration", "scope": 204, "src": "658:28:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20_$7778", "typeString": "contract ERC20" }, "typeName": { "contractScope": null, "id": 193, "name": "ERC20", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 7778, "src": "658:5:1", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20_$7778", "typeString": "contract ERC20" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 196, "name": "oracle", "nodeType": "VariableDeclaration", "scope": 204, "src": "692:20:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" }, "typeName": { "contractScope": null, "id": 195, "name": "Oracle", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 4841, "src": "692:6:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Oracle_$4841", "typeString": "contract Oracle" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 198, "name": "isOutcomeSet", "nodeType": "VariableDeclaration", "scope": 204, "src": "718:24:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 197, "name": "bool", "nodeType": "ElementaryTypeName", "src": "718:4:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 200, "name": "outcome", "nodeType": "VariableDeclaration", "scope": 204, "src": "748:18:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" }, "typeName": { "id": 199, "name": "int", "nodeType": "ElementaryTypeName", "src": "748:3:1", "typeDescriptions": { "typeIdentifier": "t_int256", "typeString": "int256" } }, "value": null, "visibility": "public" }, { "constant": false, "id": 203, "name": "outcomeTokens", "nodeType": "VariableDeclaration", "scope": 204, "src": "772:35:1", "stateVariable": true, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_OutcomeToken_$5793_$dyn_storage", "typeString": "contract OutcomeToken[]" }, "typeName": { "baseType": { "contractScope": null, "id": 201, "name": "OutcomeToken", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 5793, "src": "772:12:1", "typeDescriptions": { "typeIdentifier": "t_contract$_OutcomeToken_$5793", "typeString": "contract OutcomeToken" } }, "id": 202, "length": null, "nodeType": "ArrayTypeName", "src": "772:14:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_OutcomeToken_$5793_$dyn_storage_ptr", "typeString": "contract OutcomeToken[]" } }, "value": null, "visibility": "public" } ], "scope": 393, "src": "215:595:1" }, { "baseContracts": [ { "arguments": null, "baseName": { "contractScope": null, "id": 205, "name": "EventData", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 204, "src": "967:9:1", "typeDescriptions": { "typeIdentifier": "t_contract$_EventData_$204", "typeString": "contract EventData" } }, "id": 206, "nodeType": "InheritanceSpecifier", "src": "967:9:1" } ], "contractDependencies": [ 204 ], "contractKind": "contract", "documentation": "@title Event contract - Provide basic functionality required by different event types\n @author Stefan George - <stefan@gnosis.pm>", "fullyImplemented": false, "id": 392, "linearizedBaseContracts": [ 392, 204 ], "name": "Event", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 250, "nodeType": "Block", "src": "1276:405:1", "statements": [ { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 214, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7920, "src": "1380:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 215, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1380:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "id": 217, "name": "this", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7952, "src": "1400:4:1", "typeDescriptions": { "typeIdentifier": "t_contract$_Event_$392", "typeString": "contract Event" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_contract$_Event_$392", "typeString": "contract Event" } ], "id": 216, "isConstant": false, "isLValue": false, "isPure": true, "lValueRequested": false, "nodeType": "ElementaryTypeNameExpression", "src": "1392:7:1", "typeDescriptions": { "typeIdentifier": "t_type$_t_address_$", "typeString": "type(address)" }, "typeName": "address" }, "id": 218, "isConstant": false, "isLValue": false, "isPure": false, "kind": "typeConversion", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1392:13:1", "typeDescriptions": { "typeIdentifier": "t_address", "typeString": "address" } }, { "argumentTypes": null, "id": 219, "name": "collateralTokenCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 208, "src": "1407:20:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_address", "typeString": "address" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "id": 212, "name": "collateralToken", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 194, "src": "1351:15:1", "typeDescriptions": { "typeIdentifier": "t_contract$_ERC20_$7778", "typeString": "contract ERC20" } }, "id": 213, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "transferFrom", "nodeType": "MemberAccess", "referencedDeclaration": 7511, "src": "1351:28:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$_t_uint256_$returns$_t_bool_$", "typeString": "function (address,address,uint256) external returns (bool)" } }, "id": 220, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1351:77:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_bool", "typeString": "bool" } ], "id": 211, "name": "require", "nodeType": "Identifier", "overloadedDeclarations": [ 7923, 7924 ], "referencedDeclaration": 7923, "src": "1343:7:1", "typeDescriptions": { "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", "typeString": "function (bool) pure" } }, "id": 221, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1343:86:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 222, "nodeType": "ExpressionStatement", "src": "1343:86:1" }, { "body": { "expression": { "argumentTypes": null, "arguments": [ { "argumentTypes": null, "expression": { "argumentTypes": null, "id": 238, "name": "msg", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 7920, "src": "1569:3:1", "typeDescriptions": { "typeIdentifier": "t_magic_message", "typeString": "msg" } }, "id": 239, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "sender", "nodeType": "MemberAccess", "referencedDeclaration": null, "src": "1569:10:1", "typeDescriptions": { "typeIdentifier": "t_address_payable", "typeString": "address payable" } }, { "argumentTypes": null, "id": 240, "name": "collateralTokenCount", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 208, "src": "1581:20:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "expression": { "argumentTypes": [ { "typeIdentifier": "t_address_payable", "typeString": "address payable" }, { "typeIdentifier": "t_uint256", "typeString": "uint256" } ], "expression": { "argumentTypes": null, "baseExpression": { "argumentTypes": null, "id": 234, "name": "outcomeTokens", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 203, "src": "1546:13:1", "typeDescriptions": { "typeIdentifier": "t_array$_t_contract$_OutcomeToken_$5793_$dyn_storage", "typeString": "contract OutcomeToken[] storage ref" } }, "id": 236, "indexExpression": { "argumentTypes": null, "id": 235, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 224, "src": "1560:1:1", "typeDescriptions": { "typeIdentifier": "t_uint8", "typeString": "uint8" } }, "isConstant": false, "isLValue": true, "isPure": false, "lValueRequested": false, "nodeType": "IndexAccess", "src": "1546:16:1", "typeDescriptions": { "typeIdentifier": "t_contract$_OutcomeToken_$5793", "typeString": "contract OutcomeToken" } }, "id": 237, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "memberName": "issue", "nodeType": "MemberAccess", "referencedDeclaration": 5772, "src": "1546:22:1", "typeDescriptions": { "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_uint256_$returns$__$", "typeString": "function (address,uint256) external" } }, "id": 241, "isConstant": false, "isLValue": false, "isPure": false, "kind": "functionCall", "lValueRequested": false, "names": [], "nodeType": "FunctionCall", "src": "1546:56:1", "typeDescriptions": { "typeIdentifier": "t_tuple$__$", "typeString": "tuple()" } }, "id": 242, "nodeType": "ExpressionStatement", "src": "1546:56:1" }, "condition": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 230, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 227, "name": "i", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 224,