@zoralabs/coins 1.1.2 → 2.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.
Files changed (78) hide show
  1. package/.turbo/turbo-build.log +107 -110
  2. package/CHANGELOG.md +50 -0
  3. package/README.md +48 -1
  4. package/abis/BaseCoin.json +442 -0
  5. package/abis/BaseZoraV4CoinHook.json +6 -2
  6. package/abis/CoinTest.json +3 -246
  7. package/abis/CoinUniV4Test.json +20 -0
  8. package/abis/ContentCoinHook.json +6 -2
  9. package/abis/CreatorCoinHook.json +6 -2
  10. package/abis/FactoryTest.json +8 -133
  11. package/abis/FeeEstimatorHook.json +6 -2
  12. package/abis/HooksTest.json +0 -26
  13. package/abis/ICoin.json +378 -0
  14. package/abis/ICoinV3.json +378 -0
  15. package/abis/IZoraFactory.json +0 -18
  16. package/abis/IZoraV4CoinHook.json +2 -2
  17. package/abis/LiquidityMigrationTest.json +101 -0
  18. package/abis/MockBadFactory.json +15 -0
  19. package/abis/Ownable2StepUpgradeable.json +138 -0
  20. package/abis/ZoraFactoryImpl.json +38 -65
  21. package/addresses/8453.json +5 -5
  22. package/dist/index.cjs +272 -268
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +270 -266
  25. package/dist/index.js.map +1 -1
  26. package/dist/wagmiGenerated.d.ts +397 -470
  27. package/dist/wagmiGenerated.d.ts.map +1 -1
  28. package/package/wagmiGenerated.ts +275 -271
  29. package/package.json +3 -3
  30. package/script/DeployPostDeploymentHooks.s.sol +2 -2
  31. package/script/TestBackingCoinSwap.s.sol +9 -9
  32. package/script/TestV4Swap.s.sol +9 -9
  33. package/script/UpgradeFactoryImpl.s.sol +0 -1
  34. package/src/BaseCoin.sol +109 -6
  35. package/src/ContentCoin.sol +45 -0
  36. package/src/CreatorCoin.sol +7 -5
  37. package/src/ZoraFactoryImpl.sol +12 -95
  38. package/src/deployment/CoinsDeployerBase.sol +13 -30
  39. package/src/hooks/BaseZoraV4CoinHook.sol +8 -6
  40. package/src/hooks/deployment/BuySupplyWithSwapRouterHook.sol +4 -5
  41. package/src/interfaces/ICoin.sol +67 -1
  42. package/src/interfaces/ICreatorCoin.sol +2 -2
  43. package/src/interfaces/IZoraFactory.sol +0 -5
  44. package/src/interfaces/IZoraV4CoinHook.sol +1 -1
  45. package/src/libs/CoinConfigurationVersions.sol +1 -39
  46. package/src/libs/CoinRewardsV4.sol +2 -2
  47. package/src/libs/CoinSetup.sol +1 -4
  48. package/src/libs/UniV4SwapHelper.sol +1 -1
  49. package/src/libs/UniV4SwapToCurrency.sol +2 -2
  50. package/src/libs/V4Liquidity.sol +1 -1
  51. package/src/version/ContractVersionBase.sol +1 -1
  52. package/test/Coin.t.sol +112 -535
  53. package/test/CoinUniV4.t.sol +66 -10
  54. package/test/DeploymentHooks.t.sol +5 -102
  55. package/test/Factory.t.sol +49 -291
  56. package/test/LiquidityMigration.t.sol +160 -2
  57. package/test/MultiOwnable.t.sol +36 -36
  58. package/test/Upgrades.t.sol +23 -42
  59. package/test/utils/BaseTest.sol +39 -84
  60. package/test/utils/FeeEstimatorHook.sol +3 -3
  61. package/wagmi.config.ts +2 -2
  62. package/abis/Coin.json +0 -1912
  63. package/abis/DopplerUniswapV3Test.json +0 -800
  64. package/abis/ICoinV4.json +0 -1048
  65. package/abis/Simulate.json +0 -29
  66. package/abis/UniV3BuySell.json +0 -12
  67. package/abis/UniV3Errors.json +0 -32
  68. package/script/Simulate.s.sol +0 -59
  69. package/src/Coin.sol +0 -236
  70. package/src/CoinV4.sol +0 -151
  71. package/src/interfaces/ICoinV4.sol +0 -74
  72. package/src/libs/CoinDopplerUniV3.sol +0 -50
  73. package/src/libs/CoinRewards.sol +0 -201
  74. package/src/libs/CoinSetupV3.sol +0 -50
  75. package/src/libs/UniV3BuySell.sol +0 -231
  76. package/src/libs/UniV3Errors.sol +0 -11
  77. package/test/CoinDopplerUniV3.t.sol +0 -310
  78. /package/abis/{CoinV4.json → ContentCoin.json} +0 -0
