Created
May 26, 2022 05:01
-
-
Save korrio/43e2f2a2b80596d48ffd49a0bd4e11c3 to your computer and use it in GitHub Desktop.
ACL.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.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); | |
} | |
} |
ชอบหรอ
…On Thu, May 26, 2022, 12:02 PM DoctorNasa ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Yes
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/43e2f2a2b80596d48ffd49a0bd4e11c3#gistcomment-4179476>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARXWM5SCKJE5TYFCWHFJB3VL4AVJANCNFSM5W7S7KIQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes