events

package
v0.0.0-...-f6bc33c Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 15 Imported by: 0

README

Event bus

Add a new event

  1. Create a protobuf message to describe your event in the proto folder.
  2. Register your event in BusEventType enum and BusEvent.event message in proto/events.proto.
  3. Generate the code with make proto.
  4. In events/bus.go, create a constant to identify the event and map it to the protobuf enum type BusEventType in variable protoMap and toProto. Give it a name in eventStrings.
  5. In the events folder, create a file my_event.go where the Golang definition of the new event will live:
type MyEvent struct {
	*Base
	o proto.MyEvent
}
  1. Implement the StreamEvent interface on it.
  2. Implement the "FromStream interface on it.
  3. Add the support for this new event into the Service responsible for it.
  4. Update the graphql structures in the data-node in schema.graphql. In particular the BusEventType enum and the Event union

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnsupportedEvent = errors.New("unknown payload for event")
	ErrInvalidEventType = errors.New("invalid proto event type")
)

Functions

func GetMarketIDFilter

func GetMarketIDFilter(mID string) func(Event) bool

func GetPartyAndMarketFilter

func GetPartyAndMarketFilter(mID, pID string) func(Event) bool

func GetPartyIDFilter

func GetPartyIDFilter(pID string) func(Event) bool

Types

type Acc

type Acc struct {
	*Base
	// contains filtered or unexported fields
}

func AccountEventFromStream

func AccountEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Acc

func NewAccountEvent

func NewAccountEvent(ctx context.Context, a types.Account) *Acc

func (*Acc) Account

func (a *Acc) Account() ptypes.Account

func (Acc) IsParty

func (a Acc) IsParty(id string) bool

func (Acc) MarketID

func (a Acc) MarketID() string

func (Acc) PartyID

func (a Acc) PartyID() string

func (Acc) Proto

func (a Acc) Proto() ptypes.Account

func (Acc) StreamMessage

func (a Acc) StreamMessage() *eventspb.BusEvent

type Asset

type Asset struct {
	*Base
	// contains filtered or unexported fields
}

func AssetEventFromStream

func AssetEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Asset

func NewAssetEvent

func NewAssetEvent(ctx context.Context, a types.Asset) *Asset

func (*Asset) Asset

func (a *Asset) Asset() proto.Asset

func (Asset) Proto

func (a Asset) Proto() proto.Asset

func (Asset) StreamMessage

func (a Asset) StreamMessage() *eventspb.BusEvent

type Auction

type Auction struct {
	*Base
	// contains filtered or unexported fields
}

func AuctionEventFromStream

func AuctionEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Auction

func NewAuctionEvent

func NewAuctionEvent(ctx context.Context, marketID string, leave bool, start, stop int64, triggers ...types.AuctionTrigger) *Auction

NewAuctionEvent creates a new auction event object.

func (Auction) Auction

func (a Auction) Auction() bool

Auction returns the action performed (either true=leave auction, or false=entering auction).

func (Auction) MarketEvent

func (a Auction) MarketEvent() string

MarketEvent - implement market event interface so we can log this event.

func (Auction) MarketID

func (a Auction) MarketID() string

func (Auction) Proto

func (a Auction) Proto() eventspb.AuctionEvent

Proto wrap event data in a proto message.

func (Auction) StreamMarketMessage

func (a Auction) StreamMarketMessage() *eventspb.BusEvent

StreamMarketMessage - allows for this event to be streamed as just a market event containing just market ID and a string akin to a log message.

func (Auction) StreamMessage

func (a Auction) StreamMessage() *eventspb.BusEvent

StreamMessage returns the BusEvent message for the event stream API.

type Base

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

Base common denominator all event-bus events share.

func (Base) BlockNr

func (b Base) BlockNr() int64

BlockNr returns the current block number.

func (Base) ChainID

func (b Base) ChainID() string

func (Base) CompositeCount

func (b Base) CompositeCount() uint64

CompositeCount on the base event will default to 1.

func (Base) Context

func (b Base) Context() context.Context

Context returns context.

func (Base) Sequence

func (b Base) Sequence() uint64

Sequence returns event sequence number.

func (*Base) SetSequenceID

func (b *Base) SetSequenceID(s uint64)

func (Base) TraceID

func (b Base) TraceID() string

TraceID returns the... traceID obviously.

func (Base) TxHash

func (b Base) TxHash() string

func (Base) Type

func (b Base) Type() Type

Type returns the event type.

type BeginBlock

type BeginBlock struct {
	*Base
	// contains filtered or unexported fields
}

func BeginBlockEventFromStream

func BeginBlockEventFromStream(ctx context.Context, be *eventspb.BusEvent) *BeginBlock

func NewBeginBlock

func NewBeginBlock(ctx context.Context, bb eventspb.BeginBlock) *BeginBlock

NewTime returns a new time Update event.

func (BeginBlock) BeginBlock

func (b BeginBlock) BeginBlock() eventspb.BeginBlock

Time returns the new blocktime.

func (BeginBlock) Proto

func (b BeginBlock) Proto() eventspb.BeginBlock

func (BeginBlock) StreamMessage

func (b BeginBlock) StreamMessage() *eventspb.BusEvent

type Checkpoint

type Checkpoint struct {
	*Base
	// contains filtered or unexported fields
}

func CheckpointEventFromStream

func CheckpointEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Checkpoint

func NewCheckpointEvent

func NewCheckpointEvent(ctx context.Context, snap *types.CheckpointState) *Checkpoint

func (Checkpoint) Proto

func (Checkpoint) StreamMessage

func (e Checkpoint) StreamMessage() *eventspb.BusEvent

type DelegationBalance

type DelegationBalance struct {
	*Base
	Party    string
	NodeID   string
	Amount   *num.Uint
	EpochSeq string
}

func DelegationBalanceEventFromStream

func DelegationBalanceEventFromStream(ctx context.Context, be *eventspb.BusEvent) *DelegationBalance

func NewDelegationBalance

func NewDelegationBalance(ctx context.Context, party, nodeID string, amount *num.Uint, epochSeq string) *DelegationBalance

func (DelegationBalance) Proto

func (DelegationBalance) StreamMessage

func (db DelegationBalance) StreamMessage() *eventspb.BusEvent

type Deposit

type Deposit struct {
	*Base
	// contains filtered or unexported fields
}

func DepositEventFromStream

func DepositEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Deposit

func NewDepositEvent

func NewDepositEvent(ctx context.Context, d types.Deposit) *Deposit

func (*Deposit) Deposit

func (d *Deposit) Deposit() proto.Deposit

func (Deposit) IsParty

func (d Deposit) IsParty(id string) bool

func (Deposit) PartyID

func (d Deposit) PartyID() string

func (Deposit) Proto

func (d Deposit) Proto() proto.Deposit

func (Deposit) StreamMessage

func (d Deposit) StreamMessage() *eventspb.BusEvent

type DistressedOrders

type DistressedOrders struct {
	*Base
	// contains filtered or unexported fields
}

DistressedOrders contains the market and parties that needed to have their orders closed in order to maintain their open positions on the market.

func DistressedOrdersEventFromStream

func DistressedOrdersEventFromStream(ctx context.Context, be *eventspb.BusEvent) *DistressedOrders

func NewDistressedOrdersEvent

func NewDistressedOrdersEvent(ctx context.Context, marketID string, parties []string) *DistressedOrders

