集成
钱包、应用、Keeper 或索引器在不使用 Avana 前端的情况下直接与 Avana 合约交互所需的一切。
概述
Avana 运行在 Ethereum 和 Base 上。每条链有一个 Avana Hub、一个 Lend Spoke,以及按 AMM 协议和风险等级设立的 CDP Spoke。目前,CDP Spoke 接受 Ethereum 上的 Uniswap v3 和 Uniswap v4 仓位,以及 Base 上未质押挖矿的 Aerodrome Slipstream 仓位。Hub 和 Spoke 是由 Aave DAO 拥有和配置的标准、未经修改的 Aave V4 合约;Avana 的合约围绕它们处理托管、估值、借款人操作和清算。
任何人都可以直接调用合约。Avana 前端和 AppKit 是可选的;还款、无债务提取、手续费领取和清算从不依赖它们。每条链的合约相互独立:没有任何内容跨链共享,每项操作都通过该链自己的时间锁运行。
需调用的合约
| 合约 | 调用者 | For |
|---|---|---|
| AaveAdapter | 借款人、应用、任何为借款人还款的人 | 每项借款人操作:质押、重新记入、借款、还款、提取、部分移除、全额还款并提取、以抵押品还款、手续费领取、零记入释放。每条链一个。 |
| LPVaultSwap | 任何未被冻结的地址:Avana 的 Keeper、其他清算人和闪电清算辅助合约 | 清算,使用 liquidate,唯一的清算入口,由调用者自有的债务资产出资 |
| 闪电清算辅助合约 | 不持有任何债务资产的清算调用者 | flashLiquidate:从 Aave V3 Pool 闪电借入债务资产,调用 liquidate,并从调用者的支付款中偿还贷款。公开且不可变,每条链一个。 |
| LPOracle, DebtOracle | Keeper、任何人 | poke() 用于存储价格状态;另有状态和时长视图 |
| Uniswap v3 或 Slipstream 仓位管理器 | 借款人 | 质押前将仓位按代币授权给 LPVault,以及重新记入前添加流动性 |
地址
每条链有自己的部署和自己经验证的部署清单。可升级合约终身保持一个固定的代理地址,每个市场的 vault token 和 LPOracle 地址在上架时固定。绝不要从不受信任的来源获取合约地址;请使用部署清单或公布的列表。
各链的合约地址列于合约参考页面: 合约地址.
链下组件
| 组件 | 功能 |
|---|---|
packages/protocol | Calldata builders for every AMM integration and chain, built in the browser from a bundled, verified deployment manifest. It ships the upstream Aave error ABIs. Its builders request only the exact approvals listed below. |
| Keeper | Avana's keepers poke every oracle on schedule, record breaker breaches every block, liquidate every eligible account after simulating each liquidation, fund the debt asset from their own inventory or through the flash liquidation helper, pay their own gas and accept a recovery a few units below the debt repaid out of their own payout. |
| 索引器 | Ponder 索引器将实时链上事件存储到 Postgres 中供应用使用:仓位、债务和健康因子。 |
| 应用后端 | 存储应用数据、偏好设置和意图状态。它从不提供交易目标或 calldata,因此被攻破的后端无法改变用户交易的去向。 |
链下代码由测试覆盖;链上合约会重新检查每项输入,因此任何链下组件都无法授权操作。
账户与仓位
- Each wallet gets one PositionProxy per CDP Spoke and market, deployed on its first pledge. The proxy address is known before deployment from the Adapter's
predictProxy视图。 - 每个代理都是一个独立的 Aave 账户,拥有自己的健康因子。一个市场中的问题绝不会使同一钱包的另一个市场变为可清算。
- 仓位以 AMM 集成标识符和仓位键命名:Uniswap v3 为代币 ID,Slipstream 为高位字节带有仓位管理器代际的代币 ID。
- 市场只接受 tick 区间与市场完全相等的仓位。
授权
用户只授予两类授权,每类都恰好满足一笔交易所需:
- 质押时,将恰好一个仓位授权给该 AMM 协议不可变的 LPVault:对于 Uniswap v3 和 Slipstream 为按代币的 ERC-721 授权或 permit,对于可替代份额协议则为精确的 LP 代币数量。
- For a repay, an approval to the AaveAdapter of exactly the repay amount in the debt asset, for the account being repaid. For a repay-all it is a repay-all quote sized to the deadline; the Adapter pulls it in full and refunds the rest in the same call, leaving zero allowance.
截止时间与 Nonce
- Every AaveAdapter entry point and every liquidation takes a deadline and reverts once the block timestamp passes it. Previews use the same deadline and add the margins (interest accrual, Aave's dust rule) that keep the transaction valid until then.
- 每次借款都指定代理当前的借款 nonce。Adapter 会消耗该 nonce,因此借款无法被重放或重新排序。
- 借款、提取和部分移除接受由调用者选择的最低健康因子。以抵押品还款接受最低金额和最小还款额,且每个兑换腿还带有基于预言机的最低输出。
- 除金额须非零外,没有最低借款额,也没有最低债务。每笔质押的价值必须至少达到市场的最低质押价值(上线时为 $10)。
需索引的事件
| 合约 | 事件 |
|---|---|
| AaveAdapter | UserProxyCreated, CollateralAdded, CollateralSupplied, Borrowed, Repaid, CollateralWithdrawn, CollateralRecredited, CollateralReduced, RepaidWithCollateral, CollateralDisabled, SeizedUnitsBurned |
| CDP Spoke(每个代理) | Supply, Borrow, Repay, Withdraw, LiquidationCall |
| ProxyManager | ProxyDeployed |
| Collateralization | CollateralPledged, CollateralReleased, RecordReduced, RecordRecredited, RecordDebited, SeizureSettled, SeizureReconciled, PendingSettled, CounterSaturated |
| LPVault | PositionReceived, PositionReturned, UnitsUnwound, UnitsReleased, FeesCollected, StrayReceived, StrayReturned, MarketBound |
| LPVaultSwap | LiquidationSettled, BorrowerSurplusPaid, FlashLoanUsed, RouteFailed, ResidueReturned, PendingSettlementForwarded, Deleveraged, KeeperAdded, KeeperRemoved |
| LPOracle | PriceStateChanged, PriceAccepted, FailureRecorded, FailureCleared, DisagreementRecorded, DisagreementCleared, OutageExpiredLatched, GraceStarted, QuoteChangeCapped, RouteChanged |
| DebtOracle | DebtPriceStateChanged, DebtPriceAccepted, DebtFailureRecorded, DebtFailureCleared, DebtDisagreementRecorded, DebtOutageExpiredLatched, DebtGraceStarted |
| MarketRegistry | PauseStateChanged, PauseReasonChanged, AddressFrozen, AddressUnfrozen, BreakerLatched, GateBreached, BreakerReset, StandbyRouteActivated, MarketActivated, MarketOffboarding, WindDownStepped, MarketClosed, RouteDisabled |
| RiskModule | BreakersPoked, ConfigDriftDetected |
| ParameterStore | ParameterSet, ParameterTightened, ParameterLoosened, CapTightened, CapLoosened, MinPledgeUsdSet, FeedConfigured, SecondSourceSwitched |
| VaultTokenFactory、vault token | IntegrationRegistered, VaultTokenDeployed, Transfer, ProxyAdded |
| 闪电清算辅助合约 | FlashLiquidated |
| 支付托管 | RemainderEscrowed, RemainderClaimed |
| AvanaTimelock | CallScheduled, CallExecuted, Cancelled, NormalDelayChanged, ShortDelaySelectorSet, PublicExecutionToggled, ExpiredOperationCleaned |
Borrowers and apps should watch the timelock's scheduled operations: every normal-delay change is public for 5 days before it executes, which is the window to exit if a change is unwelcome.
