Boost.sol

Overview

Boost.sol defines the Boost smart contract, which is an auxiliary contract designed to work closely with the PopitGame contract. It provides mechanisms for managing and updating an internal state variable (_mbiCur), interacting with the PopitGame contract, and enabling controlled upgrade and destruction of the contract itself. The contract includes strict access control through ownership verification and sender restrictions.

This contract imports several dependencies, including custom modifiers (Modifiers), a verifier library (VerifiersLib), the root contract (MobileVerifiersContractRoot), and the PopitGame contract, allowing it to integrate securely and efficiently with the broader system.

Contract: Boost

State Variables

Variable

Type

Description

version

string

Constant string representing the contract version ("1.0.0").

_wallet

address

Address of the wallet associated with this contract.

_popitGame

address

Static address of the linked PopitGame contract. This is set at deployment and immutable.

_root

address

Address of the root contract derived from the contract's code salt.

_mbiCur

uint64

Current value of the mobile boost index or similar metric managed by this contract.

_rootPubkey

uint256

Public key of the root owner, used for access control.

Constructor

constructor (address wallet, uint256 rootPubkey) senderIs(_popitGame) accept

Private Functions

ensureBalance()

function ensureBalance() private pure

Public Functions

deleteMbiCur()

function deleteMbiCur() public senderIs(_popitGame) accept

setMbiCur(uint64 mbiCur)

function setMbiCur(uint64 mbiCur) public onlyOwnerPubkey(_rootPubkey) accept

updateCode(TvmCell newcode, TvmCell cell)

function updateCode(TvmCell newcode, TvmCell cell) public view onlyOwnerPubkey(_rootPubkey) accept

onCodeUpgrade(TvmCell cell)

function onCodeUpgrade(TvmCell cell) private pure

destroyNode()

function destroyNode() public senderIs(address(this)) accept

getDetails()

function getDetails() external view returns(uint64 mbiCur, address wallet)

getVersion()

function getVersion() external pure returns(string, string)

Implementation Details and Algorithms

Interactions with Other Contracts

Visual Diagram

classDiagram
class Boost {
-string version
-address _wallet
-address static _popitGame
-address _root
-uint64 _mbiCur
-uint256 _rootPubkey
+constructor(wallet, rootPubkey)
-ensureBalance()
+deleteMbiCur()
+setMbiCur()
+updateCode()
-onCodeUpgrade()
+destroyNode()
+getDetails()
+getVersion()
}
Boost ..> Modifiers : inherits
Boost --> PopitGame : interacts with
Boost --> VerifiersLib : verifies version

This diagram illustrates the Boost contract's main state variables and methods, its inheritance from Modifiers, and its interaction dependencies with the PopitGame contract and VerifiersLib library.