Skip to content

Commit 3fa95bd

Browse files
author
omriss
committed
Move liquidateRewards from ALMFLib to ALMFLib2 to reduce size of ALMFLib
1 parent 70f39a5 commit 3fa95bd

3 files changed

Lines changed: 14 additions & 13 deletions

File tree

src/strategies/AaveLeverageMerklFarmStrategy.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ contract AaveLeverageMerklFarmStrategy is
439439
address[] memory rewardAssets_,
440440
uint[] memory rewardAmounts_
441441
) internal override(FarmingStrategyBase, StrategyBase, LeverageLendingBase) returns (uint earnedExchangeAsset) {
442-
return ALMFLib.liquidateRewards(
442+
return ALMFLib2.liquidateRewards(
443443
platform(), exchangeAsset, rewardAssets_, rewardAmounts_, customPriceImpactTolerance()
444444
);
445445
}

src/strategies/libs/ALMFLib.sol

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -925,18 +925,6 @@ library ALMFLib {
925925
}
926926
}
927927

928-
function liquidateRewards(
929-
address platform_,
930-
address exchangeAsset,
931-
address[] memory rewardAssets_,
932-
uint[] memory rewardAmounts_,
933-
uint priceImpactTolerance
934-
) external returns (uint earnedExchangeAsset) {
935-
earnedExchangeAsset = StrategyLib.liquidateRewards(
936-
platform_, exchangeAsset, rewardAssets_, rewardAmounts_, priceImpactTolerance
937-
);
938-
}
939-
940928
function compound(
941929
address platform_,
942930
ILeverageLendingStrategy.LeverageLendingBaseStorage storage $,

src/strategies/libs/ALMFLib2.sol

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
1313
import {SharedLib} from "./SharedLib.sol";
1414
import {StrategyIdLib} from "./StrategyIdLib.sol";
1515
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
16+
import {StrategyLib} from "./StrategyLib.sol";
1617

1718
/// @notice Several standalone functions were moved here to reduce size of ALMFLib
1819
library ALMFLib2 {
@@ -143,4 +144,16 @@ library ALMFLib2 {
143144
}
144145

145146
//endregion ------------------------------------- Init vars, desc
147+
148+
function liquidateRewards(
149+
address platform_,
150+
address exchangeAsset,
151+
address[] memory rewardAssets_,
152+
uint[] memory rewardAmounts_,
153+
uint priceImpactTolerance
154+
) external returns (uint earnedExchangeAsset) {
155+
earnedExchangeAsset = StrategyLib.liquidateRewards(
156+
platform_, exchangeAsset, rewardAssets_, rewardAmounts_, priceImpactTolerance
157+
);
158+
}
146159
}

0 commit comments

Comments
 (0)