Versions in this module Expand all Collapse all v1 v1.0.2 Jan 27, 2022 v1.0.1 Dec 1, 2021 Changes in this version + const DefaultCap + const MaxContractCallDepth + var ErrNotImplementation = errors.New("not implementation") + var ErrOutOfDiskLimit = errors.New("out of disk limit") + func AmountBytesToString(buf []byte) string + func ContractCodeDescKey(contractName string) []byte + func Register(tp ContractType, name string, driver NewInstanceCreatorFunc) + type Context struct + Args map[string][]byte + AuthRequire []string + Caller string + CanInitialize bool + ContractName string + ContractSet map[string]bool + Core contract.ChainCore + Events []*protos.ContractEvent + ID int64 + Initiator string + Instance Instance + Logger logs.Logger + Method string + Module string + Output *pb.Response + ResourceLimits contract.Limits + State contract.StateSandbox + SubResourceUsed contract.Limits + TransferAmount string + func (c *Context) DiskUsed() int64 + func (c *Context) ExceedDiskLimit() bool + func (c *Context) GetAuthRequire() []string + func (c *Context) GetInitiator() string + func (c *Context) ResourceUsed() contract.Limits + type ContextManager struct + func NewContextManager() *ContextManager + func (n *ContextManager) Context(id int64) (*Context, bool) + func (n *ContextManager) DestroyContext(ctx *Context) + func (n *ContextManager) MakeContext() *Context + type ContractCodeProvider interface + GetContractAbi func(name string) ([]byte, error) + GetContractCode func(name string) ([]byte, error) + GetContractCodeDesc func(name string) (*protos.WasmCodeDesc, error) + type ContractError struct + Message string + Status int + func (c *ContractError) Error() string + type ContractType string + const TypeEvm + const TypeKernel + const TypeNative + const TypeWasm + type Instance interface + Abort func(msg string) + Exec func() error + Release func() + ResourceUsed func() contract.Limits + type InstanceCreator interface + CreateInstance func(ctx *Context, cp ContractCodeProvider) (Instance, error) + RemoveCache func(name string) + func Open(tp ContractType, name string, config *InstanceCreatorConfig) (InstanceCreator, error) + type InstanceCreatorConfig struct + Basedir string + SyscallService *SyscallService + VMConfig VMConfig + type NewInstanceCreatorFunc func(config *InstanceCreatorConfig) (InstanceCreator, error) + type SyscallService struct + func NewSyscallService(ctxmgr *ContextManager, bridge *XBridge) *SyscallService + func (c *SyscallService) ContractCall(ctx context.Context, in *pb.ContractCallRequest) (*pb.ContractCallResponse, error) + func (c *SyscallService) CrossContractQuery(ctx context.Context, in *pb.CrossContractQueryRequest) (*pb.CrossContractQueryResponse, error) + func (c *SyscallService) DeleteObject(ctx context.Context, in *pb.DeleteRequest) (*pb.DeleteResponse, error) + func (c *SyscallService) EmitEvent(ctx context.Context, in *pb.EmitEventRequest) (*pb.EmitEventResponse, error) + func (c *SyscallService) GetAccountAddresses(ctx context.Context, in *pb.GetAccountAddressesRequest) (*pb.GetAccountAddressesResponse, error) + func (c *SyscallService) GetCallArgs(ctx context.Context, in *pb.GetCallArgsRequest) (*pb.CallArgs, error) + func (c *SyscallService) GetObject(ctx context.Context, in *pb.GetRequest) (*pb.GetResponse, error) + func (c *SyscallService) NewIterator(ctx context.Context, in *pb.IteratorRequest) (*pb.IteratorResponse, error) + func (c *SyscallService) Ping(ctx context.Context, in *pb.PingRequest) (*pb.PingResponse, error) + func (c *SyscallService) PostLog(ctx context.Context, in *pb.PostLogRequest) (*pb.PostLogResponse, error) + func (c *SyscallService) PutObject(ctx context.Context, in *pb.PutRequest) (*pb.PutResponse, error) + func (c *SyscallService) QueryBlock(ctx context.Context, in *pb.QueryBlockRequest) (*pb.QueryBlockResponse, error) + func (c *SyscallService) QueryTx(ctx context.Context, in *pb.QueryTxRequest) (*pb.QueryTxResponse, error) + func (c *SyscallService) SetOutput(ctx context.Context, in *pb.SetOutputRequest) (*pb.SetOutputResponse, error) + func (c *SyscallService) Transfer(ctx context.Context, in *pb.TransferRequest) (*pb.TransferResponse, error) + type VMConfig interface + DriverName func() string + IsEnable func() bool + type XBridge struct + func New(cfg *XBridgeConfig) (*XBridge, error) + func (c XBridge) DeployContract(kctx contract.KContext) (*contract.Response, contract.Limits, error) + func (c XBridge) UpgradeContract(kctx contract.KContext) (*contract.Response, contract.Limits, error) + func (v *XBridge) NewContext(ctxCfg *contract.ContextConfig) (contract.Context, error) + type XBridgeConfig struct + Basedir string + Config contract.ContractConfig + Core contract.ChainCore + LogDriver logs.Logger + VMConfigs map[ContractType]VMConfig + XModel ledger.XMReader