The output from fetch_aave_reserves_shapshot is made available to frontend via the lending-reserve/details API. frontend needs to convert this data into human-readable USD values using @aave/math-utils.
When calling the formatReserveUSD function from the @aave package, the following error occurs:
Error: [BigNumber Error] Argument not a primitive number: 18
This is due to the decimals value being "18" (string) instead of 18 (number). The @aave/math-utils conversion functions fail when the wrong type is supplied.
Reviewing the ReserveData interface defined by @aave/math-utils, it appears the following properties should preserve the number type:
decimals
stableDebtLastUpdateTimestamp
lastUpdateTimestamp
eModeCategoryId
debtCeilingDecimals
eModeLtv
eModeLiquidationThreshold
eModeLiquidationBonus
Other numeric values are expected to be strings in order to retain precision.
Issue
The
fetch_aave_reserves_shapshot
function converts all numeric values to strings. This conflicts with the type expectations of the@aave/math-utils
module.Details
The output from
fetch_aave_reserves_shapshot
is made available tofrontend
via thelending-reserve/details
API.frontend
needs to convert this data into human-readable USD values using@aave/math-utils
.When calling the
formatReserveUSD
function from the@aave
package, the following error occurs:This is due to the
decimals
value being"18"
(string) instead of18
(number). The@aave/math-utils
conversion functions fail when the wrong type is supplied.Reviewing the
ReserveData
interface defined by@aave/math-utils
, it appears the following properties should preserve thenumber
type:decimals
stableDebtLastUpdateTimestamp
lastUpdateTimestamp
eModeCategoryId
debtCeilingDecimals
eModeLtv
eModeLiquidationThreshold
eModeLiquidationBonus
Other numeric values are expected to be strings in order to retain precision.