> For the complete documentation index, see [llms.txt](https://docs.primefi.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.primefi.xyz/deep-dive/know-your-algorithm/operational-flow/borrowing-flow.md).

# Borrowing Flow

#### Borrowing Flow

1. **Borrow request and validation:** A user with eligible collateral calls `borrow(asset, amount, interestRateMode, referralCode, onBehalfOf)` on `LendingPool`. The Aave v2-derived function signature retains `interestRateMode`, but every live reserve on Base, HyperEVM, and XDC accepts **variable-rate borrowing only**; stable borrowing is disabled by reserve configuration. `ValidationLogic.validateBorrow` checks reserve state, available liquidity, borrowing configuration, collateral value, existing debt, per-reserve LTV, and Health Factor using the oracle prices available at execution.
2. **Variable debt accounting:** After validation, the reserve accrues pending index changes through `updateState()`. `LendingPool` mints `VariableDebtToken` units—shown to users as vdTokens—using the current variable borrow index. If this is the user's first debt in that reserve, the user configuration is updated accordingly. Although inherited deployments can contain `StableDebtToken` contracts and stable-related fields, the live markets do not expose a stable-debt creation or rate-switching flow.
3. **Liquidity transfer and rate update:** The borrow removes available liquidity and increases utilization. The reserve calls `updateInterestRates(...)` with the borrowed amount as liquidity taken, recalculating the variable borrow and supplier liquidity rates under the configured curve. The pToken contract—called an `aToken` in some inherited source interfaces—then transfers the borrowed underlying asset to the destination used by the borrowing flow. A `Borrow` event records the transaction details.
4. **Interest accrual:** Variable debt grows according to the reserve's variable borrow rate and variable borrow index. Contract storage is updated when reserve interactions occur; index calculations account for elapsed time since the previous update. The same reserve accounting updates the liquidity index used for supplier interest. Rates can move as utilization and configured parameters change, and there is no fixed-rate commitment.
5. **Optional borrower incentives:** A variable debt token can be configured as a reward-bearing pool in `ChefIncentivesController`. If enabled, its balance-change hook updates the borrower's reward accounting when debt is minted or burned. Eligibility, emissions, and allocation points are configurable, so active debt does not guarantee PRFI rewards.

{% hint style="warning" %}
Borrow validation is only as reliable as the oracle data returned to the contracts. Authorised price pushers, update freshness, deviation controls, and the market depth behind low-liquidity collateral are separate trust and risk considerations. A pause can limit exposure but can also restrict user actions while active. See [Risks & Assumptions](/deep-dive/know-your-algorithm/risks-and-assumptions.md).
{% endhint %}
