-
Notifications
You must be signed in to change notification settings - Fork 306
refactor: Optional storage flag when parsing price feed updates #2727
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
Changes from 7 commits
4fe1222
552a34f
b3cf5d3
2db25fc
a1822f8
2a5b2ec
6b4b0c8
2e79358
f1183f1
53690d2
0636cb1
f604a13
660717e
27bf014
02fe840
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,15 +86,21 @@ contract MockPyth is AbstractPyth { | |
| return singleUpdateFeeInWei * updateData.length; | ||
| } | ||
|
|
||
| function parsePriceFeedUpdatesInternal( | ||
| function parsePriceFeedUpdatesWithConfig( | ||
| bytes[] calldata updateData, | ||
| bytes32[] calldata priceIds, | ||
| uint64 minPublishTime, | ||
| uint64 maxPublishTime, | ||
| bool unique | ||
| uint64 minAllowedPublishTime, | ||
| uint64 maxAllowedPublishTime, | ||
| bool checkUniqueness, | ||
| bool checkUpdateDataIsMinimal, | ||
| bool storeUpdatesIfFresh | ||
| ) | ||
| internal | ||
| returns (PythStructs.PriceFeed[] memory feeds, uint64[] memory slots) | ||
| public | ||
| payable | ||
| returns ( | ||
| PythStructs.PriceFeed[] memory feeds, | ||
| uint64[] memory slots | ||
| ) | ||
|
||
| { | ||
| uint requiredFee = getUpdateFee(updateData); | ||
| if (msg.value < requiredFee) revert PythErrors.InsufficientFee(); | ||
|
|
@@ -124,9 +130,9 @@ contract MockPyth is AbstractPyth { | |
|
|
||
| if (feeds[i].id == priceIds[i]) { | ||
| if ( | ||
| minPublishTime <= publishTime && | ||
| publishTime <= maxPublishTime && | ||
| (!unique || prevPublishTime < minPublishTime) | ||
| minAllowedPublishTime <= publishTime && | ||
| publishTime <= maxAllowedPublishTime && | ||
| (!checkUniqueness || prevPublishTime < minAllowedPublishTime) | ||
| ) { | ||
| break; | ||
| } else { | ||
|
|
@@ -146,12 +152,14 @@ contract MockPyth is AbstractPyth { | |
| uint64 minPublishTime, | ||
| uint64 maxPublishTime | ||
| ) external payable override returns (PythStructs.PriceFeed[] memory feeds) { | ||
| (feeds, ) = parsePriceFeedUpdatesInternal( | ||
| (feeds, ) = parsePriceFeedUpdatesWithConfig( | ||
| updateData, | ||
| priceIds, | ||
| minPublishTime, | ||
| maxPublishTime, | ||
| false | ||
| false, | ||
| true, | ||
| true | ||
| ); | ||
| } | ||
|
|
||
|
|
@@ -161,11 +169,13 @@ contract MockPyth is AbstractPyth { | |
| uint64 minPublishTime, | ||
| uint64 maxPublishTime | ||
| ) external payable override returns (PythStructs.PriceFeed[] memory feeds) { | ||
| (feeds, ) = parsePriceFeedUpdatesInternal( | ||
| (feeds, ) = parsePriceFeedUpdatesWithConfig( | ||
| updateData, | ||
| priceIds, | ||
| minPublishTime, | ||
| maxPublishTime, | ||
| false, | ||
| true, | ||
| true | ||
| ); | ||
| } | ||
|
|
@@ -182,13 +192,15 @@ contract MockPyth is AbstractPyth { | |
| returns (PythStructs.PriceFeed[] memory feeds, uint64[] memory slots) | ||
| { | ||
| return | ||
| parsePriceFeedUpdatesInternal( | ||
| updateData, | ||
| priceIds, | ||
| minPublishTime, | ||
| maxPublishTime, | ||
| false | ||
| ); | ||
| parsePriceFeedUpdatesWithConfig( | ||
| updateData, | ||
| priceIds, | ||
| minPublishTime, | ||
| maxPublishTime, | ||
| false, | ||
| true, | ||
| true | ||
| ); | ||
| } | ||
|
|
||
| function parseTwapPriceFeedUpdates( | ||
|
|
||
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.
let's bump the version() to 1.4.5-alpha.1