func (DistressedOrders) IsMarket

func (d DistressedOrders) IsMarket(marketID string) bool

func (DistressedOrders) IsParty

func (d DistressedOrders) IsParty(partyID string) bool

func (DistressedOrders) MarketID

func (d DistressedOrders) MarketID() string

func (DistressedOrders) Parties

func (d DistressedOrders) Parties() []string

func (DistressedOrders) Proto

func (DistressedOrders) StreamMarketMessage

func (d DistressedOrders) StreamMarketMessage() *eventspb.BusEvent

func (DistressedOrders) StreamMessage

func (d DistressedOrders) StreamMessage() *eventspb.BusEvent

type DistressedPositions

type DistressedPositions struct {
	*Base
	// contains filtered or unexported fields
}

DistressedPositions contains the market and parties that needed to have their orders closed in order to maintain their open positions on the market.

func DistressedPositionsEventFromStream

func DistressedPositionsEventFromStream(ctx context.Context, be *eventspb.BusEvent) *DistressedPositions

func NewDistressedPositionsEvent

func NewDistressedPositionsEvent(ctx context.Context, marketID string, dParties, sParties []string) *DistressedPositions

func (*DistressedPositions) AddDistressedParties

func (d *DistressedPositions) AddDistressedParties(parties ...string)

func (*DistressedPositions) AddSafeParties

func (d *DistressedPositions) AddSafeParties(parties ...string)

func (DistressedPositions) DistressedParties

func (d DistressedPositions) DistressedParties() []string

func (DistressedPositions) IsDistressedParty

func (d DistressedPositions) IsDistressedParty(p string) bool

func (DistressedPositions) IsMarket

func (d DistressedPositions) IsMarket(marketID string) bool

func (DistressedPositions) IsParty

func (d DistressedPositions) IsParty(partyID string) bool

func (DistressedPositions) IsSafeParty

func (d DistressedPositions) IsSafeParty(p string) bool

func (DistressedPositions) MarketID

func (d DistressedPositions) MarketID() string

func (DistressedPositions) Proto

func (DistressedPositions) SafeParties

func (d DistressedPositions) SafeParties() []string

func (DistressedPositions) StreamMarketMessage

func (d DistressedPositions) StreamMarketMessage() *eventspb.BusEvent

func (DistressedPositions) StreamMessage

func (d DistressedPositions) StreamMessage() *eventspb.BusEvent

type ERC20MultiSigSigner

type ERC20MultiSigSigner struct {
	*Base
	// contains filtered or unexported fields
}

func ERC20MultiSigSignerFromStream

func ERC20MultiSigSignerFromStream(ctx context.Context, be *eventspb.BusEvent) *ERC20MultiSigSigner

func NewERC20MultiSigSigner

func NewERC20MultiSigSigner(ctx context.Context, evt types.SignerEvent) *ERC20MultiSigSigner

func (ERC20MultiSigSigner) ERC20MultiSigSigner

func (s ERC20MultiSigSigner) ERC20MultiSigSigner() eventspb.ERC20MultiSigSignerEvent

func (ERC20MultiSigSigner) Proto

func (ERC20MultiSigSigner) StreamMessage

func (s ERC20MultiSigSigner) StreamMessage() *eventspb.BusEvent

type ERC20MultiSigSignerAdded

type ERC20MultiSigSignerAdded struct {
	*Base
	// contains filtered or unexported fields
}

func ERC20MultiSigSignerAddedFromStream

func ERC20MultiSigSignerAddedFromStream(ctx context.Context, be *eventspb.BusEvent) *ERC20MultiSigSignerAdded

func (ERC20MultiSigSignerAdded) ERC20MultiSigSignerAdded

func (s ERC20MultiSigSignerAdded) ERC20MultiSigSignerAdded() eventspb.ERC20MultiSigSignerAdded

func (ERC20MultiSigSignerAdded) Proto

func (ERC20MultiSigSignerAdded) StreamMessage

func (s ERC20MultiSigSignerAdded) StreamMessage() *eventspb.BusEvent

type ERC20MultiSigSignerRemoved

type ERC20MultiSigSignerRemoved struct {
	*Base
	// contains filtered or unexported fields
}

func ERC20MultiSigSignerRemovedFromStream

func ERC20MultiSigSignerRemovedFromStream(ctx context.Context, be *eventspb.BusEvent) *ERC20MultiSigSignerRemoved

func (ERC20MultiSigSignerRemoved) ERC20MultiSigSignerRemoved

func (s ERC20MultiSigSignerRemoved) ERC20MultiSigSignerRemoved() eventspb.ERC20MultiSigSignerRemoved

func (ERC20MultiSigSignerRemoved) Proto

func (ERC20MultiSigSignerRemoved) StreamMessage

func (s ERC20MultiSigSignerRemoved) StreamMessage() *eventspb.BusEvent

type ERC20MultiSigThresholdSet

type ERC20MultiSigThresholdSet struct {
	*Base
	// contains filtered or unexported fields
}

func ERC20MultiSigThresholdSetFromStream

func ERC20MultiSigThresholdSetFromStream(ctx context.Context, be *eventspb.BusEvent) *ERC20MultiSigThresholdSet

func (ERC20MultiSigThresholdSet) ERC20MultiSigThresholdSet

func (ERC20MultiSigThresholdSet) Proto

func (ERC20MultiSigThresholdSet) StreamMessage

func (s ERC20MultiSigThresholdSet) StreamMessage() *eventspb.BusEvent

type EndBlock

type EndBlock struct {
	*Base
	// contains filtered or unexported fields
}

func EndBlockEventFromStream

func EndBlockEventFromStream(ctx context.Context, be *eventspb.BusEvent) *EndBlock

func NewEndBlock

func NewEndBlock(ctx context.Context, bb eventspb.EndBlock) *EndBlock

NewTime returns a new time Update event.

func (EndBlock) EndBlock

func (e EndBlock) EndBlock() eventspb.EndBlock

Time returns the new blocktime.

func (EndBlock) Proto

func (e EndBlock) Proto() eventspb.EndBlock

func (EndBlock) StreamMessage

func (e EndBlock) StreamMessage() *eventspb.BusEvent

type EpochEvent

type EpochEvent struct {
	*Base
	// contains filtered or unexported fields
}

func EpochEventFromStream

func EpochEventFromStream(ctx context.Context, be *eventspb.BusEvent) *EpochEvent

func NewEpochEvent

func NewEpochEvent(ctx context.Context, e *types.Epoch) *EpochEvent

func (*EpochEvent) Epoch

func (e *EpochEvent) Epoch() *eventspb.EpochEvent

func (EpochEvent) Proto

func (e EpochEvent) Proto() eventspb.EpochEvent

func (EpochEvent) StreamMessage

func (e EpochEvent) StreamMessage() *eventspb.BusEvent

type EthereumKeyRotation

type EthereumKeyRotation struct {
	*Base
	NodeID      string
	OldAddr     string
	NewAddr     string
	BlockHeight uint64
}

EthereumKeyRotation ...

func EthereumKeyRotationEventFromStream

func EthereumKeyRotationEventFromStream(ctx context.Context, be *eventspb.BusEvent) *EthereumKeyRotation

func NewEthereumKeyRotationEvent

func NewEthereumKeyRotationEvent(
	ctx context.Context,
	nodeID string,
	oldAddr string,
	newAddr string,
	blockHeight uint64,
) *EthereumKeyRotation

