Skip to content

Commit

Permalink
Merge pull request #429 from oceanprotocol/bug/fix_getPoolSharesByAdd…
Browse files Browse the repository at this point in the history
…ress

fix getPoolSharesByAddress
  • Loading branch information
alexcos20 authored Oct 29, 2020
2 parents 7b16f75 + 07c3835 commit fe5c99f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/balancer/OceanPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -913,23 +913,25 @@ export class OceanPool extends Pool {
const factory = new this.web3.eth.Contract(this.factoryABI, this.factoryAddress)

const events = await factory.getPastEvents('BPoolRegistered', {
filter: account ? { registeredBy: account } : {},
filter: {},
fromBlock: BPFACTORY_DEPLOY_BLOCK,
toBlock: 'latest'
})

for (let i = 0; i < events.length; i++) {
const shares = await super.sharesBalance(account, events[i].returnValues[0])
if (shares) {
const onePool: PoolShare = {
shares,
poolAddress: events[i].returnValues[0],
did: didPrefixed(didNoZeroX(await this.getDTAddress(events[i].returnValues[0])))
if (parseFloat(shares) > 0) {
const dtAddress = await this.getDTAddress(events[i].returnValues[0])
if (dtAddress) {
const onePool: PoolShare = {
shares,
poolAddress: events[i].returnValues[0],
did: didPrefixed(didNoZeroX(dtAddress))
}
result.push(onePool)
}
result.push(onePool)
}
}
console.log(result)
return result
}

Expand Down

0 comments on commit fe5c99f

Please sign in to comment.