@zoralabs/coins 0.7.1 → 1.0.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 (167) hide show
  1. package/.turbo/turbo-build.log +106 -84
  2. package/CHANGELOG.md +68 -0
  3. package/abis/BadImpl.json +15 -0
  4. package/abis/BalanceDeltaLibrary.json +15 -0
  5. package/abis/BaseCoin.json +1350 -0
  6. package/abis/BaseCoinDeployHook.json +78 -0
  7. package/abis/BaseHook.json +897 -0
  8. package/abis/BaseTest.json +60 -91
  9. package/abis/BeforeSwapDeltaLibrary.json +15 -0
  10. package/abis/BuySupplyWithSwapRouterHook.json +126 -0
  11. package/abis/Coin.json +214 -150
  12. package/abis/CoinConstants.json +65 -0
  13. package/abis/CoinDopplerMultiCurve.json +38 -0
  14. package/abis/CoinRewardsV4.json +54 -0
  15. package/abis/CoinTest.json +66 -111
  16. package/abis/CoinUniV4Test.json +1053 -0
  17. package/abis/CoinV4.json +1687 -0
  18. package/abis/CurrencyLibrary.json +25 -0
  19. package/abis/DeployHooks.json +9 -0
  20. package/abis/DeployScript.json +47 -0
  21. package/abis/DeployedCoinVersionLookup.json +21 -0
  22. package/abis/DeployedCoinVersionLookupTest.json +716 -0
  23. package/abis/DifferentNamespaceVersionLookup.json +39 -0
  24. package/abis/DopplerUniswapV3Test.json +62 -184
  25. package/abis/ERC20.json +310 -0
  26. package/abis/FactoryTest.json +98 -98
  27. package/abis/FakeHookNoInterface.json +21 -0
  28. package/abis/FeeEstimatorHook.json +1528 -0
  29. package/abis/Hooks.json +28 -0
  30. package/abis/HooksDeployment.json +23 -0
  31. package/abis/HooksTest.json +698 -0
  32. package/abis/IAllowanceTransfer.json +486 -0
  33. package/abis/ICoin.json +62 -69
  34. package/abis/ICoinDeployHook.json +31 -0
  35. package/abis/ICoinV3.json +879 -0
  36. package/abis/ICoinV4.json +915 -0
  37. package/abis/IContractMetadata.json +28 -0
  38. package/abis/IDeployedCoinVersionLookup.json +21 -0
  39. package/abis/IEIP712.json +15 -0
  40. package/abis/IEIP712_v4.json +15 -0
  41. package/abis/IERC20Minimal.json +172 -0
  42. package/abis/IERC6909Claims.json +288 -0
  43. package/abis/IERC721.json +36 -36
  44. package/abis/IERC721Permit_v4.json +88 -0
  45. package/abis/IExtsload.json +64 -0
  46. package/abis/IExttload.json +40 -0
  47. package/abis/IHasAfterCoinDeploy.json +31 -0
  48. package/abis/IHasContractName.json +15 -0
  49. package/abis/IHasPoolKey.json +42 -0
  50. package/abis/IHasRewardsRecipients.json +54 -0
  51. package/abis/IHasSwapPath.json +60 -0
  52. package/abis/IHooks.json +789 -0
  53. package/abis/IImmutableState.json +15 -0
  54. package/abis/IMsgSender.json +15 -0
  55. package/abis/IMulticall_v4.json +21 -0
  56. package/abis/INotifier.json +187 -0
  57. package/abis/IPermit2.json +865 -0
  58. package/abis/IPermit2Forwarder.json +138 -0
  59. package/abis/IPoolConfigEncoding.json +46 -0
  60. package/abis/IPoolInitializer_v4.json +53 -0
  61. package/abis/IPoolManager.json +1286 -0
  62. package/abis/IPositionManager.json +712 -0
  63. package/abis/IProtocolFees.json +174 -0
  64. package/abis/ISignatureTransfer.json +394 -0
  65. package/abis/ISubscriber.json +89 -0
  66. package/abis/ISwapPathRouter.json +92 -0
  67. package/abis/ISwapRouter.json +82 -0
  68. package/abis/IUniversalRouter.json +61 -0
  69. package/abis/IUnlockCallback.json +21 -0
  70. package/abis/IUnorderedNonce.json +44 -0
  71. package/abis/IV4Quoter.json +310 -0
  72. package/abis/IV4Router.json +47 -0
  73. package/abis/IZoraFactory.json +328 -4
  74. package/abis/IZoraV4CoinHook.json +427 -0
  75. package/abis/ImmutableState.json +36 -0
  76. package/abis/LPFeeLibrary.json +65 -0
  77. package/abis/MockERC20.json +21 -0
  78. package/abis/MultiOwnableTest.json +60 -91
  79. package/abis/{CoinConfigurationVersions.json → Position.json} +1 -1
  80. package/abis/PrintUpgradeCommand.json +9 -0
  81. package/abis/ProxyShim.json +24 -0
  82. package/abis/Simulate.json +0 -91
  83. package/abis/StateLibrary.json +80 -0
  84. package/abis/TestDeployedCoinVersionLookupImplementation.json +39 -0
  85. package/abis/TestV4Swap.json +9 -0
  86. package/abis/{CoinSetup.json → UniV3BuySell.json} +5 -0
  87. package/abis/UniV3Errors.json +32 -0
  88. package/abis/UpgradeCoinImpl.json +47 -0
  89. package/abis/UpgradeFactoryImpl.json +9 -0
  90. package/abis/UpgradesTest.json +671 -0
  91. package/abis/Vm.json +1482 -111
  92. package/abis/VmSafe.json +856 -32
  93. package/abis/ZoraFactoryImpl.json +450 -1
  94. package/abis/ZoraV4CoinHook.json +1439 -0
  95. package/addresses/8453.json +8 -3
  96. package/addresses/84532.json +8 -3
  97. package/dist/index.cjs +1998 -184
  98. package/dist/index.cjs.map +1 -1
  99. package/dist/index.js +1989 -178
  100. package/dist/index.js.map +1 -1
  101. package/dist/wagmiGenerated.d.ts +2852 -688
  102. package/dist/wagmiGenerated.d.ts.map +1 -1
  103. package/package/wagmiGenerated.ts +1992 -173
  104. package/package.json +7 -2
  105. package/remappings.txt +6 -1
  106. package/script/CoinsDeployerBase.sol +105 -10
  107. package/script/DeployDevFactory.s.sol +21 -0
  108. package/script/DeployHooks.s.sol +22 -0
  109. package/script/PrintUpgradeCommand.s.sol +13 -0
  110. package/script/Simulate.s.sol +4 -12
  111. package/script/TestBackingCoinSwap.s.sol +146 -0
  112. package/script/TestV4Swap.s.sol +136 -0
  113. package/script/UpgradeCoinImpl.sol +2 -2
  114. package/script/UpgradeFactoryImpl.s.sol +23 -0
  115. package/src/BaseCoin.sol +176 -0
  116. package/src/Coin.sol +93 -515
  117. package/src/CoinV4.sol +121 -0
  118. package/src/ZoraFactoryImpl.sol +257 -57
  119. package/src/hooks/ZoraV4CoinHook.sol +195 -0
  120. package/src/hooks/deployment/BaseCoinDeployHook.sol +62 -0
  121. package/src/hooks/deployment/BuySupplyWithSwapRouterHook.sol +80 -0
  122. package/src/interfaces/ICoin.sol +35 -39
  123. package/src/interfaces/ICoinDeployHook.sol +8 -0
  124. package/src/interfaces/ICoinV3.sol +71 -0
  125. package/src/interfaces/ICoinV4.sol +69 -0
  126. package/src/interfaces/IDeployedCoinVersionLookup.sol +11 -0
  127. package/src/interfaces/IMsgSender.sol +9 -0
  128. package/src/interfaces/IPoolConfigEncoding.sol +14 -0
  129. package/src/interfaces/ISwapPathRouter.sol +14 -0
  130. package/src/interfaces/ISwapRouter.sol +1 -35
  131. package/src/interfaces/IZoraFactory.sol +97 -7
  132. package/src/interfaces/IZoraV4CoinHook.sol +116 -0
  133. package/src/libs/CoinCommon.sol +15 -0
  134. package/src/libs/CoinConfigurationVersions.sol +116 -1
  135. package/src/{utils → libs}/CoinConstants.sol +11 -6
  136. package/src/libs/CoinDopplerMultiCurve.sol +134 -0
  137. package/src/libs/CoinDopplerUniV3.sol +19 -171
  138. package/src/libs/CoinRewards.sol +195 -0
  139. package/src/libs/CoinRewardsV4.sol +180 -0
  140. package/src/libs/CoinSetup.sol +40 -20
  141. package/src/libs/CoinSetupV3.sol +50 -0
  142. package/src/libs/DopplerMath.sol +156 -0
  143. package/src/libs/HooksDeployment.sol +84 -0
  144. package/src/libs/MarketConstants.sol +4 -0
  145. package/src/libs/PoolStateReader.sol +22 -0
  146. package/src/libs/UniV3BuySell.sol +231 -0
  147. package/src/libs/UniV3Errors.sol +11 -0
  148. package/src/libs/UniV4SwapHelper.sol +65 -0
  149. package/src/libs/UniV4SwapToCurrency.sol +109 -0
  150. package/src/libs/V4Liquidity.sol +129 -0
  151. package/src/types/PoolConfiguration.sol +15 -0
  152. package/src/utils/DeployedCoinVersionLookup.sol +52 -0
  153. package/src/version/ContractVersionBase.sol +1 -1
  154. package/test/Coin.t.sol +94 -101
  155. package/test/CoinDopplerUniV3.t.sol +35 -184
  156. package/test/CoinUniV4.t.sol +752 -0
  157. package/test/DeploymentHooks.t.sol +270 -0
  158. package/test/Factory.t.sol +84 -50
  159. package/test/MultiOwnable.t.sol +6 -3
  160. package/test/Upgrades.t.sol +68 -0
  161. package/test/mocks/MockERC20.sol +12 -0
  162. package/test/utils/BaseTest.sol +124 -59
  163. package/test/utils/DeployedCoinVersionLookup.t.sol +127 -0
  164. package/test/utils/FeeEstimatorHook.sol +84 -0
  165. package/test/utils/ProxyShim.sol +17 -0
  166. package/wagmi.config.ts +10 -9
  167. package/src/libs/CoinLegacy.sol +0 -48
