ante

package
v0.0.0-...-23a414b Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsShortTermClobMsgTx

func IsShortTermClobMsgTx(ctx sdk.Context, tx sdk.Tx) (bool, error)

IsShortTermClobMsgTx returns `true` if the supplied `tx` consist of a single clob message (`MsgPlaceOrder` or `MsgCancelOrder` or `MsgBatchCancel`) which references a Short-Term Order. If `msgs` consist of multiple clob messages, or a mix of on-chain and clob messages, an error is returned.

func IsSingleClobMsgTx

func IsSingleClobMsgTx(tx sdk.Tx) (bool, error)

IsSingleClobMsgTx returns `true` if the supplied `tx` consist of a single clob message (`MsgPlaceOrder` or `MsgCancelOrder` or `MsgBatchCancel`). If `msgs` consist of multiple clob messages, or a mix of on-chain and clob messages, an error is returned.

Types

type ClobDecorator

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

ClobDecorator is an AnteDecorator which is responsible for:

  • adding short term order placements and cancelations to the in-memory orderbook (`CheckTx` only).
  • adding stateful order placements and cancelations to state (`CheckTx` and `RecheckTx` only).

This AnteDecorator also enforces that any Transaction which contains a `MsgPlaceOrder`, or a `MsgCancelOrder`, must consist only of a single message.

This AnteDecorator is a no-op if:

  • No messages in the transaction are `MsgPlaceOrder` or `MsgCancelOrder`.
  • This AnteDecorator is called during `DeliverTx`.

This AnteDecorator returns an error if:

  • The transaction contains multiple messages, and one of them is a `MsgPlaceOrder` or `MsgCancelOrder` message.
  • The underlying `PlaceStatefulOrder`, `PlaceShortTermOrder`, `CancelStatefulOrder`, or `CancelShortTermOrder` methods on the keeper return errors.

func NewClobDecorator

func NewClobDecorator(clobKeeper types.ClobKeeper) ClobDecorator

func (ClobDecorator) AnteHandle

func (cd ClobDecorator) AnteHandle(
	ctx sdk.Context,
	tx sdk.Tx,
	simulate bool,
	next sdk.AnteHandler,
) (sdk.Context, error)

type ClobRateLimitDecorator

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

ClobRateLimitDecorator is an AnteDecorator which is responsible for rate limiting MsgCancelOrder and MsgPlaceOrder and MsgBatchCancel requests.

This AnteDecorator is a no-op if:

  • No messages in the transaction are `MsgCancelOrder` or `MsgPlaceOrder` or `MsgBatchCancel`

This AnteDecorator returns an error if:

  • The rate limit is exceeded for any `MsgCancelOrder` messages.
  • The rate limit is exceeded for any `MsgPlaceOrder` messages.
  • The rate limit is exceeded for any `MsgBatchCancel` messages.

TODO(CLOB-721): Rate limit short term order cancellations.

func NewRateLimitDecorator

func NewRateLimitDecorator(clobKeeper types.ClobKeeper) ClobRateLimitDecorator

func (ClobRateLimitDecorator) AnteHandle

func (r ClobRateLimitDecorator) AnteHandle(
	ctx sdktypes.Context,
	tx sdktypes.Tx, simulate bool,
	next sdktypes.AnteHandler,
) (newCtx sdktypes.Context, err error)

Jump to

Keyboard shortcuts

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