-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathERC6909NFT.sol
More file actions
52 lines (37 loc) · 1.43 KB
/
ERC6909NFT.sol
File metadata and controls
52 lines (37 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.28;
import {ERC6909} from "src/misc/ERC6909.sol";
import {StringLib} from "src/misc/libraries/StringLib.sol";
import {Auth} from "src/misc/Auth.sol";
import {IERC6909NFT, IERC6909URIExt} from "src/misc/interfaces/IERC6909.sol";
contract ERC6909NFT is ERC6909, Auth, IERC6909NFT {
using StringLib for string;
uint8 constant MAX_SUPPLY = 1;
uint256 public latestTokenId;
/// @inheritdoc IERC6909URIExt
string public contractURI;
/// @inheritdoc IERC6909URIExt
mapping(uint256 tokenId => string URI) public tokenURI;
constructor(address deployer) Auth(deployer) {}
/// @inheritdoc IERC6909NFT
function setTokenURI(uint256 tokenId, string memory URI) public auth {
tokenURI[tokenId] = URI;
emit TokenURISet(tokenId, URI);
}
/// @inheritdoc IERC6909NFT
function mint(address owner, string memory tokenURI_) public auth returns (uint256 tokenId) {
require(!tokenURI_.isEmpty(), EmptyURI());
tokenId = ++latestTokenId;
_mint(owner, tokenId, MAX_SUPPLY);
setTokenURI(tokenId, tokenURI_);
}
/// @inheritdoc IERC6909NFT
function burn(uint256 tokenId) external {
_burn(msg.sender, tokenId, 1);
}
// @inheritdoc IERC6909NFT
function setContractURI(string calldata URI) external auth {
contractURI = URI;
emit ContractURISet(address(this), URI);
}
}