From e8aec648ebcad229b96f2346d8dc52a77331cf30 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 23 Oct 2025 13:11:06 +0530 Subject: [PATCH 1/2] chore(scripts) Add price reading script --- .gitignore | 2 ++ scripts/MorphoPythOracleRead.s.sol | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 scripts/MorphoPythOracleRead.s.sol diff --git a/.gitignore b/.gitignore index e40c4b8..110be18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,14 @@ # Compiler files cache/ out/ +.zkout/ # Ignores development broadcast logs !/broadcast /broadcast/*/31337/ /broadcast/**/dry-run/ broadcast/ +lib/ # Docs docs/ diff --git a/scripts/MorphoPythOracleRead.s.sol b/scripts/MorphoPythOracleRead.s.sol new file mode 100644 index 0000000..701fab6 --- /dev/null +++ b/scripts/MorphoPythOracleRead.s.sol @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.21; + +import "forge-std/Script.sol"; +import {console} from "forge-std/console.sol"; +import {IMorphoPythOracle} from "../src/morpho-pyth/interfaces/IMorphoPythOracle.sol"; +import {IERC4626} from "../src/interfaces/IERC4626.sol"; + +contract MorphoPythOracleRead is Script { + function run() public { + + // Use an RPC fork so external calls hit the real chain state + string memory rpcUrl = vm.envString("RPC"); + vm.createSelectFork(rpcUrl); + + // Get the Factory address on your chain + address oracleAddress = vm.envAddress("ORACLE_ADDRESS"); + console.log("Oracle address:", oracleAddress); + + IMorphoPythOracle oracle = IMorphoPythOracle(oracleAddress); + console.log("Pyth address:", address(oracle.pyth())); + + console2.log("Max age:", oracle.PRICE_FEED_MAX_AGE()); + + console2.log("Price:", oracle.price()); + } +} \ No newline at end of file From eecae96cff8c698a5e44b7cf695024b9f245fa90 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 23 Oct 2025 13:15:10 +0530 Subject: [PATCH 2/2] fmt fix --- scripts/MorphoPythOracleDeploy.s.sol | 2 +- scripts/MorphoPythOracleFactoryDeploy.s.sol | 2 +- scripts/MorphoPythOracleRead.s.sol | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/MorphoPythOracleDeploy.s.sol b/scripts/MorphoPythOracleDeploy.s.sol index ff12777..c5903a2 100644 --- a/scripts/MorphoPythOracleDeploy.s.sol +++ b/scripts/MorphoPythOracleDeploy.s.sol @@ -68,4 +68,4 @@ contract MorphoPythOracleDeploy is Script { vm.stopBroadcast(); } -} \ No newline at end of file +} diff --git a/scripts/MorphoPythOracleFactoryDeploy.s.sol b/scripts/MorphoPythOracleFactoryDeploy.s.sol index 7e19869..eb741dd 100644 --- a/scripts/MorphoPythOracleFactoryDeploy.s.sol +++ b/scripts/MorphoPythOracleFactoryDeploy.s.sol @@ -15,4 +15,4 @@ contract MorphoPythOracleFactoryDeploy is Script { vm.stopBroadcast(); } -} \ No newline at end of file +} diff --git a/scripts/MorphoPythOracleRead.s.sol b/scripts/MorphoPythOracleRead.s.sol index 701fab6..df7fb93 100644 --- a/scripts/MorphoPythOracleRead.s.sol +++ b/scripts/MorphoPythOracleRead.s.sol @@ -8,7 +8,6 @@ import {IERC4626} from "../src/interfaces/IERC4626.sol"; contract MorphoPythOracleRead is Script { function run() public { - // Use an RPC fork so external calls hit the real chain state string memory rpcUrl = vm.envString("RPC"); vm.createSelectFork(rpcUrl); @@ -24,4 +23,4 @@ contract MorphoPythOracleRead is Script { console2.log("Price:", oracle.price()); } -} \ No newline at end of file +}