func (EthereumKeyRotation) EthereumKeyRotation

func (kr EthereumKeyRotation) EthereumKeyRotation() eventspb.EthereumKeyRotation

func (EthereumKeyRotation) Proto

func (EthereumKeyRotation) StreamMessage

func (kr EthereumKeyRotation) StreamMessage() *eventspb.BusEvent

type Event

type Event interface {
	Type() Type
	Context() context.Context
	TraceID() string
	TxHash() string
	ChainID() string
	Sequence() uint64
	SetSequenceID(s uint64)
	BlockNr() int64
	StreamMessage() *eventspb.BusEvent
	// used for events like ExpiredOrders. It is used to increment the sequence ID by the number of records
	// this event will produce to ensure history tables using time + sequence number to function properly.
	CompositeCount() uint64
}

Event - the base event interface type, add sequence ID setter here, because the type assertions in broker seem to be a bottleneck. Change its behaviour so as to only set the sequence ID once.

type ExpiredOrders

type ExpiredOrders struct {
	*Base
	// contains filtered or unexported fields
}

ExpiredOrders contains the market and parties that needed to have their orders closed in order to maintain their open positions on the market.

func ExpiredOrdersEventFromStream

func ExpiredOrdersEventFromStream(ctx context.Context, be *eventspb.BusEvent) *ExpiredOrders

func NewExpiredOrdersEvent

func NewExpiredOrdersEvent(ctx context.Context, marketID string, orders []string) *ExpiredOrders

func (ExpiredOrders) CompositeCount

func (d ExpiredOrders) CompositeCount() uint64

func (ExpiredOrders) IsMarket

func (d ExpiredOrders) IsMarket(marketID string) bool

func (ExpiredOrders) MarketID

func (d ExpiredOrders) MarketID() string

func (ExpiredOrders) OrderIDs

func (d ExpiredOrders) OrderIDs() []string

func (ExpiredOrders) Proto

func (ExpiredOrders) StreamMarketMessage

func (d ExpiredOrders) StreamMarketMessage() *eventspb.BusEvent

func (ExpiredOrders) StreamMessage

func (d ExpiredOrders) StreamMessage() *eventspb.BusEvent

type FeesTransfer

type FeesTransfer interface {
	// The list of transfers to be made by the collateral
	Transfers() []*types.Transfer
	// The total amount of fees to be paid (all cumulated)
	// per party if all the  transfers are to be executed
	// map is party id -> total amount of fees to be transferred
	TotalFeesAmountPerParty() map[string]*num.Uint
}

FeeTransfer is a transfer initiated after trade occurs.

type KeyRotation

type KeyRotation struct {
	*Base
	NodeID      string
	OldPubKey   string
	NewPubKey   string
	BlockHeight uint64
}

KeyRotation ...

func KeyRotationEventFromStream

func KeyRotationEventFromStream(ctx context.Context, be *eventspb.BusEvent) *KeyRotation

func NewZetaKeyRotationEvent

func NewZetaKeyRotationEvent(
	ctx context.Context,
	nodeID string,
	oldPubKey string,
	newPubKey string,
	blockHeight uint64,
) *KeyRotation

func (KeyRotation) KeyRotation

func (kr KeyRotation) KeyRotation() eventspb.KeyRotation

func (KeyRotation) Proto

func (kr KeyRotation) Proto() eventspb.KeyRotation

func (KeyRotation) StreamMessage

func (kr KeyRotation) StreamMessage() *eventspb.BusEvent

type LedgerMovements

type LedgerMovements struct {
	*Base
	// contains filtered or unexported fields
}

func NewLedgerMovements

func NewLedgerMovements(ctx context.Context, ledgerMovements []*types.LedgerMovement) *LedgerMovements

NewLedgerMovements returns an event with transfer responses - this is the replacement of the transfer buffer.

func TransferResponseEventFromStream

func TransferResponseEventFromStream(ctx context.Context, be *eventspb.BusEvent) *LedgerMovements

func (*LedgerMovements) IsParty

func (t *LedgerMovements) IsParty(id string) bool

func (*LedgerMovements) LedgerMovements

func (t *LedgerMovements) LedgerMovements() []*ptypes.LedgerMovement

LedgerMovements returns the actual event payload.

func (*LedgerMovements) Proto

func (*LedgerMovements) StreamMessage

func (t *LedgerMovements) StreamMessage() *eventspb.BusEvent

type LiquidityProvision

type LiquidityProvision struct {
	*Base
	// contains filtered or unexported fields
}

func LiquidityProvisionEventFromStream

func LiquidityProvisionEventFromStream(ctx context.Context, be *eventspb.BusEvent) *LiquidityProvision

func (LiquidityProvision) IsParty

func (p LiquidityProvision) IsParty(id string) bool

func (LiquidityProvision) LiquidityProvision

func (p LiquidityProvision) LiquidityProvision() *proto.LiquidityProvision

func (LiquidityProvision) MarketID

func (p LiquidityProvision) MarketID() string

func (LiquidityProvision) PartyID

func (p LiquidityProvision) PartyID() string

func (LiquidityProvision) Proto

func (LiquidityProvision) StreamMessage

func (p LiquidityProvision) StreamMessage() *eventspb.BusEvent

type LossSoc

type LossSoc struct {
	*Base
	// contains filtered or unexported fields
}

func LossSocializationEventFromStream

func LossSocializationEventFromStream(ctx context.Context, be *eventspb.BusEvent) *LossSoc

func NewLossSocializationEvent

func NewLossSocializationEvent(ctx context.Context, partyID, marketID string, amount *num.Uint, neg bool, ts int64) *LossSoc

func (LossSoc) Amount

func (l LossSoc) Amount() *num.Int

func (LossSoc) IsParty

func (l LossSoc) IsParty(id string) bool

func (LossSoc) MarketID

func (l LossSoc) MarketID() string

func (LossSoc) Negative

func (l LossSoc) Negative() bool

func (LossSoc) PartyID

func (l LossSoc) PartyID() string

func (LossSoc) Proto

func (LossSoc) StreamMessage

func (l LossSoc) StreamMessage() *eventspb.BusEvent

func (LossSoc) Timestamp

func (l LossSoc) Timestamp() int64

type LossSocialization

type LossSocialization interface {
	MarketID() string
	PartyID() string
	AmountLost() int64
}

LossSocialization ...

type Margin

type Margin interface {
	MarketPosition
	Asset() string
	MarginBalance() *num.Uint
	GeneralBalance() *num.Uint
	BondBalance() *num.Uint
	MarketID() string
	MarginShortFall() *num.Uint
}

Margin is an event with a change to balances after settling e.g. MTM.

type MarginLevels

type MarginLevels struct {
	*Base
	// contains filtered or unexported fields
}

MarginLevels - the margin levels event.

func MarginLevelsEventFromStream

func MarginLevelsEventFromStream(ctx context.Context, be *eventspb.BusEvent) *MarginLevels

func NewMarginLevelsEvent

func NewMarginLevelsEvent(ctx context.Context, l types.MarginLevels) *MarginLevels

func (MarginLevels) Asset

func (m MarginLevels) Asset() string

func (MarginLevels) IsParty

func (m MarginLevels) IsParty(id string) bool

func (MarginLevels) MarginLevels

func (m MarginLevels) MarginLevels() proto.MarginLevels

func (MarginLevels) MarketID

