Skip to content

Commit

Permalink
Merge branch 'dev' into pendle-scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDeadCe11 authored Jul 16, 2024
2 parents bd573fe + 76fae45 commit e158594
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
2 changes: 2 additions & 0 deletions script/Registry.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ address constant MAINNET_DENOMINATED_WSTETH_USD_ORACLE = 0x8746664d1E0F0e61275EF
address constant MAINNET_DELAYED_RETH_USD_ORACLE = 0x0859c0B3EF150fAb129E43B74a63da13F5d2Dd35;
address constant MAINNET_DELAYED_WSTETH_USD_ORACLE = 0xa8dEa011Ed90C53BA4601868Ccc9a36A6F442499;
address constant MAINNET_DELAYED_ARB_USD_ORACLE = 0xa4e0410E7eb9a02aa9C0505F629d01890c816A77;
address constant MAINNET_DELAYED_ETH_USD_ORACLE = 0x562CCE2F4dc383862dC6A926AF10DeFf5fCd172F;

////////// CHAINLINK //////////
// Price feeds to USD
Expand Down Expand Up @@ -116,3 +117,4 @@ address constant MAINNET_PENDLE_ORACLE = 0x9a9Fa8338dd5E5B2188006f1Cd2Ef26d92165
address constant MAINNET_PENDLE_RETH_MARKET = 0x14FbC760eFaF36781cB0eb3Cb255aD976117B9Bd;
address constant MAINNET_PENDLE_WSTETH_MARKET = 0x08a152834de126d2ef83D612ff36e4523FD0017F;
address constant MAINNET_PENDLE_RELAYER_FACTORY = 0xToBeDeployed;

9 changes: 5 additions & 4 deletions script/dexrelayer/DeployPendleFactory.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {IAuthorizable} from '@interfaces/utils/IAuthorizable.sol';
import {IBaseOracle} from '@interfaces/oracles/IBaseOracle.sol';

// BROADCAST
// source .env && forge script DeployPendleFactory --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY

// source .env && forge script DeployPendleFactory --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY --account defaultKey --sender $DEFAULT_KEY_PUBLIC_ADDRESS

// SIMULATE
// source .env && forge script DeployPendleFactory --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC
// source .env && forge script DeployPendleFactory --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_SEPOLIA_RPC --account defaultKey --sender $DEFAULT_KEY_PUBLIC_ADDRESS

contract DeployPendleFactory is Script {
IBaseOracle public pendleLpToSyRelayer;
Expand All @@ -21,10 +22,10 @@ contract DeployPendleFactory is Script {
PendleRelayerFactory public pendleRelayerFactory;

function run() public {
uint256 pk = vm.envUint('ARB_SEPOLIA_PK');

uint256 pk = vm.envUint();
vm.startBroadcast(pk);
pendleRelayerFactory = new PendleRelayerFactory();
IAuthorizable(address(pendleRelayerFactory)).addAuthorization(vm.addr(pk));
vm.stopBroadcast();
}
}
2 changes: 1 addition & 1 deletion script/predeployment/DeployRelayers.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ contract DeployRethEthChainlinkRelayerMainnet is CommonMainnet {
}

// BROADCAST
// source .env && forge script DeployWstethEthChainlinkRelayerMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY
// source .env && forge script DeployWstethEthChainlinkRelayerMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY --account defaultKey --sender $DEFAULT_KEY_PUBLIC_ADDRESS

// SIMULATE
// source .env && forge script DeployWstethEthChainlinkRelayerMainnet --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC
Expand Down
5 changes: 2 additions & 3 deletions src/contracts/oracles/pendle/PendleLpToSyRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import '@interfaces/oracles/pendle/IPMarket.sol';
*/
contract PendleLpToSyRelayer {
IStandardizedYield public SY;
IPPrincipalToken public PT;
IPYieldToken public YT;

IPMarket public market;
IPOracle public oracle;
Expand All @@ -28,7 +26,8 @@ contract PendleLpToSyRelayer {
oracle = IPOracle(_oracle);
twapDuration = _twapDuration;

(SY, PT, YT) = market.readTokens();
(SY,,) = market.readTokens();

symbol = string(abi.encodePacked('LP / ', SY.symbol()));
// test if oracle is ready
(bool increaseCardinalityRequired,, bool oldestObservationSatisfied) = oracle.getOracleState(_market, _twapDuration);
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/oracles/pendle/PendlePtToSyRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'forge-std/console2.sol';
contract PendlePtToSyRelayer {
IStandardizedYield public SY;
IPPrincipalToken public PT;
IPYieldToken public YT;

IPMarket public market;
IPOracle public oracle;
Expand All @@ -29,7 +28,8 @@ contract PendlePtToSyRelayer {
oracle = IPOracle(_oracle);
twapDuration = _twapDuration;

(SY, PT, YT) = market.readTokens();
(SY, PT,) = market.readTokens();

symbol = string(abi.encodePacked(PT.symbol(), ' / ', SY.symbol()));

// test if oracle is ready
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/oracles/pendle/PendleYtToSyRelayer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import '@interfaces/oracles/pendle/IPMarket.sol';
*/
contract PendleYtToSyRelayer {
IStandardizedYield public SY;
IPPrincipalToken public PT;
IPYieldToken public YT;

IPMarket public market;
Expand All @@ -28,7 +27,8 @@ contract PendleYtToSyRelayer {
oracle = IPOracle(_oracle);
twapDuration = _twapDuration;

(SY, PT, YT) = market.readTokens();
(SY,, YT) = market.readTokens();

symbol = string(abi.encodePacked(YT.symbol(), ' / ', SY.symbol()));
// test if oracle is ready
(bool increaseCardinalityRequired,, bool oldestObservationSatisfied) = oracle.getOracleState(_market, _twapDuration);
Expand Down
7 changes: 4 additions & 3 deletions test/unit/RelayerFactories.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ contract Unit_PendleRelayerFactory_DeployPendleOracles is Base {
assertEq(pendleFactory.authorizedAccounts()[0], address(this));
}

function test_Deploy_PT_Relayer() public {

function test_Deploy_PT_Oracle() 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 +413,7 @@ contract Unit_PendleRelayerFactory_DeployPendleOracles is Base {
assertEq(address(IPendleRelayer(address(ptOracle)).SY()), 0xc0Cf4b266bE5B3229C49590B59E67A09c15b22f4);
}

function test_Deploy_YT_Relayer() public {
function test_Deploy_YT_Oracle() 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 +425,7 @@ contract Unit_PendleRelayerFactory_DeployPendleOracles is Base {
assertEq(address(IPendleRelayer(address(ytOracle)).SY()), 0xc0Cf4b266bE5B3229C49590B59E67A09c15b22f4);
}

function test_Deploy_LP_Relayer() public {
function test_Deploy_LP_Oracle() 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 e158594

Please sign in to comment.