@zoralabs/coins 2.2.1 → 2.3.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.
Files changed (88) hide show
  1. package/.turbo/turbo-build$colon$js.log +125 -106
  2. package/CHANGELOG.md +50 -5
  3. package/README.md +5 -0
  4. package/abis/AddressConstants.json +7 -0
  5. package/abis/BaseCoin.json +0 -5
  6. package/abis/BaseTest.json +62 -0
  7. package/abis/BuySupplyWithV4SwapHook.json +429 -0
  8. package/abis/ContentCoin.json +0 -5
  9. package/abis/CreatorCoin.json +0 -5
  10. package/abis/FeeEstimatorHook.json +94 -1
  11. package/abis/IUniswapV4Router04.json +484 -0
  12. package/abis/IUpgradeableDestinationV4HookWithUpdateableFee.json +95 -0
  13. package/abis/IZoraFactory.json +69 -0
  14. package/abis/MockAirlock.json +39 -0
  15. package/abis/SimpleERC20.json +326 -0
  16. package/abis/ZoraFactoryImpl.json +69 -0
  17. package/abis/ZoraV4CoinHook.json +94 -1
  18. package/addresses/8453.json +8 -10
  19. package/audits/report-cantinacode-zora-0827.pdf +3498 -4
  20. package/audits/report-cantinacode-zora-1021.pdf +0 -0
  21. package/dist/index.cjs +161 -22
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.js +160 -21
  24. package/dist/index.js.map +1 -1
  25. package/dist/wagmiGenerated.d.ts +259 -40
  26. package/dist/wagmiGenerated.d.ts.map +1 -1
  27. package/foundry.toml +3 -3
  28. package/package/wagmiGenerated.ts +160 -21
  29. package/package.json +1 -1
  30. package/script/DeployPostDeploymentHooks.s.sol +1 -3
  31. package/script/TestBackingCoinSwap.s.sol +0 -2
  32. package/script/TestV4Swap.s.sol +0 -2
  33. package/src/BaseCoin.sol +4 -12
  34. package/src/ContentCoin.sol +3 -4
  35. package/src/CreatorCoin.sol +8 -10
  36. package/src/ZoraFactoryImpl.sol +115 -83
  37. package/src/deployment/CoinsDeployerBase.sol +9 -8
  38. package/src/hook-registry/ZoraHookRegistry.sol +4 -0
  39. package/src/hooks/ZoraV4CoinHook.sol +66 -9
  40. package/src/hooks/deployment/BuySupplyWithV4SwapHook.sol +310 -0
  41. package/src/interfaces/IUpgradeableV4Hook.sol +18 -0
  42. package/src/interfaces/IZoraFactory.sol +21 -2
  43. package/src/libs/CoinConstants.sol +51 -8
  44. package/src/libs/CoinDopplerMultiCurve.sol +11 -11
  45. package/src/libs/CoinRewardsV4.sol +26 -33
  46. package/src/libs/CoinSetup.sol +2 -9
  47. package/src/libs/DopplerMath.sol +2 -2
  48. package/src/libs/V4Liquidity.sol +79 -15
  49. package/src/utils/AutoSwapper.sol +1 -1
  50. package/src/version/ContractVersionBase.sol +1 -1
  51. package/test/BuySupplyWithV4SwapHook.t.sol +509 -0
  52. package/test/Coin.t.sol +26 -14
  53. package/test/CoinRewardsV4.t.sol +33 -0
  54. package/test/CoinUniV4.t.sol +3 -5
  55. package/test/ContentCoinRewards.t.sol +44 -3
  56. package/test/CreatorCoin.t.sol +54 -33
  57. package/test/CreatorCoinRewards.t.sol +1 -3
  58. package/test/DeploymentHooks.t.sol +54 -2
  59. package/test/Factory.t.sol +3 -3
  60. package/test/LiquidityMigration.t.sol +145 -7
  61. package/test/MultiOwnable.t.sol +4 -4
  62. package/test/Upgrades.t.sol +26 -17
  63. package/test/V4Liquidity.t.sol +178 -0
  64. package/test/ZoraHookRegistry.t.sol +19 -9
  65. package/test/mocks/MockAirlock.sol +22 -0
  66. package/test/mocks/SimpleERC20.sol +8 -0
  67. package/test/utils/BaseTest.sol +155 -3
  68. package/test/utils/RewardTestHelpers.sol +4 -4
  69. package/test/utils/hookmate/README.md +50 -0
  70. package/test/utils/hookmate/artifacts/DeployHelper.sol +20 -0
  71. package/test/utils/hookmate/artifacts/Permit2.sol +16 -0
  72. package/test/utils/hookmate/artifacts/UniversalRouter.sol +29 -0
  73. package/test/utils/hookmate/artifacts/V4PoolManager.sol +17 -0
  74. package/test/utils/hookmate/artifacts/V4PositionManager.sol +23 -0
  75. package/test/utils/hookmate/artifacts/V4Quoter.sol +17 -0
  76. package/test/utils/hookmate/artifacts/V4Router.sol +18 -0
  77. package/test/utils/hookmate/constants/AddressConstants.sol +193 -0
  78. package/test/utils/hookmate/interfaces/router/IUniswapV4Router04.sol +173 -0
  79. package/test/utils/hookmate/interfaces/router/PathKey.sol +34 -0
  80. package/test/utils/hookmate/test/utils/SwapFeeEventAsserter.sol +24 -0
  81. package/wagmi.config.ts +1 -1
  82. package/abis/CoinConstants.json +0 -54
  83. package/abis/CoinRewardsV4.json +0 -67
  84. package/src/libs/CreatorCoinConstants.sol +0 -15
  85. package/src/libs/MarketConstants.sol +0 -23
  86. package/src/utils/uniswap/BytesLib.sol +0 -35
  87. package/src/utils/uniswap/Path.sol +0 -31
  88. /package/abis/{VmContractHelper227.json → VmContractHelper239.json} +0 -0
