# Aave V3 on Aptos

> [!WARNING]
> Aave V3 on Aptos is deprecated. Supplying and borrowing are disabled, but
> users can still repay debt and withdraw supplied assets. See the [governance
> proposal](https://app.aave.com/governance/v3/proposal/?proposalId=521).

This is the official Aptos version of the Aave V3 Protocol. Access the [Aave Protocol on Aptos](https://aptos.aave.com/).

The Aptos Move codebase represents a faithful implementation of the Aave V3.3 protocol on the Aptos blockchain using the Move language. While maintaining the core financial logic and security properties of the original Solidity implementation, this port leverages Aptos’s unique architectural features to enhance performance, security, and composability.

## High-Level Summary

- **Modular Design:** Organized into specialized modules with `friend` functions enforcing controlled inter-module access (no inheritance).
- **Resource-Oriented Programming:** Assets are linear resources that cannot be copied or implicitly discarded, only moved, which prevents accidental loss and double-spending.
- **Ability-Based Types:** Types declare abilities (`copy`, `drop`, `store`, `key`) that control how values can be used.
- **Native Token Support:** Integrates Aptos’s native fungible asset standard.
- **Reduced Reentrancy Risk:** Move has no fallback functions and restricts module cycles, which reduces reentrancy risk.
- **Safety & Verification:** Strong type enforcement and the Move Prover allow formal verification of protocol correctness against specifications written alongside the code.
- **Predictable Gas:** Static dispatch and a simpler VM make execution costs more deterministic.

## Core Features

- **Full Liquidity Protocol Implementation:** Complete supply and borrow functionality, including variable interest rates, liquidations, collateral management, and risk parameters.
- **E-Mode:** Efficiency mode for correlated assets that allows higher borrowing power.
- **Isolation Mode:** Risk containment for new assets with customizable debt ceilings.
- **Fungible Asset Integration:** Native support for Aptos’s fungible asset standard, Aptos’s version of ERC-20.
- **Price Oracles:** Integration with external price feeds for accurate asset valuations.
- **Flexible Interest Rate Strategy:** Adaptable interest rate models based on utilization.

## Aptos Move Implementation Approach

The implementation adapts the Solidity logic to Move’s paradigms:

- **Resource-Oriented Design:** Instead of Solidity contracts, the implementation uses Move’s resource model to store protocol state.
- **Object-Centric Architecture:** Leverages Aptos’s object model for reserve data and token management, providing stronger ownership guarantees.
- **Resource Groups:** Utilizes resource groups to organize related data structures efficiently.

## Key Architectural Differences

- **Module Structure:**
  - Functionality is divided into specialized modules (`pool_logic`, `generic_logic`, `liquidation_logic`, etc.) rather than monolithic contracts.
  - `friend` functions provide controlled access between modules for specific functions, enabling a permission-based composition model.
  - Move has no inheritance, forcing explicit composition patterns instead of the hierarchical inheritance common in Solidity.
- **Token Implementation:**
  - Uses Aptos’s Fungible Asset standard instead of ERC-20.
  - Implements a `token_base` module that abstracts common token functionality.
  - Provides a `coin_migrator` to bridge between Aptos Coin and Fungible Asset standards.
- **State Management:**
  - Leverages Move’s ability to pass references to resources, enabling more efficient state updates.
  - Uses `SmartTable` for mapping-like storage with better gas efficiency.
- **Type Safety:**
  - Takes advantage of Move’s strong type system to prevent runtime errors common in Solidity.
  - Uses generics where appropriate to enhance code reusability.
- **Object References:**
  - Reserve data is stored as objects with explicit access controls, improving security.
  - Capabilities are used to control privileged operations instead of address-based access control.

## Notable Implementation Details

- **Precise Math:** Implements ray math (27 decimal places) and wad math (18 decimal places) for high-precision financial calculations.
- **Interest Rate Accrual:** Uses the same compound interest model with liquidity and borrow indices for efficient interest tracking.
- **Configuration Data:** Uses dedicated resource structures for storing protocol configuration.
- **Event Emission:** Maps Solidity events to Move events for protocol monitoring and analytics.

The protocol keeps the economic and security properties of the Solidity implementation while embracing the strengths of the Aptos blockchain and Move language, providing a robust and efficient DeFi liquidity protocol for the Aptos ecosystem.

---

## Next Steps

  <IconCard
    href="/aave-v3/aptos/smart-contracts"
    icon="SolidityIcon"
    title="Smart Contracts"
    description="Move module reference"
  />
  <IconCard
    href="https://aave.github.io/aave-v3-aptos-ts-sdk/"
    icon="TypescriptIcon"
    title="Aptos TypeScript SDK"
    description="Integrate Aave on Aptos"
  />
