Skip to content

Commit

Permalink
test strategy token burning
Browse files Browse the repository at this point in the history
  • Loading branch information
alcueca committed Nov 6, 2023
1 parent d247a53 commit a880335
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions test/Unwind.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ contract UnwindTest is StdCheats {
}
}



/// @dev Test that the total supply of all pools can be burned, or give a reason of why not
function test_removePoolLiquidity() external {
for (uint i = 0; i < unwind.knownContractsLength(); i++) {
Expand All @@ -66,6 +64,37 @@ contract UnwindTest is StdCheats {
}
}
}

/// @dev Test that the total supply of all v2 strategies can be burned, or give a reason of why not
function test_removeStrategyV2Liquidity() external {
for (uint i = 0; i < unwind.knownContractsLength(); i++) {
address target = unwind.knownContracts(i);
if (unwind.contractTypes(target) == Unwind.Type.STRATEGYV2) {
uint256 totalSupply = ERC20(target).totalSupply();

deal(target, address(this), totalSupply);
ERC20(target).approve(address(unwind), type(uint256).max);
unwind.removeLiquidity(target);
console2.log("%s: Burned %s", ERC20(target).name(), totalSupply);
}
}
}


/// @dev Test that the total supply of all v1 strategies can be burned, or give a reason of why not
function test_removeStrategyV1Liquidity() external {
for (uint i = 0; i < unwind.knownContractsLength(); i++) {
address target = unwind.knownContracts(i);
if (unwind.contractTypes(target) == Unwind.Type.STRATEGYV1) {
uint256 totalSupply = ERC20(target).totalSupply();

deal(target, address(this), totalSupply);
ERC20(target).approve(address(unwind), type(uint256).max);
unwind.removeLiquidity(target);
console2.log("%s: Burned %s", ERC20(target).name(), totalSupply);
}
}
}
//
// /// @dev Fuzz test that provides random values for an unsigned integer, but which rejects zero as an input.
// /// If you need more sophisticated input validation, you should use the `bound` utility instead.
Expand Down

0 comments on commit a880335

Please sign in to comment.