monitor

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: GPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChanInfoState_Null            uint8 = 0
	ChanInfoState_CaughtWithdraw  uint8 = 1
	ChanInfoState_GuardedWithdraw uint8 = 2
	ChanInfoState_CaughtSettle    uint8 = 3
	ChanInfoState_GuardedSettle   uint8 = 4
)

Variables

View Source
var (
	PullerKeyPrefix  = []byte{0x01} // Key prefix for puller
	GuardKeyPrefix   = []byte{0x02} // Key prefix for guard
	PenaltyKeyPrefix = []byte{0x03} // Key prefix for penalty
)

Functions

func GetGuardKey added in v0.2.0

func GetGuardKey(cid mainchain.CidType, simplexReceiver mainchain.Addr) []byte

get guard key from mainchain txHash

func GetPenaltyKey

func GetPenaltyKey(nonce uint64) []byte

get penalty key from nonce

func GetPullerKey

func GetPullerKey(eLog ethtypes.Log) []byte

get puller key from mainchain txHash

func MonitorTendermintEvent added in v0.2.4

func MonitorTendermintEvent(nodeURI, eventTag string, handleEvent func(event abci.Event))

func NewMonitor added in v0.2.0

func NewMonitor(operator *Operator, db dbm.DB)

Types

type ChanInfo added in v0.2.0

type ChanInfo struct {
	Cid             mainchain.CidType
	SimplexReceiver mainchain.Addr
	SeqNum          uint64
	State           uint8
}

type EventName

type EventName string
const (
	UpdateSidechainAddr    EventName = "UpdateSidechainAddr"
	AddSubscriptionBalance EventName = "AddSubscriptionBalance"
	ConfirmParamProposal   EventName = "ConfirmParamProposal"
	UpdateDelegatedStake   EventName = "UpdateDelegatedStake"
	CandidateUnbonded      EventName = "CandidateUnbonded"
	ValidatorChange        EventName = "ValidatorChange"
	UpdateCommissionRate   EventName = "UpdateCommissionRate"
	IntendSettle           EventName = "IntendSettle"
	IntendWithdraw         EventName = "IntendWithdraw"
	IntendWithdrawChannel  EventName = "IntendWithdrawChannel"
)

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) interface{}

type Monitor added in v0.2.0

type Monitor struct {
	*Operator
	// contains filtered or unexported fields
}

type MonitorContractInfo added in v0.2.0

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

func NewMonitorContractInfo added in v0.2.0

func NewMonitorContractInfo(address mainchain.Addr, abi string) *MonitorContractInfo

func (*MonitorContractInfo) GetABI added in v0.2.0

func (info *MonitorContractInfo) GetABI() string

func (*MonitorContractInfo) GetAddr added in v0.2.0

func (info *MonitorContractInfo) GetAddr() mainchain.Addr

type Operator added in v0.2.3

type Operator struct {
	EthClient  *mainchain.EthClient
	Transactor *transactor.Transactor
}

func NewOperator added in v0.2.3

func NewOperator(cdc *codec.Codec, cliHome string) (operator *Operator, err error)

func (*Operator) SyncDelegator added in v0.2.3

func (o *Operator) SyncDelegator(candidatorAddr, delegatorAddr mainchain.Addr)

func (*Operator) SyncSubscriptionBalance added in v0.2.3

func (o *Operator) SyncSubscriptionBalance(consumerAddr mainchain.Addr)

func (*Operator) SyncUpdateSidechainAddr added in v0.2.3

func (o *Operator) SyncUpdateSidechainAddr(candidateAddr mainchain.Addr)

func (*Operator) SyncValidator added in v0.2.3

func (o *Operator) SyncValidator(candidateAddr mainchain.Addr) bool

return true if already updated or no need for retry

type PenaltyEvent

type PenaltyEvent struct {
	Nonce      uint64 `json:"nonce"`
	RetryCount uint64 `json:"retry_count"`
}

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

Jump to

Keyboard shortcuts

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