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

# Pendle Events

> Track yield trading activities and strategies in Pendle markets

The `ethereum.yields.pendle_events` table captures all yield trading activities from Pendle's Router V4 contract, providing detailed information about different yield management strategies and their execution.

## Strategy Types

Events are mapped to specific strategies based on the type of operation:

1. **Yield Position Strategies**

   * `long_yield`: Buying YT or selling PT
   * `short_yield`: Selling YT or buying PT

2. **Token Management**

   * `mint_pt_yt`: Minting principal and yield tokens
   * `redeem_pt_yt`: Redeeming principal and yield tokens
   * `mint_sy`: Minting standardized yield tokens
   * `redeem_sy`: Redeeming standardized yield tokens

3. **Liquidity Operations**
   * `add_liquidity`: Adding tokens to markets
   * `remove_liquidity`: Removing tokens from markets

## Strategy Mapping Logic

The strategy field is determined by the following rules:

| Event Type  | Condition            | Strategy          |
| ----------- | -------------------- | ----------------- |
| Swap YT     | YT amount > 0        | long\_yield       |
| Swap YT     | YT amount \< 0       | short\_yield      |
| Swap PT     | PT amount > 0        | short\_yield      |
| Swap PT     | PT amount \< 0       | long\_yield       |
| Mint/Redeem | MintPyFromToken/Sy   | mint\_pt\_yt      |
| Mint/Redeem | RedeemPyToToken/Sy   | redeem\_pt\_yt    |
| Mint/Redeem | MintSyFromToken      | mint\_sy          |
| Mint/Redeem | RedeemSyToToken      | redeem\_sy        |
| Liquidity   | AddLiquidity         | add\_liquidity    |
| Liquidity   | RemoveLiquidity/Exit | remove\_liquidity |

## Usage Example

This query fetches the strategies that have been used in a market.

```sql theme={null}
select
  date(block_timestamp) as date,
  strategy, 
  sum(usd_amount) as usd 
from ethereum.yields.pendle_events
where market = '0x9a63fa80b5ddfd3cab23803fdb93ad2c18f3d5aa'
group by all
order by 1 desc
```

This query finds the largest yield trading positions in the last 30 days.

## Table Columns

| Column Name        | Description                                                            |
| ------------------ | ---------------------------------------------------------------------- |
| strategy           | Type of yield strategy (long\_yield, short\_yield, mint\_pt\_yt, etc.) |
| event\_name        | Name of the Pendle Router V4 event                                     |
| receiver           | Address receiving tokens from the event                                |
| market             | Pendle market (liquidity pool) address                                 |
| market\_name       | Human-readable market name                                             |
| lp\_amount         | Amount of liquidity pool tokens                                        |
| sy                 | Standardized yield token address                                       |
| sy\_name           | Name of standardized yield token                                       |
| sy\_amount         | Amount of standardized yield tokens                                    |
| pt                 | Principal token address                                                |
| pt\_name           | Name of principal token                                                |
| pt\_amount         | Amount of principal tokens                                             |
| yt                 | Yield token address                                                    |
| yt\_name           | Name of yield token                                                    |
| yt\_amount         | Amount of yield tokens                                                 |
| token              | Address of token being swapped                                         |
| token\_name        | Name of token being swapped                                            |
| token\_symbol      | Symbol of token being swapped                                          |
| token\_amount      | Amount of tokens being swapped                                         |
| token\_amount\_usd | USD value of swapped tokens                                            |
| usd\_amount        | Total USD value of event                                               |
| caller             | Address initiating the transaction                                     |
| transaction\_hash  | Transaction hash                                                       |
| transaction\_index | Index of transaction in block                                          |
| block\_timestamp   | Block timestamp                                                        |
| block\_number      | Block number                                                           |
| block\_hash        | Block hash                                                             |
| from\_address      | Transaction sender address                                             |
| to\_address        | Transaction recipient contract                                         |
| log\_index         | Event log index                                                        |
| topic0             | First event log topic                                                  |
| extra\_fields      | Additional event fields                                                |
| unique\_id         | Unique event identifier                                                |
