-
Notifications
You must be signed in to change notification settings - Fork 306
feat(twap): update TWAP price feed logic to handle multiple price feeds and improve validation #2624
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
…ds and improve validation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…nd improve validation
| UnsafeCalldataBytesLib.toUint32(updateData[i + 1], 0) == | ||
| ACCUMULATOR_MAGIC) | ||
| startPriceIds[i] == endPriceIds[j] && !endPriceIdMatched[j] | ||
| ) { |
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.
we dont need this check anymore because we call processSingleTwapUpdate and in the function we call extractUpdateTypeFromAccumulatorHeader which checks for the ACCUMULATOR_MAGIC
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!
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.
Nice! Please address my comments before merging.
…e fees based on the number of updates
Summary
Modified
parseTwapPriceFeedUpdatesto properly handle multiple price feed IDs in a single call, allowing batch TWAP updates for multiple price feeds.Rationale
How has this been tested?
Testing details:
Added
testParseTwapPriceFeedUpdatesMultipleFeeds()to verify:Added
testParseTwapPriceFeedUpdatesRevertsWithMismatchedArrayLengths()to verify:Modified base test setup to include test data for multiple price feeds:
The changes maintain all existing functionality while adding support for batch updates, with comprehensive test coverage ensuring correctness and proper error handling.