explaingit

chenxu0602/pendle-pt-yt-mechanism-lab

0SolidityAudience · researcherComplexity · 5/5ActiveSetup · hard

TLDR

Foundry plus Jupyter research lab that runs executable experiments on Pendle's PT and YT yield tokenization, focusing on the monotonic PY index floor and how external lenders mis-value collateral when SY backing falls.

Mindmap

mindmap
  root((pendle-pt-yt-mechanism-lab))
    Inputs
      Mock SY exchange rates
      Pendle PT and YT contracts
      Live market snapshots
    Outputs
      Forge test results
      Mechanism and threat notes
      Collateral overvaluation cases
    Use Cases
      Study PY index floor behaviour
      Stress test integrator pricing
      Build a toy LTV lending example
    Tech Stack
      Solidity
      Foundry
      Python
      Jupyter

Things people build with this

USE CASE 1

Run Forge tests that walk the SY exchange rate up and back down to observe the PY index floor

USE CASE 2

Reproduce the 15-unit collateral overvaluation case for an unsafe oracle consumer

USE CASE 3

Model an 80 percent LTV lending integrator to see borrow-limit drift

USE CASE 4

Snapshot live Pendle market rates from a Jupyter notebook

Tech stack

SolidityFoundryPythonJupyter

Getting it running

Difficulty · hard Time to first run · 1h+

Two toolchains: forge install plus forge build for Solidity, and uv sync plus uv run jupyter lab for the Python notebooks.

In plain English

This repository is a small research lab that studies how Pendle-style yield tokenization protocols behave through executable experiments rather than written analysis alone. Pendle is a well known DeFi protocol that splits a yield-bearing token into two pieces: a principal token, PT, which behaves a bit like a zero-coupon bond, and a yield token, YT, which collects the variable yield. The author is clear up front that this is not an audit and not a claim that Pendle has a live vulnerability. The point is to make some accounting assumptions explicit and testable, especially what happens at the boundaries between SY share accounting, PT and YT minting and redemption, the PT/SY market, and external oracles. The first experiment looks at the PY index floor. In Pendle the PY index is monotonic: once the SY exchange rate has risen, the stored PY index does not drop again even if the live SY exchange rate later falls. The lab walks the SY exchange rate through 1.00, then 1.10, then 0.95, and records what that does to pyIndexStored, PT redemption before and after expiry, YT interest, oracle rates for PT, YT and LP positions, and external collateral valuation. The README presents this asymmetry as a deliberate design choice, then asks who absorbs the loss when SY backing falls below the floored index. The second experiment connects that gap to an external integrator. A mock oracle consumer reads PT, YT, or LP style rates and treats them as current collateral value. With SY at 0.95 but the PY index still at 1.10, the unsafe consumer values 100 SY worth of position at 110 instead of the recoverable 95, a 15 unit overvaluation. A third experiment extends this into a toy lending protocol at 80 percent LTV: an unsafe borrow limit of 88 versus a safe limit of 76 lets a borrower pull 12 units more than the position can actually back. A further set of planned experiments looks at boundary behaviour of the PT/SY market itself, with large PT buys, large sells, extreme reserve ratios, short time to expiry, and low liquidity, asking how implied APY moves and where discontinuities or denial-of-service-like states appear. The code is a Foundry project under src and test, with mocks, test fixtures, and Forge test files for each experiment, plus markdown notes on mechanism, threat model, attack patterns, and limitations, and a Jupyter notebook that snapshots live Pendle market rates. Setup is forge install and forge build for the Solidity side, and uv sync plus uv run jupyter lab for the Python side.

Copy-paste prompts

Prompt 1
Run the Forge tests in pendle-pt-yt-mechanism-lab and explain what each PY index floor case proves
Prompt 2
Walk through the mock oracle consumer and show where the 15-unit overvaluation comes from
Prompt 3
Add a new Forge test that takes the SY exchange rate down to 0.80 and prints the PT and YT oracle rates
Prompt 4
Open the Jupyter notebook and describe how it pulls live Pendle market data
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.