common

package
v0.0.0-...-fb4f826 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UINT16_SIZE = 2
	UINT32_SIZE = 4
	UINT64_SIZE = 8
)

Variables

View Source
var ErrIrregularData = errors.New("irregular data")

Functions

func SafeAdd

func SafeAdd(x, y uint64) (uint64, bool)

func SerializeToBytes

func SerializeToBytes(values ...Serializable) []byte

Types

type Serializable

type Serializable interface {
	Serialization(sink *ZeroCopySink)
}

type StorageLog

type StorageLog struct {
	// Consensus fields:
	// address of the contract that generated the event
	Address ethcomm.Address `json:"address"`
	// list of topics provided by the contract.
	Topics []ethcomm.Hash `json:"topics"`
	// supplied by the contract, usually ABI-encoded
	Data []byte `json:"data"`
}

StorageLog represents a contract log event. These events are generated by the LOG opcode and stored/indexed by the node.

func (*StorageLog) Deserialization

func (self *StorageLog) Deserialization(source *ZeroCopySource) error

func (*StorageLog) Serialization

func (self *StorageLog) Serialization(sink *ZeroCopySink)

type ZeroCopySink

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

func NewZeroCopySink

func NewZeroCopySink(b []byte) *ZeroCopySink

NewZeroCopySink returns a new ZeroCopySink reading from b.

func (*ZeroCopySink) BackUp

func (self *ZeroCopySink) BackUp(n uint64)

func (*ZeroCopySink) Bytes

func (self *ZeroCopySink) Bytes() []byte

func (*ZeroCopySink) NextBytes

func (self *ZeroCopySink) NextBytes(n uint64) (data []byte)

func (*ZeroCopySink) Reset

func (self *ZeroCopySink) Reset()

func (*ZeroCopySink) Size

func (self *ZeroCopySink) Size() uint64

func (*ZeroCopySink) WriteAddress

func (self *ZeroCopySink) WriteAddress(addr ethcomm.Address)

func (*ZeroCopySink) WriteBool

func (self *ZeroCopySink) WriteBool(data bool)

func (*ZeroCopySink) WriteByte

func (self *ZeroCopySink) WriteByte(c byte)

func (*ZeroCopySink) WriteBytes

func (self *ZeroCopySink) WriteBytes(p []byte)

func (*ZeroCopySink) WriteHash

func (self *ZeroCopySink) WriteHash(hash ethcomm.Hash)

func (*ZeroCopySink) WriteInt16

func (self *ZeroCopySink) WriteInt16(data int16)

func (*ZeroCopySink) WriteInt32

func (self *ZeroCopySink) WriteInt32(data int32)

func (*ZeroCopySink) WriteInt64

func (self *ZeroCopySink) WriteInt64(data int64)

func (*ZeroCopySink) WriteString

func (self *ZeroCopySink) WriteString(data string) (size uint64)

func (*ZeroCopySink) WriteUint16

func (self *ZeroCopySink) WriteUint16(data uint16)

func (*ZeroCopySink) WriteUint32

func (self *ZeroCopySink) WriteUint32(data uint32)

func (*ZeroCopySink) WriteUint64

func (self *ZeroCopySink) WriteUint64(data uint64) *ZeroCopySink

func (*ZeroCopySink) WriteUint8

func (self *ZeroCopySink) WriteUint8(data uint8)

func (*ZeroCopySink) WriteVarBytes

func (self *ZeroCopySink) WriteVarBytes(data []byte) (size uint64)

func (*ZeroCopySink) WriteVarUint

func (self *ZeroCopySink) WriteVarUint(data uint64) (size uint64)

type ZeroCopySource

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

func NewZeroCopySource

func NewZeroCopySource(b []byte) *ZeroCopySource

NewZeroCopySource returns a new ZeroCopySource reading from b.

func (*ZeroCopySource) Len

func (self *ZeroCopySource) Len() uint64

Len returns the number of bytes of the unread portion of the slice.

func (*ZeroCopySource) NextAddress

func (self *ZeroCopySource) NextAddress() (data common.Address, eof bool)

func (*ZeroCopySource) NextBool

func (self *ZeroCopySource) NextBool() (data bool, irregular bool, eof bool)

func (*ZeroCopySource) NextByte

func (self *ZeroCopySource) NextByte() (data byte, eof bool)

func (*ZeroCopySource) NextBytes

func (self *ZeroCopySource) NextBytes(n uint64) (data []byte, eof bool)

func (*ZeroCopySource) NextHash

func (self *ZeroCopySource) NextHash() (data common.Hash, eof bool)

func (*ZeroCopySource) NextInt16

func (self *ZeroCopySource) NextInt16() (data int16, eof bool)

func (*ZeroCopySource) NextInt32

func (self *ZeroCopySource) NextInt32() (data int32, eof bool)

func (*ZeroCopySource) NextInt64

func (self *ZeroCopySource) NextInt64() (data int64, eof bool)

func (*ZeroCopySource) NextString

func (self *ZeroCopySource) NextString() (data string, size uint64, irregular bool, eof bool)

func (*ZeroCopySource) NextUint16

func (self *ZeroCopySource) NextUint16() (data uint16, eof bool)

func (*ZeroCopySource) NextUint32

func (self *ZeroCopySource) NextUint32() (data uint32, eof bool)

func (*ZeroCopySource) NextUint64

func (self *ZeroCopySource) NextUint64() (data uint64, eof bool)

func (*ZeroCopySource) NextUint8

func (self *ZeroCopySource) NextUint8() (data uint8, eof bool)

func (*ZeroCopySource) NextVarBytes

func (self *ZeroCopySource) NextVarBytes() (data []byte, size uint64, irregular bool, eof bool)

func (*ZeroCopySource) NextVarUint

func (self *ZeroCopySource) NextVarUint() (data uint64, size uint64, irregular bool, eof bool)

func (*ZeroCopySource) Pos

func (self *ZeroCopySource) Pos() uint64

func (*ZeroCopySource) ReadString

func (self *ZeroCopySource) ReadString() (string, error)

func (*ZeroCopySource) ReadUint32

func (self *ZeroCopySource) ReadUint32() (data uint32, err error)

func (*ZeroCopySource) ReadUint64

func (self *ZeroCopySource) ReadUint64() (data uint64, err error)

func (*ZeroCopySource) ReadVarBytes

func (self *ZeroCopySource) ReadVarBytes() (data []byte, err error)

func (*ZeroCopySource) ReadVarUint

func (self *ZeroCopySource) ReadVarUint() (uint64, error)

func (*ZeroCopySource) Size

func (self *ZeroCopySource) Size() uint64

Size returns the original length of the underlying byte slice. Size is the number of bytes available for reading via ReadAt. The returned value is always the same and is not affected by calls to any other method.

Jump to

Keyboard shortcuts

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