Skip to content

Commit

Permalink
LPStrategyBase 1.0.4: _swapForDepositProportion support all amm adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
a17 committed Jan 2, 2025
1 parent 6620c80 commit 01e9340
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/strategies/base/LPStrategyBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import "../libs/LPStrategyLib.sol";
import "../../interfaces/ILPStrategy.sol";

/// @dev Base liquidity providing strategy
/// Changelog:
/// 1.0.4: _swapForDepositProportion support all amm adapters
/// @author Alien Deployer (https://github.com/a17)
/// @author JodsMigel (https://github.com/JodsMigel)
abstract contract LPStrategyBase is StrategyBase, ILPStrategy {
Expand All @@ -14,7 +16,7 @@ abstract contract LPStrategyBase is StrategyBase, ILPStrategy {
/*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

/// @dev Version of LPStrategyBase implementation
string public constant VERSION_LP_STRATEGY_BASE = "1.0.3";
string public constant VERSION_LP_STRATEGY_BASE = "1.0.4";

// keccak256(abi.encode(uint256(keccak256("erc7201:stability.LPStrategyBase")) - 1)) & ~bytes32(uint256(0xff));
bytes32 private constant LPSTRATEGYBASE_STORAGE_LOCATION =
Expand Down
4 changes: 2 additions & 2 deletions src/strategies/libs/LPStrategyLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ library LPStrategyLib {
amountsToDeposit = new uint[](2);
SwapForDepositProportionVars memory vars;
vars.swapper = ISwapper(IPlatform(platform).swapper());
vars.price = ammAdapter.getPrice(_pool, assets[1], address(0), 0);
vars.asset1decimals = IERC20Metadata(assets[1]).decimals();
vars.price = ammAdapter.getPrice(_pool, assets[1], assets[0], 10 ** vars.asset1decimals);
vars.balance0 = _balance(assets[0]);
vars.balance1 = _balance(assets[1]);
vars.asset1decimals = IERC20Metadata(assets[1]).decimals();
vars.threshold0 = vars.swapper.threshold(assets[0]);
vars.threshold1 = vars.swapper.threshold(assets[1]);
if (vars.balance0 > vars.threshold0 || vars.balance1 > vars.threshold1) {
Expand Down

0 comments on commit 01e9340

Please sign in to comment.