MobileVerifiersContractRoot.sol

Overview

The MobileVerifiersContractRoot contract serves as the root and central management point for a set of verifier-related smart contracts within the system. It manages key code artifacts, epoch timing, reward calculations, and interactions with subordinate contracts such as PopCoinRoot, PopitGame, MvMultifactor, and Indexer. The contract maintains and adjusts the reward distribution mechanism over time, handles code upgrades, and facilitates the coordination and address calculation for its child contracts. It also emits events related to the lifecycle of PopCoinRoot contracts.

The contract implements reward tap functionality with time-based reward accrual and enforces access control through custom modifiers, ensuring only authorized senders can invoke sensitive methods.

Contract Structure and State Variables

Events

Constructor

constructor(uint128 reward_adjustment)

Methods

popCoinRootDestroyed

function popCoinRootDestroyed(string name) public senderIs(address) accept

setNewCode

function setNewCode(uint8 id, TvmCell code) public senderIs(address(this)) accept

destroyNode

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

tapReward

function tapReward() private returns(uint128)

sendTapRewards

function sendTapRewards(string name) public senderIs(address) accept

sendTapRewardsPopit

function sendTapRewardsPopit(string name, uint256 key, optional(string) media) public senderIs(address) accept

calcRewardAdjustment

function calcRewardAdjustment() private returns (uint128)

ensureBalance

function ensureBalance() private

Fallback / Receive

receive() external

Getter Methods

Important Implementation Details and Algorithms

Interactions with Other Contracts and Libraries

Visual Diagram

classDiagram
class MobileVerifiersContractRoot {
-string version
-mapping(uint8 => TvmCell) _code
-uint32 _networkStart
-uint32 _epochStart
-uint32 _epochEnd
-uint128 _prevEpochDuration
-uint128 _reward_sum
-uint128 _reward_adjustment
-uint128 _reward_adjustment_prev_epoch
-uint32 _reward_last_time
-uint32 _min_reward_period
-uint32 _reward_period
-uint128 _sum_coef
-uint32 _calc_reward_num
-uint32 _last_tap
-uint64[] MBNLstPrev
-uint64[] MBNLstCur
-uint64[] GLstPrev
-uint64[] GLstCur
-uint64[] BCLst
+constructor(uint128)
+popCoinRootDestroyed(string)
+setNewCode(uint8, TvmCell)
+destroyNode()
-tapReward() uint128
+sendTapRewards(string)
+sendTapRewardsPopit(string, uint256, optional(string))
-calcRewardAdjustment() uint128
-ensureBalance()
+getPopitGameAddress(address) address
+getMvMultifactorAddress(uint256) address
+getPopCoinRootAddress(string) address
+getIndexerAddress(string) address
+getIndexerCode() TvmCell
+getCodes() mapping(uint8 => TvmCell)
+getEpoch() (uint32, uint32)
+getVersion() (string, string)
+getReward(uint128, uint64[], uint64[], uint64, uint128) uint128
}
MobileVerifiersContractRoot --> Modifiers : inherits
MobileVerifiersContractRoot --> VerifiersLib : uses for address calculations
MobileVerifiersContractRoot --> PopCoinRoot : interacts for rewards
MobileVerifiersContractRoot --> PopitGame : address calculation
MobileVerifiersContractRoot --> Mvmultifactor : address calculation
MobileVerifiersContractRoot --> Indexer : address and code management
MobileVerifiersContractRoot --> gosh : external reward and mint calculations

This diagram summarizes the main properties and methods of the MobileVerifiersContractRoot contract, its inheritance, and its relationships with external contracts and libraries.