@zoralabs/comments-contracts 0.0.3 → 0.1.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/.turbo/turbo-build.log +55 -55
- package/CHANGELOG.md +8 -0
- package/abis/CommentsImpl.json +0 -5
- package/abis/CommentsPermitTest.json +2 -2
- package/abis/CommentsTest.json +7 -7
- package/abis/Comments_mintAndCommentTest.json +8 -1
- package/abis/Comments_smartWallet.json +4 -4
- package/abis/IComments.json +0 -5
- package/abis/Vm.json +1482 -111
- package/abis/VmSafe.json +856 -32
- package/dist/index.cjs +3 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/wagmiGenerated.d.ts +0 -4
- package/dist/wagmiGenerated.d.ts.map +1 -1
- package/package/wagmiGenerated.ts +0 -1
- package/package.json +4 -4
- package/script/storage-check.sh +1 -1
- package/src/CommentsImpl.sol +2 -20
- package/src/interfaces/IComments.sol +0 -3
- package/src/version/ContractVersionBase.sol +1 -1
- package/test/Comments.t.sol +4 -6
- package/test/Comments_delegateComment.t.sol +19 -2
- package/test/Comments_permit.t.sol +2 -2
- package/test/Comments_smartWallet.t.sol +2 -4
|
@@ -133,9 +133,6 @@ interface IComments {
|
|
|
133
133
|
/// @param actual The actual address that attempted to comment
|
|
134
134
|
error CommenterMismatch(address expected, address actual);
|
|
135
135
|
|
|
136
|
-
/// @notice Occurs when a non-token holder or non-admin attempts an action restricted to token holders or admins
|
|
137
|
-
error NotTokenHolderOrAdmin();
|
|
138
|
-
|
|
139
136
|
/// @notice Occurs when attempting to spark a comment without sending at least one spark
|
|
140
137
|
error MustSendAtLeastOneSpark();
|
|
141
138
|
|
|
@@ -9,6 +9,6 @@ import {IVersionedContract} from "@zoralabs/shared-contracts/interfaces/IVersion
|
|
|
9
9
|
contract ContractVersionBase is IVersionedContract {
|
|
10
10
|
/// @notice The version of the contract
|
|
11
11
|
function contractVersion() external pure override returns (string memory) {
|
|
12
|
-
return "0.0
|
|
12
|
+
return "0.1.0";
|
|
13
13
|
}
|
|
14
14
|
}
|
package/test/Comments.t.sol
CHANGED
|
@@ -470,14 +470,13 @@ contract CommentsTest is CommentsTestBase {
|
|
|
470
470
|
postComment(commenter, address(mock1155), tokenId1, "", emptyCommentIdentifier);
|
|
471
471
|
}
|
|
472
472
|
|
|
473
|
-
function
|
|
473
|
+
function testNonHolderCanCommentWithSpark() public {
|
|
474
474
|
address nonHolder = makeAddr("nonHolder");
|
|
475
475
|
|
|
476
|
-
// We don't set up the commenter with a token,
|
|
476
|
+
// We don't set up the commenter with a token, but they should be able to comment with a spark
|
|
477
477
|
vm.deal(nonHolder, SPARKS_VALUE);
|
|
478
478
|
|
|
479
|
-
|
|
480
|
-
postComment(nonHolder, address(mock1155), tokenId1, "Attempting to comment without holding token", emptyCommentIdentifier);
|
|
479
|
+
postComment(nonHolder, address(mock1155), tokenId1, "Commenting without holding token", emptyCommentIdentifier);
|
|
481
480
|
}
|
|
482
481
|
|
|
483
482
|
function testCommentRevertsWhenSendTooMuchValue() public {
|
|
@@ -674,11 +673,10 @@ contract CommentsTest is CommentsTestBase {
|
|
|
674
673
|
comments.comment(commenter, address(mockCoin), tokenId0, "test comment", emptyCommentIdentifier, address(0), address(0));
|
|
675
674
|
}
|
|
676
675
|
|
|
677
|
-
function
|
|
676
|
+
function testNonCoinHolderCanCommentWithSpark() public {
|
|
678
677
|
address nonHolder = makeAddr("nonHolder");
|
|
679
678
|
vm.deal(nonHolder, SPARKS_VALUE);
|
|
680
679
|
|
|
681
|
-
vm.expectRevert(abi.encodeWithSignature("NotTokenHolderOrAdmin()"));
|
|
682
680
|
vm.prank(nonHolder);
|
|
683
681
|
comments.comment{value: SPARKS_VALUE}(nonHolder, address(mockCoin), tokenId0, "test comment", emptyCommentIdentifier, address(0), address(0));
|
|
684
682
|
}
|
|
@@ -120,10 +120,27 @@ contract Comments_mintAndCommentTest is Test {
|
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
function
|
|
123
|
+
function test_delegateComment_nonOwnerCanCommentWithSpark() public {
|
|
124
124
|
address notOwner = makeAddr("notOwner");
|
|
125
125
|
vm.prank(notOwner);
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
mockDelegateCommenter.forwardComment(address(mock1155), tokenId1, "test");
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
function test_delegateComment_canCommentWithZeroSparks() public {
|
|
131
|
+
// Delegate commenter should be able to comment with 0 spark value
|
|
132
|
+
vm.prank(commenter);
|
|
133
|
+
mockDelegateCommenter.forwardComment(address(mock1155), tokenId1, "test comment with 0 sparks");
|
|
134
|
+
|
|
135
|
+
// Verify the comment was created successfully
|
|
136
|
+
IComments.CommentIdentifier memory expectedCommentIdentifier = IComments.CommentIdentifier({
|
|
137
|
+
commenter: commenter,
|
|
138
|
+
contractAddress: address(mock1155),
|
|
139
|
+
tokenId: tokenId1,
|
|
140
|
+
nonce: bytes32(0)
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
(, bool exists) = comments.hashAndCheckCommentExists(expectedCommentIdentifier);
|
|
144
|
+
assertTrue(exists, "Comment should exist");
|
|
145
|
+
}
|
|
129
146
|
}
|
|
@@ -124,13 +124,13 @@ contract CommentsPermitTest is CommentsTestBase {
|
|
|
124
124
|
_assertCommentExists(expectedCommentIdentifier);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
function
|
|
127
|
+
function testPermitComment_Non1155HolderCanCommentWithSpark() public {
|
|
128
128
|
IComments.PermitComment memory permitComment = _createPermitComment(collectorWithToken, "test comment");
|
|
129
129
|
bytes memory signature = _signPermitComment(permitComment, collectorWithTokenPrivateKey);
|
|
130
130
|
|
|
131
131
|
address executor = makeAddr("executor");
|
|
132
132
|
vm.deal(executor, SPARKS_VALUE);
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
_executePermitComment(executor, permitComment, signature);
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -90,12 +90,11 @@ contract Comments_smartWallet is CommentsTestBase {
|
|
|
90
90
|
assertTrue(exists);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
function
|
|
93
|
+
function test_commentWithSmartWalletOwner_canCommentWithSpark() public {
|
|
94
94
|
address smartWallet = address(new MockMultiOwnable(address(collectorWithoutToken)));
|
|
95
95
|
|
|
96
96
|
IComments.CommentIdentifier memory emptyReplyTo;
|
|
97
97
|
|
|
98
|
-
vm.expectRevert(abi.encodeWithSelector(IComments.NotTokenHolderOrAdmin.selector));
|
|
99
98
|
vm.prank(collectorWithoutToken);
|
|
100
99
|
vm.deal(collectorWithoutToken, SPARKS_VALUE);
|
|
101
100
|
comments.comment{value: SPARKS_VALUE}({
|
|
@@ -193,10 +192,9 @@ contract Comments_smartWallet is CommentsTestBase {
|
|
|
193
192
|
assertTrue(exists);
|
|
194
193
|
}
|
|
195
194
|
|
|
196
|
-
function
|
|
195
|
+
function test_commentWithSmartWalletOwner_nonCoinHolderCanCommentWithSpark() public {
|
|
197
196
|
address smartWallet = address(new MockMultiOwnable(address(collectorWithoutToken)));
|
|
198
197
|
|
|
199
|
-
vm.expectRevert(abi.encodeWithSelector(IComments.NotTokenHolderOrAdmin.selector));
|
|
200
198
|
vm.prank(collectorWithoutToken);
|
|
201
199
|
vm.deal(collectorWithoutToken, SPARKS_VALUE);
|
|
202
200
|
comments.comment{value: SPARKS_VALUE}({
|