From 5af50c4c9297c2b98124ae609ff61a0c32626958 Mon Sep 17 00:00:00 2001 From: ssallam Date: Thu, 27 Aug 2020 11:35:30 +0200 Subject: [PATCH] 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 6bca604a..ff8efe36 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 5c849abd..739ffa51 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 b719dffd..d1cdefa2 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)