Skip to content

Commit

Permalink
Hotfix: fix reward tokens apr breakdown (DM) (#3937)
Browse files Browse the repository at this point in the history
* chore: Add migration notices (#3934)

* 1.118.1

* fix reward tokens apr breakdown

---------

Co-authored-by: Tim Robinson <[email protected]>
Co-authored-by: Automated Version Bump <[email protected]>
Co-authored-by: Fábio Mendes <[email protected]>
  • Loading branch information
4 people authored Aug 10, 2023
1 parent b43b933 commit 4bc4783
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer/frontend-v2",
"version": "1.118.0",
"version": "1.118.1",
"engines": {
"node": "=16",
"npm": ">=8"
Expand Down
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>

1 comment on commit 4bc4783

@vercel
Copy link

@vercel vercel bot commented on 4bc4783 Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.