@zoralabs/comments-contracts 0.0.3 → 0.1.1
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/.abi-stability +225 -0
- package/.env.example +0 -1
- package/.turbo/turbo-build$colon$js.log +416 -0
- package/CHANGELOG.md +16 -0
- package/abis/CommentsImpl.json +0 -5
- package/abis/IComments.json +0 -5
- package/abis/Vm.json +1482 -111
- package/abis/{MockMultiOwnable.json → VmContractHelper121.json} +119 -98
- package/abis/VmContractHelper135.json +233 -0
- package/abis/VmContractHelper98.json +233 -0
- 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/foundry.toml +1 -0
- package/package/wagmiGenerated.ts +0 -1
- package/package.json +11 -7
- package/script/CommentsDeployerBase.sol +1 -1
- 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
- package/.turbo/turbo-build.log +0 -84
- package/abis/AddDelegateCommenterRole.json +0 -9
- package/abis/CallerAndCommenterMintAndCommentTest.json +0 -771
- package/abis/CallerAndCommenterSwapAndCommentTest.json +0 -844
- package/abis/CommentsPermitTest.json +0 -867
- package/abis/CommentsTest.json +0 -1062
- package/abis/Comments_mintAndCommentTest.json +0 -697
- package/abis/Comments_smartWallet.json +0 -746
- package/abis/DeployCallerAndCommenterImpl.json +0 -9
- package/abis/DeployImpl.json +0 -9
- package/abis/DeployNonDeterministic.json +0 -9
- package/abis/DeployScript.json +0 -9
- package/abis/ERC1155Holder.json +0 -99
- package/abis/GenerateDeterministicParams.json +0 -9
- package/test/CallerAndCommenter_mintAndComment.t copy.sol +0 -214
package/src/CommentsImpl.sol
CHANGED
|
@@ -142,7 +142,7 @@ contract CommentsImpl is
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
/// @notice Creates a new comment. Equivalant sparks value in eth must be sent with the transaction.
|
|
145
|
+
/// @notice Creates a new comment. Equivalant sparks value in eth must be sent with the transaction.
|
|
146
146
|
/// If not the owner, must send 1 spark.
|
|
147
147
|
/// @param contractAddress The address of the contract
|
|
148
148
|
/// @param tokenId The token ID
|
|
@@ -309,13 +309,7 @@ contract CommentsImpl is
|
|
|
309
309
|
) {
|
|
310
310
|
return;
|
|
311
311
|
}
|
|
312
|
-
// if they aren't
|
|
313
|
-
if (
|
|
314
|
-
!_accountOrSmartWalletIsTokenHolder(commentIdentifier.contractAddress, commentIdentifier.tokenId, commentIdentifier.commenter, commenterSmartWallet)
|
|
315
|
-
) {
|
|
316
|
-
revert NotTokenHolderOrAdmin();
|
|
317
|
-
}
|
|
318
|
-
|
|
312
|
+
// if they aren't an admin, they must include at least 1 spark
|
|
319
313
|
if (mustSendAtLeastOneSpark && sparksQuantity == 0) {
|
|
320
314
|
revert MustSendAtLeastOneSpark();
|
|
321
315
|
}
|
|
@@ -376,18 +370,6 @@ contract CommentsImpl is
|
|
|
376
370
|
}
|
|
377
371
|
}
|
|
378
372
|
|
|
379
|
-
function _accountOrSmartWalletIsTokenHolder(address contractAddress, uint256 tokenId, address user, address smartWallet) internal view returns (bool) {
|
|
380
|
-
bool isCoin = _isCoinComment(contractAddress, tokenId);
|
|
381
|
-
|
|
382
|
-
if (isCoin) {
|
|
383
|
-
return
|
|
384
|
-
ICoinComments(contractAddress).balanceOf(user) >= 1e18 ||
|
|
385
|
-
(smartWallet != address(0) && ICoinComments(contractAddress).balanceOf(smartWallet) >= 1e18);
|
|
386
|
-
} else {
|
|
387
|
-
return _isTokenHolder(contractAddress, tokenId, user) || (smartWallet != address(0) && _isTokenHolder(contractAddress, tokenId, smartWallet));
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
373
|
function _isTokenAdmin(address contractAddress, uint256 tokenId, address user) internal view returns (bool) {
|
|
392
374
|
try IZoraCreator1155(contractAddress).isAdminOrRole(user, tokenId, PERMISSION_BIT_ADMIN) returns (bool isAdmin) {
|
|
393
375
|
return isAdmin;
|
|
@@ -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.
|
|
12
|
+
return "0.1.1";
|
|
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}({
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @zoralabs/comments-contracts@0.0.3 build /home/runner/work/zora-protocol-private/zora-protocol-private/packages/comments
|
|
3
|
-
> pnpm run wagmi:generate && pnpm run copy-abis && pnpm run prettier:write && tsup
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
> @zoralabs/comments-contracts@0.0.3 wagmi:generate /home/runner/work/zora-protocol-private/zora-protocol-private/packages/comments
|
|
7
|
-
> FOUNDRY_PROFILE=dev forge build && wagmi generate && pnpm exec rename-generated-abi-casing ./package/wagmiGenerated.ts
|
|
8
|
-
|
|
9
|
-
Compiling 121 files with Solc 0.8.23
|
|
10
|
-
Solc 0.8.23 finished in 65.77s
|
|
11
|
-
Compiler run successful!
|
|
12
|
-
[33m-[39m Validating plugins
|
|
13
|
-
[32m✔[39m Validating plugins
|
|
14
|
-
[33m-[39m Resolving contracts
|
|
15
|
-
[32m✔[39m Resolving contracts
|
|
16
|
-
[33m-[39m Running plugins
|
|
17
|
-
[32m✔[39m Running plugins
|
|
18
|
-
[33m-[39m Writing to [90mpackage/wagmiGenerated.ts[39m
|
|
19
|
-
[32m✔[39m Writing to [90mpackage/wagmiGenerated.ts[39m
|
|
20
|
-
🔄 Processing 1 file(s) to replace 'Abi' with 'ABI'...
|
|
21
|
-
📝 Processing ./package/wagmiGenerated.ts...
|
|
22
|
-
✅ Updated ./package/wagmiGenerated.ts (2 replacements)
|
|
23
|
-
✨ All files processed successfully!
|
|
24
|
-
|
|
25
|
-
> @zoralabs/comments-contracts@0.0.3 copy-abis /home/runner/work/zora-protocol-private/zora-protocol-private/packages/comments
|
|
26
|
-
> pnpm exec bundle-abis
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
> @zoralabs/comments-contracts@0.0.3 prettier:write /home/runner/work/zora-protocol-private/zora-protocol-private/packages/comments
|
|
30
|
-
> prettier --write 'src/**/*.sol' 'test/**/*.sol' 'script/**/*.sol'
|
|
31
|
-
|
|
32
|
-
src/CommentsImpl.sol 828ms (unchanged)
|
|
33
|
-
src/CommentsImplConstants.sol 23ms (unchanged)
|
|
34
|
-
src/interfaces/ICallerAndCommenter.sol 30ms (unchanged)
|
|
35
|
-
src/interfaces/ICoinComments.sol 5ms (unchanged)
|
|
36
|
-
src/interfaces/IComments.sol 35ms (unchanged)
|
|
37
|
-
src/interfaces/IMultiOwnable.sol 2ms (unchanged)
|
|
38
|
-
src/interfaces/ISecondarySwap.sol 15ms (unchanged)
|
|
39
|
-
src/interfaces/IZoraCreator1155.sol 4ms (unchanged)
|
|
40
|
-
src/interfaces/IZoraCreator1155TypesV1.sol 14ms (unchanged)
|
|
41
|
-
src/interfaces/IZoraTimedSaleStrategy.sol 4ms (unchanged)
|
|
42
|
-
src/proxy/CallerAndCommenter.sol 8ms (unchanged)
|
|
43
|
-
src/proxy/Comments.sol 13ms (unchanged)
|
|
44
|
-
src/utils/CallerAndCommenterImpl.sol 140ms (unchanged)
|
|
45
|
-
src/utils/EIP712UpgradeableWithChainId.sol 13ms (unchanged)
|
|
46
|
-
src/version/ContractVersionBase.sol 2ms (unchanged)
|
|
47
|
-
test/CallerAndCommenter_mintAndComment.t copy.sol 129ms (unchanged)
|
|
48
|
-
test/CallerAndCommenter_swapAndComment.t.sol 272ms (unchanged)
|
|
49
|
-
test/CallerAndCommenterTestBase.sol 50ms (unchanged)
|
|
50
|
-
test/Comments_delegateComment.t.sol 86ms (unchanged)
|
|
51
|
-
test/Comments_permit.t.sol 194ms (unchanged)
|
|
52
|
-
test/Comments_smartWallet.t.sol 89ms (unchanged)
|
|
53
|
-
test/Comments.t.sol 411ms (unchanged)
|
|
54
|
-
test/CommentsTestBase.sol 66ms (unchanged)
|
|
55
|
-
test/mocks/Mock1155.sol 29ms (unchanged)
|
|
56
|
-
test/mocks/Mock1155NoCreatorRewardRecipient.sol 19ms (unchanged)
|
|
57
|
-
test/mocks/Mock1155NoOwner.sol 14ms (unchanged)
|
|
58
|
-
test/mocks/MockCoin.sol 14ms (unchanged)
|
|
59
|
-
test/mocks/MockDelegateCommenter.sol 25ms (unchanged)
|
|
60
|
-
test/mocks/MockIZoraCreator1155.sol 3ms (unchanged)
|
|
61
|
-
test/mocks/MockSecondarySwap.sol 20ms (unchanged)
|
|
62
|
-
test/mocks/MockZoraTimedSale.sol 26ms (unchanged)
|
|
63
|
-
test/mocks/ProtocolRewards.sol 362ms (unchanged)
|
|
64
|
-
script/AddDelegateCommenterRole.s.sol 10ms (unchanged)
|
|
65
|
-
script/CommentsDeployerBase.sol 60ms (unchanged)
|
|
66
|
-
script/Deploy.s.sol 7ms (unchanged)
|
|
67
|
-
script/DeployCallerAndCommenterImpl.s.sol 16ms (unchanged)
|
|
68
|
-
script/DeployImpl.s.sol 16ms (unchanged)
|
|
69
|
-
script/DeployNonDeterministic.s.sol 21ms (unchanged)
|
|
70
|
-
script/GenerateDeterministicParams.s.sol 25ms (unchanged)
|
|
71
|
-
CLI Building entry: package/index.ts
|
|
72
|
-
CLI Using tsconfig: tsconfig.json
|
|
73
|
-
CLI tsup v7.3.0
|
|
74
|
-
CLI Using tsup config: /home/runner/work/zora-protocol-private/zora-protocol-private/packages/comments/tsup.config.ts
|
|
75
|
-
CLI Target: es2021
|
|
76
|
-
CLI Cleaning output folder
|
|
77
|
-
CJS Build start
|
|
78
|
-
ESM Build start
|
|
79
|
-
ESM dist/index.js 47.94 KB
|
|
80
|
-
ESM dist/index.js.map 83.57 KB
|
|
81
|
-
ESM ⚡️ Build success in 23ms
|
|
82
|
-
CJS dist/index.cjs 49.03 KB
|
|
83
|
-
CJS dist/index.cjs.map 83.85 KB
|
|
84
|
-
CJS ⚡️ Build success in 25ms
|