ante

package
v1.0.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: AGPL-3.0 Imports: 8 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`) 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(ctx sdk.Context, tx sdk.Tx) (bool, error)

IsSingleClobMsgTx returns `true` if the supplied `tx` consist of a single clob message (`MsgPlaceOrder` or `MsgCancelOrder`). 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 requests.

This AnteDecorator is a no-op if:

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

This AnteDecorator returns an error if:

  • The rate limit is exceeded for any `MsgCancelOrder` messages.
  • The rate limit is exceeded for any `MsgPlaceOrder` 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)

type ShortTermSingleMsgClobTxAnteWrapper

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

ShortTermSingleMsgClobTxAnteWrapper is a wrapper for Antehandlers that need to be skipped for single msg clob txs `MsgPlaceOrder` and `MsgCancelOrder` which reference Short-Term orders. For example, these transactions do not require sequence number validation.

func NewShortTermSingleMsgClobTxAnteWrapper

func NewShortTermSingleMsgClobTxAnteWrapper(handler sdk.AnteDecorator) ShortTermSingleMsgClobTxAnteWrapper

func (ShortTermSingleMsgClobTxAnteWrapper) AnteHandle

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

func (ShortTermSingleMsgClobTxAnteWrapper) GetAnteHandler

func (antWrapper ShortTermSingleMsgClobTxAnteWrapper) GetAnteHandler() sdk.AnteDecorator

type SingleMsgClobTxAnteWrapper

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

SingleMsgClobTxAnteWrapper is a wrapper for Antehandlers that need to be skipped for single msg clob txs `MsgPlaceOrder` and `MsgCancelOrder`. These transactions should always have `0` Gas, and therefore should never be charged a gas fee.

func NewSingleMsgClobTxAnteWrapper

func NewSingleMsgClobTxAnteWrapper(handler sdk.AnteDecorator) SingleMsgClobTxAnteWrapper

func (SingleMsgClobTxAnteWrapper) AnteHandle

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

func (SingleMsgClobTxAnteWrapper) GetAnteHandler

func (antWrapper SingleMsgClobTxAnteWrapper) GetAnteHandler() sdk.AnteDecorator

Jump to

Keyboard shortcuts

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