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.
This commit is contained in:
Ali Behjati 2024-01-19 11:15:43 +00:00
parent 658d7ca032
commit be8447324c
3 changed files with 8 additions and 6 deletions

6
package-lock.json generated
View File

@ -29879,7 +29879,6 @@
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz",
"integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
@ -30209,7 +30208,6 @@
"version": "5.0.7",
"resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz",
"integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==",
"hasInstallScript": true,
"optional": true,
"dependencies": {
"node-gyp-build": "^4.3.0"
@ -58098,7 +58096,7 @@
},
"target_chains/ethereum/entropy_sdk/solidity": {
"name": "@pythnetwork/entropy-sdk-solidity",
"version": "1.0.0",
"version": "1.1.0",
"license": "Apache-2.0",
"devDependencies": {
"prettier": "^2.7.1",
@ -58682,7 +58680,7 @@
},
"target_chains/ethereum/sdk/solidity": {
"name": "@pythnetwork/pyth-sdk-solidity",
"version": "2.3.0",
"version": "2.4.0",
"license": "Apache-2.0",
"devDependencies": {
"prettier": "^2.7.1",

View File

@ -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 &&

View File

@ -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",