Skip to content

Commit

Permalink
update tests and code
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Lima committed Jul 12, 2023
1 parent 818bcbd commit 1927436
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/ERC721RolesRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ contract ERC721RolesRegistry is IERC721RolesRegistry {
bytes calldata _data
) external onlyOwner(_nftAddress, _tokenId) validExpirationDate(_expirationDate) {
roleAssignments[msg.sender][_account][_nftAddress][_tokenId][_role] = RoleData(_expirationDate, _data);
roleLastAssingment[msg.sender][_nftAddress][_tokenId][_role] = _account;
emit RoleGranted(_role, _account, _expirationDate, _nftAddress, _tokenId, _data);
}

Expand All @@ -46,6 +47,7 @@ contract ERC721RolesRegistry is IERC721RolesRegistry {
uint256 _tokenId
) external onlyOwner(_nftAddress, _tokenId) {
delete roleAssignments[msg.sender][_account][_nftAddress][_tokenId][_role];
delete roleLastAssingment[msg.sender][_nftAddress][_tokenId][_role];
emit RoleRevoked(_role, _account, _nftAddress, _tokenId);
}

Expand Down
11 changes: 11 additions & 0 deletions test/ERC721RolesRegistry.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ describe('Roles Registry', () => {
supportMultipleUsers,
),
).to.be.equal(false)

expect(
await rolesRegistry.hasRole(
role,
account.address,
userTwo.address,
mockERC721.address,
tokenId,
supportMultipleUsers,
),
).to.be.equal(true)
})
})
})

0 comments on commit 1927436

Please sign in to comment.