fix(ethereum): emit update event on parse* methods in MockPyth

This commit is contained in:
Ali Behjati 2024-01-23 10:17:31 +01:00
parent ab10b9f5fa
commit c5d02afe53
3 changed files with 9 additions and 3 deletions

2
package-lock.json generated
View File

@ -58589,7 +58589,7 @@
},
"target_chains/ethereum/sdk/js": {
"name": "@pythnetwork/pyth-evm-js",
"version": "1.29.3",
"version": "1.29.4",
"license": "Apache-2.0",
"dependencies": {
"@pythnetwork/price-service-client": "*",

View File

@ -1,6 +1,6 @@
{
"name": "@pythnetwork/pyth-evm-js",
"version": "1.29.3",
"version": "1.29.4",
"description": "Pyth Network EVM Utils in JS",
"homepage": "https://pyth.network",
"author": {

View File

@ -58,7 +58,7 @@ contract MockPyth is AbstractPyth {
priceFeeds[priceFeed.id] = priceFeed;
emit PriceFeedUpdate(
priceFeed.id,
uint64(lastPublishTime),
uint64(priceFeed.price.publishTime),
priceFeed.price.price,
priceFeed.price.conf
);
@ -101,6 +101,12 @@ contract MockPyth is AbstractPyth {
uint publishTime = feeds[i].price.publishTime;
if (priceFeeds[feeds[i].id].price.publishTime < publishTime) {
priceFeeds[feeds[i].id] = feeds[i];
emit PriceFeedUpdate(
feeds[i].id,
uint64(publishTime),
feeds[i].price.price,
feeds[i].price.conf
);
}
if (feeds[i].id == priceIds[i]) {