$npx -y skills add franalgaba/grimoire --skill grimoire-pendleFetches Pendle Hosted SDK metadata using the Grimoire venue CLI. Use when you need supported chains, aggregators, markets, assets, or market token details.
| 1 | # Grimoire Pendle Skill |
| 2 | |
| 3 | Use this skill to inspect Pendle metadata and preflight Pendle routing configuration before running spells. |
| 4 | |
| 5 | Preferred invocations: |
| 6 | |
| 7 | - `grimoire venue pendle ...` |
| 8 | - `npx -y @grimoirelabs/cli venue pendle ...` (no-install) |
| 9 | - `bun run packages/cli/src/index.ts venue pendle ...` (repo-local) |
| 10 | - `grimoire-pendle ...` (direct binary from `@grimoirelabs/venues`) |
| 11 | |
| 12 | Recommended preflight: |
| 13 | |
| 14 | - `grimoire venue doctor --adapter pendle --chain 1 --rpc-url <rpc> --json` |
| 15 | |
| 16 | ## Commands |
| 17 | |
| 18 | - `grimoire venue pendle info [--base-url <url>] [--format <auto|json|table>]` |
| 19 | - `grimoire venue pendle chains [--base-url <url>] [--format <auto|json|table>]` |
| 20 | - `grimoire venue pendle supported-aggregators --chain <id> [--base-url <url>] [--format <auto|json|table>]` |
| 21 | - `grimoire venue pendle markets [--chain <id>] [--active <true|false>] [--base-url <url>] [--format <auto|json|table>]` |
| 22 | - `grimoire venue pendle assets [--chain <id>] [--type <PT|YT|LP|SY>] [--base-url <url>] [--format <auto|json|table>]` |
| 23 | - `grimoire venue pendle market-tokens --chain <id> --market <address> [--base-url <url>] [--format <auto|json|table>]` |
| 24 | |
| 25 | ## Examples |
| 26 | |
| 27 | ```bash |
| 28 | grimoire venue pendle info --format table |
| 29 | grimoire venue pendle chains |
| 30 | grimoire venue pendle supported-aggregators --chain 1 --format json |
| 31 | grimoire venue pendle markets --chain 1 --active true --format table |
| 32 | grimoire venue pendle assets --chain 8453 --type PT --format table |
| 33 | grimoire venue pendle market-tokens --chain 8453 --market 0x... --format json |
| 34 | ``` |
| 35 | |
| 36 | ## Authoring Workflow |
| 37 | |
| 38 | Pendle requires a market-first approach. **Do NOT write a Pendle spell without first querying available markets.** |
| 39 | |
| 40 | 1. **Query markets** for the target chain and underlying: |
| 41 | ```bash |
| 42 | grimoire venue pendle markets --chain 1 --active true --format json |
| 43 | ``` |
| 44 | |
| 45 | 2. **Pick a market** — note its address and expiry. Each market has specific PT/YT/SY tokens. |
| 46 | |
| 47 | 3. **Query market tokens** to get the exact token addresses: |
| 48 | ```bash |
| 49 | grimoire venue pendle market-tokens --chain 1 --market 0x... --format json |
| 50 | ``` |
| 51 | |
| 52 | 4. **Write the spell** using token addresses from step 3: |
| 53 | ```spell |
| 54 | pendle.add_liquidity(0x<SY_address>, params.amount) with (max_slippage=100) |
| 55 | ``` |
| 56 | |
| 57 | ### Common mistakes |
| 58 | |
| 59 | - **`pendle.deposit(USDC, ...)`** — Pendle has no `deposit` action. Use `add_liquidity`, `mint_py`, `mint_sy`, or `swap`. |
| 60 | - **Using token symbols without addresses** — PT/YT/SY tokens are auto-resolved via the Pendle API, but standard tokens like USDC need raw amounts in the token's smallest unit. |
| 61 | - **Missing `enable_aggregator`** — Some routes require an aggregator. If no route is found, retry with `enable_aggregator=true` in the `with()` clause. |
| 62 | |
| 63 | ### Supported actions |
| 64 | |
| 65 | | Action | Description | Input | Output | |
| 66 | |--------|-------------|-------|--------| |
| 67 | | `swap` | Swap between any Pendle tokens | Single token | Single token | |
| 68 | | `add_liquidity` | Add single-sided liquidity | Underlying/SY | LP token | |
| 69 | | `remove_liquidity` | Remove single-sided liquidity | LP token | Underlying/SY | |
| 70 | | `mint_py` | Mint PT + YT from underlying | Underlying/SY | PT + YT | |
| 71 | | `redeem_py` | Redeem PT + YT to underlying | PT + YT | Underlying/SY | |
| 72 | | `mint_sy` | Wrap underlying into SY | Underlying | SY | |
| 73 | | `redeem_sy` | Unwrap SY to underlying | SY | Underlying | |
| 74 | |
| 75 | ## Metric Surface (Spell Comparisons) |
| 76 | |
| 77 | Pendle exposes `quote_out` for route output comparisons: |
| 78 | |
| 79 | ```spell |
| 80 | pendle_out = metric("quote_out", pendle, USDC, "asset_out=DAI,amount=1000000,slippage_bps=1000") |
| 81 | ``` |
| 82 | |
| 83 | Selector fields: |
| 84 | |
| 85 | - required: `asset_out` |
| 86 | - optional: `amount` (defaults to 1 unit of input asset), `slippage_bps`, `enable_aggregator` |
| 87 | |
| 88 | ## Spell Constraints |
| 89 | |
| 90 | When writing Pendle actions in `.spell` files, use `with` clauses: |
| 91 | |
| 92 | ```spell |
| 93 | pendle.swap(PT_TOKEN, SY_TOKEN, params.amount) with ( |
| 94 | max_slippage=100, |
| 95 | require_quote=true, |
| 96 | ) |
| 97 | ``` |
| 98 | |
| 99 | | Constraint | Type | Description | |
| 100 | |-----------|------|-------------| |
| 101 | | `max_slippage` | integer (bps) | Maximum slippage, validated as integer in `[0, 10000]`, converted to decimal for API | |
| 102 | | `min_output` | integer (wei) | Minimum output amount floor | |
| 103 | | `require_quote` | boolean | Fail if Pendle API quote fails | |
| 104 | | `max_gas` | integer (wei) | Gas estimate cap | |
| 105 | |
| 106 | Pendle `swap` only supports `mode: exact_in`. `exact_out` is not supported. |
| 107 | |
| 108 | When the Pendle API returns multiple routes, the adapter selects the first (best) route and emits a warning via `onWarning`. This is logged in non-JSON CLI runs. |
| 109 | |
| 110 | ## PT/YT/SY Token Resolution |
| 111 | |
| 112 | Pendle PT, YT, and SY tokens (e.g. `PT_FXSAVE`, `YT_EETH`, `SY_WSTETH`) are **automatically resolved** via the Pendle API at build time. You can use these symbols directly in spells without providing explicit addresses: |
| 113 | |
| 114 | ```spell |
| 115 | pendle.swap(PT_FXSAVE, USDC, params.amount) with (max_slippage=100) |
| 116 | ``` |
| 117 | |
| 118 | The adapter converts underscore |