-
Notifications
You must be signed in to change notification settings - Fork 203
fix(bots): Add feature to denominate synthetic price by another price feed + remove noisy BasketSpreadPriceFeed logs #2385
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
Conversation
… by another price feed Signed-off-by: Nick Pai <[email protected]> Remove debug logs from BasketSpreadPriceFeed These clog up the logs
4f6c6c3 to
7ef0de7
Compare
| return null; | ||
| } | ||
| const experimentalMean = this._computeMean(experimentalPrices); | ||
| this.logger.debug({ |
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.
These clog up the logs, removing now
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.
+1, this will help
mrice32
left a comment
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.
Looks awesome. I was trying to consider other ways to handle the pool being against a different currency without having to provide yet another feed, but I don't have a good solution. LGTM!
| return null; | ||
| } | ||
| const experimentalMean = this._computeMean(experimentalPrices); | ||
| this.logger.debug({ |
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.
+1, this will help
Signed-off-by: Nick Pai <[email protected]>
| twapLength, | ||
| poolDecimals = 18, | ||
| decimals = 18 | ||
| priceFeedDecimals = 18 |
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 was a nasty bug: because this construction was named decimals and not priceFeedDecimals, then DefaultPriceFeedConfigs was not correctly overriding this precision.
| config.twapLength, | ||
| config.poolDecimals, | ||
| config.decimals // This defaults to 18 unless supplied by user | ||
| config.priceFeedDecimals // This defaults to 18 unless supplied by user |
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.
config.decimals doesn't actually exist when the config is constructed by DefaultPriceFeedConfigs, so I renamed to priceFeedDecimals which CryptoWatchPriceFeed uses.
| web3.eth.getBlock("latest"), | ||
| createTokenPriceFeedForEmp(logger, web3, networker, getTime, empAddress, tokenPriceFeedConfig), | ||
| createReferencePriceFeedForEmp(logger, web3, networker, getTime, empAddress, medianizerPriceFeedConfig) | ||
| createTokenPriceFeedForEmp(logger, web3, networker, getTime, empAddress, { |
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.
Here's some new logic: I enforce that all of the pricefeeds use the same precision.
Signed-off-by: Nick Pai <[email protected]>
Signed-off-by: Nick Pai <[email protected]>
Signed-off-by: Nick Pai <[email protected]>
Signed-off-by: Nick Pai <[email protected]>
| STABLESPREAD: { | ||
| // This is alternatively known as "STABLESPREAD/ETH" | ||
| type: "basketspread", | ||
| lookback: 7200, |
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.
These EMP's all have huge lookback's so I want to override them
mrice32
left a comment
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.
LGTM!
|
|
||
| const { ConvertDecimals, createFormatFunction, formatHours, createObjectFromDefaultProps } = require("@uma/common"); | ||
|
|
||
| // TODO: Rename "medianizerPriceFeed" ==> "pegPriceFeed" and "uniswapPriceFeed" ==> "syntheticPriceFeed" |
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.
+1
| STABLESPREAD: { | ||
| // This is alternatively known as "STABLESPREAD/ETH" | ||
| type: "basketspread", | ||
| lookback: 7200, |
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.
+1
Signed-off-by: Nick Pai [email protected]
Motivation
Currently, the
SyntheticPegMonitorassumes that theTOKEN_PRICE_FEED(i.e. the "synthetic") and theMEDIANIZER_PRICE_FEED(i.e. the "peg") are returning prices denominated in the same currency. However, consider the case where the synthetic market is (zeldaCash - USDC) and the peg market is tracking (STABLESPREAD/ETH). This can result in the following erroneous log:Summary
Adds an optional construction parameter to this monitor called the
denominatorPriceFeedwhich will divide the synthetic price if available.Example environment variable to divide the synthetic price by the price of ETHUSD: