From aave-v3
This skill should be used when the user asks about "Aave V3 architecture", "Pool contract", "PoolAddressesProvider", "PoolConfigurator", "Aave lending", "Aave borrowing", or needs a high-level understanding of how Aave V3 works.
npx claudepluginhub cyotee/cyotee-claude-plugins --plugin aave-v3This skill uses the workspace's default tool permissions.
Aave V3 is a decentralized non-custodial lending protocol where users can supply assets to earn interest and borrow against collateral. This skill provides a high-level overview of the protocol architecture.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Share bugs, ideas, or general feedback.
Aave V3 is a decentralized non-custodial lending protocol where users can supply assets to earn interest and borrow against collateral. This skill provides a high-level overview of the protocol architecture.
┌──────────────────────────────────────────────────────────────┐
│ AAVE V3 ARCHITECTURE │
├──────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ PoolAddressesProvider │ │
│ │ Central registry for all protocol contracts │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────┼──────────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────┐ ┌─────────────┐ ┌───────────┐ │
│ │ Pool │◄────────►│PoolConfig- │ │ ACLManager│ │
│ │ │ │ urator │ │ │ │
│ └────┬────┘ └─────────────┘ └───────────┘ │
│ │ │
│ │ manages │
│ ▼ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Reserves (Assets) │ │
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
│ │ │ aToken │ │ Variable│ │ Interest│ │ Oracle │ │ │
│ │ │ │ │DebtToken│ │RateStrat│ │ │ │ │
│ │ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │ │
│ └─────────────────────────────────────────────────────────┘ │
│ │
└──────────────────────────────────────────────────────────────┘
The central registry that stores addresses of all protocol contracts for a specific market.
interface IPoolAddressesProvider {
function getPool() external view returns (address);
function getPoolConfigurator() external view returns (address);
function getPriceOracle() external view returns (address);
function getACLManager() external view returns (address);
function getACLAdmin() external view returns (address);
function getPriceOracleSentinel() external view returns (address);
function getPoolDataProvider() external view returns (address);
// Generic address getter for custom identifiers
function getAddress(bytes32 id) external view returns (address);
}
The main entry point for user interactions. All supply, borrow, repay, and withdraw operations go through the Pool.
interface IPool {
// Core operations
function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external;
function withdraw(address asset, uint256 amount, address to) external returns (uint256);
function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) external;
function repay(address asset, uint256 amount, uint256 interestRateMode, address onBehalfOf) external returns (uint256);
// Collateral management
function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external;
// Liquidation
function liquidationCall(address collateralAsset, address debtAsset, address user, uint256 debtToCover, bool receiveAToken) external;
// Flash loans
function flashLoan(address receiverAddress, address[] calldata assets, uint256[] calldata amounts, uint256[] calldata interestRateModes, address onBehalfOf, bytes calldata params, uint16 referralCode) external;
function flashLoanSimple(address receiverAddress, address asset, uint256 amount, bytes calldata params, uint16 referralCode) external;
// eModes
function setUserEMode(uint8 categoryId) external;
function getUserEMode(address user) external view returns (uint256);
// Account data
function getUserAccountData(address user) external view returns (
uint256 totalCollateralBase,
uint256 totalDebtBase,
uint256 availableBorrowsBase,
uint256 currentLiquidationThreshold,
uint256 ltv,
uint256 healthFactor
);
}
Admin contract for configuring reserves and protocol parameters.
interface IPoolConfigurator {
// Reserve initialization
function initReserves(ConfiguratorInputTypes.InitReserveInput[] calldata input) external;
// Reserve configuration
function setReserveBorrowing(address asset, bool enabled) external;
function configureReserveAsCollateral(address asset, uint256 ltv, uint256 liquidationThreshold, uint256 liquidationBonus) external;
function setReserveFreeze(address asset, bool freeze) external;
function setReservePause(address asset, bool paused) external;
function setReserveFactor(address asset, uint256 newReserveFactor) external;
// Caps
function setBorrowCap(address asset, uint256 newBorrowCap) external;
function setSupplyCap(address asset, uint256 newSupplyCap) external;
// eModes
function setEModeCategory(uint8 categoryId, uint16 ltv, uint16 liquidationThreshold, uint16 liquidationBonus, string calldata label) external;
}
Access control manager for protocol roles.
interface IACLManager {
function isPoolAdmin(address admin) external view returns (bool);
function isEmergencyAdmin(address admin) external view returns (bool);
function isRiskAdmin(address admin) external view returns (bool);
function isFlashBorrower(address borrower) external view returns (bool);
function isBridge(address bridge) external view returns (bool);
function isAssetListingAdmin(address admin) external view returns (bool);
}
Each asset listed on Aave has associated reserve data:
struct ReserveData {
// Configuration stored as bitmap
ReserveConfigurationMap configuration;
// Indexes (in ray - 27 decimals)
uint128 liquidityIndex; // Supply index for interest accrual
uint128 variableBorrowIndex; // Borrow index for interest accrual
// Current rates (in ray)
uint128 currentLiquidityRate; // Current supply APY
uint128 currentVariableBorrowRate; // Current borrow APY
// Deficit tracking (V3.3)
uint128 deficit;
// Timestamps
uint40 lastUpdateTimestamp;
uint40 liquidationGracePeriodUntil;
// Token addresses
uint16 id;
address aTokenAddress;
address variableDebtTokenAddress;
address interestRateStrategyAddress;
// Accounting
uint128 accruedToTreasury; // Fees accumulated for treasury
uint128 unbacked; // Unbacked aTokens (bridging)
uint128 isolationModeTotalDebt; // Debt in isolation mode
uint128 virtualUnderlyingBalance; // Virtual accounting balance
}
Aave uses a variable interest rate model:
┌──────────────────────────────────────────────────────────────┐
│ INTEREST RATE CURVE │
├──────────────────────────────────────────────────────────────┤
│ │
│ Rate │ ╱ │
│ │ ╱ │
│ │ ╱ Slope2 │
│ │ ╱ │
│ │ ╱───────╱ │
│ │ ╱ Slope1 │
│ │ ╱ │
│ │ Base Rate ╱ │
│ └───────────────┼─────────────────────────────────── │
│ │ │
│ Optimal │
│ Utilization │
│ │
│ Utilization = Total Debt / (Virtual Balance + Total Debt) │
│ │
└──────────────────────────────────────────────────────────────┘
HF = Σ(Collateral × LT) / Total DebtAave V3.1+ tracks virtual balances to protect against donation attacks:
// Instead of checking actual token balance:
// balanceOf(aToken)
// Aave uses virtual balance tracking:
virtualUnderlyingBalance += amountSupplied;
virtualUnderlyingBalance -= amountWithdrawn;
Allow higher LTV for correlated assets:
struct EModeCategory {
uint16 ltv; // Higher LTV for correlated assets
uint16 liquidationThreshold;
uint16 liquidationBonus;
uint128 collateralBitmap; // Which assets can be collateral
uint128 borrowableBitmap; // Which assets can be borrowed
string label;
}
User → Pool.supply() → SupplyLogic.executeSupply()
1. Update reserve indexes
2. Transfer underlying to aToken
3. Mint aTokens to user
4. Update virtual balance
5. Update interest rates
User → Pool.borrow() → BorrowLogic.executeBorrow()
1. Validate health factor will remain >= 1
2. Update reserve indexes
3. Mint debt tokens to user
4. Transfer underlying to user
5. Update interest rates
Liquidator → Pool.liquidationCall() → LiquidationLogic.executeLiquidationCall()
1. Verify user health factor < 1
2. Calculate debt to cover and collateral to receive
3. Burn debt tokens
4. Transfer collateral to liquidator (+ bonus)
5. Update interest rates
| Version | Key Features |
|---|---|
| V3.0 | eModes, isolation mode, siloed borrowing |
| V3.1 | Virtual accounting, stateful interest rates, liquidation grace period |
| V3.2 | Liquid eModes, stable rate deprecation |
| V3.3 | Deficit tracking, liquidation optimizations |
| Skill | Description |
|---|---|
aave-v3-pool | Core Pool operations (supply, borrow, repay, withdraw) |
aave-v3-tokens | aTokens and Variable Debt Tokens |
aave-v3-configuration | Reserve configuration and interest rate strategies |
aave-v3-emodes | Efficiency Modes for correlated assets |
aave-v3-flash-loans | Flash loan functionality |
aave-v3-stata-token | ERC4626 wrapper for aTokens |
src/contracts/protocol/pool/Pool.sol - Main Pool contractsrc/contracts/protocol/pool/PoolConfigurator.sol - Configuration contractsrc/contracts/protocol/libraries/types/DataTypes.sol - Core data structuressrc/contracts/interfaces/IPool.sol - Pool interfacesrc/contracts/interfaces/IPoolAddressesProvider.sol - Registry interface