BlockchainAppMaker Get a quote

DeFi

DeFi lending protocols like Aave: how Aave works and what to copy

Aave is the largest of the DeFi lending protocols, and its design is the usual reference for teams that build a new one. This guide explains how Aave works, which of its risk features to copy, and what a realistic Aave fork involves.

In Aave, lenders deposit into shared pools and receive interest-bearing aTokens, borrowers take variable-rate loans against collateral, and liquidations protect the pools. Aave added many of its risk layers after real incidents, such as the CRV loss described below. For a general guide to interest rate math, oracles and market designs, start with DeFi lending: how a lending and borrowing platform works.

Aave in brief

Aave started in 2017 as ETHLend, a peer-to-peer lending marketplace that had trouble matching lenders with borrowers. The team relaunched it as Aave with pooled liquidity in early 2020 and released version 2 later that year.

Aave V3 launched in 2022 on several networks and reached Ethereum in January 2023. Aave also launched its own stablecoin, GHO, in 2023. Each redesign fixed problems of the design before it: ETHLend's peer-to-peer matching was too slow, so Aave moved to pooled liquidity. Later, the single shared pool of V2 spread risk too widely, so V3 added isolation tools.

Aave V4 went live on Ethereum on 30 March 2026 with a hub-and-spoke design, in which hubs hold shared liquidity and each spoke sets its own collateral, risk and liquidation rules. It launched in phases with conservative limits.

DefiLlama data from 19 October 2026 shows the difference in scale: Aave V3 held about $17.1 billion and Aave V4 about $0.7 billion. V3 is the mature, widely forked code base. Check the official repositories and documentation to see which version runs on each chain.

Aave compared with other DeFi lending protocols

ProtocolMarket designRisk controls
Aave V3Pooled: any listed collateral backs any borrow in the same marketCaps, isolation mode, E-Mode, siloed borrowing, Umbrella backstop
Aave V4Hub and spoke: shared liquidity, separate risk rules per spokeRisk settings per spoke on top of shared hubs
Compound IIIOne borrowable base asset per market, with several collateral assetsCollateral cannot be borrowed, and collateral earns no interest
Morpho (Morpho Blue markets)Isolated pairs of one collateral and one loan assetEach market has fixed parameters, and vault curators choose markets

Core components of Aave V3

ComponentRoleDesign note
PoolEntry point to supply, borrow, repay, withdraw, liquidate and take flash loansGovernance can upgrade it through a proxy
aTokensReceipt for a deposit, whose balance grows with interestA scaled balance times a liquidity index gives the current balance
Variable debt tokensRecord of a user's debt, which grows with borrow interestCannot be transferred, so nobody can move debt to another address
Interest rate strategyA kinked, utilization-based rate curve for each assetGovernance sets the parameters on the advice of risk providers
OracleAsset prices, mostly from Chainlink feedsCustom adapters handle correlated and pegged assets
Pool configurator and ACL managerParameter changes and role-based permissionsSeparate roles for the risk admin, the emergency admin and the pool admin
Treasury and reserve factorThe share of interest the protocol keepsFunds the DAO and can cover deficits
UmbrellaStaked backstop that covers bad debtReplaces the older Safety Module, an AAVE staking backstop

How aTokens accrue interest

Each reserve keeps a liquidity index that grows as interest accrues. The contract stores a scaled balance for each user, the deposit amount divided by the index at deposit time, and the user's current balance is the scaled balance times the current index.

Debt tokens work the same way as aTokens, with a variable borrow index. Each interaction updates only the reserve's liquidity index and variable borrow index, and the contract never loops over users. Staking contracts and vaults use the same accumulator method.

Umbrella

Umbrella is Aave V3's automated system for covering bad debt. Users stake aTokens such as aUSDC, aUSDT and aWETH, or stake GHO. When a pool records a deficit in an asset, the contract slashes the stake held for that same asset to cover it, without a governance vote. Staked aUSDC, for example, covers only USDC bad debt.

The Aave DAO covers a first-loss amount for each asset before stakers lose anything. Umbrella is gradually replacing the Safety Module, an older backstop in which users staked AAVE tokens.

Aave risk features worth copying

Supply and borrow caps

Caps limit how much of an asset users can supply as collateral or borrow, so the damage from a manipulated or collapsing asset stays within a known amount.

In November 2022 a trader borrowed large amounts of CRV on Aave V2 in an attempt to short it. The CRV price rose, liquidations could not keep up, and Aave was left with about $1.6 million of bad debt. Supply and borrow caps, with stricter parameters for volatile assets, limit the size of such losses.

Isolation mode

New or riskier assets can serve as collateral only in isolation mode. A user with such collateral cannot use other collateral in the same position and can borrow only approved stablecoins. A debt ceiling limits the total borrowing against the asset. Isolation mode lets a pooled protocol list small assets without exposing the whole pool.

Efficiency mode (E-Mode)

