From 117353e9b1b994ce4eab124b0148dade767560cc Mon Sep 17 00:00:00 2001 From: Shawn <44221603+shaspitz@users.noreply.github.com> Date: Wed, 23 Oct 2024 20:25:33 -0700 Subject: [PATCH] fix: Violation Of CEI Pattern In FeePayOut Allows For Reentrancy, 443 --- contracts/contracts/utils/FeePayout.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/contracts/utils/FeePayout.sol b/contracts/contracts/utils/FeePayout.sol index 81358c8d9..7af7f1d2f 100644 --- a/contracts/contracts/utils/FeePayout.sol +++ b/contracts/contracts/utils/FeePayout.sol @@ -35,10 +35,10 @@ library FeePayout { /// @param tracker The FeePayout.Tracker struct function transferToRecipient(Tracker storage tracker) internal { uint256 amountToPay = tracker.accumulatedAmount; - (bool success, ) = payable(tracker.recipient).call{value: amountToPay}(""); - require(success, TransferToRecipientFailed()); tracker.accumulatedAmount = 0; tracker.lastPayoutBlock = block.number; + (bool success, ) = payable(tracker.recipient).call{value: amountToPay}(""); + require(success, TransferToRecipientFailed()); emit FeeTransfer(amountToPay, tracker.recipient); }