off_chain_updates

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrderPlaceMessage

func CreateOrderPlaceMessage(
	ctx sdk.Context,
	order clobtypes.Order,
) (message msgsender.Message, success bool)

CreateOrderPlaceMessage creates an off-chain update message for an order.

func CreateOrderRemoveMessage

func CreateOrderRemoveMessage(
	ctx sdk.Context,
	orderId clobtypes.OrderId,
	orderStatus clobtypes.OrderStatus,
	orderError error,
	removalStatus ocutypes.OrderRemoveV1_OrderRemovalStatus,
) (message msgsender.Message, success bool)

CreateOrderRemoveMessage creates an off-chain update message for an order being removed, with the order's status and the resulting removal status of the removed order.

func CreateOrderRemoveMessageWithDefaultReason

func CreateOrderRemoveMessageWithDefaultReason(
	ctx sdk.Context,
	orderId clobtypes.OrderId,
	orderStatus clobtypes.OrderStatus,
	orderError error,
	removalStatus ocutypes.OrderRemoveV1_OrderRemovalStatus,
	defaultRemovalReason sharedtypes.OrderRemovalReason,
) (message msgsender.Message, success bool)

CreateOrderRemoveMessageWithDefaultReason creates an off-chain update message for an order being removed with the resulting removal status of the removed order. It attempts to look up the removal reason using the given orderStatus & orderError. If the reason cannot be found, it logs an error and falls back to the defaultRemovalReason. If defaultRemovalReason is ...UNSPECIFIED, it panics. TODO(CLOB-1051) take in ctx, not logger

func CreateOrderRemoveMessageWithReason

func CreateOrderRemoveMessageWithReason(
	ctx sdk.Context,
	orderId clobtypes.OrderId,
	reason sharedtypes.OrderRemovalReason,
	removalStatus ocutypes.OrderRemoveV1_OrderRemovalStatus,
) (message msgsender.Message, success bool)

CreateOrderRemoveMessageWithReason creates an off-chain update message for an order being removed with a specific reason for the removal and the resulting removal status of the removed order.

func CreateOrderReplaceMessage

func CreateOrderReplaceMessage(
	ctx sdk.Context,
	order clobtypes.Order,
) (message msgsender.Message, success bool)

CreateOrderReplaceMessage creates an off-chain update message for an order.

func CreateOrderUpdateMessage

func CreateOrderUpdateMessage(
	ctx sdk.Context,
	orderId clobtypes.OrderId,
	totalFilled satypes.BaseQuantums,
) (message msgsender.Message, success bool)

CreateOrderUpdateMessage creates an off-chain update message for an order being updated.

func GetOrderIdHash

func GetOrderIdHash(orderId clobtypes.OrderId) ([]byte, error)

GetOrderIdHash gets the SHA256 hash of the `IndexerOrderId` mapped from an `OrderId`.

func MustCreateOrderPlaceMessage

func MustCreateOrderPlaceMessage(
	ctx sdk.Context,
	order clobtypes.Order,
) msgsender.Message

MustCreateOrderPlaceMessage invokes CreateOrderPlaceMessage and panics if creation was unsuccessful.

func MustCreateOrderRemoveMessage

func MustCreateOrderRemoveMessage(
	ctx sdk.Context,
	orderId clobtypes.OrderId,
	orderStatus clobtypes.OrderStatus,
	orderError error,
	removalStatus ocutypes.OrderRemoveV1_OrderRemovalStatus,
) msgsender.Message

MustCreateOrderRemoveMessage invokes CreateOrderRemoveMessage and panics if creation was unsuccessful.

func MustCreateOrderRemoveMessageWithReason

func MustCreateOrderRemoveMessageWithReason(
	ctx sdk.Context,
	orderId clobtypes.OrderId,
	reason sharedtypes.OrderRemovalReason,
	removalStatus ocutypes.OrderRemoveV1_OrderRemovalStatus,
) msgsender.Message

MustCreateOrderRemoveMessageWithReason invokes CreateOrderRemoveMessageWithReason and panics if creation was unsuccessful.

func MustCreateOrderReplaceMessage

func MustCreateOrderReplaceMessage(
	ctx sdk.Context,
	order clobtypes.Order,
) msgsender.Message

MustCreateOrderReplaceMessage invokes CreateOrderReplaceMessage and panics if creation was unsuccessful.

func MustCreateOrderUpdateMessage

func MustCreateOrderUpdateMessage(
	ctx sdk.Context,
	orderId clobtypes.OrderId,
	totalFilled satypes.BaseQuantums,
) msgsender.Message

MustCreateOrderUpdateMessage invokes CreateOrderUpdateMessage and panics if creation was unsuccessful.

func NewOrderPlaceMessage

func NewOrderPlaceMessage(
	order clobtypes.Order,
) ([]byte, error)

NewOrderPlaceMessage returns an `OffChainUpdate` struct populated with an `OrderPlace` struct as the `UpdateMessage` parameter, encoded as a byte slice.

func NewOrderRemoveMessage

func NewOrderRemoveMessage(
	orderId clobtypes.OrderId,
	reason sharedtypes.OrderRemovalReason,
	status ocutypes.OrderRemoveV1_OrderRemovalStatus,
) ([]byte, error)

NewOrderRemoveMessage returns an `OffChainUpdate` struct populated with an `OrderRemove` struct as the `UpdateMessage` parameter, encoded as a byte slice. The `OrderRemove` struct is instantiated with the given orderId, reason and status parameters.

func NewOrderReplaceMessage

func NewOrderReplaceMessage(
	order clobtypes.Order,
) ([]byte, error)

NewOrderReplaceMessage returns an `OffChainUpdate` struct populated with an `OrderReplace` struct as the `UpdateMessage` parameter, encoded as a byte slice.

func NewOrderUpdateMessage

func NewOrderUpdateMessage(
	orderId clobtypes.OrderId,
	totalFilled satypes.BaseQuantums,
) ([]byte, error)

NewOrderUpdateMessage returns an `OffChainUpdate` struct populated with an `OrderUpdate` struct as the `UpdateMessage` parameter, encoded as a byte slice. The `OrderUpdate` struct is instantiated with the given orderId and totalFilled parameters.

func ShouldSendOrderRemovalOnReplay

func ShouldSendOrderRemovalOnReplay(
	orderError error,
) bool

ShouldSendOrderRemovalOnReplay returns a true/false for whether an order removal message should be sent given the error encountered while replaying an order. TODO(CLOB-518): Re-visit enumerating all the errors where an order removal should be / not be sent vs using the existence of an order nonce to determine if an order removal message should be sent.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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