state

package
v0.97.3 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 21 Imported by: 38

Documentation

Index

Constants

View Source
const NEP17TransferBatchSize = 128

NEP17TransferBatchSize is the maximum number of entries for NEP17TransferLog.

Variables

This section is empty.

Functions

func CreateContractHash added in v0.92.0

func CreateContractHash(sender util.Uint160, checksum uint32, name string) util.Uint160

CreateContractHash creates deployed contract hash from transaction sender and contract script.

Types

type AppExecResult

type AppExecResult struct {
	Container util.Uint256
	Execution
}

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.

func (*AppExecResult) MarshalJSON added in v0.92.0

func (aer *AppExecResult) MarshalJSON() ([]byte, error)

MarshalJSON implements implements json.Marshaler interface.

func (*AppExecResult) UnmarshalJSON added in v0.92.0

func (aer *AppExecResult) UnmarshalJSON(data []byte) error

UnmarshalJSON implements implements json.Unmarshaler interface.

type Contract

type Contract struct {
	ContractBase
	UpdateCounter uint16 `json:"updatecounter"`
}

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

func (*Contract) FromStackItem added in v0.92.0

func (c *Contract) FromStackItem(item stackitem.Item) error

FromStackItem fills Contract's data from given stack itemized contract representation.

func (*Contract) ToStackItem added in v0.92.0

func (c *Contract) ToStackItem() (stackitem.Item, error)

ToStackItem converts state.Contract to stackitem.Item.

type ContractBase added in v0.93.0

type ContractBase struct {
	ID       int32             `json:"id"`
	Hash     util.Uint160      `json:"hash"`
	NEF      nef.File          `json:"nef"`
	Manifest manifest.Manifest `json:"manifest"`
}

ContractBase represents part shared by native and user-deployed contracts.

type Deposit added in v0.92.0

type Deposit struct {
	Amount *big.Int
	Till   uint32
}

Deposit represents GAS deposit from Notary contract.

func (*Deposit) FromStackItem added in v0.96.0

func (d *Deposit) FromStackItem(it stackitem.Item) error

FromStackItem implements stackitem.Convertible interface.

func (*Deposit) ToStackItem added in v0.96.0

func (d *Deposit) ToStackItem() (stackitem.Item, error)

ToStackItem implements stackitem.Convertible interface. It never returns an error.

type Execution added in v0.92.0

type Execution struct {
	Trigger        trigger.Type
	VMState        vm.State
	GasConsumed    int64
	Stack          []stackitem.Item
	Events         []NotificationEvent
	FaultException string
}

Execution represents the result of a single script execution, gathering together all resulting notifications, state, stack and other metadata.

func (Execution) MarshalJSON added in v0.92.0

func (e Execution) MarshalJSON() ([]byte, error)

MarshalJSON implements implements json.Marshaler interface.

func (*Execution) UnmarshalJSON added in v0.92.0

func (e *Execution) UnmarshalJSON(data []byte) error

UnmarshalJSON implements implements json.Unmarshaler interface.

type MPTRoot added in v0.76.0

type MPTRoot struct {
	Version byte                  `json:"version"`
	Index   uint32                `json:"index"`
	Root    util.Uint256          `json:"roothash"`
	Witness []transaction.Witness `json:"witnesses"`
}

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) DecodeBinaryUnsigned added in v0.94.0

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

DecodeBinaryUnsigned decodes hashable part of state root.

func (*MPTRoot) EncodeBinary added in v0.76.0

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

EncodeBinary implements io.Serializable.

func (*MPTRoot) EncodeBinaryUnsigned added in v0.94.0

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

EncodeBinaryUnsigned encodes hashable part of state root..

func (*MPTRoot) Hash added in v0.94.0

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

Hash returns hash of s.

type NEOBalance added in v0.96.0

type NEOBalance struct {
	NEP17Balance
	BalanceHeight uint32
	VoteTo        *keys.PublicKey
}

NEOBalance represents balance state of a NEO-token.

func NEOBalanceFromBytes added in v0.96.0

func NEOBalanceFromBytes(b []byte) (*NEOBalance, error)

NEOBalanceFromBytes converts serialized NEOBalance to structure.

func (*NEOBalance) Bytes added in v0.96.0

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

Bytes returns serialized NEOBalance.

func (*NEOBalance) FromStackItem added in v0.96.0

func (s *NEOBalance) FromStackItem(item stackitem.Item) error

FromStackItem converts stackitem.Item to NEOBalance.

func (*NEOBalance) ToStackItem added in v0.96.0

func (s *NEOBalance) ToStackItem() (stackitem.Item, error)

