Skip to content

Commit

Permalink
feat: overwrite virtgual acc
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaquinBattilana committed Jul 27, 2024
1 parent 8982861 commit 818ba3a
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ export class UiPoolDataProvider implements UiPoolDataProviderInterface {
const { 0: reservesRaw, 1: poolBaseCurrencyRaw }: ReservesData =
await this.getReservesData({ lendingPoolAddressProvider });

const reservesData: ReserveDataHumanized[] = reservesRaw.map(
reserveRaw => ({
const reservesData: ReserveDataHumanized[] = reservesRaw.map(reserveRaw => {
const virtualUnderlyingBalance =
reserveRaw.virtualUnderlyingBalance.toString();
const { virtualAccActive } = reserveRaw;
return {
id: `${this.chainId}-${reserveRaw.underlyingAsset}-${lendingPoolAddressProvider}`.toLowerCase(),
underlyingAsset: reserveRaw.underlyingAsset.toLowerCase(),
name: reserveRaw.name,
Expand Down Expand Up @@ -156,7 +159,9 @@ export class UiPoolDataProvider implements UiPoolDataProviderInterface {
reserveRaw.variableDebtTokenAddress.toString(),
interestRateStrategyAddress:
reserveRaw.interestRateStrategyAddress.toString(),
availableLiquidity: reserveRaw.availableLiquidity.toString(),
availableLiquidity: virtualAccActive
? virtualUnderlyingBalance
: reserveRaw.availableLiquidity.toString(),
totalPrincipalStableDebt:
reserveRaw.totalPrincipalStableDebt.toString(),
averageStableRate: reserveRaw.averageStableRate.toString(),
Expand Down Expand Up @@ -191,11 +196,10 @@ export class UiPoolDataProvider implements UiPoolDataProviderInterface {
debtCeilingDecimals: reserveRaw.debtCeilingDecimals.toNumber(),
isSiloedBorrowing: reserveRaw.isSiloedBorrowing,
flashLoanEnabled: reserveRaw.flashLoanEnabled,
virtualAccActive: reserveRaw.virtualAccActive,
virtualUnderlyingBalance:
reserveRaw.virtualUnderlyingBalance.toString(),
}),
);
virtualAccActive,
virtualUnderlyingBalance,
};
});

const baseCurrencyData: PoolBaseCurrencyHumanized = {
// this is to get the decimals from the unit so 1e18 = string length of 19 - 1 to get the number of 0
Expand Down

0 comments on commit 818ba3a

Please sign in to comment.