From c957457f82732499e57215a8dcda2d268b84ebc1 Mon Sep 17 00:00:00 2001 From: Dima Lekhovitsky Date: Mon, 13 Jan 2025 19:34:41 +0200 Subject: [PATCH] fix: minor refactoring --- contracts/credit/CreditManagerV3.sol | 14 +++++++++----- .../test/unit/credit/CreditManagerV3.unit.t.sol | 3 +++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/contracts/credit/CreditManagerV3.sol b/contracts/credit/CreditManagerV3.sol index 360654a2..551ffff2 100644 --- a/contracts/credit/CreditManagerV3.sol +++ b/contracts/credit/CreditManagerV3.sol @@ -1292,16 +1292,20 @@ contract CreditManagerV3 is ICreditManagerV3, SanityCheckTrait, ReentrancyGuardT _setCreditConfigurator(_creditConfigurator); } + /// @dev Same as above, added for compatibility with `BytecodeRepository` which only works with `Ownable` contracts + function transferOwnership(address newOwner) + external + creditConfiguratorOnly // U:[CM-4] + { + _setCreditConfigurator(newOwner); + } + + /// @dev `setCreditConfigurator` implementation function _setCreditConfigurator(address _creditConfigurator) internal { creditConfigurator = _creditConfigurator; // U:[CM-46] emit SetCreditConfigurator(_creditConfigurator); // U:[CM-46] } - // @notice Added for compatibility with the ByteCodeRepository Deployment - function transferOwnership(address _creditConfigurator) external creditConfiguratorOnly { - _setCreditConfigurator(_creditConfigurator); - } - // --------- // // INTERNALS // // --------- // diff --git a/contracts/test/unit/credit/CreditManagerV3.unit.t.sol b/contracts/test/unit/credit/CreditManagerV3.unit.t.sol index d80f8442..d748b8f0 100644 --- a/contracts/test/unit/credit/CreditManagerV3.unit.t.sol +++ b/contracts/test/unit/credit/CreditManagerV3.unit.t.sol @@ -540,6 +540,9 @@ contract CreditManagerV3UnitTest is TestHelper, ICreditManagerV3Events, BalanceH vm.expectRevert(CallerNotConfiguratorException.selector); creditManager.setCreditConfigurator(DUMB_ADDRESS); + + vm.expectRevert(CallerNotConfiguratorException.selector); + creditManager.transferOwnership(DUMB_ADDRESS); } /// @dev U:[CM-5]: non-reentrant functions revert if called in reentrancy