Last active
October 2, 2022 12:44
-
-
Save cygaar/6d908d1eb12727d94583ad20b84a06eb to your computer and use it in GitHub Desktop.
721Royalty.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
import "@openzeppellin/contracts/token/ERC721/ERC721.sol"; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
contract ERC721RestrictedMarkets is Ownable, ERC721 { | |
mapping(address => bool) private _approvedMarketplaces; | |
function approve(address to, uint256 tokenId) public virtual override { | |
require(_approvedMarketplaces[to], "Invalid Marketplace"); | |
super.approve(to, tokenId); | |
} | |
function setApprovalForAll(address operator, bool approved) public virtual override { | |
require(_approvedMarketplaces[operator], "Invalid Marketplace"); | |
super.setApprovalForAll(operator, approved); | |
} | |
function setApprovedMarketplace(address market, bool approved) public onlyOwner { | |
_approvedMarketplaces[market] = approved; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do we get marketplace address?