From 3d3f8a4950fd725ff0eedf8129dced6cb0c5107c Mon Sep 17 00:00:00 2001 From: franzns <93920061+franzns@users.noreply.github.com> Date: Tue, 19 Nov 2024 10:22:55 +0100 Subject: [PATCH] test for tvl (#1172) --- .../ve-bal-gauge-apr.service.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/modules/pool/lib/apr-data-sources/ve-bal-gauge-apr.service.ts b/modules/pool/lib/apr-data-sources/ve-bal-gauge-apr.service.ts index 5c165211..ab6f12a6 100644 --- a/modules/pool/lib/apr-data-sources/ve-bal-gauge-apr.service.ts +++ b/modules/pool/lib/apr-data-sources/ve-bal-gauge-apr.service.ts @@ -117,10 +117,12 @@ export class GaugeAprService implements PoolAprService { // this is deprecated if (isVeBalemissions && (networkContext.chain === 'MAINNET' || gauge.version === 2)) { let minApr = 0; - if (workingSupply > 0 && totalShares > 0) { - minApr = (((totalShares * 0.4) / workingSupply) * rewardPerYear) / gaugeTvl; - } else if (gaugeTvl > 0) { - minApr = rewardPerYear / gaugeTvl; + if (gaugeTvl > 0) { + if (workingSupply > 0 && totalShares > 0) { + minApr = (((totalShares * 0.4) / workingSupply) * rewardPerYear) / gaugeTvl; + } else { + minApr = rewardPerYear / gaugeTvl; + } } const aprRangeId = `${itemData.id}-range`; @@ -134,6 +136,13 @@ export class GaugeAprService implements PoolAprService { }; itemData.apr = minApr * this.MAX_VEBAL_BOOST; + if (Number.isNaN(itemData.apr)) { + console.log(`${gauge.id} ${symbol} apr is NaN`); + console.log('rewardPerYear', rewardPerYear); + console.log('gaugeTvl', gaugeTvl); + console.log('totalShares', totalShares); + console.log('workingSupply', workingSupply); + } return [itemData, rangeData]; } else {