diff --git a/src/balancer/Pool.ts b/src/balancer/Pool.ts index c09f5955..60ab4cda 100644 --- a/src/balancer/Pool.ts +++ b/src/balancer/Pool.ts @@ -157,24 +157,6 @@ export class Pool extends PoolFactory { return result } - /** - * Get total supply of pool tokens - * @param {String} poolAddress - * @return {String} - */ - async totalSupply(poolAddress: string): Promise { - let result = null - - try { - const pool = new this.web3.eth.Contract(this.poolABI, poolAddress) - const totalSupply = await pool.methods.totalSupply().call() - result = this.web3.utils.fromWei(totalSupply) - } catch (e) { - console.error(e) - } - return result - } - /** * Adds tokens to pool * @param {String} account diff --git a/test/unit/balancer/Balancer.test.ts b/test/unit/balancer/Balancer.test.ts index d5208885..d574ac80 100644 --- a/test/unit/balancer/Balancer.test.ts +++ b/test/unit/balancer/Balancer.test.ts @@ -14,6 +14,12 @@ import OceanPoolFactory from '@oceanprotocol/contracts/artifacts/BFactory.json' import OceanSPool from '@oceanprotocol/contracts/artifacts/BPool.json' const web3 = new Web3('http://127.0.0.1:8545') +function sleep(ms: number) { + return new Promise((resolve) => { + setTimeout(resolve, ms) + }) +} + describe('Balancer flow', () => { let oceanTokenAddress: string let OceanPoolFactoryAddress: string @@ -116,7 +122,7 @@ 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') - const s = await Pool.totalSupply(alicePoolAddress) + const s = await Pool.getPoolSharesTotalSupply(alicePoolAddress) assert(String(s) === '100', 'totalSupply does not match: ' + s) const n = await Pool.getNumTokens(alicePoolAddress) assert(String(n) === '2', 'unexpected num tokens: ' + n) @@ -164,7 +170,7 @@ describe('Balancer flow', () => { assert(Number(currentOceanReserve) > 0) }) it('Get total supply of pool tokens', async () => { - const totalSupply = await Pool.totalSupply(alicePoolAddress) + const totalSupply = await Pool.getPoolSharesTotalSupply(alicePoolAddress) assert(Number(totalSupply) > 0) }) it('Get amount of Ocean needed to buy 1 dtToken', async () => {