@zoralabs/coins 2.0.0 → 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 (69) hide show
  1. package/.turbo/turbo-build.log +106 -110
  2. package/CHANGELOG.md +28 -0
  3. package/README.md +30 -109
  4. package/abis/BaseCoin.json +442 -0
  5. package/abis/CoinTest.json +3 -246
  6. package/abis/FactoryTest.json +5 -137
  7. package/abis/HooksTest.json +0 -26
  8. package/abis/ICoin.json +378 -0
  9. package/abis/ICoinV3.json +378 -0
  10. package/abis/IZoraFactory.json +0 -18
  11. package/abis/LiquidityMigrationTest.json +101 -0
  12. package/abis/MockBadFactory.json +15 -0
  13. package/abis/ZoraFactoryImpl.json +1 -67
  14. package/dist/index.cjs +236 -265
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.js +235 -264
  17. package/dist/index.js.map +1 -1
  18. package/dist/wagmiGenerated.d.ts +389 -493
  19. package/dist/wagmiGenerated.d.ts.map +1 -1
  20. package/package/wagmiGenerated.ts +240 -269
  21. package/package.json +3 -3
  22. package/script/DeployPostDeploymentHooks.s.sol +2 -2
  23. package/script/TestBackingCoinSwap.s.sol +8 -8
  24. package/script/TestV4Swap.s.sol +8 -8
  25. package/script/UpgradeFactoryImpl.s.sol +0 -1
  26. package/src/BaseCoin.sol +109 -6
  27. package/src/ContentCoin.sol +4 -4
  28. package/src/CreatorCoin.sol +5 -5
  29. package/src/ZoraFactoryImpl.sol +10 -93
  30. package/src/deployment/CoinsDeployerBase.sol +10 -27
  31. package/src/hooks/BaseZoraV4CoinHook.sol +5 -5
  32. package/src/hooks/deployment/BuySupplyWithSwapRouterHook.sol +4 -5
  33. package/src/interfaces/ICoin.sol +67 -1
  34. package/src/interfaces/ICreatorCoin.sol +2 -2
  35. package/src/interfaces/IZoraFactory.sol +0 -5
  36. package/src/libs/CoinConfigurationVersions.sol +1 -39
  37. package/src/libs/CoinRewardsV4.sol +2 -2
  38. package/src/libs/CoinSetup.sol +1 -4
  39. package/src/libs/UniV4SwapHelper.sol +1 -1
  40. package/src/libs/UniV4SwapToCurrency.sol +2 -2
  41. package/src/libs/V4Liquidity.sol +1 -1
  42. package/src/version/ContractVersionBase.sol +1 -1
  43. package/test/Coin.t.sol +112 -535
  44. package/test/CoinUniV4.t.sol +5 -5
  45. package/test/DeploymentHooks.t.sol +5 -102
  46. package/test/Factory.t.sol +23 -306
  47. package/test/LiquidityMigration.t.sol +160 -2
  48. package/test/MultiOwnable.t.sol +36 -36
  49. package/test/Upgrades.t.sol +16 -35
  50. package/test/utils/BaseTest.sol +16 -69
  51. package/test/utils/FeeEstimatorHook.sol +3 -3
  52. package/wagmi.config.ts +1 -1
  53. package/abis/BaseCoinV4.json +0 -1840
  54. package/abis/Coin.json +0 -1912
  55. package/abis/DopplerUniswapV3Test.json +0 -800
  56. package/abis/ICoinV4.json +0 -1048
  57. package/abis/Simulate.json +0 -29
  58. package/abis/UniV3BuySell.json +0 -12
  59. package/abis/UniV3Errors.json +0 -32
  60. package/script/Simulate.s.sol +0 -59
  61. package/src/BaseCoinV4.sol +0 -143
  62. package/src/Coin.sol +0 -236
  63. package/src/interfaces/ICoinV4.sol +0 -74
  64. package/src/libs/CoinDopplerUniV3.sol +0 -50
  65. package/src/libs/CoinRewards.sol +0 -201
  66. package/src/libs/CoinSetupV3.sol +0 -50
  67. package/src/libs/UniV3BuySell.sol +0 -231
  68. package/src/libs/UniV3Errors.sol +0 -11
  69. package/test/CoinDopplerUniV3.t.sol +0 -310
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",
@@ -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
+ ]
@@ -2,11 +2,6 @@
2
2
  {
3
3
  "type": "constructor",
4
4
  "inputs": [
5
- {
6
- "name": "_coinImpl",
7
- "type": "address",
8
- "internalType": "address"
9
- },
10
5
  {
11
6
  "name": "_coinV4Impl",
12
7
  "type": "address",
@@ -94,19 +89,6 @@
94
89
  ],
95
90
  "stateMutability": "view"
96
91
  },
97
- {
98
- "type": "function",
99
- "name": "coinImpl",
100
- "inputs": [],
101
- "outputs": [
102
- {
103
- "name": "",
104
- "type": "address",
105
- "internalType": "address"
106
- }
107
- ],
108
- "stateMutability": "view"
109
- },
110
92
  {
111
93
  "type": "function",
112
94
  "name": "coinV4Impl",
@@ -358,7 +340,7 @@
358
340
  "internalType": "address"
359
341
  },
360
342
  {
361
- "name": "orderSize",
343
+ "name": "",
362
344
  "type": "uint256",
363
345
  "internalType": "uint256"
364
346
  }
@@ -959,27 +941,11 @@
959
941
  }
