Преглед на файлове

fix: update bal before keeper payment (#2628)

Tejas Badadare преди 6 месеца
родител
ревизия
928639193d
променени са 1 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 4 3
      target_chains/ethereum/contracts/contracts/pulse/Scheduler.sol

+ 4 - 3
target_chains/ethereum/contracts/contracts/pulse/Scheduler.sol

@@ -768,12 +768,13 @@ abstract contract Scheduler is IScheduler, SchedulerState {
             revert InsufficientBalance();
         }
 
-        // Pay keeper and update status if successful
+        status.balanceInWei -= totalKeeperFee;
+        status.totalSpent += totalKeeperFee;
+
+        // Pay keeper and update status
         (bool sent, ) = msg.sender.call{value: totalKeeperFee}("");
         if (!sent) {
             revert KeeperPaymentFailed();
         }
-        status.balanceInWei -= totalKeeperFee;
-        status.totalSpent += totalKeeperFee;
     }
 }