Fix kredits balance handling

Kredits are stored on the Token contract as uint256 / bignumbers with 18
decimal points. Just like Ether and required by the ERC20 standard.
So we need to work with bignumbers and format a bignumber value here.
This commit is contained in:
2019-04-19 11:37:18 +02:00
parent 6dcbd1efbf
commit 2aae2a8f90
4 changed files with 41 additions and 2 deletions
+5 -1
View File
@@ -7,6 +7,8 @@ import { computed } from '@ember/object';
import { alias, notEmpty } from '@ember/object/computed';
import { isEmpty } from '@ember/utils';
import formatKredits from 'kredits-web/utils/format-kredits';
import config from 'kredits-web/config/environment';
import Contributor from 'kredits-web/models/contributor'
import Proposal from 'kredits-web/models/proposal'
@@ -109,7 +111,9 @@ export default Service.extend({
},
totalSupply: computed(function() {
return this.kredits.Token.functions.totalSupply();
return this.kredits.Token.functions.totalSupply().then(total => {
return Promise.resolve(formatKredits(total));
})
}),
loadInitialData() {