func (m MarginLevels) MarketID() string

func (MarginLevels) PartyID

func (m MarginLevels) PartyID() string

func (MarginLevels) Proto

func (m MarginLevels) Proto() proto.MarginLevels

func (MarginLevels) StreamMessage

func (m MarginLevels) StreamMessage() *eventspb.BusEvent

type MarketCreated

type MarketCreated struct {
	*Base
	// contains filtered or unexported fields
}

func MarketCreatedEventFromStream

func MarketCreatedEventFromStream(ctx context.Context, be *eventspb.BusEvent) *MarketCreated

func NewMarketCreatedEvent

func NewMarketCreatedEvent(ctx context.Context, m types.Market) *MarketCreated

func (MarketCreated) Market

func (m MarketCreated) Market() proto.Market

func (MarketCreated) MarketEvent

func (m MarketCreated) MarketEvent() string

MarketEvent -> is needs to be logged as a market event.

func (MarketCreated) MarketID

func (m MarketCreated) MarketID() string

func (MarketCreated) MarketProto

func (m MarketCreated) MarketProto() eventspb.MarketEvent

func (MarketCreated) Proto

func (m MarketCreated) Proto() proto.Market

func (MarketCreated) StreamMarketMessage

func (m MarketCreated) StreamMarketMessage() *eventspb.BusEvent

func (MarketCreated) StreamMessage

func (m MarketCreated) StreamMessage() *eventspb.BusEvent

type MarketData

type MarketData struct {
	*Base
	// contains filtered or unexported fields
}

func MarketDataEventFromStream

func MarketDataEventFromStream(ctx context.Context, be *eventspb.BusEvent) *MarketData

func NewMarketDataEvent

func NewMarketDataEvent(ctx context.Context, md types.MarketData) *MarketData

func (MarketData) MarketData

func (m MarketData) MarketData() proto.MarketData

func (MarketData) MarketID

func (m MarketData) MarketID() string

func (MarketData) Proto

func (m MarketData) Proto() proto.MarketData

func (MarketData) StreamMessage

func (m MarketData) StreamMessage() *eventspb.BusEvent

type MarketPosition

type MarketPosition interface {
	Party() string
	Size() int64
	Buy() int64
	Sell() int64
	Price() *num.Uint
	BuySumProduct() *num.Uint
	SellSumProduct() *num.Uint
	VWBuy() *num.Uint
	VWSell() *num.Uint
}

MarketPosition is an event with a change to a position.

type MarketTick

type MarketTick struct {
	*Base
	// contains filtered or unexported fields
}

func MarketTickEventFromStream

func MarketTickEventFromStream(ctx context.Context, be *eventspb.BusEvent) *MarketTick

func NewMarketTick

func NewMarketTick(ctx context.Context, id string, t time.Time) *MarketTick

func (MarketTick) MarketEvent

func (m MarketTick) MarketEvent() string

func (MarketTick) MarketID

func (m MarketTick) MarketID() string

func (MarketTick) MarketProto

func (m MarketTick) MarketProto() eventspb.MarketEvent

func (MarketTick) Proto

func (m MarketTick) Proto() eventspb.MarketTick

func (MarketTick) StreamMarketMessage

func (m MarketTick) StreamMarketMessage() *eventspb.BusEvent

func (MarketTick) StreamMessage

func (m MarketTick) StreamMessage() *eventspb.BusEvent

func (MarketTick) Time

func (m MarketTick) Time() time.Time

type MarketUpdated

type MarketUpdated struct {
	*Base
	// contains filtered or unexported fields
}

func MarketUpdatedEventFromStream

func MarketUpdatedEventFromStream(ctx context.Context, be *eventspb.BusEvent) *MarketUpdated

func NewMarketUpdatedEvent

func NewMarketUpdatedEvent(ctx context.Context, m types.Market) *MarketUpdated

func (MarketUpdated) Market

func (m MarketUpdated) Market() proto.Market

func (MarketUpdated) MarketEvent

func (m MarketUpdated) MarketEvent() string

MarketEvent -> is needs to be logged as a market event.

func (MarketUpdated) MarketID

func (m MarketUpdated) MarketID() string

func (MarketUpdated) MarketProto

func (m MarketUpdated) MarketProto() eventspb.MarketEvent

func (MarketUpdated) Proto

func (m MarketUpdated) Proto() proto.Market

func (MarketUpdated) StreamMarketMessage

func (m MarketUpdated) StreamMarketMessage() *eventspb.BusEvent

func (MarketUpdated) StreamMessage

func (m MarketUpdated) StreamMessage() *eventspb.BusEvent

type NetworkLimits

type NetworkLimits struct {
	*Base
	// contains filtered or unexported fields
}

func NetworkLimitsEventFromStream

func NetworkLimitsEventFromStream(ctx context.Context, be *eventspb.BusEvent) *NetworkLimits

func NewNetworkLimitsEvent

func NewNetworkLimitsEvent(ctx context.Context, limits *proto.NetworkLimits) *NetworkLimits

func (*NetworkLimits) NetworkLimits

func (n *NetworkLimits) NetworkLimits() *proto.NetworkLimits

func (NetworkLimits) Proto

func (n NetworkLimits) Proto() *proto.NetworkLimits

func (NetworkLimits) StreamMessage

func (n NetworkLimits) StreamMessage() *eventspb.BusEvent

type NetworkParameter

type NetworkParameter struct {
	*Base
	// contains filtered or unexported fields
}

func NetworkParameterEventFromStream

func NetworkParameterEventFromStream(ctx context.Context, be *eventspb.BusEvent) *NetworkParameter

func NewNetworkParameterEvent

func NewNetworkParameterEvent(ctx context.Context, key, value string) *NetworkParameter

func (*NetworkParameter) NetworkParameter

func (n *NetworkParameter) NetworkParameter() proto.NetworkParameter

func (NetworkParameter) Proto

func (NetworkParameter) StreamMessage

func (n NetworkParameter) StreamMessage() *eventspb.BusEvent

type NodeSignature

type NodeSignature struct {
	*Base
	// contains filtered or unexported fields
}

NodeSignature ...

func NewNodeSignatureEvent

func NewNodeSignatureEvent(ctx context.Context, e commandspb.NodeSignature) *NodeSignature

func NodeSignatureEventFromStream

func NodeSignatureEventFromStream(ctx context.Context, be *eventspb.BusEvent) *NodeSignature

func (NodeSignature) NodeSignature

func (n NodeSignature) NodeSignature() commandspb.NodeSignature

func (NodeSignature) Proto

func (NodeSignature) StreamMessage

func (n NodeSignature) StreamMessage() *eventspb.BusEvent

type OracleData

type OracleData struct {
	*Base
	// contains filtered or unexported fields
}

func NewOracleDataEvent

func NewOracleDataEvent(ctx context.Context, spec zetapb.OracleData) *OracleData

func OracleDataEventFromStream

func OracleDataEventFromStream(ctx context.Context, be *eventspb.BusEvent) *OracleData

func (*OracleData) OracleData

func (o *OracleData) OracleData() zetapb.OracleData

func (OracleData) Proto

func (o OracleData) Proto() zetapb.OracleData

func (OracleData) StreamMessage

func (o OracleData) StreamMessage() *eventspb.BusEvent

type OracleSpec

type OracleSpec struct {
	*Base
	// contains filtered or unexported fields
}

func NewOracleSpecEvent

