> 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/reference/contracts/lending-borrowing.md).

# Lending & Borrowing

This page gives a conceptual view of the **PrimeFi v2** lending and borrowing contracts. It is not an ABI or integration specification, and the exact reserve configuration and addresses vary by network.

## Core lifecycle

1. **Supply:** a user supplies a supported reserve and receives interest-bearing [pTokens](/product/lend/ptokens.md) representing the supplied position.
2. **Use collateral and borrow:** an eligible supplied asset can be enabled as collateral. A borrow creates the corresponding [variable-debt token](/product/borrow/vdtokens.md) balance.
3. **Accrue and monitor:** interest indexes update supplied and borrowed balances. Oracle prices and reserve risk parameters determine borrowing capacity and [health factor](/product/borrow/health-factor.md).
4. **Repay or withdraw:** repaying reduces debt. If debt remains, a withdrawal must leave the account within the market's collateral requirements.
5. **Liquidation:** when an account crosses the configured liquidation threshold, an eligible liquidator can repay part of its debt and receive collateral under the market's [liquidation rules](/product/borrow/liquidations.md).

Cross-chain borrowing, where enabled, adds Stargate liquidity or routing and LayerZero messaging to this local-market flow; see [Stargate Borrow](/reference/contracts/lending-borrowing/stargate.md). Integrators should verify the selected network, current configuration and deployed address under [Smart Contracts Addresses](/reference/smart-contracts-addresses.md).

The app's **v3** family uses separate Aave v3 deployments. The XRP testnets are PrimeFi-operated, while Fathom on XDC is third-party; see the [v3 market boundary](/v3-market-family/fathom-v3.md).

## Contract overview

The diagram summarizes the principal actors and calls; it intentionally omits many checks and internal interactions.

![Lending and Borrowing Contract Overview](https://4217557780-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fo4SISzko0XTUUE5cJyPX%2Fuploads%2Fgit-blob-ae1ce92eee55616adfdff01f13d99883749310ab%2Flending-borrowing.drawio.svg?alt=media\&token=93243d2a-4253-4167-904d-a68ec54b6440)
