You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .gitbook/developers/modules/injective/auction/02_messages.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
2
sidebar_position: 2
3
-
title: Messages
3
+
title: Messages
4
4
---
5
5
6
6
# Messages
7
7
8
-
In this section, we describe the processing of the auction messages and the corresponding updates to the state.
8
+
In this section we describe the processing of the auction messages and the corresponding updates to the state.
9
9
10
10
## Msg/Bid
11
11
@@ -26,7 +26,7 @@ message MsgBid {
26
26
27
27
This service message is expected to fail if:
28
28
29
-
*`Round` does not equal the current auction round
30
-
*`BidAmount` does not exceed the previous highest bid amount by at least `min_next_increment_rate` percent.
29
+
-`Round` does not equal the current auction round
30
+
-`BidAmount` does not exceed the previous highest bid amount by at least `min_next_increment_rate` percent.
31
31
32
32
This service message transfers the `BidAmount` of INJ from the `Sender` to the auction module, stores the bid, and refunds the last bidder's bid amount.
The settlement of a given auction round occurs when `blockTime ≥ EndingTimeStamp.` If a non-zero INJ bid was placed during this period (i.e., there exists a `LastBid`), the following procedure will take place:
10
+
The settlement of a given auction round occurs when `blockTime ≥ EndingTimeStamp.` If a non-zero INJ bid was placed during this period (i.e. there exists a `LastBid`), the following procedure will take place:
11
11
12
-
* The winning INJ bid amount is burned.
13
-
* The basket of coins held by the auction module is transferred to the winning bidder.
14
-
*`LastAuctionResult` is written to state and `EventAuctionResult` is emitted.
15
-
* The `LastBid` is cleared.
16
-
* The AuctionRound is incremented by 1 and the EndingTimestamp is incremented by `AuctionPeriod`.
17
-
* The accumulated exchange fees are transferred from the `exchange` module to the `auction` module for the new upcoming auction.
12
+
- The winning INJ bid amount is burned.
13
+
- The basket of coins held by the auction module is transferred to the winning bidder.
14
+
-`LastAuctionResult` is written to state and `EventAuctionResult` is emitted.
15
+
- The `LastBid` is cleared.
16
+
- The AuctionRound is incremented by 1 and the EndingTimestamp is incremented by `AuctionPeriod`.
17
+
- The accumulated exchange fees are transferred from the `exchange` module to the `auction` module for the new upcoming auction.
18
18
19
-
If the round closed without any successful bids, the existing coin basket will be rolled over into the next auction and combined with the new accumulated fee basket.
19
+
If the round closed without any successful bids, the existing coin basket will be rolled over into the next auction and combined with the new accumulated fee basket.
The `auction` module periodically obtains a basket of tokens accumulated from trading fees from the `exchange` module and auctions the basket to the highest bidder in an open English auction for INJ. The winner of this auction receives the basket of tokens, and the winning INJ bid amount from this auction is burned.
5
+
The `auction` module periodically obtains a basket of tokens accumulated from trading fees from the `exchange` module and auctions the basket to the highest bidder in an open English auction for INJ. The winner of this auction receives the basket of tokens and the winning INJ bid amount from this auction is burned.
Copy file name to clipboardExpand all lines: .gitbook/developers/modules/injective/exchange/01_spot_market_concepts.md
+53-39Lines changed: 53 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,68 +3,79 @@ sidebar_position: 2
3
3
title: Spot Market Concepts
4
4
---
5
5
6
-
# Spot Markets Concepts
6
+
# Spot Market Concepts
7
7
8
8
## Definitions
9
9
10
10
In a Spot Market with ticker **AAA/BBB, AAA is the base asset, BBB is the quote asset.**
11
11
12
12
For example, in the ETH/USDT market
13
13
14
-
* ETH is base asset
15
-
* USDT is the quote asset
14
+
- ETH is base asset
15
+
- USDT is the quote asset
16
16
17
-
The spot market's **price** refers to how much USDT (the quote asset) is required for one unit of ETH (the base asset). For all spot markets, **fees are always paid in the quote asset**, e.g., USDT.
17
+
The spot market's **price** refers to how much USDT (the quote asset) is required for one unit of ETH (the base
18
+
asset). For all spot markets, **fees are always paid in the quote asset**, e.g., USDT.
18
19
19
-
**Debit vs. Credit**
20
+
**Debit vs Credit**
20
21
21
-
***Debit Amount** refers to the amount of asset that is withdrawn from an account.
22
-
***Credit Amount** refers to the amount of asset that is deposited to an account.
22
+
-**Debit Amount** refers to the amount of asset that is withdrawn from an account.
23
+
-**Credit Amount** refers to the amount of asset that is deposited to an account.
23
24
24
25
**Refunds**
25
26
26
-
In our system, a refund refers to the action of incrementing the **available balance** of an account. This liberation of funds occurs as the result of an encumbrance being lifted from the account (e.g. cancelling a limit order, reducing an order's payable fee to a maker fee, using less margin to fund a market order, etc.).
27
+
In our system, a refund refers to the action of incrementing the **available balance** of an account. This liberation of
28
+
funds occurs as the result of an encumbrance being lifted from the account (e.g. cancelling a limit order, reducing an
29
+
order's payable fee to a maker fee, using less margin to fund a market order, etc.).
27
30
28
31
### Limit Buy Order
29
32
30
-
A limit buy order seeks to buy a specified `Quantity` ETH (**base asset**) in exchange for `Quantity * Price` amount of USDT (**quote asset**) **plus fees,** which depend on whether the limit order becomes executed as a maker order or a taker order.
33
+
A limit buy order seeks to buy a specified `Quantity` ETH (**base asset**) in exchange for `Quantity * Price` amount of
34
+
USDT (**quote asset**) **plus fees** which depend on whether the limit order becomes executed as a maker order or a
35
+
taker order.
31
36
32
37
### Limit Sell Order
33
38
34
-
A limit sell order seeks to sell a specified `Quantity` ETH (**base asset**) in exchange for `Quantity * Price` amount of USDT (**quote asset**) **minus fees,** which depend on whether the limit order becomes executed as a maker order or a taker order.
39
+
A limit sell order seeks to sell a specified `Quantity` ETH (**base asset**) in exchange for `Quantity * Price` amount
40
+
of USDT (**quote asset**) **minus fees** which depend on whether the limit order becomes executed as a maker order or a
41
+
taker order.
35
42
36
43
### Market Buy Order
37
44
38
-
A market buy order seeks to buy a specified `Quantity` ETH (**base asset**) at a specified worst price which is at or near the current ask using the respective account quote asset balance (USDT) as collateral\*\* (inclusive of fees).
45
+
A market buy order seeks to buy a specified `Quantity` ETH (**base asset**) at a specified worst price which is at or near
46
+
the current ask using the respective account quote asset balance (USDT) as collateral\*\* (inclusive of fees).
39
47
40
-
As a result, each market buy order implicitly has a maximum acceptable price associated with it, as filling the market order beyond that price would simply fail due to a lack of funds.
48
+
As a result, each market buy order implicitly has a maximum acceptable price associated with it, as filling the market
49
+
order beyond that price would simply fail due to a lack of funds.
41
50
42
51
### Market Sell Order
43
52
44
-
A market sell order seeks to sell a specified `Quantity` ETH (**base asset**) at a specified worst price which is at or near the current bid in exchange for any amount of the quote asset (USDT) available in the market.
53
+
A market sell order seeks to sell a specified `Quantity` ETH (**base asset**) at a specified worst price which is at or
54
+
near the current bid in exchange for any amount of the quote asset (USDT) available in the market.
45
55
46
56
As a result, each market sell order implicitly has a zero price associated with it.
47
57
48
58
### Order Types
49
59
50
-
* BUY (1): A standard buy order to purchase an asset at either the current market price or a set limit price.
51
-
* SELL (2): A standard sell order to sell an asset at either the current market price or a set limit price.
52
-
* STOP_BUY (3): This order type is not supported for spot markets.
53
-
* STOP_SELL (4): This order type is not supported for spot markets.
54
-
* TAKE_BUY (5): This order type is not supported for spot markets.
55
-
* TAKE_SELL (6): This order type is not supported for spot markets.
56
-
* BUY_PO (7): Post-Only Buy. This order type ensures that the order will only be added to the order book and not match with a pre-existing order. It guarantees that you will be the market "maker" and not the "taker".
57
-
* SELL_PO (8): Post-Only Sell. Similar to BUY_PO, this ensures that your sell order will only add liquidity to the order book and not match with a pre-existing order.
58
-
* BUY_ATOMIC (9): An atomic buy order is a market order that gets executed instantly, bypassing the Frequent Batch Auctions (FBA). It's intended for smart contracts that need to execute a trade instantly. A higher fee is paid, defined in the global exchange parameters.
59
-
* SELL_ATOMIC (10): An atomic sell order is similar to a BUY_ATOMIC, and it gets executed instantly at the current market price, bypassing the FBA.
60
+
- BUY (1): A standard buy order to purchase an asset at either the current market price or a set limit price.
61
+
- SELL (2): A standard sell order to sell an asset at either the current market price or a set limit price.
62
+
- STOP_BUY (3): This order type is not supported for spot markets.
63
+
- STOP_SELL (4): This order type is not supported for spot markets.
64
+
- TAKE_BUY (5): This order type is not supported for spot markets.
65
+
- TAKE_SELL (6): This order type is not supported for spot markets.
66
+
- BUY_PO (7): Post-Only Buy. This order type ensures that the order will only be added to the order book and not match with a pre-existing order. It guarantees that you will be the market "maker" and not the "taker".
67
+
- SELL_PO (8): Post-Only Sell. Similar to BUY_PO, this ensures that your sell order will only add liquidity to the order book and not match with a pre-existing order.
68
+
- BUY_ATOMIC (9): An atomic buy order is a market order that gets executed instantly, bypassing the Frequent Batch Auctions (FBA). It's intended for smart contracts that need to execute a trade instantly. A higher fee is paid defined in the global exchange parameters.
69
+
- SELL_ATOMIC (10): An atomic sell order is similar to a BUY_ATOMIC, and it gets executed instantly at the current market price, bypassing the FBA.
60
70
61
71
### Market Data Requirements
62
72
63
-
Orderbook data aside, so long as our Chain supports the **base capability** to obtain Tick by Tick trading data, aggregations can be applied to obtain most of the necessary higher order data, including
73
+
Orderbook data aside, so long as our Chain supports the **base capability** to obtain Tick by Tick trading data,
74
+
aggregations can be applied to obtain most of the necessary higher order data, including
64
75
65
-
* OHLCV data
66
-
* Account Trading History
67
-
* Market Statistics
76
+
- OHLCV data
77
+
- Account Trading History
78
+
- Market Statistics
68
79
69
80
## Spot Market Lifecycle
70
81
@@ -74,9 +85,10 @@ A market is first created either by the instant launch functionality through `Ms
74
85
75
86
### Listing Fee based Spot Market Creation
76
87
77
-
Allow anyone to create an active spot market of their choice without requiring governance approval by burning a pre-set SpotMarketInstantListingFee of INJ.
88
+
Allow anyone to create an active spot market of their choice without requiring governance approval by burning a pre-set
89
+
SpotMarketInstantListingFee of INJ.
78
90
79
-
We should still check that the denom is valid, though.
91
+
We should still check that the denom is valid though.
80
92
81
93
### Spot Market Status Update
82
94
@@ -89,15 +101,17 @@ A Spot Market can exist in four different states:
89
101
90
102
#### **Active State**
91
103
92
-
If a spot market is in an active state, it can accept orders and trades.
104
+
If a spot market is an active state, it can accept orders and trades.
93
105
94
106
#### Paused State
95
107
96
-
If a spot market is in a paused state, it will no longer accept orders and trades and will also not allow any users to take actions on that market (no order cancellations).
108
+
If a spot market is a paused state, it will no longer accept orders and trades and will also not allow any users to take
109
+
actions on that market (no order cancellations).
97
110
98
111
#### Suspended State
99
112
100
-
If a spot market is in a suspended state, it will no longer accept orders and trades, and will only allow traders to cancel their orders.
113
+
If a spot market is a suspended state, it will no longer accept orders and trades, and will only allow traders to cancel
114
+
their orders.
101
115
102
116
## Demolished State
103
117
@@ -107,15 +121,15 @@ When a market becomes demolished, all outstanding orders are cancelled.
107
121
108
122
There are three state transitions that correspond to the following status changes
109
123
110
-
* Activate Action - **Paused or Suspended Status → Active Status**
111
-
* Pause Action - **Active or Suspended Status → Paused Status**
112
-
* Suspend Action - **Active or Paused Status → Suspended Status**
113
-
* Demolish Action - **Paused or Suspended Status → Demolished Status**
124
+
- Activate Action - **Paused or Suspended Status → Active Status**
125
+
- Pause Action - **Active or Suspended Status → Paused Status**
126
+
- Suspend Action - **Active or Paused Status → Suspended Status**
127
+
- Demolish Action - **Paused or Suspended Status → Demolished Status**
0 commit comments