Skip to content

Commit

Permalink
test for tvl (#1172)
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns authored Nov 19, 2024
1 parent d587351 commit 3d3f8a4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions modules/pool/lib/apr-data-sources/ve-bal-gauge-apr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand All @@ -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 {
Expand Down

0 comments on commit 3d3f8a4

Please sign in to comment.