monitor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventKeyPrefix = []byte{0x01} // Key prefix for event

	PullerKeyPrefix = []byte{0x02} // Key prefix for puller

	PusherKeyPrefix = []byte{0x03} // Key prefix for pusher

	PenaltyKeyPrefix = []byte{0x04} // Key prefix for penalty
)

Functions

func GetEventKey

func GetEventKey(log types.Log) []byte

get event key from log

func GetPenaltyKey

func GetPenaltyKey(nonce uint64) []byte

get penalty key from nonce

func GetPullerKey

func GetPullerKey(log types.Log) []byte

get puller key from log

func GetPusherKey

func GetPusherKey(log types.Log) []byte

get pusher key from log

func NewEthMonitor

func NewEthMonitor(ethClient *mainchain.EthClient, operator, blockSyncer *transactor.Transactor)

Types

type EthMonitor

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

type EventName

type EventName string
const (
	InitializeCandidate EventName = "InitializeCandidate"
	Delegate            EventName = "Delegate"
	ValidatorChange     EventName = "ValidatorChange"
	IntendWithdraw      EventName = "IntendWithdraw"
	IntendSettle        EventName = "IntendSettle"
)

type EventWrapper

type EventWrapper struct {
	Name EventName `json:"name"`
	Log  types.Log `json:"log"`
}

Wrapper for ethereum Event

func NewEvent

func NewEvent(name EventName, l types.Log) EventWrapper

func NewEventFromBytes

func NewEventFromBytes(input []byte) EventWrapper

func (EventWrapper) MustMarshal

func (e EventWrapper) MustMarshal() []byte

Marshal event into json bytes

func (*EventWrapper) MustUnMarshal

func (e *EventWrapper) MustUnMarshal(input []byte)

Unmarshal json bytes to event

func (EventWrapper) ParseEvent

func (e EventWrapper) ParseEvent(ethClient *mainchain.EthClient) (res interface{})

type PenaltyEvent

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

func NewPenaltyEvent

func NewPenaltyEvent(nonce uint64) PenaltyEvent

func NewPenaltyEventFromBytes

func NewPenaltyEventFromBytes(input []byte) PenaltyEvent

func (PenaltyEvent) MustMarshal

func (e PenaltyEvent) MustMarshal() []byte

Marshal event into json bytes

func (*PenaltyEvent) MustUnMarshal

func (e *PenaltyEvent) MustUnMarshal(input []byte)

Unmarshal json bytes to penalty event

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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