Skip to main content
Avana logo

Manage Loans

Monitor an open loan and change its collateral: add collateral, re-credit liquidity you added, remove part of a position, or repay with your own collateral.

Overview

An account is one PositionProxy for one wallet and market, with one health factor. Its health factor changes when the LPOracle price of the market's vault token moves, when debt prices move, and as interest accrues. Below 1.00 the account can be liquidated.

To raise the health factor a borrower can repay any amount, pledge another position as a top-up, re-credit liquidity added to a pledged position, or repay with collateral. To take collateral out while debt remains, a borrower can withdraw a whole record or remove part of one, as long as the account stays above the health floor.

Health factor 1.10 is a guide, not a limit: the app recommends borrowing to 1.10, and an indebted account below 1.10 can use rescue top-ups. Liquidation starts below 1.00.

Price States

Each market's LPOracle reports a price state, and each non-GHO debt reserve's DebtOracle reports its own. The state decides which actions can run. Example values: a 24-hour stablecoin feed is fresh for 88,200 seconds, the cached window is 1 hour and the grace window is 30 minutes.

StateMeaningWhat a borrower can do
LiveEvery feed is fresh and the routes agree with the pool's TWAP.Every action that passes its other checks. Borrow and withdraw-with-debt also need the second source to agree.
DriftingThe pool's TWAP or a second route disagrees with the served price, or a stablecoin leaves its USD band.Top-ups, rescue top-ups, repay and debt-free exits. New-account pledges only for a USD-band breach. Borrow and withdraw-with-debt are refused.
CachedA feed is past its heartbeat plus 1,800 seconds; the oracle serves the last cached price.Repay with funds and debt-free exits. Pledges, borrow, withdraw-with-debt, repay with collateral and liquidation of the market are refused.
ExpiredCached for longer than the cached window (1 hour), or a persistent route disagreement. The oracle serves a price of 1 (10^-8 USD per vault token), so Aave counts the collateral as worthless.Repay with funds and debt-free exits only.
Grace after recoveryFor 30 minutes after a feed publishes again, liquidation reaches only accounts below a health factor of 0.95, then every account below 1.00.The state shows the grace end; borrowers use the window to repay or add collateral.

Top-Ups and Rescue Top-Ups

A top-up is a pledge into an account that has debt. It uses the same pledge call as a first deposit and the same position rules (exact range, at most 16 records). Because added collateral only lowers risk, a top-up passes a Frozen Hub, a Base sequencer outage or grace window, and Aave configuration drift.

Rescue health factor and the slice

The rescue health factor is 1.10. While an indebted account is below it, a top-up may book its charge from the market's top-up slice (10% of the market cap) when the regular budget is full, but only up to the USD value that brings the account back to 1.10. A rescue top-up is a top-up below 1.10 whose charge is at most that restore amount and whose value is at least the smaller of minPledgeUsd and $10. It is the only pledge admitted under Paused with reason General, from a frozen wallet, under a rescue-only market breaker, above the pool-share cap or below minPledgeUsd.

Rescue units

Units admitted through the slice or a rescue exemption are rescue units. Aave counts them as collateral, so they protect the account from liquidation, but they count as zero for new borrowing and for withdrawals that leave debt: those checks use the health factor with rescue units valued at zero.

Example values; each market's parameters are set at listing. An account owes 15,000 GHO against $19,500 of collateral at an 80.00% collateral factor, so its HF is 1.04. The regular budget is full. A $1,000 top-up books from the slice (the restore amount is $1,125), all of its units are rescue units, and HF becomes 1.0933. Under Paused with reason General, a $100 rescue top-up (restore amount $125) lifts HF to 1.0987, while a $200 pledge reverts with NotRescueTopUp.

Every check a pledge runs is listed in Deposit LP.

Re-Credit Added Liquidity

Liquidity added to a pledged NFT with the AMM protocol's increaseLiquidity is not collateral until the depositor of record calls recredit. The added units run every check of a top-up of that size, the Adapter mints and supplies exactly those units, and the record's charge basis is rebased. An account at 16 records adds collateral this way.

recredit(uint256 marketId, PositionRef position, bytes topUp, uint256 deadline) returns (uint128 added)

