Skip to content

Commit

Permalink
feat: isUserOwned acl
Browse files Browse the repository at this point in the history
  • Loading branch information
CanvasL committed Jul 30, 2024
1 parent 0b775aa commit 0abc19f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/AccessToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,27 @@ contract AccessToken is ERC721 {
PRODUCT = product;
}

modifier onlyTokenOwner(uint256 tokenId) {
modifier onlyProductOwner(uint256 tokenId) {
require(msg.sender == PRODUCT.ownerOf(tokenId), "not product owner");
_;
}

function mint(
address user,
uint256 tokenId
) external onlyTokenOwner(tokenId) {
) external onlyProductOwner(tokenId) {
_mint(user, tokenId);
}

function burn(uint256 tokenId) external onlyTokenOwner(tokenId) {
function burn(uint256 tokenId) external onlyProductOwner(tokenId) {
_burn(tokenId);
}

function isExist(uint256 tokenId) external view returns (bool) {
return _ownerOf(tokenId) != address(0);
}

function isUserOwned(address user, uint256 tokenId) external view returns (bool) {
return _ownerOf(tokenId) == user;
}
}

0 comments on commit 0abc19f

Please sign in to comment.