Mirror.abi.json
Overview
Mirror.abi.json defines the Application Binary Interface (ABI) for a smart contract, specifying its version, header fields, state variables, and the externally callable functions. The contract is designed to manage and deploy various related contracts or modules, including multifactor authentication contracts, game deployments, and token roots. It contains administrative functions to update contract state and deploy subcontracts, reflecting a modular and extensible architecture.
This ABI is structured to support interactions requiring cryptographic keys, proofs, and metadata, indicating usage in security-sensitive or identity-related decentralized applications. The contract maintains ownership and control through public keys and supports dynamic code updates via a code map.
ABI Structure and Components
ABI Metadata
ABI version: 2 — Indicates the ABI format version.
version:
"2.4"— Semantic version of the contract interface.header:
["pubkey", "time", "expire"]— Specifies standard message header fields used for authentication, timing, and expiration validation.
State Variables (Fields)
Field Name | Type | Initialization | Description |
|---|---|---|---|
Yes | Public key of the contract owner used for signature verification. | ||
| No | Tracks the last update or deployment timestamp. | |
| No | Indicates if the constructor has been executed. | |
No | Root address related to the contract's deployment hierarchy. | ||
| No | Index identifier, likely used for versioning or enumeration. | |
No | Public key associated with the root address or entity. | ||
|
| No | Mapping of code versions or modules identified by a numeric key. |
Functions
constructor(root: address, index: uint128, rootPubkey: uint256)
Purpose: Initializes the contract with the given root address, index, and root public key.
Inputs:
root: Address of the root contract or owner.
index: Numeric identifier for this contract instance.
rootPubkey: Public key of the root entity.
Outputs: None
Usage: Called once during deployment to set initial ownership and contextual data.
setNewIndex(index: uint128)
Purpose: Updates the internal index field.
Inputs:
index: New index value to set.
Outputs: None
Usage: Used to change or increment the contract index, possibly for versioning or state tracking.
setNewCode(id: uint8, code: cell)
Purpose: Updates or adds a new code cell associated with an identifier.
Inputs:
id: Numeric identifier for the code snippet or module.code: The new code in serialized cell format.
Outputs: None
Usage: Allows dynamic updates or additions to the contract’s code components stored in the
_codemap.
destroyNode()
Purpose: Terminates or destroys the contract node.
Inputs: None
Outputs: None
Usage: Likely used for self-destruct functionality or cleanup.
deployPopitGame(pubkey: uint256)
Purpose: Deploys a Popit game contract with the specified public key.
Inputs:
pubkey: Public key for the new Popit game.
Outputs: None
Usage: Facilitates creation and deployment of a game instance linked to this contract.
deployMultifactor(name: string, zkid: string, proof: bytes, epk: uint256, epk_sig: bytes, epk_expire_at: uint64, jwk_modulus: bytes, kid: bytes, jwk_modulus_expire_at: uint64, index_mod_4: uint8, iss_base_64: string, provider: string, header_base_64: string, pub_recovery_key: uint256, pub_recovery_key_sig: bytes, jwk_update_key: uint256, jwk_update_key_sig: bytes, root_provider_certificates: map(uint256, bytes))
Purpose: Deploys a multifactor authentication contract with extensive cryptographic and identity-related parameters.
Inputs:
name: Identifier string for the multifactor contract.
zkid: Zero-knowledge identity string.proof: Cryptographic proof bytes.
epk: Ephemeral public key.epk_sig: Signature of the ephemeral public key.epk_expire_at: Expiration timestamp for the ephemeral public key.jwk_modulus: Modulus bytes of a JSON Web Key.
kid: Key identifier bytes.jwk_modulus_expire_at: Expiration timestamp for the JWK modulus.
index_mod_4: Index modulo 4, possibly for sharding or partitioning.
iss_base_64: Base64-encoded issuer string.provider: Provider identifier string.header_base_64: Base64-encoded header.pub_recovery_key: Public recovery key.pub_recovery_key_sig: Signature of the recovery key.jwk_update_key: JSON Web Key update key.
jwk_update_key_sig: Signature of the update key.
root_provider_certificates: Mapping of root provider certificates.
Outputs: None
Usage: Deploys a secure multifactor authentication mechanism tied to cryptographic proofs and keys, supporting identity verification.
isDeployMultifactor(name: string, ready: bool, zkid: string, proof: bytes, epk: uint256, epk_sig: bytes, epk_expire_at: uint64, jwk_modulus: bytes, kid: bytes, jwk_modulus_expire_at: uint64, index_mod_4: uint8, iss_base_64: string, provider: string, header_base_64: string, pub_recovery_key: uint256, pub_recovery_key_sig: bytes, jwk_update_key: uint256, jwk_update_key_sig: bytes, root_provider_certificates: map(uint256, bytes), owner_pubkey: uint256)
Purpose: Checks or validates deployment readiness of a multifactor contract with the provided parameters.
Inputs: Same as
deployMultifactorplus:ready: Boolean indicating readiness state.
owner_pubkey: Public key of the owner.
Outputs: None
Usage: Likely used as a conditional or verification step before or after multifactor contract deployment.
updateWhiteList(pubkey: uint256, index: uint8, name: string)
Purpose: Updates a whitelist entry with a public key, index, and name.
Inputs:
Outputs: None
Usage: Manages access control or permissions by updating whitelist entries.
deployPopCoinRoot(name: string, maxPopitIndex: uint16, popits_media: map(uint16, tuple(media: string, id: uint256, protopopit: optional(uint32))), description: string, isPublic: bool, popitGameOwner: address)
Purpose: Deploys a PopCoin root contract with detailed metadata and ownership.
Inputs:
name: Name of the PopCoin root.
maxPopitIndex: Maximum index for Popit tokens.
popits_media: Map of media assets keyed by Popit index, containing:
media: Media URI or identifier.
id: Media ID.protopopit: Optional prototype Popit ID.
description: Description string.isPublic: Boolean indicating public availability.popitGameOwner: Address of the game owner.
Outputs: None
Usage: Facilitates deployment of a token root with associated metadata and ownership information.
getVersion()
Purpose: Retrieves the ABI and contract version information.
Inputs: None
Outputs:
value0: ABI version string.value1: Contract version string.
Usage: Provides version details for compatibility and upgrade management.
Implementation Details
The contract uses a map
_codekeyed byuint8to store serialized code cells, allowing modular code updates without redeploying the entire contract.Public keys (uint256) are extensively used for ownership, deployment authorization, and signature verification, reflecting a security-focused design.
Complex data structures such as maps and tuples are used to manage collections of media (popits_media) and certificates (
root_provider_certificates), indicating support for rich metadata.The multifactor deployment methods handle cryptographic proofs and keys with expiry times, emphasizing secure identity management.
Interaction with Other Contracts and System Components
The
deployPopitGameanddeployPopCoinRootfunctions suggest interaction with game and token contracts, possibly deploying subcontracts that represent game instances or token collections.The use of root address and rootPubkey links this contract to a root or parent contract, enabling hierarchical deployment and control.
The multifactor deployment and validation functions imply integration with identity verification systems and cryptographic key management services.
The whitelist management function indicates interaction with access control mechanisms or permissioned components.
Visual Diagram
flowchart TD
A[constructor] --> B[setNewIndex]
A --> C[setNewCode]
A --> D[destroyNode]
A --> E[deployPopitGame]
A --> F[deployMultifactor]
F --> G[isDeployMultifactor]
A --> H[updateWhiteList]
A --> I[deployPopCoinRoot]
A --> J[getVersion]
The diagram shows the main functions and their relationships, with
constructoras the entry point initializing the contract.deployMultifactorconnects toisDeployMultifactorfor deployment validation.Other functions represent independent operations related to contract management, deployment, and querying.
For further understanding of cryptographic key management and contract deployment patterns, see Public Key Cryptography and Smart Contract Deployment. For more on data structures like maps and tuples used here, reference Data Structures in Smart Contracts.