-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGatedKnowledgeManager.sol
69 lines (58 loc) · 1.9 KB
/
GatedKnowledgeManager.sol
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
// Uncomment this line to use console.log() for debugging
// import "hardhat/console.sol";
import {ERC4908} from "./erc4908/ERC4908.sol";
import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import {ERC721URIStorage} from "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
contract GatedKnowledgeManager is ERC4908, ERC721URIStorage {
string public _tokenURI;
constructor(
string memory uri
) ERC4908("Ipal Gated Knowledge Manager", "IGI") {
_tokenURI = uri;
}
function mint(
address author,
string calldata resourceId,
address to
) public payable override(ERC4908) {
super.mint(author, resourceId, to);
uint256 tokenId = totalSupply() - 1;
_setTokenURI(
tokenId,
_tokenURI
/*
* @dev to replace _tokenURI later
*/
// string.concat(_tokenURI, Strings.toString(tokenId))
);
}
/*
* overrides required for ERC721URIStorage extension
*/
function _update(
address to,
uint256 tokenId,
address auth
) internal override(ERC4908, ERC721) returns (address) {
return super._update(to, tokenId, auth);
}
function _increaseBalance(
address account,
uint128 value
) internal override(ERC4908, ERC721) {
super._increaseBalance(account, value);
}
function tokenURI(
uint256 tokenId
) public view override(ERC721, ERC721URIStorage) returns (string memory) {
return super.tokenURI(tokenId);
}
function supportsInterface(
bytes4 interfaceId
) public view override(ERC4908, ERC721URIStorage) returns (bool) {
return super.supportsInterface(interfaceId);
}
}