960
942
  ]
961
943
  },
962
- {
963
- "type": "error",
964
- "name": "AddressInsufficientBalance",
965
- "inputs": [
966
- {
967
- "name": "account",
968
- "type": "address",
969
- "internalType": "address"
970
- }
971
- ]
972
- },
973
944
  {
974
945
  "type": "error",
975
946
  "name": "ArrayLengthMismatch",
976
947
  "inputs": []
977
948
  },
978
- {
979
- "type": "error",
980
- "name": "CannotMintZeroLiquidity",
981
- "inputs": []
982
- },
983
949
  {
984
950
  "type": "error",
985
951
  "name": "ConfigTickLowerMustBeLessThanTickUpper",
@@ -1011,11 +977,6 @@
1011
977
  "name": "ERC1967NonPayable",
1012
978
  "inputs": []
1013
979
  },
1014
- {
1015
- "type": "error",
1016
- "name": "ERC20TransferAmountMismatch",
1017
- "inputs": []
1018
- },
1019
980
  {
1020
981
  "type": "error",
1021
982
  "name": "EthTransferInvalid",
@@ -1062,22 +1023,6 @@
1062
1023
  }
1063
1024
  ]
1064
1025
  },
1065
- {
1066
- "type": "error",
1067
- "name": "InvalidTickRangeMisordered",
1068
- "inputs": [
1069
- {
1070
- "name": "tickLower",
1071
- "type": "int24",
1072
- "internalType": "int24"
1073
- },
1074
- {
1075
- "name": "tickUpper",
1076
- "type": "int24",
1077
- "internalType": "int24"
1078
- }
1079
- ]
1080
- },
1081
1026
  {
1082
1027
  "type": "error",
1083
1028
  "name": "MaxShareToBeSoldExceeded",
@@ -1131,17 +1076,6 @@
1131
1076
  "name": "ReentrancyGuardReentrantCall",
1132
1077
  "inputs": []
1133
1078
  },
1134
- {
1135
- "type": "error",
1136
- "name": "SafeERC20FailedOperation",
1137
- "inputs": [
1138
- {
1139
- "name": "token",
1140
- "type": "address",
1141
- "internalType": "address"
1142
- }
1143
- ]
1144
- },
1145
1079
  {
1146
1080
  "type": "error",
1147
1081
  "name": "UUPSUnauthorizedCallContext",