Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/BuilderCodes.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ contract BuilderCodes is
/// @notice Initializes the contract (replaces constructor)
///
/// @param initialOwner Address that will own the contract
/// @param initialRegistrar Address to grant REGISTER_ROLE (can be address(0) to skip)
function initialize(address initialOwner, address initialRegistrar, string memory uriPrefix) external initializer {
/// @param initialAdmin Address to grant REGISTER_ROLE (can be address(0) to skip)
function initialize(address initialOwner, address initialAdmin, string memory uriPrefix) external initializer {
if (initialOwner == address(0)) revert ZeroAddress();

__AccessControl_init();
Expand All @@ -107,7 +107,7 @@ contract BuilderCodes is
__UUPSUpgradeable_init();
_getRegistryStorage().uriPrefix = uriPrefix;

if (initialRegistrar != address(0)) _grantRole(REGISTER_ROLE, initialRegistrar);
if (initialAdmin != address(0)) _grantRole(DEFAULT_ADMIN_ROLE, initialAdmin);
}

/// @notice Registers a new referral code in the system with a custom value
Expand Down Expand Up @@ -247,7 +247,7 @@ contract BuilderCodes is
///
/// @return True if the address has the role
function hasRole(bytes32 role, address account) public view override returns (bool) {
return account == owner() || super.hasRole(role, account);
return super.hasRole(role, account) || super.hasRole(getRoleAdmin(role), account) || account == owner();
}

/// @inheritdoc ERC721Upgradeable
Expand Down
Loading