package/abis/ICoinV3.json CHANGED
@@ -134,6 +134,172 @@
134
134
  ],
135
135
  "stateMutability": "view"
136
136
  },
137
+ {
138
+ "type": "function",
139
+ "name": "getPayoutSwapPath",
140
+ "inputs": [
141
+ {
142
+ "name": "coinVersionLookup",
143
+ "type": "address",
144
+ "internalType": "contract IDeployedCoinVersionLookup"
145
+ }
146
+ ],
147
+ "outputs": [
148
+ {
149
+ "name": "",
150
+ "type": "tuple",
151
+ "internalType": "struct IHasSwapPath.PayoutSwapPath",
152
+ "components": [
153
+ {
154
+ "name": "path",
155
+ "type": "tuple[]",
156
+ "internalType": "struct PathKey[]",
157
+ "components": [
158
+ {
159
+ "name": "intermediateCurrency",
160
+ "type": "address",
161
+ "internalType": "Currency"
162
+ },
163
+ {
164
+ "name": "fee",
165
+ "type": "uint24",
166
+ "internalType": "uint24"
167
+ },
168
+ {
169
+ "name": "tickSpacing",
170
+ "type": "int24",
171
+ "internalType": "int24"
172
+ },
173
+ {
174
+ "name": "hooks",
175
+ "type": "address",
176
+ "internalType": "contract IHooks"
177
+ },
178
+ {
179
+ "name": "hookData",
180
+ "type": "bytes",
181
+ "internalType": "bytes"
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ "name": "currencyIn",
187
+ "type": "address",
188
+ "internalType": "Currency"
189
+ }
190
+ ]
191
+ }
192
+ ],
193
+ "stateMutability": "view"
194
+ },
195
+ {
196
+ "type": "function",
197
+ "name": "getPoolConfiguration",
198
+ "inputs": [],
199
+ "outputs": [
200
+ {
201
+ "name": "",
202
+ "type": "tuple",
203
+ "internalType": "struct PoolConfiguration",
204
+ "components": [
205
+ {
206
+ "name": "version",
207
+ "type": "uint8",
208
+ "internalType": "uint8"
209
+ },
210
+ {
211
+ "name": "numPositions",
212
+ "type": "uint16",
213
+ "internalType": "uint16"
214
+ },
215
+ {
216
+ "name": "fee",
217
+ "type": "uint24",
218
+ "internalType": "uint24"
219
+ },
220
+ {
221
+ "name": "tickSpacing",
222
+ "type": "int24",
223
+ "internalType": "int24"
224
+ },
225
+ {
226
+ "name": "numDiscoveryPositions",
227
+ "type": "uint16[]",
228
+ "internalType": "uint16[]"
229
+ },
230
+ {
231
+ "name": "tickLower",
232
+ "type": "int24[]",
233
+ "internalType": "int24[]"
234
+ },
235
+ {
236
+ "name": "tickUpper",
237
+ "type": "int24[]",
238
+ "internalType": "int24[]"
239
+ },
240
+ {
241
+ "name": "maxDiscoverySupplyShare",
242
+ "type": "uint256[]",
243
+ "internalType": "uint256[]"
244
+ }
245
+ ]
246
+ }
247
+ ],
248
+ "stateMutability": "view"
249
+ },
250
+ {
251
+ "type": "function",
252
+ "name": "getPoolKey",
253
+ "inputs": [],
254
+ "outputs": [
255
+ {
256
+ "name": "",
257
+ "type": "tuple",
258
+ "internalType": "struct PoolKey",
259
+ "components": [
260
+ {
261
+ "name": "currency0",
262
+ "type": "address",
263
+ "internalType": "Currency"
264
+ },
265
+ {
266
+ "name": "currency1",
267
+ "type": "address",
268
+ "internalType": "Currency"
269
+ },
270
+ {
271
+ "name": "fee",
272
+ "type": "uint24",
273
+ "internalType": "uint24"
274
+ },
275
+ {
276
+ "name": "tickSpacing",
277
+ "type": "int24",
278
+ "internalType": "int24"
279
+ },
280
+ {
281
+ "name": "hooks",
282
+ "type": "address",
283
+ "internalType": "contract IHooks"
284
+ }
285
+ ]
286
+ }
287
+ ],
288
+ "stateMutability": "view"
289
+ },
290
+ {
291
+ "type": "function",
292
+ "name": "hooks",
293
+ "inputs": [],
294
+ "outputs": [
295
+ {
296
+ "name": "",
297
+ "type": "address",
298
+ "internalType": "contract IHooks"
299
+ }
300
+ ],
301
+ "stateMutability": "view"
302
+ },
137
303
  {
138
304
  "type": "function",
139
305
  "name": "initialize",
@@ -251,6 +417,133 @@
251
417
  "outputs": [],
252
418
  "stateMutability": "nonpayable"
253
419
  },
420
+ {
421
+ "type": "function",
422
+ "name": "initialize",
423
+ "inputs": [
424
+ {
425
+ "name": "payoutRecipient_",
426
+ "type": "address",
427
+ "internalType": "address"
428
+ },
429
+ {
430
+ "name": "owners_",
431
+ "type": "address[]",
432
+ "internalType": "address[]"
433
+ },
434
+ {
435
+ "name": "tokenURI_",
436
+ "type": "string",
437
+ "internalType": "string"
438
+ },
439
+ {
440
+ "name": "name_",
441
+ "type": "string",
442
+ "internalType": "string"
443
+ },
444
+ {
445
+ "name": "symbol_",
446
+ "type": "string",
447
+ "internalType": "string"
448
+ },
449
+ {
450
+ "name": "platformReferrer_",
451
+ "type": "address",
452
+ "internalType": "address"
453
+ },
454
+ {
455
+ "name": "currency_",
456
+ "type": "address",
457
+ "internalType": "address"
458
+ },
459
+ {
460
+ "name": "poolKey_",
461
+ "type": "tuple",
462
+ "internalType": "struct PoolKey",
463
+ "components": [
464
+ {
465
+ "name": "currency0",
466
+ "type": "address",
467
+ "internalType": "Currency"
468
+ },
469
+ {
470
+ "name": "currency1",
471
+ "type": "address",
472
+ "internalType": "Currency"
473
+ },
474
+ {
475
+ "name": "fee",
476
+ "type": "uint24",
477
+ "internalType": "uint24"
478
+ },
479
+ {
480
+ "name": "tickSpacing",
481
+ "type": "int24",
482
+ "internalType": "int24"
483
+ },
484
+ {
485
+ "name": "hooks",
486
+ "type": "address",
487
+ "internalType": "contract IHooks"
488
+ }
489
+ ]
490
+ },
491
+ {
492
+ "name": "sqrtPriceX96",
493
+ "type": "uint160",
494
+ "internalType": "uint160"
495
+ },
496
+ {
497
+ "name": "poolConfiguration_",
498
+ "type": "tuple",
499
+ "internalType": "struct PoolConfiguration",
500
+ "components": [
501
+ {
502
+ "name": "version",
503
+ "type": "uint8",
504
+ "internalType": "uint8"
505
+ },
506
+ {
507
+ "name": "numPositions",
508
+ "type": "uint16",
509
+ "internalType": "uint16"
510
+ },
511
+ {
512
+ "name": "fee",
513
+ "type": "uint24",
514
+ "internalType": "uint24"
515
+ },
516
+ {
517
+ "name": "tickSpacing",
518
+ "type": "int24",
519
+ "internalType": "int24"
520
+ },
521
+ {
522
+ "name": "numDiscoveryPositions",
523
+ "type": "uint16[]",
524
+ "internalType": "uint16[]"
525
+ },
526
+ {
527
+ "name": "tickLower",
528
+ "type": "int24[]",
529
+ "internalType": "int24[]"
530
+ },
531
+ {
532
+ "name": "tickUpper",
533
+ "type": "int24[]",
534
+ "internalType": "int24[]"
535
+ },
536
+ {
537
+ "name": "maxDiscoverySupplyShare",
538
+ "type": "uint256[]",
539
+ "internalType": "uint256[]"
540
+ }
541
+ ]
542
+ }
543
+ ],
544
+ "outputs": [],
545
+ "stateMutability": "nonpayable"
546
+ },
254
547
  {
255
548
  "type": "function",
256
549
  "name": "payoutRecipient",
@@ -741,6 +1034,91 @@
741
1034
  "inputs": [],
742
1035
  "anonymous": false
743
1036
  },
1037
+ {
1038
+ "type": "event",
1039
+ "name": "LiquidityMigrated",
1040
+ "inputs": [
1041
+ {
1042
+ "name": "fromPoolKey",
1043
+ "type": "tuple",
1044
+ "indexed": false,
1045
+ "internalType": "struct PoolKey",
1046
+ "components": [
1047
+ {
1048
+ "name": "currency0",
1049
+ "type": "address",
1050
+ "internalType": "Currency"
1051
+ },
1052
+ {
1053
+ "name": "currency1",
1054
+ "type": "address",
1055
+ "internalType": "Currency"
1056
+ },
1057
+ {
1058
+ "name": "fee",
1059
+ "type": "uint24",
1060
+ "internalType": "uint24"
1061
+ },
1062
+ {
1063
+ "name": "tickSpacing",
1064
+ "type": "int24",
1065
+ "internalType": "int24"
1066
+ },
1067
+ {
1068
+ "name": "hooks",
1069
+ "type": "address",
1070
+ "internalType": "contract IHooks"
1071
+ }
1072
+ ]
1073
+ },
1074
+ {
1075
+ "name": "fromPoolKeyHash",
1076
+ "type": "bytes32",
1077
+ "indexed": false,
1078
+ "internalType": "bytes32"
1079
+ },
1080
+ {
1081
+ "name": "toPoolKey",
1082
+ "type": "tuple",
1083
+ "indexed": false,
1084
+ "internalType": "struct PoolKey",
1085
+ "components": [
1086
+ {
1087
+ "name": "currency0",
1088
+ "type": "address",
1089
+ "internalType": "Currency"
1090
+ },
1091
+ {
1092
+ "name": "currency1",
1093
+ "type": "address",
1094
+ "internalType": "Currency"
1095
+ },
1096
+ {
1097
+ "name": "fee",
1098
+ "type": "uint24",
1099
+ "internalType": "uint24"
1100
+ },
1101
+ {
1102
+ "name": "tickSpacing",
1103
+ "type": "int24",
1104
+ "internalType": "int24"
1105
+ },
1106
+ {
1107
+ "name": "hooks",
1108
+ "type": "address",
1109
+ "internalType": "contract IHooks"
1110
+ }
1111
+ ]
1112
+ },
1113
+ {
1114
+ "name": "toPoolKeyHash",
1115
+ "type": "bytes32",
1116
+ "indexed": false,
1117
+ "internalType": "bytes32"
1118
+ }
1119
+ ],
1120
+ "anonymous": false
1121
+ },
744
1122
  {
745
1123
  "type": "event",
746
1124
  "name": "NameAndSymbolUpdated",
@@ -43,19 +43,6 @@
43
43
  ],
44
44
  "stateMutability": "view"
45
45
  },
46
- {
47
- "type": "function",
48
- "name": "coinImpl",
49
- "inputs": [],
50
- "outputs": [
51
- {
52
- "name": "",
53
- "type": "address",
54
- "internalType": "address"
55
- }
56
- ],
57
- "stateMutability": "view"
58
- },
59
46
  {
60
47
  "type": "function",
61
48
  "name": "deploy",
@@ -606,11 +593,6 @@
606
593
  "name": "Deprecated",
607
594
  "inputs": []
608
595
  },
609
- {
610
- "type": "error",
611
- "name": "ERC20TransferAmountMismatch",
612
- "inputs": []
613
- },
614
596
  {
615
597
  "type": "error",
616
598
  "name": "EthTransferInvalid",
@@ -80,8 +80,8 @@
80
80
  "inputs": [
81
81
  {
82
82
  "name": "poolKeyHash",
83
- "type": "bytes23",
84
- "internalType": "bytes23"
83
+ "type": "bytes32",
84
+ "internalType": "bytes32"
85
85
  }
86
86
  ],
87
87
  "outputs": [
@@ -247,6 +247,69 @@
247
247
  ],
248
248
  "stateMutability": "view"
249
249
  },
250
+ {
251
+ "type": "function",
252
+ "name": "test_hookUpgradeGate_isAllowedHookUpgradeMapping",
253
+ "inputs": [],
254
+ "outputs": [],
255
+ "stateMutability": "nonpayable"
256
+ },
257
+ {
258
+ "type": "function",
259
+ "name": "test_hookUpgradeGate_registerEmptyArray",
260
+ "inputs": [],
261
+ "outputs": [],
262
+ "stateMutability": "nonpayable"
263
+ },
264
+ {
265
+ "type": "function",
266
+ "name": "test_hookUpgradeGate_registerMultipleUpgradePaths",
267
+ "inputs": [],
268
+ "outputs": [],
269
+ "stateMutability": "nonpayable"
270
+ },
271
+ {
272
+ "type": "function",
273
+ "name": "test_hookUpgradeGate_registerSamePathTwice",
274
+ "inputs": [],
275
+ "outputs": [],
276
+ "stateMutability": "nonpayable"
277
+ },
278
+ {
279
+ "type": "function",
280
+ "name": "test_hookUpgradeGate_registerUpgradePath_onlyOwner",
281
+ "inputs": [],
282
+ "outputs": [],
283
+ "stateMutability": "nonpayable"
284
+ },
285
+ {
286
+ "type": "function",
287
+ "name": "test_hookUpgradeGate_removeNonexistentUpgradePath",
288
+ "inputs": [],
289
+ "outputs": [],
290
+ "stateMutability": "nonpayable"
291
+ },
292
+ {
293
+ "type": "function",
294
+ "name": "test_hookUpgradeGate_removeUpgradePath",
295
+ "inputs": [],
296
+ "outputs": [],
297
+ "stateMutability": "nonpayable"
298
+ },
299
+ {
300
+ "type": "function",
301
+ "name": "test_hookUpgradeGate_removeUpgradePath_onlyOwner",
302
+ "inputs": [],
303
+ "outputs": [],
304
+ "stateMutability": "nonpayable"
305
+ },
306
+ {
307
+ "type": "function",
308
+ "name": "test_hookUpgradeGate_zeroAddressHandling",
309
+ "inputs": [],
310
+ "outputs": [],
311
+ "stateMutability": "nonpayable"
312
+ },
250
313
  {
251
314
  "type": "function",
252
315
  "name": "test_migrateLiquidity_emitsLiquidityMigrated",
@@ -374,6 +437,44 @@
374
437
  ],
375
438
  "anonymous": false
376
439
  },
