Skip to content

Commit

Permalink
constants
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfung-dydx committed Feb 27, 2024
1 parent 8f77dbe commit 040422a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions protocol/x/clob/types/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import (
// `MsgPlaceOrder` or `MsgCancelOrder` message will be considered valid by the validator.
const ShortBlockWindow uint32 = 20

// MaxMsgBatchCancelBatchSize represents the maximum number of cancels that a MsgBatchCancel
// can have in one Msg.
const MaxMsgBatchCancelBatchSize uint32 = 100

// StatefulOrderTimeWindow represents the maximum amount of time in seconds past the current block time that a
// long-term/conditional `MsgPlaceOrder` message will be considered valid by the validator.
const StatefulOrderTimeWindow time.Duration = 95 * 24 * time.Hour // 95 days.
Expand Down
5 changes: 5 additions & 0 deletions protocol/x/clob/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ var (
44,
"invalid time in force",
)
ErrInvalidBatchCancel = errorsmod.Register(
ModuleName,
45,
"Invalid Batch Cancel",
)

// Liquidations errors.
ErrInvalidLiquidationsConfig = errorsmod.Register(
Expand Down
4 changes: 2 additions & 2 deletions protocol/x/clob/types/message_batch_cancel.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

var _ sdk.Msg = &MsgBatchCancel{}

// NewMsgCancelOrderShortTerm constructs a MsgBatchCancel from an `OrderId` and a `GoodTilBlock`.
// NewMsgBatchCancel constructs a MsgBatchCancel.
func NewMsgBatchCancel(subaccountId types.SubaccountId, cancelBatch []OrderBatch, goodTilBlock uint32) *MsgBatchCancel {
return &MsgBatchCancel{
SubaccountId: subaccountId,
Expand All @@ -18,7 +18,7 @@ func NewMsgBatchCancel(subaccountId types.SubaccountId, cancelBatch []OrderBatch
}
}

// ValidateBasic performs stateless validation for
// ValidateBasic performs stateless validation for the `MsgBatchCancel` msg.
func (msg *MsgBatchCancel) ValidateBasic() (err error) {
subaccountId := msg.GetSubaccountId()
if err := subaccountId.Validate(); err != nil {
Expand Down

0 comments on commit 040422a

Please sign in to comment.