@zoralabs/coins 0.9.0 → 1.0.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 (131) hide show
  1. package/.turbo/turbo-build.log +179 -114
  2. package/CHANGELOG.md +46 -0
  3. package/abis/BaseCoin.json +26 -118
  4. package/abis/BaseTest.json +47 -0
  5. package/abis/BuySupplyWithSwapRouterHook.json +40 -0
  6. package/abis/Coin.json +171 -63
  7. package/abis/CoinDopplerMultiCurve.json +38 -0
  8. package/abis/CoinRewardsV4.json +54 -0
  9. package/abis/CoinTest.json +53 -20
  10. package/abis/CoinUniV4Test.json +1091 -0
  11. package/abis/CoinV4.json +234 -211
  12. package/abis/DeployScript.json +47 -0
  13. package/abis/DeployedCoinVersionLookup.json +21 -0
  14. package/abis/DeployedCoinVersionLookupTest.json +716 -0
  15. package/abis/DifferentNamespaceVersionLookup.json +39 -0
  16. package/abis/DopplerUniswapV3Test.json +49 -93
  17. package/abis/ERC20.json +310 -0
  18. package/abis/FactoryTest.json +85 -7
  19. package/abis/FeeEstimatorHook.json +1515 -0
  20. package/abis/HooksDeployment.json +23 -0
  21. package/abis/HooksTest.json +60 -0
  22. package/abis/ICoin.json +40 -71
  23. package/abis/ICoinV3.json +879 -0
  24. package/abis/ICoinV4.json +915 -0
  25. package/abis/IDeployedCoinVersionLookup.json +21 -0
  26. package/abis/IERC721.json +36 -36
  27. package/abis/IHasPoolKey.json +42 -0
  28. package/abis/IHasRewardsRecipients.json +54 -0
  29. package/abis/IHasSwapPath.json +60 -0
  30. package/abis/IMsgSender.json +15 -0
  31. package/abis/IPoolConfigEncoding.json +46 -0
  32. package/abis/ISwapPathRouter.json +92 -0
  33. package/abis/IUniversalRouter.json +61 -0
  34. package/abis/IUnlockCallback.json +21 -0
  35. package/abis/IV4Quoter.json +310 -0
  36. package/abis/IZoraFactory.json +210 -11
  37. package/abis/IZoraV4CoinHook.json +348 -4
  38. package/abis/MockERC20.json +21 -0
  39. package/abis/MultiOwnableTest.json +47 -0
  40. package/abis/{CoinConfigurationVersions.json → Position.json} +1 -1
  41. package/abis/PrintUpgradeCommand.json +9 -0
  42. package/abis/ProxyShim.json +24 -0
  43. package/abis/StateLibrary.json +80 -0
  44. package/abis/TestDeployedCoinVersionLookupImplementation.json +39 -0
  45. package/abis/TestV4Swap.json +9 -0
  46. package/abis/UpgradeCoinImpl.json +47 -0
  47. package/abis/UpgradesTest.json +81 -0
  48. package/abis/Vm.json +1482 -111
  49. package/abis/VmSafe.json +856 -32
  50. package/abis/ZoraFactoryImpl.json +339 -1
  51. package/abis/ZoraV4CoinHook.json +442 -5
  52. package/addresses/8453.json +7 -4
  53. package/addresses/84532.json +8 -5
  54. package/addresses/dev/8453.json +10 -0
  55. package/dist/index.cjs +1932 -167
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.js +1928 -167
  58. package/dist/index.js.map +1 -1
  59. package/dist/wagmiGenerated.d.ts +2606 -160
  60. package/dist/wagmiGenerated.d.ts.map +1 -1
  61. package/foundry.toml +1 -0
  62. package/package/wagmiGenerated.ts +1941 -164
  63. package/package.json +8 -3
  64. package/remappings.txt +6 -1
  65. package/script/Deploy.s.sol +1 -1
  66. package/script/DeployDevFactory.s.sol +21 -0
  67. package/script/DeployHooks.s.sol +1 -1
  68. package/script/PrintUpgradeCommand.s.sol +13 -0
  69. package/script/Simulate.s.sol +1 -10
  70. package/script/TestBackingCoinSwap.s.sol +147 -0
  71. package/script/TestV4Swap.s.sol +136 -0
  72. package/script/UpgradeCoinImpl.sol +2 -2
  73. package/script/UpgradeFactoryImpl.s.sol +2 -2
  74. package/src/BaseCoin.sol +190 -0
  75. package/src/Coin.sol +87 -202
  76. package/src/CoinV4.sol +121 -0
  77. package/src/ZoraFactoryImpl.sol +208 -36
  78. package/{script → src/deployment}/CoinsDeployerBase.sol +111 -17
  79. package/src/hooks/ZoraV4CoinHook.sol +212 -0
  80. package/src/hooks/{BaseCoinDeployHook.sol → deployment/BaseCoinDeployHook.sol} +3 -3
  81. package/src/hooks/deployment/BuySupplyWithSwapRouterHook.sol +140 -0
  82. package/src/interfaces/ICoin.sol +31 -39
  83. package/src/interfaces/ICoinV3.sol +71 -0
  84. package/src/interfaces/ICoinV4.sol +69 -0
  85. package/src/interfaces/IDeployedCoinVersionLookup.sol +11 -0
  86. package/src/interfaces/IMsgSender.sol +9 -0
  87. package/src/interfaces/IPoolConfigEncoding.sol +14 -0
  88. package/src/interfaces/ISwapPathRouter.sol +14 -0
  89. package/src/interfaces/IZoraFactory.sol +67 -28
  90. package/src/interfaces/IZoraV4CoinHook.sol +116 -0
  91. package/src/libs/CoinCommon.sol +15 -0
  92. package/src/libs/CoinConfigurationVersions.sol +116 -1
  93. package/src/libs/CoinConstants.sol +5 -0
  94. package/src/libs/CoinDopplerMultiCurve.sol +134 -0
  95. package/src/libs/CoinDopplerUniV3.sol +19 -171
  96. package/src/libs/CoinRewards.sol +195 -0
  97. package/src/libs/CoinRewardsV4.sol +179 -0
  98. package/src/libs/CoinSetup.sol +57 -0
  99. package/src/libs/CoinSetupV3.sol +6 -67
  100. package/src/libs/DopplerMath.sol +156 -0
  101. package/src/libs/HooksDeployment.sol +128 -0
  102. package/src/libs/MarketConstants.sol +4 -0
  103. package/src/libs/PoolStateReader.sol +22 -0
  104. package/src/libs/UniV3BuySell.sol +74 -292
  105. package/src/libs/UniV4SwapHelper.sol +65 -0
  106. package/src/libs/UniV4SwapToCurrency.sol +109 -0
  107. package/src/libs/V4Liquidity.sol +122 -0
  108. package/src/types/PoolConfiguration.sol +15 -0
  109. package/src/utils/DeployedCoinVersionLookup.sol +52 -0
  110. package/src/version/ContractVersionBase.sol +1 -1
  111. package/test/Coin.t.sol +78 -88
  112. package/test/CoinDopplerUniV3.t.sol +32 -171
  113. package/test/CoinUniV4.t.sol +777 -0
  114. package/test/{Hooks.t.sol → DeploymentHooks.t.sol} +53 -16
  115. package/test/Factory.t.sol +80 -47
  116. package/test/MultiOwnable.t.sol +6 -3
  117. package/test/Upgrades.t.sol +97 -5
  118. package/test/mocks/MockERC20.sol +12 -0
  119. package/test/utils/BaseTest.sol +162 -57
  120. package/test/utils/DeployedCoinVersionLookup.t.sol +127 -0
  121. package/test/utils/FeeEstimatorHook.sol +84 -0
  122. package/test/utils/ProxyShim.sol +17 -0
  123. package/wagmi.config.ts +4 -0
  124. package/.env +0 -1
  125. package/.turbo/turbo-update-contract-version.log +0 -22
  126. package/abis/CoinSetupV3.json +0 -7
  127. package/abis/HookDeployer.json +0 -68
  128. package/abis/IHookDeployer.json +0 -42
  129. package/src/hooks/BuySupplyWithSwapRouterHook.sol +0 -78
  130. package/src/libs/CoinLegacy.sol +0 -48
  131. package/src/libs/CoinLegacyMarket.sol +0 -182
