smartcontract

package
v0.0.0-...-e920dd0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Caller         common.Uint168
	Code           []byte
	Input          []byte
	CodeHash       common.Uint168
	CacheCodeTable interfaces.IScriptTable
	Time           *big.Int
	BlockNumber    *big.Int
	SignableData   SignableData
	StateMachine   ns.StateMachine
	DBCache        database.Batch
	Gas            common.Fixed64
	ReturnType     types.ContractParameterType
	ParameterTypes []types.ContractParameterType
	Trigger        avm.TriggerType
}

type Engine

type Engine interface {
	Create(caller common.Uint168, code []byte) ([]byte, error)
	Call(caller common.Uint168, codeHash common.Uint168, input []byte) ([]byte, error)
}

type SignableData

type SignableData interface {
	interfaces.IDataContainer
	//TODO: add SerializeUnsigned
	SerializeUnsigned(io.Writer) error
}

SignableData describe the data need be signed.

type SmartContract

type SmartContract struct {
	Engine         Engine
	Code           []byte
	Input          []byte
	ParameterTypes []types.ContractParameterType
	Caller         common.Uint168
	CodeHash       common.Uint168
	ReturnType     types.ContractParameterType
}

func NewSmartContract

func NewSmartContract(context *Context) (*SmartContract, error)

func (*SmartContract) DeployContract

func (sc *SmartContract) DeployContract(payload *types.PayloadDeploy) ([]byte, error)

func (*SmartContract) InvokeContract

func (sc *SmartContract) InvokeContract() (interface{}, error)

func (*SmartContract) InvokeParamsTransform

func (sc *SmartContract) InvokeParamsTransform() ([]byte, error)

func (*SmartContract) InvokeResult

func (sc *SmartContract) InvokeResult() (interface{}, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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