Skip to content

Commit

Permalink
Merge pull request #43 from burrowHQ/hotfix-netTvl-issue
Browse files Browse the repository at this point in the history
fix netTvlAPY display issue
  • Loading branch information
xieqiancaosissi authored Mar 7, 2024
2 parents 267e90e + f2dcdd9 commit e53884a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions hooks/useExtraAPY.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ export function useExtraAPY({
const { hasNegativeNetLiquidity } = useNonFarmedAssets();

const hasNetTvlFarms = Object.keys(portfolio.farms.netTvl).length > 0;

const netLiquidityAPY = hasNegativeNetLiquidity
? 0
: hasNetTvlFarms && !onlyMarket
? userNetTvlAPY
: totalNetTvlApy;

let netLiquidityAPY;
if (onlyMarket) {
netLiquidityAPY = totalNetTvlApy;
} else if (hasNegativeNetLiquidity) {
netLiquidityAPY = 0;
} else if (hasNetTvlFarms) {
netLiquidityAPY = userNetTvlAPY;
} else {
netLiquidityAPY = totalNetTvlApy;
}
const asset = assets.data[assetId];

const assetDecimals = asset.metadata.decimals + asset.config.extra_decimals;
const assetPrice = assets.data[assetId].price?.usd || 0;

Expand Down

0 comments on commit e53884a

Please sign in to comment.