|
|
@@ -168,17 +168,7 @@ abstract contract Pyth is
|
|
|
index += attestationSize;
|
|
|
|
|
|
// Store the attestation
|
|
|
- uint64 latestPublishTime = latestPriceInfoPublishTime(priceId);
|
|
|
-
|
|
|
- if (info.publishTime > latestPublishTime) {
|
|
|
- setLatestPriceInfo(priceId, info);
|
|
|
- emit PriceFeedUpdate(
|
|
|
- priceId,
|
|
|
- info.publishTime,
|
|
|
- info.price,
|
|
|
- info.conf
|
|
|
- );
|
|
|
- }
|
|
|
+ updateLatestPriceIfNecessary(priceId, info);
|
|
|
}
|
|
|
|
|
|
emit BatchPriceFeedUpdate(vm.emitterChainId, vm.sequence);
|
|
|
@@ -486,12 +476,12 @@ abstract contract Pyth is
|
|
|
);
|
|
|
|
|
|
for (uint j = 0; j < numUpdates; j++) {
|
|
|
- PythInternalStructs.PriceInfo memory info;
|
|
|
+ PythInternalStructs.PriceInfo memory priceInfo;
|
|
|
bytes32 priceId;
|
|
|
uint64 prevPublishTime;
|
|
|
(
|
|
|
offset,
|
|
|
- info,
|
|
|
+ priceInfo,
|
|
|
priceId,
|
|
|
prevPublishTime
|
|
|
) = extractPriceInfoFromMerkleProof(
|
|
|
@@ -499,6 +489,7 @@ abstract contract Pyth is
|
|
|
encoded,
|
|
|
offset
|
|
|
);
|
|
|
+ updateLatestPriceIfNecessary(priceId, priceInfo);
|
|
|
{
|
|
|
// check whether caller requested for this data
|
|
|
uint k = findIndexOfPriceId(priceIds, priceId);
|
|
|
@@ -509,7 +500,7 @@ abstract contract Pyth is
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- uint publishTime = uint(info.publishTime);
|
|
|
+ uint publishTime = uint(priceInfo.publishTime);
|
|
|
// Check the publish time of the price is within the given range
|
|
|
// and only fill the priceFeedsInfo if it is.
|
|
|
// If is not, default id value of 0 will still be set and
|
|
|
@@ -524,7 +515,7 @@ abstract contract Pyth is
|
|
|
priceFeeds,
|
|
|
k,
|
|
|
priceId,
|
|
|
- info,
|
|
|
+ priceInfo,
|
|
|
publishTime
|
|
|
);
|
|
|
}
|
|
|
@@ -576,7 +567,7 @@ abstract contract Pyth is
|
|
|
}
|
|
|
|
|
|
(
|
|
|
- PythInternalStructs.PriceInfo memory info,
|
|
|
+ PythInternalStructs.PriceInfo memory priceInfo,
|
|
|
|
|
|
) = parseSingleAttestationFromBatch(
|
|
|
encoded,
|
|
|
@@ -584,7 +575,9 @@ abstract contract Pyth is
|
|
|
attestationSize
|
|
|
);
|
|
|
|
|
|
- uint publishTime = uint(info.publishTime);
|
|
|
+ updateLatestPriceIfNecessary(priceId, priceInfo);
|
|
|
+
|
|
|
+ uint publishTime = uint(priceInfo.publishTime);
|
|
|
// Check the publish time of the price is within the given range
|
|
|
// and only fill the priceFeedsInfo if it is.
|
|
|
// If is not, default id value of 0 will still be set and
|
|
|
@@ -598,7 +591,7 @@ abstract contract Pyth is
|
|
|
priceFeeds,
|
|
|
k,
|
|
|
priceId,
|
|
|
- info,
|
|
|
+ priceInfo,
|
|
|
publishTime
|
|
|
);
|
|
|
}
|
|
|
@@ -727,6 +720,6 @@ abstract contract Pyth is
|
|
|
}
|
|
|
|
|
|
function version() public pure returns (string memory) {
|
|
|
- return "1.3.3";
|
|
|
+ return "1.4.3";
|
|
|
}
|
|
|
}
|