Common Functions
The Helios protocol provides several common utility functions for retrieving reserve configuration data. Commonly used ones include getReserveFactor
and getDecimals
. These functions are used to read configuration values (stored in a reserve’s configuration map).
getReserveFactor
getReserveFactor
Returns the reserve factor of a given reserve, as a uint256
. The reserve factor represents the percentage of borrowing interest that is allocated to the Helios protocol (e.g. to a treasury or insurance fund), with the remainder of the interest going to suppliers of liquidity (holders of hTokens for that reserve).
The reserve factor is stored as part of the reserve’s configuration bitmap (
ReserveConfigurationMap
).getReserveFactor
isolates the reserve factor bits from this bitmap and returns their value.The value is expressed in basis points (bps). For example, a reserve factor of
1000
would correspond to 10% (since 1000 bps = 10%). If the reserve factor is 10%, then 10% of the interest accrued by borrowers on that asset goes to Helios, and 90% goes to the suppliers of that asset.
getDecimals
getDecimals
Returns the number of decimals used by the reserve’s underlying asset, as a uint256
. This is typically equal to the ERC20 decimals()
of the underlying token.
The decimals value is stored in the reserve’s configuration bitmap.
getDecimals
extracts this value from the stored data.Helios uses the asset’s decimals to scale values for accurate calculations. All internal accounting uses a common base (e.g. 18 decimal fixed-point math via “ray” units), so knowing the asset’s native decimals is important for conversions when minting hTokens, accruing interest, etc.
Last updated