2aae2a8f90
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.
30 lines
721 B
JavaScript
30 lines
721 B
JavaScript
import { computed } from '@ember/object';
|
|
import EmberObject from '@ember/object';
|
|
import bignumber from 'kredits-web/utils/cps/bignumber';
|
|
import kreditsValue from 'kredits-web/utils/cps/kredits';
|
|
|
|
export default EmberObject.extend({
|
|
// Contract
|
|
id: bignumber('idRaw', 'toString'),
|
|
account: null,
|
|
balance: kreditsValue('balanceRaw'),
|
|
isCore: false,
|
|
ipfsHash: null,
|
|
|
|
// IPFS
|
|
kind: null,
|
|
name: null,
|
|
url: null,
|
|
github_username: null,
|
|
github_uid: null,
|
|
wiki_username: null,
|
|
ipfsData: '',
|
|
|
|
avatarURL: computed('github_uid', function() {
|
|
let github_uid = this.github_uid;
|
|
if (github_uid) {
|
|
return `https://avatars2.githubusercontent.com/u/${github_uid}?v=3&s=128`;
|
|
}
|
|
}),
|
|
});
|