Skip to content

Commit

Permalink
test: deploy the protocol with "deployProtocol()"
Browse files Browse the repository at this point in the history
  • Loading branch information
andreivladbrg committed Feb 6, 2023
1 parent fa5c007 commit 06fa329
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
11 changes: 7 additions & 4 deletions test/invariant/Invariant.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ abstract contract Invariant_Test is Base_Test, ForgeInvariantTest {
function setUp() public virtual override {
Base_Test.setUp();

// Deploy the comptroller and its handler.
comptroller = new SablierV2Comptroller({ initialAdmin: users.admin });
// Deploy the entire protocol.
deployProtocol();

// Deploy the comptroller handler.
comptrollerHandler = new ComptrollerHandler(comptroller);
vm.prank({ msgSender: users.admin });
comptroller.transferAdmin(address(comptrollerHandler));
Expand All @@ -35,12 +37,13 @@ abstract contract Invariant_Test is Base_Test, ForgeInvariantTest {

// Exclude the comptroller, linear and pro for being the `msg.sender`.
excludeSender(address(comptroller));
excludeSender(address(linear));
excludeSender(address(pro));

// Exclude the comptroller handler for being the `msg.sender`.
excludeSender(address(comptrollerHandler));

// Label the base contracts.
vm.label({ account: address(comptroller), newLabel: "Comptroller" });
// Label the comptroller handler.
vm.label({ account: address(comptrollerHandler), newLabel: "ComptrollerHandler" });
}
}
14 changes: 3 additions & 11 deletions test/invariant/lockup/linear/Linear.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ contract Linear_Invariant_Test is Lockup_Invariant_Test {
function setUp() public virtual override {
Lockup_Invariant_Test.setUp();

// Deploy the linear contract and its handlers.
linear = new SablierV2LockupLinear({
initialAdmin: users.admin,
initialComptroller: comptroller,
maxFee: DEFAULT_MAX_FEE
});
// Deploy the linear contract handlers.
linearHandler = new LockupLinearHandler({
asset_: DEFAULT_ASSET,
linear_: linear,
Expand Down Expand Up @@ -63,15 +58,12 @@ contract Linear_Invariant_Test is Lockup_Invariant_Test {
targetContract(address(linearHandler));
targetContract(address(linearCreateHandler));

excludeSender(address(linear));

// Exclude the linear and the linear handlers for being the `msg.sender`.
// Exclude the linear handlers for being the `msg.sender`.
excludeSender(address(flashLoanHandler));
excludeSender(address(linearHandler));
excludeSender(address(linearCreateHandler));

// Label the linear contract and its handler.
vm.label({ account: address(linear), newLabel: "LockupLinear" });
// Label the linear handler.
vm.label({ account: address(linearHandler), newLabel: "LockupLinearHandler" });
}

Expand Down
11 changes: 2 additions & 9 deletions test/invariant/lockup/pro/Pro.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ contract Pro_Invariant_Test is Lockup_Invariant_Test {
function setUp() public virtual override {
Lockup_Invariant_Test.setUp();

// Deploy the pro contract and its handlers.
pro = new SablierV2LockupPro({
initialAdmin: users.admin,
initialComptroller: comptroller,
maxFee: DEFAULT_MAX_FEE,
maxSegmentCount: DEFAULT_MAX_SEGMENT_COUNT
});
// Deploy the pro contract handlers.
proHandler = new LockupProHandler({ asset_: DEFAULT_ASSET, pro_: pro, _storage_: lockupHandlerStorage });
proCreateHandler = new LockupProCreateHandler({
asset_: DEFAULT_ASSET,
Expand Down Expand Up @@ -66,8 +60,7 @@ contract Pro_Invariant_Test is Lockup_Invariant_Test {
excludeSender(address(proHandler));
excludeSender(address(proCreateHandler));

// Label the pro contract and its handler.
vm.label({ account: address(pro), newLabel: "LockupPro" });
// Label the pro handler.
vm.label({ account: address(lockupHandler), newLabel: "LockupProHandler" });
}

Expand Down

0 comments on commit 06fa329

Please sign in to comment.