PopitGame.abi.json
Overview
This file defines the Application Binary Interface (ABI) for the PopitGame smart contract version 2.4, specifying its callable functions, events, and persistent state fields. It serves as a contract interface description facilitating interaction with the PopitGame contract on the blockchain. Primarily, the contract manages a system of "PopCoin" tokens, their wallets, and related game mechanics such as value assignment, deployment, and withdrawal.
The ABI describes:
The contract's initialization through the
constructor.Functions to manage PopCoin tokens and wallets.
Event declarations for key state changes.
Persistent storage fields used by the contract.
Structure and Contents
ABI Metadata
ABI version: 2
Contract version: "2.4"
Header fields:
pubkey,time, expire — standard header fields for transaction validation and expiration.
Fields (Persistent State Variables)
Name | Type | Initialization | Description |
|---|---|---|---|
|
| Yes | Public key associated with the contract owner. |
|
| No | Timestamp representing contract-related time data. |
|
| No | Flag indicating if the constructor has been executed. |
|
| No | Code storage mapping, likely for wallet or token logic. |
|
| Yes | Address of the contract owner. |
|
| No | Current mbi (possibly a metric or index) value. |
|
| No | Address of the root contract or entity. |
|
| No | Start time for contract logic or game initialization. |
|
| No | Public key of the root entity or contract. |
|
| No | Address associated with boosting mechanics. |
|
| No | Reward amount or pool tracked by the contract. |
Functions
constructor
Inputs:
code:map(uint8,cell)— a mapping of code cells, likely representing compiled contract code for wallets or tokens.root_pubkey:uint256— root public key for contract authentication.index:uint128— an index parameter, potentially for unique identification.
Outputs: None
Description:
Initializes the contract setting up the code map, root public key, and index. This function sets the initial state of the contract and must be called once upon deployment.Usage Example:
popitGame.constructor(codeMap, rootPublicKey, index);
addValuePopit
Inputs:
name:string— name identifier for the PopCoin.id:uint256— unique identifier associated with the PopCoin.value:uint64— value to assign to the PopCoin.
Outputs: None
Description:
Adds or updates a value for a specific PopCoin identified by name and id. This function is used to manage token values within the game.Usage Example:
popitGame.addValuePopit("GoldToken", 12345, 1000);
popCoinRootDeployed
Inputs:
name:string— name of the PopCoin root contract deployed.
Outputs: None
Description:
Signals that the root contract for a specific PopCoin has been deployed. Likely triggers internal bookkeeping or event emission.
popCoinWalletDeployed
Inputs:
name:string— name of the PopCoin wallet contract deployed.
Outputs: None
Description:
Signals deployment of a PopCoin wallet contract associated with the given name.
setMbiCur
Inputs:
mbiCur:uint64— new mbi current value.
Outputs: None
Description:
Updates the current mbi metric, which may relate to internal game logic or scoring.
deployPopCoinWallet
Inputs:
name:string— name of the PopCoin wallet to deploy.value:uint64— initial value to assign to the wallet.
Outputs: None
Description:
Deploys a new PopCoin wallet contract with the specified name and initial value.
deployPopCoinWalletOldTransfer
Inputs:
name:string— name of the PopCoin wallet.value:uint64— value for transfer.
Outputs: None
Description:
Deploys a PopCoin wallet but uses an older transfer mechanism, probably for backward compatibility.
withdraw
Inputs:
value:uint128— amount to withdraw.to:address— destination address for the withdrawal.
Outputs: None
Description:
Enables withdrawal of funds or tokens from the contract to an external address.Usage Example:
popitGame.withdraw(5000, "0xabc123...");
getPopCoinWalletAddress
Inputs:
name:string— name of the PopCoin wallet.
Outputs:
popCoinWalletAddress:address— computed wallet address.
Description:
Returns the blockchain address of the PopCoin wallet associated with the given name, allowing clients to locate wallet contracts.Usage Example:
const walletAddress = popitGame.getPopCoinWalletAddress("GoldToken");
getDetails
Inputs: None
Outputs:
owner:address— owner address of the contract.root:address— root contract address.startTime:uint32— contract start timestamp.mbiCur:uint64— current mbi value.boost:address— boost contract address.rewards:uint128— accrued rewards.minstake:uint128— minimum stake amount (note: not in fields, possibly computed or inherited).
Description:
Retrieves key contract details including ownership, root contract reference, timing, and reward-related data.Usage Example:
const details = popitGame.getDetails();
console.log(details.owner, details.rewards);
getVersion
Inputs: None
Outputs:
value0:string— primary version string.value1:string— secondary version or build info.
Description:
Returns the contract's version information useful for compatibility and debugging.
Events
Two events are declared to notify external listeners of significant state changes:
PopCoinRootReceived
Inputs:
name(string)Triggered when a PopCoin root contract is received or recognized.
PopCoinWalletReceived
Inputs:
name(string)Triggered when a PopCoin wallet contract is received or recognized.
These events support asynchronous monitoring of contract state by external systems or interfaces.
Implementation Details
The contract uses a map of
uint8tocellfor storing executable code blobs (_code). This allows dynamic deployment or referencing of wallet/token code on demand.The use of
uint256for public keys and IDs provides cryptographic security and uniqueness.The ABI specifies immutable fields (
init: true) such as_pubkeyand_ownerthat are set at deployment and remain constant, ensuring security and ownership integrity.Functions for deploying wallets indicate the PopitGame contract acts as a factory or manager for PopCoin wallet contracts.
Withdrawal and value assignment functions imply the contract manages token economics and user balances.
Event declarations facilitate integration with off-chain systems via blockchain event listeners.
Interaction with Other System Components
PopCoin Wallet Contracts: The ABI includes functions to deploy and manage wallet contracts, indicating a relationship where PopitGame serves as a central controller or factory.
Root Contract: The
_rootaddress andpopCoinRootDeployedfunction suggest linkage with a root or parent contract managing overall game or token logic.Boost Mechanism: The
_boostaddress field implies interaction with an external contract or system that provides boosting features, possibly related to rewards or staking.External Addresses: Withdrawal and wallet address retrieval functions show interactions with user accounts or external contracts.
Code Storage: The
_codemap likely contains compiled contract code for dynamic deployment, facilitating modularity and upgradability.
Mermaid Diagram: Contract Structure
classDiagram
class PopitGame {
+_pubkey: uint256
+_timestamp: uint64
+_constructorFlag: bool
+_code: map(uint8,cell)
+_owner: address
+_mbiCur: uint64
+_root: address
+_startTime: uint32
+_root_pubkey: uint256
+_boost: address
+_rewards: uint128
+constructor()
+addValuePopit()
+popCoinRootDeployed()
+popCoinWalletDeployed()
+setMbiCur()
+deployPopCoinWallet()
+deployPopCoinWalletOldTransfer()
+withdraw()
+getPopCoinWalletAddress()
+getDetails()
+getVersion()
}
PopitGame ..> "1" PopCoinWallet : deploys >
PopitGame ..> "1" PopCoinRoot : interacts >
PopitGame ..> BoostMechanism : references >
This diagram illustrates the core contract PopitGame with its persistent fields and exposed methods. The arrows indicate interactions with other entities such as PopCoin wallets, root contracts, and boost mechanisms.