Skip to content

Commit

Permalink
Merge branch 'v3-canary' into sor-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
johngrantuk committed Sep 7, 2023
2 parents abbc61e + cd78056 commit 08767d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions modules/pool/lib/apr-data-sources/boosted-pool-apr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 1 addition & 3 deletions modules/pool/lib/apr-data-sources/ib-tokens-apr.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions modules/pool/pool.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit 08767d1

Please sign in to comment.