Messages
In this section we describe the processing of the exchange messages and the corresponding updates to the state. All created/modified state objects specified by each message are defined within the State Transitions section.
Msg/Deposit
MsgDeposit defines a SDK message for transferring coins from the sender's bank balance into the subaccount's exchange deposits.
type MsgDeposit struct {
Sender string
// (Optional) bytes32 subaccount ID to deposit funds into. If empty, the coin will be deposited to the sender's default
// subaccount address.
SubaccountId string
Amount types.Coin
}
Fields description
Senderfield describes the address who deposits.SubaccountIddescribes the ID of a sub-account to receive a deposit.Amountspecifies the deposit amount.
Msg/Withdraw
MsgWithdraw defines a SDK message for withdrawing coins from a subaccount's deposits to the user's bank balance.
type MsgWithdraw struct {
Sender string
// bytes32 subaccount ID to withdraw funds from
SubaccountId string
Amount types.Coin
}
Fields description
Senderfield describes the address to receive withdrawal.SubaccountIddescribes the ID of a sub-account to withdraw from.Amountspecifies the withdrawal amount.
Msg/InstantSpotMarketLaunch
MsgInstantSpotMarketLaunch defines a SDK message for creating a new spot market by paying listing fee without governance. The fee is sent to the community spend pool.
type MsgInstantSpotMarketLaunch struct {
Sender string
Ticker string
BaseDenom string
QuoteDenom string
MinPriceTickSize sdk.Dec
MinQuantityTickSize sdk.Dec
MinNotional sdk.Dec
}
Fields description
Senderfield describes the creator of this msg.Tickerdescribes the ticker for the spot market.BaseDenomspecifies the type of coin to use as the base currency.QuoteDenomspecifies the type of coin to use as the quote currency.MinPriceTickSizedefines the minimum tick size of the order's price.MinQuantityTickSizedefines the minimum tick size of the order's quantity.
Msg/InstantPerpetualMarketLaunch
MsgInstantPerpetualMarketLaunch defines a SDK message for creating a new perpetual futures market by paying listing fee without governance. The fee is sent to the community spend pool.
type MsgInstantPerpetualMarketLaunch struct {
Sender string
Ticker string
QuoteDenom string
OracleBase string
OracleQuote string
OracleScaleFactor uint32
OracleType types1.OracleType
MakerFeeRate sdk.Dec
TakerFeeRate sdk.Dec
InitialMarginRatio sdk.Dec
MaintenanceMarginRatio sdk.Dec
MinPriceTickSize sdk.Dec
MinQuantityTickSize sdk.Dec
MinNotional sdk.Dec
}
Fields description
Senderfield describes the creator of this msg.Tickerfield describes the ticker for the derivative market.QuoteDenomfield describes the type of coin to use as the base currency.OracleBasefield describes the oracle base currency.OracleQuotefield describes the oracle quote currency.OracleScaleFactorfield describes the scale factor for oracle prices.OracleTypefield describes the oracle type.MakerFeeRatefield describes the trade fee rate for makers on the derivative market.TakerFeeRatefield describes the trade fee rate for takers on the derivative market.InitialMarginRatiofield describes the initial margin ratio for the derivative market.MaintenanceMarginRatiofield describes the maintenance margin ratio for the derivative market.MinPriceTickSizefield describes the minimum tick size of the order's price and margin.MinQuantityTickSizefield describes the minimum tick size of the order's quantity.
Msg/InstantExpiryFuturesMarketLaunch
MsgInstantExpiryFuturesMarketLaunch defines a SDK message for creating a new expiry futures market by paying listing fee without governance. The fee is sent to the community spend pool.
type MsgInstantExpiryFuturesMarketLaunch struct {
Sender string
Ticker string
QuoteDenom string
OracleBase string
OracleQuote string
OracleType types1.OracleType
OracleScaleFactor uint32
Expiry int64
MakerFeeRate sdk.Dec
TakerFeeRate sdk.Dec
InitialMarginRatio sdk.Dec
MaintenanceMarginRatio sdk.Dec
MinPriceTickSize sdk.Dec
MinQuantityTickSize sdk.Dec
MinNotional sdk.Dec
}
Fields description
Senderfield describes the creator of this msg.Tickerfield describes the ticker for the derivative market.QuoteDenomfield describes the type of coin to use as the quote currency.OracleBasefield describes the oracle base currency.OracleQuotefield describes the oracle quote currency.OracleScaleFactorfield describes the scale factor for oracle prices.OracleTypefield describes the oracle type.Expiryfield describes the expiration time of the market.MakerFeeRatefield describes the trade fee rate for makers on the derivative market.TakerFeeRatefield describes the trade fee rate for takers on the derivative market.InitialMarginRatiofield describes the initial margin ratio for the derivative market.MaintenanceMarginRatiofield describes the maintenance margin ratio for the derivative market.MinPriceTickSizefield describes the minimum tick size of the order's price and margin.MinQuantityTickSizefield describes the minimum tick size of the order's quantity.
Msg/CreateSpotLimitOrder
MsgCreateSpotLimitOrder defines a SDK message for creating a new spot limit order.
type MsgCreateSpotLimitOrder struct {
Sender string
Order SpotOrder
}
Fields description
Senderfield describes the creator of this msg.Orderfield describes the order info.
Msg/BatchCreateSpotLimitOrders
MsgBatchCreateSpotLimitOrders defines a SDK message for creating a new batch of spot limit orders.
type MsgBatchCreateSpotLimitOrders struct {
Sender string
Orders []SpotOrder
}
Fields description
Senderfield describes the creator of this msg.Ordersfield describes the orders info.
Msg/CreateSpotMarketOrder
MsgCreateSpotMarketOrder defines a SDK message for creating a new spot market order.
type MsgCreateSpotMarketOrder struct {
Sender string
Order SpotOrder
}
Fields description
Senderfield describes the creator of this msg.Orderfield describes the order info.
Msg/CancelSpotOrder
MsgCancelSpotOrder defines the message to cancel a spot order.
type MsgCancelSpotOrder struct {
Sender string
MarketId string
SubaccountId string
OrderHash string
Cid string
}
Fields description
Senderfield describes the creator of this msg.MarketIdfield describes the id of the market where the order is placed.SubaccountIdfield describes the subaccount id that placed the order.OrderHashfield describes the hash of the order.
Msg/BatchCancelSpotOrders
MsgBatchCancelSpotOrders defines the message to cancel the spot orders in batch.
type MsgBatchCancelSpotOrders struct {
Sender string
Data []OrderData
}
Fields description
Senderfield describes the creator of this msg.Datafield describes the orders to cancel.
Msg/CreateDerivativeLimitOrder
MsgCreateDerivativeLimitOrder defines the message to create a derivative limit order.
type MsgCreateDerivativeLimitOrder struct {
Sender string
Order DerivativeOrder
}
Fields description
Senderfield describes the creator of this msg.Orderfield describes the order info.
Batch creation of derivative limit orders
MsgBatchCreateDerivativeLimitOrders describes the batch creation of derivative limit orders.
type MsgBatchCreateDerivativeLimitOrders struct {
Sender string
Orders []DerivativeOrder
}
Fields description
Senderfield describes the creator of this msg.Ordersfield describes the orders info.
Msg/CreateDerivativeMarketOrder
MsgCreateDerivativeMarketOrder is a message to create a derivative market order.
// A Cosmos-SDK MsgCreateDerivativeMarketOrder
type MsgCreateDerivativeMarketOrder struct {
Sender string
Order DerivativeOrder
}
Fields description
Senderfield describes the creator of this msg.Orderfield describes the order info.
Msg/CancelDerivativeOrder
MsgCancelDerivativeOrder is a message to cancel a derivative order.
type MsgCancelDerivativeOrder struct {
Sender string
MarketId string
SubaccountId string
OrderHash string
OrderMask int32
Cid string
}
Fields description
Senderfield describes the creator of this msg.MarketIdfield describes the id of the market where the order is placed.SubaccountIdfield describes the subaccount id that placed the order.OrderHashfield describes the hash of the order.
Msg/BatchCancelDerivativeOrders
MsgBatchCancelDerivativeOrders is a message to cancel derivative orders in batch.
type MsgBatchCancelDerivativeOrders struct {
Sender string
Data []OrderData
}
Fields description
Senderfield describes the creator of this msg.Datafield describes the orders to cancel.
Msg/SubaccountTransfer
MsgSubaccountTransfer is a message to transfer balance between sub-accounts.
type MsgSubaccountTransfer struct {
Sender string
SourceSubaccountId string
DestinationSubaccountId string
Amount types.Coin
}
Fields description
Senderfield describes the creator of this msg.SourceSubaccountIdfield describes a source subaccount to send coins from.DestinationSubaccountIdfield describes a destination subaccount to send coins to.Amountfield describes the amount of coin to send.
Msg/ExternalTransfer
MsgExternalTransfer is a message to transfer balance from one of source account to external sub-account.
type MsgExternalTransfer struct {
Sender string
SourceSubaccountId string
DestinationSubaccountId string
Amount types.Coin
}
Fields description
Senderfield describes the creator of this msg.SourceSubaccountIdfield describes a source subaccount to send coins from.DestinationSubaccountIdfield describes a destination subaccount to send coins to.Amountfield describes the amount of coin to send.
Msg/LiquidatePosition
MsgLiquidatePosition describes a message to liquidate an account's position
type MsgLiquidatePosition struct {
Sender string
SubaccountId string
MarketId string
// optional order to provide for liquidation
Order *DerivativeOrder
}
Fields description
Senderfield describes the creator of this msg.SubaccountIdfield describes a subaccount to receive liquidation amount.MarketIdfield describes a market where the position is in.Orderfield describes the order info.
Msg/IncreasePositionMargin
MsgIncreasePositionMargin describes a message to increase margin of an account.
// A Cosmos-SDK MsgIncreasePositionMargin
type MsgIncreasePositionMargin struct {
Sender string
SourceSubaccountId string
DestinationSubaccountId string
MarketId string
// amount defines the amount of margin to add to the position
Amount sdk.Dec
}
Fields description
Senderfield describes the creator of this msg.SourceSubaccountIdfield describes a source subaccount to send balance from.DestinationSubaccountIdfield describes a destination subaccount to receive balance.MarketIdfield describes a market where positions are in.Amountfield describes amount to increase.
Msg/BatchUpdateOrders
MsgBatchUpdateOrders allows for the atomic cancellation and creation of spot and derivative limit orders, along with a new order cancellation mode. Upon execution, order cancellations (if any) occur first, followed by order creations (if any).
// A Cosmos-SDK MsgBatchUpdateOrders
// SubaccountId only used for the spot_market_ids_to_cancel_all and derivative_market_ids_to_cancel_all.
type MsgBatchUpdateOrders struct {
Sender string
SubaccountId string
SpotMarketIdsToCancelAll []string
DerivativeMarketIdsToCancelAll []string
SpotOrdersToCancel []OrderData
DerivativeOrdersToCancel []OrderData
SpotOrdersToCreate []SpotOrder
DerivativeOrdersToCreate []DerivativeOrder
}
Fields description
Senderfield describes the creator of this msg.SubaccountIdfield describes the sender's sub-account ID.SpotMarketIdsToCancelAllfield describes a list of spot market IDs for which the sender wants to cancel all open orders.DerivativeMarketIdsToCancelAllfield describes a list of derivative market IDs for which the sender wants to cancel all open orders.SpotOrdersToCancelfield describes specific spot orders the sender wants to cancel.DerivativeOrdersToCancelfield describes specific derivative orders the sender wants to cancel.SpotOrdersToCreatefield describes spot orders the sender wants to create.DerivativeOrdersToCreatefield describes derivative orders the sender wants to create.