package/abis/CoinV4.json CHANGED
@@ -3,47 +3,33 @@
3
3
  "type": "constructor",
4
4
  "inputs": [
5
5
  {
6
- "name": "_protocolRewardRecipient",
6
+ "name": "protocolRewardRecipient_",
7
7
  "type": "address",
8
8
  "internalType": "address"
9
9
  },
10
10
  {
11
- "name": "_protocolRewards",
11
+ "name": "protocolRewards_",
12
12
  "type": "address",
13
13
  "internalType": "address"
14
14
  },
15
15
  {
16
- "name": "_weth",
16
+ "name": "poolManager_",
17
17
  "type": "address",
18
- "internalType": "address"
19
- },
20
- {
21
- "name": "_poolManager",
22
- "type": "address",
23
- "internalType": "address"
24
- },
25
- {
26
- "name": "_positionManager",
27
- "type": "address",
28
- "internalType": "address"
18
+ "internalType": "contract IPoolManager"
29
19
  },
30
20
  {
31
- "name": "_permit2",
21
+ "name": "airlock_",
32
22
  "type": "address",
33
23
  "internalType": "address"
34
24
  },
35
25
  {
36
- "name": "_hookDeployer",
26
+ "name": "hooks_",
37
27
  "type": "address",
38
- "internalType": "address"
28
+ "internalType": "contract IHooks"
39
29
  }
40
30
  ],
