From d6d772adb5dc86dd4c08296ca50ba8162ba1c0be Mon Sep 17 00:00:00 2001 From: Patrick Gallagher Date: Thu, 25 Jul 2024 21:25:08 -0700 Subject: [PATCH] Deploy OD / USD Oracle (#83) * Add DeployCamelotOdUsdOracle * Fix quote period and redeploy OD and ODG oracles --- script/DeployOracle.s.sol | 57 ++++++++++++++++++++++++++++++++++++--- script/Registry.s.sol | 8 ++++-- 2 files changed, 60 insertions(+), 5 deletions(-) diff --git a/script/DeployOracle.s.sol b/script/DeployOracle.s.sol index 8e610ef..460f7b2 100644 --- a/script/DeployOracle.s.sol +++ b/script/DeployOracle.s.sol @@ -6,9 +6,6 @@ import {Script} from 'forge-std/Script.sol'; import {CommonMainnet} from '@script/Common.s.sol'; import 'forge-std/console2.sol'; -import {CamelotRelayerFactory} from '@contracts/factories/CamelotRelayerFactory.sol'; -import {ChainlinkRelayerFactory} from '@contracts/factories/ChainlinkRelayerFactory.sol'; -import {DenominatedOracleFactory} from '@contracts/factories/DenominatedOracleFactory.sol'; import {IBaseOracle} from '@interfaces/oracles/IBaseOracle.sol'; // BROADCAST @@ -116,3 +113,57 @@ contract DeployWstethRethL2ValidityOracles is Script, CommonMainnet { vm.stopBroadcast(); } } + +// BROADCAST +// source .env && forge script DeployCamelotOdUsdOracle --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY --sender $DEFAULT_KEY_PUBLIC_ADDRESS --account defaultKey + +// SIMULATE +// source .env && forge script DeployCamelotOdUsdOracle --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --sender $DEFAULT_KEY_PUBLIC_ADDRESS + +contract DeployCamelotOdUsdOracle is Script, CommonMainnet { + IBaseOracle public _odEthCamelotRelayer; + IBaseOracle public _odUsdOracle; + + function run() public { + vm.startBroadcast(); + + _odEthCamelotRelayer = camelotRelayerFactory.deployAlgebraRelayer( + MAINNET_ALGEBRA_FACTORY, MAINNET_SYSTEM_COIN, MAINNET_WETH, uint32(MAINNET_CAMELOT_QUOTE_PERIOD) + ); + + _odUsdOracle = denominatedOracleFactory.deployDenominatedOracle( + _odEthCamelotRelayer, IBaseOracle(MAINNET_CHAINLINK_L2VALIDITY_ETH_USD_RELAYER), false + ); + + _odUsdOracle.getResultWithValidity(); + + vm.stopBroadcast(); + } +} + +// BROADCAST +// source .env && forge script DeployCamelotOdgUsdOracle --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --broadcast --verify --etherscan-api-key $ARB_ETHERSCAN_API_KEY --sender $DEFAULT_KEY_PUBLIC_ADDRESS --account defaultKey + +// SIMULATE +// source .env && forge script DeployCamelotOdgUsdOracle --with-gas-price 2000000000 -vvvvv --rpc-url $ARB_MAINNET_RPC --sender $DEFAULT_KEY_PUBLIC_ADDRESS + +contract DeployCamelotOdgUsdOracle is Script, CommonMainnet { + IBaseOracle public _odgEthCamelotRelayer; + IBaseOracle public _odgUsdOracle; + + function run() public { + vm.startBroadcast(); + + _odgEthCamelotRelayer = camelotRelayerFactory.deployAlgebraRelayer( + MAINNET_ALGEBRA_FACTORY, MAINNET_PROTOCOL_TOKEN, MAINNET_WETH, uint32(MAINNET_CAMELOT_QUOTE_PERIOD) + ); + + _odgUsdOracle = denominatedOracleFactory.deployDenominatedOracle( + _odgEthCamelotRelayer, IBaseOracle(MAINNET_CHAINLINK_L2VALIDITY_ETH_USD_RELAYER), false + ); + + _odgUsdOracle.getResultWithValidity(); + + vm.stopBroadcast(); + } +} diff --git a/script/Registry.s.sol b/script/Registry.s.sol index cb5fdf9..5c4011d 100644 --- a/script/Registry.s.sol +++ b/script/Registry.s.sol @@ -64,7 +64,9 @@ address constant SEPOLIA_ALGEBRA_FARM_CENTER = 0x04e4A5A4E4D2A5a0fb48ECde0bbD555 address constant MAINNET_DEPLOYER = 0xF78dA2A37049627636546E0cFAaB2aD664950917; uint256 constant MAINNET_ORACLE_DELAY = 1 hours; uint256 constant MAINNET_CHAINLINK_L2VALIDITY_GRACE_PERIOD = 1 hours; +uint256 constant MAINNET_CAMELOT_QUOTE_PERIOD = 1 hours; address constant MAINNET_PROTOCOL_TOKEN = 0x000D636bD52BFc1B3a699165Ef5aa340BEA8939c; +address constant MAINNET_SYSTEM_COIN = 0x221A0f68770658C15B525d0F89F5da2baAB5f321; address constant MAINNET_WETH = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1; address constant ETH = 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1; address constant ARB = 0x912CE59144191C1204E64559FE8253a0e49E6548; @@ -79,7 +81,8 @@ address constant MAINNET_DELAYED_ORACLE_FACTORY = 0x9Dd63fA54dEfd8820BCAb3e3cC39 ////////// RELAYERS ////////// // Camelot -address constant MAINNET_CAMELOT_ODG_WETH_RELAYER = 0xF7Ec9ad3192d4ec1E54d52B3E492B5B66AB02889; +address constant MAINNET_CAMELOT_ODG_WETH_RELAYER = 0x10ef7FEcf888Bc4B1F64757B77317946fFBc5873; +address constant MAINNET_CAMELOT_OD_WETH_RELAYER = 0x43261bFF12F8D26Ae3E3ef6924Eca6FA5c32f4b6; // Chainlink address constant MAINNET_CHAINLINK_ETH_USD_RELAYER = 0x3e6C1621f674da311E57646007fBfAd857084383; address constant MAINNET_CHAINLINK_L2VALIDITY_ETH_USD_RELAYER = 0x4617Feb8B72167c3b8253a1327CddE44e54670Ce; @@ -89,7 +92,8 @@ address constant MAINNET_CHAINLINK_L2VALIDITY_RETH_ETH_RELAYER = 0x77A15A5b9b7e1 address constant MAINNET_CHAINLINK_L2VALIDITY_WSTETH_ETH_RELAYER = 0x4dF7048DC8696832A146ac4Ba8f7a791f258916c; address constant MAINNET_CHAINLINK_ARB_USD_RELAYER = 0x2635f731BB6981E72F92A781578952450759F762; // Denominated -address constant MAINNET_DENOMINATED_ODG_USD_ORACLE = 0xE90E52eb676bc00DD85FAE83D2FAC22062F7f470; +address constant MAINNET_DENOMINATED_ODG_USD_ORACLE = 0x734B085f68Ee612A7e51927e7B070CddE948C510; +address constant MAINNET_DENOMINATED_OD_USD_ORACLE = 0x53BA82f08639F5D0ac7b61471A6CAc0B2FAb7372; address constant MAINNET_DENOMINATED_RETH_USD_ORACLE = 0xE0ac4511A617cBee55ECb62667B08DB6864B9d8e; address constant MAINNET_DENOMINATED_WSTETH_USD_ORACLE = 0x8746664d1E0F0e61275EF3B52A8a3b3dFC11CcAb; address constant MAINNET_DENOMINATED_L2VALIDITY_RETH_USD_ORACLE = 0x35843B3B7838eA15D0cAf2E61AD52C72b95b3Ca7;