Skip to content

Instantly share code, notes, and snippets.

@korrio
Created May 26, 2022 05:01
Show Gist options
  • Save korrio/43e2f2a2b80596d48ffd49a0bd4e11c3 to your computer and use it in GitHub Desktop.
Save korrio/43e2f2a2b80596d48ffd49a0bd4e11c3 to your computer and use it in GitHub Desktop.
ACL.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract MyToken is ERC721, Ownable {
mapping(address => bool) public minters;
modifier onlyMinter() {
require(minters[msg.sender], "Ownable: caller is not the minter");
}
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("MyToken", "MTK") {}
function setMinter(address newMinter) public onlyOwner {
minters[newMinter] = true;
}
function unsetMinter(address newMinter) public onlyOwner {
minters[newMinter] = false;
}
function safeMint(address to) public onlyMinter {
uint256 tokenId = _tokenIdCounter.current();
_tokenIdCounter.increment();
_safeMint(to, tokenId);
}
}
@DoctorNasa
Copy link

Yes

@korrio
Copy link
Author

korrio commented Oct 11, 2022 via email

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