41
31
  "stateMutability": "nonpayable"
42
32
  },
43
- {
44
- "type": "receive",
45
- "stateMutability": "payable"
46
- },
47
33
  {
48
34
  "type": "function",
49
35
  "name": "DOMAIN_SEPARATOR",
@@ -57,19 +43,6 @@
57
43
  ],
58
44
  "stateMutability": "view"
59
45
  },
60
- {
61
- "type": "function",
62
- "name": "WETH",
63
- "inputs": [],
64
- "outputs": [
65
- {
66
- "name": "",
67
- "type": "address",
68
- "internalType": "address"
69
- }
70
- ],
71
- "stateMutability": "view"
72
- },
73
46
  {
74
47
  "type": "function",
75
48
  "name": "addOwner",
@@ -96,6 +69,19 @@
96
69
  "outputs": [],
97
70
  "stateMutability": "nonpayable"
98
71
  },
72
+ {
73
+ "type": "function",
74
+ "name": "airlock",
75
+ "inputs": [],
76
+ "outputs": [
77
+ {
78
+ "name": "",
79
+ "type": "address",
80
+ "internalType": "address"
81
+ }
82
+ ],
83
+ "stateMutability": "view"
84
+ },
99
85
  {
100
86
  "type": "function",
101
87
  "name": "allowance",
@@ -176,63 +162,6 @@
176
162
  "outputs": [],
177
163
  "stateMutability": "nonpayable"
178
164
  },
179
- {
180
- "type": "function",
181
- "name": "buy",
182
- "inputs": [
183
- {
184
- "name": "recipient",
185
- "type": "address",
186
- "internalType": "address"
187
- },
188
- {
189
- "name": "orderSize",
190
- "type": "uint256",
191
- "internalType": "uint256"
192
- },
193
- {
194
- "name": "minAmountOut",
195
- "type": "uint256",
196
- "internalType": "uint256"
197
- },
198
- {
199
- "name": "sqrtPriceLimitX96",
200
- "type": "uint160",
201
- "internalType": "uint160"
202
- },
203
- {
204
- "name": "tradeReferrer",
205
- "type": "address",
206
- "internalType": "address"
207
- }
208
- ],
209
- "outputs": [
210
- {
211
- "name": "",
212
- "type": "uint256",
213
- "internalType": "uint256"
214
- },
215
- {
216
- "name": "",
217
- "type": "uint256",
218
- "internalType": "uint256"
219
- }
220
- ],
221
- "stateMutability": "payable"
222
- },
223
- {
224
- "type": "function",
225
- "name": "claimSecondaryRewards",
226
- "inputs": [
227
- {
228
- "name": "pushEthRewards",
229
- "type": "bool",
230
- "internalType": "bool"
231
- }
232
- ],
233
- "outputs": [],
234
- "stateMutability": "nonpayable"
235
- },
236
165
  {
237
166
  "type": "function",
238
167
  "name": "contractURI",
@@ -285,6 +214,19 @@
285
214
  ],
