Helios Finance
  • Introduction
    • Problem - Solution
    • How Helios Differs from Other Protocols
    • Summary of Capabilities
  • Quickstart
    • Installing Leather Wallet
    • Add MIDL regtest on Leather
    • Get test tokens from faucet
    • Experience the new BTC Defi
  • Architecture
    • Overview
      • Helios & MIDL Architecture Overview
      • MIDL Validator Network (DPoS Consensus Layer)
      • Threshold Signature Scheme
      • Lending Logic Layer by Helios
      • Roles and Responsibilities Summary
    • Bitcoin-Native Smart Contracts
    • Bitcoin Settlement Flow and One-Step Transactions
    • Bitcoin Settlement & Finality
  • Core Concepts
    • Overview
    • BTC-Native Liquidity, Expanded Asset Support
      • Interest Mechanics
      • Supported Assets
    • Partial Collateral Swap (Flexible Position Management)
  • Risk Framework
    • Overview
    • Adaptive Risk Optimization (Mempool- & Volatility-Aware LTVs)
      • More on Adaptive Risk Engine
    • Liquidation Mechanics
  • Capital Efficiency and Use Cases
    • Overview
    • Delta-Neutral Yield Strategies
    • Enhanced Yield for Bitcoin Holders
    • Arbitrage and Market Efficiency
    • Tax-Optimized Borrowing
  • Institutional Compliance and Security
    • Overview
    • KYC-Ready Architecture and Permissioned Pools
      • More on Dual-Layer Market
    • AML, Monitoring, and Auditability
    • Regulatory Alignment (MiCA, BIS/IOSCO, etc.)
  • For Developers
    • Overview
    • Interest Rate Model
    • Supply & Borrow Interest
    • Functions
      • Common Functions
      • Supply & Withdraw
      • Borrow & Repay & Liquidate
      • Flashloan
    • SDK Release Plan
    • Smart Contract Interface via MIDL (EVM on Bitcoin)
    • Transaction Fees
  • Oracles and Price Feeds
  • Running a Liquidator or Integration with Exchanges
Powered by GitBook
On this page
  1. For Developers
  2. Functions

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

function getReserveFactor(DataTypes.ReserveConfigurationMap memory config) internal pure returns (uint256)

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

function getDecimals(DataTypes.ReserveConfigurationMap memory config) internal pure returns (uint256)

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.

PreviousFunctionsNextSupply & Withdraw

Last updated 28 days ago