# Table of Contents - [Introduction to Pendle | Pendle Documentation](#introduction-to-pendle-pendle-documentation) - [Search the documentation](#search-the-documentation) - [Boros Developer Documentation | Pendle Documentation](#boros-developer-documentation-pendle-documentation) - [Season 2 Coming Soon | Pendle Documentation](#season-2-coming-soon-pendle-documentation) - [Agent Trading | Pendle Documentation](#agent-trading-pendle-documentation) - [Boros Open API | Pendle Documentation](#boros-open-api-pendle-documentation) - [Historical Data | Pendle Documentation](#historical-data-pendle-documentation) - [Custom Types | Pendle Documentation](#custom-types-pendle-documentation) - [Boros Lite Paper | Pendle Documentation](#boros-lite-paper-pendle-documentation) - [Backend Integration | Pendle Documentation](#backend-integration-pendle-documentation) - [Market View Functions | Pendle Documentation](#market-view-functions-pendle-documentation) - [Fees | Pendle Documentation](#fees-pendle-documentation) - [Stop Orders (TP/SL) | Pendle Documentation](#stop-orders-tp-sl-pendle-documentation) - [Boros API Best Practices | Pendle Documentation](#boros-api-best-practices-pendle-documentation) - [High Level Architecture | Pendle Documentation](#high-level-architecture-pendle-documentation) - [Points Trading | Pendle Documentation](#points-trading-pendle-documentation) - [Margin | Pendle Documentation](#margin-pendle-documentation) - [\$PENDLE Farms | Pendle Documentation](#-pendle-farms-pendle-documentation) - [Withdrawals / Deposits from Other Chains | Pendle Documentation](#withdrawals-deposits-from-other-chains-pendle-documentation) - [Chapter 2 - Yield Tokenization Basics | Pendle Documentation](#chapter-2-yield-tokenization-basics-pendle-documentation) - [Settlement | Pendle Documentation](#settlement-pendle-documentation) - [Central Limit Order Book | Pendle Documentation](#central-limit-order-book-pendle-documentation) - [Chapter 1 - Introduction to Optimizing Yield | Pendle Documentation](#chapter-1-introduction-to-optimizing-yield-pendle-documentation) - [Pendle Documentation](#pendle-documentation) - [Start Here | Pendle Documentation](#start-here-pendle-documentation) - [MarketHub View Functions | Pendle Documentation](#markethub-view-functions-pendle-documentation) - [Pendle 101 - Key Takeaways | Pendle Documentation](#pendle-101-key-takeaways-pendle-documentation) - [Chapter 9 - Identifying Opportunities to Long/Short Yield | Pendle Documentation](#chapter-9-identifying-opportunities-to-long-short-yield-pendle-documentation) - [Glossary | Pendle Documentation](#glossary-pendle-documentation) - [Privacy Policy | Pendle Documentation](#privacy-policy-pendle-documentation) - [Boros WebSocket | Pendle Documentation](#boros-websocket-pendle-documentation) - [Chapter 3.1 - Fixed Yield on Pendle | Pendle Documentation](#chapter-3-1-fixed-yield-on-pendle-pendle-documentation) - [Chapter 6 - Shorting Yield | Pendle Documentation](#chapter-6-shorting-yield-pendle-documentation) - [Router Integration Guide | Pendle Documentation](#router-integration-guide-pendle-documentation) - [Chapter 4 - Yield Trading Basics with YT | Pendle Documentation](#chapter-4-yield-trading-basics-with-yt-pendle-documentation) - [Frequently Asked Questions | Pendle Documentation](#frequently-asked-questions-pendle-documentation) - [Chapter 5 - Important concepts in yield trading | Pendle Documentation](#chapter-5-important-concepts-in-yield-trading-pendle-documentation) - [Chapter 8 - Long Yield (Obtain Leveraged Yield-Exposure) | Pendle Documentation](#chapter-8-long-yield-obtain-leveraged-yield-exposure-pendle-documentation) - [Optimizing Yields with Pendle - Key Takeaways | Pendle Documentation](#optimizing-yields-with-pendle-key-takeaways-pendle-documentation) - [Chapter 7 - Providing Liquidity while Trading Yield | Pendle Documentation](#chapter-7-providing-liquidity-while-trading-yield-pendle-documentation) - [FAQ | Pendle Documentation](#faq-pendle-documentation) - [Security | Pendle Documentation](#security-pendle-documentation) - [Pendle Wars & "Bribes" | Pendle Documentation](#pendle-wars-bribes-pendle-documentation) - [PT / YT / LP Cheatsheet | Pendle Documentation](#pt-yt-lp-cheatsheet-pendle-documentation) - [TERMS OF USE (THESE “TERMS”) | Pendle Documentation](#terms-of-use-these-terms-pendle-documentation) - [Claim | Pendle Documentation](#claim-pendle-documentation) - [Mint | Pendle Documentation](#mint-pendle-documentation) - [Bridging Pendle (PENDLE) Tokens | Pendle Documentation](#bridging-pendle-pendle-tokens-pendle-documentation) - [Swap | Pendle Documentation](#swap-pendle-documentation) - [Pendle AI Plugin | Pendle Documentation](#pendle-ai-plugin-pendle-documentation) - [Pencosystem | Pendle Documentation](#pencosystem-pendle-documentation) - [Limit Order | Pendle Documentation](#limit-order-pendle-documentation) - [Cross-Chain PT | Pendle Documentation](#cross-chain-pt-pendle-documentation) - [Pool | Pendle Documentation](#pool-pendle-documentation) - [Using Pendle | Pendle Documentation](#using-pendle-pendle-documentation) - [Glossary | Pendle Documentation](#glossary-pendle-documentation) - [Chapter 3.2 - More Yield via Liquidity Provision | Pendle Documentation](#chapter-3-2-more-yield-via-liquidity-provision-pendle-documentation) - [RouterStatic | Pendle Documentation](#routerstatic-pendle-documentation) - [Understanding Negative Yield Risk on Interest-Bearing Tokens (IBT) | Pendle Documentation](#understanding-negative-yield-risk-on-interest-bearing-tokens-ibt-pendle-documentation) - [Order Book | Pendle Documentation](#order-book-pendle-documentation) - [Deployments | Pendle Documentation](#deployments-pendle-documentation) - [Fees | Pendle Documentation](#fees-pendle-documentation) - [Minting | Pendle Documentation](#minting-pendle-documentation) - [AMM | Pendle Documentation](#amm-pendle-documentation) - [sPENDLE | Pendle Documentation](#spendle-pendle-documentation) - [SY | Pendle Documentation](#sy-pendle-documentation) - [APY Calculation | Pendle Documentation](#apy-calculation-pendle-documentation) - [Dashboard | Pendle Documentation](#dashboard-pendle-documentation) - [High Level Architecture | Pendle Documentation](#high-level-architecture-pendle-documentation) - [Tokenomics | Pendle Documentation](#tokenomics-pendle-documentation) - [Incentives | Pendle Documentation](#incentives-pendle-documentation) - [Pendle API Overview | Pendle Documentation](#pendle-api-overview-pendle-documentation) - [PT | Pendle Documentation](#pt-pendle-documentation) - [Points & Rewards Tracking | Pendle Documentation](#points-rewards-tracking-pendle-documentation) - [Quickstart | Pendle Documentation](#quickstart-pendle-documentation) - [Points Support Page | Pendle Documentation](#points-support-page-pendle-documentation) - [Pendle Hosted SDK | Pendle Documentation](#pendle-hosted-sdk-pendle-documentation) - [Community Listing Guide | Pendle Documentation](#community-listing-guide-pendle-documentation) - [Troubleshooting Guide | Pendle Documentation](#troubleshooting-guide-pendle-documentation) - [Cancel Limit Orders | Pendle Documentation](#cancel-limit-orders-pendle-documentation) - [Create a Limit Order | Pendle Documentation](#create-a-limit-order-pendle-documentation) - [Fill a Limit Order | Pendle Documentation](#fill-a-limit-order-pendle-documentation) - [Cross-Chain PT | Pendle Documentation](#cross-chain-pt-pendle-documentation) - [LP as Collateral in a Money Market | Pendle Documentation](#lp-as-collateral-in-a-money-market-pendle-documentation) - [Sanity checks for PT Integrations | Pendle Documentation](#sanity-checks-for-pt-integrations-pendle-documentation) - [Limit Order Contract | Pendle Documentation](#limit-order-contract-pendle-documentation) - [YT | Pendle Documentation](#yt-pendle-documentation) - [Limit Orders | Pendle Documentation](#limit-orders-pendle-documentation) - [Linear Discount Oracle Wrapper | Pendle Documentation](#linear-discount-oracle-wrapper-pendle-documentation) - [Simple Functions | Pendle Documentation](#simple-functions-pendle-documentation) - [PT as Collateral in a Money Market | Pendle Documentation](#pt-as-collateral-in-a-money-market-pendle-documentation) - [Yield Token (YT) Trading Functions | Pendle Documentation](#yield-token-yt-trading-functions-pendle-documentation) - [Principal Token (PT) Trading Functions | Pendle Documentation](#principal-token-pt-trading-functions-pendle-documentation) - [LP Linear Discount Oracle | Pendle Documentation](#lp-linear-discount-oracle-pendle-documentation) - [Spark Linear Discount Oracle (PT) | Pendle Documentation](#spark-linear-discount-oracle-pt-pendle-documentation) - [Liquidity Management Functions | Pendle Documentation](#liquidity-management-functions-pendle-documentation) - [Market Factory | Pendle Documentation](#market-factory-pendle-documentation) - [LP Wrapper | Pendle Documentation](#lp-wrapper-pendle-documentation) - [Yield Contract Factory | Pendle Documentation](#yield-contract-factory-pendle-documentation) - [sPENDLE | Pendle Documentation](#spendle-pendle-documentation) - [Choosing Linear Discount Parameters | Pendle Documentation](#choosing-linear-discount-parameters-pendle-documentation) - [LP Linear Discount Oracle | Pendle Documentation](#lp-linear-discount-oracle-pendle-documentation) - [Common Market Deployments | Pendle Documentation](#common-market-deployments-pendle-documentation) - [Pendle Router Overview | Pendle Documentation](#pendle-router-overview-pendle-documentation) - [Unit, Decimals and Scaled18 | Pendle Documentation](#unit-decimals-and-scaled18-pendle-documentation) - [User & Position Info Functions | Pendle Documentation](#user-position-info-functions-pendle-documentation) - [Misc Functions | Pendle Documentation](#misc-functions-pendle-documentation) - [Types and Utility Functions | Pendle Documentation](#types-and-utility-functions-pendle-documentation) - [Mint & Redeem Simulation Functions | Pendle Documentation](#mint-redeem-simulation-functions-pendle-documentation) - [GaugeController | Pendle Documentation](#gaugecontroller-pendle-documentation) - [Pendle Spark Linear Discount Oracle | Pendle Documentation](#pendle-spark-linear-discount-oracle-pendle-documentation) - [Decimals Wrapper | Pendle Documentation](#decimals-wrapper-pendle-documentation) - [Pendle Chainlink-Compatible Oracle Wrappers | Pendle Documentation](#pendle-chainlink-compatible-oracle-wrappers-pendle-documentation) - [Market Rates & State Functions | Pendle Documentation](#market-rates-state-functions-pendle-documentation) - [Pendle Router Contract Integration Guide | Pendle Documentation](#pendle-router-contract-integration-guide-pendle-documentation) - [Liquidity Simulation Functions | Pendle Documentation](#liquidity-simulation-functions-pendle-documentation) - [PendlePYLpOracle | Pendle Documentation](#pendlepylporacle-pendle-documentation) - [Pendle Oracle Overview | Pendle Documentation](#pendle-oracle-overview-pendle-documentation) - [Swap Simulation Functions | Pendle Documentation](#swap-simulation-functions-pendle-documentation) - [RouterStatic Overview | Pendle Documentation](#routerstatic-overview-pendle-documentation) - [Overview | Pendle Documentation](#overview-pendle-documentation) - [StandardizedYield (SY) | Pendle Documentation](#standardizedyield-sy-pendle-documentation) - [Frequently Asked Questions | Pendle Documentation](#frequently-asked-questions-pendle-documentation) - [How to Integrate PT and LP Oracle | Pendle Documentation](#how-to-integrate-pt-and-lp-oracle-pendle-documentation) - [MerkleDistributor | Pendle Documentation](#merkledistributor-pendle-documentation) - [Rewards | Pendle Documentation](#rewards-pendle-documentation) - [Pendle Market Smart Contracts | Pendle Documentation](#pendle-market-smart-contracts-pendle-documentation) - [Common SY Contracts | Pendle Documentation](#common-sy-contracts-pendle-documentation) - [Yield Tokenization Smart Contracts | Pendle Documentation](#yield-tokenization-smart-contracts-pendle-documentation) --- # Introduction to Pendle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Introduction#__docusaurus_skipToContent_fallback) On this page How much will you earn from lending 1,000 USDC on Aave? 1%? 3%? 5%? Truth is, you can't say for sure. Yield fluctuates just like token prices. It tends to go up in bull markets, and go down in bear markets, and there are further micro-factors that cause fluctuations within those general market trends. ![Compound historical yield charts](https://docs.pendle.finance/img/introduction/historical_yield.jpg) Compound historical yield charts from [The Block Crypto](https://www.theblockcrypto.com/data/decentralized-finance/cryptocurrency-lending/compound-lending-rates) With Pendle, you can always maximise your yield: increase your yield exposure in bull markets and hedge against yield downturns during bear markets. What does Pendle do?[​](https://docs.pendle.finance/pendle-v2/Introduction#what-does-pendle-do "Direct link to What does Pendle do?") -------------------------------------------------------------------------------------------------------------------------------------- We give users the reins to their yield. [Pendle](https://pendle.finance/) is a permissionless yield-trading protocol where users can execute various yield-management strategies. It acts as a second-order derivative layer, building upon and integrating with existing core yield-generating primitives in the DeFi ecosystem — Liquid Staking Tokens (LSTs), Liquid Restaking Tokens (LRTs), stablecoins, RWAs, and more. Pendle's smart contract architecture is **permissionless** — any user or protocol can create a new yield-trading market on-chain. While on-chain creation is open to all, the visibility of these markets on the official [Pendle UI](https://app.pendle.finance/) is curated through a review process to ensure quality and safety. Community members can also leverage the [Community Listing Portal](https://listing.pendle.finance/) for a streamlined listing process. There are 2 main parts to fully understand Pendle: 1. Yield Tokenization First, Pendle wrap **yield-bearing tokens** into **SY**(standardized yield tokens), which is a wrapped version of the underlying yield-bearing token that is compatible with the Pendle AMM (e.g. stETH → SY-stETH). SY is then split into its principal and yield components, **PT** (principal token) and **YT** (yield token) respectively, this process is termed as yield-tokenization, where the yield is tokenized into a separate token. 2. Pendle AMM Both **PT** and **YT** can be traded via Pendle’s **AMM**. Even though this is the core engine of Pendle, understanding of the AMM is not required to trade PT and YT. As a yield derivative protocol, we are bringing the TradFi interest derivative market ([worth over $400T in notional value](https://www.bis.org/publ/otc_hy2111/intgraphs/graphA3.htm) ) into DeFi, making it accessible to all. By creating a yield market in DeFi, Pendle unlocks the full potential of yield, enabling users to execute advanced yield strategies, such as: * Fixed yield (e.g. earn fixed yield on stETH) * Long yield (e.g. bet on stETH yield going up by purchasing more yield) * Earn more yield without additional risks (e.g. provide liquidity with your stETH) * A mix of any of the above strategies, learn more on how to execute these strategies at our [Pendle Academy](https://pendle.gitbook.io/pendle-academy) * [What does Pendle do?](https://docs.pendle.finance/pendle-v2/Introduction#what-does-pendle-do) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Search the documentation [Skip to main content](https://docs.pendle.finance/search#__docusaurus_skipToContent_fallback) Search the documentation ======================== Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Boros Developer Documentation | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev#__docusaurus_skipToContent_fallback) On this page Boros is an on-chain interest rate swap (IRS) trading platform by Pendle, deployed on Arbitrum. It enables users to take leveraged long or short positions on variable interest rates — starting with funding rates — through a hybrid central limit order book (CLOB) and AMM architecture. These docs are for developers integrating with Boros programmatically, whether through the REST API and SDK, direct smart contract calls, or both. Choose your path[​](https://docs.pendle.finance/boros-dev#choose-your-path "Direct link to Choose your path") -------------------------------------------------------------------------------------------------------------- Building a trading bot or API integration Use the REST API and SDK via the agent-based **Send Txs Bot** architecture. Start with [Backend Integration > Overview](https://docs.pendle.finance/boros-dev/Backend/overview) . Integrating smart contracts directly Call Boros contracts from your own on-chain or off-chain code. Start with [Contracts > Router](https://docs.pendle.finance/boros-dev/Contracts/Router) . Learning how the protocol works Read the [LitePaper](https://docs.pendle.finance/boros-dev/LitePaper) for a conceptual overview, or dive into [Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook) for protocol-level detail. What's in these docs[​](https://docs.pendle.finance/boros-dev#whats-in-these-docs "Direct link to What's in these docs") ------------------------------------------------------------------------------------------------------------------------- | Section | Contents | | --- | --- | | **Backend Integration** | REST API, WebSocket, agent wallet setup, stop orders (TP/SL), transaction submission via Send Txs Bot, best practices | | **Historical Data** | Monthly NDJSON exports of trades, OHLCV candles, order book snapshots, settlement rates and market data | | **Mechanics** | Order book matching, margin system (cross vs isolated), settlement, fees | | **Contracts** | Router, MarketHub, Market, custom types reference, NPM package | | **LitePaper** | User-friendly explanation of interest rate swaps with worked examples | | **FAQ** | Common questions and troubleshooting | Quick resources[​](https://docs.pendle.finance/boros-dev#quick-resources "Direct link to Quick resources") ----------------------------------------------------------------------------------------------------------- * [Whitepapers](https://github.com/pendle-finance/boros-core-public/tree/main/whitepapers) * [Core Contracts Repository](https://github.com/pendle-finance/boros-core-public) * [Audit Reports](https://github.com/pendle-finance/boros-core-public/tree/main/audits/) * [Deployed Addresses](https://github.com/pendle-finance/boros-core-public/tree/main/deployments) * [Historical Data Browser](https://historical-data.boros.finance/) * [Choose your path](https://docs.pendle.finance/boros-dev#choose-your-path) * [What's in these docs](https://docs.pendle.finance/boros-dev#whats-in-these-docs) * [Quick resources](https://docs.pendle.finance/boros-dev#quick-resources) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Season 2 Coming Soon | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/Leaderboard#__docusaurus_skipToContent_fallback) On this page Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Agent Trading | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/agent#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/boros-dev/Backend/agent#overview "Direct link to Overview") ---------------------------------------------------------------------------------------------------- An **agent** is an EVM address authorized to execute trading operations on behalf of your root account. Agents enable automated trading and simplified transaction management without requiring your root account to sign every transaction. **Benefits:** * Execute trades without signing each transaction with your root account * Enable automated trading strategies * Simplified transaction flow for high-frequency operations * Enhanced security by limiting exposure of your root private key How Agents Work[​](https://docs.pendle.finance/boros-dev/Backend/agent#how-agents-work "Direct link to How Agents Work") ------------------------------------------------------------------------------------------------------------------------- Agents use a delegated signing mechanism where your root account authorizes a specific agent address to perform actions on your behalf. Once approved, the agent can sign transactions for operations like placing orders, canceling orders, and other trading activities. Setting Up an Agent[​](https://docs.pendle.finance/boros-dev/Backend/agent#setting-up-an-agent "Direct link to Setting Up an Agent") ------------------------------------------------------------------------------------------------------------------------------------- ### Step 1: Generate an Agent[​](https://docs.pendle.finance/boros-dev/Backend/agent#step-1-generate-an-agent "Direct link to Step 1: Generate an Agent") Create a new EVM address (private/public key pair) that will serve as your agent. This can be done using standard Ethereum wallet libraries. **Example:** [https://github.com/pendle-finance/boros-api-examples/blob/main/examples/01-agent.ts](https://github.com/pendle-finance/boros-api-examples/blob/main/examples/01-agent.ts) ### Step 2: Approve the Agent[​](https://docs.pendle.finance/boros-dev/Backend/agent#step-2-approve-the-agent "Direct link to Step 2: Approve the Agent") Sign an approval payload with your root account to authorize the agent. 1. Generate the approval payload 2. Sign the payload using your root account's private key 3. Submit the signed approval to the Boros backend Example can be found in [https://github.com/pendle-finance/boros-api-examples/blob/main/examples/01-agent.ts](https://github.com/pendle-finance/boros-api-examples/blob/main/examples/01-agent.ts) ### Step 3: Confirmation[​](https://docs.pendle.finance/boros-dev/Backend/agent#step-3-confirmation "Direct link to Step 3: Confirmation") Once the approval transaction is processed, the agent is authorized to act on behalf of your account. You can now use the agent's signature for trading operations without requiring your root signature. **API Reference:** Check agent expiry and status: [https://api.boros.finance/open-api/docs#tag/agents/get/v1/agents/expiry-time](https://api.boros.finance/open-api/docs#tag/agents/get/v1/agents/expiry-time) Trading with an Agent[​](https://docs.pendle.finance/boros-dev/Backend/agent#trading-with-an-agent "Direct link to Trading with an Agent") ------------------------------------------------------------------------------------------------------------------------------------------- Once your agent is approved, follow this workflow for executing trades: ### Workflow[​](https://docs.pendle.finance/boros-dev/Backend/agent#workflow "Direct link to Workflow") 1. **Generate Calldata** * Call the Boros API to generate transaction calldata, or * Generate calldata manually using the SDK 2. **Sign with Agent** * Use your agent's private key to sign the calldata payload 3. **Submit Transaction** * Send the signed calldata to the Boros backend * The backend submits the transaction on-chain on your behalf **Example:** [https://github.com/pendle-finance/boros-api-examples](https://github.com/pendle-finance/boros-api-examples) Gas Fees[​](https://docs.pendle.finance/boros-dev/Backend/agent#gas-fees "Direct link to Gas Fees") ---------------------------------------------------------------------------------------------------- The Boros backend submits transactions to the blockchain on your behalf. Gas fees are charged for each on-chain action. **Important Points:** * Gas fees are denominated in USD based on the current ETH price * Fees reflect the actual cost charged by the Arbitrum network * **No additional markup** - you pay only the network transaction fee * Fees are deducted from your account balance automatically ### Managing Gas Balance[​](https://docs.pendle.finance/boros-dev/Backend/agent#managing-gas-balance "Direct link to Managing Gas Balance") You need to maintain sufficient balance to cover gas fees for your transactions. #### Option 1: Pay via Agent Flow[​](https://docs.pendle.finance/boros-dev/Backend/agent#option-1-pay-via-agent-flow "Direct link to Option 1: Pay via Agent Flow") Use the agent signing mechanism to deposit funds into your gas treasury. **Example:** [https://github.com/pendle-finance/boros-api-examples/blob/main/examples/12-top-up-gas-account.ts](https://github.com/pendle-finance/boros-api-examples/blob/main/examples/12-top-up-gas-account.ts) #### Option 2: Web Interface[​](https://docs.pendle.finance/boros-dev/Backend/agent#option-2-web-interface "Direct link to Option 2: Web Interface") Use the Boros web interface for a simple deposit flow. You can go to [https://boros.pendle.finance/account](https://boros.pendle.finance/account) and click on the Gas balance button **UI Link:** [Boros App](https://boros.pendle.finance/) Security Considerations[​](https://docs.pendle.finance/boros-dev/Backend/agent#security-considerations "Direct link to Security Considerations") ------------------------------------------------------------------------------------------------------------------------------------------------- **Best Practices:** * Store agent private keys securely, separate from your root key * Monitor agent activity regularly * Set appropriate expiry times for agent approvals * Revoke agent access if compromised * Never share agent private keys **Agent Limitations:** * Agents can only perform authorized trading operations * Agents cannot withdraw funds — only the root account can initiate withdrawals * Agent approvals can be revoked at any time by the root account * [Overview](https://docs.pendle.finance/boros-dev/Backend/agent#overview) * [How Agents Work](https://docs.pendle.finance/boros-dev/Backend/agent#how-agents-work) * [Setting Up an Agent](https://docs.pendle.finance/boros-dev/Backend/agent#setting-up-an-agent) * [Step 1: Generate an Agent](https://docs.pendle.finance/boros-dev/Backend/agent#step-1-generate-an-agent) * [Step 2: Approve the Agent](https://docs.pendle.finance/boros-dev/Backend/agent#step-2-approve-the-agent) * [Step 3: Confirmation](https://docs.pendle.finance/boros-dev/Backend/agent#step-3-confirmation) * [Trading with an Agent](https://docs.pendle.finance/boros-dev/Backend/agent#trading-with-an-agent) * [Workflow](https://docs.pendle.finance/boros-dev/Backend/agent#workflow) * [Gas Fees](https://docs.pendle.finance/boros-dev/Backend/agent#gas-fees) * [Managing Gas Balance](https://docs.pendle.finance/boros-dev/Backend/agent#managing-gas-balance) * [Security Considerations](https://docs.pendle.finance/boros-dev/Backend/agent#security-considerations) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Boros Open API | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/api#__docusaurus_skipToContent_fallback) On this page This guide walks you through integrating with the Boros trading platform via the REST API. For exact request/response schemas and parameter details, see the [interactive API docs](https://api.boros.finance/open-api/docs) . For key concepts and terminology, see the [Glossary](https://docs.pendle.finance/boros-dev/Backend/glossary) . **Example Repository:** [https://github.com/pendle-finance/boros-api-examples](https://github.com/pendle-finance/boros-api-examples) * * * Base URLs[​](https://docs.pendle.finance/boros-dev/Backend/api#base-urls "Direct link to Base URLs") ----------------------------------------------------------------------------------------------------- | Environment | Base URL | | --- | --- | | Production | `https://api.boros.finance` | | Service | Path Prefix | Purpose | | --- | --- | --- | | **Open API** | `/open-api/v1/` (or `/v2/`) | Market data, calldata generation, account queries | | **Send Txs Bot** | `/send-txs-bot/v2/` or `/v3/` | Submitting signed transactions on-chain | | **Stop Order** | `/stop-order/v1/` to `/v3/` | Conditional TP/SL order management | * * * API Services[​](https://docs.pendle.finance/boros-dev/Backend/api#api-services "Direct link to API Services") -------------------------------------------------------------------------------------------------------------- ### Open API (Primary)[​](https://docs.pendle.finance/boros-dev/Backend/api#open-api-primary "Direct link to Open API (Primary)") The main API for querying data and generating transaction calldata. **Interactive docs:** [https://api.boros.finance/open-api/docs](https://api.boros.finance/open-api/docs) ### Send Txs Bot (Transaction Submission)[​](https://docs.pendle.finance/boros-dev/Backend/api#send-txs-bot-transaction-submission "Direct link to Send Txs Bot (Transaction Submission)") Receives signed calldata from agents and broadcasts transactions on-chain. You never call smart contracts directly — the bot submits them on your behalf and charges gas fees from your gas balance. **Interactive docs:** [https://api.boros.finance/send-txs-bot/docs](https://api.boros.finance/send-txs-bot/docs) ### Stop Order Service[​](https://docs.pendle.finance/boros-dev/Backend/api#stop-order-service "Direct link to Stop Order Service") Manages conditional stop orders (take-profit / stop-loss). These orders live off-chain and are triggered automatically when the market APR crosses a threshold. See [Stop Orders](https://docs.pendle.finance/boros-dev/Backend/api#stop-orders-tpsl) below for details. **Interactive docs:** [https://api.boros.finance/stop-order/docs](https://api.boros.finance/stop-order/docs) * * * Integration Workflows[​](https://docs.pendle.finance/boros-dev/Backend/api#integration-workflows "Direct link to Integration Workflows") ----------------------------------------------------------------------------------------------------------------------------------------- ### 1\. First-Time Setup[​](https://docs.pendle.finance/boros-dev/Backend/api#1-first-time-setup "Direct link to 1. First-Time Setup") Before trading, you need to set up an agent and fund your accounts. ┌─────────────────────────────────────────────────────┐│ 1. Generate an agent key pair ││ 2. GET /calldata/approve-agent → calldata ││ 3. Sign & submit approval tx (from root wallet) ││ 4. GET /calldata/deposit → calldata ││ 5. Sign & submit deposit tx (from root wallet) ││ 6. Top up gas balance for agent tx fees │└─────────────────────────────────────────────────────┘ **Steps 2-5 are "sensitive" actions** — they require the root wallet signature and are submitted directly to the blockchain, not through the Send Txs Bot. The calldata endpoints return a `to` address (the Router contract) and the encoded calldata to include in your transaction. See [Agent Trading](https://docs.pendle.finance/boros-dev/Backend/agent) for the full agent setup guide. ### 2\. Placing a Trade (Agent Flow)[​](https://docs.pendle.finance/boros-dev/Backend/api#2-placing-a-trade-agent-flow "Direct link to 2. Placing a Trade (Agent Flow)") Once your agent is approved, this is the typical order placement flow: ┌──────────────────────────────────────────────────────────────┐│ 1. GET /markets/{marketId} → market info ││ 2. GET /simulations/place-order → preview trade ││ 3. POST /calldata/place-orders → calldata[] ││ 4. Sign each calldata with agent key ││ 5. POST /send-txs-bot/v2/agent/bulk-direct-call → tx hash ││ 6. Subscribe to WebSocket account channel for fill updates │└──────────────────────────────────────────────────────────────┘ **Step 2 (simulation) is optional** but recommended — it previews the margin impact, estimated fees, and validates constraints before generating calldata. **Step 3** returns an array of calldata objects. When `autoExitMarket` is enabled (default), the response may contain **1 or 2 calldatas**: an optional exit-market calldata followed by the place-order calldata. You must submit **all** calldatas, not just the first one. **Step 5** sends the signed calldata(s) to the Send Txs Bot. Use `bulk-direct-call` when you have multiple calldatas (e.g., exit-market + place-order). Use `direct-call` only when you have exactly one calldata. The response includes a transaction status and hash. skipReceipt parameter When submitting via the Send Txs Bot, you can set `skipReceipt=true` to get the `txHash` returned immediately without waiting for block inclusion. With `skipReceipt=false` (default), the bot waits for the transaction to be included in a block and returns the full `status` and any `error` message. Use `skipReceipt=true` for lower latency when you can track the transaction status yourself. Calldata and requireSuccess The calldata endpoints return a **list of calldatas** that execute the intended action. These calldatas should be sent to the `bulk-direct-call` endpoint of the Send Txs Bot. When submitting via `bulk-direct-call`, use the `requireSuccess` parameter to control atomicity: * **`requireSuccess=true` (recommended for most actions)** — All calldatas either succeed together or fail together. Use this for actions like place-order with `autoExitMarket`, where the exit-market and place-order calldatas must both execute or neither should. * **`requireSuccess=false`** — Each calldata is executed independently; some may succeed while others fail. This is useful specifically for `place-orders` when you want to place multiple orders and don't need them to be atomic (e.g., if one order fails due to insufficient margin, the others can still go through). ### 3\. Closing a Position[​](https://docs.pendle.finance/boros-dev/Backend/api#3-closing-a-position "Direct link to 3. Closing a Position") ┌──────────────────────────────────────────────────────────────┐│ 1. POST /accounts/market-acc-infos → current position ││ 2. GET /simulations/close-active-position → preview close ││ 3. POST /calldata/place-orders → counter-order ││ 4. Sign & submit via Send Txs Bot │└──────────────────────────────────────────────────────────────┘ Closing a position internally creates a counter-order (opposite side, same size). The simulation endpoint handles this logic for you. ### 4\. Withdrawing Funds[​](https://docs.pendle.finance/boros-dev/Backend/api#4-withdrawing-funds "Direct link to 4. Withdrawing Funds") Withdrawals follow a **request → cooldown → finalize** pattern: ┌──────────────────────────────────────────────────────────────┐│ 1. GET /calldata/withdraw-request → request calldata ││ 2. Sign & submit withdrawal request (root wallet) ││ 3. Wait for cooldown period ││ 4. Finalize withdrawal on MarketHub contract ││ ││ To cancel: GET /calldata/withdraw-cancel → cancel calldata │└──────────────────────────────────────────────────────────────┘ Withdrawal requests and cancellations are **sensitive** actions signed by the root wallet. ### 5\. Setting Up Stop Orders (TP/SL)[​](https://docs.pendle.finance/boros-dev/Backend/api#5-setting-up-stop-orders-tpsl "Direct link to 5. Setting Up Stop Orders (TP/SL)") Stop orders are conditional orders that execute automatically when the market APR hits your target: ┌──────────────────────────────────────────────────────────────┐│ 1. GET /stop-order/v1/orders/tpsl/prepare → order params ││ 2. POST /stop-order/v2/orders/place → place order ││ ││ To cancel: DELETE /stop-order/v3/orders/cancel │└──────────────────────────────────────────────────────────────┘ The prepare endpoint generates the order parameters (including the calldata that will be executed when triggered). The place endpoint submits the signed conditional order. See [Stop Orders](https://docs.pendle.finance/boros-dev/Backend/stop-orders) for details. * * * Sensitive vs Non-Sensitive Actions[​](https://docs.pendle.finance/boros-dev/Backend/api#sensitive-vs-non-sensitive-actions "Direct link to Sensitive vs Non-Sensitive Actions") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Understanding this distinction is critical for integration: | Type | Signed by | Submitted via | Examples | | --- | --- | --- | --- | | **Sensitive** | Root wallet | Direct to blockchain | Deposit, withdraw, approve/revoke agent | | **Non-sensitive** | Agent key | Send Txs Bot | Place orders, cancel orders, cash transfer, enter/exit markets | Sensitive actions require the root wallet's private key and are submitted as regular Ethereum transactions. Non-sensitive actions are signed by the agent and submitted through the Send Txs Bot service, which handles gas and on-chain submission. * * * Endpoint Categories[​](https://docs.pendle.finance/boros-dev/Backend/api#endpoint-categories "Direct link to Endpoint Categories") ----------------------------------------------------------------------------------------------------------------------------------- ### Assets[​](https://docs.pendle.finance/boros-dev/Backend/api#assets "Direct link to Assets") Query available collateral tokens with metadata and current prices. | Endpoint | Description | | --- | --- | | `GET /assets/all` | List all supported collateral assets | ### Markets[​](https://docs.pendle.finance/boros-dev/Backend/api#markets "Direct link to Markets") Query market configurations, order books, and trade history. | Endpoint | Description | | --- | --- | | `GET /markets` | List all markets with current state and pricing. Includes `isWhitelisted` field. | | `GET /markets/{marketId}` | Get a single market's details | | `GET /markets/order-books` | Aggregated order book by tick size. _(Deprecated — use v2)_ | | `GET /v2/markets/order-books` | Order book with optional AMM liquidity. Response includes `syncStatus` (`blockNumber` + `timestamp`). | | `GET /markets/market-trades` | Recent executed trades | | `GET /markets/chart` | OHLCV candlestick data | ### Accounts[​](https://docs.pendle.finance/boros-dev/Backend/api#accounts "Direct link to Accounts") Query and manage user account state. | Endpoint | Description | | --- | --- | | `POST /accounts/market-acc-infos` | Positions, margins, balances for market accounts. See [details below](https://docs.pendle.finance/boros-dev/Backend/api#market-acc-infos)
. | | `GET /accounts/entered-markets` | Markets entered by a cross-margin account | | `GET /accounts/active-positions` | All active positions for a user. See [details below](https://docs.pendle.finance/boros-dev/Backend/api#active-positions)
. | | `GET /accounts/latest-settlements` | Latest settlement per market position. See [details below](https://docs.pendle.finance/boros-dev/Backend/api#latest-settlements)
. | | `GET /accounts/limit-orders` | Active/inactive limit orders. _(Deprecated — use v2)_ | | `GET /accounts/transactions` | Trade history. _(Deprecated — use v2)_ | | `GET /accounts/settlements` | Funding rate settlement history | | `GET /accounts/transfer-logs` | Deposit/withdrawal transfer logs. _(Deprecated — use v2)_ | | `GET /accounts/gas-balance` | Current gas balance | | `GET /accounts/gas-consumption-history` | Gas usage history. _(Deprecated — use v2)_ | | `GET /accounts/settings` | User account settings | | `POST /accounts/settings` | Update settings (agent-signed) | #### Market Acc Infos[​](https://docs.pendle.finance/boros-dev/Backend/api#market-acc-infos "Direct link to Market Acc Infos") `POST /accounts/market-acc-infos` — Returns detailed account information for one or more market accounts. Accepts an array of up to **100** `marketAccs` in the request body. **Response fields (per market account):** | Field | Type | Description | | --- | --- | --- | | `totalCash` | string | Total cash balance (bigint string in settlement token) | | `netBalance` | string | Equity = totalCash + sum of all position values | | `positions` | array | List of active positions (size, rate, entry block, etc.) | | `initialMargin` | string | Raw initial margin without leverage | | `initialMarginWithLeverage` | string | Initial margin with leverage applied | | `availableInitialMargin` | string | Remaining margin available for new positions | | `availableMaintMargin` | string | Remaining margin before liquidation (health ratio = 1.0 when zero) | Response includes `syncStatus` (`blockNumber` + `timestamp`). #### Active Positions[​](https://docs.pendle.finance/boros-dev/Backend/api#active-positions "Direct link to Active Positions") `GET /accounts/active-positions` — Returns all active (non-zero size) positions for a user's account. Query params: `userAddress`, `accountId`. **Response fields (per position):** | Field | Type | Description | | --- | --- | --- | | `marketId` | number | Market identifier | | `marketAcc` | MarketAcc | Packed account position identifier | | `isCross` | boolean | Whether the position uses cross-margin mode | | `fixedApr` | number | The fixed APR of the position (e.g. `0.05` = 5%) | | `signedSize` | string | Bigint string of signed position size (negative = short) | | `side` | Side | `0` = Long, `1` = Short | | `cumulativePnl` | string | Bigint string of all-time cumulative trade PnL | | `isMatured` | boolean | Whether the market has reached its maturity date | Response includes `syncStatus` (`blockNumber` + `timestamp`). #### Latest Settlements[​](https://docs.pendle.finance/boros-dev/Backend/api#latest-settlements "Direct link to Latest Settlements") `GET /accounts/latest-settlements` — Returns the most recent settlement for each market that a user's account has participated in. Query params: `userAddress`, `accountId`. **Response fields (per settlement):** | Field | Type | Description | | --- | --- | --- | | `marketId` | number | Market identifier | | `marketAcc` | MarketAcc | Packed account position identifier | | `isCross` | boolean | Whether the position uses cross-margin mode | | `isMatured` | boolean | Whether the market has reached maturity | | `timestamp` | number | Timestamp of the latest settlement | | `side` | Side | Position side at time of settlement (`0` = Long, `1` = Short) | | `positionSize` | string | Bigint string of position size at settlement | | `yieldPaid` | string | Bigint string of yield paid in the latest settlement period | | `yieldReceived` | string | Bigint string of yield received in the latest settlement period | | `settlement` | string | Net settlement = yieldReceived − yieldPaid | | `settlementRate` | number | Annualized settlement rate of the latest period (e.g. `0.05` = 5%) | | `cumulativeSettlementPnl` | string | All-time cumulative settlement PnL | | `sinceOpenSettlementPnl` | string | Cumulative settlement PnL since position was opened | Response includes `syncStatus` (`blockNumber` + `timestamp`). #### V2 Accounts (Cursor-Based Pagination)[​](https://docs.pendle.finance/boros-dev/Backend/api#v2-accounts-cursor-based-pagination "Direct link to V2 Accounts (Cursor-Based Pagination)") The v2 endpoints replace the v1 offset-based pagination (`skip`/`limit`/`total`) with **cursor-based pagination** using a `resumeToken`. This is significantly more efficient for large datasets. **How it works:** 1. Make the initial request with `limit` (no `resumeToken`) 2. The response includes a `resumeToken` string — pass it as a query parameter on the next request to get the next page 3. When `resumeToken` is `null`, there are no more pages All v2 responses also include a `syncStatus` field (`blockNumber` + `timestamp`) indicating how up-to-date the backend data is. | Endpoint | Description | | --- | --- | | `GET /v2/accounts/limit-orders` | Limit orders sorted by last updated. Supports `marketId`, `isActive`, `orderType` filters. Max `limit`: 2000. | | `GET /v2/accounts/all-limit-orders` | All limit orders sorted by placed order. **Guarantees no missed orders** during pagination — use this for syncing/indexing. | | `GET /v2/accounts/transactions` | Trade history with cursor pagination. Supports `fromBlockNumber`, `toBlockNumber`, `isLimitOrderTrade` filters. Max `limit`: 2000. | | `GET /v2/accounts/transfer-logs` | Deposit/withdrawal logs with cursor pagination. Max `limit`: 100. | | `GET /v2/accounts/gas-consumption-history` | Gas usage history with cursor pagination. Max `limit`: 100. | Which limit-orders endpoint to use? * **`/v2/accounts/limit-orders`** — sorted by last updated (`eventIndex`). Best for showing recent activity in a UI. Note: orders updated during pagination may shift position, so you might miss or duplicate some entries. * **`/v2/accounts/all-limit-orders`** — sorted by immutable placed timestamp (`placedEventIndex`). Guarantees stable pagination — **use this for syncing all orders**. **New response fields on limit orders:** * `placedTxHash` — the transaction hash where the order was originally placed ### Calldata Generation[​](https://docs.pendle.finance/boros-dev/Backend/api#calldata-generation "Direct link to Calldata Generation") Generate transaction calldata for on-chain operations. **Sensitive (root-signed, direct to chain):** | Endpoint | Description | | --- | --- | | `GET /calldata/deposit` | Deposit collateral to margin account | | `GET /calldata/withdraw-request` | Request withdrawal | | `GET /calldata/withdraw-cancel` | Cancel pending withdrawal | | `GET /calldata/approve-agent` | Approve an agent | | `GET /calldata/revoke-agent` | Revoke an agent | | `GET /calldata/vault-pay-treasury` | Pay treasury from vault | **Non-sensitive (agent-signed, via Send Txs Bot):** | Endpoint | Description | | --- | --- | | `POST /calldata/place-orders` | Place one or more limit orders | | `POST /calldata/place-orders-with-rate` | Place orders with an explicit desired rate (instead of slippage) | | `GET /calldata/cancel-order` | Cancel orders | | `GET /calldata/cash-transfer` | Transfer between cross and isolated accounts | | `GET /calldata/enter-exit-markets` | Enter or exit markets | | `GET /calldata/pay-treasury` | Pay accrued treasury fees | | `GET /calldata/add-liquidity-single-cash-to-amm` | Add AMM liquidity | | `GET /calldata/remove-liquidity-single-cash-from-amm` | Remove AMM liquidity | ### Simulations[​](https://docs.pendle.finance/boros-dev/Backend/api#simulations "Direct link to Simulations") Preview operations before executing them. All simulation endpoints return the projected account state after the operation. | Endpoint | Description | | --- | --- | | `GET /simulations/deposit` | Preview deposit effect on account | | `GET /simulations/withdraw` | Preview withdrawal effect on account | | `GET /simulations/cash-transfer` | Preview cross ↔ isolated transfer | | `GET /simulations/place-order` | Preview order placement with fees | | `GET /simulations/close-active-position` | Preview closing a position | | `GET /simulations/add-liquidity-single-cash` | Preview adding AMM liquidity | | `GET /simulations/remove-liquidity-single-cash` | Preview removing AMM liquidity | ### Funding Rate[​](https://docs.pendle.finance/boros-dev/Backend/api#funding-rate "Direct link to Funding Rate") Access funding rate data and settlement history. | Endpoint | Description | | --- | --- | | `GET /funding-rate/all-funding-rate-symbols` | Available funding rate symbols | | `POST /funding-rate/settlement-summary` | Historical settlement summaries | ### Agents[​](https://docs.pendle.finance/boros-dev/Backend/api#agents "Direct link to Agents") Manage agent authorization. | Endpoint | Description | | --- | --- | | `GET /agents/expiry-time` | Check agent expiry time | ### Events[​](https://docs.pendle.finance/boros-dev/Backend/api#events "Direct link to Events") Query protocol events. | Endpoint | Description | | --- | --- | | `GET /events/liquidation-events` | Liquidation event history | ### Charts[​](https://docs.pendle.finance/boros-dev/Backend/api#charts "Direct link to Charts") Charting data for trading UIs. | Endpoint | Description | | --- | --- | | `GET /charts/ohlcv` | OHLCV candlestick data | ### Leaderboard[​](https://docs.pendle.finance/boros-dev/Backend/api#leaderboard "Direct link to Leaderboard") Query trading leaderboard data. | Endpoint | Description | | --- | --- | | `GET /leaderboard` | Trading leaderboard with rankings | | `GET /leaderboard/search` | Search for a specific user on the leaderboard | ### Transaction Status (Send Txs Bot)[​](https://docs.pendle.finance/boros-dev/Backend/api#transaction-status-send-txs-bot "Direct link to Transaction Status (Send Txs Bot)") Query transaction status with detailed on-chain event data. | Endpoint | Description | | --- | --- | | `POST /send-txs-bot/v2/agent/dedicated/tx-status` | Transaction status with block info | | `POST /send-txs-bot/v2/agent/dedicated/tx-status-with-events` | Transaction status with parsed limit order events (placed, cancelled, market order executed). Each status item includes `limitOrdersPlaced` (orderIds + sizes), `limitOrdersCancelled` (orderIds), and `marketOrdersExecuted` (orderId, side, size). | * * * Error Handling[​](https://docs.pendle.finance/boros-dev/Backend/api#error-handling "Direct link to Error Handling") -------------------------------------------------------------------------------------------------------------------- The Open API returns errors in a structured format: { "errorCode": "INVALID_MARKET_ID", "message": "Market with ID 999 not found", "data": {}} The `errorCode` field is a machine-readable string you can use for programmatic error handling. Common error codes include validation errors (invalid parameters), state errors (insufficient margin), and not-found errors. The Send Txs Bot and Stop Order services use the legacy format: { "statusCode": 400, "message": "Invalid signature"} See [Best Practices](https://docs.pendle.finance/boros-dev/Backend/best-practices) for error handling recommendations. * * * Rate Limiting[​](https://docs.pendle.finance/boros-dev/Backend/api#rate-limiting "Direct link to Rate Limiting") ----------------------------------------------------------------------------------------------------------------- The API does not currently enforce strict rate limits, but excessive request rates may be throttled. Recommendations: * Use [WebSocket](https://docs.pendle.finance/boros-dev/Backend/websocket) for real-time data instead of polling * Use bulk order endpoints instead of multiple single-order calls * Cache market and asset data that doesn't change frequently * * * Code Examples[​](https://docs.pendle.finance/boros-dev/Backend/api#code-examples "Direct link to Code Examples") ----------------------------------------------------------------------------------------------------------------- For complete working examples covering the full integration lifecycle, see: **[https://github.com/pendle-finance/boros-api-examples](https://github.com/pendle-finance/boros-api-examples) ** Key examples: * `01-agent.ts` — Agent setup and approval * `02-deposit.ts` to `04-withdraw.ts` — Fund management * `05-place-order.ts` to `08-cancel-order.ts` — Order lifecycle * `11-bulk-place-orders.ts` — Bulk order placement * `12-top-up-gas-account.ts` — Gas management * `13-top-up-isolated-account.ts` — Isolated margin funding * [Base URLs](https://docs.pendle.finance/boros-dev/Backend/api#base-urls) * [API Services](https://docs.pendle.finance/boros-dev/Backend/api#api-services) * [Open API (Primary)](https://docs.pendle.finance/boros-dev/Backend/api#open-api-primary) * [Send Txs Bot (Transaction Submission)](https://docs.pendle.finance/boros-dev/Backend/api#send-txs-bot-transaction-submission) * [Stop Order Service](https://docs.pendle.finance/boros-dev/Backend/api#stop-order-service) * [Integration Workflows](https://docs.pendle.finance/boros-dev/Backend/api#integration-workflows) * [1\. First-Time Setup](https://docs.pendle.finance/boros-dev/Backend/api#1-first-time-setup) * [2\. Placing a Trade (Agent Flow)](https://docs.pendle.finance/boros-dev/Backend/api#2-placing-a-trade-agent-flow) * [3\. Closing a Position](https://docs.pendle.finance/boros-dev/Backend/api#3-closing-a-position) * [4\. Withdrawing Funds](https://docs.pendle.finance/boros-dev/Backend/api#4-withdrawing-funds) * [5\. Setting Up Stop Orders (TP/SL)](https://docs.pendle.finance/boros-dev/Backend/api#5-setting-up-stop-orders-tpsl) * [Sensitive vs Non-Sensitive Actions](https://docs.pendle.finance/boros-dev/Backend/api#sensitive-vs-non-sensitive-actions) * [Endpoint Categories](https://docs.pendle.finance/boros-dev/Backend/api#endpoint-categories) * [Assets](https://docs.pendle.finance/boros-dev/Backend/api#assets) * [Markets](https://docs.pendle.finance/boros-dev/Backend/api#markets) * [Accounts](https://docs.pendle.finance/boros-dev/Backend/api#accounts) * [Calldata Generation](https://docs.pendle.finance/boros-dev/Backend/api#calldata-generation) * [Simulations](https://docs.pendle.finance/boros-dev/Backend/api#simulations) * [Funding Rate](https://docs.pendle.finance/boros-dev/Backend/api#funding-rate) * [Agents](https://docs.pendle.finance/boros-dev/Backend/api#agents) * [Events](https://docs.pendle.finance/boros-dev/Backend/api#events) * [Charts](https://docs.pendle.finance/boros-dev/Backend/api#charts) * [Leaderboard](https://docs.pendle.finance/boros-dev/Backend/api#leaderboard) * [Transaction Status (Send Txs Bot)](https://docs.pendle.finance/boros-dev/Backend/api#transaction-status-send-txs-bot) * [Error Handling](https://docs.pendle.finance/boros-dev/Backend/api#error-handling) * [Rate Limiting](https://docs.pendle.finance/boros-dev/Backend/api#rate-limiting) * [Code Examples](https://docs.pendle.finance/boros-dev/Backend/api#code-examples) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Historical Data | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/historical-data#__docusaurus_skipToContent_fallback) On this page Historical market data exports for [Pendle Boros](https://boros.pendle.finance/) on Arbitrum. All data is stored as **NDJSON** (newline-delimited JSON) compressed with **ZIP**. Each file covers one calendar month per market. **Browse data:** [https://historical-data.boros.finance](https://historical-data.boros.finance/) Directory Structure[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#directory-structure "Direct link to Directory Structure") ----------------------------------------------------------------------------------------------------------------------------------------------- market-data/{market}/ Hourly market snapshotssettlement/{market}/ On-chain settlement rate updatesunderlying-apr/ Historical underlying funding ratesmarket-trades/{market}/ Individual tradesohlcv/{timeframe}/{market}/ OHLCV candles (5m, 1h, 1d)order-book/{market}/raw/ Raw order book snapshotsorder-book/{market}/combined_{tickSize}/ Order book aggregated by tick size **Market naming:** `{ID}-{EXCHANGE}-{PAIR}-{EXPIRY}` (e.g. `2-BINANCE-BTCUSDT-26SEP2025`) **File naming:** `YYYY-MM.ndjson.zip` (e.g. `2025-08.ndjson.zip`) How to Decompress[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#how-to-decompress "Direct link to How to Decompress") ----------------------------------------------------------------------------------------------------------------------------------------- Files are compressed with ZIP. Decompress with any standard unzip tool: # Decompress a single fileunzip 2025-08.ndjson.zip# Decompress all files in placefind . -name '*.ndjson.zip' -exec sh -c 'unzip -o -q "$1" -d "$(dirname "$1")"' _ {} \; How to Read the Data[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#how-to-read-the-data "Direct link to How to Read the Data") -------------------------------------------------------------------------------------------------------------------------------------------------- Each `.ndjson` file contains one JSON object per line. You can parse it with standard tools: # Preview first 3 lines (pretty-printed)unzip -p 2025-08.ndjson.zip | head -3 | jq .# Count recordsunzip -p 2025-08.ndjson.zip | wc -l# Filter by timestamp rangeunzip -p 2025-08.ndjson.zip | jq -c 'select(.timestamp >= 1754006400 and .timestamp < 1754092800)' ### Python[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#python "Direct link to Python") import jsonimport zipfile# Read compressed file directlywith zipfile.ZipFile('2025-08.ndjson.zip') as zf: with zf.open(zf.namelist()[0]) as f: records = [json.loads(line) for line in f] ### JavaScript / TypeScript[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#javascript--typescript "Direct link to JavaScript / TypeScript") import { execSync } from 'child_process';const output = execSync('unzip -p 2025-08.ndjson.zip', { encoding: 'utf-8' });const records = output.trim().split('\n').map(line => JSON.parse(line)); Data Schemas[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#data-schemas "Direct link to Data Schemas") -------------------------------------------------------------------------------------------------------------------------- ### Market Data (`market-data/`)[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#market-data-market-data "Direct link to market-data-market-data") Hourly snapshots of market state. | Field | Type | Description | | --- | --- | --- | | `timestamp` | number | Unix timestamp | | `datetime` | string | ISO 8601 datetime | | `blockNumber` | number | Arbitrum block number | | `midApr` | number | Mid APR (average of best bid and best ask) | | `bestBid` | number \| null | Best bid rate (highest long order) | | `bestAsk` | number \| null | Best ask rate (lowest short order) | | `ammImpliedApr` | number \| null | AMM implied APR | | `markApr` | number | Mark APR (on-chain mark rate) | | `notionalOI` | number \| null | Notional open interest | | `lastTradedApr` | number \| null | Rate of the most recent trade | | `latestSettlementApr` | number \| null | Latest on-chain settlement APR (0 from market creation until first settlement) | {"timestamp":1754006400,"datetime":"2025-08-01T00:00:00.000Z","blockNumber":363657956,"midApr":0.07625,"bestBid":0.07605,"bestAsk":0.07637,"ammImpliedApr":0.07625,"markApr":0.07615,"notionalOI":51,"lastTradedApr":0.07615,"latestSettlementApr":0.07} ### Settlement Data (`settlement/`)[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#settlement-data-settlement "Direct link to settlement-data-settlement") On-chain settlement rate updates (FIndexUpdated events). Settlement APR is 0% from market creation until the first settlement event. | Field | Type | Description | | --- | --- | --- | | `timestamp` | number | Unix timestamp of the block | | `datetime` | string | ISO 8601 datetime | | `blockNumber` | number | Arbitrum block number | | `settlementApr` | number | Annualized settlement rate (0 until first settlement) | | `txHash` | string | Transaction hash | {"timestamp":1767211230,"datetime":"2025-12-31T20:00:30.000Z","blockNumber":416536437,"settlementApr":0.0990756,"txHash":"0x193c...2370"} ### Underlying Funding Rate (`underlying-apr/`)[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#underlying-funding-rate-underlying-apr "Direct link to underlying-funding-rate-underlying-apr") Historical underlying funding rates sourced from exchanges. One file per exchange-asset pair (e.g. `Binance-BTC.ndjson.zip`). | Field | Type | Description | | --- | --- | --- | | `timestamp` | number | Unix timestamp (funding rate start time) | | `datetime` | string | ISO 8601 datetime | | `annualizedFundingRate` | number | Annualized funding rate | {"timestamp":1754006400,"datetime":"2025-08-01T00:00:00.000Z","annualizedFundingRate":0.05234} note This data is carefully monitored to match the funding rates reported by each exchange. In rare cases, exchange API instability may cause minor discrepancies. ### Trades (`market-trades/`)[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#trades-market-trades "Direct link to trades-market-trades") Individual trade events. | Field | Type | Description | | --- | --- | --- | | `eventIndex` | number | On-chain event index | | `blockTimestamp` | number | Unix timestamp of the block | | `datetime` | string | ISO 8601 datetime | | `rate` | number | Trade rate (implied APR) | | `side` | string | Taker side: `"long"` or `"short"` | | `size` | number | Absolute trade size | | `txHash` | string | Transaction hash | {"eventIndex":363716829000015,"blockTimestamp":1754021093,"datetime":"2025-08-01T04:04:53.000Z","rate":0.07332,"side":"short","size":0.005,"txHash":"0x2578..."} ### OHLCV Candles (`ohlcv/`)[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#ohlcv-candles-ohlcv "Direct link to ohlcv-candles-ohlcv") Available in three timeframes: `5m`, `1h`, `1d`. | Field | Type | Description | | --- | --- | --- | | `periodStartTimestamp` | number | Unix timestamp of candle start | | `datetime` | string | ISO 8601 datetime | | `open` | number | Opening rate (implied APR) | | `high` | number | Highest rate in the period | | `low` | number | Lowest rate in the period | | `close` | number | Closing rate | | `volume` | number | Total absolute trade size | {"periodStartTimestamp":1754020800,"datetime":"2025-08-01T04:00:00.000Z","open":0.07332,"high":0.07332,"low":0.07332,"close":0.07332,"volume":0.005} ### Order Book — Raw (`order-book/{market}/raw/`)[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#order-book--raw-order-bookmarketraw "Direct link to order-book--raw-order-bookmarketraw") Full order book snapshots with individual tick entries. | Field | Type | Description | | --- | --- | --- | | `blockNumber` | number | Arbitrum block number | | `blockTimestamp` | number | Unix timestamp | | `datetime` | string | ISO 8601 datetime | | `long` | object\[\] | Bid side entries (sorted by rate descending) | | `short` | object\[\] | Ask side entries (sorted by rate ascending) | Each entry in `long` / `short`: | Field | Type | Description | | --- | --- | --- | | `rate` | number | Implied APR at this tick | | `tick` | number | On-chain tick index | | `size` | number | Notional size at this tick | ### Order Book — Combined (`order-book/{market}/combined_{tickSize}/`)[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#order-book--combined-order-bookmarketcombined_ticksize "Direct link to order-book--combined-order-bookmarketcombined_ticksize") Order book merged with AMM liquidity, aggregated by tick size. Available tick sizes: `0.00001`, `0.0001`, `0.001`, `0.01`, `0.1`. | Field | Type | Description | | --- | --- | --- | | `timestamp` | number | Unix timestamp | | `datetime` | string | ISO 8601 datetime | | `blockNumber` | number | Arbitrum block number | | `long` | object\[\] | Bid side entries, grouped by tick size | | `short` | object\[\] | Ask side entries, grouped by tick size | Each entry in `long` / `short`: | Field | Type | Description | | --- | --- | --- | | `rate` | number | Implied APR (tick index x tick size) | | `size` | number | Aggregated notional size at this level | Notes[​](https://docs.pendle.finance/boros-dev/Backend/historical-data#notes "Direct link to Notes") ----------------------------------------------------------------------------------------------------- * All rates are expressed as **implied APR** (annualized percentage rate as a decimal, e.g. `0.07` = 7%) * All timestamps are **Unix seconds** (UTC) * Data is exported monthly and only includes **fully completed periods** (e.g. an incomplete 1h candle at the time of export is excluded) * Data is updated every 2–3 days * [Directory Structure](https://docs.pendle.finance/boros-dev/Backend/historical-data#directory-structure) * [How to Decompress](https://docs.pendle.finance/boros-dev/Backend/historical-data#how-to-decompress) * [How to Read the Data](https://docs.pendle.finance/boros-dev/Backend/historical-data#how-to-read-the-data) * [Python](https://docs.pendle.finance/boros-dev/Backend/historical-data#python) * [JavaScript / TypeScript](https://docs.pendle.finance/boros-dev/Backend/historical-data#javascript--typescript) * [Data Schemas](https://docs.pendle.finance/boros-dev/Backend/historical-data#data-schemas) * [Market Data (`market-data/`)](https://docs.pendle.finance/boros-dev/Backend/historical-data#market-data-market-data) * [Settlement Data (`settlement/`)](https://docs.pendle.finance/boros-dev/Backend/historical-data#settlement-data-settlement) * [Underlying Funding Rate (`underlying-apr/`)](https://docs.pendle.finance/boros-dev/Backend/historical-data#underlying-funding-rate-underlying-apr) * [Trades (`market-trades/`)](https://docs.pendle.finance/boros-dev/Backend/historical-data#trades-market-trades) * [OHLCV Candles (`ohlcv/`)](https://docs.pendle.finance/boros-dev/Backend/historical-data#ohlcv-candles-ohlcv) * [Order Book — Raw (`order-book/{market}/raw/`)](https://docs.pendle.finance/boros-dev/Backend/historical-data#order-book--raw-order-bookmarketraw) * [Order Book — Combined (`order-book/{market}/combined_{tickSize}/`)](https://docs.pendle.finance/boros-dev/Backend/historical-data#order-book--combined-order-bookmarketcombined_ticksize) * [Notes](https://docs.pendle.finance/boros-dev/Backend/historical-data#notes) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Custom Types | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#__docusaurus_skipToContent_fallback) On this page Boros heavily uses Solidity user-defined value types for gas optimization and type safety. These types use bit-packing to minimize storage costs and provide efficient operations on the EVM. Core Trading Types[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#core-trading-types "Direct link to Core Trading Types") ------------------------------------------------------------------------------------------------------------------------------------------ ### Trade[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#trade "Direct link to Trade") **Definition**: `type Trade is uint256` **Bit Packing**: `signedSize(128) | signedCost(128)` // Creating tradesTrade memory trade = TradeLib.from(signedSize, signedCost);Side side = trade.side();int128 size = trade.signedSize();int128 cost = trade.signedCost(); Account Types[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#account-types "Direct link to Account Types") --------------------------------------------------------------------------------------------------------------------------- ### Account[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#account "Direct link to Account") **Definition**: `type Account is bytes21` **Bit Packing**: `address(160) | accountId(8)` // Creating accountsAccount mainAcc = AccountLib.from(userAddress, 0); // Main accountAccount subAcc = AccountLib.from(userAddress, 1); // Sub-account 1Account ammAcc = userAddress.toAMM(); // AMM account 255// Parsing accountsaddress root = account.root(); // Extract root addressuint8 accountId = account.accountId(); // Extract account ID// Special account typesbool isMain = account.isMain(); // accountId == 0bool isAMM = account.isAMM(); // accountId == 255 ### MarketAcc[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketacc "Direct link to MarketAcc") **Definition**: `type MarketAcc is bytes26` **Bit Packing**: `address(160) | accountId(8) | tokenId(16) | marketId(24)` // Creating market accountsMarketAcc crossAcc = account.toCross(tokenId); // Cross-marginMarketAcc isolatedAcc = account.toIsolated(tokenId, marketId); // Isolated// Parsing market accountsaddress root = crossAcc.root();Account account = crossAcc.account();TokenId tokenId = crossAcc.tokenId();MarketId marketId = crossAcc.marketId();// Cross vs isolated marginbool isCross = isolatedAcc.isCross();MarketAcc crossAcc = isolatedAcc.toCross(); Order Book Types[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#order-book-types "Direct link to Order Book Types") ------------------------------------------------------------------------------------------------------------------------------------ ### OrderId[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderid "Direct link to OrderId") **Definition**: `type OrderId is uint64` **Bit Packing**: `initialized(1) | reserved(6) | side(1) | encodedTick(16) | orderIndex(40)` // Creating order IDs (done internally by order book)OrderId orderId = OrderIdLib.from(Side.LONG, tickIndex, orderIndex);// Parsing order IDsSide side = orderId.side();int16 tick = orderId.tickIndex();uint40 index = orderId.orderIndex();// Priority comparison (lower unwrapped value = higher priority)bool higherPriority = orderId1 < orderId2; ### Side[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#side "Direct link to Side") **Definition**: `enum Side { LONG, SHORT }` Side opposite = side.opposite(); // LONG ↔ SHORTbool topDown = side.sweepTickTopDown(); // LONG: true, SHORT: falseint16 endTick = side.endTick(); // Boundary tick values ### TimeInForce[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#timeinforce "Direct link to TimeInForce") **Definition**: `enum TimeInForce { GTC, IOC, FOK, ALO, SOFT_ALO }` * **GTC (Good Till Cancel)**: Standard limit order that remains on the order book until fully filled or manually canceled. With `placeSingleOrder`, a GTC order can match against existing order book and AMM liquidity; any unfilled remainder stays on the book as a maker order. With `bulkOrders`, GTC orders are placed directly on the book without AMM matching. * **IOC (Immediate or Cancel)**: Executes against available liquidity (order book + AMM) immediately, cancels any unfilled portion. **Best for taker orders** — guarantees no residual maker orders remain on the book. * **FOK (Fill or Kill)**: Must fill entire order size immediately (from order book + AMM) or the transaction reverts. Use when partial fills are unacceptable. * **ALO (Add Liquidity Only)**: Also known as **Post-Only**. Ensures the order is placed as a maker order only — the transaction reverts if it would immediately match against existing orders or the AMM. Ideal for market makers who want to guarantee maker status. * **SOFT\_ALO**: Similar to ALO (Post-Only), but instead of reverting, it silently skips any portion that would match and places the rest on the book. Useful for market makers who prefer no-revert behavior. ### OrderStatus[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderstatus "Direct link to OrderStatus") **Definition**: `enum OrderStatus { NOT_EXIST, OPEN, PENDING_SETTLE, PURGED }` * **NOT\_EXIST**: Order has never been placed or has been cancelled * **OPEN**: Active order in the order book, available for matching against incoming orders * **PENDING\_SETTLE**: Order has been filled * **PURGED**: Order was purged because rate is [out of bound](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#restrictions) Market Types[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#market-types "Direct link to Market Types") ------------------------------------------------------------------------------------------------------------------------ ### MarketStatus[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketstatus "Direct link to MarketStatus") **Definition**: `enum MarketStatus { PAUSED, CLO, GOOD }` * **PAUSED (0)**: Market is fully paused — no trading, no order placement, no cancellation * **CLO (1)**: Close-Only mode — only orders that reduce existing position size are allowed. New position opening is prohibited. Activated when open interest approaches risk limits * **GOOD (2)**: Normal operating mode — all trading operations are available Markets transition between states based on risk conditions (e.g., open interest approaching caps). Query the current status via [`getMarketConfig()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarketconfig) . ### LiqSettings[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#liqsettings "Direct link to LiqSettings") **Definition**: `struct LiqSettings { uint64 base, uint64 slope, uint64 feeRate }` Parameters governing [liquidation incentives](https://docs.pendle.finance/boros-dev/Mechanics/Margin#liquidation-process) : * **base**: Base incentive factor for liquidators * **slope**: Scaling factor that increases incentive as health ratio decreases * **feeRate**: Fee rate charged on liquidated positions (goes to protocol treasury) See [Margin — Liquidation Process](https://docs.pendle.finance/boros-dev/Mechanics/Margin#liquidation-process) for the incentive formula. ### TokenId[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#tokenid "Direct link to TokenId") **Definition**: `type TokenId is uint16` Unique identifier for collateral tokens supported by the protocol. ### MarketId[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketid "Direct link to MarketId") **Definition**: `type MarketId is uint24` **Special Value**: The value `type(uint24).max` (16,777,215) is reserved as `MarketIdLib.CROSS` to indicate cross-margin mode, where collateral is shared across all markets within the same collateral zone. // Cross-margin constantMarketId crossMargin = MarketIdLib.CROSS; // type(uint24).max// Regular market IDs for isolated marginMarketId market1 = MarketId.wrap(1); // Isolated margin for market 1MarketId market2 = MarketId.wrap(2); // Isolated margin for market 2// Checking margin modebool isCross = marketId.isCross(); // true if marketId == CROSS ### AMMId[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#ammid "Direct link to AMMId") **Definition**: `type AMMId is uint24` Advanced Types[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#advanced-types "Direct link to Advanced Types") ------------------------------------------------------------------------------------------------------------------------------ ### FIndex[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#findex "Direct link to FIndex") **Definition**: `type FIndex is bytes26` **Bit Packing**: `fTime(32) | floatingIndex(112) | feeIndex(64)` FIndex fIndex = FIndexLib.from(fTime, floatingIndex, feeIndex);// Parsing componentsuint32 fTime = fIndex.fTime(); // Funding timeint112 floatingIndex = fIndex.floatingIndex(); // Floating rate indexuint64 feeIndex = fIndex.feeIndex(); // Fee accumulator// Comparison and checksbool isZero = fIndex.isZero();bool same = fIndex1 == fIndex2; ### PayFee[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#payfee "Direct link to PayFee") **Definition**: `type PayFee is uint256` **Bit Packing**: `payment(128) | fees(128)` Compact representation of a cash payment paired with its associated fees. Used throughout the settlement and liquidation system to bundle payment amounts with their fee components. PayFee result = PayFeeLib.from(payment, fees);(int128 payment, uint128 fees) = result.unpack();int256 netAmount = result.total(); // payment - fees ### VMResult[​](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#vmresult "Direct link to VMResult") **Definition**: `type VMResult is uint256` **Bit Packing**: `value(128) | margin(128)` Compact representation of a position's value paired with its margin requirement. Used by `settleAllAndGet()` to return position valuation and margin data in a single value. VMResult result = VMResultLib.from(positionValue, marginRequired);(int128 value, uint128 margin) = result.unpack(); * [Core Trading Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#core-trading-types) * [Trade](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#trade) * [Account Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#account-types) * [Account](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#account) * [MarketAcc](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketacc) * [Order Book Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#order-book-types) * [OrderId](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderid) * [Side](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#side) * [TimeInForce](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#timeinforce) * [OrderStatus](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderstatus) * [Market Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#market-types) * [MarketStatus](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketstatus) * [LiqSettings](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#liqsettings) * [TokenId](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#tokenid) * [MarketId](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketid) * [AMMId](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#ammid) * [Advanced Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#advanced-types) * [FIndex](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#findex) * [PayFee](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#payfee) * [VMResult](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#vmresult) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Boros Lite Paper | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/LitePaper#__docusaurus_skipToContent_fallback) On this page This document outlines how Boros works in a more high level and user-centric manner. Exact formal definitions and formulas can be found in the [whitepaper](https://github.com/pendle-finance/boros-core-public/blob/main/whitepapers/AMM.pdf) . How does Boros work from a user perspective?[​](https://docs.pendle.finance/boros-dev/LitePaper#how-does-boros-work-from-a-user-perspective "Direct link to How does Boros work from a user perspective?") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Interest rate swap mechanics[​](https://docs.pendle.finance/boros-dev/LitePaper#interest-rate-swap-mechanics "Direct link to Interest rate swap mechanics") * Users can open **interest rate swap positions** to speculate on **interest rates** of a certain asset. * An **interest rate swap position** = user has to pay an **interest stream** and receive another **interest stream** until a **maturity**. There are only two possible scenarios: * Receive the **floating interest**, and pay a **fixed interest** * Receive a **fixed interest**, and pay the **floating interest** * **floating interest** = the current interest (underlying APY in V2), **always in APR**, being determined by **an external oracle** * What is the **fixed interest** that the user has to pay? * It's specific to each user's position and it's basically based on demand and supply in Boros **when the user opens the position**. * Example: * Today, the fixed interest level (or Implied APR) being traded in Boros is 5% for ETHUSDT funding rate market. * Alice gets an interest swap position (pay fixed, get floating) at the current 5% fixed rate ⇒ Alice can hold this position all the way to the maturity and pay 5% APR all the way, while getting the floating interest along the way. * The next day, the fixed interest level (implied interest) being traded in Boros is 6%. However, Alice is still paying 5% in her interest rate swap position. Alice's position is already locked in at 5% fixed rate. * However, Alice can "sell the current swap position" by essentially creating another opposite position of (pay floating, get fixed) of the same magnitude to **close** the current position. Depending on the difference between the fixed rate of the user's position and the current fixed rate being traded, the sale of the user's position can be deemed a net loss or profit. ### Interest rate swap markets[​](https://docs.pendle.finance/boros-dev/LitePaper#interest-rate-swap-markets "Direct link to Interest rate swap markets") * For users to start holding and trading interest rate swaps, there has to be a market created for it. * Each interest rate swap market has a few main attributes: * The external oracle for floating interest rate. This defines which interest the users will be trading. For example: Binance ETHUSDT Perp Funding Rate * The base asset (like ETH for trading Binance ETHUSDT Perp), which is used for accounting profit/loss and denominating the position sizes. * The maturity for the interest rate swap positions * Parameters to control the risks for the market * Each market will have a "Mark Rate", which is the market Implied APR that will be used to value user positions' unrealized profits and loss. This Mark Rate will be a TWAP-like oracle taking from historical trades. ### Interest rate swap trading zone[​](https://docs.pendle.finance/boros-dev/LitePaper#interest-rate-swap-trading-zone "Direct link to Interest rate swap trading zone") * Users must deposit **collateral** in terms of base asset into a "trading zone", to open interest rate swaps. * Each trading zone comprises of multiple interest rate swap markets of the same base asset. * For example: an "ETH trading zone" could have the following markets: * Binance ETHUSDT Funding Rate, 27 Dec 2024 Maturity * Binance ETHUSDT Funding Rate, 28 March 2025 Maturity * Deribit ETHUSDT Funding Rate, 28 March 2025 Maturity * To open a new interest rate swap, a user must satisfy the **initial margin requirements** for the position they want to open. * Users must maintain enough collateral to cover the **maintenance margin requirements** for their open positions, otherwise they could be liquidated. * User's health and liquidations are trading-zone-specific. ### Orderbook for matching swaps[​](https://docs.pendle.finance/boros-dev/LitePaper#orderbook-for-matching-swaps "Direct link to Orderbook for matching swaps") * Each Boros market has a native orderbook to facilitate opening swaps. * Users can open a new swap in two ways: * Open a limit order on the orderbook and wait for someone to take their order, creating a pair of swaps between the two users. * Do a market order, filling existing limit orders, creating a pair of swaps between the two users. ### Important terms and mechanics, using an example[​](https://docs.pendle.finance/boros-dev/LitePaper#important-terms-and-mechanics-using-an-example "Direct link to Important terms and mechanics, using an example") * Example market: ETHUSDT funding rates on Binance * Maturity: in 6 months (June 2025) * Liquidation Incentive Factor: * Starts at 10%, linearly increases to 50% when marginRatio = 0.5 * Initial Margin Rate: * 50% of Mark Rate, with a minimum of 5% (I\_threshold = 10%) * Maintenance Margin Rate: * 25% of Mark Rate, with a minimum of 2.5% * 6 months before maturity * Alice wants to get a **swap position** with **size = 10 ETH**, **paying fixed and receiving floating (Long Rate)** * Alice deposits 0.4 ETH collateral into the ETH trading zone. * Current Mark Rate is 12% * Alice is good to pay a fixed rate of 12% (and below), so she offers to pay 12% fixed rate on 10 ETH to get the floating interest stream, by placing an order in an on-chain orderbook. * **Initial Margin Rate** is 50% \* 12% = 6% * **Initial margin needed** for this position = 10 \* 0.5 years \* 6% = 0.3 ETH out of Alice's 0.4 ETH collateral. Alice's available initial margin left is 0.1 ETH after placing the limit order. * Bob is another user who wants to pay the **floating rate** in exchange for a **fixed rate**. Bob is good to receive 12% fixed (and above) on 10 ETH, so he does a market order on the orderbook and fills Alice's limit order. * Now, a pair of swaps between Alice and Bob is created and: * Alice has * 0.4 ETH in collateral, minus a debt of 12% \* 10 \* 0.5 = 0.6 ETH that is "realized" immediately * \= -0.2 ETH **collateral** (it's ok to have negative "collateral" because there is still the value of the floating leg) * A **position** of **"10 ETH paying fixed 12% (already paid upfront) & receiving floating until June 2025"** * Note that from the contract perspective, we don't track and don't care about the number 12%, because it's already paid upfront * The **Mark rate** in the ETHUSDT Dec 2024 **interest rate swap market** is currently **12%** (it's a TWAP rate) * Alice's **swap position** has a **"unrealized PnL"** of 12% \* 10ETH \* 0.5 years = **0.6 ETH** because the floating stream is currently valued at 12% * Alice has 0 **realized PnL** because she has just opened the swap * Alice has a **current** **total value** = **collateral value** + **unrealized PNL = -0.2 + 0.6 = 0.4 ETH** * Alice's total initial margin consumed is 0.3 ETH * Alice's total maintenance margin required is 10 \* 0.5 years \* 3% = 0.15 ETH * (Margin rate = 25% \* 12% = 3%) * Alice's health ratio is 0.4 / 0.15 = 2.67 (healthy) * After 1 month, (5 **months** before maturity), the average ETH funding rate has been 10%. Now, let's say the **mark rate** is 5% (traders on Boros collectively think the average future rate is at 5%) * At this point, Alice has * A **swap position** of **"10 ETH, paying 12% fixed (paid upfront) & receiving floating until June 2025"** \[Same\] * Alice's **swap position** has a **"unrealized PnL"** of: 5% \* (5 months / 12 months) \* 10 ETH = 0.2083 **ETH** * Alice has **realized PnL** = 10% \* (1 months / 12 months) \* 10 ETH = +0.08333 ETH = total floating stream payments over the 1 month * All realized PnL **gets reflected in the collateral value** immediately * New **collateral value** = -0.2 + 0.08333 = -0.1167 ETH * Alice has a **current total value** = **collateral value** + **unrealized PnL** = -0.1167 + 0.2083 = 0.0916 ETH * Alice's maintenance margin required is: 10 ETH \* 5/12 years \* 2.5% = 0.1042 ETH * Maintenance margin rate is 2.5%, since 25% of Mark rate = 25% \* 5% is below the min 2.5% * Alice's margin ratio is **0.0916** / 0.1042 = 0.88 < 1 ⇒ unhealthy * Charlie liquidates 100% of Alice's position (5 months before maturity) * Before liquidation, Charlie has: * 10 ETH collateral * 0 position * When liquidation happens, two steps happen: * Step 1: A swap of 10ETH happens between Charlie and Alice at the current Mark Price (5%) * For Charlie: * Charlie will hold a position of "10 ETH, paying 5% (paid upfront) & receiving floating until June 2025" * The debt of 10 \* 5% \* 5/12 = -0.2083 is realized into Charlie collateral * Charlie's collateral is 10ETH-0.2083ETH = 9.7917 ETH now * For Alice: * Alice's new swap of "10 ETH, receiving 5% (paid upfront) & paying floating until June 2025" is merged with her existing position of "10 ETH, paying 12% fixed (paid upfront) & receiving floating until June 2025" * The result of the merge is a 0 position, and getting paid upfront for the new debt of -10 \* 5% \* 5/12 = -0.2083 ETH * Alice's collateral is now -0.1167 - (-0.2083) = 0.0916 ETH * Step 2: A liquidation incentive is transferred from Alice's collateral to Charlie's collateral * Since Alice's margin Ratio is 0.88, the liquidation incentive factor is 19.6% (it linearly goes up from 10% to 50% as margin ratio goes down from 1 to 0.5) * After the liquidation, Alice's maintenance margin goes down by 0.1042 ETH * Liquidation incentives = 19.6% \* 0.1042 = 0.0204 ETH * As such, 0.0204 ETH is transferred from Alice's collateral to Charlie's collateral * Final states: * Alice: * 0 position * Collateral = 0.0916 - 0.0204 = 0.0712 ETH * Charlie: * a position of "10 ETH, paying 5% (paid upfront) & receiving floating until June 2025" * Collateral = 9.7917 + 0.0204 = 9.8121 ETH * [How does Boros work from a user perspective?](https://docs.pendle.finance/boros-dev/LitePaper#how-does-boros-work-from-a-user-perspective) * [Interest rate swap mechanics](https://docs.pendle.finance/boros-dev/LitePaper#interest-rate-swap-mechanics) * [Interest rate swap markets](https://docs.pendle.finance/boros-dev/LitePaper#interest-rate-swap-markets) * [Interest rate swap trading zone](https://docs.pendle.finance/boros-dev/LitePaper#interest-rate-swap-trading-zone) * [Orderbook for matching swaps](https://docs.pendle.finance/boros-dev/LitePaper#orderbook-for-matching-swaps) * [Important terms and mechanics, using an example](https://docs.pendle.finance/boros-dev/LitePaper#important-terms-and-mechanics-using-an-example) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Backend Integration | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/overview#__docusaurus_skipToContent_fallback) On this page Backend integration means interacting with Boros through its REST API and TypeScript SDK rather than calling contracts directly. This is the recommended path for most integrators: the API handles calldata generation, signature encoding, and on-chain submission, so you can build trading workflows without managing ABI encoding or gas mechanics yourself. * * * Services[​](https://docs.pendle.finance/boros-dev/Backend/overview#services "Direct link to Services") ------------------------------------------------------------------------------------------------------- All services are hosted under `https://api.boros.finance`. | Service | Path prefix | Purpose | | --- | --- | --- | | Open API | `/open-api/v1/` or `/v2/` | Market data, calldata generation, account queries, simulations | | Send Txs Bot | `/send-txs-bot/v2/` or `/v3/` | Receives agent-signed calldatas, submits them on-chain, charges gas from user's gas balance | | Stop Order | `/stop-order/v1/` to `/v3/` | Off-chain conditional order (take-profit/stop-loss) management | * * * Request Flow[​](https://docs.pendle.finance/boros-dev/Backend/overview#request-flow "Direct link to Request Flow") ------------------------------------------------------------------------------------------------------------------- Boros uses a two-track signing model. Sensitive account actions are signed by the root wallet and sent directly to the blockchain. Non-sensitive trading actions are signed by an agent wallet and routed through the Send Txs Bot, which manages gas, nonce, and submission. Root wallet ──[sensitive: deposit / withdraw / approve-agent]──▶ Blockchain (direct)Agent wallet ──[non-sensitive: place / cancel / transfer]──────▶ Send Txs Bot ──▶ Blockchain The Send Txs Bot charges gas from the user's on-chain gas balance in USD at the actual Arbitrum cost, with no markup. * * * SDK[​](https://docs.pendle.finance/boros-dev/Backend/overview#sdk "Direct link to SDK") ---------------------------------------------------------------------------------------- The official TypeScript SDK covers signature generation, calldata encoding, and type-safe API calls for all three services. **Install** npm install @pendle/sdk-boros **Packages** | Package | Purpose | | --- | --- | | `@pendle/sdk-boros` | Main SDK — API clients, calldata builders, signature helpers | | `@pendle/boros-offchain-math` | Math utilities — `FixedX18` type, tick/rate conversion | **Links** * SDK repository: [https://github.com/pendle-finance/sdk-boros-public](https://github.com/pendle-finance/sdk-boros-public) * Open API interactive docs: [https://api.boros.finance/open-api/docs](https://api.boros.finance/open-api/docs) * Send Txs Bot interactive docs: [https://api.boros.finance/send-txs-bot/docs](https://api.boros.finance/send-txs-bot/docs) * Stop Order interactive docs: [https://api.boros.finance/stop-order/docs](https://api.boros.finance/stop-order/docs) * * * What's in This Section[​](https://docs.pendle.finance/boros-dev/Backend/overview#whats-in-this-section "Direct link to What's in This Section") ------------------------------------------------------------------------------------------------------------------------------------------------ | Page | Contents | | --- | --- | | [Glossary](https://docs.pendle.finance/boros-dev/Backend/glossary) | Key terms and type definitions used throughout the API | | [Agent](https://docs.pendle.finance/boros-dev/Backend/agent) | Setting up and managing agent wallets | | [API](https://docs.pendle.finance/boros-dev/Backend/api) | Full REST endpoint reference and integration workflows | | [WebSocket](https://docs.pendle.finance/boros-dev/Backend/websocket) | Real-time market and account data streaming | | [Best Practices](https://docs.pendle.finance/boros-dev/Backend/best-practices) | Patterns for gas efficiency, error handling, and market management | | [Stop Orders](https://docs.pendle.finance/boros-dev/Backend/stop-orders) | Conditional take-profit and stop-loss order management | * [Services](https://docs.pendle.finance/boros-dev/Backend/overview#services) * [Request Flow](https://docs.pendle.finance/boros-dev/Backend/overview#request-flow) * [SDK](https://docs.pendle.finance/boros-dev/Backend/overview#sdk) * [What's in This Section](https://docs.pendle.finance/boros-dev/Backend/overview#whats-in-this-section) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Market View Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Contracts/Market#__docusaurus_skipToContent_fallback) On this page Prefer the API over direct contract calls The [REST API](https://docs.pendle.finance/boros-dev/Backend/api) provides all market data (positions, order books, margins) with up-to-date settlement applied. Direct contract calls return unsettled data and require manual settlement triggers. Use the API unless you have a specific need for on-chain reads. The Market contract provides comprehensive view functions for querying market state, user positions, order book data, and risk parameters. Market Information[​](https://docs.pendle.finance/boros-dev/Contracts/Market#market-information "Direct link to Market Information") ------------------------------------------------------------------------------------------------------------------------------------- ### `descriptor()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#descriptor "Direct link to descriptor") ( bool isIsolatedOnly, // True if market only supports isolated margin TokenId tokenId, // Underlying collateral token ID MarketId marketId, // Unique market identifier uint32 maturity, // Maturity timestamp uint8 tickStep, // Tick step for calculating tick rate uint16 iTickThresh, // Tick threshold for margin calculation uint32 latestFTime // Latest fTime) = market.descriptor(); The rate threshold for margin calculations can be derived from `tickStep` and `iTickThresh`: int256 rateThreshold = TickMath.getRateAtTick(iTickThresh, tickStep); ### `name()` and `symbol()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#name-and-symbol "Direct link to name-and-symbol") string memory marketName = market.name(); // e.g., "Binance ETHUSDT 26 Sep 2025"string memory marketSymbol = market.symbol(); // e.g., "BINANCE-ETHUSDT-26SEP2025" ### `getOI()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getoi "Direct link to getoi") Returns the total open interest across both long and short positions. Note that this represents the sum of absolute position sizes from both sides, which differs from conventional open interest calculations that typically report only one side. uint256 openInterest = market.getOI();console.log("Total open interest: %s", openInterest); ### `getMarketConfig()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarketconfig "Direct link to getmarketconfig") Returns the complete market configuration parameters: struct MarketConfigStruct { uint16 maxOpenOrders; // Maximum orders per account address markRateOracle; // Oracle for mark rate calculation address fIndexOracle; // Oracle for floating index updates uint128 hardOICap; // Hard open interest cap uint64 takerFee; // Taker fee rate uint64 otcFee; // OTC swap fee rate LiqSettings liqSettings; // Liquidation incentive parameters uint64 kIM; // Initial margin factor uint64 kMM; // Maintenance margin factor uint32 tThresh; // Time threshold for margin calculations uint16 maxRateDeviationFactorBase1e4; // Max rate deviation from mark rate uint16 closingOrderBoundBase1e4; // Rate bounds for closing orders int16 loUpperConstBase1e4; // Limit order upper constant int16 loUpperSlopeBase1e4; // Limit order upper slope int16 loLowerConstBase1e4; // Limit order lower constant int16 loLowerSlopeBase1e4; // Limit order lower slope MarketStatus status; // Market status (PAUSED/CLO/GOOD) bool useImpliedAsMarkRate; // Whether to use implied rate as mark rate}MarketConfigStruct memory config = market.getMarketConfig();console.log("Max open orders: %s", config.maxOpenOrders);console.log("Taker fee: %s bps", config.takerFee); Order Book[​](https://docs.pendle.finance/boros-dev/Contracts/Market#order-book "Direct link to Order Book") ------------------------------------------------------------------------------------------------------------- ### `getNextNTicks()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getnextnticks "Direct link to getnextnticks") // Get best 10 LONG ticks(int16[] memory ticks, uint256[] memory sizes) = market.getNextNTicks( Side.LONG, Side.LONG.tickToGetFirstAvail(), 10);// Get liquidity after specific tickint16 bestAskTick = 125;(int16[] memory nextTicks, uint256[] memory nextSizes) = market.getNextNTicks( Side.SHORT, bestAskTick, // Start after this tick 5); ### `getAllOpenOrders()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getallopenorders "Direct link to getallopenorders") Returns all open orders for a user account. Each order contains: struct Order { OrderStatus status; // NOT_EXIST, OPEN, PENDING_SETTLE, PURGED OrderId id; // Unique 64-bit identifier encoding side, tick, and index MarketAcc maker; // Account that placed the order uint256 size; // Order size (18 decimals) int256 rate; // Order rate derived from tick index} MarketAcc userAccount = AccountLib.toMainCross(userAddress, tokenId);Order[] memory orders = market.getAllOpenOrders(userAccount);for (uint i = 0; i < orders.length; i++) { Order memory order = orders[i]; console.log("Order ID: %s", OrderId.unwrap(order.id)); console.log("Size: %s", order.size); console.log("Rate: %s", order.rate); console.log("Status: %s", uint(order.status));} ### `getOrder()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getorder "Direct link to getorder") OrderId orderId = OrderIdLib.from(Side.LONG, 125, 1000);Order memory order = market.getOrder(orderId); **Caveats:** * For an order that is **not fully filled**, `size` returns the **remaining unfilled size**, not the original order size. * If an order is partially filled (possible multiple times) before being fully filled, `size` returns the remaining order size right before the order gets fully filled, excluding previous partial fills. * Cancelled orders show `status = NOT_EXIST` and `size = 0`. Position and Risk[​](https://docs.pendle.finance/boros-dev/Contracts/Market#position-and-risk "Direct link to Position and Risk") ---------------------------------------------------------------------------------------------------------------------------------- Functions ending with `NoSettle` return potentially outdated data without triggering settlement. Due to Boros's lazy settlement system, on-chain state may not reflect the latest position values until the next user interaction. **Important:** For accurate, up-to-date position data, first trigger [settlement](https://docs.pendle.finance/boros-dev/Mechanics/Settlement) : IMarketHub(marketHub).settleAllAndGet(userAccount, GetRequest.ZERO, MarketId.ZERO); ### `getSignedSizeNoSettle()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getsignedsizenosettle "Direct link to getsignedsizenosettle") MarketAcc userAccount = AccountLib.toCross(mainAccount, tokenId);int256 position = market.getSignedSizeNoSettle(userAccount); ### `calcPositionValueNoSettle()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#calcpositionvaluenosettle "Direct link to calcpositionvaluenosettle") int256 positionValue = market.calcPositionValueNoSettle(userAccount); ### `calcMarginNoSettle()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#calcmarginnosettle "Direct link to calcmarginnosettle") // Calculate initial margin requirementuint256 initialMargin = market.calcMarginNoSettle(userAccount, MarginType.IM);// Calculate maintenance margin requirementuint256 maintenanceMargin = market.calcMarginNoSettle(userAccount, MarginType.MM); ### `getMarginFactor()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarginfactor "Direct link to getmarginfactor") (uint64 kIM, uint64 kMM) = market.getMarginFactor(userAccount); ### `getPendingSizes()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getpendingsizes "Direct link to getpendingsizes") (uint256 pendingLong, uint256 pendingShort) = market.getPendingSizes(userAccount);console.log("Pending long orders: %s", pendingLong);console.log("Pending short orders: %s", pendingShort); Funding and Settlement Tracking[​](https://docs.pendle.finance/boros-dev/Contracts/Market#funding-and-settlement-tracking "Direct link to Funding and Settlement Tracking") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### `getLatestFIndex()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getlatestfindex "Direct link to getlatestfindex") FIndex latestIndex = market.getLatestFIndex();uint32 fTime = latestIndex.fTime();int112 floatingIndex = latestIndex.floatingIndex();uint64 feeIndex = latestIndex.feeIndex(); Rate Information[​](https://docs.pendle.finance/boros-dev/Contracts/Market#rate-information "Direct link to Rate Information") ------------------------------------------------------------------------------------------------------------------------------- ### `getImpliedRate()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getimpliedrate "Direct link to getimpliedrate") ( int128 lastTradedRate, // Last trade execution rate int128 oracleRate, // TWAP rate uint32 lastTradedTime, // Timestamp of last trade uint32 observationWindow // Rate observation window) = market.getImpliedRate(); ### `getMarkRateView()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarkrateview "Direct link to getmarkrateview") Returns the current mark rate used for margin calculations and position valuation. This is the oracle-based TWAP rate from the order book's rate observations. int256 markRate = market.getMarkRateView(); Fees[​](https://docs.pendle.finance/boros-dev/Contracts/Market#fees "Direct link to Fees") ------------------------------------------------------------------------------------------- ### `getBestFeeRates()`[​](https://docs.pendle.finance/boros-dev/Contracts/Market#getbestfeerates "Direct link to getbestfeerates") MarketAcc user = AccountLib.toMainCross(userAddress, tokenId);MarketAcc counterparty = AccountLib.toMainCross(counterpartyAddress, tokenId);(uint64 takerFee, uint64 otcFee) = market.getBestFeeRates(user, counterparty); * [Market Information](https://docs.pendle.finance/boros-dev/Contracts/Market#market-information) * [`descriptor()`](https://docs.pendle.finance/boros-dev/Contracts/Market#descriptor) * [`name()` and `symbol()`](https://docs.pendle.finance/boros-dev/Contracts/Market#name-and-symbol) * [`getOI()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getoi) * [`getMarketConfig()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarketconfig) * [Order Book](https://docs.pendle.finance/boros-dev/Contracts/Market#order-book) * [`getNextNTicks()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getnextnticks) * [`getAllOpenOrders()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getallopenorders) * [`getOrder()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getorder) * [Position and Risk](https://docs.pendle.finance/boros-dev/Contracts/Market#position-and-risk) * [`getSignedSizeNoSettle()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getsignedsizenosettle) * [`calcPositionValueNoSettle()`](https://docs.pendle.finance/boros-dev/Contracts/Market#calcpositionvaluenosettle) * [`calcMarginNoSettle()`](https://docs.pendle.finance/boros-dev/Contracts/Market#calcmarginnosettle) * [`getMarginFactor()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarginfactor) * [`getPendingSizes()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getpendingsizes) * [Funding and Settlement Tracking](https://docs.pendle.finance/boros-dev/Contracts/Market#funding-and-settlement-tracking) * [`getLatestFIndex()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getlatestfindex) * [Rate Information](https://docs.pendle.finance/boros-dev/Contracts/Market#rate-information) * [`getImpliedRate()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getimpliedrate) * [`getMarkRateView()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarkrateview) * [Fees](https://docs.pendle.finance/boros-dev/Contracts/Market#fees) * [`getBestFeeRates()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getbestfeerates) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Fees | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Mechanics/Fees#__docusaurus_skipToContent_fallback) On this page Boros charges various fees to maintain protocol sustainability. This section outlines all fee types that users should be aware of when trading on the platform. Position Opening Fees[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#position-opening-fees "Direct link to Position Opening Fees") -------------------------------------------------------------------------------------------------------------------------------------------- Boros charges fees when opening new positions through: * **Taker orders**: When executing against existing orders in the order book * **OTC swaps**: When opening direct swaps with other users (typically AMMs) **Important**: Maker orders (limit orders placed in the order book) incur **no fees** when placed. Fees are only charged to the taker when these orders are filled. ### Fee Formula[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#fee-formula "Direct link to Fee Formula") Both taker orders and OTC swaps follow the same fee calculation: Fee = |Position Size| × Fee Rate × Time to Maturity Where: * **Position Size**: The notional size of the position being opened * **Fee Rate**: Configured per market — `takerFee` for order book trades and `otcFee` for OTC swaps (e.g., AMM interactions). Typical value: 0.05% (0.0005). Query the exact rates via [`getMarketConfig()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarketconfig) or [`getBestFeeRates()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getbestfeerates) * **Time to Maturity**: The time remaining until the swap maturity, expressed in years **Fee Discounts:** Some accounts may have personal discount rates (`takerDisc`, `otcDisc`) that reduce the effective fee. The `getBestFeeRates()` function returns the actual rate after applying any applicable discounts. ### Example[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#example "Direct link to Example") Suppose you want to open a long position by taking an order: * Position size: 100 ETH * Current time: January 1, 2025 * Maturity: April 1, 2025 (90 days = 0.2466 years) * Fee rate: 0.05% Fee = 100 ETH × 0.0005 × 0.2466 = 0.01233 ETH The same fee calculation applies for OTC swaps of the same size and maturity. Settlement Fees[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#settlement-fees "Direct link to Settlement Fees") -------------------------------------------------------------------------------------------------------------------------- Boros charges settlement fees on all open positions during each periodic payment settlement. ### Fee Formula[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#fee-formula-1 "Direct link to Fee Formula") Settlement fees are calculated as: Settlement Fee = |Position Size| × Settlement Fee Rate × Settlement Period Where: * **Position Size**: The absolute value of your current position size * **Settlement Fee Rate**: Set by the protocol (varies by market) * **Settlement Period**: Typically 8 hours (8/8760 = 0.000913 years) ### Example[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#example-1 "Direct link to Example") For an open position during settlement: * Position size: 50 ETH (long) * Settlement fee rate: 0.2% (0.002) * Settlement period: 8 hours = 0.000913 years Settlement Fee = 50 ETH × 0.002 × 0.000913 = 0.0000913 ETH This fee is charged every 8 hours (or the configured settlement period) for as long as the position remains open. Market Entrance Fees[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#market-entrance-fees "Direct link to Market Entrance Fees") ----------------------------------------------------------------------------------------------------------------------------------------- A one-time market entrance fee is charged when you perform your first action in any specific market. The entrance fee is denominated in the base asset of the market: * **BTC markets**: 0.000008 BTC (approx. $1 USD) * **ETH markets**: 0.00027 ETH (approx. $1 USD) You can check if you've already paid the entrance fee by calling: bool hasEntered = MarketHub.hasEnteredMarketBefore(userAccount, marketId); If `hasEntered` returns `true`, you won't be charged the entrance fee again for that market. Liquidation Fees[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#liquidation-fees "Direct link to Liquidation Fees") ----------------------------------------------------------------------------------------------------------------------------- When an account is liquidated, a fee is charged on the liquidated position and collected by the protocol treasury. This fee is separate from the [liquidation incentive](https://docs.pendle.finance/boros-dev/Mechanics/Margin#liquidation-process) paid to the liquidator. Liquidation Fee = |Liquidated Size| × LiqSettings.feeRate × Time to Maturity The `feeRate` is part of the market's [`LiqSettings`](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#liqsettings) configuration. It follows the same time-scaling pattern as position opening fees. Fee Summary[​](https://docs.pendle.finance/boros-dev/Mechanics/Fees#fee-summary "Direct link to Fee Summary") -------------------------------------------------------------------------------------------------------------- | Fee Type | When Charged | Rate Source | Discountable | | --- | --- | --- | --- | | Taker fee | Order fills against book | `MarketConfig.takerFee` | Yes (`takerDisc`) | | OTC fee | AMM swaps / OTC trades | `MarketConfig.otcFee` | Yes (`otcDisc`) | | Settlement fee | Each funding period | `FIndex.feeIndex` | No | | Market entrance fee | First action per market | `CashFeeData.marketEntranceFee` | No | | Liquidation fee | Account liquidated | `LiqSettings.feeRate` | No | * [Position Opening Fees](https://docs.pendle.finance/boros-dev/Mechanics/Fees#position-opening-fees) * [Fee Formula](https://docs.pendle.finance/boros-dev/Mechanics/Fees#fee-formula) * [Example](https://docs.pendle.finance/boros-dev/Mechanics/Fees#example) * [Settlement Fees](https://docs.pendle.finance/boros-dev/Mechanics/Fees#settlement-fees) * [Fee Formula](https://docs.pendle.finance/boros-dev/Mechanics/Fees#fee-formula-1) * [Example](https://docs.pendle.finance/boros-dev/Mechanics/Fees#example-1) * [Market Entrance Fees](https://docs.pendle.finance/boros-dev/Mechanics/Fees#market-entrance-fees) * [Liquidation Fees](https://docs.pendle.finance/boros-dev/Mechanics/Fees#liquidation-fees) * [Fee Summary](https://docs.pendle.finance/boros-dev/Mechanics/Fees#fee-summary) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Stop Orders (TP/SL) | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/stop-orders#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#overview "Direct link to Overview") ---------------------------------------------------------------------------------------------------------- Stop orders are **conditional orders** that automatically execute when the market APR crosses a specified threshold. They allow you to set up take-profit (TP) and stop-loss (SL) levels for your positions without needing to monitor the market continuously. Unlike regular limit orders that live on-chain in the order book, stop orders are managed **off-chain** by the Stop Order Service. When the trigger condition is met, the service generates and submits the trade on your behalf through the agent system. How Stop Orders Work[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#how-stop-orders-work "Direct link to How Stop Orders Work") ---------------------------------------------------------------------------------------------------------------------------------------------- ┌─────────────────────────────────────────────────────────────┐│ 1. You have an open position on a market ││ 2. You set a stop order: "if APR reaches X, close/reduce" ││ 3. The Stop Order Service monitors the market APR ││ 4. When APR crosses your threshold → order is triggered ││ 5. The service executes a market order to close/reduce │└─────────────────────────────────────────────────────────────┘ Order Types[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#order-types "Direct link to Order Types") ------------------------------------------------------------------------------------------------------------------- | Type | Value | Description | | --- | --- | --- | | **Take Profit (Market)** | `2` | Triggers when the market moves in your favor. Closes at market price to lock in profit. | | **Stop Loss (Market)** | `3` | Triggers when the market moves against you. Closes at market price to limit losses. | Both types execute as **market orders** (IOC — Immediate or Cancel) when triggered, filling against available liquidity in the order book. Trigger Logic[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#trigger-logic "Direct link to Trigger Logic") ------------------------------------------------------------------------------------------------------------------------- The trigger condition depends on the combination of your position side and the order type: | Position | Order Type | Triggers when APR... | | --- | --- | --- | | Long | Take Profit | rises above the threshold | | Long | Stop Loss | falls below the threshold | | Short | Take Profit | falls below the threshold | | Short | Stop Loss | rises above the threshold | The trigger APR is specified as a **tick** value. See the [Glossary](https://docs.pendle.finance/boros-dev/Backend/glossary) for how ticks map to interest rates. Integration Guide[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#integration-guide "Direct link to Integration Guide") ------------------------------------------------------------------------------------------------------------------------------------- ### Step 1: Prepare the Stop Order[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#step-1-prepare-the-stop-order "Direct link to Step 1: Prepare the Stop Order") Call the prepare endpoint to generate the order parameters including the calldata that will be executed when the order triggers: const { data: prepareResult } = await axios.get( `${BASE_URL}/stop-order/v1/orders/tpsl/prepare`, { params: { userAddress: '0xYourAddress', accountId: 0, marketId: 1, side: 0, // 0 = Long, 1 = Short stopAprOrderType: 3, // 2 = Take Profit, 3 = Stop Loss tick: -500, // trigger APR as tick value size: '1000000000000000000000', // size in 18 decimals } }); The response includes a `calldatas` array — the pre-built transaction data that the service will submit when the stop order triggers. ### Step 2: Place the Stop Order[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#step-2-place-the-stop-order "Direct link to Step 2: Place the Stop Order") Sign and submit the stop order. The placement requires an agent signature to authorize the service to execute on your behalf: const { data: placeResult } = await axios.post( `${BASE_URL}/stop-order/v2/orders/place`, { userAddress: '0xYourAddress', accountId: 0, tokenId: 0, marketId: 1, side: 0, stopAprOrderType: 3, tick: -500, size: '1000000000000000000000', timeInForce: 1, // IOC for market execution calldatas: prepareResult.calldatas, // ... agent signature fields }); The response confirms placement with the order details and a `stopOrderRequestId`. ### Step 3: Monitor or Cancel[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#step-3-monitor-or-cancel "Direct link to Step 3: Monitor or Cancel") To cancel a pending stop order: const { data: cancelResult } = await axios.delete( `${BASE_URL}/stop-order/v3/orders/cancel`, { data: { orderIds: ['order-id-1', 'order-id-2'], // ... agent signature fields } }); Important Notes[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#important-notes "Direct link to Important Notes") ------------------------------------------------------------------------------------------------------------------------------- * **Off-chain execution**: Stop orders are not on-chain limit orders. They are monitored and triggered by the Stop Order Service. * **Market orders**: When triggered, stop orders execute as market orders (IOC). In low-liquidity conditions, the order may partially fill or not fill at all. * **Agent required**: Stop orders use the agent authorization system. Your agent must be approved before placing stop orders. * **Size in 18 decimals**: Position sizes are always specified in 18-decimal fixed-point format, regardless of the underlying token's native decimals. * **Tick precision**: The trigger APR is specified as a tick value. Use SDK helpers (`estimateTickForRate`, `getRateAtTick`) to convert between human-readable APR and tick values. API Reference[​](https://docs.pendle.finance/boros-dev/Backend/stop-orders#api-reference "Direct link to API Reference") ------------------------------------------------------------------------------------------------------------------------- For exact request/response schemas, see the interactive docs: **[https://api.boros.finance/stop-order/docs](https://api.boros.finance/stop-order/docs) ** | Endpoint | Method | Description | | --- | --- | --- | | `/v1/orders/tpsl/prepare` | GET | Generate stop order parameters and calldata | | `/v2/orders/place` | POST | Place a signed stop order | | `/v3/orders/cancel` | DELETE | Cancel one or more stop orders | * [Overview](https://docs.pendle.finance/boros-dev/Backend/stop-orders#overview) * [How Stop Orders Work](https://docs.pendle.finance/boros-dev/Backend/stop-orders#how-stop-orders-work) * [Order Types](https://docs.pendle.finance/boros-dev/Backend/stop-orders#order-types) * [Trigger Logic](https://docs.pendle.finance/boros-dev/Backend/stop-orders#trigger-logic) * [Integration Guide](https://docs.pendle.finance/boros-dev/Backend/stop-orders#integration-guide) * [Step 1: Prepare the Stop Order](https://docs.pendle.finance/boros-dev/Backend/stop-orders#step-1-prepare-the-stop-order) * [Step 2: Place the Stop Order](https://docs.pendle.finance/boros-dev/Backend/stop-orders#step-2-place-the-stop-order) * [Step 3: Monitor or Cancel](https://docs.pendle.finance/boros-dev/Backend/stop-orders#step-3-monitor-or-cancel) * [Important Notes](https://docs.pendle.finance/boros-dev/Backend/stop-orders#important-notes) * [API Reference](https://docs.pendle.finance/boros-dev/Backend/stop-orders#api-reference) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Boros API Best Practices | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/best-practices#__docusaurus_skipToContent_fallback) On this page This guide provides recommendations and common patterns for integrating with the Boros API efficiently. * * * Bulk Order Placement[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#bulk-order-placement "Direct link to Bulk Order Placement") ------------------------------------------------------------------------------------------------------------------------------------------------- When placing multiple orders simultaneously, **always use the bulk order endpoint** instead of making multiple single order requests. ### Why Use Bulk Orders?[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#why-use-bulk-orders "Direct link to Why Use Bulk Orders?") | Approach | Gas Cost | Atomicity | Network Overhead | | --- | --- | --- | --- | | Multiple single orders | High (N transactions) | None (partial failures possible) | High | | Bulk orders | Low (1 transaction) | Atomic (all or nothing) | Low | ### Benefits[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#benefits "Direct link to Benefits") 1. **Lower Gas Fees** — Multiple operations batched into a single transaction 2. **Atomic Execution** — All operations execute together, eliminating partial execution risks 3. **Better Performance** — Reduces network overhead and speeds up execution 4. **Complex Strategies** — Combine cancellations and new orders in one operation caution Unlike single order placement (`placeSingleOrder`), **bulk orders do NOT match with the AMM**. They are placed directly into the order book. If you need to take liquidity from both the order book and the AMM, use single order placement with `IOC` or `FOK` time-in-force. ### Examples[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#examples "Direct link to Examples") * [Bulk Place Orders Example](https://github.com/pendle-finance/boros-api-examples/blob/main/examples/11-bulk-place-orders.ts) * [Place Orders API](https://api.boros.finance/open-api/docs) * * * Transaction Submission[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#transaction-submission "Direct link to Transaction Submission") ------------------------------------------------------------------------------------------------------------------------------------------------------- ### `direct-call` vs `bulk-direct-call`[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#direct-call-vs-bulk-direct-call "Direct link to direct-call-vs-bulk-direct-call") The Send Txs Bot provides two submission endpoints: | Endpoint | Use case | | --- | --- | | `POST /v2/agent/direct-call` | Submit a **single** calldata | | `POST /v2/agent/bulk-direct-call` | Submit **one or more** calldatas with sequential execution | v2 vs v3 Send Txs Bot Both v2 and v3 expose `bulk-direct-call`, but they have **different request schemas**: * **v2** (`BulkAgentExecuteDto`) — no session required. Use this for **programmatic / API integrations**. * **v3** (`BulkAgentExecuteV2Dto`) — requires a mandatory `agentSession` field (HTTP-only cookie / CSRF token). Use this for **browser-based UIs** only. Unless you are building a browser UI with session management, always use **v2**. **When to use `bulk-direct-call`:** The calldata generation endpoints (e.g., `POST /calldata/place-orders`) may return **multiple calldatas** in the `calldatas` array — for example, `[exit-market, place-order]` when `autoExitMarket=true`. You **must** submit all calldatas together using `bulk-direct-call` to ensure correct execution order. Common pitfall If you use `direct-call` with only the first element of a multi-calldata response, only the exit-market transaction executes — your order will not be placed. Always check the length of the `calldatas` array and use `bulk-direct-call` when there are multiple entries. ### `autoExitMarket` Parameter[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#autoexitmarket-parameter "Direct link to autoexitmarket-parameter") When calling `POST /calldata/place-orders`, the `autoExitMarket` parameter (default: `true`) controls whether the API automatically generates an exit-market calldata for expired/unused markets: * `autoExitMarket=true` → API may return 1 or 2 calldatas: `[exit-market (optional), place-order]`. The last element is always the place-order calldata. * `autoExitMarket=false` → API always returns exactly 1 calldata (place-order only). Use this if you manage market entry/exit yourself. ### `skipReceipt` Parameter[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#skipreceipt-parameter "Direct link to skipreceipt-parameter") Controls whether the Send Txs Bot waits for block confirmation: * `skipReceipt=false` (default): Waits for the transaction to be included in a block, then returns `status` and `error` fields. Higher latency but gives immediate confirmation. * `skipReceipt=true`: Returns the `txHash` immediately after broadcasting. Lower latency but you must track the transaction status yourself. * * * Market Management[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#market-management "Direct link to Market Management") ---------------------------------------------------------------------------------------------------------------------------------------- ### Exit Unused Markets[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#exit-unused-markets "Direct link to Exit Unused Markets") If you have entered markets that are no longer in use, **exit them to reduce gas costs** on future operations. When you enter a market, the system tracks your participation for margin calculations. Each entered market adds overhead to the margin tracker, making it **more expensive in gas** for every subsequent transaction. **Important limitations:** * **Maximum 10 entered markets** per `marketAcc` (market account). This limit is per combination of **(address, accountId, tokenId)** — i.e., per collateral type. * **Maximum active limit orders** per `marketAcc` per market (configurable per market via `maxOpenOrders`, typically 100) * Entering more markets = heavier margin calculations = higher gas costs tip If you trade many markets over time (e.g., weekly expiry markets), you will hit the 10-market limit. **You must exit expired/matured markets** to free up slots for new ones. The `autoExitMarket` parameter in the place-orders API can handle this automatically. Exiting unused markets helps: * Reduce gas consumption on all subsequent transactions * Free up slots for new markets (10 market limit) * Improve transaction performance ### When to Exit Markets[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#when-to-exit-markets "Direct link to When to Exit Markets") * After closing all positions in a market * When you no longer plan to trade a specific market * During account cleanup/maintenance * Before market expiry (for dated markets) To exit a market, you must first: 1. Close all positions (zero position size) 2. Cancel all open orders 3. Have no pending settlements ### Isolated-Only Markets[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#isolated-only-markets "Direct link to Isolated-Only Markets") Some markets are **isolated-only**, meaning they cannot be traded from a cross-margin account. For these markets: 1. **Deposit to the isolated account** — You must transfer collateral specifically to the isolated market account, not the cross-margin account 2. **Use the correct `marketAcc`** — Pack the `marketAcc` with the specific `marketId` instead of `CROSS_MARKET_ID` import { MarketAccLib } from "@pendle/sdk-boros";// For isolated-only markets, use the specific marketIdconst isolatedMarketAcc = MarketAccLib.pack( walletAddress, accountId, tokenId, marketId // Use the specific market ID, NOT CROSS_MARKET_ID); To fund an isolated account, either: * **Direct deposit**: Deposit directly to the isolated market using the `marketId` in the deposit calldata * **Cash transfer**: Transfer from cross-margin to isolated using the `/calldata/cash-transfer` endpoint with `isDeposit: true` **Example:** [Top Up Isolated Account](https://github.com/pendle-finance/boros-api-examples/blob/main/examples/13-top-up-isolated-account.ts) * * * Gas Usage and Estimation[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#gas-usage-and-estimation "Direct link to Gas Usage and Estimation") ------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Monitor Gas Balance[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#monitor-gas-balance "Direct link to Monitor Gas Balance") Boros uses a gas account system for executing agent-signed transactions. Always monitor your gas balance to avoid failed transactions. **Key endpoints:** * `GET /accounts/gas-balance` — Check current balance * `GET /accounts/gas-consumption-history` — Review usage patterns * `GET /calldata/vault-pay-treasury` — Top up gas balance (sensitive, root-signed) ### Arbitrum Gas Spikes[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#arbitrum-gas-spikes "Direct link to Arbitrum Gas Spikes") Arbitrum gas prices can spike significantly during high network activity. Consider: 1. **Monitor gas prices** before submitting transactions 2. **Maintain buffer** in your gas account for unexpected spikes 3. **Check gas consumption history** to understand your usage patterns **Example:** [Top Up Gas Account](https://github.com/pendle-finance/boros-api-examples/blob/main/examples/12-top-up-gas-account.ts) * * * Error Handling[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#error-handling "Direct link to Error Handling") ------------------------------------------------------------------------------------------------------------------------------- ### Error Response Formats[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#error-response-formats "Direct link to Error Response Formats") The Open API uses a structured error format: { "errorCode": "INVALID_MARKET_ID", "message": "Market with ID 999 not found", "data": {}} The Send Txs Bot and Stop Order services use a legacy format: { "statusCode": 400, "message": "Invalid signature"} ### Handling Common Errors[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#handling-common-errors "Direct link to Handling Common Errors") | Error | Cause | Solution | | --- | --- | --- | | Insufficient margin | Not enough collateral for the position | Deposit more, reduce size, or close other positions | | Agent expired | Agent approval has expired | Re-approve agent via `GET /calldata/approve-agent` | | Invalid signature | Signature doesn't match the expected signer | Verify you're signing with the correct agent key | | Market not entered | Trying to trade on a market you haven't entered | Use `GET /calldata/enter-exit-markets` to enter first | | Order limit reached | Exceeded `maxOpenOrders` for the market | Cancel some existing orders before placing new ones | | Market limit reached | Over 10 entered markets | Exit unused markets to free up slots | ### Retry Strategy[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#retry-strategy "Direct link to Retry Strategy") * **Don't retry immediately** on validation errors (bad parameters, insufficient margin) — fix the root cause * **Retry with backoff** on transient errors (network timeouts, 503s) * **Check transaction status** before retrying submissions to the Send Txs Bot — the original may have succeeded * * * Simulation Before Execution[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#simulation-before-execution "Direct link to Simulation Before Execution") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Always use the simulation endpoints before executing trades, especially for: * **Large orders** — preview margin impact and fees * **Close positions** — verify the counter-order parameters * **Deposits/withdrawals** — check that the operation won't cause under-margining Simulations are free (no gas) and return the projected account state. The key simulation endpoints: | Endpoint | Use case | | --- | --- | | `GET /simulations/place-order` | Preview order placement | | `GET /simulations/close-active-position` | Preview closing a position | | `GET /simulations/deposit` | Preview deposit effect | | `GET /simulations/withdraw` | Preview withdrawal effect | | `GET /simulations/cash-transfer` | Preview cross ↔ isolated transfer | * * * Real-Time Data[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#real-time-data "Direct link to Real-Time Data") ------------------------------------------------------------------------------------------------------------------------------- ### Market Data Latency[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#market-data-latency "Direct link to Market Data Latency") Not all REST endpoints have the same latency characteristics. For latency-sensitive indicators, use the correct endpoint: | Data | Best endpoint | Latency | | --- | --- | --- | | `midApr`, `bestBid`, `bestAsk`, `ammImpliedApr`, `markApr` | `GET /open-api/v1/markets/{marketId}` | Real-time | | Order book depth | `GET /open-api/v2/markets/order-books?marketId={marketId}` | < 1 second | | AMM state | `GET /core/amm/{ammId}` | < 1 second | | Market list / overview | `GET /open-api/v1/markets` | May have several seconds of delay | tip For market making or any use case requiring live mid/mark rates, always use the **single market endpoint** (`GET /open-api/v1/markets/{marketId}`) rather than the bulk markets list. The bulk endpoint may have a delay of several seconds on sensitive indicators. ### Combined Order Book (AMM + Order Book)[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#combined-order-book-amm--order-book "Direct link to Combined Order Book (AMM + Order Book)") The order book displayed in the Boros UI and returned by `GET /v2/markets/order-books` (with AMM enabled) is a **combined** order book that merges: * **Order book liquidity**: Discrete maker orders at specific tick levels * **AMM liquidity**: Continuous liquidity from the AMM, discretized into tick levels for display **Important:** The AMM has a minimum and maximum APR range. When the market rate moves outside this range, the AMM stops providing liquidity. In this case, the combined order book may show a wider spread since only order book liquidity remains. **Note:** Some markets may have **no AMM** at all. In these markets, all liquidity comes from the order book only, and `placeSingleOrder` behaves the same as `bulkOrders` (no AMM to route through). Check the market's `ammId` — if absent or null, there is no AMM. The AMM implied rate should normally be within the range `(bestBid - ε, bestAsk + ε)` where ε is a small amount to prevent arbitrage between the AMM and the order book. ### Use WebSocket for Streaming[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#use-websocket-for-streaming "Direct link to Use WebSocket for Streaming") Don't poll REST endpoints for real-time data. Use [WebSocket](https://docs.pendle.finance/boros-dev/Backend/websocket) for: * **Order book updates**: `orderbook:MARKET_ID:TICK_SIZE` * **Trade events**: `market-trade:MARKET_ID` * **Market statistics**: `statistics:MARKET_ID` * **Account changes**: `account:ADDRESS:ACCOUNT_ID` ### Caching Strategy[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#caching-strategy "Direct link to Caching Strategy") | Data | Cache duration | Refresh trigger | | --- | --- | --- | | Assets list | Long (hours) | Rarely changes | | Market list | Medium (minutes) | New markets added infrequently | | Market state / order book | Don't cache | Use WebSocket | | Account positions | Don't cache | Use WebSocket account channel | | Gas balance | Short (seconds) | After each transaction | * * * Market Maker Order Flow[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#market-maker-order-flow "Direct link to Market Maker Order Flow") ---------------------------------------------------------------------------------------------------------------------------------------------------------- The calldata endpoints (e.g., `POST /calldata/place-orders`) return a list of calldatas. You sign each calldata with your agent key, then send them to `POST /send-txs-bot/v2/agent/bulk-direct-call`. When submitting, set the `requireSuccess` parameter to control atomicity: * **`requireSuccess=true`** — All calldatas are placed atomically (all succeed or all revert). * **`requireSuccess=false`** — Each calldata is placed independently; some may succeed while others fail. ### Full Flow[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#full-flow "Direct link to Full Flow") ┌──────────────────────────────────────────────────────────────────────┐│ 1. POST /calldata/place-orders → calldatas[] ││ 2. Sign each calldata with agent key ││ 3. POST /send-txs-bot/v2/agent/bulk-direct-call ││ with requireSuccess=true or false → tx results │└──────────────────────────────────────────────────────────────────────┘ ### `requireSuccess` Parameter (Send Txs Bot)[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#requiresuccess-parameter-send-txs-bot "Direct link to requiresuccess-parameter-send-txs-bot") The `requireSuccess` parameter on `bulk-direct-call` controls whether the calldatas execute atomically: | Value | Behavior | Use case | | --- | --- | --- | | `true` (default) | All calldatas succeed together or all revert | Place multiple orders atomically | | `false` | Each calldata executes independently; some may succeed while others fail | Placing multiple independent orders (e.g., market making quotes on both sides) | When to use `requireSuccess=false` If you are a market maker placing multiple orders across different markets or at different price levels, use `requireSuccess=false`. This way, if one order fails (e.g., due to insufficient margin for that specific order), the remaining orders can still be placed successfully. * * * Security[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#security "Direct link to Security") ------------------------------------------------------------------------------------------------------------- ### Key Management[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#key-management "Direct link to Key Management") * **Never expose your root private key** in client-side code or logs * **Use the agent system** — the agent key has limited permissions and cannot withdraw funds * **Rotate agent keys** periodically by revoking the old agent and approving a new one * **Set reasonable expiry times** on agent approvals ### Transaction Verification[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#transaction-verification "Direct link to Transaction Verification") * Always **simulate before executing** to verify expected outcomes * Check the `to` address in calldata responses matches the expected Router contract * Verify transaction status after submission — don't assume success * * * Summary[​](https://docs.pendle.finance/boros-dev/Backend/best-practices#summary "Direct link to Summary") ---------------------------------------------------------------------------------------------------------- | Best Practice | Why | | --- | --- | | Use bulk orders for multiple operations | Lower gas, atomic execution | | Use `bulk-direct-call` for multi-calldata responses | Ensures all calldatas (exit-market + place-order) are submitted | | Use `requireSuccess=false` for independent orders | Lets each order succeed/fail independently (market making) | | Set `autoExitMarket=false` if managing markets yourself | Avoids unexpected multi-calldata responses | | Exit unused/expired markets (max 10 per account) | Reduce gas overhead, free up slots | | Use `GET /open-api/v1/markets/{marketId}` for real-time rates | Guaranteed real-time midApr, markApr, bestBid, bestAsk | | Use correct `marketAcc` for isolated-only markets | Required for trading isolated-only markets | | Monitor gas balance | Avoid failed transactions | | Simulate before executing | Preview margin impact and catch errors | | Use WebSocket for real-time data | Lower latency, less overhead than polling | | Handle errors by format (Open API vs legacy) | Different services use different formats | | Never expose root key; use agents | Security best practice | For complete working examples, visit: [https://github.com/pendle-finance/boros-api-examples](https://github.com/pendle-finance/boros-api-examples) * [Bulk Order Placement](https://docs.pendle.finance/boros-dev/Backend/best-practices#bulk-order-placement) * [Why Use Bulk Orders?](https://docs.pendle.finance/boros-dev/Backend/best-practices#why-use-bulk-orders) * [Benefits](https://docs.pendle.finance/boros-dev/Backend/best-practices#benefits) * [Examples](https://docs.pendle.finance/boros-dev/Backend/best-practices#examples) * [Transaction Submission](https://docs.pendle.finance/boros-dev/Backend/best-practices#transaction-submission) * [`direct-call` vs `bulk-direct-call`](https://docs.pendle.finance/boros-dev/Backend/best-practices#direct-call-vs-bulk-direct-call) * [`autoExitMarket` Parameter](https://docs.pendle.finance/boros-dev/Backend/best-practices#autoexitmarket-parameter) * [`skipReceipt` Parameter](https://docs.pendle.finance/boros-dev/Backend/best-practices#skipreceipt-parameter) * [Market Management](https://docs.pendle.finance/boros-dev/Backend/best-practices#market-management) * [Exit Unused Markets](https://docs.pendle.finance/boros-dev/Backend/best-practices#exit-unused-markets) * [When to Exit Markets](https://docs.pendle.finance/boros-dev/Backend/best-practices#when-to-exit-markets) * [Isolated-Only Markets](https://docs.pendle.finance/boros-dev/Backend/best-practices#isolated-only-markets) * [Gas Usage and Estimation](https://docs.pendle.finance/boros-dev/Backend/best-practices#gas-usage-and-estimation) * [Monitor Gas Balance](https://docs.pendle.finance/boros-dev/Backend/best-practices#monitor-gas-balance) * [Arbitrum Gas Spikes](https://docs.pendle.finance/boros-dev/Backend/best-practices#arbitrum-gas-spikes) * [Error Handling](https://docs.pendle.finance/boros-dev/Backend/best-practices#error-handling) * [Error Response Formats](https://docs.pendle.finance/boros-dev/Backend/best-practices#error-response-formats) * [Handling Common Errors](https://docs.pendle.finance/boros-dev/Backend/best-practices#handling-common-errors) * [Retry Strategy](https://docs.pendle.finance/boros-dev/Backend/best-practices#retry-strategy) * [Simulation Before Execution](https://docs.pendle.finance/boros-dev/Backend/best-practices#simulation-before-execution) * [Real-Time Data](https://docs.pendle.finance/boros-dev/Backend/best-practices#real-time-data) * [Market Data Latency](https://docs.pendle.finance/boros-dev/Backend/best-practices#market-data-latency) * [Combined Order Book (AMM + Order Book)](https://docs.pendle.finance/boros-dev/Backend/best-practices#combined-order-book-amm--order-book) * [Use WebSocket for Streaming](https://docs.pendle.finance/boros-dev/Backend/best-practices#use-websocket-for-streaming) * [Caching Strategy](https://docs.pendle.finance/boros-dev/Backend/best-practices#caching-strategy) * [Market Maker Order Flow](https://docs.pendle.finance/boros-dev/Backend/best-practices#market-maker-order-flow) * [Full Flow](https://docs.pendle.finance/boros-dev/Backend/best-practices#full-flow) * [`requireSuccess` Parameter (Send Txs Bot)](https://docs.pendle.finance/boros-dev/Backend/best-practices#requiresuccess-parameter-send-txs-bot) * [Security](https://docs.pendle.finance/boros-dev/Backend/best-practices#security) * [Key Management](https://docs.pendle.finance/boros-dev/Backend/best-practices#key-management) * [Transaction Verification](https://docs.pendle.finance/boros-dev/Backend/best-practices#transaction-verification) * [Summary](https://docs.pendle.finance/boros-dev/Backend/best-practices#summary) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # High Level Architecture | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#__docusaurus_skipToContent_fallback) On this page Use the API For most integrations, interact with Boros through the [REST API](https://docs.pendle.finance/boros-dev/Backend/api) and [SDK](https://docs.pendle.finance/boros-dev/Backend/overview) rather than calling contracts directly. The API handles calldata encoding, settlement, and transaction submission. The contract details below are provided as an architectural reference. Core Contracts[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#core-contracts "Direct link to Core Contracts") ------------------------------------------------------------------------------------------------------------------------------ graph TD Router --> MarketHub MarketHub --> Market-1 MarketHub --> Market-2 MarketHub --> Market-3 MarketHub --> ... MarketHub --> Market-n Router authenticates and forwards user operations to MarketHub. MarketHub receives user operations from Router, forwards them to the correct market contract, settles fees/payment, and checks that accounts fulfill the margin requirements. Market executes user operations from MarketHub, then returns payment amount and data for margin checking. ### Router[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#router "Direct link to Router") Router is the gateway to the Boros protocol. Its main functionality is authentication and authorization. Transactions can be sent to Router in two ways: * Direct call where `msg.sender` is used as user address * Agent call where user signs messages of desired operations * Only available to Pendle's permissioned relayers * Accessed through the [Boros SDK](https://docs.pendle.finance/boros-dev/Backend/overview) ### MarketHub[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#markethub "Direct link to MarketHub") MarketHub is the market coordinator and risk manager of Boros. MarketHub holds user deposits and keeps track of users in the system and the markets that they have entered. Users are identified by MarketAcc, a custom type made of: * user EVM address * subaccountID * Every user has up to 256 subaccounts, though only subaccount 0 is available for direct calls * tokenId * Every collateral token has a specific ID inside Boros. A given MarketAcc can only interact with markets of that collateral token. * marketId * For an isolated-margin account, this is the marketId of the market that this account operates on. * For a cross-margin account, this is a special value _CROSS_, equal to 224−12^{24}-1224−1. An account can enter a single market, if it is isolated, or multiple markets, if it is _CROSS_. Every market represents a different interest rate swap type: different token, different maturity, different reference rate. However, every market entered by a given account must share the same collateral token. After each user operation, MarketHub checks that accounts fulfill the [margin requirements](https://docs.pendle.finance/boros-dev/Mechanics/Margin) . ### Market[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#market "Direct link to Market") Boros markets are deployed as separate contracts. Markets are differentiated by their descriptors: - bool isIsolatedOnly- TokenId tokenId- MarketId marketId- uint32 maturity- uint8 tickStep- uint16 iTickThresh- uint32 latestFTime Market provides an on-chain [central limit order book](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook) , as well as over-the-counter (OTC) trading. For each user, market keeps track of position size and list of orders. When an order is filled, or an OTC trade is made, the position size is updated accordingly, and the fixed interest is paid upfront. Variable interest payments are paid on a fixed time period; the payment amount is determined by the accrual of the variable interest since last update, which is reported on-chain via an oracle. ### AMM[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#amm "Direct link to AMM") Automated Market Makers (AMM) provide continuous liquidity alongside the order book. In Boros, AMMs are like normal accounts: they don't have any special permissions except that they can perform OTC trades with users when requested. Router ensures optimal liquidity routing between AMMs and order book for best swap rate. More details about AMM can be found in the [whitepaper](https://github.com/pendle-finance/boros-core-public/blob/main/whitepapers/AMM.pdf) . Supporting Contracts[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#supporting-contracts "Direct link to Supporting Contracts") ------------------------------------------------------------------------------------------------------------------------------------------------ ### FIndex Oracle[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#findex-oracle "Direct link to FIndex Oracle") Each market has an associated FIndex Oracle that provides the floating rate data used in [periodic settlement](https://docs.pendle.finance/boros-dev/Mechanics/Settlement) . The oracle reports the cumulative floating index and fee index, which are packed into the [`FIndex`](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#findex) type. Oracle updates trigger settlement calculations for all positions in the market. The oracle address is configured per market and can be queried via [`getMarketConfig()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarketconfig) . ### Deposit Box[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#deposit-box "Direct link to Deposit Box") Deposit Boxes are deterministic per-user contracts created by the `DepositBoxFactory`. They serve as intermediary wallets for receiving cross-chain deposits and performing token swaps (via external DEX routers) before depositing into Boros. Funds in Deposit Boxes are managed by Pendle's backend — users do not interact with them directly. The factory computes a deterministic address from `(root, boxId)` so senders can pre-calculate the deposit target. ### Bot Infrastructure[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#bot-infrastructure "Direct link to Bot Infrastructure") Pendle operates permissioned bots that perform automated risk management on behalf of the protocol. These bots can affect user positions and orders: * **Liquidation Bot**: Liquidates accounts whose [health ratio](https://docs.pendle.finance/boros-dev/Mechanics/Margin#health-ratio) drops to 1.0 or below * **Force-Cancel Bot**: Cancels open orders for accounts approaching liquidation, or orders with rates that deviate too far from the mark rate (see [Risk Management Actions](https://docs.pendle.finance/boros-dev/Mechanics/Margin#risk-management-actions) ) * **CLO Bot**: Toggles markets into [Close-Only mode](https://docs.pendle.finance/boros-dev/Mechanics/Margin#closing-only-mode) when open interest approaches risk limits Users should monitor their [order status](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderstatus) and account health, especially during volatile market conditions, as these bots may modify open orders or trigger liquidations. Token Decimals[​](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#token-decimals "Direct link to Token Decimals") ------------------------------------------------------------------------------------------------------------------------------ Internally, Boros uses 18-decimals fixed point for all numerical values, including position size, payment, fees, etc. When depositing ERC20 tokens of non-18 decimals, the amount will be scaled up. Similarly, when withdrawing, the amount will be scaled down. Tokens with decimals greater than 18 are not supported. * [Core Contracts](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#core-contracts) * [Router](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#router) * [MarketHub](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#markethub) * [Market](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#market) * [AMM](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#amm) * [Supporting Contracts](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#supporting-contracts) * [FIndex Oracle](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#findex-oracle) * [Deposit Box](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#deposit-box) * [Bot Infrastructure](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#bot-infrastructure) * [Token Decimals](https://docs.pendle.finance/boros-dev/HighLevelArchitecture#token-decimals) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Points Trading | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#__docusaurus_skipToContent_fallback) On this page Facing problems? Head to our [Support](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page) page! Assets with Points on Pendle are consolidated into our Points UI: [https://app.pendle.finance/points](https://app.pendle.finance/points) Get leveraged points, yields or get the highest fixed yields on Pendle supercharged by points trading! Definition[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#definition "Direct link to Definition") ---------------------------------------------------------------------------------------------------------------------------------------- Points trading on Pendle works the same way as yield-trading where: * YT buyers receive underlying floating yields and points * PT buyers receive a fixed yield in exchange for foregoing all floating yields and points * Liquidity Providers receive additional yields from swap fees and Pendle incentives while retaining points exposure (with zero price impact enabled) In other words, underlying points are treated the same way as the underlying yields. This includes 5% YT fees incurred on underlying yields and points. YT[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#yt "Direct link to YT") ---------------------------------------------------------------------------------------------------------------- Where to buy YT: [https://app.pendle.finance/points](https://app.pendle.finance/points) **Each YT lets you receive the yield and points of 1 unit of the underlying asset until maturity. (1 ETH, 1 USDC, etc)** YT is worth **ZERO at maturity** as it no longer generates any yield and points. ![](https://docs.pendle.finance/pendle-academy//pendle-academy/imgs/image%20(16).png) In the image above, 1 ETH enables you to purchase 13.2 YT. In other words, you’re using 1 ETH to purchase 13.2 ETH worth of ezETH yield and points until maturity. Note that positions on Pendle are not locked and **you can sell YT anytime at market rate**. Click on the arrows below the input box to switch the input and output assets. PT[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#pt "Direct link to PT") ---------------------------------------------------------------------------------------------------------------- Where to buy PT: [https://app.pendle.finance/points](https://app.pendle.finance/points) **Each PT will be redeemable for 1 unit worth of the underlying asset deposited into the underlying protocol at maturity (e.g. 1 ETH worth of ezETH, 1 USDe worth of sUSDe, 1 DAI worth of sDAI, etc).** As the final value of PT is known, the difference between its current price and its value at maturity, is PT’s fixed yield. Since PT holders forego all its underlying yields and points to its YT counterpart, PT’s value trades at a discount. At maturity when YT stops accruing yields and points, PT is made whole again, redeemable for the full value of its underlying (1 ETH, 1 USD, etc). ![](https://docs.pendle.finance/pendle-academy//pendle-academy/imgs/image%20(19).png) In the image above, 1 ETH enables you to purchase 1.15 PT. In other words, you’re foregoing points for a guaranteed 11.5% return until maturity. At the time of writing, that translates to ~30% APY. Note that positions on Pendle are not locked and **you can sell PT anytime at market rate**. Click on the arrows below the input box to switch the input and output assets. LP[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#lp "Direct link to LP") ---------------------------------------------------------------------------------------------------------------- Where to provide liquidity: [https://app.pendle.finance/points](https://app.pendle.finance/points) Liquidity Providers on Pendle retain all points exposure while earning additional yield from Pendle. **Turn on Zero price impact mode to retain the majority of your points exposure**. ![](https://docs.pendle.finance/pendle-academy//pendle-academy/imgs/image%20(20).png) LP position on Pendle consists of PT and a wrapped version of its underlying, e.g. PT-eETH/SY-eETH, PT-USDe/SY-USDe (SY is simply a wrapped version of its underlying to be compatible with Pendle's architecture). If Zero Price Impact mode is turned off, your YT position will be sold for a bigger LP position (hence incurring some price impact). This gives more yield but sacrifices points as the PTs in the LP position do not earn points. To retain most of your points exposure, toggle Zero Price Impact Mode to retain your YT position. While YT goes to zero at maturity, its value is offset by PT’s price gain inside the LP position. Note that points are affected by vePENDLE boosts too (i.e. Those that are unboosted might earn slightly less than those that are max boosted). In conclusion: LPs on Pendle retain all yield exposure and points while earning additional yields from swap fees and $PENDLE incentives. For maximum yield and points, boost your yields by locking vePENDLE or use liquid lockers such as Penpie and Equilibria. Point Multipliers on Pendle[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#point-multipliers-on-pendle "Direct link to Point Multipliers on Pendle") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Some assets on Pendle earn higher points than simply holding the underlying asset. This multiplier is given by the underlying protocol and is subject to change at any given notice. Refer to [this page](https://app.pendle.finance/trade/points) for the list of point-multipliers for the various assets on Pendle. > Holding naked SYs (i.e. SYs that are not in LP) DO NOT earn any Sats. > This is to discourage users from simply holding SY without providing any utility while negatively contributing towards the cap. SY in LP positions and YT will continue to earn Sats as per their multipliers. The point multipliers are given by the respective protocols. Disputes should be forwarded to the respective teams, not Pendle. ![](https://docs.pendle.finance/pendle-academy//pendle-academy/imgs/image%20(21).png) In the image above, 1 ETH enables you to purchase 9.3 ETH exposure of yields and points. Coupled with a 2x rsETH multiplier, 1 ETH purchases: * **9.35x** EigenLayer points * **18.7x** Kelp Miles * Yield from 9.35 rsETH FAQ[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#faq "Direct link to FAQ") ------------------------------------------------------------------------------------------------------------------- See [points-support-page.md](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page "mention") for the full FAQ. Please read through this page and the support page before asking the team questions. The information in this docs is correct. You do not have to ask the team for confirmation again. Happy yield (and points) trading. ☺️ * [Definition](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#definition) * [YT](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#yt) * [PT](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#pt) * [LP](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#lp) * [Point Multipliers on Pendle](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#point-multipliers-on-pendle) * [FAQ](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading#faq) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Margin | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Mechanics/Margin#__docusaurus_skipToContent_fallback) On this page Similar to other derivative exchanges, Boros supports both cross margin and isolated margin modes: * **Cross Margin**: Enables maximum capital efficiency by sharing collateral across multiple markets within the same collateral zone. A single collateral deposit can back positions across all markets in the zone, allowing unrealized profits in one market to offset potential losses in another. * **Isolated Margin**: Constrains collateral to a single market, providing position-level risk isolation. Liquidations in an isolated market only affect that specific position and do not impact other isolated positions or cross-margin positions. This document covers the essential concepts of the Boros margin system. For complete specifications, please refer to the [Boros whitepaper](https://github.com/pendle-finance/boros-core-public/blob/main/whitepapers/Boros.pdf) . Position Value and Total Value[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#position-value-and-total-value "Direct link to Position Value and Total Value") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Position Value[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#position-value "Direct link to Position Value") The position value represents the current unrealized profit or loss of an interest rate swap position: Position Value = Position Size × Mark Rate × Time to Maturity ### Total Value[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#total-value "Direct link to Total Value") A user's total value across all positions is calculated as: Total Value = Account Cash + Σ(Position Values across all markets) This total value determines the user's available margin for new positions and liquidation risk. Initial Margin[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#initial-margin "Direct link to Initial Margin") ------------------------------------------------------------------------------------------------------------------------- Initial margin requirements must be satisfied when opening new positions to ensure sufficient collateral backing. ### Pre-scaling Initial Margin[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#pre-scaling-initial-margin "Direct link to Pre-scaling Initial Margin") The pre-scaling initial margin (PIM) for each component is calculated as: Pre-scaling IM = |Size| × max(|Rate|, Rate Threshold) Where `Rate Threshold` (also known as the **rate floor**) is a market parameter that sets the minimum rate used for margin calculations. This prevents artificially low margin requirements on orders placed near 0% rate. The rate floor can be derived from the market's `imData.iTickThresh` field — convert this tick value to a rate using the standard [tick-to-rate formula](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#tick-to-rate-conversion) . If a limit order's absolute rate is less than the rate floor, the margin formula uses the rate floor instead of the order's actual rate. ### Combined Initial Margin[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#combined-initial-margin "Direct link to Combined Initial Margin") The system combines initial margin requirements from: 1. **Active Position**: Existing standalone position. 2. **Long Orders**: Unfilled buy orders 3. **Short Orders**: Unfilled sell orders PIM for the active position is calculated using the mark rate. PIM for orders is calculated using order rates. The calculation evaluates worst-case margin requirements for both long and short sides: **Long-side Pre-scaling IM:** * If current position is SHORT and total long order sizes ≤ |short position size|: Long PIM = 0 (orders only reduce position) * Otherwise: Long PIM = Sum of long orders' PIM + position PIM (adjusted for direction) **Short-side Pre-scaling IM:** * If current position is LONG and total short order sizes ≤ |long position size|: Short PIM = 0 (orders only reduce position) * Otherwise: Short PIM = Sum of short orders' PIM + position PIM (adjusted for direction) **Final Pre-scaling IM** = max(Long-side PIM, Short-side PIM) This ensures sufficient margin for the worst-case scenario where all orders on one side get filled. #### Examples[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#examples "Direct link to Examples") _Note: For simplicity, these examples ignore the rate threshold parameter and use the actual rates directly._ **Example 1: Long position with additional long orders** * Current position: LONG 1000 units at mark rate 5% * Open orders: LONG 500 units at 4.5% * Position PIM = 1000 × 5% = 50 * Long orders PIM = 500 × 4.5% = 22.5 * **Long-side PIM** = 50 + 22.5 = 72.5 (position and orders add up) * **Short-side PIM** = 0 (no short orders) * **Final PIM** = 72.5 **Example 2: Long position with small short orders (not enough to flip position)** * Current position: LONG 1000 units at mark rate 5% * Open orders: SHORT 600 units at 5.5% * Position PIM = 1000 × 5% = 50 * Short orders PIM = 600 × 5.5% = 33 * **Long-side PIM** = 50 (no long orders) * **Short-side PIM** = 0 (600 < 1000, orders only reduce position) * **Final PIM** = 50 **Example 3: Long position with large short orders (can flip position)** * Current position: LONG 1000 units at mark rate 5% * Open orders: SHORT 2500 units at 6% * Position PIM = 1000 × 5% = 50 * Short orders PIM = 2500 × 6% = 150 * **Long-side PIM** = 50 (no long orders) * **Short-side PIM** = 150 - 50 = 100 * **Final PIM** = 100 (Short-side PIM is larger) ### Final Initial Margin[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#final-initial-margin "Direct link to Final Initial Margin") The actual initial margin requirement scales the pre-scaling amount: Initial Margin = Pre-scaling IM × IM Factor × max(Time to Maturity, Time Threshold) **Note:** The IM Factor (`kIM`) and MM Factor (`kMM`) are global market parameters set in `MarketConfigStruct`. In some cases, individual accounts may have personal margin factors that differ from the global values (e.g., for whitelisted market makers). The effective factor for an account can be queried via [`getMarginFactor()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarginfactor) . ### Opening Position Requirements[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#opening-position-requirements "Direct link to Opening Position Requirements") To open new positions: Total Initial Margin (all markets) ≤ User's Total Value ### Margin Check for Closing Orders[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#margin-check-for-closing-orders "Direct link to Margin Check for Closing Orders") When initial margin requirements are not met, users can still place orders under "closing-only" conditions: * **Position Size Reduction**: Orders must reduce absolute position size (no position flipping) * **No Opposite Side Orders**: Cannot place orders on the opposite side of existing position * **Rate Bounds**: Closing rate must be within reasonable bounds from mark rate These relaxed conditions allow users to reduce risk even when under-collateralized. Maintenance Margin and Liquidation[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#maintenance-margin-and-liquidation "Direct link to Maintenance Margin and Liquidation") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Maintenance Margin[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#maintenance-margin "Direct link to Maintenance Margin") Maintenance margin represents the minimum collateral required to keep positions open: Maintenance Margin = |Position Size| × max(|Mark Rate|, Rate Threshold) × MM Factor × max(Time to Maturity, Time Threshold) ### Health Ratio[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#health-ratio "Direct link to Health Ratio") A user's health ratio indicates their margin safety: Health Ratio = Total Value / Total Maintenance Margin The system uses multiple health ratio thresholds to trigger progressive risk actions: | Threshold | Value | Action | | --- | --- | --- | | Healthy | \> 1.0 | Normal operations | | `riskyThresHR` | Approaching 1.0 | Risky orders may be force-cancelled (see [below](https://docs.pendle.finance/boros-dev/Mechanics/Margin#risk-management-actions)
) | | Liquidation | ≤ 1.0 | Position eligible for liquidation | | Deleverage | ≤ 0.7 | Forced deleverage as last resort | ### Liquidation Process[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#liquidation-process "Direct link to Liquidation Process") When a user's total value drops below maintenance margin requirements, their position becomes eligible for liquidation. Liquidation is a permissioned action carried out by Pendle to maintain protocol solvency. **Liquidation Mechanics:** 1. Position is closed (partially or fully) at current mark rate 2. Liquidator takes over the closed position 3. Liquidation incentive is transferred from liquidated user to liquidator **Liquidation Incentive:** Liquidation Incentive = min(Incentive Factor, Health Ratio) × Change in Maintenance Margin Where the **Incentive Factor** is calculated from the market's [`LiqSettings`](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#liqsettings) : Incentive Factor = LiqSettings.base + LiqSettings.slope × (1 - Health Ratio) A liquidation fee (`LiqSettings.feeRate`) is also charged on the liquidated position and collected by the protocol treasury. This structure provides larger incentives as positions become more distressed, encouraging timely liquidation. ### Forced Deleverage[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#forced-deleverage "Direct link to Forced Deleverage") When insufficient liquidity exists for normal liquidation and a user's health ratio continues declining to **0.7**, the system performs forced deleverage as a last resort. **Deleverage Process:** 1. Identifies accounts with opposite-side positions (typically highest leverage) 2. Forces a swap between distressed account and counterparty at mark rate 3. Total value across accounts remains unchanged 4. Maintenance margin requirements decrease, restoring account health **Important Notes:** * Forced deleverage is an emergency mechanism to protect protocol solvency * This action is not expected to occur frequently under normal market conditions * Priority targets are high-leverage positions on the opposite side ### Risk Management Actions[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#risk-management-actions "Direct link to Risk Management Actions") In addition to liquidation and deleverage, the protocol performs automated risk management to protect system solvency: **Force-Cancel of Risky Orders:** When an account's health ratio falls below `riskyThresHR`, all open orders for that account may be force-cancelled across all markets. This prevents further exposure from orders that could fill and worsen the account's position. **Out-of-Bound Order Purging:** Orders with rates that deviate too far from the current mark rate are periodically purged. The maximum allowed deviation is controlled by the market's `maxRateDeviationFactorBase1e4` parameter. Purged orders receive the [`PURGED`](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderstatus) status. This mechanism prevents stale or manipulative orders from remaining in the book. **Health-Jump Order Cancellation:** If a pending funding rate update would cause an account's health ratio to drop below the risky threshold, the system may proactively cancel orders that contribute to the potential health deterioration. note These actions are performed by Pendle's permissioned infrastructure. Users should monitor their order status and health ratio, especially during volatile market conditions. Additional Restrictions[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#additional-restrictions "Direct link to Additional Restrictions") ---------------------------------------------------------------------------------------------------------------------------------------------------- ### Hard Open Interest Cap[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#hard-open-interest-cap "Direct link to Hard Open Interest Cap") Boros implements a hard cap on total open interest to limit system-wide risk: Total Open Interest ≤ Hard OI Cap When the system approaches this limit, "Closing only" mode may be activated for risk management. ### Closing Only Mode[​](https://docs.pendle.finance/boros-dev/Mechanics/Margin#closing-only-mode "Direct link to Closing Only Mode") Markets can enter [CLO (Close-Only)](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketstatus) mode when open interest approaches the hard cap or during high-risk conditions. In this mode: * Only orders that reduce position size are allowed * New position opening is prohibited * Certain whitelisted accounts (e.g., market makers) may be exempt from CLO restrictions via the `exemptCLOCheck` flag The market's current status (PAUSED, CLO, or GOOD) can be queried via [`getMarketConfig()`](https://docs.pendle.finance/boros-dev/Contracts/Market#getmarketconfig) . * [Position Value and Total Value](https://docs.pendle.finance/boros-dev/Mechanics/Margin#position-value-and-total-value) * [Position Value](https://docs.pendle.finance/boros-dev/Mechanics/Margin#position-value) * [Total Value](https://docs.pendle.finance/boros-dev/Mechanics/Margin#total-value) * [Initial Margin](https://docs.pendle.finance/boros-dev/Mechanics/Margin#initial-margin) * [Pre-scaling Initial Margin](https://docs.pendle.finance/boros-dev/Mechanics/Margin#pre-scaling-initial-margin) * [Combined Initial Margin](https://docs.pendle.finance/boros-dev/Mechanics/Margin#combined-initial-margin) * [Final Initial Margin](https://docs.pendle.finance/boros-dev/Mechanics/Margin#final-initial-margin) * [Opening Position Requirements](https://docs.pendle.finance/boros-dev/Mechanics/Margin#opening-position-requirements) * [Margin Check for Closing Orders](https://docs.pendle.finance/boros-dev/Mechanics/Margin#margin-check-for-closing-orders) * [Maintenance Margin and Liquidation](https://docs.pendle.finance/boros-dev/Mechanics/Margin#maintenance-margin-and-liquidation) * [Maintenance Margin](https://docs.pendle.finance/boros-dev/Mechanics/Margin#maintenance-margin) * [Health Ratio](https://docs.pendle.finance/boros-dev/Mechanics/Margin#health-ratio) * [Liquidation Process](https://docs.pendle.finance/boros-dev/Mechanics/Margin#liquidation-process) * [Forced Deleverage](https://docs.pendle.finance/boros-dev/Mechanics/Margin#forced-deleverage) * [Risk Management Actions](https://docs.pendle.finance/boros-dev/Mechanics/Margin#risk-management-actions) * [Additional Restrictions](https://docs.pendle.finance/boros-dev/Mechanics/Margin#additional-restrictions) * [Hard Open Interest Cap](https://docs.pendle.finance/boros-dev/Mechanics/Margin#hard-open-interest-cap) * [Closing Only Mode](https://docs.pendle.finance/boros-dev/Mechanics/Margin#closing-only-mode) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # \$PENDLE Farms | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/usdpendle-farms#__docusaurus_skipToContent_fallback) On this page > The information on this page was last updated: 2025-02-06 💡 Please note that there are many options available for $PENDLE beyond what's mentioned in this document, e.g. LP on liquidity pools, lend $PENDLE on lending markets, and more, to name a few. These strategies are developed by 3rd parties that are _not_ part of the Pendle team, _nor_ officially endorsed by Pendle. As always, **do your own research** and **understand the risks** when putting your assets to work in DeFi. Read the full disclaimer at the bottom of the page. ### Vote-escrowed PENDLE (vePENDLE)[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/usdpendle-farms#vote-escrowed-pendle-vependle "Direct link to Vote-escrowed PENDLE (vePENDLE)") * Developed by Pendle, **vote-escrowed PENDLE (vePENDLE) represents your governance share, and gives you access to protocol revenue and reward boost on Pendle**. Lock $PENDLE for up to 2 years, your vePENDLE value is proportional to the amount and duration locked. The value decays over time and when it reaches zero your PENDLE is fully unlocked. * to create/update lock, start here: [https://app.pendle.finance/vependle/lock](https://app.pendle.finance/vependle/lock) * Single-token exposure, so there is no impermanent loss (IL) involved. * vePENDLE holders are entitled to: * Base APY * 5% fee collected from yield produced by all YT * 100% yield from all matured unredeemed PT * Voter’s APY * vePENDLE holders vote for and direct the flow of rewards to different pools, effectively incentivizing liquidity in the pool they vote for * earn 80% of the swap fees from the pools you voted * LP reward boost 🔥 * $PENDLE incentives and rewards for all of your LPs will be boosted by up to 250% based on your vePENDLE value * Practically, this strategy is suitable for larger capitals who LPs into many Pendle LP pools because the LP reward boost is the most valuable benefit. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(111).png) vePENDLE yields 💡 Learn more about the mechanics of vePENDLE in the [documentations](https://docs.pendle.finance/ProtocolMechanics/Mechanisms/vePENDLE) . * * * 💡 **DISCLAIMER** _This article is for informational purposes only and does not constitute financial, legal, or professional advice. Pendle is not responsible for any actions or consequences that may result from the use of the information or third-party integrations presented in this article. The third-party integrations are provided as examples and do not imply endorsement, recommendation, or affiliation by Pendle or the author. Users should do their own research and due diligence before using any third-party integration or service in the decentralized finance (DeFi) space. Pendle makes no warranty of accuracy, completeness, reliability, or suitability of the information or third-party integrations in this article. Pendle disclaims all liability for any loss, damage, injury, or expense that may arise from the use of or reliance on the information or third-party integrations in this article._ * [Vote-escrowed PENDLE (vePENDLE)](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/usdpendle-farms#vote-escrowed-pendle-vependle) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Withdrawals / Deposits from Other Chains | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/withdrawals-deposits-from-other-chains#__docusaurus_skipToContent_fallback) On this page Pendle exists in multiple chains + L2s and certain assets that Pendle supports on these chains might not be native to the chain. These assets might have liquidity constraints on external DEXes which can affect user experience on Pendle, especially when interacting via a different asset (e.g: Using USDT to purchase PT-sUSDE on Arbitrum -> Pendle will utilize external DEXes to swap USDT to sUSDE prior to purchasing PT). To avoid heavy price impacts from external DEXes in such situations, you can consider interacting with the asset's home chain (usually Ethereum mainnet): #### Withdrawal Guide for non-native assets in L2:[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/withdrawals-deposits-from-other-chains#withdrawal-guide-for-non-native-assets-in-l2 "Direct link to Withdrawal Guide for non-native assets in L2:") 1. Bridge to Ethereum Mainnet 1. Use the underlying protocol's dedicated bridge (if any, refer to the respective protocol's docs for more info) 2. Or use your preferred bridge aggregator 2. Withdraw natively via the underlying protocol 1. Go to the underlying protocol's website / dApp and withdraw. If the same asset is available on Pendle on Ethereum, check out the info page for the URL.![](https://docs.pendle.finance/assets/images/image-7c15d56a6be9a39948491b368a8532e6.png) #### Deposit Guide for non-native assets in L2:[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/withdrawals-deposits-from-other-chains#deposit-guide-for-non-native-assets-in-l2 "Direct link to Deposit Guide for non-native assets in L2:") 1. Deposit natively via the underlying protocol 1. Go to the underlying protocol's website / dApp. If the same asset is available on Pendle on its home chain, check out the info page for the URL. ![](https://docs.pendle.finance/assets/images/image-7c15d56a6be9a39948491b368a8532e6.png) 2. Bridge to the destination network 1. Use the underlying protocol's dedicated bridge (if any, refer to the respective protocol's docs for more info) 2. Or use your preferred bridge aggregator Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 2 - Yield Tokenization Basics | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#__docusaurus_skipToContent_fallback) On this page > Course level: **#beginner** TL;DR[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#tldr "Direct link to TL;DR") -------------------------------------------------------------------------------------------------------------------------------- Yield tokenization means splitting a yield-bearing asset into its two components: the **principal** and the **yield** components. A yield-bearing asset is an asset that generates yield over time (e.g. stETH, Uniswap LP Token, sDAI, etc). To better illustrate this, we can look at the example of a **real estate property.** A real estate property is a yield-bearing asset, where it generates rental yield to the owner of the property. Now imagine a real estate property that’s been split into 2 components: * The rights to the ownership of the property. You can think of this as the **Principal**. * The rights to the rental income of the property, which can grant its owner the right collect all the rental income (AKA yield) generated by the property for a certain length of time. You can think of this as the **Yield**. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(35).png) 1 PT + 1 YT = 1 Underlying Asset At any point in time, you can combine both to get the whole property: With stETH as an example: **Principal** (Right to Principal of stETH) + **Yield** (Rights to stETH yield) = **Yield-bearing asset** (stETH) When you tokenize the yield, you can sell or trade the Yield portion even before maturity. This creates new ways to manage and even speculate on yield. Let’s say the maturity date is in 1 year: ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(39).png) * You can buy the Rights to Ownership at **a lower price** than an actual property. After 1 year, the rights entitle you to redeem the property. The guaranteed value appreciation from the discounted value of paper ownership → owning the property at its full value constitutes the fixed yield/income. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(38).png) * You can also buy only the yield portion (the Rights to Rental Payments) to receive rent for 1 year. Assuming this costs $5000, you’ll profit when you collect more than $5000 within the year or suffer a loss when it yields less. Buying this lets you speculate on the property “yield”. Think the rental price is going up soon and you want some exposure? Buy the “yield” instead of paying the whole property price. 💡 Pendle is a marketplace where property owners can split and trade their principal (rights to the underlying) and yield (rights to rental payments) separately. Both Principal and Yield position can be sold anytime (no lockup) even before the maturity is up. PT & YT in Pendle[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#pt--yt-in-pendle "Direct link to PT & YT in Pendle") -------------------------------------------------------------------------------------------------------------------------------------------------------------------- DeFi pools gives you a yield-bearing position in return for staking or depositing tokens. In Pendle, the yield-bearing position can be split into two components: * **YT (Yield Token) -> representing the yield-receivables of the position** * **PT (Principal Token) -> representing the principal amount** When yield is tokenized, there is a **maturity** associated with the tokenization, demonstrated below. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(97).png) The $ value sum of PT and YT should equate to its underlying as they’re individual parts of a whole. You can redeem the underlying by depositing equal amount of PTs and YTs. On maturity, PT can be redeemed for its underlying without its YT counterpart (This is because matured YT have 0 value as they no longer generate yield). 💡 You can tokenize the yield-bearing tokens on Pendle by selecting any of the assets on Pendle in the Market page, and select the “Mint tab” at the left-hand side of the page. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(98).png) Minting PT and YT (Yield Tokenization) ### **What are PT and YT exactly?**[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#pt-and-yt-in-pendle "Direct link to pt-and-yt-in-pendle") Here are the definitions of **PT** and **YT**: * **1 YT gives you the right to receive the yield of 1 unit of the accounting asset (e.g. 1 ETH, 1 DAI, 1 USDe, etc) until maturity, claimable in real-time.** * **1 PT gives you the right to redeem 1 unit of the accounting asset (e.g. 1 ETH, 1 DAI, 1 USDe, etc) upon maturity.** Using an example of sUSDe from Ethena, the naming convention for PT and YT is: * 1 YT-sUSDe (USDe) * 1 PT-sUSDe (USDe) With that example, the definition of PT and YT is: * 1 YT-sUSDe (USDe) -> Receive the yield of 1 USDe worth of sUSDe * 1 PT-sUSDe (USDe) -> Will be redeemable for 1 USDe worth of sUSDe * 1 YT-HLP (USDC) -> Receive the yield of 1 USDC worth of HLP * 1 PT-HLP (USDC) -> Will be redeemable for 1 USDC worth of HLP ### What can you do with PT & YT?[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#what-can-you-do-with-pt--yt "Direct link to What can you do with PT & YT?") #### Before Maturity:[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#before-maturity "Direct link to Before Maturity:") 1. PT and YT can be minted from the underlying asset.\\ ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(100).png) 2. PT and YT can be redeemed back into its underlying asset\\ ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(102).png) 3. YT holders can claim any accrued yield in real-time.\\ ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(103).png) #### After Maturity[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#after-maturity "Direct link to After Maturity") * PT holders can redeem underlying asset 1:1 without YT.\\ ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(104).png) #### **Anytime**[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#anytime "Direct link to anytime") You can **buy and sell PT and YT** on the open market using Pendle AMM. As such, PT and YT will always have a market price. We will talk more about trading PT and YT in the next chapters. ### **The PT / YT equation**[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#the-pt--yt-equation "Direct link to the-pt--yt-equation") PT Price + YT Price = Accounting Asset Price Since **1 unit of underlying asset mints 1 PT + 1 YT** and **1 PT + 1 YT redeems for 1 unit of the accounting asset**, there is an obvious relationship between their prices: The Pendle AMM ensures that this relationship holds true at all times. * * * Analogy of PT & YT in TradFi[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#analogy-of-pt--yt-in-tradfi "Direct link to Analogy of PT & YT in TradFi") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- In TradFi, what Pendle does is similar to bond stripping. The principal and interest of bonds are separated, so PTs are equivalent to [zero-coupon bonds](https://www.investopedia.com/terms/z/zero-couponbond.asp) , while YTs are the detached [coupons](https://www.investopedia.com/terms/c/coupon.asp) . #### PT is the DeFi zero-coupon bond[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#pt-is-the-defi-zero-coupon-bond "Direct link to PT is the DeFi zero-coupon bond") ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(44).png) A zero-coupon bond is a type of bond that does not pay any interest to the bondholder during the life of the bond. Instead, the bond is **sold at a deep discount** to its face value, and the **bondholder receives the full face value when the bond matures**. The difference between the purchase price and the face value is the investor’s return or profit. For example, if you buy a zero-coupon bond for $800 that has a face value of $1,000 and matures in 3 years, you will receive $1,000 at maturity and earn a profit of $200 for the 3 years of investment. Again, you don’t need to hold bonds to maturity, you can sell them on the open market at any time at market price. #### YT is the DeFi detached coupon[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#yt-is-the-defi-detached-coupon "Direct link to YT is the DeFi detached coupon") A detached coupon is a part of a coupon bond that has been separated from the bond and can be traded or sold separately. A coupon bond is a type of bond that pays regular interest payments to the bondholder until the bond matures. The interest payments are called coupons, and they are usually attached to the bond certificate. A detached coupon is a coupon that has been **cut off from the certificate** and **can be redeemed for cash by anyone who holds it**. For example, if you have a coupon bond that pays $50 every year for 3 years and you detach the coupons, you can sell it to someone else to wishes to claim that $150 over the 3 years. A person who buys the detached coupon below $150 makes a profit over the 3 years. 💡 The detached coupons can also be sold to the open market at any time at market price. > Additional reading: [Coupon Bond Vs. Zero Coupon Bond: What's the Difference? (investopedia.com)](https://www.investopedia.com/ask/answers/06/zerocouponregularbond.asp) * [TL;DR](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#tldr) * [PT & YT in Pendle](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#pt--yt-in-pendle) * [**What are PT and YT exactly?**](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#pt-and-yt-in-pendle) * [What can you do with PT & YT?](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#what-can-you-do-with-pt--yt) * [**The PT / YT equation**](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#the-pt--yt-equation) * [Analogy of PT & YT in TradFi](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#analogy-of-pt--yt-in-tradfi) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Settlement | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#__docusaurus_skipToContent_fallback) On this page In Boros, settlement refers to the position update when a trade happens (e.g., market order placed, limit order filled) and the periodic floating payment. ### Trade Settlement[​](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#trade-settlement "Direct link to Trade Settlement") When a trade is executed (e.g., a market order fills against limit orders), traders must pay an upfront fixed cost immediately. This upfront cost represents the present value of the fixed rate component of the interest rate swap for the remaining time to maturity. **Formula:** Upfront Cost\=Order Size×Order Rate×Time to MaturityYEAR\\text{Upfront Cost} = \\text{Order Size} \\times \\text{Order Rate} \\times \\frac{\\text{Time to Maturity}}{\\text{YEAR}}Upfront Cost\=Order Size×Order Rate×YEARTime to Maturity​ Where: * **Order Size**: The notional amount of the trade * **Order Rate**: The fixed interest rate agreed upon in the trade * **Time to Maturity**: `maturity - latestFTime` (in seconds) * `maturity`: The market's expiration timestamp * `latestFTime`: The timestamp of the last periodic payment * **YEAR**: 365 days in seconds (31,536,000) * Both `maturity` and `latestFTime` can be retrieved from `market.descriptor()` **Example:** For a market with 8-hour payment periods: * If current time is 10:00 UTC * The `latestFTime` would be 8:00 UTC (the last 8-hour boundary) **Direction of Payment:** * **Long positions**: Pay upfront cost to receive floating rate * **Short positions**: Receive upfront cost to pay floating rate ### Floating Rate Settlement[​](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#floating-rate-settlement "Direct link to Floating Rate Settlement") Floating rate payments occur periodically (e.g., every 8 hours) to exchange the difference between fixed and floating rates. These payments are calculated based on the position size and the change in the floating index. **Formula:** Floating Payment\=Signed Position Size×ΔFloating Index\\text{Floating Payment} = \\text{Signed Position Size} \\times \\Delta\\text{Floating Index}Floating Payment\=Signed Position Size×ΔFloating Index Where: * **Signed Position Size**: Positive for long positions, negative for short positions * **ΔFloating Index**: The change in floating index since the last settlement **Floating Index:** The floating index is a cumulative value that represents the total yield earned by 1 unit of the underlying asset since inception. **Example:** Consider a perpetual futures funding rate scenario: * If the funding rate on Binance for the last 8-hour epoch is 0.0001 (0.01%) * The ΔFloating Index would be 0.0001 * A long position of 100 units would receive: `100 × 0.0001 = 0.01` units * A short position of 100 units would receive: `-100 × 0.0001 = -0.01` units (negative payment means paying) **Fees:** Floating payments are subject to settlement fees. For detailed fee structure, see [Fees](https://docs.pendle.finance/boros-dev/Mechanics/Fees) . Algorithm[​](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#algorithm "Direct link to Algorithm") -------------------------------------------------------------------------------------------------------------- In traditional order books, when a market order matches against limit orders, all makers' positions are updated immediately. On-chain, this becomes prohibitively expensive as a single order could match against hundreds or thousands of limit orders, each requiring storage updates. Boros solves this by using a lazy settlement process that defers the position update until the next time users interact with Boros. Since the last time a user interacted with Boros, multiple events may have occurred that affect their position: * Limit orders could have been filled * Floating rate settlements could have occurred * These events can interleave in complex patterns The settlement algorithm processes all pending events in chronological order to ensure correctness: 1. **Event Collection**: Gather all events since the user's last settlement: * Filled limit orders (grouped by the `fTime` when they were filled) * Floating payment settlements at each `fTime` boundary 2. **Chronological Processing**: Iterate through events by `fTime`: For each fTime period: a. Process all filled orders from that period - Calculate and apply upfront costs - Update position sizes b. Process floating payment for that period - Calculate payment based on position size at settlement time - Apply floating index changes c. Continue to next fTime period 3. **State Update**: After processing all events: * Update user's final position size * Update user's cash balance * Update user's last settlement timestamp **Example Timeline:** 08:00 16:00 (fTime) 18:00 (now) |─────────────────|──────────────────────| │ Period 1 │ Period 2 │ │ │ │ ↓ 09:30 ↓ 16:00 ↓ 17:15 Fill Float pay Fill (100 units) settlement (50 units) Processing order: 1. Process fills in Period 1 (08:00–16:00): apply fill at 09:30, updating position size to 100 units 2. Process floating payment at 16:00 boundary: settle on the current position size (100 units) 3. Process fills in Period 2 (16:00–18:00): apply fill at 17:15, updating position size to 150 units Notes[​](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#notes "Direct link to Notes") -------------------------------------------------------------------------------------------------- Due to lazy settlement, on-chain state may not reflect the latest position values and balances. Query functions ending with `NoSettle` return raw, unsettled data that may be outdated. **Getting Up-to-Date Data:** To retrieve current, accurate position information, you must first trigger settlement: IMarketHub(marketHub).settleAllAndGet(acc, GetRequest.ZERO, MarketId.ZERO); You can also use the [REST API](https://docs.pendle.finance/boros-dev/Backend/api) , which provides accurate, up-to-date data without requiring manual settlement triggers. **Strategic Position Management:** Floating payments are calculated based on your position size at the exact payment timestamp. This creates an opportunity for strategic position management: * **Avoiding Payments**: You can close or reduce your position before the payment time to minimize floating payments * **Payment Timing**: Payments occur at regular intervals (e.g., every 8 hours) * **Position Size Matters**: Only the position size at the payment timestamp is used for calculation **Settlement Timing:** Floating rate settlements are triggered by off-chain oracle updates and occur at regular intervals: * **Settlement frequency**: Typically every hour (but varies by market) * **Expected settlement time**: Approximately **30 seconds after the hour** (e.g., 08:00:30 UTC) * **Exceptional cases**: During extreme market volatility or high/low settlement values that could push users' health ratios near zero, settlements may be delayed while the system runs additional risk management operations (e.g., liquidation bots) **Oracle Update Delays:** In practice, floating payments don't occur at the exact period boundaries due to off-chain oracle update delays: * **Expected Time**: Payment for 8:00:00 boundary * **Actual Time**: Usually occurs ~30 seconds later (e.g., 8:00:30) * [Trade Settlement](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#trade-settlement) * [Floating Rate Settlement](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#floating-rate-settlement) * [Algorithm](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#algorithm) * [Notes](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#notes) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Central Limit Order Book | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#__docusaurus_skipToContent_fallback) On this page Boros implements a gas-optimized central limit order book (CLOB) specifically designed for the EVM. The order book architecture minimizes gas costs through [lazy settlement](https://docs.pendle.finance/boros-dev/Mechanics/Settlement) and efficient data structures while maintaining the functionality expected from professional trading platforms. Order Book Structure[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#order-book-structure "Direct link to Order Book Structure") ---------------------------------------------------------------------------------------------------------------------------------------------- The order book consists of two independent sides: * **Long Side (Bids)**: Orders to buy/go long on interest rates * **Short Side (Asks)**: Orders to sell/go short on interest rates Each side contains **65,536 discrete rate levels** (ticks) ranging from -32768 to 32767. The tick system uses an exponential function to map discrete tick indices to interest rates. This design provides: * **Compactness**: Entire rate range expressed with just 16 bits * **Expressiveness**: Finer granularity near zero, coarser at extremes * **Symmetry**: Equal precision for positive and negative rates The tick spacing is configurable per market via the `tickStep` parameter. A larger `tickStep` creates wider rate intervals between ticks, suitable for more volatile markets. Tick vs Rate[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#tick-vs-rate "Direct link to Tick vs Rate") ---------------------------------------------------------------------------------------------------------------------- **Ticks are for the order book only.** The order book uses integer tick values to represent discrete rate levels. The AMM, on the other hand, operates with continuous **rates** (not ticks). This distinction is important: * **Order placement** requires an integer `tick` value — you cannot place orders at arbitrary rates * **AMM implied rate** is a continuous value and does not correspond to any specific tick * **Mid APR** is typically `(bestBid + bestAsk) / 2` or the AMM implied rate, which is a continuous value that generally cannot be expressed as an integer tick * When converting a rate to a tick for order placement, you must **round** to the nearest valid tick — this introduces a small rounding difference Tick to Rate Conversion[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#tick-to-rate-conversion "Direct link to Tick to Rate Conversion") ------------------------------------------------------------------------------------------------------------------------------------------------------- The conversion between tick indices and interest rates follows an exponential formula: rate(tick)\={1.00005tick×tickStep−1if tick≥0−(1.00005−tick×tickStep−1)if tick<0\\text{rate}(\\text{tick}) = \\begin{cases} 1.00005^{\\text{tick} \\times \\text{tickStep}} - 1 & \\text{if tick} \\geq 0 \\\\ -(1.00005^{-\\text{tick} \\times \\text{tickStep}} - 1) & \\text{if tick} < 0 \\end{cases}rate(tick)\={1.00005tick×tickStep−1−(1.00005−tick×tickStep−1)​if tick≥0if tick<0​ The TickMath library provides conversion between tick indices and interest rates: // Convert tick to interest rateint128 rate = TickMath.getRateAtTick(tick, tickStep);// Formula: rate = 1.00005^(tick * tickStep) - 1 for tick >= 0// rate = -(1.00005^(-tick * tickStep) - 1) for tick < 0 ### Examples[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#examples "Direct link to Examples") // tickStep = 2tick = 0 -> rate = 0% (neutral)tick = 100 -> rate = 1.00005^200 - 1 ≈ 1.005%tick = -100 -> rate = -(1.00005^200 - 1) ≈ -1.005% Matching Priority[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#matching-priority "Direct link to Matching Priority") ------------------------------------------------------------------------------------------------------------------------------------- Boros order book follows the standard **rate-time priority** matching: * Orders offering better rates are matched first * For long orders: Higher rates (willing to pay more) have priority * For short orders: Lower rates (willing to receive less) have priority * Within the same rate level (tick), orders are matched in the order they were placed (FIFO) * The `orderIndex` within each tick determines the exact queue position Order Id[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#order-id "Direct link to Order Id") ---------------------------------------------------------------------------------------------------------- Each order in Boros has a unique order Id **within its market**. The combination of **(Market ID, Order ID)** is the globally unique identifier. Order IDs may be reused across different markets — do not use the Order ID alone as a unique key. The order Id is a 64-bit packed value containing order metadata: OrderId structure (64 bits):┌─────────┬──────────────┬──────────┬─────────────┬──────────────┐│ Init(1) │ Reserved(6) │ Side(1) │ Tick(16) │ Index(40) │└─────────┴──────────────┴──────────┴─────────────┴──────────────┘Bit 63: Initialization marker (always 1 for valid orders)Bits 57-62: ReservedBit 56: Side (0 = LONG, 1 = SHORT)Bits 40-55: Encoded tick indexBits 0-39: Order index within tick This encoding has a nice ordering property: orders with **lower OrderId values** have **higher priority** in the order book. ### Parsing OrderId[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#parsing-orderid "Direct link to Parsing OrderId") // Parsing an OrderId(Side side, int16 tickIndex, uint40 orderIndex) = OrderIdLib.unpack(orderId);// Quick access methodsSide side = orderId.side();int16 tick = orderId.tickIndex();uint40 index = orderId.orderIndex(); Placing orders[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#placing-orders "Direct link to Placing orders") ---------------------------------------------------------------------------------------------------------------------------- ### Time In Force[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#time-in-force "Direct link to Time In Force") Time In Force (TIF) parameters control how orders behave during matching and placement. Boros supports five TIF types: GTC, IOC, FOK, ALO, and SOFT\_ALO. See [Custom Types — TimeInForce](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#timeinforce) for descriptions of each type. ### Self-trade Prevention[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#self-trade-prevention "Direct link to Self-trade Prevention") Boros prevents self-trading by checking if an incoming order would match against the same account's existing orders. If self-matching is detected, the transaction will revert to protect traders from unintentionally trading with themselves. ### Restrictions[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#restrictions "Direct link to Restrictions") **Order Size**: * No minimum order size requirement * No lot size restrictions - any decimal amount supported * Orders must have non-zero size **Order Limits**: * Maximum open orders per account across all sides (configurable per market via `maxOpenOrders`, typically 100) * Exceeding this limit will cause the transaction to revert **Rate Bounds (Taker Orders) — "Large Rate Deviation"**: * When an order matches and executes (taker fill), the resulting trade rate is checked against the mark rate * If the rate deviates too much from the mark rate, the transaction reverts with **`Large Rate Deviation`** * **Buy/Long orders**: Rejected if executed rate is too far above the mark rate * **Sell/Short orders**: Rejected if executed rate is too far below the mark rate * The acceptable deviation is governed by `maxRateDeviationFactorBase1e4` in the market config * When placing **closing orders** (reducing position), a separate, more lenient bound `closingOrderBoundBase1e4` applies **Limit Order Rate Bounds (Maker Orders) — "Rate too far off"**: * Limit orders placed on the book have additional rate constraints * If a maker order's rate is too far from the mark rate, it is rejected with **`Rate too far off`** * The bounds are controlled by four parameters in the market config: Upper Bound = Mark Rate × (1 + loUpperConst + loUpperSlope × Time to Maturity)Lower Bound = Mark Rate × (1 - loLowerConst - loLowerSlope × Time to Maturity) These parameters ensure limit orders remain within a reasonable range of the current mark rate, scaling with time to maturity. Understanding the two rate errors * **`Large Rate Deviation`** → applies to **taker fills** (IOC, FOK, or the matched portion of GTC). Your trade's execution rate is too far from the mark rate. * **`Rate too far off`** → applies to **maker orders** (the resting portion placed on the book). Your order's rate is too far from the mark rate to be placed. Order Lifecycle[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#order-lifecycle "Direct link to Order Lifecycle") ------------------------------------------------------------------------------------------------------------------------------- Beyond normal cancellation, orders can be removed by the protocol's risk management system — including force-cancellation of risky accounts' orders and purging of out-of-bound orders (which receive the [`PURGED`](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderstatus) status). See [Risk Management Actions](https://docs.pendle.finance/boros-dev/Mechanics/Margin#risk-management-actions) for details. For order status values, see [Custom Types — OrderStatus](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#orderstatus) . TWAP Oracle (Mark Rate)[​](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#twap-oracle-mark-rate "Direct link to TWAP Oracle (Mark Rate)") ----------------------------------------------------------------------------------------------------------------------------------------------------- Boros maintains a Time-Weighted Average Price (TWAP) oracle to calculate the **mark rate** — the reference rate used for margining, liquidations, and order rate bounds. The mark rate is essentially the **TWAP of historical trades**. Each time an order is matched against the order book, the rate of the last matched tick is incorporated into the TWAP calculation based on time elapsed. The oracle uses a fixed-window observation approach: markRate = (lastTradedRate × timeElapsed + prevOracleRate × (window - timeElapsed)) / window Where: * **`lastTradedRate`**: the rate of the most recent matched tick * **`timeElapsed`**: seconds since the last trade * **`prevOracleRate`**: the mark rate before the latest trade * **`window`**: a per-market parameter controlling how quickly the mark rate responds to new trades — typically **5 minutes** (300 seconds). A smaller window makes the mark rate more reactive; a larger window smooths out short-term spikes. Query the exact value via [`getMarketConfig()`](https://docs.pendle.finance/boros-dev/Mechanics/Market.mdx#getmarketconfig) . The mark rate is distinct from the **mid rate** (midpoint of best bid and best ask) and the **AMM implied rate**. In normal conditions, these values should be close, but they can diverge in thin markets or when the AMM operates outside its active range. * [Order Book Structure](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#order-book-structure) * [Tick vs Rate](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#tick-vs-rate) * [Tick to Rate Conversion](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#tick-to-rate-conversion) * [Examples](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#examples) * [Matching Priority](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#matching-priority) * [Order Id](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#order-id) * [Parsing OrderId](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#parsing-orderid) * [Placing orders](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#placing-orders) * [Time In Force](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#time-in-force) * [Self-trade Prevention](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#self-trade-prevention) * [Restrictions](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#restrictions) * [Order Lifecycle](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#order-lifecycle) * [TWAP Oracle (Mark Rate)](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#twap-oracle-mark-rate) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 1 - Introduction to Optimizing Yield | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#__docusaurus_skipToContent_fallback) On this page > Course level: **#beginner** ### Manage Your Yields[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#manage-your-yields "Direct link to Manage Your Yields") In DeFi, you can place your assets into a yield farming pool to receive an APY that fluctuates over time, just like token prices. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(45).png) Yield fluctuates **APR often goes down… 😢** You rushed into a new pool with 100% APR and only to find out yields have declined to 10% the day after. Sound familiar? 💡 What if you can “fix” this yield? **If only I had more capital when APR goes up… 🤑** In a bull market, APR goes up and many of us find ourselves thinking “man, if only increase my capital”. While you can always leverage your assets by borrowing, managing collateral and avoiding liquidation can be a daunting affair. 💡 What if you can increase your yield exposure without liquidation risk? * * * ### Yield-bearing tokens[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#yield-bearing-tokens "Direct link to Yield-bearing tokens") 💡 _Yield-bearing Token_ is an umbrella term that refers to any token that generates yield. Examples: * Lido’s stETH and wstETH * Liquid restaking assets like EtherFi’s weETH, Renzo’s ezETH or KelpDAO’s rsETH * Staked stablecoin like Ethena’s sUSDe * LP Tokens (Balancer LP tokens, Uniswap LP tokens, Curve LP tokens, Aura pool tokens, etc) * * * ### Introducing Pendle[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#introducing-pendle "Direct link to Introducing Pendle") Simply put, Pendle lets you earn better yields to help you secure better certainty, better returns (i.e. higher APY 🔥) _Y_ou are going to master these DeFi magics in our Academy. There are 2 main parts to fully understand Pendle. 1. **Yield-Tokenization** In the next chapter, we will explain how Pendle wraps and split yield-bearing tokens into its principal and yield components, **PT** (principal token) and **YT** (yield token) respectively. This opens you up to various ways to optimize yields. 2. **Yield-Trading** **PT** and **YT** can be traded via Pendle’s AMM. By creating a yield trading market in DeFi, Pendle unlocks the full potential of yield, enabling users to execute advanced yield strategies. We will go through how to [earn passive earning](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle) as well as [active trading strategies](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt) with Pendle in the next chapters. * * * ### What can you do to earn better yields with Pendle[​](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#what-can-you-do-to-earn-better-yields-with-pendle "Direct link to What can you do to earn better yields with Pendle") * [Passive earning](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle) * Fixed yield (e.g. earn fixed yield on stETH) * Earn extra yield **without additional risks, using the same asset** that you already own (e.g. provide liquidity with your stETH) * [Yield trading](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt) * Long yield (e.g. bet on stETH yield going up by purchasing more yield) * Or, a mix of any of the all passive and active strategies, you are going to learn more on how to execute these strategies, including some advanced ones, in this Academy. * [Manage Your Yields](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#manage-your-yields) * [Yield-bearing tokens](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#yield-bearing-tokens) * [Introducing Pendle](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#introducing-pendle) * [What can you do to earn better yields with Pendle](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield#what-can-you-do-to-earn-better-yields-with-pendle) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Documentation [Skip to main content](https://docs.pendle.finance/#__docusaurus_skipToContent_fallback) Pendle V2 --------- [📚\ \ Pendle V2 Docs\ --------------\ \ Learn about Pendle's yield tokenization protocol, AMM mechanics, sPENDLE system, and integration guides for developers.\ \ Get Started](https://docs.pendle.finance/pendle-v2/Introduction) [📊\ \ Pendle Academy\ --------------\ \ Learn how to use Pendle products with Pendle Academy.\ \ Get Started](https://pendle.gitbook.io/pendle-academy/) [🔌\ \ Pendle V2 API\ -------------\ \ For developers to integrate Pendle products into their own applications.\ \ Get Started](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview) Boros ----- [💻\ \ Boros Developer Docs\ --------------------\ \ Explore Boros, Pendle's interest rate swaps platform with order book mechanics, margin trading, and advanced settlement features.\ \ Get Started](https://docs.pendle.finance/boros-dev) [📖\ \ Boros Docs\ ----------\ \ Comprehensive documentation for Boros platform features and functionality.\ \ Get Started](https://pendle.gitbook.io/boros/boros-docs) [💰\ \ Boros Academy\ -------------\ \ Learn how to become a Boros trader.\ \ Get Started](https://pendle.gitbook.io/boros) --- # Start Here | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/Introduction#__docusaurus_skipToContent_fallback) On this page This doc is your full guide to yield-trading on Pendle. To learn more about the Pendle protocol and its mechanics, refer to [https://docs.pendle.finance/introduction](https://docs.pendle.finance/introduction) . [### Beginner](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-1-introduction-to-optimizing-yield) [### Intermediate](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle) [### Advanced](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # MarketHub View Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#__docusaurus_skipToContent_fallback) On this page Prefer the API over direct contract calls The [REST API](https://docs.pendle.finance/boros-dev/Backend/api) exposes the same data (balances, withdrawals, entered markets) with proper settlement handling. Direct contract calls return unsettled data. Use the API unless you have a specific need for on-chain reads. ### `getEnteredMarkets()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getenteredmarkets "Direct link to getenteredmarkets") MarketAcc userAccount = AccountLib.toMainCross(userAddress, tokenId);MarketId[] memory markets = marketHub.getEnteredMarkets(userAccount); ### `hasEnteredMarketBefore()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#hasenteredmarketbefore "Direct link to hasenteredmarketbefore") Returns whether the account has entered the specified market before. This is used to determine if the account needs to pay a market entrance fee. When entering a market for the first time, users pay a one-time entrance fee that goes to the protocol treasury. Subsequent entries to the same market don't incur this fee. MarketAcc userAccount = AccountLib.toCross(userAddress, tokenId);MarketId marketId = MarketId.wrap(2);bool hasEnteredBefore = marketHub.hasEnteredMarketBefore(userAccount, marketId); ### `tokenIdToAddress()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#tokenidtoaddress "Direct link to tokenidtoaddress") TokenId btcTokenId = TokenId.wrap(1);address btcAddress = marketHub.tokenIdToAddress(btcTokenId); ### `marketIdToAddress()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#marketidtoaddress "Direct link to marketidtoaddress") MarketId btcMarketId = MarketId.wrap(456);address btcMarketAddress = marketHub.marketIdToAddress(btcMarketId); ### `tokenData()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#tokendata "Direct link to tokendata") Returns the token configuration data for the specified token ID. The `TokenData` struct contains: * `token`: The ERC20 token contract address * `scalingFactor`: Used to normalize token decimals to 18-decimal precision for internal calculations. Calculated as `10^(18 - tokenDecimals)` during token registration TokenId btcTokenId = TokenId.wrap(1);TokenData memory data = marketHub.tokenData(btcTokenId); Cash and Balance Functions[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#cash-and-balance-functions "Direct link to Cash and Balance Functions") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ### `accCash()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#acccash "Direct link to acccash") Returns the account's cash balance in scaled units. The cash balance can be negative, which represents upfront borrowing (borrowed funds that need to be repaid). **Important caveats:** * Similar to `NoSettle` functions in Market contracts, this returns unsettled data that may be outdated * Due to Boros's [lazy settlement](https://docs.pendle.finance/boros-dev/Mechanics/Settlement) mechanism, positions and cash balances are only updated when users interact with the protocol * To get up-to-date cash balance, you must settle first using `settleAllAndGet()` or trigger settlement through other interactions // Check cross-margin cash balanceMarketAcc crossAccount = AccountLib.toMainCross(userAddress, tokenId);int256 crossCash = marketHub.accCash(crossAccount); ### `getCashFeeData()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getcashfeedata "Direct link to getcashfeedata") Returns fee configuration and treasury data for the specified token. TokenId tokenId = TokenId.wrap(1);CashFeeData memory feeData = marketHub.getCashFeeData(tokenId);uint128 treasuryCash = feeData.treasuryCash; // Protocol treasury balanceuint128 entranceFee = feeData.marketEntranceFee; // Fee to enter marketsuint128 minCashCross = feeData.minCashCross; // Min cash for cross-marginuint128 minCashIsolated = feeData.minCashIsolated; // Min cash for isolated ### `getUserWithdrawalStatus()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getuserwithdrawalstatus "Direct link to getuserwithdrawalstatus") Returns the user's pending withdrawal status. **Important caveats:** * The `amount` field (`unscaled`) is in the token's native decimal precision, not Boros's internal 18-decimal scaling * To finalize the withdrawal, the condition `start + cooldown <= block.timestamp` must be satisfied * Cash is deducted immediately when withdrawal is requested, but tokens are only transferred after the cooldown period address userAddress = 0x123...;TokenId tokenId = TokenId.wrap(1);Withdrawal memory withdrawal = marketHub.getUserWithdrawalStatus(userAddress, tokenId);uint32 startTime = withdrawal.start; // Withdrawal request timestampuint224 amount = withdrawal.unscaled; // Unscaled withdrawal amountif (amount) { uint32 cooldown = marketHub.getPersonalCooldown(userAddress); uint32 finalizationTime = startTime + cooldown; if (block.timestamp >= finalizationTime) { console.log("Withdrawal ready for finalization"); console.log("Amount: %s", amount); } else { uint32 remaining = finalizationTime - uint32(block.timestamp); console.log("Withdrawal pending, %s seconds remaining", remaining); }} else { console.log("No pending withdrawal");} ### `settleAllAndGet()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#settleallandget "Direct link to settleallandget") MarketAcc userAccount = AccountLib.toMainCross(userAddress, tokenId);MarketId marketId = MarketId.wrap(123);// Get all settlement data and margin requirements( int256 totalCash, VMResult totalMarginData,) = marketHub.settleAllAndGet(userAccount, GetRequest.MM, MarketIdLib.ZERO);// Parse margin data(int256 totalPositionValue, uint256 totalMaintenanceMargin) = totalMarginData.unpack();console.log("Total value: %s", totalCash + totalPositionValue);console.log("Total Maintenance Margin: %s", totalMaintenanceMargin);// Calculate health ratioint256 healthRatio = (totalCash + totalPositionValue) * 1e18 / int256(totalMaintenanceMargin);console.log("Health ratio: %s", healthRatio); ### `simulateTransfer()`[​](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#simulatetransfer "Direct link to simulatetransfer") Used for off-chain simulation only. This function allows simulating cash transfers to test scenarios like margin requirements or health ratios without affecting the actual blockchain state. **Requirement:** This function can only be executed when faking `tx.origin = address(0)` (using `eth_call` state overrides). MarketAcc fromAccount = AccountLib.toMainCross(userAddress, tokenId);int256 transferAmount = 1 ether;marketHub.simulateTransfer(fromAccount, transferAmount); * [`getEnteredMarkets()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getenteredmarkets) * [`hasEnteredMarketBefore()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#hasenteredmarketbefore) * [`tokenIdToAddress()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#tokenidtoaddress) * [`marketIdToAddress()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#marketidtoaddress) * [`tokenData()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#tokendata) * [Cash and Balance Functions](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#cash-and-balance-functions) * [`accCash()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#acccash) * [`getCashFeeData()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getcashfeedata) * [`getUserWithdrawalStatus()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getuserwithdrawalstatus) * [`settleAllAndGet()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#settleallandget) * [`simulateTransfer()`](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#simulatetransfer) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle 101 - Key Takeaways | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#__docusaurus_skipToContent_fallback) On this page > Course level: **#beginner** 1\. **Introduction to optimizing yields with Pendle**[​](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#1-introduction-to-optimizing-yields-with-pendle "Direct link to 1-introduction-to-optimizing-yields-with-pendle") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * Yield-bearing tokens are tokens that generate yield from various DeFi protocols. * Pendle is a platform that enables users to get better yields, through: * Yield Tokenization * Yield Trading * A few examples of what you can do on Pendle to get better yields include: 1. Earn fixed yield 2. Earn extra yield without additional risks, using the same asset that you already own (liquidity provision) 3. Increase yield exposure by purchasing more yield 4. and more~ 2\. **Yield Tokenization basics**[​](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#2-yield-tokenization-basics "Direct link to 2-yield-tokenization-basics") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Yield Tokenization[​](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#yield-tokenization "Direct link to Yield Tokenization") * It means splitting a yield-bearing asset into two parts: the **principal** and the **yield**. * **Principal** + **Yield** = **Yield-bearing asset** * Pendle is a marketplace where yield-bearing assets can be tokenized into separate principal and yield tokens and are traded separately. ### PT & YT[​](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#pt--yt "Direct link to PT & YT") Pendle splits a yield-bearing token into two parts: **Principal Token (PT)** and **Yield Token (YT)**. #### **Principal Token (PT)**[​](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#principal-token-pt "Direct link to principal-token-pt") * **PT lets you redeem the underlying principal asset after the maturity date.** * PT has a **lower entry cost** than the original asset. PT value grows over time and becomes 1:1 redeemable with the original asset at maturity. * You [earn a fixed yield by buying and holding PT](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle) . The difference between the entry cost and the redemption value is your fixed yield. * PT is similar to [zero-coupon bond](https://www.investopedia.com/terms/z/zero-couponbond.asp) in traditional finance. #### Yield **Token (YT)**[​](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#yield-token-yt "Direct link to yield-token-yt") * **YT lets you receive the yield of the underlying asset until its maturity date, claimable in real-time.** * You can buy only the yield, or more yield, by buying YT, at a much lower price than the principal. You profit if the yield you receive is more than what you paid for the YT. * You get [leveraged yield exposure](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure) by buying YT, without liquidation or oracle risk. * YT is similar to [detached coupons of bonds](https://www.investopedia.com/terms/c/coupon.asp) in traditional finance. **You can sell PT and YT anytime** on the Pendle market prior to maturity, with _**no**_ **lock or penalty**, at market price. They are tradable 24/7. Perhaps the most important takeaway from Pendle 101: 💡 **PT Price + YT Price = Accounting Asset Price**\\ For example: **1 PT-sUSDe (USDe) + 1 YT-sUSDe (USDe) = 1 USDe** * [1\. **Introduction to optimizing yields with Pendle**](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#1-introduction-to-optimizing-yields-with-pendle) * [2\. **Yield Tokenization basics**](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#2-yield-tokenization-basics) * [Yield Tokenization](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#yield-tokenization) * [PT & YT](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways#pt--yt) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 9 - Identifying Opportunities to Long/Short Yield | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#__docusaurus_skipToContent_fallback) On this page > Course level: #**advanced** TLDR[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#tldr "Direct link to TLDR") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- The objective of this strategy is to maximize your APY on the underlying asset by switching between the 2 possible positions: 1. [**Hold PT (short yield)**](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield) 2. [**Hold YT (long yield)**](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure) Since yields in DeFi are constantly fluctuating, Implied APY on Pendle markets also fluctuates. As Implied APY fluctuates, the market will swing between two modes: ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(80).png) Hence, if you can time the market well and alternate between selling and buying PT and YT, you can potentially get greater profits. This is essentially swing trading for yield. However, if you are unsure of the yield movements, you can also simply hold the underlying asset to hedge against both sides. The 3 modes of the yield market[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#the-3-modes-of-the-yield-market "Direct link to The 3 modes of the yield market") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(84).png) ### **CHEAP PT MODE**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#cheap-pt-mode "Direct link to cheap-pt-mode") When Implied APY is high (overvalued), PT is cheap with a high fixed APY, **holding PT tends to be the best strategy.** When holding PT: * If the market swings and Implied APY falls, examine the Implied APY to determine which mode the market has morphed into, and execute the relevant strategies. * If all else stays constant, you can hold PT until maturity and redeem the underlying asset, realising the Fixed APY (see Level 2 for fixed yield strategy). ### **EQUILIBRIUM MODE**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#equilibrium-mode "Direct link to equilibrium-mode") When Implied APY is at a reasonable rate, it means that PT and YT prices are both reasonable and the **market is at an equilibrium**. As such, **any of the three strategies (holding PT, holding YT, or holding the underlying asset)** are all potentially sound. ### **CHEAP YT MODE**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#cheap-yt-mode "Direct link to cheap-yt-mode") When Implied APY is low (undervalued), YT is cheap with a high Long Yield APY, **holding YT tends to be the best strategy.** When holding YT: * If the market swings and Implied APY rises, examine the Implied APY to determine which mode the market has morphed into, and execute the relevant strategies. * If all else stays constant, you can hold YT until maturity and continue collecting the yield of the asset. ### How to identify the correct mode[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#how-to-identify-the-correct-mode "Direct link to How to identify the correct mode") The key to identifying the mode is to judge whether the **current Implied APY is overvalued or undervalued**. > To recap, **Implied APY** is the **average future APY that the market is implying by trading PT and YT at the current prices**. It boils down to predicting the **average future APY**, then comparing your predictions with the **current Implied APY**. In many cases, it is reasonable to approximate the average future APY to the **underlying APY**. However, yield can fluctuate by large amounts in rare cases, and the underlying APY might deviate significantly from the actual average future APY. For example, if a protocol has announced an upcoming APY reduction, the market will likely have priced it in, resulting in a seemingly low Implied Yield and cheap YT. Ultimately, the deciding factor is **your own outlook on the average future APY** that guides your decisions and determines your success in yield trading. 💡 See also [#how-can-i-predict-the-average-future-apy](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-can-i-predict-the-average-future-apy "mention") 💡 Review when to enter/exit a YT position in [chapter-8-long-yield-obtain-leveraged-yield-exposure.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure "mention") ### How it works in practice[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#how-it-works-in-practice "Direct link to How it works in practice") Suppose it is 1 Jan 2023, and there is a stETH market on Pendle with a **1-year maturity period (1 Jan 2024)**. **On 1 Jan 2023 (1 year till maturity):** ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(56).png) **On 1 April 2023 (9 months till maturity):** ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(55).png) **On 1 Oct 2023 (3 months till maturity):** ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(57).png) In total, after 9 months, Peepo executed **3 trades** and has **5.301 stETH from a starting principal of 4.3 stETH. This translates into an APY of 32.2%**. Obviously, the more correct trades Peepo executes, the larger his APY. We can also observe that correct YT trades can lead to large profits. Of course, the inverse is also true, that wrong YT trades can lead to large losses. PT trades, on the other hand, will be lower risk, and lower reward as well. **PRO TIP** On top of Implied APY changes due to overall market conditions, there are Implied APY changes simply due to volatility as people buy and sell PT and YT. You can actively trade these movements and switch between PT / YT much more often, which could give larger profits if you do it right. * [TLDR](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#tldr) * [The 3 modes of the yield market](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#the-3-modes-of-the-yield-market) * [**CHEAP PT MODE**](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#cheap-pt-mode) * [**EQUILIBRIUM MODE**](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#equilibrium-mode) * [**CHEAP YT MODE**](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#cheap-yt-mode) * [How to identify the correct mode](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#how-to-identify-the-correct-mode) * [How it works in practice](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield#how-it-works-in-practice) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Glossary | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/glossary#__docusaurus_skipToContent_fallback) On this page Quick reference for key terms used in the Boros API. For portfolio concepts (leverage, margin, PnL, liquidation), see the [Boros User Glossary](https://pendle.gitbook.io/boros/boros-docs/about-boros/glossary) . * * * Core Concepts[​](https://docs.pendle.finance/boros-dev/Backend/glossary#core-concepts "Direct link to Core Concepts") ---------------------------------------------------------------------------------------------------------------------- | Term | Description | Where it appears | | --- | --- | --- | | **Market** | A trading market uniquely identified by `marketId`, with one collateral token and specific parameters. Each market represents a different interest rate swap: different token, different maturity, different reference rate. | `GET /markets`, `GET /markets/{marketId}` | | **Asset** | Any collateral token in the system, identified by `tokenId` (e.g., USDT has 6 decimals, BTC has 8). Internally all values are normalized to 18 decimals. | `GET /assets/all` | | **Root** | EVM address (0x-prefixed) serving as the primary trading identity. The root wallet signs sensitive actions (deposit, withdraw, agent approval). | All account endpoints, calldata endpoints | | **Account** | Sub-account under a root (IDs 0–255). Account `0` is default for trading; `255` is reserved for AMM. Currently only account `0` is available for external users. | `accountId` parameter across all endpoints | | **Agent** | Wallet authorized to execute non-sensitive trading operations on behalf of a root account. Agents cannot withdraw funds — only place orders, cancel, transfer cash, and enter/exit markets. See [Agent Trading](https://docs.pendle.finance/boros-dev/Backend/agent)
. | `GET /agents/expiry-time`, `GET /calldata/approve-agent` | | **Account Manager** | Delegated wallet that can approve and revoke agents on behalf of a root account. The root sets the account manager via `setAccManager`. Useful for programmatic agent management without exposing the root key. | `GET /calldata/approve-agent` | | **Market Account** | Unique trading context packed as: `(root, subaccountId, tokenId, marketId)`. Use `CROSS_MARKET_ID` (16777215) for cross-margin, or a specific `marketId` for isolated. This is the key identifier for querying positions and balances. See [Custom Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketacc)
. | `POST /accounts/market-acc-infos` | | **Decimals** | Deposits/withdrawals use native token decimals (e.g., 6 for USDT). All trading values — sizes, balances, prices — use **18 decimals** internally. Always convert when bridging between wallet amounts and API values. | All size/amount fields | | **APR Format** | All APR values in the API (`markApr`, `midApr`, `liquidationApr`, `impliedApr`, `ammImpliedApr`, etc.) are **decimal fractions**, not percentages. For example, `0.05495` means **5.495%**. Multiply by 100 to get the human-readable percentage. All APR fields use the same scaling — there are no exceptions. | All market and account endpoints | | **Scaling Factor** | Multiplier used to normalize token amounts to 18-decimal precision internally. Calculated as `10^(18 - tokenDecimals)` during token registration (e.g., USDT with 6 decimals has scaling factor `10^12`). Tokens with more than 18 decimals are not supported. | `GET /assets/all` | | **Cooldown** | Mandatory waiting period between requesting and finalizing a withdrawal. Protects protocol solvency by preventing instant removal of collateral backing active positions. The global cooldown applies to all users; individual roots may have a personal cooldown override. | Withdrawal endpoints | | **Deposit Box** | Deterministic per-user contract for receiving cross-chain deposits and performing token swaps (via DEX routers) before depositing into Boros. Created by `DepositBoxFactory` from `(root, boxId)`. Managed by Pendle backend — users do not interact with them directly. | Internal (not exposed via API) | * * * Trading Concepts[​](https://docs.pendle.finance/boros-dev/Backend/glossary#trading-concepts "Direct link to Trading Concepts") ------------------------------------------------------------------------------------------------------------------------------- | Term | Description | Where it appears | | --- | --- | --- | | **Order Book** | Primary liquidity source with Long/Short sides organized by price ticks. See [Order Book Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook)
for matching rules and constraints. | `GET /markets/order-books`, `GET /v2/markets/order-books` | | **Order** | Trade instruction with `orderId`, `tick` (price level), `side`, `size` (18 decimals), and `tif` (time-in-force). Orders can be placed individually or in bulk. | `POST /calldata/place-orders`, `GET /accounts/limit-orders` | | **Tick** | Integer price level representing an interest rate. Formula: `rate = 1.00005^(tick × tickStep) - 1`. Higher tick = higher rate. The tick step is market-specific and controls rate granularity. Use SDK helpers to convert between human-readable APR and tick values. | All order-related endpoints, `GET /stop-order/v1/orders/tpsl/prepare` | | **Slippage** | Max acceptable price impact as a percentage (market orders only). Protects against unfavorable fills when the order book is thin. | `GET /simulations/place-order` | | **AMM** | Automated market maker providing continuous liquidity alongside the order book. The Router routes between AMM and order book for optimal execution. AMM liquidity can be optionally included in order book queries. | `GET /v2/markets/order-books`, AMM simulation/calldata endpoints | | **OTC Trade** | Direct swap between two accounts bypassing the order book, typically routed through the AMM. Has a separate fee rate (`otcFee`). See [Fees](https://docs.pendle.finance/boros-dev/Mechanics/Fees)
. | AMM swap/liquidity endpoints | | **Mark Rate** | TWAP of historical order book trades, used as the reference rate for margin, liquidation, and order rate bounds. Distinct from mid rate and AMM implied rate. See [TWAP Oracle](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#twap-oracle-mark-rate)
. | `GET /markets/{marketId}` (in market state) | | **Mid Rate (midApr)** | Midpoint of the best bid and best ask rates: `(bestBid + bestAsk) / 2`. When the AMM provides the tightest spread, this may equal the AMM implied rate. Can diverge from the mark rate in thin markets. | `GET /markets/{marketId}` | | **AMM Implied Rate** | The current rate implied by the AMM's internal state. Represents the rate at which the AMM would trade. Should normally be near the order book's best bid/ask. The AMM has a min/max APR range — outside this range, it stops serving trades. | `GET /markets/{marketId}` | | **Implied Rate** | Current interest rate implied by order book trading, consisting of the last traded rate and a TWAP component. | `GET /markets/{marketId}` | | **Rate Floor** | Minimum absolute rate used in margin calculations (derived from `market.imData.iTickThresh`). If an order's rate is below the rate floor, the floor value is used for margin instead. See [Margin — Pre-scaling IM](https://docs.pendle.finance/boros-dev/Mechanics/Margin#pre-scaling-initial-margin)
. | Market config | | **Settlement** | Periodic floating rate payment exchange (typically every 8 hours) using [lazy settlement](https://docs.pendle.finance/boros-dev/Mechanics/Settlement)
. See [Settlement Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/Settlement)
. | `GET /accounts/settlements`, `POST /funding-rate/settlement-summary` | | **Conditional Order** | On-chain order with an off-chain trigger condition, executed by a permissioned validator when conditions are met. Stop orders are built on this. See [Conditional Orders](https://docs.pendle.finance/boros-dev/Contracts/Router#conditional-orders)
. | Stop Order Service endpoints | | **Stop Order** | Conditional off-chain order (take-profit or stop-loss) that triggers when market APR crosses a threshold. Managed by the Stop Order Service. See [Stop Orders](https://docs.pendle.finance/boros-dev/Backend/stop-orders)
. | `GET /stop-order/v1/orders/tpsl/prepare`, `POST /stop-order/v2/orders/place` | * * * Margin Concepts[​](https://docs.pendle.finance/boros-dev/Backend/glossary#margin-concepts "Direct link to Margin Concepts") ---------------------------------------------------------------------------------------------------------------------------- | Term | Description | Where it appears | | --- | --- | --- | | **Cross Margin** | Shares collateral across all entered markets. Unrealized profit in one market can offset losses in another. Use `CROSS_MARKET_ID` (16777215) when packing `marketAcc`. | `POST /accounts/market-acc-infos`, `GET /calldata/enter-exit-markets` | | **Isolated Margin** | Constrains collateral to a single market. Liquidation in one market doesn't affect others. Use the specific `marketId` when packing `marketAcc`. | `GET /calldata/cash-transfer`, `GET /simulations/deposit` | | **Initial Margin** | Minimum collateral required to open a new position. Calculated based on position size, rate, and time to maturity. See [Margin Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/Margin)
. | `GET /simulations/place-order` (in projected state) | | **Maintenance Margin** | Minimum collateral required to keep positions open. If total value drops below this, the position is eligible for liquidation. | `POST /accounts/market-acc-infos` (in margin status) | | **Health Ratio** | `Total Value / Maintenance Margin`. Above 1.0 = healthy; ≤ 1.0 = liquidation eligible. Multiple thresholds trigger progressive risk actions. See [Margin Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/Margin#health-ratio)
. | `POST /accounts/market-acc-infos` | | **Liquidation** | Forced closure of positions when health ratio ≤ 1.0. Positions are closed at mark rate; a liquidation incentive is paid to the liquidator. See [Margin Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/Margin#liquidation-process)
. | `GET /events/liquidation-events` | | **Force Cancel** | Automatic cancellation of open orders when an account's health ratio drops below the risky threshold, or when order rates deviate too far from mark rate. See [Risk Management](https://docs.pendle.finance/boros-dev/Mechanics/Margin#risk-management-actions)
. | `GET /accounts/limit-orders` | | **CLO (Close-Only)** | [Market status](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketstatus)
where only position-reducing orders are accepted. See [Closing Only Mode](https://docs.pendle.finance/boros-dev/Mechanics/Margin#closing-only-mode)
. | `GET /markets/{marketId}` (status field) | * * * Enums[​](https://docs.pendle.finance/boros-dev/Backend/glossary#enums "Direct link to Enums") ---------------------------------------------------------------------------------------------- ### Side[​](https://docs.pendle.finance/boros-dev/Backend/glossary#side "Direct link to Side") | Value | Name | Description | | --- | --- | --- | | `0` | `LONG` | Betting on rate increase (pay fixed, receive floating) | | `1` | `SHORT` | Betting on rate decrease (receive fixed, pay floating) | ### Time In Force (TIF)[​](https://docs.pendle.finance/boros-dev/Backend/glossary#time-in-force-tif "Direct link to Time In Force (TIF)") | Value | Name | Best for | Description | | --- | --- | --- | --- | | `0` | `GOOD_TIL_CANCELLED` | Limit orders | Remains on book until filled or canceled | | `1` | `IMMEDIATE_OR_CANCEL` | Market orders | Fills against available liquidity, cancels remainder | | `2` | `FILL_OR_KILL` | All-or-nothing | Must fill entire size immediately or reverts | | `3` | `ALO` | Market making | Post-only (Add Liquidity Only); reverts if it would match existing orders. Guarantees maker-only status. | | `4` | `SOFT_ALO` | Market making | Post-only (soft); skips matching without reverting. Preferred over ALO for no-revert behavior. | ### Market Status[​](https://docs.pendle.finance/boros-dev/Backend/glossary#market-status "Direct link to Market Status") `PAUSED (0)` · `CLO (1)` · `GOOD (2)` — See [Custom Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes#marketstatus) for descriptions and state transitions. ### Stop Order Type[​](https://docs.pendle.finance/boros-dev/Backend/glossary#stop-order-type "Direct link to Stop Order Type") | Value | Name | Description | | --- | --- | --- | | `2` | `TAKE_PROFIT_MARKET` | Triggers when market moves in your favor | | `3` | `STOP_LOSS_MARKET` | Triggers when market moves against you | * * * SDK Helpers[​](https://docs.pendle.finance/boros-dev/Backend/glossary#sdk-helpers "Direct link to SDK Helpers") ---------------------------------------------------------------------------------------------------------------- import { MarketAccLib, CROSS_MARKET_ID, estimateTickForRate, getRateAtTick } from "@pendle/sdk-boros";import { FixedX18 } from "@pendle/boros-offchain-math";// Pack market account for API callsconst marketAcc = MarketAccLib.pack(walletAddress, accountId, tokenId, CROSS_MARKET_ID);// Convert between tick and rateconst tick = estimateTickForRate(FixedX18.fromNumber(0.05), tickStep, false);const rate = getRateAtTick(tick, tickStep);// Convert between human-readable numbers and 18-decimal stringsconst size = FixedX18.fromNumber(100).value.toString(); // "100000000000000000000"const amount = FixedX18.fromBigIntString(balanceString).toNumber(); // 100.0 * * * Additional Resources[​](https://docs.pendle.finance/boros-dev/Backend/glossary#additional-resources "Direct link to Additional Resources") ------------------------------------------------------------------------------------------------------------------------------------------- * [Boros User Glossary](https://pendle.gitbook.io/boros/boros-docs/about-boros/glossary) — Portfolio and general trading terms * [OrderBook Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook) — How the order book works * [Margin Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/Margin) — Initial/maintenance margin and liquidation * [Settlement Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/Settlement) — Funding rate payments * [Fee Structure](https://docs.pendle.finance/boros-dev/Mechanics/Fees) — Position opening, settlement, and entrance fees * [Custom Types](https://docs.pendle.finance/boros-dev/Contracts/CustomTypes) — Contract type definitions * [API Reference](https://docs.pendle.finance/boros-dev/Backend/api) — All API endpoints and integration workflows * [Core Concepts](https://docs.pendle.finance/boros-dev/Backend/glossary#core-concepts) * [Trading Concepts](https://docs.pendle.finance/boros-dev/Backend/glossary#trading-concepts) * [Margin Concepts](https://docs.pendle.finance/boros-dev/Backend/glossary#margin-concepts) * [Enums](https://docs.pendle.finance/boros-dev/Backend/glossary#enums) * [Side](https://docs.pendle.finance/boros-dev/Backend/glossary#side) * [Time In Force (TIF)](https://docs.pendle.finance/boros-dev/Backend/glossary#time-in-force-tif) * [Market Status](https://docs.pendle.finance/boros-dev/Backend/glossary#market-status) * [Stop Order Type](https://docs.pendle.finance/boros-dev/Backend/glossary#stop-order-type) * [SDK Helpers](https://docs.pendle.finance/boros-dev/Backend/glossary#sdk-helpers) * [Additional Resources](https://docs.pendle.finance/boros-dev/Backend/glossary#additional-resources) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Privacy Policy | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#__docusaurus_skipToContent_fallback) On this page Date Last Revised: 9 December 2025 ### 1\. ABOUT THIS POLICY[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#1about-this-policy "Direct link to 1. ABOUT THIS POLICY") 1. This is the Privacy Policy for Univerum Innovations Inc (referred to herein as “**Company**”, “**us**”, “**we**” or “**our**”). 2. This Privacy Policy describes how we may collect, use, disclose and process your personal data when you: 1. access or use our websites and applications (including mobile and web-based applications) (collectively, “**Website & Applications**”), and services; and/or 2. provide us with your personal data. 3. We will only use your personal data where you have given us your consent or where we have other lawful basis for doing so, and in the manner set out in this Privacy Policy. 4. By providing us with personal data, you acknowledge that our collection, use, disclosure and processing of personal data will be in accordance with this Policy, including, for the avoidance of doubt, the cross-jurisdictional transfer of your data. DO NOT provide any personal data to us if you do not accept this Privacy Policy. 5. This Privacy Policy supplements but does not supersede or replace any consents you may have provided to us, or any other agreements or arrangements that you may have with us, in respect of your personal data. 6. The Website & Applications may contain links to other websites that are not owned or maintained by us. These links are provided only for your convenience. You may also be accessing our Applications through third party websites and/or platforms. This Privacy Policy only applies to our Applications. When visiting these third party websites, their privacy policies apply. 7. If you have any feedback or issues in relation to your personal data, or about this Privacy Policy, or wish to make a complaint to us, you may contact our Data Protection Officer at : Email : [legal@pendle.finance](mailto:legal@pendle.finance) This does not affected your statutory rights. For example, if the GDPR applies to you, you may also have a right to lodge a complaint with a European supervisory authority, in particular in the Member State in the European Union where you are habitually resident, where you work or where an alleged infringement of Data Protection law has taken place. When you contact us, we may require that you submit certain forms or provide certain information, including verification of your identity, before we are able to respond. ### 2\. AMENDMENTS TO THIS PRIVACY POLICY[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#2amendments-to-this-privacy-policy "Direct link to 2. AMENDMENTS TO THIS PRIVACY POLICY") We may amend this Privacy Policy from time to time without notice to you, in compliance with applicable laws or as we update our data usage and handling processes. The updated policy will supersede earlier versions and will apply to personal data provided to us. The updated Privacy Policy will take effect when made available on [https://docs.pendle.finance/pendle-v2/PrivacyPolicy](https://docs.pendle.finance/pendle-v2/PrivacyPolicy) . ### 3\. WHAT PERSONAL DATA WE COLLECT[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#3what-personal-data-we-collect "Direct link to 3. WHAT PERSONAL DATA WE COLLECT") 1. **What is personal data**. “Personal data” is data that can be used to identify a natural person. Examples of personal data include wallet addresses, and user-specific information for analytical purposes, email addresses and any other information of a personal nature. 2. **Voluntary provision of personal data**. We may collect personal data (1) that you voluntarily provide to us; or (2) from third parties; or (3) through your use of our (or our services provider’s) digital technologies and services (Please see Section 4 How We Collect Personal Data for further details). What personal data we collect depends on the purposes for which the personal data is collected and what you have chosen to provide. When our collection is based on consent, you can choose not to provide us with personal data. You also have the right to withdraw your consent for us to continue collecting, using, disclosing and processing your personal data, by contacting us in accordance with paragraph 1(g). However, if you do so, it may not be possible for us to fulfil the purposes for which we require the personal data, including processing your transactions or providing you with the products and services that you require. 3. **Providing personal data belonging to others**. In certain circumstances, you may also provide us with personal data of persons other than yourself (such as your team members, family members and next-of-kin). If you do so, you represent and warrant that you have brought this Privacy Policy to his/her attention, informed him/her of the purposes for which we are collecting his/her personal data and that he/she has consented to your disclosure of his/her personal data to us for those purposes and accepts this Privacy Policy. You agree to indemnify and hold us harmless from and against any and all claims by such individuals relating to our collection, use and disclosure of such personal data in accordance with the terms of this Privacy Policy. 4. **Accuracy and completeness of personal data**. You are responsible for ensuring that all personal data that you provide to us is true, accurate and complete. You are responsible for informing us of any changes to your personal data. 5. **Minors**. Our Applications and/or services are not intended to be accessed or used by children, minors or persons who are not of legal age. If you are a parent or guardian and you have reason to believe your child or ward has provided us with their personal data without your consent, please contact us. 6. **Excluded Persons and Excluded Jurisdictions**. Our Applications and/or services are also not intended for Excluded Persons, and/or access and/or use in Excluded Jurisdictions. Please refer to the relevant terms of use for the specific excluded persons and jurisdictions. ### 4\. HOW WE COLLECT PERSONAL DATA[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#4how-we-collect-personal-data "Direct link to 4. HOW WE COLLECT PERSONAL DATA") 1. **Personal data you provide**. We collect personal data that is relevant to our relationship with you. We may collect your personal data directly or indirectly through various channels, such as when: 1. you download, access or use our Applications and services; 2. you authorise us to obtain your personal data from a third party; 3. you enter into agreements with us; 4. you transact with us, contact us or request that we contact you through various communication channels, for example, through social media platforms (such as Discord), messenger platforms (such as Telegram and Slack), face-to-face meetings, telephone calls, emails, fax and letters; 5. your request to be included in an e-mail or our mailing list; 6. we seek information about you and receive your personal data in connection with your relationship with us; and/or 7. when you submit your personal data to us for any other reason. 2. **Personal data provided by others**. Depending on your relationship with us, we may also collect your personal data from third party sources, for example, from: 1. any third parties whom you have authorised us to obtain your personal data from; 2. entities in which you (or a party connected to you) have an interest; 3. our business partners such as third parties providing services to us; 4. your family members or friends who provide your personal data to us on your behalf; and/or 5. public agencies or other public sources. ### 5\. WHAT WE DO WITH YOUR PERSONAL DATA[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#5what-we-do-with-your-personal-data "Direct link to 5. WHAT WE DO WITH YOUR PERSONAL DATA") 1. **What we do**. We collect, use, disclose and process your personal data where: 1. you have given us consent; 2. necessary to comply with our legal or regulatory obligations, e.g. responding to valid requests from public authorities; 3. necessary to support our legitimate business interests, provided that this does not override your interests or rights; and 4. necessary to perform a transaction you have entered into with us, or provide a service that you have requested or require from us. 2. **General purposes**. We collect, use, disclose and process your personal data for purposes connected or relevant to our business, to manage your relationship with us. Such purposes would include: 1. carrying out your transactions with us and our business partners, taking steps as may be directed by you, or to provide products and/or services to you; 2. facilitating your use of our Applications, including verifying and establishing your identity, and authenticating, operating and maintaining user accounts; 3. facilitating business asset transactions; 4. communicating with you, and assisting you with your queries, requests, applications, complaints, and feedback; 5. resolving any disputes, investigating any complaint, claim or dispute or any actual or suspected illegal or unlawful conduct; 6. administrative purposes, including finance, IT and HR purposes, quality assurance and staff training, and compliance with internal policies and procedures, including audit, accounting, risk management and record keeping; 7. carrying out research and statistical analysis, including development of new products and services or evaluation and improvement of our existing products and services; 8. security purposes, e.g. protecting our Applications and services from unauthorised access or usage and to monitor for security threats; 9. compliance with any legal or regulatory obligations, applicable laws, regulations, codes of practices, guidelines, or rules (including anti-money laundering and countering the financing of terrorism laws), or to assist in law enforcement and investigations conducted by any governmental and/or regulatory authority; 10. performing data analytics and related technologies on data, to enable us to deliver relevant content and information to you, and to improve our Applications and services; 11. managing and engaging third parties or data processors that provide services to us, e.g. IT services, technological services, delivery services, and other professional services; 12. carrying out our legitimate business interests; 13. such purposes that may be informed to you when your personal data is collected; and/or 14. any other reasonable purposes related to the aforesaid. Where personal data is used for a new purpose and where required under applicable law, we shall obtain your consent. 3. Legitimate business interests. We may also collect, use, disclose and process your personal data for the following purposes to support our legitimate business interests, provided that this does not override your interests or rights, which include: 1. managing our business and relationship with you, and providing services to our customers; 2. assistance of carrying out corporate restructuring plans; 3. complying with internal policies, and procedures; 4. protecting our rights and interests, and those of our customers; 5. enforcing our terms and conditions, and obligations owed to us, or protecting ourselves from legal liability; 6. managing our investor and shareholder relations; and 7. process or share your personal data to facilitate acquisitions, mergers, or transfers of our business. 4. **Marketing purposes**. In order for us to market products, updates, events and services which are of specific interest and relevance to you, we may analyse and rely on your personal data provided to us, or data collected from your interactions with us However, no marketing, using your personal data in non-aggregated and/or identifiable form would be carried out unless you have provided us with your consent to use your personal data for such marketing purposes. If you do not want us to use your personal data for the purposes of marketing you can withdraw your consent at any time by contacting us in accordance with paragraph 1(g). 5. **Use permitted under applicable laws**. We may also collect, use, disclose and process your personal data for other purposes, without your knowledge or consent, where this is required or permitted by law. Your personal data may be processed if it is necessary on reasonable request by a law enforcement or regulatory authority, body or agency or in the defence of a legal claim. We will not delete personal data if relevant to an investigation or a dispute. It will continue to be stored until those issues are fully resolved. 6. **Contacting you**. When we contact or send you information for the above purposes and purposes for which you have consented, we may do so by post, e-mail, SMS, telephone or such other means provided by you. If you do not wish to receive any communication or information from us, or wish to restrict the manner by which we may contact or send you information, you may contact us in accordance with paragraph 1(g) above. ### 6\. USE OF AUTOMATED DATA COLLECTION TECHNOLOGIES[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#6use-of-automated-data-collection-technologies "Direct link to 6. USE OF AUTOMATED DATA COLLECTION TECHNOLOGIES") 1. **Cookies**. In order to improve our products or services, we collect data by way of “cookies”. A cookie is a small file of letters and numbers that we store via your browser on the hard drive of your computer or mobile device. There are three main types of cookies: 1. **Session cookies**: specific to a particular visit and limited to sending session identifiers (random numbers generated by the server) so you don't have to re-enter information when you navigate to a new page or check out. Session cookies are not permanently stored on your device and are deleted when the browser closes; 2. **Persistent cookies**: record information about your preferences and are stored in your browser cache or mobile device (if applicable); and 3. **Third party cookies**: placed by someone other than us which may gather data across multiple websites or sessions. 2. **How we use cookies**. We use cookies for the following purposes: 1. **Strictly necessary**: These cookies are essential for you to browse our Applications and use its features. The information collected relates to the operation of the Applications (e.g. website scripting language and security tokens) and enables us to provide you with the service you have requested. 2. **Functionality**: These cookies remember the choices you have made, for example the country you visit our Website from, your language and any changes you have made to text size and other parts of the web pages that you can customise to improve your user experience and to make your visits more tailored and enjoyable. 3. **Performance/analytics**: These cookies collect information on how users use our Website, for example which pages you visit most often, whether you receive any error messages and how you arrived at our Applications. Information collected by these cookies is used only to improve your use of our Applications. These cookies are sometimes placed by third party providers of web traffic and analysis services. We use Google Analytics. For information on how Google processes and collects your information and how you can opt out, please click here. We may also automatically collect and store certain information about your interaction with our Applications including IP address, browser type, internet service provider, referring/exit pages, operating system, date/time stamps and related data. 3. **Other technologies**. In addition to cookies, we may use some other similar technologies as follows (as and where applicable): 1. **Web Beacons**: small graphic images included on our Applications or emails or those of third parties to provide analytics information. 2. **Social widgets**: buttons or icons provided by third party social media networks which may collect browsing data and will be received by the third party and are controlled by the third party. 3. **SDKs**: these are mobile application third party software development kits used in our apps. They enable us to collect information about app activity and the device it runs on. 4. **Local shared objects**: these are sometimes called flash cookies and can be stored on your browser. They are used to maintain preferences and usage records. 4. **Refusing or deleting cookies**. Most internet browsers are set up by default to accept cookies. However if you want to refuse or delete them (or similar technologies) please refer to the help and support area on your browser for instructions on how to block or delete cookies (for example: Internet Explorer, Google Chrome, Mozilla Firefox and Safari). Please note you may not be able to take advantage of all the features of our Applications, including certain personalised features, if you delete or refuse cookies. 5. **Mobile Opt-out**. Where applicable if we do support a mobile version of our product - If you access our Applications through mobile devices, you can enable a "do not track" feature so as to control interest-based advertising on an iOS or Android mobile device by selecting the Limit Add Tracking option in the privacy section of your Settings on iOS or via advertising preferences on Android devices (e.g. in Google Settings). This will not prevent the display of advertisements but will mean that they will no longer be personalised to your interests. 1. To opt out of Google Analytics, visit [https://tools.google.com/dlpage/gaoptout](https://tools.google.com/dlpage/gaoptout) 2. For more information on managing cookies, please go to [www.allaboutcookies.org](http://www.allaboutcookies.org/) 6. **If you are a resident in the EU**. For more information on managing cookies, please visit [www.youronlinechoices.eu](http://www.youronlinechoices.eu/) and [www.aboutcookies.org](http://www.aboutcookies.org/) . The above links have further information about behavioural advertising and online privacy. 7. **Changes to our uses of Cookies**. If we change anything important about this Paragraph 6 on cookies, we will notify you through a pop-up on the website for a reasonable length of time prior to and following the change. You may review this Paragraph by visiting the sites and clicking on the “Privacy Policy” link. ### 7\. DISCLOSURE OF PERSONAL DATA[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#7disclosure-of-personal-data "Direct link to 7. DISCLOSURE OF PERSONAL DATA") 1. **Disclosure to related parties**. We may disclose or share your personal data with our related parties in order to provide our services to you, manage our shareholder and investor returns, for management and compliance purposes, and to utilise shared group IT functions. 2. **Disclosure to third parties**. We may also disclose your personal data to third parties in connection with purposes described in paragraph 5, including without limitation the following circumstances: 1. disclosing your personal data to third parties who provide services to us (including, but not limited to, data providers, technology providers, insurance providers, and other professional services (including accountants, lawyers and auditors)); 2. disclosing your personal data to third parties in order to fulfil such third party products and/or services as may be requested or directed by you; 3. disclosing your personal data to third parties that we conduct marketing and cross promotions with; 4. disclosing your personal data to authorities, governments, law enforcement agencies or public agencies; 5. If we are discussing selling or transferring part or all of our business – the information may be transferred to prospective purchasers under suitable terms as to confidentiality; 6. If we are reorganised or sold, information may be transferred to a buyer who can continue to provide continued relationship with you; and 7. If we are defending a legal claim your information may be transferred as required in connection with defending such claim. 3. When disclosing personal data to third parties, we will (where appropriate and permissible) enter into contracts with these third parties to protect your personal data in a manner that is consistent with all applicable laws and/or ensure that they only process your personal data in accordance with our instructions. ### 8\. TRANSFER OF PERSONAL DATA TO OTHER COUNTRIES[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#8transfer-of-personal-data-to-other-countries "Direct link to 8. TRANSFER OF PERSONAL DATA TO OTHER COUNTRIES") 1. **Transfers**. We may transfer your personal data to different jurisdictions in connection with the purposes described in paragraph 5: 1. from the jurisdiction where it is collected (or where you are located) to any other jurisdictions that we operate in; and 2. to third parties in other jurisdictions. 2. **Safeguards**. Where we transfer your personal data across jurisdictions, we will ensure that your personal data is protected in accordance with this policy and applicable laws regardless of the jurisdictions they are transferred to, but in any event to a level that is no less stringent than the jurisdiction from which the personal data is transferred. When we transfer your personal data internationally and where required by applicable law we put in place appropriate safeguards including EU Model Clauses or rely on EU Commission adequacy decisions. You may obtain details of these safeguards by contacting us. ### 9\. SECURITY AND RETENTION OF PERSONAL DATA[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#9security-and-retention-of-personal-data "Direct link to 9. SECURITY AND RETENTION OF PERSONAL DATA") 1. **Unauthorised access**. While we take reasonable precautions to safeguard your personal data in our possession or under our control, you agree not to hold us liable or responsible for any loss or damage resulting from unauthorised or unintended access that is beyond our control, such as hacking or cybercrimes. 2. **Vulnerabilities**. We do not make any warranty, guarantee, or representation that your use of our systems or applications is safe and protected from malware, and other vulnerabilities. We also do not guarantee the security of data that you choose to send us electronically. Sending such data is entirely at your own risk. 3. **Period of retention**. We retain your personal data only for as long as is necessary to fulfil the purposes we collected it for, and to satisfy our business and/or legal purposes, including data analytics, audit, accounting or reporting purposes. How long we keep your personal data depends on the nature of the data, e.g. we keep personal data for at least the duration of the limitation period for bringing claims if the personal data may be required to commence or defend legal proceedings. Some information may also be retained for longer, e.g. where we are required to do so by law. 4. **Anonymised data**. In some circumstances we may anonymise your personal data so that it can no longer be associated with you, in which case we are entitled to retain and use such data without restriction. ### 10\. YOUR RIGHTS[​](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#10your-rights "Direct link to 10. YOUR RIGHTS") 1. **Rights you may enjoy**. Depending on the jurisdiction that you are in or where we operate, you may enjoy certain rights under applicable law in relation to our collection, use, disclosure and processing of your personal data. Such rights may include: 1. **Access**: you may ask us if we hold your personal data and, if we are, you can request access to your personal data. This enables you to receive a copy of and information on the personal data we hold about you. 2. **Correction**: you may request that any incomplete or inaccurate personal data we hold about you is corrected. 3. **Erasure**: you may ask us to delete or remove personal data that we hold about you in certain circumstances. 4. **Restriction**: you may withdraw consent for our use of your personal data, or ask us to suspend the processing of certain of your personal data about you, for example if you want us to establish its accuracy. 5. **Portability**: you may request the transfer of certain of your personal data to another party under certain conditions. 6. **Objection**: where we are processing your personal data based on a legitimate interest (or those of a third party) you may object to processing on this ground. If you wish to exercise any of your rights, you may contact us in accordance with paragraph 1(g). We may require that you submit certain forms or provide certain information to process your request. Where permitted by law, we may also charge you a fee to process your request. 2. **Limitations**. We may be permitted under applicable laws to refuse a request, for example, we may refuse (a) a request for erasure where the personal data is required for in connection with claims; or (b) an objection request and continue processing your personal data based on compelling legitimate grounds for the processing. * [1\. ABOUT THIS POLICY](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#1about-this-policy) * [2\. AMENDMENTS TO THIS PRIVACY POLICY](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#2amendments-to-this-privacy-policy) * [3\. WHAT PERSONAL DATA WE COLLECT](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#3what-personal-data-we-collect) * [4\. HOW WE COLLECT PERSONAL DATA](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#4how-we-collect-personal-data) * [5\. WHAT WE DO WITH YOUR PERSONAL DATA](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#5what-we-do-with-your-personal-data) * [6\. USE OF AUTOMATED DATA COLLECTION TECHNOLOGIES](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#6use-of-automated-data-collection-technologies) * [7\. DISCLOSURE OF PERSONAL DATA](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#7disclosure-of-personal-data) * [8\. TRANSFER OF PERSONAL DATA TO OTHER COUNTRIES](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#8transfer-of-personal-data-to-other-countries) * [9\. SECURITY AND RETENTION OF PERSONAL DATA](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#9security-and-retention-of-personal-data) * [10\. YOUR RIGHTS](https://docs.pendle.finance/pendle-v2/PrivacyPolicy#10your-rights) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Boros WebSocket | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Backend/websocket#__docusaurus_skipToContent_fallback) On this page This guide explains how to directly connect to Boros's WebSocket service using Socket.IO client. Basic Usage[​](https://docs.pendle.finance/boros-dev/Backend/websocket#basic-usage "Direct link to Basic Usage") ----------------------------------------------------------------------------------------------------------------- Here's a complete example of how to connect to and use the WebSocket: import { io } from 'socket.io-client';// Initialize the socket connectionconst socket = io('wss://api.boros.finance/pendle-dapp-v3', { path: '/socket/socket.io', reconnectionAttempts: 5, transports: ['websocket']}); Connection Events[​](https://docs.pendle.finance/boros-dev/Backend/websocket#connection-events "Direct link to Connection Events") ----------------------------------------------------------------------------------------------------------------------------------- ### Handling Connection[​](https://docs.pendle.finance/boros-dev/Backend/websocket#handling-connection "Direct link to Handling Connection") socket.on('connect', () => { console.log('Connected to WebSocket server');});socket.on('disconnect', () => { console.log('Disconnected from WebSocket server');});socket.on('connect_error', (error) => { console.error('Connection error:', error);}); Subscribing to Channels[​](https://docs.pendle.finance/boros-dev/Backend/websocket#subscribing-to-channels "Direct link to Subscribing to Channels") ----------------------------------------------------------------------------------------------------------------------------------------------------- To receive updates, you need to: 1. Subscribe to a channel 2. Listen for updates on that channel // Subscribe to a channelsocket.emit('subscribe', 'statistics:MARKET_ID');// Listen for updatessocket.on('statistics:MARKET_ID:update', (data) => { console.log('Received market statistics update:', data);}); Cleanup[​](https://docs.pendle.finance/boros-dev/Backend/websocket#cleanup "Direct link to Cleanup") ----------------------------------------------------------------------------------------------------- Always clean up your WebSocket connections when they're no longer needed: function cleanup() { // Unsubscribe from channels socket.emit('unsubscribe', 'statistics:MARKET_ID'); // Remove listeners socket.off('statistics:MARKET_ID:update'); // Disconnect socket.disconnect();} Channel Types[​](https://docs.pendle.finance/boros-dev/Backend/websocket#channel-types "Direct link to Channel Types") ----------------------------------------------------------------------------------------------------------------------- ### Market Channels[​](https://docs.pendle.finance/boros-dev/Backend/websocket#market-channels "Direct link to Market Channels") | Channel | Event | Description | | --- | --- | --- | | `orderbook:MARKET_ID:TICK_SIZE` | `orderbook:MARKET_ID:TICK_SIZE:update` | Orderbook updates. Accepted TICK\_SIZE: `0.1`, `0.01`, `0.001`, `0.0001`, `0.00001` | | `market-trade:MARKET_ID` | `market-trade:MARKET_ID:update` | Individual trade executions with `rate`, `size`, `blockTimestamp`, `txHash` | | `statistics:MARKET_ID` | `statistics:MARKET_ID:update` | Market statistics: `markApr`, `midApr`, `lastTradedApr`, `floatingApr`, `volume24h`, `notionalOI`, `nextSettlementTime`, `longYieldApr` | | `market-data:MARKET_ID` | `market-data-update` | Real-time market data from on-chain events. See [Market Data Events](https://docs.pendle.finance/boros-dev/Backend/websocket#market-data-events)
below. | ### Account Channels[​](https://docs.pendle.finance/boros-dev/Backend/websocket#account-channels "Direct link to Account Channels") | Channel | Event | Description | | --- | --- | --- | | `account:ACCOUNT` | `account:ACCOUNT:update` | Legacy notification — tells you _something_ changed (type: `Position`, `LimitOrder`, or `Collateral`). Requires REST API refetch. | | `account-updates:ROOT_ADDRESS` | `position-update` | Detailed position changes with pre/post state. See [Account Update Events](https://docs.pendle.finance/boros-dev/Backend/websocket#account-update-events)
. | | `account-updates:ROOT_ADDRESS` | `order-update` | Detailed order state changes (placed, filled, cancelled, purged). | | `account-updates:ROOT_ADDRESS` | `settlement-update` | Detailed settlement data (yield paid/received, APR rates, fees). | Replace `MARKET_ID` with your market identifier. For `ACCOUNT`, use `AccountLib.pack(address, accountId)`. For `ROOT_ADDRESS`, use your lowercased wallet address (e.g., `0xdac17...`). Prefer `account-updates` over `account` The legacy `account:ACCOUNT` channel only tells you _that_ something changed — you still need to call the REST API to find out _what_. The new `account-updates:ROOT_ADDRESS` channel includes full event details in the payload, eliminating the need for follow-up API calls. Best Practices[​](https://docs.pendle.finance/boros-dev/Backend/websocket#best-practices "Direct link to Best Practices") -------------------------------------------------------------------------------------------------------------------------- 1. **Connection Management** * Always handle connection errors * Implement reconnection logic if needed * Clean up connections when no longer needed 2. **Event Handling** * Subscribe to channels after connection is established * Remove listeners before disconnecting * Handle potential errors in data processing 3. **Resource Management** * Unsubscribe from channels you no longer need * Don't create multiple connections unnecessarily * Clean up resources when your application closes Example Implementation[​](https://docs.pendle.finance/boros-dev/Backend/websocket#example-implementation "Direct link to Example Implementation") -------------------------------------------------------------------------------------------------------------------------------------------------- Here's a complete example putting it all together: import { io } from 'socket.io-client';class PendleWebSocket { private socket: any; constructor() { this.socket = io('wss://api.boros.finance/pendle-dapp-v3', { path: '/socket/socket.io', reconnectionAttempts: 5, transports: ['websocket'] }); this.setupEventHandlers(); } private setupEventHandlers() { this.socket.on('connect', () => { console.log('Connected to WebSocket server'); }); this.socket.on('disconnect', () => { console.log('Disconnected from WebSocket server'); }); this.socket.on('connect_error', (error) => { console.error('Connection error:', error); }); } public subscribeToMarket(marketId: string) { const channel = `statistics:${marketId}`; this.socket.emit('subscribe', channel); this.socket.on(`${channel}:update`, (data) => { console.log(`Received update for ${marketId}:`, data); }); } public unsubscribeFromMarket(marketId: string) { const channel = `statistics:${marketId}`; this.socket.emit('unsubscribe', channel); this.socket.off(`${channel}:update`); } public disconnect() { this.socket.disconnect(); }}// Usage example:const ws = new PendleWebSocket();ws.subscribeToMarket('YOUR_MARKET_ID');// Clean up when done// ws.unsubscribeFromMarket('YOUR_MARKET_ID');// ws.disconnect(); Account Change Tracking[​](https://docs.pendle.finance/boros-dev/Backend/websocket#account-change-tracking "Direct link to Account Change Tracking") ----------------------------------------------------------------------------------------------------------------------------------------------------- You can subscribe to your account channel to receive notifications when your account state changes (e.g., order fills, position updates, balance changes). ### Subscribing to Account Updates[​](https://docs.pendle.finance/boros-dev/Backend/websocket#subscribing-to-account-updates "Direct link to Subscribing to Account Updates") The account channel format is `account:ACCOUNT`, where `ACCOUNT` is your wallet address (lowercased) concatenated with your account ID. For example, if your wallet address is `0xdAC17F958D2ee523a2206206994597C13D831ec7` and your account ID is `0` (the default account ID in Boros), the channel would be: account:0xdac17f958d2ee523a2206206994597c13d831ec700 You can use `AccountLib.pack()` from `@pendle/sdk-boros` to construct this: import { AccountLib } from '@pendle/sdk-boros';const account = AccountLib.pack('0xdAC17F958D2ee523a2206206994597C13D831ec7', 0);// account = '0xdac17f958d2ee523a2206206994597c13d831ec700' // Subscribe to account updates// Format: account:ACCOUNTconst channel = `account:${AccountLib.pack(walletAddress, accountId)}`;socket.emit('subscribe', channel);// Listen for account update eventssocket.on(`${channel}:update`, (data) => { console.log('Account updated:', data); // Refetch the latest account data via API refreshAccountData();}); ### Recommended Pattern[​](https://docs.pendle.finance/boros-dev/Backend/websocket#recommended-pattern "Direct link to Recommended Pattern") When you receive an account update event, **refetch the relevant API endpoints** to get the complete updated state: import axios from "axios";import { MarketAccLib, CROSS_MARKET_ID } from "@pendle/sdk-boros";async function refreshAccountData() { const marketAcc = MarketAccLib.pack(walletAddress, accountId, tokenId, CROSS_MARKET_ID); // Refetch account info const { data: accountInfo } = await axios.post( `${API_BASE_URL}/open-api/v1/accounts/market-acc-infos`, { marketAccs: [marketAcc] } ); // Refetch active orders const { data: orders } = await axios.get( `${API_BASE_URL}/open-api/v1/accounts/limit-orders`, { params: { userAddress: walletAddress, accountId: accountId, isActive: true, }, } ); // Update your local state updateLocalState(accountInfo, orders);} Market Data Events[​](https://docs.pendle.finance/boros-dev/Backend/websocket#market-data-events "Direct link to Market Data Events") -------------------------------------------------------------------------------------------------------------------------------------- Subscribe to `market-data:MARKET_ID` to receive real-time market data derived from on-chain events. The event name is `market-data-update`. **Payload fields:** | Field | Type | Description | | --- | --- | --- | | `mId` | number | Market ID | | `bn` | number | Block number of the on-chain event | | `bt` | number | Block timestamp (unix) | | `oi` | number | Notional open interest | | `mid` | number | Mid APR (from implied rate, AMM rate, or bid/ask average) | | `mk` | number | Mark APR (from contract) | | `lt` | number | Last traded APR | | `nst` | number | Next settlement time (unix) | | `bb` | number? | Best bid APR (undefined if no bids) | | `ba` | number? | Best ask APR (undefined if no asks) | | `ai` | number? | AMM implied APR (undefined if no AMM) | socket.emit('subscribe', `market-data:${marketId}`);socket.on('market-data-update', (data) => { console.log(`Market ${data.mId}: mark=${data.mk}, mid=${data.mid}, OI=${data.oi}`);}); Account Update Events[​](https://docs.pendle.finance/boros-dev/Backend/websocket#account-update-events "Direct link to Account Update Events") ----------------------------------------------------------------------------------------------------------------------------------------------- Subscribe to `account-updates:ROOT_ADDRESS` (lowercased wallet address) to receive detailed, structured events when your positions, orders, or settlements change. Unlike the legacy `account:ACCOUNT` channel which only notifies you that _something_ changed, these events include the full details — no REST API refetch needed. ### Position Update (`position-update`)[​](https://docs.pendle.finance/boros-dev/Backend/websocket#position-update-position-update "Direct link to position-update-position-update") Emitted when a position size or rate changes (trade fill, liquidation). | Field | Type | Description | | --- | --- | --- | | `ei` | number | Event index (on-chain sequence number) | | `bn` | number | Block number | | `bt` | number | Block timestamp (unix) | | `tx` | Hex | Transaction hash | | `mId` | number | Market ID | | `ma` | MarketAcc | Packed market account | | `prf` | string | Previous fixed rate (FixedX18 raw) | | `prs` | string | Previous position size (FixedX18 raw) | | `ptf` | string | Post-trade fixed rate (FixedX18 raw) | | `pts` | string | Post-trade position size (FixedX18 raw) | ### Order Update (`order-update`)[​](https://docs.pendle.finance/boros-dev/Backend/websocket#order-update-order-update "Direct link to order-update-order-update") Emitted when an order is placed, partially filled, fully filled, cancelled, or purged. | Field | Type | Description | | --- | --- | --- | | `ei` | number | Event index | | `bn` | number | Block number | | `bt` | number | Block timestamp (unix) | | `tx` | Hex | Transaction hash | | `mId` | number | Market ID | | `oId` | string | Order ID | | `sd` | Side | `0` = Long, `1` = Short | | `ps` | string | Original placed size (FixedX18 raw) | | `us` | string | Remaining unfilled size (FixedX18 raw) | | `tk` | number | Tick (price level) | | `ot` | OrderType | Order type: `0` = Limit, `1` = Market, `2` = TakeProfitMarket, `3` = StopLossMarket | | `os` | LimitOrderStatus | Order status: `0` = Filling (unfilled/partially filled), `1` = Cancelled, `2` = FullyFilled, `3` = Expired (market matured), `4` = Purged | | `efs` | string? | Size filled by this specific event (undefined if no fill) | ### Settlement Update (`settlement-update`)[​](https://docs.pendle.finance/boros-dev/Backend/websocket#settlement-update-settlement-update "Direct link to settlement-update-settlement-update") Emitted when a funding rate settlement is processed for a position. Only emitted for positions with non-zero size. Limited Availability `settlement-update` events are currently only emitted for a few active market makers, not for all users. General user support will be added in the future. For now, use `GET /accounts/settlements` or the legacy `account:ACCOUNT` channel to track settlements. | Field | Type | Description | | --- | --- | --- | | `ei` | number | Event index | | `bn` | number | Block number | | `bt` | number | Block timestamp (unix) | | `tx` | Hex | Transaction hash | | `ma` | MarketAcc | Packed market account | | `mId` | number | Market ID | | `ps` | string | Position size (negative = short) | | `yp` | string | Yield paid | | `yr` | string | Yield received | | `pa` | number | Annualized fixed rate paid | | `ra` | number | Annualized floating rate received | | `fee` | string | Settlement fee | ### Example: Subscribing to Account Updates[​](https://docs.pendle.finance/boros-dev/Backend/websocket#example-subscribing-to-account-updates "Direct link to Example: Subscribing to Account Updates") const root = walletAddress.toLowerCase();socket.emit('subscribe', `account-updates:${root}`);socket.on('position-update', (data) => { console.log(`Position changed on market ${data.mId}:`); console.log(` Size: ${data.prs} → ${data.pts}`); console.log(` Rate: ${data.prf} → ${data.ptf}`); console.log(` Tx: ${data.tx}`);});socket.on('order-update', (data) => { console.log(`Order ${data.oId} on market ${data.mId}: status=${data.os}`); if (data.efs) console.log(` Filled: ${data.efs}`);});socket.on('settlement-update', (data) => { console.log(`Settlement on market ${data.mId}: paid=${data.yp}, received=${data.yr}`);}); All numeric values use FixedX18 raw format Position sizes, rates, yields, and fees are returned as FixedX18 raw string values (18-decimal fixed-point). Use `FixedX18.fromBigIntString(value).toNumber()` from `@pendle/boros-offchain-math` to convert to human-readable numbers. ### Complete Account Tracking Example[​](https://docs.pendle.finance/boros-dev/Backend/websocket#complete-account-tracking-example "Direct link to Complete Account Tracking Example") import { io } from 'socket.io-client';import axios from 'axios';import { AccountLib } from '@pendle/sdk-boros';class AccountTracker { private socket: any; private walletAddress: string; private accountId: number; constructor(walletAddress: string, accountId: number = 0) { this.walletAddress = walletAddress.toLowerCase(); this.accountId = accountId; this.socket = io('wss://api.boros.finance/pendle-dapp-v3', { path: '/socket/socket.io', reconnectionAttempts: 5, transports: ['websocket'], }); this.setupConnection(); } private setupConnection() { this.socket.on('connect', () => { console.log('Connected - subscribing to account updates'); this.subscribeToAccount(); }); this.socket.on('disconnect', () => { console.log('Disconnected from WebSocket'); }); } private subscribeToAccount() { const channel = `account:${AccountLib.pack(this.walletAddress as `0x${string}`, this.accountId)}`; this.socket.emit('subscribe', channel); console.log('Subscribed to account:', channel); this.socket.on(`${channel}:update`, async (data: any) => { console.log('Account change detected:', data); // Fetch updated data from API await this.refreshAccountData(); }); } private async refreshAccountData() { try { // Fetch latest account state const { data } = await axios.post('https://api.boros.finance/open-api/v1/accounts/market-acc-infos', { marketAccs: [ /* your marketAcc */ ], }); console.log('Updated account data:', data); // Process updated data... } catch (error) { console.error('Failed to refresh account data:', error); } } public disconnect() { const channel = `account:${AccountLib.pack(this.walletAddress as `0x${string}`, this.accountId)}`; this.socket.emit('unsubscribe', channel); this.socket.off(`${channel}:update`); this.socket.disconnect(); }}// Usageconst tracker = new AccountTracker('0xdAC17F958D2ee523a2206206994597C13D831ec7', 0);// Clean up when done// tracker.disconnect(); * * * Error Handling[​](https://docs.pendle.finance/boros-dev/Backend/websocket#error-handling "Direct link to Error Handling") -------------------------------------------------------------------------------------------------------------------------- Always implement proper error handling: socket.on('connect_error', (error) => { console.error('Connection failed:', error); // Implement your error handling logic});socket.on('error', (error) => { console.error('Socket error:', error); // Implement your error handling logic}); * [Basic Usage](https://docs.pendle.finance/boros-dev/Backend/websocket#basic-usage) * [Connection Events](https://docs.pendle.finance/boros-dev/Backend/websocket#connection-events) * [Handling Connection](https://docs.pendle.finance/boros-dev/Backend/websocket#handling-connection) * [Subscribing to Channels](https://docs.pendle.finance/boros-dev/Backend/websocket#subscribing-to-channels) * [Cleanup](https://docs.pendle.finance/boros-dev/Backend/websocket#cleanup) * [Channel Types](https://docs.pendle.finance/boros-dev/Backend/websocket#channel-types) * [Market Channels](https://docs.pendle.finance/boros-dev/Backend/websocket#market-channels) * [Account Channels](https://docs.pendle.finance/boros-dev/Backend/websocket#account-channels) * [Best Practices](https://docs.pendle.finance/boros-dev/Backend/websocket#best-practices) * [Example Implementation](https://docs.pendle.finance/boros-dev/Backend/websocket#example-implementation) * [Account Change Tracking](https://docs.pendle.finance/boros-dev/Backend/websocket#account-change-tracking) * [Subscribing to Account Updates](https://docs.pendle.finance/boros-dev/Backend/websocket#subscribing-to-account-updates) * [Recommended Pattern](https://docs.pendle.finance/boros-dev/Backend/websocket#recommended-pattern) * [Market Data Events](https://docs.pendle.finance/boros-dev/Backend/websocket#market-data-events) * [Account Update Events](https://docs.pendle.finance/boros-dev/Backend/websocket#account-update-events) * [Position Update (`position-update`)](https://docs.pendle.finance/boros-dev/Backend/websocket#position-update-position-update) * [Order Update (`order-update`)](https://docs.pendle.finance/boros-dev/Backend/websocket#order-update-order-update) * [Settlement Update (`settlement-update`)](https://docs.pendle.finance/boros-dev/Backend/websocket#settlement-update-settlement-update) * [Example: Subscribing to Account Updates](https://docs.pendle.finance/boros-dev/Backend/websocket#example-subscribing-to-account-updates) * [Complete Account Tracking Example](https://docs.pendle.finance/boros-dev/Backend/websocket#complete-account-tracking-example) * [Error Handling](https://docs.pendle.finance/boros-dev/Backend/websocket#error-handling) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 3.1 - Fixed Yield on Pendle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#__docusaurus_skipToContent_fallback) On this page > Course level: **#intermediate**. Fixed Yield with PT[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#fixed-yield-with-pt "Direct link to Fixed Yield with PT") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- With a fixed yield deposit, you are **guaranteed to earn the displayed amount of your chosen underlying asset** if you hold the position until the maturity date. In the example below, if you deposit 1 stETH, you can redeem ~1.17 stETH on 29th of December 2027, earning a fixed profit of ~0.17 stETH or an annualized rate of ~4.687%. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(1).png) Volatility-proof yield - what you see is what you get 💡 Think of it like a term-deposit account, or a CD (Certificate of Deposit) offered by commercial banks, but it’s even better with Pendle as **your deposit is** _**not**_ **locked** and **can exit at any time**. * * * ### Why earn fixed yield?[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#why-earn-fixed-yield "Direct link to Why earn fixed yield?") DeFi yield often declines over time. With Pendle fixed yield, you can secure the yield you like on Pendle Earn, and then relax. No more checking the APRs every day and hopping from farm to farm. 💡 A fixed yield deposit can also be a viable alternative to spot, with similar risk exposure, and the benefit of downside cushion thanks to the Fixed Yield realized upon redemption. ### Where does the yield come from?[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#where-does-the-yield-come-from "Direct link to Where does the yield come from?") Behind the scenes, you are swapping your deposit for the [**Principal Token**](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics#pt-and-yt-in-pendle) **(PT)** of your chosen asset. You buy the PT (PT-stETH in this example) **at a lower price** than the underlying asset (stETH in this example). Your PT can be **redeemed 1:1 for the underlying asset** (stETH in this example) at or after the maturity date. In other words, the price difference is your yield at maturity. You can refer back to [Chapter 2](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) where we explained how PT can be sold at a discount by using yield tokenization, and how it works just like zero-coupon bonds in TradFi. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(76).png) ### How to start earning[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#how-to-start-earning "Direct link to How to start earning") 1. Go to the Markets page: [https://app.pendle.finance/trade/markets](https://app.pendle.finance/trade/markets) . 2. Deposit and start earning 1. Select an asset and a maturity date you like. You can also sort the list by the “Highest Fixed APY”. 2. Click on the “PT - Fixed APY” box to continue. 3. Select your input asset and amount (which will be swapped to the pool’s asset to buy PT, if necessary). This can be a different token to the underlying asset and we will find the best route to swap your asset. 4. Review how much you will be able to redeem at maturity (i.e. the actual earning) and the effective Fixed APY you will earn. 5. Approve and confirm the transaction. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(2).png) ### FAQ[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#faq "Direct link to FAQ") **Am I locked until the maturity date? Can I exit early?** > You are _not_ locked at all, you can exit at any time by selling your position (which is a PT) at market price on Pendle’s AMM (through “Pendle Trade” interface). **Do I earn less or even lose money if I exit early?** > It depends on the market price of PT (after deducting trading fees and slippage). The market price is driven by buyers'/sellers' activities, and generally, if the market expects the asset to generate higher APY%, PT price may drop in the short term. Conversely, if the market expects the asset to generate lower APY%, PT price may rise in the short term. > > _However_, note that **time works in your favor** in this strategy because PT price gradually closes its gap to the underlying asset (in other words, the PT price relative to the underlying asset increases over time), and eventually becomes 1:1 to the underlying asset at maturity date. So you don’t need to worry even if PT price fluctuates in the short term. You may even take early profit by exiting early when PT price rises too. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(78).png) You can sell your position at any time at market price. Market prices may fluctuate but eventually converge to the full underlying asset price. **The fixed yield APY% being offered on Pendle changes over time, does that affect my earnings?** > No, you are **guaranteed to the fixed yield APY% when you open your position**. The new rate only affects new deposits or newly opened positions. It is just like bonds or CDs in TradFi, the market rate can change daily but once you open your position, you’re secured to the rate at that time. **When is a good time to open a fixed-yield position?** > The simple answer is when the APY% offered is high. Of course, we can’t predict how the market will behave, so as long as you are satisfied with earning 4% with your stETH for example, go for it. > > Also, if you expect the underlying asset’s APY to go down (let’s say you think ETH staking yield will drop because more people will join staking), the fixed yield strategy will benefit you because: > > 1. You secured a higher APY% before it goes down > 2. PT market price may rise in the short term compared to your purchase price if other traders think the same (to buy more PTs or sell their YTs which pushes up PT’s market price), and you may be able to close your position early with a profit **Do I have to claim my yield?** > No. You earn by getting a lower price when you buy PT. You are guaranteed to redeem 1:1 the underlying asset at or after the maturity date, thereby fully realizing the discount as profit. > > You’ll need to manually redeem the underlying at maturity. ### PT as a short-yield strategy[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#pt-as-a-short-yield-strategy "Direct link to PT as a short-yield strategy") > Check out [chapter-6-shorting-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield "mention") > for a deep dive into how the strategy also works _as a short-yield strategy_ and how to look for the best time to enter or exit. * [Fixed Yield with PT](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#fixed-yield-with-pt) * [Why earn fixed yield?](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#why-earn-fixed-yield) * [Where does the yield come from?](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#where-does-the-yield-come-from) * [How to start earning](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#how-to-start-earning) * [FAQ](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#faq) * [PT as a short-yield strategy](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle#pt-as-a-short-yield-strategy) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 6 - Shorting Yield | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#__docusaurus_skipToContent_fallback) On this page > Course level: **#advanced** 💡 Review [chapter 2](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) to learn about the basics of what is a **Principal Token** (**PT**). Review [chapter 3](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle) to learn about buying PT to get fixed-yields. ### TLDR[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#tldr "Direct link to TLDR") Recall that you can [split your yield-bearing asset](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) on Pendle into one that represents the principal (PT) and one that represents the yield (YT). You can sell or buy these tokens on the Pendle market to bet on the changes in yield. For example, if you think the yield will go down, you can sell your YT and keep your PT. This way, you can secure a fixed rate of return and avoid losing money if the yield drops. This is called **shorting yield**. ### PT is a **short yield position**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#pt-is-a-short-yield-position "Direct link to pt-is-a-short-yield-position") Buying and holding PT is more than just earning a fixed income. It is also a way to bet against falling yields. When the market expects yield to go down, PT price goes up. PT is therefore also a short-yield position. [Implied APY falls if the market consensus believes the yield of an asset will go down](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#implied-apy) . This drives PT price higher and you can choose to sell your PT to make a profit. This is called active yield trading. ### When should you buy PT?[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#when-should-you-buy-pt "Direct link to When should you buy PT?") The fixed yield from buying and holding PT **depends on the current market price of PT**. Intuitively, you should **buy PT when it is cheaper,** as you would **get a higher fixed yield**. But how can you tell that PT is selling at a cheap price? You need to **compare the fixed yield** **with the average future yield of the underlying asset**. The average future yield is your own prediction of the future yield from now until maturity. If the fixed yield is higher than your prediction of the average future yield, then it is probably a good time to buy PT. This means you are betting against the market and securing a higher rate of return. For example, if you predict that the average future yield until maturity for stETH is 5%, but PT stETH is priced at a 6% fixed rate, then you should buy and hold PT stETH. _**PRO TIP**_ **Timing is important** when executing a PT trade. As people buy and sell PT in Pendle, the fixed rate will fluctuate up and down. If you can wait and enter the PT trade right when PT is oversold (due to volatility or mispricing), you will secure a high fixed rate all the way until maturity. Numerically, **Fixed APY = Implied APY**, which shows the market expectation of the future yield. You can therefore also compare the implied APY against the underlying APY within each asset market in the “Market” page. Generally speaking, **PT is cheap when the implied APY is much higher than the underlying APY** (unless you believe the underlying APY is going to bounce back). ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(105).png) In a nutshell, you may consider entering a short yield position by buying PT when… 1. you believe the asset will generate less underlying APY in the future, or 2. you want to hedge against falling yield, or 3. you feel satisfied enough with the advertised APY, or 4. you believe PT is too undervalued ### How to Ape[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#how-to-ape "Direct link to How to Ape") 1. **Go to** [**Pendle**](https://app.pendle.finance/pro/markets) 2. **Buy PT** 1. Select the PT you want to buy. 2. Select input asset (i.e. what you want to use to buy PT). 3. Review the Output and Price Impact of your trade. 4. Approve and confirm the transaction. 3. **Passive Management** - Hold PT and redeem the Underlying Asset upon expiry **Active Trading** - Sell PT when price increases ### Early selling of PTs[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#early-selling-of-pts "Direct link to Early selling of PTs") Instead of waiting until maturity to redeem the underlying asset, you can also choose to sell your PT early. The usual motivations for selling PTs include: * Exiting the position to move capital elsewhere, or * PT price has increased significantly and there is an opportunity to take profit early. This is known as Active Yield Trading. ### See how it works in practice[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#see-how-it-works-in-practice "Direct link to See how it works in practice") Let's say that there is an stETH pool in Pendle with a maturity of 1 year. That means the holder of **PT stETH is guaranteed to be able to redeem stETH at 1:1** after 1 year. Peepo sees the following information from the Pendle Market page on 01 Jan 2023: ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(42).png) **PT stETH = 0.94 stETH** You can pay 0.94 stETH to buy 1 PT stETH now and redeem 1 stETH after maturity **Underlying APY = 5%** Underlying APY means that stETH is currently generating a 5% yield from staking rewards in Lido. Thus holding stETH nets a 5% APY. **Fixed APY = 6.4%** Fixed APY for buying and holding PT until maturity is 6.4% Peepo predicts that the average future yield in Lido will **at best be 6%**, so securing a **6.4% fixed yield** is a good move. Peepo proceeds to purchase **100 PT stETH (= 94 stETH)**. Having purchased **100 PT stETH**, Peepo is guaranteed to be able to **redeem 100 stETH** after the PT matures in 1 year. Effectively this produces a **Fixed APY of 6.4%**. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(43).png) Actually, **even if the Fixed APY was slightly lower than the Underlying APY**, it might still be a good deal, especially **if you predict that** **yield will drop in the future**. This is especially useful in turbulent markets when the yield can fluctuate rapidly, as you can **fix your APY at a desirable rate** and not need to worry about your return dropping at all. * [TLDR](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#tldr) * [PT is a **short yield position**](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#pt-is-a-short-yield-position) * [When should you buy PT?](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#when-should-you-buy-pt) * [How to Ape](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#how-to-ape) * [Early selling of PTs](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#early-selling-of-pts) * [See how it works in practice](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield#see-how-it-works-in-practice) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Router Integration Guide | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/Contracts/Router#__docusaurus_skipToContent_fallback) On this page Prefer the API over direct contract calls Interacting with Boros contracts directly is **not recommended** for most use cases. The [REST API](https://docs.pendle.finance/boros-dev/Backend/api) and [SDK](https://docs.pendle.finance/boros-dev/Backend/overview) handle authentication, calldata encoding, and transaction submission for you. Direct contract interaction is error-prone and may break if contract addresses or ABIs change. The information below is provided as a reference for advanced integrators only. The Router contract serves as the main entry point for all user interactions with Boros. Router follows a modular architecture: * **AuthModule**: agent authentication and delegated trading (irrelevant for external parties) * **AMMModule**: AMM-specific operations (add/remove liquidity, swaps) * **TradeModule**: core trading operations (enter/exit markets, place/cancel orders, cash transfer) * **ConditionalModule**: conditional order execution (used by stop-order system) * **DepositModule**: deposit box operations (managed by Pendle backend) * **MiscModule**: utility functions (simulation, batch operations) Account Authorization[​](https://docs.pendle.finance/boros-dev/Contracts/Router#account-authorization "Direct link to Account Authorization") ---------------------------------------------------------------------------------------------------------------------------------------------- Currently, you can only operate on the **main account (subaccount 0)**. Support for other subaccounts may be added in future versions. Most Router functions require two key parameters: * **`bool cross`**: Specifies margin mode (true = cross-margin, false = isolated-margin) * **`MarketId marketId`**: The market identifier These parameters construct the `MarketAcc` (Market Account) identifier: // Cross-margin account (can trade multiple markets)bool cross = true;MarketId marketId = MarketIdLib.CROSS; // Special cross-margin value// Isolated-margin account (single market)bool cross = false;MarketId marketId = MarketId.wrap(12345); // Specific market ID Vault Operations[​](https://docs.pendle.finance/boros-dev/Contracts/Router#vault-operations "Direct link to Vault Operations") ------------------------------------------------------------------------------------------------------------------------------- Vault operations manage the underlying collateral tokens. ### Deposit cash[​](https://docs.pendle.finance/boros-dev/Contracts/Router#deposit-cash "Direct link to Deposit cash") router.vaultDeposit( 0, // accountId (0 = main account) tokenId, // TokenId of collateral token marketId, // marketId (2^24-1 for cross account) 1 ether // Raw token amount); ### Withdraw cash[​](https://docs.pendle.finance/boros-dev/Contracts/Router#withdraw-cash "Direct link to Withdraw cash") Withdrawals follow a two-step process: request → cooldown period → finalize. **Checking Withdrawal Status**: You can monitor your withdrawal request status and cooldown period through MarketHub's [getUserWithdrawalStatus](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getuserwithdrawalstatus) function. This returns detailed information including the pending amount and exact timestamp when withdrawal becomes available. // Step 1: Request withdrawalrouter.requestVaultWithdrawal(tokenId, 1 ether);// Step 2: After cooldown period, finalize withdrawal on MarketHubIMarketHub(marketHub).finalizeVaultWithdrawal( address(this), // root address tokenId // TokenId of collateral token);// Can cancel pending withdrawalrouter.cancelVaultWithdrawal(tokenId); ### Cash Transfer[​](https://docs.pendle.finance/boros-dev/Contracts/Router#cash-transfer "Direct link to Cash Transfer") Transfer cash between cross-margin and isolated-margin accounts using the same collateral token. // Transfer from cross-margin to isolated-margin accountCashTransferReq memory req = CashTransferReq({ marketId: marketId, // Target isolated market signedAmount: 1000e18 // Positive = from cross to isolated});router.cashTransfer(req);// Transfer from isolated-margin back to cross-margin accountreq.signedAmount = -500e18; // Negative = from isolated to crossrouter.cashTransfer(req); ### Subaccount Transfer[​](https://docs.pendle.finance/boros-dev/Contracts/Router#subaccount-transfer "Direct link to Subaccount Transfer") Transfer cash between subaccounts under the same root. This is distinct from cross/isolated cash transfer — it moves funds between different subaccount IDs (e.g., from subaccount 0 to subaccount 1). router.subaccountTransfer( 1, // target accountId tokenId, // TokenId of collateral token marketId, // marketId (CROSS for cross-margin) 500e18, // amount to transfer true // isDeposit: true = transfer TO target, false = transfer FROM target); note Currently only subaccount 0 is available for external users. Subaccount transfers are primarily used internally. Market Entry and Exit[​](https://docs.pendle.finance/boros-dev/Contracts/Router#market-entry-and-exit "Direct link to Market Entry and Exit") ---------------------------------------------------------------------------------------------------------------------------------------------- ### Enter Markets[​](https://docs.pendle.finance/boros-dev/Contracts/Router#enter-markets "Direct link to Enter Markets") Users must enter markets before trading. MarketId[] memory marketIds = new MarketId[](2);marketIds[0] = marketId0;marketIds[1] = marketId1;// Enter multiple marketsEnterExitMarketsReq memory req = EnterExitMarketsReq({ cross: true, isEnter: true, marketIds: marketIds});router.enterExitMarkets(req); **Market Entry Limits**: Each market account (`marketAcc`) can enter a maximum of **10 markets** simultaneously. This limit is per combination of `(address, accountId, tokenId)` — i.e., per collateral type. Exceeding this limit will cause transactions to revert. You must **exit expired or matured markets** to free up slots before entering new ones. **Market Entrance Fees**: A one-time entrance fee is charged when you first interact with any market. See [Fees — Market Entrance Fees](https://docs.pendle.finance/boros-dev/Mechanics/Fees#market-entrance-fees) for amounts. **Minimum Cash Requirements**: You must maintain minimum cash balances in your account to participate in markets. Check the [specific requirements](https://docs.pendle.finance/boros-dev/Contracts/MarketHub#getcashfeedata) for cross vs isolated margin modes. ### Exit Markets[​](https://docs.pendle.finance/boros-dev/Contracts/Router#exit-markets "Direct link to Exit Markets") **Exit Requirements**: To exit a market, you must: * Close all positions (zero position size) * Cancel all open orders * Have no pending settlements **Market Maturity**: When markets reach maturity, you should exit them to free up market slots. MarketId[] memory marketIds = new MarketId[](2);marketIds[0] = marketId0;marketIds[1] = marketId1;// Exit multiple marketsEnterExitMarketsReq memory req = EnterExitMarketsReq({ cross: true, isEnter: false, marketIds: marketIds});router.enterExitMarkets(req); Order Book Trading[​](https://docs.pendle.finance/boros-dev/Contracts/Router#order-book-trading "Direct link to Order Book Trading") ------------------------------------------------------------------------------------------------------------------------------------- ### Place Single Order[​](https://docs.pendle.finance/boros-dev/Contracts/Router#place-single-order "Direct link to Place Single Order") **Compound Function**: `placeSingleOrder` is a compound function that can: * Automatically enter markets if `enterMarket` is true * Cancel existing orders via `idToStrictCancel` * Place the new order * Transfer cash for isolated margin positions * Automatically exit markets if `exitMarket` is true This reduces the number of transactions needed for complex operations. // Basic limit orderSingleOrderReq memory req = SingleOrderReq({ order: OrderReq({ cross: true, // Cross-margin marketId: marketId, ammId: AMMIdLib.ZERO, // Order book only (not AMM) side: Side.LONG, // Buy interest rate swap tif: TimeInForce.GTC, // Good till cancelled size: 1000e18, // Position size tick: 125 // Price tick (≈5% rate) }), enterMarket: false, // Don't auto-enter market idToStrictCancel: OrderIdLib.ZERO, // No order to cancel exitMarket: false, // Don't auto-exit isolated_cashIn: 0, // For isolated margin only isolated_cashTransferAll: false, desiredMatchRate: 0 // Accept any match rate});router.placeSingleOrder(req); ### Bulk Orders[​](https://docs.pendle.finance/boros-dev/Contracts/Router#bulk-orders "Direct link to Bulk Orders") bulkOrders does NOT match with the AMM Orders placed via `bulkOrders` are placed directly into the order book and **cannot match with AMM liquidity**. If you need to take liquidity from both the order book and the AMM (e.g., for taker orders), use [`placeSingleOrder`](https://docs.pendle.finance/boros-dev/Contracts/Router#place-single-order) instead. For taker-only execution without any residual maker orders, set `tif` to `IOC` (Immediate or Cancel) or `FOK` (Fill or Kill). **Optimal for Market Makers**: `bulkOrders` is designed for professional market makers and offers: * Place multiple orders in a single transaction * Operate across multiple markets simultaneously * Cancel existing orders before placing new ones * Significant gas savings compared to individual order transactions **Cancel Parameters**: * `isAll: true` - Cancel all existing orders in the market before placing new orders * `isAll: false` - Cancel only the specific order IDs listed in the `ids` array * `isStrict: true` - Transaction reverts if any specified order ID doesn't exist * `isStrict: false` - Silently skip non-existent order IDs without reverting // Place multiple orders across different marketsBulkOrder[] memory bulks = new BulkOrder[](2);uint256[] memory sizes0 = new uint256[](2);sizes0[0] = 500e18;sizes0[1] = 300e18;int16[] memory limitTicks0 = new int16[](2);limitTicks0[0] = 120;limitTicks0[1] = 125;bulks[0] = BulkOrder({ marketId: marketId1, orders: LongShort({ tif: TimeInForce.GTC, side: Side.LONG, sizes: sizes0, limitTicks: limitTicks0 }), cancelData: CancelData({ ids: new OrderId[](0), isAll: false, isStrict: false })});uint256[] memory sizes1 = new uint256[](1);sizes1[0] = 1900e18;int16[] memory limitTicks1 = new int16[](1);limitTicks1[0] = 140;bulks[1] = BulkOrder({ marketId: marketId2, orders: LongShort({ tif: TimeInForce.GTC, side: Side.SHORT, sizes: sizes1, limitTicks: limitTicks1 }), cancelData: CancelData({ ids: new OrderId[](0), isAll: false, isStrict: false })});int128[] memory desiredMatchRates = new int128[](2);desiredMatchRates[0] = 0;desiredMatchRates[1] = 0;BulkOrdersReq memory req = BulkOrdersReq({ cross: true, bulks: bulks, desiredMatchRates: desiredMatchRates});BulkOrderResult[] memory results = router.bulkOrders(req); ### Cancel Orders[​](https://docs.pendle.finance/boros-dev/Contracts/Router#cancel-orders "Direct link to Cancel Orders") OrderId[] memory orderIds = new OrderId[](2);orderIds[0] = orderId1;orderIds[1] = orderId2;// Cancel specific ordersBulkCancels memory cancels = BulkCancels({ cross: true, marketId: marketId, cancelAll: false, orderIds: orderIds});router.bulkCancels(cancels);// Cancel all orders in a marketcancels.cancelAll = true;cancels.orderIds = new OrderId[](0);router.bulkCancels(cancels); AMM[​](https://docs.pendle.finance/boros-dev/Contracts/Router#amm "Direct link to AMM") ---------------------------------------------------------------------------------------- ### Add Liquidity Dual[​](https://docs.pendle.finance/boros-dev/Contracts/Router#add-liquidity-dual "Direct link to Add Liquidity Dual") Adding liquidity requires providing both cash and position sizes in proportion to the AMM's current state. The AMM automatically calculates the required ratio based on its current cash-to-position balance. AddLiquidityDualToAmmReq memory req = AddLiquidityDualToAmmReq({ cross: true, ammId: ammId, maxCashIn: 10000e18, exactSizeIn: 1000e18, minLpOut: 950e18});(uint256 lpOut, int256 cashIn, uint256 fee) = router.addLiquidityDualToAmm(req); ### Add Liquidity Single Cash[​](https://docs.pendle.finance/boros-dev/Contracts/Router#add-liquidity-single-cash "Direct link to Add Liquidity Single Cash") This function simplifies liquidity provision by: 1. Using part of your cash to trade for the required position size 2. Adding the remaining cash + acquired position as dual liquidity AddLiquiditySingleCashToAmmReq memory req = AddLiquiditySingleCashToAmmReq({ cross: true, ammId: ammId, enterMarket: true, netCashIn: 5000e18, minLpOut: 450e18});(uint256 lpOut, int256 cashUsed, uint256 fee, int256 swapSize) = router.addLiquiditySingleCashToAmm(req); ### Remove Liquidity Dual[​](https://docs.pendle.finance/boros-dev/Contracts/Router#remove-liquidity-dual "Direct link to Remove Liquidity Dual") Removes liquidity and receives both cash and position sizes proportionally. You specify the LP tokens to burn and receive the underlying assets based on the AMM's current composition. // Remove liquidity and receive both cash and sizeRemoveLiquidityDualFromAmmReq memory req = RemoveLiquidityDualFromAmmReq({ cross: true, ammId: ammId, lpToRemove: 1000e18, minCashOut: 4500e18, minSizeOut: -1200e18, maxSizeOut: -800e18});(int256 cashOut, int256 sizeOut, uint256 fee) = router.removeLiquidityDualFromAmm(req); ### Remove Liquidity Single Cash[​](https://docs.pendle.finance/boros-dev/Contracts/Router#remove-liquidity-single-cash "Direct link to Remove Liquidity Single Cash") Removes liquidity and converts everything to cash by: 1. Withdrawing proportional cash and position sizes 2. Trading the position sizes back to cash 3. Returning the total cash amount to you RemoveLiquiditySingleCashFromAmmReq memory req = RemoveLiquiditySingleCashFromAmmReq({ cross: true, ammId: ammId, lpToRemove: 500e18, minCashOut: 4800e18});(int256 cashOut, uint256 fee, int256 swapSize) = router.removeLiquiditySingleCashFromAmm(req); Simulation[​](https://docs.pendle.finance/boros-dev/Contracts/Router#simulation "Direct link to Simulation") ------------------------------------------------------------------------------------------------------------- The MiscModule provides simulation capabilities. // Simulate multiple operationsSimulateData[] memory simulations = new SimulateData[](2);simulations[0] = SimulateData({ account: mainAccount, target: address(router), data: abi.encodeCall(ITradeModule.placeSingleOrder, orderRequest)});simulations[1] = SimulateData({ account: mainAccount, target: address(router), data: abi.encodeCall(IAMMModule.swapWithAmm, swapRequest)});// Get simulation results without changing state(bytes[] memory results, uint256[] memory gasUsed) = router.batchSimulate(simulations); Conditional Orders[​](https://docs.pendle.finance/boros-dev/Contracts/Router#conditional-orders "Direct link to Conditional Orders") ------------------------------------------------------------------------------------------------------------------------------------- The ConditionalModule enables orders with off-chain trigger conditions. This is the on-chain mechanism underlying the [Stop Order](https://docs.pendle.finance/boros-dev/Backend/stop-orders) system. **How it works:** 1. The user (agent) signs a `ConditionalOrder` specifying the trade parameters and a hashed off-chain condition 2. When the condition is met (e.g., market rate crosses a threshold), a permissioned validator signs an execution message 3. The validator submits both signatures to `executeConditionalOrder()`, which executes the trade on-chain struct ConditionalOrder { Account account; // The trading account bool cross; // Cross or isolated margin MarketId marketId; // Target market Side side; // LONG or SHORT TimeInForce tif; // Order type (GTC, IOC, etc.) uint256 size; // Order size int16 tick; // Price tick bool reduceOnly; // Only reduce existing position uint256 salt; // Unique salt for replay protection uint64 expiry; // Order expiration timestamp bytes32 hashedOffchainCondition; // Hash of the trigger condition} note Conditional orders are not placed directly by users. They are managed through the [Stop Order Service](https://docs.pendle.finance/boros-dev/Backend/stop-orders) API, which handles the signing, condition monitoring, and execution flow. * [Account Authorization](https://docs.pendle.finance/boros-dev/Contracts/Router#account-authorization) * [Vault Operations](https://docs.pendle.finance/boros-dev/Contracts/Router#vault-operations) * [Deposit cash](https://docs.pendle.finance/boros-dev/Contracts/Router#deposit-cash) * [Withdraw cash](https://docs.pendle.finance/boros-dev/Contracts/Router#withdraw-cash) * [Cash Transfer](https://docs.pendle.finance/boros-dev/Contracts/Router#cash-transfer) * [Subaccount Transfer](https://docs.pendle.finance/boros-dev/Contracts/Router#subaccount-transfer) * [Market Entry and Exit](https://docs.pendle.finance/boros-dev/Contracts/Router#market-entry-and-exit) * [Enter Markets](https://docs.pendle.finance/boros-dev/Contracts/Router#enter-markets) * [Exit Markets](https://docs.pendle.finance/boros-dev/Contracts/Router#exit-markets) * [Order Book Trading](https://docs.pendle.finance/boros-dev/Contracts/Router#order-book-trading) * [Place Single Order](https://docs.pendle.finance/boros-dev/Contracts/Router#place-single-order) * [Bulk Orders](https://docs.pendle.finance/boros-dev/Contracts/Router#bulk-orders) * [Cancel Orders](https://docs.pendle.finance/boros-dev/Contracts/Router#cancel-orders) * [AMM](https://docs.pendle.finance/boros-dev/Contracts/Router#amm) * [Add Liquidity Dual](https://docs.pendle.finance/boros-dev/Contracts/Router#add-liquidity-dual) * [Add Liquidity Single Cash](https://docs.pendle.finance/boros-dev/Contracts/Router#add-liquidity-single-cash) * [Remove Liquidity Dual](https://docs.pendle.finance/boros-dev/Contracts/Router#remove-liquidity-dual) * [Remove Liquidity Single Cash](https://docs.pendle.finance/boros-dev/Contracts/Router#remove-liquidity-single-cash) * [Simulation](https://docs.pendle.finance/boros-dev/Contracts/Router#simulation) * [Conditional Orders](https://docs.pendle.finance/boros-dev/Contracts/Router#conditional-orders) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 4 - Yield Trading Basics with YT | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#__docusaurus_skipToContent_fallback) On this page > Course level: **#intermediate** You’ve made it through the first 3 chapters and learned the [basics of PT and YT](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) , as well as how to use Pendle to [earn passive income](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.1-fixed-yield-on-pendle) from yield. Great job! Now let’s dive deeper to execute various kinds of yield trading strategies through buying and selling YT. Yield Trading 101 with YT[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#yield-trading-101-with-yt "Direct link to Yield Trading 101 with YT") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- In this chapter, we will tap into the simplest form of yield trade — _buying a YT (Yield Token)._ ### Buy YT to long yield[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#buy-yt-to-long-yield "Direct link to Buy YT to long yield") One way to trade yield with Pendle is to buy YT ([Yield Token](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) ). That means you are **increasing your yield exposure (long yield)**. You can either hold it until maturity, or swing-trade it to turn a quick profit, if you buy low and sell high. This strategy works well when you expect the underlying APY of an asset to rise in the future, or when you think the YT price is undervalued (we’ll explain more later). 💡 Remember: YT holders receive the yield of the underlying asset ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(92).png) Go to “Market” under the “Trade” interface from the top menu bar. Then choose your asset and click “YT”. ### **Get leveraged yield exposure without borrowing risk**[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#get-leveraged-yield-exposure-without-borrowing-risk "Direct link to get-leveraged-yield-exposure-without-borrowing-risk") Since YT is typically much cheaper than the principal, you _effectively_ get **leveraged yield exposure** by buying YT. For example, in the image below, you can earn the yield of ~11.9 stETH with just the cost of 1 stETH, which is an 11.9x effective leverage in _notional value traded_. There’s **no borrowing involved**, so there’s **no risk of liquidation or oracle errors**. The leverage is simply achieved by [Yield Tokenisation](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) , which lets you buy only the yield portion of the asset for a small fraction of the original price. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(93).png) With the cost of 1 stETH, you are buying yield exposure of 11.9 stETH. An 11.9x leverage in notional value in this case. ### **How do I profit from buying YT?**[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#how-do-i-profit-from-buying-yt "Direct link to how-do-i-profit-from-buying-yt") You profit when either: 1. YT price increases, or 2. Yield received from YT is more than the cost of buying YT Generally speaking, you are betting that either or both… 1. the **implied APY** rises after you buy (which pumps the YT price), and implied APY is driven by **market force** (supply & demand of YT and PT) 2. the **underlying APY** and/or the **long yield APY** becomes higher (which means yield is being produced faster) 💡 Don’t worry if you are not familiar with the different kinds of APYs and jargons, we will cover those in the [next chapter](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading) . For now, the summary table below should be enough for most situations. Here’s a table that quickly summarizes what is going in favor or against you as a YT holder. Just flip the arrows’ directions if the indicators go the other way round. | Indicators👇 / Effect 👉 | YT Price | YT Yield Receivables | | --- | --- | --- | | Underlying asset price ⤴️ | ⬆️ | ┄ | | Implied APY ⤴️ | ⬆️ | ┄ | | Underlying APY ⤴️ | ┄ | ⬆️ | | Long Yield APY ⤴️ | ┄ | ⬆️ | | Time to maturity ⤵️ | ⬇️ (slowly) | ┄ | In simple terms: * **A good time to buy YT** is when the implied APY is low, which means the YT price is low. You also want to make sure the long yield APY is positive (the higher the better), which suggests that the YT _may_ be undervalued. * **A good time to sell YT** is just the opposite — when the implied APY is high, which means the YT price is high. Also, when the long yield APY is close to zero or even negative, it suggests that the YT _may_ be overvalued. 💡 More on how to better determine when it is a good time to buy or sell YT, in our [chapter-8-long-yield-obtain-leveraged-yield-exposure.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure "mention") . ### **How to buy YT**[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#how-to-buy-yt "Direct link to how-to-buy-yt") 1. Go to the “Markets” page [https://app.pendle.finance/trade/markets](https://app.pendle.finance/trade/markets) from the top menu. 2. Choose an asset and buy its YT 1. Select an underlying asset and a maturity date you like. Look for one with high underlying APY and/or low implied APY. 2. Click on the “YT - Long Yield APY” box to continue. 3. Select your input asset and amount (which will be swapped to the pool’s asset to buy YT, if necessary). This can be a different token to the underlying asset and we will find the best route to swap your asset. 4. Review the effective implied APY after price impact and fees, which is also the effective cost of your YT, and the effective long yield APY you will earn. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(48).png) Review the effective implied APY, long yield APY and price impact. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(49).png) Review the different scenarios of your profit projections. You can also use the “Calculator” on the bottom right of the page to run customized projections. 3. Approve and confirm the transaction. 4. If you have an open position, click **“Dashboard”** on the top menu to see your current positions. You can later click the **“Claim”** button to claim the yield produced by your YT. Remember: **You can exit and sell your YT positions at any time.** The Pendle market is 24/7. There’s never any lock or penalty to close your position early in Pendle. * [Yield Trading 101 with YT](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#yield-trading-101-with-yt) * [Buy YT to long yield](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#buy-yt-to-long-yield) * [**Get leveraged yield exposure without borrowing risk**](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#get-leveraged-yield-exposure-without-borrowing-risk) * [**How do I profit from buying YT?**](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#how-do-i-profit-from-buying-yt) * [**How to buy YT**](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt#how-to-buy-yt) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Frequently Asked Questions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/boros-dev/FAQ#__docusaurus_skipToContent_fallback) On this page Getting Started[​](https://docs.pendle.finance/boros-dev/FAQ#getting-started "Direct link to Getting Started") --------------------------------------------------------------------------------------------------------------- ### What do I need to start trading on Boros programmatically?[​](https://docs.pendle.finance/boros-dev/FAQ#what-do-i-need-to-start-trading-on-boros-programmatically "Direct link to What do I need to start trading on Boros programmatically?") You need three things: 1. **A root wallet** — an Ethereum address on Arbitrum with funds for collateral deposits 2. **An agent wallet** — a separate key pair authorized to trade on your behalf (so you don't expose your root key) 3. **Gas balance** — topped up via the agent flow or the Boros web UI, used to pay for on-chain transaction fees See the [Backend Integration Overview](https://docs.pendle.finance/boros-dev/Backend/overview) and [Agent Trading](https://docs.pendle.finance/boros-dev/Backend/agent) for the full setup guide. ### What's the difference between root wallet and agent wallet?[​](https://docs.pendle.finance/boros-dev/FAQ#whats-the-difference-between-root-wallet-and-agent-wallet "Direct link to What's the difference between root wallet and agent wallet?") Your **root wallet** is your primary identity. It signs sensitive actions: deposits, withdrawals, and agent approvals. These go directly to the blockchain. Your **agent wallet** is a delegated signer for day-to-day trading. It signs non-sensitive actions: placing orders, canceling orders, cash transfers. These go through the Send Txs Bot service. The agent **cannot withdraw funds** — only the root can. ### Which chain is Boros on?[​](https://docs.pendle.finance/boros-dev/FAQ#which-chain-is-boros-on "Direct link to Which chain is Boros on?") Boros is deployed on **Arbitrum**. All on-chain transactions (deposits, withdrawals, agent approvals) are Arbitrum transactions. * * * Account & Margin[​](https://docs.pendle.finance/boros-dev/FAQ#account--margin "Direct link to Account & Margin") ----------------------------------------------------------------------------------------------------------------- ### What is a Market Account (`marketAcc`)?[​](https://docs.pendle.finance/boros-dev/FAQ#what-is-a-market-account-marketacc "Direct link to what-is-a-market-account-marketacc") A Market Account is a packed identifier: `(root, subaccountId, tokenId, marketId)`. It uniquely identifies your trading context. Pack it using the SDK: import { MarketAccLib, CROSS_MARKET_ID } from "@pendle/sdk-boros";const marketAcc = MarketAccLib.pack(walletAddress, 0, tokenId, CROSS_MARKET_ID); Use `CROSS_MARKET_ID` (16777215) for cross-margin, or a specific `marketId` for isolated margin. ### What's the difference between cross-margin and isolated-margin?[​](https://docs.pendle.finance/boros-dev/FAQ#whats-the-difference-between-cross-margin-and-isolated-margin "Direct link to What's the difference between cross-margin and isolated-margin?") **Cross-margin** shares collateral across all entered markets. Profit in one market offsets losses in another, giving you better capital efficiency. Most users should use cross-margin. **Isolated-margin** constrains collateral to a single market. A liquidation in that market won't affect your other positions. Use isolated when you want strict risk separation. See [Margin Mechanics](https://docs.pendle.finance/boros-dev/Mechanics/Margin) for details. ### How many markets can I enter?[​](https://docs.pendle.finance/boros-dev/FAQ#how-many-markets-can-i-enter "Direct link to How many markets can I enter?") Up to **10 markets** per market account. This limit is per combination of `(address, accountId, tokenId)` — i.e., per collateral type. If you trade many short-dated markets over time, you **must exit expired markets** to free up slots. The `autoExitMarket` parameter in the place-orders API can handle this automatically. See [Best Practices](https://docs.pendle.finance/boros-dev/Backend/best-practices) for why exiting unused markets also saves gas. ### How many open orders can I have?[​](https://docs.pendle.finance/boros-dev/FAQ#how-many-open-orders-can-i-have "Direct link to How many open orders can I have?") Maximum **100 open limit orders** per market account per market. ### Why are all my values in 18 decimals?[​](https://docs.pendle.finance/boros-dev/FAQ#why-are-all-my-values-in-18-decimals "Direct link to Why are all my values in 18 decimals?") Boros normalizes all internal values to 18-decimal fixed-point for consistency, regardless of the underlying token's native decimals (e.g., USDT uses 6 decimals on-chain, but 18 inside Boros). Use the SDK helpers `FixedX18.fromNumber()` and `FixedX18.fromBigIntString()` to convert. * * * Trading[​](https://docs.pendle.finance/boros-dev/FAQ#trading "Direct link to Trading") --------------------------------------------------------------------------------------- ### How do I place an order?[​](https://docs.pendle.finance/boros-dev/FAQ#how-do-i-place-an-order "Direct link to How do I place an order?") 1. Generate calldata: `POST /open-api/v1/calldata/place-orders` 2. Sign the calldata with your agent key 3. Submit: `POST /send-txs-bot/v3/agent/bulk-direct-call` See the [API integration workflow](https://docs.pendle.finance/boros-dev/Backend/api#2-placing-a-trade-agent-flow) for the complete flow. ### What's the difference between single orders and bulk orders?[​](https://docs.pendle.finance/boros-dev/FAQ#whats-the-difference-between-single-orders-and-bulk-orders "Direct link to What's the difference between single orders and bulk orders?") **Single orders** (`placeSingleOrder` on-chain) can match with both the **AMM and the order book** for potentially better execution. They support all TIF types. Use single orders when you want to take liquidity from both venues. **Bulk orders** are batched into one transaction — lower gas, atomic execution, but they go directly to the order book and do **not** match with the AMM. Ideal for market makers placing or adjusting multiple orders at once. **Key difference:** If you place a GTC order via `bulkOrders` at a rate that crosses the AMM's implied rate, the order will **not** match the AMM — it will be placed on the book as a maker order. To take AMM liquidity, use `placeSingleOrder` instead. See [Best Practices](https://docs.pendle.finance/boros-dev/Backend/best-practices#bulk-order-placement) . ### How do I ensure my order is taker-only (no residual maker order)?[​](https://docs.pendle.finance/boros-dev/FAQ#how-do-i-ensure-my-order-is-taker-only-no-residual-maker-order "Direct link to How do I ensure my order is taker-only (no residual maker order)?") Use `IOC` (Immediate or Cancel) or `FOK` (Fill or Kill) as the time-in-force: * **IOC**: Fills as much as possible against order book + AMM, cancels the rest. You may get a partial fill. * **FOK**: Must fill the entire order size, otherwise the transaction reverts. All-or-nothing. Both guarantee no residual maker orders are left on the book. These must be placed via `placeSingleOrder` (not `bulkOrders`) to access AMM liquidity. ### What is a tick? How do I convert APR to tick?[​](https://docs.pendle.finance/boros-dev/FAQ#what-is-a-tick-how-do-i-convert-apr-to-tick "Direct link to What is a tick? How do I convert APR to tick?") A tick is an integer representing an interest rate level on the order book. The conversion formula is: rate = 1.00005^(tick × tickStep) - 1 Where `tickStep` is a market-specific parameter. Use the SDK: import { estimateTickForRate, getRateAtTick } from "@pendle/sdk-boros";import { FixedX18 } from "@pendle/boros-offchain-math";const tick = estimateTickForRate(FixedX18.fromNumber(0.05), tickStep, false); // 5% APR → tickconst rate = getRateAtTick(tick, tickStep); // tick → rate ### How do stop orders (TP/SL) work?[​](https://docs.pendle.finance/boros-dev/FAQ#how-do-stop-orders-tpsl-work "Direct link to How do stop orders (TP/SL) work?") Stop orders are off-chain conditional orders monitored by the Stop Order Service. When the market APR crosses your specified threshold, the service automatically submits a market order on your behalf. See [Stop Orders](https://docs.pendle.finance/boros-dev/Backend/stop-orders) for the full guide. ### Can I close a position partially?[​](https://docs.pendle.finance/boros-dev/FAQ#can-i-close-a-position-partially "Direct link to Can I close a position partially?") Yes. Use the `place-orders` calldata endpoint to place a counter-order (opposite side) with a smaller size than your current position. For a full close, use the `simulations/close-active-position` endpoint to get the exact parameters. ### Are order IDs globally unique?[​](https://docs.pendle.finance/boros-dev/FAQ#are-order-ids-globally-unique "Direct link to Are order IDs globally unique?") No. Order IDs are unique **per market**, not globally. The combination of **(Market ID, Order ID)** is the globally unique identifier. If you track orders across multiple markets, always use both fields as the key. ### What is `direct-call` vs `bulk-direct-call`?[​](https://docs.pendle.finance/boros-dev/FAQ#what-is-direct-call-vs-bulk-direct-call "Direct link to what-is-direct-call-vs-bulk-direct-call") * **`direct-call`**: Submits a single calldata. Use when the calldata API returns exactly one entry. * **`bulk-direct-call`**: Submits one or more calldatas with guaranteed sequential execution (based on nonce). **You must use this** when the calldata API returns multiple entries (e.g., `[exit-market, place-order]` when `autoExitMarket=true`). If you use `direct-call` with only the first element of a multi-calldata response, only the first operation executes (e.g., only the exit-market happens, and your order is never placed). ### What does `autoExitMarket` do?[​](https://docs.pendle.finance/boros-dev/FAQ#what-does-autoexitmarket-do "Direct link to what-does-autoexitmarket-do") When set to `true` (default) in the place-orders calldata API, the system automatically exits expired/unused markets to free up slots (max 10 per account). This may add an extra calldata to the response array. Set `autoExitMarket=false` if you manage market entry/exit yourself. ### What is the "Rate too far off" error?[​](https://docs.pendle.finance/boros-dev/FAQ#what-is-the-rate-too-far-off-error "Direct link to What is the "Rate too far off" error?") This means your **maker order** rate is too far from the current mark rate. The market has bounds on how far limit orders can deviate from the mark rate. This is different from "Large Rate Deviation", which applies to **taker fills** (the execution rate deviating from the mark rate). See [Order Book — Rate Bounds](https://docs.pendle.finance/boros-dev/Mechanics/OrderBook#restrictions) . ### What is the rate floor?[​](https://docs.pendle.finance/boros-dev/FAQ#what-is-the-rate-floor "Direct link to What is the rate floor?") A minimum absolute rate used in margin calculations, derived from `market.imData.iTickThresh`. Orders with rates below the floor use the floor value for margin instead, preventing unrealistically low margin requirements near 0%. See [Margin — Pre-scaling IM](https://docs.pendle.finance/boros-dev/Mechanics/Margin#pre-scaling-initial-margin) . * * * Withdrawals[​](https://docs.pendle.finance/boros-dev/FAQ#withdrawals "Direct link to Withdrawals") --------------------------------------------------------------------------------------------------- ### Why can't I withdraw immediately?[​](https://docs.pendle.finance/boros-dev/FAQ#why-cant-i-withdraw-immediately "Direct link to Why can't I withdraw immediately?") Boros uses a **request → cooldown → finalize** withdrawal pattern for security. After requesting a withdrawal, you must wait for the cooldown period before finalizing. You can cancel a pending withdrawal request at any time. ### Can my agent withdraw funds?[​](https://docs.pendle.finance/boros-dev/FAQ#can-my-agent-withdraw-funds "Direct link to Can my agent withdraw funds?") No. Withdrawals are a **sensitive action** that only the root wallet can initiate. This is a key security property — even if your agent key is compromised, your funds remain safe. * * * Gas & Fees[​](https://docs.pendle.finance/boros-dev/FAQ#gas--fees "Direct link to Gas & Fees") ----------------------------------------------------------------------------------------------- ### What fees does Boros charge?[​](https://docs.pendle.finance/boros-dev/FAQ#what-fees-does-boros-charge "Direct link to What fees does Boros charge?") 1. **Position opening fees** (taker only): `size × 0.05% × time to maturity`. Makers pay zero fees. 2. **Settlement fees**: Charged every 8 hours on open positions. 3. **Market entrance fee**: One-time fee when first entering a market, denominated in the market's base asset. See [Fee Structure](https://docs.pendle.finance/boros-dev/Mechanics/Fees#market-entrance-fees) for exact amounts. 4. **Gas fees**: Actual Arbitrum gas cost for agent-submitted transactions (no markup). See [Fee Structure](https://docs.pendle.finance/boros-dev/Mechanics/Fees) for detailed formulas. ### How does the gas balance work?[​](https://docs.pendle.finance/boros-dev/FAQ#how-does-the-gas-balance-work "Direct link to How does the gas balance work?") When the Send Txs Bot submits transactions on your behalf, gas is paid from your gas balance (denominated in USD). You're charged the actual Arbitrum gas cost with no markup. Top up via the agent flow (`/calldata/vault-pay-treasury`) or the [Boros web UI](https://boros.pendle.finance/account) . ### What happens if my gas balance runs out?[​](https://docs.pendle.finance/boros-dev/FAQ#what-happens-if-my-gas-balance-runs-out "Direct link to What happens if my gas balance runs out?") Your agent-submitted transactions will fail. You can still perform root-signed actions (deposit, withdraw) since those are submitted directly to the blockchain. Top up your gas balance to resume agent trading. * * * WebSocket[​](https://docs.pendle.finance/boros-dev/FAQ#websocket "Direct link to WebSocket") --------------------------------------------------------------------------------------------- ### Should I use REST or WebSocket for real-time data?[​](https://docs.pendle.finance/boros-dev/FAQ#should-i-use-rest-or-websocket-for-real-time-data "Direct link to Should I use REST or WebSocket for real-time data?") Use **WebSocket** for real-time streaming: order book updates, trade events, and account state changes. Use **REST** for initial data loading and on-demand queries. See [WebSocket docs](https://docs.pendle.finance/boros-dev/Backend/websocket) . ### Do WebSocket events include full data?[​](https://docs.pendle.finance/boros-dev/FAQ#do-websocket-events-include-full-data "Direct link to Do WebSocket events include full data?") It depends on which channel you use: * **`account-updates:ROOT_ADDRESS`** (recommended) — subscribe with your lowercased wallet address. Emits rich, structured events with full before/after state — no REST refetch needed: * `position-update` — pre/post position size and rate on every fill * `order-update` — full order state (placed, partially filled, cancelled, purged) * `settlement-update` — yield paid/received, APR rates, fees per settlement * **`account:ACCOUNT`** (legacy) — notification-only. Tells you _something_ changed (type: `Position`, `LimitOrder`, or `Collateral`) but carries no detail. You must call the REST API (`POST /accounts/market-acc-infos`) to find out what changed. Prefer `account-updates` for all new integrations. See [WebSocket — Account Update Events](https://docs.pendle.finance/boros-dev/Backend/websocket#account-update-events) for the full payload schemas. * * * Troubleshooting[​](https://docs.pendle.finance/boros-dev/FAQ#troubleshooting "Direct link to Troubleshooting") --------------------------------------------------------------------------------------------------------------- ### My transaction failed with "insufficient margin"[​](https://docs.pendle.finance/boros-dev/FAQ#my-transaction-failed-with-insufficient-margin "Direct link to My transaction failed with "insufficient margin"") Your account doesn't have enough collateral to satisfy the initial margin requirement for the new position. Either: * Deposit more collateral * Reduce the position size * Close existing positions to free up margin Use `GET /simulations/place-order` to preview margin requirements before placing. ### I'm getting "agent expired" errors[​](https://docs.pendle.finance/boros-dev/FAQ#im-getting-agent-expired-errors "Direct link to I'm getting "agent expired" errors") Agent approvals have an expiry time. Check it with `GET /agents/expiry-time` and re-approve if needed using `GET /calldata/approve-agent`. Don't assume a fixed expiry duration — always query the endpoint to get the actual expiry timestamp. ### Why hasn't my position been settled yet?[​](https://docs.pendle.finance/boros-dev/FAQ#why-hasnt-my-position-been-settled-yet "Direct link to Why hasn't my position been settled yet?") Floating rate settlements are triggered by off-chain oracle updates and typically land **~30 seconds after the hour** (e.g., 08:00:30 UTC rather than exactly 08:00:00). During periods of extreme volatility or when a settlement value would push accounts near liquidation, the system may delay settlement further while risk management operations (liquidation bots, force-cancel bots) run first. If your position hasn't settled after a few minutes past the expected boundary, this is normal. See [Settlement — Timing](https://docs.pendle.finance/boros-dev/Mechanics/Settlement#notes) for full details. ### I'm getting `MMIsolatedMarketDenied()` on an isolated-only market[​](https://docs.pendle.finance/boros-dev/FAQ#im-getting-mmisolatedmarketdenied-on-an-isolated-only-market "Direct link to im-getting-mmisolatedmarketdenied-on-an-isolated-only-market") You're using a cross-margin `marketAcc` on a market that only supports isolated margin. Use `MarketAccLib.pack(address, accountId, tokenId, marketId)` with the **specific market ID** instead of `CROSS_MARKET_ID`. You also need to deposit collateral to the isolated account specifically. See [Best Practices — Isolated-Only Markets](https://docs.pendle.finance/boros-dev/Backend/best-practices#isolated-only-markets) . * [Getting Started](https://docs.pendle.finance/boros-dev/FAQ#getting-started) * [What do I need to start trading on Boros programmatically?](https://docs.pendle.finance/boros-dev/FAQ#what-do-i-need-to-start-trading-on-boros-programmatically) * [What's the difference between root wallet and agent wallet?](https://docs.pendle.finance/boros-dev/FAQ#whats-the-difference-between-root-wallet-and-agent-wallet) * [Which chain is Boros on?](https://docs.pendle.finance/boros-dev/FAQ#which-chain-is-boros-on) * [Account & Margin](https://docs.pendle.finance/boros-dev/FAQ#account--margin) * [What is a Market Account (`marketAcc`)?](https://docs.pendle.finance/boros-dev/FAQ#what-is-a-market-account-marketacc) * [What's the difference between cross-margin and isolated-margin?](https://docs.pendle.finance/boros-dev/FAQ#whats-the-difference-between-cross-margin-and-isolated-margin) * [How many markets can I enter?](https://docs.pendle.finance/boros-dev/FAQ#how-many-markets-can-i-enter) * [How many open orders can I have?](https://docs.pendle.finance/boros-dev/FAQ#how-many-open-orders-can-i-have) * [Why are all my values in 18 decimals?](https://docs.pendle.finance/boros-dev/FAQ#why-are-all-my-values-in-18-decimals) * [Trading](https://docs.pendle.finance/boros-dev/FAQ#trading) * [How do I place an order?](https://docs.pendle.finance/boros-dev/FAQ#how-do-i-place-an-order) * [What's the difference between single orders and bulk orders?](https://docs.pendle.finance/boros-dev/FAQ#whats-the-difference-between-single-orders-and-bulk-orders) * [How do I ensure my order is taker-only (no residual maker order)?](https://docs.pendle.finance/boros-dev/FAQ#how-do-i-ensure-my-order-is-taker-only-no-residual-maker-order) * [What is a tick? How do I convert APR to tick?](https://docs.pendle.finance/boros-dev/FAQ#what-is-a-tick-how-do-i-convert-apr-to-tick) * [How do stop orders (TP/SL) work?](https://docs.pendle.finance/boros-dev/FAQ#how-do-stop-orders-tpsl-work) * [Can I close a position partially?](https://docs.pendle.finance/boros-dev/FAQ#can-i-close-a-position-partially) * [Are order IDs globally unique?](https://docs.pendle.finance/boros-dev/FAQ#are-order-ids-globally-unique) * [What is `direct-call` vs `bulk-direct-call`?](https://docs.pendle.finance/boros-dev/FAQ#what-is-direct-call-vs-bulk-direct-call) * [What does `autoExitMarket` do?](https://docs.pendle.finance/boros-dev/FAQ#what-does-autoexitmarket-do) * [What is the "Rate too far off" error?](https://docs.pendle.finance/boros-dev/FAQ#what-is-the-rate-too-far-off-error) * [What is the rate floor?](https://docs.pendle.finance/boros-dev/FAQ#what-is-the-rate-floor) * [Withdrawals](https://docs.pendle.finance/boros-dev/FAQ#withdrawals) * [Why can't I withdraw immediately?](https://docs.pendle.finance/boros-dev/FAQ#why-cant-i-withdraw-immediately) * [Can my agent withdraw funds?](https://docs.pendle.finance/boros-dev/FAQ#can-my-agent-withdraw-funds) * [Gas & Fees](https://docs.pendle.finance/boros-dev/FAQ#gas--fees) * [What fees does Boros charge?](https://docs.pendle.finance/boros-dev/FAQ#what-fees-does-boros-charge) * [How does the gas balance work?](https://docs.pendle.finance/boros-dev/FAQ#how-does-the-gas-balance-work) * [What happens if my gas balance runs out?](https://docs.pendle.finance/boros-dev/FAQ#what-happens-if-my-gas-balance-runs-out) * [WebSocket](https://docs.pendle.finance/boros-dev/FAQ#websocket) * [Should I use REST or WebSocket for real-time data?](https://docs.pendle.finance/boros-dev/FAQ#should-i-use-rest-or-websocket-for-real-time-data) * [Do WebSocket events include full data?](https://docs.pendle.finance/boros-dev/FAQ#do-websocket-events-include-full-data) * [Troubleshooting](https://docs.pendle.finance/boros-dev/FAQ#troubleshooting) * [My transaction failed with "insufficient margin"](https://docs.pendle.finance/boros-dev/FAQ#my-transaction-failed-with-insufficient-margin) * [I'm getting "agent expired" errors](https://docs.pendle.finance/boros-dev/FAQ#im-getting-agent-expired-errors) * [Why hasn't my position been settled yet?](https://docs.pendle.finance/boros-dev/FAQ#why-hasnt-my-position-been-settled-yet) * [I'm getting `MMIsolatedMarketDenied()` on an isolated-only market](https://docs.pendle.finance/boros-dev/FAQ#im-getting-mmisolatedmarketdenied-on-an-isolated-only-market) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 5 - Important concepts in yield trading | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#__docusaurus_skipToContent_fallback) On this page > Course level: **#intermediate** We have introduced the various terms and jargon in [Chapter 4 - Yield Trading Basics](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt) . Let’s explore these important yield trading concepts in more depth. ### PT + YT = Underlying asset[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#pt--yt--underlying-asset "Direct link to PT + YT = Underlying asset") As a reminder, the core of Pendle’s [yield tokenization](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) is to split a yield-bearing token into PT and YT. The price of the two tokens adds up to the price of the underlying asset. Therefore, the price of PT and YT must be **inversely correlated** — the higher the YT price, the lower the PT price, and vice versa. 💡 Key takeaway: **PT and YT are just two sides of the same coin — the Implied APY** ### Underlying APY[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#underlying-apy "Direct link to Underlying APY") Underlying APY represents the 7-day moving average yield rate of the underlying asset. This approach allows a more accurate indication of the underlying yield over a period of time. ### Implied APY[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#implied-apy "Direct link to Implied APY") Implied APY is the current **market consensus of the yield** of an asset. In other words, it is the “price” of YT, denoted in percentage terms. **The implied APY changes over time, depending on the supply and demand of YT and PT in the market**. The more people buy YT, or sell PT (remember they are just two sides of the same coin), the higher the implied APY is, and the more expensive the YT is (or the cheaper the PT is), and vice versa. Here is a table that summarizes the how market activities affect implied APY: | Buy/Sell | YT | PT | | --- | --- | --- | | Buy | Implied APY ↑ | Implied APY ↓ | | Sell | Implied APY ↓ | Implied APY ↑ | 💡 Key takeaway: Think of **implied APY as the measure of how valuable the YT is**. It is the price of YT, denoted in yield % terms. 💡 Key takeaway: Pendle is **a marketplace of** _**Implied APYs**_ of different assets. (Akin to how Uniswap is a marketplace of _spot prices_ of different assets) ImpliedAPY\=\[(1+YTpricePTprice)365DaysToMaturity\]−1ImpliedAPY = \[(1+\\frac{YTprice}{PTprice})^\\frac{365}{DaysToMaturity} \]-1ImpliedAPY\=\[(1+PTpriceYTprice​)DaysToMaturity365​\]−1 It is not required to fully understand the math behind implied APY, but you can notice two things from it: 1. **The underlying APY does not directly affect the implied APY** Implied APY depends on the demand of YT or PT, which is determined by market forces. So, even if the underlying APY stays the same, the implied APY can still fluctuate due to shifts in market sentiment. 2. **With a constant implied APY, YT price decreases and PT price increases over time** Even if the market has no trading activity at all (and thus the implied APY stays the same), time will also affect the price of YT and PT. This is rational, as time approaches expiry (maturity), there are less yield remaining to collect for YT, hence its price decline. YT’s price decline in turn causes PT price to trend upwards, being equal to its underlying at maturity. ### Long Yield APY[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#long-yield-apy "Direct link to Long Yield APY") The long yield APY is the _**estimated**_ **return** (expressed as annualized percentage yield) that you can get **by** **buying YT and holding it until maturity**, assuming the underlying APY remains at its current value. This value can be negative, meaning that the total value of the future yield based on the current underlying APY will be less than the cost of buying YT. In simple terms, the long yield APY represents the difference between the underlying APY (estimated yield to receive) and the implied APY (cost of YT). If you buy and hold YT, you want this value to stay positive, the higher the better. 💡 Key takeaway: The long yield APY gives you a _**clue**_ if the YT is currently cheap (when positive) or expensive (when negative). Learn more about how to value YT and PT at [chapter-9-identifying-opportunities-to-long-short-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield "mention") ### Fixed APY[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#fixed-apy "Direct link to Fixed APY") Fixed APY is the guaranteed yield you will receive if you buy and hold the PT now. This value is numerically equivalent to the Implied APY. ### Example 1[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#example-1 "Direct link to Example 1") ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(46).png) The image above is an example of a yield-bearing asset on Pendle. sDAI is the DAI savings rate by MakerDAO (Spark Protocol) and it is currently generating 5% yield. The implied APY on Pendle shown above is 3.89%, which means YT-sDAI-2024 is currently priced at 3.89%. 💡 If you think that the average yield of sDAI (underlying APY) is going to be above its implied APY until maturity, purchasing YT will be a good decision. Purchasing YT-sDAI in this instance will yield 5% while costing 3.89%, since you’ll be receiving more than what you’re spending, Long Yield APY in this instance is positive (29.42% as shown in the attached image). * [PT + YT = Underlying asset](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#pt--yt--underlying-asset) * [Underlying APY](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#underlying-apy) * [Implied APY](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#implied-apy) * [Long Yield APY](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#long-yield-apy) * [Fixed APY](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#fixed-apy) * [Example 1](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#example-1) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 8 - Long Yield (Obtain Leveraged Yield-Exposure) | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#__docusaurus_skipToContent_fallback) On this page > Course level: **#advanced** ### TLDR[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#tldr "Direct link to TLDR") **Yield Tokens (YT)** are traded on the Pendle AMM in the same pool as Principal Tokens (PT). ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(70).png) Let's say **1 YT stETH** is trading at **0.04 stETH**, with a **maturity in 1 year**. Holding **1 YT stETH** gives you the **right to receive the yield on 1 stETH until maturity**. Peepo thinks that **1 stETH will generate more than 0.04 stETH yield in 1 year** (equivalent to 4% APY), and chooses to **buy 1 YT stETH**. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(69).png) Here, **Peepo profits** as the future yield that he **accrued is greater than the price of YT stETH when he purchased it**. Peepo was basically **longing stETH yield**: 💡 **Buying and holding YT = longing yield Profits = Future yield - YT cost** ### How to Ape[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-to-ape "Direct link to How to Ape") 1. **Go to** [**Pendle**](https://app.pendle.finance/pro/markets) 2. **Buy YT** 1. Select the YT you want to buy. 2. Select input asset (i.e. what you want to use to buy YT) 3. Review the Output and Price Impact of your trade. 4. Approve and confirm the transaction 3. **Passive Management** - Hold YT and collect all the yields until expiry **Active Trading** - Sell YT when Implied APY increases 4. **Redeem YT yields** from the [Pendle Dashboard](https://app.pendle.finance/trade/dashboard/overview/positions) ### How do I become _profitable_?[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-do-i-become-profitable "Direct link to how-do-i-become-profitable") You profit when either or both… 1. the price of YT rises 2. the yield produced by the YT becomes bigger than your cost buying the YT Generally speaking, you are betting that either or both… 1. the **implied APY** rises after you buy (which pumps the YT price), implied APY is driven by **market force** (supply & demand of YT and PT) 2. the **underlying APY** and/or the **long yield APY** becomes higher (which means yield is being produced faster) Here’s a table that quickly summarises what is going in favor or against you as a YT holder. Just flip the arrows’ directions if the indicators go the other way around. | Indicators👇 / Effect 👉 | YT Price | YT Yield Receivables | | --- | --- | --- | | Underlying asset price ⤴️ | ⬆️ | ┄ | | Implied APY ⤴️ | ⬆️ | ┄ | | Underlying APY ⤴️ | ┄ | ⬆️ | | Long Yield APY ⤴️ | ┄ | ⬆️ | | Time to maturity ⤵️ | ⬇️ (slowly) | ┄ | ### Leveraged yield exposure & nominal value[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#leveraged-yield-exposure--nominal-value "Direct link to Leveraged yield exposure & nominal value") Since YT is typically much cheaper than the underlying asset, you _effectively_ get **leveraged yield exposure** by buying YT. For example, in the image below, you can earn the yield of ~11.9 stETH with just the cost of 1 stETH, which is an 11.9x effective leverage in _**notional value traded**_. There’s **no borrowing involved**, so there’s **no risk of liquidation or oracle errors**. The leverage is simply achieved by [Yield Tokenisation](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) , which lets you buy only the yield portion of the asset for a small fraction of the original price. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(71).png) With the cost of 1 stETH, you are buying yield exposure of 11.9 ETH worth of stETH. An 11.9x leverage in notional value in this case. ### When should I long yield and buy YT?[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#when-should-i-long-yield-and-buy-yt "Direct link to When should I long yield and buy YT?") The last statement in the TLDR section can be condensed into a formula: ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(72).png) _The best way to frame yield trading is to think in APY terms, instead of dollar values._ If you think the **average future APY** will be higher than the **current Implied APY** (the APY that the market is implying), then **longing yield is a sound strategy**. One simple estimate of the **average future APY** is the **current underlying APY**, which is the APY being generated **in the underlying protocol**. If all the conditions stay exactly the same from now until maturity, **the future APY should be the same as the underlying APY**. **If you assume** that the **current underlying APY** is a good estimate of **future APY**, these are simple guidelines to see when is a good time to purchase YT: 💡 If **Implied APY is low compared to Underlying APY**, then you are **more likely to profit** from buying YT. 💡 If **Implied APY is high compared to Underlying APY**, then you are **less likely to profit** from buying YT. ### How to manage my trade?[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-to-manage-my-trade "Direct link to How to manage my trade?") **Passive Management - Buy and hold YT when Implied APY is low** YT is cheap when Implied APY is low relative to the Underlying APY. As long as the Underlying APY stays above the Implied APY you bought YT at, you will likely profit from this trade. > Profit = Total Yield Collected from YT - Cost of YT **Active Trading - Sell YT when Implied APY is high** YT can be sold anytime. Just like any other tokens, you can also profit from “buying low, selling high” with YT. You can profit by monitoring the Implied APY, and selling off your YT when Implied APY increases. > Profit = (Total Yield Collected + Revenue from YT Sale) - Cost of YT ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(73).png) Implied APY Charts in the Pendle App ### How can I predict the average future APY?[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-can-i-predict-the-average-future-apy "Direct link to How can I predict the average future APY?") The simple guidelines in the previous section have a **big assumption** that the **underlying APY will stay the same**. Of course, reality is not so simple and this **usually is not the case**. Many other factors can influence the future yield, such as **market sentiment** or **changes to the yield-generating mechanism of the underlying protocol**. For example, in a bull market, there is a high demand for money, resulting in a higher rate of borrowing in money markets. This demand will translate to higher borrowing APY, and thus higher APY for lenders. Any edge in identifying and analyzing these trends will go a long way in predicting future yield and executing this strategy. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(58).png) As another hypothetical example, GMX could be close to successfully partnering up with Google and Amazon, providing a catalyst for GLP yield to skyrocket in the future due to increases in user activities, interests, and ultimately swap fees, rewards, etc. So, just because YT is relatively expensive doesn’t necessarily mean that it’s overvalued. In this case, it might be a good idea to purchase YT now ahead of time. Another way to evaluate the value of Implied APY is by analyzing its historical trend on Pendle. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(60).png) ### How does it work?[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-does-it-work "Direct link to How does it work?") Let's say that there is a **stETH pool** in Pendle with a **maturity of 1 year.** That means the holder of **YT stETH** has the right to collect **stETH yield for the next 1 year**. Peepo sees the following information from the Pendle Market page on 01 Jan 2023: ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(61).png) **YT stETH = 0.04 stETHImplied APY = 4.2%** By trading YT stETH at this price, the market is valuing the average future APY of stETH to be 4.2% in the next year. **Underlying APY = 5%** Underlying APY means that stETH is currently generating a 5% yield from staking rewards in Lido. Thus holding stETH nets a 5% APY. **Long Yield APY = 25%** APY for buying and holding YT at the current price, assuming the average future APY is equivalent to the current underlying APY. Peepo predicts that the average future APY of stETH will **remain above 5%**, meaning that the **current Implied APY of 4.2% is a bargain**. Peepo chooses to **buy 100 YT stETH (= 4 stETH),** knowing that if the average future APY remains at the current underlying APY (which is a possible assumption), **he will receive 5 stETH worth of yield, netting a 25% APY**. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(62).png) It turns out that the average APY increases to **5.5%** within the next year, **Peepo ends up receiving an even greater yield**. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(63).png) Compared to **simply holding stETH**, which would receive the **displayed 5.5% APY**, Peepo receives **more than 6x** of that APY by holding **YT stETH** instead. * * * **Wojak bought 4 stETH** ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(64).png) By holding **4 stETH** for 1 year, Wojak earned **5.5% APY = 0.22 stETH** * * * **Peepo bought 100 YT stETH (=4 stETH)** ![](https://docs.pendle.finance/assets/images/image%20(66)-24b5026a461e2c78bff27342ca1bcaab.png) By holding **100 YT stETH** for 1 year, Peepo earned **1.5 stETH**. Peepo receives **more than 6x** of that APY by holding stETH instead. * * * However, it is important to note that, as with most investments, higher rewards comes with higher risks. When **Implied Yield is much greater than Underlying APY**, then the **Long Yield APY will be negative**. This means that assuming the underlying APY remains constant, the cost of buying YT would be more than the average future yield collected. Under such scenario, it is generally **not a good time to buy YT**, unless you believe that the underlying APY will rise above the current implied APY. Even when you buy YT at a **positive Long Yield APY** when **Implied APY < Underlying APY**, the average future APY could **drop lower than the Implied APY** of your trade and you will have a loss (look at the equation in section 3.1 again). Ultimately, you are entering a **long-yield** position and your profit depends on **yield sustaining or increasing**. * [TLDR](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#tldr) * [How to Ape](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-to-ape) * [How do I become _profitable_?](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-do-i-become-profitable) * [Leveraged yield exposure & nominal value](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#leveraged-yield-exposure--nominal-value) * [When should I long yield and buy YT?](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#when-should-i-long-yield-and-buy-yt) * [How to manage my trade?](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-to-manage-my-trade) * [How can I predict the average future APY?](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-can-i-predict-the-average-future-apy) * [How does it work?](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure#how-does-it-work) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Optimizing Yields with Pendle - Key Takeaways | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#__docusaurus_skipToContent_fallback) On this page > Course level: **#intermediate** 💡 Review [Pendle 101 key takeaways](https://docs.pendle.finance/pendle-academy/pendle-101/pendle-101-key-takeaways) if you need to refresh your memory about what is PT and YT in Pendle. Simple Yield Farming on Pendle[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#simple-yield-farming-on-pendle "Direct link to Simple Yield Farming on Pendle") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### 1\. Earn fixed yield[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#1-earn-fixed-yield "Direct link to 1. Earn fixed yield") * Go to [Market](https://app.pendle.finance/trade/markets) . Select an asset and click the “PT - Fixed APY” box to continue. * You are **guaranteed to earn the displayed amount of your chosen underlying asset** if you hold until the maturity date. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(9).png) In this example, you are guaranteed to earn ~0.17 stETH (which is ~4.6% APY) on 29th Dec 2027. * The fixed yield comes from the discount you get from buying the Principal Token (**PT**) **at a lower price** than the underlying asset. Your PT can be **redeemed 1:1 for the underlying asset** at or after the maturity date. In other words, the price difference is your yield at maturity. * The PT can be a viable alternative to spot, with similar risk exposure, and the benefit of downside cushion thanks to the Fixed Yield realized upon redemption. * **You are** _**not**_ **locked** and **can exit at any time**, even before the maturity date. * If you exit early, your actual earning will depend on the market price of PT, which is driven by buyers/sellers activities (supply and demand). So you may earn higher or lower (and in extreme cases, at a loss) than the fixed APY at entry. * Note that **time works in your favor** because PT price gradually closes its gap (i.e. rises) to the underlying asset, and becomes 1:1 to the underlying asset at the maturity date. So you don’t need to worry about short term price fluctuations. * You may even take early profit by exiting early when PT price rises. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(108).png) Example showing PT price gradually rises to the redeem price ($1 in this case) over time despite short term fluctuations. ### 2\. Liquidity provision[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#2-liquidity-provision "Direct link to 2. Liquidity provision") * Go to the “[Pools](https://app.pendle.finance/trade/pools) ” and select an asset to continue. * You can deposit your yield-bearing assets to provide liquidity to Pendle pools to **earn extra “free” yields on top the native yields using the same assets.** * LP receives returns from multiple avenues: * Native yields * Yields/rewards from the underlying asset (e.g. yield from stETH, or ETH rewards distributed from GMX’s GLP) * Fixed yield from the PT component of the pool * Swap fees * $PENDLE incentives * LP is denominated in your selected underlying asset _only_ (e.g. native stETH plus PT-stETH only in the stETH pools) * you are not exposed to price actions of uncorrelated assets * **ultimately no impermanent-loss (IL) concern at maturity** * **You are** _**not**_ **locked** and **can exit at any time**, even before the maturity date. The APY you earn from liquidity provision is also independent of the maturity date. 💡 Lock PENDLE for vePENDLE to boost LP incentives (optional). vePENDLE holders can also boost their Liquidity Provision APY up to 2.5X. Click [here](https://docs.pendle.finance/ProtocolMechanics/Mechanisms/vePENDLE) to learn more. * * * Yield Trading Basics[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#yield-trading-basics "Direct link to Yield Trading Basics") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Buy YT to long yield[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#buy-yt-to-long-yield "Direct link to Buy YT to long yield") * Go to [Market](https://app.pendle.finance/trade/markets) . Then select your asset and click “YT”. * Buying a YT means you are **increasing your yield exposure (long yield)**. You can either hold it until maturity, or buy low and sell high to turn a quick profit. * You profit when either or both… 1. the price of YT rises (then you may sell it off for a capital gain), 2. the yield produced by the YT becomes bigger than your cost buying the YT * This strategy works well when you expect the underlying APY of an asset to rise in the future, or when you think the YT price is undervalued. * Since YT is typically much cheaper than the underlying asset, you _effectively_ get **leveraged yield exposure** by buying YT, with no actual borrowing involved, so there’s **no risk of liquidation or oracle errors**. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(110).png) With the cost of 1 stETH, you are buying yield exposure of 11.9 stETH. An 11.9x leverage in notional value in this case. * Here’s a table that quickly summarises what is going in favor or against you as a YT holder. Just flip the arrows’ directions if the indicators go the other way round. | Indicators👇 / Effect 👉 | YT Price | YT Yield Receivables | | --- | --- | --- | | Underlying asset price ⤴️ | ⬆️ | ┄ | | Implied APY ⤴️ | ⬆️ | ┄ | | Underlying APY ⤴️ | ┄ | ⬆️ | | Long Yield APY ⤴️ | ┄ | ⬆️ | | Time to maturity ⤵️ | ⬇️ (slowly) | ┄ | * * * Important concepts in yield trading[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#important-concepts-in-yield-trading "Direct link to Important concepts in yield trading") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ #### **PT + YT = Underlying asset**[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#pt--yt--underlying-asset "Direct link to pt--yt--underlying-asset") * So the higher the YT price, the lower the PT price, and vice versa. * **PT and YT are just two sides of the same coin** #### **Underlying APY**[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#underlying-apy "Direct link to underlying-apy") * The yield of the underlying asset. Pendle displays a 7-day moving average in the app. * Note that the underlying APY does _not_ directly affect the implied APY #### **Implied APY**[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#implied-apy "Direct link to implied-apy") * Represents the **market** _**consensus**_ **of the future APY** of an asset * It changes depending on the supply and demand of YT and PT in the market | Buy/Sell | YT | PT | | --- | --- | --- | | Buy | Implied APY ↑ | Implied APY ↓ | | Sell | Implied APY ↓ | Implied APY ↑ | * **It is the measure of how valuable the YT is** * In layman's terms, implied APY is the “price of YT” in yield % terms (and the inverse price of PT) 💡 Key takeaway: Pendle is **a marketplace of** _**Implied APYs**_ of different assets. (Akin to how Uniswap is a marketplace of _spot prices_ of different assets) #### Long Yield APY[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#long-yield-apy "Direct link to Long Yield APY") * is the _**estimated**_ **return** (expressed as annualized percentage yield) that you can get **by** **buying YT and holding it until maturity**, assuming the underlying APY stays the same at its current value. * Its value can be negative if the total value of the future yield based on the current underlying APY will be less than the cost of buying YT. * Gives you a _**clue**_ if the YT is currently cheap (when positive) or expensive (when negative) #### Fixed APY[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#fixed-apy "Direct link to Fixed APY") * is the guaranteed yield you will receive if you buy and hold PT now * numerically equivalent to the Implied APY * [Simple Yield Farming on Pendle](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#simple-yield-farming-on-pendle) * [1\. Earn fixed yield](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#1-earn-fixed-yield) * [2\. Liquidity provision](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#2-liquidity-provision) * [Yield Trading Basics](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#yield-trading-basics) * [Buy YT to long yield](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#buy-yt-to-long-yield) * [Important concepts in yield trading](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/optimizing-yields-with-pendle-key-takeaways#important-concepts-in-yield-trading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 7 - Providing Liquidity while Trading Yield | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#__docusaurus_skipToContent_fallback) On this page > Course level: **#advanced** Let’s first look at what exactly makes up a Pendle AMM liquidity pool. Pendle Pool Composition[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#pendle-pool-composition "Direct link to Pendle Pool Composition") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- A Pendle pool consists of PT and SY. Let’s use stETH as an example of our underlying asset. A stETH pool (for any maturity date) consists of two tokens: * **PT**\-stETH * **SY**\-stETH **SY** is a wrapped version of the underlying asset, which gives Pendle a standard way to interact with any yield mechanism and split it into PT & YT. You can think of SY the same as the underlying yield-bearing asset. > Notice that there’s no YT in the pool, because both PT and YT are traded through the same pool of liquidity. This is made possible by using a pseudo-AMM with [flash swaps](https://docs.pendle.finance/ProtocolMechanics/LiquidityEngines/AMM#flash-swaps) > , which we won’t go into details here. 1\. Zap to provide liquidity to Long PT[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#1-zap-to-provide-liquidity-to-long-pt "Direct link to 1. Zap to provide liquidity to Long PT") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **The best of both worlds: Earn fixed yield and swap fees with PT liquidity pools** [Holding PT](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#2-how-to-be-yield-neutral-with-zero-price-impact-mode) gives you fixed yield that does not change with market conditions, and is a safe strategy that can still offer high returns. PT can also be used to provide liquidity in our liquidity pools to earn extra yields. When you provide liquidity with PT and the underlying asset (e.g. PT-stETH + stETH), you can earn: 1. Swap fees from the pools 2. $PENDLE incentives 3. Native yields 1. A portion of PT fixed yield 2. A portion of the underlying yield You can withdraw your PT from the pool at any time and sell it for profit, or redeem it for the underlying asset after maturity. ### How to Ape[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#how-to-ape "Direct link to How to Ape") Pendle makes it easy for you to enter this strategy with the Zap function. It automatically converts your input token into PT and the underlying asset and adds them to the pool. To use this strategy, follow these steps: 1. Go to the [Pools](https://app.pendle.finance/trade/pools) page. 2. Select the pool of your desired asset. 3. Deposit the token of the underlying asset, or any other token, and receive LP tokens in return. 💡 Your LP position is _**not**_ **locked** and you can **exit at any time**, even before the maturity date. The APY you earn from liquidity provision is also independent of the maturity date. ### **How this strategy is also a short-yield position**?[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#how-this-strategy-is-also-a-short-yield-position "Direct link to how-this-strategy-is-also-a-short-yield-position") As we explained in [chapter-6-shorting-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield "mention") , providing liquidity with PT means that you have a slightly bearish view on the underlying yield and you are shorting it. In other words, this strategy gives you **some protection against the falling yield rate** of the asset. If you want to maintain a yield-neutral LP position, you can read the next section. 2\. **How to be yield-neutral with “Zero price impact mode”**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#2-how-to-be-yield-neutral-with-zero-price-impact-mode "Direct link to 2-how-to-be-yield-neutral-with-zero-price-impact-mode") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- If you want to provide liquidity without taking a net short-yield position, you can use the “Zero price impact mode” option when you Zap in. Recall that a Pendle liquidity pool is made up of PT and the underlying asset. By default, when you Zap to provide liquidity, some of the underlying assets are used to buy PT from the PT/SY pool, and the rest is wrapped into SY. However, this purchase of PT can affect the price and the yield. #### What is **“Zero price impact mode”?**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#what-is-zero-price-impact-mode "Direct link to what-is-zero-price-impact-mode") If you enable this mode, the underlying asset is fully converted into SY, a portion of which is used to mint PT and YT. The PT and the remaining SY are then used for liquidity provision, while keeping the YT in your wallet. This avoids buying PT during the Zap, thus won’t cause any price impact. This option is for intermediate or advanced users, because you will need to know how to [manage your YT position](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-4-yield-trading-basics-with-yt) . #### Yield-neutral[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#yield-neutral "Direct link to Yield-neutral") By using this option, you balance out the effect of the PT in your LP position with the YT in your wallet. This means that you are yield-neutral instead of short-yield. #### **When not to use “Zero price impact” mode?**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#when-not-to-use-zero-price-impact-mode "Direct link to when-not-to-use-zero-price-impact-mode") You may not want to use this option if: * You don’t want to manage a YT position * for example, on Ethereum mainnet, it may not be worth maintaining a small YT position due to gas costs * You think the YT price is too overvalued (in other words, the PT is too cheap and you want to own more PT in the pool) 3\. How to use an LP position as part of yield trading[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#3-how-to-use-an-lp-position-as-part-of-yield-trading "Direct link to 3. How to use an LP position as part of yield trading") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #### Zap in when Implied APY / Fixed APY is High[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#zap-in-when-implied-apy--fixed-apy-is-high "Direct link to Zap in when Implied APY / Fixed APY is High") One way to use an LP position as part of yield trading is to enter when the Implied APY is high, and exit when it is low. This is similar to buying PT, which is best to enter when the Implied Yield is high. When the Implied APY is high, that means PT is cheaper (relative to the underlying token), and the resulting fixed yield APY is higher. When the Implied APY is low, that means PT is more expensive, and you can look to exit the LP position for an early profit. You can also hold the LP position and continue earning yield from the pool until maturity, after which the PT can then be redeemed 1:1 for the underlying asset. #### **Shorting Yield with LP**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#shorting-yield-with-lp "Direct link to shorting-yield-with-lp") Recall that _Long PT = Short yield_. You can quickly switch between Long and Short yield positions by zapping between YT and LP, instead of YT and PT. An LP position partially holds PT and achieves the same objective of "shorting" yield, while also earning extra yields (from swap fees, PENDLE incentives, and SY rewards) on top of the PT fixed yield. #### **No Impermanent Loss (IL) Concern**[​](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#no-impermanent-loss-il-concern "Direct link to no-impermanent-loss-il-concern") You don’t have to worry about impermanent loss (IL) when providing liquidity in a Pendle pool. This is because a Pendle pool consists of PT and the underlying asset only, which are highly correlated and denominated in the same asset, so their price ratio does not fluctuate much. This means that IL is minimal before maturity. And thanks to the fact that PT is 1:1 redeemable at maturity, IL is also **guaranteed to be zero or none at maturity**. See how Pendle LP historically fared well against impermanent losses in the studies below. * **Pendle LP Performance Study -** [**Part 1**](https://medium.com/pendle/evaluating-performance-of-pendle-liquidity-pools-part-1-f81e6957837d) * LP on Pendle vs. holding underlying asset w/o yield (e.g. ETH) * LP outperforms holding the underlying asset (e.g. ETH) in all cases studied here, even when excluding PENDLE incentives * No IL was observed in all cases studied here * The longer one LPs on Pendle, the greater the outperformance * **Pendle LP Performance Study -** [**Part 2**](https://medium.com/pendle/evaluating-performance-of-pendle-liquidity-pools-part-2-3d085872a603) * LP on Pendle vs. depositing in the underlying pool (e.g. stETH) * LP generally outperforms non-Pendle users, even when excluding PENDLE incentives * In the worst case, IL was observed to be 0.85% only * When including PENDLE incentives, there was zero IL in the stETH and gDAI pools * The performance of an LP using Zero Price Impact Mode vs. without depends on the Underlying and Implied APY of the pool. Regardless, Pendle LPs still generally outperform non-Pendle users. 💡 **Boost your APY with vePENDLE** You can increase your APY (up to 2.5x) from your LP positions by locking PENDLE for vePENDLE. The zap interface shows you how much PENDLE you need to lock and for how long to get the maximum APY boost. With vePENDLE, you can also vote for pools to allocate more incentives to them and earn extra swap fees on top. Learn more [here](https://docs.pendle.finance/ProtocolMechanics/Mechanisms/vePENDLE) . ![Example of vePENDLE required to max boost APY](https://docs.pendle.finance/pendle-academy/imgs/image%20(40).png) 💡 **Estimate Profit with Calculator** Look for the calculator icon next to the "Approve" or "Zap In" button. The calculator lets you estimate the potential profit for strategies such as Buy PT or Buy YT, and compares it to just holding the original asset. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(41).png) * [Pendle Pool Composition](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#pendle-pool-composition) * [1\. Zap to provide liquidity to Long PT](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#1-zap-to-provide-liquidity-to-long-pt) * [How to Ape](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#how-to-ape) * [**How this strategy is also a short-yield position**?](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#how-this-strategy-is-also-a-short-yield-position) * [2\. **How to be yield-neutral with “Zero price impact mode”**](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#2-how-to-be-yield-neutral-with-zero-price-impact-mode) * [3\. How to use an LP position as part of yield trading](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#3-how-to-use-an-lp-position-as-part-of-yield-trading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # FAQ | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/FAQ#__docusaurus_skipToContent_fallback) On this page General[​](https://docs.pendle.finance/pendle-v2/FAQ#general "Direct link to General") --------------------------------------------------------------------------------------- ### What does the maturity date mean?[​](https://docs.pendle.finance/pendle-v2/FAQ#what-does-the-maturity-date-mean "Direct link to What does the maturity date mean?") Each PT and YT has an maturity date. For PT, you can redeem the full underlying yield-bearing token after this date. For YT, the yield of the yield-bearing token is only accrued up until the maturity date, after which YT has no value. ### Why is the Underlying APY shown on Pendle differ from the APY shown in the underlying protocol?[​](https://docs.pendle.finance/pendle-v2/FAQ#why-is-the-underlying-apy-shown-on-pendle-differ-from-the-apy-shown-in-the-underlying-protocol "Direct link to Why is the Underlying APY shown on Pendle differ from the APY shown in the underlying protocol?") The Underlying APY displayed on Pendle is a 7-day average of the underlying protocol (with some assets like GLP as exceptions) to smoothen out short-term fluctuations of the underlying protocol's APY. Liquidity Provision[​](https://docs.pendle.finance/pendle-v2/FAQ#liquidity-provision "Direct link to Liquidity Provision") --------------------------------------------------------------------------------------------------------------------------- ### What do I receive in return for providing liquidity?[​](https://docs.pendle.finance/pendle-v2/FAQ#what-do-i-receive-in-return-for-providing-liquidity "Direct link to What do I receive in return for providing liquidity?") * Swap fees generated by the pool * PENDLE incentives * Protocol incentives emitted by the underlying asset (e.g. COMP,COMP, COMP,AAVE) ### Do I have to stake my LP to earn rewards?[​](https://docs.pendle.finance/pendle-v2/FAQ#do-i-have-to-stake-my-lp-to-earn-rewards "Direct link to Do I have to stake my LP to earn rewards?") No, you do not have to stake LP tokens. All LP token holders will receive their fair share of the rewards. Security[​](https://docs.pendle.finance/pendle-v2/FAQ#security "Direct link to Security") ------------------------------------------------------------------------------------------ ### Is Pendle audited?[​](https://docs.pendle.finance/pendle-v2/FAQ#is-pendle-audited "Direct link to Is Pendle audited?") The Pendle codebase has been fully audited by reputable auditors and all flaws have been addressed. Read the audit reports [here](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/audits) . Nonetheless, users are advised to exercise caution and deploy funds prudently. ### What risks are there associated with using the protocol?[​](https://docs.pendle.finance/pendle-v2/FAQ#what-risks-are-there-associated-with-using-the-protocol "Direct link to What risks are there associated with using the protocol?") **Risk Warning:** Since Pendle interacts with third-party protocols and contracts, there is inherent risk associated with the smart contracts and systems deployed by the third-party protocols. Pendle is not responsible for any funds lost due to exploits in third-party contracts. * [General](https://docs.pendle.finance/pendle-v2/FAQ#general) * [What does the maturity date mean?](https://docs.pendle.finance/pendle-v2/FAQ#what-does-the-maturity-date-mean) * [Why is the Underlying APY shown on Pendle differ from the APY shown in the underlying protocol?](https://docs.pendle.finance/pendle-v2/FAQ#why-is-the-underlying-apy-shown-on-pendle-differ-from-the-apy-shown-in-the-underlying-protocol) * [Liquidity Provision](https://docs.pendle.finance/pendle-v2/FAQ#liquidity-provision) * [What do I receive in return for providing liquidity?](https://docs.pendle.finance/pendle-v2/FAQ#what-do-i-receive-in-return-for-providing-liquidity) * [Do I have to stake my LP to earn rewards?](https://docs.pendle.finance/pendle-v2/FAQ#do-i-have-to-stake-my-lp-to-earn-rewards) * [Security](https://docs.pendle.finance/pendle-v2/FAQ#security) * [Is Pendle audited?](https://docs.pendle.finance/pendle-v2/FAQ#is-pendle-audited) * [What risks are there associated with using the protocol?](https://docs.pendle.finance/pendle-v2/FAQ#what-risks-are-there-associated-with-using-the-protocol) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Security | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Security#__docusaurus_skipToContent_fallback) On this page Audits[​](https://docs.pendle.finance/pendle-v2/Security#audits "Direct link to Audits") ----------------------------------------------------------------------------------------- Pendle smart contracts have been audited by Ackee, Dedaub, Dingbats, and some of the top wardens from Code4rena. All of Pendle's smart contracts are open source. ![Pendle Audits](https://docs.pendle.finance/assets/images/audits-a3255c2234772fe937f2a7d324eb35a4.jpeg "PendleAudits") All audits can be found in our GitHub repo: [https://github.com/pendle-finance/pendle-core-v2-public/tree/main/audits/](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/audits/) * [Audits](https://docs.pendle.finance/pendle-v2/Security#audits) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Wars & "Bribes" | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#__docusaurus_skipToContent_fallback) On this page > The information on this page was last updated: 2023-10-12 **“Pendle Wars”** is a term used to describe the competition for influence in the Pendle ecosystem among different platforms, like Penpie, Equilibria and StakeDAO, to accumulate $PENDLE token and liquidity on Pendle. The goal of these projects is to **accumulate** **vePENDLE** by locking more $PENDLE, which they can use to boost their yields on Pendle and pass them on to users. ### **What is vePENDLE?**[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#what-is-vependle "Direct link to what-is-vependle") The vote-escrowed PENDLE (vePENDLE) is a locked version of the PENDLE token. It grants: * Holders a share of the revenue generated on Pendle, * Increases yield to LP positions (boosting) and * Channeling of $PENDLE emissions. 💡 [Learn more about vePENDLE](https://docs.pendle.finance/ProtocolMechanics/Mechanisms/vePENDLE) in the documentation. However, vePENDLE is not liquid, meaning that it is not transferrable until the lock period expires. This creates an opportunity for other platforms to offer alternative solutions that allow users to enjoy the benefits of vePENDLE without locking their tokens. Current major contenders in the Pendle Wars[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#current-major-contenders-in-the-pendle-wars "Direct link to Current major contenders in the Pendle Wars") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * **Penpie** ([https://www.pendle.magpiexyz.io/](https://www.pendle.magpiexyz.io/) ) * **Equilibria** ([https://equilibria.fi/](https://equilibria.fi/) ) * **StakeDAO** ([https://lockers.stakedao.org/lockers/pendle](https://lockers.stakedao.org/lockers/pendle) or [https://beta.stakedao.org/lockers/pendle](https://beta.stakedao.org/lockers/pendle) ) StakeDAO is Ethereum mainnet only, while Penpie and Equilibria are deployed on multiple chains. 💡 **DISCLAIMER:** Please note that these projects are managed by external parties that are _not_ part of the Pendle team, _nor_ officially endorsed by Pendle. As always, **do your own research** and **understand your risks** when interacting with different protocols in DeFi. ### What do these platforms offer to Pendle users?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#what-do-these-platforms-offer-to-pendle-users "Direct link to What do these platforms offer to Pendle users?") Different platforms offer various benefits to Pendle users, such as: * Increasing yield (**APR boost**) on Pendle LP positions * Governance rights over Pendle Finance and revenue sharing without locking $PENDLE themselves * these platforms issue liquid wrapped version of vePENDLE (e.g. $mPendle, $ePendle, $sdPendle) which also shares revenue on _their_ platforms * these platforms also issue their own governance tokens which can be locked to share governance rights and revenue over Pendle * Earning **“Bribes”** as they vote to direct the flow of rewards to different Pendle pools * users typically need to obtain the vote-locked version of _their_ governance tokens to be able to vote and earn “bribes” * Accessing other exclusive features and platform specific benefits, if any ### Pendle Wars Statistics[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#pendle-wars-statistics "Direct link to Pendle Wars Statistics") There are some interesting information to look at about Pendle Wars, such as: 1. The current distribution of vePENDLE among different platforms 2. The current and historical liquid wrapper pegs (i.e. the exchange rate of the liquid wrapper token against the ordinary version $PENDLE) 3. The vote-locked percentage of the governance tokens of different platforms Here are some of the community-created Pendle Wars statistics/visualisation: 1. DefiWars ([https://www.defiwars.xyz/wars/pendle](https://www.defiwars.xyz/wars/pendle) ) 2. Dune Analytics ([https://dune.com/coumarin/pendle-war](https://dune.com/coumarin/pendle-war) ) * * * What are “Bribes”?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#what-are-bribes "Direct link to What are “Bribes”?") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- In the context of governance in DeFi protocols, “bribes” in voting refer to rewards offered to governance token holders in exchange for their votes on proposals. These rewards can be in the form of tokens, fees, or other incentives that aim to influence the outcome of the vote. Despite the common name “bribes”, it’s important to note that these rewards can be seen as a legitimate way to incentivize participation and engagement in governance. For Pendle, **“bribes” refer to the rewards offered to vePENDLE voters in exchange for their votes in Pendle’s gauge voting system**. The gauge voting system is used to direct the flow of rewards to different Pendle pools. By participating in voting, vePENDLE holders may earn rewards offered by other projects that have liquidity pool on Pendle. ### How to earn “Bribes”?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#how-to-earn-bribes "Direct link to How to earn “Bribes”?") Currently, “bribes” are usually offered to the vePENDLE controlled by Penpie and Equilibria, so access to “bribes” is available only through the bribery markets on Penpie and Equilibria. However, this may change in the future if projects are willing to offer “bribes” directly to other vePENDLE holders. To access the bribery markets on Penpie and Equilibria, you need to hold their vote-locked (vl-)tokens, namely vlPNP or vlEQB. These vl-tokens give voting rights and protocol revenue to their holders. Here are the **active bribery markets** targeting Pendle’s gauge voting system: * Penpie’s bribery market: [https://www.pendle.magpiexyz.io/bribe](https://www.pendle.magpiexyz.io/bribe) * Equilibria’s bribery market: [https://equilibria.fi/vote](https://equilibria.fi/vote) & [https://hiddenhand.finance/equilibria](https://hiddenhand.finance/equilibria) Please refer to each project’s documentation for more information on how each vote-locked token and bribery market works. ### Why do projects offer “Bribes”?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#why-do-projects-offer-bribes "Direct link to Why do projects offer “Bribes”?") The TVL behind these vl-tokens is typically much less than the actual value of vePENDLE these protocols control. This creates leverage on the voting power controlled by these vl-tokens. As a result, a relatively small amount of “bribes” is enough to drive a large number of votes to flow to the target pool, thereby significantly increasing the $PENDLE incentive flowing to the pool. Therefore, it is much more capital-efficient for other projects to bribe voters than to directly emit token rewards to the LP pools. According to the tweet by Pendle Intern ([https://x.com/PendleIntern/status/1706240227776606528?s=20](https://x.com/PendleIntern/status/1706240227776606528?s=20) ), based on a study made on Sep 25, 2023, the efficiency was as good as $400 - $2300 of $PENDLE voted per $1 bribed. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(26).png) Bribe efficiency on Equilibria’s bribery market, as of Sep 25, 2023 ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(27).png) Bribe efficiency on Penpie’s bribery market, as of Sep 25, 2023 ### Conclusion[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#conclusion "Direct link to Conclusion") In conclusion, “bribes” are rewards offered to vePENDLE holders in exchange for their votes in the Gauge Voting system. Equilibria and Penpie offer different tokens (vlEQB and vlPNP) that give voting rights and protocol revenue. Protocols that have liquidity on Pendle Finance are very keen to buy votes from these platforms, as they can get more PENDLE emissions on their liquidity. After voting in the Gauge Voting or bribery market, vePENDLE holders can earn a vote reward from Pendle and a potential bribe reward from other protocols. * [**What is vePENDLE?**](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#what-is-vependle) * [Current major contenders in the Pendle Wars](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#current-major-contenders-in-the-pendle-wars) * [What do these platforms offer to Pendle users?](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#what-do-these-platforms-offer-to-pendle-users) * [Pendle Wars Statistics](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#pendle-wars-statistics) * [What are “Bribes”?](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#what-are-bribes) * [How to earn “Bribes”?](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#how-to-earn-bribes) * [Why do projects offer “Bribes”?](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#why-do-projects-offer-bribes) * [Conclusion](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/pendle-wars-and-bribes#conclusion) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # PT / YT / LP Cheatsheet | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#__docusaurus_skipToContent_fallback) On this page What is Pendle[​](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#what-is-pendle "Direct link to What is Pendle") -------------------------------------------------------------------------------------------------------------------------------------------------------------- Pendle lets you earn better yields. We help you secure better certainty and better returns (i.e. higher APY 🔥). 1. Earn fixed yield (with PT) 2. Provide liquidity (LP) to earn extra yield with minimal or zero impermanent loss (IL) 3. Long yield (with YT) ### PT & YT — a quick round-up[​](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#pt--yt--a-quick-round-up "Direct link to PT & YT — a quick round-up") Imagine Pendle being a marketplace where property owners can split and trade their principal (rights to the ownership of the property) and yield (rights to rental payments) separately. You can then sell or trade the yield portion even before maturity. This creates new ways to manage and even speculate on yield. 💡 Using stETH as an example: **Principal** (Right to Principal of stETH) + **Yield** (Rights to stETH yield) = **Yield-bearing asset** (stETH) #### **Principal Token (PT)**[​](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#principal-token-pt "Direct link to principal-token-pt") * 1 PT lets you redeem 1 unit of the original asset at maturity date. * PT is similar to [zero-coupon bond](https://www.investopedia.com/terms/z/zero-couponbond.asp) in traditional finance. #### Yield **Token (YT)**[​](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#yield-token-yt "Direct link to yield-token-yt") * 1 YT lets you receive the yield of 1 unit of the original asset until the maturity date, claimable in real-time. * YT is similar to [detached coupons of bonds](https://www.investopedia.com/terms/c/coupon.asp) in traditional finance. **You can sell PT and YT anytime** on Pendle market, with _**no**_ **lock or penalty**, at market price. They are traded 24/7. Perhaps the most important takeaway about PT & YT: 💡 PT Price + YT Price = Underlying Asset Price * * * PT Cheatsheet — Earn fixed yield[​](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#pt-cheatsheet--earn-fixed-yield "Direct link to PT Cheatsheet — Earn fixed yield") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | | --- | --- | | TL;DR | **Earn** **guaranteed amount of your chosen asset** if you hold the position until the maturity date. | | Yield source | PT has [a lower entry cost compared to underlying asset](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics)
, its value grows over time and becomes 1:1 redeemable to the original asset at maturity date. Your realised discount becomes your fixed yield. | | Volatility | Low | | Investment profile | Long term | | | Beginners friendly | | Guaranteed | Both capital and return are guaranteed, if you hold until maturity | | Underlying asset yield outlook | Bearish | | Price changes | Price rises _in the short term_ with…

1. time
2. Falling [implied APY](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#implied-apy)

3. Rising underlying asset price (and vice versa) Note that PT is always 1:1 redeemable to underlying asset at maturity date. | | Valuation | PT is cheap when [_Implied APY_](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#implied-apy)
is much higher than the [_Underlying APY_](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#underlying-apy) | | Time to enter | 1. If you believe the asset will generate less APY in the future,
2. If you want to hedge against falling yields,
3. If you feel satisfied enough with the advertised APY,
4. If you believe PT is too undervalued | | Early exit | **Anytime**, there’s **no lock or penalty**. PT always has a market price in Pendle’s AMM. | | Capital efficiency | No leverage by itself. However, there are [lending platforms](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/broken-reference)
that allow you to deposit PTs as collateral to borrow assets, or even loop-leveraging. | | Other comments | PT can be a viable alternative to spot, with similar risk exposure, and the benefit of downside cushion thanks to the fixed yield realized upon redemption. PT can also be a [short-yield strategy](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-6-shorting-yield)
, you may profit in short-term if underlying yield goes down. | Can I profit if I early exit my PT? When you exit early, your earnings will depend on the PT’s market price at exit. You may earn higher or lower (in extreme cases, at a loss) than the advertised APY at entry. Note that, however, PT is always 1:1 redeemable to the underlying asset at the maturity date, you do not necessarily need to sell under unfavorable short-term price moves. YT Cheatsheet — Increase yield exposure (Long yield)[​](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#yt-cheatsheet--increase-yield-exposure-long-yield "Direct link to YT Cheatsheet — Increase yield exposure (Long yield)") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | | --- | --- | | TL;DR | **Increase your yield exposure (long yield)**. Either hold it until maturity, or buy low and sell high to turn a quick profit. You profit when either or both…

1. the price of YT rises,
2. the yield produced by the YT becomes bigger than your cost buying the YT | | Yield source | YT [receives all yield produced by the underlying asset](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics)
until maturity date, claimable in real time. | | Volatility | Higher | | Investment profile | Short or Long term | | | Intermediate to Advanced investors | | Guaranteed | N/A | | Underlying asset yield outlook | Bullish | | Price changes | Price rises with…

1. Rising [implied APY](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#implied-apy)

2. Rising underlying asset price
3. Rising yield/reward token asset price (if applicable to that asset) (and vice versa) Note that **time** works _against_ YT — YT price gradually falls over time to zero at maturity. | | Valuation | YT is cheap when [_Implied APY_](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#implied-apy)
is much lower than the [_Underlying APY_](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#underlying-apy) | | Time to enter | 1. If you believe the asset will generate more APY in the future,
2. If you want to hedge against rising yield,
3. If you want to speculate on short-term rise of yield % or yield token prices
4. If you believe YT is too undervalued | | Early exit | **Anytime**, there’s **no lock or penalty**. YT always has a market price in Pendle’s AMM. | | Capital efficiency | Since [YT is much cheaper than the underlying asset](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics)
, you _effectively_ get a **leveraged yield exposure** (typically 20x or more), with no actual borrowing involved. So there’s **no liquidation or oracle error risks**. | LP Cheatsheet — Earn passive extra yields providing liquidity[​](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#lp-cheatsheet--earn-passive-extra-yields-providing-liquidity "Direct link to LP Cheatsheet — Earn passive extra yields providing liquidity") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | | | --- | --- | | TL;DR | **Earn extra “free” yields on top of your otherwise idle yield-bearing assets.** A Pendle pool is denominated in your selected underlying asset _only_ (PT + SY) (SY = wrapped underlying asset). There’s also **no impermanent-loss (IL) concern at maturity**. | | Yield source | Multiple avenues:

1. Native yields — asset’s underlying yield + PT’s fixed yield
2. Swap fees 3. $PENDLE incentives (Optional) You can boost your APY by locking PENDLE for [vePENDLE](https://docs.pendle.finance/ProtocolMechanics/Mechanisms/vePENDLE)
. vePENDLE holders can also boost their Liquidity Provision APY up to 2.5X. | | Volatility | Low IL is minimal (pool consists of highly correlated tokens only) before maturity date. No IL at maturity date because PT in the pool will become 1:1 redeemable to underlying asset. | | Investment profile | Short or Long term | | | Beginners friendly | | Guaranteed | APY not guaranteed but capital is guaranteed if you hold until maturity | | Underlying asset yield outlook | Slightly bearish, due to some presence of PT in the pool | | Price changes | Short term price change behavior is similar to PT due to some presence of PT in the pool. Note that the PT in the pool is always 1:1 redeemable to underlying asset at maturity date. | | Time to enter | Anytime. Timing or underlying yield outlook aren’t very important. When implied APY is low, it is more favorable to enter with the “[Zero Price Impact Mode](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#what-is-zero-price-impact-mode)
” enabled, and vice versa. | | Early exit | **Anytime**, there’s **no lock or penalty**. Your APY is also not affected if you exit early. | | Comment | Can be used to hedge against falling underlying yield due to some presence of PT in the pool. Learn more about using [LP as part of your yield trade](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield)
. | Learn more on [chapter-9-identifying-opportunities-to-long-short-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-9-identifying-opportunities-to-long-short-yield "mention") * [What is Pendle](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#what-is-pendle) * [PT & YT — a quick round-up](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#pt--yt--a-quick-round-up) * [PT Cheatsheet — Earn fixed yield](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#pt-cheatsheet--earn-fixed-yield) * [YT Cheatsheet — Increase yield exposure (Long yield)](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#yt-cheatsheet--increase-yield-exposure-long-yield) * [LP Cheatsheet — Earn passive extra yields providing liquidity](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet#lp-cheatsheet--earn-passive-extra-yields-providing-liquidity) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # TERMS OF USE (THESE “TERMS”) | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/TermsOfUse#__docusaurus_skipToContent_fallback) On this page Date Last Revised: 9 December 2025 (“**Date Last Revised**”) The Website and the Pendle Protocol (each as defined herein) is operated by Univerum Innovations Inc (“**Company**”, “**we**”, "**us**”, or “**our**”), an entity established under the laws of the Republic of Panama. By: (a) accessing the Website; (b) using Pendle Protocol; and/or (c) integrating Pendle Protocol with your protocol or products (whether on behalf of your users (including you as a representative of Non-Pendle Underlying Protocol (as defined below) or otherwise)), you (“**you**” or “**User**”) agree to these Terms, and if applicable, you agree to these Terms for and on behalf of any person (as defined in these Terms to include an entity) you represent, and you represent and warrant that you have the right and authority to do so. For purposes of these Terms, User and Company shall be collectively referred to as “**Parties**”, and each, a “**Party**”. Please review these Terms carefully, as they set forth legally binding terms and conditions between you and the Company that govern your access and/or use of: (a) the website located at [https://pendle.finance](https://pendle.finance/) , including all applications, chatbots, widgets, linked pages within the same domain and all associated social media channels and chat forums (collectively, the “**Website**”); (b) the Smart Contracts (as defined below), whether your access and/or use is via (i) the Website-hosted interface access (“**Website Access**”) or (ii) command line, locally installed programs, software development kits, software code and blockchain and smart contract explorers or any other channel through which you interact with the Smart Contracts (collectively “**Direct Access**”); and (c) any content or document you may have access to that is prepared by the Company and/or any other person in connection with Pendle Protocol (“**Content**”). These Terms are to be read together with the provisions set forth in our privacy policy found at [https://docs.pendle.finance/pendle-v2/PrivacyPolicy](https://docs.pendle.finance/pendle-v2/PrivacyPolicy) (“**Privacy Policy**”). For purposes of these Terms, the Website, the Smart Contracts, Content, and all associated product(s) or product component(s) associated with Pendle-branded products (including Pendle V2 and Boros (each as defined herein)) shall be collectively referred to as “**Pendle Protocol**”. **~Pendle Protocol is not intended for (a) access and/or use by Excluded Persons (as defined below); or (b) access and/or use by any person or entity in, or accessing or using Pendle Protocol from, an Excluded Jurisdiction. Accordingly, Excluded Persons (as defined below) must not access and/or use Pendle Protocol.~** You acknowledge that you shall be deemed to have accepted these Terms by accessing and/or using Pendle Protocol–whether by Website Access or Direct Access and/or accessing or retaining Content. Company reserves the right to change these Terms in its sole discretion from time to time. The “**Date Last Revised**” specified on these Terms indicates the date on which the Terms were last changed. Your acceptance of, and/or your access or continued access and/or use of Pendle Protocol following notice of, the updated Terms shall indicate your acknowledgement of, and agreement to be bound by, the updated Terms. ### 1\. OVERVIEW OF PENDLE PROTOCOL[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#1overview-of-pendle-protocol "Direct link to 1. OVERVIEW OF PENDLE PROTOCOL") 1. Pendle Protocol is a collection of open-source protocols that enables a User to, on a self-directed and non-custodial basis, among other things (“**Pendle Protocol Activities**”): 1. in connection with the Pendle V2 product accessible at: [https://app.pendle.finance/trade/markets](https://app.pendle.finance/trade/markets) (last accessed on the Date Last Revised) (“Pendle V2”): 1\. in respect of such User’s yield or reward bearing asset (“**Yield-Bearing Asset**”), effectively separate the yield component from the principal component to be each represented by tokens referred to as “**YT**” and “**PT**” respectively; 2\. trade and/or provide liquidity for PTs and/or YTs; 2. in connection with the Boros product accessible at: [https://boros.pendle.finance/](https://boros.pendle.finance/) (last accessed on the Date Last Revised) (“**Boros**”); 1\. trade funding rates (including on a leveraged basis against User’s collateral) on perpetual markets on certain third-party trading venues; 2\. provide liquidity towards trading of funding rates (including through liquidity vaults); 3. participate and provide certain governance-related input relating to Pendle Protocol using the PENDLE Token (“**PENDLE Token**”); 4. such other functions or features available through Pendle Protocol. See documentation related to the Pendle Protocol accessible at [https://docs.pendle.finance](https://docs.pendle.finance/) and all its associated links (“**Pendle Protocol Documentation**”), which you acknowledge to have reviewed and have understood how the Pendle Protocol operates. 2. **IMPORTANT: AS A GENERALLY SELF-DIRECTED AND NON-CUSTODIAL PROTOCOL, PENDLE PROTOCOL FUNCTIONS AS A “PASS-THROUGH” INFRASTRUCTURE TECHNOLOGY LAYER THAT ENABLES USER TO EXECUTE TRANSACTIONS DIRECTED BY THE USER BASED ON THE PARAMETERS THAT HAVE BEEN ENCODED IN PENDLE PROTOCOL WHICH USER AGREES TO AND WISHES TO VOLUNTARILY EXECUTE ON A SELF-DIRECTED BASIS. NEITHER THE COMPANY NOR ITS AFFILIATES IS: (A) PROVIDING ANY SERVICE OF EXECUTING ANY TRANSACTION ON BEHALF OF USER; (B) SOLICITING USER TO PERFORM ANY ACTION; (C) AN ISSUER OF ANY TOKEN TO THE USER OR ANY OTHER PERSON (INCLUDING BUT NOT LIMITED TO PT AND YT, WHICH ARE ISSUED ON A SELF-DIRECTED BASIS); (D) A CLEARING HOUSE, BROKER, DEALER, CUSTODIAN, OR ANY OTHER TYPE OF INTERMEDIARY TO THE USER AND ANOTHER PERSON.** 3. **Pendle** Protocol is integrated with or built on other blockchains which may comprise Yield-Bearing Assets issued on such blockchains or based on other protocols (“**Non-Pendle Underlying Protocols**”). These Yield-Bearing Assets and blockchains are neither issued, operated nor controlled by the Pendle Group (as defined below). 4. Pendle Protocol enables Pendle Protocol Activities using smart contracts comprising computer code written based on various blockchain standards and programming languages (collectively, “**Smart Contracts**”) deployed by Company or its Affiliate(s) which are referred to at Pendle Protocol’s official Github page (“**Github Page**”). 5. For purposes of these Terms: 1. “**Affiliate**” in respect of a person (“first-mentioned person”), means any other person (“second-mentioned person”) that directly or indirectly controls, is controlled by, or is under common control with, the second-mentioned person, including but not limited to a parent company, subsidiary, service provider, a person having direct or indirect interest, and the scope of the foregoing shall also be enlarged to include, in respect of each of the first-mentioned and second-mentioned person, their respective owners, directors, officers, employees, advisors and agents; 2. “**Pendle Protocol Supported Asset**” means any asset or position made available on or can interact with the Pendle Protocol, including but not limited to PT, YT, PENDLE Token and any asset underlying PT and YT; 3. “**Pendle Group**” means the Company and its Affiliates collectively; 4. “**Supported Wallet**” in relation to Pendle Protocol, means such digital wallet of User as may be supported by Pendle Protocol; a reference to: 5. a “person” includes a reference to any individual, body corporate, unincorporated association or partnership; 6. an agreement or other document is a reference to that agreement or document as from time to time supplemented or amended; 7. the masculine gender includes the feminine and neuter genders and vice versa; 8. the singular includes the plural and vice versa; and 9. any law or regulation is a reference to that law or regulation as amended from time to time and, where the same has been repealed, to any re-enactment or replacement of the same. 6. **Website Access** 1. The Website is a user interface deployed by Company to facilitate use of the Pendle Protocol and Smart Contracts by providing a user-friendly interface to access and/or use the Smart Contracts, although the Smart Contracts are also accessible / can be used via Direct Access. Company may modify or discontinue support for the Website at any time, in its sole discretion. 2. You are hereby granted a non-exclusive, non-transferable, revocable, limited licence to electronically access and use the Website in the manner described in these Terms. You do not have the right, and nothing in these Terms shall be construed as granting you the right, to sub-license any rights in connection with the access and/or use of the Website. Company may revoke or terminate this licence at any time if you use, or attempt to use, the Website in a manner prohibited by these Terms, or if your rights are terminated pursuant to these Terms. 7. **Direct Access**. With the necessary technical expertise, it is possible for a User to generate transaction messages to interact with the Smart Contracts via Direct Access directly without use of the Website. Company is not involved in and has no oversight of any Direct Access and expressly disclaims all responsibility, and User acknowledges that Pendle Group shall have no responsibility for any loss suffered or attributable to Direct Access. 8. **Smart Contracts**. The Smart Contracts are open source and generally documented at the Github Page and are subject to modification. You agree that save for the right to access and/or use the Smart Contracts on the relevant licensing terms, you shall not acquire and/or own any legal right, title and/or interest in the Smart Contracts or any intellectual property rights associated thereto. 9. **Transaction-Related Costs**. 1. User may be subject to transaction-related costs, including transaction fees, slippage, among others (“Transaction-Related Costs”) while using Pendle Protocol. Such Transaction-Related Costs designed and encoded as part of the Pendle Protocol. Such Transaction-Related Costs like slippage may be a function of liquidity conditions (for example, the lack of liquidity may result in substantially higher price impact and costs). You acknowledge and agree to assume all Transaction-Related Costs. 2. User hereby consents to such Transaction-Related Costs being charged / debited from such User’s assets which may also be applicable to Users using the Smart Contracts via Direct Access. 3. Such Transaction-Related Costs may be subject of variation through on-chain governance with such variation implemented via variations to the Smart Contracts. ### 2\. REPRESENTATIONS AND WARRANTIES[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#2representations-and-warranties "Direct link to 2. REPRESENTATIONS AND WARRANTIES") 1. By accessing and/or using Pendle Protocol and/or connecting a Supported Wallet to Pendle Protocol, User makes the following representations and warranties: 1. User is at least eighteen (18) years of age, and has the full right, power and authority to access and/or use the Pendle Protocol, and to enter into and comply with these Terms; 2. User is not prohibited and/or restricted under the laws of any jurisdiction applicable to User from accessing and/or using Pendle Protocol; 3. User is compliant with all laws of any jurisdiction applicable to User in relation to User’s access and/or use of Pendle Protocol and acknowledges and agrees that the Pendle Group is not liable for User’s compliance or non-compliance with any such laws; 4. User is not an Excluded Person (as defined below), and User is not accessing and/or using Pendle Protocol from an Excluded Jurisdiction (as defined below); 5. User has not had User’s access or use of Pendle Protocol previously terminated or revoked for any reason whatsoever; 6. User will not, and will not attempt to, authorize anyone other than User to access and/or use Pendle Protocol using a Supported Wallet owned by User, or otherwise engage in Prohibited Use (as defined below) of such Supported Wallet; 7. User is the legal and beneficial owner of, or is authorized by the owner of the Supported Wallet to hold and/or deploy assets through Pendle Protocol; and 8. User is knowledgeable in using and evaluating blockchain technologies and related blockchain-based digital assets, including Pendle Protocol, PT and YT, Pendle Protocol Supported Assets and Supported Wallets, and User has evaluated and understands the use of Pendle Protocol and has not relied on any information, statement, representation, or warranty, express or implied, made by or on behalf of Pendle Group with respect to Pendle Protocol whether as regards the suitability, reliability, security or otherwise of Pendle Protocol. Each and all of User’s above representations and warranties are true, complete, accurate and not misleading from the time of User’s acceptance of these Terms and are deemed repeated each time User uses the Pendle Protocol. 2. By accessing and/or using Pendle Protocol, User acknowledges and accepts that the Pendle Group shall not be liable to User for the deployment and maintenance of Pendle Protocol and/or any malfunction thereof. 3. Company may, in its sole discretion, modify or discontinue support for Pendle Protocol and/or access to the Smart Contracts at any time. 4. User shall be responsible for obtaining the data network access necessary to use and/or access Pendle Protocol, and for acquiring compatible hardware or device necessary to access and use Pendle Protocol and any updates thereto. 5. Use of Pendle Protocol may be disrupted due to malfunction and/or delays which are inherent to the use of the internet and electronic communications, and User agrees that the Pendle Group shall not be responsible for any such disruption, malfunction and/or delay, and any loss which may arise therefrom. 6. The Website and its contents are our property or the property of our licensors and are protected by copyright, trademark, patent and other applicable laws. User is permitted to download and print content from the Website solely for such User’s own personal use to the extent required to access and use the tools and information made available via the Website. Unless with our prior written consent, the Website and its contents must not be reproduced, modified, redistributed or otherwise used for any other reason. 7. User shall not modify, adapt or hack the Website and/or Pendle Protocol, or modify any other website and/or protocol to falsely imply that such other website and/or protocol is associated with the , Pendle Protocol and/or Pendle Group and/or its Affiliates (as defined below) in any way. User shall not crawl, scrape, cache or otherwise access any content from the Website via automated means, and User shall not use automated data collection, data mining, robots or any other data gathering methods of any kind on the Website and/or Pendle Protocol. 8. User may, through hyperlinks displayed on the Website, gain access to websites operated by persons other than Pendle Protocol. Such hyperlinks are displayed only for User’s convenience, and we assume no responsibility for the use of any third-party software or other materials on the Website. ### 3\. EXCLUDED PERSON AND EXCLUDED JURISDICTION[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#3excluded-person-and-excluded-jurisdiction "Direct link to 3. EXCLUDED PERSON AND EXCLUDED JURISDICTION") 1. You agree not to use the Pendle Protocol if you are an Excluded Person and that we have the right to take appropriate action including restricting your access to Pendle Protocol if there is a reasonable suspicion that you or the person you are acting for is an Excluded Person. You shall not use a virtual private network, proxy or any other method to circumvent geo-blocks or eligibility criteria. 2. “**Excluded Jurisdiction**” means any of the following jurisdictions: 1. a jurisdiction identified by the Financial Action Task Force (FATF) for strategic AML/CFT deficiencies and included in FATF’s listing of “High-risk and Other Monitored Jurisdictions” accessible at [http://www.fatf-gafi.org/publications/high-risk-and-other-monitored-jurisdictions](http://www.fatf-gafi.org/publications/high-risk-and-other-monitored-jurisdictions) ; 2. a sanctioned, embargoed, adverse jurisdiction as identified in any adverse list issued by Office of Foreign Assets Control (OFAC), European Union (EU), United Nations (UN) or any other international or local regulatory or oversight body; and/or 3. a jurisdiction in which Pendle Protocol and the use of which are prohibited or would subject Pendle Group to licensing, permissions or approvals. 3. “Excluded Persons” refers to the following: 1. a person who is a citizen of, resident of, incorporated in, owned, controlled by, operating from an Excluded Jurisdiction, or an Affiliate of such person; 2. a person included in United Nations Consolidated List (accessible at [https://www.un.org/securitycouncil/content/un-sc-consolidated-list](https://www.un.org/securitycouncil/content/un-sc-consolidated-list) ), Consolidated Sanctions List, or any other adverse list issued by Office of Foreign Assets Control (OFAC), European Union (EU), United Nations (UN) or any other international or local regulatory or oversight body, or an Affiliate of such person; 3. if your wallet address is listed on the Specially Designated Nationals and Blocked Persons List or any other adverse list of any regulatory or oversight body, or any private or public entity that performs the function of wallet and illicit activity screening; 4. if you violate these Terms or can be reasonably suspected to be utilising Pendle Protocol for illegal or fraudulent purposes. ### 4\. PROHIBITED USE[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#4prohibited-use "Direct link to 4. PROHIBITED USE") User shall not, directly or indirectly: 1. access and/or use Pendle Protocol: 1. in violation of any law, rule, or regulation of any jurisdiction that is applicable to User; and/or 2. in violation or breach of these Terms and/or any other document from time-to-time governing User access and/or use of Pendle Protocol; 2. permit others to access Pendle Protocol through User’s wallet or a blockchain address User controls or otherwise engage in transactions using Pendle Protocol for any person other than the wallet owner; 3. disrupt, interfere with, or otherwise adversely affect the normal flow or function of Pendle Protocol or otherwise act in a manner that may negatively affect other users’ experience when using Pendle Protocol, and User shall not take advantage of software vulnerabilities and any other act that intentionally abuses or exploits the design and functions of Pendle Protocol; 4. engage in, or knowingly facilitate, any fraudulent, deceptive, or manipulative transaction activity in connection with User’s use of Pendle Protocol; 5. engage in, or knowingly facilitate, any money laundering, terrorist financing, or other illegal activities using Pendle Protocol; 6. access or attempt to access non-public systems, programs, data, or services using Pendle Protocol; 7. copy, reproduce, republish, upload, post, transmit, resell, or distribute in any way, any data, content, or any part of Pendle Protocol except as expressly permitted by applicable laws; and 8. attempt to bypass, evade or circumvent restrictions imposed by the Website or the Company, including but not limited to using virtual private networks, proxies or other methods to conceal your location, make false statements or misrepresentations about your residency, citizenship or compliance with applicable laws, or to circumvent the restrictions set out in these Terms or applicable law (collectively, “**Prohibited Uses**”). ### 5\. WAIVERS & RELEASE[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#5waivers--release "Direct link to 5. WAIVERS & RELEASE") 1. User agrees and acknowledges that neither the Company nor any of its Affiliates (as defined below) shall be liable to User for any direct, indirect, special, incidental, consequential or other losses of any kind, in tort, contract or otherwise (including but not limited to loss of revenue, income or profits, and loss of use or data), arising out of or in connection with User’s access and/or use of Pendle Protocol. 2. To the extent permitted by law, you expressly waive and release the Pendle Group from any and all liability, claims, causes of action, or damages arising out of or related to your use of the Website and Pendle Protocol including but not limited to: (i) any errors, delays, or interruptions in its operation; (ii) your interaction with the Pendle Protocol, including in respect of any unrealised gains, trading losses, liquidation events, or other financial impact; (iii) any reliance on market data, token values, or information displayed on the Website, which may be inaccurate; (iv) any third-party services; and (v) any regulatory, tax, or legal consequences arising in connection with Pendle Protocol. 3. User undertakes not to initiate or participate, and waives the right to participate in, any class action lawsuit or a class-wide arbitration against the Pendle Group in relation to User’s access and/or use of Pendle Protocol. 4. By accepting these Terms, User waives all rights, claims and/or causes of action (present or future) under law (including any tortious claims) or contract against the Pendle Group and its Affiliates in connection with User’s access and/or use of Pendle Protocol. ### 6\. TERMINATION[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#6termination "Direct link to 6. TERMINATION") 1. The Pendle Group may restrict, suspend and/or terminate User’s access and/or use of Pendle Protocol at any time for any reason and to such extent at Pendle Group’s sole discretion. 2. Neither the Company nor any of our Affiliates will have any liability whatsoever to User for any such restriction, suspension and/or termination or for any action taken by the Company and/or any of our Affiliates to implement such restriction, suspension and/or termination which can include blacklisting User’s Supported Wallet which User uses to access and/or use Pendle Protocol. 3. These Terms shall remain in effect in favour of the Pendle Group notwithstanding any such restriction, suspension and/or termination. ### 7\. DISCLAIMERS[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#7disclaimers "Direct link to 7. DISCLAIMERS") USER ACKNOWLEDGES AND AGREES THAT: 1. PENDLE PROTOCOL IS PROVIDED ON AN “AS-IS” AND “AS AVAILABLE” BASIS BY THE COMPANY, AND THE PENDLE GROUP EXPRESSLY DISCLAIMS ANY AND ALL REPRESENTATIONS, WARRANTIES AND/OR CONDITIONS OF ANY KIND, WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING ALL WARRANTIES OR CONDITIONS OF MERCHANTABILITY, MERCHANTABLE QUALITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, QUIET ENJOYMENT, ACCURACY, OR NON-INFRINGEMENT. 2. THE PENDLE GROUP HAS NOT MADE AND MAKES NO REPRESENTATION, WARRANTY AND/OR CONDITION OF ANY KIND THAT PENDLE PROTOCOL WILL MEET USER’S REQUIREMENTS, WILL BE AVAILABLE ON AN UNINTERRUPTED, TIMELY, SECURE, OR ERROR-FREE BASIS, OR WILL BE ACCURATE, RELIABLE, FREE OF VIRUSES OR OTHER HARMFUL CODE, COMPLETE, LEGAL, OR SAFE. NO REPRESENTATION THAT THE PENDLE TOKENS, PT, YT, YIELD-BEARING ASSET, OR ANY OTHER ASSET IN CONNECTION WITH PENDLE PROTOCOL SHALL HAVE OR SHALL CONTINUE TO HAVE ANY VALUE. 3. BLOCKCHAIN TRANSACTIONS, INCLUDING TRANSACTIONS EXECUTED USING PENDLE PROTOCOL ARE GENERALLY IRREVERSIBLE ONCE CONFIRMED. YOU ARE RESPONSIBLE FOR YOUR OWN TRANSACTIONS AND AGREE NOT TO HOLD THE PENDLE GROUP FOR YOUR TRANSACTIONS. 4. NEITHER PENDLE PROTOCOL NOR ANY OF ITS AFFILIATES IS USER’S BROKER, AGENT, TAX OR LEGAL ADVISOR, AND HAS NO FIDUCIARY RELATIONSHIP WITH OR OBLIGATION TO USER. NO COMMUNICATION OR INFORMATION PROVIDED BY PENDLE PROTOCOL OR ANY OF ITS AFFILIATES IS INTENDED AS OR SHALL BE CONSTRUED AS INVESTMENT, FINANCIAL, TAX, LEGAL OR ANY OTHER KIND OF ADVICE. THE PENDLE GROUP SHALL NOT BE LIABLE FOR ANY DECISIONS USER MAKES TO ACCESS AND/OR USE PENDLE PROTOCOL. 5. TO THE EXTENT THAT APPLICABLE LAW REQUIRES OR IMPOSES ANY REPRESENTATION, WARRANTY AND/OR CONDITION WITH RESPECT TO USER’S ACCESS AND/OR USE OF PENDLE PROTOCOL, ALL SUCH REPRESENTATION, WARRANTY AND/OR CONDITION ARE LIMITED IN DURATION TO THIRTY (30) DAYS FROM THE DATE OF FIRST ACCESS AND/USE BY USER OF PENDLE PROTOCOL. 6. THE PENDLE GROUP DOES NOT ENDORSE ANY THIRD PARTY AND SHALL NOT BE RESPONSIBLE IN ANY WAY FOR ANY TRANSACTIONS YOU ENTER INTO WITH ANY OTHER THIRD PARTY. 7. YOU ACKNOWLEDGE AND AGREE THAT NEITHER THE COMPANY NOR ANY OF ITS AFFILIATES WILL BE LIABLE TO YOU FOR ANY LOSS OR DAMAGES OF ANY SORT INCURRED AS THE RESULT OF ANY INTERACTIONS BETWEEN YOU AND ANY THIRD PARTY. ### 8\. LIMITATION OF LIABILITY[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#8limitation-of-liability "Direct link to 8. LIMITATION OF LIABILITY") 1. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL THE COMPANY AND/OR ANY OF OUR AFFILIATES BE LIABLE TO USER OR ANY THIRD PARTY FOR ANY LOST PROFITS, LOST DATA, OR ANY INDIRECT, CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, SPECIAL OR PUNITIVE DAMAGES ARISING OUT OF USER’S ACCESS AND/OR USE OF PENDLE PROTOCOL, EVEN IF THE COMPANY AND/OR ANY OF ITS AFFILIATES HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 2. USER’S ACCESS TO AND/OR USE OF PENDLE PROTOCOL IS AT USER’S OWN DISCRETION AND RISK, AND USER WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE TO USER’S DEVICE OR COMPUTER SYSTEM, OR LOSS OF DATA RESULTING THEREFROM. 3. NEITHER THE COMPANY NOR ANY OF ITS AFFILIATES SHALL BE LIABLE TO USER FOR ANY LOSS OR DAMAGE ARISING OUT OF USER’S FAILURE TO KEEP USER’S PRIVATE KEYS OR LOGIN CREDENTIALS TO USER’S WALLET SECURE OR ANY OTHER UNAUTHORIZED ACCESS TO OR TRANSACTIONS INVOLVING USER’S WALLET. 4. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, NOTWITHSTANDING ANYTHING TO THE CONTRARY CONTAINED HEREIN, THE LIABILITY OF THE COMPANY AND/OR ANY OF OUR AFFILIATES TO USER FOR ANY CLAIM BY USER FOR DAMAGES ARISING FROM OR RELATED TO USER’S ACCESS AND/OR USE OF PENDLE PROTOCOL: 1. WHETHER PURSUANT TO THESE TERMS; AND/OR 2. WHETHER FOR ANY CAUSE WHATSOEVER AND REGARDLESS OF THE FORM OF THE ACTION, WILL AT ALL TIMES BE LIMITED TO A MAXIMUM OF USD100. THE EXISTENCE OF MORE THAN ONE CLAIM BY USER WILL NOT ENLARGE THIS LIMIT. ### 9\. INDEMNIFICATION[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#9indemnification "Direct link to 9. INDEMNIFICATION") 1. User shall indemnify and hold the Pendle Group including each of their respective employees, officers, directors, representatives and agents (collectively, “Indemnified Party”), harmless, including costs and attorneys’ fees, from any loss, claim or demand made due to or arising out of: 1. User’s access and/or use of Pendle Protocol; 2. User’s violation of these Terms; and 3. User’s violation of laws or regulations applicable to User’s access and/or use of Pendle Protocol. 2. The relevant Indemnified Party reserves the right, at User’s expense, to assume the exclusive defence and control of any matter for which User is required to provide indemnification, and User agrees to cooperate in the defence of these claims. User shall not settle any matter without the prior written consent of the relevant Indemnified Party. The relevant Indemnified Party will use reasonable efforts to notify User of any such claim, action or proceeding upon becoming aware of it. ### 10\. TAX IMPLICATIONS[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#10tax-implications "Direct link to 10. TAX IMPLICATIONS") User is solely responsible for determining the tax implications and tax reporting requirements associated with transactions User engages in using Pendle Protocol, and for paying any applicable taxes in each applicable jurisdiction. Neither Pendle Protocol nor any of our Affiliates shall be responsible for determining whether there are tax implications in connection with transactions involving User’s use of Pendle Protocol, for reporting any such transactions, or for paying any applicable taxes. ### 11\. POTENTIAL RISKS ASSOCIATED WITH USE OF PENDLE PROTOCOL[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#11potential-risks-associated-with-use-of-pendle-protocol "Direct link to 11. POTENTIAL RISKS ASSOCIATED WITH USE OF PENDLE PROTOCOL") 1. The Use of Pendle Protocol is at the User’s own risk. 2. User acknowledges and agrees to assume all risks including the following: 1. **Underlying Protocol Risk**: Pendle Protocol is built on and is composable on several Non-Pendle Underlying Protocols. There is no assurance that the Non-Pendle Underlying Protocols are functioning or will continue to function as expected. If there are any adverse events affecting the Non-Pendle Underlying Protocols, it could result in a material adverse impact on User’s position on the Pendle Protocol. Such adverse events include without limitation, a de-peg in the price of a stablecoin or synthetically-pegged token, an exploit or cybersecurity compromise, oracle failure, freezing of assets or default by the Non-Pendle Underlying Protocols. The Non-Pendle Underlying Protocols may also operate in a manner that undermines or adversely affects PT, YT and Pendle Protocol as a whole, including without limitation, not honouring yield distributions to be made to the holders of PT and/or YT. 2. **Product Sophistication (including stablecoins, wrappers, etc.)**: Assets issued by Non-Pendle Underlying Protocols that integrated with Pendle Protocol can be sophisticated. You shall do your own due diligence and be satisfied with the risks you are assuming, including but not limited to the following: 1\. Products which are termed or characterised as stablecoins which may have price-stable characteristics but are structured differently from traditionally understood dollar or treasury-backed stablecoins like USD coin issued by Circle (“USDC”). In general, whilst stablecoins (including USDC) may possess price-stable characteristics, User should not assume that all stablecoins function in the same manner. In respect of all stablecoins, there is no assurance that User may ultimately be able receive any yields promised, and/or to recover the expected dollar-denominated amount for various reasons, including but not limited to a de-peg in price due to the insolvency of the issuer, the lack of liquidity to redeem the relevant stablecoin, a malfunction or exploit in the system supporting price stability of a stablecoin, or a change in the terms and conditions under which the relevant stablecoin is issued. The Pendle Group makes no representation in respect of any of such assets termed as stablecoins, including but not limited to how such stablecoins are structured, and whether User may be able to recover any value associated with such stablecoin. 2\. Products which track, or are wrappers or synthetic representations of, more traditionally understood products (“**RWA Associated Products**”), which for the avoidance of doubt are neither issued by the Company nor its Affiliates. In general, whilst such RWA Associated Products may track the price of an underlying traditionally understood asset (or commonly referred to as “**Real World Assets**” or “**RWA**”) the underlying RWA Associated Product, there is no assurance that User may ultimately be able to receive any yields promised, to recover the underlying RWA Associated Product, and/or to recover any dollar-denominated value expected from holding, trading or participating in Real World Assets or RWA. This could be for many reasons, including but not limited to a de-peg in price due to, among other things, the insolvency, malfeasance of the issuer, the lack of liquidity to redeem the RWA Associated Products, or a change in the terms and conditions under which the relevant RWA Associated Products are issued. The Pendle Group makes no representation in respect of any of such assets termed or associated with the RWA Associated Products or RWA, how such RWA Associated Products or RWAs are structured, and whether User may be able to recover any value associated with such RWA Associated Products or RWA. 3. **Monetary Loss**: Trading cryptographic tokens are highly risky and can result in losses including total loss. Where tokens are deposited in pools or vaults which includes or is exposed to other tokens, the movement in price relative to such other tokens and vice versa can result in impermanent loss, which may eventually realise into actual losses on withdrawal or termination of the User’s position. 4. **Liquidation Risks**: Where leverage is used, there is a risk of being liquidated, which may involve a total loss of your assets or capital. Liquidation may occur for various reasons, including a situation where your position is no longer supported by the value of your collateral based on the risk parameters of the Pendle Protocol. Automated liquidation can also occur in periods of high price volatility (whether such price volatility is caused by market movements or inaccurate or incorrect price feeds and other market structure issues) which results in auto-deleveraging (“**ADL**”). ADL is built into the risk parameters of Pendle Protocol and can occur even if your position would otherwise have been profitable, to avoid or mitigate the risk of bad debt of the Pendle Protocol. In the event of ADL, losses may effectively be socialised amongst other users. You accept the risk of total loss if your position is liquidated whether it occurs due to ADL or otherwise. 5. **Technology / Smart Contract Risk**: While security audits are carried on certain code infrastructure of Pendle Protocol, there is no assurance that such security audits are sufficient, comprehensive or that such security audits represent that Pendle Protocol is immune from exploits. Open technologies are typically targeted by bad actors and are vulnerable to exploits. There may be vulnerabilities or bugs in distributed networks, protocols, systems and smart contracts and there is no assurance that Pendle Protocol or any other protocol connected to the Pendle Protocol would be immune from attacks or exploits resulting in loss to User. 6. **Risks related to distributed network consensus mechanisms**: Distributed networks and blockchains are based on various consensus mechanisms (including but not limited to ‘proof-of-work’ or ‘proof-of-stake’ mechanisms) each having inherent risks. These include majority control risks, malicious or exploitive actions by nodes or network participants or a failure of such consensus mechanisms to work as intended resulting in forks and/or other circumstances resulting in disruption or loss. 7. **Risks associated, hardware, software or service providers**: Hardware and software disruptions can happen including disruptions from infrastructure service providers (including but not limited to cloud service providers). Pendle Protocol may be adversely affected by such disruptions which may result in disruption or loss to the User. 8. **Volatility Risk**: Digital assets and tokens are highly speculative and are usually subject to high price volatility. There is no assurance that these digital assets (including but not limited to PENDLE token, PT, YT and Yield-Bearing Assets), tokens and/or financial positions will have or will continue to have any market value. 9. **Tax Risks**: Tax treatment on digital assets and financial positions in connection with Pendle Protocol may have adverse tax consequences and you should seek independent tax and financial advice in connection with your use of Pendle Protocol. 10. **Regulatory Risk**: The laws, regulations and guidelines governing digital assets, distributed technologies and cryptographic tokens are uncertain and may apply or change in such a way as to have an adverse effect on User and User’s use of Pendle Protocol, including materially adverse effect on the distributed ledger industry, Pendle Protocol, the Pendle Group, and any asset in connection with Pendle Protocol. 11. **Operational Risk**: Contributors to Pendle Protocol may be compelled to cease operations for financial reasons, regulatory restrictions, hostile actions, legal proceedings, or any other circumstance that would make operations no longer viable. In such event, the development of Pendle Protocol may be disrupted and may not continue to operate as expected. 12. **Force Majeure**: Acts of God, natural disasters, wars, terrorist attacks, riots, civil commotions, widespread communicable diseases and other force majeure events may occur resulting in adverse effects on Pendle Protocol and User. 13. **Token Risk**: You shall not view or treat the PENDLE Token as a form of investment and shall only acquire the PENDLE Token with a view towards utilising PENDLE Token to participate in furthering the development of the Pendle Protocol. Similar to other cryptographic tokens in the industry, there can be no assurance of any value or of a constantly available market to acquire PENDLE Tokens with sufficient liquidity. You accept all risks (including all losses) associated with PENDLE Token as yours. 14. **Unanticipated Risks**: Notwithstanding the risks set out herein (which may not be complete), there can be risks that are not anticipated. Such unanticipated risks may realise into adverse consequences or loss to the User. 15. **Financial Risk**: Trading digital assets and/or providing liquidity of the same entails a high financial risk. User has necessary experience and knowledge to understand the risks involved. User should carefully assess User’s financial circumstances and risk tolerance and where appropriate, seek third party financial advice before engaging in the aforementioned activities. 16. **Address Handling Risks**. User is solely responsible for verifying the accuracy and authenticity of blockchain addresses in connection with the use of Pendle Protocol. User may interact with malicious, spoofed, cloned, modified or unofficial smart contracts, websites, interfaces or applications including phishing or impersonated interfaces designed to trick User into sending assets incorrectly. Such transactions, if executed on the blockchain is effectively irreversible. 3. Nothing in these Terms or the Website shall be construed as: 1. financial or investment advice. We do not provide any view on the merits of any particular investment. Any information provided is for educational purposes and to keep investors informed of prices, ranges, and volatility of digital assets and derivatives thereof. No person in the Pendle Group acts as your broker, intermediary, agent or advisor in any capacity; and 2. any marketing, promotion or offer for any product or investment to User or any third party. User shall be solely responsible for any losses, damages or costs resulting from User’s reliance on any data or information on the Website or otherwise. User shall be responsible for User’s decisions relating to Pendle Protocol which are User’s own. 4. Like all software, Pendle Protocol may be subject to exploits, accordingly, neither the Company nor any of its Affiliates shall be responsible to User for any such exploits or loss to User as a result of such exploits, whether foreseeable or not. 5. While the Company has taken a number of precautions to ensure the security of Pendle Protocol including obtaining third-party security audits, the technology constituting Pendle Protocol, and their interaction, is relatively new and it is not possible to guarantee that the code is completely free from bugs or errors. 6. User accepts all risks that arise from User’s access and/or use of Pendle Protocol, including and not limited to, the risk of any of Pendle Protocol Supported Assets being lost due to a failure or exploit of Pendle Protocol. 7. User is solely responsible for securing the private keys associated with any Supported Wallet which User uses when accessing and/or using Pendle Protocol. 8. User understands that anyone who obtains User’s private keys to User’s Supported Wallet and/or access to User’s device containing such private keys, may access User’s Supported Wallet controlled with those private keys with or without User’s authorisation and may transfer any Pendle Protocol Supported Assets accessible through User’s Supported Wallet. 9. In choosing to access and/or use Pendle Protocol, User does so on User’s own initiative and at User’s own risk, and User is responsible for complying with all applicable local laws, rules and regulations relating to User’s access and/or use of Pendle Protocol. 10. Support for the Pendle Protocol may be modified or discontinued at any time in Pendle Group’s sole discretion. 11. In the event of a change in the operating rules or other features of the relevant code (“**Fork**”) that may result in more than one version of a network (“**Forked Network**”) and more than one version of a digital asset (“**Forked Asset**”), Pendle Protocol may not support activity related to any Forked Assets. Forked Networks and the available supply of any Forked Assets are wholly outside Pendle Group’s control. In the event of a Fork, Pendle Group may temporarily suspend certain services on the Website (with or without advance notice to User) while it is determined which Forked Network(s) to support. Pendle Group shall not be responsible for a lack of support for any Forked Asset. 12. By using Pendle Protocol, User is using Pendle Protocol “as is” and “as available” with no representations or warranties whatsoever. To the maximum extent permitted by law, neither the Company nor any of its Affiliates makes any express or implied representations and warranties, including implied representations or warranties of accuracy, merchantability, fitness for a particular purpose and non-infringement in relation to Pendle Protocol. Neither the Company nor any of its Affiliates is responsible or liable for any error, delay or interruption in or lack of access to Pendle Protocol or for any loss of digital assets (including but not limited to Pendle Protocol Supported Assets) occasioned by or attributable to the Pendle Protocol. ### 12\. Electronic Communications[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#12electronic-communications "Direct link to 12. Electronic Communications") 1. The communications between User and the Company shall be via electronic means, either through the Website or electronic mail. 2. For contractual purposes, User: 1. consents to receive communications from the Company in any electronic form; and 2. acknowledges and agrees that all terms and conditions, agreements, notices, disclosures, and other communications that the Company provides to User electronically satisfy any legal requirement that would also be satisfied if such communications were to be in a hardcopy writing. ### 13\. CONTENT, THIRD PARTY SERVICES, PROGRAMS[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#13content-third-party-services-programs "Direct link to 13. CONTENT, THIRD PARTY SERVICES, PROGRAMS") 1. Nothing in Pendle Protocol, the Smart Contracts, the Website, or any Content shall constitute or be construed as an offer, solicitation, invitation, advertisement, inducement, financial promotion, marketing, or public offering of any tokens, securities, commodities, derivatives, financial instruments, or other regulated products in any jurisdiction. The Pendle Group does not purport to and does not provide any facility for the purchase, sale, issuance, distribution, exchange, arrangement, or offering of securities or capital markets products, nor does it intend or purport to operate any exchange, trading venue, organised market, regulated market, multilateral trading facility, payment service, money service business, or any similar regulated service. 2. All Content is subject to these Terms and is solely for informational purposes only. No representation is made and no Content shall in any way constitute an offer, solicitation, financial, legal, tax or professional advice. 3. ANY METRIC (“**METRIC**”), INCLUDING BUT NOT LIMITED TO YIELD, RETURN, APR, APY, RATE, PROJECTION, IMPLIED, ESTIMATION, SIMULATION, OR PERFORMANCE METRIC DISPLAYED OR REFERENCED IN CONTENT, ON THE WEBSITE AND IN CONNECTION WITH PENDLE PROTOCOL (INCLUDING IN RELATION TO ANY PT, YT, YIELD-BEARING ASSET, POOLS OR VAULTS) IS PROVIDED STRICTLY FOR INFORMATIONAL PURPOSES ONLY, AND SHALL NOT BE CONSTRUED AS A PROMISE, GUARANTEE, WARRANTY, OR REPRESENTATION OF ANY KIND. THE PENDLE GROUP DOES NOT GUARANTEE THAT ANY USER WILL RECEIVE ANY YIELD, RETURN, OR REWARD, OR THAT ANY REFERENCED YIELD-GENERATING MECHANISM WILL FUNCTION AS EXPECTED. PAST PERFORMANCE DOES NOT GUARANTEE FUTURE RESULTS, AND ALL ECONOMIC OUTCOMES REMAIN HIGHLY SPECULATIVE AND MAY RESULT IN TOTAL LOSS. SUCH METRIC CAN BE INACCURATE FOR VARIOUS REASONS, INCLUDING BUT NOT LIMITED TO INACCURATE API SOURCES, ROUNDING ERRORS, LATENCY, LACK OF LIQUIDITY, SPECULATIVE YIELD THAT ARE UNREALISED (INCLUDING POINTS THAT DO NOT REALISE INTO ANY VALUE) AND PRICE FLUCTUATIONS WHICH CAN DEVIATE GREATLY FROM ANY EXPECTATION OF VALUE, WHICH YOU ACCEPT. 4. By accessing or retaining Content, you acknowledge and agree that you qualify as a financially sophisticated person, that you have enquired and not been solicited to receive Content, that any action you take is entirely based on your due diligence and you have not relied on any part of Content, and that you accept all consequences and risks of damage or loss (direct or indirect) as your own and shall hold no one else liable (including the Pendle Group). 5. Content may include third party content (including links to other websites, content or applications) which are provided “as is” and shall not be construed as endorsement by any person including the Pendle Group. 6. We may in our sole discretion run promotions or growth campaigns (“Campaigns”) from time to time. The terms and conditions applicable to such Campaigns shall be at the sole discretion of the Pendle Group shall be ultimately subject to these Terms which are incorporated by reference. We reserve the right to modify, suspend or terminate such Campaigns and to cancel or retroactively revoke any benefits associated with such Campaigns at our own discretion. The benefits in connection with such Campaigns may not have any value and is subject to applicable law which may prohibit your participation. ### 14\. GENERAL[​](https://docs.pendle.finance/pendle-v2/TermsOfUse#14general "Direct link to 14. GENERAL") 1. **Entire Terms** These Terms (read together with our Privacy Policy) constitute the entire agreement between User and the Company regarding User’s access and/or use of Pendle Protocol. 2. **Severability** If any provision of these Terms is, for any reason, held to be invalid or unenforceable, the other provisions of these Terms will be unimpaired and the invalid or unenforceable provision will be deemed modified so that it is valid and enforceable to the maximum extent permitted by law. 3. **Relationship of Parties** Nothing contained in these Terms will be deemed to be construed as creating a partnership or an agency relationship or joint venture between User, the Company and/or any of our Affiliates. 4. **Assignment** These Terms, and User’s rights thereunder, may not be assigned, without the Company’s prior written consent, and any attempted assignment, subcontract, delegation, or transfer in violation of the foregoing will be null and void. The Company may freely assign these Terms and our respective rights thereunder. 5. **Waiver** A waiver by the Company of any right or remedy under these Terms shall only be effective if it is in writing, executed by a duly authorized representative of the Company and shall apply only to the circumstances for which it is given. Failure of the Company to exercise or enforce any right or remedy under these Terms shall not operate as a waiver of such right or remedy, nor shall it prevent any future exercise or enforcement of such right or remedy, and no single or partial exercise of any right or remedy shall preclude or restrict the further exercise of any such right or remedy or other rights or remedies. 6. **No Third-Party Rights** Save for the Company’s Affiliates and the Indemnified Parties who shall have the rights and benefits to the extent accorded thereto under these Terms, any person who is not a Party shall have no right under the Contracts (Rights of Third Parties) Act 2001 of Singapore to enforce any of these Terms. 7. **Governing Law and Jurisdiction** The agreement as shall be constituted by User’s acceptance of these Terms, and any dispute or claim arising out of or in connection with the subject matter or formation (including non-contractual disputes or claims) of such agreement, shall be governed by and construed in accordance with the law of Singapore. The Parties agree that any dispute or claim arising out of or in connection with the subject matter or formation (including non-contractual disputes or claims) of these Terms shall be by arbitration, and judgment upon the award may be entered by any court having jurisdiction thereof or having jurisdiction over the relevant Party or its assets. The arbitration shall be conducted under the rules of the Singapore International Arbitration Centre (“**SIAC**”). The arbitral tribunal shall consist of a sole arbitrator to be appointed by the President of the SIAC. The seat of the arbitration shall be Singapore. The language of the arbitration shall be English. The arbitration agreement shall be governed by Singapore law. 8. **Severability** If any provisions of these Terms are found by any court or tribunal of competent jurisdiction to be invalid, void, unlawful or unenforceable under any applicable law, such unenforceability or invalidity shall not render these Terms unenforceable or invalid as a whole, and such provisions shall be deleted without affecting the remaining provisions herein. * [1\. OVERVIEW OF PENDLE PROTOCOL](https://docs.pendle.finance/pendle-v2/TermsOfUse#1overview-of-pendle-protocol) * [2\. REPRESENTATIONS AND WARRANTIES](https://docs.pendle.finance/pendle-v2/TermsOfUse#2representations-and-warranties) * [3\. EXCLUDED PERSON AND EXCLUDED JURISDICTION](https://docs.pendle.finance/pendle-v2/TermsOfUse#3excluded-person-and-excluded-jurisdiction) * [4\. PROHIBITED USE](https://docs.pendle.finance/pendle-v2/TermsOfUse#4prohibited-use) * [5\. WAIVERS & RELEASE](https://docs.pendle.finance/pendle-v2/TermsOfUse#5waivers--release) * [6\. TERMINATION](https://docs.pendle.finance/pendle-v2/TermsOfUse#6termination) * [7\. DISCLAIMERS](https://docs.pendle.finance/pendle-v2/TermsOfUse#7disclaimers) * [8\. LIMITATION OF LIABILITY](https://docs.pendle.finance/pendle-v2/TermsOfUse#8limitation-of-liability) * [9\. INDEMNIFICATION](https://docs.pendle.finance/pendle-v2/TermsOfUse#9indemnification) * [10\. TAX IMPLICATIONS](https://docs.pendle.finance/pendle-v2/TermsOfUse#10tax-implications) * [11\. POTENTIAL RISKS ASSOCIATED WITH USE OF PENDLE PROTOCOL](https://docs.pendle.finance/pendle-v2/TermsOfUse#11potential-risks-associated-with-use-of-pendle-protocol) * [12\. Electronic Communications](https://docs.pendle.finance/pendle-v2/TermsOfUse#12electronic-communications) * [13\. CONTENT, THIRD PARTY SERVICES, PROGRAMS](https://docs.pendle.finance/pendle-v2/TermsOfUse#13content-third-party-services-programs) * [14\. GENERAL](https://docs.pendle.finance/pendle-v2/TermsOfUse#14general) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Claim | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/Claim#__docusaurus_skipToContent_fallback) On this page Claim the accrued yield from YT and rewards from farming.[​](https://docs.pendle.finance/pendle-v2/AppGuide/Claim#claim-the-accrued-yield-from-yt-and-rewards-from-farming "Direct link to Claim the accrued yield from YT and rewards from farming.") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. Go to [Dashboard](https://app.pendle.finance/pro/dashboard/overview) 2. Click “Claim Yield and Rewards” 3. Use the slider in the top right to filter for balance value 4. Select which rewards you would like to claim 5. Use the toggle in the top left to choose between USDC and raw token 6. Check your gas and swap fees, and hit Claim! * [Claim the accrued yield from YT and rewards from farming.](https://docs.pendle.finance/pendle-v2/AppGuide/Claim#claim-the-accrued-yield-from-yt-and-rewards-from-farming) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Mint | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/Mint#__docusaurus_skipToContent_fallback) On this page Mint PT and YT with your yield-bearing tokens.[​](https://docs.pendle.finance/pendle-v2/AppGuide/Mint#mint-pt-and-yt-with-your-yield-bearing-tokens "Direct link to Mint PT and YT with your yield-bearing tokens.") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. Go to [Markets](https://app.pendle.finance/pro/markets/) 2. Select your desired asset and maturity 3. Choose your input asset 4. Enter the transaction amount 5. Approve the transaction and Mint! * [Mint PT and YT with your yield-bearing tokens.](https://docs.pendle.finance/pendle-v2/AppGuide/Mint#mint-pt-and-yt-with-your-yield-bearing-tokens) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Bridging Pendle (PENDLE) Tokens | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#__docusaurus_skipToContent_fallback) On this page Bridging from Ethereum[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#bridging-from-ethereum "Direct link to Bridging from Ethereum") ------------------------------------------------------------------------------------------------------------------------------------------------------ ### 1\. Arbitrum[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#1-arbitrum "Direct link to 1. Arbitrum") * Bridge URL: [https://bridge.arbitrum.io](https://bridge.arbitrum.io/) * Steps: 1. Select Ethereum as the source and Arbitrum as the destination. 2. Choose PENDLE as the token and specify the amount. 3. Approve and confirm the bridge transaction. ### 2\. BNB Chain[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#2-bnb-chain "Direct link to 2. BNB Chain") * Bridge URL: [https://portalbridge.com/advanced-tools/#/transfer](https://portalbridge.com/advanced-tools/#/transfer) * Steps: 1. Open the link and select Ethereum as the source and BNB Chain as the destination. 2. Input PENDLE token address if it isn’t listed: 0x808507121B80c02388fAd14726482e061B8da827 3. Approve and bridge. ### 3\. Optimism[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#3-optimism "Direct link to 3. Optimism") * Bridge URL: [https://superbridge.app/optimism](https://superbridge.app/optimism) * Steps: 1. Connect your wallet and select PENDLE. 2. Choose Ethereum → Optimism. 3. Confirm the transfer. ### 4\. Mantle[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#4-mantle "Direct link to 4. Mantle") * Bridge URL: [https://app.mantle.xyz/bridge](https://app.mantle.xyz/bridge) * Steps: 1. Select Ethereum as the source and Mantle as the destination. 2. Pick PENDLE and initiate the bridge process. ### 5\. Sonic[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#5-sonic "Direct link to 5. Sonic") * Bridge URL: [https://gateway.soniclabs.com/ethereum/sonic/ftm-s](https://gateway.soniclabs.com/ethereum/sonic/ftm-s) * Steps: 1. Connect wallet and choose Ethereum → Sonic. 2. Select PENDLE from the token list. 3. Confirm and send. ### 6\. Base[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#6-base "Direct link to 6. Base") * Bridge URL: [https://superbridge.app/base](https://superbridge.app/base) * Steps: 1. Choose Ethereum → Base. 2. Pick PENDLE from the token list. 3. Bridge your tokens. ### 7\. Hyperliquid (HyperEVM)[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#7-hyperliquid-hyperevm "Direct link to 7. Hyperliquid (HyperEVM)") * Bridge URL: [https://stargate.finance/bridge?srcChain=ethereum&srcToken=0x808507121B80c02388fAd14726482e061B8da827&dstChain=hyperliquid&dstToken=0xD6Eb81136884713E843936843E286FD2a85A205A](https://stargate.finance/bridge?srcChain=ethereum&srcToken=0x808507121B80c02388fAd14726482e061B8da827&dstChain=hyperliquid&dstToken=0xD6Eb81136884713E843936843E286FD2a85A205A) * Steps: 1. Open the link above with your wallet connected. 2. Enter amount of PENDLE and confirm the bridge. ### 8\. Berachain[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#8-berachain "Direct link to 8. Berachain") * Bridge URL: [https://bridge.berachain.com/bridge/token](https://bridge.berachain.com/bridge/token) * Steps: 1. Connect your wallet. 2. Choose Ethereum as the source chain and Berachain as the destination. 3. Select PENDLE and confirm the transaction. Bridging Back to Ethereum[​](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#bridging-back-to-ethereum "Direct link to Bridging Back to Ethereum") --------------------------------------------------------------------------------------------------------------------------------------------------------------- To move your $PENDLE back to Ethereum from any of the supported chains: 1. Open the same bridge platform used to bridge out (linked above). 2. Select the source chain (e.g., Arbitrum, Mantle, etc.) and Ethereum as the destination. 3. Choose PENDLE, approve the transaction, and confirm the bridge. 4. Wait for confirmation (bridging times vary by chain). Note: Always double-check the destination wallet address and ensure you have enough native gas tokens (ETH, BNB, etc.) to cover fees on the source chain. * [Bridging from Ethereum](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#bridging-from-ethereum) * [1\. Arbitrum](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#1-arbitrum) * [2\. BNB Chain](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#2-bnb-chain) * [3\. Optimism](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#3-optimism) * [4\. Mantle](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#4-mantle) * [5\. Sonic](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#5-sonic) * [6\. Base](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#6-base) * [7\. Hyperliquid (HyperEVM)](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#7-hyperliquid-hyperevm) * [8\. Berachain](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#8-berachain) * [Bridging Back to Ethereum](https://docs.pendle.finance/pendle-v2/AppGuide/BridgePendle#bridging-back-to-ethereum) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Swap | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/Swap#__docusaurus_skipToContent_fallback) On this page Getting Fixed Yield with PT[​](https://docs.pendle.finance/pendle-v2/AppGuide/Swap#getting-fixed-yield-with-pt "Direct link to Getting Fixed Yield with PT") ------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. Go to [Markets](https://app.pendle.finance/pro/markets/) . ![PT Swaps 1](https://docs.pendle.finance/assets/images/pt-swaps-1-a33c92e1819ac5f2e83afee76a85af04.png) 2. Select your desired asset by clicking on the PT bar. ![PT Swaps 2](https://docs.pendle.finance/assets/images/pt-swaps-2-b73d95ae3609208b7dab71cbe76f8c0f.png) 3. Make sure you’re on the “Swap” tab, then choose your input asset. ![PT Swaps 3](https://docs.pendle.finance/assets/images/pt-swaps-3-63fc6c3a028347ac849b12e64c38fec9.png) 4. Enter the transaction volume. You can control your slippage tolerance with the gear icon in the top right corner. ![PT Swaps 4](https://docs.pendle.finance/assets/images/pt-swaps-4-8bca8ab6d8d3acbabfff120c3c102a08.png) 5. Review the output information. * Max. Slippage: The maximum slippage to be tolerated. Transaction reverts if slippage is beyond the tolerance number. * Effective Fixed APY: The fixed APY that you are effectively getting from this trade, after taking into account price impact and swap fees. This is equivalent to the final execution price/average price of acquisition for PT. ![PT Swaps 5](https://docs.pendle.finance/assets/images/pt-swaps-5-1dcf80623a949326c43186ae4e4d680a.png) 6. Once you’re ready, approve the transaction and Swap! Boosting your yield exposure with YT[​](https://docs.pendle.finance/pendle-v2/AppGuide/Swap#boosting-your-yield-exposure-with-yt "Direct link to Boosting your yield exposure with YT") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. Go to [Markets](https://app.pendle.finance/pro/markets/) . ![YT Swaps 1](https://docs.pendle.finance/assets/images/yt-swaps-1-a33c92e1819ac5f2e83afee76a85af04.png) 2. Select your desired asset by clicking on the YT bar. ![YT Swaps 2](https://docs.pendle.finance/assets/images/yt-swaps-2-30b9bfc1ba33a42ffa6a52820e949520.png) 3. Make sure you’re on the “Swap” tab, then choose your input asset. ![YT Swaps 3](https://docs.pendle.finance/assets/images/yt-swaps-3-3fd6a09c2b22ae82d2389471cf847163.png) 4. Enter the transaction volume. You can control your slippage tolerance with the gear icon in the top right corner. ![YT Swaps 4](https://docs.pendle.finance/assets/images/yt-swaps-4-e7bbf6aab27c8713dd62195dd4146e68.png) 5. Review the output information. * Max. Slippage: The maximum slippage to be tolerated. Transaction reverts if slippage is beyond the tolerance number. * Effective Fixed APY: The fixed APY that you are effectively getting from this trade, after taking into account price impact and swap fees. This is equivalent to the final execution price/average price of acquisition for YT. * Notional value traded: The amount of underlying asset needed to generate the trade. This can also be treated as the amount of yield exposure (i.e. YT generates yield from $122,366 worth of DAI deposit). ![YT Swaps 5](https://docs.pendle.finance/assets/images/yt-swaps-5-ff1d33c44c5608ce722116f04932b59c.png) 6. Once you’re ready, approve the transaction and Swap! * [Getting Fixed Yield with PT](https://docs.pendle.finance/pendle-v2/AppGuide/Swap#getting-fixed-yield-with-pt) * [Boosting your yield exposure with YT](https://docs.pendle.finance/pendle-v2/AppGuide/Swap#boosting-your-yield-exposure-with-yt) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle AI Plugin | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#__docusaurus_skipToContent_fallback) On this page The Pendle AI plugin ([pendle-finance/pendle-ai](https://github.com/pendle-finance/pendle-ai) ) is an open-source, beta-stage toolkit that lets AI agents interact with the Pendle V2 protocol directly. It exposes 25 MCP tools and 4 skills, enabling agents to trade yield tokens, manage LP positions, place limit orders, and query live market data — all across 7 EVM chains. The plugin works with Claude Code, Cursor, and Windsurf. * * * Installation[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#installation "Direct link to Installation") -------------------------------------------------------------------------------------------------------------------- Install via the Claude Code plugin marketplace: /plugin marketplace add pendle-finance/pendle-ai/plugin install pendle-v2 **Requirements:** Node.js 20 or higher. * * * What You Can Do[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#what-you-can-do "Direct link to What You Can Do") ----------------------------------------------------------------------------------------------------------------------------- The plugin is organized into four skills, each covering a distinct area of Pendle's functionality: ### `pendle-swap` — Trading and Liquidity[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-swap--trading-and-liquidity "Direct link to pendle-swap--trading-and-liquidity") Swap PT, YT, and SY tokens, add or remove liquidity from Pendle pools, and collect accrued rewards. ### `pendle-data` — Market Intelligence[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-data--market-intelligence "Direct link to pendle-data--market-intelligence") Query live market data, filter markets by APY or other criteria, look up token details, and explore yield strategy information. Market data is kept current via an in-memory database that refreshes every 5 minutes. ### `pendle-portfolio` — Position Tracking[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-portfolio--position-tracking "Direct link to pendle-portfolio--position-tracking") View your open positions across all Pendle markets, track profit and loss, and get notified as positions approach maturity. ### `pendle-order` — Limit Orders[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-order--limit-orders "Direct link to pendle-order--limit-orders") Create, sign, submit, and cancel limit orders on Pendle's order book. * * * Example Prompts[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#example-prompts "Direct link to Example Prompts") ----------------------------------------------------------------------------------------------------------------------------- Once installed, you can interact with Pendle through natural language. Some examples: * _"Show me all PT markets on Arbitrum with an implied yield above 8%."_ * _"Buy PT-weETH on Ethereum with 100 USDC."_ * _"What are my current Pendle positions and their P&L?"_ * _"Place a limit order to buy PT-stETH at 5% implied yield."_ * _"Add liquidity to the PT-USDe pool on Mantle."_ * * * Supported Chains[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#supported-chains "Direct link to Supported Chains") -------------------------------------------------------------------------------------------------------------------------------- The plugin covers 7 EVM chains, including Ethereum, Arbitrum, Optimism, BNB Chain, Mantle, Base, and others as supported by the Pendle V2 protocol. * * * Source Code and Contributions[​](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#source-code-and-contributions "Direct link to Source Code and Contributions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- The plugin is open source under the MIT License. See the [GitHub repository](https://github.com/pendle-finance/pendle-ai) for setup instructions, contribution guidelines, and the full list of available MCP tools. * [Installation](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#installation) * [What You Can Do](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#what-you-can-do) * [`pendle-swap` — Trading and Liquidity](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-swap--trading-and-liquidity) * [`pendle-data` — Market Intelligence](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-data--market-intelligence) * [`pendle-portfolio` — Position Tracking](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-portfolio--position-tracking) * [`pendle-order` — Limit Orders](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#pendle-order--limit-orders) * [Example Prompts](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#example-prompts) * [Supported Chains](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#supported-chains) * [Source Code and Contributions](https://docs.pendle.finance/pendle-v2/AppGuide/PendleAI#source-code-and-contributions) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pencosystem | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#__docusaurus_skipToContent_fallback) On this page The Pencosystem is the growing ecosystem of DeFi protocols, CeFi platforms, and institutions that have built on, partnered with, or integrated Pendle — collectively expanding what you can do with PT, YT, and LP positions beyond the Pendle app itself. From money markets that accept PT as collateral, to yield strategy protocols that automate looping, to CEXs and wallets that bring Pendle to a broader audience — the Pencosystem makes Pendle yields accessible across the wider crypto landscape. Finding Integrations[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#finding-integrations "Direct link to Finding Integrations") ----------------------------------------------------------------------------------------------------------------------------------------------- ### Global Pencosystem Directory[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#global-pencosystem-directory "Direct link to Global Pencosystem Directory") All Pencosystem partners are listed at [pendle.finance/pencosystem](https://pendle.finance/pencosystem) , organized by category: * **Money Market** — protocols where you can deposit PT as collateral and borrow against it (e.g., Aave, Morpho, Euler, Dolomite) * **Yield Strategy** — protocols that build automated strategies on top of Pendle markets (e.g., Contango, Ceres, AFI) * **CEX / Web3 Wallet** — centralized exchanges and wallets that have listed or integrated Pendle assets (e.g., Binance, Bybit, Coinbase, Bitget) * **Insurance** — protocols providing coverage for Pendle positions ### Per-Market Pencosystem Tab[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#per-market-pencosystem-tab "Direct link to Per-Market Pencosystem Tab") When viewing a specific PT market on the Pendle app, navigate to the **Pencosystem** tab to see which integrations are available for that market. This gives you a focused view of how you can put your PT to work beyond simply holding it. The Money Market section displays key metrics at a glance: | Field | Description | | --- | --- | | **Total Supply / Cap** | Total PT currently deposited in the money market and the protocol's supply cap, if any | | **Assets to Borrow** | The asset you can borrow against your PT collateral, and its current borrow rate | | **Max LTV** | The maximum Loan-to-Value ratio — how much you can borrow relative to your PT collateral value | | **Available Liquidity** | How much is currently available to borrow | | **Max Looping APY** | The maximum APY achievable by looping your PT position (see below) | * * * Money Markets[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#money-markets "Direct link to Money Markets") -------------------------------------------------------------------------------------------------------------------------- Money market integration is one of the most useful aspects of the Pencosystem. By depositing PT as collateral, you can borrow against your fixed yield position — unlocking capital without giving up your PT exposure. ### Borrowing Against PT[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#borrowing-against-pt "Direct link to Borrowing Against PT") 1. Navigate to the PT market you hold and open the **Pencosystem** tab. 2. Select a money market (e.g., Morpho) and click the link to open it. 3. Deposit your PT as collateral. 4. Borrow an asset (e.g., USDC) against your PT, up to the displayed Max LTV. PT is a fixed-yield asset that accrues value toward face value at maturity, making it a predictable and low-volatility form of collateral. Many money markets recognize this with relatively favorable LTV ratios. ### Looping PT for Leveraged Fixed Yield[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#looping-pt-for-leveraged-fixed-yield "Direct link to Looping PT for Leveraged Fixed Yield") Looping amplifies your fixed APY by using borrowed funds to buy more PT recursively. The **Max Looping APY** shown in the Pencosystem tab represents the theoretical maximum yield achievable through this strategy at current rates. A typical loop: 1. Deposit PT as collateral → borrow USDC. 2. Use borrowed USDC to buy more PT on Pendle. 3. Deposit the new PT as additional collateral → borrow more USDC. 4. Repeat until you reach your desired leverage level. The result is a larger PT position earning the fixed APY, with borrowing costs subtracted. The **Max Looping APY** reflects the net yield at maximum loop depth. **Note:** Looping increases your exposure and carries liquidation risk if the PT's collateral value drops relative to your borrow position. Some protocols — such as Contango — automate this strategy and manage the loop on your behalf. * * * Cross-Chain Access[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#cross-chain-access "Direct link to Cross-Chain Access") ----------------------------------------------------------------------------------------------------------------------------------------- With [Cross-Chain PT](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT) , you can hold PT on a chain where a money market or yield strategy is available, even if the underlying Pendle market is on a different chain. This makes the full Pencosystem accessible regardless of where your funds originate. For example, if a money market on HyperEVM accepts PT-wstETH as collateral, you can buy that PT from any chain and receive it directly on HyperEVM — ready to deposit without any additional bridging. * [Finding Integrations](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#finding-integrations) * [Global Pencosystem Directory](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#global-pencosystem-directory) * [Per-Market Pencosystem Tab](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#per-market-pencosystem-tab) * [Money Markets](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#money-markets) * [Borrowing Against PT](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#borrowing-against-pt) * [Looping PT for Leveraged Fixed Yield](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#looping-pt-for-leveraged-fixed-yield) * [Cross-Chain Access](https://docs.pendle.finance/pendle-v2/AppGuide/Pencosystem#cross-chain-access) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Limit Order | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/LimitOrder#__docusaurus_skipToContent_fallback) On this page Guides[​](https://docs.pendle.finance/pendle-v2/AppGuide/LimitOrder#guides "Direct link to Guides") ---------------------------------------------------------------------------------------------------- ![Limit Order Interface](https://docs.pendle.finance/assets/images/limit_order-46c6e4d902946d0d3470de86e260bf57.png "Limit Order Interface") 1. Select your desired asset and navigate to the **Limit** tab 2. Input the amount to set aside for limit-order. (Note: for orders to remain valid, your balance should not fall below the amount set here) 3. Input your desired Implied APY and Order Expiry (Note: Order will not execute after the order expiry) 4. Approve and submit your signature 5. Your order status will be shown at **My Active Orders** table at the bottom of the page ![Order Table](https://docs.pendle.finance/assets/images/order_table-b6aa53cf3514ae5b1f28a0a5f857fb14.png "Order Table") 1. To cancel your order, click on the red bin logo on the right 2. Your order fill status is shown on the table until its expiry date, where it’ll be shown in **My Order History** table. Multisig Step-by-Step Guide[​](https://docs.pendle.finance/pendle-v2/AppGuide/LimitOrder#multisig-step-by-step-guide "Direct link to Multisig Step-by-Step Guide") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- **Please make sure to keep both the placing limit order browser tab and the Safe Wallet browser tab always open throughout the placing limit order process.** 1. Click “Connect Wallet” on the top right of the Pendle App. ![Click Conncect Wallet](https://docs.pendle.finance/assets/images/1.click-connect-wallet-13fb582bf735e554abc368d19b0d94ee.png "Click Conncect Wallet") 2. Choose “WalletConnect”. ![Choose WalletConnect](https://docs.pendle.finance/assets/images/2.click-walletconnect-c8acfbd5ce69fdab42c2e62e6a6e4c7d.png "Choose WalletConnect") 3. Copy the pairing code from the pop-up. ![Copy pairing code](https://docs.pendle.finance/assets/images/3.click-copy-pairing-code-3e9a043a4dd412f4c089b0f84349256f.png "Copy pairing code") 4. On your Safe Wallet homepage, click on “Use WalletConnect”. ![Click use WalletConnect](https://docs.pendle.finance/assets/images/4.click-use-walletconnect-12de9bceda156b9adfb895cacd80d07e.png "Click use WalletConnect") 5. Paste the copied pairing code from step 3 in the pop-up form. After completing this step, your Pendle app is connected to the Safe Wallet. ![Patse pairing code to Safe Wallet app](https://docs.pendle.finance/assets/images/5.patse-pairing-code-71dac4b16ea1d61062bee133f122b6e5.png "Patse pairing code to Safe Wallet app") 6. Place the limit order. ![Place the limit order](https://docs.pendle.finance/assets/images/6.place-order-825693dd592caa53c6e9ed92b5c1b4bd.png "Place the limit order") 7. Review the order and click “Place Order”. ![Review the order](https://docs.pendle.finance/assets/images/7.review-the-order-52326448a8b5539d1be869ceac1756c4.png "Review the order") 8. After you click “Place Order” in step 7, a pop-up will appear on the Safe Wallet tab, requesting you to sign the order message and collect other signatures. Click the “Sign” button to sign the message and collect the required signatures from other signers. After you collect enough signatures, the orders will be submitted to Pendle’s Limit Order system in a couple of seconds. ![Signed message pop up](https://docs.pendle.finance/assets/images/8.signed-message-pop-up-9c74819badbc136c9cff9a81071f1e51.png "Signed message pop up") ![Sign the message](https://docs.pendle.finance/assets/images/9.sign-the-message-65ffff8c706ad1b555b7fccf7f9793fa.png "Sign the message") **Please make sure to keep both the placing limit order browser tab and the Safe Wallet browser tab always open throughout the placing limit order process.** FAQ[​](https://docs.pendle.finance/pendle-v2/AppGuide/LimitOrder#faq "Direct link to FAQ") ------------------------------------------------------------------------------------------- **Why is there a large gap between the AMM spot APY and the best bid in the orderbook, but no arbitrage is happening?** Arbitrage bot factor in fees from both the AMM and the orderbook when deciding whether to act. A trade is only profitable if the spread between the two exceeds the combined fees of both systems. For example, if the orderbook fee is 0.2% and the AMM fee is 0.15%, arbitrage will only occur when the spread exceeds 0.35%. Below that threshold, the trade would be unprofitable after fees, so no arbitrage takes place. **Why is only ~90% of my swap routed through the orderbook, even though it offers a better price?** This is by design. A small portion of every swap is always routed through the AMM as a safety buffer. Orderbook execution can occasionally result in dust amounts — tiny leftovers that are too small to process further. Without the AMM fallback, those dust amounts would either need to be returned to you (requiring an additional swap) or burned. By routing a small slice through the AMM, all funds are guaranteed to be fully utilized, since the AMM provides continuous liquidity at all times. * [Guides](https://docs.pendle.finance/pendle-v2/AppGuide/LimitOrder#guides) * [Multisig Step-by-Step Guide](https://docs.pendle.finance/pendle-v2/AppGuide/LimitOrder#multisig-step-by-step-guide) * [FAQ](https://docs.pendle.finance/pendle-v2/AppGuide/LimitOrder#faq) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Cross-Chain PT | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#__docusaurus_skipToContent_fallback) On this page PT is omnichain. You can buy PT on any supported chain using funds from any other chain, and choose which chain to hold your PT on — all in a single transaction. You do not need to hold funds or gas on the destination chain. What You Can Do[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#what-you-can-do "Direct link to What You Can Do") --------------------------------------------------------------------------------------------------------------------------------- * **Buy PT from any chain** — use funds on any supported chain to buy PT on any Pendle market, regardless of which chain the market lives on. * **Hold PT on your preferred chain** — receive and hold PT on the chain of your choice, and take advantage of Pendle ecosystem integrations available there, such as money markets and lending protocols. * **Sell PT cross-chain** — the same flexibility applies when exiting your position. * **Redeem at maturity from your Dashboard** — when your PT matures, bridge it back and redeem in one flow directly from the Dashboard, without touching the original chain. * * * How It Works[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#how-it-works "Direct link to How It Works") ------------------------------------------------------------------------------------------------------------------------ Depending on where your funds are and where you want to hold your PT, the app automatically routes through the necessary steps. The full route is displayed in the trade preview before you confirm. ### Buying PT — Funds and PT on the Same Chain[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#buying-pt--funds-and-pt-on-the-same-chain "Direct link to Buying PT — Funds and PT on the Same Chain") This is the standard flow. Your funds are swapped into PT on the chain where the Pendle market lives, and the PT stays on that chain. ![Same chain buy](https://docs.pendle.finance/assets/images/same-chain-6867943df47289580412165a698ed2e9.png) ### Buying PT — Funds on Same Chain, Receiving PT on Another Chain[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#buying-pt--funds-on-same-chain-receiving-pt-on-another-chain "Direct link to Buying PT — Funds on Same Chain, Receiving PT on Another Chain") Use this when your funds are on the same chain as the Pendle market, but you want to hold the PT on a different chain. For example: you have USDC on Ethereum and want to buy PT-wstETH, but hold the PT on HyperEVM. 1. Select your desired market and enter the amount. 2. In the **Receive PT on** selector, choose your destination chain (e.g., HyperEVM). 3. The app swaps your funds into PT on the source chain via Pendle, then bridges the PT to your chosen chain. 4. Review the route in the trade preview — it shows the Pendle swap step followed by the bridge step. 5. Approve and confirm. Your PT will arrive on the destination chain shortly after. ![Same chain buy, bridge PT out](https://docs.pendle.finance/assets/images/same-chain-bridge-out-b1b2e0c5a5921c7ad64066f6d85ce38a.png) ### Buying PT — Funds on a Different Chain from the Market[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#buying-pt--funds-on-a-different-chain-from-the-market "Direct link to Buying PT — Funds on a Different Chain from the Market") Use this when your funds are on a completely different chain from the Pendle market. For example: you hold USDC on HyperEVM and want to buy PT-wstETH, which lives on Ethereum, then hold the PT on HyperEVM. 1. Select your desired market and enter the amount. 2. In the **Receive PT on** selector, choose where you want to hold the PT. 3. The app bridges your funds to the chain where the Pendle market lives, executes the swap, then bridges the PT back to your chosen destination chain. 4. Review the full multi-step route in the trade preview. 5. Approve and confirm. ![Cross-chain buy, bridge PT](https://docs.pendle.finance/assets/images/cross-chain-bridge-out-0ee4c0c05b5788e8ac81997b958c7d98.png) * * * Selling PT Cross-Chain[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#selling-pt-cross-chain "Direct link to Selling PT Cross-Chain") ------------------------------------------------------------------------------------------------------------------------------------------------------ The same cross-chain capability applies when selling PT. If you hold PT on one chain but want to receive your funds on another, the app handles the bridging and swap automatically. The full route is shown before you confirm. * * * Redeeming at Maturity[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#redeeming-at-maturity "Direct link to Redeeming at Maturity") --------------------------------------------------------------------------------------------------------------------------------------------------- When your PT matures, you can redeem directly from the **Dashboard** — even if the PT is held on a different chain from the original Pendle market. 1. Go to your [Dashboard](https://app.pendle.finance/pro/dashboard) . 2. Find your matured PT position. 3. Click **Redeem**. If the PT is on a different chain, the app bridges it back and redeems in a single flow. * * * What Happens if a Transaction Fails[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#what-happens-if-a-transaction-fails "Direct link to What Happens if a Transaction Fails") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Cross-chain transactions involve multiple steps — a Pendle swap and one or more bridge operations. If a step fails, the outcome depends on how far the transaction progressed. ### Failure Before Funds Leave Your Wallet[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#failure-before-funds-leave-your-wallet "Direct link to Failure Before Funds Leave Your Wallet") If the transaction fails at the first step, before any funds have moved, nothing changes. Your funds remain in your wallet and you can retry when ready. ### Failure After Funds Have Left Your Wallet[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#failure-after-funds-have-left-your-wallet "Direct link to Failure After Funds Have Left Your Wallet") If a later step fails after funds have already been sent — for example, the bridge step fails after the Pendle swap succeeded — you will see two options: * **Accept and Retry** — re-attempts the failed step with updated rates. Use this if you still want to complete the transaction. * **Refund** — returns your funds to your wallet. You will receive the funds in the token at the last successfully completed step. If the bridge failed, you may receive an intermediate token on the source chain. ### When Only Refund Is Available[​](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#when-only-refund-is-available "Direct link to When Only Refund Is Available") In some cases, retrying is not possible — for example, if the PT market is no longer available or no suitable route exists. Only the **Refund** option will be shown. Your funds will be returned to your wallet. **Note:** Always review the full route and estimated fees in the trade preview before confirming any cross-chain transaction. * [What You Can Do](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#what-you-can-do) * [How It Works](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#how-it-works) * [Buying PT — Funds and PT on the Same Chain](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#buying-pt--funds-and-pt-on-the-same-chain) * [Buying PT — Funds on Same Chain, Receiving PT on Another Chain](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#buying-pt--funds-on-same-chain-receiving-pt-on-another-chain) * [Buying PT — Funds on a Different Chain from the Market](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#buying-pt--funds-on-a-different-chain-from-the-market) * [Selling PT Cross-Chain](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#selling-pt-cross-chain) * [Redeeming at Maturity](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#redeeming-at-maturity) * [What Happens if a Transaction Fails](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#what-happens-if-a-transaction-fails) * [Failure Before Funds Leave Your Wallet](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#failure-before-funds-leave-your-wallet) * [Failure After Funds Have Left Your Wallet](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#failure-after-funds-have-left-your-wallet) * [When Only Refund Is Available](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT#when-only-refund-is-available) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pool | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#__docusaurus_skipToContent_fallback) On this page Pendle's liquidity pools can be found [here](https://app.pendle.finance/pro/pools) . You can see the **Pools**, their **Maturity** date, the total **Liquidity** in the pool, and the current APY of liquidity provision. Liquidity providers receive returns from multiple avenues * Fixed rate from PT * Protocol rewards from underlying token * Swap fees * PENDLE incentives Tutorial[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#tutorial "Direct link to Tutorial") ---------------------------------------------------------------------------------------------------- Provide liquidity in our trading pools and earn yield in return. 1. Go to [Pools](https://app.pendle.finance/pro/pools) 2. Select your desired pool to LP 3. Choose your input asset to zap with 4. Enter your transaction amount 5. Control your slippage tolerance with the Gear icon in the top right 6. Approve the transaction and Zap In! Zapping In to LP[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#zapping-in-to-lp "Direct link to Zapping In to LP") ---------------------------------------------------------------------------------------------------------------------------- When liquidity is zapped in, a portion of the underlying asset is used to purchase PT from the PT/SY pool, and the rest is wrapped into SY: 1. Your assets are converted to the required assets and wrapped into SY 2. Some of the SY are minted into PT and YT 3. Minted YTs are sold into PT 4. PTs are paired with SY to provide liquidity The selling of YT in the 3rd step above can cause a price impact. But, this can be avoided by toggling **Keep YT Mode** (see below). ### Keep YT Mode[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#keep-yt-mode "Direct link to Keep YT Mode") ![Keep YT Mode](https://docs.pendle.finance/assets/images/keep_yt_mode-9055b1ab4fb1b993177d0539eda15641.png "Keep YT Mode") On Pendle, users have the option to activate **Keep YT Mode** (previously called "Zero Price Impact Mode"), which allows them to provide liquidity to the PT/SY pool without affecting the price. Normally, when liquidity is added, a portion of the underlying asset is used to purchase PT from the pool (causing price impact), and the rest is wrapped into SY. With **Keep YT Mode** enabled, the underlying asset is fully wrapped into SY, a portion of which is used to **mint PT and YT**. The PT and remaining SY are then used for liquidity provision, with the YT returned to the user's wallet. While this method prevents price impact, it results in a portion of the user's capital becoming YT, which doesn't earn LP yield. YT value goes to 0 at maturity but entitles holders to the underlying yield or points. This approach offers a trade-off between **avoiding price impact in the initial zap** in and having a **separate YT component** with different earning potential. Keep YT Mode is automatically enabled by default for pools with low liquidity (below approximately $100,000) to protect new LPs. ### Seeding Initial Liquidity[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#seeding-initial-liquidity "Direct link to Seeding Initial Liquidity") When seeding a new pool with initial liquidity, it is **mandatory** to enable Keep YT Mode. Without sufficient initial liquidity, early LPs and users who zap in will suffer excessive price impact. **Recommended seeding amounts:** | Scenario | Minimum Amount | | --- | --- | | Standard pool | **$150,000** (for < 1% price impact on subsequent zaps) | | Workable minimum | **50,000–50,000 – 50,000–100,000** | | Major networks (Ethereum) | **$500,000+** (especially if large migration from an older pool is expected) | **Best practice:** Deposit a smaller amount first (e.g., $100K), verify that the pool's Implied APY is at the desired level, then proceed with the larger remaining amount to minimize immediate impermanent loss. ### Adding & Removing Liquidity Best Practices[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#adding--removing-liquidity-best-practices "Direct link to Adding & Removing Liquidity Best Practices") * **Adding liquidity**: Enable Keep YT Mode when adding to any pool to avoid price impact. For large deposits, use Keep YT Mode and place a limit order to sell the retained YT over time. * **Removing liquidity**: It is strongly recommended to **manually remove liquidity** to the pool's base assets (SY and PT) rather than using "Zap Out" to a single token, which can cause unnecessary price impact. * **Gas optimization**: Choose SY as one of the output tokens instead of the final underlying asset. This returns SY and PT directly, and you can handle the final redemption separately. * **Protocol Owned Liquidity (POL)**: There are no conditions or lockups on POL provided to Pendle pools. The protocol that provided liquidity is free to withdraw at any time. Transfer Liquidity[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#transfer-liquidity "Direct link to Transfer Liquidity") ---------------------------------------------------------------------------------------------------------------------------------- ![Transfer Liqudiity](https://docs.pendle.finance/assets/images/transfer-liquidity-906ef196171a448f6fe036a8f39366b7.png "Transfer Liquidity") Pendle allows users to directly transfer liquidity from one LP pool to another in a single transaction. This feature simplifies the process of exiting and entering different liquidity pools, ensuring optimal transitions and minimizing complexities. Redeem Rewards Bundle[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#redeem-rewards-bundle "Direct link to Redeem Rewards Bundle") ------------------------------------------------------------------------------------------------------------------------------------------- ![Redeem Rewards Bundle](https://docs.pendle.finance/assets/images/redeem-rewards-bundle-7ff2bdea2e6f7ab4c29215638de15ae4.png "Redeem Rewards Bundle") By toggling “Claim All Pool Rewards” on the Zap Out page, Pendle App users can save on gas by claiming rewards AND removing liquidity/zapping out at the same time - in just one single transaction. ### Key Features[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#key-features "Direct link to Key Features") 1. Seamless LP Pool Transfers Swap LP tokens from one pool to another effortlessly with automated processes. 2. Optimal Path Optimization Pendle calculates the most efficient route, maximizing returns and minimizing price impact. 3. Flexible Transfer Options * LP Only: Transfers only your LP tokens. * All Positions: Includes LP, PT, and YT positions. Pendle handles the redemption of dual liquidity and the combination of PT and YT for you. 4. Target Pool information display You can check out Pool and APY information of the target Pool at the **Target Pool Info** segment at the top right part of the page ### How to use[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#how-to-use "Direct link to How to use") 1. Navigate to the Transfer Liquidity Page Access the feature from the Transfer Liquidity tab in the Pools Action page of an asset 2. Select Your Transfer Mode Choose between LP Only and All Positions based on your needs. * LP Only: Transfers only LP tokens. * All Positions: Transfers all positions (LP, PT, YT). 3. Choose your Params Enable Keep YT Mode to avoid any price impact but you will receive some YT as a result. Or disable the mode to purely receive LP tokens but at the risk of some price impact from swapping. Refer to the docs for Keep YT mode above. 4. Approve and Execute Approve the transaction and let Pendle handle the rest. The system will automatically execute the optimal path for your transfer. LP as collateral[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#lp-as-collateral "Direct link to LP as collateral") ---------------------------------------------------------------------------------------------------------------------------- Some money markets support LPs as collateral to borrow other assets. For LP to be used as collateral, it will first need to be wrapped. ![Wrap LP](https://docs.pendle.finance/assets/images/wrap-lp-8f80922e00ca004613f961f83cd8bf67.png "Wrap LP") ### How to wrap LP[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#how-to-wrap-lp "Direct link to How to wrap LP") 1. Navigate to Pool which LP you want to wrap 2. Click on LP Wrapper Click on tools tab to see **LP Wrapper** as one of the dropdown options. Click on it to open LP Wrapper form 3. Input Amount Input amount of LP you want to wrap. Wrapping is 1 to 1 with no slippage or price impact and no fee. 4. Form is still accessible after market has matured ### What happens when you wrap LP[​](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#what-happens-when-you-wrap-lp "Direct link to What happens when you wrap LP") LP needs to be wrapped to ensure Pendle rewards are still properly distributed when LPs are being used as collateral. Wrapped LPs have the following properties: * Wrapped LP rewards are claimable on dashboard in Merkle Rewards Tab every few weeks. * Wrapped LPs are not trackable on the dashboard * [Tutorial](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#tutorial) * [Zapping In to LP](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#zapping-in-to-lp) * [Keep YT Mode](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#keep-yt-mode) * [Seeding Initial Liquidity](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#seeding-initial-liquidity) * [Adding & Removing Liquidity Best Practices](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#adding--removing-liquidity-best-practices) * [Transfer Liquidity](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#transfer-liquidity) * [Redeem Rewards Bundle](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#redeem-rewards-bundle) * [Key Features](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#key-features) * [How to use](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#how-to-use) * [LP as collateral](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#lp-as-collateral) * [How to wrap LP](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#how-to-wrap-lp) * [What happens when you wrap LP](https://docs.pendle.finance/pendle-v2/AppGuide/Pool#what-happens-when-you-wrap-lp) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Using Pendle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#__docusaurus_skipToContent_fallback) On this page Pendle App gives users access to the full suite of Pendle’s functionality, allowing you to freely trade yield and execute any yield strategies. Users can deposit yield-generating assets into Pendle and mint Principal Tokens (**PT**) and Yield Tokens (**YT**). PT represents the principal of the underlying yield-bearing token, while YT represents entitlement to **all** the yield of the asset. You can trade both PT and YT on Pendle. ![Yield splitting](https://docs.pendle.finance/assets/images/yield_splitting-08d5c6f74bd2188293e466b11183e781.png "Yield splitting") In TradFi, what Pendle does is similar to bond stripping. The principal and interest of bonds are separated, so PTs are equivalent to [zero-coupon bonds](https://www.investopedia.com/terms/z/zero-couponbond.asp) , while YTs are the detached [coupons](https://www.investopedia.com/terms/c/coupon.asp) . Strategies[​](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#strategies "Direct link to Strategies") ----------------------------------------------------------------------------------------------------------------- ### Buying PT[​](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#buying-pt "Direct link to Buying PT") If you believe that the yield of the asset will fall, you would want to **hedge your yield**. You can achieve this by buying PT. Since you are guaranteed the underlying asset after maturity, you are effectively locking your APY at the current Implied Yield when you buy PT. Another way to look at it is that you are **fixing your yield** at the current Implied Yield. For example, if you buy PT-aUSDC with a maturity period of 1 year at 5% implied yield, it means that for every USDC you spend on PT, you will get back 1.05 USDC upon maturity and redemption. ### Buying YT[​](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#buying-yt "Direct link to Buying YT") On the other hand, if you believe that the yield of the asset will rise, you would want to **bet on your yield**. By buying YT, you are increasing your exposure to the yield of an asset by only buying the yield component, and your returns will be determined by the fluctuations in the underlying APY. Furthermore, buying YT is much more capital efficient than buying the underlying asset, meaning that for the same amount of capital, you can purchase a much larger quantity of YT, therefore **compounding your exposure** to yield. For example, if the price of YT is 5% the price of the underlying asset, any increase in underlying yield will result in a 20x increase in your returns, since you are able to purchase 20x units of YT. ### Liquidity Provision[​](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#liquidity-provision "Direct link to Liquidity Provision") If you believe that the yield of an asset will be unlikely to fluctuate significantly, you can simply provide liquidity in our pools to earn some extra yield from swap fees and incentives. There is no IL risk from fluctuations in the price of the underlying asset that most other yield protocols have, as the price of PT and YT are linked to the price of the underlying asset, in that PT + YT = underlying. The only IL risk comes from fluctuations in the demand for PT and YT, which are inherent in all liquidity pools. IL is capped and minimized if liquidity is provided to maturity. This is possible as both assets provided have the exact same value at maturity. This way, liquidity provision can also act as a hedge for any of your PT or YT positions. * [Strategies](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#strategies) * [Buying PT](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#buying-pt) * [Buying YT](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#buying-yt) * [Liquidity Provision](https://docs.pendle.finance/pendle-v2/AppGuide/UsingPendle#liquidity-provision) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Glossary | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#__docusaurus_skipToContent_fallback) On this page #### Yield-Bearing Token[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#yield-bearing-token "Direct link to Yield-Bearing Token") Yield-bearing Token is an umbrella term that refers to any token that generates yield. Examples include stETH, GLP, gDAI or even liquidity tokens such as Aura rETH-WETH. #### Accounting Asset[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#accounting-asset "Direct link to Accounting Asset") The asset yield bearing token appreciates in value against. It appears in brackets at the end of each market name. #### SY = Standardized Yield[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#sy--standardized-yield "Direct link to SY = Standardized Yield") SY is a token standard written by the Pendle team that wraps any yield-bearing token and provides a standardized interface for interacting with any yield-bearing token’s yield generating mechanism. SY is a purely technical component, the user does not interact directly with SY. #### PT = Principal Token[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#pt--principal-token "Direct link to PT = Principal Token") PT entitles you to the principal of the underlying yield-bearing token, redeemable after maturity. If you own 1 PT-wstETH (stETH) with 1 year maturity, you will be able to redeem 1 stETH after 1 year. PT is tradeable anytime, even before maturity. #### YT = Yield Token[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#yt--yield-token "Direct link to YT = Yield Token") YT entitles you to all the yield generated by the underlying yield-bearing token in real-time, and the yield accrued can be manually claimed _at any time_ from the Pendle Dashboard. If you own 1 YT-wstETH (stETH) and stETH has an average yield of 5% through the year, you will have accrued 0.05 stETH by the end of the year. YT is tradeable anytime, even before maturity. #### Maturity[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#maturity "Direct link to Maturity") Maturity is the date at which PT becomes fully redeemable for the underlying asset and YT stops accruing yield. One asset can have multiple maturity dates, with an independent market for each maturity date. As such, the implied yield of an asset can also differ across different maturities. #### Underlying APY[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#underlying-apy "Direct link to Underlying APY") Underlying APY represents the 7-day moving average yield rate of the underlying asset. This approach allows a more accurate indication of the underlying yield over a period of time, which can help traders to better estimate the Future Average Underlying APY. #### Implied APY[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#implied-apy "Direct link to Implied APY") Implied APY is the market consensus of the future APY of an asset. This value is calculated based on the ratio of the price of YT to PT and the formula is shown below. When used in conjunction with the Underlying APY, Implied APY can be used to establish the relative valuation of an asset such as YT and PT at their current price, and help traders determine their trading strategies. The value of Implied Yield is numerically equivalent to the to Fixed Yield APY. Implied APY\=\[(1+YT PricePT Price)365Days to expiry\]−1\\text{Implied APY} = \\left\[\\left(1 + \\frac{\\text{YT Price}}{\\text{PT Price}}\\right)^{\\frac{365}{\\text{Days to expiry}}}\\right\] - 1Implied APY\=\[(1+PT PriceYT Price​)Days to expiry365​\]−1 #### Fixed APY[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#fixed-apy "Direct link to Fixed APY") Fixed APY is the guaranteed yield you will receive by holding PT. This value is numerically equivalent to the Implied APY. #### Long Yield APY[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#long-yield-apy "Direct link to Long Yield APY") Long Yield APY is the approximated return (annualized) from buying YT at the current price, assuming underlying APY remains constant at its current value. This value can be negative, meaning that the total value of all the future yield based on the Underlying APY will be less than the cost of buying YT. #### Exchange Rate[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#exchange-rate "Direct link to Exchange Rate") Refers to the exchange rate between the interest-bearing token and its accounting asset #### LP = Liquidity Provider Token[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#lp--liquidity-provider-token "Direct link to LP = Liquidity Provider Token") LP tokens represent a user's share of a Pendle liquidity pool, which is composed of PT and SY. LPs earn returns from multiple sources simultaneously: swap fees, PENDLE incentives, underlying yield from the SY portion, and an implicit fixed yield from the PT portion. #### LP Wrapper[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#lp-wrapper "Direct link to LP Wrapper") An ERC-20 token that wraps the underlying LP position on a 1:1 basis, enabling LP tokens to be used as collateral in external money markets while still accruing PENDLE rewards and off-chain points. The wrapper ensures that the original depositor continues to receive all associated rewards. #### Watermark Rate[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#watermark-rate "Direct link to Watermark Rate") The highest recorded exchange rate between the IBT and its accounting asset. When the exchange rate falls below this level, PT will redeem below its actual value at maturity, and YT will stop earning yield. Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Chapter 3.2 - More Yield via Liquidity Provision | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#__docusaurus_skipToContent_fallback) On this page Liquidity Provision on Pendle[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#liquidity-provision-on-pendle "Direct link to Liquidity Provision on Pendle") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Similar to many other DeFi protocols, you can also deposit your asset to provide liquidity to Pendle pools. Pendle pools facilitate all other yield strategies discussed in this Academy. 💡 Liquidity provision on Pendle has no impermanent loss risk at maturity. #### Earn extra yields on top of your otherwise idle yield-bearing assets[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#earn-extra-yields-on-top-of-your-otherwise-idle-yield-bearing-assets "Direct link to Earn extra yields on top of your otherwise idle yield-bearing assets") Liquidity providers receive returns from multiple avenues: * Native yields * Protocol yields/rewards from the underlying asset (e.g. yield from stETH, or ETH rewards distributed from GMX’s GLP) * Fixed yield from the PT component of the pool * Swap fees * $PENDLE incentives ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(3).png) **Obtain vePENDLE to boost rewards further** On top of all these rewards, vePENDLE holders can also boost their Liquidity Provision APY up to 2.5X! Click [here](https://docs.pendle.finance/ProtocolMechanics/Mechanisms/vePENDLE) to learn more. ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(6).png) vePENDLE lock ### Why provide liquidity to Pendle pools?[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#why-provide-liquidity-to-pendle-pools "Direct link to Why provide liquidity to Pendle pools?") 1. You **earn extra “free” yields**, including swap fees and $PENDLE incentives, on top of your otherwise idle asset 2. No impermanent loss (IL) at maturity. Pendle pools are denominated in your selected underlying asset _only_ (e.g. consists of the native stETH plus PT-stETH only in the stETH pools), which results in a single asset price exposure. 3. You are _**not**_ locked and can exit at any time. ### How to start earning[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#how-to-start-earning "Direct link to How to start earning") Providing liquidity on Pendle can be as simple as just a one-click transaction, allowing you to swap any assets you hold (e.g. USDC) into Pendle LP positions (e.g. Pendle LP-stETH). Similarly, you can even use other Pendle assets like [PT or YT](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics) to deposit into a Pendle LP. 1. Go to the **Pools** page: [https://app.pendle.finance/trade/pools](https://app.pendle.finance/trade/pools) . 2. Deposit and start earning 1. Select an asset pool and a maturity date to provide liquidity to. You can also sort the list by the “Highest APY”. 2. Select your input asset and amount (which will be swapped to the pool’s asset, if necessary). This can be a different token to the underlying asset and we will find the best route to swap your asset. 3. Review output, approve and confirm the transaction. 3. If you have an open position: 1. Click “Dashboard” on the top menu to see your current LP positions. 2. You can return to the “Claim” button in “Dashboard” to claim your LP rewards (note that not all rewards are claimable, see FAQ). ![](https://docs.pendle.finance/pendle-academy/imgs/image%20(8).png) 4. Lock PENDLE for vePENDLE to boost LP incentives (optional). Buy $PENDLE and click “vePENDLE” on the top menu and click the “Lock PENDLE” button, or go to [this page](https://app.pendle.finance/vependle/lock/update) . Learn more [here](https://docs.pendle.finance/Governance/vePENDLE) . **Am I locked until the maturity date? Can I exit early?** > You are _not_ locked at all, you can remove LP and exit at any time. **Do I have to hold until the maturity date to earn the advertised APY?** > No, the APY you earn from liquidity provision is independent of the maturity date. The PENDLE or native rewards are streamed to LPs all the time, exiting the pool before its maturity date does not change the amount of rewards streamed to you. **What tokens am I really exposed to in the LP pool?** > We will explain in more detail in[chapter-7-providing-liquidity-while-trading-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield "mention") > . In a nutshell, a Pendle pool consists of 2 components: (1) (a wrapped version of) the underlying asset, and (2) the PT version of it (usually in a smaller proportion). You can review the concept of PT in [chapter-2-yield-tokenization-basics.md](https://docs.pendle.finance/pendle-academy/pendle-101/chapter-2-yield-tokenization-basics "mention") > . **How is there no impermanent-loss (IL) at maturity?** > The main idea is that a Pendle pool only contains tokens that are highly correlated and denominated in the same asset you choose, so the price ratio between them does not change much. This means that IL is minimal and **guaranteed to be zero or none at maturity**. **How to claim LP rewards?** > You can claim your LP rewards by clicking the “Claim” button within “Dashboard” on the top menu. **Why don’t I see the underlying yield being claimable sometimes?** > Some assets, like stETH, wstETH, rETH, and gDAI, do not distribute yields explicitly, but rather increase their token value over time. Their yields are baked into their rising token price. Pendle pool swap fees also increase the pool value and do not need to be claimed. > > On the other hand, some assets, like GLP and Stargate-USDT, distribute yields to holders periodically. You will need to claim these yields manually. > > $PENDLE incentives are always claimable using the “Claim” button. **What is the “Zero Price Impact Mode” in the “Zap” interface in “Pendle Trade”?** > Please check out [#2-how-to-be-yield-neutral-with-zero-price-impact-mode](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield#2-how-to-be-yield-neutral-with-zero-price-impact-mode "mention") ### LP as part of your yield-trading strategy[​](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#lp-as-part-of-your-yield-trading-strategy "Direct link to LP as part of your yield-trading strategy") Providing liquidity can also be part of your yield optimization or trading strategies because an LP position has a slightly bearish outlook on the underlying asset yield. This will be discussed in depth in [chapter-7-providing-liquidity-while-trading-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield "mention") * [Liquidity Provision on Pendle](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#liquidity-provision-on-pendle) * [Why provide liquidity to Pendle pools?](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#why-provide-liquidity-to-pendle-pools) * [How to start earning](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#how-to-start-earning) * [LP as part of your yield-trading strategy](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-3.2-more-yield-via-liquidity-provision#lp-as-part-of-your-yield-trading-strategy) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # RouterStatic | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Backend/RouterStatic#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/RouterStatic#overview "Direct link to Overview") ---------------------------------------------------------------------------------------------------------------------- info Please note that this RouterStatic should not be used for fund-sensitive/on-chain transactions. If you or your team needs to use any functions on-chain, please let us know. This docs assume you have read Pendle's [High Level Architecture](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture) . The RouterStatic addresses across the different chains can be found under Deployments on the navigation sidebar on the left. RouterStatic is a contract designed for off-chain computations. It's a multi-facet proxy (ERC2535), so the easiest way to use it is by using the ABI of `contracts/interfaces/IPRouterStatic.sol`. The Router will resolve the call accordingly when any function is called. Most functions are straightforward to use. Below, we discuss some less straightforward functions: function getLpToSyRate(address market) external view returns (uint256);function getPtToSyRate(address market) external view returns (uint256);function getLpToAssetRate(address market) external view returns (uint256);function getPtToAssetRate(address market) external view returns (uint256); * `getLpToSyRate`: Retrieves the **spot** price of LP in terms of its corresponding SY. * `getLpToAssetRate`: Serves the same purpose, but in terms of SY's asset. Let's consider the following example: ![RouterStatic Example](https://docs.pendle.finance/assets/images/routerstatic_example-d7f75c33ef04de2866127991b43bedbe.png "RouterStatic Example") The total value of LP is 4.90M USD, and the total supply of LP is 1,373.11. ⇒ The price of one LP is 3568 USD. By calling **`getLpToSyRate`**, we receive `1817546249542325054`, which is 1.817 SY-wstETH == 1.817 wstETH. At this time, the price of one token is 1,966 USD, so one LP is roughly 3572 USD. By calling **`getLpToAssetRate`**, we receive `2049787610667181659`, which is 2.049 stETH == one LP is roughly 3567 USD. * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Backend/RouterStatic#overview) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Understanding Negative Yield Risk on Interest-Bearing Tokens (IBT) | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/NegativeYield#__docusaurus_skipToContent_fallback) On this page Interest-bearing tokens (IBTs) typically increase in value over time as they accrue rewards and yield. This leads to a rising [exchange rate](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#exchange-rate) between the IBT and its accounting asset. For example, 1 sUSDe (IBT) can be exchanged for more USDe over time. However, in scenarios where yield turns negative, the IBT’s value may decline instead. This can impact both PT and YT performance, especially if the exchange rate falls. What is the Watermark Rate?[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/NegativeYield#what-is-the-watermark-rate "Direct link to What is the Watermark Rate?") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ The [Watermark Rate](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Glossary#watermark-rate) is the highest recorded exchange rate between the IBT and its accounting asset. In prolonged periods of negative yield, the Exchange Rate may fall below this level. When this happens: * **PT** will redeem below its actual value at maturity, leading to potential losses. For example, 1 PT-RLP (USDC) is expected to be redeemed for 1 USDC at maturity in normal conditions. However, when the Exchange Rate falls below the Watermark Rate, PT-RLP will redeem for less than 1 USDC at maturity. * **YT** will stop earning yield until the Exchange Rate recovers to the Watermark Rate ![Watermark Chart](https://docs.pendle.finance/assets/images/watermark_chart-ce7b65ddd216e91c48f22388a7c63b48.png "Watermark Chart") You can track the Watermark Rate and current Exchange Rate by switching to the **Watermark Rate** view on any asset’s market page. The Watermark Rate can become artificially elevated due to factors such as oracle mispricing or temporary spikes in the IBT’s share price. When this occurs, a new inflated Watermark Rate is recorded and remains in effect even after the Exchange Rate normalizes to reflect the asset’s true value. During this period, the pool may appear to be generating negative yield until the Exchange Rate catches up with the inflated Watermark Rate. * [What is the Watermark Rate?](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/NegativeYield#what-is-the-watermark-rate) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Order Book | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#__docusaurus_skipToContent_fallback) On this page Pendle features an Order Book system alongside its AMM to enable peer-to-peer trading of PT and YT. Users can place limit orders to buy or sell at a specified implied APY. Together, the Order Book and AMM enhance market liquidity, facilitating smoother trading on Pendle. Pendle's swap router intelligently sources liquidity from **both** the AMM pool and the limit order book simultaneously, automatically calculating the optimal path for any given trade to minimize price impact and gas costs for the user. ![Order Book](https://docs.pendle.finance/assets/images/order_book-abec17db6b23dd6552d333c1e00a5fe3.png "Order Book") What is Limit Order[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#what-is-limit-order "Direct link to What is Limit Order") -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit order on Pendle is a purchase / sell order at a specified implied APY. You can set limit orders on PT and YT of supported assets on any chain. Most popular market on Pendle has limit order support. Order Execution[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#order-execution "Direct link to Order Execution") -------------------------------------------------------------------------------------------------------------------------------------------------------- A limit order will be executed if the implied APY of the AMM moves towards the order APY. At that moment, any further swaps (taker order) in said implied APY direction will fill the order book first, before proceeding to the AMM. In other words, a limit order deepens liquidity of the AMM at that specific implied APY as swaps will fill the order first before pushing the AMM’s implied APY again. Swaps can be partially allocated to the AMM and limit orders (if any) to optimize for price-impact. That amount is determined at the most optimal amount, taking the AMM price impact and gas fees into account. Consequently, smaller orders face a lower likelihood of being filled due to the increased number of transactions required, leading to higher gas fees, particularly on chains with costly gas fees. Orders can be: * Active (Partially or fully fillable) * Executed (Order is fully filled) * Expired (Order is not fully filled by its expiry date) * Cancelled * Invalid [Flash swap](https://docs.pendle.finance/ProtocolMechanics/AMM#flash-swaps) capability between PT and YT enhances the Order Book's flexibility by allowing a buy YT taker order to be matched with a buy PT limit order, and vice versa—a sell YT taker order can be matched with a sell PT limit order. This capability significantly broadens potential trading matches, streamlining transactions between PT and YT. Order Validity[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#order-validity "Direct link to Order Validity") ----------------------------------------------------------------------------------------------------------------------------------------------------- Only the underlying yield-bearing asset can be used to place a limit order. Partially Fillable order will be highlighted in a yellow warning. Orders will only be partially fillable when: 1. The balance of asset in your wallet falls below the order amount but not 0 2. The allowance set from your address is less than the order amount but not 0 Invalid orders will be highlighted in a red warning. Limit orders will be invalid when: 1. The balance of asset in your wallet falls to 0 2. The allowance set from your address is 0 Setting a limit order requires signature from your address while revoking the order involves a transaction to revoke the signature. Fees[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#fees "Direct link to Fees") ----------------------------------------------------------------------------------------------------------------------- Fees for swaps on limit order will be the same as if they were done on the AMM. The **taker** of the order pays both the gas fee and the swap fee. The **maker** of the order does not incur these costs (maker order fee is currently set to 0). The team has full discretion on when to scale-up fees for maker orders. Fees collected are distributed in accordance with the protocol's [fee structure](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Fees) . Arbitrage[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#arbitrage "Direct link to Arbitrage") -------------------------------------------------------------------------------------------------------------------------------------- Pendle operates an arbitrage bot that continuously aligns prices between the AMM and the Order Book. This ensures any price discrepancies due to liquidity differences are quickly corrected, maintaining consistent pricing across the two system. * [What is Limit Order](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#what-is-limit-order) * [Order Execution](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#order-execution) * [Order Validity](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#order-validity) * [Fees](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#fees) * [Arbitrage](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/OrderBook#arbitrage) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Deployments | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Deployments#__docusaurus_skipToContent_fallback) On this page info While interacting with contracts, please use the ABI of implementation contracts from a block explorer or generate the ABI from the smart contract code in GitHub. Core Contracts[​](https://docs.pendle.finance/pendle-v2/Developers/Deployments#core-contracts "Direct link to Core Contracts") ------------------------------------------------------------------------------------------------------------------------------- Pendle's core contract addresses are organized by chain ID. You can find the latest contract addresses in the deployment files within the [Pendle contract repository](https://github.com/pendle-finance/pendle-core-v2-public) . Each chain's deployment file follows the naming pattern: `/deployments/{chainId}-core.json` ### Supported Chains[​](https://docs.pendle.finance/pendle-v2/Developers/Deployments#supported-chains "Direct link to Supported Chains") | Chain | Chain ID | Deployment File | | --- | --- | --- | | Ethereum | 1 | [`1-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/1-core.json) | | Optimism | 10 | [`10-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/10-core.json) | | BNB Chain | 56 | [`56-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/56-core.json) | | Sonic | 146 | [`146-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/146-core.json) | | HyperEVM | 999 | [`999-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/999-core.json) | | Mantle | 5000 | [`5000-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/5000-core.json) | | Base | 8453 | [`8453-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/8453-core.json) | | Arbitrum | 42161 | [`42161-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/42161-core.json) | | Berachain | 80094 | [`80094-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/80094-core.json) | | Monad | 143 | [`143-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/143-core.json) | | Katana | 747474 | [`747474-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/747474-core.json) | | Ink | 57073 | [`57073-core.json`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/deployments/57073-core.json) | To access deployment information for any chain, simply reference the deployment file corresponding to its chain ID in the repository. SY / Market / PT / YT Addresses[​](https://docs.pendle.finance/pendle-v2/Developers/Deployments#sy--market--pt--yt-addresses "Direct link to SY / Market / PT / YT Addresses") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- To find the relevant addresses and details of a specific market: 1. Go to the [Pendle markets page](https://app.pendle.finance/trade/markets) 2. Select the desired chain and click into an asset 3. Click into the button as shown in the image below to view all contract addresses ![Market Info](https://docs.pendle.finance/assets/images/market_info-2469d2ce7f86f9b271806c5fb77b73c0.png "Market Info") Additional Resources[​](https://docs.pendle.finance/pendle-v2/Developers/Deployments#additional-resources "Direct link to Additional Resources") ------------------------------------------------------------------------------------------------------------------------------------------------- * [Core Contract Repository](https://github.com/pendle-finance/pendle-core-v2-public) * [SY Contract Repository](https://github.com/pendle-finance/Pendle-SY-Public) * All deployed Markets: [Pendle App](https://app.pendle.finance/trade/markets) * [Core Contracts](https://docs.pendle.finance/pendle-v2/Developers/Deployments#core-contracts) * [Supported Chains](https://docs.pendle.finance/pendle-v2/Developers/Deployments#supported-chains) * [SY / Market / PT / YT Addresses](https://docs.pendle.finance/pendle-v2/Developers/Deployments#sy--market--pt--yt-addresses) * [Additional Resources](https://docs.pendle.finance/pendle-v2/Developers/Deployments#additional-resources) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Fees | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Fees#__docusaurus_skipToContent_fallback) On this page Pendle protocol has 2 revenue sources: * **YT Fees** Pendle collects a 5% fee from all yield accrued (including points) by all YT in existence, and all yields (including all points negotiated) from the SYs of matured unredeemed PTs. * **YT Fees on Points** Fees on points are applied similarly as Pendle treats points as a form of yield. Since points are tracked off-chain, partner protocols deduct the 5% fee when allocating points to user wallets. The deducted points from fees are then re-allocated to the following Pendle-controlled wallets: info Fee wallets for pools launched BEFORE 8th October 2024 | Chain | Fee Wallet Address | | --- | --- | | Ethereum | `0x8270400d528c34e1596EF367eeDEc99080A1b592` | | Arbitrum | `0xCbcb48e22622a3778b6F14C2f5d258Ba026b05e6` | | Mantle | `0x5C30d3578A4D07a340650a76B9Ae5dF20D5bdF55` | | BNB Chain | `0xd77E9062c6DF3F2d1CB5Bf45855fa1E7712A059e` | info Fee wallet for pools launched AFTER 8th October 2024 All chains: `0xC328dFcD2C8450e2487a91daa9B75629075b7A43` * **Swap Fees** Pendle collects a percentage-based swap fee, scaled with maturity, from all PT swaps. Each fee tier will be displayed in the dApp and is decided by the pool deployer (currently only the Pendle team deploys pools on Pendle). Pendle taxes the yield-receivables of PT when swaps occur. This creates a fair fee for all pools and maturities as it is scaled to a pool’s maturity (less time to maturity -> less yield-receivables -> lower fees in $ terms). Since YT swaps are also routed through the PT AMM, its fees are calculated based on the PT swapped. * **Fee Distribution** Pendle has 2 sources of fees **YT fees** and **Swap fees**. 20% of all swap fees are given to LP providers of the pool as yield. The remaining swap fees and all YT fees are split between PENDLE buyback fund and Pendle protocol in the following ratio * 80% for PENDLE buyback * 10% to Protocol Treasury * 10% to Protocol Operations * **Trading Fee Calculation** Trading fees are dynamically adjusted based on time remaining until maturity: `Trading Fee = (Fee Tier / 365) * Days to Maturity` The **Fee Tier** is specific to each market and can be found by clicking the "specs" button on the market's trading interface. Redeeming PT for the underlying asset _after_ maturity incurs no protocol fee, only standard network gas fees. * **Post-Maturity Yield Redirection** If a user does not redeem their PT or LP position after maturity, the underlying asset remains in the SY contract and **continues to accrue yield and points**. However, all yield and points generated by these unredeemed, matured positions are automatically redirected to the **Pendle treasury fee wallet**. This incentivizes users to promptly redeem their matured assets and roll them over into new pools. Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Minting | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/Minting#__docusaurus_skipToContent_fallback) On this page Users receive yield-bearing assets when they deposit funds into a yield-source. For example, DAI staked in Compound is represented as _cDAI_. ETH staked in Lido is represented as _stETH_. _cDAI_ and _stETH_ are examples of **yield-bearing assets**. In Pendle, yield-bearing assets are split into two components: Principal Tokens (**PT**) and Yield Tokens (**YT**). PT represents the principal of the underlying yield-bearing token, while YT represents entitlement to all the yield of the asset. YT and PT can be traded on Pendle. ![Yield Splitting](https://docs.pendle.finance/assets/images/yield-splitting-33e596f1053eb103d2ee60884c2351d1.png "Yield Splitting") What Pendle does is similar to bond stripping in traditional finance, where the principal and interest of bonds are separated. In this, PTs are equivalent to [zero-coupon bonds](https://www.investopedia.com/terms/z/zero-couponbond.asp) , while YTs are the detached [coupon](https://www.investopedia.com/terms/c/coupon.asp) payments. Users can mint PT and YT by depositing the yield-bearing asset (e.g. stETH) into Pendle. Base assets (e.g. ETH) will be auto-converted into the yield-bearing asset before PT and YT are minted. e.g. ETH → stETH → SY-stETH → PT-stETH + YT-stETH. This function can be found in the Pendle App after selecting one of the assets. ![Yield Splitting UI](https://docs.pendle.finance/assets/images/yield-splitting-ui-eb1dcc8e5daa43bf4d34b66ea37d7e9c.png "Yield Splitting UI") Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # AMM | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#__docusaurus_skipToContent_fallback) On this page Pendle’s V2 AMM is designed specifically for trading yield, and takes advantage of the behaviors of PT and YT. Unlike standard AMMs that concentrate liquidity within a **price range**, Pendle’s AMM concentrates liquidity within a pre-configured **yield range** (or Implied APY range). This makes trading within the expected yield boundaries highly efficient, with lower slippage for larger trades. The AMM model was adapted from Notional Finance’s AMM. The AMM curve changes to account for yield accrued over time and narrows PT’s price range as it approaches maturity (**dynamic curve tightening**). By concentrating liquidity into a narrow, meaningful range, the capital efficiency to trade yield is increased as PT approaches maturity. This automatic tightening reflects the decreasing uncertainty of future yield and is a key factor in minimizing impermanent loss. Furthermore, we managed to create a pseudo-AMM that allows us to both facilitate PT and YT swaps using just a single pool of liquidity. With a PT/SY pool, PT can be directly traded with SY, while YT trades are also possible via flash swaps. ### Fee Calculation[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#fee-calculation "Direct link to Fee Calculation") Unlike traditional AMMs that charge fees on the swap principal, Pendle’s AMM fee is calculated relative to the **yield** being traded. This means the fee is influenced by the time to maturity — a trade made one year before maturity will incur a significantly higher fee than the same size trade made one month before maturity. See [Fees](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Fees) for the full formula. Liquidity Providers (LP)[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#liquidity-providers-lp "Direct link to Liquidity Providers (LP)") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Liquidity on Pendle V2 comprises of PT/SY (where SY is simply a wrapped version of the underlying yield bearing asset). This means that LPs earn yields from: 1. PT fixed yield 2. Underlying yield (SY yield) 3. Swap fees (from PT and YT swaps) 4. $PENDLE incentives Swaps[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#swaps "Direct link to Swaps") -------------------------------------------------------------------------------------------------------------------- Both PT and YT are tradeable anytime on Pendle through a single pool of liquidity. This is made possible by implementing a pseudo-AMM with flash swaps. Liquidity pools in Pendle V2 are set up as PT/SY, e.g. PT-aUSDC / SY-aUSDC. Swapping PT is a straightforward process of swapping between the 2 assets in the pool, while swapping YT is enabled via flash swaps in the same pool. > Auto-routing is built in, allowing anyone to trade PTs and YTs with any major asset. ### Flash Swaps[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#flash-swaps "Direct link to Flash Swaps") Flash swaps are possible due to the relationship between PT and YT. As PT and YT can be minted from and redeemed to its underlying SY, we can express the price relationship: P(PT)+P(YT)\=P(Underlying)P(PT) + P(YT) = P(\\text{Underlying})P(PT)+P(YT)\=P(Underlying) Knowing that YT price has an inverted correlation against PT price, we use this price relationship to utilise the PT/SY pool for YT swaps. Buying YT: 1. Buyer sends SY into the swap contract (auto-routed from any major token) 2. Contract withdraws more SY from the pool 3. Mint PTs and YTs from all of the SY 4. Send the YTs to the buyer 5. The PTs are sold for SY to return the amount from step 2 ![Buying YT](https://docs.pendle.finance/assets/images/buying_yt-22c5d12e0c609c2787ae0708639c26f3.png "Buying YT") Selling YT: 1. Seller sends YT into the swap contract 2. Contract borrows an equivalent amount of PT from the pool 3. The YTs and PTs are used to redeem SY 4. SY is sent to the seller (or routed to any major tokens, e.g. ETH, USDC, wBTC, etc) 5. A portion of the SY is sold to the pool for PT to return the amount from step 2 ![Selling YT](https://docs.pendle.finance/assets/images/selling_yt-8da5dd7f451f1fa22685572bfb631c97.png "Selling YT") Matured LP[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#matured-lp "Direct link to Matured LP") ----------------------------------------------------------------------------------------------------------------------------------- Upon maturity, LPs are able to Zap Out + Redeem PT for Underlying + Claim Rewards in a single transaction: 1. Visit [Pendle Trade](https://app.pendle.finance/trade/pools) and toggle to the “Inactive” pool list 2. Select a pool 3. Toggle “Claim All Pool Rewards” 4. Select an output asset. Pendle will automatically Redeem PT for Underlying > Unwrap SY > Perform Swaps (if needed) here Key Features[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#key-features "Direct link to Key Features") ----------------------------------------------------------------------------------------------------------------------------------------- ### Minimal Impermanent Loss (IL)[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#minimal-impermanent-loss-il "Direct link to Minimal Impermanent Loss (IL)") Pendle V2 design ensures that IL is a negligible concern. Pendle’s AMM accounts for PT’s natural price appreciation by shifting the AMM curve to push PT price towards its underlying value as time passes, mitigating time-dependent IL (No IL at maturity). On top of that, IL from swaps is also mitigated as both assets LP’ed are very highly correlated against one another (e.g. PT-stETH / SY-stETH). If liquidity is provided until maturity, an LP’s position will be equivalent to fully holding the underlying asset since PT essentially appreciates towards the underlying asset. In most cases prior to maturity, PT trades within a yield range and does not fluctuate as much as an asset’s spot price. For example, it’s rational to assume that Aave’s USDC lending rate fluctuates between 0%-15% for a reasonable timeframe (and PT accordingly trades within that yield range). This premise ensures a low IL at any given time as PT price will not deviate too far from the time of liquidity provision. ### Customizable AMM[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#customizable-amm "Direct link to Customizable AMM") ![Customizable AMM](https://docs.pendle.finance/assets/images/customizable_amm-b4da107e9ed6c28f3c125a8a40c4ecc3.png "Customizable AMM") Pendle’s AMM curve can be customised to cater to tokens with varying yield volatilities. Yields are often cyclical in nature and typically swing between highs and lows. Typically, the floor and ceiling for the yield of a liquid asset are much easier to predict than its price. For example, the annual yield of staked ETH is likely to fluctuate in a band of 0.5-7%. Knowing the rough yield range of an asset enables us to concentrate liquidity within that range, enabling much larger trade sizes at a lower slippage. However, if the implied yield of the pool trades out of its set range, liquidity will be too thin to further push it in said direction. Using the above example, if the implied yield of the stETH pool goes beyond 7%, buying YT (or selling PT) might no longer be possible. To check the set yield range of the pool, click on the sign as shown in the screenshot below. ![Market Info](https://docs.pendle.finance/assets/images/market_info-2469d2ce7f86f9b271806c5fb77b73c0.png "Market Info") ### Greater Capital Efficiency[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#greater-capital-efficiency "Direct link to Greater Capital Efficiency") _For Liquidity Providers_ Since YT trades are routed through the same PT/SY pool, LPs earn fees from both PT and YT swaps from a single liquidity provision, doubling the yield from LPing. _For Traders_ Rather than having separate pools for YT and PT, concentrating all tokens in a PT/SY pool will result in greater liquidity. This will allow traders to make trades of greater volume without having to worry about much slippage, granting traders greater price certainty. * [Fee Calculation](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#fee-calculation) * [Liquidity Providers (LP)](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#liquidity-providers-lp) * [Swaps](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#swaps) * [Flash Swaps](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#flash-swaps) * [Matured LP](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#matured-lp) * [Key Features](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#key-features) * [Minimal Impermanent Loss (IL)](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#minimal-impermanent-loss-il) * [Customizable AMM](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#customizable-amm) * [Greater Capital Efficiency](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/LiquidityEngines/AMM#greater-capital-efficiency) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # sPENDLE | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#__docusaurus_skipToContent_fallback) On this page sPENDLE is Pendle’s native governance token that distributes protocol rewards for active participation in the ecosystem. As a staked version of PENDLE, sPENDLE aligns the interest of various stakeholders while contributing to token stability and overall robustness of the Pendle protocol. Staking and Unstaking[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#staking-and-unstaking "Direct link to Staking and Unstaking") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ PENDLE may be staked to receive sPENDLE instantly at a 1:1 ratio. sPENDLE **does not** increase in value over time. sPENDLE held in a user’s wallet is eligible for: * Voting power within the Pendle ecosystem * Pro-rata share of reward distributions if they meet the active participation criteria sPENDLE can be unstaked for PENDLE 1:1 after a 14-day withdrawal period, or immediately for a 5% fee. Active Participation & Eligibility[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#active-participation--eligibility "Direct link to Active Participation & Eligibility") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- sPENDLE holders must be active to receive rewards during a given epoch. sPENDLE holders are only considered inactive if they fail to vote during a period when a Pendle Protocol Proposal (PPP) is available. During a period without a PPP, all sPENDLE is considered active and eligible for rewards. sPENDLE deployed to eligible DeFi integrations are also considered active at all times. sPENDLE Yields[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#spendle-yields "Direct link to sPENDLE Yields") --------------------------------------------------------------------------------------------------------------------------------------------- 80% of Pendle V2 fees from **Yield** and **Swap Fees** are allocated to PENDLE token buybacks. Up to 100% of repurchased PENDLE will be distributed to active sPENDLE holders in the form of sPENDLE. Airdrops that Pendle Protocol receives as a result of fees from points-bearing assets will be distributed in kind (i.e. not used for buyback). _Buybacks for the current epoch are sourced from fees from the previous epoch are executed using a 1-hourly TWAP throughout the current epoch._ Rewards from buybacks and point are distributed every 2 weeks and may be claimed from the Pendle dApp at any time. Buyback execution[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#buyback-execution "Direct link to Buyback execution") ------------------------------------------------------------------------------------------------------------------------------------------------------ Protocol fees are harvested every 2 weeks and deposited into the buyback contract. Once funded, the contract executes PENDLE purchases over the subsequent week using a 1-hourly TWAP. Buy back contract: [0x9e08C5499f953C6297A7755BcBcEd383b606896b](https://etherscan.io/address/0x9e08C5499f953C6297A7755BcBcEd383b606896b) Accounting[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#accounting "Direct link to Accounting") --------------------------------------------------------------------------------------------------------------------------------- ### Voting Power[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#voting-power "Direct link to Voting Power") A snapshot of sPENDLE balances is taken whenever a PPP is created and determines the voting power of each user. Voting power for virtual sPENDLE balance is equal to the underlying PENDLE locked in the vePENDLE contract. sPENDLE held in whitelisted smart contracts is excluded from voting snapshots. _Example: A holder with 5% of snapshotted sPENDLE receives 5% of that proposal’s votes._ ### Reward Distribution[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#reward-distribution "Direct link to Reward Distribution") A snapshot of active sPENDLE balances is taken every 14-days. This includes virtual sPENDLE balances. Rewards are claimable via sPENDLE dashboard (merkle distribution)". _Example: A holder with 10% of total active sPENDLE receives 10% of that epoch’s rewards._ Rewards are distributed pro-rata to active sPENDLE holders. vePENDLE Loyalty Bonus ====================== ![vePENDLE bonus timeline](https://docs.pendle.finance/assets/images/vependle_bonus_timeline-bbb4e25ec3addc3d46c4f035be988603.png "vePENDLE Bonus Timeline") **January 20th** * sPENDLE staking goes live **January 29th, 00:00 UTC** * vePENDLE locks paused * Snapshot of locked balance and lock duration (for virtual sPENDLE calculation) * New PENDLE incentive structure commences (see [Algorithmic Incentive Module](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives) ) ![vePENDLE bonus decay](https://docs.pendle.finance/assets/images/vependle_bonus_decay-012c4765607e5d589a8a77aec1c16a83.png "vePENDLE Bonus Decay") During this period, existing vePENDLE holders receive a virtual sPENDLE balance based on their PENDLE locked and time to full unlock during the snapshot at 00:00 UTC, January 29th. This virtual sPENDLE balance is non-transferable. The maximum multiplier is 4x for 2 years to unlock (i.e. maximum unlock) and decays to 1x by the unlock date, after which the virtual sPENDLE balance expires. To continue receiving sPENDLE benefits, vePENDLE holders must redeem their locked PENDLE and stake it as sPENDLE. ![vePENDLE multiplier illustration](https://docs.pendle.finance/assets/images/vependle_bonus_illustration-e582529379fcaf29446dc29b7f168160.png "vePENDLE Multiplier Illustration") Once all users are fully unlocked, sPENDLE will be the sole governance and revenue token of the Pendle ecosystem. * [Staking and Unstaking](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#staking-and-unstaking) * [Active Participation & Eligibility](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#active-participation--eligibility) * [sPENDLE Yields](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#spendle-yields) * [Buyback execution](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#buyback-execution) * [Accounting](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#accounting) * [Voting Power](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#voting-power) * [Reward Distribution](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE#reward-distribution) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # SY | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/SY#__docusaurus_skipToContent_fallback) On this page ![SY](https://docs.pendle.finance/assets/images/sy-43cf9a60f737cc44295f377a05f714c9.png "SY") SY is a token standard that implements a standardized API for wrapped yield-bearing tokens within smart contracts. All yield-bearing tokens can be wrapped into SY, giving them a common interface that can be built upon. SY opens up Pendle’s yield-tokenization mechanism to all yield-bearing tokens in DeFi, creating a permissionless ecosystem. > For example, stETH, cDAI and yvUSDC can be wrapped into SY-stETH, SY-cDAI and SY-yvUSDC, standardizing their yield-generating mechanics to be supported on Pendle. As all SYs have the same mechanism, Pendle interacts with SY as the main interface to all yield-bearing tokens. PT and YT are minted from SY and Pendle AMM pools trade PT against SY. While this might seem daunting, Pendle automatically converts yield-bearing tokens into SY and vice versa. This process happens automatically behind the scenes, making users feel as if they’re interacting directly with their yield-bearing tokens instead of having to manually deal with SY ↔ yield-bearing token conversion. ### Key Characteristics[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/SY#key-characteristics "Direct link to Key Characteristics") * **1:1 Wrapping (Typically):** In most cases, 1 SY token represents 1 unit of the underlying yield-bearing asset. For instance, 1 SY-rsETH is equivalent to 1 rsETH. However, there are exceptions (e.g., mPendle, aUSDC) where the ratio is not strictly 1:1. Integrators should verify the specific wrapping mechanism for each SY token. * **No Maturity Date:** Unlike PT and YT, the SY token does not have an expiry date. It acts as a perpetual wrapper for the underlying asset as long as it is held within the Pendle ecosystem. * **Source of Yield and Points:** The SY contract holds the deposited underlying asset and is the direct recipient of all accrued yield and points from that asset. All rewards distributed within a Pendle market originate from the SY tokens held within it. * **Upgradability:** Most newer SY contracts are deployed as upgradable proxies. This allows for future enhancements — such as adding support for new deposit assets or adjusting mechanisms — without requiring a full market migration. While this standard benefits Pendle, our vision for SY extends beyond just our own protocol. SY aims to create unprecedented composability across all of DeFi, enabling developers to seamlessly build on top of existing contracts without the need for manual integration. SY Converter[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/SY#sy-converter "Direct link to SY Converter") ----------------------------------------------------------------------------------------------------------------------------------------- ![SY Converter](https://docs.pendle.finance/assets/images/sy-converter-bacdf0cbebcfd0495d0e09156084485f.png "SY Converter") The SY Converter can be found in the trade form for any of the associated market. For example _SY-sUSDe_ wrapper/unwrapper is accessible from sUSDe market of any maturity. **To use the SY Converter:** ![SY Converter Window](https://docs.pendle.finance/assets/images/sy-converter-window-092288f6efa04271d0db1640f4ad5331.png "SY Unwrapper Window") Step 1: Select between “Unwrap” or “Wrap” mode Step 2: Select the token to wrap from or unwrap to Step 3: Check the rate and output. Step 4: Confirm and approve the transaction. * [Key Characteristics](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/SY#key-characteristics) * [SY Converter](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/SY#sy-converter) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # APY Calculation | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#__docusaurus_skipToContent_fallback) On this page This document contains the formulas used to calculate the APY for Pendle markets. In this document, we take the market `0x107a2e3cd2bb9a32b9ee2e4d51143149f8367eba` on mainnet as an example. **Variables**[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#variables "Direct link to variables") ------------------------------------------------------------------------------------------------------------------------------------------ | name | Description | | --- | --- | | market\\text{market}market | [0x107a2e3cd2bb9a32b9ee2e4d51143149f8367eba](https://etherscan.io/address/0x107a2e3cd2bb9a32b9ee2e4d51143149f8367eba) | | sy\\text{sy}sy | [0xC4ed348c56223C5953939e932E315F9d72Cd83fF](https://etherscan.io/address/0xC4ed348c56223C5953939e932E315F9d72Cd83fF) | | lpPriceUsd\\text{lpPriceUsd}lpPriceUsd | price of the lp token in terms of USD | | syPriceUsd\\text{syPriceUsd}syPriceUsd | price of the sy token in terms of USD | | pendlePriceUSD\\text{pendlePriceUSD}pendlePriceUSD | price of the Pendle token in terms of USD | | duration\\text{duration}duration | the interval that we use to calculate the APY. For example, duration\=7\\text{duration}=7duration\=7 means we calculate the APY based on data of the last 7 days. In our system, we use 7 days as the default duration! | | syIndex\\text{syIndex}syIndex | the current index of the SY token, can be taken from [exchangeRate function](https://etherscan.io/address/0xC4ed348c56223C5953939e932E315F9d72Cd83fF#readContract#F9)
of the sy contract | | prevSyIndex\\text{prevSyIndex}prevSyIndex | the syIndex\\text{syIndex}syIndex at duration\\text{duration}duration days ago. | | yearsToExpiry\\text{yearsToExpiry}yearsToExpiry | the number of years until the expiry of the market. | Underlying APY[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#underlying-apy "Direct link to Underlying APY") ----------------------------------------------------------------------------------------------------------------------------------------------------- underlyingApy\=underlyingInterestApy+underlyingRewardApr\\text{underlyingApy} = \\text{underlyingInterestApy} + \\text{underlyingRewardApr}underlyingApy\=underlyingInterestApy+underlyingRewardApr underlyingApy\\text{underlyingApy}underlyingApy comes in two part, below are how to calculate each of them ### **UnderlyingInterestApy**[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#underlyinginterestapy "Direct link to underlyinginterestapy") interestMultiple\=syIndexprevSyIndex\\text{interestMultiple} = \\dfrac{\\text{syIndex}}{\\text{prevSyIndex}}interestMultiple\=prevSyIndexsyIndex​ underlyingInterestApy\=interestMultiple365days−1\\text{underlyingInterestApy} = \\text{interestMultiple}^{\\frac{365}{\\text{days}}} - 1underlyingInterestApy\=interestMultipledays365​−1 * Explanation: * underlyingInterestApy\\text{underlyingInterestApy}underlyingInterestApy estimates the current APY for the **interest** of the underlying protocol of the SY token. **Interest** = returns in the underlying asset, and it’s auto-compounding by default. * In this formula, we are taking the historical APY for the last 7 days, to extrapolate into the returns for the year. ### **UnderlyingRewardApr:**[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#underlyingrewardapr "Direct link to underlyingrewardapr") * For each reward token: * prevRewardIndex\=\\text{prevRewardIndex} =prevRewardIndex\= rewardIndex\\text{rewardIndex}rewardIndex at duration\\text{duration}duration days ago * dailyRewardPerSy\=rewardIndex−prevRewardIndexdays\\text{dailyRewardPerSy} = \\dfrac{\\text{rewardIndex} - \\text{prevRewardIndex}}{\\text{days}}dailyRewardPerSy\=daysrewardIndex−prevRewardIndex​ * dailyRewardYield\=dailyRewardPerSy∗rewardPricesyPrice\\text{dailyRewardYield} = \\text{dailyRewardPerSy} \* \\dfrac{\\text{rewardPrice}}{\\text{syPrice}}dailyRewardYield\=dailyRewardPerSy∗syPricerewardPrice​ * tokenRewardApr\=dailyRewardYield×365\\text{tokenRewardApr} = \\text{dailyRewardYield} \\times 365tokenRewardApr\=dailyRewardYield×365 * underlyingRewardApr\=∑tokenRewardApr\\text{underlyingRewardApr} = \\sum \\text{tokenRewardApr}underlyingRewardApr\=∑tokenRewardApr * Explanation: * underlyingRewardApr\\text{underlyingRewardApr}underlyingRewardApr estimates the current APr for the **rewards** of the underlying protocol of the SY token. **Rewards** = returns in the reward token, and it’s not auto-compounding by default. * In this formula, we are taking the historical rewards rate for the last 7 days, to extrapolate into the returns for the year. * Each reward token has its own reward rate, so they have their own APR. We sum them up to get the total APR for all reward tokens. **impliedAPY:**[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#impliedapy "Direct link to impliedapy") ---------------------------------------------------------------------------------------------------------------------------------------------- apy\=elnImpliedYield−1\\text{apy} = e^{\\text{lnImpliedYield}} - 1apy\=elnImpliedYield−1 * lnImpliedYield\\text{lnImpliedYield}lnImpliedYield can be read from [readState](https://etherscan.io/address/0x107a2e3cd2bb9a32b9ee2e4d51143149f8367eba#readContract#F18) function of the market contract. Do remember to scale it by 1e18. **SwapFeeApy**[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#swapfeeapy "Direct link to swapfeeapy") --------------------------------------------------------------------------------------------------------------------------------------------- ### SwapFeeApy[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#swapfeeapy-1 "Direct link to SwapFeeApy") swapFeeApy\\text{swapFeeApy}swapFeeApy is the APY that LP holders will get from the swap fees of the pool. poolValue\=lpPriceUsd∗totalSupply\\text{poolValue} = \\text{lpPriceUsd} \* \\text{totalSupply}poolValue\=lpPriceUsd∗totalSupply swapFeeForLpHolder\=explicitSwapFee∗20%+implicitSwapFee\\text{swapFeeForLpHolder} = \\text{explicitSwapFee} \* 20\\% + \\text{implicitSwapFee}swapFeeForLpHolder\=explicitSwapFee∗20%+implicitSwapFee swapFeeRateForLpHolder\=swapFeeForLpHolder∗syPriceUsdpoolValue\\text{swapFeeRateForLpHolder} = \\dfrac{\\text{swapFeeForLpHolder} \* \\text{syPriceUsd}}{\\text{poolValue}}swapFeeRateForLpHolder\=poolValueswapFeeForLpHolder∗syPriceUsd​ swapFeeApy\=(1+swapFeeRateForLpHolder)365durations−1\\text{swapFeeApy} = (1 + \\text{swapFeeRateForLpHolder})^\\frac{{365}}{\\text{durations}} - 1swapFeeApy\=(1+swapFeeRateForLpHolder)durations365​−1 * Explanation: * LP Holder will received 20% from explicit swap fee, and 100% from the implicit swap fee * swapFeeRateForLpHolder\\text{swapFeeRateForLpHolder}swapFeeRateForLpHolder is the rate of swap fee that LP holder will get in terms of USD, then we interpolate it to get the swapFeeApyswapFeeApyswapFeeApy #### longYieldApy:[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#longyieldapy "Direct link to longYieldApy:") interestReturns\=(1+underlyingInterestApy)yearsToExpiry−1\\text{interestReturns} = (1+\\text{underlyingInterestApy})^{\\text{yearsToExpiry}} - 1interestReturns\=(1+underlyingInterestApy)yearsToExpiry−1 rewardsReturns\=underlyingRewardApy∗yearsToExpiry\\text{rewardsReturns} = \\text{underlyingRewardApy} \* \\text{yearsToExpiry}rewardsReturns\=underlyingRewardApy∗yearsToExpiry ytReturns\=interestReturns+rewardsReturns\\text{ytReturns} = \\text{interestReturns} + \\text{rewardsReturns}ytReturns\=interestReturns+rewardsReturns ytReturnsAfterFee\=holdYtReturns×95%\\text{ytReturnsAfterFee} = \\text{holdYtReturns} \\times 95\\%ytReturnsAfterFee\=holdYtReturns×95% longYieldApy\=ytReturnsAfterFeeytPriceInAsset1yearsToExpiry−1\\text{longYieldApy}=\\dfrac{\\text{ytReturnsAfterFee}}{\\text{ytPriceInAsset}}^{\\frac{1}{\\text{yearsToExpiry}}}-1longYieldApy\=ytPriceInAssetytReturnsAfterFee​yearsToExpiry1​−1 * Explanation: * interestReturns\\text{interestReturns}interestReturns: * interest returns, in terms of accounting asset, for holding 1 YT from now until expiry * rewardsReturns\\text{rewardsReturns}rewardsReturns: * rewards returns, in terms of accounting asset, for holding 1 YT from now until expiry * ytReturnsAfterFee\\text{ytReturnsAfterFee}ytReturnsAfterFee: * we charge 5% on YT yield, so we need to scale it down by 95% * longYieldApy\\text{longYieldApy}longYieldApy: * This is the APY if we buy YT today, and hold it all the way to expiry, assuming the underlying APY will stay the same. This can be negative (if the returns from YT is less than YT price) * Starting with ytPriceInAsset\\text{ytPriceInAsset}ytPriceInAsset, we got back ytReturnsWithFee\\text{ytReturnsWithFee}ytReturnsWithFee after yearsToExpiry\\text{yearsToExpiry}yearsToExpiry.Then we just need to scale it to one year to get the APY effectiveImpliedApy\\text{effectiveImpliedApy}effectiveImpliedApy[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#texteffectiveimpliedapy "Direct link to texteffectiveimpliedapy") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Effective Implied APY is the APY based on the actual rate that the user used to swap. To calculate effectiveImpliedApy\\text{effectiveImpliedApy}effectiveImpliedApy, we need to get the ptExchangeRate\\text{ptExchangeRate}ptExchangeRate: how much PT you can get from 1 underlying. There are 3 type of swaps: * PT ↔ any token except YT * YT ↔ any token except PT * PT ↔ YT Each of them has different way to calculate the ptExchangeRateptExchangeRateptExchangeRate ### PT ↔ any token[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#pt--any-token "Direct link to PT ↔ any token") * underlying\\text{underlying}underlying: input/output token amount in terms of the underlying token * ptAmount\\text{ptAmount}ptAmount: PT input/output amount ptExchangeRate\=ptAmountunderlying\\text{ptExchangeRate} = \\dfrac{\\text{ptAmount}}{\\text{underlying}}ptExchangeRate\=underlyingptAmount​ ### YT ↔ any token[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#yt--any-token "Direct link to YT ↔ any token") * ytAmount\\text{ytAmount}ytAmount: YT input/output amount ptExchangeRate\=11−underlyingytAmount\\text{ptExchangeRate} = \\dfrac{1}{1 - \\dfrac{\\text{underlying}}{\\text{ytAmount}}}ptExchangeRate\=1−ytAmountunderlying​1​ ### PT ↔ YT[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#pt--yt "Direct link to PT ↔ YT") ptExchangeRate\=1+ptAmountytAmount\\text{ptExchangeRate} = 1 + \\dfrac{\\text{ptAmount}}{\\text{ytAmount}}ptExchangeRate\=1+ytAmountptAmount​ From ptExchangeRate\\text{ptExchangeRate}ptExchangeRate you can calculate the effectiveImpliedApy as follow: effectiveImpliedApy\=ptExchangeRate365daysToExpiry−1\\text{effectiveImpliedApy} = \\text{ptExchangeRate}^{\\frac{365}{\\text{daysToExpiry}}} - 1effectiveImpliedApy\=ptExchangeRatedaysToExpiry365​−1 * [**Variables**](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#variables) * [Underlying APY](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#underlying-apy) * [**UnderlyingInterestApy**](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#underlyinginterestapy) * [**UnderlyingRewardApr:**](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#underlyingrewardapr) * [**impliedAPY:**](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#impliedapy) * [**SwapFeeApy**](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#swapfeeapy) * [SwapFeeApy](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#swapfeeapy-1) * [\\text{effectiveImpliedApy}](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#texteffectiveimpliedapy) * [PT ↔ any token](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#pt--any-token) * [YT ↔ any token](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#yt--any-token) * [PT ↔ YT](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation#pt--yt) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Dashboard | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#__docusaurus_skipToContent_fallback) On this page The dashboard is designed to help Pendle users manage all of your positions. It offers a comprehensive view of your portfolio, allowing you to easily track all of your historical and current performance on Pendle itself. Yield and rewards accrued from any Yield Tokens (YT) and Liquidity Provision (LP) positions can also be directly monitored and claimed here. Overview[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#overview "Direct link to Overview") --------------------------------------------------------------------------------------------------------- ![Dashboard](https://docs.pendle.finance/img/AppGuide/dashboard.png) The upper part of the dashboard provides an overview of your positions. #### My Total Balance[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#my-total-balance "Direct link to My Total Balance") Total current, _active_ positions on the selected chain in dollar terms #### My Claimable Yield & Rewards[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#my-claimable-yield--rewards "Direct link to My Claimable Yield & Rewards") All of the accrued yield and rewards from YT and LP that can be [claimed](https://docs.pendle.finance/AppGuide/Claim) on the selected chain #### Leaderboard[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#leaderboard "Direct link to Leaderboard") Shows your P&L ranking compared to other yield traders on the Seasonal Leaderboard. Note that only rankings ≥1000 will be shown. You can access the Leaderboard by clicking the button [here](https://app.pendle.finance/trade/dashboard/leaderboard/valuation) . All My Positions[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#all-my-positions "Direct link to All My Positions") --------------------------------------------------------------------------------------------------------------------------------- The lower part of the Dashboard breaks down your Pendle positions by Assets, including which active positions you hold for that particular asset (i.e. PT, YT or LP), its Total Position Value as well as P&L. ![All My Positions](https://docs.pendle.finance/assets/images/all_my_positions-85a8cdde3a7005f285d165115b0bbb07.png "All My Positions") You can click on “Details” for an even more comprehensive view of the asset position, which will show you a further breakdown of your position by PT, YT and LP, alongside a dynamic P&L chart (coming soon). ![My Position](https://docs.pendle.finance/assets/images/my_position-e06cf725cf9a1f82ecff619e34857122.png "My Position") The “Transactions” tab shows all the transactions related to the asset, including realized profit by transactions. Clicking on the actions (e.g. “Claim Yield” or “LP Transferred Out”) under the column will bring you to the transaction page on the blockchain explorer. ![My Transactions](https://docs.pendle.finance/assets/images/my_transactions-35d5c6fb63296d1d2e1a38f04a89d30d.png "My Transactions") Dashboard Viewing Mode[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#dashboard-viewing-mode "Direct link to Dashboard Viewing Mode") --------------------------------------------------------------------------------------------------------------------------------------------------- Pendle offers two distinct viewing modes for the dashboard: USD Mode and Underlying Mode. Each mode provides a different perspective on your positions and profit and loss (P&L) calculations: ### USD Mode[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#usd-mode "Direct link to USD Mode") In USD Mode, all positions and P&L calculations are expressed in US dollars. This mode is sensitive to fluctuations in the price of the underlying assets, meaning any change in asset prices directly affects both your P&L and the value of your positions. ### Underlying Mode[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#underlying-mode "Direct link to Underlying Mode") In contrast, Underlying Mode calculates all positions and P&L using the quantities of the underlying assets. This approach isolates your financial metrics from the volatility of asset prices; fluctuations in market prices do not impact your P&L or the valuation of your positions, which are solely influenced by transactions and events within Pendle. ### Aggregate Calculations[​](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#aggregate-calculations "Direct link to Aggregate Calculations") Regardless of the selected mode, aggregate metrics such as overall P&L, the total value of positions, and capital are consistently calculated in USD. This ensures clarity and uniformity when assessing overall financial performance. The mode toggle specifically affects the display and calculation of data for individual assets. * [Overview](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#overview) * [All My Positions](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#all-my-positions) * [Dashboard Viewing Mode](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#dashboard-viewing-mode) * [USD Mode](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#usd-mode) * [Underlying Mode](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#underlying-mode) * [Aggregate Calculations](https://docs.pendle.finance/pendle-v2/AppGuide/Dashboard#aggregate-calculations) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # High Level Architecture | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#__docusaurus_skipToContent_fallback) On this page ![High Level Architecture](https://docs.pendle.finance/assets/images/high_level_architecture-457bcdd55f399a2d90b8c7bd9e2b6a09.png "High Level Architecture") Functions of Contracts[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#functions-of-contracts "Direct link to Functions of Contracts") ----------------------------------------------------------------------------------------------------------------------------------------------------------------- ### PendleRouter[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#pendlerouter "Direct link to PendleRouter") PendleRouter is a contract that aggregates callers' actions with various different SYs, PTs, YTs, and Markets. It does not have any special permissions or whitelists on any contracts it interacts with. Therefore, any third-party protocols can freely embed the router's logic into their code for better gas efficiency. You can read more about the PendleRouter [here](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview) . ### Standardized Yield (SY)[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#standardized-yield-sy "Direct link to Standardized Yield (SY)") SY is a wrapped version of the interest-bearing token (ibToken) that can also be staked into other protocols to earn even more interest. In the Pendle system, SY is used instead of the ibToken for all operations, including trading on PendleMarket or minting Principal Token & Yield Token. The following are true: | SY | ibToken (1 SY = 1 ib Token) | Asset (ibToken appreciates against) | | --- | --- | --- | | SY GLP | `GLP` | NIL, GLP doesn't appreciate | | SY wstETH | `wstETH` | stETH | | SY ETHx | `ETHx` | ETH locked in ETHx contract\* | | SY aUSDC | Not 1-1 to aUSDC since it's rebasing | aUSDC | | SY rETH-WETH\_BalancerLP Aura | `rETH-WETH LP` of Balancer staked into the corresponding Aura's gauge | Liquidity of rETH-WETH pool | For `*`: ETH locked in ETHx is different from normal ETH due to withdrawal from ETHx has delay. Under normal circumstances it's also normal for ETHx to trade at a market price lower than the amount of ETH it can be withdrawn to. ### Principal Token (PT)[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#principal-token-pt "Direct link to Principal Token (PT)") PT is a token that represents the right to redeem for the principal amount at maturity, and is tradable on PendleMarket. While PT represents a claim to a fixed amount of assets, SY wraps an ibToken that increases in value, meaning that `1 PT != 1 SY` is usually true (except in exceptional cases). Instead, `1 PT = 1 Asset`, where "Asset" refers to what SY's ibToken is denominated in. The following are true: | PT | Asset (1 PT = 1 Asset) | | --- | --- | | PT GLP | GLP | | PT wstETH | stETH | | PT ETHx | ETH locked in ETHx contract | | PT aUSDC | aUSDC | At redemption, `1 PT = X SY`, where `X` satisfies the condition that `X SY = 1 Asset`. For example, assuming `1 wstETH = 1.2 stETH` on 1/1/2024, `1 PT-wstETH-01JAN2024` will be redeemable to `0.8928 wstETH` at maturity. ### Yield Token (YT)[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#yield-token-yt "Direct link to Yield Token (YT)") YT is a token that represents the rights to redeem the interest generated by the SY until it reaches maturity. It's important to note that the value of YT is zero once it reaches maturity. The yield can be redeemed at any time and it can be traded on PendleMarket using special methods. ibToken generates yield in two forms, which Pendle denotes as: * **Interest** (compounding yield): The yield is denominated in the same unit as the asset of ibToken. For example, as time goes on, `wstETH` becomes worth more in terms of `stETH`, and `SY-aUSDC` becomes worth more in terms of `USDC`. * **Rewards** (yield that does not compound): The yield is given out in a different unit than the ibToken. For example, GLP generates ETH. The following are true: | YT | Interest | Rewards | | --- | --- | --- | | YT GLP | \- | ETH | | YT wstETH | stETH | \- | | YT ETHx | ETH locked in ETHx contract | \- | | YT aUSDC | aUSDC | \- | | YT rETH-WETH\_BalancerLP Aura | liquidity of rETH-WETH pool | AURA, BAL | PT and YT are minted and redeemed using the YT contract. To mint PT and YT, SY is utilized. `1 SY = X PT + X YT` is created where `1 SY = X Asset`. Prior to maturity, both PT and YT must be provided to redeem the underlying SY. After maturity, only PT is required for redemption. ### PendleMarket[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#pendlemarket "Direct link to PendleMarket") PendleMarket (or simply Market) is a contract that enables users to trade between PT and its corresponding SY, while still allowing liquidity provision as usual. Swap fees are directly compounded into the LP. Each Market also has its own built-in geometric-mean oracle, similar to UniswapV3. Currently, there is no market to trade YT, but it is always tradable by the following algorithms: * `SY ➝ YT` = flashswap SY, mint PT & YT, payback PT, send YT to users. * `YT ➝ SY` = flashswap PT, use PT & YT, redeem SY, pay back, send excess to users. YT Fungibility All Yield Tokens (YT) of the same underlying asset are **completely fungible**. It is not programmatically possible to distinguish between YT acquired through minting, swapping, or LPing. User balances are queried on the SY contract, which treats all YT of a given type as identical. Any attempt to classify users or distribute rewards based on how they acquired their YT is not feasible on-chain. Contract Factories[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#contract-factories "Direct link to Contract Factories") ----------------------------------------------------------------------------------------------------------------------------------------------------- Pendle uses a factory pattern for deploying new markets, PTs, and YTs. This standardizes the creation process and provides a single source of truth for identifying valid protocol components. ### Factory Versions[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#factory-versions "Direct link to Factory Versions") | Version | Timeframe | Key Changes | | --- | --- | --- | | Pre-V3 | Early deployments | Initial factory implementations | | **V3** | Late 2023 | Standard for all new deployments across all chains | | **V4/V5** | Mid-2024 | **Removed `Permit` (EIP-2612) from all new PT, YT, and LP tokens** to mitigate phishing attacks | | **V6** | Late 2025 | Current recommended version for all new market deployments | Security Note: Permit Removal Starting with V4/V5 factories, the `Permit` function (EIP-2612) was **completely removed** from all newly created PT, YT, and LP tokens. The `Permit` function, which allows gasless approvals via off-chain signatures, was identified as a significant phishing attack vector. Tokens created by V4+ factories no longer support `permit()`. warning Always use the **latest factory version** for new market deployments. Using deprecated factories can lead to issues including improper contract verification. ### Immutability vs. Upgradability[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#immutability-vs-upgradability "Direct link to Immutability vs. Upgradability") * **Market contracts are immutable** once deployed. Their fundamental parameters (including the concentrated yield range) cannot be changed. If a pool goes "out of range," a brand new market must be deployed and LPs must manually migrate. * **SY contracts are upgradable proxies** (for newer deployments). This allows adding support for new deposit assets or adjusting mechanisms without requiring a full market migration. When developing an SY externally, it is recommended to deploy it as an upgradeable contract using Pendle's proxy admin and transfer ownership to Pendle's pause controller. Cross-Chain Principal Tokens[​](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#cross-chain-principal-tokens "Direct link to Cross-Chain Principal Tokens") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Cross-chain PTs allow Principal Tokens to be bridged and used on networks where Pendle may not have a full deployment, while concentrating deep trading liquidity on mainnet. * **Standard:** Uses [LayerZero's Omnichain Fungible Token (OFT)](https://docs.layerzero.network/v2/home/token-standards/oft-standard) standard. * **Mechanism:** Users can "zap in" to a PT position on a mainnet pool, then bridge the PT to a destination chain (e.g., Avalanche, HyperEVM) for use as collateral in local money markets. * **Liquidation:** The system handles liquidations without relying on DEX liquidity on the destination chain — the underlying asset is converted and bridged back from mainnet. * **Initial Pilot:** sUSDe/USDe PTs, with the goal of collateral support on money markets like Morpho. * [Functions of Contracts](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#functions-of-contracts) * [PendleRouter](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#pendlerouter) * [Standardized Yield (SY)](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#standardized-yield-sy) * [Principal Token (PT)](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#principal-token-pt) * [Yield Token (YT)](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#yield-token-yt) * [PendleMarket](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#pendlemarket) * [Contract Factories](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#contract-factories) * [Factory Versions](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#factory-versions) * [Immutability vs. Upgradability](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#immutability-vs-upgradability) * [Cross-Chain Principal Tokens](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture#cross-chain-principal-tokens) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Tokenomics | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Tokenomics#__docusaurus_skipToContent_fallback) On this page ![PENDLE distribution](https://docs.pendle.finance/img/ProtocolMechanics/pendle_distribution.png) PENDLE distribution as of Oct-2022 As of September 2024, all team and investor tokens have fully vested. Any increase to circulating supply will be contributed by incentives and ecosystem building. Weekly Emission[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Tokenomics#weekly-emission "Direct link to Weekly Emission") --------------------------------------------------------------------------------------------------------------------------------------------------- Weekly emission as of Sept-2024 is 216,076 with a 1.1% decrease each week until April 2026. At that point, it will switch to a terminal inflation rate of 2% per annum for incentives. As the industry matures, governance may propose changes based on the evolution of ecosystem best practices. ![Weekly Emission](https://docs.pendle.finance/img/ProtocolMechanics/weekly_emission.png) Weekly Emission Circulating Supply[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Tokenomics#circulating-supply "Direct link to Circulating Supply") ------------------------------------------------------------------------------------------------------------------------------------------------------------ **Circulating Supply** refers to all freely circulating Pendle token which does NOT include: 1. Pendle staked in [sPENDLE contract](https://etherscan.io/address/0x999999999991E178D52Cd95AFd4b00d066664144) 2. Pendle in [vePENDLE contract](https://etherscan.io/address/0x4f30a9d41b80ecc5b94306ab4364951ae3170210) (winding down — users should migrate to sPENDLE). 3. Pendle in [Ecosystem Fund address](https://etherscan.io/address/0x399be606db281a054e359eb709df9f21e922ec9a) . 4. Pendle in [Governance Multi-signature address](https://etherscan.io/address/0x8119ec16f0573b7dac7c0cb94eb504fb32456ee1) . 5. Pendle in [Team Multi-signature address](https://etherscan.io/address/0x918cf6b16d1426b5aa0edf0492ced1aa89f9659a) . The total supply of Pendle tokens at any point in time is the **Circulating Supply** plus Pendle in the 5 addresses above. ![PENDLE supply](https://docs.pendle.finance/img/ProtocolMechanics/pendle_supply.png) PENDLE Total supply * [Weekly Emission](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Tokenomics#weekly-emission) * [Circulating Supply](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Tokenomics#circulating-supply) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Incentives | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#__docusaurus_skipToContent_fallback) On this page The algorithmic incentive model is an automated merit-based reward system that allocates PENDLE emissions to pools based on their performance. Pools that excel across liquidity, swap fee, and co-incentive categories receive a higher share of rewards to recognize their contributions to the Pendle ecosystem. The algorithmic incentive model has four reward streams: * Performance: Automated emissions based on liquidity and swap fees * Limit Order: Automated emissions based on Total TVL and recent volume * Co-Incentives: Matching rewards for protocol-provided incentives * Discretionary: Strategic allocations for high-potential pools The maximum rewards per week across all streams is 90,000 PENDLE. Each pool may receive up to 5,000 and 1,500 PENDLE from the performance and limit order streams respectively. Any PENDLE not distributed in a given week is returned to the protocol treasury and does not roll over to the next week's budget. How Often Are Incentives Updated?​[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#how-often-are-incentives-updated "Direct link to How Often Are Incentives Updated?​") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Incentives are recalculated and updated every hour. When a new pool is whitelisted, it will begin receiving incentives within the next hour. Individual components update on different schedules: * Liquidity emissions: Continuously in real-time as TVL changes * Fee emissions: Recalculated three times per week (Monday, Wednesday, Saturday) * Limit order emissions: Continuously in real-time as TVL and volume changes. * Co-incentives: Updated weekly on Wednesdays * Discretionary: Updated weekly on Wednesdays Performance[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#performance "Direct link to Performance") --------------------------------------------------------------------------------------------------------------------------------------- Performance-based emissions are adapted to support pools based on their expected needs throughout their lifecycle: newer pools are aggressively incentivized based on liquidity growth while mature pools are primarily incentivized based on swap fee performance. ![incentive timeline](https://docs.pendle.finance/assets/images/incentive_timeline-3adc58ebb782d60c8e87b0b117e63055.png "Incentive Timeline") The performance-based emission streams may receive up to the maximum weekly reward rate less emissions consumed by the co-incentive and discretionary streams. Liquidity-Based Emissions[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#liquidity-based-emissions "Direct link to Liquidity-Based Emissions") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Pools receive PENDLE based on their weighted TVL which reflects: WeightedTVL = LP TVL + k x Floating TVL Where k is currently set to 0.2. Weighted TVL determines a pool’s share of emissions depending on its phase which is defined by its days since launch:: Bootstrapping -> <14 days since deployment Growth -> 14-28 days since deployment Mature -> 28 days since deployment ![Emission Curve](https://docs.pendle.finance/assets/images/emission_curve-0c53b890c17faf15d3fb27c216fdbc76.png "Emission Curve") The Bootstrapping curve has an aggressive reward per liquidity slope to support new pools during their critical early phases. As a pool moves closer to maturity, these benefits are gradually tapered with pool performance driven by fees instead. The initial liquidity parameters are as follows: | Liquidity | PENDLE Emission (<14 Days Since Launch) | PENDLE Emission (>28 Days Since Launch) | | --- | --- | --- | | 0–2m | 0%–0.6% | 0% | | 2–5m | 0.6%–1.25% | 0%-0.1125% | | 5–10m | 1.25%-1.5 | 0.1125%-0.3% | | 10m | 1.5% | 0.3% | ### Renewed Pools[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#renewed-pools "Direct link to Renewed Pools") When a new maturity (‘Renewal Pool’) is launched for an existing pool (‘Maturing Pool’) on the same chain, the Renewal Pool benefits from the **Renewal Liquidity Curve** which overrides the default Liquidity curve. The Renewal Pools’ incentives are determined by: 1. Maturing Pool’s days-to-maturity 2. Renewal Pool’s Liquidity There are 3 phases for the **Renewal Liquidity Curve**: 1. Pre-Maturity (<7 days before the original pool matures) 2. Transitional (0-7 days after the original pool matures) 3. Post-Maturity (>7 days after the original pool matures OR >7 days before the original pool matures) ![Renewal Curve](https://docs.pendle.finance/assets/images/renewal_curve-788a9a3b79764d8f20aba81ea07d8a19.png "Renewal Curve") Each phase applies different emissions levels based on the Renewal Pool’s Liquidity: | Liquidity (Renewal Pool) | PENDLE Emission (Pre-Maturity) | PENDLE Emission (Post-Maturity) | | --- | --- | --- | | 0–2m | 0%–0.2% | 0% | | 2–5m | 0.2%–0.5% | 0%-0.1125% | | 5–10m | 0.5%–1% | 0.1125%-0.3% | | 10m+ | 1% | 0.3% | #### Example[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#example "Direct link to Example") ![Renewal Emission](https://docs.pendle.finance/assets/images/renewal_emission-8951fa504831c7816e8c73aa8799cfb0.png "Renewal Emission") _Assume the USDe pool is maturing soon, with the renewal pool (next closest maturity) having $10M weighted TVL. Under ordinary circumstances, it would receive 1.5% emission share under the default Liquidity Curve (Bootstrapping)_. _Since it is a renewal pool, it follows the Renewal liquidity curve instead, determined by the maturing USDe pool’s day to maturity_: * <7 days pre-maturity -> 1.0% emission share * 4 days post maturity -> 0.471% emission share * \>7 days post-maturity -> 0.3% emission share The objective is to calibrate incentives based on context. Renewal pools benefit from established liquidity and userbase, requiring less bootstrapping support than genuine new assets. This allows the protocol to focus stronger incentives on new asset launches, while still supporting smooth rollovers for maturing pools Fee-Based Emission[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#fee-based-emission "Direct link to Fee-Based Emission") ------------------------------------------------------------------------------------------------------------------------------------------------------------ Fee-based Emissions have a weekly budget of 40,000 PENDLE. A pool’s share of **total swap fees** determines their pro-rata share of the fee-based emission budget with a maximum cap of **four times** its previous week’s fees from this stream. ### Eligibility and Fee Measurement​[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#eligibility-and-fee-measurement "Direct link to Eligibility and Fee Measurement​") **Eligibility**: Pools must be at least 2 days old to receive fee-based emissions. Newer pools can still receive liquidity-based emissions and other incentives. **Fee Calculation**: Fee performance uses a recency-weighted methodology that emphasizes recent activity: * For pools older than 14 days: Fee performance number updates every snapshot with the fees 7 day before last snapshot weighted at 2x and the earlier 7 days weighted at 1x * For younger pools: Special calculations account for limited trading history Limit Order Emissions[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#limit-order-emissions "Direct link to Limit Order Emissions") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Pools receive Limit Order (LO) rewards based on their total TVL and recent swap volume with a per pool cap of $1,500 per week. Incentives are distributed to LOs within a 4% range of the current IY on a time and notional value weighted basis. ### Target Depth[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#target-depth "Direct link to Target Depth") Each pool targets a baseline of 5% of its total TVL in orderbook depth with potential to grow to 15% of total TVL based on its 4 day recency adjusted swap volume (4D-RASW). For example, a pool with 10mtotalTVLwilltarget10m total TVL will target 10mtotalTVLwilltarget500k in orderbook depth as a baseline but may be adjusted based on 4D-RASW. * 400k4D−RASW→400k 4D-RASW → 400k4D−RASW→500k target depth (4D-RASW < Target Depth) * 1m4D−RASW→1m 4D-RASW → 1m4D−RASW→750k target depth (4D-RASW > Target Depth) * 2m4D−RASW→2m 4D-RASW → 2m4D−RASW→1.5m target depth (4D-RASW > Depth Cap) ### Decay-Adjusted Target Depth[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#decay-adjusted-target-depth "Direct link to Decay-Adjusted Target Depth") A pool’s target depth may be adjusted to reflect its days to maturity (DTM). The decay rate initializes at 25% for pools with DTM > 120 and decreases to 0% for pools with DTM < 60. For example, the decay-adjusted target depth for pools with $1m target depth with varying DTM is outlined as follows: * 120 DTM → $750k decay-adjusted target depth * 90 DTM → $875k decay-adjusted target depth * 60 DTM → $600k decay-adjusted target depth ### Target Incentives[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#target-incentives "Direct link to Target Incentives") The decay-adjusted target depth is used to determine the actual incentives allocated to a pool based on a target LO APR of 50%. This is based on notional value which is derived by multiplying target depth by YT/USD. For example, given a decay-adjusted target depth of $1m, YT/USD of $0.02, and target APR of 50%, a pool would receive $192 in weekly PENDLE incentives. Co-Incentive[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#co-incentive "Direct link to Co-Incentive") ------------------------------------------------------------------------------------------------------------------------------------------ Protocols can use External Incentive Campaigns to provide additional rewards to Pendle users. Participants are also eligible for co-incentives, where Pendle will match contributions up to a defined amount. For every $1 contributed by the protocol, Pendle provides additional PENDLE of: * $0.4 for external incentives provided as PENDLE * $0.3 for external incentives provided as other tokens **How Matching Works​** * Protocols submit incentives weekly (Wednesdays) through External Incentive Campaigns * Token values are calculated using 7-day moving average prices for both the contributed token and PENDLE * Protocols receive their guaranteed match rate for that week * Maximum co-incentive budget: 9,000 PENDLE per week Discretionary[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#discretionary "Direct link to Discretionary") --------------------------------------------------------------------------------------------------------------------------------------------- Up to 15% of the maximum weekly emissions may be used for discretionary allocations which are primarily targeted towards pools with high growth potential. * [How Often Are Incentives Updated?​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#how-often-are-incentives-updated) * [Performance](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#performance) * [Liquidity-Based Emissions](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#liquidity-based-emissions) * [Renewed Pools](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#renewed-pools) * [Fee-Based Emission](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#fee-based-emission) * [Eligibility and Fee Measurement​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#eligibility-and-fee-measurement) * [Limit Order Emissions](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#limit-order-emissions) * [Target Depth](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#target-depth) * [Decay-Adjusted Target Depth](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#decay-adjusted-target-depth) * [Target Incentives](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#target-incentives) * [Co-Incentive](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#co-incentive) * [Discretionary](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives#discretionary) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle API Overview | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#__docusaurus_skipToContent_fallback) On this page Pendle provides a comprehensive API system that enables developers to integrate with the Pendle protocol for trading, analytics, and portfolio management. Understanding Pendle's API System[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#understanding-pendles-api-system "Direct link to Understanding Pendle's API System") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **API Base URL**: [https://api-v2.pendle.finance/core/docs](https://api-v2.pendle.finance/core/docs) Pendle's API consists of two complementary components: ### 1\. Hosted SDK (Transaction Generation)[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#1-hosted-sdk-transaction-generation "Direct link to 1. Hosted SDK (Transaction Generation)") **Purpose**: Generate transaction payloads to interact with Pendle smart contracts **Use this when you need to**: * Swap tokens (buy/sell PT, YT) * Add or remove liquidity * Mint or redeem PT/YT tokens * Transfer liquidity between pools * Roll over PT positions * ... or any other transactions that interact with Pendle smart contracts 📖 [View Hosted SDK Documentation](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) ### 2\. Backend API (Data Queries)[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#2-backend-api-data-queries "Direct link to 2. Backend API (Data Queries)") **Purpose**: Retrieve offchain data for markets, assets, pricing, user positions, and governance **Use this when you need to**: * Get offchain data for analytics * Get supported markets list with latest data (TVL, volume, underlying APY, swap fee, ...) * Get PT/YT/LP/SY asset prices * Get sPENDLE and governance data (staking, rewards, ...) 📖 [View Backend API Documentation](https://api-v2.pendle.finance/core/docs) API Entry Points[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#api-entry-points "Direct link to API Entry Points") --------------------------------------------------------------------------------------------------------------------------------------------- All public endpoints are served under `https://api-v2.pendle.finance/core` and follow one of two routing patterns: ### Cross-chain endpoints (recommended)[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#cross-chain-endpoints-recommended "Direct link to Cross-chain endpoints (recommended)") These endpoints return data across all chains in a single request. Preferred for new integrations: | Endpoint | Description | | --- | --- | | `GET /v2/markets/all` | All markets across all chains — includes pagination, points, and external protocol data | | `GET /v1/assets/all` | All assets across all chains | | `GET /v1/prices/assets` | Asset prices across all chains | Deprecated `GET /v1/markets/all` and `GET /v1/markets/points-market` are deprecated. Use `GET /v2/markets/all` instead — it returns the same markets with pagination support and points data included in each market object. #### Markets — Pagination[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#markets--pagination "Direct link to Markets — Pagination") `GET /v2/markets/all` supports `skip` and `limit` query parameters for pagination: | Parameter | Default | Maximum | Description | | --- | --- | --- | --- | | `skip` | `0` | — | Number of records to skip | | `limit` | `10` | `100` | Maximum number of records to return | #### Prices — Error Handling[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#prices--error-handling "Direct link to Prices — Error Handling") The price response now includes an `errors` array alongside the price map: { priceMap: Record, errors: Error[] } Non-fatal pricing errors (e.g., assets not found for a given timestamp) are returned in `errors` rather than thrown. Callers should check and handle this field, as a partial result may be returned even when some assets could not be priced. ### Chain-scoped endpoints — `/{version}/{chainId}/...`[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#chain-scoped-endpoints--versionchainid "Direct link to chain-scoped-endpoints--versionchainid") Some endpoints are scoped to a specific chain: | Endpoint | Description | | --- | --- | | ~`GET /v2/{chainId}/markets/{address}/data`~ | _(Deprecated)_ Market data for a specific address | | ~`GET /v2/sdk/{chainId}/convert`~ | _(Deprecated)_ Generate transaction payload — use `POST /v3/sdk/{chainId}/convert` instead | | `GET /v5/{chainId}/transactions/{address}` | Transaction history for an address | Deprecated * `GET /v2/{chainId}/markets/{address}/data` is deprecated. * `GET /v2/sdk/{chainId}/convert` (GET) is deprecated. Use `POST /v3/sdk/{chainId}/convert` instead, which accepts a JSON body and supports typed inputs. For new integrations, prefer cross-chain endpoints where available — they reduce the number of calls needed when working with multiple chains. ### BFF API — `https://api-v2.pendle.finance/bff`[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#bff-api--httpsapi-v2pendlefinancebff "Direct link to bff-api--httpsapi-v2pendlefinancebff") The BFF (Backend for Frontend) API powers the official Pendle web app. It is **not intended for third-party integrations**: endpoints may change or be removed without notice. For third-party use, always use the `/core` API documented here. Rate Limiting[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limiting "Direct link to Rate Limiting") ------------------------------------------------------------------------------------------------------------------------------------ All Pendle API endpoints are rate-limited to ensure service stability and fair usage. ### How Rate Limiting Works[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#how-rate-limiting-works "Direct link to How Rate Limiting Works") Pendle uses a **Computing Unit (CU)** based system. Every endpoint has a CU cost, which may be fixed or dynamic depending on the endpoint. The rate limit is calculated based on the total CU cost of all endpoints. Each user (IP) has a rate limit of 100 CU per minute, and 200,000 CU per week. Both limits apply simultaneously. You must stay within both the per-minute AND weekly limits to avoid rate limiting. **Example**: If an endpoint costs 5 CU, you can call it: * 20 times per minute (100 ÷ 5 = 20) * 40,000 times per week (200,000 ÷ 5 = 40,000) #### Computing Unit Costs[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#computing-unit-costs "Direct link to Computing Unit Costs") Most RESTful API endpoints have fixed costs (typically 1-5 CU), whereas the Hosted SDK has dynamic costs depending on the number of aggregators used. Check the [API documentation](https://api-v2.pendle.finance/core/docs) for specific costs — they're displayed in the "CU" box before each endpoint description. More on computing unit costs for HostedSdk can be found in [HostedSdk.mdx](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#select-aggregators) . #### Rate Limit Headers[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limit-headers "Direct link to Rate Limit Headers") Our endpoints return the following headers to help you monitor your usage: | Header | Description | | --- | --- | | `X-Computing-Unit` | CU cost of this request | | `X-RateLimit-Limit` | Maximum CU per minute (e.g., 100 for free tier) | | `X-RateLimit-Remaining` | CU remaining in current minute window | | `X-RateLimit-Reset` | Unix timestamp when minute limit resets | | `X-RateLimit-Weekly-Limit` | Maximum CU per week (e.g., 200,000 for free tier) | | `X-RateLimit-Weekly-Remaining` | CU remaining in current week window | | `X-RateLimit-Weekly-Reset` | Unix timestamp when week limit resets | Example response: x-computing-unit: 25x-ratelimit-limit: 100x-ratelimit-remaining: 75x-ratelimit-reset: 1724206817x-ratelimit-weekly-limit: 200000x-ratelimit-weekly-remaining: 175000x-ratelimit-weekly-reset: 1724206817 ### Best Practices for Rate Limiting[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#best-practices-for-rate-limiting "Direct link to Best Practices for Rate Limiting") * **Never hardcode rate limits.** Rate limits have evolved over time and may change in the future. Always handle `429` responses gracefully. * **Implement exponential backoff.** When you receive a `429 Too Many Requests` response, wait and retry with increasing delays. * **Use the right endpoint for the job.** For general price monitoring, use `getAllAssetPricesByAddresses` (updates every ~30 seconds). For pre-swap price checks, use `getMarketSpotSwappingPrice` (updates every block). * **Set generous timeouts.** Some API endpoints, particularly those querying complex data, can be slow. Set a client-side HTTP timeout of at least **120 seconds**. * **Watch out for RPC rate limits.** A `429` error is most often caused by your **RPC provider**, not the Pendle API — especially when backfilling historical data. Use a private or paid archival RPC (e.g., QuickNode) for intensive operations. * **Use pagination correctly.** For endpoints returning large lists, include the `resumeToken` from a response in your next request to fetch subsequent pages. ### I get rate limited, what should I do?[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#i-get-rate-limited-what-should-i-do "Direct link to I get rate limited, what should I do?") Our rate limit was designed so that most users can use the API without facing any rate limiting issues, unless you are calling the API unreasonably fast. So before requesting increased rate limits, please make sure you are not calling the API at an unreasonable rate. Follow our best practices and examples. If after all that, you are still getting rate limited, you can consider upgrading your plan, details below. ### API Pricing Plans[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#api-pricing-plans "Direct link to API Pricing Plans") If you need higher rate limits, we offer flexible paid plans that scale with your needs. #### Pricing Structure[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#pricing-structure "Direct link to Pricing Structure") Our pricing is simple and scalable: **$10/week = 500 CU/min + 1,000,000 CU/week** You can purchase multiple units to scale your rate limits based on your application's requirements: | Weekly Cost | CU per Minute | Weekly CU Limit | | --- | --- | --- | | **$0** (Free) | 100 | 200,000 | | **$10** | 500 | 1,000,000 | | **$20** | 1,000 | 2,000,000 | | **$30** | 1,500 | 3,000,000 | | **$40** | 2,000 | 4,000,000 | **Pricing Model:** * Each **$10/week** adds **+500 CU/min** and **+1,000,000 CU/week** to your limits * Scale up to **$40/week** (2,000 CU/min, 4M CU/week) through our standard plans **Example:** If you want to use 1,000,000 CU per week and you want to use the API for 4 weeks, it would be 10∗4\=10 \* 4 = 10∗4\=40. If you want to use 2,000,000 CU per week and you want to use the API for 8 weeks (about 2 months), it would be 20∗8\=20 \* 8 = 20∗8\=160. ### How to get an API key[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#how-to-get-an-api-key "Direct link to How to get an API key") To get an API key and upgrade your plan: 1. Go to the API dashboard at: [https://api-v2.pendle.finance/dashboard](https://api-v2.pendle.finance/dashboard) 2. Login with your wallet (you will be asked to sign a message to verify your identity) 3. Top-up your account with USDC/USDT/DAI on Arbitrum 4. Choose your plan and create a new API key Your API key will be generated. Make sure to save it securely as you'll need it to authenticate your requests. #### How to use your API key[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#how-to-use-your-api-key "Direct link to How to use your API key") Include the `Bearer ` in the `Authorization` header in your requests: Authorization: Bearer **Example:** curl -i -H "Authorization: Bearer your_api_key_here" \ https://api-v2.pendle.finance/core/v1/chains The response will have rate limit headers as described in [Rate Limit Headers](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limit-headers) . note You may occasionally notice `X-Ratelimit-Limit: 100` in responses even when you have a higher rate limit plan. This happens when the response is served from **Cloudflare's cache** (indicated by the `CF-Cache-Status: HIT` header). When a cache hit occurs, the request never reaches our backend, so **it does not count against your rate limit quota**. The `X-Ratelimit-Limit: 100` value in this case is simply a default header from the cached response and does not reflect your actual rate limit. API Updates and Deprecation[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#api-updates-and-deprecation "Direct link to API Updates and Deprecation") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ * **Deprecation Notice**: Breaking changes are announced at least 30 days in advance. Follow the [Telegram Developer Channel](https://t.me/pendledevelopers) for announcements. ### vePENDLE Deprecation[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#vependle-deprecation "Direct link to vePENDLE Deprecation") vePENDLE has been deprecated and replaced by **sPENDLE**. All endpoints listed under the **Ve Pendle** tag in the [API documentation](https://api-v2.pendle.finance/core/docs) are deprecated — they remain accessible but will not be updated to reflect the new sPENDLE staking system. The following endpoints are specifically deprecated: * `GET /v1/ve-pendle/data` — use [`GET /v1/spendle/data`](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#get-v1spendledata) instead * `GET /v1/ve-pendle/market-fees-chart` — no replacement; fees data is now included in the sPENDLE historical data response sPENDLE API Endpoints[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#spendle-api-endpoints "Direct link to sPENDLE API Endpoints") ------------------------------------------------------------------------------------------------------------------------------------------------------------ These endpoints provide sPENDLE staking statistics and per-user reward data. ### GET /v1/spendle/data[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#get-v1spendledata "Direct link to GET /v1/spendle/data") Returns aggregate sPENDLE staking statistics, including total PENDLE staked, historical APRs, revenues, fees, and airdrop breakdowns. Historical data covers the last 12 epochs. | Property | Value | | --- | --- | | Query parameters | None | | Cache TTL | 5 minutes | | CU cost | 1 | **Response fields:** | Field | Description | | --- | --- | | `totalPendleStaked` | Total PENDLE currently staked | | `totalStakedInSpendle` | Total staked in the sPENDLE contract | | `virtualSpendleFromVependle` | Virtual sPENDLE balance derived from vePENDLE positions | | `sPendleHistoricalData` | Per-epoch historical data: `timestamps`, `revenues`, `aprs`, `fees`, `airdrops`, `buybackAmounts`, `airdropInUSDs`, `airdropBreakdowns`, `allTimeRevenues` | | `vependleHistoricalData` | Historical data for the legacy vePENDLE system | ### GET /v1/spendle/:address[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#get-v1spendle "Direct link to get-v1spendle") Returns claimable and historical rewards for a specific sPENDLE holder, including ETH fee rewards, multi-token merkle proofs, and all-time reward totals. | Property | Value | | --- | --- | | Path parameter | `address` — the user's Ethereum address | | Query parameters | None | | Caching | Not cached | | CU cost | 3 | **Response fields:** | Field | Description | | --- | --- | | `ethAccruedAmount` | Accrued ETH fee rewards claimable by the address | | `multiTokenProof` | Merkle proof data — `total` and `results[]` for multi-token rewards | | `allTimeRewards` | Cumulative rewards keyed by `"chainId-tokenAddress"`, with `lastDistributionAt` timestamp | | `vePendlePositionData` | _(Optional)_ Legacy vePENDLE position data, if applicable | Dashboard Endpoints[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#dashboard-endpoints "Direct link to Dashboard Endpoints") ------------------------------------------------------------------------------------------------------------------------------------------------------ ### GET /v1/dashboard/merkle-rewards/:user[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#get-v1dashboardmerkle-rewards "Direct link to get-v1dashboardmerkle-rewards") Returns both claimable and claimed merkle-distributed rewards for a user in a single call. | Property | Value | | --- | --- | | Path parameter | `user` — the user's Ethereum address | | Query parameters | None | | CU cost | 4 | **Response:** { claimableRewards: [...], claimedRewards: [...]} Each item in `claimableRewards` and `claimedRewards` contains: | Field | Description | | --- | --- | | `user` | Ethereum address of the user | | `token` | Token address | | `merkleRoot` | Merkle root for the distribution | | `chainId` | Chain ID of the distribution | | `assetId` | Asset identifier | | `amount` | Reward amount | | `toTimestamp` | _(Optional)_ End of the distribution period | | `fromTimestamp` | _(Optional)_ Start of the distribution period | Deprecated endpoints The following endpoints are deprecated and will be removed in a future release. Use `GET /v1/dashboard/merkle-rewards/:user` instead: * `GET /v1/dashboard/merkle-claimable-rewards/:user` * `GET /v1/dashboard/merkle-claimed-rewards/:user` Code Examples and Resources[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#code-examples-and-resources "Direct link to Code Examples and Resources") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### Official Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#official-examples "Direct link to Official Examples") * [Hosted SDK Demo](https://github.com/pendle-finance/pendle-examples-public/tree/main/hosted-sdk-demo/src) - Transaction generation examples * [Backend API Demo](https://github.com/pendle-finance/pendle-examples-public/blob/main/backend-api-demo/src/index.ts) - Data query examples Getting Help[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#getting-help "Direct link to Getting Help") --------------------------------------------------------------------------------------------------------------------------------- 1. **Documentation**: Start with [API Overview](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview) , [Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) or [Backend API](https://api-v2.pendle.finance/core/docs) docs 2. **API Reference**: Explore endpoints at [API Reference](https://api-v2.pendle.finance/core/docs) 3. **Examples**: Check [GitHub examples](https://github.com/pendle-finance/pendle-examples-public) Frequently Asked Questions[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#frequently-asked-questions "Direct link to Frequently Asked Questions") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #### **Q: When should I use Hosted SDK vs RESTful API?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-when-should-i-use-hosted-sdk-vs-restful-api "Direct link to q-when-should-i-use-hosted-sdk-vs-restful-api") A: Use Hosted SDK when you need to **send transactions** to the blockchain (swaps, liquidity operations, mints/redeems). Use RESTful API when you need to **get data** (market info, prices, positions). See [Overview](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#understanding-pendles-api-system) . ### Hosted SDK FAQ[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#hosted-sdk-faq "Direct link to Hosted SDK FAQ") #### **Q: How do I know the exact output amount before sending a transaction?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-how-do-i-know-the-exact-output-amount-before-sending-a-transaction "Direct link to q-how-do-i-know-the-exact-output-amount-before-sending-a-transaction") A: There is no way to know the exact output amount before sending a transaction. All output amounts are calculated based on current market conditions and are subject to change until the transaction is executed. You can control how much the output amount can vary compared to the expected amount by setting the `slippage` parameter. #### **Q: Why do I get different results each time I call the same endpoint?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-why-do-i-get-different-results-each-time-i-call-the-same-endpoint "Direct link to q-why-do-i-get-different-results-each-time-i-call-the-same-endpoint") A: Market conditions change constantly. Each call reflects the current state of liquidity pools and aggregator routes. #### **Q: Do I need to approve tokens before using the Hosted SDK?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-do-i-need-to-approve-tokens-before-using-the-hosted-sdk "Direct link to q-do-i-need-to-approve-tokens-before-using-the-hosted-sdk") A: Short answer: no. Long answer: yes. * Short answer: You don't need to approve or have enough token balance to call the Hosted SDK API. * Long answer: The Hosted SDK tries its best to return the most accurate route by simulating all the routes it generates. However, if you don't have enough tokens or approvals, the SDK can't simulate the call, and the returned route will be a preview route, which could differ from the actual route. In short: if you have sufficient approval and balance, the SDK will be able to simulate the transaction, resulting in a more accurate route. Otherwise, all routes are preview routes. Also, the API response includes a `requiredApprovals` field listing tokens that need approval. Approve these tokens to the router contract before sending your transaction. #### **Q: How do I reduce Computing Unit costs when using aggregators?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-how-do-i-reduce-computing-unit-costs-when-using-aggregators "Direct link to q-how-do-i-reduce-computing-unit-costs-when-using-aggregators") A: Obtain API keys from aggregator partners (KyberSwap, Odos, OKX) and pass them in request headers. This reduces that aggregator's CU cost to 0. See [Reducing Aggregator Costs](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#reduce-aggregator-computing-units) . #### **Q: What happens if I don't specify which aggregators to use?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-what-happens-if-i-dont-specify-which-aggregators-to-use "Direct link to q-what-happens-if-i-dont-specify-which-aggregators-to-use") A: If `enableAggregator=true` but no `aggregators` parameter is provided, a preset set of aggregators will be used, which may change over time for optimization. #### **Q: Can I swap any PT to any other PT?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-can-i-swap-any-pt-to-any-other-pt "Direct link to q-can-i-swap-any-pt-to-any-other-pt") A: Not all PT pairs are swappable. Try using the Convert API. If the swap is not supported, the API will return an error. #### **Q: What does the `needScale` parameter do?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-what-does-the-needscale-parameter-do "Direct link to q-what-does-the-needscale-parameter-do") A: Set `needScale=true` only when your input amounts are updated on-chain (e.g., using contract balance). When enabled, buffer your input amount by ~2% to account for changes during transaction execution. Only applicable to swap actions. #### **Q: What is `priceImpact` and does it include slippage?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-what-is-priceimpact-and-does-it-include-slippage "Direct link to q-what-is-priceimpact-and-does-it-include-slippage") A: `priceImpact` is the effect your trade size has on the market price - it's included in the output amount. **Slippage** is different - it's caused by market movement between API call and transaction execution. You set `slippage` parameter as maximum tolerance (e.g., 0.01 = 1%). See the Pendle API documentation for more details on the difference between price impact and slippage. #### **Q: What's the difference between "Add liquidity" and "Add liquidity ZPI"?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-whats-the-difference-between-add-liquidity-and-add-liquidity-zpi "Direct link to q-whats-the-difference-between-add-liquidity-and-add-liquidity-zpi") A: * **Add liquidity**: Adds liquidity and receives only LP tokens * **Add liquidity ZPI** (Zero Price Impact): Adds liquidity while keeping the generated YT tokens #### **Q: Can I transfer liquidity between different pools?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-can-i-transfer-liquidity-between-different-pools "Direct link to q-can-i-transfer-liquidity-between-different-pools") A: Yes! Use the Convert API with your current position (LP + PT + YT) as `tokensIn` and the target market as `tokensOut`. #### **Q: What contract is the `to` address in the transaction response?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-what-contract-is-the-to-address-in-the-transaction-response "Direct link to q-what-contract-is-the-to-address-in-the-transaction-response") A: The `to` address is typically the Pendle Router contract. This contract is upgradeable, so the address may change over time. Always use the address returned by the API - never hardcode it. #### **Q: How do I decode the transaction data to see what function is being called?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-how-do-i-decode-the-transaction-data-to-see-what-function-is-being-called "Direct link to q-how-do-i-decode-the-transaction-data-to-see-what-function-is-being-called") A: The response includes `contractParamInfo` with: * `method`: Function name (e.g., `"swapExactTokenForPt"`) * `contractCallParamsName`: Parameter names * `contractCallParams`: Parameter values console.log('Method:', response.contractParamInfo.method);console.log('Params:', response.contractParamInfo.contractCallParams); #### **Q: Is the router address guaranteed to stay the same?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-is-the-router-address-guaranteed-to-stay-the-same "Direct link to q-is-the-router-address-guaranteed-to-stay-the-same") A: No, the router may be updated for protocol improvements. Always use the `tx.to` address from the API response. Changes will be announced publicly via the [Telegram Developer Channel](https://t.me/pendledevelopers) . #### **Q: Can I use the same transaction data multiple times?**[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#q-can-i-use-the-same-transaction-data-multiple-times "Direct link to q-can-i-use-the-same-transaction-data-multiple-times") A: No. Transaction data is specific to current market conditions. Always generate fresh transaction data immediately before sending. Reusing old data will likely fail or give suboptimal results. * [Understanding Pendle's API System](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#understanding-pendles-api-system) * [1\. Hosted SDK (Transaction Generation)](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#1-hosted-sdk-transaction-generation) * [2\. Backend API (Data Queries)](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#2-backend-api-data-queries) * [API Entry Points](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#api-entry-points) * [Cross-chain endpoints (recommended)](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#cross-chain-endpoints-recommended) * [Chain-scoped endpoints — `/{version}/{chainId}/...`](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#chain-scoped-endpoints--versionchainid) * [BFF API — `https://api-v2.pendle.finance/bff`](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#bff-api--httpsapi-v2pendlefinancebff) * [Rate Limiting](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limiting) * [How Rate Limiting Works](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#how-rate-limiting-works) * [Best Practices for Rate Limiting](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#best-practices-for-rate-limiting) * [I get rate limited, what should I do?](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#i-get-rate-limited-what-should-i-do) * [API Pricing Plans](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#api-pricing-plans) * [How to get an API key](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#how-to-get-an-api-key) * [API Updates and Deprecation](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#api-updates-and-deprecation) * [vePENDLE Deprecation](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#vependle-deprecation) * [sPENDLE API Endpoints](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#spendle-api-endpoints) * [GET /v1/spendle/data](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#get-v1spendledata) * [GET /v1/spendle/](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#get-v1spendle) * [Dashboard Endpoints](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#dashboard-endpoints) * [GET /v1/dashboard/merkle-rewards/](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#get-v1dashboardmerkle-rewards) * [Code Examples and Resources](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#code-examples-and-resources) * [Official Examples](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#official-examples) * [Getting Help](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#getting-help) * [Frequently Asked Questions](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#frequently-asked-questions) * [Hosted SDK FAQ](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#hosted-sdk-faq) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # PT | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/PT#__docusaurus_skipToContent_fallback) On this page Principal Token (PT) represents the principal portion of an underlying yield-bearing asset — essentially a zero-coupon bond on the underlying asset. Upon maturity, PT can be redeemed at 1:1 for the accounting asset, which appears in brackets at the end of each PT name. This is the base, principal asset deployed in the underlying protocol such as Lido, Renzo, and Aave (e.g. stETH in stETH, ETH in ezETH, USDC in aUSDC). ![PT Mechanics](https://docs.pendle.finance/assets/images/pt-mechanics-570352369debc97eca60acff6fdbe73e.png "PT Mechanics") Since the collective value of its yield component has been separated, PT can be acquired at a discount relative to its accounting asset. Assuming no swaps, the value of PT will approach and ultimately match the value of accounting asset on maturity when redemption is enabled. This appreciation in value is what establishes its Fixed Yield APY. Key Properties * **No Variable Yield or Points:** PT holders forgo all variable yield and points generated by the underlying asset — these are redirected entirely to YT holders. * **Use as Collateral:** PTs are increasingly used as collateral in money markets (e.g., Morpho, Silo, Euler) due to their predictable value at maturity, which minimizes liquidation risk from market price volatility. See [PT as Collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral) for integration details. Redemption Value ================ In general, yield bearing assets can be broadly categorized as: 1. Rebasing assets - tokens that increase in count/number overtime as yield is accrued _Examples: stETH, aUSDC_ 2. Interest-bearing assets - tokens that increase in value overtime as yield is accrued _Examples: ezETH, wstETH_ ![Redemption Value](https://docs.pendle.finance/assets/images/redemption-value-5a9cc135d827dacc111106a846d51eb4.png "Redemption Value") In the case of reward-bearing assets, it’s particularly important to note that PT is redeemable 1:1 for the accounting asset, _NOT_ the \*\*underlying asset. For example, the value of Renzo ezETH increases overtime relative to ETH as staking and restaking rewards are accrued. For every 1 PT-ezETH you own, you’ll be able to redeem 1 ETH worth of ezETH upon maturity, _NOT_ 1 ezETH which has a higher value\*\*.\*\* You can refer to the asset in brackets in the market name to identify the accounting asset (e.g. PT-ezETH (ETH) means 1 PT redeems to 1 ETH worth of ezETH). You can also double-check the redemption value of PT on [Pendle App](https://app.pendle.finance/trade/markets) 's individual asset pages. How to Redeem PT ================ To redeem your PT on maturity: 1. Visit [Pendle Markets](https://app.pendle.finance/trade/markets) and navigate to dashboard 2. Select the position you want to redeem. 3. Select an output asset. Pendle will automatically perform Redemption > Swap (if needed) for you Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Points & Rewards Tracking | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#__docusaurus_skipToContent_fallback) On this page This guide covers how partner protocols can track and distribute points-based rewards (e.g., EigenLayer points, Renzo Miles, Ethena Sats) to Pendle users. Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#overview "Direct link to Overview") ---------------------------------------------------------------------------------------------------------------------------- Many Pendle pools offer additional rewards in the form of points from integrated protocols. Pendle provides standardized tools to help partners manage the complexity of tracking points across YT holders, LP positions, and liquid lockers. The Balance Fetcher[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#the-balance-fetcher "Direct link to The Balance Fetcher") ------------------------------------------------------------------------------------------------------------------------------------------------------------- The recommended approach for tracking points is to use the **[`pendle-generic-balance-fetcher`](https://github.com/Pendle-Finance-Periphery/pendle-generic-balance-fetcher) ** script. ### Core Functionality[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#core-functionality "Direct link to Core Functionality") The script returns a user's balance snapshot at a specific block height. The output is a mapping of `user_address => implied_yield_share`, representing each user's proportional share of the underlying asset held in the SY contract. ### What It Handles[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#what-it-handles "Direct link to What It Handles") The balance fetcher correctly accounts for all of Pendle's internal nuances: | Factor | How it's handled | | --- | --- | | **LP Boosting** | Applies the yield boost (up to 2.5x) for eligible stakers | | **YT Fee** | Accounts for the 5% fee applied to YT yields, allocated to the protocol | | **Liquid Lockers** | Integrates with APIs from Penpie and Equilibria to track end-user balances within their contracts | | **Post-Expiry** | Correctly attributes points for expired but unredeemed positions | ### Partner Responsibility[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#partner-responsibility "Direct link to Partner Responsibility") The partner protocol is responsible for: 1. Running the balance fetcher script 2. Using the output to calculate the pro-rata distribution of points 3. Displaying it on their own dashboard Pendle does **not** handle the final distribution of partner points. Points Calculation Logic[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#points-calculation-logic "Direct link to Points Calculation Logic") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### YT Holders[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#yt-holders "Direct link to YT Holders") For point calculation purposes, **1 YT is treated as equivalent to 1 unit of the underlying SY asset**, regardless of the YT's market price. It earns the same amount of points as if you were holding the full underlying asset. A **5% fee** is applied to points earned from YT holdings. This fee is allocated to Pendle governance. ### LP Holders[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#lp-holders "Direct link to LP Holders") For LPs, only the **SY portion** of the LP position earns points. The PT portion does not. The ratio of SY to PT within an LP position is dynamic and changes with every trade. No points fee is applied to LP positions. However, LP point earnings are influenced by the **LP boost** mechanism (up to 2.5x). ### Calculating User Proportion (LP)[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#calculating-user-proportion-lp "Direct link to Calculating User Proportion (LP)") A user's proportional share of a liquidity pool is calculated using `activeBalance`: User Proportion = activeBalance(user) / totalActiveSupply Query these values from the LP contract: * `LP_Contract.activeBalance(userAddress)` * `LP_Contract.totalActiveSupply()` ### Calculating Total Point-Earning Position[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#calculating-total-point-earning-position "Direct link to Calculating Total Point-Earning Position") To find a user's total point-earning position, sum contributions from YT and LP: **Step 1: YT Contribution** * Get user's YT balance (e.g., 100 YT-ezETH) * Apply 5% fee: `100 × 0.95 = 95` * Point-earning amount from YT = **95 ezETH** **Step 2: LP Contribution** * Calculate user's proportion using the `activeBalance` formula above * Query total SY in LP: `SY_Contract.balanceOf(LP_Contract_Address)` * `LP SY Share = User Proportion × Total SY in LP` **Step 3: Total** Total Point-Earning Position = (YT Balance × 0.95) + LP SY Share This final value (in terms of the underlying asset) is used to calculate the user's point allocation. ### Multipliers[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#multipliers "Direct link to Multipliers") Points programs often involve multiple layers of multipliers, which are **multiplicative**: **Example (Zircuit & Renzo Points):** * Zircuit Base: 1x for ETH, 2x for ezETH * Pendle Pool: 2x Zircuit multiplier, 1x Renzo multiplier * **Effective Zircuit Points**: `(2x ETH base) × (2x Pendle) = 4x` the base ETH emission rate * **Effective Renzo Points**: `(1x Renzo base) × (1x Pendle) = 1x` the base Renzo emission rate Eligible Positions[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#eligible-positions "Direct link to Eligible Positions") ---------------------------------------------------------------------------------------------------------------------------------------------------------- Points are allocated to positions with exposure to the underlying yield: | Position Type | Earns Points? | Notes | | --- | --- | --- | | **YT holders** | Yes | Full share (minus 5% fee) corresponding to 1 unit of the underlying asset per YT | | **LP holders** | Yes | Proportional to the SY portion of their LP position only | | **Liquid locker holders** | Yes | Via Penpie, Equilibria, etc. — their underlying position is still an LP token | | **PT holders** | No | PT holders forgo all variable yield and points | LP Boost on Points[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#lp-boost-on-points "Direct link to LP Boost on Points") ---------------------------------------------------------------------------------------------------------------------------------------------------------- The up-to-2.5x boost applies to points earned by the **SY portion of an LP position**. It does **not** apply to points earned by holding YT. Boosting is a **zero-sum redistribution** of rewards within the LP pool. Boosting one user's share means other, non-boosted LPs receive a comparatively smaller share of the total points allocated to the pool's SY component. External Reward Distribution[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#external-reward-distribution "Direct link to External Reward Distribution") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Merkl Integration[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#merkl-integration "Direct link to Merkl Integration") For campaigns that use [Merkl](https://merkl.angle.money/) to distribute rewards, Pendle enables users to claim directly from the Merkl UI. The SY contract can be configured to claim rewards from Merkl and distribute them to end-users. ### Direct Airdrops[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#direct-airdrops "Direct link to Direct Airdrops") Pendle can assist partners by providing necessary user balance data to facilitate direct airdrops. For rewards sent to liquid locker contracts, the liquid locker protocol is responsible for the final distribution. * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#overview) * [The Balance Fetcher](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#the-balance-fetcher) * [Core Functionality](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#core-functionality) * [What It Handles](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#what-it-handles) * [Partner Responsibility](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#partner-responsibility) * [Points Calculation Logic](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#points-calculation-logic) * [YT Holders](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#yt-holders) * [LP Holders](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#lp-holders) * [Calculating User Proportion (LP)](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#calculating-user-proportion-lp) * [Calculating Total Point-Earning Position](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#calculating-total-point-earning-position) * [Multipliers](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#multipliers) * [Eligible Positions](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#eligible-positions) * [LP Boost on Points](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#lp-boost-on-points) * [External Reward Distribution](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#external-reward-distribution) * [Merkl Integration](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#merkl-integration) * [Direct Airdrops](https://docs.pendle.finance/pendle-v2/Developers/Integration/PointsTracking#direct-airdrops) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Quickstart | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#__docusaurus_skipToContent_fallback) On this page Pendle V2 is a yield-trading protocol that lets users split yield-bearing assets into Principal Tokens (PT) and Yield Tokens (YT), trade them on AMM markets, and provide liquidity — all on-chain. The fastest way to start is the off-chain Backend API — no wallet required. Prerequisites[​](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#prerequisites "Direct link to Prerequisites") --------------------------------------------------------------------------------------------------------------------------- * `curl` or any HTTP client (browser, `fetch`, `axios`, etc.) Step 1 — Browse available markets[​](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#step-1--browse-available-markets "Direct link to Step 1 — Browse available markets") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **Endpoint:** `GET https://api-v2.pendle.finance/core/v2/markets/all` Returns all Pendle markets across every supported chain. Supports `skip` and `limit` for pagination (default `limit` is 10, maximum is 100). curl "https://api-v2.pendle.finance/core/v2/markets/all?limit=10&skip=0" const res = await fetch( "https://api-v2.pendle.finance/core/v2/markets/all?limit=10&skip=0");const { markets } = await res.json();console.log(markets); Key fields in each market object: | Field | Description | | --- | --- | | `chainId` | Chain the market is deployed on (e.g., `1` for Ethereum, `42161` for Arbitrum) | | `address` | Market contract address | | `expiry` | Unix timestamp when the market matures | | `impliedApy` | Current implied fixed APY of the market | | `pt.price.usd` | Current PT price in USD | Step 2 — Get market data[​](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#step-2--get-market-data "Direct link to Step 2 — Get market data") ----------------------------------------------------------------------------------------------------------------------------------------------------------- **Endpoint:** `GET https://api-v2.pendle.finance/core/v2/markets/all` Use the `address` field from Step 1 to identify markets of interest. For filtering and additional query options (e.g., by chain, by asset category), see the [full API reference](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview) . The example below fetches all markets on Arbitrum (chainId `42161`) and filters client-side for a known market address: curl "https://api-v2.pendle.finance/core/v2/markets/all?limit=100&skip=0" \ | jq '[.markets[] | select(.chainId == 42161 and .address == "{MARKET_ADDRESS}")]' Replace `{MARKET_ADDRESS}` with the address of the market you want to inspect (obtained from Step 1). Step 3 — Get sPENDLE staking data (optional)[​](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#step-3--get-spendle-staking-data-optional "Direct link to Step 3 — Get sPENDLE staking data (optional)") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **Endpoint:** `GET https://api-v2.pendle.finance/core/v1/spendle/data` curl "https://api-v2.pendle.finance/core/v1/spendle/data" Returns aggregate sPENDLE staking statistics including total PENDLE staked, historical APRs, per-epoch revenues, and airdrop breakdowns for the last 12 epochs. Next steps[​](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#next-steps "Direct link to Next steps") ------------------------------------------------------------------------------------------------------------------ tip * **Full API reference** — endpoint details, query parameters, response schemas: [Backend API Overview](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview) * **On-chain Router** (swaps, add/remove liquidity, mint/redeem): [Pendle Router Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview) * **Deployed contract addresses** — all chains and environments: [Deployments](https://docs.pendle.finance/pendle-v2/Developers/Deployments) * **Developer support** — questions, announcements, deprecation notices: [t.me/pendledevelopers](https://t.me/pendledevelopers) * [Prerequisites](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#prerequisites) * [Step 1 — Browse available markets](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#step-1--browse-available-markets) * [Step 2 — Get market data](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#step-2--get-market-data) * [Step 3 — Get sPENDLE staking data (optional)](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#step-3--get-spendle-staking-data-optional) * [Next steps](https://docs.pendle.finance/pendle-v2/Developers/Quickstart#next-steps) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Points Support Page | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#__docusaurus_skipToContent_fallback) On this page Self-service[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#self-service "Direct link to Self-service") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ [### YT / PT / LP](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#yt-pt-lp) [### Risks](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#risks) [### Balance is Down](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#balance-is-down) [### Points Related](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#points-related) [### Zero Price Impact LP](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#zero-price-impact-lp) [### LRT on Arbitrum](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#lrt-on-arbitrum) [### Capped Assets](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#usde-cap) [### Others](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#others) FAQ[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#faq "Direct link to FAQ") --------------------------------------------------------------------------------------------------------------------------------------- ### YT / PT / LP[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#yt-pt-lp "Direct link to YT / PT / LP") #### 1\. What are the differences between YT, PT and LP?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-what-are-the-differences-between-yt-pt-and-lp "Direct link to 1. What are the differences between YT, PT and LP?") Pendle splits a yield-bearing asset (eETH, stETH, GLP, etc) into 2 parts, **YT** (Yield Token) and **PT** (Principal Token). These 2 components can be traded on Pendle and trading is facilitated by **LP**s (Liquidity Providers). YT and PT are the 2 fundamental concepts in Pendle. To learn more about them in LRT's context, check out [#definition](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/#definition "mention") . #### 2\. Can I swap between PT and YT?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-can-i-swap-between-pt-and-yt "Direct link to 2. Can I swap between PT and YT?") Yes. #### 3\. Why does YT have a negative long-yield APY?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#3-why-does-yt-have-a-negative-long-yield-apy "Direct link to 3. Why does YT have a negative long-yield APY?") The negative long-yield APY is because you are paying more vs what you're getting in yield. But note that in LRT's case, YT receives points, which have unknown values (Pendle assumes 0 value for points). Since YT’s cost is higher than the estimated yield-receivables from the current underlying APY, long-yield APY is displaying a negative value. Check out [#long-yield-apy](https://docs.pendle.finance/pendle-academy/optimizing-yields-with-pendle/chapter-5-important-concepts-in-yield-trading#long-yield-apy "mention") to learn more about long-yield APY. #### 4\. Do I have to hold until maturity?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#4-do-i-have-to-hold-until-maturity "Direct link to 4. Do I have to hold until maturity?") No. But see [#risks](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#risks "mention") , might be relevant for you. #### 5\. Does 1 PT-weETH redeem 1 weETH or 1 eETH at maturity?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#5-does-1-pt-weeth-redeem-1-weeth-or-1-eeth-at-maturity "Direct link to 5. Does 1 PT-weETH redeem 1 weETH or 1 eETH at maturity?") 1 PT-weETH represents the principal of 1 eETH (which is pegged to ETH). So at maturity, 1 PT-weETH redeems 1 eETH, but is given in weETH (whatever the exchange rate between weETH and eETH is then). One way to easily visualize it is that **1 PT-LRT will be redeemable for 1 ETH** at maturity, given in its yield-bearing form (weETH, rsETH, ezETH, etc). #### 6\. What exactly does 1 PT / YT represent?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#6-what-exactly-does-1-pt--yt-represent "Direct link to 6. What exactly does 1 PT / YT represent?") It might differ by assets, refer to the asset description in the app (above its price chart) for its exact representation. See below for an example with Ethena's sUSDe. ![](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources//pendle-academy/imgs/image%20(123).png) ### Risks[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#risks "Direct link to Risks") #### 1\. What are the risks?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-what-are-the-risks "Direct link to 1. What are the risks?") **Smart contract risks are to be expected in any DeFi protocol.** **YT**: The value of the received points and yield might not offset the cost you paid to buy YT. **PT**: Holding to maturity has no price risk, where you will be able to redeem for the full underlying asset. Exiting before maturity may expose you to price risk (i.e. YT and PT's implied yield fluctuates, which may lead to a difference in value when exiting your position). However, you are still exposed to underlying price risk, i.e. underlying depegs, extreme price movements, etc. **LP**: Holding to maturity has no price risk, where you will be able to redeem for the full underlying asset. Exiting before maturity may expose you to price risk (i.e. YT and PT's implied yield fluctuates, which may lead to a difference in value when exiting your position). However, you are still exposed to underlying price risk, i.e. underlying depegs, extreme price movements, etc. #### 2\. What happens if EigenLayer (or the LRT projects) stops distributing points?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-what-happens-if-eigenlayer-or-the-lrt-projects-stops-distributing-points "Direct link to 2. What happens if EigenLayer (or the LRT projects) stops distributing points?") Pendle still functions as normal. In a nutshell, Pendle streams the points and yields to YT holders. If the underlying projects stop distributing points, YT holders (and LPs) stop earning points too. In a rational market, we would expect: * YT's value to decline as it is now worth less (no more points to receive). * PT's value to rise, as YT's value declines (note that PT+YT = underlying) #### 3\. Are Points guaranteed to translate to airdrops?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#3-are-points-guaranteed-to-translate-to-airdrops "Direct link to 3. Are Points guaranteed to translate to airdrops?") No. It depends on the underlying protocols to decide what to grant the points for. Pendle is simply a tool to manage your points exposure. * * * ### Balance is down[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#balance-is-down "Direct link to Balance is down") #### 1\. My YT balance is down, what is going on?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-my-yt-balance-is-down-what-is-going-on "Direct link to 1. My YT balance is down, what is going on?") That means YT's price is down. See [#id-1.-what-are-the-risks](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-what-are-the-risks "mention") for a list of risks. YT's price fluctuates based on market valuation. YT's value is derived from its yields and points receivables. If the market thinks its future yields and points are worth more than what YT is trading at, YT should see demand, driving its price up, and vice-versa. That said, YT price naturally declines to zero at maturity while it earns yields and points from the underlying LRT. Because the $ value of points is unknown, Pendle assumes 0 value, hence your YT PnL will be deep in the negatives in the Pendle dashboard. Learn more at [#id-3.-why-does-yt-have-a-negative-long-yield-apy](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#3-why-does-yt-have-a-negative-long-yield-apy "mention") #### 2\. My PT balance is down, what is going on?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-my-pt-balance-is-down-what-is-going-on "Direct link to 2. My PT balance is down, what is going on?") That means PT's price is down. See [#id-1.-what-are-the-risks](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-what-are-the-risks "mention") for a list of risks. PT's price fluctuates based on market valuation. **However, at maturity PTs will be worth its guaranteed value**. This means that over time, each PT will appreciate toward that value, with some fluctuations in between. PT price gain is guaranteed at maturity, barring any smart contract risk. #### 3\. My LP balance is down, what is going on?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#3-my-lp-balance-is-down-what-is-going-on "Direct link to 3. My LP balance is down, what is going on?") First of all, DYOR, you should know what you're providing liquidity for. Learn more about liquidity provision at [chapter-7-providing-liquidity-while-trading-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield "mention") . In short, liquidity provision is done in SY and PT. (e.g SY-eETH and PT-eETH, where SY is simply a wrapped version of the yield-bearing asset to be compatible with Pendle). LP's value can have a temporary decline because of impermanent loss (IL), but there will be no IL at maturity. How? If PT's value declines, LP's balance declines alongside it as well as it comprises of partly PT. But note that PT's final value is known as it is a fixed yield position (See [here](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#yt-pt-lp) and [here](https://docs.pendle.finance/pendle-academy/cheatsheet-for-the-impatient/pt-yt-lp-cheatsheet) to learn what PT is). This means **at maturity, there will be NO IL for LPs on Pendle**. There will be short-term fluctuations, but a long enough timeframe should result in a net-positive position. * * * ### Points Related[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#points-related "Direct link to Points Related") #### 1\. Do I get points when I deposit my LP tokens to Penpie and Equilibria?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-do-i-get-points-when-i-deposit-my-lp-tokens-to-penpie-and-equilibria "Direct link to 1. Do I get points when I deposit my LP tokens to Penpie and Equilibria?") Yes. Points are boosted as well if you deposit to liquid lockers like Penpie and Equilibria. #### 2\. Where can I see my points? How do I know it is accruing?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-where-can-i-see-my-points-how-do-i-know-it-is-accruing "Direct link to 2. Where can I see my points? How do I know it is accruing?") You can track your EigenLayer and native protocol points over at the respective protocol's dashboard: * eETH Ether.fi (ETH network): [https://app.ether.fi/portfolio](https://app.ether.fi/portfolio) * rsETH - KelpDAO: [https://kelpdao.xyz/dashboard/](https://kelpdao.xyz/dashboard/) * ezETH - Renzo [https://app.renzoprotocol.com/portfolio](https://app.renzoprotocol.com/portfolio) New pool launches might take a while for the respective teams to build the dashboard. Please be patient, your points are accruing in the meantime, just not showing in the dashboard at the moment. Any dispute should be done in the respective protocol's channel. Pendle is simply a protocol to trade yields (and points). The points tracking is eventually at the underlying protocol's discretion. #### 3\. How does Pendle enable leveraged points for YT?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#3-how-does-pendle-enable-leveraged-points-for-yt "Direct link to 3. How does Pendle enable leveraged points for YT?") Note that Pendle does NOT give nor generate additional points to enable YT's leverage. Pendle simply streams points from the underlying to YT holders. To learn more, see [here](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/) and [here](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-8-long-yield-obtain-leveraged-yield-exposure) . #### 4\. How often do points accrue? [​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#4-how-often-do-points-accrue- "Direct link to 4. How often do points accrue? ") It varies by protocol, check again after 1 day. For newer markets, it might take a while for the respective teams to build the dashboard. Please be patient, your points are accruing in the meantime, just not showing in the dashboard at the moment. #### 5\. My points are not showing, what do I do?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#5-my-points-are-not-showing-what-do-i-do "Direct link to 5. My points are not showing, what do I do?") If you purchased PT, you are not getting points. If you purchased YT or provided liquidity, you ARE earning points. Do give it a while for the respective dashboard to show. For newer markets, it might take a while for the respective teams to build the dashboard. Please be patient. #### 6\. Do I earn Eigenlayer points when I deposit my LRTs on Pendle on Arbitrum?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#6-do-i-earn-eigenlayer-points-when-i-deposit-my-lrts-on-pendle-on-arbitrum "Direct link to 6. Do I earn Eigenlayer points when I deposit my LRTs on Pendle on Arbitrum?") Yes. However, it is up to the underlying protocol to continue streaming rewards and points on Arbitrum. * * * ### Zero Price Impact LP[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#zero-price-impact-lp "Direct link to Zero Price Impact LP") #### 1\. What is the difference between when I provide liquidity with Zero Price Impact on vs off?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-what-is-the-difference-between-when-i-provide-liquidity-with-zero-price-impact-on-vs-off "Direct link to 1. What is the difference between when I provide liquidity with Zero Price Impact on vs off?") Learn more on how liquidity provision works: [https://docs.pendle.finance/AppGuide/Pool](https://docs.pendle.finance/AppGuide/Pool) Without ZPI, you are providing liquidity with 100% of your capital. LPs consist of PT and its underlying (wrapped in [SY](https://docs.pendle.finance/ProtocolMechanics/YieldTokenization/SY) ). Note that PT does not earn points. With ZPI toggled on, Pendle retains your YT exposure in your LP process. (i.e. YT is not sold for additional LP -> hence no price impact). This results in less yield as you have less position in LP (since some capital is retained in YT). The amount of YTs that is retained in this process is equivalent to the amount of PTs in your LP position. **This means that ZPI mode retains most of your points exposure while earning yields from swap fees and Pendle incentives.** Note that PT's fixed yield is offset by YT's price decay at maturity. #### 2\. I forgot to turn on ZPI when I provide liquidity, how do I earn the full points exposure?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-i-forgot-to-turn-on-zpi-when-i-provide-liquidity-how-do-i-earn-the-full-points-exposure "Direct link to 2. I forgot to turn on ZPI when I provide liquidity, how do I earn the full points exposure?") See FAQ #4, If you did not turn on ZPI, your YT is sold for more LPs. In this case, the most efficient way to obtain back your points exposure is to **buy more YT**. You can buy an equivalent amount of YT to the PT in your LP position. You can find the LP composition in the Pool page (eETH example: [https://app.pendle.finance/trade/pools/0xf32e58f92e60f4b0a37a69b95d642a471365eae8/zap/in?chain=ethereum](https://app.pendle.finance/trade/pools/0xf32e58f92e60f4b0a37a69b95d642a471365eae8/zap/in?chain=ethereum) ) ![](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources//pendle-academy/imgs/image%20(122).png) With basic math, you can calculate the amount of PT in your LP holdings and purchase an equivalent amount of YT to regain full points exposure. #### 3\. This is all so confusing! Where can I learn more?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#3-this-is-all-so-confusing-where-can-i-learn-more "Direct link to 3. This is all so confusing! Where can I learn more?") Check out [chapter-7-providing-liquidity-while-trading-yield.md](https://docs.pendle.finance/pendle-academy/yield-trading-deep-dives/chapter-7-providing-liquidity-while-trading-yield "mention") for all you need to know about liquidity provision. * * * ### LRT on Arbitrum[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#lrt-on-arbitrum "Direct link to LRT on Arbitrum") #### 1\. How do I bridge LRTs to Arbitrum?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-how-do-i-bridge-lrts-to-arbitrum "Direct link to 1. How do I bridge LRTs to Arbitrum?") Only use the bridges for the respective assets **Bridging weETH:** Use Arbitrum's native bridge ([https://bridge.arbitrum.io/](https://bridge.arbitrum.io/) ) to bridge weETH from Ethereum to Arbitrum. _ONLY BRIDGE weETH, NOT eETH. Wrap your eETH to weETH at_ [_https://app.ether.fi/eeth/wrap_](https://app.ether.fi/eeth/wrap) **Bridging rsETH:** Use Kelp's bridge, powered by LayerZero ([https://bridge.kelpdao.xyz/](https://bridge.kelpdao.xyz/) ) to bridge rsETH from Ethereum to Arbitrum. _If you used the native Arbitrum bridge, you have to bridge it back to Ethereum, which takes 7 days._ Bridging ezETH: Use connext ([https://bridge.connext.network/EZETH-from-ethereum-to-arbitrum?symbol=ezETH](https://bridge.connext.network/EZETH-from-ethereum-to-arbitrum?symbol=ezETH) ) to bridge ezETH from Ethereum to Arbitrum. _If you used the native Arbitrum bridge, you have to bridge it back to Ethereum, which takes 7 days._ #### 2\. Do I earn EigenLayer points on Arbitrum?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-do-i-earn-eigenlayer-points-on-arbitrum "Direct link to 2. Do I earn EigenLayer points on Arbitrum?") Yes. If the underlying LRT gives points on Ethereum, it will behave the same way on Arbitrum. * * * ### Capped Assets[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#capped-assets "Direct link to Capped Assets") #### 1\. What happens if the asset reaches cap on Pendle?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-what-happens-if-the-asset-reaches-cap-on-pendle "Direct link to 1. What happens if the asset reaches cap on Pendle?") You will not be able to purchase YT/PT/LP with assets from outside of Pendle. You can still exit YT/PT/LP position into other assets but re-entering will not be possible if the cap fills after you exit. #### 2\. Why are some assets capped on Pendle?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-why-are-some-assets-capped-on-pendle "Direct link to 2. Why are some assets capped on Pendle?") The caps are enforced by the underlying protocols. * * * ### Others[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#others "Direct link to Others") #### 1\. Do I have to stake anything?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#1-do-i-have-to-stake-anything "Direct link to 1. Do I have to stake anything?") No. If you're holding YT, PT, or provided liquidity, you will receive whatever the assets give you without the need to stake anything. #### 2\. My question is not answered here, what do I do?[​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#2-my-question-is-not-answered-here-what-do-i-do "Direct link to 2. My question is not answered here, what do I do?") Use the search function Pendle's discord. Your questions have very likely been asked and answered before. If not, we appreciate questions from a new angle! #### 3\. Is Ether.fi / Renzo affected by EigenLayer caps? [​](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#3-is-etherfi--renzo-affected-by-eigenlayer-caps- "Direct link to 3. Is Ether.fi / Renzo affected by EigenLayer caps? ") No, ezETH & eETH are natively restaked, there are no caps. * [Self-service](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#self-service) * [FAQ](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#faq) * [YT / PT / LP](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#yt-pt-lp) * [Risks](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#risks) * [Balance is down](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#balance-is-down) * [Points Related](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#points-related) * [Zero Price Impact LP](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#zero-price-impact-lp) * [LRT on Arbitrum](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#lrt-on-arbitrum) * [Capped Assets](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#capped-assets) * [Others](https://docs.pendle.finance/pendle-academy/ecosystem-and-resources/points-trading/points-support-page#others) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Hosted SDK | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#__docusaurus_skipToContent_fallback) On this page Pendle accommodates a vast array of assets, each characterized by its unique nuances and complexities. While the Pendle protocol remains immutable, the underlying assets don't share this feature, requiring our app and SDK to be updated frequently to align with changes in these assets. To address this, Pendle has introduced a hosted version of our SDK. It ensures the output remains consistent with Pendle's UI and keeps up-to-date with the latest protocol changes. The API design prioritizes simplicity and stability, with a high rate limit to meet the needs of most users. Getting Started[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#getting-started "Direct link to Getting Started") ---------------------------------------------------------------------------------------------------------------------------------------- **Base URL:** `https://api-v2.pendle.finance/core` Most SDK operations go through a single universal endpoint — the [Convert API](https://api-v2.pendle.finance/core/docs#/SDK/SdkController_convert) : GET /v2/sdk/{chainId}/convert?tokensIn=...&tokensOut=...&amountsIn=...&receiver=...&slippage=... The code examples on this page use a `callSDK` helper function that wraps HTTP requests to the base URL. A complete implementation can be found in the [Convert API demo repository](https://github.com/pendle-finance/pendle-examples-public/tree/main/hosted-sdk-demo/src) . For API rate limits and computing unit costs, see [API Overview](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limiting) . Supported functions[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#supported-functions "Direct link to Supported functions") ---------------------------------------------------------------------------------------------------------------------------------------------------- * Swap * Add liquidity * Add liquidity ZPI * Remove liquidity * Mint PT & YT * Redeem PT & YT * Transfer liquidity * Transfer liquidity ZPI * Roll over PT * Add liquidity dual * Remove liquidity dual * Mint SY * Redeem SY All actions above can be accessed via one universal [Convert API](https://api-v2.pendle.finance/core/docs#/SDK/SdkController_convert) . Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#examples "Direct link to Examples") ------------------------------------------------------------------------------------------------------------------- ### Swap[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#swap "Direct link to Swap") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&tokensOut=0xf99985822fb361117fcf3768d34a6353e6022f5f&amountsIn=1000000000&enableAggregator=true&aggregators=kyberswap&additionalData=impliedApy,effectiveApy In code: export async function swapTokenToPt() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${USDC_ADDRESS}`, amountsIn: 1000000000, tokensOut: `${PT_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, enableAggregator: true, aggregators: "kyberswap", additionalData: "impliedApy,effectiveApy", });} ### Add liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#add-liquidity "Direct link to Add liquidity") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&tokensOut=0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2&amountsIn=1000000000000000000 In code: export async function addLiquiditySingleToken() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${WSTETH_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${MARKET_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} ### Add liquidity ZPI[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#add-liquidity-zpi "Direct link to Add liquidity ZPI") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&tokensOut=0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2,0xf3abc972a0f537c1119c990d422463b93227cd83&amountsIn=1000000000000000000 In code: export async function addLiquiditySingleTokenKeepYt() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${WSTETH_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${MARKET_ADDRESS},${YT_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} ### Remove liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#remove-liquidity "Direct link to Remove liquidity") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2&tokensOut=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&amountsIn=1000000000000000000&enableAggregator=true In code: export async function removeLiquiditySingleToken() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${MARKET_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${WSTETH_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, enableAggregator: true, });} ### Mint PT & YT[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#mint-pt--yt "Direct link to Mint PT & YT") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&tokensOut=0xf99985822fb361117fcf3768d34a6353e6022f5f,0xf3abc972a0f537c1119c990d422463b93227cd83&amountsIn=1000000000000000000 In code: export async function mintPyFromToken() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${WSTETH_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${PT_ADDRESS},${YT_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} ### Redeem PT & YT[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#redeem-pt--yt "Direct link to Redeem PT & YT") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0xf99985822fb361117fcf3768d34a6353e6022f5f,0xf3abc972a0f537c1119c990d422463b93227cd83&tokensOut=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&amountsIn=1000000000000000000,1000000000000000000 In code: export async function redeemPyToToken() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${PT_ADDRESS},${YT_ADDRESS}`, amountsIn: "1000000000000000000,1000000000000000000", tokensOut: `${WSTETH_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} ### Transfer liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#transfer-liquidity "Direct link to Transfer liquidity") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0x9bc2fb257e00468fe921635fe5a73271f385d0eb,0x21aace56a8f21210b7e76d8ef1a77253db85bf0a,0x3787c19c32e727310708c0693aec00fb37a01e7b&tokensOut=0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2&amountsIn=1000000000000000000,1000000000000000000,1000000000000000000&enableAggregator=true&aggregators=kyberswap In code: export async function transferLiquidity() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${FXSAVE_MARKET_ADDRESS},${FXSAVE_PT_ADDRESS},${FXSAVE_YT_ADDRESS}`, amountsIn: "1000000000000000000,1000000000000000000,1000000000000000000", tokensOut: `${MARKET_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, enableAggregator: true, aggregators: "kyberswap", });} ### Transfer liquidity ZPI[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#transfer-liquidity-zpi "Direct link to Transfer liquidity ZPI") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0x9bc2fb257e00468fe921635fe5a73271f385d0eb,0x21aace56a8f21210b7e76d8ef1a77253db85bf0a,0x3787c19c32e727310708c0693aec00fb37a01e7b&tokensOut=0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2,0xf3abc972a0f537c1119c990d422463b93227cd83&amountsIn=1000000000000000000,1000000000000000000,1000000000000000000&enableAggregator=true&aggregators=kyberswap In code: export async function transferLiquidityKeepYt() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${FXSAVE_MARKET_ADDRESS},${FXSAVE_PT_ADDRESS},${FXSAVE_YT_ADDRESS}`, amountsIn: "1000000000000000000,1000000000000000000,1000000000000000000", tokensOut: `${MARKET_ADDRESS},${YT_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, enableAggregator: true, aggregators: "kyberswap", });} ### Roll over PT[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#roll-over-pt "Direct link to Roll over PT") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0x21aace56a8f21210b7e76d8ef1a77253db85bf0a&tokensOut=0xf99985822fb361117fcf3768d34a6353e6022f5f&amountsIn=1000000000000000000&enableAggregator=true In code: export async function rollOverPt() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${FXSAVE_PT_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${PT_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, enableAggregator: true, });} ### Add liquidity dual[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#add-liquidity-dual "Direct link to Add liquidity dual") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0xcbc72d92b2dc8187414f6734718563898740c0bc,0xf99985822fb361117fcf3768d34a6353e6022f5f&tokensOut=0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2&amountsIn=1000000000000000000,1000000000000000000 In code: export async function addLiquidityDualSyAndPt() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${SY_ADDRESS},${PT_ADDRESS}`, amountsIn: "1000000000000000000,1000000000000000000", tokensOut: `${MARKET_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} ### Remove liquidity dual[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#remove-liquidity-dual "Direct link to Remove liquidity dual") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0xc374f7ec85f8c7de3207a10bb1978ba104bda3b2&tokensOut=0xf99985822fb361117fcf3768d34a6353e6022f5f,0xcbc72d92b2dc8187414f6734718563898740c0bc&amountsIn=1000000000000000000 In code: export async function removeLiquidityDualSyAndPt() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${MARKET_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${PT_ADDRESS},${SY_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} ### Mint SY[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#mint-sy "Direct link to Mint SY") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&tokensOut=0xcbc72d92b2dc8187414f6734718563898740c0bc&amountsIn=1000000000000000000 In code: export async function mintSyFromToken() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${WSTETH_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${SY_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} ### Redeem SY[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#redeem-sy "Direct link to Redeem SY") GET https://api-v2.pendle.finance/core/v2/sdk/1/convert?receiver=&slippage=0.01&tokensIn=0xcbc72d92b2dc8187414f6734718563898740c0bc&tokensOut=0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0&amountsIn=1000000000000000000 In code: export async function redeemSyToToken() { const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${SY_ADDRESS}`, amountsIn: "1000000000000000000", tokensOut: `${WSTETH_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, });} Send Transaction[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#send-transaction "Direct link to Send Transaction") ------------------------------------------------------------------------------------------------------------------------------------------- After calling any of the Convert API functions above, you can inspect the response and send the transaction: const res: ConvertResponse;// Log the action and outputsconsole.log("Action: ", res.action);console.log("Outputs: ", res.routes[0].outputs);// Send the transactiongetSigner().sendTransaction(res.routes[0].tx); Please visit our [Convert API demo](https://github.com/pendle-finance/pendle-examples-public/tree/main/hosted-sdk-demo/src) to see more detailed examples. ### Inputs[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#inputs "Direct link to Inputs") The Convert API accepts the following input parameters: | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `tokensIn` | string | Yes | \- | Array of input token addresses (comma-separated) | | `amountsIn` | string | Yes | \- | Array of input token amounts in wei (comma-separated) | | `tokensOut` | string | Yes | \- | Array of expected output token addresses (comma-separated) | | `receiver` | string | Yes | \- | Address to receive the output tokens | | `slippage` | number | Yes | \- | Maximum slippage tolerance (0-1, where 0.01 = 1%) | | `enableAggregator` | boolean | No | `false` | Enable swap aggregators for token conversions | | `aggregators` | string | No | \- | Specific aggregators to use (comma-separated), see [Routing](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#routing) | | `redeemRewards` | boolean | No | `false` | Whether to redeem rewards during the action, applicable to actions: `transfer-liquidity` | | `needScale` | boolean | No | `false` | Aggregator needScale parameter, only set to true when amounts are updated on-chain. When enabled, please make sure to buffer the input amount by about 2%, applicable to actions: `swap` | | `additionalData` | string | No | \- | Additional data to include in response (comma-separated), see [Additional data](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#additional-data) | ### Outputs[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#outputs "Direct link to Outputs") The Convert API returns the following response structure: | Field | Type | Required | Description | | --- | --- | --- | --- | | `action` | string | Yes | The classified and executed action (e.g., `mint-py`, `swap`, `add-liquidity`) | | `inputs` | [TokenAmountResponse\[\]](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#tokenamountresponse) | Yes | Input tokens and amounts used in the action | | `requiredApprovals` | [TokenAmountResponse\[\]](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#tokenamountresponse) | No | Tokens requiring approval before execution | | `routes` | [ConvertResponse\[\]](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#convertresponse) | Yes | Array of route execution details, sorted by decreasing output amount | #### TokenAmountResponse[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#tokenamountresponse "Direct link to TokenAmountResponse") | Field | Type | Required | Description | | --- | --- | --- | --- | | `token` | string | Yes | Token contract address (lowercase) | | `amount` | string | Yes | Token amount in wei (BigInt string) | #### ConvertResponse[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#convertresponse "Direct link to ConvertResponse") | Field | Type | Required | Description | | --- | --- | --- | --- | | `contractParamInfo` | [ContractParamInfo](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#contractparaminfo) | Yes | Param info for the contract method called | | `tx` | [TransactionDto](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#transactiondto-tx) | Yes | Complete transaction data for execution | | `outputs` | [TokenAmountResponse\[\]](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#tokenamountresponse) | Yes | Expected output tokens and amounts | | `data` | [ConvertData](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#convertdata) | Yes | Action-specific data | #### ContractParamInfo[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#contractparaminfo "Direct link to ContractParamInfo") | Field | Type | Required | Description | | --- | --- | --- | --- | | `method` | string | Yes | Contract method name (e.g., `mintPyFromToken`) | | `contractCallParamsName` | string\[\] | Yes | Parameter names array | | `contractCallParams` | any\[\] | Yes | Parameter values array | #### TransactionDto[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#transactiondto-tx "Direct link to TransactionDto") | Field | Type | Required | Description | | --- | --- | --- | --- | | `data` | string | Yes | Encoded transaction data (hex) | | `to` | string | Yes | Contract address to call | | `from` | string | Yes | Sender address | | `value` | string | Yes | Native token amount to send | #### ConvertData[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#convertdata "Direct link to ConvertData") | Field | Type | Required | Description | | --- | --- | --- | --- | | `aggregatorType` | string | Yes | The aggregator used, or `VOID` if none was used | | `priceImpact` | number | Yes | Price impact | | `impliedApy` | [ImpliedApy](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#impliedapy) | No | Market APY information for yield actions. (for `swap` actions) | | `effectiveApy` | number | No | User's effective APY after fees/slippage. (for `swap` actions) | | `paramsBreakdown` | [ParamsBreakdown](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#paramsbreakdown) | No | Multi-step action breakdown (for `transfer-liquidity`) | #### ImpliedApy[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#impliedapy "Direct link to ImpliedApy") | Field | Type | Required | Description | | --- | --- | --- | --- | | `before` | number | Yes | Implied APY before transaction | | `after` | number | Yes | Implied APY after transaction | #### ParamsBreakdown[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#paramsbreakdown "Direct link to ParamsBreakdown") | Field | Type | Required | Description | | --- | --- | --- | --- | | `selfCall1` | [ContractParamInfo](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#contractparaminfo) | Yes | Params info for selfCall1 | | `selfCall2` | [ContractParamInfo](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#contractparaminfo) | No | Params info for selfCall2 | | `reflectCall` | [ContractParamInfo](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#contractparaminfo) | Yes | Params info for reflectCall | Features[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#features "Direct link to Features") ------------------------------------------------------------------------------------------------------------------- ### Routing[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#routing "Direct link to Routing") Routing is a feature of the Pendle SDK that helps users find the most optimal route to interact with the Pendle system. This feature ensures that users can efficiently execute their transactions by identifying the best paths for their specific needs, whether it's swapping assets, adding or removing liquidity, or any other supported function. To take advantage of the routing feature, users need to set the `enableAggregator` option to `true`. When this option is enabled, the system will automatically perform routing to find the most optimal route for the user's transaction. This ensures that users always get the best possible outcome when interacting with the Pendle system. #### Select aggregators[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#select-aggregators "Direct link to Select aggregators") When `enableAggregator` is set to `true`, you can control which aggregators are used by specifying the `aggregators` parameter. This parameter accepts a comma-separated list of aggregator names (e.g. "kyberswap,odos"). If not specified, the system will use all available aggregators to find the optimal route. Using more aggregators generally results in better optimized routes since there are more options to choose from. However, each aggregator adds to the computing unit cost of the request (see [rate limiting](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limiting) ). You can balance between optimization and cost by selectively enabling only the aggregators you want to use. Currently supported aggregators (can be fetched from [fetch supported aggregators](https://api-v2.pendle.finance/core/docs#/SDK/SdkController_getSupportedAggregators) endpoint), this list is subject to change: | Aggregator | Cost (Computing Units) | | --- | --- | | `kyberswap` | 5 | | `odos` | 15 | | `okx` | 10 | | `paraswap` | 15 | For example, this request will use KyberSwap and Odos aggregators to find the optimal route, and it costs 25 computing units (5 from kyberswap, 15 from odos, and 5 from the base computing cost): export async function addLiquiditySingleToken() { // Use 1 ETH to add liquidity to stETH pool with 1% slippage const res = await callSDK(`/v2/sdk/${CHAIN_ID}/convert`, { tokensIn: `${ETH_ADDRESS}`, amountsIn: '1000000000000000000', tokensOut: `${STETH_LP_ADDRESS}`, receiver: RECEIVER_ADDRESS, slippage: 0.01, enableAggregator: true, aggregators: "kyberswap,odos", }); console.log("Action: ", res.action); console.log("Outputs: ", res.routes[0].outputs); console.log("Price impact: ", res.routes[0].data.priceImpact); // Send tx getSigner().sendTransaction(res.routes[0].tx);} ### Reduce aggregator computing units[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#reduce-aggregator-computing-units "Direct link to Reduce aggregator computing units") By default, when using aggregators, the system will use public API keys for each aggregator. This means that the computing unit cost for each aggregator will be added to the total cost of the request. To reduce the computing unit cost, you can use your own API key for each aggregator. This way, the computing unit cost for that aggregator will be reduced to 0. For example, if you use your own API key for Odos, the total computing unit cost will be 5 (base cost) + 5 (kyberswap cost) + 0 (odos cost with custom API key) = 10 computing units. Currently, you can use an aggregator with your own API key by specifying the corresponding field in the request headers. | Aggregator | Header Key | Note | | --- | --- | --- | | `kyberswap` | `KYBERSWAP-API-KEY` | | | `odos` | `ODOS-API-KEY` | | | `okx` | `OKX-ACCESS-KEY`, `OKX-ACCESS-SECRET`, `OKX-PASSPHRASE` | Need all three to return a valid response | | `paraswap` | `PARASWAP-API-KEY` | | When using custom aggregator keys, make sure to include the required headers in your request. If the headers are not provided, the system will use the public API key for that aggregator. ### Additional data[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#additional-data "Direct link to Additional data") When an endpoint has an `additionalData` field, users can pass in some fields to receive more data, but it will cost more computing units. For example, the **swap** action has `additionalData` with two available fields: `impliedApy` and `effectiveApy`. If the query parameters have `additionalData=impliedApy`, the response will have the implied APY before and after the swap action. For additional usage, please refer to the [API documentation](https://api-v2.pendle.finance/core/docs) to explore more. Migrating from individual endpoints to Convert[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#migrating-from-individual-endpoints-to-convert "Direct link to Migrating from individual endpoints to Convert") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Convert API replaces all of the individual SDK endpoints (`/swap`, `/add-liquidity`, `/mint`, `/redeem`, etc.). The table below maps each old endpoint to the equivalent Convert call. | Old endpoint | Convert equivalent | | --- | --- | | `GET /v2/sdk/{chainId}/markets/{market}/swap` | `tokensIn=[token/PT/YT]`, `tokensOut=[token/PT/YT]` | | `GET /v2/sdk/{chainId}/markets/{market}/add-liquidity` | `tokensIn=[token]`, `tokensOut=[LP]` (standard) or `tokensOut=[LP,YT]` (ZPI) | | `GET /v2/sdk/{chainId}/markets/{market}/add-liquidity-dual` | `tokensIn=[token,PT]`, `tokensOut=[LP]` | | `GET /v2/sdk/{chainId}/markets/{market}/remove-liquidity` | `tokensIn=[LP]`, `tokensOut=[token]` | | `GET /v2/sdk/{chainId}/markets/{market}/remove-liquidity-dual` | `tokensIn=[LP]`, `tokensOut=[token,PT]` | | `GET /v2/sdk/{chainId}/mint` | `tokensIn=[token]`, `tokensOut=[PT,YT]` | | `GET /v2/sdk/{chainId}/redeem` | `tokensIn=[PT,YT]` (or just `[PT]` after expiry), `tokensOut=[token]` | | `GET /v2/sdk/{chainId}/mint-sy` | `tokensIn=[token]`, `tokensOut=[SY]` | | `GET /v2/sdk/{chainId}/redeem-sy` | `tokensIn=[SY]`, `tokensOut=[token]` | | `GET /v2/sdk/{chainId}/markets/{market}/transfer-liquidity` | `tokensIn=[LP,PT,YT]` (any subset), `tokensOut=[destination LP]` | | `GET /v2/sdk/{chainId}/markets/{market}/roll-over-pt` | `tokensIn=[source PT]`, `tokensOut=[destination PT]` | | `GET /v2/sdk/{chainId}/markets/{market}/exit-positions` | `tokensIn=[LP,PT,YT]` (any subset), `tokensOut=[token]` | ### Which version should I use?[​](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#which-version-should-i-use "Direct link to Which version should I use?") Use **v3 (POST `/v3/sdk/{chainId}/convert`)** for new integrations. It accepts a JSON body with a typed `inputs` array instead of comma-separated query strings, which is easier to construct programmatically. Use **v2 (GET `/v2/sdk/{chainId}/convert`)** if you need a fully query-parameter-based URL (e.g. for simple curl testing or when an HTTP client doesn't support request bodies on GET). Both variants execute the same logic and return the same response. * [Getting Started](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#getting-started) * [Supported functions](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#supported-functions) * [Examples](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#examples) * [Swap](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#swap) * [Add liquidity](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#add-liquidity) * [Add liquidity ZPI](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#add-liquidity-zpi) * [Remove liquidity](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#remove-liquidity) * [Mint PT & YT](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#mint-pt--yt) * [Redeem PT & YT](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#redeem-pt--yt) * [Transfer liquidity](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#transfer-liquidity) * [Transfer liquidity ZPI](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#transfer-liquidity-zpi) * [Roll over PT](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#roll-over-pt) * [Add liquidity dual](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#add-liquidity-dual) * [Remove liquidity dual](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#remove-liquidity-dual) * [Mint SY](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#mint-sy) * [Redeem SY](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#redeem-sy) * [Send Transaction](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#send-transaction) * [Inputs](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#inputs) * [Outputs](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#outputs) * [Features](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#features) * [Routing](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#routing) * [Reduce aggregator computing units](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#reduce-aggregator-computing-units) * [Additional data](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#additional-data) * [Migrating from individual endpoints to Convert](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#migrating-from-individual-endpoints-to-convert) * [Which version should I use?](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#which-version-should-i-use) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Community Listing Guide | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#__docusaurus_skipToContent_fallback) On this page Pendle has evolved from an ad-hoc, team-managed listing process to a structured, self-service **Community Listing** model. This empowers partners to deploy and manage their own markets with minimal intervention from the core team. Listing Workflow[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#listing-workflow "Direct link to Listing Workflow") ------------------------------------------------------------------------------------------------------------------------------------------------------ The entire process is managed through the official [Pendle Listing Portal](https://listing.pendle.finance/) . ### Step 1: Initiate Submission[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-1-initiate-submission "Direct link to Step 1: Initiate Submission") Access the listing portal at **[listing.pendle.finance](https://listing.pendle.finance/) **. Registration requires a wallet, email, or Discord account, and linking a Telegram handle. ### Step 2: Complete Checklists[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-2-complete-checklists "Direct link to Step 2: Complete Checklists") The portal guides you through a series of mandatory checklists: | Checklist | Purpose | | --- | --- | | **Asset Launching Checklist** | Gathers fundamental information about the asset, yield source, and desired market parameters (maturity, yield range) | | **Security Checklist (ERC-4626)** | For ERC-4626 compliant assets — must be confirmed by the asset's auditors | | **Security Checklist (Non-ERC-4626)** | For non-compliant assets (most assets on Pendle) | | **Token Pricing & Metadata** | Details for displaying the asset correctly on the Pendle UI | ### Step 3: Develop the SY Token (If Necessary)[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-3-develop-the-sy-token-if-necessary "Direct link to Step 3: Develop the SY Token (If Necessary)") For most non-ERC-4626 assets, a custom **Standardized Yield (SY)** contract must be written. Pendle provides extensive documentation and **150+ reference implementations** in the [`Pendle-SY-Public`](https://github.com/pendle-finance/pendle-core-v2-public) GitHub repository. **Requirements for SY integration:** * The underlying asset must be a fully **transferable ERC-20** token * There should be **no locking or vesting** periods associated with minting * The yield generated should not go negative ("**up-only**" yield). For assets with potential negative yield, special mechanisms (e.g., insurance fund or Merkle-based distribution) are required **All custom SY contracts must be audited.** Pendle can recommend and facilitate an audit with their retained auditors who have extensive experience with SY contracts. tip It is highly recommended to deploy custom SY contracts as **upgradable proxies** using Pendle's designated proxy admin. This allows for future modifications without requiring a full market migration. ### Step 4: Deploy the Market[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-4-deploy-the-market "Direct link to Step 4: Deploy the Market") Once checklists are approved, partners can use the [`Pendle-Common-Pool-Deploy`](https://github.com/pendle-finance/Pendle-Common-Pool-Deploy) repository to deploy the SY and market contracts themselves. ### Step 5: Sign Risk Acknowledgment[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-5-sign-risk-acknowledgment "Direct link to Step 5: Sign Risk Acknowledgment") Before deployment, the deploying entity must **sign a message on-chain** (e.g., via Etherscan's verified signatures page) acknowledging they assume all inherent risks for security vulnerabilities originating from their own contracts. ### Step 6: Seed Liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-6-seed-liquidity "Direct link to Step 6: Seed Liquidity") After deployment, the partner is responsible for bootstrapping the pool with initial liquidity. See the [Pool Guide](https://docs.pendle.finance/pendle-v2/AppGuide/Pool) for recommended seeding amounts and best practices. ### Step 7: Finalize with Pendle[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-7-finalize-with-pendle "Direct link to Step 7: Finalize with Pendle") Once seeded, the Pendle team handles the final steps: * Setting up backend metadata and pricing * Whitelisting the pool on the UI * Enabling the pool for PENDLE incentive allocation Pool Admin Portal[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#pool-admin-portal "Direct link to Pool Admin Portal") --------------------------------------------------------------------------------------------------------------------------------------------------------- Upon successful listing, protocols are granted access to a **Pool Admin Portal** to manage their market's metadata. Setting Market Parameters[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#setting-market-parameters "Direct link to Setting Market Parameters") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- When deploying a new market, you must define a minimum and maximum implied APY (the yield range). This range should be determined by: * Historical yield volatility of the underlying asset * Performance of similar markets * Estimated APY from points campaigns * A buffer to accommodate market fluctuations caution The yield range is **immutable** once the pool is deployed. If market dynamics push the implied yield outside this range, the pool goes "out of range" and a new market must be deployed with a wider range. See [Troubleshooting](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#market-out-of-range-marketproportiontoohigh) for details. * [Listing Workflow](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#listing-workflow) * [Step 1: Initiate Submission](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-1-initiate-submission) * [Step 2: Complete Checklists](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-2-complete-checklists) * [Step 3: Develop the SY Token (If Necessary)](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-3-develop-the-sy-token-if-necessary) * [Step 4: Deploy the Market](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-4-deploy-the-market) * [Step 5: Sign Risk Acknowledgment](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-5-sign-risk-acknowledgment) * [Step 6: Seed Liquidity](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-6-seed-liquidity) * [Step 7: Finalize with Pendle](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#step-7-finalize-with-pendle) * [Pool Admin Portal](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#pool-admin-portal) * [Setting Market Parameters](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing#setting-market-parameters) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Troubleshooting Guide | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#__docusaurus_skipToContent_fallback) On this page This guide covers common errors and issues encountered when integrating with or using the Pendle Protocol. It is organized by category to help you quickly identify and resolve problems. General Troubleshooting Principles[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#general-troubleshooting-principles "Direct link to General Troubleshooting Principles") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- When facing unexpected behavior, start with these client-side checks: * **Hard Refresh and Clear Cache**: A simple hard refresh can resolve transient UI glitches or data display issues. If problems persist, clear browser cache and application storage. * **Check Wallet and Network Connection**: Verify the correct wallet is connected and set to the appropriate network. An incorrect ETH balance display is almost always a sign of a wrong wallet connection. * **Review Browser Console Logs**: Open the developer console (F12), retry the failing operation, and look for error messages. A screenshot of the console output is extremely helpful when reporting issues. * **Check RPC and Security Software**: Transaction signing issues (e.g., wallet pop-up not appearing) are often related to the RPC provider, not Pendle's infrastructure. Try switching to a different public RPC from [Chainlist](https://chainlist.org/) . VPNs, firewalls, or malware protection software can sometimes block RPC communications. ### Bug Reporting Best Practices[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#bug-reporting-best-practices "Direct link to Bug Reporting Best Practices") To facilitate a swift resolution, provide as much detail as possible: * **Transaction Hash (Tx Hash)**: The most critical piece of information, even for failed transactions. * **Transaction Calldata**: For pre-transaction failures or simulation issues. * **Wallet Address**: Helps trace user-specific states (balances, rewards, voting history). * **Simulation Links**: Generate and share simulations using tools like [Tenderly](https://tenderly.co/) or [Sentio](https://sentio.xyz/) . * **Operation Specifics**: The blockchain network, market/pool address, input/output tokens and amounts, and the exact error message. * * * Smart Contract Interaction Errors[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#smart-contract-interaction-errors "Direct link to Smart Contract Interaction Errors") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Slippage and Price Movement[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#slippage-and-price-movement "Direct link to Slippage and Price Movement") Transactions can fail if the asset price moves beyond the specified slippage tolerance between transaction creation and on-chain confirmation. * **Solution 1 (Preferred)**: Increase the transaction's gas fee (e.g., use 'aggressive' or 'instant' settings). This reduces confirmation time, minimizing the window for price changes. * **Solution 2**: Increase the slippage tolerance in the dApp settings. This allows wider price fluctuation but may result in a less favorable execution price. ### Expired Aggregator Quotes (`APPROX_EXHAUSTED`)[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#expired-aggregator-quotes-approx_exhausted "Direct link to expired-aggregator-quotes-approx_exhausted") Data generated for a transaction (e.g., a route from an aggregator or an `approx` parameter) is highly time-sensitive and often only valid for the block in which it was generated. * **Error**: `Slippage: APPROX_EXHAUSTED` or `Insufficient PT` * **Cause**: Using stale transaction data even a few blocks after generation. * **Solution**: Always generate fresh calldata immediately before sending the transaction. ### `Slippage: search range overflow`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#slippage-search-range-overflow "Direct link to slippage-search-range-overflow") This error indicates the swap amount is too large for the market to handle at its current liquidity depth. Reduce the trade size or wait for more liquidity. ### Market Out of Range (`MarketProportionTooHigh`)[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#market-out-of-range-marketproportiontoohigh "Direct link to market-out-of-range-marketproportiontoohigh") Pendle's AMM pools operate within a configured yield range. If high demand pushes the implied APY beyond the pool's upper boundary, the market goes **"out of range."** * **Error**: `MarketProportionTooHigh` (error signature `0xfc68d09e`) * **Impact**: The following actions are disabled: * Buying YT via market orders * Selling PT via market orders * Using the "Zap Out" function * **Workaround**: Use **limit orders** instead of market orders. * **Resolution**: The Pendle team typically redeploys the pool with a wider yield range. LPs in the old pool should migrate to the new pool. ### `No route found` / `No route found to add liquidity`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#no-route-found--no-route-found-to-add-liquidity "Direct link to no-route-found--no-route-found-to-add-liquidity") This error indicates the system could not find a viable path to convert the input token to the required asset(s). * **Insufficient Liquidity**: Most common cause — the token pair lacks DEX liquidity on the specified chain. * **Aggregator Issues**: The aggregator may be experiencing transient issues or may not support the token pair. * **RPC Issues**: Sometimes caused by an underlying RPC problem. ### `liquidity insufficient`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#liquidity-insufficient "Direct link to liquidity-insufficient") The pool's liquidity is not deep enough for the requested trade size. This is distinct from "no route" — a route exists, but the trade is too large. ### `TransferHelper: TRANSFER_FROM_FAILED`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#transferhelper-transfer_from_failed "Direct link to transferhelper-transfer_from_failed") Often occurs during liquidity removal when the aggregator used for the transaction encounters issues, especially when zapping out to tokens requiring complex swap data. ### Reward Claiming Issues[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#reward-claiming-issues "Direct link to Reward Claiming Issues") * **`userReward` Returning Zero**: Calling `userReward` on a `PendleMarket` contract may return 0 even if rewards have accrued. The contract does not write accrued rewards to storage in real-time. To get accurate values, perform a **static call** (`eth_call` or `.callStatic`) to `redeemRewards(address user)`. * **UI Showing Zero Rewards**: The Pendle UI uses a static call to check claimable rewards. If this call reverts (e.g., the recipient contract lacks a `receive()` function to accept native ETH rewards), the UI defaults to displaying 0. * **Reverts on `redeemRewards` in Matured Pools**: An older implementation caused reward calculations to be incorrect after pool expiry. A **reward redeem proxy** contract was deployed as a fix. To redeem rewards from affected markets, call the proxy instead of the market contract directly. * **Reverts Due to Depleted Incentives**: Transactions can revert if an external incentive program (e.g., ARB incentives from Silo pools) runs out of its reward tokens. * * * Oracle and Price Feed Issues[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#oracle-and-price-feed-issues "Direct link to Oracle and Price Feed Issues") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### `increaseCardinalityRequired=true` / Error `0x39db717e`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#increasecardinalityrequiredtrue--error-0x39db717e "Direct link to increasecardinalityrequiredtrue--error-0x39db717e") * **Cause**: The oracle lacks enough historical price data points (cardinality) for the requested TWAP. The `observationCardinality` on the underlying AMM pool may be at its default value of 1. * **Solution**: 1. Call `increaseObservationCardinalityNext` on the market/oracle contract. A common required value is 1800. For some oracles, calculate as `duration / 11` (e.g., for a 900s TWAP, use `82`). 2. **Wait ~15 minutes** for the oracle to populate with sufficient data. The `increaseCardinalityRequired` flag will switch to `false` once ready. ### `OracleTargetTooOld` / `TooStalePrice()`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#oracletargettooold--toostaleprice "Direct link to oracletargettooold--toostaleprice") The last price update from the oracle is older than the maximum acceptable age. This safety mechanism prevents trading on outdated information. If an oracle provider (e.g., Pyth) is unresponsive, Pendle's functions fall back to the last known exchange rate. ### `ORACLE_NOT_FEASIBLE`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#oracle_not_feasible "Direct link to oracle_not_feasible") Originates from an integrated DEX, not directly from Pendle. Often occurs in a **forked network** environment where the Chainlink or Pyth oracle has not been updated and has fallen behind the forked block's timestamp. ### Incorrect Price Display[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#incorrect-price-display "Direct link to Incorrect Price Display") Mismatches between the UI and on-chain reality (e.g., a matured PT displaying an incorrect price, or a "100% loss" display) are often due to an external data provider (like DeBank) supplying a faulty price feed. * * * Data, Indexing, and API Errors[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#data-indexing-and-api-errors "Direct link to Data, Indexing, and API Errors") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Rate Limiting & Timeouts[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#rate-limiting--timeouts "Direct link to Rate Limiting & Timeouts") For detailed information on rate limiting (CU system, headers, best practices) and recommended timeout settings, see the [API Overview — Rate Limiting](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#rate-limiting) section. **Quick tips**: A `429` error is most often caused by the **RPC provider**, not the Pendle API. Use a private or paid archival RPC for intensive operations. Set a client-side HTTP timeout of at least **120 seconds**. ### Hosted SDK Limitations[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#hosted-sdk-limitations "Direct link to Hosted SDK Limitations") The Hosted SDK only supports **whitelisted markets**. Interacting with a non-whitelisted market returns a `Market not found` error. * **`400 Bad Request: syTokenOutAddr is not a valid SY token out`**: Previously an intermittent bug; now fixed. * **`404 Not Found`**: When checking rewards eligibility, 404 means the address is not eligible. When querying a market, it means the market address is not found on the specified chain. * **`Token is not swappable via aggregator`**: The token is not whitelisted for zapping. This can happen if a token initially has very high price impact; it can be whitelisted after review. ### `selector not found`[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#selector-not-found "Direct link to selector-not-found") When calling functions like `getYtToSyRate` on a historical block, this error indicates the function did not exist on the contract at that point in time. The function was added in a later deployment and cannot query data before its deployment block. * * * Third-Party Integration Issues[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#third-party-integration-issues "Direct link to Third-Party Integration Issues") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Public RPC Limitations[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#public-rpc-limitations "Direct link to Public RPC Limitations") Public RPCs (e.g., the default MetaMask Arbitrum RPC via Ankr) are prone to issues: multicall problems, corrupted data, and strict rate limits that interfere with data-intensive tasks. **Recommendation**: For any serious development, backfilling, or production service, use a **private, archival RPC provider** (e.g., QuickNode). ### Aggregator-Related Failures[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#aggregator-related-failures "Direct link to Aggregator-Related Failures") * **Stale Routes**: A common cause for `swapExactTokenForPt` reverts — the route provided is stale or invalid by execution time. * **Simulation Inaccuracy**: Aggregator simulations can be unreliable when the wallet lacks sufficient funds for the simulated amount. The aggregator may return a "stale" route that looks good on paper but fails in a real transaction. Accurate simulation requires both sufficient balance and token approval. * **KyberSwap Reliability**: KyberSwap has been noted as occasionally unreliable. If transactions fail, retry with the problematic aggregator excluded from the `aggregators` parameter. ### Protocol Pauses[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#protocol-pauses "Direct link to Protocol Pauses") In the event of a security compromise on an integrated protocol (e.g., Penpie, Zerolend), Pendle may pause its own contracts as a precautionary measure. Once the attack is confirmed to be isolated and that protocol has been paused, Pendle will unpause its contracts. * * * Development and Testing[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#development-and-testing "Direct link to Development and Testing") -------------------------------------------------------------------------------------------------------------------------------------------------------------- ### No Maintained Testnet[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#no-maintained-testnet "Direct link to No Maintained Testnet") Pendle **does not maintain a deployment on public testnets** like Sepolia. ### Forking Mainnet (Recommended Approach)[​](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#forking-mainnet-recommended-approach "Direct link to Forking Mainnet (Recommended Approach)") The standard approach for testing is to **fork a mainnet environment** (e.g., Ethereum, Arbitrum) to a local development environment. Tools like [Foundry](https://book.getfoundry.sh/) or [Hardhat](https://hardhat.org/) are essential. **Hardhat Configuration Tips:** * **Persistence**: When running multiple operations (e.g., deploying then seeding), ensure Hardhat connects to a **single, persistent fork instance**. Otherwise, each operation may create a new, independent fork, losing state from previous steps. * **Shanghai Hardfork**: When using a forked network, `Invalid Opcode` errors are common if the environment is not configured for the Shanghai hardfork. Ensure your Hardhat version is up-to-date and configure the `hardforkHistory` in your `hardhat.config.ts`. * [General Troubleshooting Principles](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#general-troubleshooting-principles) * [Bug Reporting Best Practices](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#bug-reporting-best-practices) * [Smart Contract Interaction Errors](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#smart-contract-interaction-errors) * [Slippage and Price Movement](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#slippage-and-price-movement) * [Expired Aggregator Quotes (`APPROX_EXHAUSTED`)](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#expired-aggregator-quotes-approx_exhausted) * [`Slippage: search range overflow`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#slippage-search-range-overflow) * [Market Out of Range (`MarketProportionTooHigh`)](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#market-out-of-range-marketproportiontoohigh) * [`No route found` / `No route found to add liquidity`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#no-route-found--no-route-found-to-add-liquidity) * [`liquidity insufficient`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#liquidity-insufficient) * [`TransferHelper: TRANSFER_FROM_FAILED`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#transferhelper-transfer_from_failed) * [Reward Claiming Issues](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#reward-claiming-issues) * [Oracle and Price Feed Issues](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#oracle-and-price-feed-issues) * [`increaseCardinalityRequired=true` / Error `0x39db717e`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#increasecardinalityrequiredtrue--error-0x39db717e) * [`OracleTargetTooOld` / `TooStalePrice()`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#oracletargettooold--toostaleprice) * [`ORACLE_NOT_FEASIBLE`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#oracle_not_feasible) * [Incorrect Price Display](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#incorrect-price-display) * [Data, Indexing, and API Errors](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#data-indexing-and-api-errors) * [Rate Limiting & Timeouts](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#rate-limiting--timeouts) * [Hosted SDK Limitations](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#hosted-sdk-limitations) * [`selector not found`](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#selector-not-found) * [Third-Party Integration Issues](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#third-party-integration-issues) * [Public RPC Limitations](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#public-rpc-limitations) * [Aggregator-Related Failures](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#aggregator-related-failures) * [Protocol Pauses](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#protocol-pauses) * [Development and Testing](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#development-and-testing) * [No Maintained Testnet](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#no-maintained-testnet) * [Forking Mainnet (Recommended Approach)](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting#forking-mainnet-recommended-approach) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Cancel Limit Orders | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#__docusaurus_skipToContent_fallback) On this page Makers can send a transaction to the Limit Order contract to cancel their orders. This action prevents those orders from being settled by the contract. There are two methods for makers to cancel their orders: 1. Cancel specific orders: Target individual orders for cancellation. 2. Increase nonce: Cancel all orders with a nonce less than the current maker's nonce. Pendle provides an API to help makers find their active orders, allowing them to cancel orders more easily. [Get maker's active orders](https://api-v2.pendle.finance/limit-order/docs#/Maker/MakersController_getMakerLimitOrder) TypeScript Example[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#typescript-example "Direct link to TypeScript Example") ------------------------------------------------------------------------------------------------------------------------------------------------------- **Note:** The code examples in the guide below are taken from our demo GitHub repository, which demonstrates the complete end-to-end Limit Order processes in a TypeScript environment. [View Repository →](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) Cancel specific order[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#cancel-specific-order "Direct link to Cancel specific order") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Step 1: Find the maker's active orders[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#step-1-find-the-makers-active-orders "Direct link to Step 1: Find the maker's active orders") To cancel specific orders, you need the data for those orders. Makers can use the Pendle API to retrieve their active order data. const requestQuery: LimitOrderMakerQuery = { skip: 0, limit: 10, chainId: ChainId.ARBITRUM, maker: await getSigner().getAddress(), isActive: true } You can find a complete example of how to get a maker's active orders in our [API demo repository](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) ### Step 2: Cancel the orders[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#step-2-cancel-the-orders "Direct link to Step 2: Cancel the orders") Once you have the limit order data, you can send this data to the Limit Order contract to cancel specific orders. const tx = await contract.cancelSingle(order); You can find a complete example of how to cancel an order in our [API demo repository](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) Increase nonce[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#increase-nonce "Direct link to Increase nonce") ------------------------------------------------------------------------------------------------------------------------------------------- Each order has a `nonce` field. When creating a limit order, this field is typically set to the current maker's nonce. All orders with a nonce lower than the current maker's nonce become invalid. Makers can increase their nonce in the Limit Order contract to cancel all orders with a lower nonce (assuming they were created with the maker's nonce at the time of creation). const tx = await contract.increaseNonces(); You can find a complete example of how to increase the nonce in our [API demo repository](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) * [TypeScript Example](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#typescript-example) * [Cancel specific order](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#cancel-specific-order) * [Step 1: Find the maker's active orders](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#step-1-find-the-makers-active-orders) * [Step 2: Cancel the orders](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#step-2-cancel-the-orders) * [Increase nonce](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders#increase-nonce) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Create a Limit Order | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#__docusaurus_skipToContent_fallback) On this page Pendle Limit Order system allows makers to create limit orders without using gas. To achieve this, makers' signed orders are stored off-chain and will be filled by the takers on-chain. To be able to create a limit order and submit it to the Pendle Limit Order system, you can follow these steps: 1. Generate the limit order data 2. Sign the limit order data 3. Post the limit order data and its signature to the Pendle Limit Order system Pendle exposes 2 APIs to help makers create orders more easily 1. [Generate limit order data](https://api-v2.pendle.finance/limit-order/docs#/Maker/MakersController_generateLimitOrderData) 2. [Post limit order](https://api-v2.pendle.finance/limit-order/docs#/Maker/MakersController_createOrder) TypeScript Example[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#typescript-example "Direct link to TypeScript Example") ------------------------------------------------------------------------------------------------------------------------------------------------------------ **Note:** The code examples in the guide below are taken from our demo GitHub repository, which demonstrates the complete end-to-end Limit Order processes in a TypeScript environment. [Repo](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) ### Step 1: Generate limit order data[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#step-1-generate-limit-order-data "Direct link to Step 1: Generate limit order data") [Order data definition](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#order-struct-definition) To place a limit order, the maker needs to generate this Order struct, which requires several details. Pendle provides a backend API that helps generate this data more easily. By providing the necessary information (`orderType`, `token`, `maker`, `impliedAPY`), the API returns the full limit order data for the maker. Makers can generate the complete data themselves, but the API simplifies the process by handling complex fields like `salt`, `failSafeRate`, `nonce`, etc. const requestBody: GenerateLimitOrderDataRequest = { chainId: ChainId.ARBITRUM, YT: aUSDC_MARKET.yt, maker: signerAddress, orderType: LimitOrderType.TOKEN_FOR_PT, token: aUSDC_MARKET.tokenIn.usdc, // Use USDC as token in to swap to PT makingAmount: '10000000', // 10 USDC impliedApy: 0.1, // 10% implied APY expiry: String(Math.floor(Date.now() / 1000) + 20 * 60), // order will be expired in 20 minutes}; Full details of all limit order data can be found via the `GenerateLimitOrderDataResponse` on our [API specification](https://api-v2.pendle.finance/limit-order/docs#/) Note that you need to ensure you have sufficient balance and allowance to create the limit order; otherwise, the API will return a 400 error. ### Step 2: Sign limit order data[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#step-2-sign-limit-order-data "Direct link to Step 2: Sign limit order data") const signature = await signer.signTypedData(limitOrderDomainArbitrum, typesLimitOrder, data); You can find the full example of signing a limit order using the ethers.js library on our [API demo repository](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) ### Step 3: Post the limit order[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#step-3-post-the-limit-order "Direct link to Step 3: Post the limit order") After signing the limit order data, you can send the limit order data along with the signature to our Backend API const requestBody: CreateLimitOrderRequest = { ...generatedLimitOrderData, yt: generatedLimitOrderData.YT, type: generatedLimitOrderData.orderType, signature,}; All the implementation details can be found in the [API demo repository](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) * [TypeScript Example](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#typescript-example) * [Step 1: Generate limit order data](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#step-1-generate-limit-order-data) * [Step 2: Sign limit order data](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#step-2-sign-limit-order-data) * [Step 3: Post the limit order](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder#step-3-post-the-limit-order) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Fill a Limit Order | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder#__docusaurus_skipToContent_fallback) On this page Takers can fill any signed limit order from the Pendle Limit Order order books by executing the fill order on the smart contract. By using Pendle Limit Order APIs, takers can access liquidity sources without slippage, ensuring secure on-chain settlements. Pendle exposes 1 API for takers to view active orders to fill them on-chain [Get limit orders](https://api-v2.pendle.finance/limit-order/docs#/Taker/TakersController_generateLimitOrderData) TypeScript Example[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder#typescript-example "Direct link to TypeScript Example") ---------------------------------------------------------------------------------------------------------------------------------------------------------- **Note:** The code examples in the guide below are taken from our demo GitHub repository, which demonstrates the complete end-to-end Limit Order processes in a TypeScript environment. [Repo](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) ### Step 1: Fetch the limit orders[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder#step-1-fetch-the-limit-orders "Direct link to Step 1: Fetch the limit orders") Takers can use Pendle's API to fetch the limit orders and use any fetched orders to fill. const requestQuery: LimitOrderQuery = { skip: 0, limit: 10, // Use skip and limit to fetch the orders, you can fetch up to 100 orders per request chainId: ChainId.ARBITRUM, yt: aUSDC_MARKET.yt, type: LimitOrderType.TOKEN_FOR_PT, sortBy: 'Implied Rate', sortOrder: 'asc',}; A single API response can return up to 100 orders. Takers can use the skip and limit parameters to find more orders. Takers can sort the orders by implied rate (in ascending or descending order) to find the best orders. For example: If a taker wants to find orders selling tokens for YT, the orders with a lower implied rate will be more profitable than those with a higher implied rate. So takers can fetch the orders sorted by `Implied Rate` and `sortOrder` set to `asc`. The returned data will include `netFromTaker`, `netToTaker`, indicating the amount the taker will receive and the amount that will be taken from the taker. ### Step 2: Fill the order[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder#step-2-fill-the-order "Direct link to Step 2: Fill the order") const sumNetFromTaker = limitOrdersInfo.reduce((acc, limitOrderInfo) => { return acc + BigInt(limitOrderInfo.netFromTaker);}, 0n);// Maximum amount to be used to fill the order// We recommend buffer the returned value from BE by 1% because// the netFromTaker amount will change by timeconst maxTaking = (sumNetFromTaker * 101n) / 100n;const tx = await contract.fill( fillParams, // limit of order to fill signer.getAddress(), // receiver maxTaking, '0x', '0x'); There are three main params that you need to fill the limit orders 1. `fillParams`: The list of limit orders and the amount you want to fill (you can partially fill the order) 2. `receiver`: The address that will receive the maker amount from the limit orders. 3. `maxTaking`: The maximum amount the limit order contract can take from the Taker to fill the limit orders. The maxTaking value indicates the maximum amount the limit order contract can take from the Taker to fill the limit orders. Because the `netFromTaker` data received from Pendle's backend can change over time, it's recommended to buffer the maxTaking by 1% of the sumNetFromTaker. You can find more implementation details in our [demo repository](https://github.com/pendle-finance/pendle-examples-public/tree/main/limit-order-api-demo) * [TypeScript Example](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder#typescript-example) * [Step 1: Fetch the limit orders](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder#step-1-fetch-the-limit-orders) * [Step 2: Fill the order](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder#step-2-fill-the-order) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Cross-Chain PT | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#__docusaurus_skipToContent_fallback) On this page Terminology[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#terminology "Direct link to Terminology") ----------------------------------------------------------------------------------------------------------------------------------- * Hub chain — the chain that the PT is originated from. * Spoke chain — the chain that the bridged PT is deployed onto. There is only 1 hub chain, but there can be multiple spoke chains. The terms "hub PT" and "spoke PT" are also used for the PT on the corresponding chain. 1\. Why Cross-Chain PT?[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#1-why-cross-chain-pt "Direct link to 1. Why Cross-Chain PT?") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- Cross-chain PT enables protocols and money markets on spoke chains to list Pendle PT assets while leveraging the deep liquidity of hub chain markets: * **Redeemable at maturity** — always redeemable 1:1 with the underlying asset at maturity * **Predictable price behavior** — PT price generally increases toward the underlying asset value over time, though it can decrease temporarily due to yield rate changes * **Low liquidation risk** — bounded price behavior reduces liquidation risk compared to other collateral types * **Hub chain liquidity** — spoke chains benefit from the hub chain's AMM depth without needing their own deep pools 2\. Requesting a New Cross-Chain PT Deployment[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#2-requesting-a-new-cross-chain-pt-deployment "Direct link to 2. Requesting a New Cross-Chain PT Deployment") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- To request a new cross-chain PT deployment for your protocol or chain: 1. Submit your request via the [Cross-Chain PT Request Form](https://launch.pendle.finance/f/q1BK1hNyQ) 2. The Pendle team will review and complete the deployment > **Note:** This request flow will migrate to the listing portal at [portal.pendle.finance](https://portal.pendle.finance/) > in the future. 3\. Bridging, Selling, and Bridging Back[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#3-bridging-selling-and-bridging-back "Direct link to 3. Bridging, Selling, and Bridging Back") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Once a cross-chain PT is deployed, liquidators and users need a way to sell PT received on the spoke chain. Since AMM depth lives on the hub chain, selling involves bridging the PT to the hub chain, swapping, and bridging proceeds back. **Example: PT-sUSDe on Sonic** 1. **Bridge** PT-sUSDe from Sonic (spoke chain) to Ethereum (hub chain) 2. **Sell** PT-sUSDe on the Ethereum Pendle market (deeper liquidity) 3. **Bridge** proceeds (e.g., USDC) back to Sonic ### Using Pendle UI (No Code)[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#using-pendle-ui-no-code "Direct link to Using Pendle UI (No Code)") For manual or low-frequency operations: 1. Go to [Pendle Trade Markets](https://app.pendle.finance/trade/markets) 2. The UI handles bridging, swapping, and returning funds automatically in a single transaction For a detailed UI walkthrough, see the [Cross-Chain PT App Guide](https://docs.pendle.finance/pendle-v2/AppGuide/CrossChainPT) . ### Using pt-bridger Script (Programmatic)[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#using-pt-bridger-script-programmatic "Direct link to Using pt-bridger Script (Programmatic)") For programmatic or automated flows (e.g., liquidation bots), use the **pt-bridger** script: * **Repository:** [pendle-finance/pt-bridger](https://github.com/pendle-finance/pt-bridger) 4\. Risks of Cross-Chain PT in Money Markets[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#4-risks-of-cross-chain-pt-in-money-markets "Direct link to 4. Risks of Cross-Chain PT in Money Markets") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Protocols listing cross-chain PT as collateral should be aware of the following risks if the AMM on the **hub chain** is chosen for liquidation: * **PT price can decrease before maturity** — changes in the yield rate can cause PT price to drop, even though it converges to 1:1 at maturity * **Price drops may trigger liquidation** — if PT is used as collateral in a money market, a price decrease can push positions below the liquidation threshold * **Bridging time** — there is a deplay to bridge PT and token back and fort, up to a few minutes. Liquidator is adviced to prepare their own tokens to liquidate the position first then use the [pt-bridger script](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#using-pt-bridger-script-programmatic) to bridge the PT to the hub chain, sell it, and bridge proceeds back 5\. Liquidation AMM[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#5-liquidation-amm "Direct link to 5. Liquidation AMM") -------------------------------------------------------------------------------------------------------------------------------------------------------- To address the liquidation risk on spoke chains, Pendle provides a **FixedPricePTAMM**. * This AMM is deployed on **spoke chain**, enabling fast and direct liquidation with flash loan. There is no bridging deplay. * This AMM allows to swap PT to token with a **fixed** price, which is provided by a [Linear discount oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle) . The price feed by this oracle is **deterministic**, and is **linearly** converged to 1 at PT's maturity. The convergence rate is called the _discounted rate_. Because the AMM is **fast** and **deterministic**, it is suitable for the liquidation application on spoke chain. We also refer to this AMM as the liquidation AMM. Pendle can help deploy a **FixedPricePTAMM** with a Linear discount oracle of your **desired** _discounted rate_. ### The Recommended Discounted Rate for the Oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#the-recommended-discounted-rate-for-the-oracle "Direct link to The Recommended Discounted Rate for the Oracle") The oracle's _discounted rate_ is defined as the PT price **one year** before the PT's maturity (so it is also called the _annually discounted rate_). It is **recommended** to choose the discounted rate to satisfy the **suboptimal price** condition: the _discounted price_ should **always** be smaller than PT market price on hub chain. The _discounted rate_ can be derived from the maximum yield of the market on the hub chain with the following formula: ln⁡(1+max yield)\\ln (1 + \\textrm{max yield})ln(1+max yield) For example, if the maximum yield of a market is 27%, the the recommended _discounted rate_ is ln⁡(1+27%)≈0.239≈24%\\ln(1 + 27\\%) \\approx 0.239 \\approx 24\\%ln(1+27%)≈0.239≈24%. This formula guarantees the above condition about the suboptimal price. The maximum yield of the market can be seen in the Specs section on Pendle DApp. Example for the USDe 2025Sep market. | Click the spec button | Getting the yield range | | --- | --- | | ![image.png](https://docs.pendle.finance/assets/images/ui-market-specs-38e34a9610a7c250ae6752dce1010199.png) | ![image.png](https://docs.pendle.finance/assets/images/ui-market-yield-range-9196f2f97ef9779db2ed307ac02ae0a1.png) | Here the liquidity yield range is 5% - 27%. So the maximum yield is 27%. tip The specs page shows the maximum _possible_ yield that the market allows to trade. If the implied yield is low and is not likely to hit this maximum yield, lower _max yield_ can be chosen to increase the capital efficiency of the **FixedPricePTAMM**. ### How to Seed Liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#how-to-seed-liquidity "Direct link to How to Seed Liquidity") To bootstrap the Liquidation AMM with initial liquidity: 1. Coordinate with the Pendle team after your cross-chain PT deployment is complete 2. Provide initial liquidity to the Discount Rate AMM on the spoke chain 3. The seeded liquidity serves as the backstop for liquidation events ### Managing AMM Liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#managing-amm-liquidity "Direct link to Managing AMM Liquidity") * **Who manages it** — the protocol listing PT as collateral is responsible for ensuring adequate liquidation AMM liquidity on the spoke chain * **Rebalancing after liquidation events** — when liquidations consume AMM liquidity, the pool needs to be replenished to maintain liquidation capacity * **Flashloan-based liquidation flow** — liquidators can use flashloans to execute liquidations, selling the PT through the Discount Rate AMM and repaying the flashloan from the proceeds. After liquidation, the consumed liquidity should be replenished by the managing protocol ### Liquidation Bot[​](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#liquidation-bot "Direct link to Liquidation Bot") Pendle runs liquidation bot for this AMM to help with liquidation on Morpho. Please reach out if you want Pendle to support the liquidation bot system for your market. * [Terminology](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#terminology) * [1\. Why Cross-Chain PT?](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#1-why-cross-chain-pt) * [2\. Requesting a New Cross-Chain PT Deployment](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#2-requesting-a-new-cross-chain-pt-deployment) * [3\. Bridging, Selling, and Bridging Back](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#3-bridging-selling-and-bridging-back) * [Using Pendle UI (No Code)](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#using-pendle-ui-no-code) * [Using pt-bridger Script (Programmatic)](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#using-pt-bridger-script-programmatic) * [4\. Risks of Cross-Chain PT in Money Markets](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#4-risks-of-cross-chain-pt-in-money-markets) * [5\. Liquidation AMM](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#5-liquidation-amm) * [The Recommended Discounted Rate for the Oracle](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#the-recommended-discounted-rate-for-the-oracle) * [How to Seed Liquidity](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#how-to-seed-liquidity) * [Managing AMM Liquidity](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#managing-amm-liquidity) * [Liquidation Bot](https://docs.pendle.finance/pendle-v2/Developers/Integration/CrossChainPT#liquidation-bot) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # LP as Collateral in a Money Market | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#__docusaurus_skipToContent_fallback) On this page Pendle pools' LP tokens are good collaterals in a money market since it is a yield bearing position on the asset. This document discusses the use cases for LP as a collateral, as well as considerations for a money market when integrating LP as a collateral. Main Use Cases[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#main-use-cases "Direct link to Main Use Cases") ------------------------------------------------------------------------------------------------------------------------------------------ #### 1\. Leverage farming[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#1-leverage-farming "Direct link to 1. Leverage farming") Example: LP-stETH gives a 12% APY, but the ETH borrow rate is only 3% in the money market. * In this case, a user can deposit LP-stETH as collateral, borrow ETH, swap borrowed ETH to more LP-stETH to use as more collateral, and so on. * As a result, the user will get a leveraged APY in ETH terms, benefiting from the difference between the Pendle LP APY and ETH borrow rate * If the collateral factor is 0.80, the user can leverage 5x their capital to get a maximum APY of 5 \* (12-3) = 45% This use case is similar to depositing a yield bearing asset like wstETH and borrowing (ETH) in a money market. #### 2\. Leverage long assets while earning yields on Pendle[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#2-leverage-long-assets-while-earning-yields-on-pendle "Direct link to 2. Leverage long assets while earning yields on Pendle") * If a user is bullish on an asset in the long term, they can use its Pendle LP as a collateral to borrow stables to buy more LP * For example, a long term ETH holder can use LP-stETH as collateral to borrow USDC to buy more LP-stETH * Essentially, the user will be getting a good returns from the Pendle LP position on top of their leveraged long position on ETH. Risk analysis for LP as a collateral[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#risk-analysis-for-lp-as-a-collateral "Direct link to Risk analysis for LP as a collateral") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### 1\. Smart contract vulnerability in Pendle contracts:[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#1-smart-contract-vulnerability-in-pendle-contracts "Direct link to 1. Smart contract vulnerability in Pendle contracts:") * This is similar to the analysis in the [risk analysis for PT as a collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#1-smart-contract-vulnerability-in-pendle-contracts) ### 2\. Smart contract vulnerability in underlying protocols:[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#2-smart-contract-vulnerability-in-underlying-protocols "Direct link to 2. Smart contract vulnerability in underlying protocols:") * This is similar to the analysis in the [risk analysis for PT as a collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#2-smart-contract-vulnerability-in-underlying-protocols) ### 3\. Oracle exploit:[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#3-oracle-exploit "Direct link to 3. Oracle exploit:") * If the oracle for LP price is easily manipulated or exploited, LP price could inflate unnaturally (leading to an attack of using over-priced LP to borrow, and get away with free money leading to bad protocol debt after LP price drops sharply after), or drops sharply (leading to bad debt for the protocol) * Assessment: * Pendle's oracle for LP/asset builds on top of the PT/asset oracle. The PT/asset oracle is permissionless and built into the contract (no maintenance needed), hence liveness and correctness is not a concern. * The LP/asset oracle returns TWAP prices for any customisable duration (within 65536 blocks, which is ~9 days for Ethereum), hence is not susceptible to short term or within-a-block manipulation of prices if the TWAP duration used is sufficient. * **Important note**: * You should only use the current LP oracle is the `SY` contract doesn't have a callback function. If the `SY` contract has a callback function, it is technically possible for the oracle to return an incorrect LP price, if it's called inside a SY's callback function. * It should be very rare to have a SY with a callback function. If you do integrate with one, you can contact us. We can deploy a specialised oracle to deal with a SY with a call back function. ### 4\. Insufficient LP liquidity for liquidation in a short duration[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#4-insufficient-lp-liquidity-for-liquidation-in-a-short-duration "Direct link to 4. Insufficient LP liquidity for liquidation in a short duration") The considerations for this part is the same as the ones for integrating PT as collateral [here](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#4-insufficient-pt-liquidity-for-liquidation-in-a-short-duration) . The difference between LP and PT is just that LP prices fluctuate less than PT prices (because LP = PT + SY). Therefore, with the same pool, the parameters for supporting LP as a collateral could more more aggressive than that for supporting PT as a collateral. ### 5\. Highly volatile LP price could liquidate users unnecessarily[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#5-highly-volatile-lp-price-could-liquidate-users-unnecessarily "Direct link to 5. Highly volatile LP price could liquidate users unnecessarily") * This is similar to the analysis in the [risk analysis for PT as a collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#5-highly-volatile-pt-price-could-liquidate-users-unnecessarily) * [Main Use Cases](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#main-use-cases) * [Risk analysis for LP as a collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#risk-analysis-for-lp-as-a-collateral) * [1\. Smart contract vulnerability in Pendle contracts:](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#1-smart-contract-vulnerability-in-pendle-contracts) * [2\. Smart contract vulnerability in underlying protocols:](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#2-smart-contract-vulnerability-in-underlying-protocols) * [3\. Oracle exploit:](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#3-oracle-exploit) * [4\. Insufficient LP liquidity for liquidation in a short duration](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#4-insufficient-lp-liquidity-for-liquidation-in-a-short-duration) * [5\. Highly volatile LP price could liquidate users unnecessarily](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#5-highly-volatile-lp-price-could-liquidate-users-unnecessarily) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Sanity checks for PT Integrations | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks#__docusaurus_skipToContent_fallback) On this page ### Sanity check for PT Oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks#sanity-check-for-pt-oracle "Direct link to Sanity check for PT Oracle") After integrating an oracle for PT price (assuming it's a PT/stable price), you should do these steps to quickly check the oracle's correctness: 1. Get the TWAP PT price from your oracle implementation. 2. Go to Pendle Market page for the PT, click the "Price" tab and check the PT price in terms of the underlying asset. In almost all cases, PT absolute price (in terms of the underlying asset) does not fluctuate that much over 30m-1hr. 3. Multiply the price in step 2 with the price of the underlying asset. Please take note which underlying asset it is from the Pendle Frontend. ![Step 3](https://docs.pendle.finance/assets/images/checkPtPrice-f981917d45f283d7af29790a4cf852ac.jpg "Step 3") 4. Compare the price in step 1 with the price in step 3. They should be almost identical. If there's a difference of more than 0.2%, something is likely wrong and please ask the Pendle team to help double check. Sanity checks for PT liquidity ============================== If you need to assess PT liquidity and PT price volatility (when doing risk assessment for PT as a collateral or other similar use cases), you should do these sanity checks: ### Check PT/underlying asset price volatility[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks#check-ptunderlying-asset-price-volatility "Direct link to Check PT/underlying asset price volatility") 1. Go to Pendle Market page for the PT, click the "Price" tab and check the volatility of PT/Underlying asset price 2. From there, you could gauge the volatility of PT/stable price ### Check PT liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks#check-pt-liquidity "Direct link to Check PT liquidity") You can check the price impact of different swap sizes (in either direction) for PT 1. Go to Pendle Market page for the PT, click the "Price" tab 2. Simulate a trade to sell or buy PT from the underlying asset 3. Check the price impact ![Check price impact](https://docs.pendle.finance/assets/images/PTPriceImpact-6ed714e81148316eb99e0d68b9458caa.jpg "Check price impact") * [Sanity check for PT Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks#sanity-check-for-pt-oracle) * [Check PT/underlying asset price volatility](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks#check-ptunderlying-asset-price-volatility) * [Check PT liquidity](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks#check-pt-liquidity) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Limit Order Contract | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#__docusaurus_skipToContent_fallback) On this page The Limit Order contract is where limit orders are settled, allowing orders to be generated off-chain and settled on-chain. The Limit Order contract provides methods to support: 1. Makers canceling their orders. 2. Takers filling orders. 3. A callback function to support arbitrageurs arbitraging limit orders. You can find the contract's implementation [here](https://github.com/pendle-finance/pendle-core-v2/tree/main/contracts/limit) . Order Struct Definition[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#order-struct-definition "Direct link to Order Struct Definition") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- interface IPLimitOrderType { enum OrderType { SY_FOR_PT, PT_FOR_SY, SY_FOR_YT, YT_FOR_SY }}struct Order { uint256 salt; uint256 expiry; uint256 nonce; IPLimitOrderType.OrderType orderType; address token; address YT; address maker; address receiver; uint256 makingAmount; uint256 lnImpliedRate; uint256 failSafeRate; bytes permit;} You can find the contract's implementation [here](https://github.com/pendle-finance/pendle-core-v2/tree/main/contracts/limit) . Field Explanations[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#field-explanations "Direct link to Field Explanations") ------------------------------------------------------------------------------------------------------------------------------------------------------------- * `salt`: A randomly generated number that differentiates between orders. * `expiry`: The expiration timestamp of the order. Orders cannot be settled on-chain after this point. * `nonce`: This field allows makers to cancel all their created orders by simply increasing the nonce. All orders with a nonce less than the current nonce will be invalid. Orders are typically created with a nonce equal to the current nonce at the time of creation. * `orderType`: Indicates the type of trade. There are four types of limit orders: 1. `SY_FOR_PT`: Swap SY (or another SY's token in) for PT. 2. `PT_FOR_SY`: Swap PT for SY (or another SY's token out). 3. `SY_FOR_YT`: Swap SY (or another SY's token in) for YT. 4. `YT_FOR_SY`: Swap YT for SY (or another SY's token out). * `token`: Specifies which token to use for the order. If the orderType is SY\_FOR\_PT or SY\_FOR\_YT, this is the token-in address. Otherwise, it's the token-out address. * `YT`: The YT address for this limit order. From this address, you can derive the SY and PT addresses. * `maker`: The address of the maker who created the order. * `receiver`: The address of the receiver, who will get the output amount if the order is settled. * `makingAmount`: The amount of input token used to create the order. If the orderType is SY\_FOR\_PT or SY\_FOR\_YT, the makingAmount is the SY amount. If PT\_FOR\_SY or YT\_FOR\_SY, it refers to the PT or YT amount, respectively. * `lnImpliedRate`: The natural logarithm of the implied rate, formatted as a uint256 by multiplying by 10^18 and then rounding to an integer. You can find the actual implied APY with the formula: exp(lnImpliedRate/1018)−1exp(lnImpliedRate/10^{18}) - 1exp(lnImpliedRate/1018)−1. * `failSafeRate`: If at the time the limit order is settled, the rate of converting input token to SY or converting from SY to output token (based on the type of order) is lower than this failSafeRate, the order will not be settled. * `permit`: Reserved for future use. Method Definitions[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#method-definitions "Direct link to Method Definitions") ------------------------------------------------------------------------------------------------------------------------------------------------------------- ### hashOrder[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#hashorder "Direct link to hashOrder") This function returns a unique hash for a given order, allowing you to get the order's status later. function hashOrder(Order memory order) external view returns (bytes32); #### Parameters:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#parameters "Direct link to Parameters:") * `order`: The order to be hashed. #### Returns:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#returns "Direct link to Returns:") * The unique hash of the order. ### cancelSingle[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#cancelsingle "Direct link to cancelSingle") This method cancels a specific limit order. Once canceled, the order cannot be filled or settled. function cancelSingle(Order calldata order) external; #### Parameters:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#parameters-1 "Direct link to Parameters:") * `order`: The limit order to be canceled. ### cancelBatch[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#cancelbatch "Direct link to cancelBatch") This method allows you to cancel multiple limit orders in a single transaction. function cancelBatch(Order[] calldata orders) external; #### Parameters:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#parameters-2 "Direct link to Parameters:") * `orders`: An array of limit orders to be canceled. ### orderStatusesRaw[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#orderstatusesraw "Direct link to orderStatusesRaw") This method retrieves raw remaining and filled amounts for specified orders. function orderStatusesRaw( bytes32[] memory orderHashes) external view returns (uint256[] memory remainingsRaw, uint256[] memory filledAmounts); #### Parameters:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#parameters-3 "Direct link to Parameters:") * `orderHashes`: An array of hashes identifying the orders for which statuses are requested. #### Returns:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#returns-1 "Direct link to Returns:") * `remainingsRaw`: The raw remaining amounts for each order. If `remainingsRaw` is zero, the order is unknown to the contract. To distinguish between unknown orders and fully filled orders, known orders have `remainingsRaw` increased by one. For example, if an order has a real remaining of `100`, its `remainingsRaw` will be `101`. Fully filled or canceled orders will have `remainingsRaw` set to one. * `filledAmounts`: The filled amounts for each order. ### fill[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#fill "Direct link to fill") The `fill` function allows you to fill one or more limit orders. This is a key operation in a limit order system, where takers fill the orders submitted by makers. It has several parameters and returns multiple values, indicating the outcome of the fill operation. function fill( FillOrderParams[] memory params, address receiver, uint256 maxTaking, bytes calldata optData, bytes calldata callback ) external returns (uint256 actualMaking, uint256 actualTaking, uint256 totalFee, bytes memory callbackReturn); #### Parameters:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#parameters-4 "Direct link to Parameters:") * `params`: An array of `FillOrderParams`, specifying the orders to be filled, including order data, signatures, and the amount the taker intends to fill. * `receiver`: The address that receives the output tokens when the orders are filled, typically the taker's address. * `maxTaking`: The maximum amount of tokens that can be taken from the taker. * `optData`: Reserved for future use. Pass empty bytes (`'0x'`). * `callback`: Optional callback data for executing additional logic. For most cases, you can pass empty bytes. See the callback part below for more details. #### Returns:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#returns-2 "Direct link to Returns:") * `actualMaking`: The total amount of tokens received by the taker from the fill operation. * `actualTaking`: The total amount of tokens taken from the taker to complete the fill operation. * `totalFee`: The total fee incurred during the fill operation. * `callbackReturn`: Data returned from the callback function, if used. Callback Mechanism[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#callback-mechanism "Direct link to Callback Mechanism") ------------------------------------------------------------------------------------------------------------------------------------------------------------- The `fill` function supports a callback mechanism for executing additional logic during the filling process, making it versatile for arbitrage and other custom operations. ### Callback Interface[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#callback-interface "Direct link to Callback Interface") The callback mechanism allows additional logic to be executed during the fill operation. Here's the interface for the callback function: interface IPLimitRouterCallback { function limitRouterCallback( uint256 actualMaking, uint256 actualTaking, uint256 totalFee, bytes memory data ) external returns (bytes memory);} #### Parameters:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#parameters-5 "Direct link to Parameters:") * `actualMaking`: The amount of tokens received by the taker's contract from the fill operation. This amount is in SY if the orderType is `SY_FOR_PT` or `SY_FOR_YT`, in PT if it's `PT_FOR_SY`, and in YT if it's `YT_FOR_SY`. * `actualTaking`: The amount of tokens the taker's contract must send to the limit order router to complete the fill. This amount is in SY if `PT_FOR_SY` or `YT_FOR_SY`, in PT if it's `SY_FOR_PT`, and in YT if it's `SY_FOR_YT`. * `totalFee`: The total fee for the operation. * `data`: Additional data provided during the `fill` operation. This corresponds to the callback parameter in the `fill` function. #### Returns:[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#returns-3 "Direct link to Returns:") * `bytes`: Optional return data from the callback function. ### Callback Flow and Arbitrage Use Cases[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#callback-flow-and-arbitrage-use-cases "Direct link to Callback Flow and Arbitrage Use Cases") The callback mechanism enables complex interactions and arbitrage opportunities. Here's a simplified flow for using the callback feature: 1. **Taker Contract Calls `fill`**: The `fill` function is called with the specified parameters and the callback data. 2. **Tokens Are Transferred**: The `actualMaking` amount is transferred to the receiver (typically the taker's contract). 3. **Callback Function Is Invoked**: The callback function (`limitRouterCallback`) is called with the `actualMaking`, `actualTaking`, and `totalFee` values, along with the callback parameter in `fill`. 4. **Callback Logic Executes**: The taker's contract can perform additional operations during the callback, such as arbitrage with Pendle's AMM or other limit orders. The goal is to use the `actualMaking` amount to generate more value than the `actualTaking` amount, creating a profit. 5. **Send Tokens to Complete**: The taker's contract must send back the `actualTaking` amount to ensure the fill operation completes successfully. 6. **Limit Order Contract Sends Output**: Once the taker's contract sends the required tokens, the limit order contract transfers the agreed output to the limit order receivers. ![Limit Order Callback Flow](https://docs.pendle.finance/assets/images/limit_order_callback_flow-bcca747a2640e9e901a6987f45b6ee20.png "Limit Order Callback Flow") This flow allows for flexible and creative use of the `fill` function, providing opportunities for arbitrage and custom contract logic. Arbitrageurs can take advantage of this mechanism to execute strategies that generate profit by finding discrepancies in token values or other market inefficiencies. * [Order Struct Definition](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#order-struct-definition) * [Field Explanations](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#field-explanations) * [Method Definitions](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#method-definitions) * [hashOrder](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#hashorder) * [cancelSingle](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#cancelsingle) * [cancelBatch](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#cancelbatch) * [orderStatusesRaw](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#orderstatusesraw) * [fill](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#fill) * [Callback Mechanism](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#callback-mechanism) * [Callback Interface](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#callback-interface) * [Callback Flow and Arbitrage Use Cases](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract#callback-flow-and-arbitrage-use-cases) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # YT | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/YT#__docusaurus_skipToContent_fallback) On this page Yield Token (YT) represents the yield component of an underlying yield-bearing asset. By holding YT, yield from the underlying asset will be streamed to the users, up until maturity. This rate of yield production is represented as “[Underlying APY](https://docs.pendle.finance/ProtocolMechanics/Glossary) ” in the Pendle app. For example, buying 10 YT-wstETH (stETH) and holding them for 5 days lets you receive all of the yield equivalent to a 10 stETH within the same period of time. ### Leveraged Yield Exposure[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/YT#leveraged-yield-exposure "Direct link to Leveraged Yield Exposure") Because YTs are purchased for a fraction of the underlying asset's price, they offer **leveraged exposure** to its yield. A small change in the underlying APY can result in a significant percentage change in the YT's return. This makes YT a powerful instrument for yield speculation and points farming. ### Value Decay[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/YT#value-decay "Direct link to Value Decay") The value of YT trends towards 0asitapproachesmaturity(∗ceterisparibus∗),becoming0 as it approaches maturity (\*ceteris paribus\*), becoming 0asitapproachesmaturity(∗ceterisparibus∗),becoming0 upon maturity. If the implied yield remains constant, the YT's price decreases linearly with the time remaining — a YT with 15 days left to maturity will be worth roughly half the price it was when it had 30 days left. Users profit when the total yield collected up to that point ends up being higher than the cost of YT acquisition. You can think of [Implied APY](https://docs.pendle.finance/ProtocolMechanics/Glossary) as the “rate” at which YT is priced by the market. If the average Underlying APY ends up being higher than the “rate” or Implied APY that you paid for, you will profit. As such, buying YT can be treated as “longing the yield” of an asset. ### Points Farming[​](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/YT#points-farming "Direct link to Points Farming") YTs are a popular instrument for farming points from airdrop campaigns, as they capture all points from the underlying asset, often with significant leverage. Since 1 YT earns the same points as 1 unit of the underlying asset, and YTs cost only a fraction of the underlying, users can achieve multiplied points exposure. You can learn more about yield trading on Pendle [here](https://app.pendle.finance/trade/education/learn) . Note: YT yields are distributed as SY, which can be unwrapped back into the underlying asset using [SY Unwrapper](https://docs.pendle.finance/ProtocolMechanics/YieldTokenization/SY) . Claiming YT Yield ================= ![Claiming YT Yield](https://docs.pendle.finance/assets/images/claiming-yt-yield-7b152f054e10e37733de9a24a7214d3a.png "Claiming YT Yield") You can claim any earned YT (and LP) yield and rewards from the [Pendle Dashboard](https://app.pendle.finance/trade/dashboard/overview?timeframe=allTime&inUsd=false) anytime, even before maturity. Since YT = $0 upon maturity, no further action (aside from claiming yield) is required. * [Leveraged Yield Exposure](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/YT#leveraged-yield-exposure) * [Value Decay](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/YT#value-decay) * [Points Farming](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/YieldTokenization/YT#points-farming) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Limit Orders | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#__docusaurus_skipToContent_fallback) On this page Pendle's Limit Order system enables gasless, off-chain order creation with secure on-chain settlement. It allows users to place orders at specific implied APY rates, which are matched and settled through the Limit Order smart contract. How It Works[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#how-it-works "Direct link to How It Works") --------------------------------------------------------------------------------------------------------------------------------- 1. **Makers** create and sign limit orders off-chain (no gas required). Orders specify a desired implied APY rate and are stored on Pendle's backend. 2. **Takers** query available orders via the API and fill them on-chain by calling the Limit Order contract. 3. The **Limit Order contract** settles orders atomically, transferring tokens between makers and takers at the agreed rates. Limit orders are also integrated into the [Pendle Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) — when enabled, the SDK automatically includes limit order liquidity alongside AMM liquidity to improve execution prices, especially for large trades. Order Types[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#order-types "Direct link to Order Types") ------------------------------------------------------------------------------------------------------------------------------ | Order Type | Description | | --- | --- | | `SY_FOR_PT` | Swap SY (or a supported token) for PT | | `PT_FOR_SY` | Swap PT for SY (or a supported token) | | `SY_FOR_YT` | Swap SY (or a supported token) for YT | | `YT_FOR_SY` | Swap YT for SY (or a supported token) | Sections[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#sections "Direct link to Sections") --------------------------------------------------------------------------------------------------------------------- * [**Limit Order Contract**](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract) — Smart contract reference: order struct, method definitions, and callback mechanism * [**Create a Limit Order**](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder) — Guide for makers: generate, sign, and submit orders * [**Cancel Limit Orders**](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders) — Guide for makers: cancel specific orders or invalidate all via nonce * [**Fill a Limit Order**](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder) — Guide for takers: query and fill orders on-chain API Reference[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#api-reference "Direct link to API Reference") ------------------------------------------------------------------------------------------------------------------------------------ * [Maker APIs](https://api-v2.pendle.finance/limit-order/docs#/Maker) — Generate order data, submit orders, view active orders * [Taker APIs](https://api-v2.pendle.finance/limit-order/docs#/Taker) — Query available orders for filling Maker Incentives[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#maker-incentives "Direct link to Maker Incentives") --------------------------------------------------------------------------------------------------------------------------------------------- Certain markets offer token rewards to makers who provide liquidity through limit orders. ### How Incentives Work[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#how-incentives-work "Direct link to How Incentives Work") * **Epochs**: Incentives are distributed on a weekly basis. * **Qualifying orders**: To be eligible, an order must be placed within the market's configured APY range and remain active for a minimum period. Orders that are placed and immediately canceled do not qualify. * **Reward calculation**: Rewards are proportional to your order's effective making amount relative to the total qualifying volume within the epoch. ### Incentive Modes[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#incentive-modes "Direct link to Incentive Modes") | Mode | Description | | --- | --- | | `RELATIVE` | Rewards apply to orders placed within a configured APY range relative to the current market rate | | `ABSOLUTE` | Rewards apply to orders placed within a fixed APY range | ### Qualifying for Rewards[​](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#qualifying-for-rewards "Direct link to Qualifying for Rewards") 1. Check whether the market has an active incentive program. 2. Place an order within the market's configured APY range. 3. Keep the order active — rewards accumulate proportionally to your share of total qualifying making volume within the epoch. * [How It Works](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#how-it-works) * [Order Types](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#order-types) * [Sections](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#sections) * [API Reference](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#api-reference) * [Maker Incentives](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#maker-incentives) * [How Incentives Work](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#how-incentives-work) * [Incentive Modes](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#incentive-modes) * [Qualifying for Rewards](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview#qualifying-for-rewards) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Linear Discount Oracle Wrapper | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#__docusaurus_skipToContent_fallback) On this page **Sources:** * [`PendleLinearDiscountOracleWrapper.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/StatelessWrapper/PendleLinearDiscountOracleWrapper.sol) * [`PendleSparkLinearDiscountOracleFactoryWrapper.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/StatelessWrapper/PendleSparkLinearDiscountOracleFactoryWrapper.sol) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#overview "Direct link to Overview") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- `PendleLinearDiscountOracleWrapper` is a thin stateless wrapper that fixes the one incompatibility between Pendle's deterministic oracles and Chainlink-consuming protocols: the `updatedAt` field. Pendle's deterministic oracles (`PendleSparkLinearDiscountOracle`, `PendleLpLinearDiscountOracle`) return `updatedAt = 0` in `latestRoundData()` because their prices are computed entirely from `block.timestamp` and immutable constructor parameters — they are never "stale" by design. However, most lending protocols enforce a staleness check of the form `block.timestamp - updatedAt < threshold`, which will reject any feed that returns `updatedAt = 0`. The wrapper solves this by forwarding all fields from the inner oracle unchanged, **except `updatedAt`**, which it overwrites with `block.timestamp`. * * * When to Use the Wrapper[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#when-to-use-the-wrapper "Direct link to When to Use the Wrapper") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **Does your protocol check `updatedAt` staleness?** * **No** — Deploy `PendleSparkLinearDiscountOracle` directly via `PendleSparkLinearDiscountOracleFactory`. * **Yes** (most lending protocols) — Deploy via `PendleSparkLinearDiscountOracleFactoryWrapper`. The wrapper always returns `updatedAt = block.timestamp`, satisfying any staleness threshold. * **You already have a bare oracle** — Call `PendleSparkLinearDiscountOracleFactoryWrapper.wrap(existingOracle)` to add the wrapper without redeploying. LP oracle has no factory wrapper `PendleLpLinearDiscountOracle` does not have a dedicated factory wrapper contract. To apply the wrapper to an LP oracle, deploy `PendleLpLinearDiscountOracle` via `PendleLpLinearDiscountOracleFactory`, then wrap the deployed address manually: address lpOracle = lpFactory.create(market, baseLpDiscountPerYear, lpMaturedPrice);address lpWrapped = address(new PendleLinearDiscountOracleWrapper(lpOracle)); * * * `PendleLinearDiscountOracleWrapper`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#pendlelineardiscountoraclewrapper "Direct link to pendlelineardiscountoraclewrapper") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ A minimal proxy that wraps **any** `IPChainlinkOracleEssential`\-compatible oracle and replaces its `updatedAt` with `block.timestamp`. contract PendleLinearDiscountOracleWrapper is IPChainlinkOracleEssential { IPChainlinkOracleEssential public immutable innerOracle; constructor(address _innerOracle);} ### `latestRoundData`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#latestrounddata "Direct link to latestrounddata") function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, // overwritten to block.timestamp uint80 answeredInRound ); All fields are forwarded from `innerOracle.latestRoundData()`, except `updatedAt` which is replaced with `block.timestamp`. The `answer` (the discount factor or LP price) is not modified in any way. ### `decimals`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#decimals "Direct link to decimals") function decimals() external view returns (uint8); Delegates directly to `innerOracle.decimals()`. Returns `18` for all Pendle deterministic oracles. * * * `PendleSparkLinearDiscountOracleFactoryWrapper`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#pendlesparklineardiscountoraclefactorywrapper "Direct link to pendlesparklineardiscountoraclefactorywrapper") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ A convenience contract that combines `PendleSparkLinearDiscountOracleFactory` and `PendleLinearDiscountOracleWrapper` into a single deployment step. Calling `createWithPt` or `createWithMarket` on this contract: 1. Deploys a `PendleSparkLinearDiscountOracle` (via the inner factory) 2. Immediately wraps it in `PendleLinearDiscountOracleWrapper` 3. Returns the **wrapper address** — the address your protocol should point at Emits `WrapperOracleCreated(address indexed innerOracle, address indexed wrapper)` on each deployment. contract PendleSparkLinearDiscountOracleFactoryWrapper { PendleSparkLinearDiscountOracleFactory public immutable innerFactory; constructor(address _innerFactory);} ### `createWithPt`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#createwithpt "Direct link to createwithpt") function createWithPt( address pt, uint256 baseDiscountPerYear) external returns (address wrapper); Deploys a `PendleSparkLinearDiscountOracle` for the given PT address, then wraps it. Returns the wrapper address. ### `createWithMarket`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#createwithmarket "Direct link to createwithmarket") function createWithMarket( address market, uint256 baseDiscountPerYear) external returns (address wrapper); Derives the PT address from `IPMarket(market).readTokens()`, then proceeds identically to `createWithPt`. ### `wrap`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#wrap "Direct link to wrap") function wrap(address innerOracle) public returns (address wrapper); Wraps an already-deployed `IPChainlinkOracleEssential`\-compatible oracle in a new `PendleLinearDiscountOracleWrapper`. Useful if you deployed an oracle via `PendleSparkLinearDiscountOracleFactory` directly and need to add the wrapper afterwards. **Deployment addresses:** Find the factory wrapper address for each chain under `"sparkLinearDiscountOracleFactoryWrapper"` in the [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) . * * * Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#further-reading "Direct link to Further Reading") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * [Spark Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle) — full contract reference for the PT oracle * [LP Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle) — full contract reference for the LP oracle * [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) — guidance on setting `baseDiscountPerYear` * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#overview) * [When to Use the Wrapper](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#when-to-use-the-wrapper) * [`PendleLinearDiscountOracleWrapper`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#pendlelineardiscountoraclewrapper) * [`latestRoundData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#latestrounddata) * [`decimals`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#decimals) * [`PendleSparkLinearDiscountOracleFactoryWrapper`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#pendlesparklineardiscountoraclefactorywrapper) * [`createWithPt`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#createwithpt) * [`createWithMarket`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#createwithmarket) * [`wrap`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#wrap) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Simple Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#__docusaurus_skipToContent_fallback) On this page This document lists simplified versions of Pendle Router functions that use on-chain approximation algorithms instead of requiring complex parameters. These functions are automatically used by the main router when conditions allow for simplified execution. Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#overview "Direct link to Overview") ----------------------------------------------------------------------------------------------------------------------------------------------------- The Pendle Router includes simplified versions of complex functions that: * Use on-chain approximation algorithms (no `ApproxParams` needed) * Skip limit order functionality (no `LimitOrderData` needed) * Provide streamlined interfaces for common operations * Are automatically selected when no off-chain guess is provided and limit order data is empty Important Notes[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#important-notes "Direct link to Important Notes") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ⚠️ **Limited Flexibility**: Simple functions don't support limit orders or custom approximation parameters. ⚠️ **Market Dependent**: Effectiveness depends on current market conditions and may not always be available. The simple functions provide a streamlined interface for common operations while maintaining the full functionality of the Pendle trading system through automated approximation algorithms. PT Trading Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#pt-trading-functions "Direct link to PT Trading Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapExactTokenForPtSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexacttokenforptsimple "Direct link to swapExactTokenForPtSimple") Simplified version of `swapExactTokenForPt` using on-chain approximation. function swapExactTokenForPtSimple( address receiver, address market, uint256 minPtOut, TokenInput calldata input) external payable returns (uint256 netPtOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT tokens | | market | `address` | Pendle market address | | minPtOut | `uint256` | Minimum PT tokens to receive | | input | `TokenInput` | Token input configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens generated from input token | ### swapExactSyForPtSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexactsyforptsimple "Direct link to swapExactSyForPtSimple") Simplified version of `swapExactSyForPt` using on-chain approximation. function swapExactSyForPtSimple( address receiver, address market, uint256 exactSyIn, uint256 minPtOut) external returns (uint256 netPtOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT tokens | | market | `address` | Pendle market address | | exactSyIn | `uint256` | Exact amount of SY tokens to swap | | minPtOut | `uint256` | Minimum PT tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | YT Trading Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#yt-trading-functions "Direct link to YT Trading Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapExactTokenForYtSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexacttokenforytsimple "Direct link to swapExactTokenForYtSimple") Simplified version of `swapExactTokenForYt` using on-chain approximation. function swapExactTokenForYtSimple( address receiver, address market, uint256 minYtOut, TokenInput calldata input) external payable returns (uint256 netYtOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive YT tokens | | market | `address` | Pendle market address | | minYtOut | `uint256` | Minimum YT tokens to receive | | input | `TokenInput` | Token input configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtOut | `uint256` | YT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens generated from input token | ### swapExactSyForYtSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexactsyforytsimple "Direct link to swapExactSyForYtSimple") Simplified version of `swapExactSyForYt` using on-chain approximation. function swapExactSyForYtSimple( address receiver, address market, uint256 exactSyIn, uint256 minYtOut) external returns (uint256 netYtOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive YT tokens | | market | `address` | Pendle market address | | exactSyIn | `uint256` | Exact amount of SY tokens to swap | | minYtOut | `uint256` | Minimum YT tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtOut | `uint256` | YT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | Liquidity Management Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#liquidity-management-functions "Direct link to Liquidity Management Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### addLiquiditySingleTokenSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysingletokensimple "Direct link to addLiquiditySingleTokenSimple") Simplified version of `addLiquiditySingleToken` using on-chain approximation. function addLiquiditySingleTokenSimple( address receiver, address market, uint256 minLpOut, TokenInput calldata input) external payable returns (uint256 netLpOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | minLpOut | `uint256` | Minimum LP tokens to receive | | input | `TokenInput` | Token input configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens generated from input token | ### addLiquiditySingleSySimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysinglesysimple "Direct link to addLiquiditySingleSySimple") Simplified version of `addLiquiditySingleSy` using on-chain approximation. function addLiquiditySingleSySimple( address receiver, address market, uint256 netSyIn, uint256 minLpOut) external returns (uint256 netLpOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | netSyIn | `uint256` | Amount of SY tokens to use | | minLpOut | `uint256` | Minimum LP tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyFee | `uint256` | Trading fees paid in SY | ### addLiquiditySinglePtSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysingleptsimple "Direct link to addLiquiditySinglePtSimple") Simplified version of `addLiquiditySinglePt` using on-chain approximation. function addLiquiditySinglePtSimple( address receiver, address market, uint256 netPtIn, uint256 minLpOut) external returns (uint256 netLpOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | netPtIn | `uint256` | Amount of PT tokens to use | | minLpOut | `uint256` | Minimum LP tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyFee | `uint256` | Trading fees paid in SY | ### removeLiquiditySinglePtSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#removeliquiditysingleptsimple "Direct link to removeLiquiditySinglePtSimple") Simplified version of `removeLiquiditySinglePt` using on-chain approximation. function removeLiquiditySinglePtSimple( address receiver, address market, uint256 netLpToRemove, uint256 minPtOut) external returns (uint256 netPtOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT tokens | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | Amount of LP tokens to burn | | minPtOut | `uint256` | Minimum PT tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | When Simple Functions Are Used[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#when-simple-functions-are-used "Direct link to When Simple Functions Are Used") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Pendle Router automatically determines when to use simplified functions. Simple functions are used when: 1. **No limit orders**: `LimitOrderData` is empty 2. **No off-chain guess**: `ApproxParams` doesn't include off-chain calculated estimates 3. **Default parameters**: Standard approximation parameters are used Advantages of Simple Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#advantages-of-simple-functions "Direct link to Advantages of Simple Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **Ease of Use**: Require fewer parameters and no complex configuration. **Reliability**: Built-in approximation algorithms are optimized for common trading scenarios. **Automatic Selection**: The main router functions automatically delegate to simple versions when no off-chain guess is provided and limit order data is empty. Integration Approach[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#integration-approach "Direct link to Integration Approach") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **Recommended Pattern**: Always use the main router functions (e.g., `swapExactTokenForPt`) with default parameters. The router will automatically use simple versions when optimal. // This may automatically use the simple versionrouter.swapExactTokenForPt( receiver, market, minPtOut, createDefaultApproxParams(), createTokenInputSimple(tokenIn, amountIn), createEmptyLimitOrderData()); **Direct Usage**: Only call simple functions directly if you're building custom routing logic and want to force the use of on-chain approximation. * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#overview) * [Important Notes](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#important-notes) * [PT Trading Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#pt-trading-functions) * [swapExactTokenForPtSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexacttokenforptsimple) * [swapExactSyForPtSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexactsyforptsimple) * [YT Trading Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#yt-trading-functions) * [swapExactTokenForYtSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexacttokenforytsimple) * [swapExactSyForYtSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexactsyforytsimple) * [Liquidity Management Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#liquidity-management-functions) * [addLiquiditySingleTokenSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysingletokensimple) * [addLiquiditySingleSySimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysinglesysimple) * [addLiquiditySinglePtSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysingleptsimple) * [removeLiquiditySinglePtSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#removeliquiditysingleptsimple) * [When Simple Functions Are Used](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#when-simple-functions-are-used) * [Advantages of Simple Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#advantages-of-simple-functions) * [Integration Approach](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#integration-approach) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # PT as Collateral in a Money Market | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#__docusaurus_skipToContent_fallback) On this page PTs are good collaterals in a money market since it is a fixed rate position (or a zero coupon bond) on an asset. This document discusses the use cases for PT as a collateral, as well as considerations for a money market when integrating PT as a collateral. Main Use Cases[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#main-use-cases "Direct link to Main Use Cases") ------------------------------------------------------------------------------------------------------------------------------------------ #### 1\. Get leveraged APY doing yield arbitrage[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#1-get-leveraged-apy-doing-yield-arbitrage "Direct link to 1. Get leveraged APY doing yield arbitrage") Example: PT-stETH gives a fixed 5% APY, but the ETH borrow rate is only 3% in the money market. * In this case, a user can deposit PT-stETH as collateral, borrow ETH, swap borrowed ETH to more PT-stETH to use as more collateral, and so on. * As a result, the user will get a leveraged APY in ETH terms, benefiting from the difference between the PT fixed rate and ETH borrow rate * If the collateral factor is 0.80, the user can leverage 5x their capital to get a maximum APY of 5 \* (5-3) = 10% This use case is similar to depositing a yield bearing asset (like wstETH) and borrowing (ETH) in a money market, but is better due to the certainty from the fixed rate in PT. #### 2\. Leverage short yield[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#2-leverage-short-yield "Direct link to 2. Leverage short yield") * If a user thinks the current fixed yield in Pendle is overvalued (PT is undervalued), they can do the exact step as the previous section (for example, use PT-stETH as collateral to borrow ETH to buy more PT-stETH) to short yield. * If the fixed yield indeed goes down, the user can unwind their position (sell PT to repay the borrowed ETH) for a profit. #### 3\. Leverage long assets while earning fixed yield[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#3-leverage-long-assets-while-earning-fixed-yield "Direct link to 3. Leverage long assets while earning fixed yield") * If a user is bullish on an asset in the long term, they can use its PT as a collateral to borrow stables to buy more PT * For example, a long term ETH holder can use PT-stETH as collateral to borrow USDC to buy more PT-stETH * Essentially, the user will be getting a fixed APY (from PT) on top of their leveraged long position on ETH. Risk analysis for PT as a collateral[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#risk-analysis-for-pt-as-a-collateral "Direct link to Risk analysis for PT as a collateral") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### 1\. Smart contract vulnerability in Pendle contracts:[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#1-smart-contract-vulnerability-in-pendle-contracts "Direct link to 1. Smart contract vulnerability in Pendle contracts:") * If Pendle contracts malfunctions or gets exploited, PT could lose value significantly in a short duration, leading to bad debt for the money market protocol. * Assessment: * Pendle V2 contracts have been audited by 6 auditors, with 3 of the top 4 C4 auditors. Find the audit reports [here](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/audits) . * Pendle V2 contract system's components (SY, YT-PT, Market, sPENDLE) are decoupled from each other, only interacting with the other components via interfaces, decreasing the chance for bugs due to complexity and interwoven logic. * Lindy-ness: There have been no incidents so far in Pendle contracts since June 2021 * Pendle V2 contracts have been live since November 2022 (peak TVL of $93M) * Pendle V1 contracts (with many similar mechanisms to V2) have been live since June 2021, with a peak TVL of $37M * Apart from the core Pendle contracts (for YT-PT and Pendle Market) which remain the same throughout, risk assessment needs to be done on the SY implementation for the particular PT pool. ### 2\. Smart contract vulnerability in underlying protocols:[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#2-smart-contract-vulnerability-in-underlying-protocols "Direct link to 2. Smart contract vulnerability in underlying protocols:") * Each PT is built on top of an underlying yield bearing token (like stETH, USDT staked in Stargate). If the underlying protocol malfunctions or gets exploited, PT could lose value significantly in a short duration, leading to bad debt for the money market * As such, risk assessment should be made for each underlying protocol for each PT. ### 3\. Oracle exploit:[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#3-oracle-exploit "Direct link to 3. Oracle exploit:") * If the oracle for PT price is easily manipulated or exploited, PT price could inflate unnaturally (leading to an attack of using over-priced PT to borrow, and get away with free money leading to bad protocol debt after PT price drops sharply after), or drops sharply (leading to bad debt for the protocol) * Assessment: * Pendle's oracle for PT/asset is permissionless and built into the contract (no maintenance needed), hence liveness and correctness is not a concern. * The PT/asset oracle can return TWAP prices for customisable durations (within 65536 blocks, which is ~9 days for Ethereum), hence is not susceptible to short term or within-a-block manipulation of prices if the TWAP duration used is sufficient. ### 4\. Insufficient PT liquidity for liquidation in a short duration[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#4-insufficient-pt-liquidity-for-liquidation-in-a-short-duration "Direct link to 4. Insufficient PT liquidity for liquidation in a short duration") When PT price drops significantly vs the borrowAsset (say for 20%) and doesn't bounce back, there might not be enough liquidity to liquidate PT collaterals for liquidatable loans, which might lead to bad debt. #### Assessment - Study 1: we want to make sure if PT/borrowAsset price drops significantly in one go, liquidators can liquidate the maximum possible liquidatable PT collaterals in profit[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#assessment---study-1-we-want-to-make-sure-if-ptborrowasset-price-drops-significantly-in-one-go-liquidators-can-liquidate-the-maximum-possible-liquidatable-pt-collaterals-in-profit "Direct link to Assessment - Study 1: we want to make sure if PT/borrowAsset price drops significantly in one go, liquidators can liquidate the maximum possible liquidatable PT collaterals in profit") * Assume the following parameters in the money market: * Collateral factor for PT: `cRatio` * Deposit limit for PT collateral: `dCap` (in dollars) * Let's say after a significant price drop, the maximum portion of loans (using PT collaterals) that will become liquidatable will be `k` (`k` = 0.3 might be a reasonable number. 30% of the borrow becomes liquidate-able in one single moment) * When a position becomes liquidatable, liquidators can liquidate a portion `f` of the liquidatable position (usually 50% in most money markets) * The profit for liquidators is `p` (usually ~5-10% in money markets) * When PT/borrowAsset price drops significantly, we will need to liquidate a maximum of `dCap * cRatio * k` worth of borrow. The maximum amount liquidators can repay and liquidate is `dCap * cRatio * k * f`. The collateral dollar value that liquidators will get (and need to sell) is `dCap * cRatio * k * f * (1+p)` * To make a profitable liquidation, we need to be able to sell these PT collaterals for < `p` price impact (since the profit is `p`) * To sell PT collaterals to borrowAsset, we need to sell PT to SY (a yield bearing position of PT's asset) via Pendle's market, convert SY to asset and sell asset for borrowAsset * Assuming minimal price impact for selling asset to borrowAsset (might not hold for non-bluechip borrow asset), **we just need to make sure that we could sell `dCap * cRatio * k * f * (1+p)` worth of PT with less than `p` price impact.** * Example for listing PT-stETH-Dec2025 in CompoundV2 with a collateral factor `cRatio` of 0.70 * `cRatio = 0.70` * Assume `k = 0.30` * `f = 0.5` in Compound * `p = 0.08` in Compound * Hence, selling `dCap * 0.70 * 0.30 * 0.5 * (1+0.08) = 0.1134 dCap` worth of PT should have a price impact of lower than 8% * As of writing (2 Jun 2023), selling $1M of PT-stETH-Dec2025 has a price impact of 2.5% * Therefore, a `dCap` of 1M/0.1134\=1M / 0.1134 = 1M/0.1134\=8.8M is already pretty safe (since it will be corresponding to a sell of $1M of PT, which only has a 2.5% price impact, well less than 8%) * This could be used as a framework to gauge how reasonable certain numbers for `dCap`, `cRatio` could be for certain PT collateral. * **Important note**: There is a cascading effect, where PT price dropping due to the collateral sell could lead to more liquidation. Ideally, the factor `k` should already take this into account (basically, after all the cascading effect from PT price dropping due to liquidations, what's the proportion of PT-collateralised loans that will become liquidatable). In the most extreme assumption, we could assume `k=1` for the strictest analysis. #### Assessment - On collateral factor for PT[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#assessment---on-collateral-factor-for-pt "Direct link to Assessment - On collateral factor for PT") * Study 1 is already the strictest analysis, where all the liquidatble PT collaterals can be liquidated in one go. * Due to the nature of Pendle AMM which is specialised for trading PTs (it concentrates liquidity, taking into account how PT will converge to the underlying asset), price impact for selling an amount of PT is much smaller than a normal pool of the same liquidity can provide. * When setting collateral factor for PT, the bottom line is to protect the money market from bad debt, in case PT/borrowAsset price drops so fast that liquidations can't happen fast enough to liquidate the liquidatable accounts. * In terms of "being able to liquidate PTs fast enough", there are two factors: 1. Liquidity for liquidating PTs, to support liquidating PTs in a short duration. 2. The liquidation system which needs to be functional and reacts fast enough to liquidate in time * For i: it's already covered in Study 1, so theoretically if the equation (taking into account the important note) in Study 1 holds, it's good (even if cRatio is 0.90). This is assuming a highly efficient liquidation system that could liquidate immediately. * For ii: it depends on how mature and decentralised the liquidation ecosystem for the money market is. If the liquidators are highly active/efficient, collateral factors could be set higher * In another approach for thinking about setting collateral factor for PT: it could be similar to the collateral factor for PT's asset in the money market, since PT price will fluctuate along the asset's price. * Since it's generally troublesome to decrease collateral factor and much easier to increase it, it's generally a good approach to start with more conservative collateral factors ### 5\. Highly volatile PT price could liquidate users unnecessarily[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#5-highly-volatile-pt-price-could-liquidate-users-unnecessarily "Direct link to 5. Highly volatile PT price could liquidate users unnecessarily") * If PT prices are too volatile, a temporary dip in PT price could liquidate certain users unnecessarily * Assessment: * In normal circumstances, PT price in terms of asset should not fluctuate as wildly as normal asset prices since it's based on people trading interest rates (which don't change too often). * Depending on the nature of the PT collateral (nature of the interest rate, and liquidity of the pool), an appropriate TWAP duration could be used in the oracle, to minimise liquidations due to temporary dips in PT prices. * [Main Use Cases](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#main-use-cases) * [Risk analysis for PT as a collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#risk-analysis-for-pt-as-a-collateral) * [1\. Smart contract vulnerability in Pendle contracts:](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#1-smart-contract-vulnerability-in-pendle-contracts) * [2\. Smart contract vulnerability in underlying protocols:](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#2-smart-contract-vulnerability-in-underlying-protocols) * [3\. Oracle exploit:](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#3-oracle-exploit) * [4\. Insufficient PT liquidity for liquidation in a short duration](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#4-insufficient-pt-liquidity-for-liquidation-in-a-short-duration) * [5\. Highly volatile PT price could liquidate users unnecessarily](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#5-highly-volatile-pt-price-could-liquidate-users-unnecessarily) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Yield Token (YT) Trading Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#__docusaurus_skipToContent_fallback) On this page This document covers all functions for trading Yield Tokens (YT) in Pendle markets. YT tokens represent the yield portion of yield-bearing assets and can be traded against other tokens or SY tokens. Token to YT Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#token-to-yt-trading "Direct link to Token to YT Trading") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Since the AMM only supports swaps by exact YT, to swap exact tokens for YT requires binary search approximation to find the correct amount of SY needed to achieve the desired YT output. For best usage, use the [SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#features) for better approximation since running binary search on-chain is costly. ### swapExactTokenForYt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexacttokenforyt "Direct link to swapExactTokenForYt") Swaps an exact amount of any supported token for YT tokens. function swapExactTokenForYt( address receiver, address market, uint256 minYtOut, ApproxParams calldata guessYtOut, TokenInput calldata input, LimitOrderData calldata limit) external payable returns (uint256 netYtOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive YT tokens | | market | `address` | Pendle market address | | minYtOut | `uint256` | Minimum YT tokens to receive | | guessYtOut | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | input | [`TokenInput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) | Token input configuration | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtOut | `uint256` | YT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens generated from input token | **Use Case** Most common function for buying YT tokens with any supported token. The function converts your token to SY and then swaps SY for YT, first filling available limit orders, then using the AMM for any remaining amount. **Simple Version Available** For basic operations without custom parameters, use [`swapExactTokenForYtSimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexacttokenforytsimple) which automatically handles approximation and skips limit order functionality. ### swapExactSyForYt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexactsyforyt "Direct link to swapExactSyForYt") Swaps an exact amount of SY tokens for YT tokens. function swapExactSyForYt( address receiver, address market, uint256 exactSyIn, uint256 minYtOut, ApproxParams calldata guessYtOut, LimitOrderData calldata limit) external returns (uint256 netYtOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive YT tokens | | market | `address` | Pendle market address | | exactSyIn | `uint256` | Exact amount of SY tokens to swap | | minYtOut | `uint256` | Minimum YT tokens to receive | | guessYtOut | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtOut | `uint256` | YT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** Direct and efficient method when you already have SY tokens and want to buy YT tokens. **Simple Version Available** For basic operations without custom parameters, use [`swapExactSyForYtSimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexactsyforytsimple) which automatically handles approximation and skips limit order functionality. YT to Token Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#yt-to-token-trading "Direct link to YT to Token Trading") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapExactYtForToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexactytfortoken "Direct link to swapExactYtForToken") Swaps an exact amount of YT tokens for any supported token. function swapExactYtForToken( address receiver, address market, uint256 exactYtIn, TokenOutput calldata output, LimitOrderData calldata limit) external returns (uint256 netTokenOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | market | `address` | Pendle market address | | exactYtIn | `uint256` | Exact amount of YT tokens to swap | | output | [`TokenOutput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput) | Token output configuration | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Amount of tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens before conversion | **Use Case** Most common function for selling YT tokens to receive tokens. The function swaps YT for SY (first filling available limit orders, then using the AMM), then converts SY to your desired token. ### swapExactYtForSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexactytforsy "Direct link to swapExactYtForSy") Swaps an exact amount of YT tokens for SY tokens. function swapExactYtForSy( address receiver, address market, uint256 exactYtIn, uint256 minSyOut, LimitOrderData calldata limit) external returns (uint256 netSyOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive SY tokens | | market | `address` | Pendle market address | | exactYtIn | `uint256` | Exact amount of YT tokens to swap | | minSyOut | `uint256` | Minimum SY tokens to receive | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** Direct and efficient method for selling YT tokens to receive SY tokens. Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#integration-examples "Direct link to Integration Examples") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Buying YT-sUSDe with USDe[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#buying-yt-susde-with-usde "Direct link to Buying YT-sUSDe with USDe") // Swap 1000 USDe for YT-sUSDe tokensrouter.swapExactTokenForYt( msg.sender, PT_SUSDE_MARKET_ADDRESS, minYtOut, createDefaultApproxParams(), createTokenInputSimple(USDE_ADDRESS, 1000e18), createEmptyLimitOrderData()); ### Selling YT-sUSDe for USDe[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#selling-yt-susde-for-usde "Direct link to Selling YT-sUSDe for USDe") // Swap YT-sUSDe tokens for USDerouter.swapExactYtForToken( msg.sender, PT_SUSDE_MARKET_ADDRESS, ytAmount, createTokenOutputSimple(USDE_ADDRESS, minUsdeOut), createEmptyLimitOrderData()); ### Direct SY to YT Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#direct-sy-to-yt-trading "Direct link to Direct SY to YT Trading") // Swap SY tokens directly for YT tokensrouter.swapExactSyForYt( msg.sender, MARKET_ADDRESS, syAmount, minYtOut, createDefaultApproxParams(), createEmptyLimitOrderData()); * [Token to YT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#token-to-yt-trading) * [swapExactTokenForYt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexacttokenforyt) * [swapExactSyForYt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexactsyforyt) * [YT to Token Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#yt-to-token-trading) * [swapExactYtForToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexactytfortoken) * [swapExactYtForSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexactytforsy) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#integration-examples) * [Buying YT-sUSDe with USDe](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#buying-yt-susde-with-usde) * [Selling YT-sUSDe for USDe](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#selling-yt-susde-for-usde) * [Direct SY to YT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#direct-sy-to-yt-trading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Principal Token (PT) Trading Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#__docusaurus_skipToContent_fallback) On this page This document covers all functions for trading Principal Tokens (PT) in Pendle markets. PT tokens represent the principal portion of yield-bearing assets and can be traded against other tokens or SY tokens. Token to PT Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#token-to-pt-trading "Direct link to Token to PT Trading") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Since the AMM only supports swaps by exact PT, to swap exact tokens for PT requires binary search approximation to find the correct amount of SY needed to achieve the desired PT output. For best usage, use the [SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#features) for better approximation since running binary search on-chain is costly. ### swapExactTokenForPt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexacttokenforpt "Direct link to swapExactTokenForPt") Swaps an exact amount of any supported token for PT tokens. function swapExactTokenForPt( address receiver, address market, uint256 minPtOut, ApproxParams calldata guessPtOut, TokenInput calldata input, LimitOrderData calldata limit) external payable returns (uint256 netPtOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT tokens | | market | `address` | Pendle market address | | minPtOut | `uint256` | Minimum PT tokens to receive | | guessPtOut | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | input | [`TokenInput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) | Token input configuration | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens generated from input token | **Use Case** Most common function for buying PT tokens with any supported token. The function converts your token to SY and then swaps SY for PT, first filling available limit orders, then using the AMM for any remaining amount. **Simple Version Available** For basic operations without custom parameters, use [`swapExactTokenForPtSimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexacttokenforptsimple) which automatically handles approximation and skips limit order functionality. ### swapExactSyForPt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexactsyforpt "Direct link to swapExactSyForPt") Swaps an exact amount of SY tokens for PT tokens. function swapExactSyForPt( address receiver, address market, uint256 exactSyIn, uint256 minPtOut, ApproxParams calldata guessPtOut, LimitOrderData calldata limit) external returns (uint256 netPtOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT tokens | | market | `address` | Pendle market address | | exactSyIn | `uint256` | Exact amount of SY tokens to swap | | minPtOut | `uint256` | Minimum PT tokens to receive | | guessPtOut | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** Direct and efficient method when you already have SY tokens and want to buy PT tokens. **Simple Version Available** For basic operations without custom parameters, use [`swapExactSyForPtSimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#swapexactsyforptsimple) which automatically handles approximation and skips limit order functionality. PT to Token Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#pt-to-token-trading "Direct link to PT to Token Trading") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapExactPtForToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexactptfortoken "Direct link to swapExactPtForToken") Swaps an exact amount of PT tokens for any supported token. function swapExactPtForToken( address receiver, address market, uint256 exactPtIn, TokenOutput calldata output, LimitOrderData calldata limit) external returns (uint256 netTokenOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | market | `address` | Pendle market address | | exactPtIn | `uint256` | Exact amount of PT tokens to swap | | output | [`TokenOutput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput) | Token output configuration | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Amount of tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens before conversion | **Use Case** Most common function for selling PT tokens to receive tokens. The function swaps PT for SY (first filling available limit orders, then using the AMM), then converts SY to your desired token. ### swapExactPtForSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexactptforsy "Direct link to swapExactPtForSy") Swaps an exact amount of PT tokens for SY tokens. function swapExactPtForSy( address receiver, address market, uint256 exactPtIn, uint256 minSyOut, LimitOrderData calldata limit) external returns (uint256 netSyOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive SY tokens | | market | `address` | Pendle market address | | exactPtIn | `uint256` | Exact amount of PT tokens to swap | | minSyOut | `uint256` | Minimum SY tokens to receive | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** Direct and efficient method for selling PT tokens to receive SY tokens. Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#integration-examples "Direct link to Integration Examples") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Buying PT-sUSDe with USDe[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#buying-pt-susde-with-usde "Direct link to Buying PT-sUSDe with USDe") // Swap 1000 USDe for PT-sUSDe tokensrouter.swapExactTokenForPt( msg.sender, PT_SUSDE_MARKET_ADDRESS, minPtOut, createDefaultApproxParams(), createTokenInputSimple(USDE_ADDRESS, 1000e18), createEmptyLimitOrderData()); ### Selling PT-sUSDe for USDe[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#selling-pt-susde-for-usde "Direct link to Selling PT-sUSDe for USDe") // Swap PT-sUSDe tokens for USDerouter.swapExactPtForToken( msg.sender, PT_SUSDE_MARKET_ADDRESS, ptAmount, createTokenOutputSimple(USDE_ADDRESS, minUsdeOut), createEmptyLimitOrderData()); ### Direct SY to PT Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#direct-sy-to-pt-trading "Direct link to Direct SY to PT Trading") // Swap SY tokens directly for PT tokensrouter.swapExactSyForPt( msg.sender, MARKET_ADDRESS, syAmount, minPtOut, createDefaultApproxParams(), createEmptyLimitOrderData()); * [Token to PT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#token-to-pt-trading) * [swapExactTokenForPt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexacttokenforpt) * [swapExactSyForPt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexactsyforpt) * [PT to Token Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#pt-to-token-trading) * [swapExactPtForToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexactptfortoken) * [swapExactPtForSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexactptforsy) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#integration-examples) * [Buying PT-sUSDe with USDe](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#buying-pt-susde-with-usde) * [Selling PT-sUSDe for USDe](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#selling-pt-susde-for-usde) * [Direct SY to PT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#direct-sy-to-pt-trading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # LP Linear Discount Oracle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#__docusaurus_skipToContent_fallback) On this page **Sources:** * [`PendleLpLinearDiscountOracle.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/internal/PendleLpLinearDiscountOracle.sol) * [`PendleLpLinearDiscountOracleFactory.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/internal/PendleLpLinearDiscountOracleFactory.sol) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#overview "Direct link to Overview") -------------------------------------------------------------------------------------------------------------------------------------------------------------- `PendleLpLinearDiscountOracle` is a deterministic feed that returns a **discount factor** for a Pendle LP token. It works identically to the [Spark Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle) for PT, except the convergence target is a configurable `lpMaturedPrice` (≥ 1.0) rather than exactly 1.0 — reflecting that LP tokens accrue SY yield while the market is live. The returned value is a **multiplier in 18 decimals**, not a USD price. It implements `IPChainlinkOracleEssential` and is cardinality-free (no ring-buffer setup required). For use cases and integration examples, see the [integration guide](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle) . * * * Deployment[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#deployment "Direct link to Deployment") -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Deploy via `PendleLpLinearDiscountOracleFactory`. Find the factory address under `"lpLinearDiscountOracleFactory"` in the [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) . function create( address market, uint256 baseLpDiscountPerYear, uint256 lpMaturedPrice) external returns (address); | Parameter | Description | | --- | --- | | `market` | The `PendleMarket` (LP token) address | | `baseLpDiscountPerYear` | Annual discount slope in wad (`1e18 = 100%/year`) | | `lpMaturedPrice` | Target LP price at maturity in wad; must be `>= 1e18`. Set slightly above `1e18` to reflect SY yield accrued in the pool by maturity. | See [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) for guidance on selecting these values. No factory wrapper for LP There is no dedicated LP factory wrapper. To satisfy protocols that check `updatedAt` staleness, wrap the oracle manually after deployment: address lpOracle = lpFactory.create(market, baseLpDiscountPerYear, lpMaturedPrice);address lpWrapped = address(new PendleLinearDiscountOracleWrapper(lpOracle)); See [`LinearDiscountOracleWrapper`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper) for details. * * * Reading the Price[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#reading-the-price "Direct link to Reading the Price") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); Only `answer` carries meaningful data. All other fields return `0`. **Formula:** timeLeft = max(maturity - block.timestamp, 0)lpDiscount = timeLeft × baseLpDiscountPerYear / SECONDS_PER_YEARanswer = (1e18 - lpDiscount) × lpMaturedPrice / 1e18 Reverts if `lpDiscount > 1e18` (only possible if `baseLpDiscountPerYear` is set so high that the discount at launch would exceed 100%). function decimals() external pure returns (uint8); // returns 18 * * * Contract Reference[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#contract-reference "Direct link to Contract Reference") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Immutable Variables[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#immutable-variables "Direct link to Immutable Variables") | Variable | Type | Description | | --- | --- | --- | | `LP` | `address` | The Pendle market (LP token) this oracle prices | | `maturity` | `uint256` | Expiry timestamp, read from `LP.expiry()` at construction | | `baseLpDiscountPerYear` | `uint256` | Annual discount slope; `1e18 = 100%/year` | | `lpMaturedPrice` | `uint256` | Target LP price at maturity in wad; enforced `>= 1e18` at construction | ### `getLpPrice`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#getlpprice "Direct link to getlpprice") function getLpPrice(uint256 timeLeft) public view returns (uint256); Returns the LP price factor for a given `timeLeft` in seconds. Same value as `answer` in `latestRoundData()`. ### `getLpDiscount`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#getlpdiscount "Direct link to getlpdiscount") function getLpDiscount(uint256 timeLeft) public view returns (uint256); Returns the raw discount for a given `timeLeft` in seconds: lpDiscount = timeLeft × baseLpDiscountPerYear / SECONDS_PER_YEAR * * * Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#further-reading "Direct link to Further Reading") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * [`LinearDiscountOracleWrapper`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper) — applying the `updatedAt` wrapper manually * [Spark Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle) — deterministic pricing for PT tokens * [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) — guidance on selecting `baseLpDiscountPerYear` and `lpMaturedPrice` * [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle) — use cases and integration walkthrough * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#overview) * [Deployment](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#deployment) * [Reading the Price](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#reading-the-price) * [Contract Reference](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#contract-reference) * [Immutable Variables](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#immutable-variables) * [`getLpPrice`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#getlpprice) * [`getLpDiscount`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#getlpdiscount) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Spark Linear Discount Oracle (PT) | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#__docusaurus_skipToContent_fallback) On this page **Sources:** * [`PendleSparkLinearDiscountOracle.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/internal/PendleSparkLinearDiscountOracle.sol) * [`PendleSparkLinearDiscountOracleFactory.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/internal/PendleSparkLinearDiscountOracleFactory.sol) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#overview "Direct link to Overview") ----------------------------------------------------------------------------------------------------------------------------------------------------------------- `PendleSparkLinearDiscountOracle` is a deterministic feed that returns a **discount factor** for a given PT. The factor increases linearly as time passes and converges to `1.0` at maturity, so integrators can price PT conservatively without relying on external market data. The returned value is a **multiplier in 18 decimals**, not a USD price. It implements `IPChainlinkOracleEssential` and is cardinality-free (no ring-buffer setup required). For pricing formulas, use cases, and integration examples, see the [integration guide](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle) . * * * Should I use this oracle?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#should-i-use-this-oracle "Direct link to Should I use this oracle?") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- **Use this oracle if:** * The market is newly listed and has no TWAP history yet * Your protocol requires a manipulation-proof, fully deterministic price feed * You prefer a predictable, auditable pricing function over market-derived rates **Use [`PendlePYLpOracle`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle) instead if:** * The market is established and has sufficient TWAP cardinality * You need prices that track the actual market-implied rate See [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) for guidance on selecting `baseDiscountPerYear`. * * * Deployment[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#deployment "Direct link to Deployment") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Deploy via `PendleSparkLinearDiscountOracleFactory`. Find the factory address under `"sparkLinearDiscountOracleFactory"` in the [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) . // Deploy using the PT address directlyfunction createWithPt(address pt, uint256 baseDiscountPerYear) external returns (address);// Or derive PT from the market address automaticallyfunction createWithMarket(address market, uint256 baseDiscountPerYear) external returns (address); Emits `OracleCreated(address indexed pt, uint256 baseDiscountPerYear, address oracle)`. `updatedAt` Staleness Compatibility[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#updatedat-staleness-compatibility "Direct link to updatedat-staleness-compatibility") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Most lending protocols reject feeds where `block.timestamp - updatedAt` exceeds a threshold. This oracle always returns `updatedAt = 0` — it is stateless and computes the price live from `block.timestamp`, so it is never stale by design. If your protocol enforces a staleness check, use `PendleSparkLinearDiscountOracleFactoryWrapper` instead — it deploys and wraps the oracle in one step, returning `updatedAt = block.timestamp`. Find it under `"sparkLinearDiscountOracleFactoryWrapper"` in deployments. See [`LinearDiscountOracleWrapper`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper) for details. * * * Reading the Price[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#reading-the-price "Direct link to Reading the Price") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound); Only `answer` carries meaningful data. All other fields return `0`. **Formula:** timeLeft = max(maturity - block.timestamp, 0)discount = timeLeft × baseDiscountPerYear / SECONDS_PER_YEARanswer = clamp(1e18 - discount, 0, 1e18) `answer` is the current value of 1 PT as a fraction of its maturity redemption value. An `answer` of `0.95e18` means 1 PT is currently priced at 95% of 1 unit of the underlying asset. function decimals() external pure returns (uint8); // returns 18 * * * Contract Reference[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#contract-reference "Direct link to Contract Reference") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Public Variables[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#public-variables "Direct link to Public Variables") | Variable | Type | Description | | --- | --- | --- | | `PT` | `address` | The PT token this oracle prices | | `maturity` | `uint256` | Expiry timestamp, read from `PT.expiry()` at construction | | `baseDiscountPerYear` | `uint256` | Annual discount slope; `1e18 = 100%/year`. Constructor enforces `<= 1e18`. | ### `getDiscount`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#getdiscount "Direct link to getdiscount") function getDiscount(uint256 timeLeft) public view returns (uint256); Returns the raw discount amount for a given `timeLeft` in seconds. The `answer` from `latestRoundData()` equals `1e18 - getDiscount(timeLeft)`. * * * Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#further-reading "Direct link to Further Reading") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * [`LinearDiscountOracleWrapper`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LinearDiscountOracleWrapper) — when and how to apply the `updatedAt` wrapper * [LP Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/LpLinearDiscountOracle) — deterministic pricing for LP tokens * [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) — guidance on selecting `baseDiscountPerYear` * [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle) — pricing formulas, examples, and use cases * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#overview) * [Should I use this oracle?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#should-i-use-this-oracle) * [Deployment](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#deployment) * [`updatedAt` Staleness Compatibility](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#updatedat-staleness-compatibility) * [Reading the Price](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#reading-the-price) * [Contract Reference](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#contract-reference) * [Public Variables](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#public-variables) * [`getDiscount`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#getdiscount) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/LinearDiscountOracle/SparkLinearDiscountOracle#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Liquidity Management Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#__docusaurus_skipToContent_fallback) On this page This document covers all functions for managing liquidity positions in Pendle markets. These functions allow adding and removing liquidity in various token combinations. Add Liquidity Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#add-liquidity-functions "Direct link to Add Liquidity Functions") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### addLiquidityDualTokenAndPt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditydualtokenandpt "Direct link to addLiquidityDualTokenAndPt") Adds liquidity using a token and PT token in exact amounts. function addLiquidityDualTokenAndPt( address receiver, address market, TokenInput calldata input, uint256 netPtDesired, uint256 minLpOut) external payable returns (uint256 netLpOut, uint256 netPtUsed, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | input | [`TokenInput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) | Token input configuration | | netPtDesired | `uint256` | Desired amount of PT tokens to use | | minLpOut | `uint256` | Minimum LP tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netPtUsed | `uint256` | PT tokens actually used | | netSyInterm | `uint256` | SY tokens generated from input token | **Use Case** When you have both the underlying token and PT tokens and want to add liquidity using exact amounts of both. The function will mint SY from your token input and combine it with your PT tokens. ### addLiquidityDualSyAndPt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditydualsyandpt "Direct link to addLiquidityDualSyAndPt") Adds liquidity using both SY and PT tokens in exact amounts. function addLiquidityDualSyAndPt( address receiver, address market, uint256 netSyDesired, uint256 netPtDesired, uint256 minLpOut) external returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | netSyDesired | `uint256` | Desired amount of SY tokens to use | | netPtDesired | `uint256` | Desired amount of PT tokens to use | | minLpOut | `uint256` | Minimum LP tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyUsed | `uint256` | SY tokens actually used | | netPtUsed | `uint256` | PT tokens actually used | **Use Case** When you already have both SY and PT tokens and want to add liquidity directly. ### addLiquiditySinglePt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysinglept "Direct link to addLiquiditySinglePt") Adds liquidity using only PT tokens by internally swapping some PT for SY. function addLiquiditySinglePt( address receiver, address market, uint256 netPtIn, uint256 minLpOut, ApproxParams calldata guessPtSwapToSy, LimitOrderData calldata limit) external returns (uint256 netLpOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | netPtIn | `uint256` | Amount of PT tokens to use | | minLpOut | `uint256` | Minimum LP tokens to receive | | guessPtSwapToSy | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** When you only have PT tokens and want to add liquidity. The function will automatically determine the optimal amount of PT to swap for SY to achieve balanced liquidity provision. **Simple Version Available** For basic operations without custom parameters, use [`addLiquiditySinglePtSimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysingleptsimple) which automatically handles approximation and skips limit order functionality. ### addLiquiditySingleToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysingletoken "Direct link to addLiquiditySingleToken") Adds liquidity using any supported token by converting it to SY and PT as needed. function addLiquiditySingleToken( address receiver, address market, uint256 minLpOut, ApproxParams calldata guessPtReceivedFromSy, TokenInput calldata input, LimitOrderData calldata limit) external payable returns (uint256 netLpOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | minLpOut | `uint256` | Minimum LP tokens to receive | | guessPtReceivedFromSy | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | input | [`TokenInput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) | Token input configuration | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens generated from input token | **Use Case** Most convenient method when you have any supported token and want to add liquidity. The function handles all necessary conversions and swaps automatically. **Simple Version Available** For basic operations without custom parameters, use [`addLiquiditySingleTokenSimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysingletokensimple) which automatically handles approximation and skips limit order functionality. ### addLiquiditySingleSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysinglesy "Direct link to addLiquiditySingleSy") Adds liquidity using only SY tokens by converting some to PT through market operations. function addLiquiditySingleSy( address receiver, address market, uint256 netSyIn, uint256 minLpOut, ApproxParams calldata guessPtReceivedFromSy, LimitOrderData calldata limit) external returns (uint256 netLpOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP tokens | | market | `address` | Pendle market address | | netSyIn | `uint256` | Amount of SY tokens to use | | minLpOut | `uint256` | Minimum LP tokens to receive | | guessPtReceivedFromSy | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** When you have SY tokens and want to add liquidity. The function will swap some SY for PT to achieve optimal liquidity provision. **Simple Version Available** For basic operations without custom parameters, use [`addLiquiditySingleSySimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#addliquiditysinglesysimple) which automatically handles approximation and skips limit order functionality. ### addLiquiditySingleTokenKeepYt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysingletokenkeepyt "Direct link to addLiquiditySingleTokenKeepYt") Adds liquidity while keeping the generated YT tokens instead of selling them. function addLiquiditySingleTokenKeepYt( address receiver, address market, uint256 minLpOut, uint256 minYtOut, TokenInput calldata input) external payable returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyMintPy, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP and YT tokens | | market | `address` | Pendle market address | | minLpOut | `uint256` | Minimum LP tokens to receive | | minYtOut | `uint256` | Minimum YT tokens to receive | | input | [`TokenInput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) | Token input configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netYtOut | `uint256` | YT tokens received | | netSyMintPy | `uint256` | SY used to mint PT/YT | | netSyInterm | `uint256` | SY tokens generated from input token | **Use Case** When you want to add liquidity and also keep YT tokens for yield farming. This strategy avoids price impact since no swapping occurs - the underlying asset is converted to SY, then PT/YT pairs are minted directly. The PT and remaining SY are used for liquidity provision while YT is returned to you. ### addLiquiditySingleSyKeepYt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysinglesykeepyt "Direct link to addLiquiditySingleSyKeepYt") Adds liquidity using SY tokens while keeping the generated YT tokens. function addLiquiditySingleSyKeepYt( address receiver, address market, uint256 netSyIn, uint256 minLpOut, uint256 minYtOut) external returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyMintPy) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive LP and YT tokens | | market | `address` | Pendle market address | | netSyIn | `uint256` | Amount of SY tokens to use | | minLpOut | `uint256` | Minimum LP tokens to receive | | minYtOut | `uint256` | Minimum YT tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netYtOut | `uint256` | YT tokens received | | netSyMintPy | `uint256` | SY used to mint PT/YT | **Use Case** When you have SY tokens and want both LP tokens and YT tokens. This method avoids price impact since no swapping occurs - SY is used to mint PT/YT pairs directly, with PT used for liquidity provision and YT returned to you. Remove Liquidity Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#remove-liquidity-functions "Direct link to Remove Liquidity Functions") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### removeLiquidityDualTokenAndPt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditydualtokenandpt "Direct link to removeLiquidityDualTokenAndPt") Removes liquidity and receives both the underlying token and PT tokens. function removeLiquidityDualTokenAndPt( address receiver, address market, uint256 netLpToRemove, TokenOutput calldata output, uint256 minPtOut) external returns (uint256 netTokenOut, uint256 netPtOut, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | Amount of LP tokens to burn | | output | [`TokenOutput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput) | Token output configuration | | minPtOut | `uint256` | Minimum PT tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Amount of tokens received | | netPtOut | `uint256` | PT tokens received | | netSyInterm | `uint256` | SY tokens converted to underlying | **Use Case** When you want to exit a liquidity position and receive both the underlying token and PT tokens separately. ### removeLiquidityDualSyAndPt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditydualsyandpt "Direct link to removeLiquidityDualSyAndPt") Removes liquidity and receives both SY and PT tokens. function removeLiquidityDualSyAndPt( address receiver, address market, uint256 netLpToRemove, uint256 minSyOut, uint256 minPtOut) external returns (uint256 netSyOut, uint256 netPtOut) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | Amount of LP tokens to burn | | minSyOut | `uint256` | Minimum SY tokens to receive | | minPtOut | `uint256` | Minimum PT tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY tokens received | | netPtOut | `uint256` | PT tokens received | **Use Case** Most efficient method when you want both SY and PT tokens. No additional conversions are performed. ### removeLiquiditySinglePt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditysinglept "Direct link to removeLiquiditySinglePt") Removes liquidity and converts everything to PT tokens. function removeLiquiditySinglePt( address receiver, address market, uint256 netLpToRemove, uint256 minPtOut, ApproxParams calldata guessPtReceivedFromSy, LimitOrderData calldata limit) external returns (uint256 netPtOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT tokens | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | Amount of LP tokens to burn | | minPtOut | `uint256` | Minimum PT tokens to receive | | guessPtReceivedFromSy | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Approximation parameters | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** When you want to exit liquidity and hold only PT tokens, maximizing your PT position. **Simple Version Available** For basic operations without custom parameters, use [`removeLiquiditySinglePtSimple`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/SimpleFunctions#removeliquiditysingleptsimple) which automatically handles approximation and skips limit order functionality. ### removeLiquiditySingleToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditysingletoken "Direct link to removeLiquiditySingleToken") Removes liquidity and converts everything to a specified underlying token. function removeLiquiditySingleToken( address receiver, address market, uint256 netLpToRemove, TokenOutput calldata output, LimitOrderData calldata limit) external returns (uint256 netTokenOut, uint256 netSyFee, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | Amount of LP tokens to burn | | output | [`TokenOutput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput) | Token output configuration | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Amount of tokens received | | netSyFee | `uint256` | Trading fees paid in SY | | netSyInterm | `uint256` | SY tokens before conversion | **Use Case** Most convenient exit method when you want to receive a specific underlying token. Handles all necessary conversions automatically. ### removeLiquiditySingleSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditysinglesy "Direct link to removeLiquiditySingleSy") Removes liquidity and converts everything to SY tokens. function removeLiquiditySingleSy( address receiver, address market, uint256 netLpToRemove, uint256 minSyOut, LimitOrderData calldata limit) external returns (uint256 netSyOut, uint256 netSyFee) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive SY tokens | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | Amount of LP tokens to burn | | minSyOut | `uint256` | Minimum SY tokens to receive | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY tokens received | | netSyFee | `uint256` | Trading fees paid in SY | **Use Case** When you want to exit liquidity and hold SY tokens, useful for further operations within the Pendle ecosystem. Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#integration-examples "Direct link to Integration Examples") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Basic Liquidity Addition[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#basic-liquidity-addition "Direct link to Basic Liquidity Addition") // Add liquidity with USDerouter.addLiquiditySingleToken( msg.sender, PT_USDE_MARKET_ADDRESS, minLpOut, createDefaultApproxParams(), createTokenInputSimple(USDE_ADDRESS, 1000e18), createEmptyLimitOrderData()); ### Basic Liquidity Removal[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#basic-liquidity-removal "Direct link to Basic Liquidity Removal") // Remove liquidity to USDerouter.removeLiquiditySingleToken( msg.sender, PT_USDE_MARKET_ADDRESS, lpAmount, createTokenOutputSimple(USDE_ADDRESS, minUsdeOut), createEmptyLimitOrderData()); * [Add Liquidity Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#add-liquidity-functions) * [addLiquidityDualTokenAndPt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditydualtokenandpt) * [addLiquidityDualSyAndPt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditydualsyandpt) * [addLiquiditySinglePt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysinglept) * [addLiquiditySingleToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysingletoken) * [addLiquiditySingleSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysinglesy) * [addLiquiditySingleTokenKeepYt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysingletokenkeepyt) * [addLiquiditySingleSyKeepYt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysinglesykeepyt) * [Remove Liquidity Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#remove-liquidity-functions) * [removeLiquidityDualTokenAndPt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditydualtokenandpt) * [removeLiquidityDualSyAndPt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditydualsyandpt) * [removeLiquiditySinglePt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditysinglept) * [removeLiquiditySingleToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditysingletoken) * [removeLiquiditySingleSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditysinglesy) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#integration-examples) * [Basic Liquidity Addition](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#basic-liquidity-addition) * [Basic Liquidity Removal](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#basic-liquidity-removal) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Market Factory | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#__docusaurus_skipToContent_fallback) On this page **Contract:** [`PendleMarketFactoryV7Upg`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketFactoryV7Upg.sol) The factory is the canonical registry for Pendle markets. It deploys new markets and manages protocol-wide fee configuration. ### [`createNewMarket`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketFactoryV7Upg.sol#L70-L103) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#createnewmarket "Direct link to createnewmarket") /** * @notice Create a market between PT and its corresponding SY with scalar & anchor config. * Anyone is allowed to create a market on their own. */function createNewMarket( address PT, int256 scalarRoot, int256 initialAnchor, uint80 lnFeeRateRoot) external returns (address market); **Parameters:** * `PT` — Address of the Principal Token. Must be a valid PT registered by the yield contract factory and not yet expired. * `scalarRoot` — Capital efficiency vs. rate range trade-off. Higher values concentrate liquidity more tightly around the anchor rate, providing greater efficiency but a narrower tradeable range. Must be positive. * `initialAnchor` — The implied rate at which the market is most capital-efficient at launch. Should be set close to the expected current implied APY of the underlying asset. Must be ≥ 1 (expressed as a fixed-point number). * `lnFeeRateRoot` — Fee rate as a natural log value. Maximum is `ln(1.05) ≈ 0.0488`. Fee per swap scales with the interest rate impact of the trade. **Notes:** * Anyone can call this — market creation is permissionless. * Multiple markets for the same PT (with different `scalarRoot`, `initialAnchor`, or `lnFeeRateRoot`) are valid and can coexist. * Reverts if the exact combination of `(PT, scalarRoot, initialAnchor, lnFeeRateRoot)` already exists. ### `VERSION`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#version "Direct link to version") function VERSION() external view returns (uint256); Returns the version number of the factory contract. ### [`isValidMarket`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketFactoryV7Upg.sol#L115-L117) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#isvalidmarket "Direct link to isvalidmarket") /// @dev for gas-efficient verification of marketfunction isValidMarket(address market) external view returns (bool); Returns `true` if the address was deployed by this factory. This is a low-level on-chain check — it confirms the contract was deployed by Pendle's factory, but says nothing about whether the market is active, whitelisted, or supported by the protocol. tip To get the list of **whitelisted and verified markets** tracked by Pendle (with TVL, APY, and other metadata), use the [Pendle API](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview) instead: GET https://api-v2.pendle.finance/core/v1/markets/all ### [`getMarketConfig`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketFactoryV7Upg.sol#L105-L112) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#getmarketconfig "Direct link to getmarketconfig") function getMarketConfig(address market, address router) external view returns ( address treasury, uint80 overriddenFee, uint8 reserveFeePercent ); Returns the protocol fee configuration for a given market and router combination. `overriddenFee == 0` means no override is active for that router (the market's base fee applies). This is called internally by `readState(router)` on every market interaction. * [`createNewMarket`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#createnewmarket) * [`VERSION`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#version) * [`isValidMarket`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#isvalidmarket) * [`getMarketConfig`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/MarketFactory#getmarketconfig) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # LP Wrapper | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#__docusaurus_skipToContent_fallback) On this page **Contracts:** * [`PendleLPWrapper.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/offchain-helpers/PendleLPWrapper.sol) * [`PendleLPWrapperFactory.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/offchain-helpers/PendleLPWrapperFactory.sol) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#overview "Direct link to Overview") ---------------------------------------------------------------------------------------------------------------------------------- `PendleLPWrapper` wraps a Pendle LP token 1:1 into a plain ERC-20, making it compatible with money markets (e.g., Morpho, Aave) that require collateral tokens to behave as standard, non-rebasing ERC-20s. **Why wrapping is needed:** Pendle LP tokens call `redeemRewards` on every token transfer (via `_beforeTokenTransfer`). This side-effect is incompatible with many money market protocols, which assume collateral tokens have no state-changing transfer hooks. The wrapper absorbs the reward logic internally: rewards are harvested to the wrapper contract itself, not the holder. The holder receives a clean 1:1 ERC-20 backed by the underlying LP. **Exchange rate:** Always 1:1. `wrap` and `unwrap` involve no fees, slippage, or exchange rate. Finding a Wrapper[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#finding-a-wrapper "Direct link to Finding a Wrapper") ------------------------------------------------------------------------------------------------------------------------------------------------------------- Wrappers are deployed and tracked by `PendleLPWrapperFactory`. Look up the wrapper address for any LP token before interacting: // PendleLPWrapperFactoryfunction wrappers(address LP) external view returns (address wrapper); Returns the wrapper address for the given LP token, or `address(0)` if no wrapper exists for it yet. Wrapper creation is owner-gated — contact the Pendle team to have one deployed for a new LP. Wrapping & Unwrapping[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#wrapping--unwrapping "Direct link to Wrapping & Unwrapping") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Each `PendleLPWrapper` is specific to one LP token. It is an ERC-20 with name `"Pendle Market Wrapped"` and symbol `"PENDLE-LPT-WRAPPED"`. ### `wrap`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#wrap "Direct link to wrap") function wrap(address receiver, uint256 netLpIn) external; Transfers `netLpIn` LP tokens from `msg.sender` and mints an equal amount of wrapped tokens to `receiver`. Caller must approve the wrapper to spend LP tokens first. ### `unwrap`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#unwrap "Direct link to unwrap") function unwrap(address receiver, uint256 netWrapIn) external; Burns `netWrapIn` wrapped tokens from `msg.sender` and returns an equal amount of LP tokens to `receiver`. ### `LP`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#lp "Direct link to lp") function LP() external view returns (address); Returns the address of the underlying Pendle LP token this wrapper is backed by. Reward Handling[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#reward-handling "Direct link to Reward Handling") ------------------------------------------------------------------------------------------------------------------------------------------------------- On every token transfer, the wrapper calls `IPMarket(LP).redeemRewards(address(this))` before updating balances. This snapshots accrued rewards into the wrapper contract itself rather than letting them accrue unevenly across holders. Rewards accumulate in the wrapper and are periodically swept out by anyone calling: // PendleLPWrapperFactoryfunction redeemRewardsAndTransfer(address[] memory _wrappers) external; This harvests all accumulated rewards from each wrapper and sends them to the factory's `rewardReceiver`: // PendleLPWrapperFactoryfunction rewardReceiver() external view returns (address); **LP wrapper holders do not receive rewards directly.** Rewards are claimed by the designated `rewardReceiver` and later distributed to holders off-chain. Integrators building on top of the wrapper should be aware of this trade-off. Admin Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#admin-functions "Direct link to Admin Functions") ------------------------------------------------------------------------------------------------------------------------------------------------------- // PendleLPWrapperFactory — owner only// Update the reward recipient addressfunction setRewardReceiver(address _rewardReceiver) external onlyOwner;// Disable or re-enable the per-transfer reward hook on a specific wrapperfunction setRewardRedemptionDisabled(address _wrapper, bool _isRewardRedemptionDisabled) external onlyOwner; `setRewardRedemptionDisabled` skips the `redeemRewards` call on every transfer. This can be used as a gas optimization in contexts where per-transfer reward accuracy is not required. Current state is readable via: // PendleLPWrapperfunction isRewardRedemptionDisabled() external view returns (bool); Integration Notes[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#integration-notes "Direct link to Integration Notes") ------------------------------------------------------------------------------------------------------------------------------------------------------------- * **Collateral use:** Supply the wrapped token to the money market as collateral. Unwrap via `unwrap` to retrieve the underlying LP at any time. * **Rewards:** Rewards do not flow to the wrapper holder directly. If your integration requires LP reward exposure, interact with the LP token directly rather than through the wrapper. * **1:1 rate:** The wrapped token always redeems 1:1 for the underlying LP — there is no oracle or exchange rate to track. * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#overview) * [Finding a Wrapper](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#finding-a-wrapper) * [Wrapping & Unwrapping](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#wrapping--unwrapping) * [`wrap`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#wrap) * [`unwrap`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#unwrap) * [`LP`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#lp) * [Reward Handling](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#reward-handling) * [Admin Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#admin-functions) * [Integration Notes](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/LPWrapper#integration-notes) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Yield Contract Factory | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#__docusaurus_skipToContent_fallback) On this page **Contract:** [`PendleYieldContractFactoryUpg`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/YieldContracts/PendleYieldContractFactoryUpg.sol) The factory is the canonical registry for all Pendle PT/YT pairs. It deploys new yield contracts and tracks existing ones. ### [`createYieldContract`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/YieldContracts/PendleYieldContractFactoryUpg.sol#L108-L166) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#createyieldcontract "Direct link to createyieldcontract") /** * @notice Create a pair of (PT, YT) from any SY and valid expiry. * Anyone can create a yield contract. */function createYieldContract( address SY, uint32 expiry, bool doCacheIndexSameBlock) external returns (address PT, address YT); **Parameters:** * `SY` — Address of the Standardized Yield token to tokenize. * `expiry` — Unix timestamp for the PT/YT expiry. Must be in the future and divisible by `expiryDivisor` (e.g., 86400 enforces day-boundary expirations). * `doCacheIndexSameBlock` — If `true`, the PY index updates at most once per block (gas optimization). This trades a small amount of real-time precision for reduced write costs on high-frequency blocks. **Notes:** * Anyone can call this — yield contract creation is permissionless. * Reverts if the `(SY, expiry)` pair already exists (`YCFactoryYieldContractExisted`). * Reverts if `expiry` is in the past or not divisible by `expiryDivisor` (`YCFactoryInvalidExpiry`). ### Query Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#query-functions "Direct link to Query Functions") // Look up existing PT/YT addresses for a given SY and expiryfunction getPT(address sy, uint256 expiry) external view returns (address);function getYT(address sy, uint256 expiry) external view returns (address);// Validate whether an address is a Pendle-deployed PT or YTfunction isPT(address token) external view returns (bool);function isYT(address token) external view returns (bool); **Usage:** Before creating a yield contract, call `getPT(sy, expiry)` — if it returns a non-zero address, the pair already exists and you should use that address directly. ### `VERSION`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#version "Direct link to version") function VERSION() external view returns (uint256); Returns the version number of the factory contract. ### Protocol Fee Parameters[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#protocol-fee-parameters "Direct link to Protocol Fee Parameters") These are set by the factory owner and applied to all yield contracts at redemption time: // Fraction of YT interest sent to treasury (max 20%, 1e18 = 100%)function interestFeeRate() external view returns (uint256);// Fraction of external reward tokens sent to treasury (max 20%, 1e18 = 100%)function rewardFeeRate() external view returns (uint256); These are read-only from an integrator's perspective; they are deducted automatically on `redeemDueInterestAndRewards` calls. * [`createYieldContract`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#createyieldcontract) * [Query Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#query-functions) * [`VERSION`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#version) * [Protocol Fee Parameters](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldContractFactory#protocol-fee-parameters) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # sPENDLE | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#overview "Direct link to Overview") ------------------------------------------------------------------------------------------------------------------- [sPENDLE](https://etherscan.io/address/0x999999999991E178D52Cd95AFd4b00d066664144) is the staked version of [PENDLE](https://etherscan.io/token/0x808507121b80c02388fad14726482e061b8da827) , deployed on Ethereum at **[`0x999999999991E178D52Cd95AFd4b00d066664144`](https://etherscan.io/address/0x999999999991E178D52Cd95AFd4b00d066664144) **. Users stake PENDLE to receive sPENDLE at a 1:1 ratio. sPENDLE does not increase in value over time. sPENDLE held in a user’s wallet is eligible for: * Voting power within the Pendle ecosystem * Pro-rata share of reward distributions if they meet the active participation criteria For details on governance rights and rewards distribution, see the [sPENDLE mechanism documentation](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/sPENDLE) . ### Audit Reports[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#audit-reports "Direct link to Audit Reports") The sPENDLE contract has been audited. Full audit reports are available [here](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/audits) . Staking PENDLE[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#staking-pendle "Direct link to Staking PENDLE") ------------------------------------------------------------------------------------------------------------------------------------- To stake PENDLE and receive sPENDLE function stake(uint256 amount) external; Unstaking sPENDLE[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#unstaking-spendle "Direct link to Unstaking sPENDLE") ---------------------------------------------------------------------------------------------------------------------------------------------- There are two ways to unstake sPENDLE back to PENDLE. ### Option 1: Cooldown Flow (Fee-Free)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#option-1-cooldown-flow-fee-free "Direct link to Option 1: Cooldown Flow (Fee-Free)") Initiate a cooldown to unlock your PENDLE. After the cooldown period (14 days, readable via `cooldownDuration()`), finalize to receive your PENDLE. /// @notice Initiate cooldown, returning the specified amount of sPENDLEfunction cooldown(uint256 amount) external;/// @notice Claim PENDLE after the cooldown period endsfunction finalizeCooldown() external returns (uint256 amount);/// @notice Cancel the cooldown and return sPENDLE to your walletfunction cancelCooldown() external; ### Option 2: Instant Unstake (5% Fee)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#option-2-instant-unstake-5-fee "Direct link to Option 2: Instant Unstake (5% Fee)") For immediate access to PENDLE with a fee function instantUnstake(uint256 amount) external returns (uint256 amountAfterFee, uint256 fee); The fee rate is readable via `instantUnstakeFeeRate()`. Currently it is set to 5%. ### Comparison[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#comparison "Direct link to Comparison") | Method | Fee | Wait Time | | --- | --- | --- | | Cooldown | None | 14 days | | Instant | 5% | None | Events[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#events "Direct link to Events") ------------------------------------------------------------------------------------------------------------- /// @notice Emitted when a user stakes PENDLEevent Staked(address indexed user, uint256 amount);/// @notice Emitted when cooldown is initiatedevent CooldownInitiated(address indexed user, uint256 amount, uint256 cooldownStart);/// @notice Emitted when cooldown is canceledevent CooldownCanceled(address indexed user, uint256 amount);/// @notice Emitted on finalizeCooldown() or instantUnstake()event Unstaked(address indexed user, uint256 amountAfterFee, uint256 fee); View Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#view-functions "Direct link to View Functions") ------------------------------------------------------------------------------------------------------------------------------------- /// @notice Returns the cooldown duration in seconds (14 days = 1209600)function cooldownDuration() external view returns (uint24);/// @notice Returns the instant unstake fee rate (base 1e18, e.g., 5e16 = 5%)function instantUnstakeFeeRate() external view returns (uint64);/// @notice Returns a user's pending cooldown state/// @return cooldownStart The timestamp when cooldown was initiated/// @return amount The amount of sPENDLE in cooldownfunction userCooldown(address user) external view returns (uint104 cooldownStart, uint152 amount); Full Interface[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#full-interface "Direct link to Full Interface") ------------------------------------------------------------------------------------------------------------------------------------- interface IPStakedPendle { struct UserCooldown { uint104 cooldownStart; uint152 amount; } event Staked(address indexed user, uint256 amount); event Unstaked(address indexed user, uint256 amountAfterFee, uint256 fee); event CooldownCanceled(address indexed user, uint256 amount); event CooldownInitiated(address indexed user, uint256 amount, uint256 cooldownStart); function cooldownDuration() external view returns (uint24); function instantUnstakeFeeRate() external view returns (uint64); function userCooldown(address user) external view returns (uint104 cooldownStart, uint152 amount); function stake(uint256 amount) external; function cooldown(uint256 amount) external; function cancelCooldown() external; // fee-free, after cooldown function finalizeCooldown() external returns (uint256 amount); // instant, but with fee function instantUnstake(uint256 amount) external returns (uint256 amountAfterFee, uint256 fee);} * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#overview) * [Audit Reports](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#audit-reports) * [Staking PENDLE](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#staking-pendle) * [Unstaking sPENDLE](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#unstaking-spendle) * [Option 1: Cooldown Flow (Fee-Free)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#option-1-cooldown-flow-fee-free) * [Option 2: Instant Unstake (5% Fee)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#option-2-instant-unstake-5-fee) * [Comparison](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#comparison) * [Events](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#events) * [View Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#view-functions) * [Full Interface](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE#full-interface) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Choosing Linear Discount Parameters | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#__docusaurus_skipToContent_fallback) On this page In this documentation, we provide a Desmos graphic that let you fill in parameters to help visualizing and choosing a good linear discount rate for the linear discount oracle. Desmos link: [https://www.desmos.com/calculator/xmtoxy6lkt](https://www.desmos.com/calculator/xmtoxy6lkt) The Desmos link contains the example for the [USDe 25 SEP 2025 market](https://app.pendle.finance/trade/markets/0x6d98a2b6cdbf44939362a3e99793339ba2016af4/swap?view=yt&chain=ethereum) . * PT linear discount rate can be chosen to be 18%18\\%18%. * LP linear discount rate can be chosen to be 7%7\\%7%. See this in the Desmos graphic by changing rdiscountr\_{discount}rdiscount​ in the corresponding folder. Parameters[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#parameters "Direct link to Parameters") ----------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Market internal state[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#market-internal-state "Direct link to Market internal state") The Desmos graphic requires some internal state of the Pendle market. The following notebook can be used to get the market’s internal state: [https://colab.research.google.com/drive/1CKltGGLWrdUoCVRpV1U9ZV2BqjMkN\_OE?usp=sharing](https://colab.research.google.com/drive/1CKltGGLWrdUoCVRpV1U9ZV2BqjMkN_OE?usp=sharing) For example, if the chosen market is [USDe 25 SEP 2025 market](https://app.pendle.finance/trade/markets/0x6d98a2b6cdbf44939362a3e99793339ba2016af4/swap?view=yt&chain=ethereum) , the parameters can be obtained like the image on the left, and be filled as the image on the right. | Running the notebook | Filling the parameters in Desmos | | --- | --- | | ![Params notebook](https://docs.pendle.finance/assets/images/params-notebook-aaaab1216ca4500929e7c19441b063ea.png) | ![Params Desmos](https://docs.pendle.finance/assets/images/params-desmos-31060ff8c44e4f55262f64570e0bfd5e.png) | ### Market yield range[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#market-yield-range "Direct link to Market yield range") These parameters are opinionated. Please choose a yield range that you think the market will be trading in until maturity. The lower the rateMax\\text{rateMax}rateMax, the less underprice the oracle will be, and the more capital efficient for the users. Pendle Market also allows trading within a pre-determined yield range. If you are not sure about the yield range, use this. This yield range can be obtained from the Pendle DApp UI: | Click the spec button | Getting the yield range | | --- | --- | | ![image.png](https://docs.pendle.finance/assets/images/ui-market-specs-38e34a9610a7c250ae6752dce1010199.png) | ![image.png](https://docs.pendle.finance/assets/images/ui-market-yield-range-9196f2f97ef9779db2ed307ac02ae0a1.png) | And filled it as the following: ![image.png](https://docs.pendle.finance/assets/images/yield-range-desmos-959e1a5076b466f39fcb5cf49c1419d8.png) Choosing between PT linear oracle and LP linear oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#choosing-between-pt-linear-oracle-and-lp-linear-oracle "Direct link to Choosing between PT linear oracle and LP linear oracle") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Desmos graphic can help visualize both linear discount. The corresponding graphic can be toggled by clicking the corresponding folder ### Choosing the linear discount rate[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#choosing-the-linear-discount-rate "Direct link to Choosing the linear discount rate") In both graphic: * **The blue** lines are the maximum and minimum price of PT/LP (the price range). * **The orange** line is the current price of PT/LP until maturity if there is no trade occurred. * **The red** line is the discounted price of PT/LP with your discount rate. Change rdiscountr\_{discount}rdiscount​ to adjust the discounted price (the **red line**) and see its relation between the price range and the current price. ### Base price (or the matured price)[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#base-price-or-the-matured-price "Direct link to Base price (or the matured price)") For PT, since it can be redeem to asset 1:1 at maturity, the base price of PT is 1. For LP, the base price is calculated in the Desmos graphic. It can be found in the _LP linear discount_ Desmos folder: ![image.png](https://docs.pendle.finance/assets/images/lp-base-price-desmos-136f58b4c91a35d9ede4447fb6dd9847.png) ### Recommendation[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#recommendation "Direct link to Recommendation") rdiscountr\_{discount}rdiscount​ should be set so that the price is _sub-optimal_ compare to the market price at all the time until maturity. Therefore: * The **discounted price** line should be below the **current price**. * The closer the **discounted price** line to the **current price**, the riskier. * Setting rdiscountr\_{discount}rdiscount​ so that the **discounted price** line is **under** the **lower price** line can make sure that the oracle price is always underpriced. ### Reference[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#reference "Direct link to Reference") * [https://forum.sky.money/t/june-26-2025-proposed-changes-to-spark-for-upcoming-spell/26663](https://forum.sky.money/t/june-26-2025-proposed-changes-to-spark-for-upcoming-spell/26663) — Spark write up on linear discount rate for PT-syrupUSDC-28Aug2025, PT-USDe-25Sept2025, LP-USDS-14Aug2025. * [https://www.desmos.com/calculator/n7wfzslz8l](https://www.desmos.com/calculator/n7wfzslz8l) — Desmos graphic for single trade on Pendle Market. * [Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#parameters) * [Market internal state](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#market-internal-state) * [Market yield range](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#market-yield-range) * [Choosing between PT linear oracle and LP linear oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#choosing-between-pt-linear-oracle-and-lp-linear-oracle) * [Choosing the linear discount rate](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#choosing-the-linear-discount-rate) * [Base price (or the matured price)](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#base-price-or-the-matured-price) * [Recommendation](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#recommendation) * [Reference](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams#reference) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # LP Linear Discount Oracle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#overview "Direct link to Overview") ----------------------------------------------------------------------------------------------------------------------------------------------------- Similar to [Pendle Spark Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle) , the **LPLinearDiscountOracle** provides a deterministic discount factor for Pendle Liquidity Provider (LP) tokens. This oracle is designed to help money markets and lending platforms value LP tokens that represent a share in a liquidity pool containing Pendle's LP Tokens. The only difference between this oracle and the standard Linear Discount Oracle is that the LP version allows setting the `lpMaturedPrice` - the price of the LP token at maturity, while the convergence price of PT is always 1.0. The contract exposes familiar read functions (`latestRoundData`, `decimals`) so money markets can plug it in like a Chainlink-compatible feed. The returned value is a **multiplier in 18 decimals**, not a USD price. Please see the [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) documentation for guidance on selecting appropriate linear discount parameters. Use cases[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#use-cases "Direct link to Use cases") -------------------------------------------------------------------------------------------------------------------------------------------------------- For money markets listing LPs as collateral or borrowable assets, the oracle provides a stable, predictable valuation path. Integrators read the factor, multiply it by their LP redemption preview (and then by the underlying'S USD price feed if needed). Because the factor converges linearly to `lpMaturedPrice` at expiry, LTVs and liquidation thresholds behave smoothly instead of whipsawing with AMM volatility. Usage[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#usage "Direct link to Usage") -------------------------------------------------------------------------------------------------------------------------------------------- ### Deployment[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#deployment "Direct link to Deployment") The oracle can be deployed using the `lpLinearDiscountOracleFactory`. The address of the factory can be found in the [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) sections, under the `"lpLinearDiscountOracleFactory"` field. The factory has a method to help with oracle deployment: function create(address market, uint256 basePtDiscountPerYear, uint256 lpMaturedPrice) external returns (address res); ### Feed retrieval[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#feed-retrieval "Direct link to Feed retrieval") function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) Since the oracle is deterministic, except for `answer`, every other fields returned are `0`. #### Feed properties[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#feed-properties "Direct link to Feed properties") * **Decimals**: The oracle returns values in 18 decimals, so integrators should multiply the factor by their LP redemption preview (also in 18 decimals) to get the value. * **Deterministic**: The oracle is deterministic, meaning the same inputs will always yield the same output. This allows for predictable valuation paths. * **Linear Discount**: The discount factor increases linearly over time, converging to `lpMaturedPrice` at maturity. * **No External Calls**: The oracle does not make any external calls during reads, ensuring minimal liveness or manipulation surface. It relies solely on `block.timestamp` for time calculations. How `answer` is deterministically calculated The `answer` relies on two parameters: * `baseDiscountPerYear` - the annual discount slope, expressed in wad (1e18 = 100%/year). * `maturity` - the LP maturity timestamp in seconds (`LP.expiry()`). * `lpMaturedPrice` - the price of the LP token at maturity, expressed in wad (1e18 = 100%). The `answer` at a given time `t` (in seconds) is calculated as follows: answer\=lpMaturedPrice⋅min⁡(1018,1018−(maturity−t)⋅baseDiscountPerYear365⋅24⋅60⋅60)\\text{answer} = \\text{lpMaturedPrice} \\cdot \\min\\left( 10^{18}, 10^{18} - \\frac{(\\text{maturity} - t) \\cdot \\text{baseDiscountPerYear}}{365 \\cdot 24 \\cdot 60 \\cdot 60} \\right)answer\=lpMaturedPrice⋅min(1018,1018−365⋅24⋅60⋅60(maturity−t)⋅baseDiscountPerYear​) * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#overview) * [Use cases](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#use-cases) * [Usage](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#usage) * [Deployment](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#deployment) * [Feed retrieval](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle#feed-retrieval) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Common Market Deployments | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#__docusaurus_skipToContent_fallback) On this page **Contract:** [`PendleCommonPoolDeployHelperV2`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol) **Repository:** [pendle-finance/Pendle-Common-Pool-Deploy](https://github.com/pendle-finance/Pendle-Common-Pool-Deploy) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#overview "Direct link to Overview") ------------------------------------------------------------------------------------------------------------------------------------------------ `PendleCommonPoolDeployHelperV2` is the recommended helper for deploying Pendle markets. It handles the full deployment pipeline in a single transaction: 1. Deploy (or reuse) the SY contract 2. Create PT and YT via the yield contract factory 3. Create the market via the market factory 4. Seed initial liquidity at a target implied rate There are two deployment paths depending on whether you are using a [Common SY](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY) or a custom SY you've already deployed. **Prerequisite:** Approve `tokenToSeedLiquidity` spending by `PendleCommonPoolDeployHelperV2` before calling. ETH is accepted natively. Path 1: Deploy Common Market[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#path-1-deploy-common-market "Direct link to Path 1: Deploy Common Market") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Use this path when your asset fits one of the [pre-built Common SY types](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY) . The helper deploys the SY for you alongside the market. function deployCommonMarketById( bytes32 id, bytes memory constructorParams, bytes memory initData, PoolConfig memory config, address tokenToSeedLiquidity, uint256 amountToSeed, address syOwner) external returns (PoolDeploymentAddrs memory); * `id` — the `bytes32` type ID of the Common SY (see [Registered Type IDs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#registered-type-ids) ) * `constructorParams` / `initData` — ABI-encoded constructor and initializer args for the SY (see [Common SY Types](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#common-sy-types) for encoding per type) * `config` — market parameters (see [`PoolConfig`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#poolconfig-struct) below) * `tokenToSeedLiquidity` — token to use for seeding initial liquidity * `amountToSeed` — amount of that token to seed * `syOwner` — owner address for the deployed SY contract Returns `PoolDeploymentAddrs { SY, PT, YT, market }`. Path 2: Deploy Normal Market[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#path-2-deploy-normal-market "Direct link to Path 2: Deploy Normal Market") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Use this path when you have already deployed a custom SY (i.e., not a Common SY type) and want to create the PT/YT pair and market around it. function deploy5115MarketAndSeedLiquidity( address SY, PoolConfig memory config, address tokenToSeedLiquidity, uint256 amountToSeed) public payable returns (PoolDeploymentAddrs memory); * `SY` — address of your already-deployed SY contract * `config` — market parameters (see [`PoolConfig`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#poolconfig-struct) below) * `tokenToSeedLiquidity` / `amountToSeed` — token and amount for initial liquidity seeding This is callable by anyone (not owner-gated), making it suitable for permissionlessly listing a custom SY. Returns `PoolDeploymentAddrs { SY, PT, YT, market }`. `PoolConfig` Struct[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#poolconfig-struct "Direct link to poolconfig-struct") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- struct PoolConfig { uint32 expiry; uint256 rateMin; uint256 rateMax; uint256 desiredImpliedRate; uint256 fee;} | Field | Description | | --- | --- | | `expiry` | Market expiry as a Unix timestamp | | `rateMin` | Minimum implied APR, 1e18-scaled (e.g., `0.01e18` = 1%) | | `rateMax` | Maximum implied APR, 1e18-scaled (e.g., `0.30e18` = 30%) | | `desiredImpliedRate` | Target implied APR for seeding; must be between `rateMin` and `rateMax` | | `fee` | Swap fee, 1e18-scaled (e.g., `0.001e18` = 0.1%) | Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#further-reading "Direct link to Further Reading") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- * [Pendle-Common-Pool-Deploy Repository](https://github.com/pendle-finance/Pendle-Common-Pool-Deploy) — scripts and examples for deploying common pools * [Common SY Contracts](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY) — available Common SY types and their constructor encoding * [Community Listing](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing) — process for listing a new asset on Pendle * [PendleMarket](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket) — market state, AMM mechanics, and direct market interaction * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#overview) * [Path 1: Deploy Common Market](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#path-1-deploy-common-market) * [Path 2: Deploy Normal Market](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#path-2-deploy-normal-market) * [`PoolConfig` Struct](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#poolconfig-struct) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Router Overview | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#__docusaurus_skipToContent_fallback) On this page Quick Start[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#quick-start "Direct link to Quick Start") ------------------------------------------------------------------------------------------------------------------------------------------------------ * To see examples of how to use Pendle Router, check out the [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#integration-guide) . Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#overview "Direct link to Overview") --------------------------------------------------------------------------------------------------------------------------------------------- PendleRouter is a contract that aggregates callers' actions with various SYs, PTs, YTs, and markets. It does not have any special permissions or whitelists on any contracts it interacts with. However, it is recommended that third parties use the Router to enjoy the fee discount while trading with the pool, as opposed to directly interacting with the pools themselves. The lnFeeRateRoot in the pool will be reduced when the Router is used to trade. The Router has had three historical versions, with **RouterV4** very likely being the final version: | Version | Deployed | Address | Notes | | --- | --- | --- | --- | | RouterV1 | Nov 23, 2022 | `0x41FAD93F225b5C1C95f2445A5d7fcB85bA46713f` | Initial release | | RouterV2 | Feb 21, 2023 | `0x0000000001e4ef00d069e71d6ba041b0a16f7ea0` | 15–20% gas optimization | | RouterV3 | Dec 18, 2023 | `0x00000000005BBB0EF59571E58418F9a4357b68A0` | Added limit order support | | **RouterV4** | Apr 29, 2024 | `0x888888888889758F76e7103c6CbF23ABbF58F946` | **Upgradable** — new features and optimizations are added gradually without requiring partners to migrate | Since PendleRouter is a proxy to multiple implementations (using the [EIP-2535 Diamond Standard](https://eips.ethereum.org/EIPS/eip-2535) ), the caller can call the desired functions, and the Router will resolve to the correct implementation. Please refer to the [list of callable functions](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IPAllActionV3.sol) . Block Explorer Limitation Because the Router uses the Diamond proxy pattern, block explorers like Etherscan **cannot correctly display all available functions**. They typically only show the ABI of the base proxy contract, not the aggregated functions from all its facets (implementations). To interact with the full range of Router functions, use the complete combined ABI from [`IPAllActionV3.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IPAllActionV3.sol) . **Important notes on older Router versions:** * **RouterV2** may have issues with newer markets where a necessary approval step is not being called. On some networks like Mantle, RouterV2 is not supported and will revert. * **RouterV3** and earlier versions remain functional but lack the latest optimizations. Upgrading to **RouterV4** is highly recommended for all integrations. For a comprehensive understanding of the Pendle ecosystem, including key concepts and terminology, please refer to the [High Level Architecture](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture) . Integration Guide[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#integration-guide "Direct link to Integration Guide") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ This section covers how to interact with the Pendle Router to buy and sell Principal Tokens (PTs) and Yield Tokens (YTs) using two methods: 1. **Pendle's Hosted SDK**: Recommended for optimized liquidity, gas efficiency, and broader token support. Hosted SDK is publicly available at [https://api-v2.pendle.finance/core/docs](https://api-v2.pendle.finance/core/docs) . More about it at [Pendle Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) . 2. **Direct Interaction with the Pendle Router**: Offers direct contract interaction, all data is generated on-chain. We highly recommend using Pendle's SDK to generate calldata for several reasons: 1. **Gas Efficiency**: Currently, Pendle's AMM only supports the built-in `swapExactPtForSy` and `swapSyForExactPt`. To execute a `swapExactTokenForPt` (which is essentially the same as `swapExactSyForPt`), the router will conduct a binary search to determine the amount of PT to swap. While the binary search can be done entirely on-chain, limiting the search range off-chain will result in significantly less gas consumption for this function. The SDK leverages off-chain data to optimize gas usage, potentially reducing gas costs significantly. 2. **Accurate Price Impacts**: The SDK provides precise calculations for swaps, ensuring better price impacts for users. 3. **Limit Order System**: The limit order system of Pendle exists solely off-chain. Including these limit orders in on-chain swaps can significantly improve the price impact for users, particularly during large-size swaps. 4. **Ease of Integration**: By using the SDK, developers can seamlessly integrate Pendle's functionality into their applications, leveraging the full power of the swap aggregator, limit order system, and off-chain data preparation. 5. **Convenient zapping with any ERC20 token**: Liquidity is currently fragmented across a large number of pools across various DEXes. Integrating only Uniswap or Balancer has proven to be insufficient. As a result, PendleRouter has natively integrated [KyberSwap](https://kyberswap.com/) to swap from any ERC20 token to another. For KyberSwap to work, the routing algorithm must be called off-chain and then pass the routing results to the Router to execute. We'll explore both methods, including example code, for each approach. ### Method 1: Using the Pendle Hosted SDK (Recommended)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#method-1-using-the-pendle-hosted-sdk-recommended "Direct link to Method 1: Using the Pendle Hosted SDK (Recommended)") The Hosted SDK handles off-chain optimization, aggregator routing, and limit order integration automatically. See the [Hosted SDK Documentation](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) for full details, examples, and supported operations. ### Method 2: Direct Interaction with the Pendle Router[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#method-2-direct-interaction-with-the-pendle-router "Direct link to Method 2: Direct Interaction with the Pendle Router") For fully on-chain integrations without the SDK, see the [Contract Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide) for step-by-step Solidity examples covering PT/YT trading, liquidity management, and minting/redeeming. Key struct types used by the Router (`TokenInput`, `TokenOutput`, `ApproxParams`, `LimitOrderData`) are documented in the [Types and Utility Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types) reference, along with helper functions for on-chain parameter generation. ### Available Router Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#available-router-functions "Direct link to Available Router Functions") * **Trading**: `swapExactTokenForPt`, `swapExactPtForToken`, `swapExactTokenForYt`, `swapExactYtForToken` * **Liquidity**: `addLiquiditySingleToken`, `removeLiquiditySingleToken` * **Minting/Redeeming**: `mintPyFromToken`, `redeemPyToToken` * **Rewards**: `redeemDueInterestAndRewards` For the full list, see [`IPAllActionV3.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IPAllActionV3.sol) . Example code: [RouterSample.sol](https://github.com/pendle-finance/pendle-examples-public/blob/main/test/RouterSample.sol) . * [Quick Start](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#quick-start) * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#overview) * [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#integration-guide) * [Method 1: Using the Pendle Hosted SDK (Recommended)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#method-1-using-the-pendle-hosted-sdk-recommended) * [Method 2: Direct Interaction with the Pendle Router](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#method-2-direct-interaction-with-the-pendle-router) * [Available Router Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview#available-router-functions) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Unit, Decimals and Scaled18 | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#__docusaurus_skipToContent_fallback) On this page As Pendle supports a wide range of assets, it is important to understand how to handle units and decimals correctly. Definition[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#definition "Direct link to Definition") --------------------------------------------------------------------------------------------------------------------------------- * **Decimals** of a token is the number of digits to the right of the decimal point in the token's smallest unit. It is given by the `decimals` method of the token contract. For example: * **Raw unit** of a token X is the smallest indivisible unit of that token, often referred to as "wei" in the context of Ethereum-based tokens. This unit is used in smart contracts and calculations. * **Natural unit** of a token X is the unit that is most commonly used by users, which is typically the token's decimal representation. For example: Examples: * ETH has decimals of 18, so the natural unit (1 ETH) is 101810^{18}1018 raw unit. * USDC has decimals of 6, so the natural unit (1 USDC) is 10610^{6}106 raw unit. * BTC has decimals of 8, so the natural unit (1 BTC) is 10810^{8}108 raw unit. Decimals of PT, YT, SY and LP[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#decimals-of-pt-yt-sy-and-lp "Direct link to Decimals of PT, YT, SY and LP") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- * PT decimals and YT decimals are **the same**, and they are **equal** to the decimals of the _underlying asset_. * SY decimals equal to the decimals of the _yield token_. * Pendle LP decimals is always 18, regardless of the underlying asset's decimals. A reminder that the _underlying asset_ can be obtained using the function `SY.assetInfo()`, while the _yield token_ can be obtained using the function `SY.yieldToken()`. Scaled18 SY[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#scaled18-sy "Direct link to Scaled18 SY") ------------------------------------------------------------------------------------------------------------------------------------ As mentioned in the previous section, PT, YT and SY decimals are based on the underlying asset's decimals. However, for assets with small decimals (such as BTC), the margin for rounding error can be significant when performing calculations. To mitigate this, we introduced a _decimal-wrapping_ mechanism. For assets with decimals less than 18, we will deploy an ERC20 wrapper, both for the the underlying asset and the yield token. The wrapper will scale the asset to 18 decimals, allowing for more precise calculations. PT, YT and SY can then be of the wrapped asset, and they will have 18 decimals. ### Convention[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#convention "Direct link to Convention") For assets that are wrapped to have 18 decimals: * The function `ERC20.decimals()` will return 18. * The function `ERC20.name()` will the original asset's name, concatenated with the suffix `scaled18`. * The function `ERC20.symbol()` will the original asset's symbol, concatenated with the suffix `-scaled18`. * They will have an additional function `rawToken`, returning the address of the original asset. * One **natural unit** of the **wrapped** asset will equal to one **natural unit** of the original asset. * This fact can be used to convert between the **raw unit** of the wrapped asset and the original one. 10decimals original\=1018 wrapped⇔1 original\=1018−decimals wrapped\\begin{array}{rrcl} & 10^{\\mathrm{decimals}}\\ \\mathrm{original} & = & 10^{18}\\ \\mathrm{wrapped} \\\\ \\Leftrightarrow & 1\\ \\mathrm{original} & = & 10^{18 - decimals}\\ \\mathrm{wrapped} \\end{array}⇔​10decimals original1 original​\=\=​1018 wrapped1018−decimals wrapped​ For SY of such wrapped assets: * The contract name will have the suffix `Scaled18`, indicating that it is a scaled version of the original asset. * The `SY.assetInfo()` function will return the **wrapped** asset address. * The `SY.yieldToken()` function will return the **wrapped** yield token address. * Each `SY` will provide custom functionalities to obtain the original asset address. But the uniform way to obtain the original asset address is by calling the `rawToken` function on of the **wrapped** asset/yield token. * The `wrapped` yield token can be in the list of `tokensIn` and `tokensOut` (`SY.getTokensIn()` and `SY.getTokensOut()`). * See next section for the note on the `exchangeRate()` function. Conversion rates[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#conversion-rates "Direct link to Conversion rates") --------------------------------------------------------------------------------------------------------------------------------------------------- For on-chain purposes, there are ways to get conversion rates between 2 different tokens, such as: * `SY.exchangeRate()` - returns the exchange rate between SY and the underlying asset. * Using on-chain [Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) , the conversion rate between PT/YT/LP to SY/underlying asset can be obtained. An important fact about the conversion rate is that the number returned by these function **do NOT** operate on the _natural unit_, but on raw unit. tip Suppose that the function `SY.exchangeRate()` returns rate\\mathrm{rate}rate. To convert from xxx **raw unit** SY to the underlying asset, you can use the formula: x⋅rate/1018x \\cdot \\mathrm{rate} / 10^{18}x⋅rate/1018. Note that 101810^{18}1018 is a constant. Conversion between PT/YT/LP to SY/underlying using the oracle rate is done similarly. tip If you want to convert between **natural unit**, please convert the input into **raw unit** first, and convert the result back to **natural unit** after the calculation. ### scaled18 SY `exchangeRate()`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#scaled18-sy-exchangerate "Direct link to scaled18-sy-exchangerate") For scaled18 SY, the `exchangeRate()` function will return the exchange rate between the the SY and the **wrapped** underlying asset. To convert scaled SY of wrapped asset to the **original** underlying asset, we can multiply the `exchangeRate()` by 1018−decimals10^{18 - decimals}1018−decimals to get the conversion rate. * [Definition](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#definition) * [Decimals of PT, YT, SY and LP](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#decimals-of-pt-yt-sy-and-lp) * [Scaled18 SY](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#scaled18-sy) * [Convention](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#convention) * [Conversion rates](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#conversion-rates) * [scaled18 SY `exchangeRate()`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals#scaled18-sy-exchangerate) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # User & Position Info Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#__docusaurus_skipToContent_fallback) On this page These functions come from the `IPActionInfoStatic` facet and return position-level information for a given user. They are non-pure (they trigger a reward index update internally) but are entirely read-only from the caller's perspective — call them with `eth_call`. * * * getPY[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getpy "Direct link to getPY") ------------------------------------------------------------------------------------------------------------------------------------------ Resolves either a PT or YT address to the canonical pair. function getPY(address py) external view returns (address pt, address yt) **Parameters** | Name | Type | Description | | --- | --- | --- | | py | `address` | Address of either the PT or YT token | **Return Values** | Name | Type | Description | | --- | --- | --- | | pt | `address` | Principal Token address | | yt | `address` | Yield Token address | **Use Case** Useful when you have one token of the pair and need both addresses to call other functions. * * * getTokensInOut[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#gettokensinout "Direct link to getTokensInOut") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- Returns the lists of tokens that can be used as input or output for a given SY, PT/YT, or Market address. function getTokensInOut(address token) external view returns (address[] memory tokensIn, address[] memory tokensOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | token | `address` | Address of an SY, PT, YT, or Market contract | **Return Values** | Name | Type | Description | | --- | --- | --- | | tokensIn | `address[]` | Tokens accepted as input (for minting / swapping in) | | tokensOut | `address[]` | Tokens accepted as output (for redeeming / swapping out) | **Use Case** Use to populate token-selection UI or to validate that a given token is supported before building a swap. * * * getUserSYInfo[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getusersyinfo "Direct link to getUserSYInfo") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ Returns a user's SY balance and unclaimed SY rewards. function getUserSYInfo(address sy, address user) external returns (UserSYInfo memory res) **Parameters** | Name | Type | Description | | --- | --- | --- | | sy | `address` | SY contract address | | user | `address` | User wallet address | **Return Values** | Name | Type | Description | | --- | --- | --- | | res | [`UserSYInfo`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#usersyinfo) | SY balance + unclaimed rewards | **Use Case** Use before calling `claimRewards` to preview how much the user will receive, or to display reward accrual in a dashboard. * * * getUserPYInfo[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getuserpyinfo "Direct link to getUserPYInfo") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ Returns a user's PT balance, YT balance, unclaimed accrued interest, and unclaimed rewards. function getUserPYInfo(address py, address user) external returns (UserPYInfo memory res) **Parameters** | Name | Type | Description | | --- | --- | --- | | py | `address` | PT or YT address (both are resolved to the same pair) | | user | `address` | User wallet address | **Return Values** | Name | Type | Description | | --- | --- | --- | | res | [`UserPYInfo`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#userpyinfo) | PT/YT balances, unclaimed interest, and unclaimed rewards | **Use Case** Use to show users their outstanding interest and reward positions, or to preflight a `redeemDueInterestAndRewards` call. * * * getUserMarketInfo[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getusermarketinfo "Direct link to getUserMarketInfo") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Returns a user's LP balance and the equivalent PT and SY values, plus any unclaimed LP rewards. function getUserMarketInfo(address market, address user) external returns (UserMarketInfo memory res) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | user | `address` | User wallet address | **Return Values** | Name | Type | Description | | --- | --- | --- | | res | [`UserMarketInfo`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#usermarketinfo) | LP balance, underlying PT + SY value, and unclaimed rewards | **Use Case** Use to display a user's liquidity position, including the breakdown of assets locked in LP and any pending reward claims. * * * Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#examples "Direct link to Examples") --------------------------------------------------------------------------------------------------------------------------------------------------- Recommended: Use the Pendle API The examples below show direct RouterStatic usage. For most integrations, the [Pendle Hosted SDK / API](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) is the better choice — it handles approximation, limit-order filling, and zap routing automatically. ### Resolve a PT/YT address and get supported tokens[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#resolve-a-ptyt-address-and-get-supported-tokens "Direct link to Resolve a PT/YT address and get supported tokens") // You only have one token from the pair — get bothconst [ptAddress, ytAddress] = await routerStatic.getPY(knownPtOrYtAddress);// Find out what tokens are accepted for swapping/mintingconst [tokensIn, tokensOut] = await routerStatic.getTokensInOut(MARKET_ADDRESS);console.log("Accepted input tokens:", tokensIn);console.log("Accepted output tokens:", tokensOut); ### Display a user's full Pendle position[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#display-a-users-full-pendle-position "Direct link to Display a user's full Pendle position") const [syInfo, pyInfo, marketInfo] = await Promise.all([ routerStatic.getUserSYInfo(SY_ADDRESS, userAddress), routerStatic.getUserPYInfo(YT_ADDRESS, userAddress), routerStatic.getUserMarketInfo(MARKET_ADDRESS, userAddress),]);console.log("--- SY Position ---");console.log(`SY balance: ${ethers.formatEther(syInfo.syBalance.amount)}`);for (const r of syInfo.unclaimedRewards) { console.log(` Reward ${r.token}: ${ethers.formatEther(r.amount)}`);}console.log("--- PY Position ---");console.log(`PT balance: ${ethers.formatEther(pyInfo.ptBalance.amount)}`);console.log(`YT balance: ${ethers.formatEther(pyInfo.ytBalance.amount)}`);console.log(`Unclaimed interest: ${ethers.formatEther(pyInfo.unclaimedInterest.amount)} (${pyInfo.unclaimedInterest.token})`);for (const r of pyInfo.unclaimedRewards) { console.log(` Reward ${r.token}: ${ethers.formatEther(r.amount)}`);}console.log("--- LP Position ---");console.log(`LP balance: ${ethers.formatEther(marketInfo.lpBalance.amount)}`);console.log(`PT value in LP: ${ethers.formatEther(marketInfo.ptBalance.amount)}`);console.log(`SY value in LP: ${ethers.formatEther(marketInfo.syBalance.amount)}`);for (const r of marketInfo.unclaimedRewards) { console.log(` Reward ${r.token}: ${ethers.formatEther(r.amount)}`);} ### Preview pending rewards before deciding to claim[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#preview-pending-rewards-before-deciding-to-claim "Direct link to Preview pending rewards before deciding to claim") const marketInfo = await routerStatic.getUserMarketInfo(MARKET_ADDRESS, userAddress);const pyInfo = await routerStatic.getUserPYInfo(YT_ADDRESS, userAddress);const allRewards = [...marketInfo.unclaimedRewards, ...pyInfo.unclaimedRewards];const totalRewardUsd = await estimateRewardValueUsd(allRewards); // your price feedconsole.log(`Total claimable rewards ≈ $${totalRewardUsd.toFixed(2)}`);if (totalRewardUsd > MIN_CLAIM_USD) { await router.redeemDueInterestAndRewards( userAddress, [], // SY addresses to claim from [YT_ADDRESS], // YT addresses to claim interest + rewards from [MARKET_ADDRESS] // markets to claim LP rewards from );} * [getPY](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getpy) * [getTokensInOut](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#gettokensinout) * [getUserSYInfo](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getusersyinfo) * [getUserPYInfo](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getuserpyinfo) * [getUserMarketInfo](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#getusermarketinfo) * [Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#examples) * [Resolve a PT/YT address and get supported tokens](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#resolve-a-ptyt-address-and-get-supported-tokens) * [Display a user's full Pendle position](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#display-a-users-full-pendle-position) * [Preview pending rewards before deciding to claim](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/InfoFunctions#preview-pending-rewards-before-deciding-to-claim) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Misc Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#__docusaurus_skipToContent_fallback) On this page Interface Stability Some functions on this page have interfaces that may change in the future. Check with the Pendle team before using in production. This document covers core functions for SY/PY operations, reward claiming, exit strategies, and utility functions in Pendle Router. SY Operations[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#sy-operations "Direct link to SY Operations") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### mintSyFromToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#mintsyfromtoken "Direct link to mintSyFromToken") Mints SY tokens from any supported tokens. function mintSyFromToken( address receiver, address SY, uint256 minSyOut, TokenInput calldata input) external payable returns (uint256 netSyOut) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive SY tokens | | SY | `address` | SY token contract address | | minSyOut | `uint256` | Minimum SY tokens to receive | | input | [`TokenInput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) | Token input configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY tokens received | **Use Case** Convert any supported token into SY tokens, which are standardized yield-bearing tokens used throughout the Pendle ecosystem. ### redeemSyToToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemsytotoken "Direct link to redeemSyToToken") Redeems SY tokens back to any supported tokens. function redeemSyToToken( address receiver, address SY, uint256 netSyIn, TokenOutput calldata output) external returns (uint256 netTokenOut) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | SY | `address` | SY token contract address | | netSyIn | `uint256` | Amount of SY tokens to redeem | | output | [`TokenOutput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput) | Token output configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Tokens received | **Use Case** Convert SY tokens back to tokens when you want. Principal/Yield Token Operations[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#principalyield-token-operations "Direct link to Principal/Yield Token Operations") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### mintPyFromToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#mintpyfromtoken "Direct link to mintPyFromToken") Mints PT and YT tokens (collectively called PY) from any supported tokens. function mintPyFromToken( address receiver, address YT, uint256 minPyOut, TokenInput calldata input) external payable returns (uint256 netPyOut, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT and YT tokens | | YT | `address` | YT token contract address | | minPyOut | `uint256` | Minimum PY tokens to mint | | input | [`TokenInput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) | Token input configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPyOut | `uint256` | PT and YT tokens minted (equal amounts) | | netSyInterm | `uint256` | SY tokens generated as intermediate step | **Use Case** Split any supported token into separate principal and yield components. ### redeemPyToToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeempytotoken "Direct link to redeemPyToToken") Redeems equal amounts of PT and YT tokens back to any supported tokens. function redeemPyToToken( address receiver, address YT, uint256 netPyIn, TokenOutput calldata output) external returns (uint256 netTokenOut, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | YT | `address` | YT token contract address | | netPyIn | `uint256` | Amount of PT+YT pairs to redeem | | output | [`TokenOutput`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput) | Token output configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Tokens received | | netSyInterm | `uint256` | SY tokens generated as intermediate step | **Use Case** Recombine PT and YT tokens back into any supported token. Requires holding equal amounts of both PT and YT. ### mintPyFromSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#mintpyfromsy "Direct link to mintPyFromSy") Mints PT and YT tokens directly from SY tokens. function mintPyFromSy( address receiver, address YT, uint256 netSyIn, uint256 minPyOut) external returns (uint256 netPyOut) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive PT and YT tokens | | YT | `address` | YT token contract address | | netSyIn | `uint256` | Amount of SY tokens to use | | minPyOut | `uint256` | Minimum PY tokens to mint | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPyOut | `uint256` | PT and YT tokens minted (equal amounts) | **Use Case** Efficient splitting of SY tokens into PT and YT when you already have SY tokens. ### redeemPyToSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeempytosy "Direct link to redeemPyToSy") Redeems equal amounts of PT and YT tokens back to SY tokens. function redeemPyToSy( address receiver, address YT, uint256 netPyIn, uint256 minSyOut) external returns (uint256 netSyOut) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive SY tokens | | YT | `address` | YT token contract address | | netPyIn | `uint256` | Amount of PT+YT pairs to redeem | | minSyOut | `uint256` | Minimum SY tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY tokens received | **Use Case** Recombine PT and YT tokens into SY tokens for further operations within Pendle ecosystem. Reward Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#reward-functions "Direct link to Reward Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### redeemDueInterestAndRewards[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewards "Direct link to redeemDueInterestAndRewards") Claims all pending rewards and interest from SY tokens, YT tokens, and LP positions. function redeemDueInterestAndRewards( address user, address[] calldata sys, address[] calldata yts, address[] calldata markets) external **Input Parameters** | Name | Type | Description | | --- | --- | --- | | user | `address` | Address to receive rewards | | sys | `address[]` | Array of SY token addresses | | yts | `address[]` | Array of YT token addresses | | markets | `address[]` | Array of market addresses | **Use Case** Batch claim all rewards across multiple positions. This is the most gas-efficient way to claim rewards from multiple sources. ### redeemDueInterestAndRewardsV2[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewardsv2 "Direct link to redeemDueInterestAndRewardsV2") Advanced reward claiming with token swapping capabilities. function redeemDueInterestAndRewardsV2( IStandardizedYield[] calldata SYs, RedeemYtIncomeToTokenStruct[] calldata YTs, IPMarket[] calldata markets, IPSwapAggregator pendleSwap, SwapDataExtra[] calldata swaps) external returns (uint256[] memory netOutFromSwaps, uint256[] memory netInterests) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | SYs | `IStandardizedYield[]` | Array of SY contracts | | YTs | [`RedeemYtIncomeToTokenStruct[]`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#redeemytincometotokenstruct) | YT redemption configurations | | markets | `IPMarket[]` | Array of market contracts | | pendleSwap | `IPSwapAggregator` | Swap aggregator for token conversions | | swaps | [`SwapDataExtra[]`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#swapdata) | Swap configurations | **Return Values** | Name | Type | Description | | --- | --- | --- | | netOutFromSwaps | `uint256[]` | Tokens received from swaps | | netInterests | `uint256[]` | Interest tokens received | **Use Case** Advanced reward claiming that can automatically swap reward tokens to desired tokens. Useful for complex strategies and automated systems. Token Swapping[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#token-swapping "Direct link to Token Swapping") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapTokensToTokens[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#swaptokenstotokens "Direct link to swapTokensToTokens") Performs multiple token-to-token swaps using external aggregators. function swapTokensToTokens( IPSwapAggregator pendleSwap, SwapDataExtra[] calldata swaps, uint256[] calldata netSwaps) external payable returns (uint256[] memory netOutFromSwaps) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | pendleSwap | `IPSwapAggregator` | Swap aggregator contract | | swaps | `SwapDataExtra[]` | Array of swap configurations | | netSwaps | `uint256[]` | Array of input amounts for each swap | **Return Values** | Name | Type | Description | | --- | --- | --- | | netOutFromSwaps | `uint256[]` | Output amounts from each swap | **Use Case** Batch multiple token swaps for gas efficiency. ### swapTokenToTokenViaSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#swaptokentotokenviasy "Direct link to swapTokenToTokenViaSy") Swaps tokens using SY as an intermediate step. function swapTokenToTokenViaSy( address receiver, address SY, TokenInput calldata input, address tokenRedeemSy, uint256 minTokenOut) external payable returns (uint256 netTokenOut, uint256 netSyInterm) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive output tokens | | SY | `address` | SY token contract address | | input | `TokenInput` | Input token configuration | | tokenRedeemSy | `address` | Output token address | | minTokenOut | `uint256` | Minimum output tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Output tokens received | | netSyInterm | `uint256` | SY tokens used as intermediate | **Use Case** Swap between tokens that both support the same SY token, often providing better rates than external DEXes. Exit Strategies[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exit-strategies "Direct link to Exit Strategies") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### exitPreExpToToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpreexptotoken "Direct link to exitPreExpToToken") Comprehensive position exit before market expiry, converting everything to a single token. function exitPreExpToToken( address receiver, address market, uint256 netPtIn, uint256 netYtIn, uint256 netLpIn, TokenOutput calldata output, LimitOrderData calldata limit) external returns (uint256 totalTokenOut, ExitPreExpReturnParams memory params) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | market | `address` | Pendle market address | | netPtIn | `uint256` | Amount of PT tokens to exit | | netYtIn | `uint256` | Amount of YT tokens to exit | | netLpIn | `uint256` | Amount of LP tokens to exit | | output | `TokenOutput` | Output token configuration | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | totalTokenOut | `uint256` | Total tokens received | | params | [`ExitPreExpReturnParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpreexpreturnparams) | Detailed breakdown of exit operations | **Use Case** Complete portfolio liquidation before expiry. Optimally combines PT+YT pairs and swaps remaining tokens. ### exitPreExpToSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpreexptosy "Direct link to exitPreExpToSy") Comprehensive position exit before market expiry, converting everything to SY tokens. function exitPreExpToSy( address receiver, address market, uint256 netPtIn, uint256 netYtIn, uint256 netLpIn, uint256 minSyOut, LimitOrderData calldata limit) external returns (ExitPreExpReturnParams memory params) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive SY tokens | | market | `address` | Pendle market address | | netPtIn | `uint256` | Amount of PT tokens to exit | | netYtIn | `uint256` | Amount of YT tokens to exit | | netLpIn | `uint256` | Amount of LP tokens to exit | | minSyOut | `uint256` | Minimum SY tokens to receive | | limit | [`LimitOrderData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) | Limit order configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | params | [`ExitPreExpReturnParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpreexpreturnparams) | Detailed breakdown of exit operations | **Use Case** Portfolio liquidation to SY tokens, useful when you want to stay within Pendle ecosystem or perform further operations. ### exitPostExpToToken[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpostexptotoken "Direct link to exitPostExpToToken") Position exit after market expiry, when PT tokens can be redeemed 1:1. function exitPostExpToToken( address receiver, address market, uint256 netPtIn, uint256 netLpIn, TokenOutput calldata output) external returns (uint256 totalTokenOut, ExitPostExpReturnParams memory params) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive tokens | | market | `address` | Pendle market address | | netPtIn | `uint256` | Amount of PT tokens to redeem | | netLpIn | `uint256` | Amount of LP tokens to exit | | output | `TokenOutput` | Output token configuration | **Return Values** | Name | Type | Description | | --- | --- | --- | | totalTokenOut | `uint256` | Total tokens received | | params | [`ExitPostExpReturnParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpostexpreturnparams) | Breakdown of redemption operations | **Use Case** Clean exit after maturity when PT tokens are worth face value. Much simpler than pre-expiry exits. ### exitPostExpToSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpostexptosy "Direct link to exitPostExpToSy") Position exit after market expiry, converting to SY tokens. function exitPostExpToSy( address receiver, address market, uint256 netPtIn, uint256 netLpIn, uint256 minSyOut) external returns (ExitPostExpReturnParams memory params) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | receiver | `address` | Address to receive SY tokens | | market | `address` | Pendle market address | | netPtIn | `uint256` | Amount of PT tokens to redeem | | netLpIn | `uint256` | Amount of LP tokens to exit | | minSyOut | `uint256` | Minimum SY tokens to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | params | [`ExitPostExpReturnParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpostexpreturnparams) | Breakdown of redemption operations | **Use Case** Post-expiry exit to SY tokens, maintaining position within Pendle ecosystem. Utility Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#utility-functions "Direct link to Utility Functions") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ### boostMarkets[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#boostmarkets "Direct link to boostMarkets") Triggers market updates to refresh boost multipliers. function boostMarkets(address[] memory markets) external **Input Parameters** | Name | Type | Description | | --- | --- | --- | | markets | `address[]` | Array of market addresses to boost | **Use Case** Refresh boost calculations for multiple markets in a single transaction. ### multicall[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#multicall "Direct link to multicall") Executes multiple function calls in a single transaction. function multicall(Call3[] calldata calls) external payable returns (Result[] memory res) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | calls | `Call3[]` | Array of function calls to execute | **Return Values** | Name | Type | Description | | --- | --- | --- | | res | `Result[]` | Results from each function call | **Use Case** Batch multiple operations for gas efficiency and atomic execution. ### simulate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#simulate "Direct link to simulate") Off-chain use only `simulate` always reverts — it executes the call and surfaces the return data through a revert. It must be called via `eth_call` / `staticCall`, never as an on-chain transaction. Simulates function execution and returns the output data without committing state changes. function simulate(address target, bytes calldata data) external payable **Input Parameters** | Name | Type | Description | | --- | --- | --- | | target | `address` | Contract address to simulate | | data | `bytes` | Encoded function call data | Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#integration-examples "Direct link to Integration Examples") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Basic SY Operations[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#basic-sy-operations "Direct link to Basic SY Operations") // Mint SY-sUSDe from USDerouter.mintSyFromToken( msg.sender, SY_USDE_ADDRESS, minSyOut, createTokenInputSimple(USDE_ADDRESS, 1000e18));// Redeem SY-sUSDe back to USDErouter.redeemSyToToken( msg.sender, SY_USDE_ADDRESS, syAmount, createTokenOutputSimple(USDE_ADDRESS, minUsdeOut)); ### Reward Claiming[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#reward-claiming "Direct link to Reward Claiming") // Claim all rewardsaddress[] memory sys = new address[](1);address[] memory yts = new address[](1);address[] memory markets = new address[](1);sys[0] = SY_ADDRESS;yts[0] = YT_ADDRESS;markets[0] = MARKET_ADDRESS;router.redeemDueInterestAndRewards(msg.sender, sys, yts, markets); ### Complete Position Exit[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#complete-position-exit "Direct link to Complete Position Exit") // Exit all positions before expiryrouter.exitPreExpToToken( msg.sender, MARKET_ADDRESS, ptAmount, ytAmount, lpAmount, createTokenOutputSimple(USDC_ADDRESS, minUsdcOut), createEmptyLimitOrderData()); * [SY Operations](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#sy-operations) * [mintSyFromToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#mintsyfromtoken) * [redeemSyToToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemsytotoken) * [Principal/Yield Token Operations](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#principalyield-token-operations) * [mintPyFromToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#mintpyfromtoken) * [redeemPyToToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeempytotoken) * [mintPyFromSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#mintpyfromsy) * [redeemPyToSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeempytosy) * [Reward Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#reward-functions) * [redeemDueInterestAndRewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewards) * [redeemDueInterestAndRewardsV2](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewardsv2) * [Token Swapping](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#token-swapping) * [swapTokensToTokens](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#swaptokenstotokens) * [swapTokenToTokenViaSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#swaptokentotokenviasy) * [Exit Strategies](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exit-strategies) * [exitPreExpToToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpreexptotoken) * [exitPreExpToSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpreexptosy) * [exitPostExpToToken](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpostexptotoken) * [exitPostExpToSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#exitpostexptosy) * [Utility Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#utility-functions) * [boostMarkets](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#boostmarkets) * [multicall](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#multicall) * [simulate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#simulate) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#integration-examples) * [Basic SY Operations](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#basic-sy-operations) * [Reward Claiming](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#reward-claiming) * [Complete Position Exit](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#complete-position-exit) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Types and Utility Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#__docusaurus_skipToContent_fallback) On this page This document covers all struct types used throughout the Pendle Router and utility functions for generating parameters on-chain. Core Parameter Types[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#core-parameter-types "Direct link to Core Parameter Types") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### TokenInput[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput "Direct link to TokenInput") Defines input token configuration for functions that accept tokens. struct TokenInput { address tokenIn; uint256 netTokenIn; address tokenMintSy; address pendleSwap; SwapData swapData;} **Fields** | Name | Type | Description | | --- | --- | --- | | tokenIn | `address` | Address of the input token (can be any ERC20 token supported by Pendle) | | netTokenIn | `uint256` | Amount of input tokens | | tokenMintSy | `address` | Token used to mint SY (must be supported by target SY contract) | | pendleSwap | `address` | Swap aggregator address (use `address(0)` for direct SY token input) | | swapData | `SwapData` | Swap configuration data for external aggregation | ### Usage Patterns[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#usage-patterns "Direct link to Usage Patterns") **Direct SY Token Input (Simple):** When `tokenIn` is already a token supported by the target SY contract: * Set `tokenIn = tokenMintSy` (same token) * Set `pendleSwap = address(0)` (no external swap needed) * Set `swapData` to empty (no aggregation) **Any ERC20 Token Input (Zap In):** When `tokenIn` is any ERC20 token that needs to be swapped to a supported SY token: * Set `tokenIn` to the user's input token (e.g., USDC, DAI, WETH) * Set `tokenMintSy` to a token supported by the target SY * Set `pendleSwap` to the swap aggregator address * Set `swapData` with proper aggregator configuration. **E.g**: When you have USDC and want to mint SY-sUSDe: * Set `tokenIn = USDC` * Set `tokenMintSy = sUSDe` (a token accepted by SY-sUSDe's `deposit()` function) * Set `pendleSwap = 0xd4F480965D2347d421F1bEC7F545682E5Ec2151D` * Set `swapData` to proper data configuration obtained from [SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#supported-functions) **Benefits of Zap In:** * Users can interact with any Pendle market using any ERC20 token they hold * No need to manually swap tokens before interacting with Pendle * Optimal routing through multiple DEXes for best price execution * Single transaction for swap + Pendle operation **SDK Integration:** The [Pendle Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#features) automatically handles all TokenInput configuration when you enable routing. When you set `enableAggregator: true` in SDK calls, it: * Automatically selects the best swap aggregator (KyberSwap, ODOS, 1inch, etc.) * Generates optimal `swapData` for the chosen route * Handles all token conversions transparently * Provides the best possible price execution across multiple DEXes For direct contract interaction, you need to manually configure these fields or use utility functions like `createTokenInputSimple()` for basic operations. ### TokenOutput[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput "Direct link to TokenOutput") Defines output token configuration for functions that return tokens. struct TokenOutput { address tokenOut; uint256 minTokenOut; address tokenRedeemSy; address pendleSwap; SwapData swapData;} **Fields** | Name | Type | Description | | --- | --- | --- | | tokenOut | `address` | Address of the desired output token (can be any ERC20 token supported by Pendle) | | minTokenOut | `uint256` | Minimum amount of output tokens to receive (slippage protection) | | tokenRedeemSy | `address` | Token to redeem SY to (must be supported by target SY contract) | | pendleSwap | `address` | Swap aggregator address (use `address(0)` for direct SY token output) | | swapData | `SwapData` | Swap configuration data for external aggregation | ### Usage Patterns[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#usage-patterns-1 "Direct link to Usage Patterns") **Direct SY Token Output (Simple):** When `tokenOut` is already a token supported by the target SY contract: * Set `tokenOut = tokenRedeemSy` (same token) * Set `pendleSwap = address(0)` (no external swap needed) * Set `swapData` to empty (no aggregation) **Any ERC20 Token Output (Zap Out):** When `tokenOut` is any ERC20 token different from supported SY tokens: * Set `tokenOut` to the user's desired token (e.g., USDC, DAI, WETH) * Set `tokenRedeemSy` to a token supported by the target SY * Set `pendleSwap` to the swap aggregator address * Set `swapData` with proper aggregator configuration (KyberSwap, 1inch, etc.) **Benefits of Zap Out:** * Users can receive any ERC20 token as output from Pendle operations * No need to manually swap tokens after exiting Pendle positions * Optimal routing through multiple DEXes for best price execution * Single transaction for Pendle operation + swap * Built-in slippage protection with `minTokenOut` **SDK Integration:** The [Pendle Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#features) automatically handles all TokenOutput configuration when you enable routing. When you set `enableAggregator: true` in SDK calls, it: * Automatically selects the best swap aggregator for output token conversion * Generates optimal `swapData` for the chosen route * Calculates appropriate slippage protection * Handles all token conversions transparently For direct contract interaction, you need to manually configure these fields or use utility functions like `createTokenOutputSimple()` for basic operations. ### ApproxParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams "Direct link to ApproxParams") Parameters for approximation algorithms used when swapping exact tokens to PT or YT. **ApproxParams is required when the exact output amount needs to be determined through iterative approximation** because the Pendle AMM formula cannot be directly inverted. struct ApproxParams { uint256 guessMin; uint256 guessMax; uint256 guessOffchain; uint256 maxIteration; uint256 eps;} **Fields** | Name | Type | Description | | --- | --- | --- | | guessMin | `uint256` | Minimum bound for binary search | | guessMax | `uint256` | Maximum bound for binary search (use `type(uint256).max` for auto) | | guessOffchain | `uint256` | Initial guess from off-chain calculation (use `0` for on-chain) | | maxIteration | `uint256` | Maximum iterations for binary search (recommended: `256`) | | eps | `uint256` | Precision tolerance (recommended: `1e14`) | **When ApproxParams is Needed:** ApproxParams is required for functions that swap an exact amount of tokens to PT or YT, such as: * [`swapExactTokenForPt`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexacttokenforpt) - Convert exact token amount to PT * [`swapExactSyForPt`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/PtFunctions#swapexactsyforpt) - Convert exact SY amount to PT * [`swapExactTokenForYt`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexacttokenforyt) - Convert exact token amount to YT * [`swapExactSyForYt`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/YtFunctions#swapexactsyforyt) - Convert exact SY amount to YT **Why Approximation is Required:** The Pendle AMM natively supports functions like `swapExactPtForSy` and `swapSyForExactPt`, but does NOT have `swapExactSyForPt`. When you want to swap an exact amount of tokens/SY for PT/YT, the router must use binary search to determine how much PT/YT can be obtained, since the AMM can only calculate the reverse (exact PT amounts). ### LimitOrderData[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata "Direct link to LimitOrderData") Configuration for limit order functionality that **provides better prices and reduces slippage** by filling user orders at predetermined rates before routing to the AMM. struct LimitOrderData { address limitRouter; uint256 epsSkipMarket; FillOrderParams[] normalFills; FillOrderParams[] flashFills; bytes optData;} **Fields** | Name | Type | Description | | --- | --- | --- | | limitRouter | `address` | Address of limit order router | | epsSkipMarket | `uint256` | Threshold to skip market operations | | normalFills | `FillOrderParams[]` | Normal limit order fills | | flashFills | `FillOrderParams[]` | Flash loan limit order fills | | optData | `bytes` | Additional optimization data | ### RedeemYtIncomeToTokenStruct[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#redeemytincometotokenstruct "Direct link to RedeemYtIncomeToTokenStruct") Configuration for YT income redemption with token conversion. struct RedeemYtIncomeToTokenStruct { IPYieldToken yt; bool doRedeemInterest; bool doRedeemRewards; address tokenRedeemSy; uint256 minTokenRedeemOut;} **Fields** | Name | Type | Description | | --- | --- | --- | | yt | `IPYieldToken` | YT token contract interface | | doRedeemInterest | `bool` | Whether to redeem accrued interest | | doRedeemRewards | `bool` | Whether to redeem reward tokens | | tokenRedeemSy | `address` | Token to convert SY interest to | | minTokenRedeemOut | `uint256` | Minimum tokens to receive from conversion | ### SwapData[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#swapdata "Direct link to SwapData") Configuration for external swap aggregation functionality. struct SwapData { SwapType swapType; address extRouter; bytes extCalldata; bool needScale;} **Fields** | Name | Type | Description | | --- | --- | --- | | swapType | `SwapType` | Type of swap aggregator to use | | extRouter | `address` | Address of the external swap router | | extCalldata | `bytes` | Encoded calldata for the external swap | | needScale | `bool` | Whether the swap amount needs scaling | **Use Case** Enables integration with external swap aggregators like KyberSwap, 1inch, Paraswap, etc. This allows Pendle to support zapping in/out with any ERC20 token by routing through external DEXes. ### SwapType[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#swaptype "Direct link to SwapType") Enumeration defining supported swap aggregator types. See the [complete SwapType definition](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/router/swap-aggregator/IPSwapAggregator.sol#L18-L31) in the smart contract. enum SwapType { NONE, KYBERSWAP, ODOS, ETH_WETH, OKX, ONE_INCH, PARASWAP} **Values** | Value | Description | | --- | --- | | `NONE` | No external swap aggregation | | `KYBERSWAP` | KyberSwap aggregation | | `ODOS` | ODOS aggregation | | `ETH_WETH` | ETH/WETH conversion | | `OKX` | OKX DEX aggregation | | `ONE_INCH` | 1inch aggregation | | `PARASWAP` | Paraswap aggregation | **Use Case** Specifies which external aggregator to use for token swaps, enabling Pendle to leverage the best available liquidity across different DEXes. The [Pendle Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk#features) automatically selects the optimal SwapType based on available liquidity and routing efficiency. ### ExitPreExpReturnParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpreexpreturnparams "Direct link to ExitPreExpReturnParams") Detailed breakdown of returns from pre-expiry position exit operations. struct ExitPreExpReturnParams { uint256 netPtFromRemove; uint256 netSyFromRemove; uint256 netPyRedeem; uint256 netSyFromRedeem; uint256 netPtSwap; uint256 netYtSwap; uint256 netSyFromSwap; uint256 netSyFee; uint256 totalSyOut;} **Fields** | Name | Type | Description | | --- | --- | --- | | netPtFromRemove | `uint256` | PT tokens obtained from LP removal | | netSyFromRemove | `uint256` | SY tokens obtained from LP removal | | netPyRedeem | `uint256` | PT+YT pairs redeemed to SY | | netSyFromRedeem | `uint256` | SY tokens from PT+YT redemption | | netPtSwap | `uint256` | PT tokens swapped to SY | | netYtSwap | `uint256` | YT tokens swapped to SY | | netSyFromSwap | `uint256` | SY tokens from PT/YT swaps | | netSyFee | `uint256` | Trading fees paid in SY | | totalSyOut | `uint256` | Total SY tokens received | **Use Case** Provides detailed breakdown of complex exit operations before market expiry, helping users understand exactly how their positions were unwound and what fees were paid. ### ExitPostExpReturnParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpostexpreturnparams "Direct link to ExitPostExpReturnParams") Breakdown of returns from post-expiry position exit operations. struct ExitPostExpReturnParams { uint256 netPtFromRemove; uint256 netSyFromRemove; uint256 netPtRedeem; uint256 netSyFromRedeem; uint256 totalSyOut;} **Fields** | Name | Type | Description | | --- | --- | --- | | netPtFromRemove | `uint256` | PT tokens obtained from LP removal | | netSyFromRemove | `uint256` | SY tokens obtained from LP removal | | netPtRedeem | `uint256` | PT tokens redeemed at maturity | | netSyFromRedeem | `uint256` | SY tokens from PT redemption | | totalSyOut | `uint256` | Total SY tokens received | **Use Case** Provides breakdown of exit operations after market expiry when PT tokens can be redeemed 1:1 for underlying assets. Simpler than pre-expiry exits since no swapping is required. Utility Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#utility-functions "Direct link to Utility Functions") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- These functions generate the parameters described above on-chain, offering an alternative for users who do not utilize the Pendle SDK. ### createTokenInputSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createtokeninputsimple "Direct link to createTokenInputSimple") Creates a simple TokenInput struct without external swapping. function createTokenInputSimple(address tokenIn, uint256 netTokenIn) pure returns (TokenInput memory) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | tokenIn | `address` | Input token address (must be supported by target SY) | | netTokenIn | `uint256` | Amount of input tokens | **Return Values** | Name | Type | Description | | --- | --- | --- | | \- | `TokenInput` | Configured TokenInput struct | **Use Case** Most common way to create TokenInput for standard operations. The tokenIn must be one of the tokens accepted by the target SY contract (check via `IStandardizedYield.getTokensIn()`). ### createTokenOutputSimple[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createtokenoutputsimple "Direct link to createTokenOutputSimple") Creates a simple TokenOutput struct without external swapping. function createTokenOutputSimple(address tokenOut, uint256 minTokenOut) pure returns (TokenOutput memory) **Input Parameters** | Name | Type | Description | | --- | --- | --- | | tokenOut | `address` | Output token address (must be supported by target SY) | | minTokenOut | `uint256` | Minimum amount of output tokens | **Return Values** | Name | Type | Description | | --- | --- | --- | | \- | `TokenOutput` | Configured TokenOutput struct | **Use Case** Most common way to create TokenOutput for standard operations. The tokenOut must be one of the tokens that the target SY can redeem to (check via `IStandardizedYield.getTokensOut()`). ### createDefaultApproxParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createdefaultapproxparams "Direct link to createDefaultApproxParams") Creates default approximation parameters suitable for most operations. function createDefaultApproxParams() pure returns (ApproxParams memory) **Return Values** | Name | Type | Description | | --- | --- | --- | | \- | `ApproxParams` | Configured ApproxParams with optimal defaults | **Configuration** * guessMin: `0` * guessMax: `type(uint256).max` (auto-detection) * guessOffchain: `0` (pure on-chain calculation) * maxIteration: `256` (sufficient for most cases) * eps: `1e14` (0.01% precision) **Use Case** Recommended for all operations requiring approximation. These parameters provide good balance between accuracy and gas costs. ### createEmptyLimitOrderData[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createemptylimitorderdata "Direct link to createEmptyLimitOrderData") Creates an empty LimitOrderData struct for operations without limit orders. function createEmptyLimitOrderData() pure returns (LimitOrderData memory) **Return Values** | Name | Type | Description | | --- | --- | --- | | \- | `LimitOrderData` | Empty LimitOrderData struct | **Use Case** Use when you don't need limit order functionality. Required by many functions but can be empty for standard market operations. Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#integration-examples "Direct link to Integration Examples") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Basic Parameter Creation[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#basic-parameter-creation "Direct link to Basic Parameter Creation") // Create input parameters for 1000 USDCTokenInput memory input = createTokenInputSimple(USDC_ADDRESS, 1000e6);// Create output parameters expecting at least 950 USDCTokenOutput memory output = createTokenOutputSimple(USDC_ADDRESS, 950e6);// Create default approximation parametersApproxParams memory approx = createDefaultApproxParams();// Create empty limit order dataLimitOrderData memory limit = createEmptyLimitOrderData(); ### Complete Function Call Example[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#complete-function-call-example "Direct link to Complete Function Call Example") // Add liquidity with properly configured parametersrouter.addLiquiditySingleToken( msg.sender, // receiver MARKET_ADDRESS, // market minLpOut, // minLpOut createDefaultApproxParams(), // guessPtReceivedFromSy createTokenInputSimple(USDC_ADDRESS, 1000e6), // input createEmptyLimitOrderData() // limit); ### Custom ApproxParams for Advanced Use[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#custom-approxparams-for-advanced-use "Direct link to Custom ApproxParams for Advanced Use") // Create custom approximation parameters for high precisionApproxParams memory customApprox = ApproxParams({ guessMin: 0, guessMax: type(uint256).max, guessOffchain: estimatedOutput, // Use off-chain calculation if available maxIteration: 512, // Higher precision eps: 1e15 // Looser tolerance (0.1%)}); Best Practices[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#best-practices "Direct link to Best Practices") ------------------------------------------------------------------------------------------------------------------------------------------------------------- **For Standard Operations:** * Always use `createDefaultApproxParams()` unless you have specific precision requirements * Use `createEmptyLimitOrderData()` for simple market operations * Ensure token addresses are supported by target SY contracts **For Performance:** * Off-chain approximation (`guessOffchain`) can reduce gas costs significantly * Higher `maxIteration` values increase precision but cost more gas * Tighter `eps` values improve precision but may increase iterations * [Core Parameter Types](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#core-parameter-types) * [TokenInput](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokeninput) * [Usage Patterns](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#usage-patterns) * [TokenOutput](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#tokenoutput) * [Usage Patterns](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#usage-patterns-1) * [ApproxParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) * [LimitOrderData](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#limitorderdata) * [RedeemYtIncomeToTokenStruct](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#redeemytincometotokenstruct) * [SwapData](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#swapdata) * [SwapType](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#swaptype) * [ExitPreExpReturnParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpreexpreturnparams) * [ExitPostExpReturnParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#exitpostexpreturnparams) * [Utility Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#utility-functions) * [createTokenInputSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createtokeninputsimple) * [createTokenOutputSimple](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createtokenoutputsimple) * [createDefaultApproxParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createdefaultapproxparams) * [createEmptyLimitOrderData](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#createemptylimitorderdata) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#integration-examples) * [Basic Parameter Creation](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#basic-parameter-creation) * [Complete Function Call Example](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#complete-function-call-example) * [Custom ApproxParams for Advanced Use](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#custom-approxparams-for-advanced-use) * [Best Practices](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#best-practices) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Mint & Redeem Simulation Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#__docusaurus_skipToContent_fallback) On this page These functions come from the `IPActionMintRedeemStatic` facet. They simulate every mint and redeem operation supported by the live Router, plus two view helpers for reading the current PY index. * * * SY Mint / Redeem[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#sy-mint--redeem "Direct link to SY Mint / Redeem") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### mintSyFromTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mintsyfromtokenstatic "Direct link to mintSyFromTokenStatic") Simulates minting SY from an input token. function mintSyFromTokenStatic(address SY, address tokenIn, uint256 netTokenIn) external view returns (uint256 netSyOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | SY | `address` | SY contract address | | tokenIn | `address` | Input token address | | netTokenIn | `uint256` | Exact token amount to mint with | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY received | * * * ### getAmountTokenToMintSy[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#getamounttokentomintsy "Direct link to getAmountTokenToMintSy") Inverse of `mintSyFromTokenStatic` — returns how many tokens are required to mint a target amount of SY. function getAmountTokenToMintSy(address SY, address tokenIn, uint256 netSyOut) external view returns (uint256 netTokenIn) **Parameters** | Name | Type | Description | | --- | --- | --- | | SY | `address` | SY contract address | | tokenIn | `address` | Input token address | | netSyOut | `uint256` | Target SY amount to receive | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenIn | `uint256` | Token amount required to mint `netSyOut` SY | **Use Case** Useful for constructing "exact SY out" flows — e.g. when you need a precise SY amount before adding dual-sided liquidity. * * * ### redeemSyToTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeemsytotokenstatic "Direct link to redeemSyToTokenStatic") Simulates redeeming SY for an output token. function redeemSyToTokenStatic(address SY, address tokenOut, uint256 netSyIn) external view returns (uint256 netTokenOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | SY | `address` | SY contract address | | tokenOut | `address` | Desired output token address | | netSyIn | `uint256` | SY amount to redeem | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Token received | * * * PY Mint / Redeem[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#py-mint--redeem "Direct link to PY Mint / Redeem") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### mintPyFromSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mintpyfromsystatic "Direct link to mintPyFromSyStatic") Simulates minting PT and YT from SY. function mintPyFromSyStatic(address YT, uint256 netSyToMint) external view returns (uint256 netPYOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | YT | `address` | YT contract address | | netSyToMint | `uint256` | SY amount to mint from | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPYOut | `uint256` | PT and YT received (equal amounts of each) | * * * ### mintPyFromTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mintpyfromtokenstatic "Direct link to mintPyFromTokenStatic") Simulates minting PT and YT directly from an input token (token → SY → PT+YT). function mintPyFromTokenStatic(address YT, address tokenIn, uint256 netTokenIn) external view returns (uint256 netPyOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | YT | `address` | YT contract address | | tokenIn | `address` | Input token address | | netTokenIn | `uint256` | Token amount to mint from | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPyOut | `uint256` | PT and YT received | * * * ### redeemPyToSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeempytosystatic "Direct link to redeemPyToSyStatic") Simulates redeeming PT and YT back to SY. Equal amounts of PT and YT must be provided. function redeemPyToSyStatic(address YT, uint256 netPYToRedeem) external view returns (uint256 netSyOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | YT | `address` | YT contract address | | netPYToRedeem | `uint256` | Amount of PT (and YT) to redeem | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY received | * * * ### redeemPyToTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeempytotokenstatic "Direct link to redeemPyToTokenStatic") Simulates redeeming PT and YT directly to an output token (PT+YT → SY → token). function redeemPyToTokenStatic(address YT, uint256 netPYToRedeem, address tokenOut) external view returns (uint256 netTokenOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | YT | `address` | YT contract address | | netPYToRedeem | `uint256` | Amount of PT (and YT) to redeem | | tokenOut | `address` | Desired output token address | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Token received | * * * PY Index Views[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#py-index-views "Direct link to PY Index Views") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The PY index is the exchange rate between SY and PT/YT. It is used internally to price minting and redemption. These helpers let you read it without triggering a state-write (unlike the real `pyIndexCurrent` which may update the index on-chain). ### pyIndexCurrentViewMarket[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#pyindexcurrentviewmarket "Direct link to pyIndexCurrentViewMarket") Returns the current PY index for a market without writing state. function pyIndexCurrentViewMarket(address market) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | **Return Values** | Type | Description | | --- | --- | | `uint256` | Current PY index (18 decimals) | * * * ### pyIndexCurrentViewYt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#pyindexcurrentviewyt "Direct link to pyIndexCurrentViewYt") Returns the current PY index for a given YT without writing state. function pyIndexCurrentViewYt(address yt) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | yt | `address` | YT contract address | **Return Values** | Type | Description | | --- | --- | | `uint256` | Current PY index (18 decimals) | **Use Case** Use either index view to manually calculate the SY ↔ PT/YT conversion rate. For example, `netSyOut = netPYToRedeem * pyIndex / 1e18`. * * * Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#examples "Direct link to Examples") --------------------------------------------------------------------------------------------------------------------------------------------------------- Recommended: Use the Pendle API The examples below show direct RouterStatic usage. For most integrations, the [Pendle Hosted SDK / API](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) is the better choice — it handles approximation, limit-order filling, and zap routing automatically. ### Mint PT & YT from token — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mint-pt--yt-from-token--simulate-then-execute "Direct link to Mint PT & YT from token — simulate then execute") const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");// 1. Simulateconst netPyOut = await routerStatic.mintPyFromTokenStatic(YT_ADDRESS, tokenIn, amountIn);console.log(`Expected PT+YT out: ${ethers.formatEther(netPyOut)} each`);// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.mintPyFromToken( signer.address, YT_ADDRESS, (netPyOut * 995n) / 1000n, // minPyOut (0.5% slippage) createTokenInputStruct(tokenIn, amountIn)); ### Redeem PT & YT to token — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeem-pt--yt-to-token--simulate-then-execute "Direct link to Redeem PT & YT to token — simulate then execute") const tokenOut = WSTETH_ADDRESS;const pyAmount = ethers.parseEther("1");// 1. Simulateconst netTokenOut = await routerStatic.redeemPyToTokenStatic(YT_ADDRESS, pyAmount, tokenOut);console.log(`Expected token out: ${ethers.formatEther(netTokenOut)}`);// 2. Execute (both PT and YT must be approved in equal amounts)await IERC20(PT_ADDRESS).approve(ROUTER_ADDRESS, pyAmount);await IERC20(YT_ADDRESS).approve(ROUTER_ADDRESS, pyAmount);await router.redeemPyToToken( signer.address, YT_ADDRESS, pyAmount, createTokenOutputStruct(tokenOut, (netTokenOut * 995n) / 1000n)); ### Determine how much token to spend for a target SY amount[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#determine-how-much-token-to-spend-for-a-target-sy-amount "Direct link to Determine how much token to spend for a target SY amount") Use `getAmountTokenToMintSy` when you have a downstream requirement for a fixed SY quantity (e.g. dual-asset liquidity add). const targetSyOut = ethers.parseEther("1.5");// 1. How many tokens do I need?const netTokenIn = await routerStatic.getAmountTokenToMintSy(SY_ADDRESS, WSTETH_ADDRESS, targetSyOut);console.log(`Need ${ethers.formatEther(netTokenIn)} wstETH to mint ${ethers.formatEther(targetSyOut)} SY`);// Sanity-check by simulating the forward directionconst syOutCheck = await routerStatic.mintSyFromTokenStatic(SY_ADDRESS, WSTETH_ADDRESS, netTokenIn);console.log(`Forward check: ${ethers.formatEther(syOutCheck)} SY`); // should ≈ targetSyOut// 2. Executeawait IERC20(WSTETH_ADDRESS).approve(ROUTER_ADDRESS, netTokenIn);await router.mintSyFromToken( signer.address, SY_ADDRESS, (targetSyOut * 995n) / 1000n, // minSyOut createTokenInputStruct(WSTETH_ADDRESS, netTokenIn)); ### Use pyIndex to value a PT/YT position[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#use-pyindex-to-value-a-ptyt-position "Direct link to Use pyIndex to value a PT/YT position") // Read current PY index (no state write)const pyIndex = await routerStatic.pyIndexCurrentViewMarket(MARKET_ADDRESS);// pyIndex is an 18-decimal exchange rate: 1 SY = pyIndex PY units// Value 100 PT in SY termsconst ptBalance = ethers.parseEther("100");const syValue = (ptBalance * ethers.parseEther("1")) / pyIndex;console.log(`100 PT ≈ ${ethers.formatEther(syValue)} SY at current index`); * [SY Mint / Redeem](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#sy-mint--redeem) * [mintSyFromTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mintsyfromtokenstatic) * [getAmountTokenToMintSy](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#getamounttokentomintsy) * [redeemSyToTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeemsytotokenstatic) * [PY Mint / Redeem](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#py-mint--redeem) * [mintPyFromSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mintpyfromsystatic) * [mintPyFromTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mintpyfromtokenstatic) * [redeemPyToSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeempytosystatic) * [redeemPyToTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeempytotokenstatic) * [PY Index Views](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#py-index-views) * [pyIndexCurrentViewMarket](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#pyindexcurrentviewmarket) * [pyIndexCurrentViewYt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#pyindexcurrentviewyt) * [Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#examples) * [Mint PT & YT from token — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#mint-pt--yt-from-token--simulate-then-execute) * [Redeem PT & YT to token — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#redeem-pt--yt-to-token--simulate-then-execute) * [Determine how much token to spend for a target SY amount](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#determine-how-much-token-to-spend-for-a-target-sy-amount) * [Use pyIndex to value a PT/YT position](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/MintRedeemFunctions#use-pyindex-to-value-a-ptyt-position) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # GaugeController | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#__docusaurus_skipToContent_fallback) On this page **Contract:** [`PendleGaugeControllerUpg`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/LiquidityMining/GaugeController/PendleGaugeControllerUpg.sol) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#overview "Direct link to Overview") ------------------------------------------------------------------------------------------------------------------------------------------- `PendleGaugeControllerUpg` is the central contract that allocates **PENDLE token incentives** to whitelisted Pendle markets. It holds a balance of PENDLE and streams it to each market at a configured emission rate. Pendle's off-chain algorithm (see [Incentives](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives) ) determines how much PENDLE each market should receive per week, and the protocol owner periodically pushes updated rates on-chain via `setRewardDatas`. On every reward interaction in a market, the market contract calls `redeemMarketReward()` to pull its accumulated PENDLE from the controller. GaugeController handles **PENDLE incentives only**. SY-native external rewards (e.g., AAVE tokens from an Aave SY, or Morpho rewards) flow through a completely separate path — see [Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards) for the full picture. When to Use This[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#when-to-use-this "Direct link to When to Use This") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- * **Displaying APR / incentive rates** — read `rewardData(market)` to get the current `pendlePerSec` emission rate and compute APR * **Building dashboards** — query `rewardData` for multiple markets to show incentive schedules and remaining durations * **Verifying market eligibility** — call `isWhitelisted(market)` to check if a market receives PENDLE incentives note To claim PENDLE incentives as an LP holder, call `redeemRewards(user)` on the [PendleMarket](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/PendleMarket) contract. Core Concepts[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#core-concepts "Direct link to Core Concepts") ---------------------------------------------------------------------------------------------------------------------------------------------------------- ### MarketRewardData[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#marketrewarddata "Direct link to MarketRewardData") The controller stores per-market state in the following struct: struct MarketRewardData { uint128 pendlePerSec; // PENDLE emission rate (tokens/second, 18 decimals) uint128 accumulatedPendle; // accumulated but not yet transferred PENDLE uint128 lastUpdated; // timestamp when accumulation was last settled uint128 incentiveEndsAt; // timestamp when incentives for this market stop} | Field | Description | | --- | --- | | `pendlePerSec` | The current emission rate in PENDLE tokens per second (18 decimals). Capped at `0.0333e18` (~20,000 PENDLE/week). | | `accumulatedPendle` | PENDLE that has accrued since the last time the market called `redeemMarketReward()`. Transferred out when the market redeems. | | `lastUpdated` | The last timestamp at which accumulation was settled (either by a rate update or a market redeem). | | `incentiveEndsAt` | The timestamp at which PENDLE emission for this market ceases. Must be ≤ the market's expiry. | ### Accumulation Formula[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#accumulation-formula "Direct link to Accumulation Formula") PENDLE accrues linearly over time, stopping at `incentiveEndsAt`: pendingPendle = pendlePerSec × (min(now, incentiveEndsAt) − lastUpdated)totalClaimable = accumulatedPendle + pendingPendle Once `block.timestamp >= incentiveEndsAt`, accumulation stops and no further PENDLE accrues to the market. Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#functions "Direct link to Functions") ---------------------------------------------------------------------------------------------------------------------------------------------- ### `rewardData`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#rewarddata "Direct link to rewarddata") Returns the raw on-chain reward state for a given market. function rewardData(address market) external view returns (uint128 pendlePerSec, uint128 accumulatedPendle, uint128 lastUpdated, uint128 incentiveEndsAt); | Parameter | Type | Description | | --- | --- | --- | | `market` | `address` | PendleMarket contract address | | Return Value | Type | Description | | --- | --- | --- | | `pendlePerSec` | `uint128` | Current emission rate (18 decimals) | | `accumulatedPendle` | `uint128` | Settled but unclaimed PENDLE | | `lastUpdated` | `uint128` | Timestamp of last settlement | | `incentiveEndsAt` | `uint128` | Timestamp when emissions stop | note `accumulatedPendle` reflects the settled balance as of the last update. Add the pending accumulation (formula above) to get the full current claimable amount. ### `isWhitelisted`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#iswhitelisted "Direct link to iswhitelisted") Returns whether a market is eligible to receive PENDLE incentives. function isWhitelisted(address market) external view returns (bool); | Parameter | Type | Description | | --- | --- | --- | | `market` | `address` | PendleMarket contract address | Markets must be whitelisted before `setRewardDatas` can configure emissions for them. ### `redeemMarketReward`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#redeemmarketreward "Direct link to redeemmarketreward") Transfers all accumulated PENDLE to the calling market and resets `accumulatedPendle` to zero. function redeemMarketReward() external; This function is called internally by the market contract (`PendleGauge._redeemExternalReward`) on every reward interaction. **Users and integrators do not need to call this directly** — it is automatically triggered when users call `redeemRewards` on a market. Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#integration-examples "Direct link to Integration Examples") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Example code only The snippets below are simplified for illustration and **are not audited**. **Do not** use them in production or with real funds. If you adapt any example, conduct a full review, add comprehensive tests, and obtain an independent **security audit**. ### Computing pending PENDLE off-chain[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#computing-pending-pendle-off-chain "Direct link to Computing pending PENDLE off-chain") import { ethers } from "ethers";async function getPendingPendle( gaugeController: ethers.Contract, market: string): Promise { const { pendlePerSec, accumulatedPendle, lastUpdated, incentiveEndsAt } = await gaugeController.rewardData(market); const now = BigInt(Math.floor(Date.now() / 1000)); const effectiveNow = now < incentiveEndsAt ? now : incentiveEndsAt; const elapsed = effectiveNow > lastUpdated ? effectiveNow - lastUpdated : 0n; const pendingPendle = pendlePerSec * elapsed; return accumulatedPendle + pendingPendle;} ### Computing PENDLE APR for a market[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#computing-pendle-apr-for-a-market "Direct link to Computing PENDLE APR for a market") import { ethers } from "ethers";async function getPendleApr( gaugeController: ethers.Contract, market: ethers.Contract, pendlePriceUsd: number, lpTotalSupply: bigint, lpPriceUsd: number): Promise { const { pendlePerSec, incentiveEndsAt } = await gaugeController.rewardData(market.target); const now = BigInt(Math.floor(Date.now() / 1000)); if (now >= incentiveEndsAt || pendlePerSec === 0n) return 0; const SECONDS_PER_YEAR = 365.25 * 24 * 3600; // Annual PENDLE emission for this market const pendlePerYear = Number(pendlePerSec) / 1e18 * SECONDS_PER_YEAR; const emissionValueUsd = pendlePerYear * pendlePriceUsd; // Total LP value staked const totalLpValueUsd = Number(lpTotalSupply) / 1e18 * lpPriceUsd; return emissionValueUsd / totalLpValueUsd; // e.g. 0.12 = 12% APR} Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#further-reading "Direct link to Further Reading") ---------------------------------------------------------------------------------------------------------------------------------------------------------------- * [Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards) — full reward accounting model covering SY-native, PENDLE, and off-chain rewards * [MerkleDistributor](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor) — off-chain reward distribution (voter incentives, partner points) * [PendleMarket](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/PendleMarket) — market contract that calls `redeemMarketReward()` internally * [Incentives](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/Mechanisms/Incentives) — how PENDLE incentive allocations are determined * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#overview) * [When to Use This](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#when-to-use-this) * [Core Concepts](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#core-concepts) * [MarketRewardData](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#marketrewarddata) * [Accumulation Formula](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#accumulation-formula) * [Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#functions) * [`rewardData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#rewarddata) * [`isWhitelisted`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#iswhitelisted) * [`redeemMarketReward`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#redeemmarketreward) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#integration-examples) * [Computing pending PENDLE off-chain](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#computing-pending-pendle-off-chain) * [Computing PENDLE APR for a market](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#computing-pendle-apr-for-a-market) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Spark Linear Discount Oracle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#overview "Direct link to Overview") --------------------------------------------------------------------------------------------------------------------------------------------------- **PendleSparkLinearDiscountOracle** is a simple, deterministic feed that returns a **discount factor** for a given PT. The factor increases linearly as time passes and converges to 1.0 at maturity, so integrators can price PT conservatively without relying on external market data. The contract exposes familiar read functions (`latestRoundData`, `decimals`) so money markets can plug it in like a Chainlink-compatible feed. The returned value is a **multiplier in 18 decimals**, not a USD price. Please see the [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) documentation for guidance on selecting appropriate linear discount parameters. How to price PT[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#how-to-price-pt "Direct link to How to price PT") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ The oracle provides the PT price denominated in the **accounting asset staked in the underlying protocol** (indicated in brackets within the PT name). To convert this value to USD, you need to account for the SY-to-accounting-asset exchange rate using the PY Index. ### Formula[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#formula "Direct link to Formula") Price of PT (USD) = (Oracle discount factor) / (PYIndex) × (Yield Token USD Price) The yield token price can be sourced from market data or derived from exchange rate to accounting asset - the choice depends on your requirements. #### Where to get the PYIndex[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#where-to-get-the-pyindex "Direct link to Where to get the PYIndex") The PYIndex can be retrieved from the YT (Yield Token) contract: * **`pyIndexCurrent()`**: Returns the most up-to-date PY index. This is a state-changing function. * **`pyIndexStored()`**: Returns the cached PY index without updating. This is a view function. See the [Yield Tokenization documentation](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldTokenization) for more details on PY index behavior. ### Simplified Formula[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#simplified-formula "Direct link to Simplified Formula") If your use case does not require accounting for yield token depeg risks, you can ignore the PYIndex and use this simplified version: Price of PT (USD) = (Oracle discount factor) × (Accounting Asset USD Price) ### Pricing Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#pricing-examples "Direct link to Pricing Examples") * **`PT-kHYPE (HYPE)`**: The oracle returns the price in HYPE staked in Kinetiq. To convert to USD: PT-kHYPE USD price = (Oracle discount factor) / (kHYPE PYIndex) × (kHYPE USD price) Assuming kHYPE can always be redeemed fully for HYPE (no exchange rate depeg), you can use the simplified formula: PT-kHYPE USD price = (Oracle discount factor) × (HYPE USD price) * **`PT-sUSDe (USDe)`**: The oracle returns the price in USDe staked in the sUSDe contract. To convert to USD: PT-sUSDe USD price = (Oracle discount factor) / (sUSDe PYIndex) × (sUSDe USD price) Assuming sUSDe can always be redeemed fully for USDe (no exchange rate depeg), you can use the simplified formula: PT-sUSDe USD price = (Oracle discount factor) × (USDe USD price) * **`PT-USDe (USDe)`**: The oracle returns the price directly in USDe. Since the PYIndex is always 1, we can simplify the formula to: PT-USDe USD price = (Oracle discount factor) × (USDe USD price) Use cases[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#use-cases "Direct link to Use cases") ------------------------------------------------------------------------------------------------------------------------------------------------------ For money markets listing PTs as collateral or borrowable assets, the oracle provides a stable, predictable valuation path. Integrators can use the discount factor to calculate conservative PT valuations without relying on AMM prices. Because the factor converges linearly to 1.0 at expiry, LTVs and liquidation thresholds behave smoothly instead of whipsawing with AMM volatility. Usage[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#usage "Direct link to Usage") ------------------------------------------------------------------------------------------------------------------------------------------ ### Deployment[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#deployment "Direct link to Deployment") The oracle can be deployed using the `sparkLinearDiscountOracleFactory`. The address of the factory can be found in the [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) , under the `"sparkLinearDiscountOracleFactory"` field. The factory has two methods to help with oracle deployment: function createWithPt(address pt, uint256 baseDiscountPerYear) external returns (address);function createWithMarket(address market, uint256 baseDiscountPerYear) external returns (address); The second method will automatically derive the PT address from the market, which is useful for Pendle markets where the PT is derived from the underlying asset. ### Feed retrieval[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#feed-retrieval "Direct link to Feed retrieval") function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) Since the oracle is deterministic, all fields except `answer` are returned as `0`. #### Feed properties[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#feed-properties "Direct link to Feed properties") * **Decimals**: The oracle returns values in 18 decimals. Integrators should multiply this discount factor by the PT's redemption value (in 18 decimals) to calculate the PT's current value. * **Deterministic**: The oracle is deterministic, meaning the same inputs will always yield the same output. This allows for predictable valuation paths. * **Linear Discount**: The discount factor increases linearly over time, converging to 1.0 at maturity. This means the factor is always between 0 and 1, and it never goes negative. * **No External Calls**: The oracle does not make any external calls during reads, ensuring minimal liveness or manipulation surface. It relies solely on `block.timestamp` for time calculations. * **Clamping**: The oracle clamps the discount factor to never exceed 100% (1e18), ensuring it remains a valid multiplier. Here is a graphic showing how different `baseDiscountPerYear` values affect the discount factor over time, with the x-axis representing time left until maturity in years and the y-axis showing the discount factor (1.0 = 100%): How `answer` is deterministically calculated The `answer` relies on two parameters: * `baseDiscountPerYear` - the annual discount slope, expressed in wad (1e18 = 100%/year). * `maturity` - the PT maturity timestamp in seconds (`PT.expiry()`). The `answer` at a given time `t` (in seconds) is calculated as follows: answer\=min⁡(1018,1018−(maturity−t)⋅baseDiscountPerYear365⋅24⋅60⋅60)\\text{answer} = \\min\\left( 10^{18}, 10^{18} - \\frac{(\\text{maturity} - t) \\cdot \\text{baseDiscountPerYear}}{365 \\cdot 24 \\cdot 60 \\cdot 60} \\right)answer\=min(1018,1018−365⋅24⋅60⋅60(maturity−t)⋅baseDiscountPerYear​) * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#overview) * [How to price PT](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#how-to-price-pt) * [Formula](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#formula) * [Simplified Formula](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#simplified-formula) * [Pricing Examples](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#pricing-examples) * [Use cases](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#use-cases) * [Usage](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#usage) * [Deployment](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#deployment) * [Feed retrieval](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle#feed-retrieval) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Decimals Wrapper | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#overview "Direct link to Overview") --------------------------------------------------------------------------------------------------------------------------------------------- `PendleDecimalsWrapper` is a thin ERC-20 wrapper that re-expresses any token with fewer than 18 decimals as a new token with exactly 18 decimals. No interest accrues, there is no rebasing, and no fees are taken — it is a purely mechanical decimal normalisation layer. Within the Pendle system, this is the foundation of the **Scaled18 SY pattern**: an SY contract accepts a low-decimal raw token (e.g., LBTC with 8 decimals or USDC with 6 decimals), wraps it through `PendleDecimalsWrapper`, and exposes the 18-decimal representation to PY contracts and the market. The `PendleDecimalsWrapperFactory` creates and caches these wrappers so that only one wrapper ever exists per `(rawToken, targetDecimals)` pair. **Sources:** * [`PendleDecimalsWrapper.sol`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/misc/PendleDecimalsWrapper.sol) * [`PendleDecimalsWrapperFactory.sol`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/misc/PendleDecimalsWrapperFactory.sol) * **Interface**: [`IPDecimalsWrapper.sol`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/interfaces/IPDecimalsWrapper.sol) * **Interface**: [`IPDecimalsWrapperFactory.sol`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/interfaces/IPDecimalsWrapperFactory.sol) * * * `PendleDecimalsWrapper`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#pendledecimalswrapper "Direct link to pendledecimalswrapper") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- A standard ERC-20 token (inherits `PendleERC20`) with `decimals() = 18`. Wrapping and unwrapping is a simple multiply/divide by `10^(18 - rawDecimals)`. The constructor enforces `rawDecimals <= 18`. The contract is always deployed by the factory — do not deploy it directly. ### Public State[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#public-state "Direct link to Public State") | Variable | Type | Description | | --- | --- | --- | | `factory` | `address` | The `PendleDecimalsWrapperFactory` that deployed this contract | | `rawToken` | `address` | The original token being wrapped | | `rawDecimals` | `uint8` | Decimals of `rawToken` | ### `wrap`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#wrap "Direct link to wrap") function wrap(uint256 amount) external returns (uint256 amountOut); Transfers `amount` of `rawToken` from `msg.sender` into the wrapper, then mints `rawToWrapped(amount)` of the wrapped token to `msg.sender`. **Important:** `amount` is in raw units (i.e., `rawToken` decimals). The returned `amountOut` is in wrapped units (18 decimals). There is no rounding loss in the wrap direction. ### `unwrap`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#unwrap "Direct link to unwrap") function unwrap(uint256 amount) external returns (uint256 amountOut); Burns `amount` of the wrapped token from `msg.sender`, then transfers `wrappedToRaw(amount)` of `rawToken` back. **Important:** `amount` is in wrapped units (18 decimals). `wrappedToRaw` performs integer division — the caller may receive slightly fewer raw units than the proportional share (the remainder stays in the contract as recoverable dust). See [`sweep`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#sweep) . ### `rawToWrapped`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#rawtowrapped "Direct link to rawtowrapped") function rawToWrapped(uint256 amount) public view returns (uint256); wrappedAmount = amount × 10^(18 - rawDecimals) Converts a raw-unit quantity to its 18-decimal representation. No rounding; exact for any `amount`. ### `wrappedToRaw`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#wrappedtoraw "Direct link to wrappedtoraw") function wrappedToRaw(uint256 amount) public view returns (uint256); rawAmount = amount / 10^(18 - rawDecimals) (integer division — truncates) Converts a wrapped-unit quantity back to raw units. Because of integer truncation, `wrappedToRaw(rawToWrapped(x))` always equals `x`, but `rawToWrapped(wrappedToRaw(y))` may be slightly less than `y` if `y` is not a multiple of the scale factor. The shortfall remains in the contract as dust. * * * `PendleDecimalsWrapperFactory`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#pendledecimalswrapperfactory "Direct link to pendledecimalswrapperfactory") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Idempotent factory that ensures only one wrapper exists per `(rawToken, targetDecimals)` pair. The factory is the sole deployer of `PendleDecimalsWrapper` instances. Current limitation `getOrCreate` currently only supports `_decimals = 18`. Passing any other target decimals will revert. The API accepts `_decimals` as a parameter for forward-compatibility, but the implementation asserts `_decimals == 18` internally. ### Constructor[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#constructor "Direct link to Constructor") constructor(address _dustReceiver); Sets the immutable `dustReceiver` address that receives dust from all wrappers created by this factory. ### `getOrCreate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#getorcreate "Direct link to getorcreate") function getOrCreate( address _rawToken, uint8 _decimals) external returns (address decimalWrapper); Returns the wrapper address for `(_rawToken, _decimals)`. If no wrapper exists yet, deploys a new `PendleDecimalsWrapper` and registers it. Subsequent calls with the same arguments return the already-deployed address without re-deploying. **Reverts:** implicitly via `assert` if `_decimals != 18` (see note above). Emits `DecimalWrapperCreated(rawToken, decimals, decimalWrapper)` on first deployment only. ### `decimalWrappers`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#decimalwrappers "Direct link to decimalwrappers") mapping(address => mapping(uint8 => address)) public decimalWrappers; Registry mapping `rawToken → targetDecimals → wrapper address`. Returns `address(0)` if no wrapper has been created for that pair. ### `dustReceiver`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#dustreceiver "Direct link to dustreceiver") address public immutable dustReceiver; The address that receives dust when any wrapper's `sweep()` is called. ### Events[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#events "Direct link to Events") | Event | Parameters | Description | | --- | --- | --- | | `DecimalWrapperCreated` | `rawToken, decimals, decimalsWrapper` | Emitted when a new wrapper is deployed | * * * Token Naming Convention[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#token-naming-convention "Direct link to Token Naming Convention") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Wrapper tokens are named automatically by the factory: | Property | Value | | --- | --- | | `name` | `"{rawToken.name} scaled18"` | | `symbol` | `"{rawToken.symbol}-scaled18"` | | `decimals` | `18` (always) | For example, wrapping LBTC (8 decimals) produces a token named `"Lombard Staked Bitcoin scaled18"` with symbol `"LBTC-scaled18"`. * * * How Scaled18 SY Contracts Use the Wrapper[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#how-scaled18-sy-contracts-use-the-wrapper "Direct link to How Scaled18 SY Contracts Use the Wrapper") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ For concrete implementations, refer to some of our examples: * [`PendleLBTCBaseSYScaled18.sol`](https://github.com/pendle-finance/Pendle-SY-Public/blob/main/contracts/core/StandardizedYield/implementations/Lombard/PendleLBTCBaseSYScaled18.sol) — yield-bearing example with oracle-based `exchangeRate()` * [`PendleUniBTCBeraSYUpgScaled18.sol`](https://github.com/pendle-finance/Pendle-SY-Public/blob/main/contracts/core/StandardizedYield/implementations/BedRock/PendleUniBTCBeraSYUpgScaled18.sol) — simple 1:1 example using `ScaledTokenMath` * * * Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#further-reading "Direct link to Further Reading") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ * [Common SY Contracts](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY) — the Scaled18 SY types that rely on this wrapper * [StandardizedYield](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield) — `pricingInfo()` Scaled18 example (`PendleLBTCBaseSYScaled18`) * [Unit and Decimals](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals) — full explanation of Scaled18 SY decimals and conversion rates * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#overview) * [`PendleDecimalsWrapper`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#pendledecimalswrapper) * [Public State](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#public-state) * [`wrap`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#wrap) * [`unwrap`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#unwrap) * [`rawToWrapped`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#rawtowrapped) * [`wrappedToRaw`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#wrappedtoraw) * [`PendleDecimalsWrapperFactory`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#pendledecimalswrapperfactory) * [Constructor](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#constructor) * [`getOrCreate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#getorcreate) * [`decimalWrappers`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#decimalwrappers) * [`dustReceiver`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#dustreceiver) * [Events](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#events) * [Token Naming Convention](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#token-naming-convention) * [How Scaled18 SY Contracts Use the Wrapper](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#how-scaled18-sy-contracts-use-the-wrapper) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Chainlink-Compatible Oracle Wrappers | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#overview "Direct link to Overview") ---------------------------------------------------------------------------------------------------------------------------------- Pendle provides a set of Chainlink-compatible oracle contracts that wrap `PendlePYLpOracle` rate functions behind the standard `AggregatorV3Interface`. This allows money markets, lending protocols, and any system that already consumes Chainlink feeds to price Pendle PT and LP tokens without any custom integration. **Contracts covered here:** * **`PendleChainlinkOracle`** — Immutable per-market wrapper; returns PT or LP price in SY or asset * **`PendleChainlinkOracleWithQuote`** — Extends the base wrapper; multiplies the Pendle rate by an external quote feed * **`PendleChainlinkOracleFactory`** — Permissionless factory; deploys and registers both oracle variants **Sources:** * [`PendleChainlinkOracle.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracle.sol) * [`PendleChainlinkOracleWithQuote.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleWithQuote.sol) * [`PendleChainlinkOracleFactory.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/PtYtLpOracle/chainlink/PendleChainlinkOracleFactory.sol) > **Prerequisite:** The underlying `PendlePYLpOracle` TWAP must be initialized before any Chainlink oracle can be deployed for a market. See [PendlePYLpOracle — Oracle Initialization](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#prerequisites-oracle-initialization) > . * * * `PendleOracleType` Enum[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendleoracletype-enum "Direct link to pendleoracletype-enum") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- All oracle types are selected at deployment time and fixed immutably: enum PendleOracleType { PT_TO_SY, // 1 PT expressed in SY units PT_TO_ASSET, // 1 PT expressed in underlying asset units LP_TO_SY, // 1 LP expressed in SY units LP_TO_ASSET // 1 LP expressed in underlying asset units} YT pricing is **not available** through the Chainlink wrapper. Use [`PendlePYLpOracle`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle) directly for `getYtToSyRate` / `getYtToAssetRate`. For guidance on choosing `ToSy` vs `ToAsset`, see [PendlePYLpOracle — SY Solvency Adjustment](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#oracle-architecture) . * * * `PendleChainlinkOracle`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendlechainlinkoracle "Direct link to pendlechainlinkoracle") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Wraps one of the four `PendleOracleType` rate functions and exposes it via `AggregatorV3Interface`. Every parameter (market, TWAP duration, oracle type) is set in the constructor and cannot be changed. **Constructor** (called by the factory — not deployed directly): constructor( address _market, // PendleMarket address uint32 _twapDuration, // TWAP window in seconds PendleOracleType _baseOracleType // PT_TO_SY | PT_TO_ASSET | LP_TO_SY | LP_TO_ASSET) ### Immutable Public Variables[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#immutable-public-variables "Direct link to Immutable Public Variables") | Variable | Type | Description | | --- | --- | --- | | `factory` | `address` | Factory that deployed this oracle | | `market` | `address` | `PendleMarket` this oracle prices | | `twapDuration` | `uint32` | TWAP window in seconds | | `baseOracleType` | `PendleOracleType` | The rate type returned | ### `latestRoundData`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#latestrounddata "Direct link to latestrounddata") function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); | Field | Value | | --- | --- | | `roundId` | Always `0` | | `answer` | Price in 18 decimals (see semantics below) | | `startedAt` | Always `0` | | `updatedAt` | Always `block.timestamp` | | `answeredInRound` | Always `0` | **`answer` semantics:** > 1 natural unit of the Pendle token = `answer / 1e18` natural units of the output token. In other words, `10^(PendleToken.decimals) raw units` of the input token is worth `(answer / 1e18) × 10^(outputToken.decimals) raw units` of the output token. See [Unit and Decimals](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals) for full decimal and scaling conventions. **Examples:** * `baseOracleType = PT_TO_SY`, `answer = 0.95e18` → 1 PT = 0.95 SY (in human/natural units) * `baseOracleType = LP_TO_ASSET`, `answer = 1.12e18` → 1 LP = 1.12 units of the underlying asset The contract internally rescales from the raw 1e18-scaled `PendlePYLpOracle` output to account for any token decimal differences between input and output. ### `getRoundData`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#getrounddata "Direct link to getrounddata") function getRoundData(uint80 roundId) external view returns (uint80, int256, uint256, uint256, uint80); Only accepts `roundId = 0`. Reverts with `InvalidRoundId()` for any other value. Returns the same data as `latestRoundData`. ### `decimals`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#decimals "Direct link to decimals") function decimals() external pure returns (uint8); Always returns `18`. ### `description`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#description "Direct link to description") function description() external pure returns (string memory); Returns `"Pendle Chainlink-compatible Oracle"`. * * * `PendleChainlinkOracleWithQuote`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendlechainlinkoraclewithquote "Direct link to pendlechainlinkoraclewithquote") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Extends `PendleChainlinkOracle` by multiplying the Pendle rate against an external Chainlink price feed, denominating the output in an arbitrary quote token (e.g., USD via ETH/USD, BTC/USD). **Use case:** A lending protocol that wants to price `PT-weETH` in USD can deploy `PendleChainlinkOracleWithQuote` with: * `baseOracleType = PT_TO_SY` (prices PT in weETH, the SY) * `quoteOracle = weETH/USD Chainlink feed` The resulting `answer` gives the USD value of 1 PT, updated whenever the quote oracle updates. **Constructor** (called by the factory): constructor( address _market, uint32 _twapDuration, PendleOracleType _baseOracleType, address _quoteOracle // must implement AggregatorV3Interface) ### Additional Immutable Variables[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#additional-immutable-variables "Direct link to Additional Immutable Variables") | Variable | Type | Description | | --- | --- | --- | | `quoteOracle` | `address` | External Chainlink feed used for the quote | | `quoteScale` | `int256` | `10^quoteOracle.decimals()`, cached at construction | ### `latestRoundData`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#latestrounddata-1 "Direct link to latestrounddata-1") function latestRoundData() external view returns ( uint80 roundId, // 0 int256 answer, // pendleRate × quoteAnswer / quoteScale uint256 startedAt, // 0 uint256 updatedAt, // quoteOracle.updatedAt (NOT block.timestamp) uint80 answeredInRound // 0 ); **Key differences from the base `PendleChainlinkOracle`:** 1. **`updatedAt` reflects the quote feed's last update timestamp**, not `block.timestamp`. If the quote oracle is stale, `updatedAt` will be old — your protocol's staleness check will catch this correctly. 2. **`answer` is the product**: `pendleRate × quoteAnswer / 10^quoteOracle.decimals()`. Both inputs are in 18 decimals on the Pendle side; the formula rescales correctly regardless of the quote feed's decimals. Check quote feed staleness Always validate `updatedAt` against a maximum staleness threshold before consuming the answer. Pendle's TWAP rate is always fresh (recomputed on each call), but the quote feed is an external dependency. A stale quote will produce a stale `answer`. * * * `PendleChainlinkOracleFactory`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendlechainlinkoraclefactory "Direct link to pendlechainlinkoraclefactory") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Permissionless factory that deploys oracle instances and stores them in a registry keyed by `keccak256(market, twapDuration, baseOracleType[, quoteOracle])`. Duplicate deployments are rejected. **Lookup the factory address** for each chain in the [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) . ### `createOracle`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#createoracle "Direct link to createoracle") function createOracle( address market, uint32 twapDuration, PendleOracleType baseOracleType) external returns (address oracle); Deploys a new `PendleChainlinkOracle`. Emits `OracleCreated`. **Reverts:** | Error | Condition | | --- | --- | | `OracleAlreadyExists()` | An oracle with these exact parameters already exists in the registry | | `OracleIncreaseCardinalityRequired(uint32 cardinalityRequired)` | The market's observation ring buffer is too small for the requested `twapDuration`; call `IPMarket(market).increaseObservationsCardinalityNext(cardinalityRequired)` first | | `OracleOldestObservationNotSatisfied()` | Cardinality is sufficient, but not enough time has elapsed since initialization; wait at least `twapDuration` seconds | ### `createOracleWithQuote`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#createoraclewithquote "Direct link to createoraclewithquote") function createOracleWithQuote( address market, uint32 twapDuration, PendleOracleType baseOracleType, address quoteOracle) external returns (address oracle); Deploys a new `PendleChainlinkOracleWithQuote`. Same revert conditions as `createOracle`. Emits `OracleWithQuoteCreated`. `quoteOracle` must implement `AggregatorV3Interface` (specifically `latestRoundData()` and `decimals()`). ### `getOracle`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#getoracle "Direct link to getoracle") function getOracle( address market, uint32 twapDuration, PendleOracleType baseOracleType) external view returns (address); Returns the deployed oracle address, or `address(0)` if not yet deployed. ### `getOracleWithQuote`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#getoraclewithquote "Direct link to getoraclewithquote") function getOracleWithQuote( address market, uint32 twapDuration, PendleOracleType baseOracleType, address quoteOracle) external view returns (address); Returns the deployed oracle-with-quote address, or `address(0)` if not yet deployed. ### `checkMarketOracleState`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#checkmarketoraclestate "Direct link to checkmarketoraclestate") function checkMarketOracleState(address market, uint32 twapDuration) external view; Reverts with the appropriate error if the market oracle is not ready. Useful as a pre-flight check before calling `createOracle`. Internally delegates to `PendlePYLpOracle.getOracleState`. * * * Deployment Workflow[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#deployment-workflow "Direct link to Deployment Workflow") ------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. Call PendlePYLpOracle.getOracleState(market, twapDuration) → if increaseCardinalityRequired: IPMarket(market).increaseObservationsCardinalityNext(cardinalityRequired) wait twapDuration seconds → if !oldestObservationSatisfied: wait twapDuration seconds2. Call factory.createOracle(market, twapDuration, baseOracleType) OR factory.createOracleWithQuote(market, twapDuration, baseOracleType, quoteOracle) → returns deployed oracle address3. Use oracle.latestRoundData() in your protocol ### Code Example[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#code-example "Direct link to Code Example") // Deploy a PT/SY oracle for a given marketaddress oracle = factory.createOracle( market, 900, // 15-minute TWAP PendleOracleType.PT_TO_SY);// Deploy a PT/USD oracle using an external ETH/USD feedaddress oracleUsd = factory.createOracleWithQuote( market, 900, PendleOracleType.PT_TO_SY, address(ETH_USD_CHAINLINK_FEED));// Consume PT/SY price(, int256 answer, , uint256 updatedAt, ) = IAggregatorV3(oracle).latestRoundData();// answer is 1e18-scaled: 1 PT = (answer / 1e18) SY (in natural units)// Consume PT/USD price(, int256 answerUsd, , uint256 updatedAtUsd, ) = IAggregatorV3(oracleUsd).latestRoundData();// answer is 1e18-scaled: 1 PT = (answerUsd / 1e18) USD (in natural units) * * * Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#further-reading "Direct link to Further Reading") ------------------------------------------------------------------------------------------------------------------------------------------------------- * [PendlePYLpOracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle) — the underlying TWAP oracle, including oracle initialization, `getOracleState`, and direct rate function specs * [How to Integrate PT and LP Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) — step-by-step integration guide with runnable examples * [PT as Collateral — Risk Analysis](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral) * [LP as Collateral — Risk Analysis](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral) * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#overview) * [`PendleOracleType` Enum](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendleoracletype-enum) * [`PendleChainlinkOracle`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendlechainlinkoracle) * [Immutable Public Variables](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#immutable-public-variables) * [`latestRoundData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#latestrounddata) * [`getRoundData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#getrounddata) * [`decimals`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#decimals) * [`description`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#description) * [`PendleChainlinkOracleWithQuote`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendlechainlinkoraclewithquote) * [Additional Immutable Variables](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#additional-immutable-variables) * [`latestRoundData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#latestrounddata-1) * [`PendleChainlinkOracleFactory`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#pendlechainlinkoraclefactory) * [`createOracle`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#createoracle) * [`createOracleWithQuote`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#createoraclewithquote) * [`getOracle`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#getoracle) * [`getOracleWithQuote`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#getoraclewithquote) * [`checkMarketOracleState`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#checkmarketoraclestate) * [Deployment Workflow](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#deployment-workflow) * [Code Example](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#code-example) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Market Rates & State Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#__docusaurus_skipToContent_fallback) On this page These functions come from the `IPActionMarketAuxStatic` facet. They cover spot prices, market state, price impact calculations, and `ApproxParams` generation helpers. * * * Spot Rates[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#spot-rates "Direct link to Spot Rates") --------------------------------------------------------------------------------------------------------------------------------------------------------- All spot rates are returned as 18-decimal fixed-point numbers. ### getLpToSyRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getlptosyrate "Direct link to getLpToSyRate") Returns the **spot** price of 1 LP token denominated in the market's SY token. function getLpToSyRate(address market) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | **Return Values** | Type | Description | | --- | --- | | `uint256` | Spot LP price in SY units (18 decimals) | * * * ### getLpToAssetRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getlptoassetrate "Direct link to getLpToAssetRate") Returns the **spot** price of 1 LP token denominated in the SY's underlying asset. function getLpToAssetRate(address market) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | **Return Values** | Type | Description | | --- | --- | | `uint256` | Spot LP price in underlying asset units (18 decimals) | * * * ### getPtToSyRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getpttosyrate "Direct link to getPtToSyRate") Returns the **spot** price of 1 PT token denominated in SY. function getPtToSyRate(address market) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | **Return Values** | Type | Description | | --- | --- | | `uint256` | Spot PT price in SY units (18 decimals) | * * * ### getPtToAssetRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getpttoassetrate "Direct link to getPtToAssetRate") Returns the **spot** price of 1 PT token denominated in the SY's underlying asset. function getPtToAssetRate(address market) external view returns (uint256) * * * ### getYtToSyRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyttosyrate "Direct link to getYtToSyRate") Returns the **spot** price of 1 YT token denominated in SY. function getYtToSyRate(address market) external view returns (uint256) * * * ### getYtToAssetRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyttoassetrate "Direct link to getYtToAssetRate") Returns the **spot** price of 1 YT token denominated in the SY's underlying asset. function getYtToAssetRate(address market) external view returns (uint256) * * * Market State[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#market-state "Direct link to Market State") --------------------------------------------------------------------------------------------------------------------------------------------------------------- ### getMarketState[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getmarketstate "Direct link to getMarketState") Returns the full market state along with derived metrics. function getMarketState(address market) external view returns ( address pt, address yt, address sy, int256 impliedYield, uint256 marketExchangeRateExcludeFee, MarketState memory state ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | **Return Values** | Name | Type | Description | | --- | --- | --- | | pt | `address` | Principal Token address | | yt | `address` | Yield Token address | | sy | `address` | SY token address | | impliedYield | `int256` | Current implied yield rate (18 decimals) | | marketExchangeRateExcludeFee | `uint256` | Current PT/SY exchange rate (fees excluded) | | state | `MarketState` | Full low-level AMM state struct | * * * ### getTradeExchangeRateExcludeFee[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#gettradeexchangerateexcludefee "Direct link to getTradeExchangeRateExcludeFee") Returns the current trade exchange rate from a given market state, excluding fees. function getTradeExchangeRateExcludeFee(address market, MarketState memory state) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | state | `MarketState` | Market state (e.g. from `getMarketState`) | **Return Values** | Type | Description | | --- | --- | | `uint256` | Exchange rate excluding fees (18 decimals) | * * * ### getTradeExchangeRateIncludeFee[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#gettradeexchangerateincludefee "Direct link to getTradeExchangeRateIncludeFee") Returns the effective exchange rate for a specific trade size, including fees. function getTradeExchangeRateIncludeFee(address market, int256 netPtOut) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netPtOut | `int256` | Signed PT delta for the trade (positive = PT leaving pool, negative = PT entering pool) | **Return Values** | Type | Description | | --- | --- | | `uint256` | Effective exchange rate including fees (18 decimals) | * * * Price Impact[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#price-impact "Direct link to Price Impact") --------------------------------------------------------------------------------------------------------------------------------------------------------------- All price impact values are returned as 18-decimal fixed-point numbers (e.g. `1e16` = 1%). ### calcPriceImpactPt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#calcpriceimpactpt "Direct link to calcPriceImpactPt") Calculates the price impact of a PT trade. function calcPriceImpactPt(address market, int256 netPtOut) external view returns (uint256) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netPtOut | `int256` | Signed PT amount (positive = buy PT, negative = sell PT) | **Return Values** | Type | Description | | --- | --- | | `uint256` | Price impact as a fraction (18 decimals) | * * * ### calcPriceImpactYt[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#calcpriceimpactyt "Direct link to calcPriceImpactYt") Calculates the price impact of a YT trade, expressed in PT terms. function calcPriceImpactYt(address market, int256 netPtOut) external view returns (uint256) * * * ### calcPriceImpactPY[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#calcpriceimpactpy "Direct link to calcPriceImpactPY") Calculates the combined price impact of a simultaneous PT+YT trade. function calcPriceImpactPY(address market, int256 netPtOut) external view returns (uint256) * * * Yield Token / PT / YT Conversion Rates[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#yield-token--pt--yt-conversion-rates "Direct link to Yield Token / PT / YT Conversion Rates") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### getYieldTokenAndPtRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyieldtokenandptrate "Direct link to getYieldTokenAndPtRate") Returns how many yield tokens are equivalent to 1 PT at current rates. function getYieldTokenAndPtRate(address market) external view returns (address yieldToken, uint256 netPtOut, uint256 netYieldTokenOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | **Return Values** | Name | Type | Description | | --- | --- | --- | | yieldToken | `address` | The market's underlying yield-bearing token | | netPtOut | `uint256` | Normalised PT amount used as the basis (typically 1e18) | | netYieldTokenOut | `uint256` | Equivalent yield token amount | * * * ### getYieldTokenAndYtRate[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyieldtokenandytrate "Direct link to getYieldTokenAndYtRate") Returns how many yield tokens are equivalent to 1 YT at current rates. function getYieldTokenAndYtRate(address market) external view returns (address yieldToken, uint256 netYtOut, uint256 netYieldTokenOut) **Return Values** | Name | Type | Description | | --- | --- | --- | | yieldToken | `address` | The market's underlying yield-bearing token | | netYtOut | `uint256` | Normalised YT amount used as the basis (typically 1e18) | | netYieldTokenOut | `uint256` | Equivalent yield token amount | * * * ApproxParams Helpers[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#approxparams-helpers "Direct link to ApproxParams Helpers") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- These functions combine a swap simulation with automatic `ApproxParams` generation. Pass the returned `approxParams` directly to the corresponding Router function. ### swapExactSyForPtStaticAndGenerateApproxParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#swapexactsyforptstaticandgenerateapproxparams "Direct link to swapExactSyForPtStaticAndGenerateApproxParams") Simulates swapping exact SY for PT and returns a ready-to-use `ApproxParams`. function swapExactSyForPtStaticAndGenerateApproxParams( address market, uint256 exactSyIn, uint256 slippage) external view returns ( uint256 netPtOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, ApproxParams memory approxParams ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactSyIn | `uint256` | Exact SY amount to swap in | | slippage | `uint256` | Maximum acceptable slippage (18-decimal fraction, e.g. `5e15` = 0.5%) | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | Expected PT output | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the trade (18 decimals) | | exchangeRateAfter | `uint256` | Exchange rate after the trade (18 decimals) | | approxParams | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Pre-filled approximation parameters for the Router call | * * * ### swapExactTokenForPtStaticAndGenerateApproxParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#swapexacttokenforptstaticandgenerateapproxparams "Direct link to swapExactTokenForPtStaticAndGenerateApproxParams") Simulates swapping exact tokens for PT and returns a ready-to-use `ApproxParams`. function swapExactTokenForPtStaticAndGenerateApproxParams( address market, address tokenIn, uint256 amountTokenIn, uint256 slippage) external view returns ( uint256 netPtOut, uint256 netSyMinted, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, ApproxParams memory approxParams ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | tokenIn | `address` | Input token address | | amountTokenIn | `uint256` | Exact token amount to swap in | | slippage | `uint256` | Maximum acceptable slippage (18-decimal fraction) | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | Expected PT output | | netSyMinted | `uint256` | SY minted from the input token | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the trade (18 decimals) | | exchangeRateAfter | `uint256` | Exchange rate after the trade (18 decimals) | | approxParams | [`ApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) | Pre-filled approximation parameters for the Router call | **Use Case** This is the recommended way to populate `ApproxParams` for `swapExactTokenForPt`. It avoids the need to tune approximation parameters manually. * * * Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#examples "Direct link to Examples") --------------------------------------------------------------------------------------------------------------------------------------------------- Recommended: Use the Pendle API The examples below show direct RouterStatic usage. For most integrations, the [Pendle Hosted SDK / API](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) is the better choice — it handles approximation, limit-order filling, and zap routing automatically. ### Display LP / PT / YT spot prices[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#display-lp--pt--yt-spot-prices "Direct link to Display LP / PT / YT spot prices") const [lpToAsset, ptToAsset, ytToAsset] = await Promise.all([ routerStatic.getLpToAssetRate(MARKET_ADDRESS), routerStatic.getPtToAssetRate(MARKET_ADDRESS), routerStatic.getYtToAssetRate(MARKET_ADDRESS),]);// All values are 18-decimal fractions of the underlying assetconsole.log(`1 LP = ${ethers.formatEther(lpToAsset)} underlying`);console.log(`1 PT = ${ethers.formatEther(ptToAsset)} underlying`);console.log(`1 YT = ${ethers.formatEther(ytToAsset)} underlying`); ### Read market state and implied yield[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#read-market-state-and-implied-yield "Direct link to Read market state and implied yield") const [pt, yt, sy, impliedYield, exchangeRateExcludeFee, state] = await routerStatic.getMarketState(MARKET_ADDRESS);// impliedYield is a signed 18-decimal annualised rateconst impliedYieldPct = Number(ethers.formatEther(impliedYield)) * 100;console.log(`Implied yield: ${impliedYieldPct.toFixed(2)}%`);console.log(`PT: ${pt}, YT: ${yt}, SY: ${sy}`); ### Gate a trade on price impact[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#gate-a-trade-on-price-impact "Direct link to Gate a trade on price impact") const netPtOut_amount = ethers.parseEther("500");const priceImpact = await routerStatic.calcPriceImpactPt(MARKET_ADDRESS, netPtOut_amount);const impactPct = Number(ethers.formatEther(priceImpact)) * 100;if (impactPct > 1.0) { throw new Error(`Price impact ${impactPct.toFixed(2)}% exceeds 1% threshold — reduce size`);} ### Buy PT with token using generated ApproxParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#buy-pt-with-token-using-generated-approxparams "Direct link to Buy PT with token using generated ApproxParams") const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");const SLIPPAGE = ethers.parseEther("0.005"); // 0.5%// 1. Get simulation + ready-to-use ApproxParams in a single callconst [netPtOut, netSyMinted, netSyFee, priceImpact, exchangeRateAfter, approxParams] = await routerStatic.swapExactTokenForPtStaticAndGenerateApproxParams( MARKET_ADDRESS, tokenIn, amountIn, SLIPPAGE );console.log(`PT out: ${ethers.formatEther(netPtOut)}`);console.log(`Fee: ${ethers.formatEther(netSyFee)} SY`);console.log(`Impact: ${ethers.formatEther(priceImpact * 100n)}%`);// 2. Execute — pass approxParams directly, no manual tuning neededawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.swapExactTokenForPt( signer.address, MARKET_ADDRESS, (netPtOut * 995n) / 1000n, // minPtOut approxParams, // generated by RouterStatic createTokenInputStruct(tokenIn, amountIn), emptyLimitOrderData); * [Spot Rates](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#spot-rates) * [getLpToSyRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getlptosyrate) * [getLpToAssetRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getlptoassetrate) * [getPtToSyRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getpttosyrate) * [getPtToAssetRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getpttoassetrate) * [getYtToSyRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyttosyrate) * [getYtToAssetRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyttoassetrate) * [Market State](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#market-state) * [getMarketState](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getmarketstate) * [getTradeExchangeRateExcludeFee](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#gettradeexchangerateexcludefee) * [getTradeExchangeRateIncludeFee](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#gettradeexchangerateincludefee) * [Price Impact](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#price-impact) * [calcPriceImpactPt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#calcpriceimpactpt) * [calcPriceImpactYt](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#calcpriceimpactyt) * [calcPriceImpactPY](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#calcpriceimpactpy) * [Yield Token / PT / YT Conversion Rates](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#yield-token--pt--yt-conversion-rates) * [getYieldTokenAndPtRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyieldtokenandptrate) * [getYieldTokenAndYtRate](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#getyieldtokenandytrate) * [ApproxParams Helpers](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#approxparams-helpers) * [swapExactSyForPtStaticAndGenerateApproxParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#swapexactsyforptstaticandgenerateapproxparams) * [swapExactTokenForPtStaticAndGenerateApproxParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#swapexacttokenforptstaticandgenerateapproxparams) * [Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#examples) * [Display LP / PT / YT spot prices](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#display-lp--pt--yt-spot-prices) * [Read market state and implied yield](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#read-market-state-and-implied-yield) * [Gate a trade on price impact](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#gate-a-trade-on-price-impact) * [Buy PT with token using generated ApproxParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#buy-pt-with-token-using-generated-approxparams) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Router Contract Integration Guide | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#overview "Direct link to Overview") ------------------------------------------------------------------------------------------------------------------------------------------------- This guide shows how to interact with the Pendle Router for common on-chain actions—buying/selling PT or YT, adding/removing liquidity, minting/redeeming PT and YT, and claiming rewards. It’s intended for developers who want to integrate Pendle fully on-chain without using the Pendle SDK. For most use cases, we recommend the Pendle SDK for a better developer and end-user experience. The SDK supports zap-in/zap-out from any token, limit-order filling, and off-chain quoting, among other features. See the [Pendle SDK documentation](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) for details. The full tutorial source code is available in [RouterSample.sol](https://github.com/pendle-finance/pendle-examples-public/blob/main/test/RouterSample.sol) . The examples target the wstETH market, but you can adapt them to other markets by changing the market and underlying asset addresses. Quick Navigation[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#quick-navigation "Direct link to Quick Navigation") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Helper functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#helper-functions "Direct link to Helper functions") * [Helper Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#helper-functions) ### Trading Operations[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#trading-operations "Direct link to Trading Operations") * [PT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#pt-trading) * [YT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#yt-trading) ### Liquidity Operations[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#liquidity-operations "Direct link to Liquidity Operations") * [Add Liquidity (Zap In) & Remove Liquidity (Zap Out)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#liquidity-management) * [Add Liquidity (Keep YT)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#add-liquidity-keep-yt) ### Other Operations[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#other-operations "Direct link to Other Operations") * [Mint/Redeem SY](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#mint-sy-from-token) * [Mint/Redeem PT & YT](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#mint-pt--yt-from-token) * * * Helper Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#helper-functions-1 "Direct link to Helper Functions") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Since Pendle Router supports various aggregators and off-chain approximation, the function parameters can be quite complex. To simplify the usage, we provide some helper functions to create the required structs with default values. Please find the full implementation in [StructGen.sol](https://github.com/pendle-finance/pendle-examples-public/blob/main/src/StructGen.sol) . import "@pendle/core-v2/contracts/interfaces/IPAllActionV3.sol";import "@pendle/core-v2/contracts/interfaces/IPMarket.sol";IPAllActionV3 router = IPAllActionV3(0x888888888889758F76e7103c6CbF23ABbF58F946);// EmptySwap means no swap aggregator is involvedSwapData public emptySwap;// EmptyLimit means no limit order is involvedLimitOrderData public emptyLimit;// DefaultApprox means no off-chain preparation is involved, more gas consuming (~ 180k gas)ApproxParams public defaultApprox = ApproxParams(0, type(uint256).max, 0, 256, 1e14);/// @notice create a simple TokenInput struct without using any aggregators. For more info please refer to/// IPAllActionTypeV3.solfunction createTokenInputStruct(address tokenIn, uint256 netTokenIn) internal view returns (TokenInput memory);/// @notice create a simple TokenOutput struct without using any aggregators. For more info please refer to/// IPAllActionTypeV3.solfunction createTokenOutputStruct( address tokenOut, uint256 minTokenOut) internal view returns (TokenOutput memory); PT Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#pt-trading "Direct link to PT Trading") ------------------------------------------------------------------------------------------------------------------------------------------------------- ### Buy PT with Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#buy-pt-with-token "Direct link to Buy PT with Token") Buying PT with the underlying token. This example uses wstETH to buy PT-wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address ptReceiver = address(this);IERC20(wstETH).approve(address(router), tokenAmount);(uint256 netPtOut, , ) = router.swapExactTokenForPt( ptReceiver, // receiver address(market), // market address 0, // minPtOut defaultApprox, // approximation params createTokenInputStruct(wstETH, tokenAmount), // token input emptyLimit // limit order data); ### Sell PT for Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#sell-pt-for-token "Direct link to Sell PT for Token") Selling PT for the underlying token. This example uses PT-wstETH to sell for wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;(, address PT, ) = IPMarket(market).readTokens();address tokenReceiver = address(this);IERC20(PT).approve(address(router), ptAmount);(uint256 netTokenOut, , ) = router.swapExactPtForToken( tokenReceiver, // receiver address(market), // market address ptAmount, // exact PT amount to sell createTokenOutputStruct(wstETH, 0), // token output (0 = no minimum) emptyLimit // limit order data); * * * YT Trading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#yt-trading "Direct link to YT Trading") ------------------------------------------------------------------------------------------------------------------------------------------------------- ### Buy YT with Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#buy-yt-with-token "Direct link to Buy YT with Token") Buying YT with the underlying token. This example uses wstETH to buy YT-wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address ytReceiver = address(this);IERC20(wstETH).approve(address(router), tokenAmount);(uint256 netYtOut, , ) = router.swapExactTokenForYt( ytReceiver, // receiver address(market), // market address 0, // minYtOut defaultApprox, // approximation params createTokenInputStruct(wstETH, tokenAmount), // token input emptyLimit // limit order data); ### Sell YT for Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#sell-yt-for-token "Direct link to Sell YT for Token") Selling YT for the underlying token. This example uses YT-wstETH to sell for wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;(,, address YT) = IPMarket(market).readTokens();address tokenReceiver = address(this);IERC20(YT).approve(address(router), ytAmount);(uint256 netTokenOut, , ) = router.swapExactYtForToken( tokenReceiver, // receiver address(market), // market address ytAmount, // exact YT amount to sell createTokenOutputStruct(wstETH, 0), // token output (0 = no minimum) emptyLimit // limit order data); * * * Liquidity Management[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#liquidity-management "Direct link to Liquidity Management") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Add Liquidity (Zap In)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#add-liquidity-zap-in "Direct link to Add Liquidity (Zap In)") Add liquidity to a market using a single underlying token. This example uses wstETH to add liquidity to the wstETH market. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address lpReceiver = address(this);IERC20(wstETH).approve(address(router), tokenAmount);(uint256 netLpOut, , ) = router.addLiquiditySingleToken( lpReceiver, // receiver address(market), // market address 0, // minLpOut defaultApprox, // approximation params createTokenInputStruct(wstETH, tokenAmount), // token input emptyLimit // limit order data); ### Remove Liquidity (Zap Out)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#remove-liquidity-zap-out "Direct link to Remove Liquidity (Zap Out)") Remove liquidity from a market to a single underlying token. This example removes liquidity from the wstETH market to receive wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address tokenReceiver = address(this);IERC20(market).approve(address(router), lpAmount);(uint256 netTokenOut, , ) = router.removeLiquiditySingleToken( address(this), // receiver address(market), // market address lpAmount, // exact LP amount to remove createTokenOutputStruct(wstETH, 0), // token output (0 = no minimum) emptyLimit // limit order data); ### Add Liquidity (Keep YT)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#add-liquidity-keep-yt "Direct link to Add Liquidity (Keep YT)") Add liquidity to a market using a single underlying token while keeping the YT. This example uses wstETH to add liquidity to the wstETH market while keeping the YT. More information about this function can be found in the [documentation](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/LiquidityFunctions#addliquiditysingletokenkeepyt) . address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address lpReceiver = address(this);IERC20(wstETH).approve(address(router), tokenAmount);(uint256 netLpOut, uint256 netYtOut, , ) = router.addLiquiditySingleTokenKeepYt( lpReceiver, // receiver address(market), // market address 0, // minLpOut 0, // minYtOut createTokenInputStruct(wstETH, tokenAmount) // token input); Other Operations[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#other-operations-1 "Direct link to Other Operations") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### Mint SY from Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#mint-sy-from-token "Direct link to Mint SY from Token") Mint SY using the underlying token. This example uses wstETH to mint SY-wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;(address SY,,) = IPMarket(market).readTokens();address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address syReceiver = address(this);IERC20(wstETH).approve(address(router), tokenAmount);uint256 netSyOut = router.mintSyFromToken( syReceiver, // receiver address(SY), // SY token address 0, // minSyOut createTokenInputStruct(wstETH, tokenAmount) // token input); ### Redeem SY to Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#redeem-sy-to-token "Direct link to Redeem SY to Token") Redeem SY to the underlying token. This example uses SY-wstETH to redeem to wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;(address SY,,) = IPMarket(market).readTokens();address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address tokenReceiver = address(this);IERC20(SY).approve(address(router), syAmount);uint256 netTokenOut = router.redeemSyToToken( tokenReceiver, // receiver address(SY), // SY token address syAmount, // exact SY amount to redeem createTokenOutputStruct(wstETH, 0) // token output (0 = no minimum)); ### Mint PT & YT from Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#mint-pt--yt-from-token "Direct link to Mint PT & YT from Token") Mint both PT and YT using the underlying token. This example uses wstETH to mint PT-wstETH and YT-wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;(,, address YT) = IPMarket(market).readTokens();address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address pyReceiver = address(this);IERC20(wstETH).approve(address(router), tokenAmount);(uint256 netPyOut, ) = router.mintPyFromToken( pyReceiver, // receiver address(YT), // YT token address (used to identify market) 0, // minPyOut createTokenInputStruct(wstETH, tokenAmount) // token input);// netPyOut represents both PT and YT amounts (they're equal) ### Redeem PT & YT to Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#redeem-pt--yt-to-token "Direct link to Redeem PT & YT to Token") Redeem both PT and YT to the underlying token. This example uses PT-wstETH and YT-wstETH to redeem to wstETH. address market = 0xD0354D4e7bCf345fB117cabe41aCaDb724eccCa2;(, address PT, address YT) = IPMarket(market).readTokens();address wstETH = 0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0;address tokenReceiver = address(this);IERC20(PT).approve(address(router), pyAmount);IERC20(YT).approve(address(router), pyAmount);(uint256 netTokenOut, ) = router.redeemPyToToken( tokenReceiver, // receiver address(YT), // YT token address (used to identify market) pyAmount, // exact PT+YT amount to redeem createTokenOutputStruct(wstETH, 0) // token output (0 = no minimum)); * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#overview) * [Quick Navigation](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#quick-navigation) * [Helper functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#helper-functions) * [Trading Operations](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#trading-operations) * [Liquidity Operations](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#liquidity-operations) * [Other Operations](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#other-operations) * [Helper Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#helper-functions-1) * [PT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#pt-trading) * [Buy PT with Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#buy-pt-with-token) * [Sell PT for Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#sell-pt-for-token) * [YT Trading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#yt-trading) * [Buy YT with Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#buy-yt-with-token) * [Sell YT for Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#sell-yt-for-token) * [Liquidity Management](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#liquidity-management) * [Add Liquidity (Zap In)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#add-liquidity-zap-in) * [Remove Liquidity (Zap Out)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#remove-liquidity-zap-out) * [Add Liquidity (Keep YT)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#add-liquidity-keep-yt) * [Other Operations](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#other-operations-1) * [Mint SY from Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#mint-sy-from-token) * [Redeem SY to Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#redeem-sy-to-token) * [Mint PT & YT from Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#mint-pt--yt-from-token) * [Redeem PT & YT to Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide#redeem-pt--yt-to-token) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Liquidity Simulation Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#__docusaurus_skipToContent_fallback) On this page These functions come from the `IPActionMarketCoreStatic` facet. They simulate the corresponding Router liquidity operations and return expected token flows, fees, and price impact. * * * Add Liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#add-liquidity "Direct link to Add Liquidity") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### addLiquidityDualSyAndPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditydualsyandptstatic "Direct link to addLiquidityDualSyAndPtStatic") Simulates adding liquidity with both SY and PT simultaneously. No swap is performed — tokens are deposited proportionally. function addLiquidityDualSyAndPtStatic(address market, uint256 netSyDesired, uint256 netPtDesired) external view returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netSyDesired | `uint256` | Maximum SY to deposit | | netPtDesired | `uint256` | Maximum PT to deposit | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netSyUsed | `uint256` | Actual SY deposited (≤ `netSyDesired`) | | netPtUsed | `uint256` | Actual PT deposited (≤ `netPtDesired`) | * * * ### addLiquidityDualTokenAndPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditydualtokenandptstatic "Direct link to addLiquidityDualTokenAndPtStatic") Simulates adding liquidity with an arbitrary token and PT. The token is converted to SY first. function addLiquidityDualTokenAndPtStatic( address market, address tokenIn, uint256 netTokenDesired, uint256 netPtDesired) external view returns ( uint256 netLpOut, uint256 netTokenUsed, uint256 netPtUsed, uint256 netSyUsed, uint256 netSyDesired ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | tokenIn | `address` | Input token to convert to SY | | netTokenDesired | `uint256` | Maximum token amount to deposit | | netPtDesired | `uint256` | Maximum PT to deposit | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netTokenUsed | `uint256` | Actual token consumed | | netPtUsed | `uint256` | Actual PT deposited | | netSyUsed | `uint256` | SY deposited into the pool | | netSyDesired | `uint256` | SY minted from `netTokenUsed` | * * * ### addLiquiditySinglePtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysingleptstatic "Direct link to addLiquiditySinglePtStatic") Simulates adding liquidity with PT only. A portion of the PT is swapped to SY internally. function addLiquiditySinglePtStatic(address market, uint256 netPtIn) external view returns ( uint256 netLpOut, uint256 netPtToSwap, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyFromSwap ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netPtIn | `uint256` | Total PT to deposit | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netPtToSwap | `uint256` | PT swapped to SY to balance the deposit | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the internal swap | | exchangeRateAfter | `uint256` | Exchange rate after the internal swap | | netSyFromSwap | `uint256` | SY obtained from swapping `netPtToSwap` | * * * ### addLiquiditySingleSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysinglesystatic "Direct link to addLiquiditySingleSyStatic") Simulates adding liquidity with SY only. A portion of the SY is swapped to PT internally. function addLiquiditySingleSyStatic(address market, uint256 netSyIn) external view returns ( uint256 netLpOut, uint256 netPtFromSwap, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyToSwap ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netSyIn | `uint256` | Total SY to deposit | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netPtFromSwap | `uint256` | PT obtained from swapping SY | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the internal swap | | exchangeRateAfter | `uint256` | Exchange rate after the internal swap | | netSyToSwap | `uint256` | SY used in the internal swap | * * * ### addLiquiditySingleTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysingletokenstatic "Direct link to addLiquiditySingleTokenStatic") Simulates adding liquidity with an arbitrary token only. The token is minted to SY, then handled like `addLiquiditySingleSy`. function addLiquiditySingleTokenStatic(address market, address tokenIn, uint256 netTokenIn) external view returns ( uint256 netLpOut, uint256 netPtFromSwap, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyMinted, uint256 netSyToSwap ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | tokenIn | `address` | Input token address | | netTokenIn | `uint256` | Token amount to deposit | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netPtFromSwap | `uint256` | PT obtained from the internal swap | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the internal swap | | exchangeRateAfter | `uint256` | Exchange rate after the internal swap | | netSyMinted | `uint256` | SY minted from the input token | | netSyToSwap | `uint256` | SY used in the internal swap | * * * ### addLiquiditySingleSyKeepYtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysinglesykeepytstatic "Direct link to addLiquiditySingleSyKeepYtStatic") Simulates adding liquidity with SY and retaining the YT that is minted during the process. Part of the SY is used to mint PT+YT; the PT goes into the pool while the YT is kept by the user. function addLiquiditySingleSyKeepYtStatic(address market, uint256 netSyIn) external view returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyToPY) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netSyIn | `uint256` | SY to deposit | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netYtOut | `uint256` | YT retained by the user | | netSyToPY | `uint256` | SY used to mint PT+YT | * * * ### addLiquiditySingleTokenKeepYtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysingletokenkeepytstatic "Direct link to addLiquiditySingleTokenKeepYtStatic") Simulates adding liquidity with an arbitrary token while retaining the minted YT. function addLiquiditySingleTokenKeepYtStatic(address market, address tokenIn, uint256 netTokenIn) external view returns (uint256 netLpOut, uint256 netYtOut, uint256 netSyMinted, uint256 netSyToPY) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | tokenIn | `address` | Input token address | | netTokenIn | `uint256` | Token amount to deposit | **Return Values** | Name | Type | Description | | --- | --- | --- | | netLpOut | `uint256` | LP tokens received | | netYtOut | `uint256` | YT retained by the user | | netSyMinted | `uint256` | SY minted from the input token | | netSyToPY | `uint256` | SY used to mint PT+YT | * * * Remove Liquidity[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#remove-liquidity "Direct link to Remove Liquidity") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### removeLiquidityDualSyAndPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditydualsyandptstatic "Direct link to removeLiquidityDualSyAndPtStatic") Simulates removing liquidity and receiving both SY and PT proportionally. function removeLiquidityDualSyAndPtStatic(address market, uint256 netLpToRemove) external view returns (uint256 netSyOut, uint256 netPtOut) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | LP tokens to burn | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY received | | netPtOut | `uint256` | PT received | * * * ### removeLiquidityDualTokenAndPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditydualtokenandptstatic "Direct link to removeLiquidityDualTokenAndPtStatic") Simulates removing liquidity and receiving an arbitrary token (converted from SY) plus PT. function removeLiquidityDualTokenAndPtStatic(address market, uint256 netLpToRemove, address tokenOut) external view returns (uint256 netTokenOut, uint256 netPtOut, uint256 netSyToRedeem) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | LP tokens to burn | | tokenOut | `address` | Desired output token | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Token received (converted from SY) | | netPtOut | `uint256` | PT received | | netSyToRedeem | `uint256` | SY redeemed to produce the token output | * * * ### removeLiquiditySinglePtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditysingleptstatic "Direct link to removeLiquiditySinglePtStatic") Simulates removing liquidity and receiving PT only. The SY portion is swapped to PT internally. function removeLiquiditySinglePtStatic(address market, uint256 netLpToRemove) external view returns ( uint256 netPtOut, uint256 netPtFromSwap, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyFromBurn, uint256 netPtFromBurn ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | LP tokens to burn | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | Total PT received | | netPtFromSwap | `uint256` | PT obtained from swapping the SY portion | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the internal swap | | exchangeRateAfter | `uint256` | Exchange rate after the internal swap | | netSyFromBurn | `uint256` | SY received from burning LP | | netPtFromBurn | `uint256` | PT received directly from burning LP | * * * ### removeLiquiditySingleSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditysinglesystatic "Direct link to removeLiquiditySingleSyStatic") Simulates removing liquidity and receiving SY only. The PT portion is swapped to SY internally. function removeLiquiditySingleSyStatic(address market, uint256 netLpToRemove) external view returns ( uint256 netSyOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyFromBurn, uint256 netPtFromBurn, uint256 netSyFromSwap ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | LP tokens to burn | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | Total SY received | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the internal swap | | exchangeRateAfter | `uint256` | Exchange rate after the internal swap | | netSyFromBurn | `uint256` | SY received directly from burning LP | | netPtFromBurn | `uint256` | PT received from burning LP (then swapped) | | netSyFromSwap | `uint256` | SY obtained from swapping `netPtFromBurn` | * * * ### removeLiquiditySingleTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditysingletokenstatic "Direct link to removeLiquiditySingleTokenStatic") Simulates removing liquidity and receiving an arbitrary token only. The SY from LP burn is redeemed, and the PT portion is first swapped to SY. function removeLiquiditySingleTokenStatic(address market, uint256 netLpToRemove, address tokenOut) external view returns ( uint256 netTokenOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyOut, uint256 netSyFromBurn, uint256 netPtFromBurn, uint256 netSyFromSwap ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | netLpToRemove | `uint256` | LP tokens to burn | | tokenOut | `address` | Desired output token | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Token received | | netSyFee | `uint256` | Fee paid in SY | | priceImpact | `uint256` | Price impact of the internal swap | | exchangeRateAfter | `uint256` | Exchange rate after the internal swap | | netSyOut | `uint256` | Total SY before token redemption | | netSyFromBurn | `uint256` | SY received directly from burning LP | | netPtFromBurn | `uint256` | PT received from burning LP (then swapped) | | netSyFromSwap | `uint256` | SY obtained from swapping `netPtFromBurn` | * * * Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#examples "Direct link to Examples") -------------------------------------------------------------------------------------------------------------------------------------------------------- Recommended: Use the Pendle API The examples below show direct RouterStatic usage. For most integrations, the [Pendle Hosted SDK / API](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) is the better choice — it handles approximation, limit-order filling, and zap routing automatically. ### Add single-token liquidity — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#add-single-token-liquidity--simulate-then-execute "Direct link to Add single-token liquidity — simulate then execute") const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");// 1. Simulate to get expected LP and internal breakdownconst [netLpOut, netPtFromSwap, , priceImpact, , netSyMinted, netSyToSwap] = await routerStatic.addLiquiditySingleTokenStatic(MARKET_ADDRESS, tokenIn, amountIn);console.log(`Expected LP out: ${ethers.formatEther(netLpOut)}`);console.log(`Price impact: ${ethers.formatEther(priceImpact * 100n)}%`);// netSyToSwap / netSyMinted shows what fraction of your deposit goes into the PT-buyconsole.log(`SY swapped to PT: ${ethers.formatEther(netSyToSwap)} / ${ethers.formatEther(netSyMinted)}`);// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.addLiquiditySingleToken( signer.address, MARKET_ADDRESS, (netLpOut * 995n) / 1000n, // minLpOut (0.5% slippage) defaultApproxParams, createTokenInputStruct(tokenIn, amountIn), emptyLimitOrderData); ### Add liquidity and keep YT — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#add-liquidity-and-keep-yt--simulate-then-execute "Direct link to Add liquidity and keep YT — simulate then execute") const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");// 1. Simulate both LP and YT outputsconst [netLpOut, netYtOut, netSyMinted, netSyToPY] = await routerStatic.addLiquiditySingleTokenKeepYtStatic(MARKET_ADDRESS, tokenIn, amountIn);console.log(`LP out: ${ethers.formatEther(netLpOut)}`);console.log(`YT out: ${ethers.formatEther(netYtOut)}`);// netSyToPY / netSyMinted shows how much goes to minting PT+YT vs swappingconsole.log(`SY to PT+YT mint: ${ethers.formatEther(netSyToPY)} / ${ethers.formatEther(netSyMinted)}`);// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.addLiquiditySingleTokenKeepYt( signer.address, MARKET_ADDRESS, (netLpOut * 995n) / 1000n, // minLpOut (netYtOut * 995n) / 1000n, // minYtOut createTokenInputStruct(tokenIn, amountIn)); ### Remove single-token liquidity — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#remove-single-token-liquidity--simulate-then-execute "Direct link to Remove single-token liquidity — simulate then execute") const tokenOut = WSTETH_ADDRESS;const lpAmount = ethers.parseEther("0.5");// 1. Simulateconst [netTokenOut, , priceImpact, , , netSyFromBurn, netPtFromBurn, netSyFromSwap] = await routerStatic.removeLiquiditySingleTokenStatic(MARKET_ADDRESS, lpAmount, tokenOut);console.log(`Expected token out: ${ethers.formatEther(netTokenOut)}`);// Breakdown: SY from burn goes directly to redemption; PT from burn is first swapped to SYconsole.log(`SY from LP burn: ${ethers.formatEther(netSyFromBurn)}`);console.log(`PT from LP burn (then swapped): ${ethers.formatEther(netPtFromBurn)}`);console.log(`SY from PT swap: ${ethers.formatEther(netSyFromSwap)}`);// 2. Executeawait IERC20(MARKET_ADDRESS).approve(ROUTER_ADDRESS, lpAmount);await router.removeLiquiditySingleToken( signer.address, MARKET_ADDRESS, lpAmount, createTokenOutputStruct(tokenOut, (netTokenOut * 995n) / 1000n), emptyLimitOrderData); ### Dual-asset add — preview actual token consumption[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#dual-asset-add--preview-actual-token-consumption "Direct link to Dual-asset add — preview actual token consumption") The dual-asset functions consume tokens proportionally to the pool ratio, so actual amounts used may be less than desired. const netSyDesired = ethers.parseEther("1");const netPtDesired = ethers.parseEther("1");// 1. Simulate — find out how much is actually consumedconst [netLpOut, netSyUsed, netPtUsed] = await routerStatic.addLiquidityDualSyAndPtStatic(MARKET_ADDRESS, netSyDesired, netPtDesired);console.log(`LP out: ${ethers.formatEther(netLpOut)}`);console.log(`SY used: ${ethers.formatEther(netSyUsed)} (of ${ethers.formatEther(netSyDesired)} desired)`);console.log(`PT used: ${ethers.formatEther(netPtUsed)} (of ${ethers.formatEther(netPtDesired)} desired)`);// 2. Execute (approve only what will be used, plus a small buffer for safety)await IERC20(SY_ADDRESS).approve(ROUTER_ADDRESS, netSyDesired);await IERC20(PT_ADDRESS).approve(ROUTER_ADDRESS, netPtDesired);await router.addLiquidityDualSyAndPt( signer.address, MARKET_ADDRESS, netSyDesired, netPtDesired, (netLpOut * 995n) / 1000n // minLpOut); * [Add Liquidity](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#add-liquidity) * [addLiquidityDualSyAndPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditydualsyandptstatic) * [addLiquidityDualTokenAndPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditydualtokenandptstatic) * [addLiquiditySinglePtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysingleptstatic) * [addLiquiditySingleSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysinglesystatic) * [addLiquiditySingleTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysingletokenstatic) * [addLiquiditySingleSyKeepYtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysinglesykeepytstatic) * [addLiquiditySingleTokenKeepYtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#addliquiditysingletokenkeepytstatic) * [Remove Liquidity](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#remove-liquidity) * [removeLiquidityDualSyAndPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditydualsyandptstatic) * [removeLiquidityDualTokenAndPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditydualtokenandptstatic) * [removeLiquiditySinglePtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditysingleptstatic) * [removeLiquiditySingleSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditysinglesystatic) * [removeLiquiditySingleTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#removeliquiditysingletokenstatic) * [Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#examples) * [Add single-token liquidity — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#add-single-token-liquidity--simulate-then-execute) * [Add liquidity and keep YT — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#add-liquidity-and-keep-yt--simulate-then-execute) * [Remove single-token liquidity — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#remove-single-token-liquidity--simulate-then-execute) * [Dual-asset add — preview actual token consumption](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/LiquidityFunctions#dual-asset-add--preview-actual-token-consumption) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # PendlePYLpOracle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#overview "Direct link to Overview") ----------------------------------------------------------------------------------------------------------------------------- `PendlePYLpOracle` is the canonical on-chain TWAP price oracle for Pendle's PT, YT, and LP tokens, modelled after the UniswapV3 oracle design. > All rates are expressed as `1e18`\-scaled fixed-point numbers. A return value of `0.95e18` means 1 unit of the queried token is worth 0.95 units of the denominator token. The contract is deployed to the same address on every supported network. Find it under `"pendlePYLpOracle"` in the [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) . **Interface**: [`IPPYLpOracle`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IPPYLpOracle.sol) **Source**: [`PendlePYLpOracle.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol) * * * Oracle Architecture[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#oracle-architecture "Direct link to Oracle Architecture") -------------------------------------------------------------------------------------------------------------------------------------------------------------- ### TWAP Mechanism[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#twap-mechanism "Direct link to TWAP Mechanism") Pendle's oracle is modelled after the UniswapV3 oracle design. Each `PendleMarket` contract stores a ring buffer of timestamped observations. Each observation records: struct Observation { uint32 blockTimestamp; // block timestamp at write time uint216 lnImpliedRateCumulative; // cumulative sum of ln(impliedRate) * elapsed_time bool initialized; // whether this slot has been written} The TWAP geometric-mean implied rate over the interval `[t₀, t₁]` is computed as: lnImpliedRate = (lnImpliedRateCumulative[t₁] - lnImpliedRateCumulative[t₀]) / (t₁ - t₀) From `lnImpliedRate` and the remaining time to expiry, the PT-to-asset exchange rate is derived: assetToPtRate = exp(lnImpliedRate)^(timeToExpiry / ONE_YEAR)ptToAssetRate = 1 / assetToPtRateytToAssetRate = 1 - ptToAssetRate ### LP Pricing[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#lp-pricing "Direct link to LP Pricing") LP token pricing uses a **hypothetical-trade simulation**: the oracle calculates what the total pool asset value would be after a simulated rebalancing trade that prices all PT in the pool at the TWAP-implied rate. See [About the LP Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#about-the-lp-oracle) for the full derivation. ### SY Solvency Adjustment[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#sy-solvency-adjustment "Direct link to SY Solvency Adjustment") All six rate functions apply a solvency guard. Let: * `syIndex` = current `SY.exchangeRate()` (asset per SY, 1e18-scaled) * `pyIndex` = `max(syIndex, YT.pyIndexStored())` — the accrued index at last PT/YT interaction When `syIndex < pyIndex` (meaning the SY backing has lost value since the last index accrual — e.g., a depeg or slashing event), rates are scaled down by `syIndex / pyIndex` to reflect the reduced redemption value. When `syIndex >= pyIndex` the adjustment is a no-op. Prefer `ToSy` over `ToAsset` for most integrations PT-to-SY pricing is natively guaranteed by the Pendle AMM: 1 PT can always be traded for some amount of SY. PT-to-asset pricing depends additionally on `SY.exchangeRate()`, which is provided by the underlying protocol and can diverge if the asset depegs or becomes unredeemable from SY. For most lending/borrowing and money-market integrations, price **PT/YT/LP in SY** and handle the SY→asset conversion separately with an appropriate external oracle or your own risk model. * * * Prerequisites: Oracle Initialization[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#prerequisites-oracle-initialization "Direct link to Prerequisites: Oracle Initialization") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Markets are deployed with an observation cardinality of 1 (a single slot), which is **insufficient for TWAP queries**. Before calling any rate function, the oracle must be initialized for the chosen duration. ### Step 1 — Check oracle state[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#step-1--check-oracle-state "Direct link to Step 1 — Check oracle state") (bool increaseCardinalityRequired, uint16 cardinalityRequired, bool oldestObservationSatisfied) = oracle.getOracleState(market, duration); ### Step 2 — Increase cardinality (if required)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#step-2--increase-cardinality-if-required "Direct link to Step 2 — Increase cardinality (if required)") If `increaseCardinalityRequired == true`, call: IPMarket(market).increaseObservationsCardinalityNext(cardinalityRequired); Typical `cardinalityRequired` values for common chains and durations: | Duration | Ethereum (≈12 s blocks) | Arbitrum / fast chains (≈1 s) | | --- | --- | --- | | 900 s (15 min) | ~85 | ~900 | | 1800 s (30 min) | ~165 | ~1800 | The exact value is returned by `getOracleState` and is calculated as: cardinalityRequired = ceil(duration × 1000 / blockCycleNumerator) + 1 where `blockCycleNumerator` is a chain-specific constant (Ethereum: `11000`, Arbitrum: `1000`). ### Step 3 — Wait for data[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#step-3--wait-for-data "Direct link to Step 3 — Wait for data") After increasing cardinality, wait at least `duration` seconds before querying prices. `oldestObservationSatisfied == false` means the buffer does not yet hold observations old enough to cover the requested TWAP window. * * * `getOracleState`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getoraclestate "Direct link to getoraclestate") ------------------------------------------------------------------------------------------------------------------------------------------------- function getOracleState(address market, uint32 duration) external view returns ( bool increaseCardinalityRequired, uint16 cardinalityRequired, bool oldestObservationSatisfied ); **Parameters** | Name | Type | Description | | --- | --- | --- | | `market` | `address` | `PendleMarket` contract address | | `duration` | `uint32` | Desired TWAP window in seconds | **Return values** | Name | Type | Description | | --- | --- | --- | | `increaseCardinalityRequired` | `bool` | `true` if `IPMarket.increaseObservationsCardinalityNext` must be called before the oracle can serve this duration | | `cardinalityRequired` | `uint16` | Minimum cardinality required for the given duration (pass this to `increaseObservationsCardinalityNext`) | | `oldestObservationSatisfied` | `bool` | `true` if the ring buffer already holds an observation old enough to serve the full TWAP window | The oracle is ready to use only when **both** `increaseCardinalityRequired == false` **and** `oldestObservationSatisfied == true`. * * * Rate Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#rate-functions "Direct link to Rate Functions") ----------------------------------------------------------------------------------------------------------------------------------------------- All six rate functions share the same parameter signature: | Parameter | Type | Description | | --- | --- | --- | | `market` | `address` | `PendleMarket` contract address | | `duration` | `uint32` | TWAP window in seconds. Pass `0` to read the current spot implied rate (not TWAP). **Do not use `duration = 0` in production** — spot rates can be manipulated within a single block. | All functions return a `uint256` value scaled to `1e18`. The return value `r` means: 1 raw_unit(queried_token) = r / 1e18 raw_units(denominator_token) ### `getPtToAssetRate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getpttoassetrate "Direct link to getpttoassetrate") function getPtToAssetRate(address market, uint32 duration) external view returns (uint256); Returns the TWAP rate of PT denominated in the market's underlying **asset** (as defined by `SY.assetInfo()`). Applies the SY solvency adjustment. Returns exactly `1e18` after market expiry (PT redeems 1:1 for asset post-expiry). ### `getPtToSyRate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getpttosyrate "Direct link to getpttosyrate") function getPtToSyRate(address market, uint32 duration) external view returns (uint256); Returns the TWAP rate of PT denominated in **SY**. This is the natively-guaranteed exchange rate and the **recommended denomination for collateral pricing**. ### `getYtToAssetRate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getyttoassetrate "Direct link to getyttoassetrate") function getYtToAssetRate(address market, uint32 duration) external view returns (uint256); Returns the TWAP rate of YT in **asset** terms. Applies the SY solvency adjustment. Computed as `1 - getPtToAssetRateRaw`, then adjusted for solvency. note Post-expiry, `ptToAssetRate = 1`, so `ytToAssetRate = 0`. Pricing YT after expiry is not meaningful and the function will return `0`. ### `getYtToSyRate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getyttosyrate "Direct link to getyttosyrate") function getYtToSyRate(address market, uint32 duration) external view returns (uint256); Returns the TWAP rate of YT in **SY** terms. ### `getLpToAssetRate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getlptoassetrate "Direct link to getlptoassetrate") function getLpToAssetRate(address market, uint32 duration) external view returns (uint256); Returns the approximate TWAP rate of one LP token in **asset** terms, using the hypothetical-trade simulation. Applies the SY solvency adjustment. Reverts if called while the market is mid-transaction (reentrancy guard). ### `getLpToSyRate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getlptosyrate "Direct link to getlptosyrate") function getLpToSyRate(address market, uint32 duration) external view returns (uint256); Returns the approximate TWAP rate of one LP token in **SY** terms. * * * Public State Variables[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#public-state-variables "Direct link to Public State Variables") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### `blockCycleNumerator`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#blockcyclenumerator "Direct link to blockcyclenumerator") function blockCycleNumerator() external view returns (uint16); Encodes the average block time of the chain as `blockTime_seconds × 1000`. Used internally to compute the minimum ring-buffer cardinality for a given TWAP duration. Configured per deployment: | Chain | `blockCycleNumerator` | Effective block time | | --- | --- | --- | | Ethereum | `11000` | <12 s | | Arbitrum, Base, other fast chains | `1000` | ≤1 s (minimum granularity) | * * * Using the Oracle Libraries Directly[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#using-the-oracle-libraries-directly "Direct link to Using the Oracle Libraries Directly") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Two libraries expose the same rate functions as method calls on `IPMarket`: | Library | Functions | | --- | --- | | `PendlePYOracleLib` | `getPtToAssetRate`, `getPtToSyRate`, `getYtToAssetRate`, `getYtToSyRate` | | `PendleLpOracleLib` | `getLpToAssetRate`, `getLpToSyRate` | **Getting PT price in SY:** import {PendlePYOracleLib} from "@pendle/core-v2/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol";import {IPMarket} from "@pendle/core-v2/contracts/interfaces/IPMarket.sol";contract MyIntegration { using PendlePYOracleLib for IPMarket; function getPtPrice(address market, uint32 duration) external view returns (uint256) { return IPMarket(market).getPtToSyRate(duration); }} **Getting LP price in asset:** import {PendleLpOracleLib} from "@pendle/core-v2/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol";import {IPMarket} from "@pendle/core-v2/contracts/interfaces/IPMarket.sol";contract MyIntegration { using PendleLpOracleLib for IPMarket; function getLpPrice(address market, uint32 duration) external view returns (uint256) { return IPMarket(market).getLpToAssetRate(duration); }} **Source files**: * [`PendlePYOracleLib.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/PtYtLpOracle/PendlePYOracleLib.sol) * [`PendleLpOracleLib.sol`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/PtYtLpOracle/PendleLpOracleLib.sol) * * * Chainlink-Compatible Oracle Wrappers[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#chainlink-compatible-oracle-wrappers "Direct link to Chainlink-Compatible Oracle Wrappers") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- For protocols that consume prices via the standard `AggregatorV3Interface`, see [Chainlink-Compatible Oracle Wrappers](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/ChainlinkOracle) for full documentation on `PendleChainlinkOracle`, `PendleChainlinkOracleWithQuote`, and `PendleChainlinkOracleFactory`. * * * Integration Checklist[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#integration-checklist "Direct link to Integration Checklist") -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1. **Call `getOracleState`** for your chosen market and duration. Parse `increaseCardinalityRequired` and `oldestObservationSatisfied`. 2. **If cardinality is insufficient**, call `IPMarket(market).increaseObservationsCardinalityNext(cardinalityRequired)`. 3. **Wait at least `duration` seconds** after increasing cardinality (or if cardinality was already sufficient but `oldestObservationSatisfied == false`). 4. **Select a denomination**: * Prefer `ToSy` (e.g., `getPtToSyRate`) for maximum trustlessness. * Use `ToAsset` only if your protocol explicitly needs asset-unit pricing and you understand the SY-solvency risk. 5. **For LP collateral**, also implement reward redemption: call `IPMarket(market).redeemRewards(address)` to claim PENDLE incentives and any protocol reward tokens accrued to LP positions. * * * Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#further-reading "Direct link to Further Reading") -------------------------------------------------------------------------------------------------------------------------------------------------- * [How to Integrate PT and LP Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) — step-by-step integration guide with runnable examples * [Oracle Overview](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview) — TWAP math, cumulative rate derivation, and LP hypothetical-trade simulation methodology * [PT as Collateral — Risk Analysis](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral) * [LP as Collateral — Risk Analysis](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral) * [Deployments](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) — full list of deployed addresses per chain * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#overview) * [Oracle Architecture](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#oracle-architecture) * [TWAP Mechanism](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#twap-mechanism) * [LP Pricing](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#lp-pricing) * [SY Solvency Adjustment](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#sy-solvency-adjustment) * [Prerequisites: Oracle Initialization](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#prerequisites-oracle-initialization) * [Step 1 — Check oracle state](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#step-1--check-oracle-state) * [Step 2 — Increase cardinality (if required)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#step-2--increase-cardinality-if-required) * [Step 3 — Wait for data](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#step-3--wait-for-data) * [`getOracleState`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getoraclestate) * [Rate Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#rate-functions) * [`getPtToAssetRate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getpttoassetrate) * [`getPtToSyRate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getpttosyrate) * [`getYtToAssetRate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getyttoassetrate) * [`getYtToSyRate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getyttosyrate) * [`getLpToAssetRate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getlptoassetrate) * [`getLpToSyRate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#getlptosyrate) * [Public State Variables](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#public-state-variables) * [`blockCycleNumerator`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#blockcyclenumerator) * [Using the Oracle Libraries Directly](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#using-the-oracle-libraries-directly) * [Chainlink-Compatible Oracle Wrappers](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#chainlink-compatible-oracle-wrappers) * [Integration Checklist](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#integration-checklist) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Oracle Overview | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#__docusaurus_skipToContent_fallback) On this page Pendle offers two oracle types for pricing PT and LP tokens. For most new integrations, **the Linear Discount Oracle is the recommended choice** — it has been widely adopted by top Aave and Morpho curators including Gauntlet and Steakhouse due to its manipulation-resistant design and alignment with PT's guaranteed 1:1 redemption to underlying at maturity. The TWAP oracle remains available for integrations that require a market-derived price. Which oracle should I use?[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#which-oracle-should-i-use "Direct link to Which oracle should I use?") ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Oracle type | Status | Best for | Docs | | --- | --- | --- | --- | | **Deterministic (Linear Discount)** | ✅ **Recommended** | Money markets, lending protocols, collateral pricing | [LinearDiscountOracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle)
· [LP variant](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle)
· [Choosing params](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) | | TWAP PT/LP Oracle | Available | Integrations requiring a live market-derived price | [HowToIntegratePtAndLpOracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) | Why the Linear Discount Oracle is recommended[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#why-the-linear-discount-oracle-is-recommended "Direct link to Why the Linear Discount Oracle is recommended") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- PT is **guaranteed to redeem 1:1 to its underlying asset at maturity**. This hard floor means a linear discount model — which prices PT as a fraction that converges to 1.0 at expiry — is fundamentally sound and tightly tracks fair value. In contrast, TWAP oracles derive price from AMM activity, which introduces AMM manipulation surface and requires careful initialization and liquidity depth assessment. The Linear Discount Oracle has no external dependencies during reads (`block.timestamp` only), making it liveness-risk-free and manipulation-resistant. This is why it has become the oracle of choice for top risk curators integrating PT across Aave and Morpho markets. About the PT Oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#about-the-pt-oracle "Direct link to About the PT Oracle") --------------------------------------------------------------------------------------------------------------------------------------------------------- In the Pendle system, PTPTPT can be freely traded from and to SYSYSY utilizing our AMM. With the built-in TWAP oracle library, the geometric mean price of PTPTPT in terms of SY or asset can be derived from our `PendleMarket` contracts fully on-chain. Please refer to the [StandardizedYield doc](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/StandardizedYield) for more details of SY & asset. ### Oracle design[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#oracle-design "Direct link to Oracle design") Pendle's oracle implementation is inspired by the idea of the UniswapV3 Oracle (see [here](https://docs.uniswap.org/concepts/protocol/oracle) ) with a slight difference in how we define the cumulative rate. In short, our oracle stores the cumulative logarithm of implied APY (the interest rate implied by PT/assetPT/assetPT/asset pricing). From the cumulative logarithm of Implied APY, we can calculate the geometric mean of Implied APY, which will be used to derive the mean PTPTPT price. In a way, the Pendle AMM contract has a built-in oracle of interest rate, which can be used to derive PTPTPT prices. ### Formulas[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#formulas "Direct link to Formulas") Our oracle storage is in the following form: struct Observation { // the block timestamp of the observation uint32 blockTimestamp; // the tick logarithm accumulator, i.e., ln(impliedRate) * time elapsed since the pool was first initialized uint216 lnImpliedRateCumulative; // whether or not the observation is initialized bool initialized;} The geometric mean price of PTPTPT for the time interval of \[t0,t1\]\[t\_0, t\_1\]\[t0​,t1​\] is: lnImpliedRate\=lnImpliedRateCumulative1−lnImpliedRateCumulative0t1−t0lnImpliedRate = \\frac{lnImpliedRateCumulative\_1 - lnImpliedRateCumulative\_0}{t\_1 - t\_0}lnImpliedRate\=t1​−t0​lnImpliedRateCumulative1​−lnImpliedRateCumulative0​​ impliedRate\=elnImpliedRateimpliedRate = e^{lnImpliedRate}impliedRate\=elnImpliedRate assetToPtPrice\=impliedRatetimeToMaturityoneYearassetToPtPrice = impliedRate^{\\frac{timeToMaturity}{oneYear}}assetToPtPrice\=impliedRateoneYeartimeToMaturity​ ptToAssetPrice\=1/assetToPtPriceptToAssetPrice = 1 / assetToPtPriceptToAssetPrice\=1/assetToPtPrice See [How to Integrate](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) for a step-by-step guide. About the LP Oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#about-the-lp-oracle "Direct link to About the LP Oracle") --------------------------------------------------------------------------------------------------------------------------------------------------------- Pendle's LP token represents a user's share in Pendle AMM which pairs up PT and SY. SY is the interest-bearing token wrapper which enables depositing from and redeeming from underlying asset with no additional fee or price impact. PT can be traded to and from SY/underlying asset using our AMM, with a built-in geometric mean pricing module. LP oracle returns the estimated TWAP exchange rate between LP token and underlying asset. Our approach for LP pricing is to simulate a hypothetical trade on the AMM so that its PT spot price (and the implied rate) matches PT price (and the implied rate) from PT oracle before using market state to calculate LP price. For example: * The 1hr TWAP PT price is 0.90 asset. * The current state of the market is (x PT, y SY), where PT price is 0.92 asset * We calculate a hypothetical, zero-fee swap that brings PT price to 0.90 asset, to reach a state of (x' PT, y' SY) * We calculate the estimated TWAP LP token price based on the hypothetical state (x' PT, y' SY) and PT price of 0.90 asset Detailed documentation on the math for this approach can be found [here](https://github.com/pendle-finance/pendle-v2-resources/blob/main/docs/LP_Oracle_Doc.pdf) . See [How to Integrate](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) for a step-by-step guide. Recommended reading order[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#recommended-reading-order "Direct link to Recommended reading order") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### If using the Linear Discount Oracle (recommended)[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#if-using-the-linear-discount-oracle-recommended "Direct link to If using the Linear Discount Oracle (recommended)") 1. This page — understand which oracle type fits your use case 2. [Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle) — how the oracle works and how to deploy it 3. [Choosing Linear Discount Parameters](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/ChoosingLinearDiscountParams) — how to select the right discount rate 4. If pricing LP tokens: [LP Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LPLinearDiscountOracle) 5. If using as collateral: [PT as Collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral) or [LP as Collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral) ### If using the TWAP Oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#if-using-the-twap-oracle "Direct link to If using the TWAP Oracle") 1. This page — understand which oracle type fits your use case 2. [How to Integrate PT and LP Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) — hands-on TWAP integration with code 3. [PT Sanity Checks](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTSanityChecks) — validate your integration before going live 4. If using as collateral: [PT as Collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral) or [LP as Collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral) * [Which oracle should I use?](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#which-oracle-should-i-use) * [Why the Linear Discount Oracle is recommended](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#why-the-linear-discount-oracle-is-recommended) * [About the PT Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#about-the-pt-oracle) * [Oracle design](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#oracle-design) * [Formulas](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#formulas) * [About the LP Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#about-the-lp-oracle) * [Recommended reading order](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#recommended-reading-order) * [If using the Linear Discount Oracle (recommended)](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#if-using-the-linear-discount-oracle-recommended) * [If using the TWAP Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#if-using-the-twap-oracle) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Swap Simulation Functions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#__docusaurus_skipToContent_fallback) On this page These functions come from the `IPActionMarketCoreStatic` facet. Each function simulates the corresponding Router swap and returns expected outputs, fee, price impact, and the exchange rate after the trade. Common return fields: | Field | Description | | --- | --- | | `netSyFee` | Fee deducted from the trade, expressed in SY (18 decimals) | | `priceImpact` | Price impact as an 18-decimal fraction (e.g. `1e16` = 1%) | | `exchangeRateAfter` | PT/SY exchange rate after the trade (18 decimals) | * * * PT Swaps (Exact In)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#pt-swaps-exact-in "Direct link to PT Swaps (Exact In)") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapExactPtForSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactptforsystatic "Direct link to swapExactPtForSyStatic") Simulates selling an exact amount of PT for SY. function swapExactPtForSyStatic(address market, uint256 exactPtIn) external view returns (uint256 netSyOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactPtIn | `uint256` | Exact PT amount to sell | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY received | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * ### swapExactPtForTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactptfortokenstatic "Direct link to swapExactPtForTokenStatic") Simulates selling an exact amount of PT for an arbitrary token. function swapExactPtForTokenStatic(address market, uint256 exactPtIn, address tokenOut) external view returns ( uint256 netTokenOut, uint256 netSyToRedeem, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactPtIn | `uint256` | Exact PT amount to sell | | tokenOut | `address` | Desired output token address | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Token received | | netSyToRedeem | `uint256` | SY redeemed to produce the token output | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * ### swapExactPtForYtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactptforytstatic "Direct link to swapExactPtForYtStatic") Simulates swapping an exact amount of PT for YT (leverage/deleverage operation). function swapExactPtForYtStatic(address market, uint256 exactPtIn) external view returns ( uint256 netYtOut, uint256 totalPtToSwap, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactPtIn | `uint256` | Exact PT amount to swap | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtOut | `uint256` | YT received | | totalPtToSwap | `uint256` | Total PT routed through the market (including flash-swap leg) | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * SY / Token Swaps (Exact In, PT Out)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#sy--token-swaps-exact-in-pt-out "Direct link to SY / Token Swaps (Exact In, PT Out)") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapExactSyForPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactsyforptstatic "Direct link to swapExactSyForPtStatic") Simulates buying PT with an exact amount of SY. function swapExactSyForPtStatic(address market, uint256 exactSyIn) external view returns (uint256 netPtOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactSyIn | `uint256` | Exact SY amount to spend | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT received | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | > For generating `ApproxParams` automatically, use [`swapExactSyForPtStaticAndGenerateApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#swapexactsyforptstaticanddgenerateapproxparams) > instead. * * * ### swapExactTokenForPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexacttokenforptstatic "Direct link to swapExactTokenForPtStatic") Simulates buying PT with an exact amount of an arbitrary token. function swapExactTokenForPtStatic(address market, address tokenIn, uint256 amountTokenIn) external view returns ( uint256 netPtOut, uint256 netSyMinted, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | tokenIn | `address` | Input token address | | amountTokenIn | `uint256` | Exact token amount to spend | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT received | | netSyMinted | `uint256` | SY minted from the input token | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | > For generating `ApproxParams` automatically, use [`swapExactTokenForPtStaticAndGenerateApproxParams`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/RateFunctions#swapexacttokenforptstaticanddgenerateapproxparams) > instead. * * * YT Swaps (Exact In)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#yt-swaps-exact-in "Direct link to YT Swaps (Exact In)") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### swapExactSyForYtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactsyforytstatic "Direct link to swapExactSyForYtStatic") Simulates buying YT with an exact amount of SY. function swapExactSyForYtStatic(address market, uint256 exactSyIn) external view returns (uint256 netYtOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactSyIn | `uint256` | Exact SY amount to spend | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtOut | `uint256` | YT received | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * ### swapExactTokenForYtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexacttokenforytstatic "Direct link to swapExactTokenForYtStatic") Simulates buying YT with an exact amount of an arbitrary token. function swapExactTokenForYtStatic(address market, address tokenIn, uint256 amountTokenIn) external view returns ( uint256 netYtOut, uint256 netSyMinted, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | tokenIn | `address` | Input token address | | amountTokenIn | `uint256` | Exact token amount to spend | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtOut | `uint256` | YT received | | netSyMinted | `uint256` | SY minted from the input token | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * ### swapExactYtForSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactytforsystatic "Direct link to swapExactYtForSyStatic") Simulates selling an exact amount of YT for SY. YT selling involves flash-swapping PT to repay accrued interest. function swapExactYtForSyStatic(address market, uint256 exactYtIn) external view returns ( uint256 netSyOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyOwedInt, uint256 netPYToRepaySyOwedInt, uint256 netPYToRedeemSyOutInt ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactYtIn | `uint256` | Exact YT amount to sell | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyOut | `uint256` | SY received after repaying interest | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | | netSyOwedInt | `uint256` | SY owed as interest that must be repaid | | netPYToRepaySyOwedInt | `uint256` | PY units used to repay the interest obligation | | netPYToRedeemSyOutInt | `uint256` | PY units redeemed to produce final SY output | * * * ### swapExactYtForTokenStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactytfortokenstatic "Direct link to swapExactYtForTokenStatic") Simulates selling an exact amount of YT for an arbitrary token. function swapExactYtForTokenStatic(address market, uint256 exactYtIn, address tokenOut) external view returns ( uint256 netTokenOut, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyOut, uint256 netSyOwedInt, uint256 netPYToRepaySyOwedInt, uint256 netPYToRedeemSyOutInt ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactYtIn | `uint256` | Exact YT amount to sell | | tokenOut | `address` | Desired output token address | **Return Values** | Name | Type | Description | | --- | --- | --- | | netTokenOut | `uint256` | Token received | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | | netSyOut | `uint256` | Intermediate SY before token redemption | | netSyOwedInt | `uint256` | SY owed as interest | | netPYToRepaySyOwedInt | `uint256` | PY units used to repay the interest obligation | | netPYToRedeemSyOutInt | `uint256` | PY units redeemed to produce final output | * * * ### swapExactYtForPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactytforptstatic "Direct link to swapExactYtForPtStatic") Simulates swapping an exact amount of YT for PT (leverage/deleverage operation). function swapExactYtForPtStatic(address market, uint256 exactYtIn) external view returns ( uint256 netPtOut, uint256 totalPtSwapped, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactYtIn | `uint256` | Exact YT amount to swap | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtOut | `uint256` | PT received | | totalPtSwapped | `uint256` | Total PT routed through the market | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * Exact-Out Swaps (Inverse)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#exact-out-swaps-inverse "Direct link to Exact-Out Swaps (Inverse)") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- These functions let you specify the desired output amount and compute the required input. ### swapPtForExactSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapptforexactsystatic "Direct link to swapPtForExactSyStatic") Simulates selling PT to receive an exact amount of SY. function swapPtForExactSyStatic(address market, uint256 exactSyOut) external view returns (uint256 netPtIn, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactSyOut | `uint256` | Exact SY amount desired | **Return Values** | Name | Type | Description | | --- | --- | --- | | netPtIn | `uint256` | PT required | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * ### swapSyForExactPtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapsyforexactptstatic "Direct link to swapSyForExactPtStatic") Simulates buying an exact amount of PT with SY. function swapSyForExactPtStatic(address market, uint256 exactPtOut) external view returns (uint256 netSyIn, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactPtOut | `uint256` | Exact PT amount desired | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyIn | `uint256` | SY required | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * ### swapSyForExactYtStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapsyforexactytstatic "Direct link to swapSyForExactYtStatic") Simulates buying an exact amount of YT with SY. Includes the internal interest accounting fields. function swapSyForExactYtStatic(address market, uint256 exactYtOut) external view returns ( uint256 netSyIn, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter, uint256 netSyReceivedInt, uint256 totalSyNeedInt ) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactYtOut | `uint256` | Exact YT amount desired | **Return Values** | Name | Type | Description | | --- | --- | --- | | netSyIn | `uint256` | SY required from the user | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | | netSyReceivedInt | `uint256` | SY received from the internal flash-swap leg | | totalSyNeedInt | `uint256` | Total SY needed for minting PT+YT in the flash-swap | * * * ### swapYtForExactSyStatic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapytforexactsystatic "Direct link to swapYtForExactSyStatic") Simulates selling YT to receive an exact amount of SY. function swapYtForExactSyStatic(address market, uint256 exactSyOut) external view returns (uint256 netYtIn, uint256 netSyFee, uint256 priceImpact, uint256 exchangeRateAfter) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | | exactSyOut | `uint256` | Exact SY amount desired | **Return Values** | Name | Type | Description | | --- | --- | --- | | netYtIn | `uint256` | YT required | | netSyFee | `uint256` | Fee in SY | | priceImpact | `uint256` | Price impact | | exchangeRateAfter | `uint256` | Exchange rate after trade | * * * Market State[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#market-state "Direct link to Market State") --------------------------------------------------------------------------------------------------------------------------------------------------------------- ### readMarketState[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#readmarketstate "Direct link to readMarketState") Returns the raw `MarketState` struct for a given market. function readMarketState(address market) external view returns (MarketState memory) **Parameters** | Name | Type | Description | | --- | --- | --- | | market | `address` | Pendle market address | **Return Values** | Type | Description | | --- | --- | | `MarketState` | Full AMM state (see [PendleMarket](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/PendleMarket)
for field details) | **Use Case** Use to pass a pre-fetched `MarketState` into `getTradeExchangeRateExcludeFee` or other functions that accept it as a parameter, avoiding redundant on-chain reads. * * * Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#examples "Direct link to Examples") --------------------------------------------------------------------------------------------------------------------------------------------------- Recommended: Use the Pendle API The examples below show direct RouterStatic usage. For most integrations, the [Pendle Hosted SDK / API](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) is the better choice — it handles approximation, limit-order filling, and zap routing automatically. ### Sell PT — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#sell-pt--simulate-then-execute "Direct link to Sell PT — simulate then execute") const ptAmount = ethers.parseEther("100");// 1. Simulateconst [netTokenOut, , , priceImpact, exchangeRateAfter] = await routerStatic.swapExactPtForTokenStatic(MARKET_ADDRESS, ptAmount, WSTETH_ADDRESS);console.log(`Receive: ${ethers.formatEther(netTokenOut)} wstETH`);console.log(`Price impact: ${ethers.formatEther(priceImpact * 100n)}%`);console.log(`Rate after: ${ethers.formatEther(exchangeRateAfter)}`);// 2. Executeawait IERC20(PT_ADDRESS).approve(ROUTER_ADDRESS, ptAmount);await router.swapExactPtForToken( signer.address, MARKET_ADDRESS, ptAmount, createTokenOutputStruct(WSTETH_ADDRESS, (netTokenOut * 995n) / 1000n), // 0.5% slippage emptyLimitOrderData); ### Sell YT — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#sell-yt--simulate-then-execute "Direct link to Sell YT — simulate then execute") const ytAmount = ethers.parseEther("50");// 1. Simulate (note: YT selling involves flash-swap interest repayment internals)const [netTokenOut, , priceImpact, , , netSyOwedInt] = await routerStatic.swapExactYtForTokenStatic(MARKET_ADDRESS, ytAmount, WSTETH_ADDRESS);console.log(`Receive: ${ethers.formatEther(netTokenOut)} wstETH`);console.log(`Interest repaid in swap: ${ethers.formatEther(netSyOwedInt)} SY`);// 2. Executeawait IERC20(YT_ADDRESS).approve(ROUTER_ADDRESS, ytAmount);await router.swapExactYtForToken( signer.address, MARKET_ADDRESS, ytAmount, createTokenOutputStruct(WSTETH_ADDRESS, (netTokenOut * 995n) / 1000n), emptyLimitOrderData); ### PT↔YT swap — simulate then execute[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#ptyt-swap--simulate-then-execute "Direct link to PT↔YT swap — simulate then execute") Swapping PT for YT (or YT for PT) changes your yield exposure direction without unwinding to the underlying asset. const ptAmount = ethers.parseEther("10");// 1. Simulate PT → YTconst [netYtOut, totalPtToSwap, , priceImpact] = await routerStatic.swapExactPtForYtStatic(MARKET_ADDRESS, ptAmount);console.log(`YT out: ${ethers.formatEther(netYtOut)}`);console.log(`Total PT routed (incl. flash leg): ${ethers.formatEther(totalPtToSwap)}`);// 2. Executeawait IERC20(PT_ADDRESS).approve(ROUTER_ADDRESS, ptAmount);await router.swapExactPtForYt( signer.address, MARKET_ADDRESS, ptAmount, (netYtOut * 995n) / 1000n, // minYtOut defaultApproxParams); ### Exact-out: buy a precise SY amount[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#exact-out-buy-a-precise-sy-amount "Direct link to Exact-out: buy a precise SY amount") Use `swapPtForExactSyStatic` when you need a known SY amount (e.g. to meet a downstream obligation). const exactSyNeeded = ethers.parseEther("1.5");// 1. Simulate — how much PT to sell?const [netPtIn, , priceImpact] = await routerStatic.swapPtForExactSyStatic(MARKET_ADDRESS, exactSyNeeded);console.log(`PT required: ${ethers.formatEther(netPtIn)}`);// Apply slippage on the input side (accept up to 0.5% more PT in)const maxPtIn = (netPtIn * 1005n) / 1000n;// 2. Executeawait IERC20(PT_ADDRESS).approve(ROUTER_ADDRESS, maxPtIn);await router.swapPtForExactSy( signer.address, MARKET_ADDRESS, exactSyNeeded, maxPtIn, emptyLimitOrderData); * [PT Swaps (Exact In)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#pt-swaps-exact-in) * [swapExactPtForSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactptforsystatic) * [swapExactPtForTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactptfortokenstatic) * [swapExactPtForYtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactptforytstatic) * [SY / Token Swaps (Exact In, PT Out)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#sy--token-swaps-exact-in-pt-out) * [swapExactSyForPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactsyforptstatic) * [swapExactTokenForPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexacttokenforptstatic) * [YT Swaps (Exact In)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#yt-swaps-exact-in) * [swapExactSyForYtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactsyforytstatic) * [swapExactTokenForYtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexacttokenforytstatic) * [swapExactYtForSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactytforsystatic) * [swapExactYtForTokenStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactytfortokenstatic) * [swapExactYtForPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapexactytforptstatic) * [Exact-Out Swaps (Inverse)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#exact-out-swaps-inverse) * [swapPtForExactSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapptforexactsystatic) * [swapSyForExactPtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapsyforexactptstatic) * [swapSyForExactYtStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapsyforexactytstatic) * [swapYtForExactSyStatic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#swapytforexactsystatic) * [Market State](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#market-state) * [readMarketState](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#readmarketstate) * [Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#examples) * [Sell PT — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#sell-pt--simulate-then-execute) * [Sell YT — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#sell-yt--simulate-then-execute) * [PT↔YT swap — simulate then execute](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#ptyt-swap--simulate-then-execute) * [Exact-out: buy a precise SY amount](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/ApiReference/SwapFunctions#exact-out-buy-a-precise-sy-amount) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # RouterStatic Overview | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#__docusaurus_skipToContent_fallback) On this page **Interface:** [`IPRouterStatic`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IPRouterStatic.sol) info RouterStatic is designed for **off-chain simulation only** and should not be used for fund-sensitive or on-chain transactions. If you need to call any of these functions on-chain, please contact the Pendle team. Recommended: Use the Pendle API For most integrations, the [Pendle Hosted SDK / API](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) is the better choice. It handles off-chain approximation, limit-order filling, and multi-DEX zap routing automatically — all things RouterStatic cannot do. Use RouterStatic directly only when you need fully on-chain quote generation without any external API dependency. Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#overview "Direct link to Overview") --------------------------------------------------------------------------------------------------------------------------------------------- RouterStatic is a read-only contract that mirrors every swap, liquidity, mint/redeem, and user-info operation exposed by the live [PendleRouter](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview) . Its purpose is pre-flight simulation: call a `*Static` function off-chain to get expected outputs, price impact, and exchange rates, then use those results to set `minOut` / `ApproxParams` before submitting the real transaction. RouterStatic is a multi-facet proxy ([ERC-2535 Diamond Standard](https://eips.ethereum.org/EIPS/eip-2535) ). Use the ABI of `IPRouterStatic` to interact with it — the proxy resolves each call to the correct facet automatically. Deployment addresses are listed on the [Deployments](https://docs.pendle.finance/pendle-v2/Developers/Deployments) page. Interface Facets[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#interface-facets "Direct link to Interface Facets") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Interface | Purpose | | --- | --- | | `IPActionInfoStatic` | User & position info | | `IPActionMarketAuxStatic` | Market rates, state, price impact, ApproxParams helpers | | `IPActionMarketCoreStatic` | Swap + liquidity simulations | | `IPActionMintRedeemStatic` | Mint/redeem simulations + pyIndex views | | `IPActionStorageStatic` | Default ApproxParams storage | | `IPActionVePendleStatic` | vePENDLE-related views | Return Types[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#return-types "Direct link to Return Types") --------------------------------------------------------------------------------------------------------------------------------------------------------- ### TokenAmount[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#tokenamount "Direct link to TokenAmount") struct TokenAmount { address token; uint256 amount;} A generic token–amount pair used throughout info functions. ### UserSYInfo[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#usersyinfo "Direct link to UserSYInfo") struct UserSYInfo { TokenAmount syBalance; TokenAmount[] unclaimedRewards;} Returned by `getUserSYInfo`. Contains the user's SY balance and any unclaimed reward tokens. ### UserPYInfo[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#userpyinfo "Direct link to UserPYInfo") struct UserPYInfo { TokenAmount ptBalance; TokenAmount ytBalance; TokenAmount unclaimedInterest; TokenAmount[] unclaimedRewards;} Returned by `getUserPYInfo`. Contains PT/YT balances, accrued interest, and unclaimed rewards. ### UserMarketInfo[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#usermarketinfo "Direct link to UserMarketInfo") struct UserMarketInfo { TokenAmount lpBalance; TokenAmount ptBalance; TokenAmount syBalance; TokenAmount[] unclaimedRewards;} Returned by `getUserMarketInfo`. Contains LP balance, the underlying PT and SY value of that LP, and unclaimed LP rewards. ### MarketState[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#marketstate "Direct link to MarketState") `MarketState` is the low-level AMM state struct returned by `getMarketState` and `readMarketState`. See [PendleMarket](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/PendleMarket) for field-level documentation. ### ApproxParams[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#approxparams "Direct link to ApproxParams") `ApproxParams` is used by the live Router for binary-search approximation. The `swapExact*StaticAndGenerateApproxParams` helpers construct a ready-to-use `ApproxParams` struct. See [Types](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types#approxparams) for field documentation. * * * Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#integration-examples "Direct link to Integration Examples") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- RouterStatic always follows the same two-step pattern: 1. Call a `*Static` function (off-chain, `eth_call`) to get expected amounts and parameters. 2. Pass those results into the corresponding Router function as `minOut` and/or `ApproxParams`. The examples below use ethers.js v6. Addresses and amounts are illustrative. ### Setup[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#setup "Direct link to Setup") import { ethers } from "ethers";const provider = new ethers.JsonRpcProvider(RPC_URL);const signer = new ethers.Wallet(PRIVATE_KEY, provider);// Use IPRouterStatic ABI for RouterStatic — the Diamond proxy resolves all facetsconst routerStatic = new ethers.Contract(ROUTER_STATIC_ADDRESS, IPRouterStaticABI, provider);// Use IPAllActionV3 ABI for the live Routerconst router = new ethers.Contract(ROUTER_ADDRESS, IPAllActionV3ABI, signer);const SLIPPAGE = ethers.parseEther("0.005"); // 0.5%function applySlippage(amount: bigint): bigint { return (amount * 995n) / 1000n; // 0.5% slippage} * * * ### Buy PT with Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#buy-pt-with-token "Direct link to Buy PT with Token") `swapExactTokenForPtStaticAndGenerateApproxParams` is the recommended way to preflight this trade — it returns `ApproxParams` ready to pass to the Router, which eliminates the need to tune the binary-search parameters manually. const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");// 1. Simulate and get ApproxParamsconst [netPtOut, , , priceImpact, , approxParams] = await routerStatic.swapExactTokenForPtStaticAndGenerateApproxParams( MARKET_ADDRESS, tokenIn, amountIn, SLIPPAGE );console.log(`Expected PT out: ${ethers.formatEther(netPtOut)}`);console.log(`Price impact: ${ethers.formatEther(priceImpact * 100n)}%`);// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.swapExactTokenForPt( signer.address, // receiver MARKET_ADDRESS, applySlippage(netPtOut), // minPtOut approxParams, // from RouterStatic createTokenInputStruct(tokenIn, amountIn), emptyLimitOrderData); * * * ### Sell PT for Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#sell-pt-for-token "Direct link to Sell PT for Token") No `ApproxParams` needed — selling PT is an exact-out AMM operation. const tokenOut = WSTETH_ADDRESS;const ptAmount = ethers.parseEther("1");// 1. Simulateconst [netTokenOut, , , priceImpact] = await routerStatic.swapExactPtForTokenStatic( MARKET_ADDRESS, ptAmount, tokenOut );console.log(`Expected token out: ${ethers.formatEther(netTokenOut)}`);// 2. Executeawait IERC20(PT_ADDRESS).approve(ROUTER_ADDRESS, ptAmount);await router.swapExactPtForToken( signer.address, MARKET_ADDRESS, ptAmount, createTokenOutputStruct(tokenOut, applySlippage(netTokenOut)), // minTokenOut baked in emptyLimitOrderData); * * * ### Buy YT with Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#buy-yt-with-token "Direct link to Buy YT with Token") YT buying also requires `ApproxParams`. Use `swapExactSyForPtStaticAndGenerateApproxParams` (after minting SY first) or simply use `swapExactSyForYtStatic` to check the trade, then supply `defaultApproxParams` to the Router. const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("0.1");// 1. Simulate YT out (no ApproxParams helper for YT — use defaultApprox on Router)const [netYtOut, , priceImpact] = await routerStatic.swapExactTokenForYtStatic( MARKET_ADDRESS, tokenIn, amountIn );console.log(`Expected YT out: ${ethers.formatEther(netYtOut)}`);console.log(`Price impact: ${ethers.formatEther(priceImpact * 100n)}%`);// Reject if price impact is too highif (priceImpact > ethers.parseEther("0.02")) { // > 2% throw new Error("Price impact too high");}// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.swapExactTokenForYt( signer.address, MARKET_ADDRESS, applySlippage(netYtOut), // minYtOut defaultApproxParams, createTokenInputStruct(tokenIn, amountIn), emptyLimitOrderData); * * * ### Sell YT for Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#sell-yt-for-token "Direct link to Sell YT for Token") const tokenOut = WSTETH_ADDRESS;const ytAmount = ethers.parseEther("10");// 1. Simulateconst [netTokenOut, , priceImpact] = await routerStatic.swapExactYtForTokenStatic( MARKET_ADDRESS, ytAmount, tokenOut );console.log(`Expected token out: ${ethers.formatEther(netTokenOut)}`);// 2. Executeawait IERC20(YT_ADDRESS).approve(ROUTER_ADDRESS, ytAmount);await router.swapExactYtForToken( signer.address, MARKET_ADDRESS, ytAmount, createTokenOutputStruct(tokenOut, applySlippage(netTokenOut)), emptyLimitOrderData); * * * ### Add Liquidity (Single Token)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#add-liquidity-single-token "Direct link to Add Liquidity (Single Token)") const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");// 1. Simulateconst [netLpOut, , , priceImpact] = await routerStatic.addLiquiditySingleTokenStatic( MARKET_ADDRESS, tokenIn, amountIn );console.log(`Expected LP out: ${ethers.formatEther(netLpOut)}`);// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.addLiquiditySingleToken( signer.address, MARKET_ADDRESS, applySlippage(netLpOut), // minLpOut defaultApproxParams, createTokenInputStruct(tokenIn, amountIn), emptyLimitOrderData); * * * ### Add Liquidity and Keep YT[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#add-liquidity-and-keep-yt "Direct link to Add Liquidity and Keep YT") This operation splits your token into LP + YT. RouterStatic lets you preview both outputs. const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");// 1. Simulateconst [netLpOut, netYtOut, netSyMinted, netSyToPY] = await routerStatic.addLiquiditySingleTokenKeepYtStatic( MARKET_ADDRESS, tokenIn, amountIn );console.log(`Expected LP out: ${ethers.formatEther(netLpOut)}`);console.log(`Expected YT out: ${ethers.formatEther(netYtOut)}`);// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.addLiquiditySingleTokenKeepYt( signer.address, MARKET_ADDRESS, applySlippage(netLpOut), // minLpOut applySlippage(netYtOut), // minYtOut createTokenInputStruct(tokenIn, amountIn) // note: no limit order parameter for KeepYt variant); * * * ### Remove Liquidity (Single Token)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#remove-liquidity-single-token "Direct link to Remove Liquidity (Single Token)") const tokenOut = WSTETH_ADDRESS;const lpAmount = ethers.parseEther("0.5");// 1. Simulateconst [netTokenOut, , priceImpact] = await routerStatic.removeLiquiditySingleTokenStatic( MARKET_ADDRESS, lpAmount, tokenOut );console.log(`Expected token out: ${ethers.formatEther(netTokenOut)}`);// 2. Executeawait IERC20(MARKET_ADDRESS).approve(ROUTER_ADDRESS, lpAmount);await router.removeLiquiditySingleToken( signer.address, MARKET_ADDRESS, lpAmount, createTokenOutputStruct(tokenOut, applySlippage(netTokenOut)), emptyLimitOrderData); * * * ### Mint PT & YT from Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#mint-pt--yt-from-token "Direct link to Mint PT & YT from Token") const tokenIn = WSTETH_ADDRESS;const amountIn = ethers.parseEther("1");// 1. Simulateconst netPyOut = await routerStatic.mintPyFromTokenStatic( YT_ADDRESS, tokenIn, amountIn);console.log(`Expected PT+YT out: ${ethers.formatEther(netPyOut)} each`);// 2. Executeawait IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn);await router.mintPyFromToken( signer.address, YT_ADDRESS, applySlippage(netPyOut), // minPyOut createTokenInputStruct(tokenIn, amountIn)); * * * ### Redeem PT & YT to Token[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#redeem-pt--yt-to-token "Direct link to Redeem PT & YT to Token") const tokenOut = WSTETH_ADDRESS;const pyAmount = ethers.parseEther("1");// 1. Simulateconst netTokenOut = await routerStatic.redeemPyToTokenStatic( YT_ADDRESS, pyAmount, tokenOut);console.log(`Expected token out: ${ethers.formatEther(netTokenOut)}`);// 2. Executeawait IERC20(PT_ADDRESS).approve(ROUTER_ADDRESS, pyAmount);await IERC20(YT_ADDRESS).approve(ROUTER_ADDRESS, pyAmount);await router.redeemPyToToken( signer.address, YT_ADDRESS, pyAmount, createTokenOutputStruct(tokenOut, applySlippage(netTokenOut))); * * * ### Price Impact Guard[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#price-impact-guard "Direct link to Price Impact Guard") Use RouterStatic to reject trades that exceed a price impact threshold before ever building a transaction. const MAX_PRICE_IMPACT = ethers.parseEther("0.01"); // 1%async function safeBuyPt(market: string, tokenIn: string, amountIn: bigint) { const [netPtOut, , , priceImpact, , approxParams] = await routerStatic.swapExactTokenForPtStaticAndGenerateApproxParams( market, tokenIn, amountIn, SLIPPAGE ); if (priceImpact > MAX_PRICE_IMPACT) { throw new Error(`Price impact ${ethers.formatEther(priceImpact * 100n)}% exceeds limit`); } await IERC20(tokenIn).approve(ROUTER_ADDRESS, amountIn); return router.swapExactTokenForPt( signer.address, market, applySlippage(netPtOut), approxParams, createTokenInputStruct(tokenIn, amountIn), emptyLimitOrderData );} * * * ### Check Pending Rewards Before Claiming[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#check-pending-rewards-before-claiming "Direct link to Check Pending Rewards Before Claiming") // 1. Preview rewards without writing stateconst marketInfo = await routerStatic.getUserMarketInfo(MARKET_ADDRESS, userAddress);for (const reward of marketInfo.unclaimedRewards) { console.log(`Reward token: ${reward.token}, amount: ${ethers.formatEther(reward.amount)}`);}// Only claim if there's something worth the gasconst totalRewardValue = await estimateRewardValue(marketInfo.unclaimedRewards);if (totalRewardValue > MIN_CLAIM_THRESHOLD) { await router.redeemDueInterestAndRewards( userAddress, [], // SY addresses [], // YT addresses [MARKET_ADDRESS] );} > **Note:** RouterStatic functions must be called with `eth_call` (read-only). Never submit them as state-changing transactions. * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#overview) * [Interface Facets](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#interface-facets) * [Return Types](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#return-types) * [TokenAmount](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#tokenamount) * [UserSYInfo](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#usersyinfo) * [UserPYInfo](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#userpyinfo) * [UserMarketInfo](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#usermarketinfo) * [MarketState](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#marketstate) * [ApproxParams](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#approxparams) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#integration-examples) * [Setup](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#setup) * [Buy PT with Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#buy-pt-with-token) * [Sell PT for Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#sell-pt-for-token) * [Buy YT with Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#buy-yt-with-token) * [Sell YT for Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#sell-yt-for-token) * [Add Liquidity (Single Token)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#add-liquidity-single-token) * [Add Liquidity and Keep YT](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#add-liquidity-and-keep-yt) * [Remove Liquidity (Single Token)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#remove-liquidity-single-token) * [Mint PT & YT from Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#mint-pt--yt-from-token) * [Redeem PT & YT to Token](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#redeem-pt--yt-to-token) * [Price Impact Guard](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#price-impact-guard) * [Check Pending Rewards Before Claiming](https://docs.pendle.finance/pendle-v2/Developers/Contracts/RouterStatic/RouterStaticOverview#check-pending-rewards-before-claiming) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Overview | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Overview#__docusaurus_skipToContent_fallback) On this page Stay Connected[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#stay-connected "Direct link to Stay Connected") ---------------------------------------------------------------------------------------------------------------------------- **Important:** Stay up to date with the latest developer updates and get support from our team: * **Telegram**: Join [t.me/pendledevelopers](https://t.me/pendledevelopers) for all development updates, API changes, and important announcements * **Telegram bot**: We have a Telegram bot for developers to ask about the API at [t.me/peepo\_the\_engineer\_bot](https://t.me/peepo_the_engineer_bot) * **Discord**: Get technical support on our [Discord Developer Channel](https://pendle.finance/discord) with responses within 24 hours For AI users[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#for-ai-users "Direct link to For AI users") ---------------------------------------------------------------------------------------------------------------------- * As many of us increasingly rely on AI tools to read and understand project documentation, we’ve added a new folder to the repository: [docs/Developers](https://github.com/pendle-finance/documentation/tree/master/docs/Developers) . It contains a list of questions and answers about our system and our API, useful for AI to better understand our system and provide more accurate answers when you query them. Our in-house AI is also using these knowledge bases! * Follow the instructions in [README.md](https://github.com/pendle-finance/documentation/tree/master?tab=readme-ov-file#ai-knowledge-bases) to index the knowledge bases for your AI. What do you want to do?[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#what-do-you-want-to-do "Direct link to What do you want to do?") ------------------------------------------------------------------------------------------------------------------------------------------------------ | Goal | Start here | | --- | --- | | **Build a trading bot or data aggregator** | [Quickstart](https://docs.pendle.finance/pendle-v2/Developers/Quickstart)
→ [Backend API Overview](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview) | | **Integrate PT/YT into your protocol (on-chain)** | [Router Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview)
→ [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide) | | **Price PT or LP (oracle / collateral)** | [Oracle Overview](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview)
→ [How to Integrate](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) | | **Work with Limit Orders** | [Limit Order Overview](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/Overview) | | **Track sPENDLE rewards** | [sPENDLE API](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#spendle-api-endpoints) | Core Documentation[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#core-documentation "Direct link to Core Documentation") ---------------------------------------------------------------------------------------------------------------------------------------- * [High Level Architecture](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture) * [StandardizedYield (SY)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield) * [Common Questions](https://docs.pendle.finance/pendle-v2/Developers/FAQ) Integration Guides[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#integration-guides "Direct link to Integration Guides") ---------------------------------------------------------------------------------------------------------------------------------------- ### On-chain Integration[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#on-chain-integration "Direct link to On-chain Integration") * **Router**: [Documentation](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/PendleRouterOverview) | [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide) * **Oracles**: [Overview](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview) | [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle) | [PT as Collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral) | [LP as Collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral) * [Example Repository](https://github.com/pendle-finance/pendle-examples-public) - Various contract interaction examples ### Off-chain Integration[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#off-chain-integration "Direct link to Off-chain Integration") * [Backend API overview](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview) * [RouterStatic](https://docs.pendle.finance/pendle-v2/Developers/Backend/RouterStatic) - Extensively tested contract for off-chain calculations. Not audited; should not be used for on-chain fund-related operations. * [sPENDLE API](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#spendle-api-endpoints) - Staking stats and per-user reward data ### Limit Orders[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#limit-orders "Direct link to Limit Orders") * [Contract](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/LimitOrderContract) | [Create](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CreateALimitOrder) | [Cancel](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/CancelOrders) | [Fill](https://docs.pendle.finance/pendle-v2/Developers/LimitOrder/FillALimitOrder) Resources[​](https://docs.pendle.finance/pendle-v2/Developers/Overview#resources "Direct link to Resources") ------------------------------------------------------------------------------------------------------------- * [Deployed Contract Addresses](https://docs.pendle.finance/pendle-v2/Developers/Deployments) — Core contracts and market addresses by chain * [Core Contract Repository](https://github.com/pendle-finance/pendle-core-v2-public) * [SY Contract Repository](https://github.com/pendle-finance/Pendle-SY-Public) * [Example Repository](https://github.com/pendle-finance/pendle-examples-public) * [Whitepapers](https://github.com/pendle-finance/pendle-v2-resources/tree/main/whitepapers) * [Stay Connected](https://docs.pendle.finance/pendle-v2/Developers/Overview#stay-connected) * [For AI users](https://docs.pendle.finance/pendle-v2/Developers/Overview#for-ai-users) * [What do you want to do?](https://docs.pendle.finance/pendle-v2/Developers/Overview#what-do-you-want-to-do) * [Core Documentation](https://docs.pendle.finance/pendle-v2/Developers/Overview#core-documentation) * [Integration Guides](https://docs.pendle.finance/pendle-v2/Developers/Overview#integration-guides) * [On-chain Integration](https://docs.pendle.finance/pendle-v2/Developers/Overview#on-chain-integration) * [Off-chain Integration](https://docs.pendle.finance/pendle-v2/Developers/Overview#off-chain-integration) * [Limit Orders](https://docs.pendle.finance/pendle-v2/Developers/Overview#limit-orders) * [Resources](https://docs.pendle.finance/pendle-v2/Developers/Overview#resources) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # StandardizedYield (SY) | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#__docusaurus_skipToContent_fallback) On this page **Contract:** [`IStandardizedYield`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IStandardizedYield.sol) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#overview "Direct link to Overview") ----------------------------------------------------------------------------------------------------------------------------- StandardizedYield (SY) is Pendle's **adapter layer** for heterogeneous yield-bearing tokens. Every yield source integrated into Pendle — whether it's Aave aTokens, Lido wstETH, or GMX GLP — is wrapped into an SY contract that exposes a uniform interface for depositing, redeeming, querying exchange rates, and claiming rewards. SY is the foundational token of the Pendle system. All other Pendle primitives build on top of it: * **PT and YT** are minted by splitting SY (see [YieldTokenization](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization) ) * **PendleMarket** trades PT against SY * **PYLpOracle** prices PT, YT, and LP in SY or asset terms Integrators interact with SY when wrapping/unwrapping yield tokens, querying supported deposit/withdrawal tokens, reading exchange rates for pricing, or claiming external protocol rewards. Core Concepts[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#core-concepts "Direct link to Core Concepts") -------------------------------------------------------------------------------------------------------------------------------------------- ### Exchange Rate Model[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#exchange-rate-model "Direct link to Exchange Rate Model") Every SY has an **exchange rate** that represents how much of the underlying asset one unit of SY is worth: value_in_asset = amountSY × exchangeRate / 1e18 For appreciating yield tokens (e.g. wstETH, sDAI), the exchange rate increases over time as yield accrues. A 2× increase in exchange rate means 1 SY is now worth double the underlying asset. The exchange rate is central to: * **PT/YT pricing** — PT converges to `1 / exchangeRate` at expiry * **Oracle rates** — `PYLpOracle` uses this to convert between SY and asset denominations * **Reward share accounting** — YT reward shares are calculated using the SY exchange rate ### Asset Info and Pricing[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#asset-info-and-pricing "Direct link to Asset Info and Pricing") `assetInfo()` returns metadata about what asset the SY appreciates against: (AssetType assetType, address assetAddress, uint8 assetDecimals) = sy.assetInfo(); | Field | Description | | --- | --- | | `assetType` | `0` = TOKEN, `1` = LIQUIDITY | | `assetAddress` | The reference asset the SY appreciates against. May not exist on the current chain (e.g. stETH address on Ethereum returned for SY-wstETH on Arbitrum). | | `assetDecimals` | Decimal precision of the asset | note The asset address is a **best estimation** — it aims to enable rough on-chain valuation. For many SYs, a true 1:1 asset doesn't exist or isn't on the same chain. Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#functions "Direct link to Functions") -------------------------------------------------------------------------------------------------------------------------------- ### `deposit`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#deposit "Direct link to deposit") Wraps `tokenIn` into SY and sends the minted shares to `receiver`. function deposit( address receiver, address tokenIn, uint256 amountTokenToDeposit, uint256 minSharesOut) external payable returns (uint256 amountSharesOut); | Parameter | Type | Description | | --- | --- | --- | | `receiver` | `address` | Address to receive the minted SY | | `tokenIn` | `address` | Token to deposit (must be in `getTokensIn()`) | | `amountTokenToDeposit` | `uint256` | Amount of `tokenIn` to deposit | | `minSharesOut` | `uint256` | Minimum SY to mint (reverts if output is less) | **Returns:** `amountSharesOut` — the amount of SY minted. Minting quirks SY wraps the underlying yield protocol, so minting/redeeming behavior varies by protocol: * **GLP**: Caps on certain tokens (ETH, USDC) are frequently reached, preventing their use despite being listed in `getTokensIn()` * **ankrBNB**: Minimum mint of 0.1 BNB — smaller amounts revert. Redemption may fail if the quick-withdrawal pool lacks liquidity * **wstETH**: ETH is in `getTokensIn()` (stake ETH → wstETH), but not in `getTokensOut()` (no direct unstake) The most reliable deposit token is the protocol's yield token itself, but hardcoding this is not recommended — always check `getTokensIn()`. ### `redeem`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#redeem "Direct link to redeem") Burns SY shares and sends the underlying `tokenOut` to `receiver`. function redeem( address receiver, uint256 amountSharesToRedeem, address tokenOut, uint256 minTokenOut, bool burnFromInternalBalance) external returns (uint256 amountTokenOut); | Parameter | Type | Description | | --- | --- | --- | | `receiver` | `address` | Address to receive the redeemed tokens | | `amountSharesToRedeem` | `uint256` | Amount of SY to burn | | `tokenOut` | `address` | Token to receive (must be in `getTokensOut()`) | | `minTokenOut` | `uint256` | Minimum output amount (reverts if less) | | `burnFromInternalBalance` | `bool` | If `true`, burns from SY transferred to the contract; if `false`, burns from `msg.sender`'s balance | **Returns:** `amountTokenOut` — the amount of `tokenOut` received. ### `previewDeposit`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#previewdeposit "Direct link to previewdeposit") Estimates the amount of SY that would be minted for a given deposit. Best-effort approximation — **not audited for on-chain use**. function previewDeposit( address tokenIn, uint256 amountTokenToDeposit) external view returns (uint256 amountSharesOut); | Parameter | Type | Description | | --- | --- | --- | | `tokenIn` | `address` | Token to deposit | | `amountTokenToDeposit` | `uint256` | Amount to deposit | ### `previewRedeem`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#previewredeem "Direct link to previewredeem") Estimates the amount of `tokenOut` received for burning a given amount of SY. Best-effort approximation — **not audited for on-chain use**. function previewRedeem( address tokenOut, uint256 amountSharesToRedeem) external view returns (uint256 amountTokenOut); | Parameter | Type | Description | | --- | --- | --- | | `tokenOut` | `address` | Token to receive | | `amountSharesToRedeem` | `uint256` | Amount of SY to burn | Preview functions — off-chain only The underlying protocols often lack explicit preview functions. SY's `previewDeposit` and `previewRedeem` are best-effort approximations by the Pendle team. While verified through testing, they are **not audited** and should not be relied upon on-chain. Use them via `eth_call` / `staticCall` for off-chain estimation only. ### `getTokensIn`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#gettokensin "Direct link to gettokensin") Returns all tokens that can be used to mint this SY. function getTokensIn() external view returns (address[] memory res); ### `getTokensOut`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#gettokensout "Direct link to gettokensout") Returns all tokens that can be received when redeeming this SY. function getTokensOut() external view returns (address[] memory res); ### `exchangeRate`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#exchangerate "Direct link to exchangerate") Returns the current exchange rate: how much asset 1 SY is worth (scaled by `1e18`). See [Unit and Decimals](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals) for decimal handling details. function exchangeRate() external view returns (uint256 res); ### `assetInfo`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#assetinfo "Direct link to assetinfo") Returns the asset type, address, and decimals that the SY appreciates against. function assetInfo() external view returns (AssetType assetType, address assetAddress, uint8 assetDecimals); See [Core Concepts — Asset Info and Pricing](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#asset-info-and-pricing) above for field descriptions. ### `claimRewards`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#claimrewards "Direct link to claimrewards") Claims all accrued external protocol rewards for `user` and transfers them. function claimRewards(address user) external returns (uint256[] memory rewardAmounts); ### `accruedRewards`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#accruedrewards "Direct link to accruedrewards") Returns the currently credited reward amounts for `user` **without** triggering a state update. To get the latest results, simulate `claimRewards(user)` via `eth_call` or `staticCall`. function accruedRewards(address user) external view returns (uint256[] memory rewardAmounts); note `accruedRewards` only reflects rewards credited as of the last on-chain interaction. It does **not** include rewards pending since the last block update. For accurate off-chain reads, simulate `claimRewards` instead. ### Extended: `pricingInfo()`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#extended-pricinginfo "Direct link to extended-pricinginfo") function pricingInfo() external view returns (address refToken, bool refStrictlyEqual); This optional function (defined in `IStandardizedYieldExtended`) describes the recommended pricing method for this SY: | Return Value | Description | | --- | --- | | `refToken` | The reference token to use when pricing this SY | | `refStrictlyEqual` | Whether `1 natural unit of SY == 1 natural unit of refToken` | **How to use for pricing PT & YT:** * `refStrictlyEqual = true`: use `PYLpOracle.get{Token}ToSyRate()` and multiply by `refToken`'s price. _Note: SY and refToken may have different decimals — see [Unit and Decimals](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals) ._ * `refStrictlyEqual = false`: use `PYLpOracle.get{Token}ToAssetRate()` and multiply by `refToken`'s price. Not all SYs implement `pricingInfo()`. Two common cases where it is overridden: **Rebasing yield tokens** — Rebasing tokens (e.g. stETH, stHYPE) adjust holder balances on every rebase, so the SY's `exchangeRate` does not track 1:1 with the yield token in raw-unit terms. In this case `refStrictlyEqual = false`. // PendleStakedHYPESY — yieldToken = stHYPE (rebasing)function pricingInfo() external view override returns (address refToken, bool refStrictlyEqual) { return (yieldToken, false);} **Scaled18 SY** — For assets with fewer than 18 decimals (e.g. LBTC at 8 decimals), Pendle deploys a decimal-wrapping contract and a corresponding `Scaled18` SY. Because 1 natural unit of the SY equals 1 natural unit of the original token, `refStrictlyEqual = true`. // PendleLBTCBaseSYScaled18address public constant LBTC = 0xecAc9C5F704e954931349Da37F60E39f515c11c1;function pricingInfo() external pure returns (address refToken, bool refStrictlyEqual) { return (LBTC, true); // original LBTC (8 decimals), not the scaled18 wrapper} tip If you're building a money market or lending protocol, check whether the SY implements `pricingInfo()` before choosing your oracle path. Contact the Pendle team for discussion when integrating a new token type. Pricing Guide[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#pricing-guide "Direct link to Pricing Guide") -------------------------------------------------------------------------------------------------------------------------------------------- When pricing PT/YT/LP positions, the choice between `getPtToSy` and `getPtToAsset` depends on the SY type. ### Standard SYs[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#standard-sys "Direct link to Standard SYs") Most SYs are a 1:1 wrap of the yield token. **Value PT/YT/LP by yield token** (`getPtToSy` / `getLpToSy`). If not possible, value by asset but account for the withdrawal risk from yield token to asset (`getPtToAsset` / `getLpToAsset`). | Market | Recommended way to get price | Unit of price | yieldToken of SY (1-1 wrap) | Note | Asset of SY | | --- | --- | --- | --- | --- | --- | | LBTC | getPtToSy | LBTC | LBTC | \- | BTC staked on Lombard | | sUSDe | getPtToSy | sUSDe | sUSDe | \- | USDe | | USDe | getPtToSy | USDe | USDe | \- | USDe | | eBTC | getPtToSy | eBTC | eBTC | \- | eBTC (constant exchange rate) | | USD0++ | getPtToSy | USD0++ | USD0++ | \- | USD0++ (constant exchange rate) | | sENA | getPtToSy | sENA | sENA | \- | ENA staked on Ethena | | SolvBTC.BBN | getPtToSy | SolvBTC.BBN | SolvBTC.BBN | \- | BTC staked on Solv | | PumpBTC | getPtToSy | PumpBTC | PumpBTC | \- | BTC staked on Pump | | weETH | getPtToSy | weETH | weETH | \- | eETH | | weETHs | getPtToSy | weETHs | weETHs | limited liquidity to market sell | weETHs (constant exchange rate) | | weETHk | getPtToSy | weETHk | weETHk | limited liquidity to market sell | weETHk (constant exchange rate) | | weETH (Karak) | getPtToSy | weETH (Karak) | weETHk (Karak) | can't market sell | eETH | | pufETH | getPtToSy | pufETH | pufETH | \- | ETH staked on Puffer | | pzETH | getPtToSy | pzETH | pzETH | limited liquidity to market sell | pzETH (constant exchange rate) | | wstETH | getPtToSy | wstETH | wstETH | \- | stETH | | GLP | getPtToSy | GLP | GLP | \- | GLP | | MUXLP | getPtToSy | MUXLP | MUXLP | can't market sell | MUXLP | | HLP | getPtToSy | HLP | HLP | can't market sell | HLP | | ezETH | getPtToSy | ezETH | ezETH | \- | ETH staked on Renzo | | rETH | getPtToSy | rETH | rETH | \- | ETH staked on Rocket | | ezETH (Zircuit) | getPtToSy | ezETH | ezETH | \- | ETH staked on Renzo then Zircuit | | uniETH | getPtToSy | uniETH | uniETH | \- | ETH staked on Bedrock | | rswETH | getPtToSy | rswETH | rswETH | \- | ETH staked on Swell | | rswETH Swell L2 | getPtToSy | rswETH | rswETH | \- | ETH staked on Swell | | swETH | getPtToSy | swETH | swETH | \- | ETH staked on Swell | | ETHx | getPtToSy | ETHx | ETHx | \- | ETH staked on Stadler | | rsETH | getPtToSy | rsETH | rsETH | \- | ETH staked on Kelp | | sDAI | **getPtToAsset** | DAI | sDAI | \- | DAI | | crvUSD Silo | **getPtToAsset** | crvUSD | scrvUSD | \- | crvUSD | | gDAI | **getPtToAsset** | DAI | gDAI | can't market sell | DAI staked in Gains | **Notes on Assets of SYs:** * All Liquid Staking Tokens (LRTs) except for weETH have assets listed as "ETH staked in xyz." This is different from ETH, as it takes 7 days or more to withdraw, and these staked ETH are subject to slashing if it occurs. As a result, LRT always trades at a slight depeg compared to the amount of ETH withdrawable from it. Hence, it's not safe to value these markets directly in ETH (which would not account for this depeg). Always value these in the original LRT form. * sDAI, scrvUSD, and gDAI tokens are not tradable, so they must be valued directly in their underlying asset. Similar to LRT, valuing them directly in the underlying asset will skip the protocol's risk of not being able to withdraw from yieldToken to Asset. Please keep that in mind! * All in all, it's safe to value tokens in yieldToken, whereas valuing them in assets carries additional conversion risk that you should be aware of. ### Non-standard SYs[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#non-standard-sys "Direct link to Non-standard SYs") Other SYs that are not 1-1 wrap of yieldToken: | Market | Recommended way to get price | Unit of price | yieldToken of SY (NOT 1-1 Wrap) | Asset of SY | | --- | --- | --- | --- | --- | | aUSDT | getPtToAsset | USDT | \- | USDT | | aUSDC | getPtToAsset | USDC | \- | USDC | | ePENDLE | getPtToAsset | ePENDLE | \- | ePENDLE | | mPENDLE | getPtToAsset | mPENDLE | \- | mPENDLE | For aUSDT and aUSDC, similar considerations apply as for sDAI, scrvUSD, and gDAI. Value them directly in their underlying asset. FAQ[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#faq "Direct link to FAQ") -------------------------------------------------------------------------------------------------------------- ### What does `exchangeRate()` represent?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#what-does-exchangerate-represent "Direct link to what-does-exchangerate-represent") It returns the amount of the underlying asset that 1 SY is worth, scaled by `1e18`. For example, if `exchangeRate()` returns `1.05e18`, then 1 SY = 1.05 units of the asset. The rate increases over time as yield accrues. ### Why can't I always deposit with any token listed in `getTokensIn()`?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#why-cant-i-always-deposit-with-any-token-listed-in-gettokensin "Direct link to why-cant-i-always-deposit-with-any-token-listed-in-gettokensin") `getTokensIn()` lists tokens that the SY _can_ accept, but the underlying protocol may have dynamic constraints — capacity caps (GLP), minimum amounts (ankrBNB), or liquidity limits — that cause deposits to revert at any given time. Always handle reverts gracefully. ### How do I price PT/YT if my SY is non-standard?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#how-do-i-price-ptyt-if-my-sy-is-non-standard "Direct link to How do I price PT/YT if my SY is non-standard?") For non-standard SYs (not a 1:1 wrap of the yield token), use `getPtToAsset` / `getLpToAsset` instead of the SY-denominated variants. Check the [Pricing Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#pricing-guide) tables above. If the SY implements `pricingInfo()`, follow the `refStrictlyEqual` flag to choose the correct oracle path. ### Should I use `getPtToSy` or `getPtToAsset`?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#should-i-use-getpttosy-or-getpttoasset "Direct link to should-i-use-getpttosy-or-getpttoasset") Prefer `getPtToSy` for maximum trustlessness — the PT→SY rate is natively guaranteed by the Pendle AMM. Use `getPtToAsset` only when your protocol explicitly needs asset-denominated pricing and you understand the additional SY→asset conversion risk (exchange rate dependency, potential depegs). See [PYLpOracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle) for details. Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#further-reading "Direct link to Further Reading") -------------------------------------------------------------------------------------------------------------------------------------------------- * [CommonSY](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY) — deployed SY addresses per chain * [DecimalsWrapper](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/DecimalsWrapper) — how Pendle handles tokens with non-18 decimals * [Unit and Decimals](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals) — decimal handling across PT, YT, SY, and asset * [YieldTokenization](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization) — how SY is split into PT and YT * [PYLpOracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Oracle/PYLpOracle) — TWAP oracle for pricing PT, YT, and LP * [Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards) — full reward accounting model for SY, YT, and LP holders * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#overview) * [Core Concepts](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#core-concepts) * [Exchange Rate Model](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#exchange-rate-model) * [Asset Info and Pricing](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#asset-info-and-pricing) * [Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#functions) * [`deposit`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#deposit) * [`redeem`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#redeem) * [`previewDeposit`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#previewdeposit) * [`previewRedeem`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#previewredeem) * [`getTokensIn`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#gettokensin) * [`getTokensOut`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#gettokensout) * [`exchangeRate`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#exchangerate) * [`assetInfo`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#assetinfo) * [`claimRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#claimrewards) * [`accruedRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#accruedrewards) * [Extended: `pricingInfo()`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#extended-pricinginfo) * [Pricing Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#pricing-guide) * [Standard SYs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#standard-sys) * [Non-standard SYs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#non-standard-sys) * [FAQ](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#faq) * [What does `exchangeRate()` represent?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#what-does-exchangerate-represent) * [Why can't I always deposit with any token listed in `getTokensIn()`?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#why-cant-i-always-deposit-with-any-token-listed-in-gettokensin) * [How do I price PT/YT if my SY is non-standard?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#how-do-i-price-ptyt-if-my-sy-is-non-standard) * [Should I use `getPtToSy` or `getPtToAsset`?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#should-i-use-getpttosy-or-getpttoasset) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Frequently Asked Questions | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/FAQ#__docusaurus_skipToContent_fallback) On this page Looking for error solutions? For common errors and debugging guidance, see the **[Troubleshooting Guide](https://docs.pendle.finance/pendle-v2/Developers/Troubleshooting) **. Looking for API questions? For Hosted SDK, rate limiting, and Backend API questions, see the **[API Overview FAQ](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#frequently-asked-questions) **. Contract[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#contract "Direct link to Contract") ----------------------------------------------------------------------------------------------------- ### How can I deploy a new SY Token on Pendle?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-deploy-a-new-sy-token-on-pendle "Direct link to How can I deploy a new SY Token on Pendle?") Pendle's smart contracts are permissionless, meaning anyone can deploy a new Standardized Yield (SY) Token without requiring approval from the Pendle team. To implement an SY Token, you must follow the Pendle SY Token standard, ensuring compatibility with the ecosystem. Detailed guidance, including contract structure and best practices, can be found in the [StandardizedYield documentation](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/StandardizedYield) . To community-list a new asset, see the [Community Listing guide](https://docs.pendle.finance/pendle-v2/Developers/Integration/CommunityListing) and the [SY writing guide](https://pendle.notion.site/How-to-write-a-SY-A-guide-207567a21d378069aecbf20176591d93) . ### How can I generate all the params for the Router on-chain?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-generate-all-the-params-for-the-router-on-chain "Direct link to How can I generate all the params for the Router on-chain?") Please refer to the following: * [Contract Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide) — step-by-step Solidity examples * [Types and Utility Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/Types) — struct definitions and helper functions * [IPAllActionTypeV3.sol](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IPAllActionTypeV3.sol) — full interface * [Pendle Examples](https://github.com/pendle-finance/pendle-examples-public) ### Why do quoted rates differ from actual swap amounts?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#why-do-quoted-rates-differ-from-actual-swap-amounts "Direct link to Why do quoted rates differ from actual swap amounts?") The rate functions in Pendle's quoter contract (e.g., `getPtToSyRate`, `getYtToSyRate`) provide **spot prices**, which do not account for price impact. To obtain the most accurate swap amounts, call Pendle's router functions directly or use the [Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) . ### Is the `pendleSwap` contract address immutable?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#is-the-pendleswap-contract-address-immutable "Direct link to is-the-pendleswap-contract-address-immutable") No, the contract address used for the `pendleSwap` parameter (e.g., in `swapExactTokenForPt`) is not guaranteed to be immutable and may change. Any changes will be announced publicly. Pricing & Data[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#pricing--data "Direct link to Pricing & Data") ---------------------------------------------------------------------------------------------------------------------- ### How can I preview the received amount of add/remove liquidity?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-preview-the-received-amount-of-addremove-liquidity "Direct link to How can I preview the received amount of add/remove liquidity?") To preview the amount you'll receive before submitting transactions, you can use: * Pendle API method (recommended): [Pendle Hosted SDK — Convert API](https://api-v2.pendle.finance/core/docs#/SDK/SdkController_convert) * On-chain method: [PendleRouter Contract](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/interfaces/IPActionAddRemoveLiqV3.sol) . The detailed guide can be found in the [Contract Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ContractIntegrationGuide) ### How do I fetch the PT price?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-do-i-fetch-the-pt-price "Direct link to How do I fetch the PT price?") You can get the PT (Principal Token) price via: * Pendle API method (recommended): [Pendle price API](https://api-v2.pendle.finance/core/docs#/Assets/PricesCrossChainController_getAllAssetPricesByAddressesCrossChains) * On-chain method: `getPtToAssetRate` of RouterStatic — see [RouterStatic](https://docs.pendle.finance/pendle-v2/Developers/Backend/RouterStatic) ### How can I retrieve historical PT and YT prices?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-historical-pt-and-yt-prices "Direct link to How can I retrieve historical PT and YT prices?") You can track historical PT/YT prices using: * Pendle API method: [Pendle ohlcv API](https://api-v2.pendle.finance/core/docs#/Assets/PricesController_ohlcv_v4) . Note that shorter timeframes (e.g., minute-by-minute updates) are not yet available. ### How can I retrieve market data such as TVL and APR?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-market-data-such-as-tvl-and-apr "Direct link to How can I retrieve market data such as TVL and APR?") You can obtain market data by calling the Pendle API. For example, to get data for a specific pool: `https://api-v2.pendle.finance/core/v2/{chainId}/markets/{marketAddress}/data`. This returns relevant details for the specified market. ### How can I retrieve market spot prices?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-market-spot-prices "Direct link to How can I retrieve market spot prices?") Use the [`getMarketSpotSwappingPrice`](https://api-v2.pendle.finance/core/docs#/SDK/SdkController_getMarketSpotSwappingPrice) endpoint. This is more suitable than calling the swap endpoint and offers a higher rate limit. ### How can I retrieve a list of market categories?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-a-list-of-market-categories "Direct link to How can I retrieve a list of market categories?") Use the markets API endpoints. You can fetch all markets via [`getAllMarkets`](https://api-v2.pendle.finance/core/docs#/Markets/MarketsCrossChainController_getAllMarkets) and filter by category client-side. ### How can I calculate the implied APY for a transaction?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-calculate-the-implied-apy-for-a-transaction "Direct link to How can I calculate the implied APY for a transaction?") The implied APY can be calculated using the `ptExchangeRate`. For a detailed explanation, refer to the [APY Calculation documentation](https://docs.pendle.finance/pendle-v2/ProtocolMechanics/PendleMarketAPYCalculation) . ### What is the format for `expectedCap` and `currentCap`?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#what-is-the-format-for-expectedcap-and-currentcap "Direct link to what-is-the-format-for-expectedcap-and-currentcap") The `expectedCap` and `currentCap` values are provided in base18 format (18 decimals). ### How can I determine the number of SY tokens received from PT tokens?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-determine-the-number-of-sy-tokens-received-from-pt-tokens "Direct link to How can I determine the number of SY tokens received from PT tokens?") Use the [Pendle Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) to simulate the swap. This avoids the need to replicate the `swapExactPtForSy` function off-chain. Rewards & Interest[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#rewards--interest "Direct link to Rewards & Interest") ---------------------------------------------------------------------------------------------------------------------------------- ### How can I get up-to-date `accruedRewards` on-chain? (Applicable to SY, YT, & LP)[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-get-up-to-date-accruedrewards-on-chain-applicable-to-sy-yt--lp "Direct link to how-can-i-get-up-to-date-accruedrewards-on-chain-applicable-to-sy-yt--lp") There are two methods: 1. **Call `redeemRewards(user)` and retrieve the output.** This method has the side effect of redeeming the user's rewards, so it might not be ideal. 2. **Call `IERC20(market).transfer(user,0)` followed by `accruedRewards`.** The transfer triggers an update of the user's rewards. ### Can the output of `getRewardTokens` change?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#can-the-output-of-getrewardtokens-change "Direct link to can-the-output-of-getrewardtokens-change") Yes, the output can change if the underlying protocol adds new reward tokens. However, no reward tokens will ever be removed. ### How can I read unclaimed rewards and interest for SY/YT/Market?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-read-unclaimed-rewards-and-interest-for-syytmarket "Direct link to How can I read unclaimed rewards and interest for SY/YT/Market?") **On-Chain Method:** To read for SY, please execute an `eth_call` (`callStatic` in ethers.js) to the following function of SY: function claimRewards(address user) external returns (uint256[] memory rewardAmounts); For YT, execute the following function: function redeemDueInterestAndRewards( address user, bool redeemInterest, bool redeemRewards) external returns (uint256 interestOut, uint256[] memory rewardsOut); For Market, execute the following function: function redeemRewards(address user) external returns (uint256[] memory); These calls can be batched through Multicall if necessary. ### When will PENDLE incentives for a new market begin?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#when-will-pendle-incentives-for-a-new-market-begin "Direct link to When will PENDLE incentives for a new market begin?") PENDLE incentives for a new market will begin on Thursday at 00:00 UTC (12 AM UTC), after the market has been whitelisted and added to voting. ### Where are Merkle distribution proofs located?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#where-are-merkle-distribution-proofs-located "Direct link to Where are Merkle distribution proofs located?") Merkle roots and proofs for claiming rewards are maintained in the [`pendle-finance/merkle-distributions`](https://github.com/pendle-finance/merkle-distributions) repository. ### Does Pendle provide a script for tracking user points or balances?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#does-pendle-provide-a-script-for-tracking-user-points-or-balances "Direct link to Does Pendle provide a script for tracking user points or balances?") Yes. The [`pendle-generic-balance-fetcher`](https://github.com/Pendle-Finance-Periphery/pendle-generic-balance-fetcher/tree/main) script tracks points and balances. It supports deposits from external protocols including Morpho, Euler, and Silo. Token Behavior[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#token-behavior "Direct link to Token Behavior") ----------------------------------------------------------------------------------------------------------------------- ### Why does the quantity of aTokens fluctuate?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#why-does-the-quantity-of-atokens-fluctuate "Direct link to Why does the quantity of aTokens fluctuate?") aTokens are rebasing tokens from Aave, meaning their quantity accrues rewards in real-time. This property causes the token balance to fluctuate, even during a transfer. Consequently, if you attempt to transfer a specific amount, the actual amount received might be slightly different (e.g., 99.9999 instead of 100), which can lead to transaction failures if not accounted for. To prevent failures, check the aToken balance immediately before each transfer or operation that relies on a precise quantity. Limit Orders & Routing[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#limit-orders--routing "Direct link to Limit Orders & Routing") ---------------------------------------------------------------------------------------------------------------------------------------------- ### How do limit orders interact with market swaps?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-do-limit-orders-interact-with-market-swaps "Direct link to How do limit orders interact with market swaps?") When a user performs a swap, the router automatically determines the optimal swap route for the best token output. This route can involve limit orders, the AMM LP, or a combination of both. Transaction emulation allows users to see the exact split between limit orders and AMM routing for any given swap in the current market environment. ### Is there an API to swap PT between different pools?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#is-there-an-api-to-swap-pt-between-different-pools "Direct link to Is there an API to swap PT between different pools?") Yes, use the **Roll Over PT** API to swap PTs from one market to another. See the [Hosted SDK Documentation](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) for details. ### How can I determine which assets support direct PT-to-PT swaps?[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-determine-which-assets-support-direct-pt-to-pt-swaps "Direct link to How can I determine which assets support direct PT-to-PT swaps?") Not all PT pairs are swappable. There is no static list of available pairs — call the API to check whether a specific swap is supported. * * * Supplemental Knowledge Base[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#supplemental-knowledge-base "Direct link to Supplemental Knowledge Base") -------------------------------------------------------------------------------------------------------------------------------------------------------------- AI-optimized reference This section contains supplemental Q&A and technical insights gathered from real partner integrations. It is intended to be searched and read by AI tools to provide more accurate answers about the Pendle protocol. The content below supplements the main documentation and covers edge cases, best practices, and technical nuances. Glossary[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#glossary "Direct link to Glossary") ----------------------------------------------------------------------------------------------------- | Term | Definition | | --- | --- | | **Pool** | Interchangeable with "market" | | **Maturity** | The end date of a financial product (pool). Upon maturity, users can claim rewards and either redeem or roll over to a new pool | | **IY** | Implied Yield | | **Roll over PT** | Swap PTs between markets (e.g., from an expiring pool to a new one) | Partner Technical Insights[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#partner-technical-insights "Direct link to Partner Technical Insights") ----------------------------------------------------------------------------------------------------------------------------------------------------------- These insights come from real conversations with technical partners during integration. They cover edge cases, best practices, and technical nuances not always obvious from standard documentation. ### Upper Bound for LP-to-SY Rate[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#upper-bound-for-lp-to-sy-rate "Direct link to Upper Bound for LP-to-SY Rate") **Q: Is there a value that can be used as an upper bound for LP-to-SY?** In theory, an LP token's value could be unbounded if accumulated fees were infinite. However, an upper bound of approximately **3 units** is somewhat reasonable for data validation purposes. (This is not security advice.) ### PT Pricing: Always Price to SY, Not Asset[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#pt-pricing-always-price-to-sy-not-asset "Direct link to PT Pricing: Always Price to SY, Not Asset") **Q: Should PT be priced against the asset (e.g., WBTC) or the wrapped token (e.g., eBTC)?** Pendle recommends pricing PT to SY and pricing the token that SY wraps whenever possible, because these tokens frequently trade at a discount compared to their true value. So PT-eBTC should be priced to eBTC, and PT-ezETH should be priced to ezETH. It's quite straightforward: * If you use `getPtToAsset`, multiply it by the asset price * If you use `getPtToSy`, multiply it by the SY price For example, PT-ezETH can be priced by either: * Method 1: `1 PT-ezETH = 1.2 ETH = 1.2 * $3500 = $4200 USD` * Method 2: `1 PT-ezETH = 1.01 ezETH = 1.01 * $4158 = $4199.58 USD` Pricing in the wrapped token (eBTC, ezETH) is always strictly more accurate since PT-eBTC is only tradable to eBTC in Pendle. The eBTC to WBTC conversion is external to Pendle. ### Oracle Cardinality Mechanic[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#oracle-cardinality-mechanic "Direct link to Oracle Cardinality Mechanic") **Q: What is the purpose of the cardinality mechanic in the market TWAP oracle?** It works the same as Uniswap V3. The cardinality mechanic is an initialization gas savings measure. Calling `increaseObservationsCardinalityNext` has no downside — anyone can call it. If called to the max, it costs `65536 * 20000 gas`, which is significant. The practical approach is to increase cardinality to your required level (e.g., 1800 for most use cases). ### PendleChainlinkOracle Decimals[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#pendlechainlinkoracle-decimals "Direct link to PendleChainlinkOracle Decimals") **Q: Why does the PendleChainlinkOracle return a price with more than 18 decimals?** The `answer` from `PendleChainlinkOracle` satisfies: 1 natural unit of PendleToken = (answer / 1e18) natural unit of OutputToken In other words: 10**(PendleToken.decimals) = (answer / 1e18) * 10**(OutputToken.decimals) This means the `answer` has `18 + OutputToken.decimals` total decimals. For example, if `OutputToken.decimals = 12`, the answer will have 30 decimals. This is expected behavior. ### sPENDLE Monthly Revenue API[​](https://docs.pendle.finance/pendle-v2/Developers/FAQ#spendle-monthly-revenue-api "Direct link to sPENDLE Monthly Revenue API") **Q: How can I retrieve sPENDLE monthly revenue data?** The vePENDLE system has been deprecated and replaced by **sPENDLE**. The previous `getMonthlyRevenue` endpoint under the Ve Pendle tag is deprecated and may be removed. For current staking and revenue data, refer to the [sPENDLE documentation](https://docs.pendle.finance/pendle-v2/Developers/Contracts/sPENDLE) . * [Contract](https://docs.pendle.finance/pendle-v2/Developers/FAQ#contract) * [How can I deploy a new SY Token on Pendle?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-deploy-a-new-sy-token-on-pendle) * [How can I generate all the params for the Router on-chain?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-generate-all-the-params-for-the-router-on-chain) * [Why do quoted rates differ from actual swap amounts?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#why-do-quoted-rates-differ-from-actual-swap-amounts) * [Is the `pendleSwap` contract address immutable?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#is-the-pendleswap-contract-address-immutable) * [Pricing & Data](https://docs.pendle.finance/pendle-v2/Developers/FAQ#pricing--data) * [How can I preview the received amount of add/remove liquidity?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-preview-the-received-amount-of-addremove-liquidity) * [How do I fetch the PT price?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-do-i-fetch-the-pt-price) * [How can I retrieve historical PT and YT prices?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-historical-pt-and-yt-prices) * [How can I retrieve market data such as TVL and APR?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-market-data-such-as-tvl-and-apr) * [How can I retrieve market spot prices?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-market-spot-prices) * [How can I retrieve a list of market categories?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-retrieve-a-list-of-market-categories) * [How can I calculate the implied APY for a transaction?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-calculate-the-implied-apy-for-a-transaction) * [What is the format for `expectedCap` and `currentCap`?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#what-is-the-format-for-expectedcap-and-currentcap) * [How can I determine the number of SY tokens received from PT tokens?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-determine-the-number-of-sy-tokens-received-from-pt-tokens) * [Rewards & Interest](https://docs.pendle.finance/pendle-v2/Developers/FAQ#rewards--interest) * [How can I get up-to-date `accruedRewards` on-chain? (Applicable to SY, YT, & LP)](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-get-up-to-date-accruedrewards-on-chain-applicable-to-sy-yt--lp) * [Can the output of `getRewardTokens` change?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#can-the-output-of-getrewardtokens-change) * [How can I read unclaimed rewards and interest for SY/YT/Market?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-read-unclaimed-rewards-and-interest-for-syytmarket) * [When will PENDLE incentives for a new market begin?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#when-will-pendle-incentives-for-a-new-market-begin) * [Where are Merkle distribution proofs located?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#where-are-merkle-distribution-proofs-located) * [Does Pendle provide a script for tracking user points or balances?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#does-pendle-provide-a-script-for-tracking-user-points-or-balances) * [Token Behavior](https://docs.pendle.finance/pendle-v2/Developers/FAQ#token-behavior) * [Why does the quantity of aTokens fluctuate?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#why-does-the-quantity-of-atokens-fluctuate) * [Limit Orders & Routing](https://docs.pendle.finance/pendle-v2/Developers/FAQ#limit-orders--routing) * [How do limit orders interact with market swaps?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-do-limit-orders-interact-with-market-swaps) * [Is there an API to swap PT between different pools?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#is-there-an-api-to-swap-pt-between-different-pools) * [How can I determine which assets support direct PT-to-PT swaps?](https://docs.pendle.finance/pendle-v2/Developers/FAQ#how-can-i-determine-which-assets-support-direct-pt-to-pt-swaps) * [Supplemental Knowledge Base](https://docs.pendle.finance/pendle-v2/Developers/FAQ#supplemental-knowledge-base) * [Glossary](https://docs.pendle.finance/pendle-v2/Developers/FAQ#glossary) * [Partner Technical Insights](https://docs.pendle.finance/pendle-v2/Developers/FAQ#partner-technical-insights) * [Upper Bound for LP-to-SY Rate](https://docs.pendle.finance/pendle-v2/Developers/FAQ#upper-bound-for-lp-to-sy-rate) * [PT Pricing: Always Price to SY, Not Asset](https://docs.pendle.finance/pendle-v2/Developers/FAQ#pt-pricing-always-price-to-sy-not-asset) * [Oracle Cardinality Mechanic](https://docs.pendle.finance/pendle-v2/Developers/FAQ#oracle-cardinality-mechanic) * [PendleChainlinkOracle Decimals](https://docs.pendle.finance/pendle-v2/Developers/FAQ#pendlechainlinkoracle-decimals) * [sPENDLE Monthly Revenue API](https://docs.pendle.finance/pendle-v2/Developers/FAQ#spendle-monthly-revenue-api) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # How to Integrate PT and LP Oracle | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#__docusaurus_skipToContent_fallback) On this page Looking for the recommended oracle? For most new integrations, Pendle now recommends the **[Linear Discount Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/DeterministicOracles/LinearDiscountOracle) ** — adopted by top Aave and Morpho curators (Gauntlet, Steakhouse) for its manipulation-resistant, AMM-independent design. This page covers the TWAP oracle, which remains fully supported for integrations that require a market-derived price. Integrating PT and LP oracles into your system can be accomplished in the following steps. This document provides detailed instructions along with runnable examples. If you need personalized assistance, don't hesitate to contact us via our Developers channel on [Pendle Discord](https://pendle.finance/discord) . Prerequisite[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#prerequisite "Direct link to Prerequisite") ------------------------------------------------------------------------------------------------------------------------------------------------- ### Understand SY, PT, LP[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#understand-sy-pt-lp "Direct link to Understand SY, PT, LP") * Read [High Level Architecture](https://docs.pendle.finance/pendle-v2/Developers/HighLevelArchitecture) and [StandardizedYield docs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield) to understand the Pendle system. * Refer to the examples in the following repository for further understanding: * [https://github.com/pendle-finance/pendle-examples/tree/main/test](https://github.com/pendle-finance/pendle-examples/tree/main/test) * [https://github.com/pendle-finance/pendle-core-v2-public/tree/main/contracts/oracles](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/contracts/oracles) ### Follow security advisories[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#follow-security-advisories "Direct link to Follow security advisories") As Pendle becomes more permissionless, certain security assumptions of SY will change in the future, and the Pendle team will verify for all teams currently integrating the LP Oracle that their integration meets the new **security assumptions** of SY. Please reach out to us on [Pendle Discord](https://pendle.finance/discord) if you have any questions. Choose a Market[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#choose-a-market "Direct link to Choose a Market") ---------------------------------------------------------------------------------------------------------------------------------------------------------- The _Using Pendle Oracle_ and _Using Pendle Library_ tabs use EtherFi's [weETH market](https://arbiscan.io/address/0x952083cde7aaa11AB8449057F7de23A970AA8472) on Arbitrum (70M USD liquidity at block 192 001 277). The _Using ChainLink oracle_ tab demonstrates with an LBTC market to show how `PendleChainlinkOracleWithQuote` works with external price feeds. We recommend choosing a market with high trading activities & deep liquidity. For a detailed guide on assessing the risk, depth of liquidity & twap duration, refer to the corresponding risk assessment docs. * [For using PT as collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/PTAsCollateral#risk-analysis-for-pt-as-a-collateral) * [For using LP as collateral](https://docs.pendle.finance/pendle-v2/Developers/Oracles/LPAsCollateral#risk-analysis-for-lp-as-a-collateral) TWAP Duration and Oracle Initialization[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#twap-duration-and-oracle-initialization "Direct link to TWAP Duration and Oracle Initialization") ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- By default, markets' oracles are **NOT initialized**. The oracle's status can be checked using the `_test_oracle_ready` function ([source](https://github.com/pendle-finance/pendle-examples-public/blob/642b1ab2784b3015691d6c26a2684cd5f7585b0d/test/OracleSample.sol#L75-L91) ). * The passed in `duration` is the TWAP duration (in seconds) you want to use. * The recommended TWAP duration is 900 seconds (15 minutes) for most markets or 1800 seconds (30 minutes). function _test_oracle_ready(address marketToCheck, uint32 duration) public view { (bool increaseCardinalityRequired, , bool oldestObservationSatisfied) = oracle.getOracleState(marketToCheck, duration); if (increaseCardinalityRequired) { // <=============== (1) - Oracle needs to be initialized } if (!oldestObservationSatisfied) { // <=============== (2) - Need to wait for data to be available } // <=============== (3) - Oracle is ready assert(!increaseCardinalityRequired); assert(oldestObservationSatisfied);} ### Point (1) - Oracle needs to be initialized[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#point-1---oracle-needs-to-be-initialized "Direct link to Point (1) - Oracle needs to be initialized") At this point, the oracle needs to be initialized. This can be done by calling the following yourself: IPMarket(market).increaseObservationsCardinalityNext(cardinalityRequired) Here are possible values for `cardinalityRequired`: | `duration` (seconds) | `900` | `1800` | | --- | --- | --- | | For Ethereum | 85 | 165 | | For Arbitrum | 900 | 1800 | So on Ethereum, for `duration` of 900 seconds, `cardinalityRequired` can be 85. Calculate `cardinalityRequired` In general, it can be calculated like this cardinalityRequired≈durationmax⁡{chain block time,1}\\mathtt{cardinalityRequired} \\approx \\frac {\\mathtt{duration}} {\\max\\{\\mathrm{\\text{chain block time}}, 1\\}}cardinalityRequired≈max{chain block time,1}duration​ After that, you need **to wait** for `duration` seconds for the first data to be available. ### Point (2) - Need to wait for data to be available[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#point-2---need-to-wait-for-data-to-be-available "Direct link to Point (2) - Need to wait for data to be available") Similar to the previous point, you need **to wait** for `duration` seconds for the first data to be available. ### Point (3) - Oracle is ready[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#point-3---oracle-is-ready "Direct link to Point (3) - Oracle is ready") Now you can call functions to get the observed price! Price Retrieval[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#price-retrieval "Direct link to Price Retrieval") ---------------------------------------------------------------------------------------------------------------------------------------------------------- We have provided a few ways to obtain the price. Select one of the following tabs to choose the one that best suits your needs. * Using ChainLink oracle * Using Pendle Oracle * Using Pendle Library We have provided a way to get the price, with the same interface as ChainLink oracles. The source code of the whole example can be found here: * [https://github.com/pendle-finance/pendle-examples-public/blob/main/test/ChainlinkOracleSample.sol](https://github.com/pendle-finance/pendle-examples-public/blob/main/test/ChainlinkOracleSample.sol) ### Step 1. Deploy the oracle (if not already deployed)[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#step-1-deploy-the-oracle-if-not-already-deployed "Direct link to Step 1. Deploy the oracle (if not already deployed)") If the oracle is not already deployed, you can deploy it yourself the same as this `setUp` function ([source](https://github.com/pendle-finance/pendle-examples-public/blob/642b1ab2784b3015691d6c26a2684cd5f7585b0d/test/ChainlinkOracleSample.sol#L30-L41) ). code fragment of setUp function factory = new PendleChainlinkOracleFactory(0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2);PT_LBTC_oracle = PendleChainlinkOracle( factory.createOracle(address(market), twapDuration, PendleOracleType.PT_TO_SY));PT_USD_oracle = PendleChainlinkOracleWithQuote( factory.createOracleWithQuote(address(market), twapDuration, PendleOracleType.PT_TO_SY, address(LBTC_USD_feed))); Parameters summary * `market` is the market address you want to observe the price. * `twapDuration` is the TWAP duration you want to use, chosen in the previous section. * `0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2` is the address of the deployed Pendle Oracle. * It was deployed to have the same address on all networks. * Refer to [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) section for the full list of addresses. * The deployed ChainLink oracles **wrap** this oracle. * Please refer to the _Using Pendle Oracle_ way if you want to use it directly. When deploying the oracle, you need to specify the type: * `PendleOracleType.PT_TO_SY` - to get the price of PT in SY. * `PendleOracleType.PT_TO_ASSET` - to get the price of PT in the underlying asset. We support 2 contracts for obtaining the price: * `PendleChainlinkOracle` - to get the price of PT in SY/asset. * `PendleChainlinkOracleWithQuote` - to get the price of PT in a different token if you have the ChainLink oracle of that token with the underlying asset. ### Step 2. Call the oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#step-2-call-the-oracle "Direct link to Step 2. Call the oracle") Price can be obtained simply by calling the `getLatestRoundData` function ([source](https://github.com/pendle-finance/pendle-examples-public/blob/642b1ab2784b3015691d6c26a2684cd5f7585b0d/test/ChainlinkOracleSample.sol#L43-L54) ). function test_get_prices_in_SY() external view { (uint80 roundId, int256 answer, , uint256 updatedAt, uint80 answeredInRound) = PT_LBTC_oracle.latestRoundData(); console.log("PT LBTC to SY-LBTC"); console.log(uint256(roundId), uint256(answer), updatedAt, uint256(answeredInRound)); // answer = 992893819205953801, meaning 1 PT = 0.992893819205953801 SY-LBTC}function test_get_prices_in_quote() external view { (uint80 roundId, int256 answer, , uint256 updatedAt, uint80 answeredInRound) = PT_USD_oracle.latestRoundData(); console.log("PT LBTC to BTC"); console.log(uint256(roundId), uint256(answer), updatedAt, uint256(answeredInRound)); // answer = 990999427443599801, meaning 1 PT = 0.9909994274435997 BTC} The source code of the whole example can be found here: * [https://github.com/pendle-finance/pendle-examples-public/blob/main/test/OracleSample.sol](https://github.com/pendle-finance/pendle-examples-public/blob/main/test/OracleSample.sol) We have deployed a contract that helps obtain the price of PT/YT/LP token in SY or asset. The contract is at address `0x5542be50420E88dd7D5B4a3D488FA6ED82F6DAc2`. * It was deployed to have the same address on all networks. * Refer to [Deployments on GitHub](https://github.com/pendle-finance/pendle-core-v2-public/tree/main/deployments) section for the full list of addresses. Getting the price can be done simply by calling the corresponding function ([source](https://github.com/pendle-finance/pendle-examples-public/blob/642b1ab2784b3015691d6c26a2684cd5f7585b0d/test/OracleSample.sol#L38-L46) ). function test_get_price_LRT_in_underlying() external view { uint256 ptRateInWeEth = oracle.getPtToSyRate(address(market), twapDuration); uint256 ytRateInWeEth = oracle.getYtToSyRate(address(market), twapDuration); uint256 lpRateInWeEth = oracle.getLpToSyRate(address(market), twapDuration); console.log("1 PT = %s Wrapped eEth (base 1e18)", ptRateInWeEth); console.log("1 YT = %s Wrapped eEth (base 1e18)", ytRateInWeEth); console.log("1 LP = %s Wrapped eEth (base 1e18)", lpRateInWeEth);} ### Optional: Convert the price to a different asset[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#optional-convert-the-price-to-a-different-asset "Direct link to Optional: Convert the price to a different asset") Additionally, if you have an on-chain feed for the price of the underlying asset with a different token, you can **convert** the price using multiplication. function test_get_price_LRT_with_external_oracle() external view { uint256 ptRateInWeEth = oracle.getPtToSyRate(address(market), twapDuration); // 1 SY-weETH = 1 weETH uint256 ptRateInEth = (ptRateInWeEth * uint256(weETH_ETH_feed.latestAnswer())) / (10 ** weETH_ETH_feed.decimals()); console.log("1 PT = %s ETH (base 1e18)", ptRateInEth); // 1 PT = 0.980103943942239852 ETH uint256 ptRateInUsd = (ptRateInEth * uint256(ETH_USD_feed.latestAnswer())) / (10 ** ETH_USD_feed.decimals()); console.log("1 PT = %s USD (base 1e18)", ptRateInUsd); // 1 PT = 3714.1302603652102 USD} The source code of the whole example can be found here: * [https://github.com/pendle-finance/pendle-examples-public/blob/main/test/OracleSample.sol](https://github.com/pendle-finance/pendle-examples-public/blob/main/test/OracleSample.sol) This library is used in the Pendle Oracle (refer to _Using Pendle Oracle_ section). But it can also be used directly in your contract source code. This can help save **about 4k gas**! Before using it, import it as follows: import { PendlePYOracleLib, PendleLpOracleLib} from "@pendle/core-v2/contracts/oracles/PtYtLpOracle/PendlePYLpOracle.sol";contract YourContract { using PendlePYOracleLib for IPMarket; using PendleLpOracleLib for IPMarket; // ...} Then you can call the functions directly on the market address. function test_get_price_LRT_in_underlying_with_lib() external view { uint256 ptRateInWeEth = market.getPtToSyRate(twapDuration); uint256 ytRateInWeEth = market.getYtToSyRate(twapDuration); uint256 lpRateInWeEth = market.getLpToSyRate(twapDuration); console.log("1 PT = %s Wrapped eEth (base 1e18)", ptRateInWeEth); console.log("1 YT = %s Wrapped eEth (base 1e18)", ytRateInWeEth); console.log("1 LP = %s Wrapped eEth (base 1e18)", lpRateInWeEth);} Refer to [StandardizedYield docs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield) to call the correct function. ### Optional: Convert the price to a different asset[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#optional-convert-the-price-to-a-different-asset-1 "Direct link to Optional: Convert the price to a different asset") Additionally, if you have an on-chain feed for the price of the underlying asset with a different token, you can **convert** the price using multiplication. function test_get_price_LRT_with_external_oracle_with_lib() external view { uint256 ptRateInWeEth = market.getPtToSyRate(twapDuration); // 1 SY-weETH = 1 weETH uint256 ptRateInEth = (ptRateInWeEth * uint256(weETH_ETH_feed.latestAnswer())) / (10 ** weETH_ETH_feed.decimals()); console.log("1 PT = %s ETH (base 1e18)", ptRateInEth); // 1 PT = 0.980103943942239852 ETH uint256 ptRateInUsd = (ptRateInEth * uint256(ETH_USD_feed.latestAnswer())) / (10 ** ETH_USD_feed.decimals()); console.log("1 PT = %s USD (base 1e18)", ptRateInUsd); // 1 PT = 3714.1302603652102 USD} We recommend pricing PT to SY instead of asset. For SY to any other units, the integrator can choose an appropriate method based on whether the asset can be directly redeemed from the SY or if there is a slashing risk, etc. Pendle can not provide a perfect PT to Asset price because Asset price is not well defined. Pendle can not provide a perfect PT to asset price Let's take a look at the example of PT-sUSDe/SY-sUSDe with asset being USDe. Pendle can guarantee 1 PT-sUSDe can be traded to XXX SY-sUSDe = XXX sUSDe. PT to SY price **exists natively**. On the other hand, Pendle **can not** guarantee sUSDe is redeemable to some amount of USDe. Which now traced back to: SY-sUSDe’s asset is not USDe, but USDe staked in Ethena, hence the price of this is not **well defined**. * * * Because of this, in case when sUSDe depegged from USDe, the conversion rate between PT-sUSDe to sUSDe is still correct, because the conversion rate is based on `SY.exchangeRate()`, which is provided by the underlying contract. About unit and decimals As the `decimals` is a token metadata, and only be used to show the amount to the users, Pendle contract does **not** operate with decimals. See the documentation about [unit and decimals](https://docs.pendle.finance/pendle-v2/Developers/Contracts/UnitAndDecimals) for more info. Let's say you want to know how much XXX LP is worth in SY. First, we convert XXX into the **raw** format so that the contract can understand. rawX\=X×10LP.decimals\\mathtt{rawX} = X \\times 10^{\\mathtt{LP}.\\mathtt{decimals}}rawX\=X×10LP.decimals After obtaining the `lpToSyRate`, we convert `rawX` to the **raw** form of SY as follows: rawY\=rawX×lpToSyRate/1018\\mathtt{rawY} = \\mathtt{rawX} \\times \\mathtt{lpToSyRate} / 10^{18}rawY\=rawX×lpToSyRate/1018 > Note that 101810^{18}1018 is a fixed number in the formula, and does not depend on any `decimals` data. Finally, we can convert `rawY` to the human-readable format: Y\=rawY/10SY.decimalsY = \\mathtt{rawY} / 10^{\\mathtt{SY}.\\mathtt{decimals}}Y\=rawY/10SY.decimals Conversion between PT/YT and SY is done similarly. As Pendle supports a wide variety of assets, each with a different `decimals`, this fact is important to remember. Handle liquidation & LP's rewards[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#handle-liquidation--lps-rewards "Direct link to Handle liquidation & LP's rewards") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ### For PT liquidation[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#for-pt-liquidation "Direct link to For PT liquidation") * When a liquidation with PTPTPT as collateral occurs, commonly, the liquidator will have to sell PTPTPT into common asset to pay their debt. * In Pendle's system, we support converting PTPTPT back to SYSYSY by selling PTPTPT on our AMM (before maturity) or redeeming directly from `PendleYieldToken` contract (post maturity). This will then allow the liquidator to redeem their SYSYSY into one of the output tokens of SYSYSY. * For reference, we have written the [`BoringPtSeller`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/samples/BoringPtSeller.sol) contract to sell PTPTPT into one of the output token. * You can extend this abstract contract to use in a liquidation system. ### For LP liquidation[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#for-lp-liquidation "Direct link to For LP liquidation") * When a liquidation with LPLPLP as collateral occurs, commonly, the liquidator will have to sell LPLPLP into common asset to pay their debt. * In Pendle's system, we support converting LPLPLP back to SYSYSY by removing liquidity single-sided into SYSYSY on our AMM (before maturity) or redeeming PTPTPT + SYSYSY and redeeming PTPTPT to SYSYSY directly from `PendleYieldToken` contract (post maturity). This will then allow the liquidator to redeem their SYSYSY into one of the output tokens of SYSYSY. * For reference, we have written the [`BoringLpSeller`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/samples/BoringLpSeller.sol) contract to sell LPLPLP into one of SY's output tokens. * You can extend this abstract contract to use in a liquidation system. ### Handling of Pendle LP's rewards:[​](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#handling-of-pendle-lps-rewards "Direct link to Handling of Pendle LP's rewards:") * Holding Pendle LP tokens will generate PENDLE incentives and potential reward tokens (like WETH for LP for GLP pool) * The money market contracts will need to redeem these rewards by calling the `redeemRewards` function and implement logic to distribute these rewards to their users * [Prerequisite](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#prerequisite) * [Understand SY, PT, LP](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#understand-sy-pt-lp) * [Follow security advisories](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#follow-security-advisories) * [Choose a Market](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#choose-a-market) * [TWAP Duration and Oracle Initialization](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#twap-duration-and-oracle-initialization) * [Point (1) - Oracle needs to be initialized](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#point-1---oracle-needs-to-be-initialized) * [Point (2) - Need to wait for data to be available](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#point-2---need-to-wait-for-data-to-be-available) * [Point (3) - Oracle is ready](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#point-3---oracle-is-ready) * [Price Retrieval](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#price-retrieval) * [Step 1. Deploy the oracle (if not already deployed)](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#step-1-deploy-the-oracle-if-not-already-deployed) * [Step 2. Call the oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#step-2-call-the-oracle) * [Optional: Convert the price to a different asset](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#optional-convert-the-price-to-a-different-asset) * [Optional: Convert the price to a different asset](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#optional-convert-the-price-to-a-different-asset-1) * [Handle liquidation & LP's rewards](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#handle-liquidation--lps-rewards) * [For PT liquidation](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#for-pt-liquidation) * [For LP liquidation](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#for-lp-liquidation) * [Handling of Pendle LP's rewards:](https://docs.pendle.finance/pendle-v2/Developers/Oracles/HowToIntegratePtAndLpOracle#handling-of-pendle-lps-rewards) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # MerkleDistributor | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#__docusaurus_skipToContent_fallback) On this page **Contract:** [`PendleMultiTokenMerkleDistributor`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/LiquidityMining/PendleMultiTokenMerkleDistributor.sol) Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#overview "Direct link to Overview") --------------------------------------------------------------------------------------------------------------------------------------------- `PendleMultiTokenMerkleDistributor` distributes off-chain computed rewards (e.g. PENDLE voter incentives, partner point rewards) to users via a Merkle tree. The protocol owner periodically updates the Merkle root with a new snapshot of cumulative accruals per `(token, user)` pair. Users prove their entitlement on-chain and receive the delta since their last claim. When to Use This[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#when-to-use-this "Direct link to When to Use This") --------------------------------------------------------------------------------------------------------------------------------------------------------------------- * **Claiming voter incentives or partner point rewards** — these are computed off-chain and distributed through this contract * **Building a claim UI** — fetch Merkle proofs from the Pendle API and submit them via `claim` * **Relayer / gasless claim flows** — use `verify` + `claimVerified` to separate proof validation from token transfer Use on-chain claim functions for LP/YT rewards This contract is only for **off-chain computed rewards**. For on-chain rewards: * **LP holders** → call `redeemRewards(user)` on [PendleMarket](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/PendleMarket) * **YT holders** → call `redeemDueInterestAndRewards(user, false, true)` on PendleYieldToken (see [YieldTokenization](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldTokenization) ) * **SY holders** → call `claimRewards(user)` on the SY contract (see [Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards) ) See [Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards) for the full reward taxonomy. Core Concepts[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#core-concepts "Direct link to Core Concepts") ------------------------------------------------------------------------------------------------------------------------------------------------------------ ### How the Merkle Tree Works[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#how-the-merkle-tree-works "Direct link to How the Merkle Tree Works") Off-chain, the protocol computes a **cumulative** total accrued amount for every `(token, user)` pair and commits it into a Merkle tree. The root is stored on-chain. To claim, a user provides: * The list of reward tokens * Their cumulative `totalAccrued` amount per token (as computed off-chain) * A Merkle proof for each `(token, user, totalAccrued)` leaf The contract verifies the proof, then transfers `totalAccrued - claimed[token][user]` to the receiver and records the new `claimed` amount. Because accruals are **cumulative**, claiming multiple times is safe — each call only pays out the delta. ### Storage[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#storage "Direct link to Storage") | Mapping | Description | | --- | --- | | `merkleRoot` | The current Merkle root committing all `(token, user, totalAccrued)` entries. Updated by the owner on each reward cycle. | | `claimed[token][user]` | Cumulative amount already transferred out to `user` for `token`. | | `verified[token][user]` | Cumulative amount verified (proof checked) but not yet claimed, used by `claimVerified`. | ### Where to Get Merkle Proofs[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#where-to-get-merkle-proofs "Direct link to Where to Get Merkle Proofs") Merkle proofs and `totalAccrued` values are available from the Pendle API. Query the API with the user's address to get the proof data needed for the `claim` call. See the [BFF API](https://docs.pendle.finance/pendle-v2/Developers/Backend/ApiOverview#bff-api--httpsapi-v2pendlefinancebff) for endpoint details. Functions[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#functions "Direct link to Functions") ------------------------------------------------------------------------------------------------------------------------------------------------ ### `claim`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claim "Direct link to claim") Verifies proofs and transfers the unclaimed delta for each token to `receiver` in one transaction. function claim( address receiver, address[] calldata tokens, uint256[] calldata totalAccrueds, bytes32[][] calldata proofs) external returns (uint256[] memory amountOuts); | Parameter | Type | Description | | --- | --- | --- | | `receiver` | `address` | Address to receive the claimed tokens (can differ from `msg.sender`) | | `tokens` | `address[]` | Reward token addresses to claim | | `totalAccrueds` | `uint256[]` | Cumulative accrued amount per token (from the Merkle tree) | | `proofs` | `bytes32[][]` | Merkle proof per token | | Return Value | Type | Description | | --- | --- | --- | | `amountOuts` | `uint256[]` | Actual amount transferred per token (`totalAccrueds[i] - claimed[tokens[i]][msg.sender]`) | * `msg.sender` is the user whose accruals are being claimed * `receiver` can differ from `msg.sender` (useful for smart contract wallets) * Reverts with `InvalidMerkleProof` if any proof is invalid ### `verify`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#verify "Direct link to verify") Validates proofs and records the verified amounts **without transferring tokens**. Allows a third party (e.g. a relayer) to pre-verify a user's entitlement so the user can later call `claimVerified` without needing to supply proofs again. function verify( address user, address[] calldata tokens, uint256[] calldata totalAccrueds, bytes32[][] calldata proofs) external returns (uint256[] memory amountClaimable); | Parameter | Type | Description | | --- | --- | --- | | `user` | `address` | The user whose entitlements to verify | | `tokens` | `address[]` | Reward token addresses | | `totalAccrueds` | `uint256[]` | Cumulative accrued amounts | | `proofs` | `bytes32[][]` | Merkle proofs | | Return Value | Type | Description | | --- | --- | --- | | `amountClaimable` | `uint256[]` | Amount claimable per token after verification | Sets `verified[token][user] = totalAccrued` for each token. Does **not** transfer any tokens. ### `claimVerified`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claimverified "Direct link to claimverified") Transfers all previously verified but unclaimed amounts to `receiver`. No proof required — relies on a prior `verify` call. function claimVerified( address receiver, address[] calldata tokens) external returns (uint256[] memory amountOuts); | Parameter | Type | Description | | --- | --- | --- | | `receiver` | `address` | Address to receive the claimed tokens | | `tokens` | `address[]` | Reward token addresses to claim | | Return Value | Type | Description | | --- | --- | --- | | `amountOuts` | `uint256[]` | Actual amount transferred per token (`verified[tokens[i]][msg.sender] - claimed[tokens[i]][msg.sender]`) | No-ops silently for tokens where nothing new has been verified. ### `merkleRoot`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#merkleroot "Direct link to merkleroot") Returns the current Merkle root. function merkleRoot() external view returns (bytes32); ### `claimed`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claimed "Direct link to claimed") Returns the total amount already paid out to `user` for `token`. function claimed(address token, address user) external view returns (uint256); ### `verified`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#verified "Direct link to verified") Returns the total amount verified (but not necessarily claimed) for `user` for `token`. function verified(address token, address user) external view returns (uint256); ### `setMerkleRoot`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#setmerkleroot "Direct link to setmerkleroot") Updates the Merkle root. Called by the owner at the start of each new reward cycle after computing off-chain accruals. function setMerkleRoot(bytes32 newMerkleRoot) external; | Parameter | Type | Description | | --- | --- | --- | | `newMerkleRoot` | `bytes32` | New Merkle root committing updated cumulative accruals | Integration Examples[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#integration-examples "Direct link to Integration Examples") --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Example code only The snippets below are simplified for illustration and **are not audited**. **Do not** use them in production or with real funds. If you adapt any example, conduct a full review, add comprehensive tests, and obtain an independent **security audit**. ### Claiming rewards via the Pendle API[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claiming-rewards-via-the-pendle-api "Direct link to Claiming rewards via the Pendle API") import { ethers } from "ethers";const distributor = new ethers.Contract(DISTRIBUTOR_ADDRESS, DISTRIBUTOR_ABI, signer);// Step 1: Fetch totalAccrueds and proofs from the Pendle APIconst { tokens, totalAccrueds, proofs } = await fetchMerkleData(userAddress);// Step 2: Submit the claim transactionconst tx = await distributor.claim( userAddress, // receiver tokens, totalAccrueds, proofs);await tx.wait(); ### Off-chain claim flow diagram[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#off-chain-claim-flow-diagram "Direct link to Off-chain claim flow diagram") Off-chain: 1. Protocol computes cumulative totalAccrued per (token, user) 2. Builds Merkle tree from leaves: keccak256(token, user, totalAccrued) 3. Owner calls setMerkleRoot(root)On-chain (user): 4. Fetch totalAccrued and proof from Pendle API 5. Call claim(receiver, tokens, totalAccrueds, proofs) → contract verifies proof, pays out delta, updates claimed[] ### Relayer flow (verify + claimVerified)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#relayer-flow-verify--claimverified "Direct link to Relayer flow (verify + claimVerified)") // Step 1: Relayer pre-verifies on behalf of user (no tokens transferred)const verifyTx = await distributor.verify( userAddress, tokens, totalAccrueds, proofs);await verifyTx.wait();// Step 2: User claims later without needing proofsconst claimTx = await distributor.connect(userSigner).claimVerified( userAddress, // receiver tokens);await claimTx.wait(); FAQ[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#faq "Direct link to FAQ") ------------------------------------------------------------------------------------------------------------------------------ ### Can I claim for another user?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#can-i-claim-for-another-user "Direct link to Can I claim for another user?") No. `msg.sender` is always the user whose accruals are claimed. However, you can set a different `receiver` to send the tokens to another address. For gasless flows, use the `verify` + `claimVerified` pattern: a relayer calls `verify(user, ...)`, then the user calls `claimVerified` themselves. ### What happens if I claim twice?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#what-happens-if-i-claim-twice "Direct link to What happens if I claim twice?") Nothing bad. Because accruals are **cumulative**, calling `claim` again with the same `totalAccrued` results in `amountOut = 0` (the delta is zero). If a new Merkle root has been published with a higher `totalAccrued`, you receive only the new delta. ### What's the difference between `claim` and `verify` + `claimVerified`?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#whats-the-difference-between-claim-and-verify--claimverified "Direct link to whats-the-difference-between-claim-and-verify--claimverified") `claim` verifies proofs and transfers tokens in one step. The two-step flow (`verify` then `claimVerified`) is useful when a third party (relayer) submits proofs on behalf of users, but the users themselves should trigger the token transfer. `claimVerified` requires no proofs — it relies on the previously stored `verified` amounts. Further Reading[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#further-reading "Direct link to Further Reading") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ * [Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards) — full taxonomy of Pendle rewards (SY-native, PENDLE incentives, off-chain) * [GaugeController](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController) — on-chain PENDLE incentive distribution to markets * [MiscFunctions — redeemDueInterestAndRewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewards) — batch claiming via Router * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#overview) * [When to Use This](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#when-to-use-this) * [Core Concepts](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#core-concepts) * [How the Merkle Tree Works](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#how-the-merkle-tree-works) * [Storage](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#storage) * [Where to Get Merkle Proofs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#where-to-get-merkle-proofs) * [Functions](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#functions) * [`claim`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claim) * [`verify`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#verify) * [`claimVerified`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claimverified) * [`merkleRoot`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#merkleroot) * [`claimed`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claimed) * [`verified`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#verified) * [`setMerkleRoot`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#setmerkleroot) * [Integration Examples](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#integration-examples) * [Claiming rewards via the Pendle API](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#claiming-rewards-via-the-pendle-api) * [Off-chain claim flow diagram](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#off-chain-claim-flow-diagram) * [Relayer flow (verify + claimVerified)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#relayer-flow-verify--claimverified) * [FAQ](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#faq) * [Can I claim for another user?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#can-i-claim-for-another-user) * [What happens if I claim twice?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#what-happens-if-i-claim-twice) * [What's the difference between `claim` and `verify` + `claimVerified`?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#whats-the-difference-between-claim-and-verify--claimverified) * [Further Reading](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor#further-reading) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Rewards | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#__docusaurus_skipToContent_fallback) On this page Pendle distributes three categories of rewards across positions: * **SY-native rewards** — external protocol rewards generated by the underlying yield source (e.g., AAVE tokens from an Aave vault, Morpho rewards) * **PENDLE incentives** — PENDLE tokens streamed by the [GaugeController](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/GaugeController) to LP positions * **Off-chain rewards** — rewards computed off-chain (e.g. voter incentives, partner point programs) and distributed via [MerkleDistributor](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor) The table below summarises which contract, reward tokens, and claim function apply to each position type: | Position | Contract | Reward Tokens | Claim Function | | --- | --- | --- | --- | | SY holder | `SYBaseWithRewards` | SY-native (e.g. AAVE) | `claimRewards(user)` | | YT holder | `PendleYieldToken` | SY-native (via SY indexes) | `redeemDueInterestAndRewards(user, false, true)` | | LP holder | `PendleMarket` (`PendleGauge`) | SY-native + PENDLE | `redeemRewards(user)` | | Any | `PendleMultiTokenMerkleDistributor` | Any (off-chain computed) | `claim(receiver, tokens, totalAccrueds, proofs)` | * * * The Reward Index Accounting Model[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#the-reward-index-accounting-model "Direct link to The Reward Index Accounting Model") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- All three position types share the same underlying accounting mechanism, implemented in `RewardManagerAbstract` and `RewardManager`. ### Core idea[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#core-idea "Direct link to Core idea") A global **index** (per reward token) increases monotonically as rewards accumulate. Each user tracks their own index snapshot. When a user's snapshot lags behind the global index, the difference represents rewards they have not yet been credited. userAccrued += userShares × (globalIndex − userIndex)userIndex = globalIndex ### Storage structs[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#storage-structs "Direct link to Storage structs") struct RewardState { uint128 index; // current global index (scaled by 1e18) uint128 lastBalance; // reward token balance at last index update}struct UserReward { uint128 index; // user's snapshot of the global index uint128 accrued; // unclaimed reward tokens owed to this user} * `rewardState[token]` — global state, one entry per reward token * `userReward[token][user]` — per-user state ### Per-block update guard[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#per-block-update-guard "Direct link to Per-block update guard") `RewardManager` updates the global index **at most once per block** (`lastRewardBlock != block.number`). Within the same block all calls read the cached index, keeping gas costs predictable. ### Index update flow[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#index-update-flow "Direct link to Index update flow") On reward interaction: 1. _redeemExternalReward() ← pull rewards from external source into contract balance 2. accrued = currentBalance − lastBalance 3. index += accrued / totalShares 4. lastBalance = currentBalance 5. For each user: userAccrued += userShares × (index − userIndex) * * * SY Rewards[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#sy-rewards "Direct link to SY Rewards") ----------------------------------------------------------------------------------------------------------------------------------------- **Contracts:** `SYBaseWithRewards`, `RewardManager` SY calculates reward indexes locally: it tracks the raw token balance of each reward token and computes accruals from balance deltas. ### Reward shares[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#reward-shares "Direct link to Reward shares") Each SY holder's reward share equals their SY token balance. Total shares = total SY supply. ### `getRewardTokens`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#getrewardtokens "Direct link to getrewardtokens") Returns the list of external reward tokens that this SY distributes. function getRewardTokens() external view returns (address[] memory tokens); | Return Value | Type | Description | | --- | --- | --- | | `tokens` | `address[]` | List of reward token addresses | ### `accruedRewards`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#accruedrewards "Direct link to accruedrewards") View function. Returns the amount of each reward token currently credited to `user` without triggering a state change. Does **not** include rewards pending since the last block update. function accruedRewards(address user) external view returns (uint256[] memory amounts); | Parameter | Type | Description | | --- | --- | --- | | `user` | `address` | The user address | | Return Value | Type | Description | | --- | --- | --- | | `amounts` | `uint256[]` | Accrued reward amounts, one per `getRewardTokens()` entry | ### `rewardIndexesCurrent`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#rewardindexescurrent "Direct link to rewardindexescurrent") Updates reward indexes for the current block and returns them. State-changing. function rewardIndexesCurrent() external returns (uint256[] memory indexes); | Return Value | Type | Description | | --- | --- | --- | | `indexes` | `uint256[]` | Current reward indexes, one per `getRewardTokens()` entry | ### `rewardIndexesStored`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#rewardindexesstored "Direct link to rewardindexesstored") View function. Returns the cached reward indexes without triggering an update. function rewardIndexesStored() external view returns (uint256[] memory indexes); | Return Value | Type | Description | | --- | --- | --- | | `indexes` | `uint256[]` | Stored reward indexes, one per `getRewardTokens()` entry | ### `claimRewards`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#claimrewards "Direct link to claimrewards") Updates the global index, credits the user's accrued rewards, and transfers them to `user`. function claimRewards(address user) external returns (uint256[] memory rewardAmounts); | Parameter | Type | Description | | --- | --- | --- | | `user` | `address` | The user to claim rewards for | | Return Value | Type | Description | | --- | --- | --- | | `rewardAmounts` | `uint256[]` | Amounts transferred, one per `getRewardTokens()` entry | * * * YT Rewards[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#yt-rewards "Direct link to YT Rewards") ----------------------------------------------------------------------------------------------------------------------------------------- **Contract:** `PendleYieldToken` YT holders earn SY-native rewards in proportion to the SY value their YT represents. The key difference from SY is that **YT does not maintain its own reward indexes** — it delegates entirely to `SY.rewardIndexesCurrent()`. ### Reward shares[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#reward-shares-1 "Direct link to Reward shares") A YT holder's reward share is the amount of SY their YT position currently represents, **plus** any interest they have accrued but not yet redeemed: rewardShares = SYUtils.assetToSy(userInterest[user].index, balanceOf(user)) + userInterest[user].accrued; This means reward weight grows over time as yield accumulates, even without any new YT minting. ### Post-expiry behaviour[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#post-expiry-behaviour "Direct link to Post-expiry behaviour") When a YT expires, `_setPostExpiryData()` snapshots the reward indexes at the moment of expiry (`postExpiry.firstRewardIndex`). After expiry: * No new rewards accrue to YT holders — the index is frozen at the expiry snapshot * Any rewards that flow into the YT contract after expiry go to the treasury via `redeemInterestAndRewardsPostExpiryForTreasury()` * Users can still claim their pre-expiry accrued rewards via `redeemDueInterestAndRewards` ### Fee[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#fee "Direct link to Fee") A `rewardFeeRate` (set by `IPYieldContractFactory`, max 20%) is deducted from rewards before transfer. The fee amount is sent to the treasury. ### `getRewardTokens`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#getrewardtokens-1 "Direct link to getrewardtokens-1") Delegates to `SY.getRewardTokens()`. function getRewardTokens() external view returns (address[] memory tokens); | Return Value | Type | Description | | --- | --- | --- | | `tokens` | `address[]` | List of reward token addresses | ### `redeemDueInterestAndRewards`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#redeemdueinterestandrewards "Direct link to redeemdueinterestandrewards") Claims interest and/or rewards for `user`. To claim only rewards, pass `redeemInterest = false, redeemRewards = true`. function redeemDueInterestAndRewards( address user, bool redeemInterest, bool redeemRewards) external returns (uint256 interestOut, uint256[] memory rewardsOut); | Parameter | Type | Description | | --- | --- | --- | | `user` | `address` | The user to claim for | | `redeemInterest` | `bool` | Whether to claim accrued interest | | `redeemRewards` | `bool` | Whether to claim accrued rewards | | Return Value | Type | Description | | --- | --- | --- | | `interestOut` | `uint256` | Interest amount transferred (0 if `redeemInterest = false`) | | `rewardsOut` | `uint256[]` | Reward amounts transferred, one per `getRewardTokens()` entry | The reward update **must** happen before the interest transfer (since interest redemption changes reward shares). The contract enforces this ordering internally. See [YieldTokenization](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization/YieldTokenization) for the full API including interest redemption. * * * Market (LP) Rewards[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#market-lp-rewards "Direct link to Market (LP) Rewards") ------------------------------------------------------------------------------------------------------------------------------------------------------------------ **Contract:** `PendleGauge` (inherited by `PendleMarket`) LP holders receive rewards from two sources simultaneously: 1. **SY-native rewards** — pulled via `IStandardizedYield(SY).claimRewards(market)` 2. **PENDLE incentives** — pulled via `IPGaugeController(gaugeController).redeemMarketReward()` Both sources are collected inside `_redeemExternalReward()`. After collection, the standard index mechanism distributes rewards proportionally to LP holders based on their LP token balance. ### Reward shares[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#reward-shares-2 "Direct link to Reward shares") Each LP holder's reward share equals their LP token balance. Total shares = total LP supply. ### `_redeemExternalReward()` internals[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#_redeemexternalreward-internals "Direct link to _redeemexternalreward-internals") function _redeemExternalReward() internal override { IStandardizedYield(SY).claimRewards(address(this)); IPGaugeController(gaugeController).redeemMarketReward();} ### `getRewardTokens`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#getrewardtokens-2 "Direct link to getrewardtokens-2") Returns the SY's reward tokens with PENDLE appended (if not already present). function getRewardTokens() external view returns (address[] memory tokens); | Return Value | Type | Description | | --- | --- | --- | | `tokens` | `address[]` | List of reward token addresses (\[...SY reward tokens, PENDLE\]) | ### `redeemRewards`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#redeemrewards "Direct link to redeemrewards") Updates the global reward index, credits the user, and transfers all accumulated rewards to `user`. function redeemRewards(address user) external returns (uint256[] memory rewardAmounts); | Parameter | Type | Description | | --- | --- | --- | | `user` | `address` | The user to claim rewards for | | Return Value | Type | Description | | --- | --- | --- | | `rewardAmounts` | `uint256[]` | Amounts transferred, one per `getRewardTokens()` entry | * * * Off-Chain Rewards[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#off-chain-rewards "Direct link to Off-Chain Rewards") -------------------------------------------------------------------------------------------------------------------------------------------------------------- **Contract:** `PendleMultiTokenMerkleDistributor` Some reward programs (e.g. voter incentives, partner point campaigns) are computed off-chain and distributed via a Merkle tree rather than the on-chain index mechanism. The protocol owner periodically commits a new Merkle root encoding cumulative `(token, user, totalAccrued)` entitlements. Users claim by supplying a Merkle proof. See [MerkleDistributor](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/MerkleDistributor) for full documentation. * * * Batch Claiming via Router[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#batch-claiming-via-router "Direct link to Batch Claiming via Router") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Pendle Router provides a convenience function to claim rewards across multiple SY, YT, and market positions in a single transaction. For a higher-level interface that handles routing complexity for you, see the [Hosted SDK](https://docs.pendle.finance/pendle-v2/Developers/Backend/HostedSdk) . Important The code below is for illustration only. In production, always interact through the Pendle Router to ensure correct token approvals, slippage protection, and callback handling. router.redeemDueInterestAndRewards( user, sys[], // SY addresses to claim from yts[], // YT addresses to claim from markets[] // Market addresses to claim from); See [MiscFunctions — redeemDueInterestAndRewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewards) for full parameter documentation. ### Example[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#example "Direct link to Example") import { ethers } from "ethers";const router = new ethers.Contract(ROUTER_ADDRESS, ROUTER_ABI, signer);// Claim from one SY, one YT, and one market in a single txconst tx = await router.redeemDueInterestAndRewards( userAddress, [syAddress], // SY positions [ytAddress], // YT positions [marketAddress], // Market (LP) positions);await tx.wait(); * [The Reward Index Accounting Model](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#the-reward-index-accounting-model) * [Core idea](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#core-idea) * [Storage structs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#storage-structs) * [Per-block update guard](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#per-block-update-guard) * [Index update flow](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#index-update-flow) * [SY Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#sy-rewards) * [Reward shares](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#reward-shares) * [`getRewardTokens`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#getrewardtokens) * [`accruedRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#accruedrewards) * [`rewardIndexesCurrent`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#rewardindexescurrent) * [`rewardIndexesStored`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#rewardindexesstored) * [`claimRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#claimrewards) * [YT Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#yt-rewards) * [Reward shares](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#reward-shares-1) * [Post-expiry behaviour](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#post-expiry-behaviour) * [Fee](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#fee) * [`getRewardTokens`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#getrewardtokens-1) * [`redeemDueInterestAndRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#redeemdueinterestandrewards) * [Market (LP) Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#market-lp-rewards) * [Reward shares](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#reward-shares-2) * [`_redeemExternalReward()` internals](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#_redeemexternalreward-internals) * [`getRewardTokens`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#getrewardtokens-2) * [`redeemRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#redeemrewards) * [Off-Chain Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#off-chain-rewards) * [Batch Claiming via Router](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#batch-claiming-via-router) * [Example](https://docs.pendle.finance/pendle-v2/Developers/Contracts/LiquidityMining/Rewards#example) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Pendle Market Smart Contracts | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#__docusaurus_skipToContent_fallback) On this page **Contract:** [`PendleMarketV7`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol) Introduction[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#introduction "Direct link to Introduction") ------------------------------------------------------------------------------------------------------------------------------------ Pendle Market is a specialized Automated Market Maker (AMM) pool designed for trading yields. Each market enables efficient trading between: * **Principal Tokens (PT)** - Tokens that represent the principal component of yield-bearing assets * **Standardized Yield (SY)** - Wrapped yield-bearing assets that standardize yield mechanics Pendle AMM Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#pendle-amm-overview "Direct link to Pendle AMM Overview") --------------------------------------------------------------------------------------------------------------------------------------------------------- Traditional AMMs like Uniswap use constant product formulas (`x × y = k`) that do not account for the unique properties of fixed-yield assets. Pendle Markets implement a sophisticated time-aware AMM based on Notional Finance's AMM model that: * **Recognizes time decay**: PT prices naturally converge to 1 as they approach expiry * **Optimizes for yield trading**: Pricing curves are tailored for interest rate movements * **Maximizes capital efficiency**: Concentrates liquidity around expected yield ranges * **Minimizes Impermanent Loss (IL)**: Pendle's AMM accounts for PT's natural price appreciation by shifting the AMM curve to push PT price towards its underlying value as time passes, mitigating time-dependent IL (No IL at maturity). > **Deep Dive**: For complete mathematical analysis and comparisons, see the [Pendle V2 AMM Whitepaper](https://github.com/pendle-finance/pendle-v2-resources/blob/main/whitepapers/V2_AMM.pdf) Market Parameters[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#market-parameters "Direct link to Market Parameters") --------------------------------------------------------------------------------------------------------------------------------------------------- * **Expiry**: The timestamp when PT tokens can be redeemed 1:1 for underlying assets - drives PT price convergence to 1 as expiry approaches. * **Scalar Root**: Controls the trade-off between capital efficiency and tradeable interest rate range - higher values create tighter, more efficient markets. * **Initial Anchor**: Sets the interest rate around which trading is most capital efficient at market launch - centers liquidity around expected yield levels. * **Fee Rate Root**: Dynamic fees based on interest rate impact rather than token amounts - larger market movements incur proportionally higher fees. Core Logic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#core-logic "Direct link to Core Logic") ------------------------------------------------------------------------------------------------------------------------------ ### [`mint`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L105-L136) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#mint "Direct link to mint") Adds liquidity using PT & SY; mints LP shares proportional to the amounts used. /** * @notice PendleMarket allows users to provide in PT & SY in exchange for LPs, which * will grant LP holders more exchange fee over time * @dev will mint as much LP as possible such that the corresponding SY and PT used do * not exceed `netSyDesired` and `netPtDesired`, respectively * @dev PT and SY should be transferred to this contract prior to calling * @dev will revert if PT is expired */function mint( address receiver, uint256 netSyDesired, uint256 netPtDesired) external returns (uint256 netLpOut, uint256 netSyUsed, uint256 netPtUsed); **Note:** * Caller must transfer PT and SY to the Market before calling. The function mints as many LPs as possible without exceeding `netSyDesired`/`netPtDesired`. ### [`burn`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L142-L159) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#burn "Direct link to burn") Removes liquidity by burning LP shares for pro-rata SY and PT. /** * @notice LP Holders can burn their LP to receive back SY & PT proportionally * to their share of the market */function burn( address receiverSy, address receiverPt, uint256 netLpToBurn) external returns (uint256 netSyOut, uint256 netPtOut); **Note:** caller must transfer LP to the Market before calling. ### [`swapExactPtForSy`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L172-L202) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#swapexactptforsy "Direct link to swapexactptforsy") Swaps an exact amount of PT for SY. /** * @notice Pendle Market allows swaps between PT & SY it is holding. This function * aims to swap an exact amount of PT to SY. * @dev steps working of this contract - The outcome amount of SY will be precomputed by MarketMathLib - Release the calculated amount of SY to receiver - Callback to msg.sender if data.length > 0 - Ensure exactPtIn amount of PT has been transferred to this address * @dev will revert if PT is expired * @param data bytes data to be sent in the callback (if any) */function swapExactPtForSy( address receiver, uint256 exactPtIn, bytes calldata data) external nonReentrant notExpired returns (uint256 netSyOut, uint256 netSyFee); **Note:** caller must transfer PT to the Market first; the Market then sends out the computed SY and (optionally) invokes a callback if data is non-empty. For a deeper understanding of the math behind it, refer to the [`Pendle V2 AMM Whitepaper`](https://github.com/pendle-finance/pendle-v2-resources/blob/main/whitepapers/V2_AMM.pdf) and [`MarketMathCore Contract`](https://github.com/pendle-finance/pendle-core-v2-public/blob/ba53685767bc16e070136b9dbfe02a5dd6258c61/contracts/core/Market/MarketMathCore.sol#L193-L217) . ### [`swapSyForExactPt`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L214-L246) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#swapsyforexactpt "Direct link to swapsyforexactpt") Swaps SY for an exact amount of PT. /** * @notice Pendle Market allows swaps between PT & SY it is holding. This function * aims to swap SY for an exact amount of PT. * @dev steps working of this function - The exact outcome amount of PT will be transferred to receiver - Callback to msg.sender if data.length > 0 - Ensure the calculated required amount of SY is transferred to this address * @dev will revert if PT is expired * @param data bytes data to be sent in the callback (if any) */function swapSyForExactPt( address receiver, uint256 exactPtOut, bytes calldata data) external returns (uint256 netSyIn, uint256 netSyFee); **Note:** the Market sends out exactPtOut to receiver, optionally callbacks msg.sender, and then enforces that the required SY has been provided (typically via `transfer` in the callback/Router). For a deeper understanding of the math behind it, refer to the [`Pendle V2 AMM Whitepaper`](https://github.com/pendle-finance/pendle-v2-resources/blob/main/whitepapers/V2_AMM.pdf) and [`MarketMathCore Contract`](https://github.com/pendle-finance/pendle-core-v2-public/blob/ba53685767bc16e070136b9dbfe02a5dd6258c61/contracts/core/Market/MarketMathCore.sol#L193-L217) . ### [`redeemRewards`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L261-L263) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#redeemrewards "Direct link to redeemrewards") Claims accumulated swap fees/protocol rewards for user (in the order of `getRewardTokens()`). /** * @notice redeems the user's reward * @return amount of reward token redeemed, in the same order as `getRewardTokens()` */function redeemRewards(address user) external returns (uint256[] memory); ### [`increaseObservationsCardinalityNext`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L284-L291) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#increaseobservationscardinalitynext "Direct link to increaseobservationscardinalitynext") Grows the oracle ring buffer to support longer TWAP windows. function increaseObservationsCardinalityNext(uint16 cardinalityNext) external; **Note:** The ring buffer starts with a cardinality of 1. To query TWAP windows longer than the current buffer covers, call this function first to pre-expand the buffer. Anyone can call this; it only increases (never decreases) the cardinality. ### [`skim`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L249-L255) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#skim "Direct link to skim") Forces internal reserves to match actual token balances. /// @notice forces balances to match reservesfunction skim() external; **Note:** If tokens are accidentally sent directly to the market contract (not via a swap/mint), they accumulate as excess. `skim` transfers this excess to the treasury. This is an emergency recovery function; normal integrations do not need to call it. ### [`readState`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L300-L315) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#readstate "Direct link to readstate") Returns the current market state and pricing metadata. struct MarketState { int256 totalPt; // total PT in the market int256 totalSy; // total SY in the market int256 totalLp; // total LP minted address treasury; // treasury address to receive protocol fees int256 scalarRoot; // variable to control the capital efficiency of the market uint256 expiry; // timestamp when market expires /// fee data /// uint256 lnFeeRateRoot; // fee rate in ln uint256 reserveFeePercent; // reserve fee in base 100 /// last trade data /// uint256 lastLnImpliedRate; // last ln(implied rate) observed} /** * @notice read the state of the market from storage into memory for gas-efficient manipulation */function readState(address router) external view returns (MarketState memory market); **Note:** * `lnFeeRateRoot` and `lastLnImpliedRate` are stored/returned as natural-log values in fixed-point form. * The router parameter allows the function to reflect router-specific settings (e.g., fee discounts if applicable). ### [`readTokens`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L348-L352) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#readtokens "Direct link to readtokens") Returns the three token addresses of the market. function readTokens() external view returns ( IStandardizedYield SY, IPPrincipalToken PT, IPYieldToken YT); **Note:** Use this as the canonical way to discover the SY, PT, and YT addresses associated with any market address. ### [`isExpired`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L354-L356) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#isexpired "Direct link to isexpired") Returns whether the market has passed its expiry timestamp. function isExpired() external view returns (bool); **Note:** Swaps and liquidity minting revert after expiry. LP burning and reward claiming remain available post-expiry. ### [`getRewardTokens`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L266-L268) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#getrewardtokens "Direct link to getrewardtokens") Lists all reward tokens distributed to LP holders. function getRewardTokens() external view returns (address[] memory); **Note:** The list includes both SY external rewards (e.g., AAVE incentives passed through the underlying SY) and PENDLE incentives distributed via the gauge controller. Always call this first to map indices before calling `redeemRewards`. ### [`observe`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L274-L282) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#observe "Direct link to observe") Oracle API — reads cumulative implied rates at past time deltas. function observe(uint32[] memory secondsAgos) external view returns (uint216[] memory lnImpliedRateCumulative); **Note:** Each element of `secondsAgos` is a lookback in seconds from the current block (e.g., `[300, 0]` = 5 minutes ago and now). Returns the cumulative `lnImpliedRate` at each point, from which a TWAP can be derived. See the [Oracle section](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#oracle) below and [About the PT Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#about-the-pt-oracle) for details. ### [`getNonOverrideLnFeeRateRoot`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/core/Market/PendleMarketV7.sol#L340-L342) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#getnonoverridelnfeerateroot "Direct link to getnonoverridelnfeerateroot") Returns the base fee rate before any router-specific override. function getNonOverrideLnFeeRateRoot() external view returns (uint80); **Note:** `readState(router)` may return a lower `lnFeeRateRoot` if an override is set for that router. This function always returns the original fee set at market creation. Fee & Rewards[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#fee--rewards "Direct link to Fee & Rewards") -------------------------------------------------------------------------------------------------------------------------------------- ### `reserveFeePercent` (Treasury fee)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#reservefeepercent-treasury-fee "Direct link to reservefeepercent-treasury-fee") A percentage of each swap's fee is sent to Pendle's treasury. The remainder goes to LP providers. `reserveFeePercent` is stored in `MarketState` and is configurable by the factory owner. It is expressed as a value in base 100 (e.g., `80` = 80% of the fee goes to the treasury, 20% to LPs). When `readState(router)` is called, the current `reserveFeePercent` is fetched from the factory's `getMarketConfig` and included in the returned `MarketState`. ### Fee Override Mechanism (Router discount)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#fee-override-mechanism-router-discount "Direct link to Fee Override Mechanism (Router discount)") `PendleMarketFactoryV7Upg.setOverriddenFee(router, market, newFee)` sets a lower fee for a specific router on a specific market. When `readState(router)` is called with that router address, the overridden fee is returned in `MarketState.lnFeeRateRoot` instead of the base fee. This is how the Pendle Router earns a fee discount compared to direct market interaction. * The overridden fee must be strictly lower than `getNonOverrideLnFeeRateRoot()`. * Setting `newFee = 0` is allowed (zero fee for that router). * Only the factory owner can set overrides. ### Reward Mechanism (Gauge)[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#reward-mechanism-gauge "Direct link to Reward Mechanism (Gauge)") The market inherits from `PendleGauge`. LP holders accumulate two types of rewards passively: * **SY external rewards** — incentives from the underlying protocol (e.g., AAVE rewards) that are passed through the SY contract. * **PENDLE incentives** — distributed via the `gaugeController` based on gauge weights. Both types accumulate in proportion to the LP balance held. Call `redeemRewards(user)` to claim all pending rewards. `getRewardTokens()` returns the full ordered list of reward token addresses. Integration Example[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#integration-example "Direct link to Integration Example") --------------------------------------------------------------------------------------------------------------------------------------------------------- Example code only The snippets below are simplified for illustration and **are not audited**. **Do not** use them in production or with real funds. If you adapt any example, conduct a full review, add comprehensive tests, and obtain an independent **security audit**. ### Discover Market Tokens[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#discover-market-tokens "Direct link to Discover Market Tokens") // Discover SY, PT, YT from a market address(IStandardizedYield sy, IPPrincipalToken pt, IPYieldToken yt) = market.readTokens(); ### Basic Swap[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#basic-swap "Direct link to Basic Swap") // Transfer PT to market firstpt.transfer(address(market), ptAmount);// Execute swap (exact PT in → SY out)(uint256 syOut,) = market.swapExactPtForSy( msg.sender, ptAmount, ""); ### Basic Mint[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#basic-mint "Direct link to Basic Mint") // Transfer tokens firstsy.transfer(address(market), syAmount);pt.transfer(address(market), ptAmount);// Mint LP tokens(uint256 lpOut,,) = market.mint( msg.sender, syAmount, ptAmount); ### Claiming LP Rewards[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#claiming-lp-rewards "Direct link to Claiming LP Rewards") // Discover what reward tokens this market distributesaddress[] memory rewardTokens = market.getRewardTokens();// Claim all accumulated rewards for msg.senderuint256[] memory rewardAmounts = market.redeemRewards(msg.sender);// rewardAmounts[i] corresponds to rewardTokens[i]for (uint256 i = 0; i < rewardTokens.length; i++) { // handle rewardTokens[i] with amount rewardAmounts[i]} Flash Swap[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#flash-swap "Direct link to Flash Swap") ------------------------------------------------------------------------------------------------------------------------------ Similar to Uniswap V2, **all Pendle swaps are actually flash swaps**. The Market sends output tokens to the receiver first, then enforces that sufficient input tokens have been received by the end of the transaction. This facilitates advanced use cases like arbitrage, liquidation, and in Pendle specifically, YT trading. ### How It Works[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#how-it-works "Direct link to How It Works") 1. **Market sends output tokens** to receiver immediately 2. **Callback executed** (if data provided) - this is where you implement your logic. You can use the received tokens for arbitrage, liquidation, or other strategies, but you must ensure you transfer the required input tokens back to the Market before the callback ends. 3. **Market checks input tokens** - verifies required tokens were transferred during the transaction Because Ethereum transactions are atomic, the entire swap reverts if the Market doesn't receive enough input tokens. ### Flash Swap Example[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#flash-swap-example "Direct link to Flash Swap Example") Example code only The snippets below are simplified for illustration and **are not audited**. **Do not** use them in production or with real funds. If you adapt any example, conduct a full review, add comprehensive tests, and obtain an independent **security audit**. contract FlashSwapExample is IPMarketSwapCallback { IPendleMarket public market; function flashSwap(uint256 ptAmount) external { // Market will send SY first, then callback to this contract market.swapExactPtForSy( address(this), ptAmount, abi.encode(msg.sender) // data for callback ); } // Callback - Market has already sent SY to this contract function swapCallback( int256 ptToAccount, // negative = we owe PT to market int256 syToAccount, // positive = we received SY from market bytes calldata data ) external { require(msg.sender == address(market)); // Your custom logic here (arbitrage, liquidation, etc.) // ... // Must transfer required PT to market before callback ends uint256 ptOwed = uint256(-ptToAccount); IERC20(market.PT()).transfer(address(market), ptOwed); }} ### Interface[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#interface "Direct link to Interface") interface IPMarketSwapCallback { function swapCallback(int256 ptToAccount, int256 syToAccount, bytes calldata data) external;} Oracle[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#oracle "Direct link to Oracle") ------------------------------------------------------------------------------------------------------------------ Pendle Markets provide oracle functionality for PT pricing and implied yield rates, adapted from Uniswap V3's time-weighted average price (TWAP) oracle. ### How It Works[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#how-it-works-1 "Direct link to How It Works") The oracle stores **implied rate observations** over time, which are then used to calculate manipulation-resistant PT prices and yields. **Key Formula:** lnImpliedRateCumulativei\=lnImpliedRateCumulativei−1+lnImpliedRate×Δt\\text{lnImpliedRateCumulative}\_i = \\text{lnImpliedRateCumulative}\_{i-1} + \\text{lnImpliedRate} \\times \\Delta tlnImpliedRateCumulativei​\=lnImpliedRateCumulativei−1​+lnImpliedRate×Δt where **lnImpliedRate** is the natural logarithm of the implied interest rate at the current market state, and **Δt** is the time elapsed. From these cumulative values, you can compute the **geometric mean price of PT** over a given interval (see [About the PT Oracle](https://docs.pendle.finance/pendle-v2/Developers/Oracles/OracleOverview#about-the-pt-oracle) for details). ### Integration Guide[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#integration-guide "Direct link to Integration Guide") See [How to Integrate PT and LP Oracles](https://docs.pendle.finance/pendle-v2/Oracles/HowToIntegratePtAndLpOracle) for implementation details. FAQ[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#faq "Direct link to FAQ") --------------------------------------------------------------------------------------------------------- ### Why is there no swapExactSy function?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#why-is-there-no-swapexactsy-function "Direct link to Why is there no swapExactSy function?") Unlike standard AMMs, Pendle's AMM only allows swapping exact PT in/out. Therefore, functions like `swapExactSyForPt` and `swapPtForExactSy` should generally be avoided. If necessary, use PendleRouter's `swapExactSyForPt` with approx parameters. Refer to the [PendleRouter documentation](https://docs.pendle.finance/pendle-v2/Developers/PendleRouter/ApiReference/PtFunctions#swapexactsyforpt) for details. ### How can I trade YT tokens when the Market only contains PT and SY?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#how-can-i-trade-yt-tokens-when-the-market-only-contains-pt-and-sy "Direct link to How can I trade YT tokens when the Market only contains PT and SY?") YT tokens can be traded via [flash swaps](https://docs.pendle.finance/ProtocolMechanics/LiquidityEngines/AMM#flash-swaps) . Use the PendleRouter's `swapExactTokenForYt` or `swapExactYtForToken` functions, which handle the necessary flash swap logic and token transfers. Refer to the [PendleRouter documentation](https://docs.pendle.finance/pendle-v2/Developers/PendleRouter/ApiReference/YtFunctions#swapexacttokenforyt) for details. ### Why can't I swap PT after expiry?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#why-cant-i-swap-pt-after-expiry "Direct link to Why can't I swap PT after expiry?") At expiry, PT can be redeemed for the underlying asset. Market-making no longer makes economic sense at this point and would enable circular arbitrage. To redeem PT post-expiry, use the [Router](https://docs.pendle.finance/pendle-v2/Developers/PendleRouter/ApiReference/LiquidityFunctions#removeliquiditysingletoken) . ### Should I use the Router or interact with the Market directly?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#should-i-use-the-router-or-interact-with-the-market-directly "Direct link to Should I use the Router or interact with the Market directly?") * Use the Router for: * Any operations involving YT. * Swaps using tokens other than the underlying (since additional swaps are required). * Fee discounts, slippage protection, etc. * Interact directly with the Market for: * Simple PT ↔ SY swaps. * Flash swaps. * Highly gas-optimized integrations where you manage token transfers and slippage manually. * [Introduction](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#introduction) * [Pendle AMM Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#pendle-amm-overview) * [Market Parameters](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#market-parameters) * [Core Logic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#core-logic) * [`mint`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#mint) * [`burn`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#burn) * [`swapExactPtForSy`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#swapexactptforsy) * [`swapSyForExactPt`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#swapsyforexactpt) * [`redeemRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#redeemrewards) * [`increaseObservationsCardinalityNext`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#increaseobservationscardinalitynext) * [`skim`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#skim) * [`readState`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#readstate) * [`readTokens`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#readtokens) * [`isExpired`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#isexpired) * [`getRewardTokens`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#getrewardtokens) * [`observe`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#observe) * [`getNonOverrideLnFeeRateRoot`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#getnonoverridelnfeerateroot) * [Fee & Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#fee--rewards) * [`reserveFeePercent` (Treasury fee)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#reservefeepercent-treasury-fee) * [Fee Override Mechanism (Router discount)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#fee-override-mechanism-router-discount) * [Reward Mechanism (Gauge)](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#reward-mechanism-gauge) * [Integration Example](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#integration-example) * [Discover Market Tokens](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#discover-market-tokens) * [Basic Swap](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#basic-swap) * [Basic Mint](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#basic-mint) * [Claiming LP Rewards](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#claiming-lp-rewards) * [Flash Swap](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#flash-swap) * [How It Works](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#how-it-works) * [Flash Swap Example](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#flash-swap-example) * [Interface](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#interface) * [Oracle](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#oracle) * [How It Works](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#how-it-works-1) * [Integration Guide](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#integration-guide) * [FAQ](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#faq) * [Why is there no swapExactSy function?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#why-is-there-no-swapexactsy-function) * [How can I trade YT tokens when the Market only contains PT and SY?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#how-can-i-trade-yt-tokens-when-the-market-only-contains-pt-and-sy) * [Why can't I swap PT after expiry?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#why-cant-i-swap-pt-after-expiry) * [Should I use the Router or interact with the Market directly?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket#should-i-use-the-router-or-interact-with-the-market-directly) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Common SY Contracts | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#overview "Direct link to Overview") -------------------------------------------------------------------------------------------------------------------------------------- Pendle provides a set of **pre-built, audited** Standardized Yield (SY) implementations that cover the most common yield-bearing asset patterns. Partners doing a [Community Listing](https://docs.pendle.finance/pendle-v2/Developers/Contracts/Integration/CommunityListing.md) should use one of these contracts when their asset fits — this avoids the overhead of writing and auditing a custom SY from scratch. These contracts can be deployed through [`PendleCommonSYFactory`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/offchain-helpers/deploy/PendleCommonSYFactory.sol) , described at the bottom of this page. tip When in doubt about which common SY to use, reach out to the Pendle team. Choosing the wrong type can result in incorrect `exchangeRate()` behavior or broken deposit/redeem paths. * * * Choosing the Right Common SY[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#choosing-the-right-common-sy "Direct link to Choosing the Right Common SY") -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | Type | Yield token type | `exchangeRate()` | Deposit tokens | Redeem tokens | | --- | --- | --- | --- | --- | | **ERC-20 with Adapter** | Plain ERC-20 + optional adapter tokens | `1e18` (constant) | yieldToken + adapter tokens | yieldToken + adapter tokens | | **ERC-20 with Oracle** | Plain ERC-20, rate from oracle | From oracle | yieldToken | yieldToken | | **ERC-4626 with Adapter** | ERC-4626 vault, full deposit/redeem + optional adapter | `vault.convertToAssets(1e18)` | asset, yieldToken + adapter tokens | asset, yieldToken + adapter tokens | | **ERC-4626 — No Redeem with Adapter** | ERC-4626 vault, restricted withdraw + optional adapter | `vault.convertToAssets(1e18)` | asset, yieldToken + adapter tokens | yieldToken only | | **ERC-4626 — No Redeem, No Deposit** | ERC-4626, both deposit and withdraw restricted | `vault.convertToAssets(1e18)` | yieldToken only | yieldToken only | note All `WithAdapter` variants accept `adapter = address(0)` if no adapter is needed at deploy time. An adapter can be set later via `SY.setAdapter(adapterAddress)`. * * * Common SY Types[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#common-sy-types "Direct link to Common SY Types") ----------------------------------------------------------------------------------------------------------------------------------------------------------- ### ERC-20 with Adapter — [`PendleERC20WithAdapterSY`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/StandardizedYield/implementations/Adapter/extensions/PendleERC20WithAdapterSY.sol) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-20-with-adapter--pendleerc20withadaptersy "Direct link to erc-20-with-adapter--pendleerc20withadaptersy") A 1:1 wrap of a plain ERC-20 token, with optional [adapter](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#sy-adapters) support for depositing and redeeming via additional tokens. **When to use:** The yield token is a standard non-rebasing ERC-20 whose share price against itself is always 1 (`1 SY = 1 yieldToken`). Yield in Pendle comes from **external incentives** (points, Merkle distributions) rather than on-chain token appreciation. If additional deposit/redeem tokens are needed (e.g., deposit `DAI` to receive `USDS`), attach an adapter. Common examples: `USDe`, `USDS`, reward tokens with fixed exchange rate. **Key behaviors:** * `exchangeRate()` = `1e18` (constant — no on-chain appreciation) * `PIVOT_TOKEN` (adapter's pivot) = `yieldToken` * `assetInfo()` returns `yieldToken` itself as the asset * Without adapter: `getTokensIn()` / `getTokensOut()` = `[yieldToken]` * With adapter: adds `adapter.getAdapterTokensDeposit()` / `getAdapterTokensRedeem()` to the lists **Constructor params** (for `deployUpgradableSY`): bytes memory constructorParams = abi.encode( address _erc20, address _offchainRewardManager);bytes memory initData = abi.encodeWithSelector( PendleERC20WithAdapterSY.initialize.selector, string _name, // e.g. "SY USDS" string _symbol, // e.g. "SY-USDS" address _adapter // address(0) if no adapter needed at deploy time); * * * ### ERC-20 with Oracle — [`PendleERC20WithOracleSY`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/StandardizedYield/implementations/PendleERC20WithOracleSY.sol) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-20-with-oracle--pendleerc20withoraclesy "Direct link to erc-20-with-oracle--pendleerc20withoraclesy") A plain ERC-20 wrap where `exchangeRate()` is sourced from an external `IPExchangeRateOracle` contract and `assetInfo()` returns a separately specified underlying asset. **When to use:** The exchange rate of the yield token against its underlying asset cannot be computed on-chain from the token itself — for example, a token bridged from another chain where the vault state lives. The rate is instead published on-chain via a dedicated oracle contract. **Example:** `sUSDai` is an Arbitrum-native savings token. It is bridged to Plasma as a LayerZero OFT. On Plasma the vault's `convertToAssets` logic is unavailable, so a Chainlink feed is deployed to publish the `sUSDai / USDai` exchange rate. The SY on Plasma points `exchangeRateOracle` at that Chainlink adapter. **Key behaviors:** * `exchangeRate()` = `IPExchangeRateOracle(exchangeRateOracle).getExchangeRate()` * `assetInfo()` returns `underlyingAsset` (separate from `yieldToken`) * `getTokensIn()` / `getTokensOut()` = `[yieldToken]` **Constructor params** (for `deployUpgradableSY`): bytes memory constructorParams = abi.encode( address _yieldToken, // the ERC-20 yield token (e.g. sUSDai OFT on Plasma) address _underlyingAsset, // asset it appreciates against (e.g. USDai) address _exchangeRateOracle, // IPExchangeRateOracle (e.g. Chainlink feed adapter) address _offchainRewardManager);bytes memory initData = abi.encodeWithSelector( PendleERC20WithOracleSY.initialize.selector, string _name, string _symbol, address _owner); **`IPExchangeRateOracle` implementations** Pendle ships two ready-to-use oracle adapters that implement `IPExchangeRateOracle`. Deploy one of these and pass its address as `_exchangeRateOracle`. #### [`PendleChainlinkExchangeRateWrapper`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/misc/PendleChainlinkExchangeRateWrapper.sol) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#pendlechainlinkexchangeratewrapper "Direct link to pendlechainlinkexchangeratewrapper") Wraps any Chainlink-compatible aggregator (`AggregatorV2V3Interface`). Reads `latestRoundData()` and normalises the answer to the 1e18 scale expected by the SY. constructor( address _chainlinkFeed, // Chainlink aggregator address int8 _tokenDecimalsOffset // decimal adjustment: see note below) `tokenDecimalsOffset` bridges the gap between the feed's native decimals and the SY's required scale: * `offset < 0` → result is **multiplied** by `10^|offset|` (feed has fewer decimals than needed) * `offset > 0` → result is **divided** by `10^offset` (feed has more decimals than needed) * `offset = 0` → feed decimals already match; only `oracleDecimals` normalisation is applied #### [`PendleRedStoneRateOracleAdapter`](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/oracles/internal/PendleRedStoneRateOracleAdapter.sol) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#pendleredstonerateoracleadapter "Direct link to pendleredstonerateoracleadapter") Wraps a RedStone push-model price feed (`IRedstonePriceFeed`). Reads `latestAnswer()` and rescales from the feed's `rawDecimals` to the target `decimals`. constructor( address _redStoneOracle, // RedStone push-feed address uint8 _decimals // desired output decimals (typically 18))// getExchangeRate() output:// (latestAnswer * 10^decimals) / 10^rawDecimals * * * ### ERC-4626 with Adapter — [`PendleERC4626WithAdapterSY`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/StandardizedYield/implementations/Adapter/extensions/PendleERC4626WithAdapterSY.sol) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-4626-with-adapter--pendleerc4626withadaptersy "Direct link to erc-4626-with-adapter--pendleerc4626withadaptersy") A full [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) vault wrap with bidirectional deposit and redemption, plus optional [adapter](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#sy-adapters) support for additional deposit/redeem tokens. **When to use:** The yield token is a fully ERC-4626 compliant vault with unrestricted `deposit()` and `redeem()`. Users can enter and exit via the vault's underlying asset. If users should also be able to enter/exit with other tokens natively (e.g., deposit USDC → adapter converts USDC → vault asset → vault shares), attach an adapter. Common examples: `sUSDe`, `sDAI`, Morpho vaults. **Key behaviors:** * `exchangeRate()` = `IERC4626(yieldToken).convertToAssets(1e18)` * `PIVOT_TOKEN` (adapter's pivot) = vault's `asset` * `assetInfo()` returns the vault's `asset()` * Without adapter: `getTokensIn()` / `getTokensOut()` = `[asset, yieldToken]` * With adapter: adds `adapter.getAdapterTokens*()` to both lists **Deposit flow with adapter token:** 1. Non-asset token `T` is transferred to the adapter 2. `adapter.convertToDeposit(T, amount)` converts `T → asset` 3. `IERC4626(yieldToken).deposit(amtAsset, address(this))` mints vault shares **Constructor params** (for `deployUpgradableSY`): bytes memory constructorParams = abi.encode( address _erc4626, address _offchainRewardManager);bytes memory initData = abi.encodeWithSelector( PendleERC4626WithAdapterSY.initialize.selector, string _name, string _symbol, address _adapter // address(0) if no adapter needed at deploy time); * * * ### ERC-4626 — No Redeem with Adapter — [`PendleERC4626NoRedeemWithAdapterSY`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/StandardizedYield/implementations/Adapter/extensions/PendleERC4626NoRedeemWithAdapterSY.sol) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-4626--no-redeem-with-adapter--pendleerc4626noredeemwithadaptersy "Direct link to erc-4626--no-redeem-with-adapter--pendleerc4626noredeemwithadaptersy") An ERC-4626 wrap where **depositing** via the underlying asset is supported, but **redeeming back to the underlying asset is not**. Optional [adapter](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#sy-adapters) support for extended deposit tokens. **When to use:** The vault supports `deposit()` but has restricted or locked `redeem()` (e.g., cooldown periods, liquidity limits, or protocol-level withdrawal queues). Users who want to exit to the underlying asset must do so through secondary markets or the vault's own withdrawal mechanism. Add an adapter if users should be able to deposit using tokens other than `asset`. **Key behaviors:** * `exchangeRate()` = `IERC4626(yieldToken).convertToAssets(1e18)` * `PIVOT_TOKEN` (adapter's pivot) = vault's `asset` * `getTokensIn()` = `[asset, yieldToken] + adapter.getAdapterTokensDeposit()` (with adapter) * `getTokensOut()` = `[yieldToken]` only — adapter is **not** used on the redeem side **Constructor params** (for `deployUpgradableSY`): same as `PendleERC4626WithAdapterSY` above. * * * ### ERC-4626 — No Redeem, No Deposit — [`PendleERC4626NoRedeemNoDepositUpgSY`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/StandardizedYield/implementations/PendleERC4626NoRedeemNoDepositUpgSY.sol) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-4626--no-redeem-no-deposit--pendleerc4626noredeemnodepositupgsy "Direct link to erc-4626--no-redeem-no-deposit--pendleerc4626noredeemnodepositupgsy") The most restrictive ERC-4626 variant. Neither `deposit()` nor `redeem()` is called on the vault — the SY only wraps existing vault shares. **When to use:** The vault does not support standard ERC-4626 `deposit(asset)` or `redeem(shares)` flows at all. Users must already hold vault shares; the SY is purely a wrapper that reads the vault's exchange rate. Common for locked positions, receipt tokens from bespoke protocols, or vaults with fully non-standard deposit mechanisms. **Key behaviors:** * `exchangeRate()` = `IERC4626(yieldToken).convertToAssets(1e18)` * `getTokensIn()` = `[yieldToken]` only * `getTokensOut()` = `[yieldToken]` only **Constructor params** (for `deployUpgradableSY`): bytes memory constructorParams = abi.encode( address _erc4626, address _offchainRewardManager);bytes memory initData = abi.encodeWithSelector( PendleERC4626NoRedeemNoDepositUpgSY.initialize.selector, string _name, string _symbol); * * * SY Adapters[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#sy-adapters "Direct link to SY Adapters") ----------------------------------------------------------------------------------------------------------------------------------------------- ### What Is an Adapter?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#what-is-an-adapter "Direct link to What Is an Adapter?") An SY Adapter is an optional contract that extends a Common SY's supported deposit and redeem tokens beyond the base set (`yieldToken` and, for ERC-4626, `asset`). Without an adapter, the Pendle Router must rely on DEX swaps to convert between a user's token and the SY's base token, incurring price impact and fees. An adapter performs this conversion **natively and atomically**. **Example:** A `PendleERC20WithAdapterSY` wrapping `USDS` can, via an adapter, accept `DAI` deposits. The adapter calls the Sky `DAI → USDS` converter on-chain. No DEX swap is needed. An adapter is a **separate contract** plugged into the SY after deployment via `SY.setAdapter(adapterAddress)`. This lets adapters be added or swapped without redeploying the SY or migrating the market. ### `IStandardizedYieldAdapter` Interface[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#istandardizedyieldadapter-interface "Direct link to istandardizedyieldadapter-interface") [Source](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/interfaces/IStandardizedYieldAdapter.sol) interface IStandardizedYieldAdapter { /// @notice The intermediate token this adapter converts to/from. /// For ERC-20 SY: PIVOT_TOKEN = yieldToken /// For ERC-4626 SY: PIVOT_TOKEN = vault's asset function PIVOT_TOKEN() external view returns (address pivotToken); /// @notice Convert tokenIn → PIVOT_TOKEN. /// @dev tokenIn has already been transferred to this adapter before this call. function convertToDeposit(address tokenIn, uint256 amountTokenIn) external returns (uint256 amountOut); /// @notice Convert PIVOT_TOKEN → tokenOut. /// @dev PIVOT_TOKEN has already been transferred to this adapter before this call. function convertToRedeem(address tokenOut, uint256 amountPivotTokenIn) external returns (uint256 amountOut); /// @notice Preview convertToDeposit (off-chain / view). function previewConvertToDeposit(address tokenIn, uint256 amountTokenIn) external view returns (uint256 amountOut); /// @notice Preview convertToRedeem (off-chain / view). function previewConvertToRedeem(address tokenOut, uint256 amountPivotTokenIn) external view returns (uint256 amountOut); /// @notice Tokens this adapter accepts for deposit. function getAdapterTokensDeposit() external view returns (address[] memory tokens); /// @notice Tokens this adapter can output on redeem. function getAdapterTokensRedeem() external view returns (address[] memory tokens);} ### `PIVOT_TOKEN` — The Adapter's Bridge[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#pivot_token--the-adapters-bridge "Direct link to pivot_token--the-adapters-bridge") The key concept is the **pivot token**: the token the adapter converts _to_ on deposit and _from_ on redeem. | SY type | `PIVOT_TOKEN` | What the adapter converts | | --- | --- | --- | | ERC-20 with Adapter | `yieldToken` | `tokenIn → yieldToken` on deposit; `yieldToken → tokenOut` on redeem | | ERC-4626 with Adapter | vault's `asset` | `tokenIn → asset` on deposit; `asset → tokenOut` on redeem | | ERC-4626 No Redeem with Adapter | vault's `asset` | `tokenIn → asset` on deposit; _(redeem not supported)_ | When `SY.setAdapter(_adapter)` is called, it validates that `adapter.PIVOT_TOKEN() == expected pivot`. This prevents accidentally attaching an adapter designed for a different SY type. ### Example: `PendleSUSDSAdapter`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#example-pendlesusdsadapter "Direct link to example-pendlesusdsadapter") [Source](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/StandardizedYield/implementations/Adapter/examples/PendleSUSDSAdapter.sol) This adapter allows a `PendleERC20WithAdapterSY` wrapping `USDS` to accept `DAI` as a deposit/redeem token. The Sky protocol provides a 1:1 DAI ↔ USDS converter. contract PendleSUSDSAdapter is IStandardizedYieldAdapter { address public constant USDS = 0xdC035D45d973E3EC169d2276DDab16f1e407384F; address public constant DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; address public constant PIVOT_TOKEN = USDS; // yieldToken of the SY // On deposit: DAI (already in adapter) → USDS (sent back to SY) function convertToDeposit(address, uint256 amountTokenIn) external override returns (uint256) { ISkyConverter(CONVERTER).daiToUsds(msg.sender, amountTokenIn); return amountTokenIn; // 1:1 } // On redeem: USDS (already in adapter) → DAI (sent back to SY) function convertToRedeem(address, uint256 amountPivotToken) external override returns (uint256) { ISkyConverter(CONVERTER).usdsToDai(msg.sender, amountPivotToken); return amountPivotToken; // 1:1 } function getAdapterTokensDeposit() external pure override returns (address[] memory tokens) { tokens = new address[](1); tokens[0] = DAI; } function getAdapterTokensRedeem() external pure override returns (address[] memory tokens) { tokens = new address[](1); tokens[0] = DAI; }} With this adapter attached: * `SY.deposit(DAI, amount)`: `DAI → adapter.convertToDeposit → USDS → SY holds USDS` * `SY.redeem(DAI, amount)`: `SY releases USDS → adapter.convertToRedeem → DAI → user` ### Writing Your Own Adapter[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#writing-your-own-adapter "Direct link to Writing Your Own Adapter") Partners are responsible for writing, testing, and auditing their own adapters. Key requirements: 1. **`PIVOT_TOKEN` must match** the SY's expected pivot (`yieldToken` for ERC-20 SY; vault `asset` for ERC-4626 SY). 2. **`convertToDeposit` and `convertToRedeem` are stateful** — they receive the input token pre-transferred and must send the output to `msg.sender` (the SY contract). 3. **`previewConvert*` functions are view** — used by `SY.previewDeposit`/`SY.previewRedeem`. They should match the actual conversion as closely as possible. 4. **Approvals must be set in the constructor** — the adapter typically needs infinite approvals to external converters/routers. Reference implementation: [`PendleSUSDSAdapter`](https://github.com/pendle-finance/pendle-sy-public/blob/main/contracts/core/StandardizedYield/implementations/Adapter/examples/PendleSUSDSAdapter.sol) * * * Deploying via `PendleCommonSYFactory`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#deploying-via-pendlecommonsyfactory "Direct link to deploying-via-pendlecommonsyfactory") ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [Source](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/offchain-helpers/deploy/PendleCommonSYFactory.sol) `PendleCommonSYFactory` is the on-chain factory for deploying all common SY contracts. It uses a split-code deployment pattern (`BaseSplitCodeFactory`) to work around the EVM's contract size limit. **Deployment address (all supported chains):** `0x466CeD3b33045Ea986B2f306C8D0aA8067961CF8` ### `deployUpgradableSY`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#deployupgradablesy "Direct link to deployupgradablesy") function deployUpgradableSY( bytes32 id, bytes memory constructorParams, // abi-encoded constructor args for the implementation bytes memory initData, // abi-encoded initialize(...) call for the proxy address syOwner) external returns (address SY); // returns the proxy address Deploys an implementation contract and wraps it in a `TransparentUpgradeableProxy`. `initData` is the ABI-encoded call to the `initialize(...)` function. The returned address is the proxy — this is the SY address to use. ### Registered Type IDs[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#registered-type-ids "Direct link to Registered Type IDs") These are the `bytes32 id` values registered in the factory for each common SY type. Each `bytes32` value is the `keccak256` hash of the corresponding ID string. | SY Type | ID string | `bytes32` value | | --- | --- | --- | | ERC-20 with Adapter | `"PendleERC20WithAdapterSY"` | `0xe5cce2b1999bf8c2cc4cf6d96d0569a24d8b782ba1647c09a8e1aa8bbfb98996` | | ERC-4626 with Adapter | `"PendleERC4626WithAdapterSY"` | `0x73f41560741d6765943d3c955034291fe23d9141e3a4719bc97422d5bf019adc` | | ERC-4626 — No Redeem with Adapter | `"PendleERC4626NoRedeemWithAdapterSY"` | `0x3b8dd2b992f773444e5422ba1db289c4657c57110d740dca7975dc095632ef23` | | ERC-4626 — No Redeem, No Deposit | `"PendleERC4626NoRedeemNoDepositUpgSY"` | `0x5c1cddc0128e0b02bb711f84a022bf1c13177d4ab028830b702f3a77280025ea` | ### Deploying via `PendleCommonPoolDeployHelperV2`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#deploying-via-pendlecommonpooldeployhelperv2 "Direct link to deploying-via-pendlecommonpooldeployhelperv2") [Source](https://github.com/pendle-finance/pendle-core-v2-public/blob/main/contracts/offchain-helpers/deploy/PendleCommonPoolDeployHelperV2.sol) `PendleCommonPoolDeployHelperV2` wraps the factory with market deployment and liquidity seeding into a single transaction. Use `deployCommonMarketById` for all common SY types: function deployCommonMarketById( bytes32 id, bytes memory constructorParams, bytes memory initData, PoolConfig memory config, address tokenToSeedLiquidity, uint256 amountToSeed, address syOwner) external returns (PoolDeploymentAddrs memory); This deploys the SY (via `deployUpgradableSY`), then immediately calls `deploy5115MarketAndSeedLiquidity` to create the Pendle market and seed initial liquidity. See [Common Market Deployments](https://docs.pendle.finance/pendle-v2/Developers/Contracts/PendleMarket/CommonMarketDeployments) for full details on `PoolConfig` and the seeding flow. * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#overview) * [Choosing the Right Common SY](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#choosing-the-right-common-sy) * [Common SY Types](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#common-sy-types) * [ERC-20 with Adapter — `PendleERC20WithAdapterSY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-20-with-adapter--pendleerc20withadaptersy) * [ERC-20 with Oracle — `PendleERC20WithOracleSY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-20-with-oracle--pendleerc20withoraclesy) * [ERC-4626 with Adapter — `PendleERC4626WithAdapterSY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-4626-with-adapter--pendleerc4626withadaptersy) * [ERC-4626 — No Redeem with Adapter — `PendleERC4626NoRedeemWithAdapterSY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-4626--no-redeem-with-adapter--pendleerc4626noredeemwithadaptersy) * [ERC-4626 — No Redeem, No Deposit — `PendleERC4626NoRedeemNoDepositUpgSY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#erc-4626--no-redeem-no-deposit--pendleerc4626noredeemnodepositupgsy) * [SY Adapters](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#sy-adapters) * [What Is an Adapter?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#what-is-an-adapter) * [`IStandardizedYieldAdapter` Interface](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#istandardizedyieldadapter-interface) * [`PIVOT_TOKEN` — The Adapter's Bridge](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#pivot_token--the-adapters-bridge) * [Example: `PendleSUSDSAdapter`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#example-pendlesusdsadapter) * [Writing Your Own Adapter](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#writing-your-own-adapter) * [Deploying via `PendleCommonSYFactory`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#deploying-via-pendlecommonsyfactory) * [`deployUpgradableSY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#deployupgradablesy) * [Registered Type IDs](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#registered-type-ids) * [Deploying via `PendleCommonPoolDeployHelperV2`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/StandardizedYield/CommonSY#deploying-via-pendlecommonpooldeployhelperv2) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) --- # Yield Tokenization Smart Contracts | Pendle Documentation [Skip to main content](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#__docusaurus_skipToContent_fallback) On this page Overview[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#overview "Direct link to Overview") ----------------------------------------------------------------------------------------------------------------------------- This guide explains how Pendle tokenizes yield by splitting assets into PT (Principal Token) and YT (Yield Token), and how the YT contract handles minting and redeeming, index accounting, and the distribution of interest and rewards. This documentation is for developers and partners who want a deep dive into the Pendle yield mechanism and how it works under the hood. Key Concepts[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#key-concepts "Direct link to Key Concepts") ----------------------------------------------------------------------------------------------------------------------------------------- Yield tokenization takes a yield-bearing asset, then splits that value into two claims with a fixed expiry: * [PT (Principal Token)](https://docs.pendle.finance/ProtocolMechanics/YieldTokenization/PT) : represents the principal of the underlying yield-bearing token. * [YT (Yield Token)](https://docs.pendle.finance/ProtocolMechanics/YieldTokenization/YT) : represents entitlement to all yield, rewards, and points of the asset until expiry. Example: A user stakes 100 USDe in Ethena and, via Pendle, tokenizes it into 100 PT-USDe and 100 YT-USDe with a 3-month expiry. They can sell the YT-USDe to someone who wants the next three months of yield and points while keeping the PT-USDe to redeem the principal at maturity; assuming a 12% APY (~3% over three months), the position would accrue about 3 USDe - so at expiry the YT-USDe holder is entitled to ~3 USDe of accrued yield (plus any program points earned during that period), and the PT-USDe holder redeems the 100 USDe principal. Technical Details[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#technical-details "Direct link to Technical Details") -------------------------------------------------------------------------------------------------------------------------------------------------------- The Pendle yield-tokenization architecture comprises three core components: * **Standardized Yield (SY):** A unified wrapper interface for yield-bearing assets; underlying yield and rewards accrue to the SY contract. * **YT contract:** The core logic that splits SY into PT and YT, maintains index accounting, and accrues/distributes yield and rewards. * **PT contract:** The ERC-20 representing principal; PT is minted/burned by the YT contract and is redeemable for principal at/after maturity. ![PT and YT Yield Stream](https://docs.pendle.finance/assets/images/sy_pt_yt_yield_stream-8f443485f597fa9ee0246701254e902f.png) Before splitting, yield-bearing assets are wrapped into SY. To tokenize yield, users deposit SY into the YT contract, which mints PT and YT. The YT contract tracks yield and rewards accrued to the SY and distributes them to YT holders. At maturity, PT holders can redeem their principal from the YT contract. Core Logic[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#core-logic "Direct link to Core Logic") ----------------------------------------------------------------------------------------------------------------------------------- ### [`mintPY`](https://github.com/pendle-finance/pendle-core-v2-public/blob/ba53685767bc16e070136b9dbfe02a5dd6258c61/contracts/core/YieldContracts/PendleYieldToken.sol#L84-L100) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#mintpy "Direct link to mintpy") /** * @notice Tokenize SY into PT + YT of equal qty. Every unit of asset of SY will create 1 PT + 1 YT * @dev SY must be transferred to this contract prior to calling */function mintPY(address receiverPT, address receiverYT) external returns (uint256 amountPYOut); **Purpose**: Mints equal amounts of PT and YT by depositing SY into the YT contract. **How it works:** * The YT contract mints using its current SY balance. Therefore, you must transfer SY into the YT contract before calling the function. The amount of PT and YT minted is calculated as: PY  minted\=SY  deposited×current  PY  indexPY \\; minted = SY \\; deposited \\times current \\; PY \\; indexPYminted\=SYdeposited×currentPYindex * The YT contract mints equal quantities of PT and YT to the specified recipient addresses. **Example:** * If `1 SY-sUSDe = 1.2 USDe` (`PY index = 1.2`) and a user deposits `100 SY-sUSDe`, the contract mints `120 PT-sUSDe` and `120 YT-sUSDe`. * Since `100 SY-sUSDe` corresponds to `120 USDe` of underlying value, the user receives `120 PT-sUSDe` (principal exposure) and `120 YT-sUSDe` (pre-expiry yield claim). ### [`redeemPY`](https://github.com/pendle-finance/pendle-core-v2-public/blob/ba53685767bc16e070136b9dbfe02a5dd6258c61/contracts/core/YieldContracts/PendleYieldToken.sol#L120-L134) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#redeempy "Direct link to redeempy") /** * @notice converts PT(+YT) tokens into SY, but interests & rewards are not redeemed at the * same time * @dev PT/YT must be transferred to this contract prior to calling */function redeemPY(address receiver) external returns (uint256 amountSyOut); **Purpose:** Redeem SY by burning PT and YT. Think of this as converting back to the principal accounting unit, while **interest and rewards are claimed separately**. **How it works:** * You have to provide equal amounts of PT and YT to the YT contract before calling the function. * The contract burns the tokens and returns SY according to the current PY index: SY  redeemed\=PY  burned  ÷current  PY  indexSY \\; redeemed = PY \\; burned \\; \\div current \\; PY \\; indexSYredeemed\=PYburned÷currentPYindex * The redeemed SY is sent to the specified receiver. Note that interest and rewards accrued to YT are not included in this redemption. **Notes:** * **Pre-expiry:** both PT and YT are required to redeem SY. * **Post-expiry:** only PT is required (YT has no value after maturity). **Example:** **Pre-expiry** * Continuing the prior example: if the user holds `120 PT-sUSDe` and `120 YT-sUSDe`, and now the PY index is `1.25`, then `SY_out = 120 / 1.25 = 96 SY-sUSDe` (which corresponds to **120 USDe**). Interest and rewards accrued to YT are **not** included in this redemption. **Post-expiry** * After maturity, with `120 PT-sUSDe` and PY index `1.25`, `SY_out = 120 / 1.25 = 96 SY-sUSDe` (again equal to **120 USDe**). The user receives `96 SY-sUSDe`, which can be unwrapped or swapped back to the underlying **120 USDe** principal. ### [`redeemDueInterestAndRewards`](https://github.com/pendle-finance/pendle-core-v2-public/blob/ba53685767bc16e070136b9dbfe02a5dd6258c61/contracts/core/YieldContracts/PendleYieldToken.sol#L150-L186) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#redeemdueinterestandrewards "Direct link to redeemdueinterestandrewards") /** * @notice Redeems interests and rewards for `user` * @param redeemInterest will only transfer out interest for user if true * @param redeemRewards will only transfer out rewards for user if true * @dev With YT yielding interest in the form of SY, which is redeemable by users, the reward * distribution should be based on the amount of SYs that their YT currently represent, plus * their dueInterest. It has been proven and tested that _rewardSharesUser will not change over * time, unless users redeem their dueInterest or redeemPY. Due to this, it is required to * update users' accruedReward STRICTLY BEFORE transferring out their interest. */function redeemDueInterestAndRewards( address user, bool redeemInterest, bool redeemRewards) external returns (uint256 interestOut, uint256[] memory rewardsOut); **Purpose:** Allows a YT holder to claim accrued earnings: interest (in SY) and any external reward tokens. Interest for YT is **always paid in SY**, but it can be swapped into your preferred token through the [router](https://docs.pendle.finance/pendle-v2/Developers/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewardsv2) . **Behavior notes:** * **Interest unit:** Always **SY**. If you want the underlying/base asset, unwrap or swap through the [router](https://docs.pendle.finance/pendle-v2/Developers/PendleRouter/ApiReference/MiscFunctions#redeemdueinterestandrewardsv2) . * **Pre- vs post-expiry:** * Pre-expiry: interest and rewards continue accruing; this function pays whatever is due up to the call. * Post-expiry: YT no longer earns new yield. Calling still pays any **remaining** pre-expiry interest/rewards, if any. * **Zero-flag calls:** If both flags are `false`, the call **reverts** with `YCNothingToRedeem`. At least one flag must be `true`. * **Token order:** `rewardsOut[i]` corresponds to `getRewardTokens()[i]`. Always read the list first. **Examples:** * _Claim both:_ User has accrued `2.5 SY` of interest and `[10 X, 0.3 Y]` rewards. Calling with `(true, true)` returns `(2.5, [10, 0.3])`, transfers those amounts, and resets baselines. * _Claim rewards only:_ Calling `(false, true)` transfers only rewards. Due interest remains in SY terms and continues to count toward reward-share until it's eventually claimed or the user redeems PY. ### `mintPYMulti`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#mintpymulti "Direct link to mintpymulti") /** * @notice Tokenize SY into PT + YT for multiple receivers in a single transaction. * @dev SY must be transferred to this contract prior to calling. * The sum of `amountSyToMints` must not exceed the floating SY balance. */function mintPYMulti( address[] calldata receiverPTs, address[] calldata receiverYTs, uint256[] calldata amountSyToMints) external returns (uint256[] memory amountPYOuts); **Purpose:** Batch version of `mintPY`. Mints PT and YT for multiple receivers in a single transaction, saving gas when distributing to many addresses. **How it works:** * Transfer the total required SY to the YT contract before calling. * Pass parallel arrays: each `(receiverPTs[i], receiverYTs[i])` pair receives `amountPYOuts[i]` PT and YT minted from `amountSyToMints[i]` SY. * The sum of `amountSyToMints` must equal the floating SY balance (total SY transferred in). * * * ### `redeemPYMulti`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#redeempymulti "Direct link to redeempymulti") /** * @notice Redeem PT (+YT) for multiple users in a single transaction. * @dev PT/YT must be transferred to this contract prior to calling. */function redeemPYMulti( address[] calldata receivers, uint256[] calldata amountPYToRedeems) external returns (uint256[] memory amountSyOuts); **Purpose:** Batch version of `redeemPY`. Redeems PT (and YT pre-expiry) for multiple users in one transaction. **How it works:** * Transfer the total required PT (and YT, if pre-expiry) to the YT contract before calling. * Each `receivers[i]` receives SY from redeeming `amountPYToRedeems[i]` PY. * * * ### [`pyIndexCurrent`](https://github.com/pendle-finance/pendle-core-v2-public/blob/ba53685767bc16e070136b9dbfe02a5dd6258c61/contracts/core/YieldContracts/PendleYieldToken.sol#L226-L236) [​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#pyindexcurrent "Direct link to pyindexcurrent") /** * @notice updates and returns the current PY index * @dev this function maximizes the current PY index with the previous index, guaranteeing * non-decreasing PY index * @dev if `doCacheIndexSameBlock` is true, PY index only updates at most once per block, * and has no state changes on the second call onwards (within the same block). * @dev see `pyIndexStored()` for view function for cached value. */function pyIndexCurrent() external returns (uint256 currentIndex); * **Purpose:** Returns the **current PY index**, updating it if needed. The PY index tracks the SY exchange rate and is stored **monotonically** (never decreases). * **Behavior notes:** * The PY index is **non-decreasing**: `pyIndexCurrent = max(SY.exchangeRate(), pyIndexStored)`. * If `doCacheIndexSameBlock` is enabled, the index is updated **at most once per block**; subsequent calls in the same block are read-only (no further state changes). * If `SY.exchangeRate()` falls below the stored index (negative yield), the PY index **does not** move down. Consequences: * Pre-expiry redemptions return **less SY per PY** until `SY.exchangeRate()` recovers above the stored index. * YT accrual effectively **pauses** (no new interest) until recovery. * In sustained drawdowns, even PT's eventual redemption (valued in the accounting asset) can be **less than previously expected** because the SY backing has shrunk. See [Negative Yield](https://docs.pendle.finance/ProtocolMechanics/NegativeYield) . * **Examples:** * **Up move:** Last stored `SY.exchangeRate()` = `1.20`; it rises to `1.25`. Calling `pyIndexCurrent()` updates the PY index to `1.25`. * **Down move:** Last stored index = `1.20`; `SY.exchangeRate()` drops to `1.15`. The PY index **stays at `1.20`**. If a user minted **120 PT** when the index was `1.20`, their claim on SY is `120 / 1.20 = 100 SY`. At maturity, if each SY equals `1.15 USDe`, they redeem `100 × 1.15 = 115 USDe` (less than 120 USDe), reflecting the underlying negative yield. ### `setPostExpiryData`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#setpostexpirydata "Direct link to setpostexpirydata") /** * @notice Triggers the post-expiry data initialization if the market has expired. * @dev Has no effect if called pre-expiry. */function setPostExpiryData() external; **Purpose:** Manually triggers the post-expiry settlement. Normally this is called automatically on the first interaction after expiry (via the `updateData` modifier), but this can be called explicitly to ensure the post-expiry index is snapshotted before further redemptions. * * * ### `pyIndexStored`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#pyindexstored "Direct link to pyindexstored") /// @notice returns the last-updated PY index (view function, no state changes)function pyIndexStored() external view returns (uint256); **Purpose:** Returns the last cached PY index without updating state. Use this for read-only queries when you don't need the latest value. For the current (possibly updated) value, use `pyIndexCurrent()`. * * * ### `getPostExpiryData`[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#getpostexpirydata "Direct link to getpostexpirydata") /** * @notice Returns the post-expiry data snapshot. * @dev Reverts if post-expiry data has not been set yet (see `setPostExpiryData()`). */function getPostExpiryData() external view returns ( uint256 firstPYIndex, uint256 totalSyInterestForTreasury, uint256[] memory firstRewardIndexes, uint256[] memory userRewardOwed ); **Purpose:** Returns the post-expiry data snapshot. Useful for understanding what index was locked in at expiry and verifying post-expiry redemption amounts. **Returns:** * `firstPYIndex`: The PY index snapshotted at expiry. PT redemptions post-expiry use this index. * `totalSyInterestForTreasury`: Accumulated SY interest accrued after expiry (goes to treasury, not users). * `firstRewardIndexes`: Per-reward-token indexes snapshotted at expiry. * `userRewardOwed`: Total unclaimed user reward balances at time of snapshot. * * * Integration Example[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#integration-example "Direct link to Integration Example") -------------------------------------------------------------------------------------------------------------------------------------------------------------- Example code only The snippets below are simplified for illustration and **are not audited**. **Do not** use them in production or with real funds. If you adapt any example, conduct a full review, add comprehensive tests, and obtain an independent **security audit**. // SPDX-License-Identifier: MITpragma solidity ^0.8.0;IPYieldContractFactory factory; // PendleYieldContractFactoryUpgaddress SY;uint32 expiry;address receiver;// --- Step 1: Look up or create a PT/YT pair ---// Check if the pair already existsaddress PT = factory.getPT(SY, expiry);address YT = factory.getYT(SY, expiry);if (PT == address(0)) { // Create a new yield contract if it doesn't exist yet (PT, YT) = factory.createYieldContract(SY, expiry, true);}IPYieldToken yt = IPYieldToken(YT);IStandardizedYield sy = IStandardizedYield(SY);IPrincipalToken pt = IPrincipalToken(PT);// --- Step 2: Mint PT + YT by depositing SY ---IERC20(address(sy)).transfer(address(yt), 100e18); // deposit 100 SYuint256 amountPYOut = yt.mintPY(receiver, receiver); // receive PT + YT// --- Step 3a: Redeem SY by burning PT + YT (pre-expiry) ---IERC20(address(pt)).transfer(address(yt), amountPYOut); // send PTIERC20(address(yt)).transfer(address(yt), amountPYOut); // send YTuint256 amountSyOut = yt.redeemPY(receiver); // receive SY// --- Step 3b: Redeem SY by burning PT only (post-expiry) ---// After expiry, YT has no remaining value; only PT is required.IERC20(address(pt)).transfer(address(yt), amountPYOut); // send PT onlyuint256 amountSyOut = yt.redeemPY(receiver); // receive SY// --- Step 4: Claim accrued interest (in SY) and rewards ---(uint256 interestOut, uint256[] memory rewardsOut) = yt.redeemDueInterestAndRewards( receiver, true, // claim interest true // claim rewards); FAQ[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#faq "Direct link to FAQ") -------------------------------------------------------------------------------------------------------------- ### When the underlying asset's exchange rate increases, does Pendle buy more of the asset on the market and distribute it to YT holders?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#when-the-underlying-assets-exchange-rate-increases-does-pendle-buy-more-of-the-asset-on-the-market-and-distribute-it-to-yt-holders "Direct link to When the underlying asset's exchange rate increases, does Pendle buy more of the asset on the market and distribute it to YT holders?") No. Pendle's accounting is **index-based**: yield accrues inside the **SY** balance held by the contracts as `exchangeRate` rises. **YT** holders are entitled to the yield portion of that **existing SY collateral** (paid in SY), while **PT** holders claim principal at/after maturity; users can then unwrap or swap SY to the base asset if they wish. No open-market purchases are required. ### Is 1 SY always equal to 1 PT + 1 YT?[​](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#is-1-sy-always-equal-to-1-pt--1-yt "Direct link to Is 1 SY always equal to 1 PT + 1 YT?") No. **PT** is a principal claim **in units of the accounting asset at maturity**, whereas **SY** is a wrapper whose value floats with `exchangeRate`; **YT** represents the pre-expiry yield claim. The amounts of PT and YT you mint depend on the **current index** - they collectively replicate the economic exposure of the underlying, but **1 SY ≠ 1 PT + 1 YT** except in edge cases (e.g., `exchangeRate == 1`). * [Overview](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#overview) * [Key Concepts](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#key-concepts) * [Technical Details](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#technical-details) * [Core Logic](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#core-logic) * [`mintPY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#mintpy) * [`redeemPY`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#redeempy) * [`redeemDueInterestAndRewards`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#redeemdueinterestandrewards) * [`mintPYMulti`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#mintpymulti) * [`redeemPYMulti`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#redeempymulti) * [`pyIndexCurrent`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#pyindexcurrent) * [`setPostExpiryData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#setpostexpirydata) * [`pyIndexStored`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#pyindexstored) * [`getPostExpiryData`](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#getpostexpirydata) * [Integration Example](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#integration-example) * [FAQ](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#faq) * [When the underlying asset's exchange rate increases, does Pendle buy more of the asset on the market and distribute it to YT holders?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#when-the-underlying-assets-exchange-rate-increases-does-pendle-buy-more-of-the-asset-on-the-market-and-distribute-it-to-yt-holders) * [Is 1 SY always equal to 1 PT + 1 YT?](https://docs.pendle.finance/pendle-v2/Developers/Contracts/YieldTokenization#is-1-sy-always-equal-to-1-pt--1-yt) Pages [Website](https://www.pendle.finance/) [App](https://app.pendle.finance/market) Socials [Discord](https://discord.com/invite/EAujvncY2R) [Twitter](https://twitter.com/pendle_fi/) [Telegram](https://t.me/pendlefinance/) About Us [Medium](https://medium.com/pendle/) [Careers](https://angel.co/company/pendle_finance/) [Media Kit](https://pendle.finance/brandguide) [Audits](https://github.com/pendle-finance/pendle-core-v2-public/tree/master/audits) ---