@@ -5,29 +5,14 @@ import {CoinConfigurationVersions} from "../src/libs/CoinConfigurationVersions.s
5
5
  import {MarketConstants} from "../src/libs/MarketConstants.sol";
6
6
  import {BaseTest} from "./utils/BaseTest.sol";
7
7
  import {Coin} from "../src/Coin.sol";
8
+ import {CoinConstants} from "../src/libs/CoinConstants.sol";
8
9
  import {IUniswapV3Pool} from "../src/interfaces/IUniswapV3Pool.sol";
9
10
  import {LpPosition} from "../src/types/LpPosition.sol";
10
11
  import {IDopplerErrors} from "../src/interfaces/IDopplerErrors.sol";
11
- import {CoinDopplerUniV3} from "../src/libs/CoinDopplerUniV3.sol";
12
+ import {DopplerMath, CoinDopplerUniV3} from "../src/libs/CoinDopplerUniV3.sol";
12
13
  import {TickMath} from "../src/utils/uniswap/TickMath.sol";
13
14
 
14
15
  contract DopplerUniswapV3Test is BaseTest {
15
- int24 internal constant DEFAULT_DISCOVERY_TICK_LOWER = -777000;
16
- int24 internal constant DEFAULT_DISCOVERY_TICK_UPPER = 222000;
17
- uint16 internal constant DEFAULT_NUM_DISCOVERY_POSITIONS = 10; // will be 11 total with tail position
18
- uint256 internal constant DEFAULT_DISCOVERY_SUPPLY_SHARE = 0.495e18; // half of the 990m total pool supply
19
-
20
- function _generatePoolConfig(
21
- uint8 version_,
22
- address currency_,
23
- int24 tickLower_,
24
- int24 tickUpper_,
25
- uint16 numDiscoveryPositions_,
26
- uint256 maxDiscoverySupplyShare_
27
- ) internal pure returns (bytes memory) {
28
- return abi.encode(version_, currency_, tickLower_, tickUpper_, numDiscoveryPositions_, maxDiscoverySupplyShare_);
29
- }
30
-
31
16
  function _deployCoin(bytes memory poolConfig_) internal {
32
17
  vm.prank(users.creator);
33
18
  (address coinAddress, ) = factory.deploy(
@@ -52,134 +37,7 @@ contract DopplerUniswapV3Test is BaseTest {
52
37
  super.setUp();
53
38
  }
54
39
 
55
- function test_deploy_legacy_eth_config() public {
56
- bytes memory poolConfig = _generatePoolConfig(
57
- CoinConfigurationVersions.LEGACY_POOL_VERSION,
58
- address(weth),
59
- MarketConstants.LP_TICK_LOWER_WETH,
60
- 0,
61
- 1,
62
- 0
63
- );
64
-
65
- _deployCoin(poolConfig);
66
-
67
- assertEq(coin.currency(), address(weth), "currency");
68
- assertEq(coin.totalSupply(), 1_000_000_000e18, "totalSupply");
69
- assertEq(coin.balanceOf(users.creator), 10_000_000e18, "balanceOf creator");
70
- assertGt(coin.balanceOf(coin.poolAddress()), 989_999_999e18, "balanceOf pool");
71
-
72
- (
73
- address asset,
74
- address numeraire,
75
- int24 tickLower,
76
- int24 tickUpper,
77
- uint16 numPositions,
78
- bool isInitialized,
79
- bool isExited,
80
- uint256 maxShareToBeSold,
81
- uint256 totalTokensOnBondingCurve
82
- ) = coin.poolState();
83
-
84
- assertEq(asset, address(coin));
85
- assertEq(numeraire, address(weth));
86
- assertEq(numPositions, 1);
87
- assertTrue(isInitialized);
88
- assertFalse(isExited);
89
- assertEq(maxShareToBeSold, 0);
90
- assertEq(totalTokensOnBondingCurve, POOL_LAUNCH_SUPPLY);
91
-
92
- bool isCoinToken0 = address(coin) < address(weth);
93
-
94
- if (isCoinToken0) {
95
- assertEq(tickLower, MarketConstants.LP_TICK_LOWER_WETH);
96
- assertEq(tickUpper, MarketConstants.LP_TICK_UPPER);
97
- } else {
98
- assertEq(tickLower, -MarketConstants.LP_TICK_UPPER);
99
- assertEq(tickUpper, -MarketConstants.LP_TICK_LOWER_WETH);
100
- }
101
- }
102
-
103
- function test_invalid_tick_range() public {
104
- bytes memory poolConfig = _generatePoolConfig(CoinConfigurationVersions.LEGACY_POOL_VERSION, address(weth), -100, 100, 100, 0.5e18);
105
-
106
- vm.expectRevert();
107
- factory.deploy(users.creator, _getDefaultOwners(), "https://test.com", "Testcoin", "TEST", poolConfig, users.platformReferrer, 0);
108
- }
109
-
110
- function test_inverted_tick_range_revert() public {
111
- // These tick ranges are flipped
112
- bytes memory poolConfig = _generatePoolConfig(CoinConfigurationVersions.LEGACY_POOL_VERSION, address(weth), 10000, -10000, 100, 0.5e18);
113
-
114
- vm.expectRevert(abi.encodeWithSignature("InvalidWethLowerTick()"));
115
- factory.deploy(users.creator, _getDefaultOwners(), "https://test.com", "Testcoin", "TEST", poolConfig, users.platformReferrer, 0);
116
- }
117
-
118
- function test_deploy_legacy_eth_config_with_prebuy(uint256 initialOrderSize) public {
119
- vm.assume(initialOrderSize > MIN_ORDER_SIZE);
120
- vm.assume(initialOrderSize < 10 ether);
121
-
122
- vm.deal(users.creator, initialOrderSize);
123
-
124
- bytes memory poolConfig = _generatePoolConfig(
125
- CoinConfigurationVersions.LEGACY_POOL_VERSION,
126
- address(weth),
127
- MarketConstants.LP_TICK_LOWER_WETH,
128
- 0,
129
- 0,
130
- 0
131
- );
132
-
133
- vm.prank(users.creator);
134
- (address coinAddress, ) = factory.deploy{value: initialOrderSize}(
135
- users.creator,
136
- _getDefaultOwners(),
137
- "https://test.com",
138
- "Testcoin",
139
- "TEST",
140
- poolConfig,
141
- users.platformReferrer,
142
- initialOrderSize
143
- );
144
-
145
- coin = Coin(payable(coinAddress));
146
- pool = IUniswapV3Pool(coin.poolAddress());
147
-
148
- assertGt(coin.balanceOf(users.creator), 10_000_000e18, "balanceOf creator");
149
- }
150
-
151
- function test_deploy_legacy_usdc_config_with_prebuy() public {
152
- address[] memory owners = new address[](1);
153
- owners[0] = users.creator;
154
-
155
- uint256 orderSize = dealUSDC(users.creator, 100);
156
-
157
- vm.prank(users.creator);
158
- usdc.approve(address(factory), orderSize);
159
-
160
- bytes memory poolConfig = _generatePoolConfig(CoinConfigurationVersions.LEGACY_POOL_VERSION, address(usdc), USDC_TICK_LOWER, 0, 0, 0);
161
-
162
- vm.prank(users.creator);
163
- (address coinAddress, uint256 coinsPurchased) = factory.deploy(
164
- users.creator,
165
- owners,
166
- "https://testcoinusdcpair.com",
167
- "Testcoinusdcpair",
168
- "TESTCOINUSDCPAIR",
169
- poolConfig,
170
- users.platformReferrer,
171
- orderSize
172
- );
173
- coin = Coin(payable(coinAddress));
174
- pool = IUniswapV3Pool(coin.poolAddress());
175
- vm.label(address(coin), "COIN");
176
- vm.label(address(pool), "POOL");
177
-
178
- assertEq(coin.currency(), address(usdc), "currency");
179
- assertEq(coin.balanceOf(users.creator), CREATOR_LAUNCH_REWARD + coinsPurchased);
180
- }
181
-
182
- function test_deploy_doppler_eth() public {
40
+ function test_supply_constants() public {
183
41
  bytes memory poolConfig = _generatePoolConfig(
184
42
  CoinConfigurationVersions.DOPPLER_UNI_V3_POOL_VERSION,
185
43
  address(weth),
@@ -190,30 +48,19 @@ contract DopplerUniswapV3Test is BaseTest {
190
48
  );
191
49
 
192
50
  _deployCoin(poolConfig);
51
+ assertEq(CoinConstants.MAX_TOTAL_SUPPLY, CoinConstants.POOL_LAUNCH_SUPPLY + CoinConstants.CREATOR_LAUNCH_REWARD);
52
+
53
+ assertEq(CoinConstants.MAX_TOTAL_SUPPLY, 1_000_000_000e18);
54
+ assertEq(CoinConstants.POOL_LAUNCH_SUPPLY, 990_000_000e18);
55
+ assertEq(CoinConstants.CREATOR_LAUNCH_REWARD, 10_000_000e18);
193
56
 
194
- (
195
- address asset,
196
- address numeraire,
197
- ,
198
- ,
199
- uint16 numPositions,
200
- bool isInitialized,
201
- bool isExited,
202
- uint256 maxShareToBeSold,
203
- uint256 totalTokensOnBondingCurve
204
- ) = coin.poolState();
205
-
206
- assertEq(asset, address(coin), "poolState.asset");
207
- assertEq(numeraire, address(weth), "poolState.numeraire");
208
- assertEq(numPositions, DEFAULT_NUM_DISCOVERY_POSITIONS, "poolState.numPositions");
209
- assertTrue(isInitialized, "poolState.isInitialized");
210
- assertFalse(isExited, "poolState.isExited");
211
- assertEq(maxShareToBeSold, DEFAULT_DISCOVERY_SUPPLY_SHARE, "poolState.maxShareToBeSold");
212
- assertEq(totalTokensOnBondingCurve, POOL_LAUNCH_SUPPLY, "poolState.totalTokensOnBondingCurve");
57
+ assertEq(coin.totalSupply(), CoinConstants.MAX_TOTAL_SUPPLY);
58
+ assertEq(coin.balanceOf(coin.payoutRecipient()), CoinConstants.CREATOR_LAUNCH_REWARD);
59
+ assertApproxEqAbs(coin.balanceOf(address(pool)), CoinConstants.POOL_LAUNCH_SUPPLY, 1e18);
213
60
  }
214
61
 
215
62
  function test_deploy_doppler_eth_with_prebuy(uint256 initialOrderSize) public {
216
- vm.assume(initialOrderSize > MIN_ORDER_SIZE);
63
+ vm.assume(initialOrderSize > CoinConstants.MIN_ORDER_SIZE);
217
64
  vm.assume(initialOrderSize < 1 ether);
218
65
 
219
66
  vm.deal(users.creator, initialOrderSize);
@@ -244,7 +91,7 @@ contract DopplerUniswapV3Test is BaseTest {
244
91
 
245
92
  assertEq(coin.currency(), address(weth), "currency");
246
93
  assertGt(coinsPurchased, 0, "coinsPurchased > 0");
247
- assertEq(coin.balanceOf(users.creator), CREATOR_LAUNCH_REWARD + coinsPurchased, "balanceOf creator");
94
+ assertEq(coin.balanceOf(users.creator), CoinConstants.CREATOR_LAUNCH_REWARD + coinsPurchased, "balanceOf creator");
248
95
  assertGt(weth.balanceOf(address(pool)), 0, "Pool WETH balance");
249
96
  }
250
97
 
@@ -274,40 +121,40 @@ contract DopplerUniswapV3Test is BaseTest {
274
121
  int24 TICK_SPACING = 60;
275
122
  int24 expected = 12300;
276
123
 
277
- assertEq(CoinDopplerUniV3.alignTickToTickSpacing(true, tick, TICK_SPACING), expected, "Align positive tick (token0)");
124
+ assertEq(DopplerMath.alignTickToTickSpacing(true, tick, TICK_SPACING), expected, "Align positive tick (token0)");
278
125
  }
279
126
 
280
127
  function test_alignTick_isToken0_negative() public pure {
281
128
  int24 tick = -12345;
282
129
  int24 TICK_SPACING = 60;
283
130
  int24 expected = -12360;
284
- assertEq(CoinDopplerUniV3.alignTickToTickSpacing(true, tick, TICK_SPACING), expected, "Align negative tick (token0)");
131
+ assertEq(DopplerMath.alignTickToTickSpacing(true, tick, TICK_SPACING), expected, "Align negative tick (token0)");
285
132
  }
286
133
 
287
134
  function test_alignTick_isToken1_negative() public pure {
288
135
  int24 tick = -12345;
289
136
  int24 TICK_SPACING = 60;
290
137
  int24 expected = -12300;
291
- assertEq(CoinDopplerUniV3.alignTickToTickSpacing(false, tick, TICK_SPACING), expected, "Align negative tick (token1)");
138
+ assertEq(DopplerMath.alignTickToTickSpacing(false, tick, TICK_SPACING), expected, "Align negative tick (token1)");
292
139
  }
293
140
 
294
141
  function test_alignTick_isToken1_zero() public pure {
295
142
  int24 tick = 0;
296
143
  int24 expected = 0;
297
- assertEq(CoinDopplerUniV3.alignTickToTickSpacing(false, tick, MarketConstants.TICK_SPACING), expected, "Align zero tick (token1)");
144
+ assertEq(DopplerMath.alignTickToTickSpacing(false, tick, MarketConstants.TICK_SPACING), expected, "Align zero tick (token1)");
298
145
  }
299
146
 
300
147
  // Additional tick alignment test for full branch coverage
301
148
  function test_alignTick_isToken0_zero() public pure {
302
149
  int24 tick = 0;
303
150
  int24 expected = 0;
304
- assertEq(CoinDopplerUniV3.alignTickToTickSpacing(true, tick, MarketConstants.TICK_SPACING), expected, "Align zero tick (token0)");
151
+ assertEq(DopplerMath.alignTickToTickSpacing(true, tick, MarketConstants.TICK_SPACING), expected, "Align zero tick (token0)");
305
152
  }
306
153
 
307
154
  function test_alignTick_isToken1_positive() public pure {
308
155
  int24 tick = 12345;
309
156
  int24 expected = 12400; // Round up for token1
310
- assertEq(CoinDopplerUniV3.alignTickToTickSpacing(false, tick, MarketConstants.TICK_SPACING), expected, "Align positive tick (token1)");
157
+ assertEq(DopplerMath.alignTickToTickSpacing(false, tick, MarketConstants.TICK_SPACING), expected, "Align positive tick (token1)");
311
158
  }
312
159
 
313
160
  function test_calculateLpTail_isToken0() public pure {
@@ -316,10 +163,10 @@ contract DopplerUniswapV3Test is BaseTest {
316
163
  uint256 tailSupply = 1e18;
317
164
  bool isToken0 = true;
318
165
 
319
- LpPosition memory tail = CoinDopplerUniV3.calculateLpTail(tickLower, tickUpper, isToken0, tailSupply, MarketConstants.TICK_SPACING);
166
+ LpPosition memory tail = DopplerMath.calculateLpTail(tickLower, tickUpper, isToken0, tailSupply, MarketConstants.TICK_SPACING);
320
167
 
321
168
  int24 expectedPosTickLower = tickUpper;
322
- int24 expectedPosTickUpper = CoinDopplerUniV3.alignTickToTickSpacing(true, TickMath.MAX_TICK, MarketConstants.TICK_SPACING);
169
+ int24 expectedPosTickUpper = DopplerMath.alignTickToTickSpacing(true, TickMath.MAX_TICK, MarketConstants.TICK_SPACING);
323
170
 
324
171
  assertEq(tail.tickLower, expectedPosTickLower, "Tail tickLower (token0)");
325
172
  assertEq(tail.tickUpper, expectedPosTickUpper, "Tail tickUpper (token0)");
@@ -332,9 +179,9 @@ contract DopplerUniswapV3Test is BaseTest {
332
179
  uint256 tailSupply = 1e18;
333
180
  bool isToken0 = false;
334
181
 
335
- LpPosition memory tail = CoinDopplerUniV3.calculateLpTail(tickLower, tickUpper, isToken0, tailSupply, MarketConstants.TICK_SPACING);
182
+ LpPosition memory tail = DopplerMath.calculateLpTail(tickLower, tickUpper, isToken0, tailSupply, MarketConstants.TICK_SPACING);
336
183
 
337
- int24 expectedPosTickLower = CoinDopplerUniV3.alignTickToTickSpacing(false, TickMath.MIN_TICK, MarketConstants.TICK_SPACING);
184
+ int24 expectedPosTickLower = DopplerMath.alignTickToTickSpacing(false, TickMath.MIN_TICK, MarketConstants.TICK_SPACING);
338
185
  int24 expectedPosTickUpper = tickLower;
339
186
 
340
187
  assertEq(tail.tickLower, expectedPosTickLower, "Tail tickLower (token1)");
@@ -349,14 +196,15 @@ contract DopplerUniswapV3Test is BaseTest {
349
196
  uint256 discoverySupply = 100e18;
350
197
  LpPosition[] memory newPositions = new LpPosition[](DEFAULT_NUM_DISCOVERY_POSITIONS);
351
198
 
352
- (LpPosition[] memory positions, uint256 totalAssetsSold) = CoinDopplerUniV3.calculateLogNormalDistribution(
199
+ (LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
353
200
  tickLower,
354
201
  tickUpper,
355
202
  MarketConstants.TICK_SPACING,
356
203
  isToken0,
357
204
  discoverySupply,
358
205
  DEFAULT_NUM_DISCOVERY_POSITIONS,
359
- newPositions
206
+ newPositions,
207
+ 0
360
208
  );
361
209
 
362
210
  assertEq(positions.length, DEFAULT_NUM_DISCOVERY_POSITIONS, "Correct number of positions (token0)");
@@ -380,14 +228,15 @@ contract DopplerUniswapV3Test is BaseTest {
380
228
  uint256 discoverySupply = 100e18;
381
229
  LpPosition[] memory newPositions = new LpPosition[](DEFAULT_NUM_DISCOVERY_POSITIONS);
382
230
 
383
- (LpPosition[] memory positions, uint256 totalAssetsSold) = CoinDopplerUniV3.calculateLogNormalDistribution(
231
+ (LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
384
232
  tickLower,
385
233
  tickUpper,
386
234
  MarketConstants.TICK_SPACING,
387
235
  isToken0,
388
236
  discoverySupply,
389
237
  DEFAULT_NUM_DISCOVERY_POSITIONS,
390
- newPositions
238
+ newPositions,
239
+ 0
391
240
  );
392
241
 
393
242
  assertEq(positions.length, DEFAULT_NUM_DISCOVERY_POSITIONS, "Correct number of positions (token1)");
@@ -411,14 +260,15 @@ contract DopplerUniswapV3Test is BaseTest {
411
260
  uint256 discoverySupply = 0;
412
261
  LpPosition[] memory newPositions = new LpPosition[](DEFAULT_NUM_DISCOVERY_POSITIONS);
413
262
 
414
- (LpPosition[] memory positions, uint256 totalAssetsSold) = CoinDopplerUniV3.calculateLogNormalDistribution(
263
+ (LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
415
264
  tickLower,
416
265
  tickUpper,
417
266
  MarketConstants.TICK_SPACING,
418
267
  isToken0,
419
268
  discoverySupply,
420
269
  DEFAULT_NUM_DISCOVERY_POSITIONS,
421
- newPositions
270
+ newPositions,
271
+ 0
422
272
  );
423
273
 
424
274
  assertEq(positions.length, DEFAULT_NUM_DISCOVERY_POSITIONS, "Correct number of positions (zero supply)");
@@ -442,14 +292,15 @@ contract DopplerUniswapV3Test is BaseTest {
442
292
  uint16 totalPositions = 1;
443
293
  LpPosition[] memory newPositions = new LpPosition[](totalPositions);
444
294
 
445
- (LpPosition[] memory positions, uint256 totalAssetsSold) = CoinDopplerUniV3.calculateLogNormalDistribution(
295
+ (LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
446
296
  tickLower,
447
297
  tickUpper,
448
298
  MarketConstants.TICK_SPACING,
449
299
  isToken0,
450
300
  discoverySupply,
451
301
  totalPositions,
452
- newPositions
302
+ newPositions,
303
+ 0
453
304
  );
454
305
 
455
306
  assertEq(positions.length, totalPositions, "Correct number of positions");