lens-modules 3.1.2 → 3.1.4
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/contracts/actions/account/base/BaseAccountAction.sol +3 -0
- package/contracts/actions/post/base/BasePostAction.sol +3 -1
- package/contracts/actions/post/collect/LensCollectedPost.sol +72 -29
- package/contracts/actions/post/collect/SimpleCollectAction.sol +30 -17
- package/contracts/core/base/BaseSource.sol +0 -1
- package/contracts/core/base/LensERC721.sol +2 -0
- package/contracts/core/base/RuleBasedPrimitive.sol +2 -1
- package/contracts/core/base/SourceStampBased.sol +2 -1
- package/contracts/core/interfaces/IFeed.sol +5 -5
- package/contracts/core/interfaces/IGraph.sol +4 -4
- package/contracts/core/interfaces/IGroup.sol +5 -5
- package/contracts/core/interfaces/INamespace.sol +4 -4
- package/contracts/core/primitives/feed/Feed.sol +3 -3
- package/contracts/core/primitives/feed/RuleBasedFeed.sol +8 -2
- package/contracts/core/primitives/graph/Graph.sol +2 -2
- package/contracts/core/primitives/graph/RuleBasedGraph.sol +8 -2
- package/contracts/core/primitives/group/RuleBasedGroup.sol +7 -1
- package/contracts/core/primitives/namespace/Namespace.sol +21 -9
- package/contracts/core/primitives/namespace/RuleBasedNamespace.sol +7 -1
- package/contracts/core/types/Constants.sol +6 -0
- package/contracts/core/types/Errors.sol +7 -0
- package/contracts/extensions/account/Account.sol +382 -105
- package/contracts/extensions/account/IAccount.sol +23 -3
- package/contracts/extensions/actions/ActionHub.sol +23 -13
- package/contracts/extensions/fees/LensNativePaymentHelper.sol +62 -0
- package/contracts/extensions/fees/LensPaymentHandler.sol +26 -6
- package/contracts/extensions/fees/LensRulePaymentHandler.sol +30 -0
- package/contracts/extensions/misc/TokenDistributor.sol +248 -0
- package/contracts/rules/base/SimplePaymentRule.sol +8 -6
- package/contracts/rules/namespace/UsernamePricePerLengthNamespaceRule.sol +1 -2
- package/contracts/rules/namespace/UsernameReservedNamespaceRule.sol +2 -2
- package/package.json +5 -3
- package/dist/abis.cjs +0 -1
- package/dist/abis.d.cts +0 -38902
- package/dist/abis.d.ts +0 -38902
- package/dist/abis.js +0 -1
- package/dist/deployments.cjs +0 -1
- package/dist/deployments.d.cts +0 -760
- package/dist/deployments.d.ts +0 -760
- package/dist/deployments.js +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -1
|
@@ -12,6 +12,7 @@ abstract contract BaseAccountAction is BaseAction, IAccountAction {
|
|
|
12
12
|
|
|
13
13
|
function configure(address originalMsgSender, address account, KeyValue[] calldata params)
|
|
14
14
|
external
|
|
15
|
+
payable
|
|
15
16
|
override
|
|
16
17
|
onlyActionHub
|
|
17
18
|
returns (bytes memory)
|
|
@@ -21,6 +22,7 @@ abstract contract BaseAccountAction is BaseAction, IAccountAction {
|
|
|
21
22
|
|
|
22
23
|
function execute(address originalMsgSender, address account, KeyValue[] calldata params)
|
|
23
24
|
external
|
|
25
|
+
payable
|
|
24
26
|
override
|
|
25
27
|
onlyActionHub
|
|
26
28
|
returns (bytes memory)
|
|
@@ -30,6 +32,7 @@ abstract contract BaseAccountAction is BaseAction, IAccountAction {
|
|
|
30
32
|
|
|
31
33
|
function setDisabled(address originalMsgSender, address account, bool isDisabled, KeyValue[] calldata params)
|
|
32
34
|
external
|
|
35
|
+
payable
|
|
33
36
|
override
|
|
34
37
|
onlyActionHub
|
|
35
38
|
returns (bytes memory)
|
|
@@ -12,6 +12,7 @@ abstract contract BasePostAction is BaseAction, IPostAction {
|
|
|
12
12
|
|
|
13
13
|
function configure(address originalMsgSender, address feed, uint256 postId, KeyValue[] calldata params)
|
|
14
14
|
external
|
|
15
|
+
payable
|
|
15
16
|
override
|
|
16
17
|
onlyActionHub
|
|
17
18
|
returns (bytes memory)
|
|
@@ -21,6 +22,7 @@ abstract contract BasePostAction is BaseAction, IPostAction {
|
|
|
21
22
|
|
|
22
23
|
function execute(address originalMsgSender, address feed, uint256 postId, KeyValue[] calldata params)
|
|
23
24
|
external
|
|
25
|
+
payable
|
|
24
26
|
override
|
|
25
27
|
onlyActionHub
|
|
26
28
|
returns (bytes memory)
|
|
@@ -34,7 +36,7 @@ abstract contract BasePostAction is BaseAction, IPostAction {
|
|
|
34
36
|
uint256 postId,
|
|
35
37
|
bool isDisabled,
|
|
36
38
|
KeyValue[] calldata params
|
|
37
|
-
) external override onlyActionHub returns (bytes memory) {
|
|
39
|
+
) external payable override onlyActionHub returns (bytes memory) {
|
|
38
40
|
return _setDisabled(originalMsgSender, feed, postId, isDisabled, params);
|
|
39
41
|
}
|
|
40
42
|
|
|
@@ -3,11 +3,15 @@
|
|
|
3
3
|
pragma solidity ^0.8.26;
|
|
4
4
|
|
|
5
5
|
import "lens-modules/contracts/core/base/LensERC721.sol";
|
|
6
|
-
import {IERC7572} from "lens-modules/contracts/actions/post/collect/IERC7572.sol";
|
|
7
6
|
import {IFeed} from "lens-modules/contracts/core/interfaces/IFeed.sol";
|
|
8
7
|
import {ITokenURIProvider} from "lens-modules/contracts/core/interfaces/ITokenURIProvider.sol";
|
|
9
8
|
import {Errors} from "lens-modules/contracts/core/types/Errors.sol";
|
|
10
9
|
|
|
10
|
+
struct ContentURISnapshot {
|
|
11
|
+
string contentURI;
|
|
12
|
+
uint256 tokenId;
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* @notice A contract that represents a Lens Collected Post.
|
|
13
17
|
*
|
|
@@ -19,54 +23,93 @@ import {Errors} from "lens-modules/contracts/core/types/Errors.sol";
|
|
|
19
23
|
* If the Collect is immutable - it will snapshot the content of the post and always return the snapshotted tokenURI
|
|
20
24
|
* even if the post was updated or deleted. The contractURI, however, always stays the same, as it was at the moment of
|
|
21
25
|
* Collect creation.
|
|
26
|
+
*
|
|
27
|
+
* We assume tokenIds are sequential and start from 1.
|
|
22
28
|
*/
|
|
23
|
-
contract LensCollectedPost is LensERC721
|
|
29
|
+
contract LensCollectedPost is LensERC721 {
|
|
24
30
|
event Lens_LensCollectedPost_Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
address internal immutable
|
|
29
|
-
uint256 internal immutable
|
|
30
|
-
address internal immutable
|
|
32
|
+
ContentURISnapshot[] internal _contentURISnapshots;
|
|
33
|
+
bool internal _isImmutable;
|
|
34
|
+
address internal immutable FEED;
|
|
35
|
+
uint256 internal immutable POST_ID;
|
|
36
|
+
address internal immutable COLLECT_ACTION;
|
|
31
37
|
|
|
32
|
-
constructor(address feed, uint256 postId, bool
|
|
38
|
+
constructor(address feed, uint256 postId, bool isImmutableCollect) {
|
|
33
39
|
LensERC721._initialize("Lens Collected Post", "LCP", ITokenURIProvider(address(0)));
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_contentURISnapshot = contentURI;
|
|
40
|
+
COLLECT_ACTION = msg.sender;
|
|
41
|
+
FEED = feed;
|
|
42
|
+
POST_ID = postId;
|
|
43
|
+
// Getting the URI outside the if to use it as a length validation too.
|
|
44
|
+
string memory contentURI = _getNonEmptyContentURIFromPost();
|
|
45
|
+
if (isImmutableCollect) {
|
|
46
|
+
_turnImmutable(contentURI);
|
|
42
47
|
}
|
|
43
|
-
emit ContractURIUpdated();
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
function mint(address to, uint256 tokenId) external {
|
|
47
|
-
require(msg.sender ==
|
|
51
|
+
require(msg.sender == COLLECT_ACTION, Errors.InvalidMsgSender());
|
|
52
|
+
_takeContentURISnapshotIfNeeded(tokenId);
|
|
48
53
|
_mint(to, tokenId);
|
|
49
54
|
}
|
|
50
55
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
function turnImmutable() external {
|
|
57
|
+
require(msg.sender == COLLECT_ACTION, Errors.InvalidMsgSender());
|
|
58
|
+
if (!_isImmutable) {
|
|
59
|
+
_turnImmutable(_getNonEmptyContentURIFromPost());
|
|
60
|
+
}
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
// Getters
|
|
64
|
+
|
|
65
|
+
function tokenURI(uint256 tokenId) public view override returns (string memory) {
|
|
66
|
+
if (_isImmutable) {
|
|
67
|
+
// Searching for snapshots (starting from latest)
|
|
68
|
+
for (uint256 i = _contentURISnapshots.length - 1; i > 0; i--) {
|
|
69
|
+
if (_contentURISnapshots[i].tokenId <= tokenId) {
|
|
70
|
+
return _contentURISnapshots[i].contentURI;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// contentURISnapshot[0] is always taken when the collection is marked as immutable,
|
|
74
|
+
// so we can guarantee it's present and non-empty.
|
|
75
|
+
return _contentURISnapshots[0].contentURI;
|
|
60
76
|
} else {
|
|
61
|
-
|
|
62
|
-
// If content was deleted we fail. You can override this to return the empty URI if preferred.
|
|
63
|
-
require(bytes(contentURI).length > 0, Errors.DoesNotExist());
|
|
64
|
-
return contentURI;
|
|
77
|
+
return _getNonEmptyContentURIFromPost();
|
|
65
78
|
}
|
|
66
79
|
}
|
|
67
80
|
|
|
81
|
+
function getPostId() external view returns (uint256) {
|
|
82
|
+
return POST_ID;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isImmutable() external view returns (bool) {
|
|
86
|
+
return _isImmutable;
|
|
87
|
+
}
|
|
88
|
+
|
|
68
89
|
// Internal
|
|
69
90
|
|
|
91
|
+
function _getNonEmptyContentURIFromPost() internal view returns (string memory) {
|
|
92
|
+
string memory contentURI = IFeed(FEED).getPost(POST_ID).contentURI;
|
|
93
|
+
require(bytes(contentURI).length > 0, Errors.InvalidParameter());
|
|
94
|
+
return contentURI;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function _turnImmutable(string memory contentURI) internal {
|
|
98
|
+
_isImmutable = true;
|
|
99
|
+
_contentURISnapshots.push(ContentURISnapshot(contentURI, 0));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function _takeContentURISnapshotIfNeeded(uint256 tokenId) internal {
|
|
103
|
+
if (_isImmutable) {
|
|
104
|
+
// Getting the content URI will revert if the post was deleted or does not exist.
|
|
105
|
+
string memory contentURI = _getNonEmptyContentURIFromPost();
|
|
106
|
+
string memory latestContentURISnapshot = _contentURISnapshots[_contentURISnapshots.length - 1].contentURI;
|
|
107
|
+
if (keccak256(bytes(contentURI)) != keccak256(bytes(latestContentURISnapshot))) {
|
|
108
|
+
_contentURISnapshots.push(ContentURISnapshot(contentURI, tokenId));
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
70
113
|
function _afterTokenTransfer(address from, address to, uint256 tokenId) internal virtual override {
|
|
71
114
|
emit Lens_LensCollectedPost_Transfer(from, to, tokenId);
|
|
72
115
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
pragma solidity ^0.8.26;
|
|
4
4
|
|
|
5
5
|
import {ISimpleCollectAction, CollectActionData} from "lens-modules/contracts/actions/post/collect/ISimpleCollectAction.sol";
|
|
6
|
-
import {IFeed} from "lens-modules/contracts/core/interfaces/IFeed.sol";
|
|
6
|
+
import {IFeed, Post} from "lens-modules/contracts/core/interfaces/IFeed.sol";
|
|
7
7
|
import {IGraph} from "lens-modules/contracts/core/interfaces/IGraph.sol";
|
|
8
8
|
import {LensCollectedPost} from "lens-modules/contracts/actions/post/collect/LensCollectedPost.sol";
|
|
9
9
|
import {OwnableMetadataBasedPostAction} from "lens-modules/contracts/actions/post/base/OwnableMetadataBasedPostAction.sol";
|
|
@@ -69,11 +69,15 @@ contract SimpleCollectAction is
|
|
|
69
69
|
* @param recipients Recipient(s) of collect fees.
|
|
70
70
|
* @param referralFeeBps The fee percentage that is distributed to referrals.
|
|
71
71
|
* @param isImmutable If true, it means that:
|
|
72
|
-
* - The Post URI is snapshotted at
|
|
72
|
+
* - The Post URI is snapshotted at collect time for each collected NFT.
|
|
73
73
|
* - Collected posts' NFTs remain permanently available.
|
|
74
|
-
* - What you see is what you get
|
|
74
|
+
* - What you see is what you get (*).
|
|
75
|
+
* - Deleting the post will disable further collection.
|
|
75
76
|
* Note: This immutability is only guaranteed if the URI is hosted on immutable storage. Mutability inherent
|
|
76
77
|
* to the chosen storage technology exceeds the on-chain verification capabilities.
|
|
78
|
+
* (*) WYSIWYG is not preserved for Legacy LensCollectedPost collections. Those will have a snapshot of the
|
|
79
|
+
* post at configuration time and, if the post was edited, the NFT would still have same snapshot.
|
|
80
|
+
* This decision was made to prevent legacy collections from breaking on editing.
|
|
77
81
|
*/
|
|
78
82
|
struct CollectActionConfigureParams {
|
|
79
83
|
uint160 amount; ///////////// (Optional) Default: 0
|
|
@@ -140,13 +144,33 @@ contract SimpleCollectAction is
|
|
|
140
144
|
storedData.referralFeeBps = configData.referralFeeBps;
|
|
141
145
|
storedData.followerOnlyGraph = configData.followerOnlyGraph;
|
|
142
146
|
storedData.endTimestamp = configData.endTimestamp;
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
if (storedData.currentCollects == 0) {
|
|
148
|
+
// Re-deploy collection as a fix for some broken mutable (i.e. isImmutable = false) collections.
|
|
149
|
+
storedData.collectionAddress = address(new LensCollectedPost(feed, postId, configData.isImmutable));
|
|
150
|
+
} else if (configData.isImmutable == true) {
|
|
151
|
+
// Tries to turn existing collection immutable, which is not supported for older collections.
|
|
152
|
+
_tryTurnImmutable(feed, postId, storedData.collectionAddress);
|
|
153
|
+
storedData.isImmutable = true;
|
|
154
|
+
}
|
|
145
155
|
}
|
|
146
156
|
}
|
|
147
157
|
return abi.encode(storedData);
|
|
148
158
|
}
|
|
149
159
|
|
|
160
|
+
function _tryTurnImmutable(address feed, uint256 postId, address collectionAddress) internal {
|
|
161
|
+
Post memory post = IFeed(feed).getPostUnchecked(postId);
|
|
162
|
+
if (post.isDeleted || bytes(post.contentURI).length == 0) {
|
|
163
|
+
// Call will fail anyways when the collection tries to take the content URI snapshot #0.
|
|
164
|
+
revert Errors.UnexpectedValue();
|
|
165
|
+
} else {
|
|
166
|
+
(bool callSucceeded,) = collectionAddress.call(abi.encodeCall(LensCollectedPost.turnImmutable, ()));
|
|
167
|
+
if (!callSucceeded) {
|
|
168
|
+
// Collection is from an older version that does not support turning immutable.
|
|
169
|
+
revert Errors.UnsupportedOperation();
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
150
174
|
function _execute(address originalMsgSender, address feed, uint256 postId, KeyValue[] calldata params)
|
|
151
175
|
internal
|
|
152
176
|
override
|
|
@@ -203,8 +227,7 @@ contract SimpleCollectAction is
|
|
|
203
227
|
require(configData.recipients.length == 0, Errors.InvalidParameter());
|
|
204
228
|
require(configData.referralFeeBps == 0, Errors.InvalidParameter());
|
|
205
229
|
} else {
|
|
206
|
-
|
|
207
|
-
IERC20(configData.token).balanceOf(address(this));
|
|
230
|
+
_validateToken(configData.token);
|
|
208
231
|
require(configData.recipients.length > 0, Errors.InvalidParameter());
|
|
209
232
|
require(configData.referralFeeBps <= BPS_MAX, Errors.InvalidParameter());
|
|
210
233
|
}
|
|
@@ -310,16 +333,6 @@ contract SimpleCollectAction is
|
|
|
310
333
|
);
|
|
311
334
|
}
|
|
312
335
|
|
|
313
|
-
if (data.isImmutable) {
|
|
314
|
-
// If post is edited to a different content, we fail so people do not collect an unexpected thing.
|
|
315
|
-
string memory contentURI = IFeed(feed).getPost(postId).contentURI;
|
|
316
|
-
require(
|
|
317
|
-
keccak256(bytes(contentURI))
|
|
318
|
-
== keccak256(bytes(LensCollectedPost(data.collectionAddress).tokenURI(data.currentCollects))),
|
|
319
|
-
Errors.InvalidParameter()
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
|
|
323
336
|
if (data.isDisabled) {
|
|
324
337
|
revert Errors.Disabled();
|
|
325
338
|
}
|
|
@@ -42,7 +42,6 @@ abstract contract BaseSource is ISource {
|
|
|
42
42
|
emit Lens_Source_NonceUsed(nonce);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
// Signature Standard: EIP-191 - Version Byte: 0x00
|
|
46
45
|
function _validateSource(SourceStamp calldata sourceStamp) internal virtual {
|
|
47
46
|
require(!$baseSourceStorage().wasSourceStampNonceUsed[sourceStamp.nonce], Errors.NonceUsed());
|
|
48
47
|
require(sourceStamp.deadline >= block.timestamp, Errors.Expired());
|
|
@@ -16,6 +16,7 @@ abstract contract LensERC721 is IERC721Metadata, ERC165 {
|
|
|
16
16
|
using AddressUpgradeable for address;
|
|
17
17
|
|
|
18
18
|
event Lens_ERC721_TokenURIProviderSet(address indexed tokenURIProvider);
|
|
19
|
+
event Lens_ERC721_Initialized(string name, string symbol);
|
|
19
20
|
|
|
20
21
|
struct ERC721Storage {
|
|
21
22
|
// Token name
|
|
@@ -47,6 +48,7 @@ abstract contract LensERC721 is IERC721Metadata, ERC165 {
|
|
|
47
48
|
$erc721Storage().name = nftName;
|
|
48
49
|
$erc721Storage().symbol = nftSymbol;
|
|
49
50
|
$erc721Storage().tokenURIProvider = tokenURIProvider;
|
|
51
|
+
emit Lens_ERC721_Initialized(nftName, nftSymbol);
|
|
50
52
|
emit Lens_ERC721_TokenURIProviderSet(address(tokenURIProvider));
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -13,8 +13,9 @@ import {
|
|
|
13
13
|
} from "lens-modules/contracts/core/types/Types.sol";
|
|
14
14
|
import {CallLib} from "lens-modules/contracts/core/libraries/CallLib.sol";
|
|
15
15
|
import {Errors} from "lens-modules/contracts/core/types/Errors.sol";
|
|
16
|
+
import {PayableUsingNativePaymentHelper} from "lens-modules/contracts/extensions/fees/LensNativePaymentHelper.sol";
|
|
16
17
|
|
|
17
|
-
abstract contract RuleBasedPrimitive {
|
|
18
|
+
abstract contract RuleBasedPrimitive is PayableUsingNativePaymentHelper {
|
|
18
19
|
using RulesLib for RulesStorage;
|
|
19
20
|
using CallLib for address;
|
|
20
21
|
|
|
@@ -4,6 +4,7 @@ pragma solidity ^0.8.26;
|
|
|
4
4
|
import {KeyValue, SourceStamp} from "lens-modules/contracts/core/types/Types.sol";
|
|
5
5
|
import {ExtraStorageBased} from "lens-modules/contracts/core/base/ExtraStorageBased.sol";
|
|
6
6
|
import {ISource} from "lens-modules/contracts/core/interfaces/ISource.sol";
|
|
7
|
+
import {Errors} from "lens-modules/contracts/core/types/Errors.sol";
|
|
7
8
|
|
|
8
9
|
abstract contract SourceStampBased is ExtraStorageBased {
|
|
9
10
|
/// @custom:keccak lens.param.sourceStamp
|
|
@@ -30,7 +31,7 @@ abstract contract SourceStampBased is ExtraStorageBased {
|
|
|
30
31
|
for (uint256 i = 0; i < customParams.length; i++) {
|
|
31
32
|
if (customParams[i].key == PARAM__SOURCE_STAMP) {
|
|
32
33
|
SourceStamp memory sourceStamp = abi.decode(customParams[i].value, (SourceStamp));
|
|
33
|
-
require(sourceStamp.originalMsgSender == msg.sender);
|
|
34
|
+
require(sourceStamp.originalMsgSender == msg.sender, Errors.InvalidSourceStampOriginalMsgSender());
|
|
34
35
|
ISource(sourceStamp.source).validateSource(sourceStamp);
|
|
35
36
|
return sourceStamp.source;
|
|
36
37
|
}
|
|
@@ -121,7 +121,7 @@ interface IFeed is IMetadataBased {
|
|
|
121
121
|
|
|
122
122
|
function initialize(string memory metadataURI, IAccessControl accessControl) external;
|
|
123
123
|
|
|
124
|
-
function changeFeedRules(RuleChange[] calldata ruleChanges) external;
|
|
124
|
+
function changeFeedRules(RuleChange[] calldata ruleChanges) external payable;
|
|
125
125
|
|
|
126
126
|
function createPost(
|
|
127
127
|
CreatePostParams calldata postParams,
|
|
@@ -129,7 +129,7 @@ interface IFeed is IMetadataBased {
|
|
|
129
129
|
RuleProcessingParams[] calldata feedRulesParams,
|
|
130
130
|
RuleProcessingParams[] calldata rootPostRulesParams,
|
|
131
131
|
RuleProcessingParams[] calldata quotedPostRulesParams
|
|
132
|
-
) external returns (uint256);
|
|
132
|
+
) external payable returns (uint256);
|
|
133
133
|
|
|
134
134
|
function editPost(
|
|
135
135
|
uint256 postId,
|
|
@@ -138,19 +138,19 @@ interface IFeed is IMetadataBased {
|
|
|
138
138
|
RuleProcessingParams[] calldata feedRulesParams,
|
|
139
139
|
RuleProcessingParams[] calldata rootPostRulesParams,
|
|
140
140
|
RuleProcessingParams[] calldata quotedPostRulesParams
|
|
141
|
-
) external;
|
|
141
|
+
) external payable;
|
|
142
142
|
|
|
143
143
|
function deletePost(
|
|
144
144
|
uint256 postId,
|
|
145
145
|
KeyValue[] calldata customParams,
|
|
146
146
|
RuleProcessingParams[] calldata feedRulesParams
|
|
147
|
-
) external;
|
|
147
|
+
) external payable;
|
|
148
148
|
|
|
149
149
|
function changePostRules(
|
|
150
150
|
uint256 postId,
|
|
151
151
|
RuleChange[] calldata ruleChanges,
|
|
152
152
|
RuleProcessingParams[] calldata feedRulesParams
|
|
153
|
-
) external;
|
|
153
|
+
) external payable;
|
|
154
154
|
|
|
155
155
|
function setExtraData(KeyValue[] calldata extraDataToSet) external;
|
|
156
156
|
|
|
@@ -68,13 +68,13 @@ interface IGraph is IMetadataBased {
|
|
|
68
68
|
|
|
69
69
|
function initialize(string memory metadataURI, IAccessControl accessControl) external;
|
|
70
70
|
|
|
71
|
-
function changeGraphRules(RuleChange[] calldata ruleChanges) external;
|
|
71
|
+
function changeGraphRules(RuleChange[] calldata ruleChanges) external payable;
|
|
72
72
|
|
|
73
73
|
function changeFollowRules(
|
|
74
74
|
address account,
|
|
75
75
|
RuleChange[] calldata ruleChanges,
|
|
76
76
|
RuleProcessingParams[] calldata graphRulesProcessingParams
|
|
77
|
-
) external;
|
|
77
|
+
) external payable;
|
|
78
78
|
|
|
79
79
|
function follow(
|
|
80
80
|
address followerAccount,
|
|
@@ -83,14 +83,14 @@ interface IGraph is IMetadataBased {
|
|
|
83
83
|
RuleProcessingParams[] calldata graphRulesProcessingParams,
|
|
84
84
|
RuleProcessingParams[] calldata followRulesProcessingParams,
|
|
85
85
|
KeyValue[] calldata extraData
|
|
86
|
-
) external returns (uint256);
|
|
86
|
+
) external payable returns (uint256);
|
|
87
87
|
|
|
88
88
|
function unfollow(
|
|
89
89
|
address followerAccount,
|
|
90
90
|
address accountToUnfollow,
|
|
91
91
|
KeyValue[] calldata customParams,
|
|
92
92
|
RuleProcessingParams[] calldata graphRulesProcessingParams
|
|
93
|
-
) external returns (uint256);
|
|
93
|
+
) external payable returns (uint256);
|
|
94
94
|
|
|
95
95
|
function setExtraData(KeyValue[] calldata extraDataToSet) external;
|
|
96
96
|
|
|
@@ -70,27 +70,27 @@ interface IGroup is IMetadataBased {
|
|
|
70
70
|
address account,
|
|
71
71
|
KeyValue[] calldata customParams,
|
|
72
72
|
RuleProcessingParams[] calldata ruleProcessingParams
|
|
73
|
-
) external;
|
|
73
|
+
) external payable;
|
|
74
74
|
|
|
75
75
|
function removeMember(
|
|
76
76
|
address account,
|
|
77
77
|
KeyValue[] calldata customParams,
|
|
78
78
|
RuleProcessingParams[] calldata ruleProcessingParams
|
|
79
|
-
) external;
|
|
79
|
+
) external payable;
|
|
80
80
|
|
|
81
81
|
function joinGroup(
|
|
82
82
|
address account,
|
|
83
83
|
KeyValue[] calldata customParams,
|
|
84
84
|
RuleProcessingParams[] calldata ruleProcessingParams
|
|
85
|
-
) external;
|
|
85
|
+
) external payable;
|
|
86
86
|
|
|
87
87
|
function leaveGroup(
|
|
88
88
|
address account,
|
|
89
89
|
KeyValue[] calldata customParams,
|
|
90
90
|
RuleProcessingParams[] calldata ruleProcessingParams
|
|
91
|
-
) external;
|
|
91
|
+
) external payable;
|
|
92
92
|
|
|
93
|
-
function changeGroupRules(RuleChange[] calldata ruleChanges) external;
|
|
93
|
+
function changeGroupRules(RuleChange[] calldata ruleChanges) external payable;
|
|
94
94
|
|
|
95
95
|
function setExtraData(KeyValue[] calldata extraDataToSet) external;
|
|
96
96
|
|
|
@@ -85,14 +85,14 @@ interface INamespace is IMetadataBased {
|
|
|
85
85
|
KeyValue[] calldata customParams,
|
|
86
86
|
RuleProcessingParams[] calldata ruleProcessingParams,
|
|
87
87
|
KeyValue[] calldata extraData
|
|
88
|
-
) external;
|
|
88
|
+
) external payable;
|
|
89
89
|
|
|
90
90
|
function removeUsername(
|
|
91
91
|
string calldata username,
|
|
92
92
|
KeyValue[] calldata customParams,
|
|
93
93
|
RuleProcessingParams[] calldata unassigningRuleProcessingParams,
|
|
94
94
|
RuleProcessingParams[] calldata removalRuleProcessingParams
|
|
95
|
-
) external;
|
|
95
|
+
) external payable;
|
|
96
96
|
|
|
97
97
|
function assignUsername(
|
|
98
98
|
address account,
|
|
@@ -101,13 +101,13 @@ interface INamespace is IMetadataBased {
|
|
|
101
101
|
RuleProcessingParams[] calldata unassignAccountRuleProcessingParams,
|
|
102
102
|
RuleProcessingParams[] calldata unassignUsernameRuleProcessingParams,
|
|
103
103
|
RuleProcessingParams[] calldata assignRuleProcessingParams
|
|
104
|
-
) external;
|
|
104
|
+
) external payable;
|
|
105
105
|
|
|
106
106
|
function unassignUsername(
|
|
107
107
|
string calldata username,
|
|
108
108
|
KeyValue[] calldata customParams,
|
|
109
109
|
RuleProcessingParams[] calldata ruleProcessingParams
|
|
110
|
-
) external;
|
|
110
|
+
) external payable;
|
|
111
111
|
|
|
112
112
|
function setUsernameExtraData(string memory username, KeyValue[] calldata extraDataToSet) external;
|
|
113
113
|
|
|
@@ -123,7 +123,7 @@ contract Feed is
|
|
|
123
123
|
RuleProcessingParams[] memory feedRulesParams,
|
|
124
124
|
RuleProcessingParams[] memory rootPostRulesParams,
|
|
125
125
|
RuleProcessingParams[] memory quotedPostRulesParams
|
|
126
|
-
) external virtual override returns (uint256) {
|
|
126
|
+
) external payable virtual override usingNativePaymentHelper returns (uint256) {
|
|
127
127
|
require(msg.sender == postParams.author, Errors.InvalidMsgSender());
|
|
128
128
|
(uint256 postId, uint256 localSequentialId, uint256 rootPostId) = Core._createPost(postParams);
|
|
129
129
|
_validateExpectedPostIdIfPresent(customParams, postId);
|
|
@@ -172,7 +172,7 @@ contract Feed is
|
|
|
172
172
|
RuleProcessingParams[] memory feedRulesParams,
|
|
173
173
|
RuleProcessingParams[] memory rootPostRulesParams,
|
|
174
174
|
RuleProcessingParams[] memory quotedPostRulesParams
|
|
175
|
-
) external virtual override {
|
|
175
|
+
) external payable virtual override usingNativePaymentHelper {
|
|
176
176
|
require(Core._postExists(postId), Errors.DoesNotExist());
|
|
177
177
|
address author = Core.$storage().posts[postId].author;
|
|
178
178
|
// You can have this if you want to allow moderator editing:
|
|
@@ -204,7 +204,7 @@ contract Feed is
|
|
|
204
204
|
uint256 postId,
|
|
205
205
|
KeyValue[] calldata customParams,
|
|
206
206
|
RuleProcessingParams[] calldata feedRulesParams
|
|
207
|
-
) external virtual override {
|
|
207
|
+
) external payable virtual override usingNativePaymentHelper {
|
|
208
208
|
require(Core._postExists(postId), Errors.DoesNotExist());
|
|
209
209
|
address author = Core.$storage().posts[postId].author;
|
|
210
210
|
require(msg.sender == author || _hasAccess(msg.sender, PID__REMOVE_POST), Errors.InvalidMsgSender());
|
|
@@ -40,7 +40,13 @@ abstract contract RuleBasedFeed is IFeed, RuleBasedPrimitive {
|
|
|
40
40
|
|
|
41
41
|
//////////////////////////// CONFIGURATION FUNCTIONS ////////////////////////////
|
|
42
42
|
|
|
43
|
-
function changeFeedRules(RuleChange[] calldata ruleChanges)
|
|
43
|
+
function changeFeedRules(RuleChange[] calldata ruleChanges)
|
|
44
|
+
external
|
|
45
|
+
payable
|
|
46
|
+
virtual
|
|
47
|
+
override
|
|
48
|
+
usingNativePaymentHelper
|
|
49
|
+
{
|
|
44
50
|
_changePrimitiveRules($feedRulesStorage(), ruleChanges);
|
|
45
51
|
}
|
|
46
52
|
|
|
@@ -48,7 +54,7 @@ abstract contract RuleBasedFeed is IFeed, RuleBasedPrimitive {
|
|
|
48
54
|
uint256 postId,
|
|
49
55
|
RuleChange[] calldata ruleChanges,
|
|
50
56
|
RuleProcessingParams[] calldata feedRulesParams
|
|
51
|
-
) external virtual override {
|
|
57
|
+
) external payable virtual override usingNativePaymentHelper {
|
|
52
58
|
_changeEntityRules($postRulesStorage(postId), postId, ruleChanges, feedRulesParams);
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -101,7 +101,7 @@ contract Graph is
|
|
|
101
101
|
RuleProcessingParams[] calldata graphRulesProcessingParams,
|
|
102
102
|
RuleProcessingParams[] calldata followRulesProcessingParams,
|
|
103
103
|
KeyValue[] calldata extraData
|
|
104
|
-
) external virtual override returns (uint256) {
|
|
104
|
+
) external payable virtual override usingNativePaymentHelper returns (uint256) {
|
|
105
105
|
require(msg.sender == followerAccount, Errors.InvalidMsgSender());
|
|
106
106
|
// If some implementation wants to allow followId specification, it can be implemented using customParams.
|
|
107
107
|
uint256 assignedFollowId = Core._follow(followerAccount, accountToFollow, 0, block.timestamp);
|
|
@@ -126,7 +126,7 @@ contract Graph is
|
|
|
126
126
|
address accountToUnfollow,
|
|
127
127
|
KeyValue[] calldata customParams,
|
|
128
128
|
RuleProcessingParams[] calldata graphRulesProcessingParams
|
|
129
|
-
) external virtual override returns (uint256) {
|
|
129
|
+
) external payable virtual override usingNativePaymentHelper returns (uint256) {
|
|
130
130
|
require(msg.sender == followerAccount, Errors.InvalidMsgSender());
|
|
131
131
|
uint256 followId = Core._unfollow(followerAccount, accountToUnfollow);
|
|
132
132
|
address source = _processSourceStamp(customParams);
|
|
@@ -39,7 +39,13 @@ abstract contract RuleBasedGraph is IGraph, RuleBasedPrimitive {
|
|
|
39
39
|
|
|
40
40
|
//////////////////////////// CONFIGURATION FUNCTIONS ////////////////////////////
|
|
41
41
|
|
|
42
|
-
function changeGraphRules(RuleChange[] calldata ruleChanges)
|
|
42
|
+
function changeGraphRules(RuleChange[] calldata ruleChanges)
|
|
43
|
+
external
|
|
44
|
+
payable
|
|
45
|
+
virtual
|
|
46
|
+
override
|
|
47
|
+
usingNativePaymentHelper
|
|
48
|
+
{
|
|
43
49
|
_changePrimitiveRules($graphRulesStorage(), ruleChanges);
|
|
44
50
|
}
|
|
45
51
|
|
|
@@ -47,7 +53,7 @@ abstract contract RuleBasedGraph is IGraph, RuleBasedPrimitive {
|
|
|
47
53
|
address account,
|
|
48
54
|
RuleChange[] calldata ruleChanges,
|
|
49
55
|
RuleProcessingParams[] calldata ruleChangesProcessingParams
|
|
50
|
-
) external virtual override {
|
|
56
|
+
) external payable virtual override usingNativePaymentHelper {
|
|
51
57
|
_changeEntityRules(
|
|
52
58
|
$followRulesStorage(account), uint256(uint160(account)), ruleChanges, ruleChangesProcessingParams
|
|
53
59
|
);
|
|
@@ -33,7 +33,13 @@ abstract contract RuleBasedGroup is IGroup, RuleBasedPrimitive {
|
|
|
33
33
|
|
|
34
34
|
//////////////////////////// CONFIGURATION FUNCTIONS ////////////////////////////
|
|
35
35
|
|
|
36
|
-
function changeGroupRules(RuleChange[] calldata ruleChanges)
|
|
36
|
+
function changeGroupRules(RuleChange[] calldata ruleChanges)
|
|
37
|
+
external
|
|
38
|
+
payable
|
|
39
|
+
virtual
|
|
40
|
+
override
|
|
41
|
+
usingNativePaymentHelper
|
|
42
|
+
{
|
|
37
43
|
_changePrimitiveRules($groupRulesStorage(), ruleChanges);
|
|
38
44
|
}
|
|
39
45
|
|