text: exports.id = "main";
  exports.modules = {
  
  /***/ "./src/server/server.js":
  /*!******************************!*\
    !*** ./src/server/server.js ***!
    \******************************/
  /*! exports provided: default */
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
  
  "use strict";
  eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _build_contracts_FlightSuretyApp_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../build/contracts/FlightSuretyApp.json */ \"./build/contracts/FlightSuretyApp.json\");\nvar _build_contracts_FlightSuretyApp_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ../../build/contracts/FlightSuretyApp.json */ \"./build/contracts/FlightSuretyApp.json\", 1);\n/* harmony import */ var _config_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./config.json */ \"./src/server/config.json\");\nvar _config_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./config.json */ \"./src/server/config.json\", 1);\n/* harmony import */ var web3__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! web3 */ \"web3\");\n/* harmony import */ var web3__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(web3__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! express */ \"express\");\n/* harmony import */ var express__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(express__WEBPACK_IMPORTED_MODULE_3__);\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n\n\n\n\nvar config = _config_json__WEBPACK_IMPORTED_MODULE_1__['localhost'];\nvar web3 = new web3__WEBPACK_IMPORTED_MODULE_2___default.a(config.url);\nweb3.eth.defaultAccount = web3.eth.accounts[0];\nvar flightSuretyApp = new web3.eth.Contract(_build_contracts_FlightSuretyApp_json__WEBPACK_IMPORTED_MODULE_0__.abi, config.appAddress);\nvar statusCodes = [0, 10, 20, 30, 40, 50];\nvar oracleCount = config.oracleCount;\nvar oracleRegistered = false;\n\nfunction getRandomStatus() {\n  var randomIndex = Math.floor(Math.random() * 6);\n  return statusCodes[randomIndex];\n}\n\nfunction registerOracles() {\n  return _registerOracles.apply(this, arguments);\n}\n\nfunction _registerOracles() {\n  _registerOracles = _asyncToGenerator(\n  /*#__PURE__*/\n  regeneratorRuntime.mark(function _callee2() {\n    var accounts, oracleFee, a, result;\n    return regeneratorRuntime.wrap(function _callee2$(_context2) {\n      while (1) {\n        switch (_context2.prev = _context2.next) {\n          case 0:\n            _context2.next = 2;\n            return web3.eth.getAccounts();\n\n          case 2:\n            accounts = _context2.sent;\n            _context2.next = 5;\n            return flightSuretyApp.methods.REGISTRATION_FEE().call();\n\n          case 5:\n            oracleFee = _context2.sent;\n            a = 1;\n\n          case 7:\n            if (!(a <= oracleCount)) {\n              _context2.next = 17;\n              break;\n            }\n\n            _context2.next = 10;\n            return flightSuretyApp.methods.registerOracle().send({\n              from: accounts[a],\n              value: oracleFee,\n              gas: 4700000,\n              gasPrice: 8000000000\n            });\n\n          case 10:\n            _context2.next = 12;\n            return flightSuretyApp.methods.getOracle(accounts[a]).call();\n\n          case 12:\n            result = _context2.sent;\n            console.log(\"Oracle registred: \".concat(result[0], \", \").concat(result[1], \", \").concat(result[2]));\n\n          case 14:\n            a++;\n            _context2.next = 7;\n            break;\n\n          case 17:\n            oracleRegistered = true;\n\n          case 18:\n          case \"end\":\n            return _context2.stop();\n        }\n      }\n    }, _callee2);\n  }));\n  return _registerOracles.apply(this, arguments);\n}\n\nflightSuretyApp.events.OracleRequest({\n  fromBlock: 0\n},\n/*#__PURE__*/\nfunction () {\n  var _ref = _asyncToGenerator(\n  /*#__PURE__*/\n  regeneratorRuntime.mark(function _callee(error, event) {\n    var accounts, flightStatus, index, airline, flight, timestamp, a, result, i;\n    return regeneratorRuntime.wrap(function _callee$(_context) {\n      while (1) {\n        switch (_context.prev = _context.next) {\n          case 0:\n            if (!oracleRegistered) {\n              _context.next = 36;\n              break;\n            }\n\n            if (!error) {\n              _context.next = 5;\n              break;\n            }\n\n            console.log(error);\n            _context.next = 36;\n            break;\n\n          case 5:\n            _context.next = 7;\n            return web3.eth.getAccounts();\n\n          case 7:\n            accounts = _context.sent;\n            flightStatus = getRandomStatus();\n            index = event.returnValues.index;\n            airline = event.returnValues.airline;\n            flight = event.returnValues.flight;\n            timestamp = event.returnValues.timestamp;\n            console.log(\"flighStatus: \" + flightStatus);\n            console.log(event);\n            console.log(\"Event.returnValues: \" + event.returnValues);\n            console.log(\"Event.returnValues.index: \" + index);\n            console.log(\"Event.returnValues.airline: \" + airline);\n            console.log(\"Event.returnValues.flight: \" + flight);\n            console.log(\"Event.returnValues.timestamp: \" + timestamp);\n            a = 1;\n\n          case 21:\n            if (!(a <= oracleCount)) {\n              _context.next = 36;\n              break;\n            }\n\n            _context.next = 24;\n            return flightSuretyApp.methods.getOracle(accounts[a]).call();\n\n          case 24:\n            result = _context.sent;\n            i = 0;\n\n          case 26:\n            if (!(i < result.length)) {\n              _context.next = 33;\n              break;\n            }\n\n            if (!(result[i] == index)) {\n              _context.next = 30;\n              break;\n            }\n\n            _context.next = 30;\n            return flightSuretyApp.methods.submitOracleResponse(index, airline, flight, timestamp, flightStatus).call({\n              from: accounts[a]\n            });\n\n          case 30:\n            i++;\n            _context.next = 26;\n            break;\n\n          case 33:\n            a++;\n            _context.next = 21;\n            break;\n\n          case 36:\n          case \"end\":\n            return _context.stop();\n        }\n      }\n    }, _callee);\n  }));\n\n  return function (_x, _x2) {\n    return _ref.apply(this, arguments);\n  };\n}());\nvar app = express__WEBPACK_IMPORTED_MODULE_3___default()();\napp.get('/api', function (req, res) {\n  res.send({\n    message: 'An API for use with your Dapp!'\n  });\n}); // console.log('********* test *********');\n\nregisterOracles().then(function () {\n  console.log(\"** registerOracles called **\");\n})[\"catch\"](function (error) {\n  console.log(\"Error: \" + error);\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = (app);\n\n//# sourceURL=webpack:///./src/server/server.js?");
  
  /***/ })
  
  };