Skip to main content

Aave v4: Developer Preview

Aave v4 represents the next evolution of the Aave protocol, introducing a revolutionary hub-and-spoke architecture that fundamentally transforms how DeFi lending operates. This developer preview gives you early access to Aave's unified liquidity layer, modular Spoke system, and the powerful AaveKit v4 developer toolkit.

🚀 Aave v4 Developer Preview Status
Aave v4 is currently in developer preview. The Aave protocol team is actively developing and refining the architecture based on community feedback. APIs and interfaces may change before the Aave v4 production release. Join the Aave developer community to stay updated on the latest Aave v4 developments.

Aave v4 Overview

Aave v4 marks a paradigm shift in DeFi protocol design. While Aave v3 focused on capital efficiency through features like E-Mode and Isolation Mode, Aave v4 reimagines the entire Aave architecture to enable unprecedented scalability, modularity, and innovation speed.

The core innovation in Aave v4 is the separation of liquidity management from product logic. In Aave v4, a central Liquidity Hub manages all deposited assets, while specialized Spokes handle specific user interactions. This Aave design pattern allows developers to build custom financial products on top of Aave's deep liquidity without fragmenting the liquidity pool.

Aave v4 is designed with developers in mind. The new Aave architecture makes it significantly easier to extend Aave functionality, create specialized lending markets, and integrate Aave liquidity into external applications. Whether you're building a new DeFi protocol or integrating Aave into an existing application, Aave v4 provides the tools you need.

What's New in Aave v4

Unified Liquidity

All Aave liquidity consolidated in one Hub, maximizing capital efficiency across all Aave products.

Modular Spokes

Specialized Aave modules for different use cases, from simple lending to complex strategies.

Share-Based Tracking

Aave positions tracked as shares rather than token amounts for cleaner accounting.

No Migration Required

New Aave features deploy as Spokes without requiring users to migrate positions.

AaveKit v4

Comprehensive Aave developer toolkit with React SDK, TypeScript SDK, and GraphQL API.

Custom Spokes

Build your own Aave Spokes for specialized lending, borrowing, and yield strategies.

Hub-and-Spoke Architecture

The hub-and-spoke model is the defining innovation of Aave v4. This Aave architectural pattern separates concerns in a way that enables both stability and rapid innovation. Understanding this Aave architecture is essential for developers building on Aave v4.

The Liquidity Hub

The Aave Liquidity Hub is the central nervous system of Aave v4. It serves as the single source of truth for all liquidity in the Aave protocol, managing deposits, withdrawals, and the overall health of the Aave system.

Aave Hub Responsibilities

  • Asset Custody: The Aave Hub holds all deposited assets in secure smart contracts
  • Share Accounting: Aave tracks liquidity provider positions using a share-based system
  • Interest Accrual: The Aave Hub calculates and distributes interest to liquidity providers
  • Liquidity Allocation: Aave coordinates liquidity flow to authorized Spokes
  • Risk Parameters: Global Aave risk settings are enforced at the Hub level
// Aave v4 Hub Interface (Simplified)
interface IAaveHub {
    // Deposit assets into the Aave Hub
    function deposit(
        address asset,
        uint256 amount,
        address onBehalfOf
    ) external returns (uint256 shares);
    
    // Withdraw assets from the Aave Hub
    function withdraw(
        address asset,
        uint256 shares,
        address receiver
    ) external returns (uint256 amount);
    
    // Get current Aave share price for an asset
    function getSharePrice(address asset) external view returns (uint256);
    
    // Get total liquidity available in the Aave Hub
    function getTotalLiquidity(address asset) external view returns (uint256);
}

Aave Spokes Explained

Aave Spokes are modular smart contracts that connect to the Aave Liquidity Hub and provide specific functionality to users. Each Aave Spoke is designed for a particular use case, allowing the Aave protocol to offer specialized products without fragmenting liquidity.

Types of Aave Spokes

