5.1 Understanding Transaction Structure

In Spicenet, transactions are structured as part of the CallMessage enum. This structure defines the various types of operations that can be performed within the Spicenet ecosystem. Let's break down the CallMessage enum for the Bank module:

use sov_bank::CallMessage::Transfer;
use sov_bank::Coins;
use sov_bank::TokenId;
use sov_bank::Amount;

pub enum CallMessage<S: sov_modules_api::Spec> {
    CreateToken {
        salt: u64,
        token_name: String,
        initial_balance: Amount,
        mint_to_address: S::Address,
        authorized_minters: Vec<S::Address>,
    },
    Transfer {
        to: S::Address,
        coins: Coins,
    },
    Burn {
        coins: Coins,
    },
    Mint {
        coins: Coins,
        mint_to_address: S::Address,
    },
    Freeze {
        token_id: TokenId,
    },
}

Each variant of this enum represents a different type of transaction:

  • CreateToken: Used to create a new token on the network.

  • Transfer: Moves tokens from one address to another.

  • Burn: Destroys a specified amount of tokens.

  • Mint: Creates new tokens and assigns them to an address.

  • Freeze: Prevents further minting or burning of a specific token.

Last updated