☁️
Zus Docs
  • About Züs
  • System
    • Providers and Services
      • Miner
      • Sharder
      • Blobber
      • Validator
      • Authorizer
      • Node Locator (0DNS)
    • Storage
      • Architecture and Data Management
      • Protocol
        • Allocations
        • Reference Objects
        • Challenges
        • Write Markers
          • Chain Hashing
          • Two Commit
        • Blobber Repair Protocol
      • ZS3 Server
        • Backup, Recovery and Replication
        • Encryption and Compression
        • S3FS Setup and Usage
        • Backup & Recovery with Restic on Blimp + ZS3 Server
        • Backup & Recovery with Veeam on Blimp + ZS3 Server
      • File Operations
        • Upload
        • Download
        • File Sharing
        • Partial Error Recovery
        • Streaming
        • Rent a Blobber
    • Smart Contracts
      • Storage S.C.
      • Miner S.C.
      • ZCN S.C.
      • ERC-20 S.C.s
      • Bridge Protocol
    • Blockchain & Consensus
      • Entities
    • User Authentication and Wallet Management System
      • OKTA Integration
      • Key Management System (KMS)
  • APIs
    • 0DNS API
    • JS API
    • Mobile API
  • CLIs
    • Storage CLI
      • Quickstart
      • Configuring the tool
    • Wallet CLI
      • Wallet Configuration
      • Quickstart
      • Configuring the tool
  • SDKs
    • Go SDK
      • GO SDK Microservices
    • JS SDK
  • Tokenomics
    • Staking
    • Reward & Penalty
  • ✨Züs Apps
    • 🗝️Vult
      • Getting Started
        • Web
        • Mobile
      • Vult AI
        • Batch Processing
        • Memory Retention
        • Technical Implementation
        • Architecture Overview
      • Login / Register
      • File Management Pages
      • File Sharing
      • Storage Management Dashboard
      • Storage Maintenance and Troubleshooting
      • Züs Subscription
      • Wallet Management
      • Refer a friend
      • Settings
    • 🏗️Blimp
      • Getting Started
      • Login / Register
      • Configure Storage
        • Create Standard Storage Allocation
        • Create Enterprise Allocation
        • Create S3 Server Allocation
        • Create Cloud Migration Allocation
        • Allocation Maintenance and Troubleshooting
      • File Management Pages
      • File Sharing
      • Manage Allocations
      • Upgrade Storage
      • Blimp Vault
      • Refer a friend
      • Settings
      • Launching ZS3 Server
      • Using CLI to backup files into Blimp + ZS3 Server
    • 🏠Chimney
      • Getting Started
      • Login / Register
      • Create New Deployment
      • Manage Your Deployments
      • Homepage
      • Staking Dashboard
      • Rank Dashboard
      • Monitor Dashboard
      • Stats Dashboard
      • Logs Dashboard
      • Wallet Dashboard
      • Operations on your Deployments
      • Restricted Blobbers
      • Settings
        • Manage Profile
        • Wallet Settings
        • Update Blobber Settings
        • Update Blobber Version
        • Refer a friend
        • Help
    • 🌐Atlus
      • Getting Started
      • Home page
      • Service Providers Page
      • Charts Page
        • Market Charts
        • Network Charts
        • Storage Charts
      • Blockchain Page
      • Server Map Page
      • Storage Explainer Page
      • Details Pages
        • Block Details Page
        • Transaction Details Page
        • Wallet Details Page
        • Miner Details Page
        • Sharder Details Page
        • Blobber Details Page
        • Validator Details Page
        • Authorizer Details Page
        • Allocation Details Page
      • Appendix: Common Components
    • ⚡Bolt
      • Getting Started
        • Web
        • Mobile
      • Login / Register
      • Sign In with external wallet
      • Staking Dashboard
      • Staking/Unstaking a provider
      • Claiming Rewards
      • Send/Receive ZCN tokens
      • Buy ZCN
      • Deposit/Withdraw ZCN tokens
      • Activity Dashboard
      • Refer a friend
      • Settings
  • Releases
    • Hardfork
Powered by GitBook
On this page
  • ZCN Smart Contract Functions
  • Execution Statistics
  • Core Functions
  • Cost Table Retrieval
  1. System
  2. Smart Contracts

ZCN S.C.

ZCN Smart Contract Functions

NewZCNSmartContract

Creates a new instance of the ZCN Smart Contract.

goCopy codefunc NewZCNSmartContract() smartcontractinterface.SmartContractInterface {
	var contract = &ZCNSmartContract{
		smartcontractinterface.NewSC(ADDRESS),
		make(map[string]smartContractFunction),
	}

	contract.InitSC()
	contract.setSC(contract.SmartContract, &smartcontract.BCContext{})
	return contract
}

InitSC

Initializes smart contract functions within the ZCN Smart Contract, associating each function with a key.

goCopy codefunc (zcn *ZCNSmartContract) InitSC()

Key Functions

  • Configuration

    • update-global-config: Updates the global configuration of the smart contract.

    • update-authorizer-config: Configures specific authorizers for the smart contract.

  • Bridge-Related

    • mint: Mints new ZCN tokens.

    • burn: Burns ZCN tokens, typically used for cross-chain interactions.

  • Authorizer Management

    • add-authorizer: Adds a new authorizer.

    • delete-authorizer: Removes an existing authorizer.

    • authorizer-health-check: Conducts a health check on an authorizer.

  • Delegate Pools

    • add-to-delegate-pool: Adds tokens to the delegate pool for staking.

    • delete-from-delegate-pool: Removes tokens from the delegate pool.

    • update-authorizer-stake-pool: Updates the stake pool for an authorizer.


Execution Statistics

ZCN Smart Contract records metrics for each major function to track performance:

Function Name
Description

add-authorizer

Tracks time taken to add a new authorizer.

delete-authorizer

Monitors time taken to delete an authorizer.

update-global-config

Tracks time taken to update the global configuration.

update-authorizer-config

Tracks time taken to update an authorizer's configuration.

mint

Measures the time taken for minting tokens.

burn

Measures the time taken for burning tokens.

add-to-delegate-pool

Tracks the time taken to add to the delegate pool.

delete-from-delegate-pool

Tracks the time taken to remove from the delegate pool.


Core Functions

Execute

Executes a specified function within the ZCN Smart Contract based on the provided method name and input data.

Function Signature:

goCopy codefunc (zcn *ZCNSmartContract) Execute(
	trans *transaction.Transaction,
	method string,
	input []byte,
	ctx cstate.StateContextI
) (string, error)

Parameters:

Field
Description

trans

Transaction to be executed.

method

Name of the method to execute within the smart contract.

input

Input data for the method in byte format.

ctx

Blockchain state context interface.

Returns:

  • string - Result of the function execution.

  • error - Error if the execution fails.


Cost Table Retrieval

GetCostTable

Retrieves the cost table for the smart contract, containing configuration costs associated with each operation.

Function Signature:

goCopy codefunc (zcn *ZCNSmartContract) GetCostTable(balances cstate.StateContextI) (map[string]int, error)

Parameters:

Field
Description

balances

Blockchain state context interface used to retrieve global costs.

Returns:

  • map[string]int - A map containing the cost configuration for each function.

  • error - Error if retrieval fails.

PreviousMiner S.C.NextERC-20 S.C.s

Last updated 6 months ago