Boost.abi.json
Overview
The Boost.abi.json file defines the Application Binary Interface (ABI) for a smart contract named "Boost" with version 2.4. This ABI outlines the structure of the contract, specifying its public methods (functions), fields (state variables), and constructor inputs. The contract appears to manage wallet-related state, a current value labeled mbiCur, and supports code updates and node destruction. It also includes mechanisms for retrieving contract details and version information.
This file is essential for interacting with the Boost smart contract programmatically, enabling external entities to call its functions with the correct parameters and interpret the resulting outputs.
ABI Structure and Components
ABI Version and Metadata
"ABI version": 2
Indicates the ABI format version used for compatibility."version": "2.4"
Specifies the contract version, useful for tracking updates."header": ["pubkey", "time", "expire"]
Lists the standard header fields included with each function call, typically for authorization and timing.
Fields (State Variables)
The contract maintains the following fields, which represent its internal state:
Field Name | Type | Initialized at Deployment | Description/Role |
|---|---|---|---|
uint256 | Yes | Public key identifier of the contract. | |
uint64 | No | Timestamp, possibly for last update time. | |
bool | No | Flag indicating constructor state. | |
address | No | Wallet address associated with contract. | |
address | Yes | Address of the PopitGame contract or entity. | |
address | No | Root address, possibly for ownership or hierarchy. | |
| uint64 | No | Current MBI value managed by the contract. |
| uint256 | No | Public key corresponding to the root. |
The fields initialized at deployment (_pubkey and _popitGame) are set once, while others can be updated during contract execution.
Functions
The contract exposes several functions. Each function specifies its inputs and outputs, enabling controlled interaction with the contract state.
1. constructor
Purpose: Initializes the contract with a wallet address and a root public key.
Inputs:
wallet (address): The wallet address linked to the contract.
rootPubkey(uint256): The root public key for cryptographic validation or hierarchy.
Outputs: None
Usage Example:
When deploying the contract, pass the wallet and root public key to establish initial ownership and validation parameters.
2. deleteMbiCur
Purpose: Deletes or resets the current MBI value (
_mbiCur).Inputs: None
Outputs: None
Usage Example:
Calling this function clears the current MBI value, possibly as part of a reset or cleanup operation.
3. setMbiCur
Purpose: Sets or updates the current MBI value.
Inputs:
mbiCur (uint64): New value to assign to
_mbiCur.
Outputs: None
Usage Example:
Update the MBI value to reflect new state or metrics relevant to the contract logic.
4. updateCode
Purpose: Updates the contract code dynamically.
Inputs:
newcode(cell): New code to replace the current contract code.cell (cell): Additional cell data that may be required for code update logic.
Outputs: None
Implementation Details:
This function allows the contract to self-update, a common pattern in upgradable smart contracts. The use of cell types suggests handling of serialized data or code blobs.Usage Example:
Triggering a contract upgrade by providing new executable code and associated data.
5. destroyNode
Purpose: Self-destructs or removes the contract instance.
Inputs: None
Outputs: None
Usage Example:
When the contract needs to be terminated, likely cleaning resources or ceasing operations.
6. getDetails
Purpose: Retrieves current contract details.
Inputs: None
Outputs:
Usage Example:
External callers can query this function to obtain the current MBI and wallet information.
7. getVersion
Purpose: Returns version-related information.
Inputs: None
Outputs:
value0(string): Version string 1.value1(string): Version string 2.
Usage Example:
Determines the contract version or related metadata, possibly for compatibility checks.
Important Implementation Details
The contract uses a combination of address,
uint64, uint256,bool, and cell types to handle blockchain addresses, numeric data, flags, and serialized data/code.The presence of a dynamic
updateCodefunction indicates support for contract upgrades without redeployment, which is a sophisticated feature for maintaining contract lifecycle.Fields such as _constructorFlag could be used internally to track initialization status, preventing re-execution of constructor logic.
The
destroyNodefunction enables contract cleanup or deactivation, which is useful for managing contract lifecycle and resource management.
Interactions with Other System Components
The _wallet field and related functions suggest integration with wallet management systems or user accounts.
The _popitGame field, initialized at deployment, implies linkage with another contract or module named "PopitGame," suggesting interaction or dependency.
The ability to update code and destroy the node indicates that this contract may be part of a dynamic, modular system where contracts can be upgraded or removed as needed.
External callers or other contracts can invoke
getDetailsandgetVersionfor state inspection and compatibility verification.
Visual Diagram: Function Interaction Flow
flowchart TD
constructor --> setMbiCur
constructor --> updateCode
constructor --> destroyNode
setMbiCur --> deleteMbiCur
deleteMbiCur --> getDetails
getDetails --> getVersion
updateCode --> destroyNode
constructor initializes the contract.
setMbiCur updates state which can be reset by deleteMbiCur.
getDetails provides state info used by getVersion for metadata retrieval.
updateCode and destroyNode manage contract lifecycle and code upgrades.
This flow represents main function dependencies and lifecycle management within the contract.
Summary
The Boost.abi.json defines an upgradable, wallet-associated smart contract with state management for a value (mbiCur), supports dynamic code updates, and includes lifecycle control via destroy functionality. It is designed for modular interaction with wallet systems and a referenced external entity (PopitGame), facilitating maintainability and extensibility within its blockchain environment. For further details on ABI usage and smart contract design patterns, see Smart Contract Basics and Contract Upgrade Patterns.