Skip to content

Commit

Permalink
test: add more test for setCrossPrice.
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-ux committed Oct 14, 2024
1 parent 1b90651 commit 65b0163
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
23 changes: 18 additions & 5 deletions test/fork/LidoFixedPriceMultiLpARM/SetCrossPrice.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,27 @@ contract Fork_Concrete_LidoARM_SetCrossPrice_Test_ is Fork_Shared_Test_ {
//////////////////////////////////////////////////////
/// --- PASSING TESTS
//////////////////////////////////////////////////////
function test_SetCrossPrice_No_StETH_Owner() public {
deal(address(steth), address(lidoARM), MIN_TOTAL_SUPPLY - 1);

function test_SetCrossPrice() public {
assertEq(lidoARM.crossPrice(), 1e36);
// at 1.0
vm.expectEmit({emitter: address(lidoARM)});
emit AbstractARM.CrossPriceUpdated(1e36);
lidoARM.setCrossPrice(1e36);

// 20 basis points lower than 1.0
vm.expectEmit({emitter: address(lidoARM)});
emit AbstractARM.CrossPriceUpdated(1e36 - 1);
lidoARM.setCrossPrice(1e36 - 1);
emit AbstractARM.CrossPriceUpdated(0.998e36);
lidoARM.setCrossPrice(0.998e36);
}

function test_SetCrossPrice_With_StETH_PriceUp_Owner() public {
// 2 basis points lower than 1.0
lidoARM.setCrossPrice(0.9998e36);

deal(address(steth), address(lidoARM), MIN_TOTAL_SUPPLY + 1);

assertEq(lidoARM.crossPrice(), 1e36 - 1);
// 1 basis points lower than 1.0
lidoARM.setCrossPrice(0.9999e36);
}
}
26 changes: 0 additions & 26 deletions test/fork/LidoFixedPriceMultiLpARM/Setters.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,32 +150,6 @@ contract Fork_Concrete_lidoARM_Setters_Test_ is Fork_Shared_Test_ {
/// --- Set Cross Price - PASSING TESTS
//////////////////////////////////////////////////////

function test_SetCrossPrice_No_StETH_Owner() public {
deal(address(steth), address(lidoARM), MIN_TOTAL_SUPPLY - 1);

// at 1.0
vm.expectEmit({emitter: address(lidoARM)});
emit AbstractARM.CrossPriceUpdated(1e36);
lidoARM.setCrossPrice(1e36);

// 20 basis points lower than 1.0
vm.expectEmit({emitter: address(lidoARM)});
emit AbstractARM.CrossPriceUpdated(0.998e36);
lidoARM.setCrossPrice(0.998e36);
}

function test_SetCrossPrice_With_StETH_PriceUp_Owner() public {
// 2 basis points lower than 1.0
lidoARM.setCrossPrice(0.9998e36);

deal(address(steth), address(lidoARM), MIN_TOTAL_SUPPLY + 1);

// 4 basis points lower than 1.0
// vm.expectEmit({emitter: address(lidoARM)});
// emit AbstractARM.CrossPriceUpdated(0.9996e36);
lidoARM.setCrossPrice(0.9999e36);
}

//////////////////////////////////////////////////////
/// --- OWNABLE - REVERTING TESTS
//////////////////////////////////////////////////////
Expand Down

0 comments on commit 65b0163

Please sign in to comment.