From 01d4d9ecb84f4d4204f335e4e6f6766f2b8aaed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Tue, 19 Sep 2023 11:57:07 -0300 Subject: [PATCH] fix: emit events in constructor (0xM Q-01) (#55) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: emit events in constructor (0xM Q-01) Signed-off-by: Tomás Migone --- contracts/GelatoManager.sol | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/contracts/GelatoManager.sol b/contracts/GelatoManager.sol index 574b1d4..06c85b5 100644 --- a/contracts/GelatoManager.sol +++ b/contracts/GelatoManager.sol @@ -75,7 +75,7 @@ contract GelatoManager is AutomateTaskCreator, Governed { address _governor, uint256 _maxGasPrice ) AutomateTaskCreator(_automate, _governor) Governed(_governor) { - maxGasPrice = _maxGasPrice; + _setMaxGasPrice(_maxGasPrice); } /** @@ -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); } /** @@ -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); + } }