Skip to content

Commit

Permalink
fix(target_chains/ethereum): update MockPyth to address Pyth
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ali-bahjati committed Jan 19, 2024
1 parent 658d7ca commit be84473
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 2 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion target_chains/ethereum/sdk/solidity/MockPyth.sol
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,12 @@ contract MockPyth is AbstractPyth {
(PythStructs.PriceFeed, uint64)
);

uint publishTime = feeds[i].price.publishTime;
if (priceFeeds[feeds[i].id].price.publishTime < publishTime) {
priceFeeds[feeds[i].id] = feeds[i];
}

if (feeds[i].id == priceIds[i]) {
uint publishTime = feeds[i].price.publishTime;
if (
minPublishTime <= publishTime &&
publishTime <= maxPublishTime &&
Expand Down
2 changes: 1 addition & 1 deletion target_chains/ethereum/sdk/solidity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-sdk-solidity",
"version": "2.3.0",
"version": "2.4.0",
"description": "Read prices from the Pyth oracle",
"repository": {
"type": "git",
Expand Down

0 comments on commit be84473

Please sign in to comment.