Skip to content

Commit

Permalink
Add license + update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
rya-sge committed Aug 29, 2024
1 parent f2c5be3 commit 20d00a8
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/DocumentEngine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ contract DocumentEngine is IERC1643, DocumentEngineInvariant, AccessControl {
//////////////////////////////////////////////////////////////*/

/**
* @notice Admin-only function to set or update a document
* @notice Restricted function to set or update a document
*/
function setDocument(
address smartContract,
Expand All @@ -32,7 +32,7 @@ contract DocumentEngine is IERC1643, DocumentEngineInvariant, AccessControl {
}

/**
* @notice Admin-only function to remove a document for a given smart contract and name
* @notice Restricted function to remove a document for a given smart contract and name
*/
function removeDocument(
address smartContract,
Expand Down Expand Up @@ -83,7 +83,7 @@ contract DocumentEngine is IERC1643, DocumentEngineInvariant, AccessControl {
}

/**
* @notice Public function to get a document. Uses msg.sender if no address is provided
* @notice Public function to get a document from msg.sender
*/
function getDocument(
bytes32 name_
Expand Down Expand Up @@ -122,12 +122,28 @@ contract DocumentEngine is IERC1643, DocumentEngineInvariant, AccessControl {
return _documentNames[smartContract];
}


/* ============ ACCESS CONTROL ============ */
/*
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(
bytes32 role,
address account
) public view virtual override returns (bool) {
// The Default Admin has all roles
if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
return true;
}
return AccessControl.hasRole(role, account);
}

/*//////////////////////////////////////////////////////////////
INTERNAL FUNCTIONS
//////////////////////////////////////////////////////////////*/

/**
* @dev Internal function to fetch a document and revert with an error if not found
* @dev Internal function to fetch a document
*/
function _getDocument(
address smartContract,
Expand Down Expand Up @@ -180,19 +196,4 @@ contract DocumentEngine is IERC1643, DocumentEngineInvariant, AccessControl {
doc.lastModified = block.timestamp;
emit DocumentUpdated(smartContract, name_, uri_, documentHash_);
}

/* ============ ACCESS CONTROL ============ */
/*
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(
bytes32 role,
address account
) public view virtual override returns (bool) {
// The Default Admin has all roles
if (AccessControl.hasRole(DEFAULT_ADMIN_ROLE, account)) {
return true;
}
return AccessControl.hasRole(role, account);
}
}

0 comments on commit 20d00a8

Please sign in to comment.