286
215
  "stateMutability": "view"
287
216
  },
217
+ {
218
+ "type": "function",
219
+ "name": "dopplerFeeRecipient",
220
+ "inputs": [],
221
+ "outputs": [
222
+ {
223
+ "name": "",
224
+ "type": "address",
225
+ "internalType": "address"
226
+ }
227
+ ],
228
+ "stateMutability": "view"
229
+ },
288
230
  {
289
231
  "type": "function",
290
232
  "name": "eip712Domain",
@@ -328,6 +270,119 @@
328
270
  ],
329
271
  "stateMutability": "view"
330
272
  },
273
+ {
274
+ "type": "function",
275
+ "name": "getPayoutSwapPath",
276
+ "inputs": [
277
+ {
278
+ "name": "coinVersionLookup",
279
+ "type": "address",
280
+ "internalType": "contract IDeployedCoinVersionLookup"
281
+ }
282
+ ],
283
+ "outputs": [
284
+ {
285
+ "name": "payoutSwapPath",
286
+ "type": "tuple",
287
+ "internalType": "struct IHasSwapPath.PayoutSwapPath",
288
+ "components": [
289
+ {
290
+ "name": "path",
291
+ "type": "tuple[]",
292
+ "internalType": "struct PathKey[]",
293
+ "components": [
294
+ {
295
+ "name": "intermediateCurrency",
296
+ "type": "address",
297
+ "internalType": "Currency"
298
+ },
299
+ {
300
+ "name": "fee",
301
+ "type": "uint24",
302
+ "internalType": "uint24"
303
+ },
304
+ {
305
+ "name": "tickSpacing",
306
+ "type": "int24",
307
+ "internalType": "int24"
308
+ },
309
+ {
310
+ "name": "hooks",
311
+ "type": "address",
312
+ "internalType": "contract IHooks"
313
+ },
314
+ {
315
+ "name": "hookData",
316
+ "type": "bytes",
317
+ "internalType": "bytes"
318
+ }
319
+ ]
320
+ },
321
+ {
322
+ "name": "currencyIn",
323
+ "type": "address",
324
+ "internalType": "Currency"
325
+ }
326
+ ]
327
+ }
328
+ ],
329
+ "stateMutability": "view"
330
+ },
331
+ {
332
+ "type": "function",
333
+ "name": "getPoolConfiguration",
334
+ "inputs": [],
335
+ "outputs": [
336
+ {
337
+ "name": "",
338
+ "type": "tuple",
339
+ "internalType": "struct PoolConfiguration",
340
+ "components": [
341
+ {
342
+ "name": "version",
343
+ "type": "uint8",
344
+ "internalType": "uint8"
345
+ },
346
+ {
347
+ "name": "numPositions",
348
+ "type": "uint16",
349
+ "internalType": "uint16"
350
+ },
351
+ {
352
+ "name": "fee",
353
+ "type": "uint24",
354
+ "internalType": "uint24"
355
+ },
356
+ {
357
+ "name": "tickSpacing",
358
+ "type": "int24",
359
+ "internalType": "int24"
360
+ },
361
+ {
362
+ "name": "numDiscoveryPositions",
363
+ "type": "uint16[]",
364
+ "internalType": "uint16[]"
365
+ },
366
+ {
367
+ "name": "tickLower",
368
+ "type": "int24[]",
369
+ "internalType": "int24[]"
370
+ },
371
+ {
372
+ "name": "tickUpper",
373
+ "type": "int24[]",
374
+ "internalType": "int24[]"
375
+ },
376
+ {
377
+ "name": "maxDiscoverySupplyShare",
378
+ "type": "uint256[]",
379
+ "internalType": "uint256[]"
380
+ }
381
+ ]
382
+ }
383
+ ],
384
+ "stateMutability": "view"
385
+ },
331
386
  {
332
387
  "type": "function",
333
388
  "name": "getPoolKey",
@@ -368,19 +423,6 @@
368
423
  ],
369
424
  "stateMutability": "view"
370
425
  },
