@zoralabs/coins 0.9.0 → 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.
- package/.turbo/turbo-build.log +131 -114
- package/CHANGELOG.md +40 -0
- package/abis/BaseCoin.json +26 -118
- package/abis/BaseTest.json +47 -0
- package/abis/Coin.json +171 -63
- package/abis/CoinDopplerMultiCurve.json +38 -0
- package/abis/CoinRewardsV4.json +54 -0
- package/abis/CoinTest.json +53 -20
- package/abis/CoinUniV4Test.json +1053 -0
- package/abis/CoinV4.json +234 -211
- package/abis/DeployScript.json +47 -0
- package/abis/DeployedCoinVersionLookup.json +21 -0
- package/abis/DeployedCoinVersionLookupTest.json +716 -0
- package/abis/DifferentNamespaceVersionLookup.json +39 -0
- package/abis/DopplerUniswapV3Test.json +49 -93
- package/abis/ERC20.json +310 -0
- package/abis/FactoryTest.json +85 -7
- package/abis/FeeEstimatorHook.json +1528 -0
- package/abis/HooksDeployment.json +23 -0
- package/abis/HooksTest.json +47 -0
- package/abis/ICoin.json +40 -71
- package/abis/ICoinV3.json +879 -0
- package/abis/ICoinV4.json +915 -0
- package/abis/IDeployedCoinVersionLookup.json +21 -0
- package/abis/IERC721.json +36 -36
- package/abis/IHasPoolKey.json +42 -0
- package/abis/IHasRewardsRecipients.json +54 -0
- package/abis/IHasSwapPath.json +60 -0
- package/abis/IMsgSender.json +15 -0
- package/abis/IPoolConfigEncoding.json +46 -0
- package/abis/ISwapPathRouter.json +92 -0
- package/abis/IUniversalRouter.json +61 -0
- package/abis/IUnlockCallback.json +21 -0
- package/abis/IV4Quoter.json +310 -0
- package/abis/IZoraFactory.json +191 -11
- package/abis/IZoraV4CoinHook.json +348 -4
- package/abis/MockERC20.json +21 -0
- package/abis/MultiOwnableTest.json +47 -0
- package/abis/{CoinConfigurationVersions.json → Position.json} +1 -1
- package/abis/PrintUpgradeCommand.json +9 -0
- package/abis/ProxyShim.json +24 -0
- package/abis/StateLibrary.json +80 -0
- package/abis/TestDeployedCoinVersionLookupImplementation.json +39 -0
- package/abis/TestV4Swap.json +9 -0
- package/abis/UpgradeCoinImpl.json +47 -0
- package/abis/UpgradesTest.json +67 -0
- package/abis/Vm.json +1482 -111
- package/abis/VmSafe.json +856 -32
- package/abis/ZoraFactoryImpl.json +339 -1
- package/abis/ZoraV4CoinHook.json +455 -5
- package/addresses/8453.json +8 -4
- package/addresses/84532.json +8 -4
- package/dist/index.cjs +1920 -169
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1916 -169
- package/dist/index.js.map +1 -1
- package/dist/wagmiGenerated.d.ts +2599 -183
- package/dist/wagmiGenerated.d.ts.map +1 -1
- package/package/wagmiGenerated.ts +1928 -165
- package/package.json +8 -3
- package/remappings.txt +6 -1
- package/script/CoinsDeployerBase.sol +74 -11
- package/script/DeployDevFactory.s.sol +21 -0
- package/script/PrintUpgradeCommand.s.sol +13 -0
- package/script/Simulate.s.sol +1 -10
- package/script/TestBackingCoinSwap.s.sol +146 -0
- package/script/TestV4Swap.s.sol +136 -0
- package/script/UpgradeFactoryImpl.s.sol +1 -1
- package/src/BaseCoin.sol +176 -0
- package/src/Coin.sol +87 -202
- package/src/CoinV4.sol +121 -0
- package/src/ZoraFactoryImpl.sol +208 -36
- package/src/hooks/ZoraV4CoinHook.sol +195 -0
- package/src/hooks/{BaseCoinDeployHook.sol → deployment/BaseCoinDeployHook.sol} +3 -3
- package/src/hooks/{BuySupplyWithSwapRouterHook.sol → deployment/BuySupplyWithSwapRouterHook.sol} +7 -5
- package/src/interfaces/ICoin.sol +31 -39
- package/src/interfaces/ICoinV3.sol +71 -0
- package/src/interfaces/ICoinV4.sol +69 -0
- package/src/interfaces/IDeployedCoinVersionLookup.sol +11 -0
- package/src/interfaces/IMsgSender.sol +9 -0
- package/src/interfaces/IPoolConfigEncoding.sol +14 -0
- package/src/interfaces/ISwapPathRouter.sol +14 -0
- package/src/interfaces/IZoraFactory.sol +65 -27
- package/src/interfaces/IZoraV4CoinHook.sol +116 -0
- package/src/libs/CoinCommon.sol +15 -0
- package/src/libs/CoinConfigurationVersions.sol +116 -1
- package/src/libs/CoinConstants.sol +5 -0
- package/src/libs/CoinDopplerMultiCurve.sol +134 -0
- package/src/libs/CoinDopplerUniV3.sol +19 -171
- package/src/libs/CoinRewards.sol +195 -0
- package/src/libs/CoinRewardsV4.sol +180 -0
- package/src/libs/CoinSetup.sol +57 -0
- package/src/libs/CoinSetupV3.sol +6 -67
- package/src/libs/DopplerMath.sol +156 -0
- package/src/libs/HooksDeployment.sol +84 -0
- package/src/libs/MarketConstants.sol +4 -0
- package/src/libs/PoolStateReader.sol +22 -0
- package/src/libs/UniV3BuySell.sol +74 -292
- package/src/libs/UniV4SwapHelper.sol +65 -0
- package/src/libs/UniV4SwapToCurrency.sol +109 -0
- package/src/libs/V4Liquidity.sol +129 -0
- package/src/types/PoolConfiguration.sol +15 -0
- package/src/utils/DeployedCoinVersionLookup.sol +52 -0
- package/src/version/ContractVersionBase.sol +1 -1
- package/test/Coin.t.sol +78 -88
- package/test/CoinDopplerUniV3.t.sol +32 -171
- package/test/CoinUniV4.t.sol +752 -0
- package/test/{Hooks.t.sol → DeploymentHooks.t.sol} +2 -6
- package/test/Factory.t.sol +80 -47
- package/test/MultiOwnable.t.sol +6 -3
- package/test/Upgrades.t.sol +6 -5
- package/test/mocks/MockERC20.sol +12 -0
- package/test/utils/BaseTest.sol +106 -56
- package/test/utils/DeployedCoinVersionLookup.t.sol +127 -0
- package/test/utils/FeeEstimatorHook.sol +84 -0
- package/test/utils/ProxyShim.sol +17 -0
- package/wagmi.config.ts +4 -0
- package/.env +0 -1
- package/.turbo/turbo-update-contract-version.log +0 -22
- package/abis/CoinSetupV3.json +0 -7
- package/abis/HookDeployer.json +0 -68
- package/abis/IHookDeployer.json +0 -42
- package/src/libs/CoinLegacy.sol +0 -48
- package/src/libs/CoinLegacyMarket.sol +0 -182
|
@@ -9,15 +9,10 @@ import {CoinConstants} from "../src/libs/CoinConstants.sol";
|
|
|
9
9
|
import {IUniswapV3Pool} from "../src/interfaces/IUniswapV3Pool.sol";
|
|
10
10
|
import {LpPosition} from "../src/types/LpPosition.sol";
|
|
11
11
|
import {IDopplerErrors} from "../src/interfaces/IDopplerErrors.sol";
|
|
12
|
-
import {CoinDopplerUniV3} from "../src/libs/CoinDopplerUniV3.sol";
|
|
12
|
+
import {DopplerMath, CoinDopplerUniV3} from "../src/libs/CoinDopplerUniV3.sol";
|
|
13
13
|
import {TickMath} from "../src/utils/uniswap/TickMath.sol";
|
|
14
14
|
|
|
15
15
|
contract DopplerUniswapV3Test is BaseTest {
|
|
16
|
-
int24 internal constant DEFAULT_DISCOVERY_TICK_LOWER = -777000;
|
|
17
|
-
int24 internal constant DEFAULT_DISCOVERY_TICK_UPPER = 222000;
|
|
18
|
-
uint16 internal constant DEFAULT_NUM_DISCOVERY_POSITIONS = 10; // will be 11 total with tail position
|
|
19
|
-
uint256 internal constant DEFAULT_DISCOVERY_SUPPLY_SHARE = 0.495e18; // half of the 990m total pool supply
|
|
20
|
-
|
|
21
16
|
function _deployCoin(bytes memory poolConfig_) internal {
|
|
22
17
|
vm.prank(users.creator);
|
|
23
18
|
(address coinAddress, ) = factory.deploy(
|
|
@@ -42,134 +37,7 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
42
37
|
super.setUp();
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
function
|
|
46
|
-
bytes memory poolConfig = _generatePoolConfig(
|
|
47
|
-
CoinConfigurationVersions.LEGACY_POOL_VERSION,
|
|
48
|
-
address(weth),
|
|
49
|
-
MarketConstants.LP_TICK_LOWER_WETH,
|
|
50
|
-
0,
|
|
51
|
-
1,
|
|
52
|
-
0
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
_deployCoin(poolConfig);
|
|
56
|
-
|
|
57
|
-
assertEq(coin.currency(), address(weth), "currency");
|
|
58
|
-
assertEq(coin.totalSupply(), 1_000_000_000e18, "totalSupply");
|
|
59
|
-
assertEq(coin.balanceOf(users.creator), 10_000_000e18, "balanceOf creator");
|
|
60
|
-
assertGt(coin.balanceOf(coin.poolAddress()), 989_999_999e18, "balanceOf pool");
|
|
61
|
-
|
|
62
|
-
(
|
|
63
|
-
address asset,
|
|
64
|
-
address numeraire,
|
|
65
|
-
int24 tickLower,
|
|
66
|
-
int24 tickUpper,
|
|
67
|
-
uint16 numPositions,
|
|
68
|
-
bool isInitialized,
|
|
69
|
-
bool isExited,
|
|
70
|
-
uint256 maxShareToBeSold,
|
|
71
|
-
uint256 totalTokensOnBondingCurve
|
|
72
|
-
) = coin.poolState();
|
|
73
|
-
|
|
74
|
-
assertEq(asset, address(coin));
|
|
75
|
-
assertEq(numeraire, address(weth));
|
|
76
|
-
assertEq(numPositions, 1);
|
|
77
|
-
assertTrue(isInitialized);
|
|
78
|
-
assertFalse(isExited);
|
|
79
|
-
assertEq(maxShareToBeSold, 0);
|
|
80
|
-
assertEq(totalTokensOnBondingCurve, CoinConstants.POOL_LAUNCH_SUPPLY);
|
|
81
|
-
|
|
82
|
-
bool isCoinToken0 = address(coin) < address(weth);
|
|
83
|
-
|
|
84
|
-
if (isCoinToken0) {
|
|
85
|
-
assertEq(tickLower, MarketConstants.LP_TICK_LOWER_WETH);
|
|
86
|
-
assertEq(tickUpper, MarketConstants.LP_TICK_UPPER);
|
|
87
|
-
} else {
|
|
88
|
-
assertEq(tickLower, -MarketConstants.LP_TICK_UPPER);
|
|
89
|
-
assertEq(tickUpper, -MarketConstants.LP_TICK_LOWER_WETH);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function test_invalid_tick_range() public {
|
|
94
|
-
bytes memory poolConfig = _generatePoolConfig(CoinConfigurationVersions.LEGACY_POOL_VERSION, address(weth), -100, 100, 100, 0.5e18);
|
|
95
|
-
|
|
96
|
-
vm.expectRevert();
|
|
97
|
-
factory.deploy(users.creator, _getDefaultOwners(), "https://test.com", "Testcoin", "TEST", poolConfig, users.platformReferrer, 0);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function test_inverted_tick_range_revert() public {
|
|
101
|
-
// These tick ranges are flipped
|
|
102
|
-
bytes memory poolConfig = _generatePoolConfig(CoinConfigurationVersions.LEGACY_POOL_VERSION, address(weth), 10000, -10000, 100, 0.5e18);
|
|
103
|
-
|
|
104
|
-
vm.expectRevert(abi.encodeWithSignature("InvalidWethLowerTick()"));
|
|
105
|
-
factory.deploy(users.creator, _getDefaultOwners(), "https://test.com", "Testcoin", "TEST", poolConfig, users.platformReferrer, 0);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function test_deploy_legacy_eth_config_with_prebuy(uint256 initialOrderSize) public {
|
|
109
|
-
vm.assume(initialOrderSize > CoinConstants.MIN_ORDER_SIZE);
|
|
110
|
-
vm.assume(initialOrderSize < 10 ether);
|
|
111
|
-
|
|
112
|
-
vm.deal(users.creator, initialOrderSize);
|
|
113
|
-
|
|
114
|
-
bytes memory poolConfig = _generatePoolConfig(
|
|
115
|
-
CoinConfigurationVersions.LEGACY_POOL_VERSION,
|
|
116
|
-
address(weth),
|
|
117
|
-
MarketConstants.LP_TICK_LOWER_WETH,
|
|
118
|
-
0,
|
|
119
|
-
0,
|
|
120
|
-
0
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
vm.prank(users.creator);
|
|
124
|
-
(address coinAddress, ) = factory.deploy{value: initialOrderSize}(
|
|
125
|
-
users.creator,
|
|
126
|
-
_getDefaultOwners(),
|
|
127
|
-
"https://test.com",
|
|
128
|
-
"Testcoin",
|
|
129
|
-
"TEST",
|
|
130
|
-
poolConfig,
|
|
131
|
-
users.platformReferrer,
|
|
132
|
-
initialOrderSize
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
coin = Coin(payable(coinAddress));
|
|
136
|
-
pool = IUniswapV3Pool(coin.poolAddress());
|
|
137
|
-
|
|
138
|
-
assertGt(coin.balanceOf(users.creator), 10_000_000e18, "balanceOf creator");
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function test_deploy_legacy_usdc_config_with_prebuy() public {
|
|
142
|
-
address[] memory owners = new address[](1);
|
|
143
|
-
owners[0] = users.creator;
|
|
144
|
-
|
|
145
|
-
uint256 orderSize = dealUSDC(users.creator, 100);
|
|
146
|
-
|
|
147
|
-
vm.prank(users.creator);
|
|
148
|
-
usdc.approve(address(factory), orderSize);
|
|
149
|
-
|
|
150
|
-
bytes memory poolConfig = _generatePoolConfig(CoinConfigurationVersions.LEGACY_POOL_VERSION, address(usdc), USDC_TICK_LOWER, 0, 0, 0);
|
|
151
|
-
|
|
152
|
-
vm.prank(users.creator);
|
|
153
|
-
(address coinAddress, uint256 coinsPurchased) = factory.deploy(
|
|
154
|
-
users.creator,
|
|
155
|
-
owners,
|
|
156
|
-
"https://testcoinusdcpair.com",
|
|
157
|
-
"Testcoinusdcpair",
|
|
158
|
-
"TESTCOINUSDCPAIR",
|
|
159
|
-
poolConfig,
|
|
160
|
-
users.platformReferrer,
|
|
161
|
-
orderSize
|
|
162
|
-
);
|
|
163
|
-
coin = Coin(payable(coinAddress));
|
|
164
|
-
pool = IUniswapV3Pool(coin.poolAddress());
|
|
165
|
-
vm.label(address(coin), "COIN");
|
|
166
|
-
vm.label(address(pool), "POOL");
|
|
167
|
-
|
|
168
|
-
assertEq(coin.currency(), address(usdc), "currency");
|
|
169
|
-
assertEq(coin.balanceOf(users.creator), CoinConstants.CREATOR_LAUNCH_REWARD + coinsPurchased);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function test_deploy_doppler_eth() public {
|
|
40
|
+
function test_supply_constants() public {
|
|
173
41
|
bytes memory poolConfig = _generatePoolConfig(
|
|
174
42
|
CoinConfigurationVersions.DOPPLER_UNI_V3_POOL_VERSION,
|
|
175
43
|
address(weth),
|
|
@@ -180,26 +48,15 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
180
48
|
);
|
|
181
49
|
|
|
182
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);
|
|
183
56
|
|
|
184
|
-
(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
,
|
|
188
|
-
,
|
|
189
|
-
uint16 numPositions,
|
|
190
|
-
bool isInitialized,
|
|
191
|
-
bool isExited,
|
|
192
|
-
uint256 maxShareToBeSold,
|
|
193
|
-
uint256 totalTokensOnBondingCurve
|
|
194
|
-
) = coin.poolState();
|
|
195
|
-
|
|
196
|
-
assertEq(asset, address(coin), "poolState.asset");
|
|
197
|
-
assertEq(numeraire, address(weth), "poolState.numeraire");
|
|
198
|
-
assertEq(numPositions, DEFAULT_NUM_DISCOVERY_POSITIONS, "poolState.numPositions");
|
|
199
|
-
assertTrue(isInitialized, "poolState.isInitialized");
|
|
200
|
-
assertFalse(isExited, "poolState.isExited");
|
|
201
|
-
assertEq(maxShareToBeSold, DEFAULT_DISCOVERY_SUPPLY_SHARE, "poolState.maxShareToBeSold");
|
|
202
|
-
assertEq(totalTokensOnBondingCurve, CoinConstants.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);
|
|
203
60
|
}
|
|
204
61
|
|
|
205
62
|
function test_deploy_doppler_eth_with_prebuy(uint256 initialOrderSize) public {
|
|
@@ -264,40 +121,40 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
264
121
|
int24 TICK_SPACING = 60;
|
|
265
122
|
int24 expected = 12300;
|
|
266
123
|
|
|
267
|
-
assertEq(
|
|
124
|
+
assertEq(DopplerMath.alignTickToTickSpacing(true, tick, TICK_SPACING), expected, "Align positive tick (token0)");
|
|
268
125
|
}
|
|
269
126
|
|
|
270
127
|
function test_alignTick_isToken0_negative() public pure {
|
|
271
128
|
int24 tick = -12345;
|
|
272
129
|
int24 TICK_SPACING = 60;
|
|
273
130
|
int24 expected = -12360;
|
|
274
|
-
assertEq(
|
|
131
|
+
assertEq(DopplerMath.alignTickToTickSpacing(true, tick, TICK_SPACING), expected, "Align negative tick (token0)");
|
|
275
132
|
}
|
|
276
133
|
|
|
277
134
|
function test_alignTick_isToken1_negative() public pure {
|
|
278
135
|
int24 tick = -12345;
|
|
279
136
|
int24 TICK_SPACING = 60;
|
|
280
137
|
int24 expected = -12300;
|
|
281
|
-
assertEq(
|
|
138
|
+
assertEq(DopplerMath.alignTickToTickSpacing(false, tick, TICK_SPACING), expected, "Align negative tick (token1)");
|
|
282
139
|
}
|
|
283
140
|
|
|
284
141
|
function test_alignTick_isToken1_zero() public pure {
|
|
285
142
|
int24 tick = 0;
|
|
286
143
|
int24 expected = 0;
|
|
287
|
-
assertEq(
|
|
144
|
+
assertEq(DopplerMath.alignTickToTickSpacing(false, tick, MarketConstants.TICK_SPACING), expected, "Align zero tick (token1)");
|
|
288
145
|
}
|
|
289
146
|
|
|
290
147
|
// Additional tick alignment test for full branch coverage
|
|
291
148
|
function test_alignTick_isToken0_zero() public pure {
|
|
292
149
|
int24 tick = 0;
|
|
293
150
|
int24 expected = 0;
|
|
294
|
-
assertEq(
|
|
151
|
+
assertEq(DopplerMath.alignTickToTickSpacing(true, tick, MarketConstants.TICK_SPACING), expected, "Align zero tick (token0)");
|
|
295
152
|
}
|
|
296
153
|
|
|
297
154
|
function test_alignTick_isToken1_positive() public pure {
|
|
298
155
|
int24 tick = 12345;
|
|
299
156
|
int24 expected = 12400; // Round up for token1
|
|
300
|
-
assertEq(
|
|
157
|
+
assertEq(DopplerMath.alignTickToTickSpacing(false, tick, MarketConstants.TICK_SPACING), expected, "Align positive tick (token1)");
|
|
301
158
|
}
|
|
302
159
|
|
|
303
160
|
function test_calculateLpTail_isToken0() public pure {
|
|
@@ -306,10 +163,10 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
306
163
|
uint256 tailSupply = 1e18;
|
|
307
164
|
bool isToken0 = true;
|
|
308
165
|
|
|
309
|
-
LpPosition memory tail =
|
|
166
|
+
LpPosition memory tail = DopplerMath.calculateLpTail(tickLower, tickUpper, isToken0, tailSupply, MarketConstants.TICK_SPACING);
|
|
310
167
|
|
|
311
168
|
int24 expectedPosTickLower = tickUpper;
|
|
312
|
-
int24 expectedPosTickUpper =
|
|
169
|
+
int24 expectedPosTickUpper = DopplerMath.alignTickToTickSpacing(true, TickMath.MAX_TICK, MarketConstants.TICK_SPACING);
|
|
313
170
|
|
|
314
171
|
assertEq(tail.tickLower, expectedPosTickLower, "Tail tickLower (token0)");
|
|
315
172
|
assertEq(tail.tickUpper, expectedPosTickUpper, "Tail tickUpper (token0)");
|
|
@@ -322,9 +179,9 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
322
179
|
uint256 tailSupply = 1e18;
|
|
323
180
|
bool isToken0 = false;
|
|
324
181
|
|
|
325
|
-
LpPosition memory tail =
|
|
182
|
+
LpPosition memory tail = DopplerMath.calculateLpTail(tickLower, tickUpper, isToken0, tailSupply, MarketConstants.TICK_SPACING);
|
|
326
183
|
|
|
327
|
-
int24 expectedPosTickLower =
|
|
184
|
+
int24 expectedPosTickLower = DopplerMath.alignTickToTickSpacing(false, TickMath.MIN_TICK, MarketConstants.TICK_SPACING);
|
|
328
185
|
int24 expectedPosTickUpper = tickLower;
|
|
329
186
|
|
|
330
187
|
assertEq(tail.tickLower, expectedPosTickLower, "Tail tickLower (token1)");
|
|
@@ -339,14 +196,15 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
339
196
|
uint256 discoverySupply = 100e18;
|
|
340
197
|
LpPosition[] memory newPositions = new LpPosition[](DEFAULT_NUM_DISCOVERY_POSITIONS);
|
|
341
198
|
|
|
342
|
-
(LpPosition[] memory positions, uint256 totalAssetsSold) =
|
|
199
|
+
(LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
|
|
343
200
|
tickLower,
|
|
344
201
|
tickUpper,
|
|
345
202
|
MarketConstants.TICK_SPACING,
|
|
346
203
|
isToken0,
|
|
347
204
|
discoverySupply,
|
|
348
205
|
DEFAULT_NUM_DISCOVERY_POSITIONS,
|
|
349
|
-
newPositions
|
|
206
|
+
newPositions,
|
|
207
|
+
0
|
|
350
208
|
);
|
|
351
209
|
|
|
352
210
|
assertEq(positions.length, DEFAULT_NUM_DISCOVERY_POSITIONS, "Correct number of positions (token0)");
|
|
@@ -370,14 +228,15 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
370
228
|
uint256 discoverySupply = 100e18;
|
|
371
229
|
LpPosition[] memory newPositions = new LpPosition[](DEFAULT_NUM_DISCOVERY_POSITIONS);
|
|
372
230
|
|
|
373
|
-
(LpPosition[] memory positions, uint256 totalAssetsSold) =
|
|
231
|
+
(LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
|
|
374
232
|
tickLower,
|
|
375
233
|
tickUpper,
|
|
376
234
|
MarketConstants.TICK_SPACING,
|
|
377
235
|
isToken0,
|
|
378
236
|
discoverySupply,
|
|
379
237
|
DEFAULT_NUM_DISCOVERY_POSITIONS,
|
|
380
|
-
newPositions
|
|
238
|
+
newPositions,
|
|
239
|
+
0
|
|
381
240
|
);
|
|
382
241
|
|
|
383
242
|
assertEq(positions.length, DEFAULT_NUM_DISCOVERY_POSITIONS, "Correct number of positions (token1)");
|
|
@@ -401,14 +260,15 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
401
260
|
uint256 discoverySupply = 0;
|
|
402
261
|
LpPosition[] memory newPositions = new LpPosition[](DEFAULT_NUM_DISCOVERY_POSITIONS);
|
|
403
262
|
|
|
404
|
-
(LpPosition[] memory positions, uint256 totalAssetsSold) =
|
|
263
|
+
(LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
|
|
405
264
|
tickLower,
|
|
406
265
|
tickUpper,
|
|
407
266
|
MarketConstants.TICK_SPACING,
|
|
408
267
|
isToken0,
|
|
409
268
|
discoverySupply,
|
|
410
269
|
DEFAULT_NUM_DISCOVERY_POSITIONS,
|
|
411
|
-
newPositions
|
|
270
|
+
newPositions,
|
|
271
|
+
0
|
|
412
272
|
);
|
|
413
273
|
|
|
414
274
|
assertEq(positions.length, DEFAULT_NUM_DISCOVERY_POSITIONS, "Correct number of positions (zero supply)");
|
|
@@ -432,14 +292,15 @@ contract DopplerUniswapV3Test is BaseTest {
|
|
|
432
292
|
uint16 totalPositions = 1;
|
|
433
293
|
LpPosition[] memory newPositions = new LpPosition[](totalPositions);
|
|
434
294
|
|
|
435
|
-
(LpPosition[] memory positions, uint256 totalAssetsSold) =
|
|
295
|
+
(LpPosition[] memory positions, uint256 totalAssetsSold) = DopplerMath.calculateLogNormalDistribution(
|
|
436
296
|
tickLower,
|
|
437
297
|
tickUpper,
|
|
438
298
|
MarketConstants.TICK_SPACING,
|
|
439
299
|
isToken0,
|
|
440
300
|
discoverySupply,
|
|
441
301
|
totalPositions,
|
|
442
|
-
newPositions
|
|
302
|
+
newPositions,
|
|
303
|
+
0
|
|
443
304
|
);
|
|
444
305
|
|
|
445
306
|
assertEq(positions.length, totalPositions, "Correct number of positions");
|