diff --git a/modules/pool/lib/apr-data-sources/boosted-pool-apr.service.ts b/modules/pool/lib/apr-data-sources/boosted-pool-apr.service.ts index fecb8d601..bde186165 100644 --- a/modules/pool/lib/apr-data-sources/boosted-pool-apr.service.ts +++ b/modules/pool/lib/apr-data-sources/boosted-pool-apr.service.ts @@ -66,7 +66,7 @@ export class BoostedPoolAprService implements PoolAprService { const aprItems = await prisma.prismaPoolAprItem.findMany({ where: { poolId: { in: poolIds }, - type: { in: ['LINEAR_BOOSTED', 'PHANTOM_STABLE_BOOSTED', 'IB_YIELD'] }, + type: { in: ['LINEAR_BOOSTED', 'PHANTOM_STABLE_BOOSTED', 'IB_YIELD', 'SWAP_FEE'] }, chain: networkContext.chain, }, }); @@ -94,7 +94,9 @@ export class BoostedPoolAprService implements PoolAprService { if ( collectsYieldFee(pool) && //nested phantom stables already have the yield fee removed - token.nestedPool.type !== 'PHANTOM_STABLE' + token.nestedPool.type !== 'PHANTOM_STABLE' && + // nested tokens/bpts that dont have a rate provider, we don't take any fees + token.dynamicData.priceRate !== '1.0' ) { userApr = apr * (1 - protocolYieldFeePercentage); } diff --git a/modules/pool/lib/apr-data-sources/ib-tokens-apr.service.ts b/modules/pool/lib/apr-data-sources/ib-tokens-apr.service.ts index a2f2db527..dc3dda53c 100644 --- a/modules/pool/lib/apr-data-sources/ib-tokens-apr.service.ts +++ b/modules/pool/lib/apr-data-sources/ib-tokens-apr.service.ts @@ -55,8 +55,6 @@ export class IbTokensAprService implements PoolAprService { continue; } - // TODO: We should check whether the token has a rate provider set, but we don't store this information yet - for (const token of pool.tokens) { const tokenApr = aprs.get(token.address); if (!tokenApr) { @@ -75,7 +73,7 @@ export class IbTokensAprService implements PoolAprService { let aprInPoolAfterFees = tokenApr.apr * tokenPercentageInPool; - if (collectsYieldFee(pool)) { + if (collectsYieldFee(pool) && token.dynamicData && token.dynamicData.priceRate !== '1.0') { const protocolYieldFeePercentage = pool.dynamicData?.protocolYieldFee ? parseFloat(pool.dynamicData.protocolYieldFee) : networkContext.data.balancer.yieldProtocolFeePercentage; diff --git a/modules/pool/pool.service.ts b/modules/pool/pool.service.ts index 05308a2e8..d34bef12c 100644 --- a/modules/pool/pool.service.ts +++ b/modules/pool/pool.service.ts @@ -443,6 +443,10 @@ export class PoolService { await prisma.prismaPoolLinearData.deleteMany({ where: { chain: networkContext.chain, poolId: poolId }, }); + + await prisma.prismaPoolGyroData.deleteMany({ + where: { chain: networkContext.chain, poolId: poolId }, + }); await prisma.prismaPoolGyroData.deleteMany({ where: { chain: networkContext.chain, poolId: poolId },