371
- {
372
- "type": "function",
373
- "name": "hookDeployer",
374
- "inputs": [],
375
- "outputs": [
376
- {
377
- "name": "",
378
- "type": "address",
379
- "internalType": "contract IHookDeployer"
380
- }
381
- ],
382
- "stateMutability": "view"
383
- },
384
426
  {
385
427
  "type": "function",
386
428
  "name": "hooks",
@@ -424,14 +466,98 @@
424
466
  "internalType": "string"
425
467
  },
426
468
  {
427
- "name": "poolConfig_",
428
- "type": "bytes",
429
- "internalType": "bytes"
469
+ "name": "platformReferrer_",
470
+ "type": "address",
471
+ "internalType": "address"
430
472
  },
431
473
  {
432
- "name": "platformReferrer_",
474
+ "name": "currency_",
433
475
  "type": "address",
434
476
  "internalType": "address"
477
+ },
478
+ {
479
+ "name": "poolKey_",
480
+ "type": "tuple",
481
+ "internalType": "struct PoolKey",
482
+ "components": [
483
+ {
484
+ "name": "currency0",
485
+ "type": "address",
486
+ "internalType": "Currency"
487
+ },
488
+ {
489
+ "name": "currency1",
490
+ "type": "address",
491
+ "internalType": "Currency"
492
+ },
493
+ {
494
+ "name": "fee",
495
+ "type": "uint24",
496
+ "internalType": "uint24"
497
+ },
498
+ {
499
+ "name": "tickSpacing",
500
+ "type": "int24",
501
+ "internalType": "int24"
502
+ },
503
+ {
504
+ "name": "hooks",
505
+ "type": "address",
506
+ "internalType": "contract IHooks"
507
+ }
508
+ ]
509
+ },
510
+ {
511
+ "name": "sqrtPriceX96",
512
+ "type": "uint160",
513
+ "internalType": "uint160"
514
+ },
515
+ {
516
+ "name": "poolConfiguration_",
517
+ "type": "tuple",
518
+ "internalType": "struct PoolConfiguration",
519
+ "components": [
520
+ {
521
+ "name": "version",
522
+ "type": "uint8",
523
+ "internalType": "uint8"
524
+ },
525
+ {
526
+ "name": "numPositions",
527
+ "type": "uint16",
528
+ "internalType": "uint16"
529
+ },
530
+ {
531
+ "name": "fee",
532
+ "type": "uint24",
533
+ "internalType": "uint24"
534
+ },
535
+ {
536
+ "name": "tickSpacing",
537
+ "type": "int24",
538
+ "internalType": "int24"
539
+ },
540
+ {
541
+ "name": "numDiscoveryPositions",
542
+ "type": "uint16[]",
543
+ "internalType": "uint16[]"
544
+ },
545
+ {
546
+ "name": "tickLower",
547
+ "type": "int24[]",
548
+ "internalType": "int24[]"
549
+ },
550
+ {
551
+ "name": "tickUpper",
552
+ "type": "int24[]",
553
+ "internalType": "int24[]"
554
+ },
555
+ {
556
+ "name": "maxDiscoverySupplyShare",
557
+ "type": "uint256[]",
558
+ "internalType": "uint256[]"
559
+ }
560
+ ]
435
561
  }
436
562
  ],
437
563
  "outputs": [],
@@ -557,19 +683,6 @@
557
683
  "outputs": [],
558
684
  "stateMutability": "nonpayable"
559
685
  },
560
- {
561
- "type": "function",
562
- "name": "permit2",
563
- "inputs": [],
564
- "outputs": [
565
- {
566
- "name": "",
567
- "type": "address",
568
- "internalType": "contract IAllowanceTransfer"
569
- }
570
- ],
571
- "stateMutability": "view"
572
- },
573
686
  {
574
687
  "type": "function",
575
688
  "name": "platformReferrer",
@@ -583,39 +696,6 @@
583
696
  ],
584
697
  "stateMutability": "view"
585
698
  },