Aave Spoke Type Description Use Cases
Core Lending Spoke Standard Aave lending and borrowing functionality General DeFi users, yield farming
Institutional Spoke Aave lending with KYC/AML compliance features Institutional investors, regulated entities
RWA Spoke Aave lending backed by real-world assets Tokenized securities, real estate
Flash Loan Spoke Optimized Aave flash loan execution Arbitrage, liquidations, refinancing
Strategy Spoke Automated Aave yield strategies Vault protocols, yield optimizers
Custom Spoke Developer-built Aave extensions Specialized lending markets, integrations

Aave Spoke Architecture

// Aave v4 Spoke Base Interface
interface IAaveSpoke {
    // Get the Aave Hub this Spoke connects to
    function hub() external view returns (IAaveHub);
    
    // Request liquidity from the Aave Hub
    function requestLiquidity(
        address asset,
        uint256 amount,
        bytes calldata data
    ) external returns (bool);
    
    // Return liquidity to the Aave Hub
    function returnLiquidity(
        address asset,
        uint256 amount,
        uint256 fee
    ) external;
    
    // Get Spoke-specific Aave risk parameters
    function getRiskParams() external view returns (RiskParams memory);
}

Benefits of Aave Unified Liquidity

The Aave unified liquidity model provides significant advantages over traditional DeFi protocol designs where liquidity is fragmented across multiple pools or versions.

  • Deeper Markets: All Aave products share the same liquidity pool, ensuring the best rates for borrowers and suppliers
  • Capital Efficiency: No idle Aave liquidity sitting in underutilized pools or protocol versions
  • Better Rates: Aave interest rates naturally optimize based on total protocol utilization
  • Simplified UX: Aave users deposit once and can access all Aave products without moving funds
  • Reduced Risk: Centralized Aave risk management at the Hub level with Spoke-specific guardrails
1
Aave Liquidity Pool
Possible Aave Spokes
0
Aave Migrations Needed
100%
Aave Liquidity Utilized

Key Aave v4 Advantages Over v3

Aave v4 addresses fundamental limitations in Aave v3 and previous versions. Here's how Aave v4 improves on the existing Aave protocol architecture.

No Migration Required for New Features

One of the biggest pain points in DeFi is protocol upgrades requiring users to migrate their positions. In Aave v3, new features often required deploying entirely new Aave markets, fragmenting liquidity and forcing users to manually move funds.

Aave v4 solves this problem. New Aave features are deployed as Spokes that connect to the existing Aave Liquidity Hub. Users can access new Aave functionality without moving their deposited assets. This design makes Aave v4 infinitely upgradeable while maintaining stability.

Scalable Aave Innovation with Custom Spokes

Aave v4 opens the protocol to external innovation. Developers can build custom Aave Spokes that leverage Aave's deep liquidity for specialized use cases. This could include:

  • Specialized Aave lending markets for specific asset classes
  • Aave integration layers for other DeFi protocols
  • Aave yield strategies and automated vaults
  • Institutional-grade Aave products with compliance features
  • Cross-chain Aave liquidity bridges

Share-Based Position Tracking

Aave v4 moves from token-amount tracking to share-based accounting. Instead of tracking that a user deposited "100 USDC into Aave," the protocol tracks their share of the total Aave USDC pool.

Aspect Aave v3 (Token-Based) Aave v4 (Share-Based)
Position Tracking aTokens represent 1:1 deposits Shares represent % of Aave pool
Interest Calculation Rebasing aToken balances Aave share value appreciation
Gas Efficiency Multiple Aave storage updates Single Aave share price update
Integration Complexity Handle Aave rebasing tokens Standard Aave ERC-4626 vault pattern

AaveKit v4: Developer Toolkit

AaveKit v4 is the official Aave developer toolkit for building applications on Aave v4. AaveKit provides everything you need to integrate Aave into your project, from React components to low-level TypeScript utilities.

AaveKit React SDK

The Aave React SDK provides pre-built components and hooks for common Aave interactions. Build Aave-powered interfaces in minutes with the AaveKit component library.

// Install AaveKit React SDK
npm install @aave/kit-react @aave/kit-core

// Using AaveKit in your React application
import { AaveProvider, useAaveHub, useAavePosition } from '@aave/kit-react';

