@zoralabs/coins 2.3.0 → 2.4.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.
Files changed (72) hide show
  1. package/.turbo/turbo-build$colon$js.log +119 -101
  2. package/CHANGELOG.md +31 -1
  3. package/README.md +1 -0
  4. package/abis/AddressConstants.json +7 -0
  5. package/abis/BaseTest.json +65 -3
  6. package/abis/BuySupplyWithV4SwapHook.json +429 -0
  7. package/abis/FeeEstimatorHook.json +23 -0
  8. package/abis/ITrustedMsgSenderProviderLookup.json +21 -0
  9. package/abis/IUniswapV4Router04.json +484 -0
  10. package/abis/IZoraV4CoinHook.json +5 -0
  11. package/abis/MockAirlock.json +39 -0
  12. package/abis/SimpleERC20.json +326 -0
  13. package/abis/TrustedMsgSenderProviderLookup.json +215 -0
  14. package/abis/VmContractHelper242.json +233 -0
  15. package/abis/ZoraV4CoinHook.json +21 -3
  16. package/addresses/8453.json +7 -9
  17. package/audits/report-cantinacode-zora-1021.pdf +0 -0
  18. package/dist/index.cjs +140 -19
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.js +139 -18
  21. package/dist/index.js.map +1 -1
  22. package/dist/wagmiGenerated.d.ts +205 -28
  23. package/dist/wagmiGenerated.d.ts.map +1 -1
  24. package/foundry.toml +5 -1
  25. package/package/wagmiGenerated.ts +139 -18
  26. package/package.json +3 -3
  27. package/script/DeployPostDeploymentHooks.s.sol +1 -3
  28. package/script/DeployTrustedMsgSenderLookup.s.sol +20 -0
  29. package/src/deployment/CoinsDeployerBase.sol +31 -9
  30. package/src/hooks/ZoraV4CoinHook.sol +19 -55
  31. package/src/hooks/deployment/BuySupplyWithV4SwapHook.sol +310 -0
  32. package/src/interfaces/ITrustedMsgSenderProviderLookup.sol +18 -0
  33. package/src/interfaces/IZoraV4CoinHook.sol +3 -0
  34. package/src/libs/HooksDeployment.sol +9 -8
  35. package/src/libs/V4Liquidity.sol +50 -6
  36. package/src/utils/AutoSwapper.sol +1 -1
  37. package/src/utils/TrustedMsgSenderProviderLookup.sol +73 -0
  38. package/src/version/ContractVersionBase.sol +1 -1
  39. package/test/BuySupplyWithV4SwapHook.t.sol +509 -0
  40. package/test/Coin.t.sol +21 -9
  41. package/test/CoinUniV4.t.sol +1 -2
  42. package/test/ContentCoinRewards.t.sol +1 -3
  43. package/test/CreatorCoin.t.sol +1 -4
  44. package/test/CreatorCoinRewards.t.sol +5 -3
  45. package/test/Factory.t.sol +3 -3
  46. package/test/HooksDeployment.t.sol +58 -6
  47. package/test/LiquidityMigration.t.sol +6 -2
  48. package/test/MultiOwnable.t.sol +4 -4
  49. package/test/TrustedMsgSenderProviderLookup.t.sol +112 -0
  50. package/test/Upgrades.t.sol +41 -27
  51. package/test/ZoraHookRegistry.t.sol +19 -9
  52. package/test/mocks/MockAirlock.sol +22 -0
  53. package/test/mocks/SimpleERC20.sol +8 -0
  54. package/test/utils/BaseTest.sol +185 -6
  55. package/test/utils/FeeEstimatorHook.sol +3 -1
  56. package/test/utils/TrustedSenderTestHelper.sol +18 -0
  57. package/test/utils/hookmate/README.md +50 -0
  58. package/test/utils/hookmate/artifacts/DeployHelper.sol +20 -0
  59. package/test/utils/hookmate/artifacts/Permit2.sol +16 -0
  60. package/test/utils/hookmate/artifacts/UniversalRouter.sol +29 -0
  61. package/test/utils/hookmate/artifacts/V4PoolManager.sol +17 -0
  62. package/test/utils/hookmate/artifacts/V4PositionManager.sol +23 -0
  63. package/test/utils/hookmate/artifacts/V4Quoter.sol +17 -0
  64. package/test/utils/hookmate/artifacts/V4Router.sol +18 -0
  65. package/test/utils/hookmate/constants/AddressConstants.sol +193 -0
  66. package/test/utils/hookmate/interfaces/router/IUniswapV4Router04.sol +173 -0
  67. package/test/utils/hookmate/interfaces/router/PathKey.sol +34 -0
  68. package/test/utils/hookmate/test/utils/SwapFeeEventAsserter.sol +24 -0
  69. package/wagmi.config.ts +1 -1
  70. package/src/utils/uniswap/BytesLib.sol +0 -35
  71. package/src/utils/uniswap/Path.sol +0 -31
  72. /package/abis/{VmContractHelper226.json → VmContractHelper235.json} +0 -0
