From efc4b8b521534be479fe2d764cf835b4da18277c Mon Sep 17 00:00:00 2001 From: "Miquel A. Cabot" Date: Tue, 14 Jun 2022 11:12:06 +0200 Subject: [PATCH] general renaming in SideStaking --- src/contracts/pools/SideStaking.ts | 102 +++++++++--------- .../pools/ssContracts/SideStaking.test.ts | 44 ++++---- 2 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/contracts/pools/SideStaking.ts b/src/contracts/pools/SideStaking.ts index dd62ae4e..2813426b 100644 --- a/src/contracts/pools/SideStaking.ts +++ b/src/contracts/pools/SideStaking.ts @@ -20,15 +20,15 @@ export class SideStaking extends SmartContract { datatokenAddress: string ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let supply = null try { - result = await sideStaking.methods + supply = await sideStaking.methods .getDatatokenCirculatingSupply(datatokenAddress) .call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - return result.toString() + return supply.toString() } /** @@ -44,11 +44,11 @@ export class SideStaking extends SmartContract { ): Promise { try { const sideStaking = this.getContract(ssAddress) - let result = null - result = await sideStaking.methods + let supply = null + supply = await sideStaking.methods .getDatatokenCurrentCirculatingSupply(datatokenAddress) .call() - return result.toString() + return supply.toString() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } @@ -65,13 +65,13 @@ export class SideStaking extends SmartContract { datatokenAddress: string ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let address = null try { - result = await sideStaking.methods.getPublisherAddress(datatokenAddress).call() + address = await sideStaking.methods.getPublisherAddress(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - return result + return address } /** @@ -80,15 +80,15 @@ export class SideStaking extends SmartContract { * @param {String} datatokenAddress datatokenAddress * @return {String} */ - async getBaseToken(ssAddress: string, datatokenAddress: string): Promise { + async getBasetoken(ssAddress: string, datatokenAddress: string): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let address = null try { - result = await sideStaking.methods.getBaseTokenAddress(datatokenAddress).call() + address = await sideStaking.methods.getBaseTokenAddress(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - return result + return address } /** @@ -99,13 +99,13 @@ export class SideStaking extends SmartContract { */ async getPoolAddress(ssAddress: string, datatokenAddress: string): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let address = null try { - result = await sideStaking.methods.getPoolAddress(datatokenAddress).call() + address = await sideStaking.methods.getPoolAddress(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - return result + return address } /** @@ -114,18 +114,18 @@ export class SideStaking extends SmartContract { * @param {String} datatokenAddress datatokenAddress * @return {String} */ - async getBaseTokenBalance( + async getBasetokenBalance( ssAddress: string, datatokenAddress: string ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let balance = null try { - result = await sideStaking.methods.getBaseTokenBalance(datatokenAddress).call() + balance = await sideStaking.methods.getBaseTokenBalance(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - return result + return balance } /** @@ -141,14 +141,14 @@ export class SideStaking extends SmartContract { tokenDecimals?: number ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let balance = null try { - result = await sideStaking.methods.getDatatokenBalance(datatokenAddress).call() + balance = await sideStaking.methods.getDatatokenBalance(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - result = await this.unitsToAmount(datatokenAddress, result, tokenDecimals) - return result + balance = await this.unitsToAmount(datatokenAddress, balance, tokenDecimals) + return balance } /** @@ -157,15 +157,15 @@ export class SideStaking extends SmartContract { * @param {String} datatokenAddress datatokenAddress * @return {String} end block for vesting amount */ - async getvestingEndBlock(ssAddress: string, datatokenAddress: string): Promise { + async getVestingEndBlock(ssAddress: string, datatokenAddress: string): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let block = null try { - result = await sideStaking.methods.getvestingEndBlock(datatokenAddress).call() + block = await sideStaking.methods.getvestingEndBlock(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - return result + return block } /** @@ -175,20 +175,20 @@ export class SideStaking extends SmartContract { * @param {number} tokenDecimals optional number of decimals of the token * @return {String} */ - async getvestingAmount( + async getVestingAmount( ssAddress: string, datatokenAddress: string, tokenDecimals?: number ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let amount = null try { - result = await sideStaking.methods.getvestingAmount(datatokenAddress).call() + amount = await sideStaking.methods.getvestingAmount(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - result = await this.unitsToAmount(datatokenAddress, result, tokenDecimals) - return result + amount = await this.unitsToAmount(datatokenAddress, amount, tokenDecimals) + return amount } /** @@ -197,18 +197,18 @@ export class SideStaking extends SmartContract { * @param {String} datatokenAddress datatokenAddress * @return {String} */ - async getvestingLastBlock( + async getVestingLastBlock( ssAddress: string, datatokenAddress: string ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let block = null try { - result = await sideStaking.methods.getvestingLastBlock(datatokenAddress).call() + block = await sideStaking.methods.getvestingLastBlock(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - return result + return block } /** @@ -218,20 +218,20 @@ export class SideStaking extends SmartContract { * @param {number} tokenDecimals optional number of decimals of the token * @return {String} */ - async getvestingAmountSoFar( + async getVestingAmountSoFar( ssAddress: string, datatokenAddress: string, tokenDecimals?: number ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let amount = null try { - result = await sideStaking.methods.getvestingAmountSoFar(datatokenAddress).call() + amount = await sideStaking.methods.getvestingAmountSoFar(datatokenAddress).call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get: ${e.message}`) } - result = await this.unitsToAmount(datatokenAddress, result, tokenDecimals) - return result + amount = await this.unitsToAmount(datatokenAddress, amount, tokenDecimals) + return amount } /** Send vested tokens available to the publisher address, can be called by anyone @@ -248,7 +248,7 @@ export class SideStaking extends SmartContract { estimateGas?: G ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let vesting = null const estGas = await calculateEstimatedGas( account, @@ -258,7 +258,7 @@ export class SideStaking extends SmartContract { if (estimateGas) return estGas try { - result = await sideStaking.methods.getVesting(datatokenAddress).send({ + vesting = await sideStaking.methods.getVesting(datatokenAddress).send({ from: account, gas: estGas + 1, gasPrice: await this.getFairGasPrice() @@ -266,7 +266,7 @@ export class SideStaking extends SmartContract { } catch (e) { LoggerInstance.error('ERROR: Failed to join swap pool amount out') } - return result + return vesting } /** Send vested tokens available to the publisher address, can be called by anyone @@ -285,7 +285,7 @@ export class SideStaking extends SmartContract { estimateGas?: G ): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let fee = null const estGas = await calculateEstimatedGas( account, @@ -297,7 +297,7 @@ export class SideStaking extends SmartContract { if (estimateGas) return estGas try { - result = await sideStaking.methods + fee = await sideStaking.methods .setPoolSwapFee(datatokenAddress, poolAddress, swapFee) .send({ from: account, @@ -307,7 +307,7 @@ export class SideStaking extends SmartContract { } catch (e) { LoggerInstance.error('ERROR: Failed to join swap pool amount out') } - return result + return fee } /** @@ -317,12 +317,12 @@ export class SideStaking extends SmartContract { */ public async getRouter(ssAddress: string): Promise { const sideStaking = this.getContract(ssAddress) - let result = null + let router = null try { - result = await sideStaking.methods.router().call() + router = await sideStaking.methods.router().call() } catch (e) { LoggerInstance.error(`ERROR: Failed to get Router address: ${e.message}`) } - return result + return router } } diff --git a/test/unit/pools/ssContracts/SideStaking.test.ts b/test/unit/pools/ssContracts/SideStaking.test.ts index fbd8988c..c2415508 100644 --- a/test/unit/pools/ssContracts/SideStaking.test.ts +++ b/test/unit/pools/ssContracts/SideStaking.test.ts @@ -193,9 +193,9 @@ describe('SideStaking unit test', () => { ).to.equal(web3.utils.toWei(BASE_TOKEN_LIQUIDITY.toString())) }) - it('#getBaseToken - should get baseToken address', async () => { + it('#getBasetoken - should get baseToken address', async () => { expect( - await sideStaking.getBaseToken(contracts.sideStakingAddress, datatoken) + await sideStaking.getBasetoken(contracts.sideStakingAddress, datatoken) ).to.equal(contracts.daiAddress) }) @@ -211,9 +211,9 @@ describe('SideStaking unit test', () => { ).to.equal(factoryOwner) }) - it('#getBaseTokenBalance ', async () => { + it('#getBasetokenBalance ', async () => { expect( - await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, datatoken) + await sideStaking.getBasetokenBalance(contracts.sideStakingAddress, datatoken) ).to.equal('0') }) @@ -232,21 +232,21 @@ describe('SideStaking unit test', () => { ) }) - it('#getvestingAmount ', async () => { + it('#getVestingAmount ', async () => { expect( - await sideStaking.getvestingAmount(contracts.sideStakingAddress, datatoken) + await sideStaking.getVestingAmount(contracts.sideStakingAddress, datatoken) ).to.equal('0') }) - it('#getvestingLastBlock ', async () => { + it('#getVestingLastBlock ', async () => { expect( - await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, datatoken) + await sideStaking.getVestingLastBlock(contracts.sideStakingAddress, datatoken) ).to.equal(initialBlock.toString()) }) - it('#getvestingAmountSoFar ', async () => { + it('#getVestingAmountSoFar ', async () => { expect( - await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, datatoken) + await sideStaking.getVestingAmountSoFar(contracts.sideStakingAddress, datatoken) ).to.equal('0') }) @@ -325,11 +325,11 @@ describe('SideStaking unit test', () => { ) }) - it('#exitswapPoolAmountIn- user1 exit the pool receiving only DAI', async () => { + it('#exitSwapPoolAmountIn- user1 exit the pool receiving only DAI', async () => { const BPTAmountIn = '0.5' const minDAIOut = '0.5' - const tx = await pool.exitswapPoolAmountIn( + const tx = await pool.exitSwapPoolAmountIn( user1, poolAddress, BPTAmountIn, @@ -391,9 +391,9 @@ describe('SideStaking unit test', () => { expect(await datatokenContract.methods.balanceOf(user1).call()).to.equal('0') }) - it('#getBaseTokenBalance ', async () => { + it('#getBasetokenBalance ', async () => { expect( - await sideStaking.getBaseTokenBalance(contracts.sideStakingAddress, datatoken) + await sideStaking.getBasetokenBalance(contracts.sideStakingAddress, datatoken) ).to.equal('0') }) @@ -412,21 +412,21 @@ describe('SideStaking unit test', () => { ) }) - it('#getvestingAmount ', async () => { + it('#getVestingAmount ', async () => { expect( - await sideStaking.getvestingAmount(contracts.sideStakingAddress, datatoken) + await sideStaking.getVestingAmount(contracts.sideStakingAddress, datatoken) ).to.equal('0') }) - it('#getvestingLastBlock ', async () => { + it('#getVestingLastBlock ', async () => { expect( - await sideStaking.getvestingLastBlock(contracts.sideStakingAddress, datatoken) + await sideStaking.getVestingLastBlock(contracts.sideStakingAddress, datatoken) ).to.equal(initialBlock.toString()) }) - it('#getvestingAmountSoFar ', async () => { + it('#getVestingAmountSoFar ', async () => { expect( - await sideStaking.getvestingAmountSoFar(contracts.sideStakingAddress, datatoken) + await sideStaking.getVestingAmountSoFar(contracts.sideStakingAddress, datatoken) ).to.equal('0') }) @@ -501,11 +501,11 @@ describe('SideStaking unit test', () => { ) }) - it('#exitswapPoolAmountIn- user1 exit the pool receiving only USDC', async () => { + it('#exitSwapPoolAmountIn- user1 exit the pool receiving only USDC', async () => { const BPTAmountIn = '0.5' const minUSDCOut = '0.5' - const tx = await pool.exitswapPoolAmountIn( + const tx = await pool.exitSwapPoolAmountIn( user1, poolAddress, BPTAmountIn,