strategy.strategies.tutorial_uniswap_swap.states.initialization
partial
TYPE_CHECKING
Optional
ETH_ADDRESS
ActionType
ExecutionStatus
Action
ActionBundle
WrapParams
initialization
def initialization(strat: "StrategyTutorialUniswapSwap") -> ActionBundle
Initializes the strategy by preparing assets and opening positions.
The initialization process may involve swapping assets, wrapping ETH, and opening liquidity positions. It operates in several substates to manage the sequence of actions.
Returns:
ActionBundle
- An action bundle representing the actions required to initialize the strategy, or None if no actions are required.
Notes:
- This method should only be called at the start of the strategy lifecycle.
- The process is divided into substates to handle complex initialization steps.
prepare_wrap
def prepare_wrap(
strat: "StrategyTutorialUniswapSwap") -> Optional[ActionBundle]
Prepares the swap actions.
Returns:
ActionBundle or None: An ActionBundle containing the approve and swap actions if a swap is needed.
validate_wrap
def validate_wrap(strat: "StrategyTutorialUniswapSwap") -> bool
Validates the wrap action and retrieves the executed amount using the execution details.
Returns:
bool
- True if the wrap action was successful and the amount was retrieved correctly. and we can move to the next state.
sadflow_wrap
def sadflow_wrap(strat: "StrategyTutorialUniswapSwap") -> ActionBundle
Handles the sadflow for the initialization wrap state. Calls the appropriate function based on the status of the actions.
sadflow_retry
def sadflow_retry(strat: "StrategyTutorialUniswapSwap") -> ActionBundle
Handles the basic retry sadflow.
sadflow_partial_retry
def sadflow_partial_retry(
strat: "StrategyTutorialUniswapSwap") -> ActionBundle