From 7ec67f7d2902e5a207afb5f0b2c4b5252440d4ca Mon Sep 17 00:00:00 2001 From: Akshay Aggarwal Date: Wed, 14 Feb 2024 19:56:21 +0000 Subject: [PATCH] Revert "cleanup maxLinkPayment" This reverts commit 1048b7cd609df54fdbe2d4b7022fff35eb85b54d. --- .../v0.8/automation/dev/v2_2/AutomationRegistryBase2_2.sol | 5 +++-- .../v0.8/automation/dev/v2_2/AutomationRegistryLogicA2_2.sol | 3 ++- .../v0.8/automation/dev/v2_2/AutomationRegistryLogicB2_2.sol | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryBase2_2.sol b/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryBase2_2.sol index da136f0ebca..c797960b663 100644 --- a/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryBase2_2.sol +++ b/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryBase2_2.sol @@ -630,9 +630,10 @@ abstract contract AutomationRegistryBase2_2 is ConfirmedOwner { function _getMaxLinkPayment( HotVars memory hotVars, Trigger triggerType, - uint32 performGas + uint32 performGas, + uint256 fastGasWei, + uint256 linkNative ) internal view returns (uint96) { - (uint256 fastGasWei, uint256 linkNative) = _getFeedData(hotVars); uint256 maxGasOverhead; if (triggerType == Trigger.CONDITION) { maxGasOverhead = REGISTRY_CONDITIONAL_OVERHEAD; diff --git a/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicA2_2.sol b/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicA2_2.sol index 32e30a4334c..645394e254f 100644 --- a/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicA2_2.sol +++ b/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicA2_2.sol @@ -70,7 +70,8 @@ contract AutomationRegistryLogicA2_2 is AutomationRegistryBase2_2, Chainable { return (false, bytes(""), UpkeepFailureReason.UPKEEP_CANCELLED, 0, upkeep.performGas, 0, 0); if (upkeep.paused) return (false, bytes(""), UpkeepFailureReason.UPKEEP_PAUSED, 0, upkeep.performGas, 0, 0); - uint96 maxLinkPayment = _getMaxLinkPayment(hotVars, triggerType, upkeep.performGas); + (fastGasWei, linkNative) = _getFeedData(hotVars); + uint96 maxLinkPayment = _getMaxLinkPayment(hotVars, triggerType, upkeep.performGas, fastGasWei, linkNative); if (upkeep.balance < maxLinkPayment) { return (false, bytes(""), UpkeepFailureReason.INSUFFICIENT_BALANCE, 0, upkeep.performGas, 0, 0); } diff --git a/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicB2_2.sol b/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicB2_2.sol index 5b9292f19a6..79419ac3cc6 100644 --- a/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicB2_2.sol +++ b/contracts/src/v0.8/automation/dev/v2_2/AutomationRegistryLogicB2_2.sol @@ -501,7 +501,9 @@ contract AutomationRegistryLogicB2_2 is AutomationRegistryBase2_2 { * @param gasLimit the gas to calculate payment for */ function getMaxPaymentForGas(Trigger triggerType, uint32 gasLimit) public view returns (uint96 maxPayment) { - return _getMaxLinkPayment(s_hotVars, triggerType, gasLimit); + HotVars memory hotVars = s_hotVars; + (uint256 fastGasWei, uint256 linkNative) = _getFeedData(hotVars); + return _getMaxLinkPayment(hotVars, triggerType, gasLimit, fastGasWei, linkNative); } /**