Skip to content

Commit

Permalink
Merge pull request #235 from oceanprotocol/bug/fix_sharesBalance
Browse files Browse the repository at this point in the history
fix sharesBalance
  • Loading branch information
kremalicious authored Aug 28, 2020
2 parents 5508aa5 + aca303a commit c7eab9a
Showing 1 changed file with 2 additions and 29 deletions.
31 changes: 2 additions & 29 deletions src/balancer/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,37 +142,10 @@ export class Pool extends PoolFactory {
* @return {String}
*/
async sharesBalance(account: string, poolAddress: string): Promise<string> {
const minABI = [
{
constant: true,
inputs: [
{
name: '_owner',
type: 'address'
}
],
name: 'balanceOf',
outputs: [
{
name: 'balance',
type: 'uint256'
}
],
payable: false,
stateMutability: 'view',
type: 'function'
}
] as AbiItem[]

let result = null

try {
const token = new this.web3.eth.Contract(minABI, poolAddress, {
from: account
})
const balance = await token.methods
.balanceOf(account)
.call({ from: account, gas: this.GASLIMIT_DEFAULT })
const token = new this.web3.eth.Contract(this.poolABI, poolAddress)
const balance = await token.methods.balanceOf(account).call()
result = this.web3.utils.fromWei(balance)
} catch (e) {
console.error(e)
Expand Down

0 comments on commit c7eab9a

Please sign in to comment.