@josojo/tokenized-events
Version:
tokenized events for pm markets
1,018 lines • 841 kB
JSON
{
"contractName": "ScalarEventData",
"abi": [
{
"constant": true,
"inputs": [],
"name": "LONG",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "OUTCOME_RANGE",
"outputs": [
{
"name": "",
"type": "uint24"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "lowerBound",
"outputs": [
{
"name": "",
"type": "int256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "SHORT",
"outputs": [
{
"name": "",
"type": "uint8"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "upperBound",
"outputs": [
{
"name": "",
"type": "int256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b50610163806100206000396000f30060806040526004361061006c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663561cce0a81146100715780636e5452fe1461009c578063a384d6ff146100c9578063a871da91146100f0578063b09ad8a014610105575b600080fd5b34801561007d57600080fd5b5061008661011a565b6040805160ff9092168252519081900360200190f35b3480156100a857600080fd5b506100b161011f565b6040805162ffffff9092168252519081900360200190f35b3480156100d557600080fd5b506100de610126565b60408051918252519081900360200190f35b3480156100fc57600080fd5b5061008661012c565b34801561011157600080fd5b506100de610131565b600181565b620f424081565b60005481565b600081565b600154815600a165627a7a72305820bdfc8ffc05c15c8ac26cece2f7b62b3979848b35a0ade48ee5ae4af73a46472f0029",
"deployedBytecode": "0x60806040526004361061006c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663561cce0a81146100715780636e5452fe1461009c578063a384d6ff146100c9578063a871da91146100f0578063b09ad8a014610105575b600080fd5b34801561007d57600080fd5b5061008661011a565b6040805160ff9092168252519081900360200190f35b3480156100a857600080fd5b506100b161011f565b6040805162ffffff9092168252519081900360200190f35b3480156100d557600080fd5b506100de610126565b60408051918252519081900360200190f35b3480156100fc57600080fd5b5061008661012c565b34801561011157600080fd5b506100de610131565b600181565b620f424081565b60005481565b600081565b600154815600a165627a7a72305820bdfc8ffc05c15c8ac26cece2f7b62b3979848b35a0ade48ee5ae4af73a46472f0029",
"sourceMap": "282:481:8:-;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;282:481:8;;;;;;;",
"deployedSourceMap": "282:481:8:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;384:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;384:30:8;;;;;;;;;;;;;;;;;;;;;;;420:46;;8:9:-1;5:2;;;30:1;27;20:12;5:2;420:46:8;;;;;;;;;;;;;;;;;;;;;;;504:21;;8:9:-1;5:2;;;30:1;27;20:12;5:2;504:21:8;;;;;;;;;;;;;;;;;;;;347:31;;8:9:-1;5:2;;;30:1;27;20:12;5:2;347:31:8;;;;531:21;;8:9:-1;5:2;;;30:1;27;20:12;5:2;531:21:8;;;;384:30;413:1;384:30;:::o;420:46::-;459:7;420:46;:::o;504:21::-;;;;:::o;347:31::-;377:1;347:31;:::o;531:21::-;;;;:::o",
"source": "pragma solidity ^0.4.24;\nimport \"./Event.sol\";\nimport \"./Proxy.sol\";\nimport \"@josojo/forkonomics-contracts/contracts/ForkonomicToken.sol\";\nimport \"@josojo/forkonomics-contracts/contracts/ForkonomicSystem.sol\";\nimport \"@realitio/realitio-contracts/truffle/contracts/Realitio.sol\";\n\n\ncontract ScalarEventData {\n\n /*\n * Constants\n */\n uint8 public constant SHORT = 0;\n uint8 public constant LONG = 1;\n uint24 public constant OUTCOME_RANGE = 1000000;\n\n /*\n * Storage\n */\n int public lowerBound;\n int public upperBound;\n\n // user => tokenCount of Short outcomeTokens\n mapping( address => uint) outcomeTokensCountShort;\n // user => tokenCount of Long outcomeTokens\n mapping( address => uint) outcomeTokensCountLong;\n\n}\n\n\ncontract ScalarEventProxy is Proxy, EventData, ScalarEventData {\n\n /// @dev Contract constructor validates and sets basic event properties\n\n /// @param _collateralBranch Tokens used as collateral in exchange for outcome tokens\n /// @param _realityCheck Oracle contract used to resolve the event\n /// @param _lowerBound Lower bound for event outcome\n /// @param _upperBound Lower bound for event outcome\n constructor(\n address proxied,\n ForkonomicToken _forkonomicToken,\n ForkonomicSystem _fSystem,\n Realitio _realityCheck,\n bytes32 _collateralBranch,\n string question_,\n uint32 openingTs_,\n uint32 minTimeout_,\n uint256 templateId_,\n address arbitrator,\n int _lowerBound,\n int _upperBound\n )\n Proxy(proxied)\n public\n {\n // Validate input\n require(address(_forkonomicToken) != 0 && address(_realityCheck) != 0, \"please check the input for the constructor\");\n require(_collateralBranch != bytes32(0), \" please check the collateralBranch\");\n\n forkonomicToken = _forkonomicToken;\n fSystem = _fSystem;\n collateralBranch = _collateralBranch;\n\n\n // create question in relaityCheck\n openingTs = openingTs_;\n minTimeout = minTimeout_; \n content_hash = keccak256(abi.encodePacked(templateId_, openingTs_, question_)); \n\n realityCheck = _realityCheck;\n questionId = realityCheck.askQuestion(templateId_, question_, arbitrator, minTimeout, openingTs_, 0);\n\n // Create an outcome token for each outcome\n // Create LongTokens \n OutcomeToken outcomeToken = new OutcomeToken(\"LONG\", string(abi.encodePacked(\"Long Token for Event \", questionId)));\n outcomeTokens.push(outcomeToken);\n emit OutcomeTokenCreation(outcomeToken, 1);\n //create ShortTokens\n outcomeToken = new OutcomeToken(\"SHRT\", string(abi.encodePacked(\"Short Token for Event \", questionId)));\n outcomeTokens.push(outcomeToken);\n emit OutcomeTokenCreation(outcomeToken, 2);\n \n \n // Validate bounds\n require(_upperBound > _lowerBound, \" bounds are not set correctly\");\n lowerBound = _lowerBound;\n upperBound = _upperBound;\n }\n}\n\n\n/// @title Scalar event contract - Scalar events resolve to a number within a range\n/// @author Stefan George - <stefan@gnosis.pm>\ncontract ScalarEvent is Proxied, EventData, ScalarEventData {\n using Math for *;\n\n /*\n * Public functions\n */\n\n bytes32 constant NULL_HASH = \"\";\n address constant NULL_ADDRESS = 0x0;\n\n\n function revokeOutcomeTokens()\n public\n {\n // only possible, if tokens were not yet revoked by this account\n // if this function has already been used, the tokens needs to be transfered to another account\n require(outcomeTokensCountShort[msg.sender] == 0 && outcomeTokensCountLong[msg.sender] == 0, \"tokens have already been revoked\");\n uint shortOutcomeTokenCount = outcomeTokens[SHORT].balanceOf(msg.sender);\n outcomeTokensCountShort[msg.sender] = shortOutcomeTokenCount;\n outcomeTokens[SHORT].revoke(msg.sender, shortOutcomeTokenCount);\n uint longOutcomeTokenCount = outcomeTokens[LONG].balanceOf(msg.sender);\n outcomeTokensCountLong[msg.sender] = longOutcomeTokenCount;\n outcomeTokens[LONG].revoke(msg.sender, longOutcomeTokenCount);\n } \n\n /// @dev Exchanges sender's winning outcome tokens for collateral tokens\n /// @return Sender's winnings\n function redeemWinnings(bytes32 branchForWithdraw, address arbitrator)\n public\n returns (uint winnings)\n {\n\n uint shortOutcomeTokenCount = outcomeTokensCountShort[msg.sender];\n uint longOutcomeTokenCount = outcomeTokensCountLong[msg.sender];\n\n // tokens need to be revoked before winnings can be redeemed\n require(shortOutcomeTokenCount > 0 || longOutcomeTokenCount > 0, \" first tokens must be revoked\");\n\n //calculate the winnings\n int outcome = getOutcome(branchForWithdraw, arbitrator);\n\n // Outcome is lower than defined lower bound\n uint24 convertedWinningOutcome;\n if (outcome < lowerBound)\n convertedWinningOutcome = 0;\n // Outcome is higher than defined upper bound\n else if (outcome > upperBound)\n convertedWinningOutcome = OUTCOME_RANGE;\n // Map outcome to outcome range\n else\n convertedWinningOutcome = uint24(OUTCOME_RANGE * (outcome - lowerBound) / (upperBound - lowerBound));\n uint factorShort = OUTCOME_RANGE - convertedWinningOutcome;\n uint factorLong = OUTCOME_RANGE - factorShort;\n winnings = (shortOutcomeTokenCount.mul(factorShort).add(longOutcomeTokenCount.mul(factorLong))) / OUTCOME_RANGE;\n\n // Payout winnings to sender\n require(!ForkonomicToken(forkonomicToken).hasBoxWithdrawal(msg.sender, NULL_HASH, branchForWithdraw, collateralBranch), \"there had already been a withdrawal (redeemWinnings)\"); \n require(ForkonomicToken(forkonomicToken).boxTransfer(msg.sender, winnings, branchForWithdraw, NULL_HASH, NULL_HASH), \"transfer went wrong (redeemWinnings)\");\n require(ForkonomicToken(forkonomicToken).recordBoxWithdrawal(msg.sender, NULL_HASH, winnings, branchForWithdraw), \"withdrawal could not be recorded\");\n \n emit WinningsRedemption(msg.sender, winnings, branchForWithdraw);\n }\n\n /// @dev Risky operation, deletes data and can safe gas in combination with other function calls\n /// @return free gas\n function clearData()\n public {\n delete outcomeTokensCountShort[msg.sender];\n delete outcomeTokensCountLong[msg.sender];\n } \n\n /// @dev Calculates and returns event hash\n /// @return Event hash\n function getEventHash()\n public\n view\n returns (bytes32)\n {\n return keccak256(abi.encodePacked(collateralBranch, questionId, lowerBound, upperBound));\n }\n\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(forkonomicToken.transferFrom(msg.sender, this, collateralTokenCount, collateralBranch), \"transfer was not possible\");\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(forkonomicToken.transfer(msg.sender, outcomeTokenCount, collateralBranch), \"transfer failed\");\n emit OutcomeTokenSetRevocation(msg.sender, outcomeTokenCount);\n }\n\n \n /// @dev gets winning event outcome\n /// @param branch is the branch on which a user wants to know the result\n function getOutcome(bytes32 branch, address arbitrator)\n public\n view\n returns (int outcome)\n {\n\n // check that original branch is a father of executionbranch:\n require(fSystem.isFatherOfBranch(collateralBranch, branch), \" not a fahter branch\");\n\n // ensure that arbitrator is white-listed\n require(fSystem.isArbitratorWhitelisted(arbitrator, branch), \"arbitrator not white-listed\");\n\n require(fSystem.isBranchCreatedAfterTS(realityCheck.getFinalizeTS(questionId), branch), \"branch is to old\");\n\n outcome = int(realityCheck.getFinalAnswerIfMatches(questionId, content_hash, arbitrator, minTimeout, minBond));\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[])\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[] 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}\n\n ",
"sourcePath": "/home/josojo/reality/tokenized-events/contracts/ScalarEvent.sol",
"ast": {
"absolutePath": "/home/josojo/reality/tokenized-events/contracts/ScalarEvent.sol",
"exportedSymbols": {
"ScalarEvent": [
2415
],
"ScalarEventData": [
1762
],
"ScalarEventProxy": [
1936
]
},
"id": 2416,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 1735,
"literals": [
"solidity",
"^",
"0.4",
".24"
],
"nodeType": "PragmaDirective",
"src": "0:24:8"
},
{
"absolutePath": "/home/josojo/reality/tokenized-events/contracts/Event.sol",
"file": "./Event.sol",
"id": 1736,
"nodeType": "ImportDirective",
"scope": 2416,
"sourceUnit": 280,
"src": "25:21:8",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "/home/josojo/reality/tokenized-events/contracts/Proxy.sol",
"file": "./Proxy.sol",
"id": 1737,
"nodeType": "ImportDirective",
"scope": 2416,
"sourceUnit": 1734,
"src": "47:21:8",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@josojo/forkonomics-contracts/contracts/ForkonomicToken.sol",
"file": "@josojo/forkonomics-contracts/contracts/ForkonomicToken.sol",
"id": 1738,
"nodeType": "ImportDirective",
"scope": 2416,
"sourceUnit": 6227,
"src": "69:69:8",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@josojo/forkonomics-contracts/contracts/ForkonomicSystem.sol",
"file": "@josojo/forkonomics-contracts/contracts/ForkonomicSystem.sol",
"id": 1739,
"nodeType": "ImportDirective",
"scope": 2416,
"sourceUnit": 5271,
"src": "139:70:8",
"symbolAliases": [],
"unitAlias": ""
},
{
"absolutePath": "@realitio/realitio-contracts/truffle/contracts/Realitio.sol",
"file": "@realitio/realitio-contracts/truffle/contracts/Realitio.sol",
"id": 1740,
"nodeType": "ImportDirective",
"scope": 2416,
"sourceUnit": 8290,
"src": "210:69:8",
"symbolAliases": [],
"unitAlias": ""
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 1762,
"linearizedBaseContracts": [
1762
],
"name": "ScalarEventData",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": true,
"id": 1743,
"name": "SHORT",
"nodeType": "VariableDeclaration",
"scope": 1762,
"src": "347:31:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 1741,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "347:5:8",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": {
"argumentTypes": null,
"hexValue": "30",
"id": 1742,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "377:1:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"visibility": "public"
},
{
"constant": true,
"id": 1746,
"name": "LONG",
"nodeType": "VariableDeclaration",
"scope": 1762,
"src": "384:30:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
},
"typeName": {
"id": 1744,
"name": "uint8",
"nodeType": "ElementaryTypeName",
"src": "384:5:8",
"typeDescriptions": {
"typeIdentifier": "t_uint8",
"typeString": "uint8"
}
},
"value": {
"argumentTypes": null,
"hexValue": "31",
"id": 1745,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "413:1:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"visibility": "public"
},
{
"constant": true,
"id": 1749,
"name": "OUTCOME_RANGE",
"nodeType": "VariableDeclaration",
"scope": 1762,
"src": "420:46:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint24",
"typeString": "uint24"
},
"typeName": {
"id": 1747,
"name": "uint24",
"nodeType": "ElementaryTypeName",
"src": "420:6:8",
"typeDescriptions": {
"typeIdentifier": "t_uint24",
"typeString": "uint24"
}
},
"value": {
"argumentTypes": null,
"hexValue": "31303030303030",
"id": 1748,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "459:7:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1000000_by_1",
"typeString": "int_const 1000000"
},
"value": "1000000"
},
"visibility": "public"
},
{
"constant": false,
"id": 1751,
"name": "lowerBound",
"nodeType": "VariableDeclaration",
"scope": 1762,
"src": "504:21:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 1750,
"name": "int",
"nodeType": "ElementaryTypeName",
"src": "504:3:8",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 1753,
"name": "upperBound",
"nodeType": "VariableDeclaration",
"scope": 1762,
"src": "531:21:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
},
"typeName": {
"id": 1752,
"name": "int",
"nodeType": "ElementaryTypeName",
"src": "531:3:8",
"typeDescriptions": {
"typeIdentifier": "t_int256",
"typeString": "int256"
}
},
"value": null,
"visibility": "public"
},
{
"constant": false,
"id": 1757,
"name": "outcomeTokensCountShort",
"nodeType": "VariableDeclaration",
"scope": 1762,
"src": "608:49:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName": {
"id": 1756,
"keyType": {
"id": 1754,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "617:7:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "608:25:8",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 1755,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "628:4:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 1761,
"name": "outcomeTokensCountLong",
"nodeType": "VariableDeclaration",
"scope": 1762,
"src": "711:48:8",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName": {
"id": 1760,
"keyType": {
"id": 1758,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "720:7:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "711:25:8",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueType": {
"id": 1759,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "731:4:8",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"value": null,
"visibility": "internal"
}
],
"scope": 2416,
"src": "282:481:8"
},
{
"baseContracts": [
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 1763,
"name": "Proxy",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1733,
"src": "795:5:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Proxy_$1733",
"typeString": "contract Proxy"
}
},
"id": 1764,
"nodeType": "InheritanceSpecifier",
"src": "795:5:8"
},
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 1765,
"name": "EventData",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 66,
"src": "802:9:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_EventData_$66",
"typeString": "contract EventData"
}
},
"id": 1766,
"nodeType": "InheritanceSpecifier",
"src": "802:9:8"
},
{
"arguments": null,
"baseName": {
"contractScope": null,
"id": 1767,
"name": "ScalarEventData",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 1762,
"src": "813:15:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ScalarEventData_$1762",
"typeString": "contract ScalarEventData"
}
},
"id": 1768,
"nodeType": "InheritanceSpecifier",
"src": "813:15:8"
}
],
"contractDependencies": [
66,
1700,
1705,
1733,
1762
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 1936,
"linearizedBaseContracts": [
1936,
1762,
66,
1733,
1705
],
"name": "ScalarEventProxy",
"nodeType": "ContractDefinition",
"nodes": [
{
"body": {
"id": 1934,
"nodeType": "Block",
"src": "1606:1448:8",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"id": 1809,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 1803,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 1800,
"name": "_forkonomicToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1772,
"src": "1658:16:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ForkonomicToken_$6226",
"typeString": "contract ForkonomicToken"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_ForkonomicToken_$6226",
"typeString": "contract ForkonomicToken"
}
],
"id": 1799,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1650:7:8",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 1801,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1650:25:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 1802,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1679:1:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1650:30:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"nodeType": "BinaryOperation",
"operator": "&&",
"rightExpression": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"id": 1808,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 1805,
"name": "_realityCheck",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1776,
"src": "1692:13:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_Realitio_$8289",
"typeString": "contract Realitio"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_contract$_Realitio_$8289",
"typeString": "contract Realitio"
}
],
"id": 1804,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1684:7:8",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_address_$",
"typeString": "type(address)"
},
"typeName": "address"
},
"id": 1806,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1684:22:8",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"hexValue": "30",
"id": 1807,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1710:1:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_0_by_1",
"typeString": "int_const 0"
},
"value": "0"
},
"src": "1684:27:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"src": "1650:61:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "706c6561736520636865636b2074686520696e70757420666f722074686520636f6e7374727563746f72",
"id": 1810,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1713:44:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_0d4d2f1e645417f66cf71c15e5c20a001d8113204e38dc7f3d5b0a6563d9b1c4",
"typeString": "literal_string \"please check the input for the constructor\""
},
"value": "please check the input for the constructor"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_0d4d2f1e645417f66cf71c15e5c20a001d8113204e38dc7f3d5b0a6563d9b1c4",
"typeString": "literal_string \"please check the input for the constructor\""
}
],
"id": 1798,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
8526,
8527
],
"referencedDeclaration": 8527,
"src": "1642:7:8",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 1811,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1642:116:8",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1812,
"nodeType": "ExpressionStatement",
"src": "1642:116:8"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"id": 1818,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"id": 1814,
"name": "_collateralBranch",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1778,
"src": "1776:17:8",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"nodeType": "BinaryOperation",
"operator": "!=",
"rightExpression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"hexValue": "30",
"id": 1816,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1805:1:8",
"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": 1815,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"nodeType": "ElementaryTypeNameExpression",
"src": "1797:7:8",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_bytes32_$",
"typeString": "type(bytes32)"
},
"typeName": "bytes32"
},
"id": 1817,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "typeConversion",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1797:10:8",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"src": "1776:31:8",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
{
"argumentTypes": null,
"hexValue": "20706c6561736520636865636b2074686520636f6c6c61746572616c4272616e6368",
"id": 1819,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "string",
"lValueRequested": false,
"nodeType": "Literal",
"src": "1809:36:8",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_stringliteral_9f26beeb443ca0d14ad39cba6124f57afbc3fa5814261ec8d9abcffa005145fc",
"typeString": "literal_string \" please check the collateralBranch\""
},
"value": " please check the collateralBranch"
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bool",
"typeString": "bool"
},
{
"typeIdentifier": "t_stringliteral_9f26beeb443ca0d14ad39cba6124f57afbc3fa5814261ec8d9abcffa005145fc",
"typeString": "literal_string \" please check the collateralBranch\""
}
],
"id": 1813,
"name": "require",
"nodeType": "Identifier",
"overloadedDeclarations": [
8526,
8527
],
"referencedDeclaration": 8527,
"src": "1768:7:8",
"typeDescriptions": {
"typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$",
"typeString": "function (bool,string memory) pure"
}
},
"id": 1820,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "1768:78:8",
"typeDescriptions": {
"typeIdentifier": "t_tuple$__$",
"typeString": "tuple()"
}
},
"id": 1821,
"nodeType": "ExpressionStatement",
"src": "1768:78:8"
},
{
"expression": {
"argumentTypes": null,
"id": 1824,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1822,
"name": "forkonomicToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 41,
"src": "1857:15:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ForkonomicToken_$6226",
"typeString": "contract ForkonomicToken"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"id": 1823,
"name": "_forkonomicToken",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 1772,
"src": "1875:16:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ForkonomicToken_$6226",
"typeString": "contract ForkonomicToken"
}
},
"src": "1857:34:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ForkonomicToken_$6226",
"typeString": "contract ForkonomicToken"
}
},
"id": 1825,
"nodeType": "ExpressionStatement",
"src": "1857:34:8"
},
{
"expression": {
"argumentTypes": null,
"id": 1828,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 1826,
"name": "fSystem",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 43,
"src": "1901:7:8",
"typeDescriptions": {
"typeIdentifier": "t_contract$_ForkonomicSystem_$5270",
"typeString": "contract ForkonomicSystem"
}
},
"nodeType": "Assignment",
"operat