@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/Coin.json CHANGED
@@ -3,32 +3,32 @@
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": "weth_",
17
17
  "type": "address",
18
18
  "internalType": "address"
19
19
  },
20
20
  {
21
- "name": "_v3Factory",
21
+ "name": "v3Factory_",
22
22
  "type": "address",
23
23
  "internalType": "address"
24
24
  },
25
25
  {
26
- "name": "_swapRouter",
26
+ "name": "swapRouter_",
27
27
  "type": "address",
28
28
  "internalType": "address"
29
29
  },
30
30
  {
31
- "name": "_airlock",
31
+ "name": "airlock_",
32
32
  "type": "address",
33
33
  "internalType": "address"
34
34
  }
@@ -293,6 +293,19 @@
293
293
  ],
294
294
  "stateMutability": "view"
295
295
  },
296
+ {
297
+ "type": "function",
298
+ "name": "dopplerFeeRecipient",
299
+ "inputs": [],
300
+ "outputs": [
301
+ {
302
+ "name": "",
303
+ "type": "address",
304
+ "internalType": "address"
305
+ }
306
+ ],
307
+ "stateMutability": "view"
308
+ },
296
309
  {
297
310
  "type": "function",
298
311
  "name": "eip712Domain",
@@ -336,6 +349,61 @@
336
349
  ],
337
350
  "stateMutability": "view"
338
351
  },
352
+ {
353
+ "type": "function",
354
+ "name": "getPoolConfiguration",
355
+ "inputs": [],
356
+ "outputs": [
357
+ {
358
+ "name": "",
359
+ "type": "tuple",
360
+ "internalType": "struct PoolConfiguration",
361
+ "components": [
362
+ {
363
+ "name": "version",
364
+ "type": "uint8",
365
+ "internalType": "uint8"
366
+ },
367
+ {
368
+ "name": "numPositions",
369
+ "type": "uint16",
370
+ "internalType": "uint16"
371
+ },
372
+ {
373
+ "name": "fee",
374
+ "type": "uint24",
375
+ "internalType": "uint24"
376
+ },
377
+ {
378
+ "name": "tickSpacing",
379
+ "type": "int24",
380
+ "internalType": "int24"
381
+ },
382
+ {
383
+ "name": "numDiscoveryPositions",
384
+ "type": "uint16[]",
385
+ "internalType": "uint16[]"
386
+ },
387
+ {
388
+ "name": "tickLower",
389
+ "type": "int24[]",
390
+ "internalType": "int24[]"
391
+ },
392
+ {
393
+ "name": "tickUpper",
394
+ "type": "int24[]",
395
+ "internalType": "int24[]"
396
+ },
397
+ {
398
+ "name": "maxDiscoverySupplyShare",
399
+ "type": "uint256[]",
400
+ "internalType": "uint256[]"
401
+ }
402
+ ]
403
+ }
404
+ ],
405
+ "stateMutability": "view"
406
+ },
339
407
  {
340
408
  "type": "function",
341
409
  "name": "initialize",
@@ -366,14 +434,88 @@
366
434
  "internalType": "string"
367
435
  },
368
436
  {
369
- "name": "poolConfig_",
370
- "type": "bytes",
371
- "internalType": "bytes"
437
+ "name": "platformReferrer_",
438
+ "type": "address",
439
+ "internalType": "address"
372
440
  },
373
441
  {
374
- "name": "platformReferrer_",
442
+ "name": "currency_",
443
+ "type": "address",
444
+ "internalType": "address"
445
+ },
446
+ {
447
+ "name": "poolAddress_",
375
448
  "type": "address",
376
449
  "internalType": "address"
450
+ },
451
+ {
452
+ "name": "poolConfiguration_",
453
+ "type": "tuple",
454
+ "internalType": "struct PoolConfiguration",
455
+ "components": [
456
+ {
457
+ "name": "version",
458
+ "type": "uint8",
459
+ "internalType": "uint8"
460
+ },
461
+ {
462
+ "name": "numPositions",
463
+ "type": "uint16",
464
+ "internalType": "uint16"
465
+ },
466
+ {
467
+ "name": "fee",
468
+ "type": "uint24",
469
+ "internalType": "uint24"
470
+ },
471
+ {
472
+ "name": "tickSpacing",
473
+ "type": "int24",
474
+ "internalType": "int24"
475
+ },
476
+ {
477
+ "name": "numDiscoveryPositions",
478
+ "type": "uint16[]",
479
+ "internalType": "uint16[]"
480
+ },
481
+ {
482
+ "name": "tickLower",
483
+ "type": "int24[]",
484
+ "internalType": "int24[]"
485
+ },
486
+ {
487
+ "name": "tickUpper",
488
+ "type": "int24[]",
489
+ "internalType": "int24[]"
490
+ },
491
+ {
492
+ "name": "maxDiscoverySupplyShare",
493
+ "type": "uint256[]",
494
+ "internalType": "uint256[]"
495
+ }
496
+ ]
497
+ },
498
+ {
499
+ "name": "positions_",
500
+ "type": "tuple[]",
501
+ "internalType": "struct LpPosition[]",
502
+ "components": [
503
+ {
504
+ "name": "tickLower",
505
+ "type": "int24",
506
+ "internalType": "int24"
507
+ },
508
+ {
509
+ "name": "tickUpper",
510
+ "type": "int24",
511
+ "internalType": "int24"
512
+ },
513
+ {
514
+ "name": "liquidity",
515
+ "type": "uint128",
516
+ "internalType": "uint128"
517
+ }
518
+ ]
377
519
  }
