Pretty standart nft contract review

Hi everybody. Got a basic ERC721 contract here mostly generated using OZs contract wizard.

A few things I could use help with...

  • the withdraw function. Designed to have a 95/5 split between the artist and the contract owner. I want to avoid deploying a separate payment splitter contract for this since I feel it's a simple implementation. But is there anything wrong or dangerous about my approach here?
  • ERC2981 implementation. Unsure if this works as expected. Various nft marketplaces should be able to use this to process royalty payments
  • just in general are there any best practices I should be using? Or are there any glaring issues with this contract?

Thanks in advance!

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";

contract PiggyTest is ERC721, Ownable {
    using Counters for Counters.Counter;

    Counters.Counter private _tokenIdCounter;

    uint256 public maxSupply = 1000;
    uint256 public mintPrice = 0.00001 ether;

    address private artistAddress;

    bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;

    constructor(address _artistAddress) ERC721("PigsTest", "PIGS") {
        artistAddress = _artistAddress;

    function _baseURI() internal pure override returns (string memory) {
        return "ipfs://xxx/";

    function safeMint() public payable {
        require(_tokenIdCounter.current() + 1 <= maxSupply);
        require(msg.value >= mintPrice);

        uint256 tokenId = _tokenIdCounter.current();
        _safeMint(msg.sender, tokenId);

    function withdraw() public onlyOwner {
        (bool artistSplit, ) = payable(artistAddress).call{value: address(this).balance * 95 / 100}("");
        (bool ownerSplit, ) = payable(owner()).call{value: address(this).balance}("");

    function royaltyInfo( uint256 _salePrice) external view returns (address receiver, uint256 royaltyAmount) {
        return (artistAddress, (_salePrice * 5)/10000);

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721) returns (bool) {
        if (interfaceId == _INTERFACE_ID_ERC2981) {
            return true;
        return super.supportsInterface(interfaceId);