func NewOracleSpecEvent(ctx context.Context, spec zetapb.OracleSpec) *OracleSpec

func OracleSpecEventFromStream

func OracleSpecEventFromStream(ctx context.Context, be *eventspb.BusEvent) *OracleSpec

func (*OracleSpec) OracleSpec

func (o *OracleSpec) OracleSpec() zetapb.OracleSpec

func (OracleSpec) Proto

func (o OracleSpec) Proto() zetapb.OracleSpec

func (OracleSpec) StreamMessage

func (o OracleSpec) StreamMessage() *eventspb.BusEvent

type Order

type Order struct {
	*Base
	// contains filtered or unexported fields
}

func NewOrderEvent

func NewOrderEvent(ctx context.Context, o *types.Order) *Order

func OrderEventFromStream

func OrderEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Order

func (Order) IsParty

func (o Order) IsParty(id string) bool

func (Order) MarketID

func (o Order) MarketID() string

func (*Order) Order

func (o *Order) Order() *ptypes.Order

func (Order) PartyID

func (o Order) PartyID() string

func (Order) Proto

func (o Order) Proto() ptypes.Order

func (Order) StreamMessage

func (o Order) StreamMessage() *eventspb.BusEvent

type Party

type Party struct {
	*Base
	// contains filtered or unexported fields
}

func NewPartyEvent

func NewPartyEvent(ctx context.Context, p proto.Party) *Party

func PartyEventFromStream

func PartyEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Party

func (Party) IsParty

func (p Party) IsParty(id string) bool

func (*Party) Party

func (p *Party) Party() proto.Party

func (Party) Proto

func (p Party) Proto() proto.Party

func (Party) StreamMessage

func (p Party) StreamMessage() *eventspb.BusEvent

type PosRes

type PosRes struct {
	*Base
	// contains filtered or unexported fields
}

func NewPositionResolution

func NewPositionResolution(ctx context.Context, distressed, closed int, markPrice *num.Uint, marketID string) *PosRes

func PositionResolutionEventFromStream

func PositionResolutionEventFromStream(ctx context.Context, be *eventspb.BusEvent) *PosRes

func (PosRes) Closed

func (p PosRes) Closed() int

func (PosRes) Distressed

func (p PosRes) Distressed() int

func (PosRes) MarkPrice

func (p PosRes) MarkPrice() *num.Uint

func (PosRes) MarketEvent

func (p PosRes) MarketEvent() string

MarketEvent implement the MarketEvent interface.

func (PosRes) MarketID

func (p PosRes) MarketID() string

func (PosRes) MarketProto

func (p PosRes) MarketProto() eventspb.MarketEvent

func (PosRes) Proto

func (PosRes) StreamMarketMessage

func (p PosRes) StreamMarketMessage() *eventspb.BusEvent

func (PosRes) StreamMessage

func (p PosRes) StreamMessage() *eventspb.BusEvent

type PositionState

type PositionState struct {
	*Base
	// contains filtered or unexported fields
}

func NewPositionStateEvent

func NewPositionStateEvent(ctx context.Context, mp MarketPosition, marketID string) *PositionState

func PositionStateEventFromStream

func PositionStateEventFromStream(ctx context.Context, be *eventspb.BusEvent) *PositionState

func (PositionState) IsParty

func (s PositionState) IsParty(id string) bool

func (PositionState) MarketID

func (s PositionState) MarketID() string

func (PositionState) PartyID

func (s PositionState) PartyID() string

func (PositionState) PotentialBuys

func (s PositionState) PotentialBuys() int64

func (PositionState) PotentialSells

func (s PositionState) PotentialSells() int64

func (PositionState) Proto

func (PositionState) Size

func (s PositionState) Size() int64

func (PositionState) StreamMessage

func (s PositionState) StreamMessage() *eventspb.BusEvent

func (PositionState) VWBuyPrice

func (s PositionState) VWBuyPrice() *num.Uint

func (PositionState) VWSellPrice

func (s PositionState) VWSellPrice() *num.Uint

type Proposal

type Proposal struct {
	*Base
	// contains filtered or unexported fields
}

func NewProposalEvent

func NewProposalEvent(ctx context.Context, p types.Proposal) *Proposal

func ProposalEventFromStream

func ProposalEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Proposal

func (Proposal) IsParty

func (p Proposal) IsParty(id string) bool

func (*Proposal) PartyID

func (p *Proposal) PartyID() string

PartyID - for combined subscriber, communal interface.

func (*Proposal) Proposal

func (p *Proposal) Proposal() proto.Proposal

func (*Proposal) ProposalID

func (p *Proposal) ProposalID() string

ProposalID - for combined subscriber, communal interface.

func (Proposal) Proto

func (p Proposal) Proto() proto.Proposal

func (Proposal) StreamMessage

func (p Proposal) StreamMessage() *eventspb.BusEvent

type ProtocolUpgradeDataNodeReady

type ProtocolUpgradeDataNodeReady struct {
	*Base
	// contains filtered or unexported fields
}

func NewProtocolUpgradeDataNodeReady

func NewProtocolUpgradeDataNodeReady(ctx context.Context, lastBlockHeight int64) *ProtocolUpgradeDataNodeReady

func ProtocolUpgradeDataNodeReadyEventFromStream

func ProtocolUpgradeDataNodeReadyEventFromStream(ctx context.Context, be *eventspb.BusEvent) *ProtocolUpgradeDataNodeReady

func (ProtocolUpgradeDataNodeReady) Proto

func (ProtocolUpgradeDataNodeReady) StreamMessage

func (b ProtocolUpgradeDataNodeReady) StreamMessage() *eventspb.BusEvent

type ProtocolUpgradeProposalEvent

type ProtocolUpgradeProposalEvent struct {
	*Base
	UpgradeBlockHeight uint64
	ZetaReleaseTag     string
	AcceptedBy         []string
	ProposalStatus     eventspb.ProtocolUpgradeProposalStatus
}

func NewProtocolUpgradeProposalEvent

func NewProtocolUpgradeProposalEvent(ctx context.Context, upgradeBlockHeight uint64, zetaReleaseTag string, acceptedBy []string, status eventspb.ProtocolUpgradeProposalStatus) *ProtocolUpgradeProposalEvent

func ProtocolUpgradeProposalEventFromStream

func ProtocolUpgradeProposalEventFromStream(ctx context.Context, be *eventspb.BusEvent) *ProtocolUpgradeProposalEvent

func (ProtocolUpgradeProposalEvent) Proto

func (ProtocolUpgradeProposalEvent) ProtocolUpgradeProposalEvent

func (pup ProtocolUpgradeProposalEvent) ProtocolUpgradeProposalEvent() eventspb.ProtocolUpgradeEvent

func (ProtocolUpgradeProposalEvent) StreamMessage

func (pup ProtocolUpgradeProposalEvent) StreamMessage() *eventspb.BusEvent

type ProtocolUpgradeStarted

type ProtocolUpgradeStarted struct {
	*Base
	// contains filtered or unexported fields
}

func NewProtocolUpgradeStarted

func NewProtocolUpgradeStarted(ctx context.Context, bb eventspb.ProtocolUpgradeStarted) *ProtocolUpgradeStarted

NewProtocolUpgradeStarted returns a new time Update event.

func ProtocolUpgradeStartedEventFromStream

