Skip to content

Commit

Permalink
refactor: zero address owner custom error
Browse files Browse the repository at this point in the history
(cherry picked from commit 240b496deeacd58a3ee2e36de00478fcfd741465)
  • Loading branch information
superical committed Mar 7, 2024
1 parent 5258e1f commit 33d6933
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/base/DocumentStoreAccessControl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"
* @notice Base contract for managing access control roles for a DocumentStore
*/
contract DocumentStoreAccessControl is AccessControlUpgradeable {
error ZeroOwner();

bytes32 public constant ISSUER_ROLE = keccak256("ISSUER_ROLE");
bytes32 public constant REVOKER_ROLE = keccak256("REVOKER_ROLE");

Expand All @@ -17,7 +19,9 @@ contract DocumentStoreAccessControl is AccessControlUpgradeable {
* @param owner The owner of the contract
*/
function __DocumentStoreAccessControl_init(address owner) internal onlyInitializing {
require(owner != address(0), "Owner is zero");
if (owner == address(0)) {
revert ZeroOwner();
}
_grantRole(DEFAULT_ADMIN_ROLE, owner);
_grantRole(ISSUER_ROLE, owner);
_grantRole(REVOKER_ROLE, owner);
Expand Down

0 comments on commit 33d6933

Please sign in to comment.