From 6c848b21752579bfa23781cfee3af307be8b5631 Mon Sep 17 00:00:00 2001 From: Rene <36115705+rene78@users.noreply.github.com> Date: Sat, 9 Nov 2019 00:48:00 +0100 Subject: [PATCH] Small updates --- contracts/HeadsOrTails.sol | 5 +---- dist/main.js | 2 +- dist/main.js.map | 2 +- index.html | 6 ++++-- main.css | 3 +++ src/main.js | 33 ++++++++++++++++++++++----------- 6 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 main.css diff --git a/contracts/HeadsOrTails.sol b/contracts/HeadsOrTails.sol index a0c3e91..19984c6 100644 --- a/contracts/HeadsOrTails.sol +++ b/contracts/HeadsOrTails.sol @@ -1,5 +1,5 @@ // Version of Solidity compiler this program was written for -pragma solidity ^0.5.0; +pragma solidity ^0.5.8; // Heads or tails game contract contract HeadsOrTails { @@ -46,9 +46,6 @@ contract HeadsOrTails { won = true; } -// EMIT für "won = false" gibt immer "null" zurück. Rausfinden warum! -// block.timestamp vor deploy rausschmeissen! - emit GameResult(won); lastPlayedGames.push(Game(msg.sender, msg.value, guess, won, address(this).balance)); return won; //Return value can only be used by other functions, but not within web3.js (as of 2019) diff --git a/dist/main.js b/dist/main.js index df09d82..75a32f0 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1,2 +1,2 @@ -!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e){e.exports=JSON.parse('{"contractName":"HeadsOrTails","abi":[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"blabla","type":"bool"}],"name":"GameResult","type":"event"},{"constant":false,"inputs":[{"name":"guess","type":"uint8"}],"name":"lottery","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"getGameCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"getGameEntry","outputs":[{"name":"addr","type":"address"},{"name":"amountBet","type":"uint256"},{"name":"guess","type":"uint8"},{"name":"winner","type":"bool"},{"name":"ethInJackpot","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"metadata":"{\\"compiler\\":{\\"version\\":\\"0.5.8+commit.23d335f2\\"},\\"language\\":\\"Solidity\\",\\"output\\":{\\"abi\\":[{\\"constant\\":true,\\"inputs\\":[],\\"name\\":\\"name\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"string\\"}],\\"payable\\":false,\\"stateMutability\\":\\"view\\",\\"type\\":\\"function\\"},{\\"constant\\":false,\\"inputs\\":[{\\"name\\":\\"amount\\",\\"type\\":\\"uint256\\"}],\\"name\\":\\"withdraw\\",\\"outputs\\":[],\\"payable\\":false,\\"stateMutability\\":\\"nonpayable\\",\\"type\\":\\"function\\"},{\\"constant\\":true,\\"inputs\\":[{\\"name\\":\\"index\\",\\"type\\":\\"uint256\\"}],\\"name\\":\\"getGameEntry\\",\\"outputs\\":[{\\"name\\":\\"addr\\",\\"type\\":\\"address\\"},{\\"name\\":\\"amountBet\\",\\"type\\":\\"uint256\\"},{\\"name\\":\\"guess\\",\\"type\\":\\"uint8\\"},{\\"name\\":\\"winner\\",\\"type\\":\\"bool\\"},{\\"name\\":\\"ethInJackpot\\",\\"type\\":\\"uint256\\"}],\\"payable\\":false,\\"stateMutability\\":\\"view\\",\\"type\\":\\"function\\"},{\\"constant\\":false,\\"inputs\\":[],\\"name\\":\\"destroy\\",\\"outputs\\":[],\\"payable\\":false,\\"stateMutability\\":\\"nonpayable\\",\\"type\\":\\"function\\"},{\\"constant\\":false,\\"inputs\\":[{\\"name\\":\\"guess\\",\\"type\\":\\"uint8\\"}],\\"name\\":\\"lottery\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"bool\\"}],\\"payable\\":true,\\"stateMutability\\":\\"payable\\",\\"type\\":\\"function\\"},{\\"constant\\":true,\\"inputs\\":[],\\"name\\":\\"getGameCount\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"uint256\\"}],\\"payable\\":false,\\"stateMutability\\":\\"view\\",\\"type\\":\\"function\\"},{\\"inputs\\":[],\\"payable\\":false,\\"stateMutability\\":\\"nonpayable\\",\\"type\\":\\"constructor\\"},{\\"payable\\":true,\\"stateMutability\\":\\"payable\\",\\"type\\":\\"fallback\\"},{\\"anonymous\\":false,\\"inputs\\":[{\\"indexed\\":false,\\"name\\":\\"blabla\\",\\"type\\":\\"bool\\"}],\\"name\\":\\"GameResult\\",\\"type\\":\\"event\\"}],\\"devdoc\\":{\\"methods\\":{}},\\"userdoc\\":{\\"methods\\":{}}},\\"settings\\":{\\"compilationTarget\\":{\\"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol\\":\\"HeadsOrTails\\"},\\"evmVersion\\":\\"petersburg\\",\\"libraries\\":{},\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200},\\"remappings\\":[]},\\"sources\\":{\\"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol\\":{\\"keccak256\\":\\"0xc23f5e1a615588efdc53ee048b97ae23fa63e07298873c4e93bf417b4c48d762\\",\\"urls\\":[\\"bzzr://d261044861bd03ec269b6d42a84e02cb85724c84bfbae22ad2b6596dd172cc23\\"]}},\\"version\\":1}","bytecode":"0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040518060400160405280601381526020017f4865616473206f72205461696c732064417070000000000000000000000000008152506001908051906020019061009c9291906100a2565b50610147565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100e357805160ff1916838001178555610111565b82800160010185558215610111579182015b828111156101105782518255916020019190600101906100f5565b5b50905061011e9190610122565b5090565b61014491905b80821115610140576000816000905550600101610128565b5090565b90565b610ad8806101566000396000f3fe6080604052600436106100555760003560e01c806306fdde03146100575780632e1a7d4d146100e75780637f9ff2f81461012257806383197ef0146101c3578063a80de5ea146101da578063e87c0ee614610223575b005b34801561006357600080fd5b5061006c61024e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100ac578082015181840152602081019050610091565b50505050905090810190601f1680156100d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100f357600080fd5b506101206004803603602081101561010a57600080fd5b81019080803590602001909291905050506102ec565b005b34801561012e57600080fd5b5061015b6004803603602081101561014557600080fd5b810190808035906020019092919050505061046b565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018460ff1660ff168152602001831515151581526020018281526020019550505050505060405180910390f35b3480156101cf57600080fd5b506101d861055b565b005b610209600480360360208110156101f057600080fd5b81019080803560ff16906020019092919050505061063a565b604051808215151515815260200191505060405180910390f35b34801561022f57600080fd5b506102386109d0565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e45780601f106102b9576101008083540402835291602001916102e4565b820191906000526020600020905b8154815290600101906020018083116102c757829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16318110610400576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180610a17603f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610467573d6000803e3d6000fd5b5050565b60008060008060006002868154811061048057fe5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600287815481106104bf57fe5b906000526020600020906004020160010154600288815481106104de57fe5b906000526020600020906004020160020160009054906101000a900460ff166002898154811061050a57fe5b906000526020600020906004020160020160019054906101000a900460ff1660028a8154811061053657fe5b9060005260206000209060040201600301549450945094509450945091939590929450565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610600576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000808260ff161480610650575060018260ff16145b6106a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180610a856028913960400191505060405180910390fd5b6000341161071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f426574206d6f7265207468616e2030000000000000000000000000000000000081525060200191505060405180910390fd5b343073ffffffffffffffffffffffffffffffffffffffff16310334111561078d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806109de6039913960400191505060405180910390fd5b60006002443342604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140182815260200193505050506040516020818303038152906040528051906020012060001c8161080157fe5b06905060008090508160ff168460ff161415610866573373ffffffffffffffffffffffffffffffffffffffff166108fc600234029081150290604051600060405180830381858888f19350505050158015610860573d6000803e3d6000fd5b50600190505b7f01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d6181604051808215151515815260200191505060405180910390a160026040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018660ff16815260200183151581526020013073ffffffffffffffffffffffffffffffffffffffff16318152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff021916908360ff16021790555060608201518160020160016101000a81548160ff021916908315150217905550608082015181600301555050508092505050919050565b600060028054905090509056fe596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e65725661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031a165627a7a723058205601e4df13afc485b3a277f93e3584f8c62a6b09fba45ef7453fc1239dedf8b60029","deployedBytecode":"0x6080604052600436106100555760003560e01c806306fdde03146100575780632e1a7d4d146100e75780637f9ff2f81461012257806383197ef0146101c3578063a80de5ea146101da578063e87c0ee614610223575b005b34801561006357600080fd5b5061006c61024e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100ac578082015181840152602081019050610091565b50505050905090810190601f1680156100d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100f357600080fd5b506101206004803603602081101561010a57600080fd5b81019080803590602001909291905050506102ec565b005b34801561012e57600080fd5b5061015b6004803603602081101561014557600080fd5b810190808035906020019092919050505061046b565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018460ff1660ff168152602001831515151581526020018281526020019550505050505060405180910390f35b3480156101cf57600080fd5b506101d861055b565b005b610209600480360360208110156101f057600080fd5b81019080803560ff16906020019092919050505061063a565b604051808215151515815260200191505060405180910390f35b34801561022f57600080fd5b506102386109d0565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e45780601f106102b9576101008083540402835291602001916102e4565b820191906000526020600020905b8154815290600101906020018083116102c757829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16318110610400576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180610a17603f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610467573d6000803e3d6000fd5b5050565b60008060008060006002868154811061048057fe5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600287815481106104bf57fe5b906000526020600020906004020160010154600288815481106104de57fe5b906000526020600020906004020160020160009054906101000a900460ff166002898154811061050a57fe5b906000526020600020906004020160020160019054906101000a900460ff1660028a8154811061053657fe5b9060005260206000209060040201600301549450945094509450945091939590929450565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610600576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000808260ff161480610650575060018260ff16145b6106a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180610a856028913960400191505060405180910390fd5b6000341161071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f426574206d6f7265207468616e2030000000000000000000000000000000000081525060200191505060405180910390fd5b343073ffffffffffffffffffffffffffffffffffffffff16310334111561078d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806109de6039913960400191505060405180910390fd5b60006002443342604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140182815260200193505050506040516020818303038152906040528051906020012060001c8161080157fe5b06905060008090508160ff168460ff161415610866573373ffffffffffffffffffffffffffffffffffffffff166108fc600234029081150290604051600060405180830381858888f19350505050158015610860573d6000803e3d6000fd5b50600190505b7f01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d6181604051808215151515815260200191505060405180910390a160026040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018660ff16815260200183151581526020013073ffffffffffffffffffffffffffffffffffffffff16318152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff021916908360ff16021790555060608201518160020160016101000a81548160ff021916908315150217905550608082015181600301555050508092505050919050565b600060028054905090509056fe596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e65725661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031a165627a7a723058205601e4df13afc485b3a277f93e3584f8c62a6b09fba45ef7453fc1239dedf8b60029","sourceMap":"122:3125:0:-;;;514:87;8:9:-1;5:2;;;30:1;27;20:12;5:2;514:87:0;550:10;542:5;;:18;;;;;;;;;;;;;;;;;;567:28;;;;;;;;;;;;;;;;;:4;:28;;;;;;;;;;;;:::i;:::-;;122:3125;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;","deployedSourceMap":"122:3125:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;175:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;175:18:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;175:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2976:198;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2976:198:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2976:198:0;;;;;;;;;;;;;;;;;:::i;:::-;;2214:352;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2214:352:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2214:352:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2866:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2866:70:0;;;:::i;:::-;;834:1099;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;834:1099:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1978:92;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1978:92:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;175:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2976:198::-;737:5;;;;;;;;;;;723:19;;:10;:19;;;715:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3058:4;3050:21;;;3041:6;:30;3033:106;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3146:5;;;;;;;;;;;:14;;:22;3161:6;3146:22;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3146:22:0;2976:198;:::o;2214:352::-;2268:12;2282:14;2298:11;2311;2324:17;2366:15;2382:5;2366:22;;;;;;;;;;;;;;;;;;:27;;;;;;;;;;;;2402:15;2418:5;2402:22;;;;;;;;;;;;;;;;;;:32;;;2443:15;2459:5;2443:22;;;;;;;;;;;;;;;;;;:28;;;;;;;;;;;;2480:15;2496:5;2480:22;;;;;;;;;;;;;;;;;;:29;;;;;;;;;;;;2518:15;2534:5;2518:22;;;;;;;;;;;;;;;;;;:35;;;2350:210;;;;;;;;;;2214:352;;;;;;;:::o;2866:70::-;737:5;;;;;;;;;;;723:19;;:10;:19;;;715:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2924:5;;;;;;;;;;;2911:19;;;834:1099;887:4;916:1;907:5;:10;;;:24;;;;930:1;921:5;:10;;;907:24;899:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1003:1;991:9;:13;983:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1076:9;1060:4;1052:21;;;:33;1039:9;:46;;1031:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1463:12;1568:1;1519:16;1537:10;1549:15;1502:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;1502:63:0;;;1492:74;;;;;;1484:83;;:85;;;;;;1463:107;;1577:8;1588:5;1577:16;;1613:6;1604:15;;:5;:15;;;1600:105;;;1644:10;:19;;:34;1676:1;1664:9;:13;1644:34;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1644:34:0;1693:4;1687:10;;1600:105;1716:15;1727:3;1716:15;;;;;;;;;;;;;;;;;;;;;;1738;1759:62;;;;;;;;1764:10;1759:62;;;;;;1776:9;1759:62;;;;1787:5;1759:62;;;;;;1794:3;1759:62;;;;;;1807:4;1799:21;;;1759:62;;;1738:84;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1738:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1836:3;1829:10;;;;834:1099;;;:::o;1978:92::-;2022:4;2042:15;:22;;;;2035:29;;1978:92;:::o","source":"// Version of Solidity compiler this program was written for\\r\\npragma solidity ^0.5.0;\\r\\n\\r\\n// Heads or tails game contract\\r\\ncontract HeadsOrTails {\\r\\n address payable owner;\\r\\n string public name;\\r\\n\\r\\n struct Game {\\r\\n address addr;\\r\\n uint amountBet;\\r\\n uint8 guess;\\r\\n bool winner;\\r\\n uint ethInJackpot;\\r\\n }\\r\\n\\r\\n Game[] lastPlayedGames;\\r\\n\\r\\n //Log game result in order to display it on frontend\\r\\n event GameResult(bool blabla);\\r\\n\\r\\n // Contract constructor run only on contract creation. Set owner.\\r\\n constructor() public {\\r\\n owner = msg.sender;\\r\\n name = \\"Heads or Tails dApp\\";\\r\\n }\\r\\n\\r\\n //add this modifier to functions, which should only be accessible by the owner\\r\\n modifier onlyOwner {\\r\\n require(msg.sender == owner, \\"This function can only be launched by the owner\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n //Play the game!\\r\\n function lottery(uint8 guess) public payable returns(bool){\\r\\n require(guess == 0 || guess == 1, \\"Variable \'guess\' should be either 0 or 1\\");\\r\\n require(msg.value > 0, \\"Bet more than 0\\");\\r\\n require(msg.value <= address(this).balance - msg.value, \\"You cannot bet more than what is available in the jackpot\\");\\r\\n //address(this).balance is increased by msg.value even before code is executed. Thus \\"address(this).balance-msg.value\\"\\r\\n //Create a random number. Use the mining difficulty & the player\'s address, hash it, convert this hex to int, divide by modulo 2 which results in either 0 or 1 and return as uint8\\r\\n uint8 result = uint8(uint256(keccak256(abi.encodePacked(block.difficulty, msg.sender, block.timestamp)))%2);\\r\\n bool won = false;\\r\\n if (guess == result) {\\r\\n //Won!\\r\\n msg.sender.transfer(msg.value * 2);\\r\\n won = true;\\r\\n }\\r\\n emit GameResult(won);\\r\\n lastPlayedGames.push(Game(msg.sender, msg.value, guess, won, address(this).balance));\\r\\n return won; //Return value can only be used by other functions, but not within web3.js (as of 2019)\\r\\n }\\r\\n\\r\\n //Get amount of games played so far\\r\\n function getGameCount() public view returns(uint) {\\r\\n return lastPlayedGames.length;\\r\\n }\\r\\n\\r\\n //Get stats about a certain played game, e.g. address of player, amount bet, won or lost, and ETH in the jackpot at this point in time\\r\\n function getGameEntry(uint index) public view returns(address addr, uint amountBet, uint8 guess, bool winner, uint ethInJackpot) {\\r\\n return (\\r\\n lastPlayedGames[index].addr,\\r\\n lastPlayedGames[index].amountBet,\\r\\n lastPlayedGames[index].guess,\\r\\n lastPlayedGames[index].winner,\\r\\n lastPlayedGames[index].ethInJackpot\\r\\n );\\r\\n }\\r\\n\\r\\n // Contract destructor (Creator of contract can also destroy it and receives remaining ether of contract address).\\r\\n //Advantage compared to \\"withdraw\\": SELFDESTRUCT opcode uses negative gas because the operation frees up space on\\r\\n //the blockchain by clearing all of the contract\'s data\\r\\n function destroy() external onlyOwner {\\r\\n selfdestruct(owner);\\r\\n }\\r\\n\\r\\n //Withdraw money from contract\\r\\n function withdraw(uint amount) external onlyOwner {\\r\\n require(amount < address(this).balance, \\"You cannot withdraw more than what is available in the contract\\");\\r\\n owner.transfer(amount);\\r\\n }\\r\\n\\r\\n // Accept any incoming amount\\r\\n function () external payable {}\\r\\n}","sourcePath":"C:/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol","ast":{"absolutePath":"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol","exportedSymbols":{"HeadsOrTails":[242]},"id":243,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"62:23:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":242,"linearizedBaseContracts":[242],"name":"HeadsOrTails","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":3,"name":"owner","nodeType":"VariableDeclaration","scope":242,"src":"149:21:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":2,"name":"address","nodeType":"ElementaryTypeName","src":"149:15:0","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"value":null,"visibility":"internal"},{"constant":false,"id":5,"name":"name","nodeType":"VariableDeclaration","scope":242,"src":"175:18:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string"},"typeName":{"id":4,"name":"string","nodeType":"ElementaryTypeName","src":"175:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"public"},{"canonicalName":"HeadsOrTails.Game","id":16,"members":[{"constant":false,"id":7,"name":"addr","nodeType":"VariableDeclaration","scope":16,"src":"219:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":6,"name":"address","nodeType":"ElementaryTypeName","src":"219:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":9,"name":"amountBet","nodeType":"VariableDeclaration","scope":16,"src":"238:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":8,"name":"uint","nodeType":"ElementaryTypeName","src":"238:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":11,"name":"guess","nodeType":"VariableDeclaration","scope":16,"src":"259:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":10,"name":"uint8","nodeType":"ElementaryTypeName","src":"259:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":13,"name":"winner","nodeType":"VariableDeclaration","scope":16,"src":"277:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":12,"name":"bool","nodeType":"ElementaryTypeName","src":"277:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":15,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":16,"src":"295:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":14,"name":"uint","nodeType":"ElementaryTypeName","src":"295:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"name":"Game","nodeType":"StructDefinition","scope":242,"src":"200:118:0","visibility":"public"},{"constant":false,"id":19,"name":"lastPlayedGames","nodeType":"VariableDeclaration","scope":242,"src":"324:22:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game[]"},"typeName":{"baseType":{"contractScope":null,"id":17,"name":"Game","nodeType":"UserDefinedTypeName","referencedDeclaration":16,"src":"324:4:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage_ptr","typeString":"struct HeadsOrTails.Game"}},"id":18,"length":null,"nodeType":"ArrayTypeName","src":"324:6:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage_ptr","typeString":"struct HeadsOrTails.Game[]"}},"value":null,"visibility":"internal"},{"anonymous":false,"documentation":null,"id":23,"name":"GameResult","nodeType":"EventDefinition","parameters":{"id":22,"nodeType":"ParameterList","parameters":[{"constant":false,"id":21,"indexed":false,"name":"blabla","nodeType":"VariableDeclaration","scope":23,"src":"426:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":20,"name":"bool","nodeType":"ElementaryTypeName","src":"426:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"425:13:0"},"src":"409:30:0"},{"body":{"id":35,"nodeType":"Block","src":"535:66:0","statements":[{"expression":{"argumentTypes":null,"id":29,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":26,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"542:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":27,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"550:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":28,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"550:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"542:18:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":30,"nodeType":"ExpressionStatement","src":"542:18:0"},{"expression":{"argumentTypes":null,"id":33,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":31,"name":"name","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":5,"src":"567:4:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"4865616473206f72205461696c732064417070","id":32,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"574:21:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_ce4abf6351d67276ac5372334d1c289ffb15acc1a14ed0a47095a166ee22f585","typeString":"literal_string \\"Heads or Tails dApp\\""},"value":"Heads or Tails dApp"},"src":"567:28:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"id":34,"nodeType":"ExpressionStatement","src":"567:28:0"}]},"documentation":null,"id":36,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":24,"nodeType":"ParameterList","parameters":[],"src":"525:2:0"},"returnParameters":{"id":25,"nodeType":"ParameterList","parameters":[],"src":"535:0:0"},"scope":242,"src":"514:87:0","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":47,"nodeType":"Block","src":"708:100:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"id":42,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":39,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"723:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":40,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"723:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":41,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"737:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"723:19:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e6572","id":43,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"744:49:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""},"value":"This function can only be launched by the owner"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""}],"id":38,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"715:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":44,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"715:79:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":45,"nodeType":"ExpressionStatement","src":"715:79:0"},{"id":46,"nodeType":"PlaceholderStatement","src":"801:1:0"}]},"documentation":null,"id":48,"name":"onlyOwner","nodeType":"ModifierDefinition","parameters":{"id":37,"nodeType":"ParameterList","parameters":[],"src":"708:0:0"},"src":"689:119:0","visibility":"internal"},{"body":{"id":155,"nodeType":"Block","src":"892:1041:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_bool","typeString":"bool"},"id":62,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":58,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":56,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"907:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"30","id":57,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"916:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"907:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"BinaryOperation","operator":"||","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":61,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":59,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"921:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"31","id":60,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"930:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_1_by_1","typeString":"int_const 1"},"value":"1"},"src":"921:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"src":"907:24:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"5661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031","id":63,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"933:42:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""},"value":"Variable \'guess\' should be either 0 or 1"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""}],"id":55,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"899:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":64,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"899:77:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":65,"nodeType":"ExpressionStatement","src":"899:77:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":70,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":67,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"991:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":68,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"991:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":">","rightExpression":{"argumentTypes":null,"hexValue":"30","id":69,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1003:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"991:13:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"426574206d6f7265207468616e2030","id":71,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1006:17:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""},"value":"Bet more than 0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""}],"id":66,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"983:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":72,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"983:41:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":73,"nodeType":"ExpressionStatement","src":"983:41:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":84,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":75,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1039:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":76,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1039:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<=","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":83,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":78,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1060:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":77,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1052:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":79,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1052:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":80,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1052:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"-","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":81,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1076:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":82,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1076:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1052:33:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1039:46:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74","id":85,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1087:59:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""},"value":"You cannot bet more than what is available in the jackpot"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""}],"id":74,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"1031:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":86,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1031:116:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":87,"nodeType":"ExpressionStatement","src":"1031:116:0"},{"assignments":[89],"declarations":[{"constant":false,"id":89,"name":"result","nodeType":"VariableDeclaration","scope":155,"src":"1463:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":88,"name":"uint8","nodeType":"ElementaryTypeName","src":"1463:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"id":107,"initialValue":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":105,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":95,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1519:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":96,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"difficulty","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1519:16:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":97,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1537:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":98,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1537:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":99,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1549:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":100,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"timestamp","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1549:15:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":93,"name":"abi","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":301,"src":"1502:3:0","typeDescriptions":{"typeIdentifier":"t_magic_abi","typeString":"abi"}},"id":94,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"memberName":"encodePacked","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1502:16:0","typeDescriptions":{"typeIdentifier":"t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$","typeString":"function () pure returns (bytes memory)"}},"id":101,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1502:63:0","typeDescriptions":{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}],"id":92,"name":"keccak256","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":308,"src":"1492:9:0","typeDescriptions":{"typeIdentifier":"t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$","typeString":"function (bytes memory) pure returns (bytes32)"}},"id":102,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1492:74:0","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes32","typeString":"bytes32"}],"id":91,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1484:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint256_$","typeString":"type(uint256)"},"typeName":"uint256"},"id":103,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1484:83:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"%","rightExpression":{"argumentTypes":null,"hexValue":"32","id":104,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1568:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1484:85:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":90,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1478:5:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint8_$","typeString":"type(uint8)"},"typeName":"uint8"},"id":106,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1478:92:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"VariableDeclarationStatement","src":"1463:107:0"},{"assignments":[109],"declarations":[{"constant":false,"id":109,"name":"won","nodeType":"VariableDeclaration","scope":155,"src":"1577:8:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":108,"name":"bool","nodeType":"ElementaryTypeName","src":"1577:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"id":111,"initialValue":{"argumentTypes":null,"hexValue":"66616c7365","id":110,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1588:5:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"false"},"nodeType":"VariableDeclarationStatement","src":"1577:16:0"},{"condition":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":114,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":112,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1604:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":113,"name":"result","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":89,"src":"1613:6:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"src":"1604:15:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"falseBody":null,"id":131,"nodeType":"IfStatement","src":"1600:105:0","trueBody":{"id":130,"nodeType":"Block","src":"1621:84:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":123,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":120,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1664:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":121,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1664:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"*","rightExpression":{"argumentTypes":null,"hexValue":"32","id":122,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1676:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1664:13:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":115,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1644:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":118,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1644:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":119,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1644:19:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":124,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1644:34:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":125,"nodeType":"ExpressionStatement","src":"1644:34:0"},{"expression":{"argumentTypes":null,"id":128,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":126,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1687:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"74727565","id":127,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1693:4:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"src":"1687:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":129,"nodeType":"ExpressionStatement","src":"1687:10:0"}]}},{"eventCall":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":133,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1727:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"}],"id":132,"name":"GameResult","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":23,"src":"1716:10:0","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_bool_$returns$__$","typeString":"function (bool)"}},"id":134,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1716:15:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":135,"nodeType":"EmitStatement","src":"1711:20:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":140,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1764:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":141,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1764:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":142,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1776:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":143,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1776:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"id":144,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1787:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"id":145,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1794:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":147,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1807:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":146,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1799:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":148,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1799:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":149,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1799:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_uint8","typeString":"uint8"},{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":139,"name":"Game","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":16,"src":"1759:4:0","typeDescriptions":{"typeIdentifier":"t_type$_t_struct$_Game_$16_storage_ptr_$","typeString":"type(struct HeadsOrTails.Game storage pointer)"}},"id":150,"isConstant":false,"isLValue":false,"isPure":false,"kind":"structConstructorCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1759:62:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}],"expression":{"argumentTypes":null,"id":136,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"1738:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":138,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"push","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1738:20:0","typeDescriptions":{"typeIdentifier":"t_function_arraypush_nonpayable$_t_struct$_Game_$16_storage_$returns$_t_uint256_$","typeString":"function (struct HeadsOrTails.Game storage ref) returns (uint256)"}},"id":151,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1738:84:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":152,"nodeType":"ExpressionStatement","src":"1738:84:0"},{"expression":{"argumentTypes":null,"id":153,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1836:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"functionReturnParameters":54,"id":154,"nodeType":"Return","src":"1829:10:0"}]},"documentation":null,"id":156,"implemented":true,"kind":"function","modifiers":[],"name":"lottery","nodeType":"FunctionDefinition","parameters":{"id":51,"nodeType":"ParameterList","parameters":[{"constant":false,"id":50,"name":"guess","nodeType":"VariableDeclaration","scope":156,"src":"851:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":49,"name":"uint8","nodeType":"ElementaryTypeName","src":"851:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"src":"850:13:0"},"returnParameters":{"id":54,"nodeType":"ParameterList","parameters":[{"constant":false,"id":53,"name":"","nodeType":"VariableDeclaration","scope":156,"src":"887:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":52,"name":"bool","nodeType":"ElementaryTypeName","src":"887:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"886:6:0"},"scope":242,"src":"834:1099:0","stateMutability":"payable","superFunction":null,"visibility":"public"},{"body":{"id":164,"nodeType":"Block","src":"2028:42:0","statements":[{"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":161,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2042:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":162,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"length","nodeType":"MemberAccess","referencedDeclaration":null,"src":"2042:22:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"functionReturnParameters":160,"id":163,"nodeType":"Return","src":"2035:29:0"}]},"documentation":null,"id":165,"implemented":true,"kind":"function","modifiers":[],"name":"getGameCount","nodeType":"FunctionDefinition","parameters":{"id":157,"nodeType":"ParameterList","parameters":[],"src":"1999:2:0"},"returnParameters":{"id":160,"nodeType":"ParameterList","parameters":[{"constant":false,"id":159,"name":"","nodeType":"VariableDeclaration","scope":165,"src":"2022:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":158,"name":"uint","nodeType":"ElementaryTypeName","src":"2022:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2021:6:0"},"scope":242,"src":"1978:92:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":202,"nodeType":"Block","src":"2343:223:0","statements":[{"expression":{"argumentTypes":null,"components":[{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":180,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2366:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":182,"indexExpression":{"argumentTypes":null,"id":181,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2382:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2366:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":183,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"addr","nodeType":"MemberAccess","referencedDeclaration":7,"src":"2366:27:0","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":184,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2402:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":186,"indexExpression":{"argumentTypes":null,"id":185,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2418:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2402:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":187,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"amountBet","nodeType":"MemberAccess","referencedDeclaration":9,"src":"2402:32:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":188,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2443:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":190,"indexExpression":{"argumentTypes":null,"id":189,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2459:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2443:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":191,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"guess","nodeType":"MemberAccess","referencedDeclaration":11,"src":"2443:28:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":192,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2480:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":194,"indexExpression":{"argumentTypes":null,"id":193,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2496:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2480:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":195,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"winner","nodeType":"MemberAccess","referencedDeclaration":13,"src":"2480:29:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":196,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2518:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":198,"indexExpression":{"argumentTypes":null,"id":197,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2534:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2518:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":199,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"ethInJackpot","nodeType":"MemberAccess","referencedDeclaration":15,"src":"2518:35:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"id":200,"isConstant":false,"isInlineArray":false,"isLValue":false,"isPure":false,"lValueRequested":false,"nodeType":"TupleExpression","src":"2357:203:0","typeDescriptions":{"typeIdentifier":"t_tuple$_t_address_$_t_uint256_$_t_uint8_$_t_bool_$_t_uint256_$","typeString":"tuple(address,uint256,uint8,bool,uint256)"}},"functionReturnParameters":179,"id":201,"nodeType":"Return","src":"2350:210:0"}]},"documentation":null,"id":203,"implemented":true,"kind":"function","modifiers":[],"name":"getGameEntry","nodeType":"FunctionDefinition","parameters":{"id":168,"nodeType":"ParameterList","parameters":[{"constant":false,"id":167,"name":"index","nodeType":"VariableDeclaration","scope":203,"src":"2236:10:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":166,"name":"uint","nodeType":"ElementaryTypeName","src":"2236:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2235:12:0"},"returnParameters":{"id":179,"nodeType":"ParameterList","parameters":[{"constant":false,"id":170,"name":"addr","nodeType":"VariableDeclaration","scope":203,"src":"2268:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":169,"name":"address","nodeType":"ElementaryTypeName","src":"2268:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":172,"name":"amountBet","nodeType":"VariableDeclaration","scope":203,"src":"2282:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":171,"name":"uint","nodeType":"ElementaryTypeName","src":"2282:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":174,"name":"guess","nodeType":"VariableDeclaration","scope":203,"src":"2298:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":173,"name":"uint8","nodeType":"ElementaryTypeName","src":"2298:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":176,"name":"winner","nodeType":"VariableDeclaration","scope":203,"src":"2311:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":175,"name":"bool","nodeType":"ElementaryTypeName","src":"2311:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":178,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":203,"src":"2324:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":177,"name":"uint","nodeType":"ElementaryTypeName","src":"2324:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2267:75:0"},"scope":242,"src":"2214:352:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":212,"nodeType":"Block","src":"2904:32:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":209,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"2924:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"id":208,"name":"selfdestruct","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":322,"src":"2911:12:0","typeDescriptions":{"typeIdentifier":"t_function_selfdestruct_nonpayable$_t_address_payable_$returns$__$","typeString":"function (address payable)"}},"id":210,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"2911:19:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":211,"nodeType":"ExpressionStatement","src":"2911:19:0"}]},"documentation":null,"id":213,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":206,"modifierName":{"argumentTypes":null,"id":205,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"2894:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"2894:9:0"}],"name":"destroy","nodeType":"FunctionDefinition","parameters":{"id":204,"nodeType":"ParameterList","parameters":[],"src":"2882:2:0"},"returnParameters":{"id":207,"nodeType":"ParameterList","parameters":[],"src":"2904:0:0"},"scope":242,"src":"2866:70:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":236,"nodeType":"Block","src":"3026:148:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":226,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":221,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3041:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":223,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"3058:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":222,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"3050:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":224,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3050:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":225,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3050:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"3041:30:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374","id":227,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"3073:65:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""},"value":"You cannot withdraw more than what is available in the contract"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""}],"id":220,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"3033:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":228,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3033:106:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":229,"nodeType":"ExpressionStatement","src":"3033:106:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":233,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3161:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":230,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"3146:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":232,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3146:14:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":234,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3146:22:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":235,"nodeType":"ExpressionStatement","src":"3146:22:0"}]},"documentation":null,"id":237,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":218,"modifierName":{"argumentTypes":null,"id":217,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"3016:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"3016:9:0"}],"name":"withdraw","nodeType":"FunctionDefinition","parameters":{"id":216,"nodeType":"ParameterList","parameters":[{"constant":false,"id":215,"name":"amount","nodeType":"VariableDeclaration","scope":237,"src":"2994:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":214,"name":"uint","nodeType":"ElementaryTypeName","src":"2994:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2993:13:0"},"returnParameters":{"id":219,"nodeType":"ParameterList","parameters":[],"src":"3026:0:0"},"scope":242,"src":"2976:198:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":240,"nodeType":"Block","src":"3242:2:0","statements":[]},"documentation":null,"id":241,"implemented":true,"kind":"fallback","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":238,"nodeType":"ParameterList","parameters":[],"src":"3222:2:0"},"returnParameters":{"id":239,"nodeType":"ParameterList","parameters":[],"src":"3242:0:0"},"scope":242,"src":"3213:31:0","stateMutability":"payable","superFunction":null,"visibility":"external"}],"scope":243,"src":"122:3125:0"}],"src":"62:3185:0"},"legacyAST":{"absolutePath":"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol","exportedSymbols":{"HeadsOrTails":[242]},"id":243,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"62:23:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":242,"linearizedBaseContracts":[242],"name":"HeadsOrTails","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":3,"name":"owner","nodeType":"VariableDeclaration","scope":242,"src":"149:21:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":2,"name":"address","nodeType":"ElementaryTypeName","src":"149:15:0","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"value":null,"visibility":"internal"},{"constant":false,"id":5,"name":"name","nodeType":"VariableDeclaration","scope":242,"src":"175:18:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string"},"typeName":{"id":4,"name":"string","nodeType":"ElementaryTypeName","src":"175:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"public"},{"canonicalName":"HeadsOrTails.Game","id":16,"members":[{"constant":false,"id":7,"name":"addr","nodeType":"VariableDeclaration","scope":16,"src":"219:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":6,"name":"address","nodeType":"ElementaryTypeName","src":"219:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":9,"name":"amountBet","nodeType":"VariableDeclaration","scope":16,"src":"238:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":8,"name":"uint","nodeType":"ElementaryTypeName","src":"238:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":11,"name":"guess","nodeType":"VariableDeclaration","scope":16,"src":"259:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":10,"name":"uint8","nodeType":"ElementaryTypeName","src":"259:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":13,"name":"winner","nodeType":"VariableDeclaration","scope":16,"src":"277:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":12,"name":"bool","nodeType":"ElementaryTypeName","src":"277:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":15,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":16,"src":"295:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":14,"name":"uint","nodeType":"ElementaryTypeName","src":"295:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"name":"Game","nodeType":"StructDefinition","scope":242,"src":"200:118:0","visibility":"public"},{"constant":false,"id":19,"name":"lastPlayedGames","nodeType":"VariableDeclaration","scope":242,"src":"324:22:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game[]"},"typeName":{"baseType":{"contractScope":null,"id":17,"name":"Game","nodeType":"UserDefinedTypeName","referencedDeclaration":16,"src":"324:4:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage_ptr","typeString":"struct HeadsOrTails.Game"}},"id":18,"length":null,"nodeType":"ArrayTypeName","src":"324:6:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage_ptr","typeString":"struct HeadsOrTails.Game[]"}},"value":null,"visibility":"internal"},{"anonymous":false,"documentation":null,"id":23,"name":"GameResult","nodeType":"EventDefinition","parameters":{"id":22,"nodeType":"ParameterList","parameters":[{"constant":false,"id":21,"indexed":false,"name":"blabla","nodeType":"VariableDeclaration","scope":23,"src":"426:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":20,"name":"bool","nodeType":"ElementaryTypeName","src":"426:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"425:13:0"},"src":"409:30:0"},{"body":{"id":35,"nodeType":"Block","src":"535:66:0","statements":[{"expression":{"argumentTypes":null,"id":29,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":26,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"542:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":27,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"550:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":28,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"550:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"542:18:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":30,"nodeType":"ExpressionStatement","src":"542:18:0"},{"expression":{"argumentTypes":null,"id":33,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":31,"name":"name","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":5,"src":"567:4:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"4865616473206f72205461696c732064417070","id":32,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"574:21:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_ce4abf6351d67276ac5372334d1c289ffb15acc1a14ed0a47095a166ee22f585","typeString":"literal_string \\"Heads or Tails dApp\\""},"value":"Heads or Tails dApp"},"src":"567:28:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"id":34,"nodeType":"ExpressionStatement","src":"567:28:0"}]},"documentation":null,"id":36,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":24,"nodeType":"ParameterList","parameters":[],"src":"525:2:0"},"returnParameters":{"id":25,"nodeType":"ParameterList","parameters":[],"src":"535:0:0"},"scope":242,"src":"514:87:0","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":47,"nodeType":"Block","src":"708:100:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"id":42,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":39,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"723:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":40,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"723:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":41,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"737:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"723:19:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e6572","id":43,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"744:49:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""},"value":"This function can only be launched by the owner"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""}],"id":38,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"715:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":44,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"715:79:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":45,"nodeType":"ExpressionStatement","src":"715:79:0"},{"id":46,"nodeType":"PlaceholderStatement","src":"801:1:0"}]},"documentation":null,"id":48,"name":"onlyOwner","nodeType":"ModifierDefinition","parameters":{"id":37,"nodeType":"ParameterList","parameters":[],"src":"708:0:0"},"src":"689:119:0","visibility":"internal"},{"body":{"id":155,"nodeType":"Block","src":"892:1041:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_bool","typeString":"bool"},"id":62,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":58,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":56,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"907:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"30","id":57,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"916:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"907:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"BinaryOperation","operator":"||","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":61,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":59,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"921:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"31","id":60,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"930:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_1_by_1","typeString":"int_const 1"},"value":"1"},"src":"921:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"src":"907:24:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"5661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031","id":63,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"933:42:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""},"value":"Variable \'guess\' should be either 0 or 1"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""}],"id":55,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"899:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":64,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"899:77:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":65,"nodeType":"ExpressionStatement","src":"899:77:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":70,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":67,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"991:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":68,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"991:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":">","rightExpression":{"argumentTypes":null,"hexValue":"30","id":69,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1003:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"991:13:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"426574206d6f7265207468616e2030","id":71,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1006:17:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""},"value":"Bet more than 0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""}],"id":66,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"983:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":72,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"983:41:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":73,"nodeType":"ExpressionStatement","src":"983:41:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":84,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":75,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1039:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":76,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1039:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<=","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":83,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":78,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1060:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":77,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1052:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":79,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1052:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":80,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1052:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"-","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":81,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1076:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":82,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1076:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1052:33:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1039:46:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74","id":85,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1087:59:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""},"value":"You cannot bet more than what is available in the jackpot"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""}],"id":74,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"1031:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":86,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1031:116:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":87,"nodeType":"ExpressionStatement","src":"1031:116:0"},{"assignments":[89],"declarations":[{"constant":false,"id":89,"name":"result","nodeType":"VariableDeclaration","scope":155,"src":"1463:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":88,"name":"uint8","nodeType":"ElementaryTypeName","src":"1463:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"id":107,"initialValue":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":105,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":95,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1519:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":96,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"difficulty","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1519:16:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":97,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1537:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":98,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1537:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":99,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1549:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":100,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"timestamp","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1549:15:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":93,"name":"abi","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":301,"src":"1502:3:0","typeDescriptions":{"typeIdentifier":"t_magic_abi","typeString":"abi"}},"id":94,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"memberName":"encodePacked","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1502:16:0","typeDescriptions":{"typeIdentifier":"t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$","typeString":"function () pure returns (bytes memory)"}},"id":101,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1502:63:0","typeDescriptions":{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}],"id":92,"name":"keccak256","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":308,"src":"1492:9:0","typeDescriptions":{"typeIdentifier":"t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$","typeString":"function (bytes memory) pure returns (bytes32)"}},"id":102,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1492:74:0","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes32","typeString":"bytes32"}],"id":91,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1484:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint256_$","typeString":"type(uint256)"},"typeName":"uint256"},"id":103,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1484:83:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"%","rightExpression":{"argumentTypes":null,"hexValue":"32","id":104,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1568:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1484:85:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":90,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1478:5:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint8_$","typeString":"type(uint8)"},"typeName":"uint8"},"id":106,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1478:92:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"VariableDeclarationStatement","src":"1463:107:0"},{"assignments":[109],"declarations":[{"constant":false,"id":109,"name":"won","nodeType":"VariableDeclaration","scope":155,"src":"1577:8:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":108,"name":"bool","nodeType":"ElementaryTypeName","src":"1577:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"id":111,"initialValue":{"argumentTypes":null,"hexValue":"66616c7365","id":110,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1588:5:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"false"},"nodeType":"VariableDeclarationStatement","src":"1577:16:0"},{"condition":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":114,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":112,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1604:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":113,"name":"result","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":89,"src":"1613:6:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"src":"1604:15:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"falseBody":null,"id":131,"nodeType":"IfStatement","src":"1600:105:0","trueBody":{"id":130,"nodeType":"Block","src":"1621:84:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":123,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":120,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1664:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":121,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1664:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"*","rightExpression":{"argumentTypes":null,"hexValue":"32","id":122,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1676:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1664:13:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":115,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1644:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":118,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1644:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":119,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1644:19:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":124,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1644:34:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":125,"nodeType":"ExpressionStatement","src":"1644:34:0"},{"expression":{"argumentTypes":null,"id":128,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":126,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1687:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"74727565","id":127,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1693:4:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"src":"1687:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":129,"nodeType":"ExpressionStatement","src":"1687:10:0"}]}},{"eventCall":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":133,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1727:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"}],"id":132,"name":"GameResult","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":23,"src":"1716:10:0","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_bool_$returns$__$","typeString":"function (bool)"}},"id":134,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1716:15:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":135,"nodeType":"EmitStatement","src":"1711:20:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":140,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1764:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":141,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1764:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":142,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1776:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":143,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1776:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"id":144,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1787:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"id":145,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1794:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":147,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1807:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":146,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1799:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":148,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1799:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":149,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1799:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_uint8","typeString":"uint8"},{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":139,"name":"Game","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":16,"src":"1759:4:0","typeDescriptions":{"typeIdentifier":"t_type$_t_struct$_Game_$16_storage_ptr_$","typeString":"type(struct HeadsOrTails.Game storage pointer)"}},"id":150,"isConstant":false,"isLValue":false,"isPure":false,"kind":"structConstructorCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1759:62:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}],"expression":{"argumentTypes":null,"id":136,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"1738:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":138,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"push","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1738:20:0","typeDescriptions":{"typeIdentifier":"t_function_arraypush_nonpayable$_t_struct$_Game_$16_storage_$returns$_t_uint256_$","typeString":"function (struct HeadsOrTails.Game storage ref) returns (uint256)"}},"id":151,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1738:84:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":152,"nodeType":"ExpressionStatement","src":"1738:84:0"},{"expression":{"argumentTypes":null,"id":153,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1836:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"functionReturnParameters":54,"id":154,"nodeType":"Return","src":"1829:10:0"}]},"documentation":null,"id":156,"implemented":true,"kind":"function","modifiers":[],"name":"lottery","nodeType":"FunctionDefinition","parameters":{"id":51,"nodeType":"ParameterList","parameters":[{"constant":false,"id":50,"name":"guess","nodeType":"VariableDeclaration","scope":156,"src":"851:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":49,"name":"uint8","nodeType":"ElementaryTypeName","src":"851:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"src":"850:13:0"},"returnParameters":{"id":54,"nodeType":"ParameterList","parameters":[{"constant":false,"id":53,"name":"","nodeType":"VariableDeclaration","scope":156,"src":"887:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":52,"name":"bool","nodeType":"ElementaryTypeName","src":"887:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"886:6:0"},"scope":242,"src":"834:1099:0","stateMutability":"payable","superFunction":null,"visibility":"public"},{"body":{"id":164,"nodeType":"Block","src":"2028:42:0","statements":[{"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":161,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2042:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":162,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"length","nodeType":"MemberAccess","referencedDeclaration":null,"src":"2042:22:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"functionReturnParameters":160,"id":163,"nodeType":"Return","src":"2035:29:0"}]},"documentation":null,"id":165,"implemented":true,"kind":"function","modifiers":[],"name":"getGameCount","nodeType":"FunctionDefinition","parameters":{"id":157,"nodeType":"ParameterList","parameters":[],"src":"1999:2:0"},"returnParameters":{"id":160,"nodeType":"ParameterList","parameters":[{"constant":false,"id":159,"name":"","nodeType":"VariableDeclaration","scope":165,"src":"2022:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":158,"name":"uint","nodeType":"ElementaryTypeName","src":"2022:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2021:6:0"},"scope":242,"src":"1978:92:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":202,"nodeType":"Block","src":"2343:223:0","statements":[{"expression":{"argumentTypes":null,"components":[{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":180,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2366:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":182,"indexExpression":{"argumentTypes":null,"id":181,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2382:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2366:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":183,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"addr","nodeType":"MemberAccess","referencedDeclaration":7,"src":"2366:27:0","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":184,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2402:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":186,"indexExpression":{"argumentTypes":null,"id":185,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2418:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2402:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":187,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"amountBet","nodeType":"MemberAccess","referencedDeclaration":9,"src":"2402:32:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":188,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2443:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":190,"indexExpression":{"argumentTypes":null,"id":189,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2459:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2443:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":191,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"guess","nodeType":"MemberAccess","referencedDeclaration":11,"src":"2443:28:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":192,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2480:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":194,"indexExpression":{"argumentTypes":null,"id":193,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2496:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2480:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":195,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"winner","nodeType":"MemberAccess","referencedDeclaration":13,"src":"2480:29:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":196,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2518:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":198,"indexExpression":{"argumentTypes":null,"id":197,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2534:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2518:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":199,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"ethInJackpot","nodeType":"MemberAccess","referencedDeclaration":15,"src":"2518:35:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"id":200,"isConstant":false,"isInlineArray":false,"isLValue":false,"isPure":false,"lValueRequested":false,"nodeType":"TupleExpression","src":"2357:203:0","typeDescriptions":{"typeIdentifier":"t_tuple$_t_address_$_t_uint256_$_t_uint8_$_t_bool_$_t_uint256_$","typeString":"tuple(address,uint256,uint8,bool,uint256)"}},"functionReturnParameters":179,"id":201,"nodeType":"Return","src":"2350:210:0"}]},"documentation":null,"id":203,"implemented":true,"kind":"function","modifiers":[],"name":"getGameEntry","nodeType":"FunctionDefinition","parameters":{"id":168,"nodeType":"ParameterList","parameters":[{"constant":false,"id":167,"name":"index","nodeType":"VariableDeclaration","scope":203,"src":"2236:10:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":166,"name":"uint","nodeType":"ElementaryTypeName","src":"2236:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2235:12:0"},"returnParameters":{"id":179,"nodeType":"ParameterList","parameters":[{"constant":false,"id":170,"name":"addr","nodeType":"VariableDeclaration","scope":203,"src":"2268:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":169,"name":"address","nodeType":"ElementaryTypeName","src":"2268:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":172,"name":"amountBet","nodeType":"VariableDeclaration","scope":203,"src":"2282:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":171,"name":"uint","nodeType":"ElementaryTypeName","src":"2282:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":174,"name":"guess","nodeType":"VariableDeclaration","scope":203,"src":"2298:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":173,"name":"uint8","nodeType":"ElementaryTypeName","src":"2298:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":176,"name":"winner","nodeType":"VariableDeclaration","scope":203,"src":"2311:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":175,"name":"bool","nodeType":"ElementaryTypeName","src":"2311:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":178,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":203,"src":"2324:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":177,"name":"uint","nodeType":"ElementaryTypeName","src":"2324:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2267:75:0"},"scope":242,"src":"2214:352:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":212,"nodeType":"Block","src":"2904:32:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":209,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"2924:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"id":208,"name":"selfdestruct","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":322,"src":"2911:12:0","typeDescriptions":{"typeIdentifier":"t_function_selfdestruct_nonpayable$_t_address_payable_$returns$__$","typeString":"function (address payable)"}},"id":210,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"2911:19:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":211,"nodeType":"ExpressionStatement","src":"2911:19:0"}]},"documentation":null,"id":213,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":206,"modifierName":{"argumentTypes":null,"id":205,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"2894:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"2894:9:0"}],"name":"destroy","nodeType":"FunctionDefinition","parameters":{"id":204,"nodeType":"ParameterList","parameters":[],"src":"2882:2:0"},"returnParameters":{"id":207,"nodeType":"ParameterList","parameters":[],"src":"2904:0:0"},"scope":242,"src":"2866:70:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":236,"nodeType":"Block","src":"3026:148:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":226,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":221,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3041:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":223,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"3058:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":222,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"3050:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":224,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3050:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":225,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3050:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"3041:30:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374","id":227,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"3073:65:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""},"value":"You cannot withdraw more than what is available in the contract"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""}],"id":220,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"3033:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":228,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3033:106:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":229,"nodeType":"ExpressionStatement","src":"3033:106:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":233,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3161:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":230,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"3146:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":232,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3146:14:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":234,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3146:22:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":235,"nodeType":"ExpressionStatement","src":"3146:22:0"}]},"documentation":null,"id":237,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":218,"modifierName":{"argumentTypes":null,"id":217,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"3016:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"3016:9:0"}],"name":"withdraw","nodeType":"FunctionDefinition","parameters":{"id":216,"nodeType":"ParameterList","parameters":[{"constant":false,"id":215,"name":"amount","nodeType":"VariableDeclaration","scope":237,"src":"2994:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":214,"name":"uint","nodeType":"ElementaryTypeName","src":"2994:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2993:13:0"},"returnParameters":{"id":219,"nodeType":"ParameterList","parameters":[],"src":"3026:0:0"},"scope":242,"src":"2976:198:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":240,"nodeType":"Block","src":"3242:2:0","statements":[]},"documentation":null,"id":241,"implemented":true,"kind":"fallback","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":238,"nodeType":"ParameterList","parameters":[],"src":"3222:2:0"},"returnParameters":{"id":239,"nodeType":"ParameterList","parameters":[],"src":"3242:0:0"},"scope":242,"src":"3213:31:0","stateMutability":"payable","superFunction":null,"visibility":"external"}],"scope":243,"src":"122:3125:0"}],"src":"62:3185:0"},"compiler":{"name":"solc","version":"0.5.8+commit.23d335f2.Emscripten.clang"},"networks":{"5777":{"events":{"0x01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d61":{"anonymous":false,"inputs":[{"indexed":false,"name":"blabla","type":"bool"}],"name":"GameResult","type":"event","signature":"0x01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d61"}},"links":{},"address":"0x88B6D98459123f663dcE83cB85EaBa64e16f4e40","transactionHash":"0x8f6ab5f82a682ae82b41201f771adf803de3279be82bfc1a6a079df96d93a917"}},"schemaVersion":"3.0.16","updatedAt":"2019-11-08T00:04:46.829Z","devdoc":{"methods":{}},"userdoc":{"methods":{}}}')},function(e,t,n){"use strict";n.r(t);var i=n(0);let a,s,r;async function f(){const e=await web3.eth.net.getId();console.log(e);const t=i.networks[e];if(console.log(t),t){console.log("HeadsOrTails contract is deployed to this network."),a=new web3.eth.Contract(i.abi,t.address),console.log(a);const e=await a.methods.name().call();console.log(e),o(),l(),document.querySelector(".contract-address").innerText=t.address}else window.alert("Marketplace contract not deployed to detected network.")}async function l(){const e=await web3.eth.getBalance(a._address)/1e18;console.log("Contract balance (ETH): "+e),document.querySelector(".eth-in-jackpot").innerHTML=e+" ETH (~"+(e*r).toFixed(2)+"$)",document.querySelector("#amount-to-bet").max=e}async function o(){const e=await a.methods.getGameCount().call();document.querySelector("#table-body").innerHTML="";let t=document.querySelector("#productrow"),n=t.content.querySelectorAll("td");for(let i=e-1;i>=0;i--){const e=await a.methods.getGameEntry(i).call();let s=e.winner?"Won":"Lost",r=0==e.guess?"Heads":"Tails";const f=e.addr.slice(0,3)+"..."+e.addr.slice(-3);n[0].textContent=f,n[1].textContent=e.amountBet/1e18+" ETH",n[2].textContent=r,n[3].textContent=s,n[4].textContent=e.ethInJackpot/1e18+" ETH";let l=document.querySelector("#table-body"),o=document.importNode(t.content,!0);l.appendChild(o)}}function p(e){if(!e.ok)throw Error(e.statusText);return e}window.addEventListener("load",async function(){if(window.ethereum){window.web3=new Web3(ethereum);try{await ethereum.enable(),console.log("User has a MODERN dapp browser!"),f()}catch(e){console.log("User denied access!")}}else window.web3?(window.web3=new Web3(web3.currentProvider),console.log("User has a LEGACY dapp browser!"),f()):window.alert("Non-Ethereum browser detected. You should consider trying MetaMask!")}()),window.addEventListener("load",async function(){fetch("https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR").then(p).then(e=>e.json()).then(e=>{console.log(e.USD),r=e.USD}).catch(e=>console.error(e))}()),document.getElementById("form").addEventListener("submit",e=>{e.preventDefault(),async function(){document.getElementsByName("ht-selector");const e=document.querySelector("#amount-to-bet").value;let t=document.querySelector(":checked").value;console.log("0 or 1: "+t),console.log("Amount to bet (ETH): "+e);const n=window.web3.utils.toWei(e,"Ether");console.log("Amount to bet (Wei): "+n);const i=await web3.eth.getAccounts();let r;s=i[0],a.once("GameResult",(function(e,t){console.log(t.returnValues)})),console.log(s),r=await a.methods.lottery(t).send({from:s,value:n}),console.log(r),o(),l()}()}),document.getElementById("amount-to-bet").addEventListener("input",(function(){const e=document.querySelector("#amount-to-bet").value;document.querySelector("#bet-in-dollar").innerText=(e*r).toFixed(2)}))}]); +!function(e){var t={};function n(i){if(t[i])return t[i].exports;var a=t[i]={i:i,l:!1,exports:{}};return e[i].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)n.d(i,a,function(t){return e[t]}.bind(null,a));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e){e.exports=JSON.parse('{"contractName":"HeadsOrTails","abi":[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"won","type":"bool"}],"name":"GameResult","type":"event"},{"constant":false,"inputs":[{"name":"guess","type":"uint8"}],"name":"lottery","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"getGameCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"index","type":"uint256"}],"name":"getGameEntry","outputs":[{"name":"addr","type":"address"},{"name":"amountBet","type":"uint256"},{"name":"guess","type":"uint8"},{"name":"winner","type":"bool"},{"name":"ethInJackpot","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"destroy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}],"metadata":"{\\"compiler\\":{\\"version\\":\\"0.5.8+commit.23d335f2\\"},\\"language\\":\\"Solidity\\",\\"output\\":{\\"abi\\":[{\\"constant\\":true,\\"inputs\\":[],\\"name\\":\\"name\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"string\\"}],\\"payable\\":false,\\"stateMutability\\":\\"view\\",\\"type\\":\\"function\\"},{\\"constant\\":false,\\"inputs\\":[{\\"name\\":\\"amount\\",\\"type\\":\\"uint256\\"}],\\"name\\":\\"withdraw\\",\\"outputs\\":[],\\"payable\\":false,\\"stateMutability\\":\\"nonpayable\\",\\"type\\":\\"function\\"},{\\"constant\\":true,\\"inputs\\":[{\\"name\\":\\"index\\",\\"type\\":\\"uint256\\"}],\\"name\\":\\"getGameEntry\\",\\"outputs\\":[{\\"name\\":\\"addr\\",\\"type\\":\\"address\\"},{\\"name\\":\\"amountBet\\",\\"type\\":\\"uint256\\"},{\\"name\\":\\"guess\\",\\"type\\":\\"uint8\\"},{\\"name\\":\\"winner\\",\\"type\\":\\"bool\\"},{\\"name\\":\\"ethInJackpot\\",\\"type\\":\\"uint256\\"}],\\"payable\\":false,\\"stateMutability\\":\\"view\\",\\"type\\":\\"function\\"},{\\"constant\\":false,\\"inputs\\":[],\\"name\\":\\"destroy\\",\\"outputs\\":[],\\"payable\\":false,\\"stateMutability\\":\\"nonpayable\\",\\"type\\":\\"function\\"},{\\"constant\\":false,\\"inputs\\":[{\\"name\\":\\"guess\\",\\"type\\":\\"uint8\\"}],\\"name\\":\\"lottery\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"bool\\"}],\\"payable\\":true,\\"stateMutability\\":\\"payable\\",\\"type\\":\\"function\\"},{\\"constant\\":true,\\"inputs\\":[],\\"name\\":\\"getGameCount\\",\\"outputs\\":[{\\"name\\":\\"\\",\\"type\\":\\"uint256\\"}],\\"payable\\":false,\\"stateMutability\\":\\"view\\",\\"type\\":\\"function\\"},{\\"inputs\\":[],\\"payable\\":false,\\"stateMutability\\":\\"nonpayable\\",\\"type\\":\\"constructor\\"},{\\"payable\\":true,\\"stateMutability\\":\\"payable\\",\\"type\\":\\"fallback\\"},{\\"anonymous\\":false,\\"inputs\\":[{\\"indexed\\":false,\\"name\\":\\"won\\",\\"type\\":\\"bool\\"}],\\"name\\":\\"GameResult\\",\\"type\\":\\"event\\"}],\\"devdoc\\":{\\"methods\\":{}},\\"userdoc\\":{\\"methods\\":{}}},\\"settings\\":{\\"compilationTarget\\":{\\"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol\\":\\"HeadsOrTails\\"},\\"evmVersion\\":\\"petersburg\\",\\"libraries\\":{},\\"optimizer\\":{\\"enabled\\":false,\\"runs\\":200},\\"remappings\\":[]},\\"sources\\":{\\"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol\\":{\\"keccak256\\":\\"0x1234f5aa2367602052c7d6f14a59d48e6ed322fb9f6618d1e5085d007fb0919d\\",\\"urls\\":[\\"bzzr://9d36fca6ffc232a4cb5080a75569781eb40fc8322bca333ead97f8899959db18\\"]}},\\"version\\":1}","bytecode":"0x608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040518060400160405280601381526020017f4865616473206f72205461696c732064417070000000000000000000000000008152506001908051906020019061009c9291906100a2565b50610147565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100e357805160ff1916838001178555610111565b82800160010185558215610111579182015b828111156101105782518255916020019190600101906100f5565b5b50905061011e9190610122565b5090565b61014491905b80821115610140576000816000905550600101610128565b5090565b90565b610ad8806101566000396000f3fe6080604052600436106100555760003560e01c806306fdde03146100575780632e1a7d4d146100e75780637f9ff2f81461012257806383197ef0146101c3578063a80de5ea146101da578063e87c0ee614610223575b005b34801561006357600080fd5b5061006c61024e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100ac578082015181840152602081019050610091565b50505050905090810190601f1680156100d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100f357600080fd5b506101206004803603602081101561010a57600080fd5b81019080803590602001909291905050506102ec565b005b34801561012e57600080fd5b5061015b6004803603602081101561014557600080fd5b810190808035906020019092919050505061046b565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018460ff1660ff168152602001831515151581526020018281526020019550505050505060405180910390f35b3480156101cf57600080fd5b506101d861055b565b005b610209600480360360208110156101f057600080fd5b81019080803560ff16906020019092919050505061063a565b604051808215151515815260200191505060405180910390f35b34801561022f57600080fd5b506102386109d0565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e45780601f106102b9576101008083540402835291602001916102e4565b820191906000526020600020905b8154815290600101906020018083116102c757829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16318110610400576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180610a17603f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610467573d6000803e3d6000fd5b5050565b60008060008060006002868154811061048057fe5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600287815481106104bf57fe5b906000526020600020906004020160010154600288815481106104de57fe5b906000526020600020906004020160020160009054906101000a900460ff166002898154811061050a57fe5b906000526020600020906004020160020160019054906101000a900460ff1660028a8154811061053657fe5b9060005260206000209060040201600301549450945094509450945091939590929450565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610600576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000808260ff161480610650575060018260ff16145b6106a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180610a856028913960400191505060405180910390fd5b6000341161071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f426574206d6f7265207468616e2030000000000000000000000000000000000081525060200191505060405180910390fd5b343073ffffffffffffffffffffffffffffffffffffffff16310334111561078d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806109de6039913960400191505060405180910390fd5b60006002443342604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140182815260200193505050506040516020818303038152906040528051906020012060001c8161080157fe5b06905060008090508160ff168460ff161415610866573373ffffffffffffffffffffffffffffffffffffffff166108fc600234029081150290604051600060405180830381858888f19350505050158015610860573d6000803e3d6000fd5b50600190505b7f01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d6181604051808215151515815260200191505060405180910390a160026040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018660ff16815260200183151581526020013073ffffffffffffffffffffffffffffffffffffffff16318152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff021916908360ff16021790555060608201518160020160016101000a81548160ff021916908315150217905550608082015181600301555050508092505050919050565b600060028054905090509056fe596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e65725661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031a165627a7a72305820965ee6b2fefeac92f82f3ecb6d42a75f246910aee6723bb1f2a1914aa3e3de1a0029","deployedBytecode":"0x6080604052600436106100555760003560e01c806306fdde03146100575780632e1a7d4d146100e75780637f9ff2f81461012257806383197ef0146101c3578063a80de5ea146101da578063e87c0ee614610223575b005b34801561006357600080fd5b5061006c61024e565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100ac578082015181840152602081019050610091565b50505050905090810190601f1680156100d95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156100f357600080fd5b506101206004803603602081101561010a57600080fd5b81019080803590602001909291905050506102ec565b005b34801561012e57600080fd5b5061015b6004803603602081101561014557600080fd5b810190808035906020019092919050505061046b565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018460ff1660ff168152602001831515151581526020018281526020019550505050505060405180910390f35b3480156101cf57600080fd5b506101d861055b565b005b610209600480360360208110156101f057600080fd5b81019080803560ff16906020019092919050505061063a565b604051808215151515815260200191505060405180910390f35b34801561022f57600080fd5b506102386109d0565b6040518082815260200191505060405180910390f35b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156102e45780601f106102b9576101008083540402835291602001916102e4565b820191906000526020600020905b8154815290600101906020018083116102c757829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610391576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff16318110610400576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180610a17603f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610467573d6000803e3d6000fd5b5050565b60008060008060006002868154811061048057fe5b906000526020600020906004020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600287815481106104bf57fe5b906000526020600020906004020160010154600288815481106104de57fe5b906000526020600020906004020160020160009054906101000a900460ff166002898154811061050a57fe5b906000526020600020906004020160020160019054906101000a900460ff1660028a8154811061053657fe5b9060005260206000209060040201600301549450945094509450945091939590929450565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610600576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602f815260200180610a56602f913960400191505060405180910390fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b6000808260ff161480610650575060018260ff16145b6106a5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526028815260200180610a856028913960400191505060405180910390fd5b6000341161071b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600f8152602001807f426574206d6f7265207468616e2030000000000000000000000000000000000081525060200191505060405180910390fd5b343073ffffffffffffffffffffffffffffffffffffffff16310334111561078d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260398152602001806109de6039913960400191505060405180910390fd5b60006002443342604051602001808481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660601b815260140182815260200193505050506040516020818303038152906040528051906020012060001c8161080157fe5b06905060008090508160ff168460ff161415610866573373ffffffffffffffffffffffffffffffffffffffff166108fc600234029081150290604051600060405180830381858888f19350505050158015610860573d6000803e3d6000fd5b50600190505b7f01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d6181604051808215151515815260200191505060405180910390a160026040518060a001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020013481526020018660ff16815260200183151581526020013073ffffffffffffffffffffffffffffffffffffffff16318152509080600181540180825580915050906001820390600052602060002090600402016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015560408201518160020160006101000a81548160ff021916908360ff16021790555060608201518160020160016101000a81548160ff021916908315150217905550608082015181600301555050508092505050919050565b600060028054905090509056fe596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e65725661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031a165627a7a72305820965ee6b2fefeac92f82f3ecb6d42a75f246910aee6723bb1f2a1914aa3e3de1a0029","sourceMap":"122:3124:0:-;;;511:87;8:9:-1;5:2;;;30:1;27;20:12;5:2;511:87:0;547:10;539:5;;:18;;;;;;;;;;;;;;;;;;564:28;;;;;;;;;;;;;;;;;:4;:28;;;;;;;;;;;;:::i;:::-;;122:3124;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;:::-;;;;;;;","deployedSourceMap":"122:3124:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;175:18;;8:9:-1;5:2;;;30:1;27;20:12;5:2;175:18:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;99:1;94:3;90:11;84:18;80:1;75:3;71:11;64:39;52:2;49:1;45:10;40:15;;8:100;;;12:14;175:18:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2975:198;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2975:198:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2975:198:0;;;;;;;;;;;;;;;;;:::i;:::-;;2213:352;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2213:352:0;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;2213:352:0;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2865:70;;8:9:-1;5:2;;;30:1;27;20:12;5:2;2865:70:0;;;:::i;:::-;;831:1101;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;831:1101:0;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;1977:92;;8:9:-1;5:2;;;30:1;27;20:12;5:2;1977:92:0;;;:::i;:::-;;;;;;;;;;;;;;;;;;;175:18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;2975:198::-;734:5;;;;;;;;;;;720:19;;:10;:19;;;712:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3057:4;3049:21;;;3040:6;:30;3032:106;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3145:5;;;;;;;;;;;:14;;:22;3160:6;3145:22;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;3145:22:0;2975:198;:::o;2213:352::-;2267:12;2281:14;2297:11;2310;2323:17;2365:15;2381:5;2365:22;;;;;;;;;;;;;;;;;;:27;;;;;;;;;;;;2401:15;2417:5;2401:22;;;;;;;;;;;;;;;;;;:32;;;2442:15;2458:5;2442:22;;;;;;;;;;;;;;;;;;:28;;;;;;;;;;;;2479:15;2495:5;2479:22;;;;;;;;;;;;;;;;;;:29;;;;;;;;;;;;2517:15;2533:5;2517:22;;;;;;;;;;;;;;;;;;:35;;;2349:210;;;;;;;;;;2213:352;;;;;;;:::o;2865:70::-;734:5;;;;;;;;;;;720:19;;:10;:19;;;712:79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2923:5;;;;;;;;;;;2910:19;;;831:1101;884:4;913:1;904:5;:10;;;:24;;;;927:1;918:5;:10;;;904:24;896:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1000:1;988:9;:13;980:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1073:9;1057:4;1049:21;;;:33;1036:9;:46;;1028:116;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1460:12;1565:1;1516:16;1534:10;1546:15;1499:63;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;1499:63:0;;;1489:74;;;;;;1481:83;;:85;;;;;;1460:107;;1574:8;1585:5;1574:16;;1610:6;1601:15;;:5;:15;;;1597:105;;;1641:10;:19;;:34;1673:1;1661:9;:13;1641:34;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;1641:34:0;1690:4;1684:10;;1597:105;1715:15;1726:3;1715:15;;;;;;;;;;;;;;;;;;;;;;1737;1758:62;;;;;;;;1763:10;1758:62;;;;;;1775:9;1758:62;;;;1786:5;1758:62;;;;;;1793:3;1758:62;;;;;;1806:4;1798:21;;;1758:62;;;1737:84;;39:1:-1;33:3;27:10;23:18;57:10;52:3;45:23;79:10;72:17;;0:93;1737:84:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1835:3;1828:10;;;;831:1101;;;:::o;1977:92::-;2021:4;2041:15;:22;;;;2034:29;;1977:92;:::o","source":"// Version of Solidity compiler this program was written for\\r\\npragma solidity ^0.5.0;\\r\\n\\r\\n// Heads or tails game contract\\r\\ncontract HeadsOrTails {\\r\\n address payable owner;\\r\\n string public name;\\r\\n\\r\\n struct Game {\\r\\n address addr;\\r\\n uint amountBet;\\r\\n uint8 guess;\\r\\n bool winner;\\r\\n uint ethInJackpot;\\r\\n }\\r\\n\\r\\n Game[] lastPlayedGames;\\r\\n\\r\\n //Log game result in order to display it on frontend\\r\\n event GameResult(bool won);\\r\\n\\r\\n // Contract constructor run only on contract creation. Set owner.\\r\\n constructor() public {\\r\\n owner = msg.sender;\\r\\n name = \\"Heads or Tails dApp\\";\\r\\n }\\r\\n\\r\\n //add this modifier to functions, which should only be accessible by the owner\\r\\n modifier onlyOwner {\\r\\n require(msg.sender == owner, \\"This function can only be launched by the owner\\");\\r\\n _;\\r\\n }\\r\\n\\r\\n //Play the game!\\r\\n function lottery(uint8 guess) public payable returns(bool){\\r\\n require(guess == 0 || guess == 1, \\"Variable \'guess\' should be either 0 or 1\\");\\r\\n require(msg.value > 0, \\"Bet more than 0\\");\\r\\n require(msg.value <= address(this).balance - msg.value, \\"You cannot bet more than what is available in the jackpot\\");\\r\\n //address(this).balance is increased by msg.value even before code is executed. Thus \\"address(this).balance-msg.value\\"\\r\\n //Create a random number. Use the mining difficulty & the player\'s address, hash it, convert this hex to int, divide by modulo 2 which results in either 0 or 1 and return as uint8\\r\\n uint8 result = uint8(uint256(keccak256(abi.encodePacked(block.difficulty, msg.sender, block.timestamp)))%2);\\r\\n bool won = false;\\r\\n if (guess == result) {\\r\\n //Won!\\r\\n msg.sender.transfer(msg.value * 2);\\r\\n won = true;\\r\\n }\\r\\n\\r\\n emit GameResult(won);\\r\\n lastPlayedGames.push(Game(msg.sender, msg.value, guess, won, address(this).balance));\\r\\n return won; //Return value can only be used by other functions, but not within web3.js (as of 2019)\\r\\n }\\r\\n\\r\\n //Get amount of games played so far\\r\\n function getGameCount() public view returns(uint) {\\r\\n return lastPlayedGames.length;\\r\\n }\\r\\n\\r\\n //Get stats about a certain played game, e.g. address of player, amount bet, won or lost, and ETH in the jackpot at this point in time\\r\\n function getGameEntry(uint index) public view returns(address addr, uint amountBet, uint8 guess, bool winner, uint ethInJackpot) {\\r\\n return (\\r\\n lastPlayedGames[index].addr,\\r\\n lastPlayedGames[index].amountBet,\\r\\n lastPlayedGames[index].guess,\\r\\n lastPlayedGames[index].winner,\\r\\n lastPlayedGames[index].ethInJackpot\\r\\n );\\r\\n }\\r\\n\\r\\n // Contract destructor (Creator of contract can also destroy it and receives remaining ether of contract address).\\r\\n //Advantage compared to \\"withdraw\\": SELFDESTRUCT opcode uses negative gas because the operation frees up space on\\r\\n //the blockchain by clearing all of the contract\'s data\\r\\n function destroy() external onlyOwner {\\r\\n selfdestruct(owner);\\r\\n }\\r\\n\\r\\n //Withdraw money from contract\\r\\n function withdraw(uint amount) external onlyOwner {\\r\\n require(amount < address(this).balance, \\"You cannot withdraw more than what is available in the contract\\");\\r\\n owner.transfer(amount);\\r\\n }\\r\\n\\r\\n // Accept any incoming amount\\r\\n function () external payable {}\\r\\n}","sourcePath":"C:/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol","ast":{"absolutePath":"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol","exportedSymbols":{"HeadsOrTails":[242]},"id":243,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"62:23:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":242,"linearizedBaseContracts":[242],"name":"HeadsOrTails","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":3,"name":"owner","nodeType":"VariableDeclaration","scope":242,"src":"149:21:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":2,"name":"address","nodeType":"ElementaryTypeName","src":"149:15:0","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"value":null,"visibility":"internal"},{"constant":false,"id":5,"name":"name","nodeType":"VariableDeclaration","scope":242,"src":"175:18:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string"},"typeName":{"id":4,"name":"string","nodeType":"ElementaryTypeName","src":"175:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"public"},{"canonicalName":"HeadsOrTails.Game","id":16,"members":[{"constant":false,"id":7,"name":"addr","nodeType":"VariableDeclaration","scope":16,"src":"219:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":6,"name":"address","nodeType":"ElementaryTypeName","src":"219:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":9,"name":"amountBet","nodeType":"VariableDeclaration","scope":16,"src":"238:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":8,"name":"uint","nodeType":"ElementaryTypeName","src":"238:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":11,"name":"guess","nodeType":"VariableDeclaration","scope":16,"src":"259:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":10,"name":"uint8","nodeType":"ElementaryTypeName","src":"259:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":13,"name":"winner","nodeType":"VariableDeclaration","scope":16,"src":"277:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":12,"name":"bool","nodeType":"ElementaryTypeName","src":"277:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":15,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":16,"src":"295:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":14,"name":"uint","nodeType":"ElementaryTypeName","src":"295:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"name":"Game","nodeType":"StructDefinition","scope":242,"src":"200:118:0","visibility":"public"},{"constant":false,"id":19,"name":"lastPlayedGames","nodeType":"VariableDeclaration","scope":242,"src":"324:22:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game[]"},"typeName":{"baseType":{"contractScope":null,"id":17,"name":"Game","nodeType":"UserDefinedTypeName","referencedDeclaration":16,"src":"324:4:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage_ptr","typeString":"struct HeadsOrTails.Game"}},"id":18,"length":null,"nodeType":"ArrayTypeName","src":"324:6:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage_ptr","typeString":"struct HeadsOrTails.Game[]"}},"value":null,"visibility":"internal"},{"anonymous":false,"documentation":null,"id":23,"name":"GameResult","nodeType":"EventDefinition","parameters":{"id":22,"nodeType":"ParameterList","parameters":[{"constant":false,"id":21,"indexed":false,"name":"won","nodeType":"VariableDeclaration","scope":23,"src":"426:8:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":20,"name":"bool","nodeType":"ElementaryTypeName","src":"426:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"425:10:0"},"src":"409:27:0"},{"body":{"id":35,"nodeType":"Block","src":"532:66:0","statements":[{"expression":{"argumentTypes":null,"id":29,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":26,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"539:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":27,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"547:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":28,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"547:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"539:18:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":30,"nodeType":"ExpressionStatement","src":"539:18:0"},{"expression":{"argumentTypes":null,"id":33,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":31,"name":"name","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":5,"src":"564:4:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"4865616473206f72205461696c732064417070","id":32,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"571:21:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_ce4abf6351d67276ac5372334d1c289ffb15acc1a14ed0a47095a166ee22f585","typeString":"literal_string \\"Heads or Tails dApp\\""},"value":"Heads or Tails dApp"},"src":"564:28:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"id":34,"nodeType":"ExpressionStatement","src":"564:28:0"}]},"documentation":null,"id":36,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":24,"nodeType":"ParameterList","parameters":[],"src":"522:2:0"},"returnParameters":{"id":25,"nodeType":"ParameterList","parameters":[],"src":"532:0:0"},"scope":242,"src":"511:87:0","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":47,"nodeType":"Block","src":"705:100:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"id":42,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":39,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"720:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":40,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"720:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":41,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"734:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"720:19:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e6572","id":43,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"741:49:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""},"value":"This function can only be launched by the owner"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""}],"id":38,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"712:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":44,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"712:79:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":45,"nodeType":"ExpressionStatement","src":"712:79:0"},{"id":46,"nodeType":"PlaceholderStatement","src":"798:1:0"}]},"documentation":null,"id":48,"name":"onlyOwner","nodeType":"ModifierDefinition","parameters":{"id":37,"nodeType":"ParameterList","parameters":[],"src":"705:0:0"},"src":"686:119:0","visibility":"internal"},{"body":{"id":155,"nodeType":"Block","src":"889:1043:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_bool","typeString":"bool"},"id":62,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":58,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":56,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"904:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"30","id":57,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"913:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"904:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"BinaryOperation","operator":"||","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":61,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":59,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"918:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"31","id":60,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"927:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_1_by_1","typeString":"int_const 1"},"value":"1"},"src":"918:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"src":"904:24:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"5661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031","id":63,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"930:42:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""},"value":"Variable \'guess\' should be either 0 or 1"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""}],"id":55,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"896:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":64,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"896:77:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":65,"nodeType":"ExpressionStatement","src":"896:77:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":70,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":67,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"988:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":68,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"988:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":">","rightExpression":{"argumentTypes":null,"hexValue":"30","id":69,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1000:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"988:13:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"426574206d6f7265207468616e2030","id":71,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1003:17:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""},"value":"Bet more than 0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""}],"id":66,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"980:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":72,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"980:41:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":73,"nodeType":"ExpressionStatement","src":"980:41:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":84,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":75,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1036:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":76,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1036:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<=","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":83,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":78,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1057:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":77,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1049:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":79,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1049:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":80,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1049:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"-","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":81,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1073:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":82,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1073:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1049:33:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1036:46:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74","id":85,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1084:59:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""},"value":"You cannot bet more than what is available in the jackpot"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""}],"id":74,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"1028:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":86,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1028:116:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":87,"nodeType":"ExpressionStatement","src":"1028:116:0"},{"assignments":[89],"declarations":[{"constant":false,"id":89,"name":"result","nodeType":"VariableDeclaration","scope":155,"src":"1460:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":88,"name":"uint8","nodeType":"ElementaryTypeName","src":"1460:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"id":107,"initialValue":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":105,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":95,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1516:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":96,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"difficulty","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1516:16:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":97,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1534:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":98,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1534:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":99,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1546:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":100,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"timestamp","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1546:15:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":93,"name":"abi","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":301,"src":"1499:3:0","typeDescriptions":{"typeIdentifier":"t_magic_abi","typeString":"abi"}},"id":94,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"memberName":"encodePacked","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1499:16:0","typeDescriptions":{"typeIdentifier":"t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$","typeString":"function () pure returns (bytes memory)"}},"id":101,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1499:63:0","typeDescriptions":{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}],"id":92,"name":"keccak256","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":308,"src":"1489:9:0","typeDescriptions":{"typeIdentifier":"t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$","typeString":"function (bytes memory) pure returns (bytes32)"}},"id":102,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1489:74:0","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes32","typeString":"bytes32"}],"id":91,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1481:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint256_$","typeString":"type(uint256)"},"typeName":"uint256"},"id":103,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1481:83:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"%","rightExpression":{"argumentTypes":null,"hexValue":"32","id":104,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1565:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1481:85:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":90,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1475:5:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint8_$","typeString":"type(uint8)"},"typeName":"uint8"},"id":106,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1475:92:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"VariableDeclarationStatement","src":"1460:107:0"},{"assignments":[109],"declarations":[{"constant":false,"id":109,"name":"won","nodeType":"VariableDeclaration","scope":155,"src":"1574:8:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":108,"name":"bool","nodeType":"ElementaryTypeName","src":"1574:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"id":111,"initialValue":{"argumentTypes":null,"hexValue":"66616c7365","id":110,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1585:5:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"false"},"nodeType":"VariableDeclarationStatement","src":"1574:16:0"},{"condition":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":114,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":112,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1601:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":113,"name":"result","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":89,"src":"1610:6:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"src":"1601:15:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"falseBody":null,"id":131,"nodeType":"IfStatement","src":"1597:105:0","trueBody":{"id":130,"nodeType":"Block","src":"1618:84:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":123,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":120,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1661:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":121,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1661:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"*","rightExpression":{"argumentTypes":null,"hexValue":"32","id":122,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1673:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1661:13:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":115,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1641:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":118,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1641:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":119,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1641:19:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":124,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1641:34:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":125,"nodeType":"ExpressionStatement","src":"1641:34:0"},{"expression":{"argumentTypes":null,"id":128,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":126,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1684:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"74727565","id":127,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1690:4:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"src":"1684:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":129,"nodeType":"ExpressionStatement","src":"1684:10:0"}]}},{"eventCall":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":133,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1726:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"}],"id":132,"name":"GameResult","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":23,"src":"1715:10:0","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_bool_$returns$__$","typeString":"function (bool)"}},"id":134,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1715:15:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":135,"nodeType":"EmitStatement","src":"1710:20:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":140,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1763:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":141,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1763:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":142,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1775:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":143,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1775:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"id":144,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1786:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"id":145,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1793:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":147,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1806:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":146,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1798:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":148,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1798:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":149,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1798:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_uint8","typeString":"uint8"},{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":139,"name":"Game","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":16,"src":"1758:4:0","typeDescriptions":{"typeIdentifier":"t_type$_t_struct$_Game_$16_storage_ptr_$","typeString":"type(struct HeadsOrTails.Game storage pointer)"}},"id":150,"isConstant":false,"isLValue":false,"isPure":false,"kind":"structConstructorCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1758:62:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}],"expression":{"argumentTypes":null,"id":136,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"1737:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":138,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"push","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1737:20:0","typeDescriptions":{"typeIdentifier":"t_function_arraypush_nonpayable$_t_struct$_Game_$16_storage_$returns$_t_uint256_$","typeString":"function (struct HeadsOrTails.Game storage ref) returns (uint256)"}},"id":151,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1737:84:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":152,"nodeType":"ExpressionStatement","src":"1737:84:0"},{"expression":{"argumentTypes":null,"id":153,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1835:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"functionReturnParameters":54,"id":154,"nodeType":"Return","src":"1828:10:0"}]},"documentation":null,"id":156,"implemented":true,"kind":"function","modifiers":[],"name":"lottery","nodeType":"FunctionDefinition","parameters":{"id":51,"nodeType":"ParameterList","parameters":[{"constant":false,"id":50,"name":"guess","nodeType":"VariableDeclaration","scope":156,"src":"848:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":49,"name":"uint8","nodeType":"ElementaryTypeName","src":"848:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"src":"847:13:0"},"returnParameters":{"id":54,"nodeType":"ParameterList","parameters":[{"constant":false,"id":53,"name":"","nodeType":"VariableDeclaration","scope":156,"src":"884:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":52,"name":"bool","nodeType":"ElementaryTypeName","src":"884:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"883:6:0"},"scope":242,"src":"831:1101:0","stateMutability":"payable","superFunction":null,"visibility":"public"},{"body":{"id":164,"nodeType":"Block","src":"2027:42:0","statements":[{"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":161,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2041:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":162,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"length","nodeType":"MemberAccess","referencedDeclaration":null,"src":"2041:22:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"functionReturnParameters":160,"id":163,"nodeType":"Return","src":"2034:29:0"}]},"documentation":null,"id":165,"implemented":true,"kind":"function","modifiers":[],"name":"getGameCount","nodeType":"FunctionDefinition","parameters":{"id":157,"nodeType":"ParameterList","parameters":[],"src":"1998:2:0"},"returnParameters":{"id":160,"nodeType":"ParameterList","parameters":[{"constant":false,"id":159,"name":"","nodeType":"VariableDeclaration","scope":165,"src":"2021:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":158,"name":"uint","nodeType":"ElementaryTypeName","src":"2021:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2020:6:0"},"scope":242,"src":"1977:92:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":202,"nodeType":"Block","src":"2342:223:0","statements":[{"expression":{"argumentTypes":null,"components":[{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":180,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2365:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":182,"indexExpression":{"argumentTypes":null,"id":181,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2381:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2365:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":183,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"addr","nodeType":"MemberAccess","referencedDeclaration":7,"src":"2365:27:0","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":184,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2401:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":186,"indexExpression":{"argumentTypes":null,"id":185,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2417:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2401:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":187,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"amountBet","nodeType":"MemberAccess","referencedDeclaration":9,"src":"2401:32:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":188,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2442:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":190,"indexExpression":{"argumentTypes":null,"id":189,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2458:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2442:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":191,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"guess","nodeType":"MemberAccess","referencedDeclaration":11,"src":"2442:28:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":192,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2479:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":194,"indexExpression":{"argumentTypes":null,"id":193,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2495:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2479:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":195,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"winner","nodeType":"MemberAccess","referencedDeclaration":13,"src":"2479:29:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":196,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2517:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":198,"indexExpression":{"argumentTypes":null,"id":197,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2533:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2517:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":199,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"ethInJackpot","nodeType":"MemberAccess","referencedDeclaration":15,"src":"2517:35:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"id":200,"isConstant":false,"isInlineArray":false,"isLValue":false,"isPure":false,"lValueRequested":false,"nodeType":"TupleExpression","src":"2356:203:0","typeDescriptions":{"typeIdentifier":"t_tuple$_t_address_$_t_uint256_$_t_uint8_$_t_bool_$_t_uint256_$","typeString":"tuple(address,uint256,uint8,bool,uint256)"}},"functionReturnParameters":179,"id":201,"nodeType":"Return","src":"2349:210:0"}]},"documentation":null,"id":203,"implemented":true,"kind":"function","modifiers":[],"name":"getGameEntry","nodeType":"FunctionDefinition","parameters":{"id":168,"nodeType":"ParameterList","parameters":[{"constant":false,"id":167,"name":"index","nodeType":"VariableDeclaration","scope":203,"src":"2235:10:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":166,"name":"uint","nodeType":"ElementaryTypeName","src":"2235:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2234:12:0"},"returnParameters":{"id":179,"nodeType":"ParameterList","parameters":[{"constant":false,"id":170,"name":"addr","nodeType":"VariableDeclaration","scope":203,"src":"2267:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":169,"name":"address","nodeType":"ElementaryTypeName","src":"2267:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":172,"name":"amountBet","nodeType":"VariableDeclaration","scope":203,"src":"2281:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":171,"name":"uint","nodeType":"ElementaryTypeName","src":"2281:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":174,"name":"guess","nodeType":"VariableDeclaration","scope":203,"src":"2297:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":173,"name":"uint8","nodeType":"ElementaryTypeName","src":"2297:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":176,"name":"winner","nodeType":"VariableDeclaration","scope":203,"src":"2310:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":175,"name":"bool","nodeType":"ElementaryTypeName","src":"2310:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":178,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":203,"src":"2323:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":177,"name":"uint","nodeType":"ElementaryTypeName","src":"2323:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2266:75:0"},"scope":242,"src":"2213:352:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":212,"nodeType":"Block","src":"2903:32:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":209,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"2923:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"id":208,"name":"selfdestruct","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":322,"src":"2910:12:0","typeDescriptions":{"typeIdentifier":"t_function_selfdestruct_nonpayable$_t_address_payable_$returns$__$","typeString":"function (address payable)"}},"id":210,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"2910:19:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":211,"nodeType":"ExpressionStatement","src":"2910:19:0"}]},"documentation":null,"id":213,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":206,"modifierName":{"argumentTypes":null,"id":205,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"2893:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"2893:9:0"}],"name":"destroy","nodeType":"FunctionDefinition","parameters":{"id":204,"nodeType":"ParameterList","parameters":[],"src":"2881:2:0"},"returnParameters":{"id":207,"nodeType":"ParameterList","parameters":[],"src":"2903:0:0"},"scope":242,"src":"2865:70:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":236,"nodeType":"Block","src":"3025:148:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":226,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":221,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3040:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":223,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"3057:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":222,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"3049:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":224,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3049:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":225,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3049:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"3040:30:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374","id":227,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"3072:65:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""},"value":"You cannot withdraw more than what is available in the contract"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""}],"id":220,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"3032:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":228,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3032:106:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":229,"nodeType":"ExpressionStatement","src":"3032:106:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":233,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3160:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":230,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"3145:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":232,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3145:14:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":234,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3145:22:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":235,"nodeType":"ExpressionStatement","src":"3145:22:0"}]},"documentation":null,"id":237,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":218,"modifierName":{"argumentTypes":null,"id":217,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"3015:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"3015:9:0"}],"name":"withdraw","nodeType":"FunctionDefinition","parameters":{"id":216,"nodeType":"ParameterList","parameters":[{"constant":false,"id":215,"name":"amount","nodeType":"VariableDeclaration","scope":237,"src":"2993:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":214,"name":"uint","nodeType":"ElementaryTypeName","src":"2993:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2992:13:0"},"returnParameters":{"id":219,"nodeType":"ParameterList","parameters":[],"src":"3025:0:0"},"scope":242,"src":"2975:198:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":240,"nodeType":"Block","src":"3241:2:0","statements":[]},"documentation":null,"id":241,"implemented":true,"kind":"fallback","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":238,"nodeType":"ParameterList","parameters":[],"src":"3221:2:0"},"returnParameters":{"id":239,"nodeType":"ParameterList","parameters":[],"src":"3241:0:0"},"scope":242,"src":"3212:31:0","stateMutability":"payable","superFunction":null,"visibility":"external"}],"scope":243,"src":"122:3124:0"}],"src":"62:3184:0"},"legacyAST":{"absolutePath":"/C/Users/renek/Documents/Programmieren/Heads or Tails/contracts/HeadsOrTails.sol","exportedSymbols":{"HeadsOrTails":[242]},"id":243,"nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity","^","0.5",".0"],"nodeType":"PragmaDirective","src":"62:23:0"},{"baseContracts":[],"contractDependencies":[],"contractKind":"contract","documentation":null,"fullyImplemented":true,"id":242,"linearizedBaseContracts":[242],"name":"HeadsOrTails","nodeType":"ContractDefinition","nodes":[{"constant":false,"id":3,"name":"owner","nodeType":"VariableDeclaration","scope":242,"src":"149:21:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"typeName":{"id":2,"name":"address","nodeType":"ElementaryTypeName","src":"149:15:0","stateMutability":"payable","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"value":null,"visibility":"internal"},{"constant":false,"id":5,"name":"name","nodeType":"VariableDeclaration","scope":242,"src":"175:18:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string"},"typeName":{"id":4,"name":"string","nodeType":"ElementaryTypeName","src":"175:6:0","typeDescriptions":{"typeIdentifier":"t_string_storage_ptr","typeString":"string"}},"value":null,"visibility":"public"},{"canonicalName":"HeadsOrTails.Game","id":16,"members":[{"constant":false,"id":7,"name":"addr","nodeType":"VariableDeclaration","scope":16,"src":"219:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":6,"name":"address","nodeType":"ElementaryTypeName","src":"219:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":9,"name":"amountBet","nodeType":"VariableDeclaration","scope":16,"src":"238:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":8,"name":"uint","nodeType":"ElementaryTypeName","src":"238:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":11,"name":"guess","nodeType":"VariableDeclaration","scope":16,"src":"259:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":10,"name":"uint8","nodeType":"ElementaryTypeName","src":"259:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":13,"name":"winner","nodeType":"VariableDeclaration","scope":16,"src":"277:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":12,"name":"bool","nodeType":"ElementaryTypeName","src":"277:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":15,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":16,"src":"295:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":14,"name":"uint","nodeType":"ElementaryTypeName","src":"295:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"name":"Game","nodeType":"StructDefinition","scope":242,"src":"200:118:0","visibility":"public"},{"constant":false,"id":19,"name":"lastPlayedGames","nodeType":"VariableDeclaration","scope":242,"src":"324:22:0","stateVariable":true,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game[]"},"typeName":{"baseType":{"contractScope":null,"id":17,"name":"Game","nodeType":"UserDefinedTypeName","referencedDeclaration":16,"src":"324:4:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage_ptr","typeString":"struct HeadsOrTails.Game"}},"id":18,"length":null,"nodeType":"ArrayTypeName","src":"324:6:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage_ptr","typeString":"struct HeadsOrTails.Game[]"}},"value":null,"visibility":"internal"},{"anonymous":false,"documentation":null,"id":23,"name":"GameResult","nodeType":"EventDefinition","parameters":{"id":22,"nodeType":"ParameterList","parameters":[{"constant":false,"id":21,"indexed":false,"name":"won","nodeType":"VariableDeclaration","scope":23,"src":"426:8:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":20,"name":"bool","nodeType":"ElementaryTypeName","src":"426:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"425:10:0"},"src":"409:27:0"},{"body":{"id":35,"nodeType":"Block","src":"532:66:0","statements":[{"expression":{"argumentTypes":null,"id":29,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":26,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"539:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":27,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"547:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":28,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"547:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"539:18:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":30,"nodeType":"ExpressionStatement","src":"539:18:0"},{"expression":{"argumentTypes":null,"id":33,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":31,"name":"name","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":5,"src":"564:4:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"4865616473206f72205461696c732064417070","id":32,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"571:21:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_ce4abf6351d67276ac5372334d1c289ffb15acc1a14ed0a47095a166ee22f585","typeString":"literal_string \\"Heads or Tails dApp\\""},"value":"Heads or Tails dApp"},"src":"564:28:0","typeDescriptions":{"typeIdentifier":"t_string_storage","typeString":"string storage ref"}},"id":34,"nodeType":"ExpressionStatement","src":"564:28:0"}]},"documentation":null,"id":36,"implemented":true,"kind":"constructor","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":24,"nodeType":"ParameterList","parameters":[],"src":"522:2:0"},"returnParameters":{"id":25,"nodeType":"ParameterList","parameters":[],"src":"532:0:0"},"scope":242,"src":"511:87:0","stateMutability":"nonpayable","superFunction":null,"visibility":"public"},{"body":{"id":47,"nodeType":"Block","src":"705:100:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_address_payable","typeString":"address payable"},"id":42,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":39,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"720:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":40,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"720:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":41,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"734:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"src":"720:19:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"546869732066756e6374696f6e2063616e206f6e6c79206265206c61756e6368656420627920746865206f776e6572","id":43,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"741:49:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""},"value":"This function can only be launched by the owner"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_c5b5e21b2b79777dc5e4f06e0d5d381231f7790523900568c7083eacd8e0a1d8","typeString":"literal_string \\"This function can only be launched by the owner\\""}],"id":38,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"712:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":44,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"712:79:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":45,"nodeType":"ExpressionStatement","src":"712:79:0"},{"id":46,"nodeType":"PlaceholderStatement","src":"798:1:0"}]},"documentation":null,"id":48,"name":"onlyOwner","nodeType":"ModifierDefinition","parameters":{"id":37,"nodeType":"ParameterList","parameters":[],"src":"705:0:0"},"src":"686:119:0","visibility":"internal"},{"body":{"id":155,"nodeType":"Block","src":"889:1043:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_bool","typeString":"bool"},"id":62,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":58,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":56,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"904:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"30","id":57,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"913:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"904:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"BinaryOperation","operator":"||","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":61,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":59,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"918:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"hexValue":"31","id":60,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"927:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_1_by_1","typeString":"int_const 1"},"value":"1"},"src":"918:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"src":"904:24:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"5661726961626c6520276775657373272073686f756c64206265206569746865722030206f722031","id":63,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"930:42:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""},"value":"Variable \'guess\' should be either 0 or 1"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_fd0c70a26512850b3223c69ae647e9b2ef49a978458f211c04f555348c032789","typeString":"literal_string \\"Variable \'guess\' should be either 0 or 1\\""}],"id":55,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"896:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":64,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"896:77:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":65,"nodeType":"ExpressionStatement","src":"896:77:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":70,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":67,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"988:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":68,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"988:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":">","rightExpression":{"argumentTypes":null,"hexValue":"30","id":69,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1000:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_0_by_1","typeString":"int_const 0"},"value":"0"},"src":"988:13:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"426574206d6f7265207468616e2030","id":71,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1003:17:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""},"value":"Bet more than 0"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_de58d807da6bedc89ff887a2727d54527c97d0e551adfeff94e45c4c69299709","typeString":"literal_string \\"Bet more than 0\\""}],"id":66,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"980:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":72,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"980:41:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":73,"nodeType":"ExpressionStatement","src":"980:41:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":84,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":75,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1036:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":76,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1036:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<=","rightExpression":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":83,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":78,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1057:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":77,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1049:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":79,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1049:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":80,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1049:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"-","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":81,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1073:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":82,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1073:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1049:33:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"1036:46:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f7420626574206d6f7265207468616e207768617420697320617661696c61626c6520696e20746865206a61636b706f74","id":85,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"1084:59:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""},"value":"You cannot bet more than what is available in the jackpot"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_87273274070974eff79558d366648cef2e3639794e98bf94e6dc64e337a7ee6c","typeString":"literal_string \\"You cannot bet more than what is available in the jackpot\\""}],"id":74,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"1028:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":86,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1028:116:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":87,"nodeType":"ExpressionStatement","src":"1028:116:0"},{"assignments":[89],"declarations":[{"constant":false,"id":89,"name":"result","nodeType":"VariableDeclaration","scope":155,"src":"1460:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":88,"name":"uint8","nodeType":"ElementaryTypeName","src":"1460:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"id":107,"initialValue":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":105,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":95,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1516:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":96,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"difficulty","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1516:16:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":97,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1534:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":98,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1534:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":99,"name":"block","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":304,"src":"1546:5:0","typeDescriptions":{"typeIdentifier":"t_magic_block","typeString":"block"}},"id":100,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"timestamp","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1546:15:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":93,"name":"abi","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":301,"src":"1499:3:0","typeDescriptions":{"typeIdentifier":"t_magic_abi","typeString":"abi"}},"id":94,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"memberName":"encodePacked","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1499:16:0","typeDescriptions":{"typeIdentifier":"t_function_abiencodepacked_pure$__$returns$_t_bytes_memory_ptr_$","typeString":"function () pure returns (bytes memory)"}},"id":101,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1499:63:0","typeDescriptions":{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes_memory_ptr","typeString":"bytes memory"}],"id":92,"name":"keccak256","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":308,"src":"1489:9:0","typeDescriptions":{"typeIdentifier":"t_function_keccak256_pure$_t_bytes_memory_ptr_$returns$_t_bytes32_$","typeString":"function (bytes memory) pure returns (bytes32)"}},"id":102,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1489:74:0","typeDescriptions":{"typeIdentifier":"t_bytes32","typeString":"bytes32"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bytes32","typeString":"bytes32"}],"id":91,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1481:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint256_$","typeString":"type(uint256)"},"typeName":"uint256"},"id":103,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1481:83:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"%","rightExpression":{"argumentTypes":null,"hexValue":"32","id":104,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1565:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1481:85:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":90,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1475:5:0","typeDescriptions":{"typeIdentifier":"t_type$_t_uint8_$","typeString":"type(uint8)"},"typeName":"uint8"},"id":106,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1475:92:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"VariableDeclarationStatement","src":"1460:107:0"},{"assignments":[109],"declarations":[{"constant":false,"id":109,"name":"won","nodeType":"VariableDeclaration","scope":155,"src":"1574:8:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":108,"name":"bool","nodeType":"ElementaryTypeName","src":"1574:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"id":111,"initialValue":{"argumentTypes":null,"hexValue":"66616c7365","id":110,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1585:5:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"false"},"nodeType":"VariableDeclarationStatement","src":"1574:16:0"},{"condition":{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint8","typeString":"uint8"},"id":114,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":112,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1601:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"nodeType":"BinaryOperation","operator":"==","rightExpression":{"argumentTypes":null,"id":113,"name":"result","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":89,"src":"1610:6:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"src":"1601:15:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"falseBody":null,"id":131,"nodeType":"IfStatement","src":"1597:105:0","trueBody":{"id":130,"nodeType":"Block","src":"1618:84:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":123,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":120,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1661:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":121,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1661:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"*","rightExpression":{"argumentTypes":null,"hexValue":"32","id":122,"isConstant":false,"isLValue":false,"isPure":true,"kind":"number","lValueRequested":false,"nodeType":"Literal","src":"1673:1:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_rational_2_by_1","typeString":"int_const 2"},"value":"2"},"src":"1661:13:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":115,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1641:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":118,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1641:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":119,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1641:19:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":124,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1641:34:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":125,"nodeType":"ExpressionStatement","src":"1641:34:0"},{"expression":{"argumentTypes":null,"id":128,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftHandSide":{"argumentTypes":null,"id":126,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1684:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"nodeType":"Assignment","operator":"=","rightHandSide":{"argumentTypes":null,"hexValue":"74727565","id":127,"isConstant":false,"isLValue":false,"isPure":true,"kind":"bool","lValueRequested":false,"nodeType":"Literal","src":"1690:4:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"value":"true"},"src":"1684:10:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"id":129,"nodeType":"ExpressionStatement","src":"1684:10:0"}]}},{"eventCall":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":133,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1726:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"}],"id":132,"name":"GameResult","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":23,"src":"1715:10:0","typeDescriptions":{"typeIdentifier":"t_function_event_nonpayable$_t_bool_$returns$__$","typeString":"function (bool)"}},"id":134,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1715:15:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":135,"nodeType":"EmitStatement","src":"1710:20:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"arguments":[{"argumentTypes":null,"expression":{"argumentTypes":null,"id":140,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1763:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":141,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"sender","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1763:10:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"id":142,"name":"msg","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":314,"src":"1775:3:0","typeDescriptions":{"typeIdentifier":"t_magic_message","typeString":"msg"}},"id":143,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"value","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1775:9:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"id":144,"name":"guess","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":50,"src":"1786:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"id":145,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1793:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":147,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"1806:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":146,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"1798:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":148,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1798:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":149,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1798:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"},{"typeIdentifier":"t_uint256","typeString":"uint256"},{"typeIdentifier":"t_uint8","typeString":"uint8"},{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_uint256","typeString":"uint256"}],"id":139,"name":"Game","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":16,"src":"1758:4:0","typeDescriptions":{"typeIdentifier":"t_type$_t_struct$_Game_$16_storage_ptr_$","typeString":"type(struct HeadsOrTails.Game storage pointer)"}},"id":150,"isConstant":false,"isLValue":false,"isPure":false,"kind":"structConstructorCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1758:62:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_struct$_Game_$16_memory","typeString":"struct HeadsOrTails.Game memory"}],"expression":{"argumentTypes":null,"id":136,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"1737:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":138,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"push","nodeType":"MemberAccess","referencedDeclaration":null,"src":"1737:20:0","typeDescriptions":{"typeIdentifier":"t_function_arraypush_nonpayable$_t_struct$_Game_$16_storage_$returns$_t_uint256_$","typeString":"function (struct HeadsOrTails.Game storage ref) returns (uint256)"}},"id":151,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"1737:84:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"id":152,"nodeType":"ExpressionStatement","src":"1737:84:0"},{"expression":{"argumentTypes":null,"id":153,"name":"won","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":109,"src":"1835:3:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"functionReturnParameters":54,"id":154,"nodeType":"Return","src":"1828:10:0"}]},"documentation":null,"id":156,"implemented":true,"kind":"function","modifiers":[],"name":"lottery","nodeType":"FunctionDefinition","parameters":{"id":51,"nodeType":"ParameterList","parameters":[{"constant":false,"id":50,"name":"guess","nodeType":"VariableDeclaration","scope":156,"src":"848:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":49,"name":"uint8","nodeType":"ElementaryTypeName","src":"848:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"}],"src":"847:13:0"},"returnParameters":{"id":54,"nodeType":"ParameterList","parameters":[{"constant":false,"id":53,"name":"","nodeType":"VariableDeclaration","scope":156,"src":"884:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":52,"name":"bool","nodeType":"ElementaryTypeName","src":"884:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"}],"src":"883:6:0"},"scope":242,"src":"831:1101:0","stateMutability":"payable","superFunction":null,"visibility":"public"},{"body":{"id":164,"nodeType":"Block","src":"2027:42:0","statements":[{"expression":{"argumentTypes":null,"expression":{"argumentTypes":null,"id":161,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2041:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":162,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"length","nodeType":"MemberAccess","referencedDeclaration":null,"src":"2041:22:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"functionReturnParameters":160,"id":163,"nodeType":"Return","src":"2034:29:0"}]},"documentation":null,"id":165,"implemented":true,"kind":"function","modifiers":[],"name":"getGameCount","nodeType":"FunctionDefinition","parameters":{"id":157,"nodeType":"ParameterList","parameters":[],"src":"1998:2:0"},"returnParameters":{"id":160,"nodeType":"ParameterList","parameters":[{"constant":false,"id":159,"name":"","nodeType":"VariableDeclaration","scope":165,"src":"2021:4:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":158,"name":"uint","nodeType":"ElementaryTypeName","src":"2021:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2020:6:0"},"scope":242,"src":"1977:92:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":202,"nodeType":"Block","src":"2342:223:0","statements":[{"expression":{"argumentTypes":null,"components":[{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":180,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2365:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":182,"indexExpression":{"argumentTypes":null,"id":181,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2381:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2365:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":183,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"addr","nodeType":"MemberAccess","referencedDeclaration":7,"src":"2365:27:0","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":184,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2401:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":186,"indexExpression":{"argumentTypes":null,"id":185,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2417:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2401:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":187,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"amountBet","nodeType":"MemberAccess","referencedDeclaration":9,"src":"2401:32:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":188,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2442:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":190,"indexExpression":{"argumentTypes":null,"id":189,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2458:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2442:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":191,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"guess","nodeType":"MemberAccess","referencedDeclaration":11,"src":"2442:28:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":192,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2479:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":194,"indexExpression":{"argumentTypes":null,"id":193,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2495:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2479:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":195,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"winner","nodeType":"MemberAccess","referencedDeclaration":13,"src":"2479:29:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"expression":{"argumentTypes":null,"baseExpression":{"argumentTypes":null,"id":196,"name":"lastPlayedGames","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":19,"src":"2517:15:0","typeDescriptions":{"typeIdentifier":"t_array$_t_struct$_Game_$16_storage_$dyn_storage","typeString":"struct HeadsOrTails.Game storage ref[] storage ref"}},"id":198,"indexExpression":{"argumentTypes":null,"id":197,"name":"index","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":167,"src":"2533:5:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"nodeType":"IndexAccess","src":"2517:22:0","typeDescriptions":{"typeIdentifier":"t_struct$_Game_$16_storage","typeString":"struct HeadsOrTails.Game storage ref"}},"id":199,"isConstant":false,"isLValue":true,"isPure":false,"lValueRequested":false,"memberName":"ethInJackpot","nodeType":"MemberAccess","referencedDeclaration":15,"src":"2517:35:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"id":200,"isConstant":false,"isInlineArray":false,"isLValue":false,"isPure":false,"lValueRequested":false,"nodeType":"TupleExpression","src":"2356:203:0","typeDescriptions":{"typeIdentifier":"t_tuple$_t_address_$_t_uint256_$_t_uint8_$_t_bool_$_t_uint256_$","typeString":"tuple(address,uint256,uint8,bool,uint256)"}},"functionReturnParameters":179,"id":201,"nodeType":"Return","src":"2349:210:0"}]},"documentation":null,"id":203,"implemented":true,"kind":"function","modifiers":[],"name":"getGameEntry","nodeType":"FunctionDefinition","parameters":{"id":168,"nodeType":"ParameterList","parameters":[{"constant":false,"id":167,"name":"index","nodeType":"VariableDeclaration","scope":203,"src":"2235:10:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":166,"name":"uint","nodeType":"ElementaryTypeName","src":"2235:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2234:12:0"},"returnParameters":{"id":179,"nodeType":"ParameterList","parameters":[{"constant":false,"id":170,"name":"addr","nodeType":"VariableDeclaration","scope":203,"src":"2267:12:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"},"typeName":{"id":169,"name":"address","nodeType":"ElementaryTypeName","src":"2267:7:0","stateMutability":"nonpayable","typeDescriptions":{"typeIdentifier":"t_address","typeString":"address"}},"value":null,"visibility":"internal"},{"constant":false,"id":172,"name":"amountBet","nodeType":"VariableDeclaration","scope":203,"src":"2281:14:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":171,"name":"uint","nodeType":"ElementaryTypeName","src":"2281:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"},{"constant":false,"id":174,"name":"guess","nodeType":"VariableDeclaration","scope":203,"src":"2297:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"},"typeName":{"id":173,"name":"uint8","nodeType":"ElementaryTypeName","src":"2297:5:0","typeDescriptions":{"typeIdentifier":"t_uint8","typeString":"uint8"}},"value":null,"visibility":"internal"},{"constant":false,"id":176,"name":"winner","nodeType":"VariableDeclaration","scope":203,"src":"2310:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"},"typeName":{"id":175,"name":"bool","nodeType":"ElementaryTypeName","src":"2310:4:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},"value":null,"visibility":"internal"},{"constant":false,"id":178,"name":"ethInJackpot","nodeType":"VariableDeclaration","scope":203,"src":"2323:17:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":177,"name":"uint","nodeType":"ElementaryTypeName","src":"2323:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2266:75:0"},"scope":242,"src":"2213:352:0","stateMutability":"view","superFunction":null,"visibility":"public"},{"body":{"id":212,"nodeType":"Block","src":"2903:32:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":209,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"2923:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_address_payable","typeString":"address payable"}],"id":208,"name":"selfdestruct","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":322,"src":"2910:12:0","typeDescriptions":{"typeIdentifier":"t_function_selfdestruct_nonpayable$_t_address_payable_$returns$__$","typeString":"function (address payable)"}},"id":210,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"2910:19:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":211,"nodeType":"ExpressionStatement","src":"2910:19:0"}]},"documentation":null,"id":213,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":206,"modifierName":{"argumentTypes":null,"id":205,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"2893:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"2893:9:0"}],"name":"destroy","nodeType":"FunctionDefinition","parameters":{"id":204,"nodeType":"ParameterList","parameters":[],"src":"2881:2:0"},"returnParameters":{"id":207,"nodeType":"ParameterList","parameters":[],"src":"2903:0:0"},"scope":242,"src":"2865:70:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":236,"nodeType":"Block","src":"3025:148:0","statements":[{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"commonType":{"typeIdentifier":"t_uint256","typeString":"uint256"},"id":226,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"leftExpression":{"argumentTypes":null,"id":221,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3040:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"nodeType":"BinaryOperation","operator":"<","rightExpression":{"argumentTypes":null,"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":223,"name":"this","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":328,"src":"3057:4:0","typeDescriptions":{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_contract$_HeadsOrTails_$242","typeString":"contract HeadsOrTails"}],"id":222,"isConstant":false,"isLValue":false,"isPure":true,"lValueRequested":false,"nodeType":"ElementaryTypeNameExpression","src":"3049:7:0","typeDescriptions":{"typeIdentifier":"t_type$_t_address_$","typeString":"type(address)"},"typeName":"address"},"id":224,"isConstant":false,"isLValue":false,"isPure":false,"kind":"typeConversion","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3049:13:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":225,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"balance","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3049:21:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"src":"3040:30:0","typeDescriptions":{"typeIdentifier":"t_bool","typeString":"bool"}},{"argumentTypes":null,"hexValue":"596f752063616e6e6f74207769746864726177206d6f7265207468616e207768617420697320617661696c61626c6520696e2074686520636f6e7472616374","id":227,"isConstant":false,"isLValue":false,"isPure":true,"kind":"string","lValueRequested":false,"nodeType":"Literal","src":"3072:65:0","subdenomination":null,"typeDescriptions":{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""},"value":"You cannot withdraw more than what is available in the contract"}],"expression":{"argumentTypes":[{"typeIdentifier":"t_bool","typeString":"bool"},{"typeIdentifier":"t_stringliteral_b3b6e22511361cc1aeaeb3e7619e98ceb63c60bcdea7751f3df2650cafcc4cc0","typeString":"literal_string \\"You cannot withdraw more than what is available in the contract\\""}],"id":220,"name":"require","nodeType":"Identifier","overloadedDeclarations":[317,318],"referencedDeclaration":318,"src":"3032:7:0","typeDescriptions":{"typeIdentifier":"t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$","typeString":"function (bool,string memory) pure"}},"id":228,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3032:106:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":229,"nodeType":"ExpressionStatement","src":"3032:106:0"},{"expression":{"argumentTypes":null,"arguments":[{"argumentTypes":null,"id":233,"name":"amount","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":215,"src":"3160:6:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}}],"expression":{"argumentTypes":[{"typeIdentifier":"t_uint256","typeString":"uint256"}],"expression":{"argumentTypes":null,"id":230,"name":"owner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":3,"src":"3145:5:0","typeDescriptions":{"typeIdentifier":"t_address_payable","typeString":"address payable"}},"id":232,"isConstant":false,"isLValue":false,"isPure":false,"lValueRequested":false,"memberName":"transfer","nodeType":"MemberAccess","referencedDeclaration":null,"src":"3145:14:0","typeDescriptions":{"typeIdentifier":"t_function_transfer_nonpayable$_t_uint256_$returns$__$","typeString":"function (uint256)"}},"id":234,"isConstant":false,"isLValue":false,"isPure":false,"kind":"functionCall","lValueRequested":false,"names":[],"nodeType":"FunctionCall","src":"3145:22:0","typeDescriptions":{"typeIdentifier":"t_tuple$__$","typeString":"tuple()"}},"id":235,"nodeType":"ExpressionStatement","src":"3145:22:0"}]},"documentation":null,"id":237,"implemented":true,"kind":"function","modifiers":[{"arguments":null,"id":218,"modifierName":{"argumentTypes":null,"id":217,"name":"onlyOwner","nodeType":"Identifier","overloadedDeclarations":[],"referencedDeclaration":48,"src":"3015:9:0","typeDescriptions":{"typeIdentifier":"t_modifier$__$","typeString":"modifier ()"}},"nodeType":"ModifierInvocation","src":"3015:9:0"}],"name":"withdraw","nodeType":"FunctionDefinition","parameters":{"id":216,"nodeType":"ParameterList","parameters":[{"constant":false,"id":215,"name":"amount","nodeType":"VariableDeclaration","scope":237,"src":"2993:11:0","stateVariable":false,"storageLocation":"default","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"},"typeName":{"id":214,"name":"uint","nodeType":"ElementaryTypeName","src":"2993:4:0","typeDescriptions":{"typeIdentifier":"t_uint256","typeString":"uint256"}},"value":null,"visibility":"internal"}],"src":"2992:13:0"},"returnParameters":{"id":219,"nodeType":"ParameterList","parameters":[],"src":"3025:0:0"},"scope":242,"src":"2975:198:0","stateMutability":"nonpayable","superFunction":null,"visibility":"external"},{"body":{"id":240,"nodeType":"Block","src":"3241:2:0","statements":[]},"documentation":null,"id":241,"implemented":true,"kind":"fallback","modifiers":[],"name":"","nodeType":"FunctionDefinition","parameters":{"id":238,"nodeType":"ParameterList","parameters":[],"src":"3221:2:0"},"returnParameters":{"id":239,"nodeType":"ParameterList","parameters":[],"src":"3241:0:0"},"scope":242,"src":"3212:31:0","stateMutability":"payable","superFunction":null,"visibility":"external"}],"scope":243,"src":"122:3124:0"}],"src":"62:3184:0"},"compiler":{"name":"solc","version":"0.5.8+commit.23d335f2.Emscripten.clang"},"networks":{"3":{"events":{"0x01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d61":{"anonymous":false,"inputs":[{"indexed":false,"name":"won","type":"bool"}],"name":"GameResult","type":"event","signature":"0x01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d61"}},"links":{},"address":"0x7f8b9483b79f735C34820497A1a7f9FB82C9224b","transactionHash":"0x65200aec4d6c59c2dfc3b8f7ff9557e3934fca7a35f4c0b904bc8bd1cd77866a"},"5777":{"events":{"0x01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d61":{"anonymous":false,"inputs":[{"indexed":false,"name":"won","type":"bool"}],"name":"GameResult","type":"event","signature":"0x01139cc8db7ae102523ff337e9eafdc94b8011b2504273f9eb71b6ccf0ba1d61"}},"links":{},"address":"0x7855c451eE02CA17B4e2C08B628D5445FbF3dc6b","transactionHash":"0x36a83607294e20938fae42005000d0cfe4ddad0c91dd92209c184373b410215d"}},"schemaVersion":"3.0.16","updatedAt":"2019-11-08T19:20:07.676Z","devdoc":{"methods":{}},"userdoc":{"methods":{}}}')},function(e,t,n){"use strict";n.r(t);var i=n(0);let a,s,r;async function f(){const e=await web3.eth.net.getId();console.log(e);const t=i.networks[e];if(console.log(t),t){console.log("HeadsOrTails contract is deployed to this network."),a=new web3.eth.Contract(i.abi,t.address),console.log(a);const e=await a.methods.name().call();console.log(e),o(),l(),document.querySelector(".contract-address").innerHTML=''+t.address+""}else window.alert("Marketplace contract not deployed to detected network.")}async function l(){const e=await web3.eth.getBalance(a._address)/1e18;console.log("Contract balance (ETH): "+e),document.querySelector(".eth-in-jackpot").innerHTML=e+" ETH (~"+(e*r).toFixed(2)+"$)",document.querySelector("#amount-to-bet").max=e}async function o(){const e=await a.methods.getGameCount().call();document.querySelector("#table-body").innerHTML="";let t=document.querySelector("#productrow"),n=t.content.querySelectorAll("td");for(let i=e-1;i>=0;i--){const s=await a.methods.getGameEntry(i).call();let r=s.winner?"Won":"Lost",f=0==s.guess?"Heads":"Tails";const l=s.addr.slice(0,3)+"..."+s.addr.slice(-3);n[0].textContent=l,n[1].textContent=s.amountBet/1e18+" ETH",n[2].textContent=f,n[3].textContent=r,n[4].textContent=s.ethInJackpot/1e18+" ETH";let o=document.querySelector("#table-body"),p=document.importNode(t.content,!0);if(o.appendChild(p),i<=e-3)break}}function p(e){if(!e.ok)throw Error(e.statusText);return e}function d(){document.body.classList.toggle("wait")}window.addEventListener("load",async function(){if(window.ethereum){window.web3=new Web3(ethereum);try{await ethereum.enable(),console.log("User has a MODERN dapp browser!"),f()}catch(e){console.log("User denied access!")}}else window.web3?(window.web3=new Web3(web3.currentProvider),console.log("User has a LEGACY dapp browser!"),f()):window.alert("Non-Ethereum browser detected. You should consider trying MetaMask!")}()),window.addEventListener("load",async function(){fetch("https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR").then(p).then(e=>e.json()).then(e=>{console.log(e.USD),r=e.USD}).catch(e=>console.error(e))}()),document.getElementById("form").addEventListener("submit",e=>{e.preventDefault(),async function(){document.getElementsByName("ht-selector");const e=document.querySelector("#amount-to-bet").value;let t=document.querySelector(":checked").value;console.log("0 or 1: "+t),console.log("Amount to bet (ETH): "+e);const n=window.web3.utils.toWei(e,"Ether");console.log("Amount to bet (Wei): "+n);const i=await web3.eth.getAccounts();s=i[0],a.once("GameResult",(function(e,t){!0===t.returnValues[0]?window.alert("You won!"):window.alert("You lost!")})),d(),await a.methods.lottery(t).send({from:s,value:n}),d(),o(),l()}()}),document.getElementById("amount-to-bet").addEventListener("input",(function(){const e=document.querySelector("#amount-to-bet").value;document.querySelector("#bet-in-dollar").innerText=(e*r).toFixed(2)})),document.querySelector(".test").addEventListener("click",d)}]); //# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/dist/main.js.map b/dist/main.js.map index cb23382..891e594 100644 --- a/dist/main.js.map +++ b/dist/main.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/main.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","headsOrTails","account","ethUsd","async","loadBlockchainData","networkId","web3","eth","net","getId","console","log","networkData","networks","Contract","abi","address","dappName","methods","getLatestGameData","getContractBalance","document","querySelector","innerText","window","alert","currentBalanceEth","getBalance","_address","innerHTML","toFixed","max","gameCount","getGameCount","td","content","querySelectorAll","gameEntry","getGameEntry","result","winner","guess","addressShortened","addr","slice","textContent","amountBet","ethInJackpot","tb","clone","importNode","appendChild","handleErrors","response","ok","Error","statusText","addEventListener","ethereum","Web3","enable","error","currentProvider","loadWeb3","fetch","then","res","json","data","USD","catch","getEthFiatRate","getElementById","event","preventDefault","getElementsByName","amountToBetEther","headsOrTailsSelection","amountToBetWei","utils","toWei","accounts","getAccounts","returnValue","once","returnValues","lottery","send","from","play"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,y7tIClFrD,kBAYA,IAAIC,EACAC,EACAC,EA+BJC,eAAeC,IAGb,MAAMC,QAAkBC,KAAKC,IAAIC,IAAIC,QACrCC,QAAQC,IAAIN,GACZ,MAAMO,EAAc,EAAaC,SAASR,GAE1C,GADAK,QAAQC,IAAIC,GACRA,EAAa,CACfF,QAAQC,IAAI,sDACZX,EAAe,IAAIM,KAAKC,IAAIO,SAAS,EAAaC,IAAKH,EAAYI,SACnEN,QAAQC,IAAIX,GAEZ,MAAMiB,QAAiBjB,EAAakB,QAAQ3C,OAAOJ,OACnDuC,QAAQC,IAAIM,GAEZE,IACAC,IAEAC,SAASC,cAAc,qBAAqBC,UAAYX,EAAYI,aAEpEQ,OAAOC,MAAM,0DA8BjBtB,eAAeiB,IACb,MAAMM,QAA0BpB,KAAKC,IAAIoB,WAAW3B,EAAa4B,UAAY,KAC7ElB,QAAQC,IAAI,2BAA6Be,GACzCL,SAASC,cAAc,mBAAmBO,UAAYH,EAAoB,WAAaA,EAAoBxB,GAAQ4B,QAAQ,GAAK,KAGhIT,SAASC,cAAc,kBAAkBS,IAAML,EAGjDvB,eAAegB,IACb,MAAMa,QAAkBhC,EAAakB,QAAQe,eAAe9D,OAG5DkD,SAASC,cAAc,eAAeO,UAAY,GAElD,IAAI3C,EAAImC,SAASC,cAAc,eAC3BY,EAAKhD,EAAEiD,QAAQC,iBAAiB,MAEpC,IAAK,IAAIpE,EAAIgE,EAAY,EAAGhE,GAAK,EAAGA,IAAK,CACvC,MAAMqE,QAAkBrC,EAAakB,QAAQoB,aAAatE,GAAGG,OAC7D,IAAIoE,EAASF,EAAUG,OAAS,MAAQ,OACpCC,EAA2B,GAAnBJ,EAAUI,MAAa,QAAU,QAE7C,MAAMC,EAAmBL,EAAUM,KAAKC,MAAM,EAAG,GAAK,MAAQP,EAAUM,KAAKC,OAAO,GACpFV,EAAG,GAAGW,YAAcH,EACpBR,EAAG,GAAGW,YAAcR,EAAUS,UAAY,KAAO,OACjDZ,EAAG,GAAGW,YAAcJ,EACpBP,EAAG,GAAGW,YAAcN,EACpBL,EAAG,GAAGW,YAAcR,EAAUU,aAAe,KAAO,OAEpD,IAAIC,EAAK3B,SAASC,cAAc,eAC5B2B,EAAQ5B,SAAS6B,WAAWhE,EAAEiD,SAAS,GAC3Ca,EAAGG,YAAYF,IAsBnB,SAASG,EAAaC,GAEpB,IAAKA,EAASC,GACZ,MAAMC,MAAMF,EAASG,YAEvB,OAAOH,EAvJT7B,OAAOiC,iBAAiB,OAaxBtD,iBAEE,GAAIqB,OAAOkC,SAAU,CACnBlC,OAAOlB,KAAO,IAAIqD,KAAKD,UACvB,UAEQA,SAASE,SACflD,QAAQC,IAAI,mCAEZP,IACA,MAAOyD,GACPnD,QAAQC,IAAI,6BAIPa,OAAOlB,MACdkB,OAAOlB,KAAO,IAAIqD,KAAKrD,KAAKwD,iBAC5BpD,QAAQC,IAAI,mCACZP,KAOAoB,OAAOC,MAAM,uEAtCesC,IAChCvC,OAAOiC,iBAAiB,OAiIxBtD,iBAEE6D,MADY,uEAETC,KAAKb,GACLa,KAAKC,GACGA,EAAIC,QAEZF,KAAKG,IACJ1D,QAAQC,IAAIyD,EAAKC,KACjBnE,EAASkE,EAAKC,MAGfC,MAAMT,GAASnD,QAAQmD,MAAMA,IA7IFU,IAChClD,SAASmD,eAAe,QAAQf,iBAAiB,SAAWgB,IAC1DA,EAAMC,iBA+DRvE,iBAEiBkB,SAASsD,kBAAkB,eAA1C,MACMC,EAAmBvD,SAASC,cAAc,kBAAkBrC,MAClE,IAAI4F,EAAwBxD,SAASC,cAAc,YAAYrC,MAE/DyB,QAAQC,IAAI,WAAakE,GACzBnE,QAAQC,IAAI,wBAA0BiE,GAEtC,MAAME,EAAiBtD,OAAOlB,KAAKyE,MAAMC,MAAMJ,EAAkB,SACjElE,QAAQC,IAAI,wBAA0BmE,GACtC,MAAMG,QAAiB3E,KAAKC,IAAI2E,cAOhC,IAAIC,EANJlF,EAAUgF,EAAS,GAGnBjF,EAAaoF,KAAK,cAAc,SAASvB,EAAOY,GAAQ/D,QAAQC,IAAI8D,EAAMY,iBAE1E3E,QAAQC,IAAIV,GAEZkF,QAAoBnF,EAAakB,QAAQoE,QAAQT,GAAuBU,KAAK,CAAEC,KAAMvF,EAAShB,MAAO6F,IACrGpE,QAAQC,IAAIwE,GAEZhE,IACAC,IArFAqE,KAEFpE,SAASmD,eAAe,iBAAiBf,iBAAiB,SAoJ1D,WACE,MAAMmB,EAAmBvD,SAASC,cAAc,kBAAkBrC,MAC9CoC,SAASC,cAAc,kBAG/BC,WAAaqD,EAAmB1E,GAAQ4B,QAAQ","file":"main.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","//import Web3 from \"web3\";//Bundle size of web3.js is huge (>1MB)! So once development is done only load the required modules, e.g. web3-eth\r\nimport HeadsOrTails from '../build/contracts/HeadsOrTails.json';\r\n\r\nwindow.addEventListener('load', loadWeb3());\r\nwindow.addEventListener('load', getEthFiatRate());\r\ndocument.getElementById(\"form\").addEventListener(\"submit\", (event) => {\r\n event.preventDefault();\r\n play();\r\n});\r\ndocument.getElementById(\"amount-to-bet\").addEventListener(\"input\", calcFiat);\r\n\r\n//Global variables\r\nlet headsOrTails;\r\nlet account;\r\nlet ethUsd;\r\n\r\nasync function loadWeb3() {\r\n // Modern dapp browsers...\r\n if (window.ethereum) {\r\n window.web3 = new Web3(ethereum);\r\n try {\r\n // Request account access if needed\r\n await ethereum.enable();\r\n console.log(\"User has a MODERN dapp browser!\");\r\n // Acccounts now exposed\r\n loadBlockchainData();\r\n } catch (error) {\r\n console.log(\"User denied access!\");\r\n }\r\n }\r\n // Legacy dapp browsers...\r\n else if (window.web3) {\r\n window.web3 = new Web3(web3.currentProvider);\r\n console.log(\"User has a LEGACY dapp browser!\");\r\n loadBlockchainData();\r\n // Acccounts always exposed\r\n //web3.eth.sendTransaction({/* ... */});\r\n }\r\n // Non-dapp browsers...\r\n else {\r\n //Load blockchain data (jackpot, last games) via Infura\r\n window.alert('Non-Ethereum browser detected. You should consider trying MetaMask!');\r\n }\r\n}\r\n\r\nasync function loadBlockchainData() {\r\n // Load account\r\n // const web3 = window.web3; //Was used at demo dapp. Not sure why.\r\n const networkId = await web3.eth.net.getId();\r\n console.log(networkId);\r\n const networkData = HeadsOrTails.networks[networkId];\r\n console.log(networkData);\r\n if (networkData) {\r\n console.log(\"HeadsOrTails contract is deployed to this network.\");\r\n headsOrTails = new web3.eth.Contract(HeadsOrTails.abi, networkData.address);\r\n console.log(headsOrTails);\r\n //Load variable from contract (just a test)\r\n const dappName = await headsOrTails.methods.name().call();\r\n console.log(dappName);\r\n //Populate table of last played games & Display amount of ETH in jackpot\r\n getLatestGameData();\r\n getContractBalance();\r\n //Show contract address\r\n document.querySelector(\".contract-address\").innerText = networkData.address;\r\n } else {\r\n window.alert('Marketplace contract not deployed to detected network.')\r\n }\r\n}\r\n\r\nasync function play() {\r\n //Find out which radio button is selected and how much money is bet.\r\n const radios = document.getElementsByName(\"ht-selector\");\r\n const amountToBetEther = document.querySelector(\"#amount-to-bet\").value;\r\n let headsOrTailsSelection = document.querySelector(\":checked\").value;\r\n\r\n console.log(\"0 or 1: \" + headsOrTailsSelection);\r\n console.log(\"Amount to bet (ETH): \" + amountToBetEther);\r\n\r\n const amountToBetWei = window.web3.utils.toWei(amountToBetEther, 'Ether');\r\n console.log(\"Amount to bet (Wei): \" + amountToBetWei);\r\n const accounts = await web3.eth.getAccounts();\r\n account = accounts[0];\r\n\r\n //test\r\n headsOrTails.once('GameResult', function(error, event){ console.log(event.returnValues); });\r\n\r\n console.log(account);\r\n let returnValue;\r\n returnValue = await headsOrTails.methods.lottery(headsOrTailsSelection).send({ from: account, value: amountToBetWei });\r\n console.log(returnValue);\r\n\r\n getLatestGameData();\r\n getContractBalance();\r\n}\r\n\r\nasync function getContractBalance() {\r\n const currentBalanceEth = await web3.eth.getBalance(headsOrTails._address) / 1e18;\r\n console.log(\"Contract balance (ETH): \" + currentBalanceEth);\r\n document.querySelector(\".eth-in-jackpot\").innerHTML = currentBalanceEth + \" ETH (~\" + (currentBalanceEth * ethUsd).toFixed(2) + \"$)\";\r\n\r\n //Set the max bet value to contract balance (i.e money in jackpot)\r\n document.querySelector(\"#amount-to-bet\").max = currentBalanceEth;\r\n}\r\n\r\nasync function getLatestGameData() {\r\n const gameCount = await headsOrTails.methods.getGameCount().call();\r\n // console.log(gameCount);\r\n //Purge table before populating\r\n document.querySelector(\"#table-body\").innerHTML = \"\";\r\n //Populate table\r\n let t = document.querySelector('#productrow');\r\n let td = t.content.querySelectorAll(\"td\");\r\n const maxEntriesToDisplay = 3;\r\n for (let i = gameCount - 1; i >= 0; i--) {\r\n const gameEntry = await headsOrTails.methods.getGameEntry(i).call();\r\n let result = gameEntry.winner ? \"Won\" : \"Lost\";\r\n let guess = gameEntry.guess == 0 ? \"Heads\" : \"Tails\";\r\n //Shorten player address\r\n const addressShortened = gameEntry.addr.slice(0, 3) + \"...\" + gameEntry.addr.slice(-3);\r\n td[0].textContent = addressShortened;\r\n td[1].textContent = gameEntry.amountBet / 1e18 + \" ETH\";\r\n td[2].textContent = guess;\r\n td[3].textContent = result;\r\n td[4].textContent = gameEntry.ethInJackpot / 1e18 + \" ETH\";\r\n\r\n let tb = document.querySelector(\"#table-body\");\r\n let clone = document.importNode(t.content, true);\r\n tb.appendChild(clone);\r\n //Show only the last five games max\r\n // if (i <= gameCount - maxEntriesToDisplay) break;\r\n }\r\n}\r\n\r\nasync function getEthFiatRate() {\r\n const url = \"https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR\";\r\n fetch(url)\r\n .then(handleErrors)\r\n .then(res => {\r\n return res.json();\r\n })\r\n .then(data => {\r\n console.log(data.USD);\r\n ethUsd = data.USD;\r\n // return (data.EUR);\r\n })\r\n .catch(error => console.error(error));\r\n}\r\n\r\n//Handle errors from fetch operation\r\nfunction handleErrors(response) {\r\n //console.log(response);\r\n if (!response.ok) {\r\n throw Error(response.statusText);\r\n }\r\n return response;\r\n}\r\n\r\nfunction calcFiat() {\r\n const amountToBetEther = document.querySelector(\"#amount-to-bet\").value;\r\n const betInDollar = document.querySelector(\"#bet-in-dollar\");\r\n // console.log(amountToBetEther);\r\n // console.log(ethUsd);\r\n betInDollar.innerText = (amountToBetEther * ethUsd).toFixed(2);\r\n}"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/main.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","headsOrTails","account","ethUsd","async","loadBlockchainData","networkId","web3","eth","net","getId","console","log","networkData","networks","Contract","abi","address","dappName","methods","getLatestGameData","getContractBalance","document","querySelector","innerHTML","window","alert","currentBalanceEth","getBalance","_address","toFixed","max","gameCount","getGameCount","td","content","querySelectorAll","gameEntry","getGameEntry","result","winner","guess","addressShortened","addr","slice","textContent","amountBet","ethInJackpot","tb","clone","importNode","appendChild","handleErrors","response","ok","Error","statusText","toggleBlur","body","classList","toggle","addEventListener","ethereum","Web3","enable","error","currentProvider","loadWeb3","fetch","then","res","json","data","USD","catch","getEthFiatRate","getElementById","event","preventDefault","getElementsByName","amountToBetEther","headsOrTailsSelection","amountToBetWei","utils","toWei","accounts","getAccounts","once","returnValues","lottery","send","from","play","innerText"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,EAAmB,IAAI,IAAIM,KAAON,EAAOrB,EAAoBU,EAAEe,EAAIE,EAAK,SAASA,GAAO,OAAON,EAAMM,IAAQC,KAAK,KAAMD,IAC9I,OAAOF,GAIRzB,EAAoB6B,EAAI,SAAS1B,GAChC,IAAIS,EAAST,GAAUA,EAAOqB,WAC7B,WAAwB,OAAOrB,EAAgB,SAC/C,WAA8B,OAAOA,GAEtC,OADAH,EAAoBU,EAAEE,EAAQ,IAAKA,GAC5BA,GAIRZ,EAAoBa,EAAI,SAASiB,EAAQC,GAAY,OAAOjB,OAAOkB,UAAUC,eAAe1B,KAAKuB,EAAQC,IAGzG/B,EAAoBkC,EAAI,GAIjBlC,EAAoBA,EAAoBmC,EAAI,G,01uIClFrD,kBAYA,IAAIC,EACAC,EACAC,EA+BJC,eAAeC,IAGb,MAAMC,QAAkBC,KAAKC,IAAIC,IAAIC,QACrCC,QAAQC,IAAIN,GACZ,MAAMO,EAAc,EAAaC,SAASR,GAE1C,GADAK,QAAQC,IAAIC,GACRA,EAAa,CACfF,QAAQC,IAAI,sDACZX,EAAe,IAAIM,KAAKC,IAAIO,SAAS,EAAaC,IAAKH,EAAYI,SACnEN,QAAQC,IAAIX,GAEZ,MAAMiB,QAAiBjB,EAAakB,QAAQ3C,OAAOJ,OACnDuC,QAAQC,IAAIM,GAEZE,IACAC,IAEAC,SAASC,cAAc,qBAAqBC,UAAY,iDAAmDX,EAAYI,QAAU,KAAOJ,EAAYI,QAAU,YAE9JQ,OAAOC,MAAM,0DAmCjBtB,eAAeiB,IACb,MAAMM,QAA0BpB,KAAKC,IAAIoB,WAAW3B,EAAa4B,UAAY,KAC7ElB,QAAQC,IAAI,2BAA6Be,GACzCL,SAASC,cAAc,mBAAmBC,UAAYG,EAAoB,WAAaA,EAAoBxB,GAAQ2B,QAAQ,GAAK,KAGhIR,SAASC,cAAc,kBAAkBQ,IAAMJ,EAGjDvB,eAAegB,IACb,MAAMY,QAAkB/B,EAAakB,QAAQc,eAAe7D,OAG5DkD,SAASC,cAAc,eAAeC,UAAY,GAElD,IAAIrC,EAAImC,SAASC,cAAc,eAC3BW,EAAK/C,EAAEgD,QAAQC,iBAAiB,MAEpC,IAAK,IAAInE,EAAI+D,EAAY,EAAG/D,GAAK,EAAGA,IAAK,CACvC,MAAMoE,QAAkBpC,EAAakB,QAAQmB,aAAarE,GAAGG,OAC7D,IAAImE,EAASF,EAAUG,OAAS,MAAQ,OACpCC,EAA2B,GAAnBJ,EAAUI,MAAa,QAAU,QAE7C,MAAMC,EAAmBL,EAAUM,KAAKC,MAAM,EAAG,GAAK,MAAQP,EAAUM,KAAKC,OAAO,GACpFV,EAAG,GAAGW,YAAcH,EACpBR,EAAG,GAAGW,YAAcR,EAAUS,UAAY,KAAO,OACjDZ,EAAG,GAAGW,YAAcJ,EACpBP,EAAG,GAAGW,YAAcN,EACpBL,EAAG,GAAGW,YAAcR,EAAUU,aAAe,KAAO,OAEpD,IAAIC,EAAK1B,SAASC,cAAc,eAC5B0B,EAAQ3B,SAAS4B,WAAW/D,EAAEgD,SAAS,GAG3C,GAFAa,EAAGG,YAAYF,GAEXhF,GAAK+D,EAjBiB,EAiBgB,OAoB9C,SAASoB,EAAaC,GAEpB,IAAKA,EAASC,GACZ,MAAMC,MAAMF,EAASG,YAEvB,OAAOH,EAYT,SAASI,IAEPnC,SAASoC,KAAKC,UAAUC,OAAO,QA1KjCnC,OAAOoC,iBAAiB,OAaxBzD,iBAEE,GAAIqB,OAAOqC,SAAU,CACnBrC,OAAOlB,KAAO,IAAIwD,KAAKD,UACvB,UAEQA,SAASE,SACfrD,QAAQC,IAAI,mCAEZP,IACA,MAAO4D,GACPtD,QAAQC,IAAI,6BAIPa,OAAOlB,MACdkB,OAAOlB,KAAO,IAAIwD,KAAKxD,KAAK2D,iBAC5BvD,QAAQC,IAAI,mCACZP,KAOAoB,OAAOC,MAAM,uEAtCeyC,IAChC1C,OAAOoC,iBAAiB,OAsIxBzD,iBAEEgE,MADY,uEAETC,KAAKjB,GACLiB,KAAKC,GACGA,EAAIC,QAEZF,KAAKG,IACJ7D,QAAQC,IAAI4D,EAAKC,KACjBtE,EAASqE,EAAKC,MAGfC,MAAMT,GAAStD,QAAQsD,MAAMA,IAlJFU,IAChCrD,SAASsD,eAAe,QAAQf,iBAAiB,SAAWgB,IAC1DA,EAAMC,iBA+DR1E,iBAEiBkB,SAASyD,kBAAkB,eAA1C,MACMC,EAAmB1D,SAASC,cAAc,kBAAkBrC,MAClE,IAAI+F,EAAwB3D,SAASC,cAAc,YAAYrC,MAE/DyB,QAAQC,IAAI,WAAaqE,GACzBtE,QAAQC,IAAI,wBAA0BoE,GAEtC,MAAME,EAAiBzD,OAAOlB,KAAK4E,MAAMC,MAAMJ,EAAkB,SACjErE,QAAQC,IAAI,wBAA0BsE,GACtC,MAAMG,QAAiB9E,KAAKC,IAAI8E,cAChCpF,EAAUmF,EAAS,GAInBpF,EAAasF,KAAK,cAChB,SAAUtB,EAAOY,IACe,IAA1BA,EAAMW,aAAa,GAAa/D,OAAOC,MAAM,YAC5CD,OAAOC,MAAM,gBAItB+B,UACMxD,EAAakB,QAAQsE,QAAQR,GAAuBS,KAAK,CAAEC,KAAMzF,EAAShB,MAAOgG,IACvFzB,IAEArC,IACAC,IA1FAuE,KAEFtE,SAASsD,eAAe,iBAAiBf,iBAAiB,SAyJ1D,WACE,MAAMmB,EAAmB1D,SAASC,cAAc,kBAAkBrC,MAC9CoC,SAASC,cAAc,kBAG/BsE,WAAab,EAAmB7E,GAAQ2B,QAAQ,MAG9DR,SAASC,cAAc,SAASsC,iBAAiB,QAASJ","file":"main.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","//import Web3 from \"web3\";//Bundle size of web3.js is huge (>1MB)! So once development is done only load the required modules, e.g. web3-eth\r\nimport HeadsOrTails from '../build/contracts/HeadsOrTails.json';\r\n\r\nwindow.addEventListener('load', loadWeb3());\r\nwindow.addEventListener('load', getEthFiatRate());\r\ndocument.getElementById(\"form\").addEventListener(\"submit\", (event) => {\r\n event.preventDefault();\r\n play();\r\n});\r\ndocument.getElementById(\"amount-to-bet\").addEventListener(\"input\", calcFiat); //Calculate value in USD during input\r\n\r\n//Global variables\r\nlet headsOrTails;\r\nlet account;\r\nlet ethUsd;\r\n\r\nasync function loadWeb3() {\r\n // Modern dapp browsers...\r\n if (window.ethereum) {\r\n window.web3 = new Web3(ethereum);\r\n try {\r\n // Request account access if needed\r\n await ethereum.enable();\r\n console.log(\"User has a MODERN dapp browser!\");\r\n // Acccounts now exposed\r\n loadBlockchainData();\r\n } catch (error) {\r\n console.log(\"User denied access!\");\r\n }\r\n }\r\n // Legacy dapp browsers...\r\n else if (window.web3) {\r\n window.web3 = new Web3(web3.currentProvider);\r\n console.log(\"User has a LEGACY dapp browser!\");\r\n loadBlockchainData();\r\n // Acccounts always exposed\r\n //web3.eth.sendTransaction({/* ... */});\r\n }\r\n // Non-dapp browsers...\r\n else {\r\n //Load blockchain data (jackpot, last games) via Infura\r\n window.alert('Non-Ethereum browser detected. You should consider trying MetaMask!');\r\n }\r\n}\r\n\r\nasync function loadBlockchainData() {\r\n // Load account\r\n // const web3 = window.web3; //Was used at demo dapp. Not sure why.\r\n const networkId = await web3.eth.net.getId();\r\n console.log(networkId);\r\n const networkData = HeadsOrTails.networks[networkId];\r\n console.log(networkData);\r\n if (networkData) {\r\n console.log(\"HeadsOrTails contract is deployed to this network.\");\r\n headsOrTails = new web3.eth.Contract(HeadsOrTails.abi, networkData.address);\r\n console.log(headsOrTails);\r\n //Load variable from contract (just a test)\r\n const dappName = await headsOrTails.methods.name().call();\r\n console.log(dappName);\r\n //Populate table of last played games & Display amount of ETH in jackpot\r\n getLatestGameData();\r\n getContractBalance();\r\n //Show contract address\r\n document.querySelector(\".contract-address\").innerHTML = '' + networkData.address + '';\r\n } else {\r\n window.alert('Marketplace contract not deployed to detected network.')\r\n }\r\n}\r\n\r\nasync function play() {\r\n //Find out which radio button is selected and how much money is bet.\r\n const radios = document.getElementsByName(\"ht-selector\");\r\n const amountToBetEther = document.querySelector(\"#amount-to-bet\").value;\r\n let headsOrTailsSelection = document.querySelector(\":checked\").value;\r\n\r\n console.log(\"0 or 1: \" + headsOrTailsSelection);\r\n console.log(\"Amount to bet (ETH): \" + amountToBetEther);\r\n\r\n const amountToBetWei = window.web3.utils.toWei(amountToBetEther, 'Ether');\r\n console.log(\"Amount to bet (Wei): \" + amountToBetWei);\r\n const accounts = await web3.eth.getAccounts();\r\n account = accounts[0];\r\n // console.log(account);\r\n\r\n //Once the event \"GameResult\" is emitted from the smart contract, display game result.\r\n headsOrTails.once('GameResult',\r\n function (error, event) {\r\n if (event.returnValues[0] === true) window.alert(\"You won!\");\r\n else window.alert(\"You lost!\");\r\n // console.log(event.returnValues[0]);\r\n }\r\n );\r\n toggleBlur();\r\n await headsOrTails.methods.lottery(headsOrTailsSelection).send({ from: account, value: amountToBetWei });\r\n toggleBlur();\r\n\r\n getLatestGameData();\r\n getContractBalance();\r\n}\r\n\r\nasync function getContractBalance() {\r\n const currentBalanceEth = await web3.eth.getBalance(headsOrTails._address) / 1e18;\r\n console.log(\"Contract balance (ETH): \" + currentBalanceEth);\r\n document.querySelector(\".eth-in-jackpot\").innerHTML = currentBalanceEth + \" ETH (~\" + (currentBalanceEth * ethUsd).toFixed(2) + \"$)\";\r\n\r\n //Set the max bet value to contract balance (i.e money in jackpot)\r\n document.querySelector(\"#amount-to-bet\").max = currentBalanceEth;\r\n}\r\n\r\nasync function getLatestGameData() {\r\n const gameCount = await headsOrTails.methods.getGameCount().call();\r\n // console.log(gameCount);\r\n //Purge table before populating\r\n document.querySelector(\"#table-body\").innerHTML = \"\";\r\n //Populate table\r\n let t = document.querySelector('#productrow');\r\n let td = t.content.querySelectorAll(\"td\");\r\n const maxEntriesToDisplay = 3;\r\n for (let i = gameCount - 1; i >= 0; i--) {\r\n const gameEntry = await headsOrTails.methods.getGameEntry(i).call();\r\n let result = gameEntry.winner ? \"Won\" : \"Lost\";\r\n let guess = gameEntry.guess == 0 ? \"Heads\" : \"Tails\";\r\n //Shorten player address\r\n const addressShortened = gameEntry.addr.slice(0, 3) + \"...\" + gameEntry.addr.slice(-3);\r\n td[0].textContent = addressShortened;\r\n td[1].textContent = gameEntry.amountBet / 1e18 + \" ETH\";\r\n td[2].textContent = guess;\r\n td[3].textContent = result;\r\n td[4].textContent = gameEntry.ethInJackpot / 1e18 + \" ETH\";\r\n\r\n let tb = document.querySelector(\"#table-body\");\r\n let clone = document.importNode(t.content, true);\r\n tb.appendChild(clone);\r\n //Show only the last five games max\r\n if (i <= gameCount - maxEntriesToDisplay) break;\r\n }\r\n}\r\n\r\nasync function getEthFiatRate() {\r\n const url = \"https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD,EUR\";\r\n fetch(url)\r\n .then(handleErrors)\r\n .then(res => {\r\n return res.json();\r\n })\r\n .then(data => {\r\n console.log(data.USD);\r\n ethUsd = data.USD;\r\n // return (data.EUR);\r\n })\r\n .catch(error => console.error(error));\r\n}\r\n\r\n//Handle errors from fetch operation\r\nfunction handleErrors(response) {\r\n //console.log(response);\r\n if (!response.ok) {\r\n throw Error(response.statusText);\r\n }\r\n return response;\r\n}\r\n\r\nfunction calcFiat() {\r\n const amountToBetEther = document.querySelector(\"#amount-to-bet\").value;\r\n const betInDollar = document.querySelector(\"#bet-in-dollar\");\r\n // console.log(amountToBetEther);\r\n // console.log(ethUsd);\r\n betInDollar.innerText = (amountToBetEther * ethUsd).toFixed(2);\r\n}\r\n\r\ndocument.querySelector(\".test\").addEventListener(\"click\", toggleBlur);\r\nfunction toggleBlur() {\r\n // let blur = document.querySelector(\".wait\");\r\n document.body.classList.toggle(\"wait\");\r\n}"],"sourceRoot":""} \ No newline at end of file diff --git a/index.html b/index.html index 2a33da6..cf04ee9 100644 --- a/index.html +++ b/index.html @@ -50,10 +50,12 @@

