aave-utilities
aave-utilities copied to clipboard
Available liquidity calculation
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 .