For NFT positions the topUp argument is empty. Read the units, charge and whether only a rescue top-up can book them with previewRecredit before calling.

Partial Liquidity Removal

removeLiquidity takes part of one record's units out of the pool and pays the tokens to the depositor of record. The position stays pledged with its remaining units and its uncollected fees.

removeLiquidity(uint256 marketId, PositionRef position, uint128 units, uint256[] minAmounts, uint256 deadline, uint256 minHealthFactor) returns (uint256[] amounts)
  • The units must be above 0 and below the record's credited units; removing every unit is a withdrawal.
  • The minimum amounts hold one entry per pool token, in the market's token order; each token paid must be at least its minimum.
  • Only the principal of the removed units is paid. Fees stay owed to the position and are collected separately.
  • Debt-free, the call reads no pause state, freeze, breaker, sequencer gate or price, and any remainder is allowed.
  • With debt, it runs the checks of a withdrawal with debt: a Paused Hub refuses it, a frozen wallet cannot make it, the RiskModule pre-checks apply (sequencer, Live prices, second sources, keepers, drift, breakers), the record left behind must be worth at least minPledgeUsd, and the rescue-excluded health factor after the call must be at least the largest of 1.00, minHealthFactor and the hard floor.

Failures: PartialRemovalTooLarge for units at or above the credited units, AmountBelowMinimum when a token falls below its minimum, RecordBelowMinPledge when the remaining record is worth less than minPledgeUsd, and HealthFactorTooLow below the health floor.

Example values; each market's parameters are set at listing. Carol holds record key1 (10,000,000,000 units, $20,000) and a top-up keyB (2,500,000,000 units, $5,000) in market 3 on Ethereum: collateral $25,000, CF-weighted $20,000, debt 13,000 USDC valued at $12,998.70, HF 1.5386. She removes 2,000 whole tokens from key1 and keeps the NFT pledged.
  • Carol calls removeLiquidity(3, (I, key1), 2,000,000,000, [1,990e6, 1,990e6], now + 600, 1.20e18).
  • The account has debt, so the pause, freeze and RiskModule pre-withdraw checks run: oracles Live, no breaker.
  • The proxy withdraws 2,000,000,000 units from the Spoke and the Adapter burns them.
  • Collateralization debits record key1 to 8,000,000,000 units and releases $20,000 × 2 / 10 = $4,000 of charge. The LPVault removes the liquidity and pays about 2,000 USDC and 2,000 USDT to Carol, each at least 1,990.
  • The remaining record is worth $16,000, above the $10 minimum. Collateral is now $21,000 and CF-weighted $16,800, so HF = 16,800 / 12,998.70 = 1.2924, above 1.20.
  • Events: RecordReduced, UnitsReleased, CollateralReduced.

Repay with Collateral

repayWithCollateral repays one debt reserve with liquidity from one of the caller's own pledged positions, in one call. LPVaultSwap flash-borrows the debt asset through the chain's flash source, the proxy repays, the units are withdrawn and burned, the LPVault unwinds them, LPVaultSwap swaps every token that is not the debt asset at oracle-bounded prices, repays the flash loan and its premium, and sends the rest to the caller in the debt asset.

repayWithCollateral(RepayWithCollateralParams p) returns (uint256 debtRepaid, uint256 debtAssetToWallet)

The parameters are the market, the position, the units to release, the debt reserve, a minimum amount per pool token for the unwind, the smallest repayment accepted, the deadline and the minimum health factor after the call while debt remains. No approval of the debt asset is needed.

  • There is no liquidation bonus, no Avana fee in the contracts and no protocol budget draw. The borrower pays the flash premium and the swap cost.
  • The repay size is set by oracle prices: x = min(debt, ⌊Vnet × 10^4 / (10^4 + maxFlashFeeBps)⌋), where Vnet is the units' oracle value in the debt asset less the market's slippage allowance (100 bps at launch) and a rounding allowance. A pool trade cannot change it; a sandwich can only make a swap fail its minimum.
  • The flash premium must satisfy premium × 10^4 ≤ maxFlashFeeBps × x. maxFlashFeeBps is 10 at launch; the Aave V3 Pool charges 5 bps, and 0 once Avana's flash source holds the FLASH_BORROWER role.
  • The debt falls before any collateral leaves. While debt remains, Aave's health factor after the call must be at least the larger of its value before the call and minHealthFactor.
  • It runs under a Frozen Hub, under Paused with reason General, for a frozen wallet and under every circuit breaker, because it only lowers debt. It is refused under Paused with reason MintPathSuspect, while the market or the repaid reserve is Cached or Expired, and while the Base sequencer is down. When the flash source is short or paused, repay with funds instead.