378
520
  ],
379
521
  "outputs": [],
@@ -561,44 +703,35 @@
561
703
  "type": "uint8",
562
704
  "internalType": "uint8"
563
705
  },
564
- {
565
- "name": "tickLower",
566
- "type": "int24",
567
- "internalType": "int24"
568
- },
569
- {
570
- "name": "tickUpper",
571
- "type": "int24",
572
- "internalType": "int24"
573
- },
574
706
  {
575
707
  "name": "numPositions",
576
708
  "type": "uint16",
577
709
  "internalType": "uint16"
578
710
  },
579
711
  {
580
- "name": "maxDiscoverySupplyShare",
581
- "type": "uint256",
582
- "internalType": "uint256"
712
+ "name": "fee",
713
+ "type": "uint24",
714
+ "internalType": "uint24"
715
+ },
716
+ {
717
+ "name": "tickSpacing",
718
+ "type": "int24",
719
+ "internalType": "int24"
583
720
  }
584
721
  ],
585
722
  "stateMutability": "view"
586
723
  },
587
724
  {
588
725
  "type": "function",
589
- "name": "poolState",
590
- "inputs": [],
591
- "outputs": [
592
- {
593
- "name": "asset",
594
- "type": "address",
595
- "internalType": "address"
596
- },
726
+ "name": "positions",
727
+ "inputs": [
597
728
  {
598
- "name": "numeraire",
599
- "type": "address",
600
- "internalType": "address"
601
- },
729
+ "name": "",
730
+ "type": "uint256",
731
+ "internalType": "uint256"
732
+ }
733
+ ],
734
+ "outputs": [
602
735
  {
603
736
  "name": "tickLower",
604
737
  "type": "int24",
@@ -610,29 +743,9 @@
610
743
  "internalType": "int24"
611
744
  },
612
745
  {
613
- "name": "numPositions",
614
- "type": "uint16",
615
- "internalType": "uint16"
616
- },
617
- {
618
- "name": "isInitialized",
619
- "type": "bool",
620
- "internalType": "bool"
621
- },
622
- {
623
- "name": "isExited",
624
- "type": "bool",
625
- "internalType": "bool"
626
- },
627
- {
628
- "name": "maxShareToBeSold",
629
- "type": "uint256",
630
- "internalType": "uint256"
631
- },
632
- {
633
- "name": "totalTokensOnBondingCurve",
634
- "type": "uint256",
635
- "internalType": "uint256"
746
+ "name": "liquidity",
747
+ "type": "uint128",
748
+ "internalType": "uint128"
636
749
  }
637
750
  ],
638
751
  "stateMutability": "view"
@@ -1619,11 +1732,6 @@
1619
1732
  "name": "InvalidPoolVersion",
1620
1733
  "inputs": []
1621
1734
  },
