diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-15 17:29:52 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 06:20:34 +0800 |
commit | b86248f13fcb8f326098252beee6ca557e0175e7 (patch) | |
tree | bce1634e6fa8f0bc1b40fd4d70f8bb31ce268c03 | |
parent | 427a29145d90070e8c67753e7f76c7b88322eefb (diff) | |
download | dexon-0x-contracts-b86248f13fcb8f326098252beee6ca557e0175e7.tar dexon-0x-contracts-b86248f13fcb8f326098252beee6ca557e0175e7.tar.gz dexon-0x-contracts-b86248f13fcb8f326098252beee6ca557e0175e7.tar.bz2 dexon-0x-contracts-b86248f13fcb8f326098252beee6ca557e0175e7.tar.lz dexon-0x-contracts-b86248f13fcb8f326098252beee6ca557e0175e7.tar.xz dexon-0x-contracts-b86248f13fcb8f326098252beee6ca557e0175e7.tar.zst dexon-0x-contracts-b86248f13fcb8f326098252beee6ca557e0175e7.zip |
Add CHANGELOG entries
-rw-r--r-- | packages/dev-utils/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/sol-compiler/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/sol-cov/CHANGELOG.json | 21 | ||||
-rw-r--r-- | packages/sol-resolver/CHANGELOG.json | 13 | ||||
-rw-r--r-- | packages/testnet-faucets/bin/server.js | 780 | ||||
-rw-r--r-- | packages/testnet-faucets/bin/server.js.map | 1 | ||||
-rw-r--r-- | packages/types/CHANGELOG.json | 4 | ||||
-rw-r--r-- | packages/utils/CHANGELOG.json | 9 |
8 files changed, 836 insertions, 0 deletions
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json index 3f70a93cc..72ecdbabb 100644 --- a/packages/dev-utils/CHANGELOG.json +++ b/packages/dev-utils/CHANGELOG.json @@ -3,6 +3,10 @@ "version": "0.4.2", "changes": [ { + "note": "Pass ZeroExArtifactsAdapter to CoverageSubprovider", + "pr": 589 + }, + { "note": "Move callbackErrorReporter over from 0x.js", "pr": 579 } diff --git a/packages/sol-compiler/CHANGELOG.json b/packages/sol-compiler/CHANGELOG.json index a1b53fb9e..35f2c6179 100644 --- a/packages/sol-compiler/CHANGELOG.json +++ b/packages/sol-compiler/CHANGELOG.json @@ -5,6 +5,10 @@ { "note": "Properly export the executable binary", "pr": 588 + }, + { + "note": "Add a possibility to define a solidity version to use", + "pr": 589 } ] }, diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 468957fe3..9c978df5a 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -1,5 +1,26 @@ [ { + "version": "0.1.0", + "changes": [ + { + "note": "Add artifact adapter as a parameter for CoverageSubprovider. Export AbstractArtifactAdapter", + "pr": 589 + }, + { + "note": "Implement ZeroExArtiactAdapter and TruffleArtifactAdapter", + "pr": 589 + }, + { + "note": "Properly parse multi-level traces", + "pr": 589 + }, + { + "note": "Add support for solidity libraries", + "pr": 589 + } + ] + }, + { "timestamp": 1525477860, "version": "0.0.10", "changes": [ diff --git a/packages/sol-resolver/CHANGELOG.json b/packages/sol-resolver/CHANGELOG.json index 0126fa170..eb52d85e0 100644 --- a/packages/sol-resolver/CHANGELOG.json +++ b/packages/sol-resolver/CHANGELOG.json @@ -1,5 +1,18 @@ [ { + "version": "0.0.5", + "changes": [ + { + "note": "Fix a bug in FsResolver trying to read directories as files", + "pr": 589 + }, + { + "note": "Fix a bug in NameResolver not ignoring .sol files", + "pr": 589 + } + ] + }, + { "timestamp": 1525477860, "version": "0.0.4", "changes": [ diff --git a/packages/testnet-faucets/bin/server.js b/packages/testnet-faucets/bin/server.js new file mode 100644 index 000000000..bee332843 --- /dev/null +++ b/packages/testnet-faucets/bin/server.js @@ -0,0 +1,780 @@ +require("source-map-support").install(); +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 6); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports) { + +module.exports = require("@0xproject/utils"); + +/***/ }), +/* 1 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.configs = {
+ DISPENSER_ADDRESS: process.env.DISPENSER_ADDRESS.toLowerCase(),
+ DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY,
+ ENVIRONMENT: process.env.FAUCET_ENVIRONMENT,
+ INFURA_API_KEY: process.env.INFURA_API_KEY,
+ ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY,
+};
+ + +/***/ }), +/* 2 */ +/***/ (function(module, exports) { + +module.exports = require("lodash"); + +/***/ }), +/* 3 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [0, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var utils_1 = __webpack_require__(0);
+var rollbar = __webpack_require__(10);
+var configs_1 = __webpack_require__(1);
+exports.errorReporter = {
+ setup: function () {
+ var _this = this;
+ rollbar.init(configs_1.configs.ROLLBAR_ACCESS_KEY, {
+ environment: configs_1.configs.ENVIRONMENT,
+ });
+ rollbar.handleUncaughtExceptions(configs_1.configs.ROLLBAR_ACCESS_KEY);
+ process.on('unhandledRejection', function (err) { return __awaiter(_this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ utils_1.logUtils.log("Uncaught exception " + err + ". Stack: " + err.stack);
+ return [4 /*yield*/, this.reportAsync(err)];
+ case 1:
+ _a.sent();
+ process.exit(1);
+ return [2 /*return*/];
+ }
+ });
+ }); });
+ },
+ reportAsync: function (err, req) {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ if (configs_1.configs.ENVIRONMENT === 'development') {
+ return [2 /*return*/]; // Do not log development environment errors
+ }
+ return [2 /*return*/, new Promise(function (resolve, reject) {
+ rollbar.handleError(err, req, function (rollbarErr) {
+ if (rollbarErr) {
+ utils_1.logUtils.log("Error reporting to rollbar, ignoring: " + rollbarErr);
+ reject(rollbarErr);
+ }
+ else {
+ resolve();
+ }
+ });
+ })];
+ });
+ });
+ },
+ errorHandler: function () {
+ return rollbar.errorHandler(configs_1.configs.ROLLBAR_ACCESS_KEY);
+ },
+};
+ + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + +module.exports = require("0x.js"); + +/***/ }), +/* 5 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+Object.defineProperty(exports, "__esModule", { value: true });
+var configs_1 = __webpack_require__(1);
+var productionRpcUrls = {
+ '3': "https://ropsten.infura.io/" + configs_1.configs.INFURA_API_KEY,
+ '4': "https://rinkeby.infura.io/" + configs_1.configs.INFURA_API_KEY,
+ '42': "https://kovan.infura.io/" + configs_1.configs.INFURA_API_KEY,
+};
+var developmentRpcUrls = {
+ '50': 'http://127.0.0.1:8545',
+};
+exports.rpcUrls = configs_1.configs.ENVIRONMENT === 'development' ? developmentRpcUrls : productionRpcUrls;
+ + +/***/ }), +/* 6 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(7); + + +/***/ }), +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+Object.defineProperty(exports, "__esModule", { value: true });
+var bodyParser = __webpack_require__(8);
+var express = __webpack_require__(9);
+var error_reporter_1 = __webpack_require__(3);
+var handler_1 = __webpack_require__(11);
+var parameter_transformer_1 = __webpack_require__(18);
+// Setup the errorReporter to catch uncaught exceptions and unhandled rejections
+error_reporter_1.errorReporter.setup();
+var app = express();
+app.use(bodyParser.json()); // for parsing application/json
+app.use(function (req, res, next) {
+ res.header('Access-Control-Allow-Origin', '*');
+ res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
+ next();
+});
+var handler = new handler_1.Handler();
+app.get('/ping', function (req, res) {
+ res.status(200).send('pong');
+});
+app.get('/info', handler.getQueueInfo.bind(handler));
+app.get('/ether/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseEther.bind(handler));
+app.get('/zrx/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseZRX.bind(handler));
+app.get('/order/weth/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseWETHOrder.bind(handler));
+app.get('/order/zrx/:recipient', parameter_transformer_1.parameterTransformer.transform, handler.dispenseZRXOrder.bind(handler));
+// Log to rollbar any errors unhandled by handlers
+app.use(error_reporter_1.errorReporter.errorHandler());
+var port = process.env.PORT || 3000;
+app.listen(port);
+ + +/***/ }), +/* 8 */ +/***/ (function(module, exports) { + +module.exports = require("body-parser"); + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + +module.exports = require("express"); + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + +module.exports = require("rollbar"); + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+var __assign = (this && this.__assign) || Object.assign || function(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
+ t[p] = s[p];
+ }
+ return t;
+};
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [0, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var _0x_js_1 = __webpack_require__(4);
+var utils_1 = __webpack_require__(0);
+var _ = __webpack_require__(2);
+var Web3 = __webpack_require__(12);
+// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest
+// to know whether it is running in a browser or node environment. We need it to be undefined since
+// we are not running in a browser env.
+// Filed issue: https://github.com/ethereum/web3.js/issues/844
+global.XMLHttpRequest = undefined;
+var subproviders_1 = __webpack_require__(13);
+var ProviderEngine = __webpack_require__(14);
+var RpcSubprovider = __webpack_require__(15);
+var configs_1 = __webpack_require__(1);
+var dispatch_queue_1 = __webpack_require__(16);
+var dispense_asset_tasks_1 = __webpack_require__(17);
+var rpc_urls_1 = __webpack_require__(5);
+var RequestedAssetType;
+(function (RequestedAssetType) {
+ RequestedAssetType["ETH"] = "ETH";
+ RequestedAssetType["WETH"] = "WETH";
+ RequestedAssetType["ZRX"] = "ZRX";
+})(RequestedAssetType || (RequestedAssetType = {}));
+var FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable
+var Handler = /** @class */ (function () {
+ function Handler() {
+ var _this = this;
+ this._networkConfigByNetworkId = {};
+ _.forIn(rpc_urls_1.rpcUrls, function (rpcUrl, networkId) {
+ var providerObj = Handler._createProviderEngine(rpcUrl);
+ var web3 = new Web3(providerObj);
+ var zeroExConfig = {
+ networkId: +networkId,
+ };
+ var zeroEx = new _0x_js_1.ZeroEx(web3.currentProvider, zeroExConfig);
+ var dispatchQueue = new dispatch_queue_1.DispatchQueue();
+ _this._networkConfigByNetworkId[networkId] = {
+ dispatchQueue: dispatchQueue,
+ web3: web3,
+ zeroEx: zeroEx,
+ };
+ });
+ }
+ Handler._createProviderEngine = function (rpcUrl) {
+ if (_.isUndefined(configs_1.configs.DISPENSER_PRIVATE_KEY)) {
+ throw new Error('Dispenser Private key not found');
+ }
+ var engine = new ProviderEngine();
+ engine.addProvider(new subproviders_1.NonceTrackerSubprovider());
+ engine.addProvider(new subproviders_1.PrivateKeyWalletSubprovider(configs_1.configs.DISPENSER_PRIVATE_KEY));
+ engine.addProvider(new RpcSubprovider({
+ rpcUrl: rpcUrl,
+ }));
+ engine.start();
+ return engine;
+ };
+ Handler.prototype.getQueueInfo = function (req, res) {
+ var _this = this;
+ res.setHeader('Content-Type', 'application/json');
+ var queueInfo = _.mapValues(rpc_urls_1.rpcUrls, function (rpcUrl, networkId) {
+ var dispatchQueue = _this._networkConfigByNetworkId[networkId].dispatchQueue;
+ return {
+ full: dispatchQueue.isFull(),
+ size: dispatchQueue.size(),
+ };
+ });
+ var payload = JSON.stringify(queueInfo);
+ res.status(200).send(payload);
+ };
+ Handler.prototype.dispenseEther = function (req, res) {
+ this._dispenseAsset(req, res, RequestedAssetType.ETH);
+ };
+ Handler.prototype.dispenseZRX = function (req, res) {
+ this._dispenseAsset(req, res, RequestedAssetType.ZRX);
+ };
+ Handler.prototype.dispenseWETHOrder = function (req, res) {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0: return [4 /*yield*/, this._dispenseOrder(req, res, RequestedAssetType.WETH)];
+ case 1:
+ _a.sent();
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ Handler.prototype.dispenseZRXOrder = function (req, res, next) {
+ return __awaiter(this, void 0, void 0, function () {
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0: return [4 /*yield*/, this._dispenseOrder(req, res, RequestedAssetType.ZRX)];
+ case 1:
+ _a.sent();
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ Handler.prototype._dispenseAsset = function (req, res, requestedAssetType) {
+ var networkId = req.params.networkId;
+ var recipient = req.params.recipient;
+ var networkConfig = this._networkConfigByNetworkId[networkId];
+ var dispenserTask;
+ switch (requestedAssetType) {
+ case RequestedAssetType.ETH:
+ dispenserTask = dispense_asset_tasks_1.dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3);
+ break;
+ case RequestedAssetType.WETH:
+ case RequestedAssetType.ZRX:
+ dispenserTask = dispense_asset_tasks_1.dispenseAssetTasks.dispenseTokenTask(recipient, requestedAssetType, networkConfig.zeroEx);
+ break;
+ default:
+ throw new Error("Unsupported asset type: " + requestedAssetType);
+ }
+ var didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask);
+ if (!didAddToQueue) {
+ res.status(503).send('QUEUE_IS_FULL');
+ return;
+ }
+ utils_1.logUtils.log("Added " + recipient + " to queue: " + requestedAssetType + " networkId: " + networkId);
+ res.status(200).end();
+ };
+ Handler.prototype._dispenseOrder = function (req, res, requestedAssetType) {
+ return __awaiter(this, void 0, void 0, function () {
+ var networkConfig, zeroEx, makerToken, takerTokenSymbol, takerToken, makerTokenAmount, takerTokenAmount, order, orderHash, signature, signedOrder, signedOrderHash, payload;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId);
+ if (_.isUndefined(networkConfig)) {
+ res.status(400).send('UNSUPPORTED_NETWORK_ID');
+ return [2 /*return*/];
+ }
+ zeroEx = networkConfig.zeroEx;
+ res.setHeader('Content-Type', 'application/json');
+ return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType)];
+ case 1:
+ makerToken = _a.sent();
+ if (_.isUndefined(makerToken)) {
+ throw new Error("Unsupported asset type: " + requestedAssetType);
+ }
+ takerTokenSymbol = requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;
+ return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol)];
+ case 2:
+ takerToken = _a.sent();
+ if (_.isUndefined(takerToken)) {
+ throw new Error("Unsupported asset type: " + requestedAssetType);
+ }
+ makerTokenAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(0.1), makerToken.decimals);
+ takerTokenAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(0.1), takerToken.decimals);
+ order = {
+ maker: configs_1.configs.DISPENSER_ADDRESS,
+ taker: req.params.recipient,
+ makerFee: new utils_1.BigNumber(0),
+ takerFee: new utils_1.BigNumber(0),
+ makerTokenAmount: makerTokenAmount,
+ takerTokenAmount: takerTokenAmount,
+ makerTokenAddress: makerToken.address,
+ takerTokenAddress: takerToken.address,
+ salt: _0x_js_1.ZeroEx.generatePseudoRandomSalt(),
+ exchangeContractAddress: zeroEx.exchange.getContractAddress(),
+ feeRecipient: _0x_js_1.ZeroEx.NULL_ADDRESS,
+ expirationUnixTimestampSec: new utils_1.BigNumber(Date.now() + FIVE_DAYS_IN_MS),
+ };
+ orderHash = _0x_js_1.ZeroEx.getOrderHashHex(order);
+ return [4 /*yield*/, zeroEx.signOrderHashAsync(orderHash, configs_1.configs.DISPENSER_ADDRESS, false)];
+ case 3:
+ signature = _a.sent();
+ signedOrder = __assign({}, order, { ecSignature: signature });
+ signedOrderHash = _0x_js_1.ZeroEx.getOrderHashHex(signedOrder);
+ payload = JSON.stringify(signedOrder);
+ utils_1.logUtils.log("Dispensed signed order: " + payload);
+ res.status(200).send(payload);
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ return Handler;
+}());
+exports.Handler = Handler;
+ + +/***/ }), +/* 12 */ +/***/ (function(module, exports) { + +module.exports = require("web3"); + +/***/ }), +/* 13 */ +/***/ (function(module, exports) { + +module.exports = require("@0xproject/subproviders"); + +/***/ }), +/* 14 */ +/***/ (function(module, exports) { + +module.exports = require("web3-provider-engine"); + +/***/ }), +/* 15 */ +/***/ (function(module, exports) { + +module.exports = require("web3-provider-engine/subproviders/rpc"); + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [0, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var utils_1 = __webpack_require__(0);
+var _ = __webpack_require__(2);
+var error_reporter_1 = __webpack_require__(3);
+var MAX_QUEUE_SIZE = 500;
+var DEFAULT_QUEUE_INTERVAL_MS = 1000;
+var DispatchQueue = /** @class */ (function () {
+ function DispatchQueue() {
+ this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;
+ this._queue = [];
+ this._start();
+ }
+ DispatchQueue.prototype.add = function (taskAsync) {
+ if (this.isFull()) {
+ return false;
+ }
+ this._queue.push(taskAsync);
+ return true;
+ };
+ DispatchQueue.prototype.size = function () {
+ return this._queue.length;
+ };
+ DispatchQueue.prototype.isFull = function () {
+ return this.size() >= MAX_QUEUE_SIZE;
+ };
+ DispatchQueue.prototype.stop = function () {
+ if (!_.isUndefined(this._queueIntervalIdIfExists)) {
+ utils_1.intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists);
+ }
+ };
+ DispatchQueue.prototype._start = function () {
+ var _this = this;
+ this._queueIntervalIdIfExists = utils_1.intervalUtils.setAsyncExcludingInterval(function () { return __awaiter(_this, void 0, void 0, function () {
+ var taskAsync;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ taskAsync = this._queue.shift();
+ if (_.isUndefined(taskAsync)) {
+ return [2 /*return*/, Promise.resolve()];
+ }
+ return [4 /*yield*/, taskAsync()];
+ case 1:
+ _a.sent();
+ return [2 /*return*/];
+ }
+ });
+ }); }, this._queueIntervalMs, function (err) {
+ utils_1.logUtils.log("Unexpected err: " + err + " - " + JSON.stringify(err));
+ // tslint:disable-next-line:no-floating-promises
+ error_reporter_1.errorReporter.reportAsync(err);
+ });
+ };
+ return DispatchQueue;
+}());
+exports.DispatchQueue = DispatchQueue;
+ + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+};
+var __generator = (this && this.__generator) || function (thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [0, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+};
+Object.defineProperty(exports, "__esModule", { value: true });
+var _0x_js_1 = __webpack_require__(4);
+var utils_1 = __webpack_require__(0);
+var _ = __webpack_require__(2);
+var configs_1 = __webpack_require__(1);
+var DISPENSE_AMOUNT_ETHER = 0.1;
+var DISPENSE_AMOUNT_TOKEN = 0.1;
+var DISPENSE_MAX_AMOUNT_TOKEN = 2;
+var DISPENSE_MAX_AMOUNT_ETHER = 2;
+exports.dispenseAssetTasks = {
+ dispenseEtherTask: function (recipientAddress, web3) {
+ var _this = this;
+ return function () { return __awaiter(_this, void 0, void 0, function () {
+ var userBalance, maxAmountInWei, sendTransactionAsync, txHash;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ utils_1.logUtils.log("Processing ETH " + recipientAddress);
+ return [4 /*yield*/, utils_1.promisify(web3.eth.getBalance)(recipientAddress)];
+ case 1:
+ userBalance = _a.sent();
+ maxAmountInWei = new utils_1.BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether'));
+ if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {
+ utils_1.logUtils.log("User exceeded ETH balance maximum (" + maxAmountInWei + ") " + recipientAddress + " " + userBalance + " ");
+ return [2 /*return*/];
+ }
+ sendTransactionAsync = utils_1.promisify(web3.eth.sendTransaction);
+ return [4 /*yield*/, sendTransactionAsync({
+ from: configs_1.configs.DISPENSER_ADDRESS,
+ to: recipientAddress,
+ value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),
+ })];
+ case 2:
+ txHash = _a.sent();
+ utils_1.logUtils.log("Sent " + DISPENSE_AMOUNT_ETHER + " ETH to " + recipientAddress + " tx: " + txHash);
+ return [2 /*return*/];
+ }
+ });
+ }); };
+ },
+ dispenseTokenTask: function (recipientAddress, tokenSymbol, zeroEx) {
+ var _this = this;
+ return function () { return __awaiter(_this, void 0, void 0, function () {
+ var amountToDispense, token, baseUnitAmount, userBalanceBaseUnits, maxAmountBaseUnits, txHash;
+ return __generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ utils_1.logUtils.log("Processing " + tokenSymbol + " " + recipientAddress);
+ amountToDispense = new utils_1.BigNumber(DISPENSE_AMOUNT_TOKEN);
+ return [4 /*yield*/, zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol)];
+ case 1:
+ token = _a.sent();
+ if (_.isUndefined(token)) {
+ throw new Error("Unsupported asset type: " + tokenSymbol);
+ }
+ baseUnitAmount = _0x_js_1.ZeroEx.toBaseUnitAmount(amountToDispense, token.decimals);
+ return [4 /*yield*/, zeroEx.token.getBalanceAsync(token.address, recipientAddress)];
+ case 2:
+ userBalanceBaseUnits = _a.sent();
+ maxAmountBaseUnits = _0x_js_1.ZeroEx.toBaseUnitAmount(new utils_1.BigNumber(DISPENSE_MAX_AMOUNT_TOKEN), token.decimals);
+ if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {
+ utils_1.logUtils.log("User exceeded token balance maximum (" + maxAmountBaseUnits + ") " + recipientAddress + " " + userBalanceBaseUnits + " ");
+ return [2 /*return*/];
+ }
+ return [4 /*yield*/, zeroEx.token.transferAsync(token.address, configs_1.configs.DISPENSER_ADDRESS, recipientAddress, baseUnitAmount)];
+ case 3:
+ txHash = _a.sent();
+ utils_1.logUtils.log("Sent " + amountToDispense + " ZRX to " + recipientAddress + " tx: " + txHash);
+ return [2 /*return*/];
+ }
+ });
+ }); };
+ },
+};
+ + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +
+Object.defineProperty(exports, "__esModule", { value: true });
+var utils_1 = __webpack_require__(0);
+var _ = __webpack_require__(2);
+var rpc_urls_1 = __webpack_require__(5);
+var DEFAULT_NETWORK_ID = 42; // kovan
+exports.parameterTransformer = {
+ transform: function (req, res, next) {
+ var recipientAddress = req.params.recipient;
+ if (_.isUndefined(recipientAddress) || !utils_1.addressUtils.isAddress(recipientAddress)) {
+ res.status(400).send('INVALID_RECIPIENT_ADDRESS');
+ return;
+ }
+ var lowerCaseRecipientAddress = recipientAddress.toLowerCase();
+ req.params.recipient = lowerCaseRecipientAddress;
+ var networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID);
+ var rpcUrlIfExists = _.get(rpc_urls_1.rpcUrls, networkId);
+ if (_.isUndefined(rpcUrlIfExists)) {
+ res.status(400).send('UNSUPPORTED_NETWORK_ID');
+ return;
+ }
+ req.params.networkId = networkId;
+ next();
+ },
+};
+ + +/***/ }) +/******/ ]); +//# sourceMappingURL=server.js.map
\ No newline at end of file diff --git a/packages/testnet-faucets/bin/server.js.map b/packages/testnet-faucets/bin/server.js.map new file mode 100644 index 000000000..c8c227727 --- /dev/null +++ b/packages/testnet-faucets/bin/server.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["webpack:///webpack/bootstrap b91d2cee364b5e101d43","webpack:///external \"@0xproject/utils\"","webpack:///./src/ts/configs.ts","webpack:///external \"lodash\"","webpack:///./src/ts/error_reporter.ts","webpack:///external \"0x.js\"","webpack:///./src/ts/rpc_urls.ts","webpack:///./src/ts/server.ts","webpack:///external \"body-parser\"","webpack:///external \"express\"","webpack:///external \"rollbar\"","webpack:///./src/ts/handler.ts","webpack:///external \"web3\"","webpack:///external \"@0xproject/subproviders\"","webpack:///external \"web3-provider-engine\"","webpack:///external \"web3-provider-engine/subproviders/rpc\"","webpack:///./src/ts/dispatch_queue.ts","webpack:///./src/ts/dispense_asset_tasks.ts","webpack:///./src/ts/parameter_transformer.ts"],"names":[],"mappings":";;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA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CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,oBAAY,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC;YAC/E,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YAClD,MAAM,CAAC;QACX,CAAC;QACD,IAAM,yBAAyB,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC;QACjE,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,yBAAyB,CAAC;QACjD,IAAM,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,EAAE,kBAAkB,CAAC,CAAC;QACpE,IAAM,cAAc,GAAG,CAAC,CAAC,GAAG,CAAC,kBAAO,EAAE,SAAS,CAAC,CAAC;QACjD,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;YAChC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;YAC/C,MAAM,CAAC;QACX,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;QACjC,IAAI,EAAE,CAAC;IACX,CAAC;CACJ,CAAC","file":"server.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, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\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 \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 6);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap b91d2cee364b5e101d43","module.exports = require(\"@0xproject/utils\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/utils\"\n// module id = 0\n// module chunks = 0","export const configs = {\n DISPENSER_ADDRESS: (process.env.DISPENSER_ADDRESS as string).toLowerCase(),\n DISPENSER_PRIVATE_KEY: process.env.DISPENSER_PRIVATE_KEY,\n ENVIRONMENT: process.env.FAUCET_ENVIRONMENT,\n INFURA_API_KEY: process.env.INFURA_API_KEY,\n ROLLBAR_ACCESS_KEY: process.env.FAUCET_ROLLBAR_ACCESS_KEY,\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/configs.ts","module.exports = require(\"lodash\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"lodash\"\n// module id = 2\n// module chunks = 0","import { logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport rollbar = require('rollbar');\n\nimport { configs } from './configs';\n\nexport const errorReporter = {\n setup() {\n rollbar.init(configs.ROLLBAR_ACCESS_KEY, {\n environment: configs.ENVIRONMENT,\n });\n rollbar.handleUncaughtExceptions(configs.ROLLBAR_ACCESS_KEY);\n process.on('unhandledRejection', async (err: Error) => {\n logUtils.log(`Uncaught exception ${err}. Stack: ${err.stack}`);\n await this.reportAsync(err);\n process.exit(1);\n });\n },\n async reportAsync(err: Error, req?: express.Request): Promise<any> {\n if (configs.ENVIRONMENT === 'development') {\n return; // Do not log development environment errors\n }\n return new Promise((resolve, reject) => {\n rollbar.handleError(err, req, (rollbarErr: Error) => {\n if (rollbarErr) {\n logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);\n reject(rollbarErr);\n } else {\n resolve();\n }\n });\n });\n },\n errorHandler() {\n return rollbar.errorHandler(configs.ROLLBAR_ACCESS_KEY);\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/error_reporter.ts","module.exports = require(\"0x.js\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"0x.js\"\n// module id = 4\n// module chunks = 0","import { configs } from './configs';\n\nconst productionRpcUrls = {\n '3': `https://ropsten.infura.io/${configs.INFURA_API_KEY}`,\n '4': `https://rinkeby.infura.io/${configs.INFURA_API_KEY}`,\n '42': `https://kovan.infura.io/${configs.INFURA_API_KEY}`,\n};\n\nconst developmentRpcUrls = {\n '50': 'http://127.0.0.1:8545',\n};\n\nexport const rpcUrls = configs.ENVIRONMENT === 'development' ? developmentRpcUrls : productionRpcUrls;\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/rpc_urls.ts","import * as bodyParser from 'body-parser';\nimport * as express from 'express';\n\nimport { errorReporter } from './error_reporter';\nimport { Handler } from './handler';\nimport { parameterTransformer } from './parameter_transformer';\n\n// Setup the errorReporter to catch uncaught exceptions and unhandled rejections\nerrorReporter.setup();\n\nconst app = express();\napp.use(bodyParser.json()); // for parsing application/json\napp.use((req, res, next) => {\n res.header('Access-Control-Allow-Origin', '*');\n res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');\n next();\n});\n\nconst handler = new Handler();\napp.get('/ping', (req: express.Request, res: express.Response) => {\n res.status(200).send('pong');\n});\napp.get('/info', handler.getQueueInfo.bind(handler));\napp.get('/ether/:recipient', parameterTransformer.transform, handler.dispenseEther.bind(handler));\napp.get('/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRX.bind(handler));\napp.get('/order/weth/:recipient', parameterTransformer.transform, handler.dispenseWETHOrder.bind(handler));\napp.get('/order/zrx/:recipient', parameterTransformer.transform, handler.dispenseZRXOrder.bind(handler));\n\n// Log to rollbar any errors unhandled by handlers\napp.use(errorReporter.errorHandler());\nconst port = process.env.PORT || 3000;\napp.listen(port);\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/server.ts","module.exports = require(\"body-parser\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"body-parser\"\n// module id = 8\n// module chunks = 0","module.exports = require(\"express\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"express\"\n// module id = 9\n// module chunks = 0","module.exports = require(\"rollbar\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"rollbar\"\n// module id = 10\n// module chunks = 0","import { Order, SignedOrder, ZeroEx } from '0x.js';\nimport { BigNumber, logUtils } from '@0xproject/utils';\nimport * as express from 'express';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\n// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest\n// to know whether it is running in a browser or node environment. We need it to be undefined since\n// we are not running in a browser env.\n// Filed issue: https://github.com/ethereum/web3.js/issues/844\n(global as any).XMLHttpRequest = undefined;\nimport { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0xproject/subproviders';\nimport ProviderEngine = require('web3-provider-engine');\nimport RpcSubprovider = require('web3-provider-engine/subproviders/rpc');\n\nimport { configs } from './configs';\nimport { DispatchQueue } from './dispatch_queue';\nimport { dispenseAssetTasks } from './dispense_asset_tasks';\nimport { rpcUrls } from './rpc_urls';\n\ninterface NetworkConfig {\n dispatchQueue: DispatchQueue;\n web3: Web3;\n zeroEx: ZeroEx;\n}\n\ninterface ItemByNetworkId<T> {\n [networkId: string]: T;\n}\n\nenum RequestedAssetType {\n ETH = 'ETH',\n WETH = 'WETH',\n ZRX = 'ZRX',\n}\n\nconst FIVE_DAYS_IN_MS = 4.32e8; // TODO: make this configurable\n\nexport class Handler {\n private _networkConfigByNetworkId: ItemByNetworkId<NetworkConfig> = {};\n private static _createProviderEngine(rpcUrl: string) {\n if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) {\n throw new Error('Dispenser Private key not found');\n }\n const engine = new ProviderEngine();\n engine.addProvider(new NonceTrackerSubprovider());\n engine.addProvider(new PrivateKeyWalletSubprovider(configs.DISPENSER_PRIVATE_KEY));\n engine.addProvider(\n new RpcSubprovider({\n rpcUrl,\n }),\n );\n engine.start();\n return engine;\n }\n constructor() {\n _.forIn(rpcUrls, (rpcUrl: string, networkId: string) => {\n const providerObj = Handler._createProviderEngine(rpcUrl);\n const web3 = new Web3(providerObj);\n const zeroExConfig = {\n networkId: +networkId,\n };\n const zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig);\n const dispatchQueue = new DispatchQueue();\n this._networkConfigByNetworkId[networkId] = {\n dispatchQueue,\n web3,\n zeroEx,\n };\n });\n }\n public getQueueInfo(req: express.Request, res: express.Response) {\n res.setHeader('Content-Type', 'application/json');\n const queueInfo = _.mapValues(rpcUrls, (rpcUrl: string, networkId: string) => {\n const dispatchQueue = this._networkConfigByNetworkId[networkId].dispatchQueue;\n return {\n full: dispatchQueue.isFull(),\n size: dispatchQueue.size(),\n };\n });\n const payload = JSON.stringify(queueInfo);\n res.status(200).send(payload);\n }\n public dispenseEther(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ETH);\n }\n public dispenseZRX(req: express.Request, res: express.Response) {\n this._dispenseAsset(req, res, RequestedAssetType.ZRX);\n }\n public async dispenseWETHOrder(req: express.Request, res: express.Response) {\n await this._dispenseOrder(req, res, RequestedAssetType.WETH);\n }\n public async dispenseZRXOrder(req: express.Request, res: express.Response, next: express.NextFunction) {\n await this._dispenseOrder(req, res, RequestedAssetType.ZRX);\n }\n private _dispenseAsset(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkId = req.params.networkId;\n const recipient = req.params.recipient;\n const networkConfig = this._networkConfigByNetworkId[networkId];\n let dispenserTask;\n switch (requestedAssetType) {\n case RequestedAssetType.ETH:\n dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3);\n break;\n case RequestedAssetType.WETH:\n case RequestedAssetType.ZRX:\n dispenserTask = dispenseAssetTasks.dispenseTokenTask(\n recipient,\n requestedAssetType,\n networkConfig.zeroEx,\n );\n break;\n default:\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const didAddToQueue = networkConfig.dispatchQueue.add(dispenserTask);\n if (!didAddToQueue) {\n res.status(503).send('QUEUE_IS_FULL');\n return;\n }\n logUtils.log(`Added ${recipient} to queue: ${requestedAssetType} networkId: ${networkId}`);\n res.status(200).end();\n }\n private async _dispenseOrder(req: express.Request, res: express.Response, requestedAssetType: RequestedAssetType) {\n const networkConfig = _.get(this._networkConfigByNetworkId, req.params.networkId);\n if (_.isUndefined(networkConfig)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n const zeroEx = networkConfig.zeroEx;\n res.setHeader('Content-Type', 'application/json');\n const makerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(requestedAssetType);\n if (_.isUndefined(makerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const takerTokenSymbol =\n requestedAssetType === RequestedAssetType.WETH ? RequestedAssetType.ZRX : RequestedAssetType.WETH;\n const takerToken = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(takerTokenSymbol);\n if (_.isUndefined(takerToken)) {\n throw new Error(`Unsupported asset type: ${requestedAssetType}`);\n }\n const makerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), makerToken.decimals);\n const takerTokenAmount = ZeroEx.toBaseUnitAmount(new BigNumber(0.1), takerToken.decimals);\n const order: Order = {\n maker: configs.DISPENSER_ADDRESS,\n taker: req.params.recipient,\n makerFee: new BigNumber(0),\n takerFee: new BigNumber(0),\n makerTokenAmount,\n takerTokenAmount,\n makerTokenAddress: makerToken.address,\n takerTokenAddress: takerToken.address,\n salt: ZeroEx.generatePseudoRandomSalt(),\n exchangeContractAddress: zeroEx.exchange.getContractAddress(),\n feeRecipient: ZeroEx.NULL_ADDRESS,\n expirationUnixTimestampSec: new BigNumber(Date.now() + FIVE_DAYS_IN_MS),\n };\n const orderHash = ZeroEx.getOrderHashHex(order);\n const signature = await zeroEx.signOrderHashAsync(orderHash, configs.DISPENSER_ADDRESS, false);\n const signedOrder = {\n ...order,\n ecSignature: signature,\n };\n const signedOrderHash = ZeroEx.getOrderHashHex(signedOrder);\n const payload = JSON.stringify(signedOrder);\n logUtils.log(`Dispensed signed order: ${payload}`);\n res.status(200).send(payload);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/handler.ts","module.exports = require(\"web3\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3\"\n// module id = 12\n// module chunks = 0","module.exports = require(\"@0xproject/subproviders\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"@0xproject/subproviders\"\n// module id = 13\n// module chunks = 0","module.exports = require(\"web3-provider-engine\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine\"\n// module id = 14\n// module chunks = 0","module.exports = require(\"web3-provider-engine/subproviders/rpc\");\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"web3-provider-engine/subproviders/rpc\"\n// module id = 15\n// module chunks = 0","import { intervalUtils, logUtils } from '@0xproject/utils';\nimport * as _ from 'lodash';\n\nimport { errorReporter } from './error_reporter';\n\nconst MAX_QUEUE_SIZE = 500;\nconst DEFAULT_QUEUE_INTERVAL_MS = 1000;\n\nexport class DispatchQueue {\n private _queueIntervalMs: number;\n private _queue: Array<() => Promise<void>>;\n private _queueIntervalIdIfExists?: NodeJS.Timer;\n constructor() {\n this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;\n this._queue = [];\n this._start();\n }\n public add(taskAsync: () => Promise<void>): boolean {\n if (this.isFull()) {\n return false;\n }\n this._queue.push(taskAsync);\n return true;\n }\n public size(): number {\n return this._queue.length;\n }\n public isFull(): boolean {\n return this.size() >= MAX_QUEUE_SIZE;\n }\n public stop() {\n if (!_.isUndefined(this._queueIntervalIdIfExists)) {\n intervalUtils.clearAsyncExcludingInterval(this._queueIntervalIdIfExists);\n }\n }\n private _start() {\n this._queueIntervalIdIfExists = intervalUtils.setAsyncExcludingInterval(\n async () => {\n const taskAsync = this._queue.shift();\n if (_.isUndefined(taskAsync)) {\n return Promise.resolve();\n }\n await taskAsync();\n },\n this._queueIntervalMs,\n (err: Error) => {\n logUtils.log(`Unexpected err: ${err} - ${JSON.stringify(err)}`);\n // tslint:disable-next-line:no-floating-promises\n errorReporter.reportAsync(err);\n },\n );\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispatch_queue.ts","import { ZeroEx } from '0x.js';\nimport { BigNumber, logUtils, promisify } from '@0xproject/utils';\nimport * as _ from 'lodash';\nimport * as Web3 from 'web3';\n\nimport { configs } from './configs';\nimport { errorReporter } from './error_reporter';\n\nconst DISPENSE_AMOUNT_ETHER = 0.1;\nconst DISPENSE_AMOUNT_TOKEN = 0.1;\nconst DISPENSE_MAX_AMOUNT_TOKEN = 2;\nconst DISPENSE_MAX_AMOUNT_ETHER = 2;\n\nexport const dispenseAssetTasks = {\n dispenseEtherTask(recipientAddress: string, web3: Web3) {\n return async () => {\n logUtils.log(`Processing ETH ${recipientAddress}`);\n const userBalance = await promisify<BigNumber>(web3.eth.getBalance)(recipientAddress);\n const maxAmountInWei = new BigNumber(web3.toWei(DISPENSE_MAX_AMOUNT_ETHER, 'ether'));\n if (userBalance.greaterThanOrEqualTo(maxAmountInWei)) {\n logUtils.log(\n `User exceeded ETH balance maximum (${maxAmountInWei}) ${recipientAddress} ${userBalance} `,\n );\n return;\n }\n const sendTransactionAsync = promisify(web3.eth.sendTransaction);\n const txHash = await sendTransactionAsync({\n from: configs.DISPENSER_ADDRESS,\n to: recipientAddress,\n value: web3.toWei(DISPENSE_AMOUNT_ETHER, 'ether'),\n });\n logUtils.log(`Sent ${DISPENSE_AMOUNT_ETHER} ETH to ${recipientAddress} tx: ${txHash}`);\n };\n },\n dispenseTokenTask(recipientAddress: string, tokenSymbol: string, zeroEx: ZeroEx) {\n return async () => {\n logUtils.log(`Processing ${tokenSymbol} ${recipientAddress}`);\n const amountToDispense = new BigNumber(DISPENSE_AMOUNT_TOKEN);\n const token = await zeroEx.tokenRegistry.getTokenBySymbolIfExistsAsync(tokenSymbol);\n if (_.isUndefined(token)) {\n throw new Error(`Unsupported asset type: ${tokenSymbol}`);\n }\n const baseUnitAmount = ZeroEx.toBaseUnitAmount(amountToDispense, token.decimals);\n const userBalanceBaseUnits = await zeroEx.token.getBalanceAsync(token.address, recipientAddress);\n const maxAmountBaseUnits = ZeroEx.toBaseUnitAmount(\n new BigNumber(DISPENSE_MAX_AMOUNT_TOKEN),\n token.decimals,\n );\n if (userBalanceBaseUnits.greaterThanOrEqualTo(maxAmountBaseUnits)) {\n logUtils.log(\n `User exceeded token balance maximum (${maxAmountBaseUnits}) ${recipientAddress} ${userBalanceBaseUnits} `,\n );\n return;\n }\n const txHash = await zeroEx.token.transferAsync(\n token.address,\n configs.DISPENSER_ADDRESS,\n recipientAddress,\n baseUnitAmount,\n );\n logUtils.log(`Sent ${amountToDispense} ZRX to ${recipientAddress} tx: ${txHash}`);\n };\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/dispense_asset_tasks.ts","import { addressUtils } from '@0xproject/utils';\nimport { NextFunction, Request, Response } from 'express';\nimport * as _ from 'lodash';\n\nimport { configs } from './configs';\nimport { rpcUrls } from './rpc_urls';\n\nconst DEFAULT_NETWORK_ID = 42; // kovan\n\nexport const parameterTransformer = {\n transform(req: Request, res: Response, next: NextFunction) {\n const recipientAddress = req.params.recipient;\n if (_.isUndefined(recipientAddress) || !addressUtils.isAddress(recipientAddress)) {\n res.status(400).send('INVALID_RECIPIENT_ADDRESS');\n return;\n }\n const lowerCaseRecipientAddress = recipientAddress.toLowerCase();\n req.params.recipient = lowerCaseRecipientAddress;\n const networkId = _.get(req.query, 'networkId', DEFAULT_NETWORK_ID);\n const rpcUrlIfExists = _.get(rpcUrls, networkId);\n if (_.isUndefined(rpcUrlIfExists)) {\n res.status(400).send('UNSUPPORTED_NETWORK_ID');\n return;\n }\n req.params.networkId = networkId;\n next();\n },\n};\n\n\n\n// WEBPACK FOOTER //\n// ./src/ts/parameter_transformer.ts"],"sourceRoot":""}
\ No newline at end of file diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index afcfd862c..aef14fead 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -3,6 +3,10 @@ "version": "0.7.0", "changes": [ { + "note": "Make OpCode type an enum", + "pr": 589 + }, + { "note": "Moved ExchangeContractErrs, DoneCallback, Token, OrderRelevantState, OrderStateValid, OrderStateInvalid, OrderState, OrderAddresses and OrderValues types from 0x.js", "pr": 579 diff --git a/packages/utils/CHANGELOG.json b/packages/utils/CHANGELOG.json index d3c7da7b9..f447bdd1c 100644 --- a/packages/utils/CHANGELOG.json +++ b/packages/utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "version": "0.7.0", + "changes": [ + { + "note": "Add logUtils.warn", + "pr": 589 + } + ] + }, + { "timestamp": 1525477860, "version": "0.6.1", "changes": [ |