wallet_config.rs

Overview

The wallet_config.rs file provides utilities for constructing internal messages related to wallet operations within the Block Keeper system, specifically focusing on the creation of "slash" messages. These messages are used to trigger slashing actions on wallets, typically for penalizing misbehavior or enforcing rules in a blockchain environment. The file leverages types and abstractions from the tvm_block and tvm_types crates to build and serialize messages that can be sent internally within the system.

Function Details

create_wallet_slash_message

pub fn create_wallet_slash_message(data: &BlockKeeperSlashData) -> anyhow::Result<Message>

Interactions with Other Modules

This function serves as a bridge between high-level slash data and the low-level internal message format required by the Block Keeper wallet system to initiate slashing procedures.

Diagram: Function Workflow

flowchart TD
A[Input: BlockKeeperSlashData] --> B[Format Parameters JSON]
B --> C[Encode Function Call with BLOCK_KEEPER_WALLET_ABI]
C --> D[Create Source & Destination MsgAddressInt]
D --> E[Create InternalMessageHeader with Addresses & Currency]
E --> F[Serialize Encoded Body into SliceData]
F --> G[Construct Message with Header and Body]
G --> H[Return Message or Error]

This flowchart illustrates the step-by-step transformation of slash data into a fully-fledged internal message suitable for dispatch within the wallet subsystem.