func ProtocolUpgradeStartedEventFromStream(ctx context.Context, be *eventspb.BusEvent) *ProtocolUpgradeStarted

func (ProtocolUpgradeStarted) Proto

func (ProtocolUpgradeStarted) ProtocolUpgradeStarted

func (b ProtocolUpgradeStarted) ProtocolUpgradeStarted() eventspb.ProtocolUpgradeStarted

func (ProtocolUpgradeStarted) StreamMessage

func (b ProtocolUpgradeStarted) StreamMessage() *eventspb.BusEvent

type RewardPayout

type RewardPayout struct {
	*Base
	Party                   string
	EpochSeq                string
	Asset                   string
	Market                  string
	PercentageOfTotalReward string
	Amount                  *num.Uint
	Timestamp               int64
	RewardType              types.AccountType
}

func NewRewardPayout

func NewRewardPayout(ctx context.Context, timestamp int64, party, epochSeq string, asset string, amount *num.Uint, percentageOfTotalReward num.Decimal, rewardType types.AccountType, market string) *RewardPayout

func RewardPayoutEventFromStream

func RewardPayoutEventFromStream(ctx context.Context, be *eventspb.BusEvent) *RewardPayout

func (RewardPayout) Proto

func (RewardPayout) RewardPayoutEvent

func (rp RewardPayout) RewardPayoutEvent() eventspb.RewardPayoutEvent

func (RewardPayout) StreamMessage

func (rp RewardPayout) StreamMessage() *eventspb.BusEvent

type Risk

type Risk interface {
	Margin
	Amount() *num.Uint
	Transfer() *types.Transfer // I know, it's included in the Transfer interface, but this is to make it clear that this particular func is masked at this level
	MarginLevels() *types.MarginLevels
}

Risk is an event that summarizes everything and an eventual update to margin account.

type RiskFactor

type RiskFactor struct {
	*Base
	// contains filtered or unexported fields
}

func NewRiskFactorEvent

func NewRiskFactorEvent(ctx context.Context, r types.RiskFactor) *RiskFactor

func RiskFactorEventFromStream

func RiskFactorEventFromStream(ctx context.Context, be *eventspb.BusEvent) *RiskFactor

func (RiskFactor) MarketID

func (r RiskFactor) MarketID() string

func (RiskFactor) Proto

func (r RiskFactor) Proto() proto.RiskFactor

func (*RiskFactor) RiskFactor

func (r *RiskFactor) RiskFactor() proto.RiskFactor

func (RiskFactor) StreamMessage

func (r RiskFactor) StreamMessage() *eventspb.BusEvent

type SettleDistressed

type SettleDistressed struct {
	*Base
	// contains filtered or unexported fields
}

func NewSettleDistressed

func NewSettleDistressed(ctx context.Context, partyID, marketID string, price, margin *num.Uint, ts int64) *SettleDistressed

func SettleDistressedEventFromStream

func SettleDistressedEventFromStream(ctx context.Context, be *eventspb.BusEvent) *SettleDistressed

func (SettleDistressed) IsParty

func (s SettleDistressed) IsParty(id string) bool

func (SettleDistressed) Margin

func (s SettleDistressed) Margin() *num.Uint

func (SettleDistressed) MarketID

func (s SettleDistressed) MarketID() string

func (SettleDistressed) PartyID

func (s SettleDistressed) PartyID() string

func (SettleDistressed) Price

func (s SettleDistressed) Price() *num.Uint

func (SettleDistressed) Proto

func (SettleDistressed) StreamMessage

func (s SettleDistressed) StreamMessage() *eventspb.BusEvent

func (SettleDistressed) Timestamp

func (s SettleDistressed) Timestamp() int64

type SettleMarket

type SettleMarket struct {
	*Base
	// contains filtered or unexported fields
}

func NewMarketSettled

func NewMarketSettled(ctx context.Context, marketID string, ts int64, settledPrice *num.Uint, positionFactor num.Decimal) *SettleMarket

func SettleMarketEventFromStream

func SettleMarketEventFromStream(ctx context.Context, be *eventspb.BusEvent) *SettleMarket

func (SettleMarket) MarketID

func (m SettleMarket) MarketID() string

func (SettleMarket) PartyID

func (m SettleMarket) PartyID() string

PartyID will return an empty string as this is only required to satisfy an interface for identifying events that can affect positions in the data-node.

func (SettleMarket) PositionFactor

func (m SettleMarket) PositionFactor() num.Decimal

func (SettleMarket) Proto

func (m SettleMarket) Proto() *eventspb.SettleMarket

func (SettleMarket) SettledPrice

func (m SettleMarket) SettledPrice() *num.Uint

func (SettleMarket) StreamMessage

func (m SettleMarket) StreamMessage() *eventspb.BusEvent

func (SettleMarket) Timestamp

func (m SettleMarket) Timestamp() int64

type SettlePos

type SettlePos struct {
	*Base
	// contains filtered or unexported fields
}

func NewSettlePositionEvent

func NewSettlePositionEvent(ctx context.Context, partyID, marketID string, price *num.Uint, trades []TradeSettlement, ts int64, positionFactor num.Decimal) *SettlePos

func SettlePositionEventFromStream

func SettlePositionEventFromStream(ctx context.Context, be *eventspb.BusEvent) *SettlePos

func (SettlePos) IsParty

func (s SettlePos) IsParty(id string) bool

func (SettlePos) MarketID

func (s SettlePos) MarketID() string

func (SettlePos) PartyID

func (s SettlePos) PartyID() string

func (SettlePos) PositionFactor

func (s SettlePos) PositionFactor() num.Decimal

func (SettlePos) Price

func (s SettlePos) Price() *num.Uint

func (SettlePos) Proto

func (s SettlePos) Proto() eventspb.SettlePosition

func (SettlePos) StreamMessage

func (s SettlePos) StreamMessage() *eventspb.BusEvent

func (SettlePos) Timestamp

func (s SettlePos) Timestamp() int64

func (SettlePos) Trades

func (s SettlePos) Trades() []TradeSettlement

type SettlePosition

type SettlePosition interface {
	MarketID() string
	Trades() []TradeSettlement
	Margin() (uint64, bool)
	Party() string
	Price() uint64
}

SettlePosition is an event that the settlement buffer will propagate through the system used by the plugins (currently only the positions API).

type SnapshotTakenEvent

type SnapshotTakenEvent struct {
	*Base
	SnapshotBlockHeight  uint64
	SnapshotBlockHash    string
	ZetaCoreVersion      string
	ProtocolUpgradeBlock bool
}

func NewSnapshotEventEvent

func NewSnapshotEventEvent(ctx context.Context, blockHeight uint64, blockHash string, protocolUpgradeBlock bool) *SnapshotTakenEvent

func SnapthostTakenEventFromStream

func SnapthostTakenEventFromStream(ctx context.Context, be *eventspb.BusEvent) *SnapshotTakenEvent

func (SnapshotTakenEvent) Proto

func (SnapshotTakenEvent) SnapshotTakenEvent

func (ste SnapshotTakenEvent) SnapshotTakenEvent() eventspb.CoreSnapshotData

func (SnapshotTakenEvent) StreamMessage

func (ste SnapshotTakenEvent) StreamMessage() *eventspb.BusEvent

type StakeLinking

type StakeLinking struct {
	*Base
	// contains filtered or unexported fields
}

func NewStakeLinking

func NewStakeLinking(ctx context.Context, evt types.StakeLinking) *StakeLinking