E-Mode groups assets whose prices move together, such as stablecoins or ETH and its liquid staking tokens, into categories with a higher LTV and a higher liquidation threshold. A high LTV for borrowing ETH against wstETH (Lido's wrapped staked ETH) is reasonable, because the two prices rarely move apart, though they can still separate during market stress.

E-Mode gives Aave much of its capital efficiency, and it also concentrates correlated risk, so the oracle choice for E-Mode assets is critical.

Siloed borrowing

Some assets have a risky oracle or unusual behavior, and Aave can mark such an asset as siloed. A user who borrows a siloed asset cannot borrow any other asset in the same position.

Features Aave removed

Aave once offered "stable" interest rates, which the protocol rebalanced under certain conditions. The feature was complex, and Aave disabled it after a vulnerability report in 2023 and later removed it from the code. Not every feature of a mature protocol deserves a copy.

Liquidations in Aave

A position can be liquidated when its health factor drops below 1. The liquidator repays part of the debt and receives collateral plus a liquidation bonus set for each asset.

The close factor limits how much debt one call can repay, and the default is 50%. When the health factor is at or below 0.95, Aave lets one liquidation repay all of the debt. Since version 3.3, Aave also allows full liquidation of small positions, so that no unprofitable dust debt remains.

Liquidators can receive the collateral as the underlying asset or as aTokens, and they can fund a liquidation with a flash loan, explained below, so they need little capital of their own. Many liquidators therefore compete for each liquidation.

Flash loans in Aave

Aave made the flash loan popular. A flash loan lets anyone borrow available liquidity without collateral, use it, and repay it with a fee in the same transaction. If the loan is not repaid, the whole transaction reverts. Aave V3 sets the flash loan fee at 0.05% at deployment, and governance can change it.

Aave offers two functions. flashLoan can borrow several assets and can turn the loan into a normal debt position. flashLoanSimple borrows one asset, always charges the fee and uses less gas.

People use flash loans for collateral swaps, self-liquidations and arbitrage, and attackers use them to fund attacks on protocols that read a price they can move. If your protocol offers flash loans, check every function for state that could be inconsistent during a loan, and protect governance votes and oracles against balances borrowed through a flash loan.

Governance and risk management

AAVE token holders govern Aave through a DAO, which approves proposals and runs them through timelocked executors. Independent risk service providers recommend routine changes to caps and rates, and governance adopts them. Stewards with narrow powers can make some changes faster.

A new protocol rarely has this structure. It should start with conservative parameters, a short asset list and an emergency guardian that can pause the protocol but cannot move funds.

A realistic plan for an Aave fork

  1. Check the license of the exact version you plan to deploy. Aave lists its V3 contracts under the Business Source License 1.1, which limits commercial use until a change date, so get a lawyer to confirm your use.
  2. Choose a market niche, such as a chain without Aave, a specific asset ecosystem, or a permissioned market for institutions. Aave once ran a permissioned market called Aave Arc, which showed that the code can limit access to an approved list of addresses.
  3. Set the asset list and parameters from on-chain liquidity data. For each collateral asset, measure how much a liquidator could sell in a crash without large slippage.
  4. Set up oracles with staleness checks, sequencer uptime checks on rollups and specific adapters for pegged assets.
  5. Configure roles. Use a multisig and a timelock for the pool admin and a limited emergency admin, so that no single private key controls the protocol.
  6. Run liquidation bots and publish documentation for outside liquidators.
  7. Audit your changes, even small ones. Attackers have exploited many lending forks after a small code change, or a newly listed token with unusual behavior, broke an assumption in audited code.
  8. Launch with caps, publish risk dashboards and raise limits as liquidity grows.

Common mistakes in lending forks

  • Forks list illiquid tokens with high LTVs, and attackers then manipulate the token price and drain the pool.
  • Forks use a DEX spot price as the oracle, and a flash loan can move that price.
  • Forks launch new markets with no deposits, which opens rounding and exchange-rate attacks.
  • Forks copy Aave's Ethereum parameters to a chain with much less liquidity, so liquidations fail in a crash.
  • Forks leave upgrade powers with the deployer key, so one stolen key can take all funds.

The smart contract audit guide explains audit planning. The NFT lending platform guide covers loans backed by NFTs, which work differently, and the decentralized stablecoin guide covers designs like GHO.

Cost and timeline

The figures below are estimates, not quotes. An Aave V3 fork on a new EVM chain with a small asset list, a branded front end, liquidation bots and monitoring needs three to five engineers for two to four months. An audit of all changes and an independent risk review of the parameters come on top.

Running costs include oracles, risk monitoring and governance work, and these costs continue for the life of the protocol. Large changes to accounting, a new interest model or a stablecoin module turn the fork into a new protocol build of many months.

This page is general information, not legal or financial advice. Running or promoting a lending protocol may be regulated, depending on its structure, who controls it and where its users live.

Frequently asked questions

What is Aave in DeFi?

Aave is a DeFi lending protocol in which users supply assets to earn interest and borrow other assets against collateral. Its pool design, interest rate models and liquidation system are the parts that every lending protocol has to solve.

Can anyone legally fork Aave?

The answer depends on the license of the version. Aave has released code under the Business Source License, which restricts commercial use for a period without permission. Read the license file of the exact release and get legal advice before you deploy.

What are aTokens?

aTokens are receipt tokens for deposits in Aave, and their balance grows as interest accrues. Users can transfer them, use them in other protocols, or redeem them for the underlying asset when the pool has liquidity.

What is a flash loan?

A flash loan is a loan without collateral that the borrower must repay within the same transaction. If the borrower does not repay, the transaction reverts and the loan never happened. Aave V3 charges a 0.05% fee by default.

How do DeFi lending protocols limit bad debt?

DeFi lending protocols use conservative collateral parameters, supply and borrow caps, isolated or siloed markets, liquidation bonuses, reserves and staked backstops such as Aave's Umbrella. These measures make bad debt rare and limit its size, but they cannot remove it.

Does an Aave-like protocol need a governance token?

No. A new protocol can start with a multisig and a timelock that control the parameters. A token can come later, once the protocol has decisions worth governing.