state

package
v0.91.1-pre Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 15 Imported by: 41

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppExecResult

type AppExecResult struct {
	TxHash      util.Uint256
	Trigger     trigger.Type
	VMState     vm.State
	GasConsumed int64
	Stack       []stackitem.Item
	Events      []NotificationEvent
}

AppExecResult represent the result of the script execution, gathering together all resulting notifications, state, stack and other metadata.

func (*AppExecResult) DecodeBinary

func (aer *AppExecResult) DecodeBinary(r *io.BinReader)

DecodeBinary implements the Serializable interface.

func (*AppExecResult) EncodeBinary

func (aer *AppExecResult) EncodeBinary(w *io.BinWriter)

EncodeBinary implements the Serializable interface.

type Coin

type Coin uint8

Coin represents the state of a coin.

const (
	CoinConfirmed Coin = 0
	CoinSpent     Coin = 1 << 1
	CoinClaimed   Coin = 1 << 2
	CoinFrozen    Coin = 1 << 5
)

Viable Coin constants.

type Contract

type Contract struct {
	ID       int32
	Script   []byte
	Manifest manifest.Manifest
	// contains filtered or unexported fields
}

Contract holds information about a smart contract in the NEO blockchain.

func (*Contract) DecodeBinary

func (cs *Contract) DecodeBinary(br *io.BinReader)

DecodeBinary implements Serializable interface.

func (*Contract) EncodeBinary

func (cs *Contract) EncodeBinary(bw *io.BinWriter)

EncodeBinary implements Serializable interface.

func (*Contract) HasStorage

func (cs *Contract) HasStorage() bool

HasStorage checks whether the contract has storage property set.

func (*Contract) IsPayable

func (cs *Contract) IsPayable() bool

IsPayable checks whether the contract has payable property set.

func (*Contract) MarshalJSON added in v0.90.0

func (cs *Contract) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Contract) ScriptHash

func (cs *Contract) ScriptHash() util.Uint160

ScriptHash returns a contract script hash.

func (*Contract) UnmarshalJSON added in v0.90.0

func (cs *Contract) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type MPTRoot added in v0.76.0

type MPTRoot struct {
	MPTRootBase
	Witness *transaction.Witness `json:"witness,omitempty"`
}

MPTRoot represents storage state root together with sign info.

func (*MPTRoot) DecodeBinary added in v0.76.0

func (s *MPTRoot) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable.

func (*MPTRoot) EncodeBinary added in v0.76.0

func (s *MPTRoot) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable.

type MPTRootBase added in v0.76.0

type MPTRootBase struct {
	Version  byte         `json:"version"`
	Index    uint32       `json:"index"`
	PrevHash util.Uint256 `json:"prehash"`
	Root     util.Uint256 `json:"stateroot"`
}

MPTRootBase represents storage state root.

func (*MPTRootBase) DecodeBinary added in v0.76.0

func (s *MPTRootBase) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable.

func (*MPTRootBase) EncodeBinary added in v0.76.0

func (s *MPTRootBase) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable.

func (*MPTRootBase) Equals added in v0.76.0

func (s *MPTRootBase) Equals(other *MPTRootBase) bool

Equals checks if s == other.

func (*MPTRootBase) GetSignedPart added in v0.76.0

func (s *MPTRootBase) GetSignedPart() []byte

GetSignedPart returns part of MPTRootBase which needs to be signed.

func (*MPTRootBase) Hash added in v0.76.0

func (s *MPTRootBase) Hash() util.Uint256

Hash returns hash of s.

type MPTRootState added in v0.76.0

type MPTRootState struct {
	MPTRoot `json:"stateroot"`
	Flag    MPTRootStateFlag `json:"flag"`
}

MPTRootState represents state root together with its verification state.

func (*MPTRootState) DecodeBinary added in v0.76.0

func (s *MPTRootState) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable.

func (*MPTRootState) EncodeBinary added in v0.76.0

func (s *MPTRootState) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable.

type MPTRootStateFlag added in v0.76.0

type MPTRootStateFlag byte

MPTRootStateFlag represents verification state of the state root.

const (
	Unverified MPTRootStateFlag = 0x00
	Verified   MPTRootStateFlag = 0x01
	Invalid    MPTRootStateFlag = 0x03
)

Possible verification states of MPTRoot.

func (MPTRootStateFlag) MarshalJSON added in v0.76.0

func (f MPTRootStateFlag) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (MPTRootStateFlag) String added in v0.76.0

func (f MPTRootStateFlag) String() string

String implements fmt.Stringer.

func (*MPTRootStateFlag) UnmarshalJSON added in v0.76.0

func (f *MPTRootStateFlag) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type NEOBalanceState added in v0.90.0

type NEOBalanceState struct {
	NEP5BalanceState
	BalanceHeight uint32
	VoteTo        *keys.PublicKey
}

NEOBalanceState represents balance state of a NEO-token.

func NEOBalanceStateFromBytes added in v0.90.0

func NEOBalanceStateFromBytes(b []byte) (*NEOBalanceState, error)

NEOBalanceStateFromBytes converts serialized NEOBalanceState to structure.

func (*NEOBalanceState) Bytes added in v0.90.0

