Skip to content

Commit

Permalink
Merge pull request #693 from bancorprotocol/hotfix/holding_calc
Browse files Browse the repository at this point in the history
Fixed deficit calculation in holdings
  • Loading branch information
RanCohenn authored Oct 3, 2022
2 parents 5f1ea3b + 38f1c6c commit be27a82
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/services/observables/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ const buildPoolV3Object = (
.minus(1)
.times(100)
.toString();

return {
...apiPool,
liquidity,
Expand Down Expand Up @@ -410,8 +409,22 @@ export const allpoolsV3$ = combineLatest([
switchMapIgnoreThrow(
async ([apiPoolsV3, allTokens, standardRewardPrograms]) => {
const tokensMap = new Map(allTokens.map((t) => [t.address, t]));
const poolIds = apiPoolsV3.map((pool) => pool.poolDltId);

const latestProgramIds = await fetchLatestProgramIdsMulticall(apiPoolsV3);
const [
latestProgramIds,
masterVaultBalances,
extVaultBalances,
extVaultIsPaused,
] = await Promise.all([
fetchLatestProgramIdsMulticall(apiPoolsV3),
fetchTokenBalanceMulticall(poolIds, bancorMasterVault),
fetchTokenBalanceMulticall(
poolIds,
ContractsApi.ExternalProtectionVault.contractAddress
),
ContractsApi.ExternalProtectionVault.read.isPaused(),
]);

const pools = await Promise.all(
apiPoolsV3.map(
Expand All @@ -421,7 +434,9 @@ export const allpoolsV3$ = combineLatest([
pool,
tokensMap.get(pool.poolDltId),
latestProgramIds,
standardRewardPrograms
standardRewardPrograms,
masterVaultBalances,
!extVaultIsPaused ? extVaultBalances : undefined
)
)
);
Expand Down

0 comments on commit be27a82

Please sign in to comment.