- Added MINTER_ROLE constant to manage minting permissions. - Updated mint function to restrict access to addresses with MINTER_ROLE, enhancing security and compliance. - Granted MINTER_ROLE to the initial owner during contract deployment.
32 lines
1.0 KiB
Solidity
32 lines
1.0 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import "@openzeppelin/contracts/access/AccessControl.sol";
|
|
|
|
contract DBIS_RootRegistry is AccessControl {
|
|
bytes32 public constant ROOT_ADMIN_ROLE = keccak256("ROOT_ADMIN");
|
|
mapping(bytes32 => address) private _components;
|
|
string public railVersion;
|
|
|
|
event ComponentUpdated(bytes32 indexed key, address indexed addr, string railVersion);
|
|
|
|
constructor(address admin, string memory _railVersion) {
|
|
_grantRole(DEFAULT_ADMIN_ROLE, admin);
|
|
_grantRole(ROOT_ADMIN_ROLE, admin);
|
|
railVersion = _railVersion;
|
|
}
|
|
|
|
function setComponent(bytes32 key, address addr) external onlyRole(ROOT_ADMIN_ROLE) {
|
|
_components[key] = addr;
|
|
emit ComponentUpdated(key, addr, railVersion);
|
|
}
|
|
|
|
function getComponent(bytes32 key) external view returns (address) {
|
|
return _components[key];
|
|
}
|
|
|
|
function setRailVersion(string calldata _version) external onlyRole(ROOT_ADMIN_ROLE) {
|
|
railVersion = _version;
|
|
}
|
|
}
|