func (s *NEOBalanceState) Bytes() []byte

Bytes returns serialized NEOBalanceState.

func (*NEOBalanceState) DecodeBinary added in v0.90.0

func (s *NEOBalanceState) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*NEOBalanceState) EncodeBinary added in v0.90.0

func (s *NEOBalanceState) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

type NEP5BalanceState added in v0.90.0

type NEP5BalanceState struct {
	Balance big.Int
}

NEP5BalanceState represents balance state of a NEP5-token.

func NEP5BalanceStateFromBytes added in v0.90.0

func NEP5BalanceStateFromBytes(b []byte) (*NEP5BalanceState, error)

NEP5BalanceStateFromBytes converts serialized NEP5BalanceState to structure.

func (*NEP5BalanceState) Bytes added in v0.90.0

func (s *NEP5BalanceState) Bytes() []byte

Bytes returns serialized NEP5BalanceState.

func (*NEP5BalanceState) DecodeBinary added in v0.90.0

func (s *NEP5BalanceState) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*NEP5BalanceState) EncodeBinary added in v0.90.0

func (s *NEP5BalanceState) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

type NEP5Balances

type NEP5Balances struct {
	Trackers map[int32]NEP5Tracker
	// NextTransferBatch stores an index of the next transfer batch.
	NextTransferBatch uint32
}

NEP5Balances is a map of the NEP5 contract IDs to the corresponding structures.

func NewNEP5Balances

func NewNEP5Balances() *NEP5Balances

NewNEP5Balances returns new NEP5Balances.

func (*NEP5Balances) DecodeBinary

func (bs *NEP5Balances) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*NEP5Balances) EncodeBinary

func (bs *NEP5Balances) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

type NEP5Tracker

type NEP5Tracker struct {
	// Balance is the current balance of the account.
	Balance big.Int
	// LastUpdatedBlock is a number of block when last `transfer` to or from the
	// account occurred.
	LastUpdatedBlock uint32
}

NEP5Tracker contains info about a single account in a NEP5 contract.

func (*NEP5Tracker) DecodeBinary

func (t *NEP5Tracker) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*NEP5Tracker) EncodeBinary

func (t *NEP5Tracker) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

type NEP5Transfer

type NEP5Transfer struct {
	// Asset is a NEP5 contract ID.
	Asset int32
	// Address is the address of the sender.
	From util.Uint160
	// To is the address of the receiver.
	To util.Uint160
	// Amount is the amount of tokens transferred.
	// It is negative when tokens are sent and positive if they are received.
	Amount big.Int
	// Block is a number of block when the event occurred.
	Block uint32
	// Timestamp is the timestamp of the block where transfer occurred.
	Timestamp uint64
	// Tx is a hash the transaction.
	Tx util.Uint256
}

NEP5Transfer represents a single NEP5 Transfer event.

func (*NEP5Transfer) DecodeBinary

func (t *NEP5Transfer) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable interface.

func (*NEP5Transfer) DecodeBinaryReturnCount added in v0.90.0

func (t *NEP5Transfer) DecodeBinaryReturnCount(r *io.BinReader) int

DecodeBinaryReturnCount decodes NEP5Transfer and returns the number of bytes read.

func (*NEP5Transfer) EncodeBinary

func (t *NEP5Transfer) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable interface.

type NEP5TransferLog

type NEP5TransferLog struct {
	Raw []byte
	// contains filtered or unexported fields
}

NEP5TransferLog is a log of NEP5 token transfers for the specific command.

func (*NEP5TransferLog) Append

func (lg *NEP5TransferLog) Append(tr *NEP5Transfer) error

Append appends single transfer to a log.

func (*NEP5TransferLog) ForEach

func (lg *NEP5TransferLog) ForEach(f func(*NEP5Transfer) error) error

ForEach iterates over transfer log returning on first error.

func (*NEP5TransferLog) Size

func (lg *NEP5TransferLog) Size() int

Size returns an amount of transfer written in log.

type NotificationEvent

type NotificationEvent struct {
	ScriptHash util.Uint160
	Name       string
	Item       *stackitem.Array
}

NotificationEvent is a tuple of scripthash that emitted the Item as a notification and that item itself.

func (*NotificationEvent) DecodeBinary

func (ne *NotificationEvent) DecodeBinary(r *io.BinReader)

DecodeBinary implements the Serializable interface.

func (*NotificationEvent) EncodeBinary

func (ne *NotificationEvent) EncodeBinary(w *io.BinWriter)

EncodeBinary implements the Serializable interface.

type StorageItem

type StorageItem struct {
	Value   []byte
	IsConst bool
}

StorageItem is the value to be stored with read-only flag.

func (*StorageItem) DecodeBinary

func (si *StorageItem) DecodeBinary(r *io.BinReader)

DecodeBinary implements Serializable interface.

func (*StorageItem) EncodeBinary

func (si *StorageItem) EncodeBinary(w *io.BinWriter)

EncodeBinary implements Serializable interface.

type Validator

type Validator struct {
	Key   *keys.PublicKey
	Votes *big.Int
}

Validator holds the state of a validator (its key and votes balance).

Jump to

Keyboard shortcuts

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