Skip to content

Commit ec8bc31

Browse files
committed
merged into one example
1 parent 720b0a7 commit ec8bc31

File tree

11 files changed

+25
-148
lines changed

11 files changed

+25
-148
lines changed

price_feeds/evm/morpho-pyth-oracle/.example.env renamed to price_feeds/evm/chainlink_migration/.example.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ RPC_URL=
44
PYTH_ADDRESS=
55
# https://docs.pyth.network/price-feeds/price-feed-ids
66
PRICE_FEED_ID=
7-
ETHERSCAN_API_KEY=
7+
# To verify the contract on the respective chain's explorer
8+
ETHERSCAN_API_KEY=

price_feeds/evm/chainlink_migration/README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This example demonstrates how to deploy a Chainlink-compatible application to Py
44
The application `src/ChainlinkApp.sol` is designed to use Chainlink price feeds.
55
The script `script/PythAggregatorV3Deployment.sol` deploys this application with the [`PythAggregatorV3`](https://github.com/pyth-network/pyth-crosschain/blob/main/target_chains/ethereum/sdk/solidity/PythAggregatorV3.sol) adapter contract, such that it uses Pyth price feeds.
66

7+
This aggregator can be used to deploy Pyth Oracles for [Morpho vaults](https://docs.morpho.org/morpho/tutorials/deploy-an-oracle/#2-fill-all-attributes).
8+
79
## Installation
810

911
This example uses [Foundry](https://book.getfoundry.sh/getting-started/installation), `npm` and `jq`.
@@ -30,7 +32,15 @@ export PYTH_ADDRESS=0x0708325268dF9F66270F1401206434524814508b
3032
Then, deploy the contracts by running:
3133

3234
```bash copy
33-
forge script script/PythAggregatorV3Deployment.s.sol --rpc-url $RPC_URL --broadcast
35+
forge script script/PythAggregatorV3Deployment.s.sol --rpc-url $RPC_URL --broadcast --verify
36+
```
37+
38+
This command will deploy the `PythAggregatorV3` contract.
39+
40+
To test the Chainlink App, you can run the following command:
41+
42+
```bash copy
43+
forge script script/ChainlinkApp.s.sol --rpc-url $RPC_URL --broadcast --verify
3444
```
3545

3646
This command will print something like:

price_feeds/evm/morpho-pyth-oracle/script/PythAggregatorV3Deployment.s.sol renamed to price_feeds/evm/chainlink_migration/script/ChainlinkApp.s.sol

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ pragma solidity ^0.8.0;
33

44
import "forge-std/Script.sol";
55
import {PythAggregatorV3} from "@pythnetwork/pyth-sdk-solidity/PythAggregatorV3.sol";
6-
import "forge-std/console.sol";
6+
import {ChainlinkApp} from "../src/ChainlinkApp.sol";
7+
78
contract PythAggregatorV3Deployment is Script {
89
function run() external {
910
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
@@ -14,13 +15,16 @@ contract PythAggregatorV3Deployment is Script {
1415
address pythPriceFeedsContract = vm.envAddress("PYTH_ADDRESS");
1516
// Get the price feed ids from:
1617
// https://docs.pyth.network/price-feeds/price-feed-ids
17-
bytes32 priceFeedId = vm.envBytes32("PRICE_FEED_ID");
18+
bytes32 ethFeedId = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;
19+
bytes32 solFeedId = 0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d;
1820

1921
// Deploy an instance of PythAggregatorV3 for every feed.
2022
// You can deploy these contracts beforehand if you are integrating with
21-
PythAggregatorV3 aggregator = new PythAggregatorV3(pythPriceFeedsContract, priceFeedId);
23+
PythAggregatorV3 ethAggregator = new PythAggregatorV3(pythPriceFeedsContract, ethFeedId);
24+
PythAggregatorV3 solAggregator = new PythAggregatorV3(pythPriceFeedsContract, solFeedId);
2225

23-
console.log("PythAggregatorV3 deployed at", address(aggregator));
26+
// Pass the address of the PythAggregatorV3 contract to your chainlink-compatible app.
27+
ChainlinkApp app = new ChainlinkApp(address(ethAggregator), address(solAggregator));
2428

2529
vm.stopBroadcast();
2630
}

price_feeds/evm/chainlink_migration/script/PythAggregatorV3Deployment.s.sol

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ pragma solidity ^0.8.0;
33

44
import "forge-std/Script.sol";
55
import {PythAggregatorV3} from "@pythnetwork/pyth-sdk-solidity/PythAggregatorV3.sol";
6-
import {ChainlinkApp} from "../src/ChainlinkApp.sol";
7-
6+
import "forge-std/console.sol";
87
contract PythAggregatorV3Deployment is Script {
98
function run() external {
109
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
@@ -15,16 +14,13 @@ contract PythAggregatorV3Deployment is Script {
1514
address pythPriceFeedsContract = vm.envAddress("PYTH_ADDRESS");
1615
// Get the price feed ids from:
1716
// https://docs.pyth.network/price-feeds/price-feed-ids
18-
bytes32 ethFeedId = 0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace;
19-
bytes32 solFeedId = 0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d;
17+
bytes32 priceFeedId = vm.envBytes32("PRICE_FEED_ID");
2018

2119
// Deploy an instance of PythAggregatorV3 for every feed.
2220
// You can deploy these contracts beforehand if you are integrating with
23-
PythAggregatorV3 ethAggregator = new PythAggregatorV3(pythPriceFeedsContract, ethFeedId);
24-
PythAggregatorV3 solAggregator = new PythAggregatorV3(pythPriceFeedsContract, solFeedId);
21+
PythAggregatorV3 aggregator = new PythAggregatorV3(pythPriceFeedsContract, priceFeedId);
2522

26-
// Pass the address of the PythAggregatorV3 contract to your chainlink-compatible app.
27-
ChainlinkApp app = new ChainlinkApp(address(ethAggregator), address(solAggregator));
23+
console.log("PythAggregatorV3 deployed at", address(aggregator));
2824

2925
vm.stopBroadcast();
3026
}

price_feeds/evm/morpho-pyth-oracle/.gitignore

Lines changed: 0 additions & 19 deletions
This file was deleted.

price_feeds/evm/morpho-pyth-oracle/README.md

Lines changed: 0 additions & 66 deletions
This file was deleted.

price_feeds/evm/morpho-pyth-oracle/foundry.toml

Lines changed: 0 additions & 6 deletions
This file was deleted.

price_feeds/evm/morpho-pyth-oracle/package-lock.json

Lines changed: 0 additions & 22 deletions
This file was deleted.

price_feeds/evm/morpho-pyth-oracle/package.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

price_feeds/evm/morpho-pyth-oracle/remappings.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)