func StakeLinkingFromStream

func StakeLinkingFromStream(ctx context.Context, be *eventspb.BusEvent) *StakeLinking

func (StakeLinking) Proto

func (StakeLinking) StakeLinking

func (s StakeLinking) StakeLinking() eventspb.StakeLinking

func (StakeLinking) StreamMessage

func (s StakeLinking) StreamMessage() *eventspb.BusEvent

type StateVar

type StateVar struct {
	*Base
	ID      string
	EventID string
	State   string
}

StateVar is an event for tracking consensus in floating point state variables.

func NewStateVarEvent

func NewStateVarEvent(ctx context.Context, ID, eventID, state string) *StateVar

func StateVarEventFromStream

func StateVarEventFromStream(ctx context.Context, be *eventspb.BusEvent) *StateVar

func (StateVar) Proto

func (sv StateVar) Proto() eventspb.StateVar

func (StateVar) StreamMessage

func (sv StateVar) StreamMessage() *eventspb.BusEvent

type Time

type Time struct {
	*Base
	// contains filtered or unexported fields
}

Time event indicating a change in block time (ie time update).

func NewTime

func NewTime(ctx context.Context, t time.Time) *Time

NewTime returns a new time Update event.

func TimeEventFromStream

func TimeEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Time

func (Time) Proto

func (t Time) Proto() eventspb.TimeUpdate

func (Time) StreamMessage

func (t Time) StreamMessage() *eventspb.BusEvent

func (Time) Time

func (t Time) Time() time.Time

Time returns the new blocktime.

type Trade

type Trade struct {
	*Base
	// contains filtered or unexported fields
}

func NewTradeEvent

func NewTradeEvent(ctx context.Context, t types.Trade) *Trade

func TradeEventFromStream

func TradeEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Trade

func (Trade) IsParty

func (t Trade) IsParty(id string) bool

func (Trade) MarketID

func (t Trade) MarketID() string

func (Trade) Proto

func (t Trade) Proto() ptypes.Trade

func (Trade) StreamMessage

func (t Trade) StreamMessage() *eventspb.BusEvent

func (*Trade) Trade

func (t *Trade) Trade() ptypes.Trade

type TradeSettlement

type TradeSettlement interface {
	Size() int64
	Price() *num.Uint
	MarketPrice() *num.Uint
}

TradeSettlement Part of the SettlePosition interface -> traces trades as they happened.

type TransactionResult

type TransactionResult struct {
	*Base
	// contains filtered or unexported fields
}

func NewTransactionResultEventFailure

func NewTransactionResultEventFailure(
	ctx context.Context,
	hash, party string,
	err error,
	tx interface{},
) *TransactionResult

func NewTransactionResultEventSuccess

func NewTransactionResultEventSuccess(
	ctx context.Context,
	hash, party string,
	tx interface{},
) *TransactionResult

func TransactionResultEventFromStream

func TransactionResultEventFromStream(ctx context.Context, be *eventspb.BusEvent) *TransactionResult

func (TransactionResult) IsParty

func (t TransactionResult) IsParty(id string) bool

func (TransactionResult) Proto

func (TransactionResult) StreamMessage

func (t TransactionResult) StreamMessage() *eventspb.BusEvent

type Transfer

type Transfer interface {
	MarketPosition
	Transfer() *types.Transfer
}

Transfer is an event passed on by settlement engine, contains position and the resulting transfer for the collateral engine to use. We need MarketPosition because we can't loose the long/short status of the open positions.

type TransferFunds

type TransferFunds struct {
	*Base
	// contains filtered or unexported fields
}

Transfer ...

func NewOneOffTransferFundsEvent

func NewOneOffTransferFundsEvent(
	ctx context.Context,
	t *types.OneOffTransfer,
) *TransferFunds

func NewOneOffTransferFundsEventWithReason

func NewOneOffTransferFundsEventWithReason(
	ctx context.Context,
	t *types.OneOffTransfer,
	reason string,
) *TransferFunds

func NewRecurringTransferFundsEvent

func NewRecurringTransferFundsEvent(
	ctx context.Context,
	t *types.RecurringTransfer,
) *TransferFunds

func NewRecurringTransferFundsEventWithReason

func NewRecurringTransferFundsEventWithReason(
	ctx context.Context,
	t *types.RecurringTransfer,
	reason string,
) *TransferFunds

func TransferFundsEventFromStream

func TransferFundsEventFromStream(ctx context.Context, be *eventspb.BusEvent) *TransferFunds

func (TransferFunds) PartyID

func (t TransferFunds) PartyID() string

func (TransferFunds) Proto

func (t TransferFunds) Proto() eventspb.Transfer

func (TransferFunds) StreamMessage

func (t TransferFunds) StreamMessage() *eventspb.BusEvent

func (TransferFunds) TransferFunds

func (t TransferFunds) TransferFunds() eventspb.Transfer

type TxErr

type TxErr struct {
	*Base
	// contains filtered or unexported fields
}

func NewTxErrEvent

func NewTxErrEvent(ctx context.Context, err error, partyID string, tx interface{}, cmd string) *TxErr

func TxErrEventFromStream

func TxErrEventFromStream(ctx context.Context, be *eventspb.BusEvent) *TxErr

func (TxErr) IsParty

func (t TxErr) IsParty(id string) bool

func (TxErr) Proto

func (t TxErr) Proto() eventspb.TxErrorEvent

func (TxErr) StreamMessage

func (t TxErr) StreamMessage() *eventspb.BusEvent

type Type

type Type int
const (
	// All event type -> used by subscribers to just receive all events, has no actual corresponding event payload.
	All Type = iota
	// other event types that DO have corresponding event types.
	TimeUpdate
	LedgerMovementsEvent
	PositionResolution
	MarketEvent // this event is not used for any specific event, but by subscribers that aggregate all market events (e.g. for logging)
	OrderEvent
	LiquidityProvisionEvent
	AccountEvent
	PartyEvent
	TradeEvent
	MarginLevelsEvent
	ProposalEvent
	VoteEvent
	MarketDataEvent
	NodeSignatureEvent
	LossSocializationEvent
	SettlePositionEvent
	SettleDistressedEvent
	MarketCreatedEvent
	MarketUpdatedEvent
	AssetEvent
	MarketTickEvent
	AuctionEvent
	WithdrawalEvent
	DepositEvent
	RiskFactorEvent
	NetworkParameterEvent
	TxErrEvent
	OracleSpecEvent
	OracleDataEvent
	EpochUpdate
	DelegationBalanceEvent
	StakeLinkingEvent
	ValidatorUpdateEvent
	RewardPayoutEvent
	CheckpointEvent
	ValidatorScoreEvent
	KeyRotationEvent
	StateVarEvent
	NetworkLimitsEvent
	TransferEvent
	ValidatorRankingEvent
	ERC20MultiSigThresholdSetEvent
	ERC20MultiSigSignerEvent
	ERC20MultiSigSignerAddedEvent
	ERC20MultiSigSignerRemovedEvent
	PositionStateEvent
	EthereumKeyRotationEvent
	ProtocolUpgradeEvent
	BeginBlockEvent
	EndBlockEvent
	ProtocolUpgradeStartedEvent
	SettleMarketEvent
	TransactionResultEvent
	CoreSnapshotEvent
	ProtocolUpgradeDataNodeReadyEvent
	DistressedOrdersClosedEvent
	ExpiredOrdersEvent
	DistressedPositionsEvent
)

