root

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0, BSD-2-Clause Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	VarContractRegistry         = "r"
	VarDeployPermissionsEnabled = "a"
	VarDeployPermissions        = "p"
	VarStateInitialized         = "i"
)

state variables

View Source
const (
	ParamDeployer                 = "dp"
	ParamHname                    = "hn"
	ParamName                     = "nm"
	ParamProgramHash              = "ph"
	ParamContractRecData          = "dt"
	ParamContractFound            = "cf"
	ParamDescription              = "ds"
	ParamDeployPermissionsEnabled = "de"
)

param variables

Variables

View Source
var (
	Contract            = coreutil.NewContract(coreutil.CoreContractRoot, "Root Contract")
	ErrContractNotFound = errors.New("smart contract not found")
)
View Source
var (
	FuncDeployContract           = coreutil.Func("deployContract")
	FuncGrantDeployPermission    = coreutil.Func("grantDeployPermission")
	FuncRevokeDeployPermission   = coreutil.Func("revokeDeployPermission")
	FuncRequireDeployPermissions = coreutil.Func("requireDeployPermissions")
	FuncFindContract             = coreutil.ViewFunc("findContract")
	FuncGetContractRecords       = coreutil.ViewFunc("getContractRecords")
)

function names

Functions

func DecodeContractRegistry

func DecodeContractRegistry(contractRegistry *collections.ImmutableMap) (map[iscp.Hname]*ContractRecord, error)

DecodeContractRegistry encodes the whole contract registry from the map into a Go map.

Types

type ContractRecord

type ContractRecord struct {
	// The ProgramHash uniquely defines the program of the smart contract
	// It is interpreted either as one of builtin contracts (including examples)
	// or a hash (reference) to the of the blob in 'blob' contract in the 'program binary' format,
	// i.e. with at least 2 pre-defined fields:
	//  - VarFieldVType
	//  - VarFieldProgramBinary
	ProgramHash hashing.HashValue
	// Description of the instance
	Description string
	// Unique name of the contract on the chain. The real identity of the instance on the chain
	// is hname(name) =  iscp.Hn(name)
	Name string
	// The agentID of the entity which deployed the instance. It can be interpreted as
	// an priviledged user of the instance, however it is up to the smart contract.
	Creator *iscp.AgentID
}

ContractRecord is a structure which contains metadata of the deployed contract instance

func ContractRecordFromBytes added in v0.2.0

func ContractRecordFromBytes(data []byte) (*ContractRecord, error)

func ContractRecordFromMarshalUtil added in v0.2.0

func ContractRecordFromMarshalUtil(mu *marshalutil.MarshalUtil) (*ContractRecord, error)

func FindContract

func FindContract(state kv.KVStoreReader, hname iscp.Hname) (*ContractRecord, bool)

FindContract is an internal utility function which finds a contract in the KVStore It is called from within the 'root' contract as well as VMContext and viewcontext objects It is not directly exposed to the sandbox If contract is not found by the given hname, the default contract is returned the bool flag indicates if contract was found or not. It means, if hname == 0 it will return default contract and true

func NewContractRecord

func NewContractRecord(itf *coreutil.ContractInfo, creator *iscp.AgentID) *ContractRecord

func (*ContractRecord) Bytes added in v0.2.0

func (p *ContractRecord) Bytes() []byte

func (*ContractRecord) HasCreator

func (p *ContractRecord) HasCreator() bool

func (*ContractRecord) Hname

func (p *ContractRecord) Hname() iscp.Hname

Directories

Path Synopsis
'root' a core contract on the chain.
'root' a core contract on the chain.

Jump to

Keyboard shortcuts

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