Skip to content

Commit e8aec64

Browse files
committed
chore(scripts) Add price reading script
1 parent 5710101 commit e8aec64

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Compiler files
22
cache/
33
out/
4+
.zkout/
45

56
# Ignores development broadcast logs
67
!/broadcast
78
/broadcast/*/31337/
89
/broadcast/**/dry-run/
910
broadcast/
11+
lib/
1012

1113
# Docs
1214
docs/

scripts/MorphoPythOracleRead.s.sol

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
pragma solidity 0.8.21;
3+
4+
import "forge-std/Script.sol";
5+
import {console} from "forge-std/console.sol";
6+
import {IMorphoPythOracle} from "../src/morpho-pyth/interfaces/IMorphoPythOracle.sol";
7+
import {IERC4626} from "../src/interfaces/IERC4626.sol";
8+
9+
contract MorphoPythOracleRead is Script {
10+
function run() public {
11+
12+
// Use an RPC fork so external calls hit the real chain state
13+
string memory rpcUrl = vm.envString("RPC");
14+
vm.createSelectFork(rpcUrl);
15+
16+
// Get the Factory address on your chain
17+
address oracleAddress = vm.envAddress("ORACLE_ADDRESS");
18+
console.log("Oracle address:", oracleAddress);
19+
20+
IMorphoPythOracle oracle = IMorphoPythOracle(oracleAddress);
21+
console.log("Pyth address:", address(oracle.pyth()));
22+
23+
console2.log("Max age:", oracle.PRICE_FEED_MAX_AGE());
24+
25+
console2.log("Price:", oracle.price());
26+
}
27+
}

0 commit comments

Comments
 (0)