UNPKG

@edgefund/core

Version:
1,204 lines (1,203 loc) 55.8 kB
{ "contractName": "CoinTossMock", "abi": [ { "constant": false, "inputs": [ { "name": "betIsHeads", "type": "bool" } ], "name": "placeBet", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "constant": true, "inputs": [], "name": "bankroll", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "MAXIMUM_PASSED_BLOCKS", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "kill", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "name": "betId", "type": "uint256" } ], "name": "resolveBet", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "counter", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "MINIMUM_PASSED_BLOCKS", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "maximumBetSize", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [ { "name": "", "type": "uint256" } ], "name": "coinTosses", "outputs": [ { "name": "user", "type": "address" }, { "name": "block", "type": "uint256" }, { "name": "isHeads", "type": "bool" }, { "name": "amount", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [], "name": "fund", "outputs": [], "payable": true, "stateMutability": "payable", "type": "function" }, { "payable": true, "stateMutability": "payable", "type": "fallback" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "id", "type": "uint256" }, { "indexed": false, "name": "user", "type": "address" }, { "indexed": false, "name": "isHeads", "type": "bool" }, { "indexed": false, "name": "amount", "type": "uint256" } ], "name": "betPlaced", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "id", "type": "uint256" }, { "indexed": false, "name": "isHeads", "type": "bool" } ], "name": "CoinTossed", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "name": "bankRoll", "type": "uint256" } ], "name": "bankRollFunded", "type": "event" }, { "constant": false, "inputs": [ { "name": "betId", "type": "uint256" } ], "name": "setBetId", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [], "name": "getMaxPassedBlocks", "outputs": [ { "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "pure", "type": "function" }, { "constant": true, "inputs": [ { "name": "betId", "type": "uint256" }, { "name": "resutBlockHash", "type": "bytes32" } ], "name": "getResultForBet", "outputs": [ { "name": "", "type": "bool" } ], "payable": false, "stateMutability": "pure", "type": "function" } ], "bytecode": "0x60806040526000808055600181905560025560048054600160a060020a03191633179055610780806100326000396000f3006080604052600436106100c45763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663096a3778811461010c5780630c657eb01461011b5780631e87e2881461014257806341c0e1b5146101575780634c36c36e1461016c57806361bc221a146101845780636426d2ff146101995780636a987336146101c857806385dcb05c146101dd5780638b3f8aef146101f2578063ad24891314610207578063b60d42881461024f578063bd7c6ade14610257575b600080543401908190556002900460025560005460408051918252517f38af9d7dab39de55be062f56ff186cb58a453fd0cf0f81122deac2222be19d4a9181900360200190a1005b610119600435151561026f565b005b34801561012757600080fd5b506101306103a7565b60408051918252519081900360200190f35b34801561014e57600080fd5b506101306103ad565b34801561016357600080fd5b506101196103b2565b34801561017857600080fd5b50610119600435610422565b34801561019057600080fd5b506101306106b3565b3480156101a557600080fd5b506101b46004356024356106b9565b604080519115158252519081900360200190f35b3480156101d457600080fd5b506101306106c1565b3480156101e957600080fd5b506101306106c6565b3480156101fe57600080fd5b506101306106cb565b34801561021357600080fd5b5061021f6004356106d1565b60408051600160a060020a0390951685526020850193909352901515838301526060830152519081900360800190f35b610119610707565b34801561026357600080fd5b5061011960043561074f565b6002543411156102c9576040805160e560020a62461bcd02815260206004820152600e60248201527f42657420697320746f6f20626967000000000000000000000000000000000000604482015290519081900360640190fd5b6040805160808082018352338083526005430160208085019182528615158587018181523460608089018281526001805460009081526003808952908d90209b518c5473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909116178c5597518b820155935160028b01805460ff1916911515919091179055519890950197909755548751908152918201939093528086019290925281019290925291517f706752a3648ca2ba13f1c7abdd321e0fde82cbba41cebacc1e5d7509b0546592929181900390910190a1506001805481019055565b60005481565b60ff81565b600454600160a060020a03163314610414576040805160e560020a62461bcd02815260206004820152601c60248201527f596f7520646f206e6f74206f776e207468697320636f6e747261637400000000604482015290519081900360640190fd5b600454600160a060020a0316ff5b600081815260036020526040812080549091908190600160a060020a03163314610496576040805160e560020a62461bcd02815260206004820152601a60248201527f596f7520646964206e6f7420706c616365207468697320626574000000000000604482015290519081900360640190fd5b60018301544310156104f2576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6f7420656e6f75676820626c6f636b73206861766520706173736564000000604482015290519081900360640190fd5b30600160a060020a0316636a9873366040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561054957600080fd5b505af115801561055d573d6000803e3d6000fd5b505050506040513d602081101561057357600080fd5b50516001840154014311156105d2576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6f7420656e6f75676820626c6f636b73206861766520706173736564000000604482015290519081900360640190fd5b6105e1848460010154406106b9565b600284015490925060ff161515821515141561063257506003820154604051600290910290339082156108fc029083906000818181858888f19350505050158015610630573d6000803e3d6000fd5b505b60408051858152831515602082015281517fce5cec4a2ff2aafde5f1d2b55d71e4b6d686505eeb629a44b1b795dea01ac248929181900390910190a150505060009081526003602081905260408220805473ffffffffffffffffffffffffffffffffffffffff191681556001810183905560028101805460ff191690550155565b60015481565b506001161590565b600590565b600581565b60025481565b60036020819052600091825260409091208054600182015460028301549290930154600160a060020a03909116929160ff169084565b600080543401908190556002900460025560005460408051918252517f38af9d7dab39de55be062f56ff186cb58a453fd0cf0f81122deac2222be19d4a9181900360200190a1565b6001555600a165627a7a723058208f2348083e83fc73dad4b689a94bfba40f0259b41d4e7de82cdffba4c02fa1bd0029", "deployedBytecode": "0x6080604052600436106100c45763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663096a3778811461010c5780630c657eb01461011b5780631e87e2881461014257806341c0e1b5146101575780634c36c36e1461016c57806361bc221a146101845780636426d2ff146101995780636a987336146101c857806385dcb05c146101dd5780638b3f8aef146101f2578063ad24891314610207578063b60d42881461024f578063bd7c6ade14610257575b600080543401908190556002900460025560005460408051918252517f38af9d7dab39de55be062f56ff186cb58a453fd0cf0f81122deac2222be19d4a9181900360200190a1005b610119600435151561026f565b005b34801561012757600080fd5b506101306103a7565b60408051918252519081900360200190f35b34801561014e57600080fd5b506101306103ad565b34801561016357600080fd5b506101196103b2565b34801561017857600080fd5b50610119600435610422565b34801561019057600080fd5b506101306106b3565b3480156101a557600080fd5b506101b46004356024356106b9565b604080519115158252519081900360200190f35b3480156101d457600080fd5b506101306106c1565b3480156101e957600080fd5b506101306106c6565b3480156101fe57600080fd5b506101306106cb565b34801561021357600080fd5b5061021f6004356106d1565b60408051600160a060020a0390951685526020850193909352901515838301526060830152519081900360800190f35b610119610707565b34801561026357600080fd5b5061011960043561074f565b6002543411156102c9576040805160e560020a62461bcd02815260206004820152600e60248201527f42657420697320746f6f20626967000000000000000000000000000000000000604482015290519081900360640190fd5b6040805160808082018352338083526005430160208085019182528615158587018181523460608089018281526001805460009081526003808952908d90209b518c5473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03909116178c5597518b820155935160028b01805460ff1916911515919091179055519890950197909755548751908152918201939093528086019290925281019290925291517f706752a3648ca2ba13f1c7abdd321e0fde82cbba41cebacc1e5d7509b0546592929181900390910190a1506001805481019055565b60005481565b60ff81565b600454600160a060020a03163314610414576040805160e560020a62461bcd02815260206004820152601c60248201527f596f7520646f206e6f74206f776e207468697320636f6e747261637400000000604482015290519081900360640190fd5b600454600160a060020a0316ff5b600081815260036020526040812080549091908190600160a060020a03163314610496576040805160e560020a62461bcd02815260206004820152601a60248201527f596f7520646964206e6f7420706c616365207468697320626574000000000000604482015290519081900360640190fd5b60018301544310156104f2576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6f7420656e6f75676820626c6f636b73206861766520706173736564000000604482015290519081900360640190fd5b30600160a060020a0316636a9873366040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561054957600080fd5b505af115801561055d573d6000803e3d6000fd5b505050506040513d602081101561057357600080fd5b50516001840154014311156105d2576040805160e560020a62461bcd02815260206004820152601d60248201527f4e6f7420656e6f75676820626c6f636b73206861766520706173736564000000604482015290519081900360640190fd5b6105e1848460010154406106b9565b600284015490925060ff161515821515141561063257506003820154604051600290910290339082156108fc029083906000818181858888f19350505050158015610630573d6000803e3d6000fd5b505b60408051858152831515602082015281517fce5cec4a2ff2aafde5f1d2b55d71e4b6d686505eeb629a44b1b795dea01ac248929181900390910190a150505060009081526003602081905260408220805473ffffffffffffffffffffffffffffffffffffffff191681556001810183905560028101805460ff191690550155565b60015481565b506001161590565b600590565b600581565b60025481565b60036020819052600091825260409091208054600182015460028301549290930154600160a060020a03909116929160ff169084565b600080543401908190556002900460025560005460408051918252517f38af9d7dab39de55be062f56ff186cb58a453fd0cf0f81122deac2222be19d4a9181900360200190a1565b6001555600a165627a7a723058208f2348083e83fc73dad4b689a94bfba40f0259b41d4e7de82cdffba4c02fa1bd0029", "sourceMap": "178:612:1:-;;;571:1:0;548:24;;;578:23;;;;607:30;;903:5;:18;;-1:-1:-1;;;;;;903:18:0;911:10;903:18;;;178:612:1;;;;;;", "deployedSourceMap": "178:612:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2903:8:0;:21;;2915:9;2903:21;;;;;2962:1;;2951:12;2934:14;:29;2994:8;;2979:24;;;;;;;;;;;;;;;;178:612:1;934:383:0;;;;;;;;;;548:24;;8:9:-1;5:2;;;30:1;27;20:12;5:2;548:24:0;;;;;;;;;;;;;;;;;;;;442:48;;8:9:-1;5:2;;;30:1;27;20:12;5:2;442:48:0;;;;3016:135;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3016:135:0;;;;2040:657;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;2040:657:0;;;;;578:23;;8:9:-1;5:2;;;30:1;27;20:12;5:2;578:23:0;;;;593:195:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;593:195:1;;;;;;;;;;;;;;;;;;;;;;;;;300:86;;8:9:-1;5:2;;;30:1;27;20:12;5:2;300:86:1;;;;496:46:0;;8:9:-1;5:2;;;30:1;27;20:12;5:2;496:46:0;;;;607:30;;8:9:-1;5:2;;;30:1;27;20:12;5:2;607:30:0;;;;644:39;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;644:39:0;;;;;;;;;-1:-1:-1;;;;;644:39:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2703:153;;;;221:73:1;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;221:73:1;;;;;934:383:0;1020:14;;1007:9;:27;;999:54;;;;;-1:-1:-1;;;;;999:54:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;1086:135;;;;;;;;;1104:10;1086:135;;;541:1;1128:12;:36;1086:135;;;;;;;;;;;;;;;;1202:9;1086:135;;;;;;;1075:7;;;-1:-1:-1;1064:19:0;;;:10;:19;;;;;;;:157;;;;-1:-1:-1;;1064:157:0;-1:-1:-1;;;;;1064:157:0;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1064:157:0;;;;;;;;;;;;;;;;;;;1247:7;1237:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1301:7:0;:9;;;;;;934:383::o;548:24::-;;;;:::o;442:48::-;487:3;442:48;:::o;3016:135::-;3077:5;;-1:-1:-1;;;;;3077:5:0;3063:10;:19;3054:61;;;;;-1:-1:-1;;;;;3054:61:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;3138:5;;-1:-1:-1;;;;;3138:5:0;3125:19;2040:657;2093:17;2113;;;:10;:17;;;;;2163:9;;2113:17;;2093;;;-1:-1:-1;;;;;2163:9:0;2149:10;:23;2141:62;;;;;-1:-1:-1;;;;;2141:62:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;2237:10;;;;2221:12;:26;;2213:68;;;;;-1:-1:-1;;;;;2213:68:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;2329:4;-1:-1:-1;;;;;2329:23:0;;:25;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2329:25:0;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2329:25:0;;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;-1:-1;2329:25:0;2316:10;;;;:38;2299:12;:56;;2291:98;;;;;-1:-1:-1;;;;;2291:98:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;2415:45;2431:5;2448:4;:10;;;2438:21;2415:15;:45::i;:::-;2486:12;;;;2400:60;;-1:-1:-1;2486:12:0;;2475:23;;;;;;2471:144;;;-1:-1:-1;2528:11:0;;;;2577:27;;2542:1;2528:15;;;;2577:10;;:27;;;;;2528:15;;2577:27;;;;2528:15;2577:10;:27;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;2577:27:0;2471:144;2630:26;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;2673:17:0;;;;:10;:17;;;;;;;2666:24;;-1:-1:-1;;2666:24:0;;;;;;;;;;;;;;-1:-1:-1;;2666:24:0;;;;;2040:657::o;578:23::-;;;;:::o;593:195:1:-;-1:-1:-1;766:9:1;;765:16;;593:195::o;300:86::-;378:1;300:86;:::o;496:46:0:-;541:1;496:46;:::o;607:30::-;;;;:::o;644:39::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;644:39:0;;;;;;;;;:::o;2703:153::-;2749:8;:21;;2761:9;2749:21;;;;;2808:1;;2797:12;2780:14;:29;2840:8;;2825:24;;;;;;;;;;;;;;;;2703:153::o;221:73:1:-;272:7;:15;221:73::o", "source": "pragma solidity ^0.4.24;\n\nimport \"./CoinToss.sol\";\n\n/* This contract inherits the CoinToss Contract, and mocks the random number\n * generation, to simplify the unit testing\n **/\ncontract CoinTossMock is CoinToss ()\n{\n function setBetId(uint betId) public\n {\n counter = betId;\n }\n\n function getMaxPassedBlocks() public pure returns (uint)\n {\n return 5;\n }\n\n /* This mocked function 'wins' when the supplied betID is even, and 'loses' when it's odd\n * This allows the function to use the 'pure' modifier, to match the CointToss implementation.\n */\n function getResultForBet(uint betId, bytes32 resutBlockHash) public pure returns (bool)\n {\n resutBlockHash = resutBlockHash; // Suppress warning.\n\n return (betId % 2) == 0;\n }\n}\n", "sourcePath": "/Users/garethoates/Developer/Blockchain/EdgeFund/edgefund-core/contracts/CoinTossMock.sol", "ast": { "absolutePath": "/Users/garethoates/Developer/Blockchain/EdgeFund/edgefund-core/contracts/CoinTossMock.sol", "exportedSymbols": { "CoinTossMock": [ 327 ] }, "id": 328, "nodeType": "SourceUnit", "nodes": [ { "id": 284, "literals": [ "solidity", "^", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:24:1" }, { "absolutePath": "/Users/garethoates/Developer/Blockchain/EdgeFund/edgefund-core/contracts/CoinToss.sol", "file": "./CoinToss.sol", "id": 285, "nodeType": "ImportDirective", "scope": 328, "sourceUnit": 283, "src": "26:24:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": [], "baseName": { "contractScope": null, "id": 286, "name": "CoinToss", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 282, "src": "203:8:1", "typeDescriptions": { "typeIdentifier": "t_contract$_CoinToss_$282", "typeString": "contract CoinToss" } }, "id": 287, "nodeType": "InheritanceSpecifier", "src": "203:11:1" } ], "contractDependencies": [ 282 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 327, "linearizedBaseContracts": [ 327, 282 ], "name": "CoinTossMock", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 296, "nodeType": "Block", "src": "262:32:1", "statements": [ { "expression": { "argumentTypes": null, "id": 294, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 292, "name": "counter", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22, "src": "272:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 293, "name": "betId", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 289, "src": "282:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "272:15:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 295, "nodeType": "ExpressionStatement", "src": "272:15:1" } ] }, "documentation": null, "id": 297, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "setBetId", "nodeType": "FunctionDefinition", "parameters": { "id": 290, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 289, "name": "betId", "nodeType": "VariableDeclaration", "scope": 297, "src": "239:10:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 288, "name": "uint", "nodeType": "ElementaryTypeName", "src": "239:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "238:12:1" }, "payable": false, "returnParameters": { "id": 291, "nodeType": "ParameterList", "parameters": [], "src": "262:0:1" }, "scope": 327, "src": "221:73:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 304, "nodeType": "Block", "src": "361:25:1", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "35", "id": 302, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "378:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_5_by_1", "typeString": "int_const 5" }, "value": "5" }, "functionReturnParameters": 301, "id": 303, "nodeType": "Return", "src": "371:8:1" } ] }, "documentation": null, "id": 305, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "getMaxPassedBlocks", "nodeType": "FunctionDefinition", "parameters": { "id": 298, "nodeType": "ParameterList", "parameters": [], "src": "327:2:1" }, "payable": false, "returnParameters": { "id": 301, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 300, "name": "", "nodeType": "VariableDeclaration", "scope": 305, "src": "351:4:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 299, "name": "uint", "nodeType": "ElementaryTypeName", "src": "351:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "350:6:1" }, "scope": 327, "src": "300:86:1", "stateMutability": "pure", "superFunction": 142, "visibility": "public" }, { "body": { "id": 325, "nodeType": "Block", "src": "685:103:1", "statements": [ { "expression": { "argumentTypes": null, "id": 316, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 314, "name": "resutBlockHash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 309, "src": "695:14:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 315, "name": "resutBlockHash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 309, "src": "712:14:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "src": "695:31:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "id": 317, "nodeType": "ExpressionStatement", "src": "695:31:1" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 323, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 320, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 318, "name": "betId", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 307, "src": "766:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "argumentTypes": null, "hexValue": "32", "id": 319, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "774:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "src": "766:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 321, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "765:11:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": { "argumentTypes": null, "hexValue": "30", "id": 322, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "780:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_0_by_1", "typeString": "int_const 0" }, "value": "0" }, "src": "765:16:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "functionReturnParameters": 313, "id": 324, "nodeType": "Return", "src": "758:23:1" } ] }, "documentation": null, "id": 326, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "getResultForBet", "nodeType": "FunctionDefinition", "parameters": { "id": 310, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 307, "name": "betId", "nodeType": "VariableDeclaration", "scope": 326, "src": "618:10:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 306, "name": "uint", "nodeType": "ElementaryTypeName", "src": "618:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" }, { "constant": false, "id": 309, "name": "resutBlockHash", "nodeType": "VariableDeclaration", "scope": 326, "src": "630:22:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" }, "typeName": { "id": 308, "name": "bytes32", "nodeType": "ElementaryTypeName", "src": "630:7:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "value": null, "visibility": "internal" } ], "src": "617:36:1" }, "payable": false, "returnParameters": { "id": 313, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 312, "name": "", "nodeType": "VariableDeclaration", "scope": 326, "src": "675:4:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" }, "typeName": { "id": 311, "name": "bool", "nodeType": "ElementaryTypeName", "src": "675:4:1", "typeDescriptions": { "typeIdentifier": "t_bool", "typeString": "bool" } }, "value": null, "visibility": "internal" } ], "src": "674:6:1" }, "scope": 327, "src": "593:195:1", "stateMutability": "pure", "superFunction": 134, "visibility": "public" } ], "scope": 328, "src": "178:612:1" } ], "src": "0:791:1" }, "legacyAST": { "absolutePath": "/Users/garethoates/Developer/Blockchain/EdgeFund/edgefund-core/contracts/CoinTossMock.sol", "exportedSymbols": { "CoinTossMock": [ 327 ] }, "id": 328, "nodeType": "SourceUnit", "nodes": [ { "id": 284, "literals": [ "solidity", "^", "0.4", ".24" ], "nodeType": "PragmaDirective", "src": "0:24:1" }, { "absolutePath": "/Users/garethoates/Developer/Blockchain/EdgeFund/edgefund-core/contracts/CoinToss.sol", "file": "./CoinToss.sol", "id": 285, "nodeType": "ImportDirective", "scope": 328, "sourceUnit": 283, "src": "26:24:1", "symbolAliases": [], "unitAlias": "" }, { "baseContracts": [ { "arguments": [], "baseName": { "contractScope": null, "id": 286, "name": "CoinToss", "nodeType": "UserDefinedTypeName", "referencedDeclaration": 282, "src": "203:8:1", "typeDescriptions": { "typeIdentifier": "t_contract$_CoinToss_$282", "typeString": "contract CoinToss" } }, "id": 287, "nodeType": "InheritanceSpecifier", "src": "203:11:1" } ], "contractDependencies": [ 282 ], "contractKind": "contract", "documentation": null, "fullyImplemented": true, "id": 327, "linearizedBaseContracts": [ 327, 282 ], "name": "CoinTossMock", "nodeType": "ContractDefinition", "nodes": [ { "body": { "id": 296, "nodeType": "Block", "src": "262:32:1", "statements": [ { "expression": { "argumentTypes": null, "id": 294, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 292, "name": "counter", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 22, "src": "272:7:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 293, "name": "betId", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 289, "src": "282:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "src": "272:15:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "id": 295, "nodeType": "ExpressionStatement", "src": "272:15:1" } ] }, "documentation": null, "id": 297, "implemented": true, "isConstructor": false, "isDeclaredConst": false, "modifiers": [], "name": "setBetId", "nodeType": "FunctionDefinition", "parameters": { "id": 290, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 289, "name": "betId", "nodeType": "VariableDeclaration", "scope": 297, "src": "239:10:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 288, "name": "uint", "nodeType": "ElementaryTypeName", "src": "239:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "238:12:1" }, "payable": false, "returnParameters": { "id": 291, "nodeType": "ParameterList", "parameters": [], "src": "262:0:1" }, "scope": 327, "src": "221:73:1", "stateMutability": "nonpayable", "superFunction": null, "visibility": "public" }, { "body": { "id": 304, "nodeType": "Block", "src": "361:25:1", "statements": [ { "expression": { "argumentTypes": null, "hexValue": "35", "id": 302, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "378:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_5_by_1", "typeString": "int_const 5" }, "value": "5" }, "functionReturnParameters": 301, "id": 303, "nodeType": "Return", "src": "371:8:1" } ] }, "documentation": null, "id": 305, "implemented": true, "isConstructor": false, "isDeclaredConst": true, "modifiers": [], "name": "getMaxPassedBlocks", "nodeType": "FunctionDefinition", "parameters": { "id": 298, "nodeType": "ParameterList", "parameters": [], "src": "327:2:1" }, "payable": false, "returnParameters": { "id": 301, "nodeType": "ParameterList", "parameters": [ { "constant": false, "id": 300, "name": "", "nodeType": "VariableDeclaration", "scope": 305, "src": "351:4:1", "stateVariable": false, "storageLocation": "default", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "typeName": { "id": 299, "name": "uint", "nodeType": "ElementaryTypeName", "src": "351:4:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "value": null, "visibility": "internal" } ], "src": "350:6:1" }, "scope": 327, "src": "300:86:1", "stateMutability": "pure", "superFunction": 142, "visibility": "public" }, { "body": { "id": 325, "nodeType": "Block", "src": "685:103:1", "statements": [ { "expression": { "argumentTypes": null, "id": 316, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftHandSide": { "argumentTypes": null, "id": 314, "name": "resutBlockHash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 309, "src": "695:14:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "nodeType": "Assignment", "operator": "=", "rightHandSide": { "argumentTypes": null, "id": 315, "name": "resutBlockHash", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 309, "src": "712:14:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "src": "695:31:1", "typeDescriptions": { "typeIdentifier": "t_bytes32", "typeString": "bytes32" } }, "id": 317, "nodeType": "ExpressionStatement", "src": "695:31:1" }, { "expression": { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 323, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "components": [ { "argumentTypes": null, "commonType": { "typeIdentifier": "t_uint256", "typeString": "uint256" }, "id": 320, "isConstant": false, "isLValue": false, "isPure": false, "lValueRequested": false, "leftExpression": { "argumentTypes": null, "id": 318, "name": "betId", "nodeType": "Identifier", "overloadedDeclarations": [], "referencedDeclaration": 307, "src": "766:5:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "%", "rightExpression": { "argumentTypes": null, "hexValue": "32", "id": 319, "isConstant": false, "isLValue": false, "isPure": true, "kind": "number", "lValueRequested": false, "nodeType": "Literal", "src": "774:1:1", "subdenomination": null, "typeDescriptions": { "typeIdentifier": "t_rational_2_by_1", "typeString": "int_const 2" }, "value": "2" }, "src": "766:9:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } } ], "id": 321, "isConstant": false, "isInlineArray": false, "isLValue": false, "isPure": false, "lValueRequested": false, "nodeType": "TupleExpression", "src": "765:11:1", "typeDescriptions": { "typeIdentifier": "t_uint256", "typeString": "uint256" } }, "nodeType": "BinaryOperation", "operator": "==", "rightExpression": {