More selective number → string conversion in `fetch_aave_reserves_shapshot`
Closed this issue · 1 comments
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 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.