跳到主要內容
Avana 徽標

整合

錢包、應用程式、Keeper 或索引器在不透過 Avana 前端的情況下,直接與 Avana 合約協作所需的一切。

概覽

Avana 在 Ethereum 與 Base 上運作。每條鏈都有一個 Avana Hub、一個 Lend Spoke,以及依 AMM 協議與風險等級設立的 CDP Spoke。目前,CDP Spoke 接受 Ethereum 上的 Uniswap v3 與 Uniswap v4 部位,以及 Base 上未質押於 gauge 的 Aerodrome Slipstream 部位。Hub 與 Spoke 是由 Aave DAO 擁有並設定的標準、未經修改的 Aave V4 合約;Avana 的合約則在其周圍處理保管、估值、借款人操作與清算。

任何人都可以直接呼叫合約。Avana 前端與 AppKit 皆為選用;還款、無債務提領、手續費收取與清算從不依賴它們。每條鏈的合約彼此獨立:鏈與鏈之間不共用任何東西,每項操作都透過該鏈自己的時間鎖執行。

要呼叫的合約

合約呼叫者For
AaveAdapter借款人、應用程式、任何替借款人還款的人每項借款人操作:質押、重新入帳、借款、還款、提領、部分移除、全額還款並提領、以抵押品還款、手續費收取、零入帳釋放。每條鏈一個。
LPVaultSwap任何未被凍結的地址:Avana 的 Keeper、其他清算人與閃電清算輔助合約清算,使用 liquidate,唯一的清算進入點,以呼叫者自有的債務資產提供資金
閃電清算輔助合約未持有任何債務資產的清算呼叫者flashLiquidate:從 Aave V3 Pool 以閃電貸借入債務資產,呼叫 liquidate,並以呼叫者的支付款項償還貸款。公開且不可變,每條鏈一個。
LPOracle, DebtOracleKeeper、任何人poke() 用以儲存價格狀態;並提供狀態與存續時間的檢視
Uniswap v3 或 Slipstream 部位管理器借款人質押前將部位按代幣核准給 LPVault,以及重新入帳前新增流動性

地址

每條鏈都有自己的部署與經驗證的部署清單。可升級合約終生保持一個固定的代理地址,每個市場的 vault token 與 LPOracle 地址則在上架時固定。絕不從不受信任的來源取得合約地址;請使用部署清單或公布的清單。

各鏈的合約地址列於合約參考頁面: 合約地址.

鏈下元件

元件功能
packages/protocolCalldata 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.
KeeperAvana'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.
絕不使用對所有代幣的 operator 核准或無上限的授權額度。絕不核准 RiskModule、MarketRegistry、ParameterStore、預言機、LPVaultSwap、兌換路徑、閃電貸來源或代理。除了不可變的 LPVault 之外,AaveAdapter 是使用者唯一信任的支出者,而精確金額將有缺陷的 Adapter 可拉取的金額限制在該筆還款內。

截止時間與 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 會消耗它,因此借款無法被重放或重新排序。
  • 借款、提領與部分移除會帶入由呼叫者選擇的最低健康因子。以抵押品還款會帶入最低金額與最低還款額,且每一段兌換也都帶有由預言機推導的最低輸出。
  • 除了金額不得為零之外,沒有最低借款額,也沒有最低債務。每筆質押的價值必須至少達到市場的最低質押價值(上線時為 $10)。

要建立索引的事件

合約事件
AaveAdapterUserProxyCreated, CollateralAdded, CollateralSupplied, Borrowed, Repaid, CollateralWithdrawn, CollateralRecredited, CollateralReduced, RepaidWithCollateral, CollateralDisabled, SeizedUnitsBurned
CDP Spoke(每個代理)Supply, Borrow, Repay, Withdraw, LiquidationCall
ProxyManagerProxyDeployed
CollateralizationCollateralPledged, CollateralReleased, RecordReduced, RecordRecredited, RecordDebited, SeizureSettled, SeizureReconciled, PendingSettled, CounterSaturated
LPVaultPositionReceived, PositionReturned, UnitsUnwound, UnitsReleased, FeesCollected, StrayReceived, StrayReturned, MarketBound
LPVaultSwapLiquidationSettled, BorrowerSurplusPaid, FlashLoanUsed, RouteFailed, ResidueReturned, PendingSettlementForwarded, Deleveraged, KeeperAdded, KeeperRemoved
LPOraclePriceStateChanged, PriceAccepted, FailureRecorded, FailureCleared, DisagreementRecorded, DisagreementCleared, OutageExpiredLatched, GraceStarted, QuoteChangeCapped, RouteChanged
DebtOracleDebtPriceStateChanged, DebtPriceAccepted, DebtFailureRecorded, DebtFailureCleared, DebtDisagreementRecorded, DebtOutageExpiredLatched, DebtGraceStarted
MarketRegistryPauseStateChanged, PauseReasonChanged, AddressFrozen, AddressUnfrozen, BreakerLatched, GateBreached, BreakerReset, StandbyRouteActivated, MarketActivated, MarketOffboarding, WindDownStepped, MarketClosed, RouteDisabled
RiskModuleBreakersPoked, ConfigDriftDetected
ParameterStoreParameterSet, ParameterTightened, ParameterLoosened, CapTightened, CapLoosened, MinPledgeUsdSet, FeedConfigured, SecondSourceSwitched
VaultTokenFactory、vault tokenIntegrationRegistered, VaultTokenDeployed, Transfer, ProxyAdded
閃電清算輔助合約FlashLiquidated
支付託管RemainderEscrowed, RemainderClaimed
AvanaTimelockCallScheduled, 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.

整合頁面