440
+ {
441
+ "type": "event",
442
+ "name": "UpgradeRegistered",
443
+ "inputs": [
444
+ {
445
+ "name": "fromImpl",
446
+ "type": "address",
447
+ "indexed": false,
448
+ "internalType": "address"
449
+ },
450
+ {
451
+ "name": "toImpl",
452
+ "type": "address",
453
+ "indexed": false,
454
+ "internalType": "address"
455
+ }
456
+ ],
457
+ "anonymous": false
458
+ },
459
+ {
460
+ "type": "event",
461
+ "name": "UpgradeRemoved",
462
+ "inputs": [
463
+ {
464
+ "name": "fromImpl",
465
+ "type": "address",
466
+ "indexed": false,
467
+ "internalType": "address"
468
+ },
469
+ {
470
+ "name": "toImpl",
471
+ "type": "address",
472
+ "indexed": false,
473
+ "internalType": "address"
474
+ }
475
+ ],
476
+ "anonymous": false
477
+ },
377
478
  {
378
479
  "type": "event",
379
480
  "name": "log",
@@ -0,0 +1,15 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "contractName",
5
+ "inputs": [],
6
+ "outputs": [
7
+ {
8
+ "name": "",
9
+ "type": "string",
10
+ "internalType": "string"
11
+ }
12
+ ],
13
+ "stateMutability": "pure"
14
+ }
15
+ ]
@@ -0,0 +1,138 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "acceptOwnership",
5
+ "inputs": [],
6
+ "outputs": [],
7
+ "stateMutability": "nonpayable"
8
+ },
9
+ {
10
+ "type": "function",
11
+ "name": "owner",
12
+ "inputs": [],
13
+ "outputs": [
14
+ {
15
+ "name": "",
16
+ "type": "address",
17
+ "internalType": "address"
18
+ }
19
+ ],
20
+ "stateMutability": "view"
21
+ },
22
+ {
23
+ "type": "function",
24
+ "name": "pendingOwner",
25
+ "inputs": [],
26
+ "outputs": [
27
+ {
28
+ "name": "",
29
+ "type": "address",
30
+ "internalType": "address"
31
+ }
32
+ ],
33
+ "stateMutability": "view"
34
+ },
35
+ {
36
+ "type": "function",
37
+ "name": "renounceOwnership",
38
+ "inputs": [],
39
+ "outputs": [],
40
+ "stateMutability": "nonpayable"
41
+ },
42
+ {
43
+ "type": "function",
44
+ "name": "transferOwnership",
45
+ "inputs": [
46
+ {
47
+ "name": "newOwner",
48
+ "type": "address",
49
+ "internalType": "address"
50
+ }
51
+ ],
52
+ "outputs": [],
53
+ "stateMutability": "nonpayable"
54
+ },
55
+ {
56
+ "type": "event",
57
+ "name": "Initialized",
58
+ "inputs": [
59
+ {
60
+ "name": "version",
61
+ "type": "uint64",
62
+ "indexed": false,
63
+ "internalType": "uint64"
64
+ }
65
+ ],
66
+ "anonymous": false
67
+ },
68
+ {
69
+ "type": "event",
70
+ "name": "OwnershipTransferStarted",
71
+ "inputs": [
72
+ {
73
+ "name": "previousOwner",
74
+ "type": "address",
75
+ "indexed": true,
76
+ "internalType": "address"
77
+ },
78
+ {
79
+ "name": "newOwner",
80
+ "type": "address",
81
+ "indexed": true,
82
+ "internalType": "address"
83
+ }
84
+ ],
85
+ "anonymous": false
86
+ },
87
+ {
88
+ "type": "event",
89
+ "name": "OwnershipTransferred",
90
+ "inputs": [
91
+ {
92
+ "name": "previousOwner",
93
+ "type": "address",
94
+ "indexed": true,
95
+ "internalType": "address"
96
+ },
97
+ {
98
+ "name": "newOwner",
99
+ "type": "address",
100
+ "indexed": true,
101
+ "internalType": "address"
102
+ }
103
+ ],
104
+ "anonymous": false
105
+ },
106
+ {
107
+ "type": "error",
108
+ "name": "InvalidInitialization",
109
+ "inputs": []
110
+ },
111
+ {
112
+ "type": "error",
113
+ "name": "NotInitializing",
114
+ "inputs": []
115
+ },
116
+ {
117
+ "type": "error",
118
+ "name": "OwnableInvalidOwner",
119
+ "inputs": [
120
+ {
121
+ "name": "owner",
122
+ "type": "address",
123
+ "internalType": "address"
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "type": "error",
129
+ "name": "OwnableUnauthorizedAccount",
130
+ "inputs": [
131
+ {
132
+ "name": "account",
133
+ "type": "address",
134
+ "internalType": "address"
135
+ }
136
+ ]
137
+ }
138
+ ]