bittensor.core.chain_data.sim_swap#

Classes#

SimSwapResult

Represents the result of a simulated swap operation.

Module Contents#

class bittensor.core.chain_data.sim_swap.SimSwapResult#

Represents the result of a simulated swap operation.

This class is used to encapsulate the amounts and fees for the simulated swap process, including both tao and alpha token values. It provides a convenient way to manage and interpret the swap results.

Variables:
  • tao_amount – The amount of tao tokens obtained as the result of the swap.

  • alpha_amount – The amount of alpha tokens obtained as the result of the swap.

  • tao_fee – The fee associated with the tao token portion of the swap.

  • alpha_fee – The fee associated with the alpha token portion of the swap.

alpha_amount: bittensor.utils.balance.Balance#
alpha_fee: bittensor.utils.balance.Balance#
classmethod from_dict(data, netuid)#

Converts a dictionary to a SimSwapResult instance.

This method acts as a factory to create a SimSwapResult object using the data from a dictionary. It parses the specified dictionary, converts values into Balance objects, and sets associated units based on parameters and context.

Parameters:
  • data (dict) – A dictionary containing the swap result data. It must include the keys “tao_amount”, “alpha_amount”, “tao_fee”, and “alpha_fee” with their respective values.

  • netuid (int) – A network-specific unit identifier used to set the unit for alpha-related amounts.

Returns:

An instance of SimSwapResult initialized with the parsed and converted data.

Return type:

SimSwapResult

tao_amount: bittensor.utils.balance.Balance#
tao_fee: bittensor.utils.balance.Balance#