Skip to content

Commit

Permalink
dont filter bpt in nested phantomstable
Browse files Browse the repository at this point in the history
  • Loading branch information
franzns committed Nov 6, 2023
1 parent 8d7967a commit 8b27bd7
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions modules/pool/lib/pool-gql-loader.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1001,38 +1001,36 @@ export class PoolGqlLoaderService {
__typename: 'GqlPoolPhantomStableNested',
...pool,
nestingType: this.getPoolNestingType(pool),
tokens: pool.tokens
.filter((token) => token.address !== pool.address)
.map((token) => {
const nestedPool = token.nestedPool;
tokens: pool.tokens.map((token) => {
const nestedPool = token.nestedPool;

if (nestedPool && nestedPool.type === 'LINEAR') {
const totalShares = parseFloat(nestedPool.dynamicData?.totalShares || '0');
const percentOfLinearSupplyNested =
totalShares > 0 ? parseFloat(token.dynamicData?.balance || '0') / totalShares : 0;
if (nestedPool && nestedPool.type === 'LINEAR') {
const totalShares = parseFloat(nestedPool.dynamicData?.totalShares || '0');
const percentOfLinearSupplyNested =
totalShares > 0 ? parseFloat(token.dynamicData?.balance || '0') / totalShares : 0;

return {
...this.mapPoolTokenToGql({
...token,
dynamicData: token.dynamicData
? {
...token.dynamicData,
balance: `${parseFloat(token.dynamicData.balance) * percentOfSupplyNested}`,
}
: null,
}),
__typename: 'GqlPoolTokenLinear',
...this.getLinearPoolTokenData(token, nestedPool),
pool: this.mapNestedPoolToGqlPoolLinearNested(
nestedPool,
percentOfSupplyNested * percentOfLinearSupplyNested,
),
totalBalance: token.dynamicData?.balance || '0',
};
}
return {
...this.mapPoolTokenToGql({
...token,
dynamicData: token.dynamicData
? {
...token.dynamicData,
balance: `${parseFloat(token.dynamicData.balance) * percentOfSupplyNested}`,
}
: null,
}),
__typename: 'GqlPoolTokenLinear',
...this.getLinearPoolTokenData(token, nestedPool),
pool: this.mapNestedPoolToGqlPoolLinearNested(
nestedPool,
percentOfSupplyNested * percentOfLinearSupplyNested,
),
totalBalance: token.dynamicData?.balance || '0',
};
}

return this.mapPoolTokenToGql(token);
}),
return this.mapPoolTokenToGql(token);
}),
totalLiquidity: `${pool.dynamicData?.totalLiquidity || 0}`,
totalShares: pool.dynamicData?.totalShares || '0',
swapFee: pool.dynamicData?.swapFee || '0',
Expand Down

0 comments on commit 8b27bd7

Please sign in to comment.