From 023248dca633249dc1730886968078deb6f9bc7a Mon Sep 17 00:00:00 2001 From: MrDeadCe11 Date: Tue, 9 Jul 2024 12:18:02 -0500 Subject: [PATCH] added script to deploy reth and wsteh pendle pt oracles --- script/Common.s.sol | 2 ++ script/Registry.s.sol | 4 ++- script/predeployment/DeployRelayers.s.sol | 44 +++++++++++++++++++++++ test/unit/RelayerFactories.t.sol | 6 ++-- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/script/Common.s.sol b/script/Common.s.sol index dcc3166..f80c409 100644 --- a/script/Common.s.sol +++ b/script/Common.s.sol @@ -10,12 +10,14 @@ import {IAuthorizable} from '@interfaces/utils/IAuthorizable.sol'; import {CamelotRelayerFactory} from '@contracts/factories/CamelotRelayerFactory.sol'; import {ChainlinkRelayerFactory} from '@contracts/factories/ChainlinkRelayerFactory.sol'; import {DenominatedOracleFactory} from '@contracts/factories/DenominatedOracleFactory.sol'; +import {PendleRelayerFactory} from '@contracts/factories/pendle/PendleRelayerFactory.sol'; abstract contract CommonMainnet is Script { ChainlinkRelayerFactory public chainlinkRelayerFactory = ChainlinkRelayerFactory(MAINNET_CHAINLINK_RELAYER_FACTORY); CamelotRelayerFactory public camelotRelayerFactory = CamelotRelayerFactory(MAINNET_CAMELOT_RELAYER_FACTORY); DenominatedOracleFactory public denominatedOracleFactory = DenominatedOracleFactory(MAINNET_DENOMINATED_ORACLE_FACTORY); + PendleRelayerFactory public pendleRelayerFactory = PendleRelayerFactory(MAINNET_PENDLE_RELAYER_FACTORY); } abstract contract CommonSepolia is Script { diff --git a/script/Registry.s.sol b/script/Registry.s.sol index 3e8ec1a..2f8d344 100644 --- a/script/Registry.s.sol +++ b/script/Registry.s.sol @@ -103,6 +103,8 @@ address constant ETH_ARB_POOL = 0xe51635ae8136aBAc44906A8f230C2D235E9c195F; address constant MAINNET_DEPLOYER = 0xF78dA2A37049627636546E0cFAaB2aD664950917; //Pendle +uint32 constant MAINNET_PENDLE_TWAP_DURATION = 900; address constant MAINNET_PENDLE_ORACLE = 0x9a9Fa8338dd5E5B2188006f1Cd2Ef26d921650C2; address constant MAINNET_PENDLE_RETH_MARKET = 0x14FbC760eFaF36781cB0eb3Cb255aD976117B9Bd; -address constant MAINNET_PENDLE_STETH_MARKET = 0x08a152834de126d2ef83D612ff36e4523FD0017F; +address constant MAINNET_PENDLE_WSTETH_MARKET = 0x08a152834de126d2ef83D612ff36e4523FD0017F; +address constant MAINNET_PENDLE_RELAYER_FACTORY = 0xToBeDeployed; \ No newline at end of file diff --git a/script/predeployment/DeployRelayers.s.sol b/script/predeployment/DeployRelayers.s.sol index 03ab429..4a9b1e2 100644 --- a/script/predeployment/DeployRelayers.s.sol +++ b/script/predeployment/DeployRelayers.s.sol @@ -106,3 +106,47 @@ contract DeployWstethEthChainlinkRelayerMainnet is CommonMainnet { vm.stopBroadcast(); } } + +// BROADCAST +// source .env && forge script DeployRethPtToSyPendleRelayerMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY + +// SIMULATE +// source .env && forge script DeployRethPtToSyPendleRelayerMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC + +contract DeployRethPtToSyPendleRelayerMainnet is CommonMainnet { + function run() public { + vm.startBroadcast(vm.envUint('ARB_MAINNET_DEPLOYER_PK')); + IBaseOracle _pendleRethPtToSyFeed = pendleRelayerFactory.deployPendlePtRelayer( + MAINNET_PENDLE_RETH_MARKET, MAINNET_PENDLE_ORACLE, MAINNET_PENDLE_TWAP_DURATION + ); + + IBaseOracle _rethToEthOracle = denominatedOracleFactory.deployDenominatedOracle( + _pendleRethPtToSyFeed, IBaseOracle(MAINNET_DENOMINATED_RETH_USD_ORACLE), false + ); + + _pendleRethPtToSyFeed.symbol(); // "(WSTETH / ETH) * (ETH / USD)" + vm.stopBroadcast(); + } +} + +// BROADCAST +// source .env && forge script DeployWsethPtToSyPendleRelayerMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY + +// SIMULATE +// source .env && forge script DeployWsethPtToSyPendleRelayerMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC + +contract DeployWsethPtToSyPendleRelayerMainnet is CommonMainnet { + function run() public { + vm.startBroadcast(vm.envUint('ARB_MAINNET_DEPLOYER_PK')); + IBaseOracle _pendleWsethPtToSyFeed = pendleRelayerFactory.deployPendlePtRelayer( + MAINNET_PENDLE_WSTETH_MARKET, MAINNET_PENDLE_ORACLE, MAINNET_PENDLE_TWAP_DURATION + ); + + IBaseOracle _rethToEthOracle = denominatedOracleFactory.deployDenominatedOracle( + _pendleRethPtToSyFeed, IBaseOracle(MAINNET_DENOMINATED_WSTETH_USD_ORACLE), false + ); + + _pendleRethPtToSyFeed.symbol(); // "(WSTETH / ETH) * (ETH / USD)" + vm.stopBroadcast(); + } +} diff --git a/test/unit/RelayerFactories.t.sol b/test/unit/RelayerFactories.t.sol index 7aab628..14390ce 100644 --- a/test/unit/RelayerFactories.t.sol +++ b/test/unit/RelayerFactories.t.sol @@ -400,7 +400,7 @@ contract Unit_PendleRelayerFactory_DeployPendleOracles is Base { assertEq(pendleFactory.authorizedAccounts()[0], address(this)); } - function test_Deploy_PT_Oracle() public { + function test_Deploy_PT_Relayer() public { IBaseOracle ptOracle = pendleFactory.deployPendlePtRelayer(MAINNET_PENDLE_RETH_MARKET, MAINNET_PENDLE_ORACLE, uint32(900)); assertTrue(keccak256(abi.encode(ptOracle.symbol())) != keccak256(abi.encode(''))); @@ -412,7 +412,7 @@ contract Unit_PendleRelayerFactory_DeployPendleOracles is Base { assertEq(address(IPendleRelayer(address(ptOracle)).SY()), 0xc0Cf4b266bE5B3229C49590B59E67A09c15b22f4); } - function test_Deploy_YT_Oracle() public { + function test_Deploy_YT_Relayer() public { IBaseOracle ytOracle = pendleFactory.deployPendleYtRelayer(MAINNET_PENDLE_RETH_MARKET, MAINNET_PENDLE_ORACLE, uint32(900)); assertTrue(keccak256(abi.encode(ytOracle.symbol())) != keccak256(abi.encode(''))); @@ -424,7 +424,7 @@ contract Unit_PendleRelayerFactory_DeployPendleOracles is Base { assertEq(address(IPendleRelayer(address(ytOracle)).SY()), 0xc0Cf4b266bE5B3229C49590B59E67A09c15b22f4); } - function test_Deploy_LP_Oracle() public { + function test_Deploy_LP_Relayer() public { IBaseOracle lpOracle = pendleFactory.deployPendleLpRelayer(MAINNET_PENDLE_RETH_MARKET, MAINNET_PENDLE_ORACLE, uint32(900)); assertTrue(keccak256(abi.encode(lpOracle.symbol())) != keccak256(abi.encode('')));