Skip to content

Commit

Permalink
pr fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ernanirst committed Dec 20, 2023
1 parent d4a4b00 commit e43c1a5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions contracts/RolesRegistry/SftRolesRegistrySingleRole.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,17 @@ contract SftRolesRegistrySingleRole is ISftRolesRegistry, ERC1155Holder {
_grantOrUpdateRole(_recordId, _role, _grantee, _expirationDate, _revocable, _data);
}

function revokeRoleFrom(uint256 _recordId, bytes32 _role, address _grantee) external override {
RoleAssignment storage role = roleAssignments[_recordId][_role];
require(_grantee == role.grantee, 'SftRolesRegistry: grantee mismatch');

function revokeRoleFrom(
uint256 _recordId, bytes32 _role, address _grantee
) external override sameGrantee(_recordId, _role, _grantee) {
RoleAssignment storage roleAssignment = roleAssignments[_recordId][_role];
Record storage record = records[_recordId];
address caller = _findCaller(record.grantor, role.grantee, record.tokenAddress);
if (role.expirationDate > block.timestamp && !role.revocable) {
address caller = _findCaller(record.grantor, roleAssignment.grantee, record.tokenAddress);
if (roleAssignment.expirationDate > block.timestamp && !roleAssignment.revocable) {
// if role is not expired and is not revocable, only the grantee can revoke it
require(caller == role.grantee, 'SftRolesRegistry: role is not expired and is not revocable');
require(caller == roleAssignment.grantee, 'SftRolesRegistry: role is not expired and is not revocable');
}

emit RoleRevoked(_recordId, _role, role.grantee);
emit RoleRevoked(_recordId, _role, roleAssignment.grantee);
delete roleAssignments[_recordId][_role];
}

Expand Down

0 comments on commit e43c1a5

Please sign in to comment.