mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
Merge pull request #360 from oceanprotocol/bug/remove_totalSupply_duplicate
remove duplicate totalSupply
This commit is contained in:
commit
fbf2f05a7b
@ -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<string> {
|
||||
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
|
||||
|
@ -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 () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user