foundation

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package foundation server implementation of smartcontract functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call(Reference Reference, MethodName string, Arguments []interface{}) ([]interface{}, error)

Call other contract via network dispatcher

Types

type BaseContract

type BaseContract struct {
	// contains filtered or unexported fields
}

BaseContract is a base class for all contracts.

func (*BaseContract) AddChild

func (bc *BaseContract) AddChild(child BaseContractInterface, class Reference) Reference

AddChild adds child to contract

func (*BaseContract) GetChildrenTyped

func (bc *BaseContract) GetChildrenTyped(r Reference) []BaseContractInterface

GetChildrenTyped returns set of children objects with corresponding type

func (*BaseContract) GetContext

func (bc *BaseContract) GetContext() *CallContext

GetContext returns current calling context of this object. It exists only for currently called contract.

func (*BaseContract) GetImplementationFor

func (bc *BaseContract) GetImplementationFor(r Reference) BaseContractInterface

GetImplementationFor finds delegate typed r in object and returns it unimplemented

func (*BaseContract) MyReference

func (bc *BaseContract) MyReference() Reference

MyReference - Returns public reference of contract

func (*BaseContract) SelfDestructRequest

func (bc *BaseContract) SelfDestructRequest()

SelfDestructRequest contract will be marked as deleted after call finishes

func (*BaseContract) SetContext

func (bc *BaseContract) SetContext(cc *CallContext)

SetContext - do not use it in smartcontracts

func (*BaseContract) TakeDelegate

func (bc *BaseContract) TakeDelegate(delegate BaseContractInterface, class Reference) Reference

TakeDelegate injects delegate to object

type BaseContractInterface

type BaseContractInterface interface {
	MyReference() Reference
	GetImplementationFor(r Reference) BaseContractInterface
	TakeDelegate(delegate BaseContractInterface, class Reference) Reference
}

BaseContractInterface is an interface to deal with any contract same way

func GetImplementationFor

func GetImplementationFor(o Reference, r Reference) BaseContractInterface

GetImplementationFor finds delegate typed r in object and returns it unimplemented

func GetObject

func GetObject(ref Reference) BaseContractInterface

GetObject create proxy by address unimplemented

type CBORMarshaler

type CBORMarshaler interface {
	Marshal(interface{}) []byte
	Unmarshal(interface{}, []byte)
}

CBORMarshaler is a special interface for serializer object

type CallContext

type CallContext struct {
	Me     Reference // My Reference.
	Caller Reference // Reference of calling contract.
	Parent Reference // Reference to parent or container contract.
	Type   Reference // Reference to type record on ledger, we have just one type reference, yet.
	Time   time.Time // Time of Calling side made call.
	Pulse  uint64    // Number of current pulse.
}

CallContext is a context of contract execution

type Reference

type Reference []byte

Reference is an address of something on ledger.

func SaveToLedger

func SaveToLedger(rec BaseContractInterface) Reference

SaveToLedger saves builder to ledger unimplemented

func (Reference) Equal

func (r Reference) Equal(o Reference) bool

Equal is equaler

func (Reference) String

func (r Reference) String() string

String - stringer interface

Jump to

Keyboard shortcuts

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