การเชื่อมต่อ
ทุกสิ่งที่วอลเล็ต แอป keeper หรือ indexer ต้องใช้เพื่อทำงานกับสัญญาของ Avana โดยตรง โดยไม่ต้องใช้ frontend ของ Avana
ภาพรวม
Avana ทำงานบน Ethereum และ Base แต่ละเชนมี Avana Hub หนึ่งแห่ง Lend Spoke และ CDP Spoke ต่อโปรโตคอล AMM และระดับความเสี่ยง ปัจจุบัน CDP Spoke รับโพซิชัน Uniswap v3 และ Uniswap v4 บน Ethereum และโพซิชัน Aerodrome Slipstream ที่ไม่ได้ stake บน Base Hub และ Spoke เป็นสัญญา Aave V4 มาตรฐานที่ไม่ได้ดัดแปลง ซึ่ง Aave DAO เป็นเจ้าของและกำหนดค่า สัญญาของ Avana ดูแลการคัสโตดี การประเมินมูลค่า การดำเนินการของผู้กู้ และการลิควิเดชันรอบๆ สัญญาเหล่านั้น
ใครก็ได้เรียกสัญญาได้โดยตรง frontend ของ Avana และ AppKit เป็นตัวเลือก การชำระคืน การถอนโดยไม่มีหนี้ การเก็บค่าธรรมเนียม และการลิควิเดตไม่เคยพึ่งพาสิ่งเหล่านี้ สัญญาของแต่ละเชนแยกจากกัน: ไม่มีสิ่งใดใช้ร่วมกันข้ามเชน และทุกการดำเนินการทำงานผ่าน timelock ของเชนนั้นเอง
สัญญาที่ต้องเรียก
| สัญญา | ผู้เรียก | For |
|---|---|---|
| AaveAdapter | ผู้กู้ แอป ใครก็ได้ที่ชำระคืนแทนผู้กู้ | ทุกการกระทำของผู้กู้: การจำนำ, re-credit, การกู้, การชำระคืน, การถอน, การถอนบางส่วน, การชำระคืนทั้งหมดและถอน, การชำระคืนด้วยหลักประกัน, การเก็บค่าธรรมเนียม, การปล่อยบันทึกที่มีเครดิตเป็นศูนย์ หนึ่งตัวต่อเชน |
| LPVaultSwap | address ใดก็ได้ที่ไม่ถูก freeze: keeper ของ Avana ผู้ลิควิเดตรายอื่น และ helper การลิควิเดตแบบ flash | การลิควิเดตด้วย liquidate, entry point การลิควิเดตเพียงจุดเดียว โดยใช้สินทรัพย์หนี้ของผู้เรียกเองเป็นเงินทุน |
| helper การลิควิเดตแบบ flash | ผู้เรียกการลิควิเดตที่ไม่ได้ถือสินทรัพย์หนี้เลย | flashLiquidate: flash-borrow สินทรัพย์หนี้จาก Aave V3 Pool เรียก liquidate และชำระคืนเงินกู้จากเงินที่จ่ายให้ผู้เรียก เป็นสัญญาสาธารณะและ immutable หนึ่งตัวต่อเชน |
| LPOracle, DebtOracle | keeper, ใครก็ได้ | poke() เพื่อจัดเก็บสถานะราคา และมุมมองสำหรับสถานะและอายุ |
| position manager ของ Uniswap v3 หรือ Slipstream | ผู้กู้ | การ approve โพซิชันรายโทเคนให้ LPVault ก่อนการจำนำ และการเพิ่ม liquidity ก่อน re-credit |
Address
แต่ละเชนมีการ deploy และ deployment manifest ที่ตรวจสอบแล้วของตัวเอง สัญญาที่อัปเกรดได้ใช้ proxy address คงที่หนึ่งตัวตลอดอายุ และ address ของ vault token และ LPOracle ของแต่ละตลาดกำหนดตายตัวตอนลิสต์ ห้ามรับ address ของสัญญาจากแหล่งที่ไม่น่าเชื่อถือ ให้ใช้ manifest หรือรายการที่เผยแพร่
address ของสัญญาแยกตามเชนแสดงอยู่ในหน้าอ้างอิงสัญญา: ที่อยู่สัญญา.
ส่วนประกอบนอกเชน
| องค์ประกอบ | สิ่งที่ทำ |
|---|---|
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. |
| Indexer | indexer ของ Ponder จัดเก็บ event บนเชนแบบ real-time ใน Postgres สำหรับแอป: โพซิชัน หนี้ และ health factor |
| App backend | จัดเก็บข้อมูลแอป การตั้งค่า และสถานะ intent ไม่เคยให้เป้าหมายธุรกรรมหรือ calldata ดังนั้น backend ที่ถูกเจาะจึงไม่สามารถเปลี่ยนเส้นทางธุรกรรมของผู้ใช้ได้ |
โค้ดนอกเชนมีการทดสอบครอบคลุม สัญญาบนเชนตรวจซ้ำทุกข้อมูลนำเข้า จึงไม่มีส่วนประกอบนอกเชนใดอนุญาตให้ดำเนินการได้
บัญชีและโพซิชัน
- 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ของ Adapter - แต่ละ proxy เป็นบัญชี Aave แยกกันที่มี health factor ของตัวเอง ปัญหาในตลาดหนึ่งไม่เคยทำให้ตลาดอื่นของวอลเล็ตเดียวกันถูกลิควิเดตได้
- โพซิชันระบุด้วยตัวระบุการเชื่อมต่อ AMM และ position key: token ID สำหรับ Uniswap v3 และ token ID ที่มีรุ่นของ position manager อยู่ใน byte สูงสุดสำหรับ Slipstream
- ตลาดรับเฉพาะโพซิชันที่ช่วง tick เท่ากับของตลาดพอดี
การ approve
ผู้ใช้ให้การ approve เพียงสองประเภท แต่ละประเภทเท่ากับที่ธุรกรรมหนึ่งต้องการพอดี:
- สำหรับการจำนำ คือการ approve โพซิชันหนึ่งรายการพอดีให้ LPVault แบบ immutable ของโปรโตคอล AMM นั้น: การ approve หรือ permit แบบ ERC-721 รายโทเคนสำหรับ Uniswap v3 และ Slipstream หรือจำนวน LP token ที่แน่นอนสำหรับโปรโตคอลที่ใช้ share แบบ fungible
- 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.
Deadline และ 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.
- ทุกการกู้ระบุ borrow nonce ปัจจุบันของ proxy Adapter ใช้ nonce นั้นไป การกู้จึงไม่สามารถถูกเล่นซ้ำหรือสลับลำดับได้
- การกู้ การถอน และการถอนบางส่วนรับ health factor ขั้นต่ำที่ผู้เรียกเลือก การชำระคืนด้วยหลักประกันรับจำนวนขั้นต่ำและการชำระคืนขั้นต่ำ และทุกขา swap ยังมีผลลัพธ์ขั้นต่ำที่คำนวณจาก oracle
- ไม่มีการกู้ขั้นต่ำนอกจากจำนวนที่ไม่เป็นศูนย์ และไม่มีหนี้ขั้นต่ำ การจำนำแต่ละครั้งต้องมีมูลค่าอย่างน้อยเท่ามูลค่าการจำนำขั้นต่ำของตลาด ($10 ตอนเปิดตัว)
event ที่ต้องทำดัชนี
| สัญญา | Event |
|---|---|
| AaveAdapter | UserProxyCreated, CollateralAdded, CollateralSupplied, Borrowed, Repaid, CollateralWithdrawn, CollateralRecredited, CollateralReduced, RepaidWithCollateral, CollateralDisabled, SeizedUnitsBurned |
| CDP Spoke (ต่อ proxy) | 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 |
| helper การลิควิเดตแบบ flash | FlashLiquidated |
| Payout escrow | 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.
