Skip to content

Commit

Permalink
added script to deploy reth and wsteh pendle pt oracles
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDeadCe11 committed Jul 9, 2024
1 parent a090e77 commit 023248d
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 4 deletions.
2 changes: 2 additions & 0 deletions script/Common.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion script/Registry.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
44 changes: 44 additions & 0 deletions script/predeployment/DeployRelayers.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
6 changes: 3 additions & 3 deletions test/unit/RelayerFactories.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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('')));
Expand All @@ -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('')));
Expand All @@ -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('')));
Expand Down

0 comments on commit 023248d

Please sign in to comment.