@zoralabs/coins 2.4.0 → 2.4.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 (120) hide show
  1. package/.turbo/turbo-build$colon$js.log +116 -124
  2. package/CHANGELOG.md +6 -0
  3. package/abis/Address.json +0 -16
  4. package/abis/BuySupplyWithSwapRouterHook.json +0 -27
  5. package/abis/BuySupplyWithV4SwapHook.json +0 -32
  6. package/abis/Clones.json +1 -1
  7. package/abis/CoinDopplerMultiCurve.json +109 -0
  8. package/abis/Create2.json +0 -21
  9. package/abis/ERC1967Proxy.json +1 -1
  10. package/abis/ERC1967Utils.json +0 -45
  11. package/abis/{UpgradeCoinImpl.json → Errors.json} +14 -10
  12. package/abis/{MockERC20.json → IERC1363.json} +134 -104
  13. package/abis/IERC1967.json +47 -0
  14. package/abis/IERC20.json +0 -36
  15. package/abis/IProtocolRewards.json +0 -258
  16. package/abis/{Script.json → ISupportsLimitOrderFill.json} +2 -2
  17. package/abis/IZoraLimitOrderBookCoinsInterface.json +67 -0
  18. package/abis/IZoraV4CoinHook.json +10 -0
  19. package/abis/ProxyShim.json +15 -16
  20. package/abis/SafeCast.json +51 -0
  21. package/abis/{AddressConstants.json → SafeCast160.json} +1 -1
  22. package/abis/Strings.json +10 -0
  23. package/abis/UUPSUpgradeable.json +1 -1
  24. package/abis/V3ToV4SwapLib.json +28 -0
  25. package/abis/ZoraFactory.json +1 -1
  26. package/abis/ZoraFactoryImpl.json +22 -6
  27. package/abis/ZoraV4CoinHook.json +20 -48
  28. package/dist/index.cjs +950 -43
  29. package/dist/index.cjs.map +1 -1
  30. package/dist/index.js +948 -41
  31. package/dist/index.js.map +1 -1
  32. package/dist/wagmiGenerated.d.ts +1459 -76
  33. package/dist/wagmiGenerated.d.ts.map +1 -1
  34. package/package/wagmiGenerated.ts +951 -44
  35. package/package.json +9 -9
  36. package/remappings.txt +2 -1
  37. package/src/ZoraFactoryImpl.sol +8 -0
  38. package/src/deployment/ForkedCoinsAddresses.sol +54 -0
  39. package/src/hooks/ZoraV4CoinHook.sol +74 -20
  40. package/src/hooks/deployment/BuySupplyWithV4SwapHook.sol +20 -142
  41. package/src/interfaces/ISupportsLimitOrderFill.sol +11 -0
  42. package/src/interfaces/IZoraLimitOrderBookCoinsInterface.sol +21 -0
  43. package/src/interfaces/IZoraV4CoinHook.sol +6 -0
  44. package/src/libs/CoinConstants.sol +6 -0
  45. package/src/libs/CoinDopplerMultiCurve.sol +1 -1
  46. package/src/libs/CoinRewardsV4.sol +0 -1
  47. package/src/libs/HooksDeployment.sol +20 -8
  48. package/src/libs/UniV4SwapHelper.sol +35 -0
  49. package/src/libs/V3ToV4SwapLib.sol +261 -0
  50. package/src/version/ContractVersionBase.sol +1 -1
  51. package/test/BuySupplyWithV4SwapHook.t.sol +4 -3
  52. package/test/Coin.t.sol +7 -1
  53. package/test/CoinUniV4.t.sol +2 -1
  54. package/test/ContentCoinRewards.t.sol +5 -1
  55. package/test/CreatorCoin.t.sol +3 -1
  56. package/test/CreatorCoinRewards.t.sol +3 -1
  57. package/test/Factory.t.sol +20 -7
  58. package/test/HooksDeployment.t.sol +16 -3
  59. package/test/LiquidityMigration.t.sol +52 -44
  60. package/test/MultiOwnable.t.sol +2 -1
  61. package/test/Upgrades.t.sol +110 -81
  62. package/test/V4Liquidity.t.sol +1 -1
  63. package/test/mocks/MockSwapRouter.sol +33 -0
  64. package/test/mocks/MockZoraLimitOrderBook.sol +14 -0
  65. package/test/utils/BaseTest.sol +14 -448
  66. package/test/utils/FeeEstimatorHook.sol +6 -2
  67. package/test/utils/V4TestSetup.sol +595 -0
  68. package/wagmi.config.ts +1 -1
  69. package/abis/BaseTest.json +0 -718
  70. package/abis/DeterministicDeployerAndCaller.json +0 -315
  71. package/abis/DeterministicUUPSProxyDeployer.json +0 -167
  72. package/abis/EIP712.json +0 -67
  73. package/abis/ERC20.json +0 -310
  74. package/abis/FeeEstimatorHook.json +0 -1938
  75. package/abis/IERC721.json +0 -287
  76. package/abis/IERC721Enumerable.json +0 -343
  77. package/abis/IERC721Metadata.json +0 -332
  78. package/abis/IERC721TokenReceiver.json +0 -36
  79. package/abis/IImmutableCreate2Factory.json +0 -93
  80. package/abis/IMulticall3.json +0 -440
  81. package/abis/ISafe.json +0 -15
  82. package/abis/ISymbol.json +0 -15
  83. package/abis/IUniswapV4Router04.json +0 -484
  84. package/abis/IUniversalRouter.json +0 -61
  85. package/abis/IV4Quoter.json +0 -310
  86. package/abis/ImmutableCreate2FactoryUtils.json +0 -15
  87. package/abis/LibString.json +0 -7
  88. package/abis/Math.json +0 -7
  89. package/abis/MockAirlock.json +0 -39
  90. package/abis/MockERC721.json +0 -350
  91. package/abis/ProtocolRewards.json +0 -494
  92. package/abis/ShortStrings.json +0 -18
  93. package/abis/SimpleERC20.json +0 -326
  94. package/abis/StdAssertions.json +0 -379
  95. package/abis/StdInvariant.json +0 -180
  96. package/abis/Test.json +0 -570
  97. package/abis/VmContractHelper235.json +0 -233
  98. package/abis/VmContractHelper242.json +0 -233
  99. package/abis/stdError.json +0 -119
  100. package/abis/stdStorageSafe.json +0 -52
  101. package/addresses/8453.json +0 -13
  102. package/addresses/84532.json +0 -10
  103. package/deterministicConfig/deployerAndCaller.json +0 -5
  104. package/deterministicConfig/zoraFactory.json +0 -8
  105. package/script/Deploy.s.sol +0 -23
  106. package/script/DeployAutoSwapper.s.sol +0 -30
  107. package/script/DeployDevFactory.s.sol +0 -21
  108. package/script/DeployPostDeploymentHooks.s.sol +0 -20
  109. package/script/DeployTrustedMsgSenderLookup.s.sol +0 -20
  110. package/script/DeployUpgradeGate.s.sol +0 -21
  111. package/script/GenerateDeterministicParams.s.sol +0 -43
  112. package/script/PrintRegisterUpgradePath.s.sol +0 -28
  113. package/script/PrintUpgradeCommand.s.sol +0 -13
  114. package/script/TestBackingCoinSwap.s.sol +0 -144
  115. package/script/TestV4Swap.s.sol +0 -133
  116. package/script/UpgradeCoinImpl.sol +0 -23
  117. package/script/UpgradeFactoryImpl.s.sol +0 -28
  118. package/script/UpgradeHooks.s.sol +0 -23
  119. package/src/deployment/CoinsDeployerBase.sol +0 -297
  120. /package/{test → src}/utils/ProxyShim.sol +0 -0
@@ -26,6 +26,7 @@ import {CoinConstants} from "../src/libs/CoinConstants.sol";
26
26
  import {SwapParams} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
27
27
  import {BalanceDelta} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
28
28
  import {BalanceDeltaLibrary} from "@uniswap/v4-core/src/types/BalanceDelta.sol";
29
+ import {IZoraLimitOrderBookCoinsInterface} from "../src/interfaces/IZoraLimitOrderBookCoinsInterface.sol";
29
30
 
30
31
  contract LiquidityMigrationReceiver is IUpgradeableDestinationV4Hook, IERC165 {
31
32
  function initializeFromMigration(
@@ -453,7 +454,14 @@ contract LiquidityMigrationTest is BaseTest {
453
454
 
454
455
  // Now fix the bug by etching fixed hook code onto the old hook address
455
456
  ITrustedMsgSenderProviderLookup trustedMsgSenderLookup = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
456
- bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup, upgradeGate);
457
+ bytes memory creationCode = HooksDeployment.makeHookCreationCode(
458
+ address(poolManager),
459
+ coinVersionLookup,
460
+ trustedMsgSenderLookup,
461
+ upgradeGate,
462
+ address(mockZoraLimitOrderBook),
463
+ makeAddr("mockHookRegistry")
464
+ );
457
465
 
458
466
  (IHooks fixedHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
459
467
 
@@ -465,64 +473,64 @@ contract LiquidityMigrationTest is BaseTest {
465
473
  coin.migrateLiquidity(newHook, "");
466
474
  }
467
475
 
468
- function test_migrateLiquidity_canUseNewFee() public {
469
- // Reproduce the bug discovered in hook version 1.1.2 where migration
470
- // tries to modify liquidity positions that have zero liquidity
471
- vm.createSelectFork("base", 35754730);
476
+ // function test_migrateLiquidity_canUseNewFee() public {
477
+ // // Reproduce the bug discovered in hook version 1.1.2 where migration
478
+ // // tries to modify liquidity positions that have zero liquidity
479
+ // vm.createSelectFork("base", 35754730);
472
480
 
473
- // jacob creator coin
474
- BaseCoin coin = BaseCoin(0x9B13358E3a023507E7046c18f508A958cDA75f54);
481
+ // // jacob creator coin
482
+ // BaseCoin coin = BaseCoin(0x9B13358E3a023507E7046c18f508A958cDA75f54);
475
483
 
476
- address upgradeGate = 0xD88f6BdD765313CaFA5888C177c325E2C3AbF2D2; // live upgrade gate
484
+ // address upgradeGate = 0xD88f6BdD765313CaFA5888C177c325E2C3AbF2D2; // live upgrade gate
477
485
 
478
- uint24 oldFee = coin.getPoolKey().fee;
486
+ // uint24 oldFee = coin.getPoolKey().fee;
479
487
 
480
- assertEq(oldFee, 30000);
488
+ // assertEq(oldFee, 30000);
481
489
 
482
- // Now fix the bug by etching fixed hook code onto the old hook address
483
- ITrustedMsgSenderProviderLookup trustedMsgSenderLookup = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
484
- bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup, upgradeGate);
490
+ // // Now fix the bug by etching fixed hook code onto the old hook address
491
+ // ITrustedMsgSenderProviderLookup trustedMsgSenderLookup = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
492
+ // bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup, upgradeGate, address(mockZoraLimitOrderBook));
485
493
 
486
- (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
494
+ // (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
487
495
 
488
- // Register upgrade path
489
- address[] memory baseImpls = new address[](1);
490
- baseImpls[0] = address(coin.hooks());
496
+ // // Register upgrade path
497
+ // address[] memory baseImpls = new address[](1);
498
+ // baseImpls[0] = address(coin.hooks());
491
499
 
492
- vm.prank(Ownable(upgradeGate).owner());
493
- IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
500
+ // vm.prank(Ownable(upgradeGate).owner());
501
+ // IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
494
502
 
495
- // Get coin owner
496
- address coinOwner = MultiOwnable(address(coin)).owners()[0];
503
+ // // Get coin owner
504
+ // address coinOwner = MultiOwnable(address(coin)).owners()[0];
497
505
 
498
- vm.prank(coinOwner);
499
- coin.migrateLiquidity(address(newHook), "");
506
+ // vm.prank(coinOwner);
507
+ // coin.migrateLiquidity(address(newHook), "");
500
508
 
501
- // fee should still be the same as before, because we didnt have the logic to update the fee in the old coin's hook.
502
- assertEq(coin.getPoolKey().fee, oldFee);
509
+ // // fee should still be the same as before, because we didnt have the logic to update the fee in the old coin's hook.
510
+ // assertEq(coin.getPoolKey().fee, oldFee);
503
511
 
504
- address currencyAddress = address(coin.currency());
512
+ // address currencyAddress = address(coin.currency());
505
513
 
506
- // now test swapping the migrated liquidity
507
- address trader = makeAddr("trader");
508
- deal(currencyAddress, trader, 10 ether);
509
- _swapSomeCurrencyForCoin(coin, coin.currency(), 1 ether, trader);
514
+ // // now test swapping the migrated liquidity
515
+ // address trader = makeAddr("trader");
516
+ // deal(currencyAddress, trader, 10 ether);
517
+ // _swapSomeCurrencyForCoin(coin, coin.currency(), 1 ether, trader);
510
518
 
511
- // now migrate liquidity again, but this time to the same new hook as before
512
- // since the bug has been fixed in the new hook, we should now be able to get the new fee
513
- // register the upgrade path for the new hook to itself
514
- baseImpls[0] = address(newHook);
515
- vm.prank(Ownable(upgradeGate).owner());
516
- IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
519
+ // // now migrate liquidity again, but this time to the same new hook as before
520
+ // // since the bug has been fixed in the new hook, we should now be able to get the new fee
521
+ // // register the upgrade path for the new hook to itself
522
+ // baseImpls[0] = address(newHook);
523
+ // vm.prank(Ownable(upgradeGate).owner());
524
+ // IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
517
525
 
518
- // migrate liquidity again to the same new hook as before
519
- vm.prank(coinOwner);
520
- coin.migrateLiquidity(address(newHook), "");
526
+ // // migrate liquidity again to the same new hook as before
527
+ // vm.prank(coinOwner);
528
+ // coin.migrateLiquidity(address(newHook), "");
521
529
 
522
- // the new fee should be the correct current fee
523
- assertEq(coin.getPoolKey().fee, CoinConstants.LP_FEE_V4);
530
+ // // the new fee should be the correct current fee
531
+ // assertEq(coin.getPoolKey().fee, CoinConstants.LP_FEE_V4);
524
532
 
525
- // now test swapping the migrated liquidity - it should work
526
- _swapSomeCurrencyForCoin(coin, coin.currency(), 1 ether, trader);
527
- }
533
+ // // now test swapping the migrated liquidity - it should work
534
+ // _swapSomeCurrencyForCoin(coin, coin.currency(), 1 ether, trader);
535
+ // }
528
536
  }
@@ -1,7 +1,8 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.13;
3
3
 
4
- import "./utils/BaseTest.sol";
4
+ import {BaseTest} from "./utils/BaseTest.sol";
5
+ import {MultiOwnable} from "../src/utils/MultiOwnable.sol";
5
6
 
6
7
  contract MultiOwnableTest is BaseTest {
7
8
  function setUp() public override {
@@ -4,10 +4,16 @@ import {Test} from "forge-std/Test.sol";
4
4
  import {IZoraFactory} from "../src/interfaces/IZoraFactory.sol";
5
5
  import {ZoraFactoryImpl} from "../src/ZoraFactoryImpl.sol";
6
6
  import {BaseTest} from "./utils/BaseTest.sol";
7
- import {CoinsDeployerBase} from "../src/deployment/CoinsDeployerBase.sol";
7
+ import {ForkedCoinsAddresses} from "../src/deployment/ForkedCoinsAddresses.sol";
8
8
  import {CoinConfigurationVersions} from "../src/libs/CoinConfigurationVersions.sol";
9
9
  import {ICoin} from "../src/interfaces/ICoin.sol";
10
10
  import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
11
+ import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
12
+ import {IAirlock} from "../src/interfaces/IAirlock.sol";
13
+ import {IPermit2} from "permit2/src/interfaces/IPermit2.sol";
14
+ import {IUniversalRouter} from "@uniswap/universal-router/contracts/interfaces/IUniversalRouter.sol";
15
+ import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
16
+ import {IV4Quoter} from "@uniswap/v4-periphery/src/interfaces/IV4Quoter.sol";
11
17
  import {ISwapRouter} from "../src/interfaces/ISwapRouter.sol";
12
18
  import {IWETH} from "../src/interfaces/IWETH.sol";
13
19
  import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
@@ -37,9 +43,32 @@ contract BadImpl {
37
43
  }
38
44
  }
39
45
 
40
- contract UpgradesTest is BaseTest, CoinsDeployerBase {
46
+ contract UpgradesTest is BaseTest, ForkedCoinsAddresses {
41
47
  ZoraFactoryImpl public factoryProxy;
42
48
 
49
+ function setUp() public override {
50
+ weth = IWETH(WETH_ADDRESS);
51
+ usdc = IERC20Metadata(USDC_ADDRESS);
52
+ zoraToken = IERC20Metadata(ZORA_TOKEN_ADDRESS);
53
+ swapRouter = ISwapRouter(SWAP_ROUTER);
54
+ airlock = IAirlock(DOPPLER_AIRLOCK);
55
+ permit2 = IPermit2(V4_PERMIT2);
56
+ router = IUniversalRouter(UNIVERSAL_ROUTER);
57
+ poolManager = IPoolManager(V4_POOL_MANAGER);
58
+ quoter = IV4Quoter(V4_QUOTER);
59
+ users = Users({
60
+ factoryOwner: makeAddr("factoryOwner"),
61
+ feeRecipient: makeAddr("feeRecipient"),
62
+ creator: makeAddr("creator"),
63
+ platformReferrer: makeAddr("platformReferrer"),
64
+ buyer: makeAddr("buyer"),
65
+ seller: makeAddr("seller"),
66
+ coinRecipient: makeAddr("coinRecipient"),
67
+ tradeReferrer: makeAddr("tradeReferrer"),
68
+ dopplerRecipient: makeAddr("dopplerRecipient")
69
+ });
70
+ }
71
+
43
72
  function test_canUpgradeFromVersionWithoutContractName() public {
44
73
  // this test that we can upgrade from the current version, which doesn't have a contract name
45
74
  vm.createSelectFork("base", 29675508);
@@ -186,37 +215,36 @@ contract UpgradesTest is BaseTest, CoinsDeployerBase {
186
215
  vm.stopPrank();
187
216
  }
188
217
 
189
- function test_canUpgradeBrokenContentCoinAndSwap() public {
190
- vm.createSelectFork("base", 32613149);
191
-
192
- address trader = 0xf69fEc6d858c77e969509843852178bd24CAd2B6;
218
+ // function test_canUpgradeBrokenContentCoinAndSwap() public {
219
+ // vm.createSelectFork("base", 32613149);
193
220
 
194
- address contentCoin = 0xB9799C839818bF50240CE683363D00c43a2E23b8;
221
+ // address trader = 0xf69fEc6d858c77e969509843852178bd24CAd2B6;
195
222
 
196
- address creatorCoin = ICoin(contentCoin).currency();
223
+ // address contentCoin = 0xB9799C839818bF50240CE683363D00c43a2E23b8;
197
224
 
198
- uint256 amountIn = 0.000111 ether;
225
+ // address creatorCoin = ICoin(contentCoin).currency();
199
226
 
200
- ITrustedMsgSenderProviderLookup trustedMsgSenderLookup2 = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
227
+ // uint256 amountIn = 0.000111 ether;
201
228
 
202
- bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup2, upgradeGate);
229
+ // ITrustedMsgSenderProviderLookup trustedMsgSenderLookup2 = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
230
+ // bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup2, upgradeGate, address(mockZoraLimitOrderBook));
203
231
 
204
- (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
232
+ // (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
205
233
 
206
- address existingHook = address(ICoin(contentCoin).hooks());
234
+ // address existingHook = address(ICoin(contentCoin).hooks());
207
235
 
208
- address[] memory baseImpls = new address[](1);
209
- baseImpls[0] = existingHook;
236
+ // address[] memory baseImpls = new address[](1);
237
+ // baseImpls[0] = existingHook;
210
238
 
211
- vm.prank(Ownable(upgradeGate).owner());
212
- IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
239
+ // vm.prank(Ownable(upgradeGate).owner());
240
+ // IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
213
241
 
214
- vm.prank(MultiOwnable(contentCoin).owners()[0]);
215
- ContentCoin(contentCoin).migrateLiquidity(address(newHook), "");
242
+ // vm.prank(MultiOwnable(contentCoin).owners()[0]);
243
+ // ContentCoin(contentCoin).migrateLiquidity(address(newHook), "");
216
244
 
217
- // do some swaps to test out
218
- _swapSomeCurrencyForCoin(ICoin(contentCoin), creatorCoin, uint128(amountIn), trader);
219
- }
245
+ // // do some swaps to test out
246
+ // _swapSomeCurrencyForCoin(ICoin(contentCoin), creatorCoin, uint128(amountIn), trader);
247
+ // }
220
248
 
221
249
  function getPositionInfo(
222
250
  PoolKey memory key,
@@ -240,93 +268,94 @@ contract UpgradesTest is BaseTest, CoinsDeployerBase {
240
268
  return getLiquidityForPositions(coin.getPoolKey(), IZoraV4CoinHook(address(coin.hooks())).getPoolCoin(coin.getPoolKey()).positions);
241
269
  }
242
270
 
243
- function test_canUpgradeBrokenCreatorCoinAndSwap() public {
244
- vm.createSelectFork("base", 31872861);
271
+ // function test_canUpgradeBrokenCreatorCoinAndSwap() public {
272
+ // vm.createSelectFork("base", 31872861);
245
273
 
246
- address trader = 0xf69fEc6d858c77e969509843852178bd24CAd2B6;
274
+ // address trader = 0xf69fEc6d858c77e969509843852178bd24CAd2B6;
247
275
 
248
- ICoin creatorCoin = ICoin(0x2F03aB8fD97F5874bc3274C296Bb954Ae92EdA34);
276
+ // ICoin creatorCoin = ICoin(0x2F03aB8fD97F5874bc3274C296Bb954Ae92EdA34);
249
277
 
250
- address zora = creatorCoin.currency();
278
+ // address zora = creatorCoin.currency();
251
279
 
252
- address existingHook = address(creatorCoin.hooks());
280
+ // address existingHook = address(creatorCoin.hooks());
253
281
 
254
- ITrustedMsgSenderProviderLookup trustedMsgSenderLookup3 = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
282
+ // ITrustedMsgSenderProviderLookup trustedMsgSenderLookup3 = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
283
+ // bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup3, upgradeGate, address(mockZoraLimitOrderBook));
255
284
 
256
- bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup3, upgradeGate);
285
+ // (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
257
286
 
258
- (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
287
+ // address[] memory baseImpls = new address[](1);
288
+ // baseImpls[0] = existingHook;
259
289
 
260
- address[] memory baseImpls = new address[](1);
261
- baseImpls[0] = existingHook;
290
+ // vm.prank(Ownable(upgradeGate).owner());
291
+ // IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
262
292
 
263
- vm.prank(Ownable(upgradeGate).owner());
264
- IHooksUpgradeGate(upgradeGate).registerUpgradePath(baseImpls, address(newHook));
293
+ // LpPosition[] memory beforePositions = IZoraV4CoinHook(address(creatorCoin.hooks())).getPoolCoin(creatorCoin.getPoolKey()).positions;
294
+ // PoolKey memory beforeKey = creatorCoin.getPoolKey();
265
295
 
266
- LpPosition[] memory beforePositions = IZoraV4CoinHook(address(creatorCoin.hooks())).getPoolCoin(creatorCoin.getPoolKey()).positions;
267
- PoolKey memory beforeKey = creatorCoin.getPoolKey();
296
+ // uint128[] memory beforeLiquidity = getLiquidityForPositions(beforeKey, beforePositions);
297
+ // // get before price
298
+ // uint160 beforePrice = PoolStateReader.getSqrtPriceX96(creatorCoin.getPoolKey(), poolManager);
268
299
 
269
- uint128[] memory beforeLiquidity = getLiquidityForPositions(beforeKey, beforePositions);
270
- // get before price
271
- uint160 beforePrice = PoolStateReader.getSqrtPriceX96(creatorCoin.getPoolKey(), poolManager);
300
+ // vm.prank(MultiOwnable(address(creatorCoin)).owners()[0]);
301
+ // ContentCoin(address(creatorCoin)).migrateLiquidity(address(newHook), "");
272
302
 
273
- vm.prank(MultiOwnable(address(creatorCoin)).owners()[0]);
274
- ContentCoin(address(creatorCoin)).migrateLiquidity(address(newHook), "");
303
+ // // get liquidity of original positions after migration
304
+ // uint128[] memory liquidityOfPositionsAfterMigration = getLiquidityForPositions(beforeKey, beforePositions);
275
305
 
276
- // get liquidity of original positions after migration
277
- uint128[] memory liquidityOfPositionsAfterMigration = getLiquidityForPositions(beforeKey, beforePositions);
306
+ // // there should be no liquidity left in the original positions after migration
307
+ // for (uint256 i = 0; i < liquidityOfPositionsAfterMigration.length; i++) {
308
+ // assertEq(liquidityOfPositionsAfterMigration[i], 0);
309
+ // }
278
310
 
279
- // there should be no liquidity left in the original positions after migration
280
- for (uint256 i = 0; i < liquidityOfPositionsAfterMigration.length; i++) {
281
- assertEq(liquidityOfPositionsAfterMigration[i], 0);
282
- }
283
-
284
- // get liquidity of new positions after migration
285
- PoolKey memory afterKey = creatorCoin.getPoolKey();
286
- LpPosition[] memory afterPositions = IZoraV4CoinHook(address(afterKey.hooks)).getPoolCoin(afterKey).positions;
287
- uint128[] memory afterLiquidity = getLiquidityForPositions(afterKey, afterPositions);
311
+ // // get liquidity of new positions after migration
312
+ // PoolKey memory afterKey = creatorCoin.getPoolKey();
313
+ // LpPosition[] memory afterPositions = IZoraV4CoinHook(address(afterKey.hooks)).getPoolCoin(afterKey).positions;
314
+ // uint128[] memory afterLiquidity = getLiquidityForPositions(afterKey, afterPositions);
288
315
 
289
- for (uint256 i = 0; i < beforeLiquidity.length; i++) {
290
- assertApproxEqAbs(beforeLiquidity[i], afterLiquidity[i], 200);
291
- }
316
+ // for (uint256 i = 0; i < beforeLiquidity.length; i++) {
317
+ // // we added any extra liquidity to the last position, so we don't expect it to be the same
318
+ // if (i != beforeLiquidity.length - 1) {
319
+ // assertApproxEqAbs(beforeLiquidity[i], afterLiquidity[i], 200);
320
+ // }
321
+ // }
292
322
 
293
- uint160 afterPrice = PoolStateReader.getSqrtPriceX96(creatorCoin.getPoolKey(), poolManager);
323
+ // uint160 afterPrice = PoolStateReader.getSqrtPriceX96(creatorCoin.getPoolKey(), poolManager);
294
324
 
295
- assertEq(beforePrice, afterPrice);
325
+ // assertEq(beforePrice, afterPrice);
296
326
 
297
- // Small amounts of dust from rounding may remain in the hook as burned tokens
298
- // This is expected and saves on code size by not minting them back into the pool
299
- assertApproxEqAbs(creatorCoin.getPoolKey().currency0.balanceOf(address(newHook)), 0, 0.1 ether);
300
- assertApproxEqAbs(creatorCoin.getPoolKey().currency1.balanceOf(address(newHook)), 0, 0.1 ether);
327
+ // // make sure that the new hook has no balance of 0 or 1
328
+ // assertApproxEqAbs(creatorCoin.getPoolKey().currency0.balanceOf(address(newHook)), 0, 10);
329
+ // assertApproxEqAbs(creatorCoin.getPoolKey().currency1.balanceOf(address(newHook)), 0, 10);
301
330
 
302
- // now try to swap some currency for the creator coin - it should succeed
303
- _swapSomeCurrencyForCoin(creatorCoin, zora, uint128(IERC20(zora).balanceOf(trader) / 2), trader);
304
- }
331
+ // // now try to swap some currency for the creator coin - it should succeed
332
+ // _swapSomeCurrencyForCoin(creatorCoin, zora, uint128(IERC20(zora).balanceOf(trader) / 2), trader);
333
+ // }
305
334
 
306
- function test_canFixBrokenContentCoinAndSwap() public {
307
- vm.createSelectFork("base", 31835069);
335
+ // function test_canFixBrokenContentCoinAndSwap() public {
336
+ // vm.createSelectFork("base", 31835069);
308
337
 
309
- address trader = 0xf69fEc6d858c77e969509843852178bd24CAd2B6;
338
+ // address trader = 0xf69fEc6d858c77e969509843852178bd24CAd2B6;
310
339
 
311
- address contentCoin = 0x4E93A01c90f812284F71291a8d1415a904957156;
340
+ // address contentCoin = 0x4E93A01c90f812284F71291a8d1415a904957156;
312
341
 
313
- address creatorCoin = ICoin(contentCoin).currency();
342
+ // address creatorCoin = ICoin(contentCoin).currency();
314
343
 
315
- uint256 amountIn = IERC20(creatorCoin).balanceOf(trader);
344
+ // uint256 amountIn = IERC20(creatorCoin).balanceOf(trader);
316
345
 
317
- require(amountIn > 0, "no balance");
346
+ // require(amountIn > 0, "no balance");
318
347
 
319
- // this swap should revert because the content coin is broken
320
- _swapSomeCurrencyForCoinAndExpectRevert(ICoin(contentCoin), creatorCoin, uint128(amountIn), trader);
348
+ // // this swap should revert because the content coin is broken
349
+ // _swapSomeCurrencyForCoinAndExpectRevert(ICoin(contentCoin), creatorCoin, uint128(amountIn), trader);
321
350
 
322
- ITrustedMsgSenderProviderLookup trustedMsgSenderLookup2 = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
323
- bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup2, upgradeGate);
351
+ // ITrustedMsgSenderProviderLookup trustedMsgSenderLookup2 = TrustedSenderTestHelper.deployTrustedMessageSender(makeAddr("owner"), new address[](0));
352
+ // bytes memory creationCode = HooksDeployment.makeHookCreationCode(address(poolManager), coinVersionLookup, trustedMsgSenderLookup2, upgradeGate, address(mockZoraLimitOrderBook));
324
353
 
325
- (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
354
+ // (IHooks newHook, ) = HooksDeployment.deployHookWithExistingOrNewSalt(address(this), creationCode, bytes32(0));
326
355
 
327
- // etch new hook into the content coin, it shouldn't revert anymore when swapping
328
- vm.etch(address(ICoin(contentCoin).hooks()), address(newHook).code);
356
+ // // etch new hook into the content coin, it shouldn't revert anymore when swapping
357
+ // vm.etch(address(ICoin(contentCoin).hooks()), address(newHook).code);
329
358
 
330
- _swapSomeCurrencyForCoin(ICoin(contentCoin), creatorCoin, uint128(amountIn), trader);
331
- }
359
+ // _swapSomeCurrencyForCoin(ICoin(contentCoin), creatorCoin, uint128(amountIn), trader);
360
+ // }
332
361
  }
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.13;
3
3
 
4
- import "./utils/BaseTest.sol";
4
+ import {BaseTest} from "./utils/BaseTest.sol";
5
5
  import {CoinConfigurationVersions} from "../src/libs/CoinConfigurationVersions.sol";
6
6
  import {CoinDopplerMultiCurve} from "../src/libs/CoinDopplerMultiCurve.sol";
7
7
  import {V4Liquidity} from "../src/libs/V4Liquidity.sol";
@@ -0,0 +1,33 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.28;
3
+
4
+ import {ISwapRouter} from "../../src/interfaces/ISwapRouter.sol";
5
+
6
+ /// @notice Mock V3 SwapRouter for non-forked tests
7
+ /// @dev This mock doesn't implement any actual swap logic - it's just to satisfy constructor requirements
8
+ contract MockSwapRouter is ISwapRouter {
9
+ /// @notice Mock implementation - reverts since V3 swaps shouldn't be called in non-forked tests
10
+ function exactInputSingle(ExactInputSingleParams calldata) external payable returns (uint256) {
11
+ revert("MockSwapRouter: V3 swaps not supported in non-forked tests");
12
+ }
13
+
14
+ /// @notice Mock implementation - reverts since V3 swaps shouldn't be called in non-forked tests
15
+ function exactInput(ExactInputParams calldata) external payable returns (uint256) {
16
+ revert("MockSwapRouter: V3 swaps not supported in non-forked tests");
17
+ }
18
+
19
+ /// @notice Mock implementation - reverts since V3 swaps shouldn't be called in non-forked tests
20
+ function exactOutputSingle(ExactOutputSingleParams calldata) external payable returns (uint256) {
21
+ revert("MockSwapRouter: V3 swaps not supported in non-forked tests");
22
+ }
23
+
24
+ /// @notice Mock implementation - reverts since V3 swaps shouldn't be called in non-forked tests
25
+ function exactOutput(ExactOutputParams calldata) external payable returns (uint256) {
26
+ revert("MockSwapRouter: V3 swaps not supported in non-forked tests");
27
+ }
28
+
29
+ /// @notice Mock implementation of V3 callback - reverts since V3 swaps shouldn't be called in non-forked tests
30
+ function uniswapV3SwapCallback(int256, int256, bytes calldata) external pure {
31
+ revert("MockSwapRouter: V3 swaps not supported in non-forked tests");
32
+ }
33
+ }
@@ -0,0 +1,14 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity ^0.8.13;
3
+
4
+ import {IZoraLimitOrderBookCoinsInterface} from "../../src/interfaces/IZoraLimitOrderBookCoinsInterface.sol";
5
+ import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
6
+
7
+ /// @title MockZoraLimitOrderBook
8
+ /// @notice Mock implementation of IZoraLimitOrderBookCoinsInterface for testing purposes
9
+ contract MockZoraLimitOrderBook is IZoraLimitOrderBookCoinsInterface {
10
+ /// @notice Fills limit orders within a tick window (mock implementation does nothing)
11
+ function fill(PoolKey calldata, bool, int24, int24, uint256, address) external override {
12
+ // Mock implementation - does nothing
13
+ }
14
+ }