Data Security

This page covers how to read state from Avon, security assumptions, and reference details.

1. Data Access

All data is available directly on strategies and orderbooks.


1.1 Reading Strategy Data

strategy.totalAssets();
strategy.totalBorrow();
strategy.debtOf(user);
strategy.collateralOf(user);
strategy.healthOf(user);

1.2 Reading Orderbook Data

Tree Roots

orderbook.lenderTreeRoot();
orderbook.borrowerTreeRoot();

Raw Quote Queries

Depending on implementation, quote structures can be accessed for:

  • monitoring

  • analytics

  • indexers

Developers may build custom indexers for:

  • best bid/ask curves

  • historical liquidity

  • borrow routing simulations


2. Security Model

2.1 Strategy Isolation

Each strategy is a self-contained market:

  • isolated collateral

  • isolated debt

  • isolated liquidations

  • isolated interest

  • isolated oracle dependency

No contagion or shared risk.


2.2 Deterministic Matching

Orderbook matching is:

  • deterministic

  • transparent

  • bounded

  • rate-first

No allocators. No hidden routing. No offchain influence.


2.3 Gas Constraints

Matching is capped at 30 quotes, guaranteeing:

  • predictable gas usage

  • no unbounded loops

  • safety under heavy tree load


2.4 Oracle Dependencies

Strategies use their own oracle logic to compute:

  • collateral values

  • debt values

  • health

  • liquidation triggers

Orderbook does not rely on oracles directly.


2.5 Emergency Controls

Protocol governance can:

  • pause orderbooks

  • disable quoting

  • remove strategies

  • force-remove strategies that are unresponsive

All emergency functions are explicit and transparent.


3. Reference (Structs, Events, Errors)

3.1 Structs

Tick / Quote

Position


3.2 Events

  • BorrowMatched(...)

  • StrategyTickUpdated(...)

  • CollateralDeposited(...)

  • CollateralWithdrawn(...)

  • Liquidation(...)


3.3 Common Errors

  • InsufficientCollateral()

  • SlippageExceeded()

  • StrategyNotWhitelisted()

  • TooManyMatches()

Last updated