@@ -0,0 +1,429 @@
1
+ [
2
+ {
3
+ "type": "constructor",
4
+ "inputs": [
5
+ {
6
+ "name": "_factory",
7
+ "type": "address",
8
+ "internalType": "contract IZoraFactory"
9
+ },
10
+ {
11
+ "name": "_swapRouter",
12
+ "type": "address",
13
+ "internalType": "address"
14
+ },
15
+ {
16
+ "name": "_poolManager",
17
+ "type": "address",
18
+ "internalType": "address"
19
+ }
20
+ ],
21
+ "stateMutability": "nonpayable"
22
+ },
23
+ {
24
+ "type": "function",
25
+ "name": "afterCoinDeploy",
26
+ "inputs": [
27
+ {
28
+ "name": "sender",
29
+ "type": "address",
30
+ "internalType": "address"
31
+ },
32
+ {
33
+ "name": "coin",
34
+ "type": "address",
35
+ "internalType": "contract ICoin"
36
+ },
37
+ {
38
+ "name": "hookData",
39
+ "type": "bytes",
40
+ "internalType": "bytes"
41
+ }
42
+ ],
43
+ "outputs": [
44
+ {
45
+ "name": "",
46
+ "type": "bytes",
47
+ "internalType": "bytes"
48
+ }
49
+ ],
50
+ "stateMutability": "payable"
51
+ },
52
+ {
53
+ "type": "function",
54
+ "name": "decodeV4RouteData",
55
+ "inputs": [
56
+ {
57
+ "name": "data",
58
+ "type": "bytes",
59
+ "internalType": "bytes"
60
+ }
61
+ ],
62
+ "outputs": [
63
+ {
64
+ "name": "v4Route",
65
+ "type": "tuple[]",
66
+ "internalType": "struct PoolKey[]",
67
+ "components": [
68
+ {
69
+ "name": "currency0",
70
+ "type": "address",
71
+ "internalType": "Currency"
72
+ },
73
+ {
74
+ "name": "currency1",
75
+ "type": "address",
76
+ "internalType": "Currency"
77
+ },
78
+ {
79
+ "name": "fee",
80
+ "type": "uint24",
81
+ "internalType": "uint24"
82
+ },
83
+ {
84
+ "name": "tickSpacing",
85
+ "type": "int24",
86
+ "internalType": "int24"
87
+ },
88
+ {
89
+ "name": "hooks",
90
+ "type": "address",
91
+ "internalType": "contract IHooks"
92
+ }
93
+ ]
94
+ },
95
+ {
96
+ "name": "startAmount",
97
+ "type": "uint256",
98
+ "internalType": "uint256"
99
+ }
100
+ ],
101
+ "stateMutability": "pure"
102
+ },
103
+ {
104
+ "type": "function",
105
+ "name": "encodeBuySupplyWithV4SwapHookData",
106
+ "inputs": [
107
+ {
108
+ "name": "params",
109
+ "type": "tuple",
110
+ "internalType": "struct BuySupplyWithV4SwapHook.InitialSupplyParams",
111
+ "components": [
112
+ {
113
+ "name": "buyRecipient",
114
+ "type": "address",
115
+ "internalType": "address"
116
+ },
117
+ {
118
+ "name": "v3Route",
119
+ "type": "bytes",
120
+ "internalType": "bytes"
121
+ },
122
+ {
123
+ "name": "v4Route",
124
+ "type": "tuple[]",
125
+ "internalType": "struct PoolKey[]",
126
+ "components": [
127
+ {
128
+ "name": "currency0",
129
+ "type": "address",
130
+ "internalType": "Currency"
131
+ },
132
+ {
133
+ "name": "currency1",
134
+ "type": "address",
135
+ "internalType": "Currency"
136
+ },
137
+ {
138
+ "name": "fee",
139
+ "type": "uint24",
140
+ "internalType": "uint24"
141
+ },
142
+ {
143
+ "name": "tickSpacing",
144
+ "type": "int24",
145
+ "internalType": "int24"
146
+ },
147
+ {
148
+ "name": "hooks",
149
+ "type": "address",
150
+ "internalType": "contract IHooks"
151
+ }
152
+ ]
153
+ },
154
+ {
155
+ "name": "inputCurrency",
156
+ "type": "address",
157
+ "internalType": "address"
158
+ },
159
+ {
160
+ "name": "inputAmount",
161
+ "type": "uint256",
162
+ "internalType": "uint256"
163
+ },
164
+ {
165
+ "name": "minAmountOut",
166
+ "type": "uint256",
167
+ "internalType": "uint256"
168
+ }
169
+ ]
170
+ }
171
+ ],
172
+ "outputs": [
173
+ {
174
+ "name": "",
175
+ "type": "bytes",
176
+ "internalType": "bytes"
177
+ }
178
+ ],
179
+ "stateMutability": "pure"
180
+ },
181
+ {
182
+ "type": "function",
183
+ "name": "factory",
184
+ "inputs": [],
185
+ "outputs": [
186
+ {
187
+ "name": "",
188
+ "type": "address",
189
+ "internalType": "contract IZoraFactory"
190
+ }
191
+ ],
192
+ "stateMutability": "view"
193
+ },
194
+ {
195
+ "type": "function",
196
+ "name": "poolManager",
197
+ "inputs": [],
198
+ "outputs": [
199
+ {
200
+ "name": "",
201
+ "type": "address",
202
+ "internalType": "contract IPoolManager"
203
+ }
204
+ ],
205
+ "stateMutability": "view"
206
+ },
207
+ {
208
+ "type": "function",
209
+ "name": "supportsInterface",
210
+ "inputs": [
211
+ {
212
+ "name": "interfaceId",
213
+ "type": "bytes4",
214
+ "internalType": "bytes4"
215
+ }
216
+ ],
217
+ "outputs": [
218
+ {
219
+ "name": "",
220
+ "type": "bool",
221
+ "internalType": "bool"
222
+ }
223
+ ],
224
+ "stateMutability": "pure"
225
+ },
226
+ {
227
+ "type": "function",
228
+ "name": "swapRouter",
229
+ "inputs": [],
230
+ "outputs": [
231
+ {
232
+ "name": "",
233
+ "type": "address",
234
+ "internalType": "contract ISwapRouter"
235
+ }
236
+ ],
237
+ "stateMutability": "view"
238
+ },
239
+ {
240
+ "type": "function",
241
+ "name": "unlockCallback",
242
+ "inputs": [
243
+ {
244
+ "name": "data",
245
+ "type": "bytes",
246
+ "internalType": "bytes"
247
+ }
248
+ ],
249
+ "outputs": [
250
+ {
251
+ "name": "",
252
+ "type": "bytes",
253
+ "internalType": "bytes"
254
+ }
255
+ ],
256
+ "stateMutability": "nonpayable"
257
+ },
258
+ {
259
+ "type": "event",
260
+ "name": "BuyInitialSupply",
261
+ "inputs": [
262
+ {
263
+ "name": "coin",
264
+ "type": "address",
265
+ "indexed": true,
266
+ "internalType": "address"
267
+ },
268
+ {
269
+ "name": "recipient",
270
+ "type": "address",
271
+ "indexed": true,
272
+ "internalType": "address"
273
+ },
274
+ {
275
+ "name": "coinsPurchased",
276
+ "type": "uint256",
277
+ "indexed": true,
278
+ "internalType": "uint256"
279
+ },
280
+ {
281
+ "name": "v3Route",
282
+ "type": "bytes",
283
+ "indexed": false,
284
+ "internalType": "bytes"
285
+ },
286
+ {
287
+ "name": "v4Route",
288
+ "type": "tuple[]",
289
+ "indexed": false,
290
+ "internalType": "struct PoolKey[]",
291
+ "components": [
292
+ {
293
+ "name": "currency0",
294
+ "type": "address",
295
+ "internalType": "Currency"
296
+ },
297
+ {
298
+ "name": "currency1",
299
+ "type": "address",
300
+ "internalType": "Currency"
301
+ },
302
+ {
303
+ "name": "fee",
304
+ "type": "uint24",
305
+ "internalType": "uint24"
306
+ },
307
+ {
308
+ "name": "tickSpacing",
309
+ "type": "int24",
310
+ "internalType": "int24"
311
+ },
312
+ {
313
+ "name": "hooks",
314
+ "type": "address",
315
+ "internalType": "contract IHooks"
316
+ }
317
+ ]
318
+ },
319
+ {
320
+ "name": "inputCurrency",
321
+ "type": "address",
322
+ "indexed": false,
323
+ "internalType": "address"
324
+ },
325
+ {
326
+ "name": "inputAmount",
327
+ "type": "uint256",
328
+ "indexed": false,
329
+ "internalType": "uint256"
330
+ },
331
+ {
332
+ "name": "v4SwapInput",
333
+ "type": "uint256",
334
+ "indexed": false,
335
+ "internalType": "uint256"
336
+ }
337
+ ],
338
+ "anonymous": false
339
+ },
340
+ {
341
+ "type": "error",
342
+ "name": "AddressEmptyCode",
343
+ "inputs": [
344
+ {
345
+ "name": "target",
346
+ "type": "address",
347
+ "internalType": "address"
348
+ }
349
+ ]
350
+ },
351
+ {
352
+ "type": "error",
353
+ "name": "AddressInsufficientBalance",
354
+ "inputs": [
355
+ {
356
+ "name": "account",
357
+ "type": "address",
358
+ "internalType": "address"
359
+ }
360
+ ]
361
+ },
362
+ {
363
+ "type": "error",
364
+ "name": "AddressZero",
365
+ "inputs": []
366
+ },
367
+ {
368
+ "type": "error",
369
+ "name": "FailedInnerCall",
370
+ "inputs": []
371
+ },
372
+ {
373
+ "type": "error",
374
+ "name": "HookNotImplemented",
375
+ "inputs": []
376
+ },
377
+ {
378
+ "type": "error",
379
+ "name": "InsufficientInputCurrency",
380
+ "inputs": [
381
+ {
382
+ "name": "inputAmount",
383
+ "type": "uint256",
384
+ "internalType": "uint256"
385
+ },
386
+ {
387
+ "name": "availableAmount",
388
+ "type": "uint256",
389
+ "internalType": "uint256"
390
+ }
391
+ ]
392
+ },
393
+ {
394
+ "type": "error",
395
+ "name": "InsufficientOutputAmount",
396
+ "inputs": []
397
+ },
398
+ {
399
+ "type": "error",
400
+ "name": "NotFactory",
401
+ "inputs": []
402
+ },
403
+ {
404
+ "type": "error",
405
+ "name": "OnlyPoolManager",
406
+ "inputs": []
407
+ },
408
+ {
409
+ "type": "error",
410
+ "name": "SafeERC20FailedOperation",
411
+ "inputs": [
412
+ {
413
+ "name": "token",
414
+ "type": "address",
415
+ "internalType": "address"
416
+ }
417
+ ]
418
+ },
419
+ {
420
+ "type": "error",
421
+ "name": "V3RouteCannotStartWithInputCurrency",
422
+ "inputs": []
423
+ },
424
+ {
425
+ "type": "error",
426
+ "name": "V3RouteDoesNotConnectToV4RouteStart",
427
+ "inputs": []
428
+ }
429
+ ]
@@ -12,6 +12,11 @@
12
12
  "type": "address",
