Skip to content

Commit

Permalink
Merge pull request #83 from loomnetwork/add-total-staked
Browse files Browse the repository at this point in the history
add total staked
  • Loading branch information
lukezhangstudio committed Feb 22, 2019
2 parents 27544ac + 43e3683 commit 16ebd59
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
17 changes: 16 additions & 1 deletion src/store/dappChainStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,22 @@ export default {
return agg;
},{})
//debugger

let whitelist = {
"NGC_LOOM": new BN("5999982000000000000000000"),
"plasma-0": new BN("10000000000000000000000000"),
"plasma-1": new BN("10000000000000000000000000"),
"plasma-3": new BN("10000000000000000000000000"),
"plasma-4": new BN("10000000000000000000000000"),
"stakewith.us": new BN("11746840000000000000000000")
}

const candidateList = dpos2Candidates.map((candidate,i) => {
let address = LocalAddress.fromPublicKey(candidate.pubKey).toString();
let delegationTotal = keyedDelegTotals[address] ? keyedDelegTotals[address] : new BN(0);
let whitelistAmount = whitelist[candidate.name] || new BN("1250000000000000000000000");
let totalStaked = delegationTotal.add(whitelistAmount);
console.log(delegationTotal.toString(),totalStaked.toString())
return {
pubKey: CryptoUtils.Uint8ArrayToB64(candidate.pubKey),
address,
Expand All @@ -405,7 +419,8 @@ export default {
description: candidate.description,
fee: candidate.fee.toString(),
name: candidate.name,
delegationsTotal: keyedDelegTotals[address] ? keyedDelegTotals[address].toString() : 0
delegationsTotal: delegationTotal.toString(),
totalStaked: totalStaked.toString()
}
})
const combination = [...candidateList]
Expand Down
3 changes: 2 additions & 1 deletion src/store/dposStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const defaultState = () => {
validatorFields: [
{ key: 'Name', sortable: true },
{ key: 'Status', sortable: true },
{ key: 'delegationsTotal', sortable: true, label: "Delegations total" },
{ key: 'totalStaked', sortable: true, label: "Total Staked" },
{ key: 'votingPower', sortable: true, label: "Voting power" },
// { key: 'Weight', sortable: true },
{ key: 'Fees', sortable: true },
Expand Down Expand Up @@ -175,6 +175,7 @@ export default {
Stake: (formatToCrypto(validator.stake) || '0'),
votingPower: formatToCrypto(validator.stake || 0),
delegationsTotal: formatToCrypto(validator.delegationsTotal),
totalStaked: formatToCrypto(validator.totalStaked),
Weight: (validator.weight || '0') + '%',
Fees: isBootstrap ? 'N/A' : (validator.fee/100 || '0') + '%',
Uptime: (validator.uptime || '0') + '%',
Expand Down
9 changes: 3 additions & 6 deletions src/views/ValidatorDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,10 @@ const DPOSStore = createNamespacedHelpers('DPOS')
})
export default class ValidatorDetail extends Vue {
fields = [
{ key: 'Status', sortable: false },
{ key: 'delegationsTotal', sortable: true , label: 'Delegations Total'},
{ key: 'votingPower', sortable: true , label: 'Voting Power'},
// { key: 'Weight', sortable: false },
{ key: 'Status' },
{ key: 'totalStaked', label: 'Total Staked'},
{ key: 'votingPower', label: 'Voting Power'},
{ key: 'Fees', sortable: false },
// { key: 'Uptime', sortable: false },
// { key: 'Slashes', sortable: false },
]
validator = {}
Expand Down

0 comments on commit 16ebd59

Please sign in to comment.