Skip to content

Instantly share code, notes, and snippets.

@cygaar
Last active October 2, 2022 12:44
Show Gist options
  • Save cygaar/6d908d1eb12727d94583ad20b84a06eb to your computer and use it in GitHub Desktop.
Save cygaar/6d908d1eb12727d94583ad20b84a06eb to your computer and use it in GitHub Desktop.
721Royalty.sol
// 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;
}
}
@shankar-bavan
Copy link

How do we get marketplace address?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment