Injective | Documentation
InjectiveGithub
Injective | Documentation
Injective | Documentation
  • About Injective
  • Getting Started
    • Wallet
      • Create a wallet
      • Accounts
      • Staking
      • Governance
      • Auction
    • Token Standards
      • INJ coin
      • Token Factory
      • CW20 Standard
    • Transactions
      • Gas and Fees
  • Guides
    • Create a Wallet
    • Bridge
      • From Ethereum
      • Using Wormhole
      • Using IBC
      • From Solana
    • Launch a Token
    • Launch a Market
    • Denom Metadata
    • Get INJ
  • Toolkits
    • injectived
      • Install injectived
      • Using injectived
      • Commands
    • Injective TS SDK
    • Injective Go SDK
    • Injective Python SDK
    • Injective CW SDK
    • Injective Rust
    • The Graph
  • References
  • Glossary
  • Developers
    • Getting Started
      • Guides
        • Testnet Proposals
        • Convert addresses
        • Calculations
          • Min Price Tick Size
          • Min Quantity Tick Size
        • Testnet Faucet Integration
    • Exchange Developers
      • Build a DEX
      • Provider Oracle
    • Cosmwasm Developers
      • Your First Smart Contract
      • Guides
        • Local Development
        • Mainnet Deployment
        • Whitelisting deployment address
        • Create your Swap Contract
        • Creating UIs
      • Using Injective Queries and Messages
      • CW20 Adapter
      • Injective Test Tube
    • Modules
      • Injective
        • Auction
          • State
          • Messages
          • EndBlock
          • Events
          • Params
          • Errors
        • Exchange
          • Derivative Markets Concepts
          • Spot Markets Concepts
          • Binary Option Markets Concepts
          • Other Concepts
          • State
          • State Transitions
          • Messages
          • Proposals
          • BeginBlock
          • EndBlock
          • Events
          • Params
          • MsgPrivilegedExecuteContract
          • Errors
        • Insurance
          • State
          • State Transitions
          • Messages
          • EndBlock
          • Events
          • Params
          • Improvements
          • Errors
        • OCR
          • Concepts
          • State
          • Messages
          • Proposals
          • BeginBlock
          • Hooks
          • Events
          • Params
          • Errors
        • Oracle
          • State
          • Keeper
          • Messages
          • Proposals
          • Events
          • Improvements
          • Errors
        • Peggy
          • Definitions
          • Workflow
          • State
          • Messages
          • Slashing
          • EndBlock
          • Events
          • Params
          • Relay Semantics
          • Improvements
          • Errors
        • Permissions
          • Concepts
          • State
          • State Transition
          • Errors
        • TokenFactory
          • Concepts
          • State
          • Messages
          • Events
          • Params
          • Errors
        • WasmX
          • Concepts
          • Data
          • Proposals
          • Messages
          • Params
          • Errors
        • Lanes
        • TxFees
      • Core
        • Auth
        • AuthZ
        • Bank
        • Consensus
        • Crisis
        • Distribution
        • Evidence
        • Feegrant
        • Gov
        • Group
        • Mint
        • NFT
        • Params
        • Slashing
        • Staking
        • Upgrade
        • Circuit
        • Genutils
    • dApps Documentation
  • Nodes
    • Getting Started
      • Interact with a node
      • Running a node
        • Setting up the keyring
        • Join a network
        • Cosmovisor
        • Upgrade your node
    • Validators
      • Mainnet
        • Peggo
        • Canonical Chain Upgrades
          • Upgrade to 10002-rc1
          • Upgrade to 10002-rc2
          • Upgrade to 10003-rc1
          • Upgrade to 10004-rc1
          • Upgrade to 10004-rc1-patch
          • Upgrade to 10005-rc1
          • Upgrade to 10006-rc1
          • Upgrade to 10007-rc1
          • Upgrade to 10008 - Camelot
          • Upgrade to 10009
          • Upgrade to v1.10
          • Upgrade to v1.11
          • Upgrade to v1.12.0 - Volan
          • Upgrade to v1.12.1
          • Upgrade to v1.13.0 - Altaris
          • Upgrade to v1.13.2
          • Upgrade to v1.13.3
          • Upgrade to v1.14.0
          • Upgrade to v1.14.1
          • Upgrade to v1.15.0
      • Testnet
        • Testnet Peggo
    • Public Endpoints
    • Premium Endpoints
    • Injective Indexer Setup
  • Traders
    • Getting Started
    • Documentation
    • API Reference
  • Useful Links
    • Injective 101
    • Injective Hub
    • Injective Explorer
    • Chain API Reference
    • Indexer API Reference
    • Testnet Faucet
Powered by GitBook
On this page
  • Msg/Deposit
  • Msg/Withdraw
  • Msg/InstantSpotMarketLaunch
  • Msg/InstantPerpetualMarketLaunch
  • Msg/InstantExpiryFuturesMarketLaunch
  • Msg/CreateSpotLimitOrder
  • Msg/BatchCreateSpotLimitOrders
  • Msg/CreateSpotMarketOrder
  • Msg/CancelSpotOrder
  • Msg/BatchCancelSpotOrders
  • Msg/CreateDerivativeLimitOrder
  • Batch creation of derivative limit orders
  • Msg/CreateDerivativeMarketOrder
  • Msg/CancelDerivativeOrder
  • Msg/BatchCancelDerivativeOrders
  • Msg/SubaccountTransfer
  • Msg/ExternalTransfer
  • Msg/LiquidatePosition
  • Msg/IncreasePositionMargin
  • Msg/BatchUpdateOrders
  • Msg/AuthorizeStakeGrants
  • Msg/ActivateStakeGrant
Edit on GitHub
Export as PDF
  1. Developers
  2. Modules
  3. Injective
  4. Exchange

Messages

PreviousState TransitionsNextProposals

Last updated 1 month ago

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 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

  • Sender field describes the address who deposits.

  • SubaccountId describes the ID of a sub-account to receive a deposit.

  • Amount specifies 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

  • Sender field describes the address to receive withdrawal.

  • SubaccountId describes the ID of a sub-account to withdraw from.

  • Amount specifies 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    math.LegacyDec
	MinQuantityTickSize math.LegacyDec
    MinNotional         math.LegacyDec
}

Fields description

  • Sender field describes the creator of this msg.

  • Ticker describes the ticker for the spot market.

  • BaseDenom specifies the type of coin to use as the base currency.

  • QuoteDenom specifies the type of coin to use as the quote currency.

  • MinPriceTickSize defines the minimum tick size of the order's price.

  • MinQuantityTickSize defines 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            math.LegacyDec
	TakerFeeRate            math.LegacyDec
	InitialMarginRatio      math.LegacyDec
	MaintenanceMarginRatio  math.LegacyDec
	MinPriceTickSize        math.LegacyDec
	MinQuantityTickSize     math.LegacyDec
    MinNotional             math.LegacyDec
}

Fields description

  • Sender field describes the creator of this msg.

  • Ticker field describes the ticker for the derivative market.

  • QuoteDenom field describes the type of coin to use as the base currency.

  • OracleBase field describes the oracle base currency.

  • OracleQuote field describes the oracle quote currency.

  • OracleScaleFactor field describes the scale factor for oracle prices.

  • OracleType field describes the oracle type.

  • MakerFeeRate field describes the trade fee rate for makers on the derivative market.

  • TakerFeeRate field describes the trade fee rate for takers on the derivative market.

  • InitialMarginRatio field describes the initial margin ratio for the derivative market.

  • MaintenanceMarginRatio field describes the maintenance margin ratio for the derivative market.

  • MinPriceTickSize field describes the minimum tick size of the order's price and margin.

  • MinQuantityTickSize field 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            math.LegacyDec
	TakerFeeRate            math.LegacyDec
	InitialMarginRatio      math.LegacyDec
	MaintenanceMarginRatio  math.LegacyDec
	MinPriceTickSize        math.LegacyDec
	MinQuantityTickSize     math.LegacyDec
    MinNotional             math.LegacyDec
}

