1
0
mirror of https://github.com/oceanprotocol/ocean.js.git synced 2024-11-26 20:39:05 +01:00

Convert amount and weight to wei, fix tests.

This commit is contained in:
ssallam 2020-08-27 11:01:15 +02:00
parent 8c7a701e6f
commit afa2996768
3 changed files with 7 additions and 5 deletions

View File

@ -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)
)

View File

@ -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

View File

@ -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)