Skip to main content

strategy.strategies.tutorial_uniswap_swap.states.teardown

partial

TYPE_CHECKING

Optional

get_address_by_chain_and_network

ActionType

ExecutionStatus

Action

ActionBundle

UnwrapParams

teardown

def teardown(strat: "StrategyTutorialUniswapSwap") -> ActionBundle

Concludes the strategy by closing any active positions and preparing the system for a reset or shutdown. Leaves the system in a state where it can be cleanly initialized again.

Returns:

ActionBundle | None: An action bundle with the teardown actions.

prepare_unwrap

def prepare_unwrap(
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_unwrap

def validate_unwrap(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_unwrap

def sadflow_unwrap(strat: "StrategyTutorialUniswapSwap") -> ActionBundle

Handles the sadflow for the initialization unwrap 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