Overview
The Lending & Borrowing module allows users to deposit RWT or stablecoins (USDC, USDY) to earn interest, and borrow stablecoins against RWT collateral. It operates as a standalone lending market built on AREAL’s native infrastructure — not an extension of DEX pools. The core use case: a user holds RWT and wants USDC liquidity without selling their RWT. They deposit RWT as collateral, borrow USDC, and continue to benefit from RWT’s NAV Book Value growth while using the borrowed stablecoins.This module focuses on RWT ↔ stablecoin pairs only. Ownership Token lending may be added in the future as a separate market with different risk parameters.
How It Works
For depositors (earn interest)
Deposit USDC or USDY into the lending market. Your tokens are made available for borrowers. In return, you earn per-second interest — accrued continuously via MagicBlock Ephemeral Rollup and auto-compounded into your position.- No lock-ups — withdraw at any time (subject to available liquidity)
- Interest rate adjusts dynamically based on market utilization
- Higher utilization = higher APY for depositors
For borrowers (get stablecoins without selling RWT)
Deposit RWT as collateral and borrow USDC or USDY. Your RWT remains in the protocol and continues to appreciate from NAV Book Value growth — you don’t lose yield exposure.- Borrow up to the configured LTV ratio of your collateral value
- Interest accrues per-second — repay at any time, no deadlines
- If your Health Factor drops below 1.0, your position can be liquidated
On-Chain Accounts
LendingMarket
Main market PDA. Stores total deposits, total borrows, current interest rate, utilization ratio, and reserve factor. One market per stablecoin (USDC market, USDY market). Seeds:
["lending_market", stablecoin_mint].DepositPosition
Per-depositor PDA. Tracks deposited stablecoin amount and accrued interest. Interest is auto-compounded — the position value grows every second. Seeds:
["deposit", market, depositor].BorrowPosition
Per-borrower PDA. Stores deposited RWT collateral amount, borrowed stablecoin amount, accrued interest, entry timestamp, and Health Factor snapshot. Seeds:
["borrow", market, borrower].LendingConfig
Global configuration managed by AREAL DAO: LTV ratio, liquidation threshold, liquidation penalty, interest rate model parameters, reserve factor, and oracle references. Seeds:
["lending_config"].Core Instructions
initialize_market
initialize_market
Creates a new lending market for a specific stablecoin (USDC or USDY). Sets the interest rate model, LTV, liquidation threshold, and other parameters. Only AREAL DAO can create markets.Authority: Engine Authority (AREAL DAO)
deposit
deposit
Deposits stablecoins (USDC or USDY) into the lending market to earn interest. Creates or updates a
DepositPosition PDA. Interest accrues per-second and is auto-compounded — no manual claiming.Authority: Permissionlesswithdraw
withdraw
Withdraws deposited stablecoins plus accrued interest. May be partially limited if market utilization is very high (most stablecoins lent out to borrowers).Authority: Depositor (must sign)
borrow
borrow
Deposits RWT as collateral and borrows stablecoins. The maximum borrow amount is determined by:
max_borrow = rwt_collateral_value_usd × LTVRWT value is determined by the current market price from the RWT/USDY master pool on the native DEX. This is the real price at which liquidators can sell — making collateral valuation accurate and actionable.Authority: Permissionless
repay
repay
Repays borrowed stablecoins plus accrued interest. After full repayment, RWT collateral is released back to the borrower. Partial repayment improves Health Factor.Authority: Borrower (must sign)
add_collateral
add_collateral
Adds more RWT collateral to an existing borrow position without borrowing more. Improves the Health Factor.Authority: Borrower (must sign)
liquidate
liquidate
Liquidates an undercollateralized borrow position (Health Factor < 1.0). The liquidator repays part of the debt and receives the borrower’s RWT collateral at a discount (liquidation penalty).
- HF between 0.95 and 1.0 → up to 50% of position can be liquidated
- HF below 0.95 → up to 100% can be liquidated
accrue_interest
accrue_interest
Accrues interest on all positions in the market. Runs every second inside the MagicBlock Ephemeral Rollup. Updates deposit position values (auto-compound) and borrow position debt amounts.Authority: Permissionless (crank, runs in ER)
update_lending_config
update_lending_config
Updates market parameters: LTV, liquidation threshold, interest rate model, reserve factor. Changes apply to new positions only — existing positions keep their entry parameters.Authority: Engine Authority (AREAL DAO)
Health Factor
The Health Factor determines how close a borrow position is to liquidation:Health Factor = (RWT collateral value × liquidation threshold) / total debtWhere:
- RWT collateral value =
rwt_amount × RWT market price(from the RWT/USDY master pool on the native DEX, updated every second in ER) - Total debt = borrowed amount + accrued interest
| Health Factor | Status |
|---|---|
| > 1.5 | Safe — well-collateralized |
| 1.0 – 1.5 | Caution — consider adding collateral or repaying |
| < 1.0 | Liquidatable — anyone can liquidate the position |
RWT market price is read from the RWT/USDY master pool on the native DEX — this is the actual price at which liquidators can sell seized collateral. Using market price (not NAV) ensures that collateral valuation reflects real liquidity conditions.
While NAV Book Value grows deterministically from yield, the market price can temporarily trade below or above NAV. This means Health Factor follows market reality, not just theoretical fair value — protecting the protocol from scenarios where NAV is high but actual market liquidity is thin.
Interest Rate Model
Utilization-based model that balances depositor yield with borrower cost:Low utilization (0-70%)
Interest rate increases gradually. Depositors earn modest APY, borrowers pay low rates. Encourages borrowing.
Optimal range (70-80%)
Target utilization zone. Balanced rates — depositors earn competitive APY, borrowers pay fair rates.
| Parameter | Description | Default |
|---|---|---|
| Optimal utilization | Target borrowing level | 75% |
| Base rate | Minimum interest rate | 2% APR |
| Slope 1 | Rate increase below optimal | 4% APR per 100% utilization |
| Slope 2 | Rate increase above optimal (steep) | 300% APR per 100% utilization |
| Reserve factor | Protocol share of interest → AREAL DAO | 10% |
RWT as Collateral — Why It Works
RWT is uniquely suited as collateral because its value is deterministic and growing:Market price from native DEX
RWT collateral is valued at the real market price from the RWT/USDY master pool on the native DEX — the actual price at which liquidators can sell. Updated every second in MagicBlock ER.
NAV as price floor
NAV Book Value grows every second from OT yield, creating a rising price floor. Market price tends to track NAV over time, meaning collateral value naturally appreciates — improving Health Factor gradually.
Deep liquidity
RWT trades on the native DEX in concentrated master pools (RWT/USDY, RWT/USDC). Liquidators can efficiently sell seized collateral without excessive slippage.
MagicBlock Integration
| Operation | Where it runs | Frequency |
|---|---|---|
accrue_interest | Ephemeral Rollup | Every second |
| RWT market price read | Ephemeral Rollup | Every second (from RWT/USDY pool) |
deposit / withdraw | Solana L1 | On-demand |
borrow / repay | Solana L1 | On-demand |
liquidate | Solana L1 | On-demand |
Security Considerations
Market price valuation
RWT collateral is valued at the real market price from the RWT/USDY master pool — the price at which liquidators can actually sell. Updated every second in MagicBlock ER. No external oracle dependency.
Variable liquidation
Variable close factor: 50% at HF 0.95-1.0, 100% at HF < 0.95. Prevents partial liquidation from leaving underwater positions.
NAV as rising floor
While Health Factor uses market price, NAV Book Value grows every second from yield — creating a rising price floor. Market price tends to converge toward NAV, reducing long-term liquidation risk.
Market isolation
USDC and USDY markets are fully isolated. Bad debt in one market cannot affect the other.
DAO-governed parameters
LTV, liquidation threshold, rate model, and reserve factor are managed by AREAL DAO. Changes apply to new positions only — existing borrowers are protected.
Per-second accrual
Interest accrues every second in MagicBlock ER. No stale interest — positions always reflect the latest state.