Skip to content

Commit 552a34f

Browse files
committed
removed TODO, updated interface
1 parent 4fe1222 commit 552a34f

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

target_chains/ethereum/contracts/contracts/pyth/Pyth.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ abstract contract Pyth is
397397
maxPublishTime,
398398
false,
399399
false,
400-
true // TODO: Figure out when to use the flag
400+
true
401401
);
402402
}
403403

@@ -423,7 +423,7 @@ abstract contract Pyth is
423423
maxPublishTime,
424424
false,
425425
true,
426-
true // TODO: Figure out when to use the flag
426+
true
427427
);
428428
}
429429

@@ -634,7 +634,7 @@ abstract contract Pyth is
634634
maxPublishTime,
635635
true,
636636
false,
637-
true // TODO: Figure out when to use flag
637+
true
638638
);
639639
}
640640

target_chains/ethereum/sdk/solidity/IPyth.sol

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,37 @@ interface IPyth is IPythEvents {
126126
uint64 maxPublishTime
127127
) external payable returns (PythStructs.PriceFeed[] memory priceFeeds);
128128

129+
/// @notice Parse `updateData` and return price feeds of the given `priceIds` if they are all published
130+
/// within `minPublishTime` and `maxPublishTime,` but choose to store price updates if `storeUpdatesIfFresh`.
131+
///
132+
/// You can use this method if you want to use a Pyth price at a fixed time and not the most recent price;
133+
/// otherwise, please consider using `updatePriceFeeds`. This method may store the price updates on-chain, if they
134+
/// are more recent than the current stored prices.
135+
///
136+
/// This method requires the caller to pay a fee in wei; the required fee can be computed by calling
137+
/// `getUpdateFee` with the length of the `updateData` array.
138+
///
139+
/// This method will eventually allow the caller to determine whether parsed price feeds should update
140+
/// the stored values as well.
141+
///
142+
/// @dev Reverts if the transferred fee is not sufficient or the updateData is invalid or there is
143+
/// no update for any of the given `priceIds` within the given time range.
144+
/// @param updateData Array of price update data.
145+
/// @param priceIds Array of price ids.
146+
/// @param minPublishTime minimum acceptable publishTime for the given `priceIds`.
147+
/// @param maxPublishTime maximum acceptable publishTime for the given `priceIds`.
148+
/// @param storeUpdatesIfFresh flag for the parse function to
149+
/// @return priceFeeds Array of the price feeds corresponding to the given `priceIds` (with the same order).
150+
function parsePriceFeedUpdatesWithConfig(
151+
bytes[] calldata updateData,
152+
bytes32[] calldata priceIds,
153+
uint64 minAllowedPublishTime,
154+
uint64 maxAllowedPublishTime,
155+
bool checkUniqueness,
156+
bool checkUpdateDataIsMinimal,
157+
bool storeUpdatesIfFresh
158+
) public returns ( PythStructs.PriceFeed[] memory priceFeeds, uint64[] memory slots);
159+
129160
/// @notice Parse time-weighted average price (TWAP) from two consecutive price updates for the given `priceIds`.
130161
///
131162
/// This method calculates TWAP between two data points by processing the difference in cumulative price values

0 commit comments

Comments
 (0)