Skip to content

Commit cfc7a1d

Browse files
fix: checks-effects-interactions pattern for pyth parse call (#2694)
1 parent 7e8c3f8 commit cfc7a1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

target_chains/ethereum/contracts/contracts/pulse/Scheduler.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ abstract contract Scheduler is IScheduler, SchedulerState {
269269
// from the last trading period. Thus, we use a minimum timestamp of zero while parsing,
270270
// and we enforce the past max validity ourselves in _validateShouldUpdatePrices using
271271
// the highest timestamp in the update data.
272+
status.balanceInWei -= pythFee;
273+
status.totalSpent += pythFee;
272274
uint64 curTime = SafeCast.toUint64(block.timestamp);
273275
(
274276
PythStructs.PriceFeed[] memory priceFeeds,
@@ -279,8 +281,6 @@ abstract contract Scheduler is IScheduler, SchedulerState {
279281
0, // We enforce the past max validity ourselves in _validateShouldUpdatePrices
280282
curTime + FUTURE_TIMESTAMP_MAX_VALIDITY_PERIOD
281283
);
282-
status.balanceInWei -= pythFee;
283-
status.totalSpent += pythFee;
284284

285285
// Verify all price feeds have the same Pythnet slot.
286286
// All feeds in a subscription must be updated at the same time.

0 commit comments

Comments
 (0)