Skip to content

Commit

Permalink
mitigate shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
a17 committed Oct 6, 2024
1 parent 2117990 commit ec6c2b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/strategies/GammaQuickSwapMerklFarmStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,14 @@ contract GammaQuickSwapMerklFarmStrategy is LPStrategyBase, MerklStrategyBase, F
uint[] memory amountsMax,
GammaQuickSwapFarmStrategyStorage storage $,
address underlying_,
address[] memory assets,
address[] memory assets_,
uint amount1Start,
uint amount1End,
uint[] memory amountsConsumed
) internal view {
amountsConsumed[1] = amountsMax[1];
amountsConsumed[0] = amountsMax[0];
(, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets[1], amountsMax[1]);
(, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets_[1], amountsMax[1]);
// Inline the assignment and condition with a ternary operator
amountsConsumed[1] = (amountsMax[1] > amount1End) ? amount1End : amountsMax[1];

Expand All @@ -337,7 +337,7 @@ contract GammaQuickSwapMerklFarmStrategy is LPStrategyBase, MerklStrategyBase, F
uint[] memory amountsMax,
GammaQuickSwapFarmStrategyStorage storage $,
address underlying_,
address[] memory assets,
address[] memory assets_,
uint amount1Start,
uint amount1End,
uint[] memory amountsConsumed
Expand All @@ -347,7 +347,7 @@ contract GammaQuickSwapMerklFarmStrategy is LPStrategyBase, MerklStrategyBase, F
// its possible to be (amount1End + amount1Start) / 2, but current amount1End value pass tests with small amounts
amountsConsumed[1] = amount1End;
} else if (amountsMax[1] <= amount1Start) {
(uint amount0Start, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets[1], amountsMax[1]);
(uint amount0Start, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets_[1], amountsMax[1]);
amountsConsumed[0] = (amount0End + amount0Start) / 2;
amountsConsumed[1] = amountsMax[1];
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/strategies/GammaUniswapV3MerklFarmStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -327,14 +327,14 @@ contract GammaUniswapV3MerklFarmStrategy is LPStrategyBase, MerklStrategyBase, F
uint[] memory amountsMax,
GammaUniswapV3FarmStrategyStorage storage $,
address underlying_,
address[] memory assets,
address[] memory assets_,
uint amount1Start,
uint amount1End,
uint[] memory amountsConsumed
) internal view {
amountsConsumed[1] = amountsMax[1];
amountsConsumed[0] = amountsMax[0];
(, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets[1], amountsMax[1]);
(, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets_[1], amountsMax[1]);

// Inline the assignment and condition with a ternary operator
amountsConsumed[1] = (amountsMax[1] > amount1End) ? amount1End : amountsMax[1];
Expand All @@ -353,7 +353,7 @@ contract GammaUniswapV3MerklFarmStrategy is LPStrategyBase, MerklStrategyBase, F
uint[] memory amountsMax,
GammaUniswapV3FarmStrategyStorage storage $,
address underlying_,
address[] memory assets,
address[] memory assets_,
uint amount1Start,
uint amount1End,
uint[] memory amountsConsumed
Expand All @@ -362,7 +362,7 @@ contract GammaUniswapV3MerklFarmStrategy is LPStrategyBase, MerklStrategyBase, F
amountsConsumed[0] = amountsMax[0];
amountsConsumed[1] = amount1End;
} else if (amountsMax[1] <= amount1Start) {
(uint amount0Start, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets[1], amountsMax[1]);
(uint amount0Start, uint amount0End) = $.uniProxy.getDepositAmount(underlying_, assets_[1], amountsMax[1]);
amountsConsumed[0] = (amount0End + amount0Start) / 2;
amountsConsumed[1] = amountsMax[1];
} else {
Expand Down

0 comments on commit ec6c2b6

Please sign in to comment.