From ee06eb28fb27541ca81f072ff306ea0f85fa0b35 Mon Sep 17 00:00:00 2001 From: Francisco de Borja Aranda Castillejo Date: Tue, 19 Mar 2024 17:33:35 +0100 Subject: [PATCH] add reentrancy guard (#12447) Signed-off-by: Borja Aranda --- .../v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol index ea01678fe76..dfbfb78d3d6 100644 --- a/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol +++ b/contracts/src/v0.8/automation/upkeeps/LinkAvailableBalanceMonitor.sol @@ -266,6 +266,7 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter for (uint256 idx = 0; idx < targetAddresses.length; idx++) { address targetAddress = targetAddresses[idx]; contractToFund = s_targets[targetAddress]; + s_targets[targetAddress].lastTopUpTimestamp = uint56(block.timestamp); if ( localBalance >= contractToFund.topUpAmount && _needsFunding( @@ -278,12 +279,12 @@ contract LinkAvailableBalanceMonitor is AccessControl, AutomationCompatibleInter bool success = i_linkToken.transfer(targetAddress, contractToFund.topUpAmount); if (success) { localBalance -= contractToFund.topUpAmount; - s_targets[targetAddress].lastTopUpTimestamp = uint56(block.timestamp); emit TopUpSucceeded(targetAddress); } else { emit TopUpFailed(targetAddress); } } else { + s_targets[targetAddress].lastTopUpTimestamp = contractToFund.lastTopUpTimestamp; emit TopUpBlocked(targetAddress); } }