Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/virtual balance #586

Merged
merged 3 commits into from
Jul 27, 2024
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
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 @@ -191,11 +194,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
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ export function calculateReserveDebt(
const totalVariableDebt = getTotalVariableDebt(reserveDebt, currentTimestamp);
const totalStableDebt = getTotalStableDebt(reserveDebt, currentTimestamp);
const totalDebt = totalVariableDebt.plus(totalStableDebt);
const totalLiquidity = totalDebt
.plus(reserveDebt.availableLiquidity)
.plus(reserveDebt.virtualUnderlyingBalance);
const totalLiquidity = totalDebt.plus(reserveDebt.availableLiquidity);
return {
totalVariableDebt,
totalStableDebt,
Expand Down
Loading