586
- {
587
- "type": "function",
588
- "name": "poolKey",
589
- "inputs": [],
590
- "outputs": [
591
- {
592
- "name": "currency0",
593
- "type": "address",
594
- "internalType": "Currency"
595
- },
596
- {
597
- "name": "currency1",
598
- "type": "address",
599
- "internalType": "Currency"
600
- },
601
- {
602
- "name": "fee",
603
- "type": "uint24",
604
- "internalType": "uint24"
605
- },
606
- {
607
- "name": "tickSpacing",
608
- "type": "int24",
609
- "internalType": "int24"
610
- },
611
- {
612
- "name": "hooks",
613
- "type": "address",
614
- "internalType": "contract IHooks"
615
- }
616
- ],
617
- "stateMutability": "view"
618
- },
619
699
  {
620
700
  "type": "function",
621
701
  "name": "poolManager",
@@ -629,19 +709,6 @@
629
709
  ],
630
710
  "stateMutability": "view"
631
711
  },
632
- {
633
- "type": "function",
634
- "name": "positionManager",
635
- "inputs": [],
636
- "outputs": [
637
- {
638
- "name": "",
639
- "type": "address",
640
- "internalType": "contract IPositionManager"
641
- }
642
- ],
643
- "stateMutability": "view"
644
- },
645
712
  {
646
713
  "type": "function",
647
714
  "name": "protocolRewardRecipient",
@@ -701,50 +768,6 @@
701
768
  "outputs": [],
702
769
  "stateMutability": "nonpayable"
703
770
  },
704
- {
705
- "type": "function",
706
- "name": "sell",
707
- "inputs": [
708
- {
709
- "name": "recipient",
710
- "type": "address",
711
- "internalType": "address"
712
- },
713
- {
714
- "name": "orderSize",
715
- "type": "uint256",
716
- "internalType": "uint256"
717
- },
718
- {
719
- "name": "minAmountOut",
720
- "type": "uint256",
721
- "internalType": "uint256"
722
- },
723
- {
724
- "name": "sqrtPriceLimitX96",
725
- "type": "uint160",
726
- "internalType": "uint160"
727
- },
728
- {
729
- "name": "tradeReferrer",
730
- "type": "address",
731
- "internalType": "address"
732
- }
733
- ],
734
- "outputs": [
735
- {
736
- "name": "",
737
- "type": "uint256",
738
- "internalType": "uint256"
739
- },
740
- {
741
- "name": "",
742
- "type": "uint256",
743
- "internalType": "uint256"
744
- }
745
- ],
746
- "stateMutability": "nonpayable"
747
- },
748
771
  {
749
772
  "type": "function",
750
773
  "name": "setContractURI",
@@ -5,5 +5,52 @@
5
5
  "inputs": [],
6
6
  "outputs": [],
7
7
  "stateMutability": "nonpayable"
8
+ },
9
+ {
10
+ "type": "error",
11
+ "name": "Create2EmptyBytecode",
12
+ "inputs": []
13
+ },
14
+ {
15
+ "type": "error",
16
+ "name": "Create2FailedDeployment",
17
+ "inputs": []
18
+ },
19
+ {
20
+ "type": "error",
21
+ "name": "Create2InsufficientBalance",
22
+ "inputs": [
23
+ {
24
+ "name": "balance",
25
+ "type": "uint256",
26
+ "internalType": "uint256"
27
+ },
28
+ {
29
+ "name": "needed",
30
+ "type": "uint256",
31
+ "internalType": "uint256"
32
+ }
33
+ ]
34
+ },
35
+ {
36
+ "type": "error",
37
+ "name": "HookNotDeployed",
38
+ "inputs": []
39
+ },
40
+ {
41
+ "type": "error",
42
+ "name": "InvalidHookAddress",
43
+ "inputs": [
44
+ {
45
+ "name": "expected",
46
+ "type": "address",
47
+ "internalType": "address"
48
+ },
49
+ {
50
+ "name": "actual",
51
+ "type": "address",
52
+ "internalType": "address"
53
+ }
54
+ ]
8
55
  }
9
56
  ]
@@ -0,0 +1,21 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "getVersionForDeployedCoin",
5
+ "inputs": [
6
+ {
7
+ "name": "coin",
8
+ "type": "address",
9
+ "internalType": "address"
10
+ }
11
+ ],
12
+ "outputs": [
13
+ {
14
+ "name": "",
15
+ "type": "uint8",
16
+ "internalType": "uint8"
17
+ }
18
+ ],
19
+ "stateMutability": "view"
20
+ }
21
+ ]