Contract Security
Which contracts can be upgraded and which cannot, the trust boundaries between them, and how far a hostile upgrade can reach.
Overview
Avana does not fork, copy or modify Aave V4 code. Every Avana Hub and CDP Spoke is a standard Aave V4 contract owned by the Aave DAO, and all Avana-specific logic sits in Avana's own contracts. Those contracts are split by what they are trusted for: custody, the backing ledger and the seizure checks are immutable, while policy, pricing and liquidation orchestration are upgradeable behind each chain's AvanaTimelock.
The split bounds what a faulty or hostile upgrade can do. Immutable code trusts upgradeable code only for yes-or-no answers, prices and values within bounds, so a bad upgrade can block new activity or misprice within limits, but cannot send a position to anyone but its depositor, release liquidity it did not burn, or stop a borrower from leaving.
The full contract list with addresses and interfaces is on this page: Contract Addresses.
Upgradeable and Immutable
| Form | Contracts | Why |
|---|---|---|
| Upgradeable (UUPS behind the AvanaTimelock) | AaveAdapter (one per chain), RiskModule, MarketRegistry, ParameterStore, each LPOracle, each DebtOracle, LPVaultSwap | Borrower actions, eligibility checks, prices, parameters, the pause and breaker state, and liquidation orchestration may need fixes or new integrations. Each upgrade waits 5 days in public and any canceller can stop it. |
| Immutable | Each LPVault (one per AMM protocol per chain), Collateralization, vault tokens and the VaultTokenFactory, every PositionProxy and the ProxyManager, the Lock, swap-route versions, the flash source implementations, the payout escrow (PayoutEscrow), the AvanaTimelock, the flash liquidation helpers | These hold the rules that bound every upgrade: positions return only to their depositor of record, the backing ledger and exposure counters, the seizure share and supply checks, the rule that seized vault tokens go only to LPVaultSwap, the flash-loan checks, escrowed payouts and the timelock's own delays and roles. |
| Aave DAO contracts | Every Avana Hub, CDP Spoke, Lend Spoke and Avana Umbrella (Coverage Spoke) | Standard Aave V4 contracts, upgraded and configured only by Aave governance. Avana Umbrella Coverage Spokes are not upgradeable. |
An immutable component is replaced by deploying a new version and pointing the upgradeable layer at it through the timelock: a new swap route, or a new flash source for repay with collateral, at the normal delay, or, for an LPVault or ledger fault, offboarding the affected markets and relisting them on fixed contracts. A PositionProxy has no logic, no implementation pointer and no upgrade path; it executes only the AaveAdapter's calls, so account logic changes only with an AaveAdapter upgrade.
The flash liquidation helper is immutable periphery outside the core contracts, with no owner, admin, upgrade path, setter or sweep. One public instance per chain (IFlashLiquidator) lets anyone liquidate without holding the debt asset, and an operator may deploy its own operator variant (IOperatorFlashLiquidator). No core contract calls a helper: LPVaultSwap sees it as an ordinary caller.
Upgrade Path
- Each upgradeable contract is a UUPS implementation behind an ERC-1967 proxy. Its upgrade authorization requires APPLICATION_ADMIN, which only the AvanaTimelock holds; a grant of that role or the default admin role to any other account reverts.
- No Avana contract has an Ownable owner, a ProxyAdmin or an AccessManager authority. Immutable contracts accept their few privileged calls only from the timelock address fixed in their bytecode.
- An upgrade is a timelock operation at the normal delay of 5 days, never below 4. The governance Safe, the Emergency Guardian, the Aave Protocol Guardian and the Aave governance executor can each cancel it during the delay.
- Each upgradeable proxy is initialized in its deployment transaction with roles only for the timelock, and the deployer holds no role once deployment ends.
- Before each upgrade proposal the invariant suite reruns on a fork after executing the upgrade, and CI compares the storage layout with the deployed version.
- A fork test enumerates every external function of every deployed implementation and fails on any state-changing function that is not in the restricted-function matrix or the list of public entry points.
- The live-configuration check compares every role holder, proxy slot and timelock setting with the deployment manifest after every governance event.
Roles, delays and cancel rules are described on this page: Governance and Timelock.
Trust Levels
A component may rely on a component at a higher level, and only for what that level is trusted for.
| Level | Components | Trusted for | Not trusted for |
|---|---|---|---|
| 1. Immutable Avana code | LPVaults, Collateralization, vault tokens, VaultTokenFactory, Lock, swap routes, flash source implementations, payout escrow, PositionProxies, ProxyManager, AvanaTimelock | Custody and return of positions, the backing ledger, seizure checks, the seizure-recipient rule, flash-loan checks, escrowed payouts, timelock delays and roles | Nothing beyond their own code |
| 2. Upgradeable custody code behind the 5-day timelock | AaveAdapter | Executing borrower actions, minting exactly the credited units and burning exactly the released or seized units, proxy creation and registration, call bounds | Receiving seized collateral, changing a proxy's code, raising any Aave cap, spending an Avana Umbrella, acting on another chain |
| 3. Upgradeable policy and settlement code | RiskModule, MarketRegistry, ParameterStore, LPOracles, DebtOracles, LPVaultSwap | Borrow-side and pledge checks, prices and price states, parameters and bounds, pause and breaker state, markets and routes, liquidation orchestration | Minting, burning, releasing collateral, registering proxies, acting for a borrower |
| 4. Aave V4 and the Aave DAO | Hubs, CDP Spokes, Lend Spoke, Coverage Spokes, AaveOracle, the Aave V3 Pool behind the flash source and the flash liquidation helper | Debt, interest, health factor, liquidation sizing, deficit accounting, debt-asset prices, flash liquidity | Keeping Avana's reserve settings unchanged, which Avana re-checks on-chain |
| 5. External protocols and off-chain parties | AMMs, Chainlink and second sources, the Base sequencer feed, token issuers, swap-route pools, keepers and other liquidation callers, the flash liquidation helpers, the backend and indexer, the web app, Safe signers | Only what each boundary below states, after its checks | Anything else |
Trust Boundaries
Every place where data, assets or authority cross from one trust domain into another, and what is checked at the crossing:
| Boundary | What crosses | What is checked |
|---|---|---|
| Borrower → AaveAdapter | Pledge, borrow, withdraw, repay-all, liquidity removal, re-credit and repay-with-collateral arguments | The proxy is resolved from the caller, the CDP Spoke and the market, never from a passed address; the Spoke and market must be registered and active; deadline, borrow nonce, minimum health factor and spend limits; the borrow receiver cannot be an Avana or Aave contract; pause state and address freeze for new activity; every borrow-side check runs in the RiskModule. |
| Borrower → LPVault and Collateralization | The pledged position; fee collection and zero-credit release | Each LPVault accepts only its bound position manager and factory; the pool is derived on-chain, never supplied by the caller; the position must match a listed market's exact pool and range; fees and positions go only to the depositor of record. |
| RiskModule, MarketRegistry, ParameterStore → AaveAdapter and Collateralization | Yes-or-no answers, the pledge charge, the post-borrow health factor, the pause state, parameters | Consulted only for pledge eligibility and borrow-side checks; values are bounded by hard limits in the setters; none of them is read by repay, debt-free withdrawal or fee collection. |
| LPVaultSwap → Collateralization and AaveAdapter | Seized vault tokens, seizure and pending settlements, burns of seized units | Accepted only from LPVaultSwap while it holds the Lock; Collateralization checks that the account's supply shares and the token supply both fell by exactly the seized amount before releasing liquidity. |
| Avana ↔ Aave V4 Hubs and CDP Spokes | Supply, borrow, repay, withdraw and liquidation calls; account data | Aave is trusted for debt and health; Avana does not trust its configuration to stay as listed, so the drift check re-reads the three required reserve settings and other values on new activity and stops new risk when they change. |
| Third parties → Aave Spoke and Hub on Avana reserves | Direct liquidation calls and Hub functions on vault-token reserves | A vault token moves only on its fixed paths: mint to a registered proxy, supply to and withdrawal from the home Hub, seizure to LPVaultSwap; a direct liquidation by anyone else reverts on the seizure transfer. |
| AMM position managers and pools → LPVaults, LPOracles, RiskModule | Position data, liquidity units, fees, principal on removal, TWAP observations | Position manager and factory are immutables of each LPVault; calls revert while the AMM's reentrancy lock is held; valuation uses Chainlink prices only, the pool TWAP is a guard. |
| Chainlink → LPOracle and DebtOracle | Token USD prices and timestamps | Per leg: positive answer, valid and non-future timestamp, age within heartbeat plus 1,800 seconds, inside the aggregator's bounds, decimals pinned at listing; any failure moves the market to a stricter price state. |
| LPOracle → Aave Spoke | The vault-token price used for health and seizure sizing | Returns 8 decimals for life, never reverts and never returns 0, and rounds down. Once a market is Expired it serves 1 unit (10⁻⁸ USD per vault token), so Aave counts the collateral as worthless while exits keep working. |
| Aave V3 Pool flash source → LPVaultSwap | Flash-borrowed debt asset and the callback, for repay with collateral only | Available liquidity and a premium at most maxFlashFeeBps checked before the loan; the callback reverts unless it comes from the chain's Aave V3 Pool with LPVaultSwap as initiator inside a deleverage. A liquidation takes no flash loan, and the callback reverts inside one. |
| Flash liquidation helper ↔ Aave V3 Pool and LPVaultSwap | A flash loan of the debt asset, the liquidation call it funds, and the payout that repays the loan | The helper is immutable periphery outside the core contracts, with no owner, setter or sweep and no balance between transactions. It borrows only from its fixed Pool, never from a recorded Hub; its callback must come from that Pool for the loan it requested; the premium is bounded by the caller's limit and maxFlashFeeBps. LPVaultSwap treats it as an ordinary caller and runs every check on it. |
| Swap-route pools → swap routes and LPVaultSwap | Debt asset returned for unwound tokens | Routes are fixed per market, token and debt asset, added at the normal delay; each leg has an oracle-derived minimum output and the total must reach the recovery floor; routes never trade through the pool being unwound. |
| Any caller → LPVaultSwap | The caller's debt-asset funding and the liquidation arguments: account, market, debt reserve, amount to cover, route mode, deadline, minimum payout, shortfall limit | The caller is not frozen, with no role or committed-operator check; registered proxy and approved debt reserve; fresh prices for the seized market and the repaid debt; LPVaultSwap pulls at most the amount to cover from the caller; every input can only make a call smaller or revert; the caller's payout always goes to the caller, directly, or the call reverts. |
| Governance → AvanaTimelock → Avana contracts | Upgrades, deployment operations, routes, price sources, parameters, the committed-operator registry, roles | Every privileged call executes from the chain's timelock; required delay read from calldata; cancel rights; hard bounds and loosening steps re-checked at execution. |
| Guardians → pause state, address freeze, breakers, standby routes | Freeze, pause, unfreeze, unpause, address freeze, breaker trips and resets, standby switch | Each power stops new activity or puts a reviewed route in service; none reaches repay, debt-free withdrawal, fee collection or liquidation; at most 20 address freezes per caller per rolling 24 hours. |
| Aave DAO → Aave configuration of Avana markets | Collateral factors, caps, flags, halts, liquidation settings, price sources | Drift blocks new risk; a collateral factor of 0 is forbidden while accounts hold the reserve. |
| Tokens and debt assets → Avana | Transfers during fee collection, borrow, repay, settlement and swaps | Fee-on-transfer, rebasing and hook tokens are not listed; SafeERC20 everywhere; amounts measured by balance change; issuer probes for pause and transfer-fee switches. |
| Donations and stray assets → Avana contracts | Dust, vault tokens, pool tokens, positions | Balance-change checks make donations inert; an uncredited position returns only through the timelock. |
| Avana Umbrella → Hub deficit | Deficit elimination amounts | Each Coverage Spoke covers only allowlisted CDP Spokes, only in its own asset, never beyond the recorded deficit or its funded balance. |
| Off-chain services → wallets and keepers | Intents, displayed positions, health factors, candidate lists | Calldata is built from a bundled, verified deployment manifest and never taken from a hosted service; the wallet shows receiver and amount before signing; users and keepers can call contracts directly. |
| LPVaultSwap → payout escrow (PayoutEscrow) | An Avana fee, borrower surplus, route residue or dust leg a token refuses to deliver; never the caller's payout | Deposits only from LPVaultSwap under the Lock; each credit is claimable only by its recipient. |
When an external dependency fails, Avana stops new activity and keeps exits open: a failing price route is replaced by its reviewed standby, a failing swap route by the market's backup route, short flash liquidity by liquidation funded from the caller's own debt asset, and an outage of Avana's backend or app by calling the contracts directly.
Hostile Upgrade Blast Radius
If an upgradeable component's implementation is faulty or hostile, its reach is bounded by the immutable layer and by Aave:
| Component | Can | Cannot |
|---|---|---|
| AaveAdapter | Borrow against every proxy of its chain up to each draw cap, withdraw supplied vault tokens, mint within the Hub's add cap, burn vault tokens, register proxies, spend allowances granted to it, pledge positions whose owners approved an LPVault | Send a position to anyone but its depositor of record, receive seized vault tokens, change an existing proxy, raise any Aave cap, spend an Avana Umbrella, act on another chain |
| RiskModule | Approve borrows it should refuse, or block borrowing and pledges | Borrow past Aave's health factor of 1 or the draw caps; touch exits |
| LPVaultSwap | Liquidate accounts Aave deems liquidatable, at Aave's sizing | Release liquidity it did not burn, because Collateralization checks the share and supply drop; draw any Avana budget, because none exists |
| MarketRegistry and ParameterStore | Misprice gates within bounds, list bad routes, pause, freeze addresses, trip breakers or keep them latched | Move funds, or block repayment, debt-free withdrawal or fee collection, which read neither contract |
| DebtOracle | Overprice debt, making accounts liquidatable early within Aave's sizing and bonus, or underprice it | Let accounts borrow past each draw cap or the RiskModule's own debt-price gates |
Hostile-component tests
The required audit tests install a hostile AaveAdapter, LPVaultSwap, RiskModule, MarketRegistry and ParameterStore, or PositionProxy implementation through the real AvanaTimelock path at the 5-day normal delay, and show that each effect stays within that contract's stated blast radius:
- The immutable LPVault still returns an NFT only to its depositor of record.
- Collateralization still rejects a seizure without the matching drop in the account's supply shares and in the vault-token supply.
- Borrowing stays within Aave's health factor and the draw caps.
Reentrancy Lock
Each chain has one immutable Lock shared by every Avana contract that moves assets or changes accounting. It has exactly two members, the AaveAdapter and LPVaultSwap. Every outer state-changing entry point of either acquires it first, and any attempt to start a second outer entry point in the same call tree reverts.
- Every Collateralization entry point and every value-moving LPVault function is reachable only inside a call tree one of the two members opened, and only from its expected caller. The custody contracts check the holder and never acquire.
- Swap-route and flash callbacks are accepted only from the route's fixed pool or the chain's Aave V3 Pool while LPVaultSwap holds the Lock. The flash source's callback serves only repay with collateral and reverts inside a liquidation. A flash liquidation helper is an ordinary caller: its own callback wraps the liquidation call and holds no Lock.
- Vault tokens have no transfer hooks, and position release uses a transfer with no receiver callback.
- A shared lock replaces per-contract guards: a guard per contract cannot stop a call that re-enters through a different Avana contract.
- The Lock is not a pause or an access list. It never blocks a protocol action at the start of a transaction, and every contract still follows checks-effects-interactions.
Exits Are Never Blocked
Repayment, fee collection, debt-free withdrawal, zero-credit release, pending settlement and liquidation read no pause state or breaker, and no Avana contract has a contract-wide pause. Of these, only liquidation reads the address freeze, and only for its direct caller: a frozen address can still liquidate through the public flash liquidation helper. Leaving needs one repay per debt reserve, or one repay-all-and-withdraw, and one withdrawal per remaining position, each a single transaction.
Every change that could harm a borrower, such as an upgrade of the AaveAdapter, RiskModule or LPVaultSwap, a new flash source, a looser parameter, a new swap route or a role change, waits the normal delay. The 4-day minimum covers a 3-day borrower reaction time plus those few transactions; on Base it also covers the 12-hour forced-inclusion delay for a borrower who must send a transaction from L1 while the sequencer is down.
The only exception is on the Aave side: a Hub halt of a CDP Spoke or an Aave pause of a reserve stops repayment and liquidation on it. The deployment AIP asks the Aave DAO to contain a Spoke with a reserve freeze and zero draw caps instead, which leave every exit open.
