From 6aec7a42f1f0f2fc518378dd02942a329a72d96f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2020 01:03:21 +0000 Subject: [PATCH 01/19] Bump ts-node from 8.10.2 to 9.0.0 Bumps [ts-node](https://github.com/TypeStrong/ts-node) from 8.10.2 to 9.0.0. - [Release notes](https://github.com/TypeStrong/ts-node/releases) - [Commits](https://github.com/TypeStrong/ts-node/compare/v8.10.2...v9.0.0) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a368e749..c58c7b6d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9429,9 +9429,9 @@ } }, "ts-node": { - "version": "8.10.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.10.2.tgz", - "integrity": "sha512-ISJJGgkIpDdBhWVu3jufsWpK3Rzo7bdiIXJjQc0ynKxVOVcg2oIrf2H2cejminGrptVc6q6/uynAHNCuWGbpVA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-9.0.0.tgz", + "integrity": "sha512-/TqB4SnererCDR/vb4S/QvSZvzQMJN8daAslg7MeaiHvD8rDZsSfXmNeNumyZZzMned72Xoq/isQljYSt8Ynfg==", "dev": true, "requires": { "arg": "^4.1.0", diff --git a/package.json b/package.json index 93b9cb706..d4d891d8a 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "ora": "^5.0.0", "prettier": "^2.0.5", "source-map-support": "^0.5.19", - "ts-node": "^8.10.2", + "ts-node": "^9.0.0", "ts-node-register": "^1.0.0", "typedoc": "^0.18.0", "typescript": "^4.0.2" From 6c1229d9620f7e3f204101f8e4903899c3f1c9fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2020 01:02:15 +0000 Subject: [PATCH 02/19] Bump whatwg-url from 8.1.0 to 8.2.1 Bumps [whatwg-url](https://github.com/jsdom/whatwg-url) from 8.1.0 to 8.2.1. - [Release notes](https://github.com/jsdom/whatwg-url/releases) - [Commits](https://github.com/jsdom/whatwg-url/compare/v8.1.0...v8.2.1) Signed-off-by: dependabot[bot] --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a368e749..2899e3cbf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10306,9 +10306,9 @@ } }, "webidl-conversions": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-5.0.0.tgz", - "integrity": "sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA==" + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", + "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" }, "websocket": { "version": "1.0.31", @@ -10329,13 +10329,13 @@ "dev": true }, "whatwg-url": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.1.0.tgz", - "integrity": "sha512-vEIkwNi9Hqt4TV9RdnaBPNt+E2Sgmo3gePebCRgZ1R7g6d23+53zCTnuB0amKI4AXq6VM8jj2DUAa0S1vjJxkw==", + "version": "8.2.1", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.2.1.tgz", + "integrity": "sha512-ZmVCr6nfBeaMxEHALLEGy0LszYjpJqf6PVNQUQ1qd9Et+q7Jpygd4rGGDXgHjD8e99yLFseD69msHDM4YwPZ4A==", "requires": { "lodash.sortby": "^4.7.0", "tr46": "^2.0.2", - "webidl-conversions": "^5.0.0" + "webidl-conversions": "^6.1.0" } }, "which": { From 18d566a535692eb2178adaff3f86e03dee3e3d5d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2020 01:02:44 +0000 Subject: [PATCH 03/19] Bump @typescript-eslint/eslint-plugin from 3.9.1 to 3.10.1 Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 3.9.1 to 3.10.1. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v3.10.1/packages/eslint-plugin) Signed-off-by: dependabot[bot] --- package-lock.json | 52 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a368e749..1aa412650 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1475,12 +1475,12 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.9.1.tgz", - "integrity": "sha512-XIr+Mfv7i4paEdBf0JFdIl9/tVxyj+rlilWIfZ97Be0lZ7hPvUbS5iHt9Glc8kRI53dsr0PcAEudbf8rO2wGgg==", + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz", + "integrity": "sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "3.9.1", + "@typescript-eslint/experimental-utils": "3.10.1", "debug": "^4.1.1", "functional-red-black-tree": "^1.0.1", "regexpp": "^3.0.0", @@ -1488,6 +1488,50 @@ "tsutils": "^3.17.1" }, "dependencies": { + "@typescript-eslint/experimental-utils": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz", + "integrity": "sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/types": "3.10.1", + "@typescript-eslint/typescript-estree": "3.10.1", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/types": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.10.1.tgz", + "integrity": "sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz", + "integrity": "sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==", + "dev": true, + "requires": { + "@typescript-eslint/types": "3.10.1", + "@typescript-eslint/visitor-keys": "3.10.1", + "debug": "^4.1.1", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz", + "integrity": "sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", From 87fa9afaace7b97a02d65b77b18457d62300896e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2020 01:03:46 +0000 Subject: [PATCH 04/19] Bump prettier from 2.0.5 to 2.1.1 Bumps [prettier](https://github.com/prettier/prettier) from 2.0.5 to 2.1.1. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/master/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.0.5...2.1.1) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7b74d69e4..41209fc80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7887,9 +7887,9 @@ "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" }, "prettier": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", - "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz", + "integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==", "dev": true }, "prettier-linter-helpers": { From 0496826f2df650ad3c5d8cc218b2dd7d04cc759b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2020 01:04:24 +0000 Subject: [PATCH 05/19] Bump mocha from 8.1.1 to 8.1.2 Bumps [mocha](https://github.com/mochajs/mocha) from 8.1.1 to 8.1.2. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v8.1.1...v8.1.2) Signed-off-by: dependabot[bot] --- package-lock.json | 145 ++++++++++++++++++++-------------------------- 1 file changed, 63 insertions(+), 82 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7b74d69e4..ef3401fb1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2431,9 +2431,9 @@ } }, "chokidar": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.3.1.tgz", - "integrity": "sha512-4QYCEWOcK3OJrxwvyyAOxFuhpvOVCYkr33LPfFNBjAD/w3sEzWsp2BUOkI4l9bHvWioAd0rc6NlHUOEaWkTeqg==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", + "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", "dev": true, "requires": { "anymatch": "~3.1.1", @@ -2443,7 +2443,7 @@ "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.3.0" + "readdirp": "~3.4.0" }, "dependencies": { "normalize-path": { @@ -6518,64 +6518,12 @@ "dev": true }, "log-symbols": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", - "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", + "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", "dev": true, "requires": { - "chalk": "^2.4.2" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } + "chalk": "^4.0.0" } }, "loose-envify": { @@ -6868,23 +6816,23 @@ } }, "mocha": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.1.tgz", - "integrity": "sha512-p7FuGlYH8t7gaiodlFreseLxEmxTgvyG9RgPHODFPySNhwUehu8NIb0vdSt3WFckSneswZ0Un5typYcWElk7HQ==", + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.2.tgz", + "integrity": "sha512-I8FRAcuACNMLQn3lS4qeWLxXqLvGf6r2CaLstDpZmMUUSmvW6Cnm1AuHxgbc7ctZVRcfwspCRbDHymPsi3dkJw==", "dev": true, "requires": { "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", - "chokidar": "3.3.1", - "debug": "3.2.6", + "chokidar": "3.4.2", + "debug": "4.1.1", "diff": "4.0.2", - "escape-string-regexp": "1.0.5", - "find-up": "4.1.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", "glob": "7.1.6", "growl": "1.10.5", "he": "1.2.0", - "js-yaml": "3.13.1", - "log-symbols": "3.0.0", + "js-yaml": "3.14.0", + "log-symbols": "4.0.0", "minimatch": "3.0.4", "ms": "2.1.2", "object.assign": "4.1.0", @@ -6901,22 +6849,37 @@ }, "dependencies": { "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { "ms": "^2.1.1" } }, - "js-yaml": { - "version": "3.13.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", - "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" } }, "ms": { @@ -6925,6 +6888,24 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "p-limit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.0.2.tgz", + "integrity": "sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, "strip-json-comments": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", @@ -8212,12 +8193,12 @@ } }, "readdirp": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.3.0.tgz", - "integrity": "sha512-zz0pAkSPOXXm1viEwygWIPSPkcBYjW1xU5j/JBh5t9bGCJwa6f9+BJa6VaB2g+b55yVrmXzqkyLf4xaWYM0IkQ==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", + "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", "dev": true, "requires": { - "picomatch": "^2.0.7" + "picomatch": "^2.2.1" } }, "rechoir": { From d47a9f02a65342a682b904b28100ac376c61d290 Mon Sep 17 00:00:00 2001 From: ssallam Date: Thu, 27 Aug 2020 09:39:02 +0200 Subject: [PATCH 06/19] use solidity setup pool function when creating new pool. --- src/balancer/OceanPool.ts | 44 +++++++++++++++++++++---------------- src/balancer/Pool.ts | 46 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 21 deletions(-) diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index a9cb2493b..4d63cebd3 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -26,9 +26,10 @@ export class OceanPool extends Pool { /** * Create DataToken pool @param {String} account - * @param {String} token Data Token address - * @param {String} amount Data Token amount - * @param {String} weight Data Token weight + * @param {String} token DataToken address + * @param {String} amount DataToken amount + * @param {String} weight DataToken weight + * @param {String} fee Swap fee in Wei * @return {String} */ public async createDTPool( @@ -37,7 +38,6 @@ export class OceanPool extends Pool { amount: string, weight: string, fee: string, - finalize = true ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') @@ -50,22 +50,28 @@ export class OceanPool extends Pool { const address = await super.createPool(account) const oceanWeight = 10 - parseFloat(weight) const oceanAmount = (parseFloat(amount) * oceanWeight) / parseFloat(weight) - const tokens = [ - { - address: token, - amount: String(amount), - weight: String(weight) - }, - { - address: this.oceanAddress, - amount: String(oceanAmount), - weight: String(oceanWeight) - } - ] this.dtAddress = token - await super.addToPool(account, address, tokens) - await super.setSwapFee(account, address, fee) - if (finalize) await super.finalize(account, address) + + await this.approve( + account, + token, + address, + this.web3.utils.toWei(String(amount)) as any + ) + await this.approve( + account, + this.oceanAddress, + address, + this.web3.utils.toWei(String(oceanAmount)) as any + ) + + super.setup( + account, address, + token, String(amount), String(weight), + this.oceanAddress, String(oceanAmount), String(oceanWeight), + this.web3.utils.toWei(fee) + ) + return address } diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index 2c76f1940..a871a6a32 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -32,8 +32,50 @@ export class Pool extends PoolFactory { * Creates a new pool */ async createPool(account: string): Promise { - const pooladdress = await super.createPool(account) - return pooladdress + return await super.createPool(account) + } + + /** + * Setup a new pool by setting datatoken, base token, swap fee and + * finalizing the pool to make it public. + * + * @param account + * @param poolAddress + * @param dataToken + * @param dataTokenAmount + * @param dataTokenWeight + * @param baseToken + * @param baseTokenAmount + * @param baseTokenWeight + * @param swapFee + */ + async setup( + account: string, + poolAddress: string, + dataToken: string, + dataTokenAmount: string, + dataTokenWeight: string, + baseToken: string, + baseTokenAmount: string, + baseTokenWeight: string, + swapFee: string, + ): Promise { + const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { + from: account + }) + let result = null + try { + result = await pool.methods + .setup( + dataToken, dataTokenAmount, dataTokenWeight, + baseToken, baseTokenAmount, baseTokenWeight, + swapFee + ).send({ from: account, gas: this.GASLIMIT_DEFAULT }) + } catch (e) { + console.error(e) + } + return result + } /** From 7078113110526c9bbe2ed36d93eb500ce9e92480 Mon Sep 17 00:00:00 2001 From: ssallam Date: Thu, 27 Aug 2020 09:46:54 +0200 Subject: [PATCH 07/19] update method docs --- src/balancer/OceanPool.ts | 2 +- src/balancer/Pool.ts | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index 4d63cebd3..4b0b4c76c 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -29,7 +29,7 @@ export class OceanPool extends Pool { * @param {String} token DataToken address * @param {String} amount DataToken amount * @param {String} weight DataToken weight - * @param {String} fee Swap fee in Wei + * @param {String} fee Swap fee (as float) * @return {String} */ public async createDTPool( diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index a871a6a32..d4a87687f 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -39,15 +39,15 @@ export class Pool extends PoolFactory { * Setup a new pool by setting datatoken, base token, swap fee and * finalizing the pool to make it public. * - * @param account - * @param poolAddress - * @param dataToken - * @param dataTokenAmount - * @param dataTokenWeight - * @param baseToken - * @param baseTokenAmount - * @param baseTokenWeight - * @param swapFee + * @param {String} account ethereum address to use for sending this transaction + * @param {String} poolAddress address of new Balancer Pool + * @param {String} dataToken address of datatoken ERC20 contract + * @param {String} dataTokenAmount in wei + * @param {String} dataTokenWeight in wei + * @param {String} baseToken address of base token ERC20 contract + * @param {String} baseTokenAmount in wei + * @param {String} baseTokenWeight in wei + * @param {String} swapFee in wei */ async setup( account: string, From 8c7a701e6f3779bdf3a5db05507571f387c8d3dd Mon Sep 17 00:00:00 2001 From: ssallam Date: Thu, 27 Aug 2020 10:21:20 +0200 Subject: [PATCH 08/19] update ocean-contracts version to 0.3.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 93b9cb706..d4952dc64 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "dependencies": { "@ethereum-navigator/navigator": "^0.5.0", - "@oceanprotocol/contracts": "^0.3.4", + "@oceanprotocol/contracts": "^0.3.5", "decimal.js": "^10.2.0", "fs": "0.0.1-security", "node-fetch": "^2.6.0", From afa2996768d9b69b2811ada0aead40f08bfc1b64 Mon Sep 17 00:00:00 2001 From: ssallam Date: Thu, 27 Aug 2020 11:01:15 +0200 Subject: [PATCH 09/19] Convert amount and weight to wei, fix tests. --- src/balancer/OceanPool.ts | 6 +++--- src/balancer/Pool.ts | 2 +- test/unit/balancer/Balancer.test.ts | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index 4b0b4c76c..6bca604a6 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -65,10 +65,10 @@ export class OceanPool extends Pool { this.web3.utils.toWei(String(oceanAmount)) as any ) - super.setup( + await super.setup( account, address, - token, String(amount), String(weight), - this.oceanAddress, String(oceanAmount), String(oceanWeight), + token, this.web3.utils.toWei(String(amount)), this.web3.utils.toWei(String(weight)), + this.oceanAddress, this.web3.utils.toWei(String(oceanAmount)), this.web3.utils.toWei(String(oceanWeight)), this.web3.utils.toWei(fee) ) diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index d4a87687f..5c849abd5 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -72,7 +72,7 @@ export class Pool extends PoolFactory { swapFee ).send({ from: account, gas: this.GASLIMIT_DEFAULT }) } catch (e) { - console.error(e) + console.error('Pool.setup failed:' + e) } return result diff --git a/test/unit/balancer/Balancer.test.ts b/test/unit/balancer/Balancer.test.ts index c8cf83d0a..b719dffd2 100644 --- a/test/unit/balancer/Balancer.test.ts +++ b/test/unit/balancer/Balancer.test.ts @@ -109,7 +109,9 @@ describe('Balancer flow', () => { }) it('Alice creates a new OceanPool pool', async () => { /// new pool with total DT = 45 , dt weight=90% with swap fee 2% - alicePoolAddress = await Pool.createDTPool(alice, tokenAddress, 45, 9, '0.02') + alicePoolAddress = await Pool.createDTPool(alice, tokenAddress, '45', '9', '0.02') + assert(await Pool.totalSupply(alicePoolAddress) == 100) + assert(await Pool.getNumTokens(alice, alicePoolAddress) == 2) }) it('Get pool information', async () => { const currentTokens = await Pool.getCurrentTokens(alice, alicePoolAddress) From 5af50c4c9297c2b98124ae609ff61a0c32626958 Mon Sep 17 00:00:00 2001 From: ssallam Date: Thu, 27 Aug 2020 11:35:30 +0200 Subject: [PATCH 10/19] Fix lint issues. --- src/balancer/OceanPool.ts | 13 ++++++--- src/balancer/Pool.ts | 42 ++++++++++++++++------------- test/unit/balancer/Balancer.test.ts | 8 +++--- 3 files changed, 37 insertions(+), 26 deletions(-) diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index 6bca604a6..ff8efe360 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -37,7 +37,7 @@ export class OceanPool extends Pool { token: string, amount: string, weight: string, - fee: string, + fee: string ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') @@ -66,9 +66,14 @@ export class OceanPool extends Pool { ) await super.setup( - account, address, - token, this.web3.utils.toWei(String(amount)), this.web3.utils.toWei(String(weight)), - this.oceanAddress, this.web3.utils.toWei(String(oceanAmount)), this.web3.utils.toWei(String(oceanWeight)), + account, + address, + token, + this.web3.utils.toWei(String(amount)), + this.web3.utils.toWei(String(weight)), + this.oceanAddress, + this.web3.utils.toWei(String(oceanAmount)), + this.web3.utils.toWei(String(oceanWeight)), this.web3.utils.toWei(fee) ) diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index 5c849abd5..739ffa511 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -35,20 +35,20 @@ export class Pool extends PoolFactory { return await super.createPool(account) } - /** - * Setup a new pool by setting datatoken, base token, swap fee and - * finalizing the pool to make it public. - * - * @param {String} account ethereum address to use for sending this transaction - * @param {String} poolAddress address of new Balancer Pool - * @param {String} dataToken address of datatoken ERC20 contract - * @param {String} dataTokenAmount in wei - * @param {String} dataTokenWeight in wei - * @param {String} baseToken address of base token ERC20 contract - * @param {String} baseTokenAmount in wei - * @param {String} baseTokenWeight in wei - * @param {String} swapFee in wei - */ + /** + * Setup a new pool by setting datatoken, base token, swap fee and + * finalizing the pool to make it public. + * + * @param {String} account ethereum address to use for sending this transaction + * @param {String} poolAddress address of new Balancer Pool + * @param {String} dataToken address of datatoken ERC20 contract + * @param {String} dataTokenAmount in wei + * @param {String} dataTokenWeight in wei + * @param {String} baseToken address of base token ERC20 contract + * @param {String} baseTokenAmount in wei + * @param {String} baseTokenWeight in wei + * @param {String} swapFee in wei + */ async setup( account: string, poolAddress: string, @@ -58,7 +58,7 @@ export class Pool extends PoolFactory { baseToken: string, baseTokenAmount: string, baseTokenWeight: string, - swapFee: string, + swapFee: string ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account @@ -67,15 +67,19 @@ export class Pool extends PoolFactory { try { result = await pool.methods .setup( - dataToken, dataTokenAmount, dataTokenWeight, - baseToken, baseTokenAmount, baseTokenWeight, + dataToken, + dataTokenAmount, + dataTokenWeight, + baseToken, + baseTokenAmount, + baseTokenWeight, swapFee - ).send({ from: account, gas: this.GASLIMIT_DEFAULT }) + ) + .send({ from: account, gas: this.GASLIMIT_DEFAULT }) } catch (e) { console.error('Pool.setup failed:' + e) } return result - } /** diff --git a/test/unit/balancer/Balancer.test.ts b/test/unit/balancer/Balancer.test.ts index b719dffd2..d1cdefa26 100644 --- a/test/unit/balancer/Balancer.test.ts +++ b/test/unit/balancer/Balancer.test.ts @@ -105,13 +105,15 @@ describe('Balancer flow', () => { await oceandatatoken.mint(oceanTokenAddress, alice, tokenAmount) }) it('Alice transfers 200 ocean token to Bob', async () => { - const ts = await datatoken.transfer(oceanTokenAddress, bob, transferAmount, alice) + await datatoken.transfer(oceanTokenAddress, bob, transferAmount, alice) }) it('Alice creates a new OceanPool pool', async () => { /// new pool with total DT = 45 , dt weight=90% with swap fee 2% alicePoolAddress = await Pool.createDTPool(alice, tokenAddress, '45', '9', '0.02') - assert(await Pool.totalSupply(alicePoolAddress) == 100) - assert(await Pool.getNumTokens(alice, alicePoolAddress) == 2) + const s = await Pool.totalSupply(alicePoolAddress) + assert(String(s) === '100', 'totalSupply does not match: ' + s) + const n = await Pool.getNumTokens(alice, alicePoolAddress) + assert(String(n) === '2', 'unexpected num tokens: ' + n) }) it('Get pool information', async () => { const currentTokens = await Pool.getCurrentTokens(alice, alicePoolAddress) From 1c791c0ea3eadc235b12a0213c2eff1e8bd48f4c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2020 01:04:07 +0000 Subject: [PATCH 11/19] Bump @truffle/hdwallet-provider from 1.0.42 to 1.0.43 Bumps [@truffle/hdwallet-provider](https://github.com/trufflesuite/truffle) from 1.0.42 to 1.0.43. - [Release notes](https://github.com/trufflesuite/truffle/releases) - [Commits](https://github.com/trufflesuite/truffle/compare/@truffle/hdwallet-provider@1.0.42...@truffle/hdwallet-provider@1.0.43) Signed-off-by: dependabot[bot] --- package-lock.json | 73 ++--------------------------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc2e3e3aa..d148e45bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1036,9 +1036,9 @@ } }, "@truffle/hdwallet-provider": { - "version": "1.0.42", - "resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-1.0.42.tgz", - "integrity": "sha512-Q6+Pn6x9oLE0lTk72xC4V7il/UoI2i6dy8kSfh4xjYkE585SO9sc7ndXqX5K+epPolr7UAndEe7Lv6mHjiPmsQ==", + "version": "1.0.43", + "resolved": "https://registry.npmjs.org/@truffle/hdwallet-provider/-/hdwallet-provider-1.0.43.tgz", + "integrity": "sha512-BzHkHh5K096JycwhalAj2lO5ia6K422zegni17d4N2889jxNw7qdC4GhvofbTLpxkVkVFBLP37++x7mCSC7T5w==", "dev": true, "requires": { "@trufflesuite/web3-provider-engine": "15.0.13-1", @@ -1555,19 +1555,6 @@ } } }, - "@typescript-eslint/experimental-utils": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.1.tgz", - "integrity": "sha512-lkiZ8iBBaYoyEKhCkkw4SAeatXyBq9Ece5bZXdLe1LWBUwTszGbmbiqmQbwWA8cSYDnjWXp9eDbXpf9Sn0hLAg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/typescript-estree": "3.9.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - } - }, "@typescript-eslint/parser": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz", @@ -1648,60 +1635,6 @@ } } }, - "@typescript-eslint/types": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.1.tgz", - "integrity": "sha512-15JcTlNQE1BsYy5NBhctnEhEoctjXOjOK+Q+rk8ugC+WXU9rAcS2BYhoh6X4rOaXJEpIYDl+p7ix+A5U0BqPTw==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.1.tgz", - "integrity": "sha512-IqM0gfGxOmIKPhiHW/iyAEXwSVqMmR2wJ9uXHNdFpqVvPaQ3dWg302vW127sBpAiqM9SfHhyS40NKLsoMpN2KA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/visitor-keys": "3.9.1", - "debug": "^4.1.1", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true - } - } - }, - "@typescript-eslint/visitor-keys": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.1.tgz", - "integrity": "sha512-zxdtUjeoSh+prCpogswMwVUJfEFmCOjdzK9rpNjNBfm6EyPt99x3RrJoBOGZO23FCt0WPKUCOL5mb/9D5LjdwQ==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, "abstract-leveldown": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz", From b805f49bbccd88562d386987d7d3e5f82ace178a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2020 01:04:46 +0000 Subject: [PATCH 12/19] Bump @types/node from 14.6.0 to 14.6.1 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.6.0 to 14.6.1. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot[bot] --- package-lock.json | 73 ++--------------------------------------------- 1 file changed, 3 insertions(+), 70 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc2e3e3aa..3d3154b3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1405,9 +1405,9 @@ "dev": true }, "@types/node": { - "version": "14.6.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.0.tgz", - "integrity": "sha512-mikldZQitV94akrc4sCcSjtJfsTKt4p+e/s0AGscVA6XArQ9kFclP+ZiYUMnq987rc6QlYxXv/EivqlfSLxpKA==" + "version": "14.6.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.1.tgz", + "integrity": "sha512-HnYlg/BRF8uC1FyKRFZwRaCPTPYKa+6I8QiUZFLredaGOou481cgFS4wKRFyKvQtX8xudqkSdBczJHIYSQYKrQ==" }, "@types/node-fetch": { "version": "2.5.7", @@ -1555,19 +1555,6 @@ } } }, - "@typescript-eslint/experimental-utils": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.9.1.tgz", - "integrity": "sha512-lkiZ8iBBaYoyEKhCkkw4SAeatXyBq9Ece5bZXdLe1LWBUwTszGbmbiqmQbwWA8cSYDnjWXp9eDbXpf9Sn0hLAg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/typescript-estree": "3.9.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - } - }, "@typescript-eslint/parser": { "version": "3.10.1", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz", @@ -1648,60 +1635,6 @@ } } }, - "@typescript-eslint/types": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.9.1.tgz", - "integrity": "sha512-15JcTlNQE1BsYy5NBhctnEhEoctjXOjOK+Q+rk8ugC+WXU9rAcS2BYhoh6X4rOaXJEpIYDl+p7ix+A5U0BqPTw==", - "dev": true - }, - "@typescript-eslint/typescript-estree": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.9.1.tgz", - "integrity": "sha512-IqM0gfGxOmIKPhiHW/iyAEXwSVqMmR2wJ9uXHNdFpqVvPaQ3dWg302vW127sBpAiqM9SfHhyS40NKLsoMpN2KA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "3.9.1", - "@typescript-eslint/visitor-keys": "3.9.1", - "debug": "^4.1.1", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true - } - } - }, - "@typescript-eslint/visitor-keys": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.9.1.tgz", - "integrity": "sha512-zxdtUjeoSh+prCpogswMwVUJfEFmCOjdzK9rpNjNBfm6EyPt99x3RrJoBOGZO23FCt0WPKUCOL5mb/9D5LjdwQ==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" - } - }, "abstract-leveldown": { "version": "2.6.3", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.6.3.tgz", From 65840235704bdd9f2e0b07418e65addcc86849ba Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 28 Aug 2020 18:12:10 +0200 Subject: [PATCH 13/19] pool typings --- src/balancer/OceanPool.ts | 21 +++++++++++---------- src/balancer/Pool.ts | 29 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/balancer/OceanPool.ts b/src/balancer/OceanPool.ts index ff8efe360..8e08d4fca 100644 --- a/src/balancer/OceanPool.ts +++ b/src/balancer/OceanPool.ts @@ -1,5 +1,6 @@ import Web3 from 'web3' import { AbiItem } from 'web3-utils/types' +import { TransactionReceipt } from 'web3-core' import { Pool } from './Pool' /** @@ -170,7 +171,7 @@ export class OceanPool extends Pool { * @param {String} amount Data Token amount * @param {String} oceanAmount Ocean Token amount expected * @param {String} maxPrice Minimum price to sell - * @return {any} + * @return {TransactionReceipt} */ public async sellDT( account: string, @@ -178,7 +179,7 @@ export class OceanPool extends Pool { amount: string, oceanAmount: string, minPrice: string - ): Promise { + ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') return null @@ -200,13 +201,13 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Data Token amount - * @return {any} + * @return {TransactionReceipt} */ public async addDTLiquidity( account: string, poolAddress: string, amount: string - ): Promise { + ): Promise { await this.getDTAddress(account, poolAddress) await super.approve( account, @@ -229,14 +230,14 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Data Token amount - * @return {any} + * @return {TransactionReceipt} */ public async removeDTLiquidity( account: string, poolAddress: string, amount: string, maximumPoolShares: string - ): Promise { + ): Promise { await this.getDTAddress(account, poolAddress) // TODO Check balance of PoolShares before doing exit return this.exitswapExternAmountOut( @@ -253,13 +254,13 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Ocean Token amount in OCEAN - * @return {any} + * @return {TransactionReceipt} */ public async addOceanLiquidity( account: string, poolAddress: string, amount: string - ): Promise { + ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') return null @@ -285,14 +286,14 @@ export class OceanPool extends Pool { * @param {String} account * @param {String} poolAddress * @param {String} amount Ocean Token amount in OCEAN - * @return {any} + * @return {TransactionReceipt} */ public removeOceanLiquidity( account: string, poolAddress: string, amount: string, maximumPoolShares: string - ): Promise { + ): Promise { if (this.oceanAddress == null) { console.error('oceanAddress is not defined') return null diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index 739ffa511..5a0a315b2 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -1,5 +1,6 @@ import Web3 from 'web3' import { AbiItem } from 'web3-utils/types' +import { TransactionReceipt } from 'web3-core' import Decimal from 'decimal.js' import jsonpoolABI from '@oceanprotocol/contracts/artifacts/SPool.json' import { PoolFactory } from './PoolFactory' @@ -539,7 +540,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} minAmountOut will be converted to wei * @param {String} maxPrice will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async swapExactAmountIn( account: string, @@ -549,7 +550,7 @@ export class Pool extends PoolFactory { tokenOut: string, minAmountOut: string, maxPrice: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -579,7 +580,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} minAmountOut will be converted to wei * @param {String} maxPrice will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async swapExactAmountOut( account: string, @@ -589,7 +590,7 @@ export class Pool extends PoolFactory { tokenOut: string, minAmountOut: string, maxPrice: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -687,7 +688,7 @@ export class Pool extends PoolFactory { * @param {String} tokenIn * @param {String} tokenAmountIn will be converted to wei * @param {String} minPoolAmountOut will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async joinswapExternAmountIn( account: string, @@ -695,7 +696,7 @@ export class Pool extends PoolFactory { tokenIn: string, tokenAmountIn: string, minPoolAmountOut: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -721,7 +722,7 @@ export class Pool extends PoolFactory { * @param {String} tokenIn * @param {String} poolAmountOut will be converted to wei * @param {String} maxAmountIn will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async joinswapPoolAmountOut( account: string, @@ -729,7 +730,7 @@ export class Pool extends PoolFactory { tokenIn: string, poolAmountOut: string, maxAmountIn: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -755,7 +756,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} poolAmountIn will be converted to wei * @param {String} minTokenAmountOut will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async exitswapPoolAmountIn( account: string, @@ -763,7 +764,7 @@ export class Pool extends PoolFactory { tokenOut: string, poolAmountIn: string, minTokenAmountOut: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -789,7 +790,7 @@ export class Pool extends PoolFactory { * @param {String} tokenOut * @param {String} tokenAmountOut will be converted to wei * @param {String} maxPoolAmountIn will be converted to wei - * @return {any} + * @return {TransactionReceipt} */ async exitswapExternAmountOut( account: string, @@ -797,7 +798,7 @@ export class Pool extends PoolFactory { tokenOut: string, tokenAmountOut: string, maxPoolAmountIn: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) @@ -822,14 +823,14 @@ export class Pool extends PoolFactory { * @param {String} poolAddress * @param {String} tokenIn * @param {String} tokenOut - * @return {any} + * @return {String} */ async getSpotPrice( account: string, poolAddress: string, tokenIn: string, tokenOut: string - ): Promise { + ): Promise { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { from: account }) From a9a614f5868fd7ae533cac123acd82c64c8999ba Mon Sep 17 00:00:00 2001 From: Alex Coseru Date: Fri, 28 Aug 2020 19:16:15 +0300 Subject: [PATCH 14/19] fix sharesBalance fix sharesBalance --- src/balancer/Pool.ts | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index 739ffa511..f10ebe6ac 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -141,37 +141,10 @@ export class Pool extends PoolFactory { * @return {String} */ async sharesBalance(account: string, poolAddress: string): Promise { - const minABI = [ - { - constant: true, - inputs: [ - { - name: '_owner', - type: 'address' - } - ], - name: 'balanceOf', - outputs: [ - { - name: 'balance', - type: 'uint256' - } - ], - payable: false, - stateMutability: 'view', - type: 'function' - } - ] as AbiItem[] - let result = null - try { - const token = new this.web3.eth.Contract(minABI, poolAddress, { - from: account - }) - const balance = await token.methods - .balanceOf(account) - .call({ from: account, gas: this.GASLIMIT_DEFAULT }) + const token = new this.web3.eth.Contract(this.poolABI, poolAddress) + const balance = await token.methods.balanceOf(account) result = this.web3.utils.fromWei(balance) } catch (e) { console.error(e) From aca303acf3ba2225b912b3c5aba9b2b57d518247 Mon Sep 17 00:00:00 2001 From: Alex Coseru Date: Fri, 28 Aug 2020 19:29:41 +0300 Subject: [PATCH 15/19] Update Pool.ts --- src/balancer/Pool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index f10ebe6ac..a38bdd8c1 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -144,7 +144,7 @@ export class Pool extends PoolFactory { let result = null try { const token = new this.web3.eth.Contract(this.poolABI, poolAddress) - const balance = await token.methods.balanceOf(account) + const balance = await token.methods.balanceOf(account).call() result = this.web3.utils.fromWei(balance) } catch (e) { console.error(e) From e3209cb4fd2c61db3a2183f965767f21fcc1abcc Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Fri, 28 Aug 2020 18:40:26 +0200 Subject: [PATCH 16/19] Release 0.1.16 --- CHANGELOG.md | 22 +++++++++++++++++++++- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8659c5c9..b9a0a6ea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v0.1.16](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.1.15...v0.1.16) + +> 28 August 2020 + +- fix sharesBalance [`#235`](https://github.com/oceanprotocol/ocean-lib-js/pull/235) +- pool transaction typings [`#234`](https://github.com/oceanprotocol/ocean-lib-js/pull/234) +- Bump @truffle/hdwallet-provider from 1.0.42 to 1.0.43 [`#232`](https://github.com/oceanprotocol/ocean-lib-js/pull/232) +- Bump @types/node from 14.6.0 to 14.6.1 [`#233`](https://github.com/oceanprotocol/ocean-lib-js/pull/233) +- feature/setup-pool [`#230`](https://github.com/oceanprotocol/ocean-lib-js/pull/230) +- Bump ts-node from 8.10.2 to 9.0.0 [`#220`](https://github.com/oceanprotocol/ocean-lib-js/pull/220) +- Bump whatwg-url from 8.1.0 to 8.2.1 [`#225`](https://github.com/oceanprotocol/ocean-lib-js/pull/225) +- Bump @typescript-eslint/eslint-plugin from 3.9.1 to 3.10.1 [`#226`](https://github.com/oceanprotocol/ocean-lib-js/pull/226) +- Bump mocha from 8.1.1 to 8.1.2 [`#229`](https://github.com/oceanprotocol/ocean-lib-js/pull/229) +- Bump prettier from 2.0.5 to 2.1.1 [`#228`](https://github.com/oceanprotocol/ocean-lib-js/pull/228) +- Bump @typescript-eslint/parser from 3.9.1 to 3.10.1 [`#227`](https://github.com/oceanprotocol/ocean-lib-js/pull/227) +- Bump typescript from 3.9.7 to 4.0.2 [`#219`](https://github.com/oceanprotocol/ocean-lib-js/pull/219) +- use solidity setup pool function when creating new pool. [`d47a9f0`](https://github.com/oceanprotocol/ocean-lib-js/commit/d47a9f02a65342a682b904b28100ac376c61d290) +- Fix lint issues. [`5af50c4`](https://github.com/oceanprotocol/ocean-lib-js/commit/5af50c4c9297c2b98124ae609ff61a0c32626958) +- pool typings [`6584023`](https://github.com/oceanprotocol/ocean-lib-js/commit/65840235704bdd9f2e0b07418e65addcc86849ba) + #### [v0.1.15](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.1.14...v0.1.15) > 20 August 2020 @@ -11,7 +31,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - add ocean.pool.totalSupply() [`#218`](https://github.com/oceanprotocol/ocean-lib-js/pull/218) - refactor [`af7964c`](https://github.com/oceanprotocol/ocean-lib-js/commit/af7964ca84394574fb78fece1ca75a6799746fc8) - simplification, make it work [`dee24e8`](https://github.com/oceanprotocol/ocean-lib-js/commit/dee24e87a3081373e055422702cff7633ad95131) -- add totalSupply unit test [`a3e43c1`](https://github.com/oceanprotocol/ocean-lib-js/commit/a3e43c157843907d377b7134a8b9067d3e28f581) +- Release 0.1.15 [`3607f49`](https://github.com/oceanprotocol/ocean-lib-js/commit/3607f49472352c11f14cfb95f5182f9c6254adfe) #### [v0.1.14](https://github.com/oceanprotocol/ocean-lib-js/compare/v0.1.13...v0.1.14) diff --git a/package-lock.json b/package-lock.json index dc37cea72..204583bbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@oceanprotocol/lib", - "version": "0.1.15", + "version": "0.1.16", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 00eb5d176..abf9b0cee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@oceanprotocol/lib", - "version": "0.1.15", + "version": "0.1.16", "description": "JavaScript client library for Ocean Protocol", "main": "./dist/node/lib.js", "typings": "./dist/node/lib.d.ts", From bd6393564b5155b0c6bdca1954b05866e2ce280c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 01:03:51 +0000 Subject: [PATCH 17/19] Bump typedoc from 0.18.0 to 0.19.0 Bumps [typedoc](https://github.com/TypeStrong/TypeDoc) from 0.18.0 to 0.19.0. - [Release notes](https://github.com/TypeStrong/TypeDoc/releases) - [Commits](https://github.com/TypeStrong/TypeDoc/compare/v0.18.0...v0.19.0) Signed-off-by: dependabot[bot] --- package-lock.json | 32 +++++++++++++++++++------------- package.json | 2 +- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index 204583bbc..881932947 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6525,9 +6525,9 @@ "dev": true }, "lunr": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz", - "integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==", + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", "dev": true }, "macos-release": { @@ -9547,21 +9547,21 @@ } }, "typedoc": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.18.0.tgz", - "integrity": "sha512-UgDQwapCGQCCdYhEQzQ+kGutmcedklilgUGf62Vw6RdI29u6FcfAXFQfRTiJEbf16aK3YnkB20ctQK1JusCRbA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.19.0.tgz", + "integrity": "sha512-Rn68JwgDDYyIWl3HXeSsLZcsvxd2anISjhKu64PvID7RETeS2Iwnc4cH60yqc8/N50Xo1d3MHPGYinCPhMMliQ==", "dev": true, "requires": { "fs-extra": "^9.0.1", "handlebars": "^4.7.6", "highlight.js": "^10.0.0", - "lodash": "^4.17.15", - "lunr": "^2.3.8", + "lodash": "^4.17.20", + "lunr": "^2.3.9", "marked": "^1.1.1", "minimatch": "^3.0.0", "progress": "^2.0.3", "shelljs": "^0.8.4", - "typedoc-default-themes": "^0.10.2" + "typedoc-default-themes": "^0.11.1" }, "dependencies": { "fs-extra": { @@ -9586,6 +9586,12 @@ "universalify": "^1.0.0" } }, + "lodash": { + "version": "4.17.20", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", + "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "dev": true + }, "universalify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-1.0.0.tgz", @@ -9595,12 +9601,12 @@ } }, "typedoc-default-themes": { - "version": "0.10.2", - "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.10.2.tgz", - "integrity": "sha512-zo09yRj+xwLFE3hyhJeVHWRSPuKEIAsFK5r2u47KL/HBKqpwdUSanoaz5L34IKiSATFrjG5ywmIu98hPVMfxZg==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/typedoc-default-themes/-/typedoc-default-themes-0.11.1.tgz", + "integrity": "sha512-1yl8pbhjrLywqGJx9TfT+wzP+ntudPYjgJdpCj+s5ed2etBkqZPOCBMKwpaN9o6pdoFQF195PggqWTLVEkaRQQ==", "dev": true, "requires": { - "lunr": "^2.3.8" + "lunr": "^2.3.9" } }, "typescript": { diff --git a/package.json b/package.json index abf9b0cee..9941bc81f 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "source-map-support": "^0.5.19", "ts-node": "^9.0.0", "ts-node-register": "^1.0.0", - "typedoc": "^0.18.0", + "typedoc": "^0.19.0", "typescript": "^4.0.2" }, "nyc": { From c7fc5cbe8997b8a7f421010e143ea7b6ee36b07c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 01:04:34 +0000 Subject: [PATCH 18/19] Bump mocha from 8.1.2 to 8.1.3 Bumps [mocha](https://github.com/mochajs/mocha) from 8.1.2 to 8.1.3. - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](https://github.com/mochajs/mocha/compare/v8.1.2...v8.1.3) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 204583bbc..9edd8e1ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6793,9 +6793,9 @@ } }, "mocha": { - "version": "8.1.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.2.tgz", - "integrity": "sha512-I8FRAcuACNMLQn3lS4qeWLxXqLvGf6r2CaLstDpZmMUUSmvW6Cnm1AuHxgbc7ctZVRcfwspCRbDHymPsi3dkJw==", + "version": "8.1.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.1.3.tgz", + "integrity": "sha512-ZbaYib4hT4PpF4bdSO2DohooKXIn4lDeiYqB+vTmCdr6l2woW0b6H3pf5x4sM5nwQMru9RvjjHYWVGltR50ZBw==", "dev": true, "requires": { "ansi-colors": "4.1.1", From fb0ef45d48c988df000701466c6582f3baf893bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 01:05:12 +0000 Subject: [PATCH 19/19] Bump @types/node from 14.6.1 to 14.6.2 Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 14.6.1 to 14.6.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node) Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 204583bbc..77445f851 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1405,9 +1405,9 @@ "dev": true }, "@types/node": { - "version": "14.6.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.1.tgz", - "integrity": "sha512-HnYlg/BRF8uC1FyKRFZwRaCPTPYKa+6I8QiUZFLredaGOou481cgFS4wKRFyKvQtX8xudqkSdBczJHIYSQYKrQ==" + "version": "14.6.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.2.tgz", + "integrity": "sha512-onlIwbaeqvZyniGPfdw/TEhKIh79pz66L1q06WUQqJLnAb6wbjvOtepLYTGHTqzdXgBYIE3ZdmqHDGsRsbBz7A==" }, "@types/node-fetch": { "version": "2.5.7",