function App() {
    return (
        <AaveProvider 
            hubAddress="0x..." 
            chainId={1}
        >
            <AaveDashboard />
        </AaveProvider>
    );
}

function AaveDashboard() {
    const { hub, totalLiquidity } = useAaveHub();
    const { position, deposit, withdraw } = useAavePosition();
    
    const handleAaveDeposit = async () => {
        // Deposit 1000 USDC into Aave v4 Hub
        await deposit({
            asset: USDC_ADDRESS,
            amount: parseUnits('1000', 6),
        });
    };
    
    return (
        <div>
            <h1>Aave v4 Dashboard</h1>
            <p>Total Aave Liquidity: ${totalLiquidity}</p>
            <p>Your Aave Position: ${position.totalValue}</p>
            <button onClick={handleAaveDeposit}>
                Deposit to Aave
            </button>
        </div>
    );
}

AaveKit TypeScript SDK

For Node.js backends and scripts, the Aave TypeScript SDK provides type-safe access to all Aave v4 functionality. The AaveKit TypeScript SDK works seamlessly with ethers.js and viem.

// Install AaveKit TypeScript SDK
npm install @aave/kit-core ethers

// Using AaveKit in Node.js
import { AaveHub, AaveSpoke, AaveClient } from '@aave/kit-core';
import { ethers } from 'ethers';

async function main() {
    // Initialize Aave client
    const provider = new ethers.JsonRpcProvider(RPC_URL);
    const signer = new ethers.Wallet(PRIVATE_KEY, provider);
    
    const aaveClient = new AaveClient({
        hubAddress: AAVE_HUB_ADDRESS,
        signer,
    });
    
    // Get Aave Hub information
    const hubInfo = await aaveClient.getHubInfo();
    console.log('Aave Hub Total Liquidity:', hubInfo.totalLiquidity);
    
    // Deposit into Aave v4
    const depositTx = await aaveClient.deposit({
        asset: USDC_ADDRESS,
        amount: ethers.parseUnits('10000', 6),
        onBehalfOf: signer.address,
    });
    
    console.log('Aave deposit tx:', depositTx.hash);
    
    // Query Aave position
    const position = await aaveClient.getPosition(signer.address);
    console.log('Aave shares:', position.shares);
    console.log('Aave value:', position.value);
}

main();

AaveKit GraphQL API

The Aave GraphQL API provides a powerful query interface for Aave protocol data. Use it to build dashboards, analytics tools, and Aave data integrations.

# Query Aave v4 Hub data via GraphQL
query AaveHubOverview {
    aaveHub(id: "0x...") {
        id
        totalLiquidity
        totalBorrowed
        utilizationRate
        assets {
            symbol
            liquidity
            sharePrice
            apy
        }
        spokes {
            id
            name
            type
            totalBorrowed
        }
    }
}

# Query Aave user position
query AaveUserPosition($user: String!) {
    aavePosition(user: $user) {
        user
        deposits {
            asset
            shares
            value
            apy
        }
        borrows {
            asset
            amount
            interestRate
            spoke
        }
        healthFactor
        netApy
    }
}

AaveKit Installation

# Install all AaveKit packages for Aave v4
npm install @aave/kit-core @aave/kit-react @aave/kit-graphql

# Or using yarn
yarn add @aave/kit-core @aave/kit-react @aave/kit-graphql

# Or using pnpm
pnpm add @aave/kit-core @aave/kit-react @aave/kit-graphql

Building on Aave v4: Custom Spokes

One of the most exciting features of Aave v4 is the ability for developers to create custom Aave Spokes. This section covers how to build, test, and deploy your own Aave Spoke.

Aave Spoke Development Prerequisites

  • Solidity development experience (0.8.x)
  • Understanding of the Aave v4 hub-and-spoke model
  • Familiarity with Aave protocol concepts
  • Foundry or Hardhat development environment

Creating a Custom Aave Spoke

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IAaveHub} from "@aave/v4-core/interfaces/IAaveHub.sol";
import {IAaveSpoke} from "@aave/v4-core/interfaces/IAaveSpoke.sol";
import {AaveSpokeBase} from "@aave/v4-core/base/AaveSpokeBase.sol";

