> ## Documentation Index
> Fetch the complete documentation index at: https://tokenterminal.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Lending

> The lending markets deployed on Celo and the asset each one lends.

<Info>
  **In progress.** This vertical is on the way. [Contact us](mailto:sales@tokenterminal.xyz) if you are interested in this dataset. We want to hear more about your use case!
</Info>

A lending protocol lets users deposit one token to earn interest and borrow another against it. The unit it works in is a market: a pool that takes deposits and lends them out. The assets inside a market are its reserves. [`dimensions.lending_markets`](/docs/catalog/lending/registry) lists the Celo markets with `chain_id = 'celo'`. The reserves inside one market share collateral, so a deposit in one can back a loan in another.

The lending facts land keyed to these markets, one row per event:

* [Deposits](/docs/catalog/lending/deposits) **In progress**
* [Withdrawals](/docs/catalog/lending/withdrawals) **In progress**
* [Borrows](/docs/catalog/lending/borrows) **In progress**
* [Repayments](/docs/catalog/lending/repayments) **In progress**
* [Liquidations](/docs/catalog/lending/liquidations) **In progress**
* [Flash loans](/docs/catalog/lending/flash-loans) **In progress**
* [Interest rates](/docs/catalog/lending/interest-rates) **In progress**

Every column is documented at [Lending](/docs/catalog/lending/index).

## Sample queries

<Tabs>
  <Tab title="Markets per app">
    **Count Celo markets by the app that runs them.**

    ```sql theme={null}
    select
        app_id,
        count(*) as markets
    from `dimensions.lending_markets`
    where chain_id = 'celo'
    group by app_id
    order by markets desc
    ```
  </Tab>

  <Tab title="Markets one app runs">
    **List the markets one app runs on Celo.** `lending_market_address` is the market's own contract.

    ```sql theme={null}
    select
        lending_market_id,
        lending_market_name,
        lending_market_address
    from `dimensions.lending_markets`
    where chain_id = 'celo'
      and app_id = 'aave-v4'
    order by lending_market_name
    ```
  </Tab>
</Tabs>
