License.abi.json

Overview

The License.abi.json file defines the Application Binary Interface (ABI) for a smart contract that manages licenses in a blockchain environment. This ABI specifies the available functions, their inputs and outputs, state variables (fields), and the versioning details relevant to the contract. The contract primarily handles license ownership, management, and token-related operations such as withdrawing tokens or adding balance. It includes mechanisms for license acceptance, rejection, deletion, and management of associated wallets and keys.

This ABI serves as the communication interface between off-chain clients and the on-chain contract, enabling clients to invoke contract methods and interpret the responses according to the specified types and structures.


ABI Metadata

The header fields are used to authenticate and timestamp transactions involving this contract, ensuring secure and time-bound operations.


Fields (State Variables)

Field Name

Type

Initialized

Description

_pubkey

uint256

Yes

Public key associated with the contract instance

_timestamp

uint64

No

Timestamp of the last relevant contract event or state change

_constructorFlag

bool

No

Flag indicating if the constructor was successfully called

_license_number

uint256

Yes

Unique identifier for the license

_root

address

Yes

Root address related to the license context

_owner_pubkey

optional(uint256)

No

Optional public key of the license owner

_owner_address

optional(address)

No

Optional address of the license owner

_rootElection

address

No

Address representing a root election entity

_bkwallet

optional(address)

No

Optional backup wallet address associated with the license

_reputationTime

uint128

No

Metric representing reputation time associated with the license

_isPrivileged

bool

No

Flag indicating privileged status of the license

_code

map(uint8, cell)

No

Mapping of code cells, potentially for different logic versions or modules

_license_start

uint64

No

Timestamp marking the start of the license period

is_ready

bool

No

Status flag indicating readiness of the license contract

_last_touch

uint64

No

Timestamp of the last interaction or update to the license

_licenseLastTouch

uint64

No

Timestamp indicating the last license-related action


Functions

constructor(pubkey: uint256, walletCode: cell, rootElection: address, isPrivileged: bool)


setOwnerAddress(owner: address)


setOwnerPubkey(pubkey: uint256)


setLockToStake(lock: bool)


removeBKWallet()


deleteWallet(reputationTime: uint128, isPrivileged: bool, last_touch: uint64)


destroyLicense()


addBKWallet(pubkey: uint256)


notAcceptLicense(pubkey: uint256)


acceptLicense(pubkey: uint256, last_touch: uint64)


toWithdrawToken(value: uint128)


withdrawToken(to: address, value: uint128)


toAddBalance(value: uint128)


getDetails()


getBK()


getOwner()


getVersion()


Important Implementation Details


Interactions with Other System Components


Visual Diagram: Structure and Function Relationships

flowchart TD
constructor -->|initializes| LicenseContract
LicenseContract --> setOwnerAddress
LicenseContract --> setOwnerPubkey
LicenseContract --> setLockToStake
LicenseContract --> addBKWallet
LicenseContract --> removeBKWallet
LicenseContract --> acceptLicense
LicenseContract --> notAcceptLicense
LicenseContract --> deleteWallet
LicenseContract --> destroyLicense
LicenseContract --> toWithdrawToken
LicenseContract --> withdrawToken
LicenseContract --> toAddBalance
LicenseContract --> getDetails
LicenseContract --> getBK
LicenseContract --> getOwner
LicenseContract --> getVersion

Usage Examples

Initializing the License Contract

contract.constructor(pubkey, walletCode, rootElectionAddress, isPrivileged);

Changing the Owner's Address

contract.setOwnerAddress(newOwnerAddress);

Accepting a License

contract.acceptLicense(userPubkey, currentTimestamp);

Retrieving License Details

const details = contract.getDetails();
console.log(details.license_number, details.owner_address, details.reputationTime);

This ABI file is essential for interacting programmatically with the license smart contract and forms the contract's external interface for all operations related to license lifecycle, ownership, and token management. For deeper understanding of ABI usage and smart contract interactions, see Smart Contract ABI and Blockchain Token Management.