Miner S.C.
Miner-related Functions
NewMinerSmartContract
Creates a new instance of the Miner Smart Contract.
Execute
Executes a specified function within the Miner Smart Contract, based on the function name and input data provided.
Function Parameters:
Parameters:
t
Transaction to be executed.
funcName
The function name to execute within the smart contract.
input
Byte array of input data for the function.
balances
State context interface for maintaining blockchain state.
Global Node Management
getGlobalNode
Retrieves the global configuration node from the blockchain state.
Function Signature:
Parameters:
balances
Blockchain state context interface.
Returns:
*GlobalNode
- Pointer to the global node configuration.error
- Error if retrieval fails.
InitConfig
Initializes the global configuration settings for the Miner Smart Contract.
Function Signature:
Parameters:
balances
Blockchain state context interface.
Description: This function initializes the settings in the blockchain, validating and storing the global node configuration if it does not already exist. If a global node does not exist, a default node is created and stored.
Execution Statistics
Miner Smart Contract records performance metrics for each key function:
add_miner
Tracks time taken to add a new miner.
add_sharder
Tracks time taken to add a new sharder.
collect_reward
Measures the time required for reward collection.
miner_health_check
Monitors time taken to conduct miner health checks.
sharder_health_check
Tracks time taken for sharder health checks.
update_globals
Counts the number of global configuration updates.
update_miner_settings
Tracks the time taken to update miner settings.
update_sharder_settings
Tracks time taken to update sharder settings.
payFees
Monitors the time taken for processing fee payments.
feesPaid
Keeps a count of total fees paid by miners and sharders.
mintedTokens
Counts the total tokens minted in the smart contract.
Last updated