/
DataTypes.sol
261 lines (228 loc) · 6.23 KB
/
DataTypes.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
// SPDX-License-Identifier: MIT
// solhint-disable contract-name-camelcase
pragma solidity 0.8.18;
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
/**
* @title DataTypes
* @notice A standard library of data types.
*/
library DataTypes {
struct MigrateData {
address account;
string handle;
string uri;
address[] toAddresses;
bytes32 linkType;
}
struct CreateCharacterData {
address to;
string handle;
string uri;
address linkModule;
bytes linkModuleInitData;
}
struct createThenLinkCharacterData {
uint256 fromCharacterId;
address to;
bytes32 linkType;
}
struct linkNoteData {
uint256 fromCharacterId;
uint256 toCharacterId;
uint256 toNoteId;
bytes32 linkType;
bytes data;
}
struct unlinkNoteData {
uint256 fromCharacterId;
uint256 toCharacterId;
uint256 toNoteId;
bytes32 linkType;
}
struct linkCharacterData {
uint256 fromCharacterId;
uint256 toCharacterId;
bytes32 linkType;
bytes data;
}
struct unlinkCharacterData {
uint256 fromCharacterId;
uint256 toCharacterId;
bytes32 linkType;
}
struct linkERC721Data {
uint256 fromCharacterId;
address tokenAddress;
uint256 tokenId;
bytes32 linkType;
bytes data;
}
struct unlinkERC721Data {
uint256 fromCharacterId;
address tokenAddress;
uint256 tokenId;
bytes32 linkType;
}
struct linkAddressData {
uint256 fromCharacterId;
address ethAddress;
bytes32 linkType;
bytes data;
}
struct unlinkAddressData {
uint256 fromCharacterId;
address ethAddress;
bytes32 linkType;
}
struct linkAnyUriData {
uint256 fromCharacterId;
string toUri;
bytes32 linkType;
bytes data;
}
struct unlinkAnyUriData {
uint256 fromCharacterId;
string toUri;
bytes32 linkType;
}
struct linkLinklistData {
uint256 fromCharacterId;
uint256 toLinkListId;
bytes32 linkType;
bytes data;
}
struct unlinkLinklistData {
uint256 fromCharacterId;
uint256 toLinkListId;
bytes32 linkType;
}
struct setLinkModule4CharacterData {
uint256 characterId;
address linkModule;
bytes linkModuleInitData;
}
struct setLinkModule4NoteData {
uint256 characterId;
uint256 noteId;
address linkModule;
bytes linkModuleInitData;
}
struct setLinkModule4LinklistData {
uint256 linklistId;
address linkModule;
bytes linkModuleInitData;
}
struct setLinkModule4ERC721Data {
address tokenAddress;
uint256 tokenId;
address linkModule;
bytes linkModuleInitData;
}
struct setLinkModule4AddressData {
address account;
address linkModule;
bytes linkModuleInitData;
}
struct setMintModule4NoteData {
uint256 characterId;
uint256 noteId;
address mintModule;
bytes mintModuleInitData;
}
struct linkCharactersInBatchData {
uint256 fromCharacterId;
uint256[] toCharacterIds;
bytes[] data;
address[] toAddresses;
bytes32 linkType;
}
struct LinkData {
uint256 linklistId;
uint256 linkItemType;
uint256 linkingCharacterId;
address linkingAddress;
uint256 linkingLinklistId;
bytes32 linkKey;
}
struct PostNoteData {
uint256 characterId;
string contentUri;
address linkModule;
bytes linkModuleInitData;
address mintModule;
bytes mintModuleInitData;
bool locked;
}
struct MintNoteData {
uint256 characterId;
uint256 noteId;
address to;
bytes mintModuleData;
}
// character struct
struct Character {
uint256 characterId;
string handle;
string uri;
uint256 noteCount;
address socialToken;
address linkModule;
}
/**
* @dev A struct containing data associated with each new note.
* @param linkItemType The link type of this note, if the note is a note with link.
* @param linkKey If linkKey is not empty, it is a note with link(eg.a comment to a character or a note).
* @param contentURI The URI associated with this note.
* @param linkModule The address of the current link module of this note, can be empty.
* @param mintModule The address of the current mint module of this note, can be empty.
* @param mintNFT The address of the mintNFT associated with this note, if any.
* @param deleted Whether the note is deleted.
* @param locked Whether the note is locked. If the note is locked, its owner can't set not uri anymore.
*/
struct Note {
bytes32 linkItemType;
bytes32 linkKey;
string contentUri;
address linkModule;
address mintModule;
address mintNFT;
bool deleted;
bool locked;
}
struct CharacterLinkStruct {
uint256 fromCharacterId;
uint256 toCharacterId;
bytes32 linkType;
}
struct NoteStruct {
uint256 characterId;
uint256 noteId;
}
struct ERC721Struct {
address tokenAddress;
uint256 erc721TokenId;
}
/**
@param blocklist The list of blocklist addresses.
@param allowlist The list of allowlist addresses.
*/
struct Operators4Note {
EnumerableSet.AddressSet blocklist;
EnumerableSet.AddressSet allowlist;
}
/**
* @dev A struct containing the necessary information to reconstruct an EIP-712 typed data signature.
* @param signer The address of the signer.
* @param v The signature's recovery parameter.
* @param r The signature's r parameter.
* @param s The signature's s parameter
* @param deadline The signature's deadline.
*/
struct EIP712Signature {
address signer;
uint8 v;
bytes32 r;
bytes32 s;
uint256 deadline;
}
}