Skip to content

Commit

Permalink
hotfix: fix reward tokens apr breakdown (#3936)
Browse files Browse the repository at this point in the history
  • Loading branch information
mendesfabio authored Aug 10, 2023
1 parent 01232c9 commit cd3637d
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { bnum } from '@/lib/utils';
import { Pool } from '@/services/pool/types';
import { AprBreakdown } from '@balancer-labs/sdk';
import { useTokens } from '@/providers/tokens.provider';
import { hasBalEmissions } from '@/composables/useAPR';
import { hasBalEmissions, hasStakingRewards } from '@/composables/useAPR';
/**
* TYPES
Expand Down Expand Up @@ -84,13 +84,15 @@ const breakdownItems = computed((): Array<any> => {
}
if (hasRewardTokens.value) {
if (isMinMaxSame.value) {
if (isMinMaxSame.value && minBalAPR.value > 0) {
items.push(['BAL', minBalAPR.value]);
}
const rewardAprTokens = apr.value?.rewardAprs.breakdown;
if (rewardAprTokens) {
Object.keys(rewardAprTokens).forEach(address => {
if (rewardAprTokens[address] === 0) return;
items.push([
getToken(address)?.symbol || 'Rewards',
rewardAprTokens[address],
Expand All @@ -116,7 +118,10 @@ const breakdownItems = computed((): Array<any> => {
</div>
</div>
<template v-else>
<BalBreakdown v-if="hasBalEmissions(apr)" :items="breakdownItems">
<BalBreakdown
v-if="hasBalEmissions(apr) || hasStakingRewards(apr)"
:items="breakdownItems"
>
<div class="flex items-center">
{{ unboostedTotalAPR }}
<span class="ml-1 text-xs text-secondary">
Expand All @@ -134,12 +139,6 @@ const breakdownItems = computed((): Array<any> => {
</span>
</template>
</BalBreakdown>
<div v-else-if="hasRewardTokens" class="flex items-center">
{{ fNum(rewardTokensAPR, FNumFormats.bp) }}
<span class="ml-1 text-xs text-secondary">
{{ $t('staking.stakingApr') }}
</span>
</div>
</template>
</div>
</template>

0 comments on commit cd3637d

Please sign in to comment.