aave-utilities icon indicating copy to clipboard operation
aave-utilities copied to clipboard

Available liquidity calculation

Open Argeare5 opened this issue 10 months ago • 0 comments

Bug Report

Package name / version

@aave/math-utils / 1.28.0

Description

I discovered that the calculation of availableLiquidity in tokens (not in dollars) does not take into account the Borrow cap calculation.

Steps to reproduce

Just console log the data received from this function https://github.com/aave/aave-utilities/blob/master/packages/math-utils/src/formatters/reserve/index.ts#L417

You'll see that availableLiquidity param returned raw from the contract regardless of this calculation https://github.com/aave/aave-utilities/blob/master/packages/math-utils/src/formatters/reserve/index.ts#L138C9-L138C27

Expected behavior

I believe that it should return processed from this function, taking into account the calculation (like the availableLiquidityUSD). I also think it makes sense to add these Math.max(availableLiquidity, 0) to availableLiquidity param as you already did in your UI:https://github.com/aave/interface/blob/main/src/modules/reserve-overview/ReserveTopDetails.tsx#L58 .

Argeare5 avatar Apr 05 '24 11:04 Argeare5