Skip to content

Commit

Permalink
fix: minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
lekhovitsky committed Jan 13, 2025
1 parent 46b1ef7 commit c957457
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 9 additions & 5 deletions contracts/credit/CreditManagerV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 //
// --------- //
Expand Down
3 changes: 3 additions & 0 deletions contracts/test/unit/credit/CreditManagerV3.unit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c957457

Please sign in to comment.