refactor: add isTokenController and move _clearTokenControllers to FleekAccessControl contract

This commit is contained in:
zoruka 2022-12-08 10:22:08 -03:00
parent 12a7a2cdf9
commit 45118cb930
2 changed files with 11 additions and 4 deletions

View File

@ -40,10 +40,21 @@ abstract contract FleekAccessControl is AccessControl {
_; _;
} }
function isTokenController(
uint256 tokenId,
address account
) public view returns (bool) {
return hasRole(_tokenRole(tokenId, "CONTROLLER"), account);
}
function _tokenRole( function _tokenRole(
uint256 tokenId, uint256 tokenId,
string memory role string memory role
) internal pure returns (bytes32) { ) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("TOKEN_", role, tokenId)); return keccak256(abi.encodePacked("TOKEN_", role, tokenId));
} }
function _clearTokenControllers(uint256 tokenId) internal {
// TODO: Remove token controllers from AccessControl
}
} }

View File

@ -231,8 +231,4 @@ contract FleekERC721 is ERC721, FleekAccessControl {
delete _apps[tokenId]; delete _apps[tokenId];
} }
} }
function _clearTokenControllers(uint256 tokenId) internal {
// TODO: Remove token controllers from AccessControl
}
} }