Skip to content

Commit

Permalink
fix: emit events in constructor (0xM Q-01) (#55)
Browse files Browse the repository at this point in the history
* fix: emit events in constructor (0xM Q-01)

Signed-off-by: Tomás Migone <tomas@edgeandnode.com>
  • Loading branch information
tmigone authored Sep 19, 2023
1 parent 347f6fa commit 01d4d9e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions contracts/GelatoManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract GelatoManager is AutomateTaskCreator, Governed {
address _governor,
uint256 _maxGasPrice
) AutomateTaskCreator(_automate, _governor) Governed(_governor) {
maxGasPrice = _maxGasPrice;
_setMaxGasPrice(_maxGasPrice);
}

/**
Expand All @@ -102,9 +102,7 @@ contract GelatoManager is AutomateTaskCreator, Governed {
* @param newGasPrice The updated value for `maxGasPrice`
*/
function setMaxGasPrice(uint256 newGasPrice) external onlyGovernor {
if (newGasPrice == 0) revert GasPriceCannotBeZero();
maxGasPrice = newGasPrice;
emit MaxGasPriceSet(maxGasPrice);
_setMaxGasPrice(newGasPrice);
}

/**
Expand Down Expand Up @@ -149,4 +147,14 @@ contract GelatoManager is AutomateTaskCreator, Governed {
_cancelTask(taskId);
emit ResolverTaskCancelled(taskId);
}

/**
* @notice Sets the maximum gas price for task execution
* @param newGasPrice The updated value for `maxGasPrice`
*/
function _setMaxGasPrice(uint256 newGasPrice) internal {
if (newGasPrice == 0) revert GasPriceCannotBeZero();
maxGasPrice = newGasPrice;
emit MaxGasPriceSet(maxGasPrice);
}
}

0 comments on commit 01d4d9e

Please sign in to comment.