From 1022ebf1c2dc902e8d3a0ee4ea5039ff531e5c30 Mon Sep 17 00:00:00 2001 From: William Poulin Date: Tue, 5 Sep 2023 16:40:06 -0400 Subject: [PATCH 1/2] fix(curve): Fix gauge v6 and dynamic pools without fee (#2932) --- .../common/curve.pool-dynamic-v2.token-fetcher.ts | 12 ++++++++---- .../curve.pool-gauge-v6.contract-position-fetcher.ts | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/apps/curve/common/curve.pool-dynamic-v2.token-fetcher.ts b/src/apps/curve/common/curve.pool-dynamic-v2.token-fetcher.ts index bb4ec7b38..05a45a5d1 100644 --- a/src/apps/curve/common/curve.pool-dynamic-v2.token-fetcher.ts +++ b/src/apps/curve/common/curve.pool-dynamic-v2.token-fetcher.ts @@ -138,10 +138,14 @@ export abstract class CurvePoolDynamicV2TokenFetcher 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; diff --git a/src/apps/curve/common/curve.pool-gauge-v6.contract-position-fetcher.ts b/src/apps/curve/common/curve.pool-gauge-v6.contract-position-fetcher.ts index 76a07e8d1..a1c2c9997 100644 --- a/src/apps/curve/common/curve.pool-gauge-v6.contract-position-fetcher.ts +++ b/src/apps/curve/common/curve.pool-gauge-v6.contract-position-fetcher.ts @@ -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'; @@ -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, @@ -101,7 +105,7 @@ export abstract class CurvePoolGaugeV6ContractPositionFetcher< }), ); - return gaugeDefinitions; + return _.compact(gaugeDefinitions); } async getTokenDefinitions({ definition }: GetTokenDefinitionsParams) { From fb0b9ab8b3cebf1c21e6fef3db641d244ca63d43 Mon Sep 17 00:00:00 2001 From: zapper-bot <92882759+zapper-bot@users.noreply.github.com> Date: Tue, 5 Sep 2023 16:51:16 -0400 Subject: [PATCH 2/2] chore(main): release 0.528.3 (#2933) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0db8cb29a..8727dea24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/package.json b/package.json index cece37066..7c5b4ea4b 100644 --- a/package.json +++ b/package.json @@ -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",