Fields description

  • Sender field describes the creator of this msg.

  • Ticker field describes the ticker for the derivative market.

  • QuoteDenom field describes the type of coin to use as the quote currency.

  • OracleBase field describes the oracle base currency.

  • OracleQuote field describes the oracle quote currency.

  • OracleScaleFactor field describes the scale factor for oracle prices.

  • OracleType field describes the oracle type.

  • Expiry field describes the expiration time of the market.

  • MakerFeeRate field describes the trade fee rate for makers on the derivative market.

  • TakerFeeRate field describes the trade fee rate for takers on the derivative market.

  • InitialMarginRatio field describes the initial margin ratio for the derivative market.

  • MaintenanceMarginRatio field describes the maintenance margin ratio for the derivative market.

  • MinPriceTickSize field describes the minimum tick size of the order's price and margin.

  • MinQuantityTickSize field 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

  • Sender field describes the creator of this msg.

  • Order field 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

  • Sender field describes the creator of this msg.

  • Orders field 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

  • Sender field describes the creator of this msg.

  • Order field 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

  • Sender field describes the creator of this msg.

  • MarketId field describes the id of the market where the order is placed.

  • SubaccountId field describes the subaccount id that placed the order.

  • OrderHash field 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

  • Sender field describes the creator of this msg.

  • Data field 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

  • Sender field describes the creator of this msg.

  • Order field 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

  • Sender field describes the creator of this msg.

  • Orders field 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

  • Sender field describes the creator of this msg.

  • Order field 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

  • Sender field describes the creator of this msg.

  • MarketId field describes the id of the market where the order is placed.

  • SubaccountId field describes the subaccount id that placed the order.

  • OrderHash field 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

  • Sender field describes the creator of this msg.

  • Data field 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

  • Sender field describes the creator of this msg.

  • SourceSubaccountId field describes a source subaccount to send coins from.

  • DestinationSubaccountId field describes a destination subaccount to send coins to.

  • Amount field 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

  • Sender field describes the creator of this msg.

  • SourceSubaccountId field describes a source subaccount to send coins from.

  • DestinationSubaccountId field describes a destination subaccount to send coins to.

  • Amount field 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

  • Sender field describes the creator of this msg.

  • SubaccountId field describes a subaccount to receive liquidation amount.

  • MarketId field describes a market where the position is in.

  • Order field 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                  math.LegacyDec
}

Fields description

  • Sender field describes the creator of this msg.

  • SourceSubaccountId field describes a source subaccount to send balance from.

  • DestinationSubaccountId field describes a destination subaccount to receive balance.

  • MarketId field describes a market where positions are in.

  • Amount field 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

  • Sender field describes the creator of this msg.

  • SubaccountId field describes the sender's sub-account ID.

  • SpotMarketIdsToCancelAll field describes a list of spot market IDs for which the sender wants to cancel all open orders.

  • DerivativeMarketIdsToCancelAll field describes a list of derivative market IDs for which the sender wants to cancel all open orders.

  • SpotOrdersToCancel field describes specific spot orders the sender wants to cancel.

  • DerivativeOrdersToCancel field describes specific derivative orders the sender wants to cancel.

  • SpotOrdersToCreate field describes spot orders the sender wants to create.

  • DerivativeOrdersToCreate field describes derivative orders the sender wants to create.

Msg/AuthorizeStakeGrants

MsgAuthorizeStakeGrants is a message used to grant another address with staked INJ balance for fee discount purposes. It can also be used to revoke/remove grants if the amount granted is set to 0.

type MsgAuthorizeStakeGrants struct {
	Sender  string 
	Grants  []*GrantAuthorization 
}

Fields description

  • Sender describes the creator of this msg.

  • Grants describes a list of grantees' addresses and grant amounts

Msg/ActivateStakeGrant

MsgActivateStakeGrant is a message used to select/activate a stake grant for fee discount purposes.

type MsgActivateStakeGrant struct {
	Sender  string 
	Granter string 
}

Fields description

  • Sender describes the creator of this msg.

  • Granter describes the address of the granter.

State Transitions