off_chain_updates

package
v0.0.0-...-cd4288d Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 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 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 MustCreateOrderUpdateMessage

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

MustCreateOrderUpdateMessage invokes CreateOrderUpdateMessage and panics if creation was unsuccessful.

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