Parcourir la source

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.
Ali Behjati il y a 1 an
Parent
commit
be8447324c

+ 2 - 4
package-lock.json

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

+ 5 - 1
target_chains/ethereum/sdk/solidity/MockPyth.sol

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

+ 1 - 1
target_chains/ethereum/sdk/solidity/package.json

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