Skip to content

Commit

Permalink
Merge branch 'Zapper-fi:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
comandar21 authored Sep 6, 2023
2 parents 48ecfc6 + fb0b9ab commit 7393813
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

[1]: https://www.npmjs.com/package/@zapper-fi/studio?activeTab=versions

## [0.528.3](https://github.com/Zapper-fi/studio/compare/v0.528.2...v0.528.3) (2023-09-05)


### Bug Fixes

* **curve:** Fix gauge v6 and dynamic pools without fee ([#2932](https://github.com/Zapper-fi/studio/issues/2932)) ([1022ebf](https://github.com/Zapper-fi/studio/commit/1022ebf1c2dc902e8d3a0ee4ea5039ff531e5c30))

## [0.528.2](https://github.com/Zapper-fi/studio/compare/v0.528.1...v0.528.2) (2023-09-05)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zapper-fi/studio",
"version": "0.528.2",
"version": "0.528.3",
"description": "Community build apps for Zapper.fi",
"license": "MIT",
"main": "./index.js",
Expand Down
12 changes: 8 additions & 4 deletions src/apps/curve/common/curve.pool-dynamic-v2.token-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ export abstract class CurvePoolDynamicV2TokenFetcher<T extends Contract> extends
const defaultDataProps = await super.getDataProps(params);

const { contract, definition } = params;

const fees = await contract.fee();
const fee = Number(fees) / 10 ** 8;

let fee: number;

try {
const fees = await contract.fee();
fee = Number(fees) / 10 ** 8;
} catch {
fee = 0;
}
const volume = await this.volumeDataLoader.load(definition.address);
const feeVolume = fee * volume;
const apy = defaultDataProps.liquidity > 0 ? (feeVolume / defaultDataProps.liquidity) * 365 : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import _, { range } from 'lodash';
import { duration } from 'moment';

import { APP_TOOLKIT, IAppToolkit } from '~app-toolkit/app-toolkit.interface';
import { ZERO_ADDRESS } from '~app-toolkit/constants/address';
import { getLabelFromToken } from '~app-toolkit/helpers/presentation/image.present';
import { IMulticallWrapper } from '~multicall';
import { MetaType } from '~position/position.interface';
Expand Down Expand Up @@ -81,6 +82,9 @@ export abstract class CurvePoolGaugeV6ContractPositionFetcher<
poolRange.map(async poolIndex => {
const tokenAddress = await this.resolveTokenAddress({ contract, poolIndex, multicall });
const gaugeAddress = await this.resolveGaugeAddress({ contract, tokenAddress, multicall });

if (gaugeAddress == ZERO_ADDRESS) return null;

const gaugeV6Contract = this.contractFactory.curveGaugeV6({
address: gaugeAddress.toLowerCase(),
network: this.network,
Expand All @@ -101,7 +105,7 @@ export abstract class CurvePoolGaugeV6ContractPositionFetcher<
}),
);

return gaugeDefinitions;
return _.compact(gaugeDefinitions);
}

async getTokenDefinitions({ definition }: GetTokenDefinitionsParams<CurveGaugeV6, CurvePoolGaugeDefinition>) {
Expand Down

0 comments on commit 7393813

Please sign in to comment.