@@ -0,0 +1,484 @@
1
+ [
2
+ {
3
+ "type": "receive",
4
+ "stateMutability": "payable"
5
+ },
6
+ {
7
+ "type": "function",
8
+ "name": "msgSender",
9
+ "inputs": [],
10
+ "outputs": [
11
+ {
12
+ "name": "",
13
+ "type": "address",
14
+ "internalType": "address"
15
+ }
16
+ ],
17
+ "stateMutability": "view"
18
+ },
19
+ {
20
+ "type": "function",
21
+ "name": "swap",
22
+ "inputs": [
23
+ {
24
+ "name": "amountSpecified",
25
+ "type": "int256",
26
+ "internalType": "int256"
27
+ },
28
+ {
29
+ "name": "amountLimit",
30
+ "type": "uint256",
31
+ "internalType": "uint256"
32
+ },
33
+ {
34
+ "name": "zeroForOne",
35
+ "type": "bool",
36
+ "internalType": "bool"
37
+ },
38
+ {
39
+ "name": "poolKey",
40
+ "type": "tuple",
41
+ "internalType": "struct PoolKey",
42
+ "components": [
43
+ {
44
+ "name": "currency0",
45
+ "type": "address",
46
+ "internalType": "Currency"
47
+ },
48
+ {
49
+ "name": "currency1",
50
+ "type": "address",
51
+ "internalType": "Currency"
52
+ },
53
+ {
54
+ "name": "fee",
55
+ "type": "uint24",
56
+ "internalType": "uint24"
57
+ },
58
+ {
59
+ "name": "tickSpacing",
60
+ "type": "int24",
61
+ "internalType": "int24"
62
+ },
63
+ {
64
+ "name": "hooks",
65
+ "type": "address",
66
+ "internalType": "contract IHooks"
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ "name": "hookData",
72
+ "type": "bytes",
73
+ "internalType": "bytes"
74
+ },
75
+ {
76
+ "name": "receiver",
77
+ "type": "address",
78
+ "internalType": "address"
79
+ },
80
+ {
81
+ "name": "deadline",
82
+ "type": "uint256",
83
+ "internalType": "uint256"
84
+ }
85
+ ],
86
+ "outputs": [
87
+ {
88
+ "name": "",
89
+ "type": "int256",
90
+ "internalType": "BalanceDelta"
91
+ }
92
+ ],
93
+ "stateMutability": "payable"
94
+ },
95
+ {
96
+ "type": "function",
97
+ "name": "swap",
98
+ "inputs": [
99
+ {
100
+ "name": "data",
101
+ "type": "bytes",
102
+ "internalType": "bytes"
103
+ },
104
+ {
105
+ "name": "deadline",
106
+ "type": "uint256",
107
+ "internalType": "uint256"
108
+ }
109
+ ],
110
+ "outputs": [
111
+ {
112
+ "name": "",
113
+ "type": "int256",
114
+ "internalType": "BalanceDelta"
115
+ }
116
+ ],
117
+ "stateMutability": "payable"
118
+ },
119
+ {
120
+ "type": "function",
121
+ "name": "swap",
122
+ "inputs": [
123
+ {
124
+ "name": "amountSpecified",
125
+ "type": "int256",
126
+ "internalType": "int256"
127
+ },
128
+ {
129
+ "name": "amountLimit",
130
+ "type": "uint256",
131
+ "internalType": "uint256"
132
+ },
133
+ {
134
+ "name": "startCurrency",
135
+ "type": "address",
136
+ "internalType": "Currency"
137
+ },
138
+ {
139
+ "name": "path",
140
+ "type": "tuple[]",
141
+ "internalType": "struct PathKey[]",
142
+ "components": [
143
+ {
144
+ "name": "intermediateCurrency",
145
+ "type": "address",
146
+ "internalType": "Currency"
147
+ },
148
+ {
149
+ "name": "fee",
150
+ "type": "uint24",
151
+ "internalType": "uint24"
152
+ },
153
+ {
154
+ "name": "tickSpacing",
155
+ "type": "int24",
156
+ "internalType": "int24"
157
+ },
158
+ {
159
+ "name": "hooks",
160
+ "type": "address",
161
+ "internalType": "contract IHooks"
162
+ },
163
+ {
164
+ "name": "hookData",
165
+ "type": "bytes",
166
+ "internalType": "bytes"
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ "name": "receiver",
172
+ "type": "address",
173
+ "internalType": "address"
174
+ },
175
+ {
176
+ "name": "deadline",
177
+ "type": "uint256",
178
+ "internalType": "uint256"
179
+ }
180
+ ],
181
+ "outputs": [
182
+ {
183
+ "name": "",
184
+ "type": "int256",
185
+ "internalType": "BalanceDelta"
186
+ }
187
+ ],
188
+ "stateMutability": "payable"
189
+ },
190
+ {
191
+ "type": "function",
192
+ "name": "swapExactTokensForTokens",
193
+ "inputs": [
194
+ {
195
+ "name": "amountIn",
196
+ "type": "uint256",
197
+ "internalType": "uint256"
198
+ },
199
+ {
200
+ "name": "amountOutMin",
201
+ "type": "uint256",
202
+ "internalType": "uint256"
203
+ },
204
+ {
205
+ "name": "startCurrency",
206
+ "type": "address",
207
+ "internalType": "Currency"
208
+ },
209
+ {
210
+ "name": "path",
211
+ "type": "tuple[]",
212
+ "internalType": "struct PathKey[]",
213
+ "components": [
214
+ {
215
+ "name": "intermediateCurrency",
216
+ "type": "address",
217
+ "internalType": "Currency"
218
+ },
219
+ {
220
+ "name": "fee",
221
+ "type": "uint24",
222
+ "internalType": "uint24"
223
+ },
224
+ {
225
+ "name": "tickSpacing",
226
+ "type": "int24",
227
+ "internalType": "int24"
228
+ },
229
+ {
230
+ "name": "hooks",
231
+ "type": "address",
232
+ "internalType": "contract IHooks"
233
+ },
234
+ {
235
+ "name": "hookData",
236
+ "type": "bytes",
237
+ "internalType": "bytes"
238
+ }
239
+ ]
240
+ },
241
+ {
242
+ "name": "receiver",
243
+ "type": "address",
244
+ "internalType": "address"
245
+ },
246
+ {
247
+ "name": "deadline",
248
+ "type": "uint256",
249
+ "internalType": "uint256"
250
+ }
251
+ ],
252
+ "outputs": [
253
+ {
254
+ "name": "",
255
+ "type": "int256",
256
+ "internalType": "BalanceDelta"
257
+ }
258
+ ],
259
+ "stateMutability": "payable"
260
+ },
261
+ {
262
+ "type": "function",
263
+ "name": "swapExactTokensForTokens",
264
+ "inputs": [
265
+ {
266
+ "name": "amountIn",
267
+ "type": "uint256",
268
+ "internalType": "uint256"
269
+ },
270
+ {
271
+ "name": "amountOutMin",
272
+ "type": "uint256",
273
+ "internalType": "uint256"
274
+ },
275
+ {
276
+ "name": "zeroForOne",
277
+ "type": "bool",
278
+ "internalType": "bool"
279
+ },
280
+ {
281
+ "name": "poolKey",
282
+ "type": "tuple",
283
+ "internalType": "struct PoolKey",
284
+ "components": [
285
+ {
286
+ "name": "currency0",
287
+ "type": "address",
288
+ "internalType": "Currency"
289
+ },
290
+ {
291
+ "name": "currency1",
292
+ "type": "address",
293
+ "internalType": "Currency"
294
+ },
295
+ {
296
+ "name": "fee",
297
+ "type": "uint24",
298
+ "internalType": "uint24"
299
+ },
300
+ {
301
+ "name": "tickSpacing",
302
+ "type": "int24",
303
+ "internalType": "int24"
304
+ },
305
+ {
306
+ "name": "hooks",
307
+ "type": "address",
308
+ "internalType": "contract IHooks"
309
+ }
310
+ ]
311
+ },
312
+ {
313
+ "name": "hookData",
314
+ "type": "bytes",
315
+ "internalType": "bytes"
316
+ },
317
+ {
318
+ "name": "receiver",
319
+ "type": "address",
320
+ "internalType": "address"
321
+ },
322
+ {
323
+ "name": "deadline",
324
+ "type": "uint256",
325
+ "internalType": "uint256"
326
+ }
327
+ ],
328
+ "outputs": [
329
+ {
330
+ "name": "",
331
+ "type": "int256",
332
+ "internalType": "BalanceDelta"
333
+ }
334
+ ],
335
+ "stateMutability": "payable"
336
+ },
337
+ {
338
+ "type": "function",
339
+ "name": "swapTokensForExactTokens",
340
+ "inputs": [
341
+ {
342
+ "name": "amountOut",
343
+ "type": "uint256",
344
+ "internalType": "uint256"
345
+ },
346
+ {
347
+ "name": "amountInMax",
348
+ "type": "uint256",
349
+ "internalType": "uint256"
350
+ },
351
+ {
352
+ "name": "startCurrency",
353
+ "type": "address",
354
+ "internalType": "Currency"
355
+ },
356
+ {
357
+ "name": "path",
358
+ "type": "tuple[]",
359
+ "internalType": "struct PathKey[]",
360
+ "components": [
361
+ {
362
+ "name": "intermediateCurrency",
363
+ "type": "address",
364
+ "internalType": "Currency"
365
+ },
366
+ {
367
+ "name": "fee",
368
+ "type": "uint24",
369
+ "internalType": "uint24"
370
+ },
371
+ {
372
+ "name": "tickSpacing",
373
+ "type": "int24",
374
+ "internalType": "int24"
375
+ },
376
+ {
377
+ "name": "hooks",
378
+ "type": "address",
379
+ "internalType": "contract IHooks"
380
+ },
381
+ {
382
+ "name": "hookData",
383
+ "type": "bytes",
384
+ "internalType": "bytes"
385
+ }
386
+ ]
387
+ },
388
+ {
389
+ "name": "receiver",
390
+ "type": "address",
391
+ "internalType": "address"
392
+ },
393
+ {
394
+ "name": "deadline",
395
+ "type": "uint256",
396
+ "internalType": "uint256"
397
+ }
398
+ ],
399
+ "outputs": [
400
+ {
401
+ "name": "",
402
+ "type": "int256",
403
+ "internalType": "BalanceDelta"
404
+ }
405
+ ],
406
+ "stateMutability": "payable"
407
+ },
408
+ {
409
+ "type": "function",
410
+ "name": "swapTokensForExactTokens",
411
+ "inputs": [
412
+ {
413
+ "name": "amountOut",
414
+ "type": "uint256",
415
+ "internalType": "uint256"
416
+ },
417
+ {
418
+ "name": "amountInMax",
419
+ "type": "uint256",
420
+ "internalType": "uint256"
421
+ },
422
+ {
423
+ "name": "zeroForOne",
424
+ "type": "bool",
425
+ "internalType": "bool"
426
+ },
427
+ {
428
+ "name": "poolKey",
429
+ "type": "tuple",
430
+ "internalType": "struct PoolKey",
431
+ "components": [
432
+ {
433
+ "name": "currency0",
434
+ "type": "address",
435
+ "internalType": "Currency"
436
+ },
437
+ {
438
+ "name": "currency1",
439
+ "type": "address",
440
+ "internalType": "Currency"
441
+ },
442
+ {
443
+ "name": "fee",
444
+ "type": "uint24",
445
+ "internalType": "uint24"
446
+ },
447
+ {
448
+ "name": "tickSpacing",
449
+ "type": "int24",
450
+ "internalType": "int24"
451
+ },
452
+ {
453
+ "name": "hooks",
454
+ "type": "address",
455
+ "internalType": "contract IHooks"
456
+ }
457
+ ]
458
+ },
459
+ {
460
+ "name": "hookData",
461
+ "type": "bytes",
462
+ "internalType": "bytes"
463
+ },
464
+ {
465
+ "name": "receiver",
466
+ "type": "address",
467
+ "internalType": "address"
468
+ },
469
+ {
470
+ "name": "deadline",
471
+ "type": "uint256",
472
+ "internalType": "uint256"
473
+ }
474
+ ],
475
+ "outputs": [
476
+ {
477
+ "name": "",
478
+ "type": "int256",
479
+ "internalType": "BalanceDelta"
480
+ }
481
+ ],
482
+ "stateMutability": "payable"
483
+ }
484
+ ]
@@ -0,0 +1,95 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "initializeFromMigrationWithUpdateableFee",
5
+ "inputs": [
6
+ {
7
+ "name": "poolKey",
8
+ "type": "tuple",
9
+ "internalType": "struct PoolKey",
10
+ "components": [
11
+ {
12
+ "name": "currency0",
13
+ "type": "address",
14
+ "internalType": "Currency"
15
+ },
16
+ {
17
+ "name": "currency1",
18
+ "type": "address",
19
+ "internalType": "Currency"
20
+ },
21
+ {
22
+ "name": "fee",
23
+ "type": "uint24",
24
+ "internalType": "uint24"
25
+ },
26
+ {
27
+ "name": "tickSpacing",
28
+ "type": "int24",
29
+ "internalType": "int24"
30
+ },
31
+ {
32
+ "name": "hooks",
33
+ "type": "address",
34
+ "internalType": "contract IHooks"
35
+ }
36
+ ]
37
+ },
38
+ {
39
+ "name": "coin",
40
+ "type": "address",
41
+ "internalType": "address"
42
+ },
43
+ {
44
+ "name": "sqrtPriceX96",
45
+ "type": "uint160",
46
+ "internalType": "uint160"
47
+ },
48
+ {
49
+ "name": "migratedLiquidity",
50
+ "type": "tuple[]",
51
+ "internalType": "struct BurnedPosition[]",
52
+ "components": [
53
+ {
54
+ "name": "tickLower",
55
+ "type": "int24",
56
+ "internalType": "int24"
57
+ },
58
+ {
59
+ "name": "tickUpper",
60
+ "type": "int24",
61
+ "internalType": "int24"
62
+ },
63
+ {
64
+ "name": "amount0Received",
65
+ "type": "uint128",
66
+ "internalType": "uint128"
67
+ },
68
+ {
69
+ "name": "amount1Received",
70
+ "type": "uint128",
71
+ "internalType": "uint128"
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "name": "additionalData",
77
+ "type": "bytes",
78
+ "internalType": "bytes"
79
+ }
80
+ ],
81
+ "outputs": [
82
+ {
83
+ "name": "fee",
84
+ "type": "uint24",
85
+ "internalType": "uint24"
86
+ },
87
+ {
88
+ "name": "tickSpacing",
89
+ "type": "int24",
90
+ "internalType": "int24"
91
+ }
92
+ ],
93
+ "stateMutability": "nonpayable"
94
+ }
95
+ ]
@@ -251,6 +251,75 @@
251
251
  ],
252
252
  "stateMutability": "nonpayable"
253
253
  },
254
+ {
255
+ "type": "function",
256
+ "name": "deployCreatorCoin",
257
+ "inputs": [
258
+ {
259
+ "name": "payoutRecipient",
260
+ "type": "address",
261
+ "internalType": "address"
262
+ },
263
+ {
264
+ "name": "owners",
265
+ "type": "address[]",
266
+ "internalType": "address[]"
267
+ },
268
+ {
269
+ "name": "uri",
270
+ "type": "string",
271
+ "internalType": "string"
272
+ },
273
+ {
274
+ "name": "name",
275
+ "type": "string",
276
+ "internalType": "string"
277
+ },
278
+ {
279
+ "name": "symbol",
280
+ "type": "string",
281
+ "internalType": "string"
282
+ },
283
+ {
284
+ "name": "poolConfig",
285
+ "type": "bytes",
286
+ "internalType": "bytes"
287
+ },
288
+ {
289
+ "name": "platformReferrer",
290
+ "type": "address",
291
+ "internalType": "address"
292
+ },
293
+ {
294
+ "name": "postDeployHook",
295
+ "type": "address",
296
+ "internalType": "address"
297
+ },
298
+ {
299
+ "name": "postDeployHookData",
300
+ "type": "bytes",
301
+ "internalType": "bytes"
302
+ },
303
+ {
304
+ "name": "coinSalt",
305
+ "type": "bytes32",
306
+ "internalType": "bytes32"
307
+ }
308
+ ],
309
+ "outputs": [
310
+ {
311
+ "name": "coin",
312
+ "type": "address",
313
+ "internalType": "address"
314
+ },
315
+ {
316
+ "name": "postDeployHookDataOut",
317
+ "type": "bytes",
318
+ "internalType": "bytes"
319
+ }
320
+ ],
321
+ "stateMutability": "payable"
322
+ },
254
323
  {
255
324
  "type": "function",
256
325
  "name": "deployWithHook",
@@ -0,0 +1,39 @@
1
+ [
2
+ {
3
+ "type": "constructor",
4
+ "inputs": [
5
+ {
6
+ "name": "owner_",
7
+ "type": "address",
8
+ "internalType": "address"
9
+ }
10
+ ],
11
+ "stateMutability": "nonpayable"
12
+ },
13
+ {
14
+ "type": "function",
15
+ "name": "owner",
16
+ "inputs": [],
17
+ "outputs": [
18
+ {
19
+ "name": "",
20
+ "type": "address",
21
+ "internalType": "address"
22
+ }
23
+ ],
24
+ "stateMutability": "view"
25
+ },
26
+ {
27
+ "type": "function",
28
+ "name": "setOwner",
29
+ "inputs": [
30
+ {
31
+ "name": "newOwner",
32
+ "type": "address",
33
+ "internalType": "address"
34
+ }
35
+ ],
36
+ "outputs": [],
37
+ "stateMutability": "nonpayable"
38
+ }
39
+ ]