AckiNackiBlockManagerNodeWallet.sol

Overview

AckiNackiBlockManagerNodeWallet.sol implements a smart contract that serves as a wallet and manager node interface for block management within the Acki Nacki ecosystem. This contract manages licenses, rewards, slashing procedures, and interactions with root contracts and license management components. It handles staking, reward distribution, slashing penalties, and license lifecycle events. The contract ensures secure operations by enforcing ownership controls and validating message senders based on cryptographic keys and whitelist licenses.

The contract relies on external libraries and contracts such as BlockKeeperLib, LicenseBMContract, and BlockManagerContractRoot for calculations and coordination. It uses persistent state variables to track license details, wallet rewards and penalties, timing for reward epochs, and control flags for slashing and reward mechanisms.


Contract: AckiNackiBlockManagerNodeWallet

State Variables


Constructor

constructor (
    TvmCell LicenseBMCode,
    mapping(uint256=>bool) whiteListLicense,
    address licenseBMRoot,
    uint32 start_time,
    uint64 waitStep,
    uint256 signing_pubkey,
    uint8 walletTouch
)

Public Methods

removeLicense

function removeLicense(uint256 license_number) public senderIs(...) accept

setSigningPubkey

function setSigningPubkey(uint256 pubkey) public onlyOwnerPubkey(_owner_pubkey) accept

setLicenseWhiteList

function setLicenseWhiteList(mapping(uint256 => bool) whiteListLicense) public onlyOwnerPubkey(_owner_pubkey) accept

addLicense

function addLicense(uint256 license_number, uint128 reward, uint128 slashSum) public senderIs(...) accept

slash

function slash() public senderIs(address(this))

noRewards

function noRewards() public senderIs(_root) accept

finalSlash

function finalSlash() private

withdrawToken

function withdrawToken(address to, varuint32 value) public view senderIs(...) accept

startBM

function startBM() public onlyOwnerPubkey(_owner_pubkey) accept

getReward

function getReward() public onlyOwnerPubkey(_owner_pubkey) accept

takeReward

function takeReward(uint8 walletTouch, uint64 waitStep, uint32 epochStart, uint64 epochEnd) public senderIs(_root) accept

stopBM

function stopBM() public onlyOwnerPubkey(_owner_pubkey) accept

Internal / Private Methods

ensureBalance

function ensureBalance() private pure

Special Functions

receive() external


Getters

getDetails

function getDetails() external view returns(
    uint256 pubkey,
    address root,
    uint256 balance,
    optional(uint256) license_num,
    uint128 minstake,
    uint256 signerPubkey
)

getVersion

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

Important Implementation Details & Algorithms


Interaction with Other System Components


Diagram: Contract Structure and Main Methods

classDiagram
class AckiNackiBlockManagerNodeWallet {
-string version
-mapping _code
-uint256 _owner_pubkey
-address _root
-optional _license_num
-mapping _whiteListLicense
-address _licenseBMRoot
-optional _start_bm
-uint128 _wallet_reward
-uint128 _slashSum
-uint32 _start_time
-uint32 _stop_seqno
-uint64 _waitStep
-uint32 _rewarded
-uint32 _epochStart
-uint64 _epochEnd
-uint64 _walletLastTouch
-bool _isSlashing
-uint32 _tryReward
-uint8 _walletTouch
-uint256 _signing_pubkey
+constructor()
+removeLicense()
+setSigningPubkey()
+setLicenseWhiteList()
+addLicense()
+slash()
+noRewards()
-finalSlash()
+withdrawToken()
+startBM()
+getReward()
+takeReward()
+stopBM()
+ensureBalance()
+receive()
+getDetails()
+getVersion()
}

This diagram represents the contract properties and main methods, illustrating the encapsulated state and exposed functionality of the wallet node within the Acki Nacki block management system.