Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
ypatil12 committed Dec 19, 2024
1 parent 4433cb1 commit 6a880aa
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions src/test/unit/StrategyManagerUnit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1518,32 +1518,26 @@ contract StrategyManagerUnitTests_burnShares is StrategyManagerUnitTests {
);
}

// /// @notice check that balances are unchanged with a reverting token but burnShares doesn't revert
// function testFuzz_tryCatchWithRevertToken(
// address staker,
// uint256 depositAmount,
// uint256 sharesToBurn
// ) external filterFuzzedAddressInputs(staker) {
// cheats.assume(staker != address(0));
// cheats.assume(sharesToBurn > 0 && sharesToBurn < dummyToken.totalSupply() && depositAmount >= sharesToBurn);
// IStrategy strategy = dummyStrat;
// IERC20 token = dummyToken;
// _depositIntoStrategySuccessfully(strategy, staker, depositAmount);

// // Now set token to be contract that reverts simulating an upgrade
// cheats.etch(address(token), address(revertToken).code);
// ERC20_SetTransferReverting_Mock(address(token)).setTransfersRevert(true);

// uint256 strategyBalanceBefore = token.balanceOf(address(strategy));
// uint256 burnAddressBalanceBefore = token.balanceOf(strategyManager.DEFAULT_BURN_ADDRESS());
// cheats.prank(address(delegationManagerMock));
// strategyManager.burnShares(strategy, sharesToBurn);
// uint256 strategyBalanceAfter = token.balanceOf(address(strategy));
// uint256 burnAddressBalanceAfter = token.balanceOf(strategyManager.DEFAULT_BURN_ADDRESS());

// assertEq(burnAddressBalanceBefore, burnAddressBalanceAfter, "burnAddressBalanceBefore != burnAddressBalanceAfter");
// assertEq(strategyBalanceBefore, strategyBalanceAfter, "strategyBalanceBefore != strategyBalanceAfter");
// }
/// @notice check that balances are unchanged with a reverting token but burnShares doesn't revert
function testFuzz_revertTryCatchWithRevertToken(
address staker,
uint256 depositAmount,
uint256 sharesToBurn
) external filterFuzzedAddressInputs(staker) {
cheats.assume(staker != address(0));
cheats.assume(sharesToBurn > 0 && sharesToBurn < dummyToken.totalSupply() && depositAmount >= sharesToBurn);
IStrategy strategy = dummyStrat;
IERC20 token = dummyToken;
_depositIntoStrategySuccessfully(strategy, staker, depositAmount);

// Now set token to be contract that reverts simulating an upgrade
cheats.etch(address(token), address(revertToken).code);
ERC20_SetTransferReverting_Mock(address(token)).setTransfersRevert(true);

cheats.expectRevert("SafeERC20: low-level call failed");
cheats.prank(address(delegationManagerMock));
strategyManager.burnShares(strategy, sharesToBurn);
}
}

contract StrategyManagerUnitTests_setStrategyWhitelister is StrategyManagerUnitTests {
Expand Down

0 comments on commit 6a880aa

Please sign in to comment.