Skip to content

Commit 7f05ff6

Browse files
committed
chore(pricefeed) Add morpho guide
1 parent ffd9006 commit 7f05ff6

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

pages/price-feeds/_meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
},
2525

2626
"use-real-time-data": "Use Real-Time Price Data",
27+
"use-pyth-for-morpho": "Use Pyth for Morpho Markets",
2728
"fetch-price-updates": "Fetch Price Updates",
2829
"schedule-price-updates": "Schedule Price Updates",
2930
"migrate-an-app-to-pyth": "Migrate an App to Pyth",
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { Steps } from "nextra/components";
2+
3+
# How to use Pyth for Morpho Markets
4+
5+
At the time of writing, Morpho supports an [oracle interface](https://github.com/morpho-org/morpho-blue-oracles/tree/main/src) similar to ChainlinkAggregatorV3Interface.
6+
7+
This guide will show how you can leverage Pyth real time price data to power Morpho markets.
8+
9+
There are three main steps to use Pyth price feeds for Morpho markets:
10+
11+
1. Deploy the [`PythAggregatorV3`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/PythAggregatorV3.sol) contract to provide a Chainlink-compatible feed interface.
12+
2. Run the price pusher or scheduler
13+
3. Deploy the Morpho oracle contract
14+
15+
<Steps>
16+
17+
### Deploy the `PythAggregatorV3` contract
18+
19+
Pyth provides a wrapper called `PythAggregatorV3` that implements the ChainlinkAggregatorV3Interface.
20+
This wrapper allows you to use Pyth price feeds with Morpho markets.
21+
[Migrate from Chainlink to Pyth](./migrate-an-app-to-pyth/chainlink.md) explains how to deploy the `PythAggregatorV3` contract.
22+
23+
You can use the forge [script](https://github.com/pyth-network/pyth-examples/blob/main/price_feeds/evm/chainlink_migration/script/PythAggregatorV3Deployment.s.sol) from the [pyth-examples](https://github.com/pyth-network/pyth-examples/tree/main/price_feeds/evm/chainlink_migration) directory to deploy the `PythAggregatorV3` contract.
24+
25+
```bash
26+
forge script script/PythAggregatorV3Deployment.s.sol --rpc-url $RPC_URL --broadcast --verify
27+
```
28+
29+
This script will deploy the `PythAggregatorV3` contract and verify it on the target chain.
30+
You have to run the script for both `BASE` and `QUOTE` price feeds.
31+
32+
### Run the price pusher or scheduler
33+
34+
As a pull oracle, Pyth's users are typically responsible for updating the state of on-chain feeds.
35+
Please see [What is a Pull Oracle?](/price-feeds/pull-updates) to learn more about pull updates.
36+
37+
If you are using the `PythAggregatorV3` contract, you must push price updates to the contract at regular intervals.
38+
The Pyth Data Association sponsors regular on-chain updates for some price feeds.
39+
See [Sponsored Feeds](./sponsored-feeds.mdx) for the current list of feeds and their update parameters.
40+
41+
If you don't find relevant price feeds in the [Sponsored Feeds](./sponsored-feeds.mdx) list, you can run the scheduler/price pusher for the price feed you need.
42+
43+
Please see [Schedule Price Updates](./schedule-price-updates.mdx) for more information on how to schedule price updates.
44+
45+
### Deploy the Morpho oracle contract
46+
47+
After deploying the `PythAggregatorV3` contract and scheduling price updates, you can deploy the Morpho oracle contract with the address of the `PythAggregatorV3` contract.
48+
49+
Please refer to the [Morpho documentation](https://docs.morpho.org/morpho/tutorials/deploy-an-oracle/) for more information on how to deploy the Morpho oracle contract.
50+
51+
52+
</Steps>
53+
54+

0 commit comments

Comments
 (0)