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

remove need of an account for some calls

This commit is contained in:
alexcos20 2020-09-30 23:10:53 -07:00
parent 9bbff39cf0
commit fa2a1f8944
5 changed files with 60 additions and 136 deletions

View File

@ -118,27 +118,25 @@ export class OceanPool extends Pool {
/** /**
* Get Ocean Token balance of a pool * Get Ocean Token balance of a pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @return {String} * @return {String}
*/ */
public async getOceanReserve(account: string, poolAddress: string): Promise<string> { public async getOceanReserve(poolAddress: string): Promise<string> {
if (this.oceanAddress == null) { if (this.oceanAddress == null) {
console.error('oceanAddress is not defined') console.error('oceanAddress is not defined')
return null return null
} }
return super.getReserve(account, poolAddress, this.oceanAddress) return super.getReserve(poolAddress, this.oceanAddress)
} }
/** /**
* Get Data Token balance of a pool * Get Data Token balance of a pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @return {String} * @return {String}
*/ */
public async getDTReserve(account: string, poolAddress: string): Promise<string> { public async getDTReserve(poolAddress: string): Promise<string> {
await this.getDTAddress(poolAddress) await this.getDTAddress(poolAddress)
return super.getReserve(account, poolAddress, this.dtAddress) return super.getReserve(poolAddress, this.dtAddress)
} }
/** /**
@ -332,12 +330,12 @@ export class OceanPool extends Pool {
* @param {String} poolAddress * @param {String} poolAddress
* @return {String} * @return {String}
*/ */
public async getDTPrice(account: string, poolAddress: string): Promise<string> { public async getDTPrice(poolAddress: string): Promise<string> {
if (this.oceanAddress == null) { if (this.oceanAddress == null) {
console.error('oceanAddress is not defined') console.error('oceanAddress is not defined')
return null return null
} }
return this.getOceanNeeded(account, poolAddress, '1') return this.getOceanNeeded(poolAddress, '1')
} }
/** /**
@ -346,11 +344,9 @@ export class OceanPool extends Pool {
* @param {String} dtAddress * @param {String} dtAddress
* @return {String[]} * @return {String[]}
*/ */
public async searchPoolforDT(account: string, dtAddress: string): Promise<string[]> { public async searchPoolforDT(dtAddress: string): Promise<string[]> {
const result: string[] = [] const result: string[] = []
const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress, { const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress)
from: account
})
const events = await factory.getPastEvents('BPoolRegistered', { const events = await factory.getPastEvents('BPoolRegistered', {
filter: {}, filter: {},
fromBlock: 0, fromBlock: 0,
@ -363,25 +359,13 @@ export class OceanPool extends Pool {
return result return result
} }
public async getOceanNeeded( public async getOceanNeeded(poolAddress: string, dtRequired: string): Promise<string> {
account: string,
poolAddress: string,
dtRequired: string
): Promise<string> {
await this.getDTAddress(poolAddress) await this.getDTAddress(poolAddress)
const tokenBalanceIn = await this.getReserve(account, poolAddress, this.oceanAddress) const tokenBalanceIn = await this.getReserve(poolAddress, this.oceanAddress)
const tokenWeightIn = await this.getDenormalizedWeight( const tokenWeightIn = await this.getDenormalizedWeight(poolAddress, this.oceanAddress)
account, const tokenBalanceOut = await this.getReserve(poolAddress, this.dtAddress)
poolAddress, const tokenWeightOut = await this.getDenormalizedWeight(poolAddress, this.dtAddress)
this.oceanAddress const swapFee = await this.getSwapFee(poolAddress)
)
const tokenBalanceOut = await this.getReserve(account, poolAddress, this.dtAddress)
const tokenWeightOut = await this.getDenormalizedWeight(
account,
poolAddress,
this.dtAddress
)
const swapFee = await this.getSwapFee(account, poolAddress)
return super.calcInGivenOut( return super.calcInGivenOut(
tokenBalanceIn, tokenBalanceIn,
tokenWeightIn, tokenWeightIn,
@ -428,7 +412,7 @@ export class OceanPool extends Pool {
/** /**
* Get all actions from a pool (join,exit,swap) * Get all actions from a pool (join,exit,swap)
* @param {String} poolAddress Pool address * @param {String} poolAddress Pool address
* @param {String} account * @param {String} account Optional, filter for this address
* @return {PoolTransaction[]} * @return {PoolTransaction[]}
*/ */
public async getPoolLogs( public async getPoolLogs(

View File

@ -256,14 +256,11 @@ export class Pool extends PoolFactory {
/** /**
* Get number of tokens composing this pool * Get number of tokens composing this pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @return {String} * @return {String}
*/ */
async getNumTokens(account: string, poolAddress: string): Promise<string> { async getNumTokens(poolAddress: string): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let result = null let result = null
try { try {
result = await pool.methods.getNumTokens().call() result = await pool.methods.getNumTokens().call()
@ -307,14 +304,11 @@ export class Pool extends PoolFactory {
/** /**
* Get controller address of this pool * Get controller address of this pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @return {String} * @return {String}
*/ */
async getController(account: string, poolAddress: string): Promise<string> { async getController(poolAddress: string): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let result = null let result = null
try { try {
result = await pool.methods.getController().call() result = await pool.methods.getController().call()
@ -352,15 +346,12 @@ export class Pool extends PoolFactory {
/** /**
* Get if a token is bounded to a pool * Get if a token is bounded to a pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @param {String} token Address of the token * @param {String} token Address of the token
* @return {Boolean} * @return {Boolean}
*/ */
async isBound(account: string, poolAddress: string, token: string): Promise<boolean> { async isBound(poolAddress: string, token: string): Promise<boolean> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let result = null let result = null
try { try {
result = await pool.methods.isBound(token).call() result = await pool.methods.isBound(token).call()
@ -372,15 +363,12 @@ export class Pool extends PoolFactory {
/** /**
* Get how many tokens are in the pool * Get how many tokens are in the pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @param {String} token Address of the token * @param {String} token Address of the token
* @return {String} * @return {String}
*/ */
async getReserve(account: string, poolAddress: string, token: string): Promise<string> { async getReserve(poolAddress: string, token: string): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let amount = null let amount = null
try { try {
const result = await pool.methods.getBalance(token).call() const result = await pool.methods.getBalance(token).call()
@ -393,14 +381,11 @@ export class Pool extends PoolFactory {
/** /**
* Get if a pool is finalized * Get if a pool is finalized
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @return {Boolean} * @return {Boolean}
*/ */
async isFinalized(account: string, poolAddress: string): Promise<boolean> { async isFinalized(poolAddress: string): Promise<boolean> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let result = null let result = null
try { try {
result = await pool.methods.isFinalized().call() result = await pool.methods.isFinalized().call()
@ -412,14 +397,11 @@ export class Pool extends PoolFactory {
/** /**
* Get pool fee * Get pool fee
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @return {String} Swap fee in wei * @return {String} Swap fee in wei
*/ */
async getSwapFee(account: string, poolAddress: string): Promise<string> { async getSwapFee(poolAddress: string): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let fee = null let fee = null
try { try {
const result = await pool.methods.getSwapFee().call() const result = await pool.methods.getSwapFee().call()
@ -432,19 +414,12 @@ export class Pool extends PoolFactory {
/** /**
* The normalized weight of a token. The combined normalized weights of all tokens will sum up to 1. (Note: the actual sum may be 1 plus or minus a few wei due to division precision loss) * The normalized weight of a token. The combined normalized weights of all tokens will sum up to 1. (Note: the actual sum may be 1 plus or minus a few wei due to division precision loss)
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @param {String} token * @param {String} token
* @return {String} * @return {String}
*/ */
async getNormalizedWeight( async getNormalizedWeight(poolAddress: string, token: string): Promise<string> {
account: string, const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
poolAddress: string,
token: string
): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
from: account
})
let weight = null let weight = null
try { try {
const result = await pool.methods.getNormalizedWeight(token).call() const result = await pool.methods.getNormalizedWeight(token).call()
@ -457,19 +432,12 @@ export class Pool extends PoolFactory {
/** /**
* getDenormalizedWeight of a token in pool * getDenormalizedWeight of a token in pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @param {String} token * @param {String} token
* @return {String} * @return {String}
*/ */
async getDenormalizedWeight( async getDenormalizedWeight(poolAddress: string, token: string): Promise<string> {
account: string, const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
poolAddress: string,
token: string
): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
from: account
})
let weight = null let weight = null
try { try {
const result = await pool.methods.getDenormalizedWeight(token).call() const result = await pool.methods.getDenormalizedWeight(token).call()
@ -482,17 +450,11 @@ export class Pool extends PoolFactory {
/** /**
* getTotalDenormalizedWeight in pool * getTotalDenormalizedWeight in pool
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @return {String} * @return {String}
*/ */
async getTotalDenormalizedWeight( async getTotalDenormalizedWeight(poolAddress: string): Promise<string> {
account: string, const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
poolAddress: string
): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, {
from: account
})
let weight = null let weight = null
try { try {
const result = await pool.methods.getTotalDenormalizedWeight().call() const result = await pool.methods.getTotalDenormalizedWeight().call()
@ -792,21 +754,17 @@ export class Pool extends PoolFactory {
/** /**
* Get Spot Price of swaping tokenIn to tokenOut * Get Spot Price of swaping tokenIn to tokenOut
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @param {String} tokenIn * @param {String} tokenIn
* @param {String} tokenOut * @param {String} tokenOut
* @return {String} * @return {String}
*/ */
async getSpotPrice( async getSpotPrice(
account: string,
poolAddress: string, poolAddress: string,
tokenIn: string, tokenIn: string,
tokenOut: string tokenOut: string
): Promise<string> { ): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let price = null let price = null
try { try {
const result = await pool.methods.getSpotPrice(tokenIn, tokenOut).call() const result = await pool.methods.getSpotPrice(tokenIn, tokenOut).call()
@ -819,21 +777,17 @@ export class Pool extends PoolFactory {
/** /**
* Get Spot Price of swaping tokenIn to tokenOut without fees * Get Spot Price of swaping tokenIn to tokenOut without fees
* @param {String} account
* @param {String} poolAddress * @param {String} poolAddress
* @param {String} tokenIn * @param {String} tokenIn
* @param {String} tokenOut * @param {String} tokenOut
* @return {String} * @return {String}
*/ */
async getSpotPriceSansFee( async getSpotPriceSansFee(
account: string,
poolAddress: string, poolAddress: string,
tokenIn: string, tokenIn: string,
tokenOut: string tokenOut: string
): Promise<string> { ): Promise<string> {
const pool = new this.web3.eth.Contract(this.poolABI, poolAddress, { const pool = new this.web3.eth.Contract(this.poolABI, poolAddress)
from: account
})
let price = null let price = null
try { try {
const result = await pool.methods.getSpotPriceSansFee(tokenIn, tokenOut).call() const result = await pool.methods.getSpotPriceSansFee(tokenIn, tokenOut).call()

View File

@ -287,52 +287,40 @@ export class DataTokens {
/** Get Blob /** Get Blob
* @param {String} dataTokenAddress * @param {String} dataTokenAddress
* @param {String} address
* @return {Promise<string>} string * @return {Promise<string>} string
*/ */
public async getBlob(dataTokenAddress: string, address: string): Promise<string> { public async getBlob(dataTokenAddress: string): Promise<string> {
const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress, { const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress)
from: address
})
const trxReceipt = await datatoken.methods.blob().call() const trxReceipt = await datatoken.methods.blob().call()
return trxReceipt return trxReceipt
} }
/** Get Name /** Get Name
* @param {String} dataTokenAddress * @param {String} dataTokenAddress
* @param {String} address
* @return {Promise<string>} string * @return {Promise<string>} string
*/ */
public async getName(dataTokenAddress: string, address: string): Promise<string> { public async getName(dataTokenAddress: string): Promise<string> {
const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress, { const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress)
from: address
})
const trxReceipt = await datatoken.methods.name().call() const trxReceipt = await datatoken.methods.name().call()
return trxReceipt return trxReceipt
} }
/** Get Symbol /** Get Symbol
* @param {String} dataTokenAddress * @param {String} dataTokenAddress
* @param {String} address
* @return {Promise<string>} string * @return {Promise<string>} string
*/ */
public async getSymbol(dataTokenAddress: string, address: string): Promise<string> { public async getSymbol(dataTokenAddress: string): Promise<string> {
const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress, { const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress)
from: address
})
const trxReceipt = await datatoken.methods.symbol().call() const trxReceipt = await datatoken.methods.symbol().call()
return trxReceipt return trxReceipt
} }
/** Get Cap /** Get Cap
* @param {String} dataTokenAddress * @param {String} dataTokenAddress
* @param {String} address
* @return {Promise<string>} string * @return {Promise<string>} string
*/ */
public async getCap(dataTokenAddress: string, address: string): Promise<string> { public async getCap(dataTokenAddress: string): Promise<string> {
const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress, { const datatoken = new this.web3.eth.Contract(this.datatokensABI, dataTokenAddress)
from: address
})
const trxReceipt = await datatoken.methods.cap().call() const trxReceipt = await datatoken.methods.cap().call()
return this.web3.utils.fromWei(trxReceipt) return this.web3.utils.fromWei(trxReceipt)
} }

View File

@ -52,8 +52,8 @@ describe('DataTokens', () => {
tokenAddress = await datatoken.create(blob, minter) tokenAddress = await datatoken.create(blob, minter)
assert(tokenAddress !== null) assert(tokenAddress !== null)
const tokenName = await datatoken.getName(tokenAddress, minter) const tokenName = await datatoken.getName(tokenAddress)
const tokenSymbol = await datatoken.getSymbol(tokenAddress, minter) const tokenSymbol = await datatoken.getSymbol(tokenAddress)
assert(tokenName !== null || tokenName !== '') assert(tokenName !== null || tokenName !== '')
assert(tokenSymbol !== null || tokenSymbol !== '') assert(tokenSymbol !== null || tokenSymbol !== '')
}) })

View File

@ -118,7 +118,7 @@ describe('Balancer flow', () => {
alicePoolAddress = await Pool.createDTPool(alice, tokenAddress, '45', '9', '0.02') alicePoolAddress = await Pool.createDTPool(alice, tokenAddress, '45', '9', '0.02')
const s = await Pool.totalSupply(alicePoolAddress) const s = await Pool.totalSupply(alicePoolAddress)
assert(String(s) === '100', 'totalSupply does not match: ' + s) assert(String(s) === '100', 'totalSupply does not match: ' + s)
const n = await Pool.getNumTokens(alice, alicePoolAddress) const n = await Pool.getNumTokens(alicePoolAddress)
assert(String(n) === '2', 'unexpected num tokens: ' + n) assert(String(n) === '2', 'unexpected num tokens: ' + n)
}) })
it('Get pool information', async () => { it('Get pool information', async () => {
@ -129,13 +129,12 @@ describe('Balancer flow', () => {
}) })
it('Get pool swap fee', async () => { it('Get pool swap fee', async () => {
const currentSwapFee = await Pool.getSwapFee(alice, alicePoolAddress) const currentSwapFee = await Pool.getSwapFee(alicePoolAddress)
assert(currentSwapFee === '0.02') assert(currentSwapFee === '0.02')
}) })
it('Get spot price for swapping', async () => { it('Get spot price for swapping', async () => {
const spotPrice = await Pool.getSpotPrice( const spotPrice = await Pool.getSpotPrice(
alice,
alicePoolAddress, alicePoolAddress,
tokenAddress, tokenAddress,
oceanTokenAddress oceanTokenAddress
@ -145,7 +144,6 @@ describe('Balancer flow', () => {
it('Get spot price for swapping without fees', async () => { it('Get spot price for swapping without fees', async () => {
const spotPrice = await Pool.getSpotPriceSansFee( const spotPrice = await Pool.getSpotPriceSansFee(
alice,
alicePoolAddress, alicePoolAddress,
tokenAddress, tokenAddress,
oceanTokenAddress oceanTokenAddress
@ -154,15 +152,15 @@ describe('Balancer flow', () => {
}) })
it('Get dtPrice from the pool ', async () => { it('Get dtPrice from the pool ', async () => {
currentDtPrice = await Pool.getDTPrice(alice, alicePoolAddress) currentDtPrice = await Pool.getDTPrice(alicePoolAddress)
assert(Number(currentDtPrice) > 0) assert(Number(currentDtPrice) > 0)
}) })
it('Get dtToken pool reserve ', async () => { it('Get dtToken pool reserve ', async () => {
const currentDtReserve = await Pool.getDTReserve(alice, alicePoolAddress) const currentDtReserve = await Pool.getDTReserve(alicePoolAddress)
assert(Number(currentDtReserve) > 0) assert(Number(currentDtReserve) > 0)
}) })
it('Get Ocean pool reserve ', async () => { it('Get Ocean pool reserve ', async () => {
const currentOceanReserve = await Pool.getOceanReserve(alice, alicePoolAddress) const currentOceanReserve = await Pool.getOceanReserve(alicePoolAddress)
assert(Number(currentOceanReserve) > 0) assert(Number(currentOceanReserve) > 0)
}) })
it('Get total supply of pool tokens', async () => { it('Get total supply of pool tokens', async () => {
@ -170,12 +168,12 @@ describe('Balancer flow', () => {
assert(Number(totalSupply) > 0) assert(Number(totalSupply) > 0)
}) })
it('Get amount of Ocean needed to buy 1 dtToken', async () => { it('Get amount of Ocean needed to buy 1 dtToken', async () => {
const requiredOcean = await Pool.getOceanNeeded(alice, alicePoolAddress, '1') const requiredOcean = await Pool.getOceanNeeded(alicePoolAddress, '1')
assert(Number(requiredOcean) > 0) assert(Number(requiredOcean) > 0)
}) })
it('Bob should search for pools with this DT', async () => { it('Bob should search for pools with this DT', async () => {
const pools = await Pool.searchPoolforDT(bob, tokenAddress) const pools = await Pool.searchPoolforDT(tokenAddress)
assert(pools.length > 0) assert(pools.length > 0)
greatPool = pools[0] greatPool = pools[0]
}) })
@ -188,7 +186,7 @@ describe('Balancer flow', () => {
assert(Number(bobOceanBalance) > 0) assert(Number(bobOceanBalance) > 0)
}) })
it('Bob should add DT liquidity to pool ', async () => { it('Bob should add DT liquidity to pool ', async () => {
const currentDtReserve = await Pool.getDTReserve(bob, greatPool) const currentDtReserve = await Pool.getDTReserve(greatPool)
if (consoleDebug) console.log('currentDtReserve:' + currentDtReserve) if (consoleDebug) console.log('currentDtReserve:' + currentDtReserve)
const bobDtBalance = await datatoken.balance(tokenAddress, bob) const bobDtBalance = await datatoken.balance(tokenAddress, bob)
if (consoleDebug) console.log('BOB DT Balance:' + bobDtBalance) if (consoleDebug) console.log('BOB DT Balance:' + bobDtBalance)
@ -196,7 +194,7 @@ describe('Balancer flow', () => {
const newbobDtBalance = await datatoken.balance(tokenAddress, bob) const newbobDtBalance = await datatoken.balance(tokenAddress, bob)
const newDtReserve = await Pool.getDTReserve(bob, greatPool) const newDtReserve = await Pool.getDTReserve(greatPool)
const sharesBalance = await Pool.sharesBalance(bob, greatPool) const sharesBalance = await Pool.sharesBalance(bob, greatPool)
if (consoleDebug) console.log('newDtReserve:' + newDtReserve) if (consoleDebug) console.log('newDtReserve:' + newDtReserve)
@ -208,7 +206,7 @@ describe('Balancer flow', () => {
}) })
it('Bob should remove DT liquidity from pool ', async () => { it('Bob should remove DT liquidity from pool ', async () => {
const currentDtReserve = await Pool.getDTReserve(bob, greatPool) const currentDtReserve = await Pool.getDTReserve(greatPool)
if (consoleDebug) console.log('currentDtReserve:' + currentDtReserve) if (consoleDebug) console.log('currentDtReserve:' + currentDtReserve)
const bobDtBalance = await datatoken.balance(tokenAddress, bob) const bobDtBalance = await datatoken.balance(tokenAddress, bob)
if (consoleDebug) console.log('bobDtBalance:' + bobDtBalance) if (consoleDebug) console.log('bobDtBalance:' + bobDtBalance)
@ -216,7 +214,7 @@ describe('Balancer flow', () => {
if (consoleDebug) console.log('poolShares:' + poolShares) if (consoleDebug) console.log('poolShares:' + poolShares)
await Pool.removeDTLiquidity(bob, greatPool, '0.75', poolShares) await Pool.removeDTLiquidity(bob, greatPool, '0.75', poolShares)
const newDtReserve = await Pool.getDTReserve(bob, greatPool) const newDtReserve = await Pool.getDTReserve(greatPool)
if (consoleDebug) console.log('newDtReserve:' + newDtReserve) if (consoleDebug) console.log('newDtReserve:' + newDtReserve)
const newbobDtBalance = await datatoken.balance(tokenAddress, bob) const newbobDtBalance = await datatoken.balance(tokenAddress, bob)
if (consoleDebug) console.log('newbobDtBalance:' + newbobDtBalance) if (consoleDebug) console.log('newbobDtBalance:' + newbobDtBalance)
@ -228,7 +226,7 @@ describe('Balancer flow', () => {
}) })
it('Bob should add Ocean liquidity to pool ', async () => { it('Bob should add Ocean liquidity to pool ', async () => {
const currentDtReserve = await Pool.getOceanReserve(bob, greatPool) const currentDtReserve = await Pool.getOceanReserve(greatPool)
const bobDtBalance = await datatoken.balance(oceanTokenAddress, bob) const bobDtBalance = await datatoken.balance(oceanTokenAddress, bob)
if (consoleDebug) console.log('currentDtReserve:' + currentDtReserve) if (consoleDebug) console.log('currentDtReserve:' + currentDtReserve)
if (consoleDebug) console.log('bobDtBalance:' + bobDtBalance) if (consoleDebug) console.log('bobDtBalance:' + bobDtBalance)
@ -237,7 +235,7 @@ describe('Balancer flow', () => {
const newbobDtBalance = await datatoken.balance(oceanTokenAddress, bob) const newbobDtBalance = await datatoken.balance(oceanTokenAddress, bob)
const newDtReserve = await Pool.getOceanReserve(bob, greatPool) const newDtReserve = await Pool.getOceanReserve(greatPool)
const sharesBalance = await Pool.sharesBalance(bob, greatPool) const sharesBalance = await Pool.sharesBalance(bob, greatPool)
if (consoleDebug) console.log('newDtReserve:' + newDtReserve) if (consoleDebug) console.log('newDtReserve:' + newDtReserve)
@ -249,7 +247,7 @@ describe('Balancer flow', () => {
}) })
it('Bob should remove Ocean liquidity from pool ', async () => { it('Bob should remove Ocean liquidity from pool ', async () => {
const currentDtReserve = await Pool.getOceanReserve(bob, greatPool) const currentDtReserve = await Pool.getOceanReserve(greatPool)
const bobDtBalance = await datatoken.balance(oceanTokenAddress, bob) const bobDtBalance = await datatoken.balance(oceanTokenAddress, bob)
const poolShares = await Pool.sharesBalance(bob, greatPool) const poolShares = await Pool.sharesBalance(bob, greatPool)
@ -259,7 +257,7 @@ describe('Balancer flow', () => {
await Pool.removeOceanLiquidity(bob, greatPool, '0.75', poolShares) await Pool.removeOceanLiquidity(bob, greatPool, '0.75', poolShares)
const newDtReserve = await Pool.getOceanReserve(bob, greatPool) const newDtReserve = await Pool.getOceanReserve(greatPool)
const newbobDtBalance = await datatoken.balance(oceanTokenAddress, bob) const newbobDtBalance = await datatoken.balance(oceanTokenAddress, bob)
const newpoolShares = await Pool.sharesBalance(bob, greatPool) const newpoolShares = await Pool.sharesBalance(bob, greatPool)