root

package
v0.5.0-alpha.12-hotfix-2 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	StateVarSchemaVersion = "v"

	StateVarContractRegistry          = "r"
	StateVarDeployPermissionsEnabled  = "a"
	StateVarDeployPermissions         = "p"
	StateVarStateInitialized          = "i"
	StateVarBlockContextSubscriptions = "b"
)

state variables

View Source
const (
	ParamDeployer                     = "dp"
	ParamHname                        = "hn"
	ParamName                         = "nm"
	ParamProgramHash                  = "ph"
	ParamContractRecData              = "dt"
	ParamContractFound                = "cf"
	ParamDescription                  = "ds"
	ParamDeployPermissionsEnabled     = "de"
	ParamStorageDepositAssumptionsBin = "db"
	ParamBlockContextOpenFunc         = "bco"
	ParamBlockContextCloseFunc        = "bcc"
)

param variables

Variables

View Source
var (
	FuncDeployContract           = coreutil.Func("deployContract")
	FuncGrantDeployPermission    = coreutil.Func("grantDeployPermission")
	FuncRevokeDeployPermission   = coreutil.Func("revokeDeployPermission")
	FuncRequireDeployPermissions = coreutil.Func("requireDeployPermissions")
	ViewFindContract             = coreutil.ViewFunc("findContract")
	ViewGetContractRecords       = coreutil.ViewFunc("getContractRecords")
	FuncSubscribeBlockContext    = coreutil.Func("subscribeBlockContext")
)

function names

View Source
var Contract = coreutil.NewContract(coreutil.CoreContractRoot, "Root Contract")
View Source
var ErrChainInitConditionsFailed = coreerrors.Register("root.init can't be called in this state").Create()

Functions

func ContractExists added in v0.3.0

func ContractExists(state kv.KVStoreReader, hname isc.Hname) bool

func DecodeContractRegistry

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

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

func GetContractRegistry added in v0.3.0

func GetContractRegistry(state kv.KVStore) *collections.Map

func GetContractRegistryR added in v0.3.0

func GetContractRegistryR(state kv.KVStoreReader) *collections.ImmutableMap

func GetSchemaVersion

func GetSchemaVersion(state kv.KVStoreReader) uint32

func ParamEVM added in v0.3.0

func ParamEVM(k kv.Key) kv.Key

ParamEVM allows to pass init parameters to the EVM core contract, by decorating them with a prefix. For example:

ParamEVM(evm.FieldBlockKeepAmount)

func SetSchemaVersion added in v1.0.3

func SetSchemaVersion(state kv.KVStore, v uint32)

func SubscribeBlockContext added in v0.3.0

func SubscribeBlockContext(state kv.KVStore, contract, openFunc, closeFunc isc.Hname)

Types

type BlockContextSubscription added in v0.3.0

type BlockContextSubscription struct {
	Contract  isc.Hname
	OpenFunc  isc.Hname
	CloseFunc isc.Hname
}

func GetBlockContextSubscriptions added in v0.3.0

func GetBlockContextSubscriptions(state kv.KVStoreReader) []BlockContextSubscription

GetBlockContextSubscriptions returns all contracts that are subscribed to block context, in deterministic order

func (*BlockContextSubscription) Encode

func (s *BlockContextSubscription) Encode() []byte

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) =  isc.Hn(name)
	Name string
}

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 ContractRecordFromContractInfo added in v0.3.0

func ContractRecordFromContractInfo(itf *coreutil.ContractInfo) *ContractRecord

func ContractRecordFromMarshalUtil added in v0.2.0

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

func FindContract

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

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, nil is returned

func (*ContractRecord) Bytes added in v0.2.0

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

func (*ContractRecord) Hname

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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