-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29dcec2
commit 7f57dad
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity ^0.8.0; | ||
|
||
import {FourSixTwoSixAggBase, FourSixTwoSixAgg} from "./FourSixTwoSixAggBase.t.sol"; | ||
|
||
contract RemoveStrategyTest is FourSixTwoSixAggBase { | ||
uint256 strategyAllocationPoints; | ||
|
||
function setUp() public virtual override { | ||
super.setUp(); | ||
|
||
strategyAllocationPoints = type(uint120).max; | ||
_addStrategy(manager, address(eTST), strategyAllocationPoints); | ||
} | ||
|
||
function testRemoveStrategy() public { | ||
uint256 totalAllocationPointsBefore = fourSixTwoSixAgg.totalAllocationPoints(); | ||
uint256 withdrawalQueueLengthBefore = fourSixTwoSixAgg.withdrawalQueueLength(); | ||
|
||
vm.prank(manager); | ||
fourSixTwoSixAgg.removeStrategy(address(eTST)); | ||
|
||
FourSixTwoSixAgg.Strategy memory strategyAfter = fourSixTwoSixAgg.getStrategy(address(eTST)); | ||
|
||
assertEq(strategyAfter.active, false); | ||
assertEq(strategyAfter.allocationPoints, 0); | ||
assertEq(fourSixTwoSixAgg.totalAllocationPoints(), totalAllocationPointsBefore - strategyAllocationPoints); | ||
assertEq(fourSixTwoSixAgg.withdrawalQueueLength(), withdrawalQueueLengthBefore - 1); | ||
} | ||
|
||
function testRemoveStrategy_fromUnauthorized() public { | ||
vm.prank(deployer); | ||
vm.expectRevert(); | ||
fourSixTwoSixAgg.removeStrategy(address(eTST)); | ||
} | ||
|
||
function testRemoveStrategy_AlreadyRemoved() public { | ||
vm.prank(manager); | ||
vm.expectRevert(); | ||
fourSixTwoSixAgg.removeStrategy(address(eTST2)); | ||
} | ||
} |