Recent Games

- + + + + \ No newline at end of file diff --git a/main.css b/main.css new file mode 100644 index 0000000..3bc7d86 --- /dev/null +++ b/main.css @@ -0,0 +1,3 @@ +.wait { + filter: blur(2px); +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index ce4101f..bc267c9 100644 --- a/src/main.js +++ b/src/main.js @@ -7,7 +7,7 @@ document.getElementById("form").addEventListener("submit", (event) => { event.preventDefault(); play(); }); -document.getElementById("amount-to-bet").addEventListener("input", calcFiat); +document.getElementById("amount-to-bet").addEventListener("input", calcFiat); //Calculate value in USD during input //Global variables let headsOrTails; @@ -61,7 +61,7 @@ async function loadBlockchainData() { getLatestGameData(); getContractBalance(); //Show contract address - document.querySelector(".contract-address").innerText = networkData.address; + document.querySelector(".contract-address").innerHTML = '' + networkData.address + ''; } else { window.alert('Marketplace contract not deployed to detected network.') } @@ -80,14 +80,19 @@ async function play() { console.log("Amount to bet (Wei): " + amountToBetWei); const accounts = await web3.eth.getAccounts(); account = accounts[0]; - - //test - headsOrTails.once('GameResult', function(error, event){ console.log(event.returnValues); }); - - console.log(account); - let returnValue; - returnValue = await headsOrTails.methods.lottery(headsOrTailsSelection).send({ from: account, value: amountToBetWei }); - console.log(returnValue); + // console.log(account); + + //Once the event "GameResult" is emitted from the smart contract, display game result. + headsOrTails.once('GameResult', + function (error, event) { + let message = (event.returnValues[0] === true) ? "You won!" : "You lost!"; + window.alert(message); + // console.log(event.returnValues[0]); + } + ); + toggleBlur(); + await headsOrTails.methods.lottery(headsOrTailsSelection).send({ from: account, value: amountToBetWei }); + toggleBlur(); getLatestGameData(); getContractBalance(); @@ -127,7 +132,7 @@ async function getLatestGameData() { let clone = document.importNode(t.content, true); tb.appendChild(clone); //Show only the last five games max - // if (i <= gameCount - maxEntriesToDisplay) break; + if (i <= gameCount - maxEntriesToDisplay) break; } } @@ -161,4 +166,10 @@ function calcFiat() { // console.log(amountToBetEther); // console.log(ethUsd); betInDollar.innerText = (amountToBetEther * ethUsd).toFixed(2); +} + +document.querySelector(".test").addEventListener("click", toggleBlur); +function toggleBlur() { + // let blur = document.querySelector(".wait"); + document.body.classList.toggle("wait"); } \ No newline at end of file