lens-modules 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/contracts/base/HubRestricted.sol +27 -0
- package/contracts/interfaces/ICollectNFT.sol +40 -0
- package/contracts/interfaces/IERC721Burnable.sol +19 -0
- package/contracts/interfaces/IERC721MetaTx.sol +27 -0
- package/contracts/interfaces/IERC721Timestamped.sol +50 -0
- package/contracts/interfaces/IFollowModule.sol +55 -0
- package/contracts/interfaces/ILensERC721.sol +11 -0
- package/contracts/interfaces/ILensGovernable.sol +141 -0
- package/contracts/interfaces/ILensHub.sol +19 -0
- package/contracts/interfaces/ILensHubEventHooks.sol +26 -0
- package/contracts/interfaces/ILensImplGetters.sol +34 -0
- package/contracts/interfaces/ILensProfiles.sol +32 -0
- package/contracts/interfaces/ILensProtocol.sol +474 -0
- package/contracts/interfaces/ILensVersion.sol +31 -0
- package/contracts/interfaces/IModuleRegistry.sol +32 -0
- package/contracts/interfaces/IPublicationActionModule.sol +53 -0
- package/contracts/libraries/constants/Errors.sol +52 -0
- package/contracts/libraries/constants/Events.sol +409 -0
- package/contracts/libraries/constants/Typehash.sol +32 -0
- package/contracts/libraries/constants/Types.sol +415 -0
- package/contracts/modules/ActionRestricted.sol +27 -0
- package/contracts/modules/FeeModuleBase.sol +43 -0
- package/contracts/modules/LensModule.sol +11 -0
- package/contracts/modules/LensModuleMetadata.sol +17 -0
- package/contracts/modules/LensModuleMetadataInitializable.sol +16 -0
- package/contracts/modules/act/collect/base/BaseFeeCollectModule.sol +298 -0
- package/contracts/modules/constants/Errors.sol +16 -0
- package/contracts/modules/interfaces/IBaseFeeCollectModule.sol +75 -0
- package/contracts/modules/interfaces/ICollectModule.sol +50 -0
- package/contracts/modules/interfaces/ILensModule.sol +18 -0
- package/contracts/modules/interfaces/IWMATIC.sol +11 -0
- package/contracts/modules/libraries/FollowValidationLib.sol +32 -0
- package/contracts/modules/libraries/constants/ModuleTypes.sol +25 -0
- package/package.json +30 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title Types
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice A standard library of data types used throughout the Lens Protocol.
|
|
10
|
+
*/
|
|
11
|
+
library Types {
|
|
12
|
+
/**
|
|
13
|
+
* @notice ERC721Timestamped storage. Contains the owner address and the mint timestamp for every NFT.
|
|
14
|
+
*
|
|
15
|
+
* Note: Instead of the owner address in the _tokenOwners private mapping, we now store it in the
|
|
16
|
+
* _tokenData mapping, alongside the mint timestamp.
|
|
17
|
+
*
|
|
18
|
+
* @param owner The token owner.
|
|
19
|
+
* @param mintTimestamp The mint timestamp.
|
|
20
|
+
*/
|
|
21
|
+
struct TokenData {
|
|
22
|
+
address owner;
|
|
23
|
+
uint96 mintTimestamp;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @notice A struct containing token follow-related data.
|
|
28
|
+
*
|
|
29
|
+
* @param followerProfileId The ID of the profile using the token to follow.
|
|
30
|
+
* @param originalFollowTimestamp The timestamp of the first follow performed with the token.
|
|
31
|
+
* @param followTimestamp The timestamp of the current follow, if a profile is using the token to follow.
|
|
32
|
+
* @param profileIdAllowedToRecover The ID of the profile allowed to recover the follow ID, if any.
|
|
33
|
+
*/
|
|
34
|
+
struct FollowData {
|
|
35
|
+
uint160 followerProfileId;
|
|
36
|
+
uint48 originalFollowTimestamp;
|
|
37
|
+
uint48 followTimestamp;
|
|
38
|
+
uint256 profileIdAllowedToRecover;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @notice An enum containing the different states the protocol can be in, limiting certain actions.
|
|
43
|
+
*
|
|
44
|
+
* @param Unpaused The fully unpaused state.
|
|
45
|
+
* @param PublishingPaused The state where only publication creation functions are paused.
|
|
46
|
+
* @param Paused The fully paused state.
|
|
47
|
+
*/
|
|
48
|
+
enum ProtocolState {
|
|
49
|
+
Unpaused,
|
|
50
|
+
PublishingPaused,
|
|
51
|
+
Paused
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @notice An enum specifically used in a helper function to easily retrieve the publication type for integrations.
|
|
56
|
+
*
|
|
57
|
+
* @param Nonexistent An indicator showing the queried publication does not exist.
|
|
58
|
+
* @param Post A standard post, having an URI, action modules and no pointer to another publication.
|
|
59
|
+
* @param Comment A comment, having an URI, action modules and a pointer to another publication.
|
|
60
|
+
* @param Mirror A mirror, having a pointer to another publication, but no URI or action modules.
|
|
61
|
+
* @param Quote A quote, having an URI, action modules, and a pointer to another publication.
|
|
62
|
+
*/
|
|
63
|
+
enum PublicationType {
|
|
64
|
+
Nonexistent,
|
|
65
|
+
Post,
|
|
66
|
+
Comment,
|
|
67
|
+
Mirror,
|
|
68
|
+
Quote
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @notice A struct containing the necessary information to reconstruct an EIP-712 typed data signature.
|
|
73
|
+
*
|
|
74
|
+
* @param signer The address of the signer. Specially needed as a parameter to support EIP-1271.
|
|
75
|
+
* @param v The signature's recovery parameter.
|
|
76
|
+
* @param r The signature's r parameter.
|
|
77
|
+
* @param s The signature's s parameter.
|
|
78
|
+
* @param deadline The signature's deadline.
|
|
79
|
+
*/
|
|
80
|
+
struct EIP712Signature {
|
|
81
|
+
address signer;
|
|
82
|
+
uint8 v;
|
|
83
|
+
bytes32 r;
|
|
84
|
+
bytes32 s;
|
|
85
|
+
uint256 deadline;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @notice A struct containing profile data.
|
|
90
|
+
*
|
|
91
|
+
* @param pubCount The number of publications made to this profile.
|
|
92
|
+
* @param followModule The address of the current follow module in use by this profile, can be address(0) in none.
|
|
93
|
+
* @param followNFT The address of the followNFT associated with this profile. It can be address(0) if the
|
|
94
|
+
* profile has not been followed yet, as the collection is lazy-deployed upon the first follow.
|
|
95
|
+
* @param __DEPRECATED__handle DEPRECATED in V2: handle slot, was replaced with LensHandles.
|
|
96
|
+
* @param __DEPRECATED__imageURI DEPRECATED in V2: The URI to be used for the profile image.
|
|
97
|
+
* @param __DEPRECATED__followNFTURI DEPRECATED in V2: The URI used for the follow NFT image.
|
|
98
|
+
* @param metadataURI MetadataURI is used to store the profile's metadata, for example: displayed name, description,
|
|
99
|
+
* interests, etc.
|
|
100
|
+
*/
|
|
101
|
+
struct Profile {
|
|
102
|
+
uint256 pubCount; // offset 0
|
|
103
|
+
address followModule; // offset 1
|
|
104
|
+
address followNFT; // offset 2
|
|
105
|
+
string __DEPRECATED__handle; // offset 3
|
|
106
|
+
string __DEPRECATED__imageURI; // offset 4
|
|
107
|
+
string __DEPRECATED__followNFTURI; // Deprecated in V2 as we have a common tokenURI for all Follows, offset 5
|
|
108
|
+
string metadataURI; // offset 6
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @notice A struct containing publication data.
|
|
113
|
+
*
|
|
114
|
+
* @param pointedProfileId The profile token ID to point the publication to.
|
|
115
|
+
* @param pointedPubId The publication ID to point the publication to.
|
|
116
|
+
* These are used to implement the "reference" feature of the platform and is used in:
|
|
117
|
+
* - Mirrors
|
|
118
|
+
* - Comments
|
|
119
|
+
* - Quotes
|
|
120
|
+
* There are (0,0) if the publication is not pointing to any other publication (i.e. the publication is a Post).
|
|
121
|
+
* @param contentURI The URI to set for the content of publication (can be ipfs, arweave, http, etc).
|
|
122
|
+
* @param referenceModule Reference module associated with this profile, if any.
|
|
123
|
+
* @param __DEPRECATED__collectModule Collect module associated with this publication, if any. Deprecated in V2.
|
|
124
|
+
* @param __DEPRECATED__collectNFT Collect NFT associated with this publication, if any. Deprecated in V2.
|
|
125
|
+
* @param pubType The type of publication, can be Nonexistent, Post, Comment, Mirror or Quote.
|
|
126
|
+
* @param rootProfileId The profile ID of the root post (to determine if comments/quotes and mirrors come from it).
|
|
127
|
+
* Posts, V1 publications and publications rooted in V1 publications don't have it set.
|
|
128
|
+
* @param rootPubId The publication ID of the root post (to determine if comments/quotes and mirrors come from it).
|
|
129
|
+
* Posts, V1 publications and publications rooted in V1 publications don't have it set.
|
|
130
|
+
* @param actionModuleEnabled The action modules enabled in a given publication.
|
|
131
|
+
*/
|
|
132
|
+
struct Publication {
|
|
133
|
+
uint256 pointedProfileId;
|
|
134
|
+
uint256 pointedPubId;
|
|
135
|
+
string contentURI;
|
|
136
|
+
address referenceModule;
|
|
137
|
+
address __DEPRECATED__collectModule; // Deprecated in V2
|
|
138
|
+
address __DEPRECATED__collectNFT; // Deprecated in V2
|
|
139
|
+
// Added in Lens V2, so these will be zero for old publications:
|
|
140
|
+
PublicationType pubType;
|
|
141
|
+
uint256 rootProfileId;
|
|
142
|
+
uint256 rootPubId;
|
|
143
|
+
mapping(address => bool) actionModuleEnabled;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
struct PublicationMemory {
|
|
147
|
+
uint256 pointedProfileId;
|
|
148
|
+
uint256 pointedPubId;
|
|
149
|
+
string contentURI;
|
|
150
|
+
address referenceModule;
|
|
151
|
+
address __DEPRECATED__collectModule; // Deprecated in V2
|
|
152
|
+
address __DEPRECATED__collectNFT; // Deprecated in V2
|
|
153
|
+
// Added in Lens V2, so these will be zero for old publications:
|
|
154
|
+
PublicationType pubType;
|
|
155
|
+
uint256 rootProfileId;
|
|
156
|
+
uint256 rootPubId;
|
|
157
|
+
// bytes32 __ACTION_MODULE_ENABLED_MAPPING; // Mappings are not supported in memory.
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @notice A struct containing the parameters required for the `createProfile()` function.
|
|
162
|
+
*
|
|
163
|
+
* @param to The address receiving the profile.
|
|
164
|
+
* @param followModule The follow module to use, can be the zero address.
|
|
165
|
+
* @param followModuleInitData The follow module initialization data, if any.
|
|
166
|
+
*/
|
|
167
|
+
struct CreateProfileParams {
|
|
168
|
+
address to;
|
|
169
|
+
address followModule;
|
|
170
|
+
bytes followModuleInitData;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @notice A struct containing the parameters required for the `post()` function.
|
|
175
|
+
*
|
|
176
|
+
* @param profileId The token ID of the profile to publish to.
|
|
177
|
+
* @param contentURI The URI to set for this new publication.
|
|
178
|
+
* @param actionModules The action modules to set for this new publication.
|
|
179
|
+
* @param actionModulesInitDatas The data to pass to the action modules' initialization.
|
|
180
|
+
* @param referenceModule The reference module to set for the given publication, must be whitelisted.
|
|
181
|
+
* @param referenceModuleInitData The data to be passed to the reference module for initialization.
|
|
182
|
+
*/
|
|
183
|
+
struct PostParams {
|
|
184
|
+
uint256 profileId;
|
|
185
|
+
string contentURI;
|
|
186
|
+
address[] actionModules;
|
|
187
|
+
bytes[] actionModulesInitDatas;
|
|
188
|
+
address referenceModule;
|
|
189
|
+
bytes referenceModuleInitData;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @notice A struct containing the parameters required for the `comment()` function.
|
|
194
|
+
*
|
|
195
|
+
* @param profileId The token ID of the profile to publish to.
|
|
196
|
+
* @param contentURI The URI to set for this new publication.
|
|
197
|
+
* @param pointedProfileId The profile token ID to point the comment to.
|
|
198
|
+
* @param pointedPubId The publication ID to point the comment to.
|
|
199
|
+
* @param referrerProfileId The profile token ID of the publication that referred to the publication being commented on/quoted.
|
|
200
|
+
* @param referrerPubId The ID of the publication that referred to the publication being commented on/quoted.
|
|
201
|
+
* @param referenceModuleData The data passed to the reference module.
|
|
202
|
+
* @param actionModules The action modules to set for this new publication.
|
|
203
|
+
* @param actionModulesInitDatas The data to pass to the action modules' initialization.
|
|
204
|
+
* @param referenceModule The reference module to set for the given publication, must be whitelisted.
|
|
205
|
+
* @param referenceModuleInitData The data to be passed to the reference module for initialization.
|
|
206
|
+
*/
|
|
207
|
+
struct CommentParams {
|
|
208
|
+
uint256 profileId;
|
|
209
|
+
string contentURI;
|
|
210
|
+
uint256 pointedProfileId;
|
|
211
|
+
uint256 pointedPubId;
|
|
212
|
+
uint256[] referrerProfileIds;
|
|
213
|
+
uint256[] referrerPubIds;
|
|
214
|
+
bytes referenceModuleData;
|
|
215
|
+
address[] actionModules;
|
|
216
|
+
bytes[] actionModulesInitDatas;
|
|
217
|
+
address referenceModule;
|
|
218
|
+
bytes referenceModuleInitData;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @notice A struct containing the parameters required for the `quote()` function.
|
|
223
|
+
*
|
|
224
|
+
* @param profileId The token ID of the profile to publish to.
|
|
225
|
+
* @param contentURI The URI to set for this new publication.
|
|
226
|
+
* @param pointedProfileId The profile token ID of the publication author that is quoted.
|
|
227
|
+
* @param pointedPubId The publication ID that is quoted.
|
|
228
|
+
* @param referrerProfileId The profile token ID of the publication that referred to the publication being commented on/quoted.
|
|
229
|
+
* @param referrerPubId The ID of the publication that referred to the publication being commented on/quoted.
|
|
230
|
+
* @param referenceModuleData The data passed to the reference module.
|
|
231
|
+
* @param actionModules The action modules to set for this new publication.
|
|
232
|
+
* @param actionModulesInitDatas The data to pass to the action modules' initialization.
|
|
233
|
+
* @param referenceModule The reference module to set for the given publication, must be whitelisted.
|
|
234
|
+
* @param referenceModuleInitData The data to be passed to the reference module for initialization.
|
|
235
|
+
*/
|
|
236
|
+
struct QuoteParams {
|
|
237
|
+
uint256 profileId;
|
|
238
|
+
string contentURI;
|
|
239
|
+
uint256 pointedProfileId;
|
|
240
|
+
uint256 pointedPubId;
|
|
241
|
+
uint256[] referrerProfileIds;
|
|
242
|
+
uint256[] referrerPubIds;
|
|
243
|
+
bytes referenceModuleData;
|
|
244
|
+
address[] actionModules;
|
|
245
|
+
bytes[] actionModulesInitDatas;
|
|
246
|
+
address referenceModule;
|
|
247
|
+
bytes referenceModuleInitData;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @notice A struct containing the parameters required for the `comment()` or `quote()` internal functions.
|
|
252
|
+
*
|
|
253
|
+
* @param profileId The token ID of the profile to publish to.
|
|
254
|
+
* @param contentURI The URI to set for this new publication.
|
|
255
|
+
* @param pointedProfileId The profile token ID of the publication author that is commented on/quoted.
|
|
256
|
+
* @param pointedPubId The publication ID that is commented on/quoted.
|
|
257
|
+
* @param referrerProfileId The profile token ID of the publication that referred to the publication being commented on/quoted.
|
|
258
|
+
* @param referrerPubId The ID of the publication that referred to the publication being commented on/quoted.
|
|
259
|
+
* @param referenceModuleData The data passed to the reference module.
|
|
260
|
+
* @param actionModules The action modules to set for this new publication.
|
|
261
|
+
* @param actionModulesInitDatas The data to pass to the action modules' initialization.
|
|
262
|
+
* @param referenceModule The reference module to set for the given publication, must be whitelisted.
|
|
263
|
+
* @param referenceModuleInitData The data to be passed to the reference module for initialization.
|
|
264
|
+
*/
|
|
265
|
+
struct ReferencePubParams {
|
|
266
|
+
uint256 profileId;
|
|
267
|
+
string contentURI;
|
|
268
|
+
uint256 pointedProfileId;
|
|
269
|
+
uint256 pointedPubId;
|
|
270
|
+
uint256[] referrerProfileIds;
|
|
271
|
+
uint256[] referrerPubIds;
|
|
272
|
+
bytes referenceModuleData;
|
|
273
|
+
address[] actionModules;
|
|
274
|
+
bytes[] actionModulesInitDatas;
|
|
275
|
+
address referenceModule;
|
|
276
|
+
bytes referenceModuleInitData;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @notice A struct containing the parameters required for the `mirror()` function.
|
|
281
|
+
*
|
|
282
|
+
* @param profileId The token ID of the profile to publish to.
|
|
283
|
+
* @param metadataURI the URI containing metadata attributes to attach to this mirror publication.
|
|
284
|
+
* @param pointedProfileId The profile token ID to point the mirror to.
|
|
285
|
+
* @param pointedPubId The publication ID to point the mirror to.
|
|
286
|
+
* @param referenceModuleData The data passed to the reference module.
|
|
287
|
+
*/
|
|
288
|
+
struct MirrorParams {
|
|
289
|
+
uint256 profileId;
|
|
290
|
+
string metadataURI;
|
|
291
|
+
uint256 pointedProfileId;
|
|
292
|
+
uint256 pointedPubId;
|
|
293
|
+
uint256[] referrerProfileIds;
|
|
294
|
+
uint256[] referrerPubIds;
|
|
295
|
+
bytes referenceModuleData;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Deprecated in V2: Will be removed after some time after upgrading to V2.
|
|
300
|
+
* @notice A struct containing the parameters required for the legacy `collect()` function.
|
|
301
|
+
* @dev The referrer can only be a mirror of the publication being collected.
|
|
302
|
+
*
|
|
303
|
+
* @param publicationCollectedProfileId The token ID of the profile that published the publication to collect.
|
|
304
|
+
* @param publicationCollectedId The publication to collect's publication ID.
|
|
305
|
+
* @param collectorProfileId The collector profile.
|
|
306
|
+
* @param referrerProfileId The ID of a profile that authored a mirror that helped discovering the collected pub.
|
|
307
|
+
* @param referrerPubId The ID of the mirror that helped discovering the collected pub.
|
|
308
|
+
* @param collectModuleData The arbitrary data to pass to the collectModule if needed.
|
|
309
|
+
*/
|
|
310
|
+
struct LegacyCollectParams {
|
|
311
|
+
uint256 publicationCollectedProfileId;
|
|
312
|
+
uint256 publicationCollectedId;
|
|
313
|
+
uint256 collectorProfileId;
|
|
314
|
+
uint256 referrerProfileId;
|
|
315
|
+
uint256 referrerPubId;
|
|
316
|
+
bytes collectModuleData;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @notice A struct containing the parameters required for the `action()` function.
|
|
321
|
+
*
|
|
322
|
+
* @param publicationActedProfileId The token ID of the profile that published the publication to action.
|
|
323
|
+
* @param publicationActedId The publication to action's publication ID.
|
|
324
|
+
* @param actorProfileId The actor profile.
|
|
325
|
+
* @param referrerProfileId
|
|
326
|
+
* @param referrerPubId
|
|
327
|
+
* @param actionModuleAddress
|
|
328
|
+
* @param actionModuleData The arbitrary data to pass to the actionModule if needed.
|
|
329
|
+
*/
|
|
330
|
+
struct PublicationActionParams {
|
|
331
|
+
uint256 publicationActedProfileId;
|
|
332
|
+
uint256 publicationActedId;
|
|
333
|
+
uint256 actorProfileId;
|
|
334
|
+
uint256[] referrerProfileIds;
|
|
335
|
+
uint256[] referrerPubIds;
|
|
336
|
+
address actionModuleAddress;
|
|
337
|
+
bytes actionModuleData;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
struct ProcessActionParams {
|
|
341
|
+
uint256 publicationActedProfileId;
|
|
342
|
+
uint256 publicationActedId;
|
|
343
|
+
uint256 actorProfileId;
|
|
344
|
+
address actorProfileOwner;
|
|
345
|
+
address transactionExecutor;
|
|
346
|
+
uint256[] referrerProfileIds;
|
|
347
|
+
uint256[] referrerPubIds;
|
|
348
|
+
Types.PublicationType[] referrerPubTypes;
|
|
349
|
+
bytes actionModuleData;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
struct ProcessCommentParams {
|
|
353
|
+
uint256 profileId;
|
|
354
|
+
uint256 pubId;
|
|
355
|
+
address transactionExecutor;
|
|
356
|
+
uint256 pointedProfileId;
|
|
357
|
+
uint256 pointedPubId;
|
|
358
|
+
uint256[] referrerProfileIds;
|
|
359
|
+
uint256[] referrerPubIds;
|
|
360
|
+
Types.PublicationType[] referrerPubTypes;
|
|
361
|
+
bytes data;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
struct ProcessQuoteParams {
|
|
365
|
+
uint256 profileId;
|
|
366
|
+
uint256 pubId;
|
|
367
|
+
address transactionExecutor;
|
|
368
|
+
uint256 pointedProfileId;
|
|
369
|
+
uint256 pointedPubId;
|
|
370
|
+
uint256[] referrerProfileIds;
|
|
371
|
+
uint256[] referrerPubIds;
|
|
372
|
+
Types.PublicationType[] referrerPubTypes;
|
|
373
|
+
bytes data;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
struct ProcessMirrorParams {
|
|
377
|
+
uint256 profileId;
|
|
378
|
+
uint256 pubId;
|
|
379
|
+
address transactionExecutor;
|
|
380
|
+
uint256 pointedProfileId;
|
|
381
|
+
uint256 pointedPubId;
|
|
382
|
+
uint256[] referrerProfileIds;
|
|
383
|
+
uint256[] referrerPubIds;
|
|
384
|
+
Types.PublicationType[] referrerPubTypes;
|
|
385
|
+
bytes data;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @notice A struct containing a profile's delegated executors configuration.
|
|
390
|
+
*
|
|
391
|
+
* @param isApproved Tells when an address is approved as delegated executor in the given configuration number.
|
|
392
|
+
* @param configNumber Current configuration number in use.
|
|
393
|
+
* @param prevConfigNumber Previous configuration number set, before switching to the current one.
|
|
394
|
+
* @param maxConfigNumberSet Maximum configuration number ever used.
|
|
395
|
+
*/
|
|
396
|
+
struct DelegatedExecutorsConfig {
|
|
397
|
+
mapping(uint256 => mapping(address => bool)) isApproved; // isApproved[configNumber][delegatedExecutor]
|
|
398
|
+
uint64 configNumber;
|
|
399
|
+
uint64 prevConfigNumber;
|
|
400
|
+
uint64 maxConfigNumberSet;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
struct TreasuryData {
|
|
404
|
+
address treasury;
|
|
405
|
+
uint16 treasuryFeeBPS;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
struct MigrationParams {
|
|
409
|
+
address lensHandlesAddress;
|
|
410
|
+
address tokenHandleRegistryAddress;
|
|
411
|
+
address legacyFeeFollowModule;
|
|
412
|
+
address legacyProfileFollowModule;
|
|
413
|
+
address newFeeFollowModule;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.15;
|
|
4
|
+
|
|
5
|
+
import {Errors} from './constants/Errors.sol';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title ActionRestricted
|
|
9
|
+
* @author Lens Protocol
|
|
10
|
+
*
|
|
11
|
+
* @notice This abstract contract adds a public `ACTION_MODULE` immutable field, and `onlyActionModule` modifier,
|
|
12
|
+
* to inherit from contracts that have functions restricted to be only called by the Action Modules.
|
|
13
|
+
*/
|
|
14
|
+
abstract contract ActionRestricted {
|
|
15
|
+
address public immutable ACTION_MODULE;
|
|
16
|
+
|
|
17
|
+
modifier onlyActionModule() {
|
|
18
|
+
if (msg.sender != ACTION_MODULE) {
|
|
19
|
+
revert Errors.NotActionModule();
|
|
20
|
+
}
|
|
21
|
+
_;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
constructor(address actionModule) {
|
|
25
|
+
ACTION_MODULE = actionModule;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.10;
|
|
4
|
+
|
|
5
|
+
import {Errors} from './constants/Errors.sol';
|
|
6
|
+
import {ILensHub} from '../interfaces/ILensHub.sol';
|
|
7
|
+
import {IModuleRegistry} from '../interfaces/IModuleRegistry.sol';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @title FeeModuleBase
|
|
11
|
+
* @author Lens Protocol
|
|
12
|
+
*
|
|
13
|
+
* @notice This is an abstract contract to be inherited from by modules that require basic fee functionality.
|
|
14
|
+
* It contains getters for module globals parameters as well as a validation function to check expected data.
|
|
15
|
+
*/
|
|
16
|
+
abstract contract FeeModuleBase {
|
|
17
|
+
uint16 internal constant BPS_MAX = 10000;
|
|
18
|
+
|
|
19
|
+
ILensHub private immutable HUB;
|
|
20
|
+
IModuleRegistry public immutable MODULE_REGISTRY;
|
|
21
|
+
|
|
22
|
+
constructor(address hub, address moduleRegistry) {
|
|
23
|
+
HUB = ILensHub(hub);
|
|
24
|
+
MODULE_REGISTRY = IModuleRegistry(moduleRegistry);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function _verifyErc20Currency(address currency) internal {
|
|
28
|
+
if (currency != address(0)) {
|
|
29
|
+
MODULE_REGISTRY.verifyErc20Currency(currency);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function _treasuryData() internal view returns (address, uint16) {
|
|
34
|
+
return HUB.getTreasuryData();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function _validateDataIsExpected(bytes calldata data, address currency, uint256 amount) internal pure {
|
|
38
|
+
(address decodedCurrency, uint256 decodedAmount) = abi.decode(data, (address, uint256));
|
|
39
|
+
if (decodedAmount != amount || decodedCurrency != currency) {
|
|
40
|
+
revert Errors.ModuleDataMismatch();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.18;
|
|
3
|
+
|
|
4
|
+
import {ILensModule} from './interfaces/ILensModule.sol';
|
|
5
|
+
|
|
6
|
+
abstract contract LensModule is ILensModule {
|
|
7
|
+
/// @inheritdoc ILensModule
|
|
8
|
+
function supportsInterface(bytes4 interfaceID) public pure virtual override returns (bool) {
|
|
9
|
+
return interfaceID == bytes4(keccak256(abi.encodePacked('LENS_MODULE')));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.18;
|
|
3
|
+
|
|
4
|
+
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
|
5
|
+
import {LensModule} from './LensModule.sol';
|
|
6
|
+
|
|
7
|
+
abstract contract LensModuleMetadata is LensModule, Ownable {
|
|
8
|
+
string private metadataURI;
|
|
9
|
+
|
|
10
|
+
function setModuleMetadataURI(string memory _metadataURI) external onlyOwner {
|
|
11
|
+
metadataURI = _metadataURI;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function getModuleMetadataURI() external view returns (string memory) {
|
|
15
|
+
return metadataURI;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.18;
|
|
3
|
+
|
|
4
|
+
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
|
|
5
|
+
import {LensModuleMetadata} from './LensModuleMetadata.sol';
|
|
6
|
+
|
|
7
|
+
contract LensModuleMetadataInitializable is Ownable, LensModuleMetadata {
|
|
8
|
+
constructor(address owner_) Ownable(owner_) LensModuleMetadata() {}
|
|
9
|
+
|
|
10
|
+
function initialize(address moduleOwner) external virtual {
|
|
11
|
+
if (owner() != address(0) || moduleOwner == address(0)) {
|
|
12
|
+
revert();
|
|
13
|
+
}
|
|
14
|
+
_transferOwnership(moduleOwner);
|
|
15
|
+
}
|
|
16
|
+
}
|