Skip to content

Commit be84473

Browse files
committed
fix(target_chains/ethereum): update MockPyth to address Pyth
We've recently changed Pyth to store the feeds on parse* methods if the updateData provided contains fresh prices. This change adds the same feature to the MockPyth.
1 parent 658d7ca commit be84473

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

package-lock.json

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

target_chains/ethereum/sdk/solidity/MockPyth.sol

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ contract MockPyth is AbstractPyth {
9898
(PythStructs.PriceFeed, uint64)
9999
);
100100

101+
uint publishTime = feeds[i].price.publishTime;
102+
if (priceFeeds[feeds[i].id].price.publishTime < publishTime) {
103+
priceFeeds[feeds[i].id] = feeds[i];
104+
}
105+
101106
if (feeds[i].id == priceIds[i]) {
102-
uint publishTime = feeds[i].price.publishTime;
103107
if (
104108
minPublishTime <= publishTime &&
105109
publishTime <= maxPublishTime &&

target_chains/ethereum/sdk/solidity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/pyth-sdk-solidity",
3-
"version": "2.3.0",
3+
"version": "2.4.0",
44
"description": "Read prices from the Pyth oracle",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)