use token specific formatter on project page

This commit is contained in:
Barry Gitarts 2019-06-19 09:56:27 -04:00
parent 1380f88c71
commit 765ded684f

View File

@ -1,7 +1,6 @@
/*global web3, BigInt*/
import LiquidPledging from '../embarkArtifacts/contracts/LiquidPledging'
import { getTokenLabel } from './currencies'
import { toEther } from './conversions'
import { getTokenLabel, getTokenByAddress } from './currencies'
const { getPledgeDelegate, numberOfPledges, getPledge } = LiquidPledging.methods
const getPledgeDelegates = (idPledge, numDelegates) => {
@ -86,8 +85,9 @@ export function getAmountsPledged(pledges){
const amounts = {}
pledges.forEach(pledge => {
const { token, amount } = pledge
if (amounts[token]) amounts[token] += Number(toEther(amount))
else amounts[token] = Number(toEther(amount))
const { humanReadibleFn } = getTokenByAddress(token)
if (amounts[token]) amounts[token] += Number(humanReadibleFn(amount))
else amounts[token] = Number(humanReadibleFn(amount))
})
return Object
.entries(amounts)