Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

fix(compound): Put meta on app level for Impermax instead of Compound #520

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/apps/compound/ethereum/compound.balance-fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@ export class EthereumCompoundBalanceFetcher implements BalanceFetcher {
this.getClaimableBalances(address),
]);

const supplyProduct = { label: 'Supply', assets: supplyBalances };
const borrowProduct = { label: 'Borrow', assets: borrowBalances };
const claimableProduct = { label: 'Claimable', assets: claimableBalances };
const meta = this.compoundLendingMetaHelper.getMeta({ balances: [...supplyBalances, ...borrowBalances] });
const claimableProduct = { label: 'Claimable', assets: claimableBalances };
const lendingProduct = { label: 'Lending', assets: [...supplyBalances, ...borrowBalances], meta };

return presentBalanceFetcherResponse([supplyProduct, borrowProduct, claimableProduct], meta);
return presentBalanceFetcherResponse([lendingProduct, claimableProduct]);
}
}
25 changes: 11 additions & 14 deletions src/apps/impermax/helpers/impermax.balance-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Inject, Injectable } from '@nestjs/common';

import { IAppToolkit, APP_TOOLKIT } from '~app-toolkit/app-toolkit.interface';
import { presentBalanceFetcherResponse } from '~app-toolkit/helpers/presentation/balance-fetcher-response.present';
import { CompoundLendingMetaHelper } from '~apps/compound';
import { CompoundBorrowBalanceHelper } from '~apps/compound/helper/compound.borrow.balance-helper';
import { CompoundSupplyBalanceHelper } from '~apps/compound/helper/compound.supply.balance-helper';

Expand All @@ -17,6 +18,8 @@ export class ImpermaxBalanceHelper {
private readonly compoundBorrowBalanceHelper: CompoundBorrowBalanceHelper,
@Inject(CompoundSupplyBalanceHelper)
private readonly compoundSupplyBalanceHelper: CompoundSupplyBalanceHelper,
@Inject(CompoundLendingMetaHelper)
private readonly compoundLendingMetaHelper: CompoundLendingMetaHelper,
@Inject(ImpermaxContractFactory)
private readonly contractFactory: ImpermaxContractFactory,
) {}
Expand Down Expand Up @@ -59,19 +62,13 @@ export class ImpermaxBalanceHelper {
this.getCollateralBalances({ address, network }),
]);

return presentBalanceFetcherResponse([
{
label: 'Collateral',
assets: collateralBalances,
},
{
label: 'Borrow',
assets: borrowBalances,
},
{
label: 'Supply',
assets: supplyBalances,
},
]);
const products = [
{ label: 'Collateral', assets: collateralBalances },
{ label: 'Borrow', assets: borrowBalances },
{ label: 'Supply', assets: supplyBalances },
];
const meta = this.compoundLendingMetaHelper.getMeta({ balances: [...supplyBalances, ...borrowBalances] });

return presentBalanceFetcherResponse(products, meta);
}
}