-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add EthX price feed #193
Add EthX price feed #193
Conversation
WalkthroughThe update introduces a Solidity script for switching the ETHX price feed by interacting with key contracts such as Changes
Sequence Diagram(s)sequenceDiagram
participant User as User
participant Script as switchEthXPriceFeed
participant Registry as Registry
participant PriceRouter as PriceRouter
User->>Script: execute run()
Script->>Registry: access Registry data
Script->>PriceRouter: modify asset settings
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
|
||
uint256 price = uint256(IChainlinkAggregator(WETH_USD_FEED).latestAnswer()); | ||
settings = PriceRouter.AssetSettings(CHAINLINK_DERIVATIVE, ETHX_USD_FEED); | ||
PriceRouter.ChainlinkDerivativeStorage memory stor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stor.inETH should be set to true. I looked at the feed and this is am ETHx/ETH feed not a USD one.
|
||
function run() external { | ||
|
||
uint256 price = uint256(IChainlinkAggregator(WETH_USD_FEED).latestAnswer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This price needs to be multiplied by the exchange rate of ETHx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However this is not used to call startEditAsset
, so you just need to keep it in mind for when you complete edit asset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- script/Mainnet/production/switchETHXPriceFeed.part2.s.sol (1 hunks)
- script/Mainnet/production/switchETHXPriceFeed.s.sol (1 hunks)
Additional comments not posted (7)
script/Mainnet/production/switchETHXPriceFeed.s.sol (3)
28-30
: Constants declaration review.The constants
CHAINLINK_DERIVATIVE
,TWAP_DERIVATIVE
, andEXTENSION_DERIVATIVE
are clearly defined. Ensure these constants are used consistently throughout the contract and their values align with the intended logic.
32-47
: Review ofrun
function.The function sets up and starts the broadcast of asset settings modifications. It uses a hardcoded
ETHX_ETH_FEED
which should be verified. TheinETH
flag is set to true based on a previous comment, which is good. However, ensure that the use ofETHX_ETH_FEED
and the logic within this function align with the overall contract's goals.
24-25
: Initialization ofRegistry
andPriceRouter
.The hardcoded addresses for
Registry
andPriceRouter
are fine as long as they are correct and intended for production use. Ensure these addresses are verified and up-to-date.script/Mainnet/production/switchETHXPriceFeed.part2.s.sol (4)
21-21
: Ensure accurate contract name.The contract name in this file is correct and aligns with the file name.
28-30
: Constants declaration review.The constants are identical to those in the first file. Ensure they are consistently used across both parts of the script.
24-25
: Initialization ofRegistry
andPriceRouter
.As in the first part, ensure the hardcoded addresses are correct and intended for production use.
32-53
: Review ofrun
function in part 2.This function completes the asset editing process started in the first part. It calculates prices using feeds and completes the asset setting. Ensure the calculations and the logic used here are accurate and intended. The division by
1e18
should be verified to ensure it aligns with the decimals used in the feeds.
* @dev Run | ||
* `source .env && forge script script/Mainnet/production/switchETHXPriceFeed.s.sol:swithEthXPriceFeed --rpc-url $MAINNET_RPC_URL --sender $MULTI_SIG --with-gas-price 25000000000` | ||
*/ | ||
contract swithEthXPriceFeed is Script, MainnetAddresses { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure accurate contract name.
The contract name swithEthXPriceFeed
seems to have a typographical error. It should likely be switchEthXPriceFeed
as indicated by the file name and usage in other documents.
- contract swithEthXPriceFeed is Script, MainnetAddresses {
+ contract switchEthXPriceFeed is Script, MainnetAddresses {
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
contract swithEthXPriceFeed is Script, MainnetAddresses { | |
contract switchEthXPriceFeed is Script, MainnetAddresses { |
Summary by CodeRabbit