> For the complete documentation index, see [llms.txt](https://docs.hann.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hann.finance/protocol/lending.md).

# Lending markets

Supply assets, borrow against collateral, repay loans, and manage Lending health factor and E-Mode

Supply assets to a Lending market to earn interest. Enable eligible supplied assets as collateral to borrow other assets. Your account's collateral value, debt, and **health factor** determine its borrowing capacity and liquidation status.

Lending uses pooled liquidity and variable-rate loans. [USDHN borrowing](/protocol/borrowing-and-liquidation.md) has its own collateralized debt positions and rules.

## Open a market

1. Open **Market** (`/market`) and connect your wallet to the network selected by the app.
2. Select an asset to open its market (`/market/<asset>`).
3. Review the supply and borrow rates, available liquidity, your position, and the market's limits.
4. Keep native KAIA in your wallet for gas, including when you use an ERC-20 asset.

The KAIA market uses WKAIA inside the Lending pool. The app's native KAIA actions use the **WKaiaGateway** to wrap or unwrap it as part of the transaction. The wallet receives native KAIA when you borrow or withdraw through this route.

| Screen value            | Meaning                                                  |
| ----------------------- | -------------------------------------------------------- |
| Your supply             | Your supplied balance, including accrued supply interest |
| Debt                    | Your outstanding debt, including accrued borrow interest |
| Available liquidity     | Assets currently available for withdrawals and new loans |
| Max LTV                 | The borrowing limit applied to collateral value          |
| Liquidation threshold   | The collateral weighting used to calculate health factor |
| Supply cap / Borrow cap | The market-wide supply and debt limits                   |
| Reserve factor          | The share of borrower interest allocated to the protocol |

The current market determines its assets, limits, and rates. Select **Market details** to inspect the risk, rate model, market size, and limits before signing.

## Supply

1. Select **Supply** and enter the asset amount.
2. Review your resulting supply balance and the collateral status.
3. Select **Review transaction**. Complete the token approval shown in the confirmation screen, then submit the supply transaction.
4. After the transaction succeeds, check **Your supply** and **Collateral use**.

The pool issues an **aToken**, the receipt token for your supplied balance. Its balance includes interest as it accrues; there is no separate claim transaction for this supply interest. An eligible first deposit can be enabled as collateral automatically, subject to the reserve and account's collateral rules.

Supply is limited by your wallet balance and the market's remaining supply capacity. For native KAIA, the app also leaves its gas reserve unspent. A frozen market rejects new supply; a paused or inactive market blocks its affected actions.

## Withdraw

1. Select **Withdraw** and enter the amount to return to your wallet.
2. Review the remaining supplied balance, available liquidity, and health factor after withdrawal.
3. Select **Review transaction**, complete the displayed approval, and confirm the withdrawal.
4. Check the received asset and remaining supply balance after the transaction succeeds.

Withdrawals consume your aToken balance. A withdrawal must fit your supplied balance and available pool liquidity. If the asset backs an outstanding loan, the remaining collateral must also meet the pool's health-factor and LTV checks. Withdrawing the full balance clears that asset's collateral-use flag.

## Borrow

1. Supply a collateral-eligible asset and check that **Collateral use** is enabled.
2. Open the asset you want to borrow and select **Borrow**.
3. Enter the amount. Review your resulting debt, available borrowing capacity, current variable rate, and health factor.
4. Select **Review transaction**. Complete a credit-delegation approval for native KAIA when requested, then confirm the loan transaction.
5. Check the asset received in your wallet and your updated debt.

The app borrows at the **variable rate**. Interest increases the debt balance over time. Borrowing requires an active, unpaused, unfrozen market with borrowing enabled, sufficient liquidity, and enough capacity under the borrow cap and your collateral limits. E-Mode and isolation or siloed-borrowing restrictions also apply to the selected asset.

The amount must fit both the market's capacity and your account's available borrow value. Review the account-level values alongside the amount field's maximum before signing.

## Repay

1. Open the asset you borrowed and select **Repay**.
2. Enter the amount and review the **Applied amount** and remaining debt.
3. Select **Review transaction**, complete the displayed token approval, and confirm repayment.
4. Check the updated debt. After a full repayment, confirm that the debt balance is zero.

Repayment uses the borrowed asset. The pool applies at most the outstanding variable debt at execution time. An ERC-20 repayment transfers the amount actually applied; native KAIA repayment through the Gateway refunds an excess native payment to the sender.

Interest accrues between the quote and execution. The displayed debt and repayment maximum therefore change over time. Refresh the position after repayment to see any remaining balance.

## Wallet approvals

An approval grants permission; the following supply, withdrawal, or loan transaction performs the action. The app skips an approval transaction when the existing allowance covers the amount.

| Action              | Native KAIA route                                                                     | ERC-20 route                                                  |
| ------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------- |
| Supply              | Send KAIA to the Gateway; no user token approval                                      | Approve the underlying token to the Lending Pool, then supply |
| Withdraw            | Approve **aWKAIA** to the Gateway, then withdraw KAIA                                 | Withdraw through the Pool; no new token approval              |
| Borrow              | Call `approveDelegation` on the variable debt token for the Gateway, then borrow KAIA | Borrow through the Pool; no token approval                    |
| Repay               | Send KAIA to the Gateway; no user token approval                                      | Approve the repayment token to the Lending Pool, then repay   |
| Collateral / E-Mode | Confirm the Pool setting change                                                       | Confirm the Pool setting change                               |

Native borrowing's delegation authorizes the Gateway to create debt on your behalf for the approved amount. It uses the variable debt token's borrowing allowance. Native withdrawal uses an ERC-20 allowance on aWKAIA to move your supply receipt tokens to the Gateway.

## Collateral and health factor

Use the **Collateral use** control on an asset with a supplied position. Enabling it makes the eligible supply count toward account collateral. The current app keeps the disable action unavailable while your Lending account has outstanding debt; repay the debt before turning collateral use off.

For an account with debt, health factor follows:

```
health factor = sum(enabled collateral value × applicable liquidation threshold) / total debt value
```

Values use the same oracle currency. The applicable threshold is the reserve threshold, or the selected E-Mode category's threshold for a matching asset. The displayed **Health factor** covers the entire Lending account.

| Health factor | Position state                               |
| ------------- | -------------------------------------------- |
| Above 1       | Collateral-weighted value exceeds debt value |
| At 1          | The position is at the liquidation boundary  |
| Below 1       | The position is eligible for liquidation     |

Collateral price declines, debt-asset price increases, and accrued interest reduce health factor. Supplying enabled collateral or repaying debt increases it. Borrowing or withdrawing collateral reduces it. Review the **before** and **after** values for each action; the preview estimates the effect using the current account data.

Liquidation repays part of the debt in exchange for collateral and applies the market's liquidation penalty. A successful earlier borrowing transaction does not fix the later health factor. Monitor the account while debt remains open.

## E-Mode

**E-Mode** applies category-specific LTV and liquidation thresholds to eligible collateral. While a category is active, new loans must use assets in that category.

1. Open the **E-Mode** control in the Market account summary.
2. Select a category and review its eligible assets, any blocking assets, maximum LTV, and health-factor change.
3. Select **Enable E-Mode** and confirm the setting change.
4. Use the active category control to select **Change E-Mode**, or select **Disable E-Mode** to return to the ordinary reserve parameters.

Existing debt must be compatible with the category you enter. Changing or exiting an active category must preserve a health factor of at least 1 under the resulting parameters. If the ordinary thresholds cannot support your debt, repay debt or add collateral before exiting. Category membership and parameters come from the current market configuration.

## Rates, costs, and unavailable actions

Supply and borrow rates change with market utilization and the configured rate model. The supply rate already reflects the reserve factor. The variable borrow rate continues to affect debt after the initial loan.

Every on-chain approval and action uses KAIA gas. Token approvals and credit delegation have separate transactions from the action they authorize.

| Reason an action is unavailable          | What to check                                                   |
| ---------------------------------------- | --------------------------------------------------------------- |
| Insufficient balance                     | The input asset balance and KAIA gas balance                    |
| Supply or borrow cap reached             | The remaining capacity shown in **Limits**                      |
| Insufficient liquidity                   | Available liquidity and the requested withdrawal or loan amount |
| Collateral or health-factor limit        | The account's debt, enabled collateral, and action preview      |
| Incompatible E-Mode assets               | The selected category's eligible and blocking assets            |
| Frozen, paused, or inactive market       | The market status and the specific action that is disabled      |
| Position or transaction data unavailable | The displayed data error; reload that data before submitting    |

Rejecting a wallet request leaves the action unsubmitted. If an approval has succeeded but the following action fails, the approval remains and the position does not change from that failed action. A successful action receipt confirms execution; then check the refreshed position and asset balance.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hann.finance/protocol/lending.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
