Skip to content

Commit

Permalink
remove fuzz test from concrete test file
Browse files Browse the repository at this point in the history
  • Loading branch information
jpick713 authored Jul 26, 2024
1 parent ba69990 commit c1ad176
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions test/fork/concrete/handlers-base/AerodromeFlashswapHandler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,6 @@ interface IPoolFactory {
abstract contract AerodromeFlashswapHandler_Test is LrtHandler_ForkBase {
uint160 sqrtPriceLimitX96;

function testFuzz_amountOutGivenAmountIn(uint256 amountInToHandler, bool isLeverage) external{
uint256 poolK = IPool(BASE_RSETH_WETH_AERODROME).getK();
uint256 wethBalance = BASE_WETH.balanceOf(address(BASE_RSETH_WETH_AERODROME));
uint256 lrtBalance = BASE_RSETH.balanceOf(address(BASE_RSETH_WETH_AERODROME));
address factory = IPool(BASE_RSETH_WETH_AERODROME).factory();
uint256 fee = IPoolFactory(factory).getFee(address(BASE_RSETH_WETH_AERODROME), false);
uint256 maxValue = isLeverage ? lrtBalance : wethBalance;
// skip 0 case since that would have returned already with no leverage or deleverage
// also bound so that amount does not completely wipe out
amountInToHandler = StdUtils.bound(amountInToHandler, 1, maxValue - 1);

if(isLeverage){
lrtBalance -= amountInToHandler;
} else{
wethBalance -= amountInToHandler;
}
uint256 amountOutFromUser = _getTypedUFHandler().getAmountOutGivenAmountIn(amountInToHandler, isLeverage);
uint256 lowerAmountOutFromUser = amountOutFromUser - 1;
uint256 wethLowerBound;
uint256 lrtLowerBound;
if(isLeverage){
lrtLowerBound = lrtBalance;
wethLowerBound = wethBalance + lowerAmountOutFromUser - (fee * lowerAmountOutFromUser)/10000;
wethBalance += amountOutFromUser - (fee * amountOutFromUser)/10000;

} else{
wethLowerBound = wethBalance;
lrtLowerBound = lrtBalance + lowerAmountOutFromUser - (fee * lowerAmountOutFromUser)/10000;
lrtBalance += amountOutFromUser - (fee * amountOutFromUser)/10000;
}

uint256 newPoolK = wethBalance * lrtBalance;
uint256 lowerBoundPoolK = wethLowerBound * lrtLowerBound;
assertGe(newPoolK, poolK);
assertGt(poolK, lowerBoundPoolK);
}

function testFork_FlashswapLeverage() external {
uint256 initialDeposit = 1e18;
uint256 resultingAdditionalCollateral = 5e18;
Expand Down

0 comments on commit c1ad176

Please sign in to comment.