Skip to content

Commit 7cdfe5e

Browse files
test: Adjusted tests
1 parent 264d593 commit 7cdfe5e

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

contracts/test/AggregatorFeeSharingWithUniswapV3.t.sol

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ contract AggregatorTest is TestParameters, TestHelpers {
3030
MockERC20 public rewardToken;
3131

3232
function setUp() public {
33-
// 0. Mock WETH
33+
// 0. Mock WETH deployment
3434
rewardToken = new MockERC20("WETH", "Wrapped Ether");
3535

36-
// 1. Mock Uniswap v3 Router
36+
// 1. Mock UniswapV3Router deployment
3737
uniswapRouter = new MockUniswapV3Router();
3838

3939
// 2. LooksRareToken deployment
@@ -80,7 +80,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
8080
address(tokenDistributor)
8181
);
8282

83-
// 6. FeeSharingSetter deployment (distribution period is set at 100 blocks)
83+
// 6. FeeSharingSetter deployment (w/ distribution period is set at 100 blocks)
8484
feeSharingSetter = new FeeSharingSetter(address(feeSharingSystem), 30, 1000, 100);
8585
feeSharingSetter.grantRole(feeSharingSetter.OPERATOR_ROLE(), feeSharingSystem.owner());
8686
feeSharingSystem.transferOwnership(address(feeSharingSetter));
@@ -164,7 +164,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
164164
uint256 amountDeposit = _parseEther(100);
165165
cheats.roll(_START_BLOCK + 5);
166166

167-
/** 1. Initial deposits at startBlock + 5
167+
/** 1. Initial deposits at startBlock + 5
168168
*/
169169
address[4] memory users = [user1, user2, user3, user4];
170170
for (uint256 i = 0; i < users.length; i++) {
@@ -173,7 +173,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
173173
}
174174
assertEq(aggregatorFeeSharingWithUniswapV3.userInfo(user1), aggregatorFeeSharingWithUniswapV3.userInfo(user2));
175175

176-
/** 2. Time travel to startBlock + 20 (15 blocks later)
176+
/** 2. Time travel to startBlock + 20 (15 blocks later)
177177
* User1 withdraws funds
178178
*/
179179
cheats.roll(_START_BLOCK + 20);
@@ -189,21 +189,21 @@ contract AggregatorTest is TestParameters, TestHelpers {
189189
currentBalanceUser + _parseEtherWithFloating(1125, 1) + amountDeposit
190190
);
191191

192-
/** 3. Time travel to startBlock + 100 (80 blocks later)
192+
/** 3. Time travel to startBlock + 100 (80 blocks later)
193193
* User2 checks the value of her shares
194194
*/
195195
cheats.roll(_START_BLOCK + 100);
196196

197197
// 80 blocks at 30 LOOKS/blocks = 2400 LOOKS
198198
// 800 LOOKS for user
199-
// Total value of the shares = 800 LOOKS + 112.5 LOOKS + 100 LOOKS = 1012.5
199+
// Total value of the shares = 800 LOOKS + 112.5 LOOKS + 100 LOOKS = 1012.5 LOOKS
200200
// @dev To deal with minor precision losses due to division, we look at the boundaries
201201
assertQuasiEq(
202202
aggregatorFeeSharingWithUniswapV3.calculateSharesValueInLOOKS(user2),
203203
_parseEtherWithFloating(10125, 1)
204204
);
205205

206-
/** 4. Time travel to startBlock + 170 (70 blocks later)
206+
/** 4. Time travel to startBlock + 170 (70 blocks later)
207207
* User2 withdraws all
208208
*/
209209
cheats.roll(_START_BLOCK + 170);
@@ -217,7 +217,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
217217
// Total = 1362.5 LOOKS
218218
assertQuasiEq(looksRareToken.balanceOf(user2), currentBalanceUser + _parseEtherWithFloating(13625, 1));
219219

220-
/** 5. Time travel to startBlock + 400 (230 blocks later)
220+
/** 5. Time travel to startBlock + 400 (230 blocks later)
221221
* User3 withdraws all
222222
*/
223223
cheats.roll(_START_BLOCK + 400);
@@ -233,7 +233,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
233233
// Total = 2150 LOOKS
234234
assertQuasiEq(looksRareToken.balanceOf(user3), currentBalanceUser + _parseEther(2150));
235235

236-
/** 6. Time travel to startBlock + 400 (230 blocks later)
236+
/** 6. Time travel to startBlock + 400 (230 blocks later)
237237
* User4 withdraws all
238238
*/
239239
cheats.roll(_START_BLOCK + 450);
@@ -244,12 +244,12 @@ contract AggregatorTest is TestParameters, TestHelpers {
244244
// Should be same as user3 since LOOKS distribution is stopped
245245
assertQuasiEq(looksRareToken.balanceOf(user4), currentBalanceUser + _parseEther(2150));
246246

247-
// Verify the final supply is equal to the cap - supply not minted (for first 5 blocks)
247+
// Verify the final total supply is equal to the cap - supply not minted (for first 5 blocks)
248248
assertEq(looksRareToken.totalSupply(), _parseEther(_CAP) - _parseEther(500));
249249
}
250250

251251
function testScenarioWithRouter() public {
252-
/** 0. Initial set up
252+
/** 0. Initial set up
253253
*/
254254
cheats.roll(_START_BLOCK);
255255

@@ -272,15 +272,15 @@ contract AggregatorTest is TestParameters, TestHelpers {
272272
uint256 amountDeposit = _parseEther(100);
273273
cheats.roll(_START_BLOCK + 5);
274274

275-
/** 1. Initial deposits at startBlock + 5
275+
/** 1. Initial deposits at startBlock + 5
276276
*/
277277
address[4] memory users = [user1, user2, user3, user4];
278278
for (uint256 i = 0; i < users.length; i++) {
279279
cheats.prank(users[i]);
280280
aggregatorFeeSharingWithUniswapV3.deposit(amountDeposit);
281281
}
282282

283-
/** 2. Time travel to startBlock + 20 (15 blocks later)
283+
/** 2. Time travel to startBlock + 20 (15 blocks later)
284284
* User1 withdraws funds
285285
*/
286286
cheats.roll(_START_BLOCK + 20);
@@ -292,7 +292,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
292292
// 15 blocks at 30 LOOKS/block = 450 LOOKS
293293
// + 150 WETH sold at 1 WETH = 1.5 LOOKS --> 225 LOOKS
294294
// 675 / 4 = 168.75 LOOKS for user
295-
// @dev 50 WETH are lost to the fee sharing system contract since nobody was staking for the first 5 blocks
295+
// @dev 50 WETH are lost to the fee sharing system contract since no user was staking for the first 5 blocks
296296
assertEq(
297297
looksRareToken.balanceOf(user1),
298298
currentBalanceUser + _parseEtherWithFloating(16875, 2) + amountDeposit
@@ -322,7 +322,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
322322
aggregatorFeeSharingWithUniswapV3.calculateSharesValueInLOOKS(user2)
323323
);
324324

325-
/** 3. Time travel to startBlock + 100 (80 blocks later)
325+
/** 3. Time travel to startBlock + 100 (80 blocks later)
326326
* User1 withdraws
327327
*/
328328
cheats.roll(_START_BLOCK + 100);
@@ -343,7 +343,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
343343

344344
assertEq(feeSharingSystem.lastRewardBlock(), _START_BLOCK + 100);
345345

346-
/** 4. Start of new reward period over 300 blocks
346+
/** 4. Start of new reward period over 300 blocks
347347
*/
348348

349349
// Add 1500 WETH for distribution for next 300 blocks (5 WETH per block)
@@ -352,8 +352,8 @@ contract AggregatorTest is TestParameters, TestHelpers {
352352
feeSharingSetter.updateRewards();
353353
assertEq(feeSharingSystem.currentRewardPerBlock(), _parseEther(5));
354354

355-
/** 5. Time travel to the end of the LOOKS staking/fee-sharing period
356-
* All users withdraw their funds
355+
/** 5. Time travel to the end of the LOOKS staking/fee-sharing period
356+
* All 3 users withdraw their funds
357357
*/
358358
cheats.roll(_START_BLOCK + 401);
359359

@@ -383,7 +383,7 @@ contract AggregatorTest is TestParameters, TestHelpers {
383383
// There should be around 50 WETH left in the fee sharing contract (for the first 5 blocks without user staking)
384384
assertQuasiEq(rewardToken.balanceOf(address(feeSharingSystem)), _parseEther(50));
385385

386-
// Verify the final supply is equal to the cap - supply not minted (for first 5 blocks)
386+
// Verify the final total supply is equal to the cap - supply not minted (for first 5 blocks)
387387
assertEq(looksRareToken.totalSupply(), _parseEther(_CAP) - _parseEther(500));
388388
}
389389
}

0 commit comments

Comments
 (0)