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

more pool tests

This commit is contained in:
Matthias Kretschmann 2020-09-08 16:51:03 +02:00
parent 7456360d00
commit 6f85014e00
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -15,12 +15,12 @@ import OceanSPool from '@oceanprotocol/contracts/artifacts/BPool.json'
const web3 = new Web3('http://127.0.0.1:8545')
describe('Balancer flow', () => {
let oceanTokenAddress
let OceanPoolFactoryAddress
let oceanTokenAddress: string
let OceanPoolFactoryAddress: string
let Pool: OceanPool
let oceandatatoken: DataTokens
let alicePoolAddress
let currentDtPrice
let alicePoolAddress: string
let currentDtPrice: string
let owner: string
let bob: string
let alice: string
@ -28,12 +28,11 @@ describe('Balancer flow', () => {
let datatoken: DataTokens
let tokenAddress: string
let consoleDebug: false
let greatPool
let greatPool: string
const tokenAmount = '1000'
const transferAmount = '200'
const blob = 'http://localhost:8030/api/v1/services/consume'
describe('#test', () => {
before(async () => {
// deploy SFactory
const SContracts = new BalancerContractHandler(
@ -128,10 +127,32 @@ describe('Balancer flow', () => {
assert(currentTokens.includes(tokenAddress))
assert(currentTokens.includes(oceanTokenAddress))
})
it('Get pool swap fee', async () => {
const currentSwapFee = await Pool.getSwapFee(alice, alicePoolAddress)
assert(currentSwapFee === '0.02')
})
it('Get spot price for swapping', async () => {
const spotPrice = await Pool.getSpotPrice(
alice,
alicePoolAddress,
tokenAddress,
oceanTokenAddress
)
assert(Number(spotPrice) > 0)
})
it('Get spot price for swapping without fees', async () => {
const spotPrice = await Pool.getSpotPriceSansFee(
alice,
alicePoolAddress,
tokenAddress,
oceanTokenAddress
)
assert(Number(spotPrice) > 0)
})
it('Get dtPrice from the pool ', async () => {
currentDtPrice = await Pool.getDTPrice(alice, alicePoolAddress)
assert(currentDtPrice > 0)
@ -249,5 +270,4 @@ describe('Balancer flow', () => {
assert(parseFloat(bobDtBalance) < parseFloat(newbobDtBalance))
assert(parseFloat(poolShares) > parseFloat(newpoolShares))
})
})
})