func MarketEvents

func MarketEvents() []Type

MarketEvents return all the possible market events.

func ProtoToInternal

func ProtoToInternal(pTypes ...eventspb.BusEventType) ([]Type, error)

ProtoToInternal converts the proto message enum to our internal constants we're not using a map to de-duplicate the event types here, so we can exploit duplicating the same event to control the internal subscriber channel buffer.

func TryFromString

func TryFromString(s string) (*Type, bool)

TryFromString tries to parse a raw string into an event type, false indicates that.

func (Type) String

func (t Type) String() string

String get string representation of event type.

func (Type) ToProto

func (t Type) ToProto() eventspb.BusEventType

type ValidatorRanking

type ValidatorRanking struct {
	*Base
	NodeID           string
	EpochSeq         string
	StakeScore       string
	PerformanceScore string
	Ranking          string
	PreviousStatus   string
	Status           string
	TMVotingPower    int
}

func NewValidatorRanking

func NewValidatorRanking(ctx context.Context, epochSeq, nodeID, stakeScore, performanceScore, ranking, previousStatus, status string, votingPower int) *ValidatorRanking

func ValidatorRankingEventFromStream

func ValidatorRankingEventFromStream(ctx context.Context, be *eventspb.BusEvent) *ValidatorRanking

func (ValidatorRanking) Proto

func (ValidatorRanking) StreamMessage

func (vr ValidatorRanking) StreamMessage() *eventspb.BusEvent

func (ValidatorRanking) ValidatorRankingEvent

func (vr ValidatorRanking) ValidatorRankingEvent() eventspb.ValidatorRankingEvent

type ValidatorScore

type ValidatorScore struct {
	*Base
	NodeID               string
	EpochSeq             string
	ValidatorScore       string
	NormalisedScore      string
	RawValidatorScore    string
	ValidatorPerformance string
	MultisigScore        string
	ValidatorStatus      string
}

func NewValidatorScore

func NewValidatorScore(ctx context.Context, nodeID, epochSeq string, score, normalisedScore, rawValidatorScore,
	validatorPerformance num.Decimal, multisigScore num.Decimal, validatorStatus string,
) *ValidatorScore

func ValidatorScoreEventFromStream

func ValidatorScoreEventFromStream(ctx context.Context, be *eventspb.BusEvent) *ValidatorScore

func (ValidatorScore) Proto

func (ValidatorScore) StreamMessage

func (vd ValidatorScore) StreamMessage() *eventspb.BusEvent

func (ValidatorScore) ValidatorScoreEvent

func (vd ValidatorScore) ValidatorScoreEvent() eventspb.ValidatorScoreEvent

type ValidatorUpdate

type ValidatorUpdate struct {
	*Base
	// contains filtered or unexported fields
}

ValidatorUpdate ...

func NewValidatorUpdateEvent

func NewValidatorUpdateEvent(
	ctx context.Context,
	nodeID string,
	zetaPubKey string,
	zetaPubKeyIndex uint32,
	ethAddress string,
	tmPubKey string,
	infoURL string,
	country string,
	name string,
	avatarURL string,
	fromEpoch uint64,
	added bool,
	epochSeq uint64,
) *ValidatorUpdate

func ValidatorUpdateEventFromStream

func ValidatorUpdateEventFromStream(ctx context.Context, be *eventspb.BusEvent) *ValidatorUpdate

func (ValidatorUpdate) AvatarURL

func (vu ValidatorUpdate) AvatarURL() string

AvatarURL return an URL to the validator avatar for UI purpose.

func (ValidatorUpdate) Country

func (vu ValidatorUpdate) Country() string

Country returns country code of node's location.

func (ValidatorUpdate) EthereumAddress

func (vu ValidatorUpdate) EthereumAddress() string

EthereumAddress returns validator's ethereum address.

func (ValidatorUpdate) InfoURL

func (vu ValidatorUpdate) InfoURL() string

InfoURL returns an url with information about validator node.

func (ValidatorUpdate) Name

func (vu ValidatorUpdate) Name() string

Name return the name of the validator.

func (ValidatorUpdate) NodeID

func (vu ValidatorUpdate) NodeID() string

NodeID returns nodes ID.

func (ValidatorUpdate) Proto

func (ValidatorUpdate) StreamMessage

func (vu ValidatorUpdate) StreamMessage() *eventspb.BusEvent

func (ValidatorUpdate) TendermintPublicKey

func (vu ValidatorUpdate) TendermintPublicKey() string

TendermintPublicKey returns Tendermint nodes public key.

func (ValidatorUpdate) ValidatorUpdate

func (vu ValidatorUpdate) ValidatorUpdate() eventspb.ValidatorUpdate

func (ValidatorUpdate) ZetaPublicKey

func (vu ValidatorUpdate) ZetaPublicKey() string

ZetaPublicKey returns validator's zeta public key.

func (ValidatorUpdate) ZetaPublicKeyIndex

func (vu ValidatorUpdate) ZetaPublicKeyIndex() uint32

ZetaPublicKey returns validator's zeta public key index.

type Vote

type Vote struct {
	*Base
	// contains filtered or unexported fields
}

func NewVoteEvent

func NewVoteEvent(ctx context.Context, v types.Vote) *Vote

func VoteEventFromStream

func VoteEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Vote

func (Vote) IsParty

func (v Vote) IsParty(id string) bool

IsParty - used in event stream API filter.

func (*Vote) PartyID

func (v *Vote) PartyID() string

PartyID - return the PartyID for subscribers' convenience.

func (*Vote) ProposalID

func (v *Vote) ProposalID() string

ProposalID get the proposal ID, part of the interface for event subscribers.

func (Vote) Proto

func (v Vote) Proto() proto.Vote

func (Vote) StreamMessage

func (v Vote) StreamMessage() *eventspb.BusEvent

func (*Vote) TotalGovernanceTokenBalance

func (v *Vote) TotalGovernanceTokenBalance() string

TotalGovernanceTokenBalance returns the total balance of token used for this vote.

func (*Vote) TotalGovernanceTokenWeight

func (v *Vote) TotalGovernanceTokenWeight() string

TotalGovernanceTokenWeight returns the total weight of token used for this vote.

func (*Vote) Value

func (v *Vote) Value() proto.Vote_Value

Value - return a Y/N value, makes subscribers easier to implement.

func (*Vote) Vote

func (v *Vote) Vote() proto.Vote

Vote get the vote object.

type Withdrawal

type Withdrawal struct {
	*Base
	// contains filtered or unexported fields
}

func NewWithdrawalEvent

func NewWithdrawalEvent(ctx context.Context, w types.Withdrawal) *Withdrawal

func WithdrawalEventFromStream

func WithdrawalEventFromStream(ctx context.Context, be *eventspb.BusEvent) *Withdrawal

func (Withdrawal) IsParty

func (w Withdrawal) IsParty(id string) bool

func (Withdrawal) PartyID

func (w Withdrawal) PartyID() string

func (Withdrawal) Proto

func (w Withdrawal) Proto() proto.Withdrawal

func (Withdrawal) StreamMessage

func (w Withdrawal) StreamMessage() *eventspb.BusEvent

func (*Withdrawal) Withdrawal

func (w *Withdrawal) Withdrawal() proto.Withdrawal

Jump to

Keyboard shortcuts

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