@zoralabs/coins 0.3.0 → 0.4.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 +33 -33
- package/CHANGELOG.md +12 -0
- package/abis/IZoraFactory.json +5 -0
- package/abis/ZoraFactoryImpl.json +5 -0
- package/addresses/8453.json +2 -2
- package/addresses/84532.json +2 -2
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/wagmiGenerated.d.ts +4 -0
- package/dist/wagmiGenerated.d.ts.map +1 -1
- package/package/wagmiGenerated.ts +4 -1
- package/package.json +1 -1
- package/src/Coin.sol +1 -3
- package/src/ZoraFactoryImpl.sol +9 -9
- package/src/interfaces/IZoraFactory.sol +1 -1
- package/src/utils/CoinConstants.sol +3 -11
- package/src/version/ContractVersionBase.sol +1 -1
- package/test/Coin.t.sol +38 -18
- package/test/Factory.t.sol +90 -98
- package/test/utils/BaseTest.sol +24 -16
package/test/Factory.t.sol
CHANGED
|
@@ -17,12 +17,18 @@ contract FactoryTest is BaseTest {
|
|
|
17
17
|
address[] memory owners = new address[](1);
|
|
18
18
|
owners[0] = users.creator;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
(address coinAddress, ) = factory.deploy(
|
|
21
|
+
users.creator,
|
|
22
|
+
owners,
|
|
23
|
+
"https://test2.com",
|
|
24
|
+
"Test2 Token",
|
|
25
|
+
"TEST2",
|
|
26
|
+
users.platformReferrer,
|
|
27
|
+
address(weth),
|
|
28
|
+
LP_TICK_LOWER_WETH,
|
|
29
|
+
0
|
|
25
30
|
);
|
|
31
|
+
coin = Coin(payable(coinAddress));
|
|
26
32
|
pool = IUniswapV3Pool(coin.poolAddress());
|
|
27
33
|
vm.label(address(coin), "COIN");
|
|
28
34
|
vm.label(address(pool), "POOL");
|
|
@@ -48,9 +54,7 @@ contract FactoryTest is BaseTest {
|
|
|
48
54
|
assertEq(coin.currency(), address(weth), "currency");
|
|
49
55
|
assertEq(coin.totalSupply(), 1_000_000_000e18, "totalSupply");
|
|
50
56
|
assertEq(coin.balanceOf(users.creator), 10_000_000e18, "balanceOf creator");
|
|
51
|
-
|
|
52
|
-
assertGe(coin.balanceOf(users.feeRecipient), 5_000_000e18, "balanceOf protocolRewardRecipient");
|
|
53
|
-
assertGt(coin.balanceOf(coin.poolAddress()), 979_999_983e18, "balanceOf pool");
|
|
57
|
+
assertGt(coin.balanceOf(coin.poolAddress()), 989_999_999e18, "balanceOf pool");
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
function test_deploy_with_eth(uint256 initialOrderSize) public {
|
|
@@ -62,21 +66,18 @@ contract FactoryTest is BaseTest {
|
|
|
62
66
|
|
|
63
67
|
vm.deal(users.creator, initialOrderSize);
|
|
64
68
|
vm.prank(users.creator);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
LP_TICK_LOWER_WETH,
|
|
76
|
-
initialOrderSize
|
|
77
|
-
)
|
|
78
|
-
)
|
|
69
|
+
(address coinAddress, ) = factory.deploy{value: initialOrderSize}(
|
|
70
|
+
users.creator,
|
|
71
|
+
owners,
|
|
72
|
+
"https://test2.com",
|
|
73
|
+
"Test2 Token",
|
|
74
|
+
"TEST2",
|
|
75
|
+
users.platformReferrer,
|
|
76
|
+
address(weth),
|
|
77
|
+
LP_TICK_LOWER_WETH,
|
|
78
|
+
initialOrderSize
|
|
79
79
|
);
|
|
80
|
+
coin = Coin(payable(coinAddress));
|
|
80
81
|
pool = IUniswapV3Pool(coin.poolAddress());
|
|
81
82
|
vm.label(address(coin), "COIN");
|
|
82
83
|
vm.label(address(pool), "POOL");
|
|
@@ -102,22 +103,18 @@ contract FactoryTest is BaseTest {
|
|
|
102
103
|
uint256 orderSize = 1 ether;
|
|
103
104
|
vm.deal(users.creator, orderSize);
|
|
104
105
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
address(weth),
|
|
116
|
-
LP_TICK_LOWER_WETH,
|
|
117
|
-
orderSize
|
|
118
|
-
)
|
|
119
|
-
)
|
|
106
|
+
(address coinAddress, ) = factory.deploy{value: orderSize}(
|
|
107
|
+
users.creator,
|
|
108
|
+
owners,
|
|
109
|
+
"https://test2.com",
|
|
110
|
+
"Test2 Token",
|
|
111
|
+
"TEST2",
|
|
112
|
+
users.platformReferrer,
|
|
113
|
+
address(weth),
|
|
114
|
+
LP_TICK_LOWER_WETH,
|
|
115
|
+
orderSize
|
|
120
116
|
);
|
|
117
|
+
coin = Coin(payable(coinAddress));
|
|
121
118
|
pool = IUniswapV3Pool(coin.poolAddress());
|
|
122
119
|
vm.label(address(coin), "COIN");
|
|
123
120
|
vm.label(address(pool), "POOL");
|
|
@@ -127,22 +124,18 @@ contract FactoryTest is BaseTest {
|
|
|
127
124
|
address[] memory owners = new address[](1);
|
|
128
125
|
owners[0] = users.creator;
|
|
129
126
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
USDC_ADDRESS,
|
|
141
|
-
USDC_TICK_LOWER,
|
|
142
|
-
0
|
|
143
|
-
)
|
|
144
|
-
)
|
|
127
|
+
(address coinAddress, ) = factory.deploy(
|
|
128
|
+
users.creator,
|
|
129
|
+
owners,
|
|
130
|
+
"https://testcoinusdcpair.com",
|
|
131
|
+
"Testcoinusdcpair",
|
|
132
|
+
"TESTCOINUSDCPAIR",
|
|
133
|
+
users.platformReferrer,
|
|
134
|
+
USDC_ADDRESS,
|
|
135
|
+
USDC_TICK_LOWER,
|
|
136
|
+
0
|
|
145
137
|
);
|
|
138
|
+
coin = Coin(payable(coinAddress));
|
|
146
139
|
pool = IUniswapV3Pool(coin.poolAddress());
|
|
147
140
|
vm.label(address(coin), "COIN");
|
|
148
141
|
vm.label(address(pool), "POOL");
|
|
@@ -190,22 +183,20 @@ contract FactoryTest is BaseTest {
|
|
|
190
183
|
address[] memory owners = new address[](1);
|
|
191
184
|
owners[0] = users.creator;
|
|
192
185
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
USDC_TICK_LOWER,
|
|
204
|
-
0
|
|
205
|
-
)
|
|
206
|
-
)
|
|
186
|
+
(address coinAddress, ) = factory.deploy(
|
|
187
|
+
users.creator,
|
|
188
|
+
owners,
|
|
189
|
+
"https://testcoinusdcpair.com",
|
|
190
|
+
"Testcoinusdcpair",
|
|
191
|
+
"TESTCOINUSDCPAIR",
|
|
192
|
+
address(0),
|
|
193
|
+
USDC_ADDRESS,
|
|
194
|
+
USDC_TICK_LOWER,
|
|
195
|
+
0
|
|
207
196
|
);
|
|
208
197
|
|
|
198
|
+
coin = Coin(payable(coinAddress));
|
|
199
|
+
|
|
209
200
|
assertEq(coin.platformReferrer(), coin.protocolRewardRecipient(), "platformReferrer");
|
|
210
201
|
}
|
|
211
202
|
|
|
@@ -214,20 +205,17 @@ contract FactoryTest is BaseTest {
|
|
|
214
205
|
owners[0] = users.creator;
|
|
215
206
|
|
|
216
207
|
vm.expectRevert(abi.encodeWithSelector(ICoin.InvalidWethLowerTick.selector));
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
0
|
|
229
|
-
)
|
|
230
|
-
)
|
|
208
|
+
|
|
209
|
+
factory.deploy(
|
|
210
|
+
users.creator,
|
|
211
|
+
owners,
|
|
212
|
+
"https://testcoinusdcpair.com",
|
|
213
|
+
"Testcoinusdcpair",
|
|
214
|
+
"TESTCOINUSDCPAIR",
|
|
215
|
+
users.platformReferrer,
|
|
216
|
+
address(0),
|
|
217
|
+
USDC_TICK_LOWER,
|
|
218
|
+
0
|
|
231
219
|
);
|
|
232
220
|
}
|
|
233
221
|
|
|
@@ -241,20 +229,17 @@ contract FactoryTest is BaseTest {
|
|
|
241
229
|
|
|
242
230
|
vm.prank(users.creator);
|
|
243
231
|
vm.expectRevert(abi.encodeWithSelector(ICoin.EthTransferInvalid.selector));
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
0
|
|
256
|
-
)
|
|
257
|
-
)
|
|
232
|
+
|
|
233
|
+
factory.deploy{value: 1e6}(
|
|
234
|
+
users.creator,
|
|
235
|
+
owners,
|
|
236
|
+
"https://testcoinusdcpair.com",
|
|
237
|
+
"Testcoinusdcpair",
|
|
238
|
+
"TESTCOINUSDCPAIR",
|
|
239
|
+
users.platformReferrer,
|
|
240
|
+
USDC_ADDRESS,
|
|
241
|
+
USDC_TICK_LOWER,
|
|
242
|
+
0
|
|
258
243
|
);
|
|
259
244
|
}
|
|
260
245
|
|
|
@@ -262,11 +247,18 @@ contract FactoryTest is BaseTest {
|
|
|
262
247
|
address[] memory owners = new address[](1);
|
|
263
248
|
owners[0] = users.creator;
|
|
264
249
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
250
|
+
(address coinAddress, ) = factory.deploy(
|
|
251
|
+
users.creator,
|
|
252
|
+
owners,
|
|
253
|
+
"https://test.com",
|
|
254
|
+
"Test Token",
|
|
255
|
+
"TEST",
|
|
256
|
+
users.platformReferrer,
|
|
257
|
+
address(weth),
|
|
258
|
+
LP_TICK_LOWER_WETH,
|
|
259
|
+
0
|
|
269
260
|
);
|
|
261
|
+
coin = Coin(payable(coinAddress));
|
|
270
262
|
|
|
271
263
|
assertEq(coin.balanceOf(users.creator), 10_000_000e18, "Should only have initial creator allocation");
|
|
272
264
|
}
|
package/test/utils/BaseTest.sol
CHANGED
|
@@ -110,9 +110,19 @@ contract BaseTest is Test, CoinConstants {
|
|
|
110
110
|
owners[0] = users.creator;
|
|
111
111
|
|
|
112
112
|
vm.prank(users.creator);
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
(address coinAddress, ) = factory.deploy(
|
|
114
|
+
users.creator,
|
|
115
|
+
owners,
|
|
116
|
+
"https://test.com",
|
|
117
|
+
"Testcoin",
|
|
118
|
+
"TEST",
|
|
119
|
+
users.platformReferrer,
|
|
120
|
+
address(weth),
|
|
121
|
+
LP_TICK_LOWER_WETH,
|
|
122
|
+
0
|
|
115
123
|
);
|
|
124
|
+
|
|
125
|
+
coin = Coin(payable(coinAddress));
|
|
116
126
|
pool = IUniswapV3Pool(coin.poolAddress());
|
|
117
127
|
|
|
118
128
|
vm.label(address(coin), "COIN");
|
|
@@ -124,21 +134,19 @@ contract BaseTest is Test, CoinConstants {
|
|
|
124
134
|
owners[0] = users.creator;
|
|
125
135
|
|
|
126
136
|
vm.prank(users.creator);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
USDC_TICK_LOWER,
|
|
138
|
-
0
|
|
139
|
-
)
|
|
140
|
-
)
|
|
137
|
+
(address coinAddress, ) = factory.deploy(
|
|
138
|
+
users.creator,
|
|
139
|
+
owners,
|
|
140
|
+
"https://testusdccoin.com",
|
|
141
|
+
"Testusdccoin",
|
|
142
|
+
"TESTUSDCCOIN",
|
|
143
|
+
users.platformReferrer,
|
|
144
|
+
USDC_ADDRESS,
|
|
145
|
+
USDC_TICK_LOWER,
|
|
146
|
+
0
|
|
141
147
|
);
|
|
148
|
+
|
|
149
|
+
coin = Coin(payable(coinAddress));
|
|
142
150
|
pool = IUniswapV3Pool(coin.poolAddress());
|
|
143
151
|
|
|
144
152
|
vm.label(address(coin), "COIN");
|