Skip to content

Commit af5e5dd

Browse files
committed
Address feedback
1 parent 3147f11 commit af5e5dd

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/bridge/MinterBurnerForwarder.sol

+17-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
pragma solidity ^0.8.0;
66

7-
import '@openzeppelin/contracts/access/AccessControl.sol';
7+
import '@openzeppelin/contracts/access/AccessControlEnumerable.sol';
88
import '../precompiles/ArbOwner.sol';
99

1010
/**
@@ -13,48 +13,48 @@ import '../precompiles/ArbOwner.sol';
1313
* Minting and burning will be done by using the ArbOwner functions mintNativeToken and burnNativeToken.
1414
* This contract must be set as a chain owner of the chain to be able to call ArbOwner functions
1515
*/
16-
contract MinterBurnerForwarder is AccessControl {
16+
contract MinterBurnerForwarder is AccessControlEnumerable {
1717
// Roles
1818
bytes32 public constant MINTER_ROLE = keccak256('MINTER');
1919
bytes32 public constant BURNER_ROLE = keccak256('BURNER');
2020

2121
// ArbOwner precompile
2222
ArbOwner constant ARB_OWNER = ArbOwner(address(112));
2323

24-
// Events
25-
event NativeTokenMinted(address indexed caller, uint256 amount);
26-
event NativeTokenBurned(address indexed caller, uint256 amount);
27-
28-
// Errors
29-
error NotChainOwner();
30-
31-
constructor() {
32-
// Check if the deployer is a chain owner
33-
if (!ARB_OWNER.isChainOwner(msg.sender)) {
34-
revert NotChainOwner();
24+
constructor(address[] memory admins, address[] memory minters, address[] memory burners) {
25+
// Grant ADMIN role to admins
26+
for (uint256 i = 0; i < admins.length; i++) {
27+
_grantRole(DEFAULT_ADMIN_ROLE, admins[i]);
28+
}
29+
30+
// Grant MINTER role to minters
31+
for (uint256 i = 0; i < minters.length; i++) {
32+
_grantRole(MINTER_ROLE, minters[i]);
3533
}
3634

37-
// Grant admin role to the chain owner
38-
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
35+
// Grant BURNER role to burners
36+
for (uint256 i = 0; i < burners.length; i++) {
37+
_grantRole(BURNER_ROLE, burners[i]);
38+
}
3939
}
4040

4141
/**
4242
* @notice Mints some amount of the native gas token for this chain to the calling address.
4343
* @dev This function calls mintNativeToken in the ArbOwner precompile, so this contract must also be a chain owner.
44+
* No events are emitted in this function, since the ArbOwner precompile already emits OwnerActs()
4445
* @param amount The amount of native gas token to mint
4546
*/
4647
function mintNativeToken(uint256 amount) external onlyRole(MINTER_ROLE) {
4748
ARB_OWNER.mintNativeToken(msg.sender, amount);
48-
emit NativeTokenMinted(msg.sender, amount);
4949
}
5050

5151
/**
5252
* @notice Burns some amount of the native gas token for this chain from the given address.
5353
* @dev This function calls burnNativeToken in the ArbOwner precompile, so this contract must also be a chain owner.
54+
* No events are emitted in this function, since the ArbOwner precompile already emits OwnerActs()
5455
* @param amount The amount of native gas token to burn
5556
*/
5657
function burnNativeToken(uint256 amount) external onlyRole(BURNER_ROLE) {
5758
ARB_OWNER.burnNativeToken(msg.sender, amount);
58-
emit NativeTokenBurned(msg.sender, amount);
5959
}
6060
}

0 commit comments

Comments
 (0)