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

# lending.borrow

> DeFi borrowing events — borrows and repayments across major lending protocols with rates and collateral context.

export const TableSample = ({tableName, tableSchema}) => <>
    <div className="hidden dark:block">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}&darkMode=true`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
    <div className="dark:hidden">
      <iframe src={`https://dune.com/embeds/3419983/5785629?table_schema_t6f0df=${tableSchema}&table_name_t6f0df=${tableName}`} style={{
  width: '100%',
  height: '500px',
  border: 'none',
  marginTop: '10px'
}} />
    </div>
  </>;

The `lending.borrow` table contains all borrow-side transactions across DeFi lending protocols — borrows, repayments, and borrow-side liquidations — across 15+ EVM chains.

## Table Schema

| Column                     | Type        | Description                                     |
| -------------------------- | ----------- | ----------------------------------------------- |
| `blockchain`               | `VARCHAR`   | Blockchain name                                 |
| `project`                  | `VARCHAR`   | Lending protocol name                           |
| `version`                  | `VARCHAR`   | Protocol contract version                       |
| `transaction_type`         | `VARCHAR`   | Transaction type (borrow, repay, liquidation)   |
| `loan_type`                | `VARCHAR`   | Type of loan                                    |
| `symbol`                   | `VARCHAR`   | Token symbol                                    |
| `token_address`            | `VARBINARY` | Token contract address                          |
| `borrower`                 | `VARBINARY` | Borrower wallet address                         |
| `on_behalf_of`             | `VARBINARY` | Wallet address the tx was executed on behalf of |
| `repayer`                  | `VARBINARY` | Repayer wallet address                          |
| `liquidator`               | `VARBINARY` | Liquidator wallet address                       |
| `amount`                   | `DOUBLE`    | Token amount in display units                   |
| `amount_raw`               | `UINT256`   | Raw token amount                                |
| `amount_usd`               | `DOUBLE`    | Token amount in USD                             |
| `block_month`              | `TIMESTAMP` | Block month (partition key)                     |
| `block_time`               | `TIMESTAMP` | Block timestamp in UTC                          |
| `block_number`             | `BIGINT`    | Block number                                    |
| `project_contract_address` | `VARBINARY` | Protocol contract address                       |
| `tx_hash`                  | `VARBINARY` | Transaction hash                                |
| `evt_index`                | `INTEGER`   | Event index                                     |

## Table sample

<TableSample tableSchema="lending" tableName="borrow" />

## Query performance

Partition keys: `blockchain`, `project`, `block_month`. Always include `blockchain` and a time filter.

```sql theme={null}
-- ✅ Good: filters on partition keys
SELECT * FROM lending.borrow
WHERE blockchain = 'ethereum'
  AND block_month >= DATE '2025-01-01'
```
