cmd

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

This file is used to test the new command before the command is moved to the categories

This is referenced from ./venachain/usage.go with tiny modification (line: 198)

Index

Constants

View Source
const (
	DefaultConfigFilePath = "./config.json"
)

Variables

View Source
var (
	// account
	AccountCmd = cli.Command{
		Name:      "account",
		Usage:     "Manage accounts",
		ArgsUsage: "",
		Category:  "account",
		Description: `
	`,
		Subcommands: []cli.Command{
			TransferCmd,
			UserAdd,
			UserUpdate,
			QueryUserCmd,
		},
	}

	TransferCmd = cli.Command{
		Name:      "transfer",
		Usage:     "Transfer value to another account",
		ArgsUsage: "<to> <value>",
		Action:    transfer,
		Flags:     globalCmdFlags,
		Description: `
		vcl account transfer <to> <value>

The input value can be either hexadecimal ("0xDE0B6B3A7640000") or decimal format ("10") 
The unit conversion table are as follows:
<TODO>"`,
	}

	UserAdd = cli.Command{
		Name:      "add",
		Usage:     "Add a user to the user platform",
		ArgsUsage: "<address> <name> <tel> <email>",
		Action:    userAdd,
		Flags:     userAddCmdFlags,
		Description: `
		vcl account add <address> <name> <tel> <email>`,
	}

	UserUpdate = cli.Command{
		Name:      "update",
		Usage:     "Update the mobile and email info of a user",
		ArgsUsage: "<address>",
		Action:    userUpdate,
		Flags:     userUpdateCmdFlags,
		Description: `
		vcl account update <address>`,
	}

	QueryUserCmd = cli.Command{
		Name:   "query",
		Usage:  "Query the user Info by user name or address",
		Action: queryUser,
		Flags:  userQueryCmdFlags,
		Description: `
		vcl account query`,
	}
)
View Source
var (
	CnsCmd = cli.Command{
		Name:     "cns",
		Usage:    "Manage Contract Named Service",
		Category: "cns",
		Subcommands: []cli.Command{
			CnsResolveCmd,
			CnsRegisterCmd,
			CnsRedirectCmd,
			CnsQueryCmd,
			CnsStateCmd,
		},
	}

	CnsRegisterCmd = cli.Command{
		Name:      "register",
		Usage:     "Register a contract to the CNS",
		ArgsUsage: "<name> <version> <address>",
		Action:    cnsRegister,
		Flags:     globalCmdFlags,
		Description: `
Register a contract to the CNS, use:
		vcl cns register <name> <version> <address>`,
	}

	CnsRedirectCmd = cli.Command{
		Name:      "redirect",
		Usage:     "Redirect a contract name in the CNS to another contract address by specifying the version",
		ArgsUsage: "<name> <version>",
		Action:    cnsRedirect,
		Flags:     globalCmdFlags,
		Description: `
Redirect a contract name in the CNS to another contract address by specifying the version, i.e, 
specify the current version of the contract with <name> to <version>, use:
		vcl cns redirect <name> <version>`,
	}

	CnsResolveCmd = cli.Command{
		Name:      "resolve",
		Usage:     "Shows the latest version (default) contract address binded with a name",
		ArgsUsage: "<name>",
		Action:    cnsResolve,
		Flags:     cnsResolveCmdFlags,
		Description: `
Shows the latest version (default) contract address binded with a name, use:
		vcl cns resolve <name>`,
	}

	CnsQueryCmd = cli.Command{
		Name:   "query",
		Usage:  "Query the CNS Info by the search key provided",
		Action: cnsQuery,
		Flags:  cnsQueryCmdFlags,
		Description: `
Query the cns information.
To get all cns information, use:
		vcl cns query --all

To get cns information in page mode, use: 
		vcl cns query --pageNum <page No.> --pageSize <number of data shown once> 

To get CNS information of specific account, use:
		vcl cns query --addr <account address> 

To get cns information of specific contract, use:
		vcl cns query --contract <contract address or contract name>`,
	}

	CnsStateCmd = cli.Command{
		Name:      "state",
		Usage:     "Show the registration status of a contract name or contract address",
		ArgsUsage: "<contract>",
		Action:    cnsState,
		Flags:     globalCmdFlags,
		Description: `
Show the registration status of a contract name or contract address, use:
		vcl cns state <contract>`,
	}
)
View Source
var (
	// contract
	ContractCmd = cli.Command{
		Name:      "contract",
		Usage:     "Manage contracts",
		ArgsUsage: "",
		Category:  "contract",
		Subcommands: []cli.Command{
			ExecuteCmd,
			MethodCmd,
			MigrateCmd,
			DeployCmd,
			ReceiptCmd,
		},
		Description: `
Currently Venachain supports two types of contracts:  wasm and evm 
Use --vm flag to select the correct interpreter when deploy and 
execute contracts on Venachain`,
	}

	DeployCmd = cli.Command{
		Name:      "deploy",
		Usage:     "Deploy a wasm or evm contract",
		ArgsUsage: "<codeFile>",
		Action:    deploy,
		Flags:     contractDeployCmdFlags,
		Description: `
		vcl contract deploy <codeFile>

Modify the genesis.json file 'interpreter' tag to support evm contract deployment
Evm: only support byzantium version 
Wasm: --abi flag is also needed when deploy wasm contract`,
	}

	ExecuteCmd = cli.Command{
		Name:      "execute",
		Usage:     "Execute a method of contract",
		ArgsUsage: "<contract> <function>",
		Action:    execute,
		Flags:     contractExecuteCmdFlags,
		Description: `
		vcl contract execute <contract> <function>`,
	}

	MigrateCmd = cli.Command{
		Name:      "migrate",
		Usage:     "Migrate the storage trie of a contract to a new address",
		ArgsUsage: "<address> <to>",
		Action:    migrate,
		Flags:     globalCmdFlags,
		Description: `
		vcl contract migrate <address> <to>`,
	}

	MethodCmd = cli.Command{
		Name:   "methods",
		Usage:  "List all the exported methods of a contract by its abi file or contract address",
		Action: contractMethods,
		Flags:  contractMethodsCmd,
		Description: `
		vcl contract methods

To list the methods of a contract by contract address, the abi file of the contract
should be stored in the ./abi with the name of its address`,
	}

	ReceiptCmd = cli.Command{
		Name:      "receipt",
		Usage:     "Get the transaction receipt by transaction hash",
		ArgsUsage: "<tx hash>",
		Action:    contractReceipt,
		Description: `
		vcl contract receipt <tx hash>

Get the full information of the transaction receipt by transaction hash`,
	}
)
View Source
var (
	// fire wall
	FwCmd = cli.Command{
		Name:     "fw",
		Usage:    "Manage contract fire wall",
		Category: "fw",
		Subcommands: []cli.Command{
			FwStatusCmd,
			FwStartCmd,
			FwStopCmd,
			FwExportCmd,
			FwImportCmd,
			FwNewCmd,
			FwDeleteCmd,
			FwResetCmd,
			FwClearCmd,
		},
	}

	FwStartCmd = cli.Command{
		Name:      "start",
		Usage:     "Start the fire wall of an specific contract",
		ArgsUsage: "<address>",
		Action:    fwStart,
		Flags:     globalCmdFlags,
		Description: `
		vcl fw start <address>`,
	}

	FwStopCmd = cli.Command{
		Name:      "stop",
		Usage:     "Stop the fire wall of an specific contract",
		ArgsUsage: "<address>",
		Action:    fwStop,
		Flags:     globalCmdFlags,
		Description: `
		vcl fw stop <address>`,
	}

	FwStatusCmd = cli.Command{
		Name:      "query",
		Usage:     "Show the fire wall Info of a contract",
		ArgsUsage: "<address>",
		Action:    fwStatus,
		Flags:     globalCmdFlags,
		Description: `
		vcl fw query <address>`,
	}

	FwExportCmd = cli.Command{
		Name:      "export",
		Usage:     "Export all the fire wall rules of a contract",
		ArgsUsage: "<address>",
		Action:    fwExport,
		Flags:     fwImportCmdFlags,
		Description: `
		vcl fw export <address>`,
	}

	FwImportCmd = cli.Command{
		Name:      "import",
		Usage:     "Import fire wall rules to a contract",
		ArgsUsage: "<address>",
		Action:    fwImport,
		Flags:     fwImportCmdFlags,
		Description: `
		vcl fw import <address>`,
	}

	FwNewCmd = cli.Command{
		Name:      "new",
		Usage:     "New a fire wall rule",
		ArgsUsage: "<address> <action> <account> <api>",
		Action:    fwNew,
		Flags:     globalCmdFlags,
		Description: `
		vcl fw new <address> <action> <account> <api>

Example: ./vcl fw new 0xcce493dcb135a19928627a7d5a0df0b1477fbce7 \
accept 0x16c8a21295E68f039B8406d13eE0dc6c3a481C76 function1

The action of the fire wall rules can be either accept or reject.
The * is stand for all account addresses or APIs`,
	}

	FwDeleteCmd = cli.Command{
		Name:      "delete",
		Usage:     "Delete a fire wall rule",
		ArgsUsage: "<address> <action> <account> <api>",
		Action:    fwDelete,
		Flags:     globalCmdFlags,
		Description: `
		vcl fw delete <address> <action> <account> <api>`,
	}

	FwResetCmd = cli.Command{
		Name:      "reset",
		Usage:     "Reset all the fire wall rules of an action",
		ArgsUsage: "<address> <action> <account> <api>",
		Action:    fwReset,
		Flags:     globalCmdFlags,
		Description: `
		vcl fw reset <address> <action> <account> <api>`,
	}

	FwClearCmd = cli.Command{
		Name:      "clear",
		Usage:     "Clear all the fire wall rules of an action",
		ArgsUsage: "<address>",
		Action:    fwClear,
		Flags:     fwClearCmdFlags,
		Description: `
		vcl fw clear <address>`,
	}
)
View Source
var (
	NodeCmd = cli.Command{
		Name:  "node",
		Usage: "Manage nodes in Venachain network",

		Subcommands: []cli.Command{
			NodeAddCmd,
			NodeDeleteCmd,
			NodeQueryCmd,
			NodeStatCmd,
			NodeUpdateCmd,
		},
	}

	NodeAddCmd = cli.Command{
		Name:      "add",
		Usage:     "Add a node to the node list",
		ArgsUsage: "<name> <publicKey> <externalIP> <internalIP> <type>",
		Action:    nodeAdd,
		Flags:     nodeAddCmdFlags,
		Description: `
		vcl admin node add <name> <publicKey> <externalIP> <internalIP>

The newly added nodes can only be observer type.`,
	}

	NodeDeleteCmd = cli.Command{
		Name:      "delete",
		Usage:     "Delete a node from the node list, the deleted node can no longer receiving and synchronizing blocks",
		ArgsUsage: "<name>",
		Action:    nodeDelete,
		Flags:     globalCmdFlags,
		Description: `
		vcl admin node delete <name>`,
	}

	NodeUpdateCmd = cli.Command{
		Name:      "update",
		Usage:     "Update the description, delay number, and node type of a node",
		ArgsUsage: "<name>",
		Action:    nodeUpdate,
		Flags:     nodeUpdateCmdFlags,
		Description: `
		vcl admin node update <name>`,
	}

	NodeQueryCmd = cli.Command{
		Name:   "query",
		Usage:  "Query the node Info by the search key provided",
		Action: nodeQuery,
		Flags:  nodeQueryCmdFlasg,
		Description: `
		vcl admin node query

Except --all flag, other search keys can be combined.`,
	}

	NodeStatCmd = cli.Command{
		Name:   "stat",
		Usage:  "Statistic the node Info by the search key provided",
		Action: nodeStat,
		Flags:  nodeStatCmdFlags,
		Description: `
		vcl admin node stat`,
	}
)
View Source
var (
	//role
	RoleCmd = cli.Command{
		Name:  "role",
		Usage: "Manage role of accounts",
		Subcommands: []cli.Command{
			RoleSetSuperAdmin,
			RoleTransferSuperAdmin,
			RoleAddChainAdmin,
			RoleDelChainAdmin,
			RoleAddGroupAdmin,
			RoleDelGroupAdmin,
			RoleAddNodeAdmin,
			RoleDelNodeAdmin,
			RoleAddContractAdmin,
			RoleDelContractAdmin,
			RoleAddContractDeployer,
			RoleDelContractDeployer,
			RoleGetAddrListOfRole,
			RoleHasRole,
			RoleGetRoles,
		},
	}
	RoleSetSuperAdmin = cli.Command{
		Name:      "setSuperAdmin",
		Usage:     "set the caller to superAdmin",
		ArgsUsage: "",
		Action:    setSuperAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role setSuperAdmin

The caller will be set to superAdmin.`,
	}
	RoleTransferSuperAdmin = cli.Command{
		Name:      "transferSuperAdmin",
		Usage:     "transfer superAdmin to another account",
		ArgsUsage: "<address>",
		Action:    transferSuperAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role transferSuperAdmin <address>

The caller should be a superAdmin, call this function to thransfer super to another`,
	}
	RoleAddChainAdmin = cli.Command{
		Name:      "addChainAdmin",
		Usage:     "add the account to ChainAdmin",
		ArgsUsage: "<address>",
		Action:    addChainAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role addChainAdmin <address>
The caller should be a superAdmin, call this function to add the account to ChainAdmin`,
	}
	RoleDelChainAdmin = cli.Command{
		Name:      "delChainAdmin",
		Usage:     "del the account from ChainAdmin",
		ArgsUsage: "<address>",
		Action:    delChainAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role addChainAdmin <address>
The caller should be a superAdmin, call this function to del the account from ChainAdmin`,
	}
	RoleAddGroupAdmin = cli.Command{
		Name:      "addGroupAdmin",
		Usage:     "add the account to GroupAdmin",
		ArgsUsage: "<address>",
		Action:    addGroupAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role addGroupAdmin <address>
The caller should be a chainAdmin, call this function to add the account to GroupAdmin`,
	}
	RoleDelGroupAdmin = cli.Command{
		Name:      "delGroupAdmin",
		Usage:     "del the account from GroupAdmin",
		ArgsUsage: "<address>",
		Action:    delGroupAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role delGroupAdmin <address>
The caller should be a chainAdmin, call this function to del the account from GroupAdmin`,
	}
	RoleAddNodeAdmin = cli.Command{
		Name:      "addNodeAdmin",
		Usage:     "add the account to NodeAdmin",
		ArgsUsage: "<address>",
		Action:    addNodeAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role addNodeAdmin <address>
The caller should be a chainAdmin, call this function to add the account to NodeAdmin`,
	}
	RoleDelNodeAdmin = cli.Command{
		Name:      "delNodeAdmin",
		Usage:     "del the account from NodeAdmin",
		ArgsUsage: "<address>",
		Action:    delNodeAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role delNodeAdmin <address>
The caller should be a chainAdmin, call this function to delete the account from NodeAdmin`,
	}
	RoleAddContractAdmin = cli.Command{
		Name:      "addContractAdmin",
		Usage:     "add the account to ContractAdmin",
		ArgsUsage: "<address>",
		Action:    addContractAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role addContractAdmin <address>
The caller should be a chainAdmin, call this function to add the account to ContractAdmin`,
	}
	RoleDelContractAdmin = cli.Command{
		Name:      "delContractAdmin",
		Usage:     "del the account from ContractAdmin",
		ArgsUsage: "<address>",
		Action:    delContractAdmin,
		Flags:     roleCmdFlags,
		Description: `
		vcl role delContractAdmin <address>
The caller should be a chainAdmin, call this function to delete the account from ContractAdmin`,
	}
	RoleAddContractDeployer = cli.Command{
		Name:      "addContractDeployer",
		Usage:     "add the account to ContractDeployer",
		ArgsUsage: "<address>",
		Action:    addContractDeployer,
		Flags:     roleCmdFlags,
		Description: `
		vcl role addContractDeployer <address>
The caller should be a chainAdmin or contractAdmin, call this function to add the account to ContractDeployer`,
	}
	RoleDelContractDeployer = cli.Command{
		Name:      "delContractDeployer",
		Usage:     "del the account from ContractDeployer",
		ArgsUsage: "<address>",
		Action:    delContractDeployer,
		Flags:     roleCmdFlags,
		Description: `
		vcl role delContractDeployer <address>
The caller should be a chainAdmin or contractAdmin, call this function to del the account from ContractDeployer`,
	}
	RoleGetAddrListOfRole = cli.Command{
		Name:      "getAddrListOfRole",
		Usage:     "get Address List Of the Role",
		ArgsUsage: "<role>",
		Action:    getAddrListOfRole,
		Flags:     roleCmdFlags,
		Description: `
		vcl role getAddrListOfRole <role>
role can be "SUPER_ADMIN", "CHAIN_ADMIN", "GROUP_ADMIN", "NODE_ADMIN", "CONTRACT_ADMIN" or "CONTRACT_DEPLOYER"`,
	}
	RoleHasRole = cli.Command{
		Name:      "hasRole",
		Usage:     "check if the account has the role",
		ArgsUsage: "<address> <role>",
		Action:    hasRole,
		Flags:     roleCmdFlags,
		Description: `
		vcl role hasRole <address> <role>
role can be "SUPER_ADMIN", "CHAIN_ADMIN", "GROUP_ADMIN", "NODE_ADMIN", "CONTRACT_ADMIN" or "CONTRACT_DEPLOYER"`,
	}
	RoleGetRoles = cli.Command{
		Name:      "getRoles",
		Usage:     "get roles of the account",
		ArgsUsage: "<address>",
		Action:    getRoles,
		Flags:     roleCmdFlags,
		Description: `
		vcl role delContractDeployer <address>
The caller should be a chainAdmin or contractAdmin, call this function to del the account from ContractDeployer`,
	}
)
View Source
var (
	// global flags
	UrlFlags = cli.StringFlag{
		Name: "url",
		Usage: `Specify the remote node IP trying to connect, 
		the url choice will be remembered util the --url flag provided next time
		url format: <ip>:<port>, eg: 127.0.0.1:6791`,
	}
	AccountFlags = cli.StringFlag{
		Name:  "account",
		Usage: "Specify the local or remote account address used to send the message calls",
	}
	ValueFlags = cli.StringFlag{
		Name:  "value",
		Usage: "Specify the transfer count",
	}
	GasFlags = cli.StringFlag{
		Name:  "gas",
		Usage: "Specify the gas allowance for the code execution",
	}
	GasPriceFlags = cli.StringFlag{
		Name:  "gasPrice",
		Usage: "Specify the number of <Token> to simulate paying for each unit of gas during execution",
	}
	LocalFlags = cli.BoolFlag{
		Name: "local",
		Usage: `Use default local account to send the message call, 
		the default local account keystore file locates at "<future feature>"`,
	}
	KeyfileFlags = cli.StringFlag{
		Name:  "keyfile",
		Usage: "Use local account to send the message call by specifying the key file",
	}
	SyncFlags = cli.BoolFlag{
		Name:  "sync",
		Usage: "Wait for the result of polling the Tx Receipt after executing the commands",
	}
	DefaultFlags = cli.BoolFlag{
		Name: "default",
		Usage: `Default the account settings by storing the
		current values of --account, --keyfile, and --local flags  to "./config/config.json"`,
	}

	// transfer
	TransferValueFlag = cli.StringFlag{
		Name:  "value",
		Value: "0x0",
		Usage: "Amount of <Token> to transfer",
	}

	// contract
	ContractParamFlag = cli.StringSliceFlag{
		Name:  "param",
		Usage: "Specify parameters of a contract method if needed, usage: --param \"p1\" --param \"p2\"",
	}
	ContractAbiFilePathFlag = cli.StringFlag{
		Name:  "abi",
		Usage: "Specify the wasm or evm abi file path",
	}
	ContractVmFlags = cli.StringFlag{
		Name:  "vm",
		Value: "wasm",
		Usage: `Choose the virtual machine interpreter for the contract execution and deployment, 
		"wasm" for WebAssembly virtual machine; "evm" for EVM virtual machine,
		The error may occur if the interpreter does not match.`,
	}
	ContractIDFlag = cli.StringFlag{
		Name:  "contract",
		Usage: "Contract name or address",
	}

	// user
	TelFlags = cli.StringFlag{
		Name:  "phone",
		Usage: "The mobile number of a user",
	}
	EmailFlags = cli.StringFlag{
		Name:  "email",
		Usage: "The email address of a user",
	}
	OrganizationFlags = cli.StringFlag{
		Name:  "organization",
		Usage: "The organization of a user",
	}
	UserRemarkFlags = cli.StringFlag{
		Name:  "remark",
		Usage: "User remark info",
	}
	UserIDFlags = cli.StringFlag{
		Name:  "user",
		Usage: "The address or name of a user",
	}
	UserRoleFlag = cli.StringFlag{
		Name:  "role",
		Usage: "A role of a user, e.g. --role <userRole>",
	}
	RolesFlag = cli.StringFlag{
		Name:  "roles",
		Usage: "Register user roles, e.g. --roles '[\"<role1>\",\"<role2>\"]'",
	}
	UserStatusFlag = cli.StringFlag{
		Name:  "status",
		Usage: "Status of a user",
	}

	// node
	NodeP2pPortFlags = cli.StringFlag{
		Name:  "p2pPort",
		Value: "16791",
		Usage: "Specify the node p2p port number",
	}
	NodeRpcPortFlags = cli.StringFlag{
		Name:  "rpcPort",
		Value: "6791",
		Usage: "Specify the node rpc port number",
	}
	NodeDelayNumFlags = cli.StringFlag{
		Name:  "delayNum",
		Usage: "Switch the node type to consensus after <delayNum> numbers of blocks generated",
	}
	NodePublicKeyFlags = cli.StringFlag{
		Name:  "publicKey",
		Usage: "Node's public key for secure p2p communication",
	}
	NodeDescFlags = cli.StringFlag{
		Name:  "desc",
		Usage: "The description of a node",
	}
	NodeTypeFlags = cli.StringFlag{
		Name:  "type",
		Usage: "The node type can be either \"observer\" or \"consensus\"",
	}
	NameFlags = cli.StringFlag{
		Name:  "name",
		Usage: "Node name, the name is unique",
	}
	NodeStatusFlags = cli.StringFlag{
		Name:  "status",
		Usage: "Status of a node: \"valid\" or \"invalid\"",
	}

	// user
	AddressFlags = cli.StringFlag{
		Name:  "addr",
		Usage: "The address of the user registered in the user platform",
	}

	// common?
	ShowAllFlags = cli.BoolFlag{
		Name:  "all",
		Usage: "List all the valid data object",
	}
	FwClearAllFlags = cli.BoolFlag{
		Name:  "all",
		Usage: "Clear the fire wall rules of all actions",
	}

	FilePathFlags = cli.StringFlag{
		Name:  "file",
		Value: defaultFwFilePath,
		Usage: "Specify the fire wall file path to be imported or exported",
	}

	// cns
	CnsVersionFlags = cli.StringFlag{
		Name:  "version",
		Value: "latest",
		Usage: `Specify the version of the cns name. 
		Usage: --version X.X.X.X, where X is number between 0 and 9`,
	}

	// admin
	AdminApproveFlags = cli.BoolFlag{
		Name:  "approve",
		Usage: "list the registration to be approved",
	}

	AdminDeleteFlags = cli.StringFlag{
		Name:  "delete",
		Usage: "list the data object can be deleted",
	}

	//fw
	FwActionFlags = cli.StringFlag{
		Name:  "action",
		Usage: "Specify the fire wall rule action, the fire wall action can be either \"accept\" or \"reject\".",
	}

	ShowContractMethodsFlag = cli.BoolFlag{
		Name:  "methods",
		Usage: "List all the contract methods",
	}

	// page
	PageNumFlags = cli.StringFlag{
		Name:  "pageNum",
		Value: "0",
		Usage: "Can be used with --pageSize, limit the output to the terminal",
	}

	PageSizeFlags = cli.StringFlag{
		Name:  "pageSize",
		Value: "0",
		Usage: "Can be used with --pageNum, limit the output to the terminal",
	}

	// system configurations
	BlockGasLimitFlags = cli.StringFlag{
		Name:  "block-gaslimit",
		Usage: "the gas limit of the block",
	}

	TxGasLimitFlags = cli.StringFlag{
		Name:  "tx-gaslimit",
		Usage: "the gas limit of transactions",
	}

	IsTxUseGasFlags = cli.StringFlag{
		Name: "tx-use-gas",
		Usage: fmt.Sprintf("if transactions use gas, "+
			"'%s' for transactions use gas, '%s' for not", txUseGas, txNotUseGas),
	}

	IsApproveDeployedContractFlags = cli.StringFlag{
		Name: "audit-con",
		Usage: fmt.Sprintf("approve the deployed contracts, "+
			"'%s' for allowing contracts audit, '%s' for not", conAudit, conNotAudit),
	}

	IsCheckContractDeployPermissionFlags = cli.StringFlag{
		Name: "check-perm",
		Usage: fmt.Sprintf("check the sender permission when deploying contracts, "+
			"'%s' for checking permission, '%s' for not", checkPerm, notCheckPerm),
	}

	IsProduceEmptyBlockFlags = cli.StringFlag{
		Name: "empty-block",
		Usage: fmt.Sprintf("consensus produces empty block, "+
			"'%s' for allowing to produce empty block, '%s' for not", prodEmp, notProdEmp),
	}

	GasContractNameFlags = cli.StringFlag{
		Name:  "gas-contract",
		Usage: "register the gas contract by contract name",
	}
	VrfParamsFlags = cli.StringFlag{
		Name:  "vrf-params",
		Usage: "VRF params",
	}

	GetBlockGasLimitFlags = cli.BoolFlag{
		Name:  "block-gaslimit",
		Usage: "the gas limit of the block",
	}

	GetTxGasLimitFlags = cli.BoolFlag{
		Name:  "tx-gaslimit",
		Usage: "the gas limit of transactions",
	}

	GetIsTxUseGasFlags = cli.BoolFlag{
		Name: "tx-use-gas",
		Usage: fmt.Sprintf("if transactions use gas, "+
			"'%s' for transactions use gas, '%s' for not", txUseGas, txNotUseGas),
	}

	GetIsApproveDeployedContractFlags = cli.BoolFlag{
		Name: "audit-con",
		Usage: fmt.Sprintf("approve the deployed contracts, "+
			"'%s' for allowing contracts audit, '%s' for not", conAudit, conNotAudit),
	}

	GetIsCheckContractDeployPermissionFlags = cli.BoolFlag{
		Name: "check-perm",
		Usage: fmt.Sprintf("check the sender permission when deploying contracts, "+
			"'%s' for checking permission, '%s' for not", checkPerm, notCheckPerm),
	}

	GetIsProduceEmptyBlockFlags = cli.BoolFlag{
		Name: "empty-block",
		Usage: fmt.Sprintf("consensus produces empty block, "+
			"'%s' for allowing to produce empty block, '%s' for not", prodEmp, notProdEmp),
	}

	GetGasContractNameFlags = cli.BoolFlag{
		Name:  "gas-contract",
		Usage: "register the gas contract by contract name",
	}

	GetVrfParamsFlags = cli.BoolFlag{
		Name:  "vrf-params",
		Usage: "VRF params",
	}

	// rest
	RestPortFlags = cli.StringFlag{
		Name:  "port",
		Value: ":8000",
		Usage: "Specify the rest server listening port number, e.g. :8000",
	}
)
View Source
var AppHelpFlagGroups = []flagGroup{
	{
		Name: "GLOBAL",
		Flags: []cli.Flag{
			UrlFlags,
			AccountFlags,
			TransferValueFlag,
			GasFlags,
			GasPriceFlags,
			LocalFlags,
			KeyfileFlags,
			SyncFlags,
			DefaultFlags,
		},
	},
	{
		Name:  "COMMON",
		Flags: []cli.Flag{},
	},
	{
		Name: "ACCOUNT",
		Flags: []cli.Flag{
			UserRemarkFlags,
			TelFlags,
			EmailFlags,
			OrganizationFlags,
			AddressFlags,
			UserIDFlags,
			UserRoleFlag,
			RolesFlag,
		},
	},
	{
		Name: "ADMIN",
		Flags: []cli.Flag{
			NodeDescFlags,
			NodeDelayNumFlags,
			NodeTypeFlags,
			NodeP2pPortFlags,
			NodeRpcPortFlags,
			NodePublicKeyFlags,
			NameFlags,

			AdminApproveFlags,
			AdminDeleteFlags,
		},
	},
	{
		Name: "CONTRACT",
		Flags: []cli.Flag{
			ContractParamFlag,
			ContractIDFlag,
			ContractAbiFilePathFlag,
			ContractVmFlags,

			ShowContractMethodsFlag,
		},
	},
	{
		Name: "CNS",
		Flags: []cli.Flag{
			CnsVersionFlags,
		},
	},
	{
		Name: "FIREWALL",
		Flags: []cli.Flag{
			FilePathFlags,
			FwActionFlags,
		},
	},
	{
		Name: "SYSTEM_CONFIG",
		Flags: []cli.Flag{
			BlockGasLimitFlags,
			TxGasLimitFlags,
			IsTxUseGasFlags,
			IsApproveDeployedContractFlags,
			IsCheckContractDeployPermissionFlags,
			IsProduceEmptyBlockFlags,
			GasContractNameFlags,
		},
	},
	{
		Name: "MISC",
	},
}

AppHelpFlagGroups is the application flags, grouped by functionality.

View Source
var AppHelpTemplate = `` /* 637-byte string literal not displayed */

AppHelpTemplate is the test template for the default, global app help topic.

View Source
var (
	SysConfigCmd = cli.Command{
		Name:  "sysconfig",
		Usage: "Manage the system configurations",

		Subcommands: []cli.Command{
			setCfg,
			getCfg,
		},
	}
)

Functions

func ConfigInit

func ConfigInit()

configInit read values from config file

func FuncParse

func FuncParse(funcName string, funcParams []string) (string, []string)

FuncParse wraps the GetFuncNameAndParams it separates the function method name and the parameters

func GetFuncNameAndParams

func GetFuncNameAndParams(funcAndParams string) (string, []string)

GetFuncNameAndParams parse the function params from the input string

func PrintJson

func PrintJson(marshalJson []byte) string

PrintJson reformats the json printing style, easier for users to read

func TrimSpace

func TrimSpace(str string) string

TrimSpace trims all the space in the string

func WriteConfig

func WriteConfig(filePath string, config *Config)

WriteConfigFile writes data into config.json

func WriteConfigFile

func WriteConfigFile(filePath, key, value string)

WriteConfigFile writes data into config.json

Types

type Config

type Config struct {
	Account string `json:"account"` // the address used to send the transaction
	//Gas      string `json:"gas,omitempty"` 		//future feature
	//GasPrice string `json:"gasPrice,omitempty"`
	Url      string `json:"url"`      // the ip address of the remote node
	Keystore string `json:"keystore"` // the path of the keystore file
}

Config store the values from config.json file

func ParseConfigJson

func ParseConfigJson(configPath string) *Config

ParseConfigJson parses the data in config.json to Config object

type ExportFwStatus

type ExportFwStatus struct {
	// ContractAddr common.Address
	// Active       bool
	AcceptedList []state.FwElem
	RejectedList []state.FwElem
}

type UserDescInfo

type UserDescInfo struct {
	Email        string `json:"email,omitempty"`
	Organization string `json:"organization,omitempty"`
	Phone        string `json:"phone,omitempty"`
}

type UserInfo

type UserInfo struct {
	Address  string `json:"address,omitempty,required"`
	Name     string `json:"name,omitempty"`
	DescInfo string `json:"descInfo,omitempty"` // 描述信息,可变更
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL