@edgefund/core
Version:
EdgeFund Core contracts and tests
1,007 lines (1,006 loc) • 410 kB
JSON
{
"contractName": "EdgeFund",
"abi": [
{
"inputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"payable": false,
"stateMutability": "nonpayable",
"type": "fallback"
},
{
"constant": false,
"inputs": [
{
"name": "BetSize",
"type": "uint256"
},
{
"name": "PayoutOdds",
"type": "uint256"
},
{
"name": "WinOdds",
"type": "uint256"
}
],
"name": "PlaceBetWithWinOdds",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "ResolveBets",
"outputs": [
{
"name": "",
"type": "bool"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "Temp",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getBankrollBalance",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "isHeads",
"type": "bool"
}
],
"name": "PlaceBet",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "ResolveBet",
"outputs": [
{
"name": "",
"type": "string"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
},
{
"constant": false,
"inputs": [
{
"name": "val",
"type": "uint256"
}
],
"name": "ForceNewBlock",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x60806040526305f5e100600381905560045534801561001d57600080fd5b5060035462989680026005556106ee806100386000396000f3006080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663049fc41f811461009157806308bfcdba1461011b578063372cd85c146101425780637205aaa81461015c578063b95a3afb14610176578063bc2319831461019f578063f45fafd4146101b4575b34801561008e57600080fd5b50005b34801561009d57600080fd5b506100a66101d2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100e05781810151838201526020016100c8565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561012757600080fd5b5061013061034c565b60408051918252519081900360200190f35b34801561014e57600080fd5b5061015a600435610352565b005b34801561016857600080fd5b5061015a6004351515610357565b34801561018257600080fd5b5061018b6103b7565b604080519115158252519081900360200190f35b3480156101ab57600080fd5b50610130610584565b3480156101c057600080fd5b5061018b6004356024356044356105ca565b6001805460609101406000808215156101ea57600080fd5b6000546040805173ffffffffffffffffffffffffffffffffffffffff9092166c0100000000000000000000000002602080840191909152603480840187905282518085039091018152605490930191829052825182918401908083835b602083106102665780518252601f199092019160209182019101610247565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912094506002925084915061029f9050565b0660ff1690508060011480156102cf575060005474010000000000000000000000000000000000000000900460ff165b1561030f5760408051808201909152600881527f596f752057696e2100000000000000000000000000000000000000000000000060208201529350610346565b60408051808201909152600881527f596f75204c6f7365000000000000000000000000000000000000000000000000602082015293505b50505090565b60055490565b600255565b60008054911515740100000000000000000000000000000000000000000274ff00000000000000000000000000000000000000001973ffffffffffffffffffffffffffffffffffffffff1990931633179290921691909117905543600155565b336000908152600660205260408120818080805b84548410156105785784848154811015156103e257fe5b906000526020600020906006020160050160149054906101000a900460ff16151561056d57848481548110151561041557fe5b9060005260206000209060060201600301544311151561043457600080fd5b848481548110151561044257fe5b906000526020600020906006020160030154600101409250848481548110151561046857fe5b600091825260209182902060069190910201600501546040805173ffffffffffffffffffffffffffffffffffffffff9092166c01000000000000000000000000028284015260348083018790528151808403909101815260549092019081905281519192909182918401908083835b602083106104f65780518252601f1990920191602091820191016104d7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209150848481548110151561053357fe5b906000526020600020906006020160020154826001900481151561055357fe5b0660ff1690508060001461056857600061056b565b60015b505b6001909301926103cb565b60009550505050505090565b60008060006003546064029150600354602402905060055481600454020260055460045402600354840201600354830360035402028115156105c257fe5b049250505090565b3360008181526006602081815260408084208054825160e081018452998a528984019889529189019687524360608a0190815260808a0183815260a08b0197885260c08b01878152600180860185559388529487209a5193909502909901918255965196810196909655935160028601559451600385015593516004840155516005909201805491511515740100000000000000000000000000000000000000000274ff00000000000000000000000000000000000000001973ffffffffffffffffffffffffffffffffffffffff90941673ffffffffffffffffffffffffffffffffffffffff199093169290921792909216179055905600a165627a7a723058204ec604342f47be19ab541065364f05592bd989c3f7cfeebc041b346ad51c45eb0029",
"deployedBytecode": "0x6080604052600436106100825763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663049fc41f811461009157806308bfcdba1461011b578063372cd85c146101425780637205aaa81461015c578063b95a3afb14610176578063bc2319831461019f578063f45fafd4146101b4575b34801561008e57600080fd5b50005b34801561009d57600080fd5b506100a66101d2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100e05781810151838201526020016100c8565b50505050905090810190601f16801561010d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561012757600080fd5b5061013061034c565b60408051918252519081900360200190f35b34801561014e57600080fd5b5061015a600435610352565b005b34801561016857600080fd5b5061015a6004351515610357565b34801561018257600080fd5b5061018b6103b7565b604080519115158252519081900360200190f35b3480156101ab57600080fd5b50610130610584565b3480156101c057600080fd5b5061018b6004356024356044356105ca565b6001805460609101406000808215156101ea57600080fd5b6000546040805173ffffffffffffffffffffffffffffffffffffffff9092166c0100000000000000000000000002602080840191909152603480840187905282518085039091018152605490930191829052825182918401908083835b602083106102665780518252601f199092019160209182019101610247565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912094506002925084915061029f9050565b0660ff1690508060011480156102cf575060005474010000000000000000000000000000000000000000900460ff165b1561030f5760408051808201909152600881527f596f752057696e2100000000000000000000000000000000000000000000000060208201529350610346565b60408051808201909152600881527f596f75204c6f7365000000000000000000000000000000000000000000000000602082015293505b50505090565b60055490565b600255565b60008054911515740100000000000000000000000000000000000000000274ff00000000000000000000000000000000000000001973ffffffffffffffffffffffffffffffffffffffff1990931633179290921691909117905543600155565b336000908152600660205260408120818080805b84548410156105785784848154811015156103e257fe5b906000526020600020906006020160050160149054906101000a900460ff16151561056d57848481548110151561041557fe5b9060005260206000209060060201600301544311151561043457600080fd5b848481548110151561044257fe5b906000526020600020906006020160030154600101409250848481548110151561046857fe5b600091825260209182902060069190910201600501546040805173ffffffffffffffffffffffffffffffffffffffff9092166c01000000000000000000000000028284015260348083018790528151808403909101815260549092019081905281519192909182918401908083835b602083106104f65780518252601f1990920191602091820191016104d7565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209150848481548110151561053357fe5b906000526020600020906006020160020154826001900481151561055357fe5b0660ff1690508060001461056857600061056b565b60015b505b6001909301926103cb565b60009550505050505090565b60008060006003546064029150600354602402905060055481600454020260055460045402600354840201600354830360035402028115156105c257fe5b049250505090565b3360008181526006602081815260408084208054825160e081018452998a528984019889529189019687524360608a0190815260808a0183815260a08b0197885260c08b01878152600180860185559388529487209a5193909502909901918255965196810196909655935160028601559451600385015593516004840155516005909201805491511515740100000000000000000000000000000000000000000274ff00000000000000000000000000000000000000001973ffffffffffffffffffffffffffffffffffffffff90941673ffffffffffffffffffffffffffffffffffffffff199093169290921792909216179055905600a165627a7a723058204ec604342f47be19ab541065364f05592bd989c3f7cfeebc041b346ad51c45eb0029",
"sourceMap": "26:4334:2:-;;;150:7;132:25;;;;163:37;;2176:222;5:2:-1;;;;30:1;27;20:12;5:2;-1:-1;2381:10:2;;2370:8;:21;2359:8;:32;26:4334;;;;;;",
"deployedSourceMap": "26:4334:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;26:4334:2;;3712:449;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3712:449:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:100:-1;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;3712:449:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3085:93;;8:9:-1;5:2;;;30:1;27;20:12;5:2;3085:93:2;;;;;;;;;;;;;;;;;;;;4289:69;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;4289:69:2;;;;;;;3481:141;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;3481:141:2;;;;;;;1063:1107;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1063:1107:2;;;;;;;;;;;;;;;;;;;;;;2653:322;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2653:322:2;;;;488:569;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;488:569:2;;;;;;;;;3712:449;3802:9;;;3754:6;;3802:11;3792:22;3772:17;;3832:14;;;3824:23;;;;;;3907:11;;3890:40;;;3907:11;;;;3890:40;;;;;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;3890:40:2;;;;;;;;3880:51;;3890:40;;3880:51;;;;3890:40;3880:51;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;;;;365:33;;3880:51:2;;;;;;;;;;;-1:-1:-1;3992:1:2;;-1:-1:-1;3880:51:2;;-1:-1:-1;3969:24:2;;-1:-1:-1;3969:24:2;;;3941:53;;;;4031:14;4049:1;4031:19;:31;;;;-1:-1:-1;4054:8:2;;;;;;;4031:31;4027:128;;;4077:17;;;;;;;;;;;;;;;;;;-1:-1:-1;4077:17:2;;4027:128;4126:17;;;;;;;;;;;;;;;;;;-1:-1:-1;4027:128:2;3712:449;;;;:::o;3085:93::-;3163:8;;3085:93;:::o;4289:69::-;4339:6;:12;4289:69::o;3481:141::-;3529:11;:24;;3563:18;;;;;-1:-1:-1;;;;3529:24:2;;;3543:10;3529:24;3563:18;;;;;;;;;;3603:12;3529:24;3591;3481:141::o;1063:1107::-;1166:10;1106:4;1155:22;;;:10;:22;;;;;1106:4;;;;1188:954;1209:19;;1205:23;;1188:954;;;1253:12;1266:1;1253:15;;;;;;;;;;;;;;;;;;;;:24;;;;;;;;;;;;1252:25;1248:884;;;1706:12;1719:1;1706:15;;;;;;;;;;;;;;;;;;;;:33;;;1691:12;:48;1683:57;;;;;;;;1799:12;1812:1;1799:15;;;;;;;;;;;;;;;;;;;;:33;;;1835:1;1799:37;1789:48;1759:78;;1925:12;1938:1;1925:15;;;;;;;;;;;;;;;;;;;;;;;;;:22;;;1908:61;;;1925:22;;;;1908:61;;;;;;;;;;;;;;;26:21:-1;;;22:32;;;6:49;;1908:61:2;;;;;;;;1877:110;;1908:61;;;;;;1877:110;;;;1908:61;1877:110;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;1877:110:2;;;;;;;;;;;;;;;;1855:132;;2048:12;2061:1;2048:15;;;;;;;;;;;;;;;;;;;;:23;;;2033:11;2025:20;;;:46;;;;;;;;2005:67;;;;2091:6;2101:1;2091:11;:26;;2112:5;2091:26;;;2105:4;2091:26;;1248:884;1230:3;;;;;1188:954;;;2158:5;2151:12;;1063:1107;;;;;;:::o;2653:322::-;2689:4;2704:12;2745:15;2725:10;;2719:3;:16;2704:31;;2768:10;;2763:2;:15;2745:33;;2959:8;;2946:10;2928:15;;:28;:39;2903:8;;2885:15;;:26;2872:10;;2862:7;:20;:49;2835:10;;2822;:23;2796:10;;:50;:116;:172;;;;;;;;2789:179;;2653:322;;;:::o;488:569::-;727:10;619:4;716:22;;;:10;:22;;;;;;;;763:19;;823:203;;;;;;;;;;;;;;;;;;;;;;922:12;823:203;;;;;;;;;;;;;;;;;;;;;;;;952:9;;;;45:23:-1;;792:235:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;716:22:2;792:235;;;-1:-1:-1;;792:235:2;;;;;;;;;;;;;;619:4;488:569::o",
"source": "pragma solidity ^0.4.23;\n\ncontract EdgeFund{\n\n address _betAddress;\n bool _isHeads;\n uint _betBlock;\n uint _dummy;\n\n uint Multiplier = 10 ** 8;\n uint FractionalKelly = 1 * Multiplier;\n\n //temporary\n uint Bankroll;\n\n struct Bet{\n uint BetSize;\n uint PayoutOdds;\n uint WinOdds;\n\n uint PlacedBlockNumber;\n uint PlayerBetIndex;\n address Player;\n\n bool Resolved;\n }\n\n mapping(address => Bet[]) playerBets;\n\n function PlaceBetWithWinOdds (\n uint BetSize,\n uint PayoutOdds,\n uint WinOdds)\n public\n returns(bool)\n {\n // Bet b;\n //b.Betsize = BetSize;\n Bet[] storage existingBets = playerBets[msg.sender];\n uint numBets = existingBets.length;\n existingBets.push(\n Bet(\n BetSize,\n PayoutOdds,\n WinOdds,\n block.number,\n numBets++,\n msg.sender,\n false\n ));\n\n return false;\n }\n\n function ResolveBets() public view returns(bool)\n {\n Bet[] storage existingBets = playerBets[msg.sender];\n\n for (uint i = 0; i < existingBets.length; i++){\n if (!existingBets[i].Resolved)\n {\n /*\n * Steps to resolve a bet\n * check that the current block is > the bet-placed block\n * check that the amount being paid out on this block is < block reward\n * get the blockhash of the resolving block\n * get the result of the bet for the given resolution-block\n */\n\n require(block.number > existingBets[i].PlacedBlockNumber);\n\n bytes32 ResolutionblockHash = blockhash(existingBets[i].PlacedBlockNumber + 1);\n bytes32 HashedValue = keccak256(\n abi.encodePacked(existingBets[i].Player, ResolutionblockHash)\n );\n uint Result = uint8(uint256(HashedValue) % existingBets[i].WinOdds);\n\n Result == 0 ? true : false;\n }\n }\n return false;\n }\n\n constructor() public\n {\n /**\n * This will be replaced with an ERC20 token. Used to allow some intial\n * testing with the EdgeFund functions\n */\n Bankroll = 10000000 * Multiplier;\n }\n\n /**\n * The default function is called when Ether is sent to this address\n * Need to decide what to do in this scenario. Place a bet? Return funds?\n * Currently favour placing a 'coin toss' bet here.\n */\n function() public{\n }\n\n function Temp() public view returns(uint){\n uint BetSize = 100 * Multiplier;\n uint PayoutOdds = 36 * Multiplier;\n\n return Multiplier *\n (PayoutOdds - Multiplier) *\n (BetSize * Multiplier + FractionalKelly * Bankroll) /\n (FractionalKelly * PayoutOdds * Bankroll);\n }\n\n struct UserInteraction{\n uint betSize;\n uint PayoutOdds;\n uint WinOdds;\n }\n\n function getBankrollBalance() public view returns (uint)\n {\n return Bankroll;\n }\n\n function CalculateEdge(\n uint probability,\n uint decimalPayoutOdds\n )\n private\n pure\n returns(uint)\n {\n return probability * decimalPayoutOdds - 1;\n }\n\n // EdgeFund.deployed().then(function(instance){return instance.PlaceBet(true);});\n function PlaceBet(bool isHeads) public{\n _betAddress = msg.sender;\n _isHeads = isHeads;\n _betBlock = block.number;\n }\n\n // EdgeFund.deployed().then(function(instance){return instance.ResolveBet();});\n function ResolveBet() public view returns(string) {\n bytes32 blockHash = blockhash(_betBlock+1);\n require(blockHash != 0);\n\n bytes32 HashedValue = keccak256(abi.encodePacked(_betAddress, blockHash));\n uint CoinTossResult = uint8(uint256(HashedValue) % 2);//heads = 1, tails = 0\n\n if (CoinTossResult == 1 && _isHeads){\n return \"You Win!\";\n\n } else {\n return \"You Lose\";\n\n }\n }\n\n // For testing with Ganache\n // EdgeFund.deployed().then(function(instance){return instance.ForceNewBlock(123);});\n function ForceNewBlock(uint val) public {\n _dummy = val;\n }\n}\n",
"sourcePath": "/Users/garethoates/Developer/Blockchain/EdgeFund/edgefund-core/contracts/EdgeFund.sol",
"ast": {
"absolutePath": "/Users/garethoates/Developer/Blockchain/EdgeFund/edgefund-core/contracts/EdgeFund.sol",
"exportedSymbols": {
"EdgeFund": [
674
]
},
"id": 675,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 329,
"literals": [
"solidity",
"^",
"0.4",
".23"
],
"nodeType": "PragmaDirective",
"src": "0:24:2"
},
{
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 674,
"linearizedBaseContracts": [
674
],
"name": "EdgeFund",
"nodeType": "ContractDefinition",
"nodes": [
{
"constant": false,
"id": 331,
"name": "_betAddress",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "50:19:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 330,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "50:7:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 333,
"name": "_isHeads",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "75:13:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 332,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "75:4:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 335,
"name": "_betBlock",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "94:14:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 334,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "94:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 337,
"name": "_dummy",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "114:11:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 336,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "114:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 342,
"name": "Multiplier",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "132:25:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 338,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "132:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_rational_100000000_by_1",
"typeString": "int_const 100000000"
},
"id": 341,
"isConstant": false,
"isLValue": false,
"isPure": true,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"hexValue": "3130",
"id": 339,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "150:2:2",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_10_by_1",
"typeString": "int_const 10"
},
"value": "10"
},
"nodeType": "BinaryOperation",
"operator": "**",
"rightExpression": {
"argumentTypes": null,
"hexValue": "38",
"id": 340,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "156:1:2",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_8_by_1",
"typeString": "int_const 8"
},
"value": "8"
},
"src": "150:7:2",
"typeDescriptions": {
"typeIdentifier": "t_rational_100000000_by_1",
"typeString": "int_const 100000000"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 347,
"name": "FractionalKelly",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "163:37:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 343,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "163:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": {
"argumentTypes": null,
"commonType": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"id": 346,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftExpression": {
"argumentTypes": null,
"hexValue": "31",
"id": 344,
"isConstant": false,
"isLValue": false,
"isPure": true,
"kind": "number",
"lValueRequested": false,
"nodeType": "Literal",
"src": "186:1:2",
"subdenomination": null,
"typeDescriptions": {
"typeIdentifier": "t_rational_1_by_1",
"typeString": "int_const 1"
},
"value": "1"
},
"nodeType": "BinaryOperation",
"operator": "*",
"rightExpression": {
"argumentTypes": null,
"id": 345,
"name": "Multiplier",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 342,
"src": "190:10:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"src": "186:14:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 349,
"name": "Bankroll",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "223:13:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 348,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "223:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"canonicalName": "EdgeFund.Bet",
"id": 364,
"members": [
{
"constant": false,
"id": 351,
"name": "BetSize",
"nodeType": "VariableDeclaration",
"scope": 364,
"src": "263:12:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 350,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "263:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 353,
"name": "PayoutOdds",
"nodeType": "VariableDeclaration",
"scope": 364,
"src": "285:15:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 352,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "285:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 355,
"name": "WinOdds",
"nodeType": "VariableDeclaration",
"scope": 364,
"src": "310:12:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 354,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "310:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 357,
"name": "PlacedBlockNumber",
"nodeType": "VariableDeclaration",
"scope": 364,
"src": "333:22:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 356,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "333:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 359,
"name": "PlayerBetIndex",
"nodeType": "VariableDeclaration",
"scope": 364,
"src": "365:19:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 358,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "365:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 361,
"name": "Player",
"nodeType": "VariableDeclaration",
"scope": 364,
"src": "394:14:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 360,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "394:7:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 363,
"name": "Resolved",
"nodeType": "VariableDeclaration",
"scope": 364,
"src": "419:13:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
},
"typeName": {
"id": 362,
"name": "bool",
"nodeType": "ElementaryTypeName",
"src": "419:4:2",
"typeDescriptions": {
"typeIdentifier": "t_bool",
"typeString": "bool"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "Bet",
"nodeType": "StructDefinition",
"scope": 674,
"src": "243:196:2",
"visibility": "public"
},
{
"constant": false,
"id": 369,
"name": "playerBets",
"nodeType": "VariableDeclaration",
"scope": 674,
"src": "445:36:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Bet_$364_storage_$dyn_storage_$",
"typeString": "mapping(address => struct EdgeFund.Bet[])"
},
"typeName": {
"id": 368,
"keyType": {
"id": 365,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "453:7:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "445:25:2",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Bet_$364_storage_$dyn_storage_$",
"typeString": "mapping(address => struct EdgeFund.Bet[])"
},
"valueType": {
"baseType": {
"contractScope": null,
"id": 366,
"name": "Bet",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 364,
"src": "464:3:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Bet_$364_storage_ptr",
"typeString": "struct EdgeFund.Bet"
}
},
"id": 367,
"length": null,
"nodeType": "ArrayTypeName",
"src": "464:5:2",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Bet_$364_storage_$dyn_storage_ptr",
"typeString": "struct EdgeFund.Bet[]"
}
}
},
"value": null,
"visibility": "internal"
},
{
"body": {
"id": 413,
"nodeType": "Block",
"src": "629:428:2",
"statements": [
{
"assignments": [
383
],
"declarations": [
{
"constant": false,
"id": 383,
"name": "existingBets",
"nodeType": "VariableDeclaration",
"scope": 414,
"src": "687:26:2",
"stateVariable": false,
"storageLocation": "storage",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Bet_$364_storage_$dyn_storage_ptr",
"typeString": "struct EdgeFund.Bet[]"
},
"typeName": {
"baseType": {
"contractScope": null,
"id": 381,
"name": "Bet",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 364,
"src": "687:3:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Bet_$364_storage_ptr",
"typeString": "struct EdgeFund.Bet"
}
},
"id": 382,
"length": null,
"nodeType": "ArrayTypeName",
"src": "687:5:2",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Bet_$364_storage_$dyn_storage_ptr",
"typeString": "struct EdgeFund.Bet[]"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 388,
"initialValue": {
"argumentTypes": null,
"baseExpression": {
"argumentTypes": null,
"id": 384,
"name": "playerBets",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 369,
"src": "716:10:2",
"typeDescriptions": {
"typeIdentifier": "t_mapping$_t_address_$_t_array$_t_struct$_Bet_$364_storage_$dyn_storage_$",
"typeString": "mapping(address => struct EdgeFund.Bet storage ref[] storage ref)"
}
},
"id": 387,
"indexExpression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 385,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 689,
"src": "727:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 386,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "727:10:2",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"nodeType": "IndexAccess",
"src": "716:22:2",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Bet_$364_storage_$dyn_storage",
"typeString": "struct EdgeFund.Bet storage ref[] storage ref"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "687:51:2"
},
{
"assignments": [
390
],
"declarations": [
{
"constant": false,
"id": 390,
"name": "numBets",
"nodeType": "VariableDeclaration",
"scope": 414,
"src": "748:12:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName": {
"id": 389,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "748:4:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 393,
"initialValue": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 391,
"name": "existingBets",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 383,
"src": "763:12:2",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_struct$_Bet_$364_storage_$dyn_storage_ptr",
"typeString": "struct EdgeFund.Bet storage ref[] storage pointer"
}
},
"id": 392,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "length",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "763:19:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"nodeType": "VariableDeclarationStatement",
"src": "748:34:2"
},
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 398,
"name": "BetSize",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 371,
"src": "844:7:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 399,
"name": "PayoutOdds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 373,
"src": "869:10:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 400,
"name": "WinOdds",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 375,
"src": "897:7:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 401,
"name": "block",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 679,
"src": "922:5:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_block",
"typeString": "block"
}
},
"id": 402,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "number",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "922:12:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"id": 404,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"nodeType": "UnaryOperation",
"operator": "++",
"prefix": false,
"src": "952:9:2",
"subExpression": {
"argumentTypes": null,
"id": 403,
"name": "numBets",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 390,
"src": "952:7:2",
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"typeDescriptions": {
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 405,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 689,
"src": "979:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 406,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "979:10:2",
"typeDescriptions": {
"typeIdentifier": "t_address",