root_contracts.rs
Overview
This file defines constants representing the root addresses and ABI (Application Binary Interface) JSON strings for two key smart contracts within the system: the BlockKeeperContractRoot and the BlockManagerContractRoot. These constants are used to facilitate interaction with these contracts by providing their unique blockchain addresses and their interface descriptions.
Constants
BK_CONTRACT_ROOT_ADDR
Type:
&strDescription: A string literal representing the root address of the BlockKeeperContractRoot contract.
Value:
"7777777777777777777777777777777777777777777777777777777777777777"Usage: This constant is used to identify the root contract address for BlockKeeper in blockchain transactions or contract calls.
BK_CONTRACT_ROOT_ABI
Type:
&strDescription: A static string containing the ABI JSON of the BlockKeeperContractRoot contract.
Value: Loaded from the file path "../../../contracts/bksystem/BlockKeeperContractRoot.abi.json"
Usage: This ABI describes the BlockKeeperContractRoot contract's interface, enabling clients to encode function calls and decode responses. It is essential for contract interaction in client code or other contract management utilities.
BM_CONTRACT_ROOT_ADDR
Type:
&strDescription: A string literal representing the root address of the BlockManagerContractRoot contract.
Value:
"6666666666666666666666666666666666666666666666666666666666666666"Usage: Used to identify the root contract address for BlockManager in blockchain calls.
BM_CONTRACT_ROOT_ABI
Type:
&strDescription: A static string containing the ABI JSON of the BlockManagerContractRoot contract.
Value: Loaded from the file path "../../../contracts/bksystem/BlockManagerContractRoot.abi.json"
Usage: ABI for BlockManagerContractRoot, required for clients to interact properly with this contract's methods and events.
Implementation Details
The root addresses are hardcoded hexadecimal strings that uniquely identify the root contracts on the blockchain.
The ABI strings are included at compile time using
include_str!macro, embedding the contents of the corresponding JSON ABI files directly into the binary. This ensures ABI availability without runtime file IO.The file does not define any functions or classes; it solely provides constants which act as configuration entries for contract interaction layers elsewhere in the system.
Interaction with Other System Components
These constants are typically imported and used by modules responsible for blockchain contract interactions, such as contract clients, transaction builders, or event listeners.
The root addresses allow the system to locate and communicate with the root contracts on the blockchain.
The ABI strings are parsed to provide structured access to contract methods, events, and types as defined in the respective ABI JSON files.
This file acts as a centralized reference point for contract roots, ensuring consistency across different components managing or interfacing with these smart contracts.
Visual Diagram
flowchart TD
BK_ADDR["BK_CONTRACT_ROOT_ADDR"]
BK_ABI["BK_CONTRACT_ROOT_ABI"]
BM_ADDR["BM_CONTRACT_ROOT_ADDR"]
BM_ABI["BM_CONTRACT_ROOT_ABI"]
BK_ADDR ---|used by| ContractClients
BK_ABI ---|used by| ContractClients
BM_ADDR ---|used by| ContractClients
BM_ABI ---|used by| ContractClients
This flowchart depicts the four constants as key contract identifiers and interfaces, all of which are consumed by contract client modules that handle blockchain interaction workflows.