@gnosis.pm/pm-contracts
Version:
Collection of smart contracts for the Gnosis prediction market platform
1,037 lines • 309 kB
JSON
{
"contractName": "StandardMarketWithPriceLoggerData",
"abi": [
{
"constant": true,
"inputs": [],
"name": "startDate",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "LONG",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "lastTradeDate",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "priceIntegral",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "endDate",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "lastTradePrice",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.5.6+commit.b259423e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"constant\":true,\"inputs\":[],\"name\":\"startDate\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"LONG\",\"outputs\":[{\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"lastTradeDate\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"priceIntegral\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"endDate\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"lastTradePrice\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/StandardMarketWithPriceLogger.sol\":\"StandardMarketWithPriceLoggerData\"},\"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/MarketMakers/MarketMaker.sol\":{\"keccak256\":\"0xa71f8ce92412033d0900d44c01f0702aefced87d860cf116c6a4d3efe86913cf\",\"urls\":[\"bzzr://63c5bf60b931bb032fcab23514a3db171b680b11d8c6c05ac8caa88752e3be41\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/Market.sol\":{\"keccak256\":\"0x7bc1ebf0ea0f4cd9b6e9bfff6c6ac9088c253bcfca4e27f31e5845799f0278d8\",\"urls\":[\"bzzr://5e3f86d96ab269d284b34563501469d539cc436d62f070dd0abda2519d5e60c0\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/StandardMarket.sol\":{\"keccak256\":\"0x527abf1b0997e2d38ce3c97f7ed647b9e913424828594287e2b068f2fb41ad4c\",\"urls\":[\"bzzr://16756e1b212fd40f21de50d99c8b7a5dde0acc2b0b047af8beead831a1274bd7\"]},\"/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/StandardMarketWithPriceLogger.sol\":{\"keccak256\":\"0xac611de823e324e444a9749619091be1f81edfd67af6109581c2f8655251fb8e\",\"urls\":[\"bzzr://feb7902d610a1e499e0330780e0e9638d4372ad941e5d5896cb1730df791405a\"]},\"/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/drafts/SignedSafeMath.sol\":{\"keccak256\":\"0xb4b45cd5475c318722ac0f8d7e2b9e77fee6f4f36374c1110fe615d50fbc0650\",\"urls\":[\"bzzr://a90fb457269c8a03ec5b811c71acef08a2751a4d2019b0661328610f9357dae7\"]},\"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": "0x608060405234801561001057600080fd5b50610170806100206000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80630b97bc8614610067578063561cce0a1461008557806368b586d5146100a95780638b797a0c146100c7578063c24a0f8b146100e5578063df449cb814610103575b600080fd5b61006f610121565b6040518082815260200191505060405180910390f35b61008d610127565b604051808260ff1660ff16815260200191505060405180910390f35b6100b161012c565b6040518082815260200191505060405180910390f35b6100cf610132565b6040518082815260200191505060405180910390f35b6100ed610138565b6040518082815260200191505060405180910390f35b61010b61013e565b6040518082815260200191505060405180910390f35b60005481565b600181565b60025481565b60045481565b60015481565b6003548156fea165627a7a7230582005d855ff89b6e1a4c8a06a66ae3bfcffc1475a203a6640ed8e3829b88b0e87db0029",
"deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100625760003560e01c80630b97bc8614610067578063561cce0a1461008557806368b586d5146100a95780638b797a0c146100c7578063c24a0f8b146100e5578063df449cb814610103575b600080fd5b61006f610121565b6040518082815260200191505060405180910390f35b61008d610127565b604051808260ff1660ff16815260200191505060405180910390f35b6100b161012c565b6040518082815260200191505060405180910390f35b6100cf610132565b6040518082815260200191505060405180910390f35b6100ed610138565b6040518082815260200191505060405180910390f35b61010b61013e565b6040518082815260200191505060405180910390f35b60005481565b600181565b60025481565b60045481565b60015481565b6003548156fea165627a7a7230582005d855ff89b6e1a4c8a06a66ae3bfcffc1475a203a6640ed8e3829b88b0e87db0029",
"sourceMap": "65:339:11:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;65:339:11;;;;;;;",
"deployedSourceMap": "65:339:11:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;65:339:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;261:21;;;:::i;:::-;;;;;;;;;;;;;;;;;;;193:30;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;313:25;;;:::i;:::-;;;;;;;;;;;;;;;;;;;376;;;:::i;:::-;;;;;;;;;;;;;;;;;;;288:19;;;:::i;:::-;;;;;;;;;;;;;;;;;;;344:26;;;:::i;:::-;;;;;;;;;;;;;;;;;;;261:21;;;;:::o;193:30::-;222:1;193:30;:::o;313:25::-;;;;:::o;376:::-;;;;:::o;288:19::-;;;;:::o;344:26::-;;;;:::o",
"source": "pragma solidity ^0.5.0;\nimport \"../Markets/StandardMarket.sol\";\n\ncontract StandardMarketWithPriceLoggerData {\n\n /*\n * Constants\n */\n uint constant ONE = 0x10000000000000000;\n uint8 public constant LONG = 1;\n\n /*\n * Storage\n */\n uint public startDate;\n uint public endDate;\n uint public lastTradeDate;\n uint public lastTradePrice;\n uint public priceIntegral;\n}\n\ncontract StandardMarketWithPriceLoggerProxy is StandardMarketProxy, StandardMarketWithPriceLoggerData {\n\n /// @dev Constructor validates and sets market properties\n /// @param _creator Market creator\n /// @param _eventContract Event contract\n /// @param _marketMaker Market maker contract\n /// @param _fee Market fee\n /// @param _startDate Start date for price logging\n constructor(address proxied, address _creator, Event _eventContract, MarketMaker _marketMaker, uint24 _fee, uint _startDate)\n public\n StandardMarketProxy(proxied, _creator, _eventContract, _marketMaker, _fee)\n {\n require(eventContract.getOutcomeCount() == 2);\n\n if (_startDate == 0)\n startDate = now;\n else {\n // The earliest start date is the market creation date\n require(_startDate >= now);\n startDate = _startDate;\n }\n\n lastTradeDate = startDate;\n // initialize lastTradePrice to assuming uniform probabilities of outcomes\n lastTradePrice = ONE / 2;\n }\n}\n\ncontract StandardMarketWithPriceLogger is StandardMarket, StandardMarketWithPriceLoggerData {\n /*\n * Public functions\n */\n /// @dev Allows to buy outcome tokens from market maker\n /// @param outcomeTokenIndex Index of the outcome token to buy\n /// @param outcomeTokenCount Amount of outcome tokens to buy\n /// @param maxCost The maximum cost in collateral tokens to pay for outcome tokens\n /// @return Cost in collateral tokens\n function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost)\n public\n returns (uint cost)\n {\n logPriceBefore();\n cost = super.buy(outcomeTokenIndex, outcomeTokenCount, maxCost);\n logPriceAfter();\n }\n\n /// @dev Allows to sell outcome tokens to market maker\n /// @param outcomeTokenIndex Index of the outcome token to sell\n /// @param outcomeTokenCount Amount of outcome tokens to sell\n /// @param minProfit The minimum profit in collateral tokens to earn for outcome tokens\n /// @return Profit in collateral tokens\n function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)\n public\n returns (uint profit)\n {\n logPriceBefore();\n profit = super.sell(outcomeTokenIndex, outcomeTokenCount, minProfit);\n logPriceAfter();\n }\n\n /// @dev Buys all outcomes, then sells all shares of selected outcome which were bought, keeping\n /// shares of all other outcome tokens.\n /// @param outcomeTokenIndex Index of the outcome token to short sell\n /// @param outcomeTokenCount Amount of outcome tokens to short sell\n /// @param minProfit The minimum profit in collateral tokens to earn for short sold outcome tokens\n /// @return Cost to short sell outcome in collateral tokens\n function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)\n public\n returns (uint cost)\n {\n logPriceBefore();\n cost = super.shortSell(outcomeTokenIndex, outcomeTokenCount, minProfit);\n logPriceAfter();\n }\n\n /// @dev Allows to trade outcome tokens with market maker\n /// @param outcomeTokenAmounts Amounts of outcome tokens to trade\n /// @param collateralLimit The maximum cost or minimum profit in collateral tokens\n /// @return Cost/profit in collateral tokens\n function trade(int[] memory outcomeTokenAmounts, int collateralLimit)\n public\n returns (int netCost)\n {\n logPriceBefore();\n netCost = super.trade(outcomeTokenAmounts, collateralLimit);\n logPriceAfter();\n }\n\n\n /// @dev Allows market creator to close the markets by transferring all remaining outcome tokens to the creator\n function close()\n public\n {\n endDate = now;\n super.close();\n }\n\n /// @dev Calculates average price for long tokens based on price integral\n /// @return Average price for long tokens over time\n function getAvgPrice()\n public\n view\n returns (uint)\n {\n if(endDate > 0)\n return (priceIntegral + lastTradePrice * (endDate - lastTradeDate)) / (endDate - startDate);\n return (priceIntegral + lastTradePrice * (now - lastTradeDate)) / (now - startDate);\n }\n\n /*\n * Private functions\n */\n /// @dev Adds price integral since the last trade to the total price integral\n function logPriceBefore()\n private\n {\n if (now >= startDate) {\n // Accumulate price integral only if logging has begun\n priceIntegral += lastTradePrice * (now - lastTradeDate);\n }\n }\n\n /// @dev Updates last trade timestamp and price\n function logPriceAfter()\n private\n {\n // Refresh lastTradePrice after every transactions as we don't know if\n // this will be the last transaction before logging period starts\n lastTradePrice = marketMaker.calcMarginalPrice(this, LONG);\n lastTradeDate = now;\n }\n}\n",
"sourcePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/StandardMarketWithPriceLogger.sol",
"ast": {
"absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/StandardMarketWithPriceLogger.sol",
"exportedSymbols": {
"StandardMarketWithPriceLogger": [
3549
],
"StandardMarketWithPriceLoggerData": [
3286
],
"StandardMarketWithPriceLoggerProxy": [
3351
]
},
"id": 3550,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 3268,
"literals": [
"solidity",
"^",
"0.5",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:23:11"
},
{
"absolutePath": "/home/alan/src/github.com/gnosis/pm-contracts/contracts/Markets/StandardMarket.sol",
"file": "../Markets/StandardMarket.sol",
"id": 3269,
"nodeType": "ImportDirective",
"scope": 3550,
"sourceUnit": 3200,
"src": "24:39:11",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 3286,
"linearizedBaseContracts": [
3286
],
"name": "StandardMarketWithPriceLoggerData",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 3272,
"name": "ONE",
"nodeType": "VariableDeclaration",
"scope": 3286,
"src": "148:39:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3270,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "148:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30783130303030303030303030303030303030",
"id": 3271,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "168:19:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_18446744073709551616_by_1",
"typeString": "int_const 18446744073709551616"
},
"value": "0x10000000000000000"
},
"visibility": "internal"
},
{
"constant": true,
"id": 3275,
"name": "LONG",
"nodeType": "VariableDeclaration",
"scope": 3286,
"src": "193:30:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 3273,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "193:5:11",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": {
"argumentTypes": null,
"hexValue": "31",
"id": 3274,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "222:1:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"visibility": "public"
},
{
"constant": false,
"id": 3277,
"name": "startDate",
"nodeType": "VariableDeclaration",
"scope": 3286,
"src": "261:21:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3276,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "261:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 3279,
"name": "endDate",
"nodeType": "VariableDeclaration",
"scope": 3286,
"src": "288:19:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3278,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "288:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 3281,
"name": "lastTradeDate",
"nodeType": "VariableDeclaration",
"scope": 3286,
"src": "313:25:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3280,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "313:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 3283,
"name": "lastTradePrice",
"nodeType": "VariableDeclaration",
"scope": 3286,
"src": "344:26:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3282,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "344:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 3285,
"name": "priceIntegral",
"nodeType": "VariableDeclaration",
"scope": 3286,
"src": "376:25:11",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 3284,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "376:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "public"
}
],
"scope": 3550,
"src": "65:339:11"
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 3287,
"name": "StandardMarketProxy",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 2389,
"src": "453:19:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_StandardMarketProxy_$2389",
"typeString": "contract StandardMarketProxy"
}
},
"id": 3288,
"nodeType": "InheritanceSpecifier",
"src": "453:19:11"
},
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 3289,
"name": "StandardMarketWithPriceLoggerData",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 3286,
"src": "474:33:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_StandardMarketWithPriceLoggerData_$3286",
"typeString": "contract StandardMarketWithPriceLoggerData"
}
},
"id": 3290,
"nodeType": "InheritanceSpecifier",
"src": "474:33:11"
}
],
"contractDependencies": [
2230,
2307,
2389,
3286,
6798,
6828
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 3351,
"linearizedBaseContracts": [
3351,
3286,
2389,
2307,
2230,
6828,
6798
],
"name": "StandardMarketWithPriceLoggerProxy",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 3349,
"nodeType": "Block",
"src": "1024:442:11",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"id": 3317,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [],
"expression": {
"argumentTypes": [],
"expression": {
"argumentTypes": null,
"id": 3313,
"name": "eventContract",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2214,
"src": "1042:13:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Event_$392",
"typeString": "contract Event"
}
},
"id": 3314,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "getOutcomeCount",
"nodeType": "MemberAccess",
"referencedDeclaration": 331,
"src": "1042:29:11",
"typeDescriptions": {
"typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$",
"typeString": "function () view external returns (uint8)"
}
},
"id": 3315,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1042:31:11",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "32",
"id": 3316,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1077:1:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"src": "1042:36:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 3312,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7923,
7924
],
"referencedDeclaration": 7923,
"src": "1034:7:11",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 3318,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1034:45:11",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 3319,
"nodeType": "ExpressionStatement",
"src": "1034:45:11"
},
{
"condition": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3322,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 3320,
"name": "_startDate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3302,
"src": "1094:10:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "==",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 3321,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1108:1:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1094:15:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"falseBody": {
"id": 3337,
"nodeType": "Block",
"src": "1153:154:11",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3330,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 3328,
"name": "_startDate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3302,
"src": "1242:10:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": ">=",
"rightExpression": {
"argumentTypes": null,
"id": 3329,
"name": "now",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7922,
"src": "1256:3:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1242:17:11",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
}
],
"id": 3327,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
7923,
7924
],
"referencedDeclaration": 7923,
"src": "1234:7:11",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$",
"typeString": "function (bool) pure"
}
},
"id": 3331,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1234:26:11",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 3332,
"nodeType": "ExpressionStatement",
"src": "1234:26:11"
},
{
"expression": {
"argumentTypes": null,
"id": 3335,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3333,
"name": "startDate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3277,
"src": "1274:9:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 3334,
"name": "_startDate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3302,
"src": "1286:10:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1274:22:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3336,
"nodeType": "ExpressionStatement",
"src": "1274:22:11"
}
]
},
"id": 3338,
"nodeType": "IfStatement",
"src": "1090:217:11",
"trueBody": {
"expression": {
"argumentTypes": null,
"id": 3325,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3323,
"name": "startDate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3277,
"src": "1123:9:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 3324,
"name": "now",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 7922,
"src": "1135:3:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1123:15:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3326,
"nodeType": "ExpressionStatement",
"src": "1123:15:11"
}
},
{
"expression": {
"argumentTypes": null,
"id": 3341,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3339,
"name": "lastTradeDate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3281,
"src": "1317:13:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 3340,
"name": "startDate",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3277,
"src": "1333:9:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1317:25:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3342,
"nodeType": "ExpressionStatement",
"src": "1317:25:11"
},
{
"expression": {
"argumentTypes": null,
"id": 3347,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 3343,
"name": "lastTradePrice",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3283,
"src": "1435:14:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 3346,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 3344,
"name": "ONE",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3272,
"src": "1452:3:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "BinaryOperation",
"operator": "/",
"rightExpression": {
"argumentTypes": null,
"hexValue": "32",
"id": 3345,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1458:1:11",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_2_by_1",
"typeString": "int_const 2"
},
"value": "2"
},
"src": "1452:7:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "1435:24:11",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"id": 3348,
"nodeType": "ExpressionStatement",
"src": "1435:24:11"
}
]
},
"documentation": "@dev Constructor validates and sets market properties\n @param _creator Market creator\n @param _eventContract Event contract\n @param _marketMaker Market maker contract\n @param _fee Market fee\n @param _startDate Start date for price logging",
"id": 3350,
"implemented": true,
"kind": "constructor",
"modifiers": [
{
"arguments": [
{
"argumentTypes": null,
"id": 3305,
"name": "proxied",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3292,
"src": "965:7:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 3306,
"name": "_creator",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3294,
"src": "974:8:11",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
{
"argumentTypes": null,
"id": 3307,
"name": "_eventContract",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3296,
"src": "984:14:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Event_$392",
"typeString": "contract Event"
}
},
{
"argumentTypes": null,
"id": 3308,
"name": "_marketMaker",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3298,
"src": "1000:12:11",
"typeDescriptions": {
"typeIdentifier": "t_contract$_MarketMaker_$1606",
"typeString": "contract MarketMaker"
}
},
{
"argumentTypes": null,
"id": 3309,
"name": "_fee",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 3300,
"src": "1014:4:11",
"typeDescriptions": {
"typeIdentifier": "t_uint24",
"typeString": "uint24"
}
}
],
"id": 3310,
"modifierName": {
"argumentTypes": null,
"id": 3304,
"name": "StandardMarketProxy",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 2389,
"src": "945:19:11",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_StandardMarketProxy_$2389_$",
"typeString": "type(contract StandardMarketProxy)"
}
},
"nodeType": "ModifierInvocation",
"src": "945:74:11"
}
],
"name": "",
"nodeType": "FunctionDefinition",
"parameters": {
"id": 3303,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 3292,
"name": "proxi