-
Notifications
You must be signed in to change notification settings - Fork 1
/
GenesisBase.sol
108 lines (88 loc) · 3.98 KB
/
GenesisBase.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.24;
// ** ** ** ** **** **
// /** /** /** // /**/ /**
// /** /** /** ** ****** ****** ****** ******
// /** /** /****** /** **//// **////**///**/ ///**/
// /** /** /**///** /**//***** /** /** /** /**
// /** /** /** /** /** /////**/** /** /** /**
// //******* /****** /** ****** //****** /** //**
// /////// ///// // ////// ////// // //
import {AccessControl} from "openzeppelinV4/access/AccessControl.sol";
import {IAccessControl} from "openzeppelinV4/access/IAccessControl.sol";
import {Ownable} from "openzeppelinV4/access/Ownable.sol";
import {IERC721} from "openzeppelinV4/token/ERC721/IERC721.sol";
import {IERC721Metadata} from "openzeppelinV4/token/ERC721/extensions/IERC721Metadata.sol";
import {ERC2981} from "openzeppelinV4/token/common/ERC2981.sol";
import {EIP712} from "openzeppelinV4/utils/cryptography/EIP712.sol";
import {ERC721Psi} from "src/ERC721Psi/ERC721Psi.sol";
import {ERC721PsiAddressData} from "src/ERC721Psi/extension/ERC721PsiAddressData.sol";
import {IGenesisBase} from "src/interfaces/IGenesisBase.sol";
import {Errors} from "src/librairies/Errors.sol";
import {MintData} from "src/types/MintData.sol";
/**
* @title GenesisBase
*
* @dev GenesisBase implements ERC721Psi as a base for GenesisPFP
*/
abstract contract GenesisBase is IGenesisBase, ERC721PsiAddressData, ERC2981, EIP712, Ownable, AccessControl {
// =============================================================
// EVENTS
// =============================================================
/// @notice UpdateDefaultRoyalty is emitted when calling `updateDefaultRoyalty`
event UpdateDefaultRoyalty(address receiver, uint96 feeNumerator);
// =============================================================
// VARIABLES
// =============================================================
/// @notice baseURI for computing tokenURI
string public baseURI;
// =============================================================
// MAPPINGS
// =============================================================
/// @notice Mapping for an address to a bool
/// @notice Tracks if a user minted its tokens
mapping(bytes32 => bool) public minted;
// =============================================================
// EXTERNAL
// =============================================================
/**
* @inheritdoc IGenesisBase
*/
function setBaseURI(string calldata _uri) external override onlyOwner {
if (bytes(baseURI).length > 0) revert Errors.BaseURIAlreadyInitialized();
baseURI = _uri;
}
/**
* @inheritdoc IGenesisBase
*/
function updateDefaultRoyalty(address receiver, uint96 feeNumerator) external onlyOwner {
_setDefaultRoyalty(receiver, feeNumerator);
emit UpdateDefaultRoyalty(receiver, feeNumerator);
}
// =============================================================
// PUBLIC
// =============================================================
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override (ERC721Psi, ERC2981, AccessControl)
returns (bool)
{
return super.supportsInterface(interfaceId);
}
// =============================================================
// INTERNAL
// =============================================================
/**
* @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
* token will be the concatenation of the `baseURI` and the `tokenId`. Empty
* by default, can be overriden in child contracts.
*/
function _baseURI() internal view override returns (string memory) {
return baseURI;
}
}