Skip to content

Commit

Permalink
Revert "cleanup maxLinkPayment"
Browse files Browse the repository at this point in the history
This reverts commit 1048b7c.
  • Loading branch information
infiloop2 committed Feb 14, 2024
1 parent 1048b7c commit 7ec67f7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit 7ec67f7

Please sign in to comment.