diff --git a/CHANGELOG.md b/CHANGELOG.md index c4870bf7a..852243551 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # backend +## 1.56.6 + +### Patch Changes + +- 1b9df4f: fix handling preferred gauge APRs +- 2768be6: fix handling PREFERRED gauge + ## 1.56.5 ### Patch Changes diff --git a/modules/aprs/examples/integration.ts b/modules/aprs/examples/integration.ts index acb1afc2f..b75ddedc7 100644 --- a/modules/aprs/examples/integration.ts +++ b/modules/aprs/examples/integration.ts @@ -2,8 +2,8 @@ import { AprService } from '../'; import { Chain } from '@prisma/client'; async function calculationExample( - chain: Chain = 'MAINNET', - poolId = '0x3de27efa2f1aa663ae5d458857e731c129069f29000200000000000000000588', + chain: Chain = 'POLYGON', + poolId = '0xe2f706ef1f7240b803aae877c9c762644bb808d80002000000000000000008c2', ) { const service = new AprService(); diff --git a/modules/aprs/handlers/liquidity-gauge-apr/liquidity-gauge-apr-handler.ts b/modules/aprs/handlers/liquidity-gauge-apr/liquidity-gauge-apr-handler.ts index c3b562e7e..354172051 100644 --- a/modules/aprs/handlers/liquidity-gauge-apr/liquidity-gauge-apr-handler.ts +++ b/modules/aprs/handlers/liquidity-gauge-apr/liquidity-gauge-apr-handler.ts @@ -31,7 +31,8 @@ export class LiquidityGaugeAprHandler implements AprHandler { const aprItems: Omit[] = []; for (const pool of pools) { - const gauge = pool.staking.find((s) => s.type === 'GAUGE')?.gauge; + const gauges = pool.staking.filter((s) => s.type === 'GAUGE').map((s) => s.gauge); + const gauge = gauges.sort((a, b) => (a?.status === 'PREFERRED' ? -1 : 1))?.[0]; if (!gauge || !gauge.rewards || !pool.dynamicData || pool.dynamicData.totalShares === '0') { continue; diff --git a/package.json b/package.json index 6cfb8023c..3b0c7789c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backend", - "version": "1.56.5", + "version": "1.56.6", "description": "Backend service for Beethoven X and Balancer", "repository": "https://github.com/balancer/backend", "author": "Beethoven X",