Skip to content

Commit

Permalink
use calldata array lengths directly
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkjester committed Oct 25, 2024
1 parent 3432687 commit 8bf9d86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 3 additions & 4 deletions contracts/contracts/lib/PauseManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@ abstract contract PauseManager is Initializable, IPauseManager, AccessControlUpg
PauseTypeRole[] calldata _pauseTypeRoleAssignments,
PauseTypeRole[] calldata _unpauseTypeRoleAssignments
) internal onlyInitializing {
uint256 arrayLength = _pauseTypeRoleAssignments.length;
for (uint256 i; i < arrayLength; i++) {
for (uint256 i; i < _pauseTypeRoleAssignments.length; i++) {
_pauseTypeRoles[_pauseTypeRoleAssignments[i].pauseType] = _pauseTypeRoleAssignments[i].role;
emit PauseTypeRoleSet(_pauseTypeRoleAssignments[i].pauseType, _pauseTypeRoleAssignments[i].role);
}
arrayLength = _unpauseTypeRoleAssignments.length;
for (uint256 i; i < arrayLength; i++) {

for (uint256 i; i < _unpauseTypeRoleAssignments.length; i++) {
_unPauseTypeRoles[_unpauseTypeRoleAssignments[i].pauseType] = _unpauseTypeRoleAssignments[i].role;
emit UnPauseTypeRoleSet(_unpauseTypeRoleAssignments[i].pauseType, _unpauseTypeRoleAssignments[i].role);
}
Expand Down
4 changes: 1 addition & 3 deletions contracts/contracts/lib/PermissionsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ abstract contract PermissionsManager is Initializable, AccessControlUpgradeable,
* @param _roleAddresses The list of addresses and roles to assign permissions to.
*/
function __Permissions_init(RoleAddress[] calldata _roleAddresses) internal onlyInitializing {
uint256 roleAddressesLength = _roleAddresses.length;

for (uint256 i; i < roleAddressesLength; i++) {
for (uint256 i; i < _roleAddresses.length; i++) {
if (_roleAddresses[i].addressWithRole == address(0)) {
revert ZeroAddressNotAllowed();
}
Expand Down

0 comments on commit 8bf9d86

Please sign in to comment.