Strategy

StrategyModule defines essential functions for validating strategy parameters and determining the need for and direction of rebalancing within AMM pools. It interacts closely with the ICore contract, AMM modules, and oracles to optimize liquidity positions based on predefined strategies.

validateStrategyParams(bytes memory params)

Validates encoded strategy parameters to ensure they meet requirements of the implementation of the StrategyModule for a valid rebalancing strategy.

  • Input Parameters:

    • params: A byte array containing the encoded strategy parameters to be validated.

  • Logic:

    • The function assesses the params to ensure they conform to expected formats and values.

getTargets(ICore.ManagedPositionInfo memory info, IAmmModule ammModule, IOracle oracle)

Determines whether rebalancing is necessary for a given liquidity position and calculates the target parameters for such a rebalance.

  • Input Parameters:

    • info: Struct containing the current position information.

    • ammModule: Reference to the AMM module, facilitating interactions with specific AMM protocol implementations.

    • oracle: Reference to the oracle used for fetching current market data or price information.

  • Returns:

    • isRebalanceRequired: A boolean value indicating whether the position requires rebalancing based on current market conditions and the strategy's parameters.

    • target: A struct detailing the target position's parameters post-rebalance, including the desired ticks and liquidity distribution.

  • Logic:

    • Utilizes info, ammModule, and oracle to evaluate the current state of the market and the position's alignment with the strategy's goals.

    • Calculates whether rebalancing is necessary and, if so, determines the optimal parameters for the rebalanced position to align with strategic objectives and market conditions.

Last updated