Skip to content

Commit

Permalink
fix: use array instead of mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
web3rover committed Sep 16, 2024
1 parent ea209e0 commit 6fd1556
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions contracts/Governance/ACMCommandsAggregator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,9 @@ contract ACMCommandsAggregator {
IAccessControlManagerV8 public immutable ACM;

/*
* @notice Mapping to store permissions
* @notice 2D array to store permissions in batches
*/
mapping(uint256 => Permission[]) public permissions;

/*
* @notice Index for the next permissions
*/
uint256 public nextIndex;
Permission[][] public permissions;

/*
* @notice Event emitted when permissions are added
Expand All @@ -72,8 +67,11 @@ contract ACMCommandsAggregator {
* @param _permissions Array of permissions
*/
function addPermissions(Permission[] memory _permissions) external {
uint256 index = permissions.length;
permissions.push();

for (uint256 i = 0; i < _permissions.length; i++) {
permissions[nextIndex].push(
permissions[index].push(
Permission(
_permissions[i].permissionType,
_permissions[i].contractAddress,
Expand All @@ -83,8 +81,7 @@ contract ACMCommandsAggregator {
);
}

emit PermissionsAdded(nextIndex);
nextIndex++;
emit PermissionsAdded(index);
}

/*
Expand Down

0 comments on commit 6fd1556

Please sign in to comment.