Introduction

This page cover Introduction, Architecture, and High-Level System Flows

Avon is an onchain lending protocol that combines isolated ERC-4626 strategies with a unified onchain orderbook that aggregates liquidity and matches borrowers with the best available credit.

Borrowers receive real-time routing across all strategies. Lenders maintain isolated risk, predictable accounting, and transparent pricing.

Avon is designed around five principles:

  1. Isolation by default — each strategy is its own lending market.

  2. Real-time rates — strategies publish their liquidity as quotes.

  3. Deterministic execution — a single onchain orderbook handles all matching.

  4. No allocators — no hidden rebalancing or opaque liquidity movement.

  5. Bounded gas — matching is capped and tree operations remain O(log n).

This documentation explains how to integrate with Avon’s contracts to borrow, repay, supply liquidity, manage collateral, read data, and perform liquidations.


Architecture Overview

Avon consists of three core components:

1. Orderbook Factory

The deployment registry for all orderbooks.

Responsibilities:

  • Deploy one orderbook per (loan asset, collateral asset)

  • Whitelist IRMs (interest rate models)

  • Whitelist strategy factories and managers

  • Configure protocol fee recipients

  • Handle emergency controls (pause, remove strategies)

Only one orderbook exists per asset-pair.


2. Orderbook (Matching Engine)

The orderbook aggregates liquidity from strategies and executes market borrow orders.

It maintains:

  • Lender Tree — liquidity quotes (ticks) from strategies

  • Borrower Tree — borrower limit orders (not enabled in this version)

Matching is deterministic:

  1. Select best rate

  2. If tied → select best LTV

  3. If tied → select earliest timestamp

Borrow execution is aggregated across up to 30 quotes in one transaction.

The orderbook never holds tokens or debt.


3. Strategies (ERC-4626 Isolated Lending Markets)

Strategies implement:

  • ERC-4626 deposits & withdrawals

  • Collateral management

  • Borrowing & repayment

  • Interest accrual

  • Liquidation logic (soft + hard ranges)

  • Curve slicing → tick-based quoting into the orderbook

Each strategy defines:

  • Loan asset

  • Collateral asset

  • LTV / LLTV

  • Liquidation parameters

  • Oracle dependency

  • Interest rate model

Strategies are fully isolated. Debt, collateral, or risk in one strategy cannot affect another.


High-Level System Flows

Lending Flow

  1. User deposits into a strategy

  2. Strategy mints ERC-4626 shares

  3. Strategy slices its curve into ticks

  4. Strategy submits ticks to the orderbook

  5. Orderbook updates the lender tree


Borrow Flow

  1. Borrower provides collateral

  2. Borrower calls matchMarketBorrowOrder

  3. Orderbook selects best quotes from all strategies

  4. Collateral moves into strategies

  5. Strategies open isolated debt positions

  6. Borrower receives loan tokens


Repayment Flow

  1. Borrower approves strategy

  2. Calls repay() on each strategy where they have debt

  3. Strategy reduces debt

  4. Collateral unlocks proportionally


Liquidation Flow

  1. Strategy computes health

  2. If health < LLTV → liquidatable

  3. Liquidator repays part of debt

  4. Strategy transfers collateral with bonus


This completes the architectural overview. Next page covers actual integration with contracts.

Last updated