1622
- {
1623
- "type": "error",
1624
- "name": "InvalidPoolVersion",
1625
- "inputs": []
1626
- },
1627
1735
  {
1628
1736
  "type": "error",
1629
1737
  "name": "InvalidTickRangeMisordered",
@@ -0,0 +1,38 @@
1
+ [
2
+ {
3
+ "type": "error",
4
+ "name": "ArrayLengthMismatch",
5
+ "inputs": []
6
+ },
7
+ {
8
+ "type": "error",
9
+ "name": "ConfigTickLowerMustBeLessThanTickUpper",
10
+ "inputs": []
11
+ },
12
+ {
13
+ "type": "error",
14
+ "name": "InvalidTickRangeMisordered",
15
+ "inputs": [
16
+ {
17
+ "name": "tickLower",
18
+ "type": "int24",
19
+ "internalType": "int24"
20
+ },
21
+ {
22
+ "name": "tickUpper",
23
+ "type": "int24",
24
+ "internalType": "int24"
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ "type": "error",
30
+ "name": "ZeroDiscoveryPositions",
31
+ "inputs": []
32
+ },
33
+ {
34
+ "type": "error",
35
+ "name": "ZeroDiscoverySupplyShare",
36
+ "inputs": []
37
+ }
38
+ ]
@@ -0,0 +1,54 @@
1
+ [
2
+ {
3
+ "type": "function",
4
+ "name": "CREATE_REFERRAL_REWARD_BPS",
5
+ "inputs": [],
6
+ "outputs": [
7
+ {
8
+ "name": "",
9
+ "type": "uint256",
10
+ "internalType": "uint256"
11
+ }
12
+ ],
13
+ "stateMutability": "view"
14
+ },
15
+ {
16
+ "type": "function",
17
+ "name": "CREATOR_REWARD_BPS",
18
+ "inputs": [],
19
+ "outputs": [
20
+ {
21
+ "name": "",
22
+ "type": "uint256",
23
+ "internalType": "uint256"
24
+ }
25
+ ],
26
+ "stateMutability": "view"
27
+ },
28
+ {
29
+ "type": "function",
30
+ "name": "DOPPLER_REWARD_BPS",
31
+ "inputs": [],
32
+ "outputs": [
33
+ {
34
+ "name": "",
35
+ "type": "uint256",
36
+ "internalType": "uint256"
37
+ }
38
+ ],
39
+ "stateMutability": "view"
40
+ },
41
+ {
42
+ "type": "function",
43
+ "name": "TRADE_REFERRAL_REWARD_BPS",
44
+ "inputs": [],
45
+ "outputs": [
46
+ {
47
+ "name": "",
48
+ "type": "uint256",
49
+ "internalType": "uint256"
50
+ }
51
+ ],
52
+ "stateMutability": "view"
53
+ }
54
+ ]
@@ -303,14 +303,14 @@
303
303
  "name": "test_contract_uri",
304
304
  "inputs": [],
305
305
  "outputs": [],
306
- "stateMutability": "view"
306
+ "stateMutability": "nonpayable"
307
307
  },
308
308
  {
309
309
  "type": "function",
310
310
  "name": "test_contract_version",
311
311
  "inputs": [],
312
312
  "outputs": [],
313
- "stateMutability": "view"
313
+ "stateMutability": "nonpayable"
314
314
  },
315
315
  {
316
316
  "type": "function",
@@ -331,7 +331,7 @@
331
331
  "name": "test_erc165_interface_support",
332
332
  "inputs": [],
333
333
  "outputs": [],
334
- "stateMutability": "view"
334
+ "stateMutability": "nonpayable"
335
335
  },
336
336
  {
337
337
  "type": "function",
@@ -349,14 +349,14 @@
349
349
  },
350
350
  {
351
351
  "type": "function",
352
- "name": "test_invalid_pool_config_currency",
352
+ "name": "test_invalid_pool_config_version",
353
353
  "inputs": [],
354
354
  "outputs": [],
355
355
  "stateMutability": "nonpayable"
356
356
  },
357
357
  {
358
358
  "type": "function",
359
- "name": "test_invalid_pool_config_version",
359
+ "name": "test_legacy_deploy_deploys_with_default_config",
360
360
  "inputs": [],
361
361
  "outputs": [],
362
362
  "stateMutability": "nonpayable"
@@ -375,13 +375,6 @@
375
375
  "outputs": [],
376
376
  "stateMutability": "nonpayable"
377
377
  },
378
- {
379
- "type": "function",
380
- "name": "test_revert_already_initialized",
381
- "inputs": [],
382
- "outputs": [],
383
- "stateMutability": "nonpayable"
384
- },
385
378
  {
386
379
  "type": "function",
387
380
  "name": "test_revert_buy_zero_address_recipient",
@@ -396,13 +389,6 @@
396
389
  "outputs": [],
397
390
  "stateMutability": "nonpayable"
398
391
  },
399
- {
400
- "type": "function",
401
- "name": "test_revert_pool_exists",
402
- "inputs": [],
403
- "outputs": [],
404
- "stateMutability": "nonpayable"
405
- },
406
392
  {
407
393
  "type": "function",
408
394
  "name": "test_revert_receive_only_weth",
@@ -519,7 +505,7 @@
519
505
  "name": "test_supply_constants",
520
506
  "inputs": [],
521
507
  "outputs": [],
522
- "stateMutability": "view"
508
+ "stateMutability": "nonpayable"
523
509
  },
524
510
  {
525
511
  "type": "event",
@@ -934,5 +920,52 @@
934
920
  }
935
921
  ],
936
922
  "anonymous": false
923
+ },
924
+ {
925
+ "type": "error",
926
+ "name": "Create2EmptyBytecode",
927
+ "inputs": []
928
+ },
929
+ {
930
+ "type": "error",
931
+ "name": "Create2FailedDeployment",
932
+ "inputs": []
933
+ },
934
+ {
935
+ "type": "error",
936
+ "name": "Create2InsufficientBalance",
937
+ "inputs": [
938
+ {
939
+ "name": "balance",
940
+ "type": "uint256",
941
+ "internalType": "uint256"
942
+ },
943
+ {
944
+ "name": "needed",
945
+ "type": "uint256",
946
+ "internalType": "uint256"
947
+ }
948
+ ]
949
+ },
950
+ {
951
+ "type": "error",
952
+ "name": "HookNotDeployed",
953
+ "inputs": []
954
+ },
955
+ {
956
+ "type": "error",
957
+ "name": "InvalidHookAddress",
958
+ "inputs": [
959
+ {
960
+ "name": "expected",
961
+ "type": "address",
962
+ "internalType": "address"
963
+ },
964
+ {
965
+ "name": "actual",
966
+ "type": "address",
967
+ "internalType": "address"
968
+ }
969
+ ]
937
970
  }
938
971
  ]