Failures: DeleverageTooSmall below the minimum repayment, HealthFactorNotImproved, MinOutNotMet for a swap leg below its oracle minimum, DeleverageShortfall, FlashLiquidityShort, NothingToRepay, and ApplicationPaused under MintPathSuspect only.

Example values; each market's parameters are set at listing. On Ethereum, wallet V owes 10,000 USDC with CF-weighted collateral of $12,000 (HF 1.20). Record #31 is a Uniswap v3 USDC/USDT position at $2.00 per whole token. USDC is priced at $1.0000 and the flash premium is 5 bps.
  • V previews with previewRepayWithCollateral(V, m_A, key31, 1,500,000,000, r_USDC): repays 2,968.505747 USDC, returns 29.41 USDC to V, and leaves HF 1.5735.
  • V calls repayWithCollateral with units 1,500,000,000, minAmounts [1,490e6, 1,490e6], minDebtRepaid 2,950e6 and minHealthFactor 1.30e18.
  • LPVaultSwap values 1,500 whole tokens at the oracle price vector: 1,500 USDC + 1,500 USDT = 3,000 USDC. After the 100 bps slippage allowance and a 0.01 USDC rounding allowance this is 2,969.99 USDC.
  • x = min(10,000, ⌊2,969.99 × 10^4 / 10,005⌋) = 2,968.505747 USDC. LPVaultSwap flash-borrows x through the chain's flash source; the premium is ⌈x × 5 / 10^4⌉ = 1.484253 USDC.
  • The proxy repays 2,968.505747 USDC: the debt falls to 7,031.494253 USDC before any collateral leaves.
  • The proxy withdraws the units, the Adapter burns them, and the LPVault unwinds 1,500 USDC + 1,500 USDT to LPVaultSwap.
  • The USDT leg swaps to 1,499.40 USDC (minimum 1,485). Recovered 2,999.40 USDC covers the loan and premium; 29.41 USDC goes to V.
  • Health check: 11,064 / 7,031.494253 = 1.5735, at least max(1.20, 1.30). Events: Deleveraged, RepaidWithCollateral.

With a minimum repayment of 3,000 USDC the same call reverts with DeleverageTooSmall(2,968,505,747, 3,000,000,000). With a zero flash premium, x is 2,969.99 USDC.

What Stays Open During Pauses

Pause states are set per Hub by the Emergency Guardian or the timelock. Frozen stops new accounts and new borrowing; Paused stops more. Circuit breakers stop new exposure only. Repayment, debt-free exits, fee collection and eligible liquidations stay open in every state below.

ActionFrozenPaused (General)Paused (MintPathSuspect)Wallet frozenBreaker trippedBase sequencer Down or Grace
New-account pledgeRefusedRefusedRefusedRefusedRefused (rescue-only breakers)Refused
Top-upAllowedRefusedRefusedRefusedRefused (rescue-only breakers)Allowed
Rescue top-upAllowedAllowedRefusedAllowedAllowedAllowed
BorrowRefusedRefusedRefusedRefusedRefusedRefused
Repay (any payer)AllowedAllowedAllowedAllowedAllowedAllowed
Repay with collateralAllowedAllowedRefusedAllowedAllowedRefused while Down
Withdraw or remove with debtAllowedRefusedRefusedRefusedRefusedRefused
Debt-free withdraw or remove, repayAllAndWithdraw, releaseZeroCreditAllowedAllowedAllowedAllowedAllowedAllowed
Collect feesAllowedAllowedAllowedAllowedAllowedAllowed

Avana cannot keep exits open when Aave itself blocks them: a pause of the vault-token reserve or a Hub halt of the CDP Spoke stops withdrawals, and a pause of a debt reserve stops repayment of that reserve. Liquidation never reads a pause state, breaker or address freeze; its own rules are in Liquidation.