Skip to content

Commit

Permalink
fix: number of stakers from v3 indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
gluneau committed Mar 4, 2024
1 parent 5ca0680 commit b4983f2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
7 changes: 6 additions & 1 deletion src/components/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import Collators from 'src/components/dashboard/Collators.vue';
import NetworkStatus from 'src/components/dashboard/NetworkStatus.vue';
import TokenPriceChart from 'src/components/dashboard/TokenPriceChart.vue';
// import TotalTransactionsChart from 'src/components/dashboard/TotalTransactionsChart.vue';
import { useDataCalculations } from 'src/staking-v3/hooks';
import TvlChart from 'src/components/dashboard/TvlChart.vue';
import { useNetworkInfo, useTvlHistorical } from 'src/hooks';
import { textChart } from 'src/modules/token-api';
Expand Down Expand Up @@ -94,9 +95,13 @@ export default defineComponent({
handleMergedTvlFilterChanged,
filteredMergedTvl,
mergedTvlAmount,
lenStakers,
} = useTvlHistorical();
const { numberOfStakersAndLockers } = useDataCalculations();
const lenStakers = computed(
() => `${numberOfStakersAndLockers.value.stakersCount.toLocaleString('en-US')} stakers`
);
const dappStakingTvlTokensDisplay = computed(
() => `${dappStakingTvlTokens.value} ${nativeTokenSymbol.value}`
);
Expand Down
13 changes: 1 addition & 12 deletions src/hooks/useTvlHistorical.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { $api } from 'src/boot/api';
import { computed, ref, watch } from 'vue';
import { useNetworkInfo } from 'src/hooks';
import {
getDappStakers,
getTvlData,
filterTvlData,
mergeTvlArray,
Expand Down Expand Up @@ -32,11 +31,6 @@ export function useTvlHistorical() {

const { currentNetworkName } = useNetworkInfo();

const fetchDappStakers = async (api: ApiPromise) => {
const result = await getDappStakers({ api });
lenStakers.value = `${result.toLocaleString('en-US')} stakers`;
};

const loadData = async (network: string): Promise<void> => {
const {
mergedTvlData,
Expand Down Expand Up @@ -147,11 +141,7 @@ export function useTvlHistorical() {
const api = $api;
try {
if (!currentNetworkName.value || !currentNetworkName.value.length || !api) return;
await Promise.all([
loadData(currentNetworkName.value.toLowerCase()),
fetchDappStakers(api),
getTvl(),
]);
await Promise.all([loadData(currentNetworkName.value.toLowerCase()), getTvl()]);
} catch (error) {
console.error(error);
}
Expand All @@ -168,7 +158,6 @@ export function useTvlHistorical() {
ecosystemTvlAmount,
ecosystemTvl,
dappStakingTvl,
lenStakers,
dappStakingTvlTokens,
handleMergedTvlFilterChanged,
handleDappStakingTvlFilterChanged,
Expand Down
2 changes: 1 addition & 1 deletion src/staking-v3/hooks/useDappStaking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function useDappStaking() {
});

const totalStakerRewards = computed<BigInt>(
() => rewards.value.staker.amount + rewards.value.bonus
() => BigInt(rewards.value.staker.amount) + BigInt(rewards.value.bonus)
);

const constants = computed<Constants | undefined>(() => {
Expand Down

0 comments on commit b4983f2

Please sign in to comment.