13
13
  "internalType": "contract IDeployedCoinVersionLookup"
14
14
  },
15
+ {
16
+ "name": "trustedMsgSenderLookup",
17
+ "type": "address",
18
+ "internalType": "contract ITrustedMsgSenderProviderLookup"
19
+ },
15
20
  {
16
21
  "name": "upgradeGate",
17
22
  "type": "address",
@@ -1169,6 +1174,19 @@
1169
1174
  ],
1170
1175
  "stateMutability": "view"
1171
1176
  },
1177
+ {
1178
+ "type": "function",
1179
+ "name": "getTrustedMsgSenderLookup",
1180
+ "inputs": [],
1181
+ "outputs": [
1182
+ {
1183
+ "name": "",
1184
+ "type": "address",
1185
+ "internalType": "contract ITrustedMsgSenderProviderLookup"
1186
+ }
1187
+ ],
1188
+ "stateMutability": "view"
1189
+ },
1172
1190
  {
1173
1191
  "type": "function",
1174
1192
  "name": "initializeFromMigration",
@@ -1891,6 +1909,11 @@
1891
1909
  "name": "SafeCastOverflow",
1892
1910
  "inputs": []
1893
1911
  },
1912
+ {
1913
+ "type": "error",
1914
+ "name": "TrustedMsgSenderLookupCannotBeZeroAddress",
1915
+ "inputs": []
1916
+ },
1894
1917
  {
1895
1918
  "type": "error",
1896
1919
  "name": "UpgradeGateCannotBeZeroAddress",
@@ -0,0 +1,21 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "isTrustedMsgSenderProvider",
5
+ "inputs": [
6
+ {
7
+ "name": "sender",
8
+ "type": "address",
9
+ "internalType": "address"
10
+ }
11
+ ],
12
+ "outputs": [
13
+ {
14
+ "name": "",
15
+ "type": "bool",
16
+ "internalType": "bool"
17
+ }
18
+ ],
19
+ "stateMutability": "view"
20
+ }
21
+ ]