For the complete documentation index, see llms.txt. This page is also available as Markdown.

Common frontend flows

Lending and borrowing flows with health monitoring.

Lending flow

  1. Read available markets or pools using getMorphoMarket or Aave pool data.

  2. Use previewDeposit-style reads or balance checks to show the user how much they can supply.

  3. For Morpho, call buildSupply and execute the returned requirements followed by bundlerTx. For Aave, send an approval transaction first, then execute the tx from buildAaveSupplyTx.

Borrow flow with health monitoring

  1. After supplying collateral, read the user's account health via getAaveUserAccountData (for Aave) or getMorphoPosition (for Morpho).

  2. Display available borrow power and health factor in the UI so the user can choose a safe borrow amount.

  3. Call the relevant build method and execute.

  4. After borrowing, re-read account health and update the UI.

For the best frontend experience, combine data sources the same way you would with vaults:

Use CityLendingClient read methods for live onchain state like positions, health factors, and market utilization. Pair this with CityPortfolioClient subgraph queries if you need historical lending activity or indexed transaction logs.

Last updated