ToStackItem implements stackitem.Convertible interface. It never returns an error.

type NEP17Balance added in v0.96.0

type NEP17Balance struct {
	Balance big.Int
}

NEP17Balance represents balance state of a NEP17-token.

func NEP17BalanceFromBytes added in v0.96.0

func NEP17BalanceFromBytes(b []byte) (*NEP17Balance, error)

NEP17BalanceFromBytes converts serialized NEP17Balance to structure.

func (*NEP17Balance) Bytes added in v0.96.0

func (s *NEP17Balance) Bytes(buf []byte) []byte

Bytes returns serialized NEP17Balance.

func (*NEP17Balance) FromStackItem added in v0.96.0

func (s *NEP17Balance) FromStackItem(item stackitem.Item) error

FromStackItem implements stackitem.Convertible.

func (*NEP17Balance) ToStackItem added in v0.96.0

func (s *NEP17Balance) ToStackItem() (stackitem.Item, error)

ToStackItem implements stackitem.Convertible. It never returns an error.

type NEP17Transfer added in v0.92.0

type NEP17Transfer struct {
	// Asset is a NEP17 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
}

NEP17Transfer represents a single NEP17 Transfer event.

func (*NEP17Transfer) DecodeBinary added in v0.92.0

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

DecodeBinary implements io.Serializable interface.

func (*NEP17Transfer) EncodeBinary added in v0.92.0

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

EncodeBinary implements io.Serializable interface.

type NEP17TransferInfo added in v0.97.1

type NEP17TransferInfo struct {
	LastUpdated map[int32]uint32
	// NextTransferBatch stores an index of the next transfer batch.
	NextTransferBatch uint32
	// NewBatch is true if batch with the `NextTransferBatch` index should be created.
	NewBatch bool
}

NEP17TransferInfo stores map of the NEP17 contract IDs to the balance's last updated block trackers along with information about NEP17 transfer batch.

func NewNEP17TransferInfo added in v0.97.1

func NewNEP17TransferInfo() *NEP17TransferInfo

NewNEP17TransferInfo returns new NEP17TransferInfo.

func (*NEP17TransferInfo) DecodeBinary added in v0.97.1

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

DecodeBinary implements io.Serializable interface.

func (*NEP17TransferInfo) EncodeBinary added in v0.97.1

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

EncodeBinary implements io.Serializable interface.

type NEP17TransferLog added in v0.92.0

type NEP17TransferLog struct {
	Raw []byte
}

NEP17TransferLog is a log of NEP17 token transfers for the specific command.

func (*NEP17TransferLog) Append added in v0.92.0

func (lg *NEP17TransferLog) Append(tr *NEP17Transfer) error

Append appends single transfer to a log.

func (*NEP17TransferLog) ForEach added in v0.92.0

func (lg *NEP17TransferLog) ForEach(f func(*NEP17Transfer) (bool, error)) (bool, error)

ForEach iterates over transfer log returning on first error.

func (*NEP17TransferLog) Size added in v0.92.0

func (lg *NEP17TransferLog) Size() int

Size returns an amount of transfer written in log.

type NativeContract added in v0.93.0

type NativeContract struct {
	ContractBase
	UpdateHistory []uint32 `json:"updatehistory"`
}

NativeContract holds information about native contract.

type NotificationEvent

type NotificationEvent struct {
	ScriptHash util.Uint160     `json:"contract"`
	Name       string           `json:"eventname"`
	Item       *stackitem.Array `json:"state"`
}

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.

func (NotificationEvent) MarshalJSON added in v0.92.0

func (ne NotificationEvent) MarshalJSON() ([]byte, error)

MarshalJSON implements implements json.Marshaler interface.

func (*NotificationEvent) UnmarshalJSON added in v0.92.0

func (ne *NotificationEvent) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler interface.

type OracleRequest added in v0.92.0

type OracleRequest struct {
	OriginalTxID     util.Uint256
	GasForResponse   uint64
	URL              string
	Filter           *string
	CallbackContract util.Uint160
	CallbackMethod   string
	UserData         []byte
}

OracleRequest represents oracle request.

func (*OracleRequest) FromStackItem added in v0.96.0

func (o *OracleRequest) FromStackItem(it stackitem.Item) error

FromStackItem implements stackitem.Convertible interface.

func (*OracleRequest) ToStackItem added in v0.96.0

func (o *OracleRequest) ToStackItem() (stackitem.Item, error)

ToStackItem implements stackitem.Convertible interface. It never returns an error.

type StorageItem

type StorageItem []byte

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

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