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,474 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
import {Types} from '../libraries/constants/Types.sol';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title ILensProtocol
|
|
9
|
+
* @author Lens Protocol
|
|
10
|
+
*
|
|
11
|
+
* @notice This is the interface for Lens Protocol's core functions. It contains all the entry points for performing
|
|
12
|
+
* social operations.
|
|
13
|
+
*/
|
|
14
|
+
interface ILensProtocol {
|
|
15
|
+
/**
|
|
16
|
+
* @notice Creates a profile with the specified parameters, minting a Profile NFT to the given recipient.
|
|
17
|
+
* @custom:permissions Any whitelisted profile creator.
|
|
18
|
+
*
|
|
19
|
+
* @param createProfileParams A CreateProfileParams struct containing the needed params.
|
|
20
|
+
*/
|
|
21
|
+
function createProfile(Types.CreateProfileParams calldata createProfileParams) external returns (uint256);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @notice Sets the metadata URI for the given profile.
|
|
25
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
26
|
+
*
|
|
27
|
+
* @param profileId The token ID of the profile to set the metadata URI for.
|
|
28
|
+
* @param metadataURI The metadata URI to set for the given profile.
|
|
29
|
+
*/
|
|
30
|
+
function setProfileMetadataURI(uint256 profileId, string calldata metadataURI) external;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @custom:meta-tx setProfileMetadataURI.
|
|
34
|
+
*/
|
|
35
|
+
function setProfileMetadataURIWithSig(
|
|
36
|
+
uint256 profileId,
|
|
37
|
+
string calldata metadataURI,
|
|
38
|
+
Types.EIP712Signature calldata signature
|
|
39
|
+
) external;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @notice Sets the follow module for the given profile.
|
|
43
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
44
|
+
*
|
|
45
|
+
* @param profileId The token ID of the profile to set the follow module for.
|
|
46
|
+
* @param followModule The follow module to set for the given profile, must be whitelisted.
|
|
47
|
+
* @param followModuleInitData The data to be passed to the follow module for initialization.
|
|
48
|
+
*/
|
|
49
|
+
function setFollowModule(uint256 profileId, address followModule, bytes calldata followModuleInitData) external;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @custom:meta-tx setFollowModule.
|
|
53
|
+
*/
|
|
54
|
+
function setFollowModuleWithSig(
|
|
55
|
+
uint256 profileId,
|
|
56
|
+
address followModule,
|
|
57
|
+
bytes calldata followModuleInitData,
|
|
58
|
+
Types.EIP712Signature calldata signature
|
|
59
|
+
) external;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @notice Changes the delegated executors configuration for the given profile. It allows setting the approvals for
|
|
63
|
+
* delegated executors in the specified configuration, as well as switching to it.
|
|
64
|
+
* @custom:permissions Profile Owner.
|
|
65
|
+
*
|
|
66
|
+
* @param delegatorProfileId The ID of the profile to which the delegated executor is being changed for.
|
|
67
|
+
* @param delegatedExecutors The array of delegated executors to set the approval for.
|
|
68
|
+
* @param approvals The array of booleans indicating the corresponding executor's new approval status.
|
|
69
|
+
* @param configNumber The number of the configuration where the executor approval state is being set.
|
|
70
|
+
* @param switchToGivenConfig A boolean indicating if the configuration must be switched to the one with the given
|
|
71
|
+
* number.
|
|
72
|
+
*/
|
|
73
|
+
function changeDelegatedExecutorsConfig(
|
|
74
|
+
uint256 delegatorProfileId,
|
|
75
|
+
address[] calldata delegatedExecutors,
|
|
76
|
+
bool[] calldata approvals,
|
|
77
|
+
uint64 configNumber,
|
|
78
|
+
bool switchToGivenConfig
|
|
79
|
+
) external;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @notice Changes the delegated executors configuration for the given profile under the current configuration.
|
|
83
|
+
* @custom:permissions Profile Owner.
|
|
84
|
+
*
|
|
85
|
+
* @param delegatorProfileId The ID of the profile to which the delegated executor is being changed for.
|
|
86
|
+
* @param delegatedExecutors The array of delegated executors to set the approval for.
|
|
87
|
+
* @param approvals The array of booleans indicating the corresponding executor's new approval status.
|
|
88
|
+
*/
|
|
89
|
+
function changeDelegatedExecutorsConfig(
|
|
90
|
+
uint256 delegatorProfileId,
|
|
91
|
+
address[] calldata delegatedExecutors,
|
|
92
|
+
bool[] calldata approvals
|
|
93
|
+
) external;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @custom:meta-tx changeDelegatedExecutorsConfig.
|
|
97
|
+
*/
|
|
98
|
+
function changeDelegatedExecutorsConfigWithSig(
|
|
99
|
+
uint256 delegatorProfileId,
|
|
100
|
+
address[] calldata delegatedExecutors,
|
|
101
|
+
bool[] calldata approvals,
|
|
102
|
+
uint64 configNumber,
|
|
103
|
+
bool switchToGivenConfig,
|
|
104
|
+
Types.EIP712Signature calldata signature
|
|
105
|
+
) external;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @notice Publishes a post.
|
|
109
|
+
* Post is the most basic publication type, and can be used to publish any kind of content.
|
|
110
|
+
* Posts can have these types of modules initialized:
|
|
111
|
+
* - Action modules: any number of publication actions (e.g. collect, tip, etc.)
|
|
112
|
+
* - Reference module: a module handling the rules when referencing this post (e.g. token-gated comments)
|
|
113
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
114
|
+
*
|
|
115
|
+
* @param postParams A PostParams struct containing the needed parameters.
|
|
116
|
+
*
|
|
117
|
+
* @return uint256 An integer representing the post's publication ID.
|
|
118
|
+
*/
|
|
119
|
+
function post(Types.PostParams calldata postParams) external returns (uint256);
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @custom:meta-tx post.
|
|
123
|
+
*/
|
|
124
|
+
function postWithSig(
|
|
125
|
+
Types.PostParams calldata postParams,
|
|
126
|
+
Types.EIP712Signature calldata signature
|
|
127
|
+
) external returns (uint256);
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @notice Publishes a comment on the given publication.
|
|
131
|
+
* Comment is a type of reference publication that points to another publication.
|
|
132
|
+
* Comments can have these types of modules initialized:
|
|
133
|
+
* - Action modules: any number of publication actions (e.g. collect, tip, etc.)
|
|
134
|
+
* - Reference module: a module handling the rules when referencing this comment (e.g. token-gated mirrors)
|
|
135
|
+
* Comments can have referrers (e.g. publications or profiles that helped to discover the pointed publication).
|
|
136
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
137
|
+
*
|
|
138
|
+
* @param commentParams A CommentParams struct containing the needed parameters.
|
|
139
|
+
*
|
|
140
|
+
* @return uint256 An integer representing the comment's publication ID.
|
|
141
|
+
*/
|
|
142
|
+
function comment(Types.CommentParams calldata commentParams) external returns (uint256);
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @custom:meta-tx comment.
|
|
146
|
+
*/
|
|
147
|
+
function commentWithSig(
|
|
148
|
+
Types.CommentParams calldata commentParams,
|
|
149
|
+
Types.EIP712Signature calldata signature
|
|
150
|
+
) external returns (uint256);
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @notice Publishes a mirror of the given publication.
|
|
154
|
+
* Mirror is a type of reference publication that points to another publication but doesn't have content.
|
|
155
|
+
* Mirrors don't have any modules initialized.
|
|
156
|
+
* Mirrors can have referrers (e.g. publications or profiles that allowed to discover the pointed publication).
|
|
157
|
+
* You cannot mirror a mirror, comment on a mirror, or quote a mirror.
|
|
158
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
159
|
+
*
|
|
160
|
+
* @param mirrorParams A MirrorParams struct containing the necessary parameters.
|
|
161
|
+
*
|
|
162
|
+
* @return uint256 An integer representing the mirror's publication ID.
|
|
163
|
+
*/
|
|
164
|
+
function mirror(Types.MirrorParams calldata mirrorParams) external returns (uint256);
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @custom:meta-tx mirror.
|
|
168
|
+
*/
|
|
169
|
+
function mirrorWithSig(
|
|
170
|
+
Types.MirrorParams calldata mirrorParams,
|
|
171
|
+
Types.EIP712Signature calldata signature
|
|
172
|
+
) external returns (uint256);
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @notice Publishes a quote of the given publication.
|
|
176
|
+
* Quote is a type of reference publication similar to mirror, but it has content and modules.
|
|
177
|
+
* Quotes can have these types of modules initialized:
|
|
178
|
+
* - Action modules: any number of publication actions (e.g. collect, tip, etc.)
|
|
179
|
+
* - Reference module: a module handling the rules when referencing this quote (e.g. token-gated comments on quote)
|
|
180
|
+
* Quotes can have referrers (e.g. publications or profiles that allowed to discover the pointed publication).
|
|
181
|
+
* Unlike mirrors, you can mirror a quote, comment on a quote, or quote a quote.
|
|
182
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
183
|
+
*
|
|
184
|
+
* @param quoteParams A QuoteParams struct containing the needed parameters.
|
|
185
|
+
*
|
|
186
|
+
* @return uint256 An integer representing the quote's publication ID.
|
|
187
|
+
*/
|
|
188
|
+
function quote(Types.QuoteParams calldata quoteParams) external returns (uint256);
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @custom:meta-tx quote.
|
|
192
|
+
*/
|
|
193
|
+
function quoteWithSig(
|
|
194
|
+
Types.QuoteParams calldata quoteParams,
|
|
195
|
+
Types.EIP712Signature calldata signature
|
|
196
|
+
) external returns (uint256);
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @notice Follows given profiles, executing each profile's follow module logic (if any).
|
|
200
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
201
|
+
*
|
|
202
|
+
* @dev Both the `idsOfProfilesToFollow`, `followTokenIds`, and `datas` arrays must be of the same length,
|
|
203
|
+
* regardless if the profiles do not have a follow module set.
|
|
204
|
+
*
|
|
205
|
+
* @param followerProfileId The ID of the profile the follows are being executed for.
|
|
206
|
+
* @param idsOfProfilesToFollow The array of IDs of profiles to follow.
|
|
207
|
+
* @param followTokenIds The array of follow token IDs to use for each follow (0 if you don't own a follow token).
|
|
208
|
+
* @param datas The arbitrary data array to pass to the follow module for each profile if needed.
|
|
209
|
+
*
|
|
210
|
+
* @return uint256[] An array of follow token IDs representing the follow tokens created for each follow.
|
|
211
|
+
*/
|
|
212
|
+
function follow(
|
|
213
|
+
uint256 followerProfileId,
|
|
214
|
+
uint256[] calldata idsOfProfilesToFollow,
|
|
215
|
+
uint256[] calldata followTokenIds,
|
|
216
|
+
bytes[] calldata datas
|
|
217
|
+
) external returns (uint256[] memory);
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @custom:meta-tx follow.
|
|
221
|
+
*/
|
|
222
|
+
function followWithSig(
|
|
223
|
+
uint256 followerProfileId,
|
|
224
|
+
uint256[] calldata idsOfProfilesToFollow,
|
|
225
|
+
uint256[] calldata followTokenIds,
|
|
226
|
+
bytes[] calldata datas,
|
|
227
|
+
Types.EIP712Signature calldata signature
|
|
228
|
+
) external returns (uint256[] memory);
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @notice Unfollows given profiles.
|
|
232
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
233
|
+
*
|
|
234
|
+
* @param unfollowerProfileId The ID of the profile the unfollows are being executed for.
|
|
235
|
+
* @param idsOfProfilesToUnfollow The array of IDs of profiles to unfollow.
|
|
236
|
+
*/
|
|
237
|
+
function unfollow(uint256 unfollowerProfileId, uint256[] calldata idsOfProfilesToUnfollow) external;
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @custom:meta-tx unfollow.
|
|
241
|
+
*/
|
|
242
|
+
function unfollowWithSig(
|
|
243
|
+
uint256 unfollowerProfileId,
|
|
244
|
+
uint256[] calldata idsOfProfilesToUnfollow,
|
|
245
|
+
Types.EIP712Signature calldata signature
|
|
246
|
+
) external;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @notice Sets the block status for the given profiles. Changing a profile's block status to `true` (i.e. blocked),
|
|
250
|
+
* when will also force them to unfollow.
|
|
251
|
+
* Blocked profiles cannot perform any actions with the profile that blocked them: they cannot comment or mirror
|
|
252
|
+
* their publications, they cannot follow them, they cannot collect, tip them, etc.
|
|
253
|
+
* @custom:permissions Profile Owner or Delegated Executor.
|
|
254
|
+
*
|
|
255
|
+
* @dev Both the `idsOfProfilesToSetBlockStatus` and `blockStatus` arrays must be of the same length.
|
|
256
|
+
*
|
|
257
|
+
* @param byProfileId The ID of the profile that is blocking/unblocking somebody.
|
|
258
|
+
* @param idsOfProfilesToSetBlockStatus The array of IDs of profiles to set block status.
|
|
259
|
+
* @param blockStatus The array of block statuses to use for each (true is blocked).
|
|
260
|
+
*/
|
|
261
|
+
function setBlockStatus(
|
|
262
|
+
uint256 byProfileId,
|
|
263
|
+
uint256[] calldata idsOfProfilesToSetBlockStatus,
|
|
264
|
+
bool[] calldata blockStatus
|
|
265
|
+
) external;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* @custom:meta-tx setBlockStatus.
|
|
269
|
+
*/
|
|
270
|
+
function setBlockStatusWithSig(
|
|
271
|
+
uint256 byProfileId,
|
|
272
|
+
uint256[] calldata idsOfProfilesToSetBlockStatus,
|
|
273
|
+
bool[] calldata blockStatus,
|
|
274
|
+
Types.EIP712Signature calldata signature
|
|
275
|
+
) external;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @notice Collects a given publication via signature with the specified parameters.
|
|
279
|
+
* Collect can have referrers (e.g. publications or profiles that allowed to discover the pointed publication).
|
|
280
|
+
* @custom:permissions Collector Profile Owner or its Delegated Executor.
|
|
281
|
+
* @custom:pending-deprecation Collect modules were replaced by PublicationAction Collect modules in V2. This method
|
|
282
|
+
* is left here for backwards compatibility with posts made in V1 that had Collect modules.
|
|
283
|
+
*
|
|
284
|
+
* @param collectParams A CollectParams struct containing the parameters.
|
|
285
|
+
*
|
|
286
|
+
* @return uint256 An integer representing the minted token ID.
|
|
287
|
+
*/
|
|
288
|
+
function collectLegacy(Types.LegacyCollectParams calldata collectParams) external returns (uint256);
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @custom:meta-tx collect.
|
|
292
|
+
* @custom:pending-deprecation
|
|
293
|
+
*/
|
|
294
|
+
function collectLegacyWithSig(
|
|
295
|
+
Types.LegacyCollectParams calldata collectParams,
|
|
296
|
+
Types.EIP712Signature calldata signature
|
|
297
|
+
) external returns (uint256);
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @notice Acts on a given publication with the specified parameters.
|
|
301
|
+
* You can act on a publication except a mirror (if it has at least one action module initialized).
|
|
302
|
+
* Actions can have referrers (e.g. publications or profiles that allowed to discover the pointed publication).
|
|
303
|
+
* @custom:permissions Actor Profile Owner or its Delegated Executor.
|
|
304
|
+
*
|
|
305
|
+
* @param publicationActionParams A PublicationActionParams struct containing the parameters.
|
|
306
|
+
*
|
|
307
|
+
* @return bytes Arbitrary data the action module returns.
|
|
308
|
+
*/
|
|
309
|
+
function act(Types.PublicationActionParams calldata publicationActionParams) external returns (bytes memory);
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @custom:meta-tx act.
|
|
313
|
+
*/
|
|
314
|
+
function actWithSig(
|
|
315
|
+
Types.PublicationActionParams calldata publicationActionParams,
|
|
316
|
+
Types.EIP712Signature calldata signature
|
|
317
|
+
) external returns (bytes memory);
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @dev This function is used to invalidate signatures by incrementing the nonce of the signer.
|
|
321
|
+
* @param increment The amount to increment the nonce by (max 255).
|
|
322
|
+
*/
|
|
323
|
+
function incrementNonce(uint8 increment) external;
|
|
324
|
+
|
|
325
|
+
/////////////////////////////////
|
|
326
|
+
/// VIEW FUNCTIONS ///
|
|
327
|
+
/////////////////////////////////
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* @notice Returns whether or not `followerProfileId` is following `followedProfileId`.
|
|
331
|
+
*
|
|
332
|
+
* @param followerProfileId The ID of the profile whose following state should be queried.
|
|
333
|
+
* @param followedProfileId The ID of the profile whose followed state should be queried.
|
|
334
|
+
*
|
|
335
|
+
* @return bool True if `followerProfileId` is following `followedProfileId`, false otherwise.
|
|
336
|
+
*/
|
|
337
|
+
function isFollowing(uint256 followerProfileId, uint256 followedProfileId) external view returns (bool);
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* @notice Returns whether the given address is approved as delegated executor, in the configuration with the given
|
|
341
|
+
* number, to act on behalf of the given profile.
|
|
342
|
+
*
|
|
343
|
+
* @param delegatorProfileId The ID of the profile to check the delegated executor approval for.
|
|
344
|
+
* @param delegatedExecutor The address to query the delegated executor approval for.
|
|
345
|
+
* @param configNumber The number of the configuration where the executor approval state is being queried.
|
|
346
|
+
*
|
|
347
|
+
* @return bool True if the address is approved as a delegated executor to act on behalf of the profile in the
|
|
348
|
+
* given configuration, false otherwise.
|
|
349
|
+
*/
|
|
350
|
+
function isDelegatedExecutorApproved(
|
|
351
|
+
uint256 delegatorProfileId,
|
|
352
|
+
address delegatedExecutor,
|
|
353
|
+
uint64 configNumber
|
|
354
|
+
) external view returns (bool);
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* @notice Returns whether the given address is approved as delegated executor, in the current configuration, to act
|
|
358
|
+
* on behalf of the given profile.
|
|
359
|
+
*
|
|
360
|
+
* @param delegatorProfileId The ID of the profile to check the delegated executor approval for.
|
|
361
|
+
* @param delegatedExecutor The address to query the delegated executor approval for.
|
|
362
|
+
*
|
|
363
|
+
* @return bool True if the address is approved as a delegated executor to act on behalf of the profile in the
|
|
364
|
+
* current configuration, false otherwise.
|
|
365
|
+
*/
|
|
366
|
+
function isDelegatedExecutorApproved(
|
|
367
|
+
uint256 delegatorProfileId,
|
|
368
|
+
address delegatedExecutor
|
|
369
|
+
) external view returns (bool);
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @notice Returns the current delegated executor config number for the given profile.
|
|
373
|
+
*
|
|
374
|
+
* @param delegatorProfileId The ID of the profile from which the delegated executors config number is being queried
|
|
375
|
+
*
|
|
376
|
+
* @return uint256 The current delegated executor configuration number.
|
|
377
|
+
*/
|
|
378
|
+
function getDelegatedExecutorsConfigNumber(uint256 delegatorProfileId) external view returns (uint64);
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* @notice Returns the previous used delegated executor config number for the given profile.
|
|
382
|
+
*
|
|
383
|
+
* @param delegatorProfileId The ID of the profile from which the delegated executors' previous configuration number
|
|
384
|
+
* set is being queried.
|
|
385
|
+
*
|
|
386
|
+
* @return uint256 The delegated executor configuration number previously set. It will coincide with the current
|
|
387
|
+
* configuration set if it was never switched from the default one.
|
|
388
|
+
*/
|
|
389
|
+
function getDelegatedExecutorsPrevConfigNumber(uint256 delegatorProfileId) external view returns (uint64);
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* @notice Returns the maximum delegated executor config number for the given profile.
|
|
393
|
+
* This is the maximum config number that was ever used by this profile.
|
|
394
|
+
* When creating a new clean configuration, you can only use a number that is maxConfigNumber + 1.
|
|
395
|
+
*
|
|
396
|
+
* @param delegatorProfileId The ID of the profile from which the delegated executors' maximum configuration number
|
|
397
|
+
* set is being queried.
|
|
398
|
+
*
|
|
399
|
+
* @return uint256 The delegated executor maximum configuration number set.
|
|
400
|
+
*/
|
|
401
|
+
function getDelegatedExecutorsMaxConfigNumberSet(uint256 delegatorProfileId) external view returns (uint64);
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @notice Returns whether `profileId` is blocked by `byProfileId`.
|
|
405
|
+
* See setBlockStatus() for more information on how blocking works on the platform.
|
|
406
|
+
*
|
|
407
|
+
* @param profileId The ID of the profile whose blocked status should be queried.
|
|
408
|
+
* @param byProfileId The ID of the profile whose blocker status should be queried.
|
|
409
|
+
*
|
|
410
|
+
* @return bool True if `profileId` is blocked by `byProfileId`, false otherwise.
|
|
411
|
+
*/
|
|
412
|
+
function isBlocked(uint256 profileId, uint256 byProfileId) external view returns (bool);
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* @notice Returns the URI associated with a given publication.
|
|
416
|
+
* This is used to store the publication's metadata, e.g.: content, images, etc.
|
|
417
|
+
*
|
|
418
|
+
* @param profileId The token ID of the profile that published the publication to query.
|
|
419
|
+
* @param pubId The publication ID of the publication to query.
|
|
420
|
+
*
|
|
421
|
+
* @return string The URI associated with a given publication.
|
|
422
|
+
*/
|
|
423
|
+
function getContentURI(uint256 profileId, uint256 pubId) external view returns (string memory);
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* @notice Returns the full profile struct associated with a given profile token ID.
|
|
427
|
+
*
|
|
428
|
+
* @param profileId The token ID of the profile to query.
|
|
429
|
+
*
|
|
430
|
+
* @return Profile The profile struct of the given profile.
|
|
431
|
+
*/
|
|
432
|
+
function getProfile(uint256 profileId) external view returns (Types.Profile memory);
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* @notice Returns the full publication struct for a given publication.
|
|
436
|
+
*
|
|
437
|
+
* @param profileId The token ID of the profile that published the publication to query.
|
|
438
|
+
* @param pubId The publication ID of the publication to query.
|
|
439
|
+
*
|
|
440
|
+
* @return Publication The publication struct associated with the queried publication.
|
|
441
|
+
*/
|
|
442
|
+
function getPublication(uint256 profileId, uint256 pubId) external view returns (Types.PublicationMemory memory);
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @notice Returns the type of a given publication.
|
|
446
|
+
* The type can be one of the following (see PublicationType enum):
|
|
447
|
+
* - Nonexistent
|
|
448
|
+
* - Post
|
|
449
|
+
* - Comment
|
|
450
|
+
* - Mirror
|
|
451
|
+
* - Quote
|
|
452
|
+
*
|
|
453
|
+
* @param profileId The token ID of the profile that published the publication to query.
|
|
454
|
+
* @param pubId The publication ID of the publication to query.
|
|
455
|
+
*
|
|
456
|
+
* @return PublicationType The publication type of the queried publication.
|
|
457
|
+
*/
|
|
458
|
+
function getPublicationType(uint256 profileId, uint256 pubId) external view returns (Types.PublicationType);
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* @notice Returns wether a given Action Module is enabled for a given publication.
|
|
462
|
+
*
|
|
463
|
+
* @param profileId The token ID of the profile that published the publication to query.
|
|
464
|
+
* @param pubId The publication ID of the publication to query.
|
|
465
|
+
* @param module The address of the Action Module to query.
|
|
466
|
+
*
|
|
467
|
+
* @return bool True if the Action Module is enabled for the queried publication, false if not.
|
|
468
|
+
*/
|
|
469
|
+
function isActionModuleEnabledInPublication(
|
|
470
|
+
uint256 profileId,
|
|
471
|
+
uint256 pubId,
|
|
472
|
+
address module
|
|
473
|
+
) external view returns (bool);
|
|
474
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title ILensVersion
|
|
7
|
+
* @author Lens Protocol
|
|
8
|
+
*
|
|
9
|
+
* @notice This is the interface for the LensHub Version getters and emitter.
|
|
10
|
+
* It allows to emit a LensHub version during an upgrade, and also to get the current version.
|
|
11
|
+
*/
|
|
12
|
+
interface ILensVersion {
|
|
13
|
+
/**
|
|
14
|
+
* @notice Returns the LensHub current Version.
|
|
15
|
+
*
|
|
16
|
+
* @return version The LensHub current Version.
|
|
17
|
+
*/
|
|
18
|
+
function getVersion() external view returns (string memory);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @notice Returns the LensHub current Git Commit.
|
|
22
|
+
*
|
|
23
|
+
* @return gitCommit The LensHub current Git Commit.
|
|
24
|
+
*/
|
|
25
|
+
function getGitCommit() external view returns (bytes20);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @notice Emits the LensHub current Version. Used in upgradeAndCall().
|
|
29
|
+
*/
|
|
30
|
+
function emitVersion() external;
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity ^0.8.15;
|
|
4
|
+
|
|
5
|
+
interface IModuleRegistry {
|
|
6
|
+
enum ModuleType {
|
|
7
|
+
__, // Just to avoid 0 as valid ModuleType
|
|
8
|
+
PUBLICATION_ACTION_MODULE,
|
|
9
|
+
REFERENCE_MODULE,
|
|
10
|
+
FOLLOW_MODULE
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Modules functions
|
|
14
|
+
|
|
15
|
+
function verifyModule(address moduleAddress, uint256 moduleType) external returns (bool);
|
|
16
|
+
|
|
17
|
+
function registerModule(address moduleAddress, uint256 moduleType) external returns (bool);
|
|
18
|
+
|
|
19
|
+
function getModuleTypes(address moduleAddress) external view returns (uint256);
|
|
20
|
+
|
|
21
|
+
function isModuleRegistered(address moduleAddress) external view returns (bool);
|
|
22
|
+
|
|
23
|
+
function isModuleRegisteredAs(address moduleAddress, uint256 moduleType) external view returns (bool);
|
|
24
|
+
|
|
25
|
+
// Currencies functions
|
|
26
|
+
|
|
27
|
+
function verifyErc20Currency(address currencyAddress) external returns (bool);
|
|
28
|
+
|
|
29
|
+
function registerErc20Currency(address currencyAddress) external returns (bool);
|
|
30
|
+
|
|
31
|
+
function isErc20CurrencyRegistered(address currencyAddress) external view returns (bool);
|
|
32
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
import {Types} from '../libraries/constants/Types.sol';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @title IPublicationAction
|
|
9
|
+
* @author Lens Protocol
|
|
10
|
+
*
|
|
11
|
+
* @notice This is the standard interface for all Lens-compatible Publication Actions.
|
|
12
|
+
* Publication action modules allow users to execute actions directly from a publication, like:
|
|
13
|
+
* - Minting NFTs.
|
|
14
|
+
* - Collecting a publication.
|
|
15
|
+
* - Sending funds to the publication author (e.g. tipping).
|
|
16
|
+
* - Etc.
|
|
17
|
+
* Referrers are supported, so any publication or profile that references the publication can receive a share from the
|
|
18
|
+
* publication's action if the action module supports it.
|
|
19
|
+
*/
|
|
20
|
+
interface IPublicationActionModule {
|
|
21
|
+
/**
|
|
22
|
+
* @notice Initializes the action module for the given publication being published with this Action module.
|
|
23
|
+
* @custom:permissions LensHub.
|
|
24
|
+
*
|
|
25
|
+
* @param profileId The profile ID of the author publishing the content with this Publication Action.
|
|
26
|
+
* @param pubId The publication ID being published.
|
|
27
|
+
* @param transactionExecutor The address of the transaction executor (e.g. for any funds to transferFrom).
|
|
28
|
+
* @param data Arbitrary data passed from the user to be decoded by the Action Module during initialization.
|
|
29
|
+
*
|
|
30
|
+
* @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by
|
|
31
|
+
* indexers or UIs.
|
|
32
|
+
*/
|
|
33
|
+
function initializePublicationAction(
|
|
34
|
+
uint256 profileId,
|
|
35
|
+
uint256 pubId,
|
|
36
|
+
address transactionExecutor,
|
|
37
|
+
bytes calldata data
|
|
38
|
+
) external returns (bytes memory);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @notice Processes the action for a given publication. This includes the action's logic and any monetary/token
|
|
42
|
+
* operations.
|
|
43
|
+
* @custom:permissions LensHub.
|
|
44
|
+
*
|
|
45
|
+
* @param processActionParams The parameters needed to execute the publication action.
|
|
46
|
+
*
|
|
47
|
+
* @return bytes Any custom ABI-encoded data. This will be a LensHub event params that can be used by
|
|
48
|
+
* indexers or UIs.
|
|
49
|
+
*/
|
|
50
|
+
function processPublicationAction(Types.ProcessActionParams calldata processActionParams)
|
|
51
|
+
external
|
|
52
|
+
returns (bytes memory);
|
|
53
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.6.0;
|
|
4
|
+
|
|
5
|
+
library Errors {
|
|
6
|
+
error CannotInitImplementation();
|
|
7
|
+
error Initialized();
|
|
8
|
+
error SignatureExpired();
|
|
9
|
+
error SignatureInvalid();
|
|
10
|
+
error InvalidOwner();
|
|
11
|
+
error NotOwnerOrApproved();
|
|
12
|
+
error NotHub();
|
|
13
|
+
error TokenDoesNotExist();
|
|
14
|
+
error NotGovernance();
|
|
15
|
+
error NotGovernanceOrEmergencyAdmin();
|
|
16
|
+
error EmergencyAdminCanOnlyPauseFurther();
|
|
17
|
+
error NotProfileOwner();
|
|
18
|
+
error PublicationDoesNotExist();
|
|
19
|
+
error CallerNotFollowNFT();
|
|
20
|
+
error CallerNotCollectNFT(); // Legacy
|
|
21
|
+
error ArrayMismatch();
|
|
22
|
+
error NotWhitelisted();
|
|
23
|
+
error NotRegistered();
|
|
24
|
+
error InvalidParameter();
|
|
25
|
+
error ExecutorInvalid();
|
|
26
|
+
error Blocked();
|
|
27
|
+
error SelfBlock();
|
|
28
|
+
error NotFollowing();
|
|
29
|
+
error SelfFollow();
|
|
30
|
+
error InvalidReferrer();
|
|
31
|
+
error InvalidPointedPub();
|
|
32
|
+
error NonERC721ReceiverImplementer();
|
|
33
|
+
error AlreadyEnabled();
|
|
34
|
+
|
|
35
|
+
// Module Errors
|
|
36
|
+
error InitParamsInvalid();
|
|
37
|
+
error ActionNotAllowed();
|
|
38
|
+
|
|
39
|
+
error CollectNotAllowed(); // Used in LegacyCollectLib (pending deprecation)
|
|
40
|
+
|
|
41
|
+
// MultiState Errors
|
|
42
|
+
error Paused();
|
|
43
|
+
error PublishingPaused();
|
|
44
|
+
|
|
45
|
+
// Profile Guardian Errors
|
|
46
|
+
error GuardianEnabled();
|
|
47
|
+
error NotEOA();
|
|
48
|
+
error DisablingAlreadyTriggered();
|
|
49
|
+
|
|
50
|
+
// Migration Errors
|
|
51
|
+
error NotMigrationAdmin();
|
|
52
|
+
}
|