Categorygithub.com/multiversx/mx-chain-vm-common-go
modulepackage
1.5.16
Repository: https://github.com/multiversx/mx-chain-vm-common-go.git
Documentation: pkg.go.dev

# README

MultiversX

mx-chain-vm-common-go

Common structs between VM and node

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

CodeMetadataFromBytes creates a metadata object from bytes.
FormatLogDataForCall prepares Data field for a LogEntry.
IsAllowedToSaveUnderKey returns if saving key-value in data tries under given key is allowed.
IsEmptyAddress returns whether an address is empty.
IsMetachainIdentifier verifies if the identifier is of type metachain.
IsSmartContractAddress verifies if a set address is of type smart contract.
IsSmartContractOnMetachain verifies if an address is smart contract on metachain.
IsSystemAccountAddress returns true if given address is system account address.
ParseVMTypeFromContractAddress obtains the VMType from the contract address TODO maybe move to elgond-go-core.
SafeSubUint64 performs subtraction on uint64 and returns an error if it overflows.
ValidateToken - validates the token ID.
ZeroValueIfNil returns 0 if the input is nil, otherwise returns the input.

# Constants

AccountCollision is returned when created account already exists.
BuiltInFunctionESDTSetBurnRoleForAll represents the defined built in function name for esdt set burn role for all.
BuiltInFunctionESDTTransferRoleAddAddress represents the defined built in function name for esdt transfer role add address.
BuiltInFunctionESDTTransferRoleDeleteAddress represents the defined built in function name for transfer role delete address.
BuiltInFunctionESDTUnSetBurnRoleForAll represents the defined built in function name for esdt unset burn role for all.
CallStackOverFlow is returned when stack overflow occurs.
ContractInvalid is returned when the contract is invalid.
ContractNotFound is returned when the called contract does not exist.
EGLDIdentifier represents the identifier for the EGLD in case of a transfer with MultIESDTNFTTransfer built-in function.
ESDTAddMetadata represents the defined built in function name for esdt add metadata.
ESDTDeleteMetadata represents the defined built in function name for esdt delete metadata.
ESDTRoleBurnForAll represents the role for burn for all.
ExecutionFailed is returned when the execution of the specified function has failed.
FunctionNotFound is returned when the input specifies a function name that does not exist or is not public.
FunctionWrongSignature is returned when the wrong number of arguments is provided.
MaxLengthForValueToOptTransfer defines the maximum length for value to optimize cross shard transfer.
MetadataGuarded is the bit for guarded account flag.
MetadataPayable is the bit for payable flag.
MetadataPayableBySC is the bit for payable flag.
MetadataReadable is the bit for readable flag.
MetadataUpgradeable is the bit for upgradable flag.
NumInitCharactersForScAddress numbers of characters for smart contract address identifier.
Ok is returned when execution was completed normally.
OutOfFunds is returned when the caller (sender) runs out of funds.
OutOfGas is returned when VM execution runs out of gas.
ShardIdentiferLen number of characters for shard identifier in an address.
SimulateFailed is returned when tx simulation fails execution.
UpgradeFailed is returned when the upgrade of the contract has failed.
UserError is returned for various execution errors.
VMTypeLen number of characters with VMType identifier in an address, these are the last 2 characters from the initial identifier.

# Variables

ErrAsyncParams signals that there was an error with the async parameters.
ErrInvalidVMType signals that invalid vm type was provided.
ErrNilTransferIndexer signals that the provided transfer indexer is nil.
ErrSubtractionOverflow signals that uint64 subtraction overflowed.
ErrTransfersNotIndexed signals that transfers were found unindexed.
SystemAccountAddress is the hard-coded address in which we save global settings on all shards.

# Structs

ArgsMigrateDataTrieLeaves is the argument structure for the MigrateDataTrieLeaves function.
No description provided by the author
BaseOperationCost defines cost for base operation cost.
BuiltInCost defines cost for built-in methods.
CodeMetadata represents smart contract code metadata.
ContractCallInput VM input when calling a function from an existing contract.
ContractCreateInput VM input when creating a new contract.
ESDTTransfer defines the structure for and ESDT / NFT transfer.
GasCost holds all the needed gas costs for system smart contracts.
LogEntry represents an entry in the contract execution log.
NftSaveArgs defines the arguments for saving nfts.
OutputAccount shows the state of an account after contract execution.
OutputTransfer contains the fields needed to create transfers to another shard.
ParsedESDTTransfers defines the struct for the parsed esdt transfers.
StorageUpdate represents a change in the account storage (insert, update or delete) Note: current implementation might also return unmodified storage entries.
VMInput contains the common fields between the 2 types of SC call.
VMOutput is the return data and final account state after a SC execution.

# Interfaces

AcceptPayableChecker defines the methods to accept a payable handler through a set function.
AccountDataHandler models what how to manipulate data held by a SC account.
AccountHandler models a state account, which can journalize and revert It knows about code and data, as data structures not hashes.
AccountsAdapter is used for the structure that manages the accounts on top of a trie.PatriciaMerkleTrie implementation.
BlockchainDataHook is an interface for getting blockchain data.
BlockchainDataProvider is an interface for getting blockchain data.
BlockchainHook is the interface for VM blockchain callbacks.
BuiltinFunction defines the methods for the built-in protocol smart contract functions.
BuiltInFunctionContainer defines the methods for the built-in protocol container.
BuiltInFunctionFactory will handle built-in functions and components.
CallArgsParser will handle parsing transaction data to function and arguments.
Coordinator defines what a shard state coordinator should hold.
CryptoHook interface for VM krypto functions.
DataTrieMigrator is the interface that defines the methods needed for migrating data trie leaves.
EnableEpochsHandler is used to verify which flags are set in the current epoch based on EnableEpochs config.
EpochNotifier can notify upon an epoch change and provide the current epoch.
EpochSubscriberHandler defines the behavior of a component that can be notified if a new epoch was confirmed.
ESDTGlobalSettingsHandler provides global settings functions for an ESDT token.
ESDTNFTStorageHandler will handle the storage for the nft metadata.
ESDTRoleHandler provides IsAllowedToExecute function for an ESDT.
ESDTTransferParser can parse single and multi ESDT / NFT transfers.
ExtendedESDTGlobalSettingsHandler provides global settings functions for an ESDT token.
GlobalMetadataHandler provides functions which handle global metadata.
GuardedAccountHandler allows setting and getting the configured account guardian.
Marshalizer defines the 2 basic operations: serialize (marshal) and deserialize (unmarshal).
NextOutputTransferIndexProvider interface abstracts a type that manages a transfer index counter.
PayableChecker will handle checking if transfer can happen of ESDT tokens towards destination.
PayableHandler provides IsPayable function which returns if an account is payable or not.
RoundNotifier can notify upon an epoch change and provide the current epoch.
RoundSubscriberHandler defines the behavior of a component that can be notified if a new epoch was confirmed.
SimpleESDTNFTStorageHandler will handle get of ESDT data and save metadata to system acc.
UserAccountHandler models a user account, which can journalize account's data with some extra features like balance, developer rewards, owner.
VMExecutionHandler interface for any MultiversX VM endpoint.

# Type aliases

FunctionNames (alias) is a map of function names.
ReturnCode is an enum with the possible error codes returned by the VM.