# Pendle Risk Engine

The Pendle Risk Engine is a smart contract used to price out Pendle PT tokens, which are used often by lending protocols to allow users to "loop" and increase their exposure to a particular asset. This particular design was [commissioned by Morpho's DAO](https://forum.morpho.org/t/call-for-grants/1177/22?u=woz).

There are two ways to often price this asset: either by the trading price of the Pendle PT (using TWAP), or by taking the linear discount of the Pendle PT up until expiry. Curators may choose one or the other for different assets for different reasons. Our risk engine takes both of these as feeds and outputs the **lower of the two**. This prices the PT at the lowest possible value, which makes the experience better for the lender, and may reduce potential bad debt.

Disclaimer: No risk strategy can 100% protect against any type of attack. This risk engine should be considered a part of a broader risk strategy - we provide absolutely no warranty of effectiveness. \
\
Pendle Risk Engines require two price feeds: the TWAP price feed of a PT and the linear discount of a feed. These can often be found in [pendle's docs](https://docs.pendle.finance/).

<figure><img src="/files/y42kpE911ueJJXdyFxkL" alt=""><figcaption></figcaption></figure>

1. On etherscan, take the TVWAP price feed address and a linear discount price, and  input them into the "createOjoPTFeed" tx
2. ![](/files/qu1AW9L3WMbv9G1J6BY4)
3. Commit the tx
4. Done! You'll see you created a new contract which can be used as an oracle in popular lending platforms.

Example tx: <https://etherscan.io/tx/0x6d5a556e210cebd6d7decd6186372f9e8c6c3950a2893af19f2daff69430481c>

Example spawned feed: <https://etherscan.io/address/0xb3c6ff1a065e39834e1bd5cb52f86773f16b52df#readContract>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ojolabs.xyz/integration-guides/pendle-risk-engine.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
