diff --git a/src/keeper/contracts/Token.ts b/src/keeper/contracts/Token.ts index 6f5d8fb..93d96fa 100644 --- a/src/keeper/contracts/Token.ts +++ b/src/keeper/contracts/Token.ts @@ -13,6 +13,10 @@ export default class OceanToken extends ContractBase { return this.sendFrom("approve", [to, price], from) } + public async decimals(): Promise { + return this.call("decimals", []) + } + public async balanceOf(address: string): Promise { return this.call("balanceOf", [address]) .then((balance: string) => new BigNumber(balance).toNumber()) diff --git a/src/ocean/Account.ts b/src/ocean/Account.ts index f9255d8..74cf779 100644 --- a/src/ocean/Account.ts +++ b/src/ocean/Account.ts @@ -33,7 +33,8 @@ export default class Account extends OceanBase { * @return {Promise} */ public async getOceanBalance(): Promise { - return (await Keeper.getInstance()).token.balanceOf(this.id) + const token = (await Keeper.getInstance()).token + return await token.balanceOf(this.id) / (10 ** await token.decimals()) } /**