/**
 * @title CustomLendingSpoke
 * @notice Example custom Aave Spoke for specialized lending
 * @dev Demonstrates how to build on Aave v4 infrastructure
 */
contract CustomLendingSpoke is AaveSpokeBase {
    // Custom Aave Spoke state
    mapping(address => uint256) public customBorrows;
    
    constructor(
        IAaveHub _aaveHub,
        address _admin
    ) AaveSpokeBase(_aaveHub, _admin) {
        // Aave Spoke initialization
    }
    
    /**
     * @notice Borrow from Aave Hub through this Spoke
     * @param asset The Aave asset to borrow
     * @param amount Amount to borrow from Aave
     */
    function borrow(
        address asset,
        uint256 amount
    ) external returns (bool) {
        // Validate Aave borrow request
        require(amount > 0, "Aave: Invalid amount");
        require(
            _checkBorrowAllowed(msg.sender, asset, amount),
            "Aave: Borrow not allowed"
        );
        
        // Request liquidity from Aave Hub
        bool success = aaveHub.requestLiquidity(
            asset,
            amount,
            abi.encode(msg.sender)
        );
        
        require(success, "Aave: Liquidity request failed");
        
        // Track Aave borrow in Spoke state
        customBorrows[msg.sender] += amount;
        
        // Transfer Aave funds to borrower
        IERC20(asset).transfer(msg.sender, amount);
        
        emit AaveBorrow(msg.sender, asset, amount);
        return true;
    }
    
    /**
     * @notice Repay Aave borrow through this Spoke
     */
    function repay(
        address asset,
        uint256 amount
    ) external returns (bool) {
        // Transfer funds from user
        IERC20(asset).transferFrom(msg.sender, address(this), amount);
        
        // Calculate Aave interest
        uint256 interest = _calculateInterest(msg.sender, asset);
        
        // Return liquidity to Aave Hub
        aaveHub.returnLiquidity(asset, amount, interest);
        
        // Update Aave Spoke state
        customBorrows[msg.sender] -= amount;
        
        emit AaveRepay(msg.sender, asset, amount);
        return true;
    }
    
    event AaveBorrow(address indexed user, address asset, uint256 amount);
    event AaveRepay(address indexed user, address asset, uint256 amount);
}

Aave Spoke Registration

Before your Aave Spoke can access Hub liquidity, it must be registered and approved through Aave governance. The registration process ensures all Aave Spokes meet security and risk management standards.

  1. Develop: Build and thoroughly test your Aave Spoke
  2. Audit: Get your Aave Spoke audited by reputable security firms
  3. Propose: Submit an Aave Improvement Proposal (AIP) to governance
  4. Vote: Aave token holders vote on Spoke approval
  5. Register: If approved, your Aave Spoke is registered with the Hub

Aave v4 Migration Path

If you're currently using Aave v3, here's what to expect as Aave v4 approaches production release.

For Aave Users

  • No Immediate Action Required: Aave v3 will continue operating alongside Aave v4
  • Gradual Transition: Aave governance will coordinate the migration timeline
  • Incentivized Migration: Expect Aave incentives for early adopters who move to v4
  • Familiar Interface: The Aave v4 user experience will be similar to v3

For Aave Developers

  • Start Building Now: Use AaveKit v4 to experiment with the new Aave architecture
  • Attend Aave Dev Calls: Stay updated on Aave v4 development progress
  • Join Aave Discord: Connect with other Aave developers and the core team
  • Review Aave AIPs: Follow governance proposals related to Aave v4

Timeline Expectations

Phase Status Description
Developer Preview Current Aave v4 architecture finalization, AaveKit SDK development
Testnet Launch Upcoming Public Aave v4 testnet deployment for developer testing
Security Audits Planned Comprehensive Aave v4 security review by multiple auditors
Mainnet Launch Planned Aave v4 production deployment with initial Spoke set
Full Migration Planned Aave v3 to v4 migration tools and incentive programs
📚 Continue Learning About Aave
Explore more Aave documentation to deepen your understanding of the protocol. Check out Aave Flash Loans, GHO Stablecoin, and the Aave Glossary for additional resources.