> ## 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.

> ## Agent Instructions
> To query the Token Terminal data catalog, read https://tokenterminal.com/docs/catalog/agents-manual.md first. It is the whole catalog as one page: table naming grammar, key columns, partition and cluster rules, units, additivity, and the tables that are documented but not served yet.
> Never query a catalog table on a time bound alone. Also filter its cluster key, which you read from INFORMATION_SCHEMA.COLUMNS; an empty result means the object is a view, whose pruning contract is on its page. Compute is billed to the caller's own Google Cloud project.

# Lending

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

> [!NOTE]
>
> **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!

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`](https://tokenterminal.com/docs/catalog/lending/registry) lists the Arbitrum markets with `chain_id = 'arbitrum'`. 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](https://tokenterminal.com/docs/catalog/lending/deposits.md) **In progress**
* [Withdrawals](https://tokenterminal.com/docs/catalog/lending/withdrawals.md) **In progress**
* [Borrows](https://tokenterminal.com/docs/catalog/lending/borrows.md) **In progress**
* [Repayments](https://tokenterminal.com/docs/catalog/lending/repayments.md) **In progress**
* [Liquidations](https://tokenterminal.com/docs/catalog/lending/liquidations.md) **In progress**
* [Flash loans](https://tokenterminal.com/docs/catalog/lending/flash-loans.md) **In progress**
* [Interest rates](https://tokenterminal.com/docs/catalog/lending/interest-rates.md) **In progress**

Every column is documented at [Lending](https://tokenterminal.com/docs/catalog/lending/index.md).

## Sample queries

**Markets per app**

**Count Arbitrum markets by the app that runs them.**

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

**Markets one app runs**

**List the markets one app runs on Arbitrum.** `lending_market_contract_address` is the market's own contract.

```sql theme={null}
select
    lending_market_id,
    lending_market_name,
    lending_market_contract_address
from `dimensions.lending_markets`
where chain_id = 'arbitrum'
  and app_id = 'aave-v4'
order by lending_market_name
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.