-
Notifications
You must be signed in to change notification settings - Fork 8
docs: order book market types #111
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Brendan Graetz <[email protected]>
Signed-off-by: Brendan Graetz <[email protected]>
WalkthroughReorganized GitBook navigation: moved Token Standards under Wallet > DeFi and added INJ coin, Token Factory, and CW20 Standard pages beneath it; added a Wallet > Order Book entry. Introduced two new docs under DeFi/Order Book: an overview (CLOB) and market types/unified infrastructure. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Trader
participant DApp as Wallet / DApp
participant Exch as Exchange Module
participant Match as Matching Engine
participant Bank as Balances/Bank
participant Oracle as Oracle
Trader->>DApp: Place/modify/cancel order
DApp->>Exch: Tx: order instruction
rect rgba(200,230,255,0.3)
note right of Exch: Frequent Batch Auction window
Exch->>Match: Queue orders for batch
Match-->>Exch: Match results (fills/partial)
end
Exch->>Oracle: Fetch mark/settlement prices (as needed)
Exch->>Bank: Update balances/margins/fees
Exch-->>DApp: Tx receipt (fills, state updates)
DApp-->>Trader: Display confirmations
alt Perpetual funding/liq cycle
Exch->>Oracle: Get mark price
Exch->>Bank: Apply funding payments
Exch->>Exch: Trigger liquidations if thresholds breached
Exch->>Bank: Insurance fund/socialize if required
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (16)
.gitbook/defi/order-book/README.md (7)
1-1: Unify “Order Book” vs “orderbook” stylingTitle uses “Order Book” but body mixes “orderbook”/“Order Book”. Pick one repo-wide style and apply consistently. I suggest “order book” (noun) and “order‑book” only when adjectival.
3-4: Tone and claims: temper hype, add citationsPhrases like “most discussed topics of 2024 and 2025” and “institutional‑grade” read promotional. Either soften or add citations/links to back the claims.
8-9: VM comparisons: tighten language or citeBroad statements about gas/overhead/architectural limits across Ethereum/Solana/Aptos/Sui should either be scoped precisely or cited. Avoid overgeneralization.
10-11: Competitor architecture references: add sources or hedge“HyperCore and HyperEVM dual architecture” requires a reference. If not adding links, rephrase to neutral/hedged language.
12-14: “This paper” → “This document”; cross‑link FBA and Exchange module
- Replace “This paper” with “This document/page.”
- Add internal links to Exchange module concept docs and to an FBA explainer for readers.
Apply:
-This paper provides a comprehensive examination... +This document provides a comprehensive examination...
14-14: Front‑running claim: clarify scope“FBA … for front‑running prevention” → consider “mitigation” unless you provide a formal guarantee reference.
15-15: Stray character at EOFLine shows “15” with no content. Likely an artifact. Remove.
-15 +.gitbook/defi/order-book/market-types.md (9)
7-10: Settlement and risk phrasing“eliminating counterparty risk” is too strong; suggest “minimizing settlement/counterparty risk via atomic in‑block settlement.”
-Trades settle atomically within the same block, eliminating counterparty risk and settlement delays. +Trades settle atomically within the same block, minimizing counterparty/settlement risk and reducing settlement delays.
11-13: Uncomment or remove order types note; add cross‑linkEither surface supported order types with a link to “Order Types” doc or delete the commented line to avoid drift.
-<!-- The spot market infrastructure supports standard order types including market orders, limit orders, and stop orders. --> +The spot market infrastructure supports standard order types (market, limit, stop). See [Order Types](../../trading/order-types.md) for details.
18-23: Funding rate specifics: add cadence/formula linkMention funding interval and link to existing “Funding Rates” doc to avoid ambiguity.
-... payments exchanged between long and short position holders every funding period. +... payments exchanged between long and short position holders every funding period (see cadence and formula in [Funding Rates](../../trading/margin-funding-rates.md)).
20-21: Liquidation/insurance: add doc linksCross‑link to liquidation and insurance fund docs to anchor behavior.
-... trigger liquidation processes that close positions, update insurance fund balances, and handle any resulting socialized losses ... +... trigger liquidation processes that close positions, update [insurance fund](../../developers-native/query-chain/insurance-funds.md) balances, and handle any resulting socialized losses (see [Liquidation](../../trading/margin-liquidation.md)) ...
26-30: Expiry settlement sourceAdd link to Oracle module and any expiry settlement spec to substantiate deterministic settlement description.
-... calculates settlement prices using Oracle module price feeds ... +... calculates settlement prices using [Oracle module](../../developers-native/injective/oracle/README.md) price feeds ...
34-38: Binary options availability caveatIf binary options are not universally enabled on mainnet, add a short availability note to prevent misinterpretation.
42-47: Portfolio/cross‑margin claims: qualify or linkCross‑margining/portfolio‑level risk controls vary by configuration. Add references or qualify (“can enable”).
-... enable cross-margining between positions, and implement global risk controls ... +... can enable cross‑margining between positions and implement global risk controls ...
50-55: Module names and numbers: fix casing; avoid brittle “12+ modules”
- “Wasmx” → “WasmX” (consistent with SUMMARY).
- Replace “12+ custom modules” with “a set of additional native modules” to avoid future drift.
-... the Wasmx module ... +... the WasmX module ... -... any other of Injective's 12+ custom modules ... +... other native modules provided by Injective ...
3-4: Link back to overviewAdd a short intro line linking to the CLOB overview page for context.
-One of the most compelling demonstrations... +As introduced in the [Order Book overview](./README.md), one of the most compelling demonstrations...
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.gitbook/SUMMARY.md(1 hunks).gitbook/defi/order-book/README.md(1 hunks).gitbook/defi/order-book/market-types.md(1 hunks)
🔇 Additional comments (3)
.gitbook/defi/order-book/README.md (1)
7-7: Historical claim needs a source“Operating … since its inception (2018)… supporting spot, perpetuals, expiry, binary options.” Please link to a dated announcement, release notes, or module docs confirming availability timelines.
.gitbook/SUMMARY.md (2)
8-12: Navigation move LGTM; check duplicationRelocation of Token Standards under Wallet looks fine. Please confirm the old Trading section no longer references Token Standards to avoid duplicates.
9-11: Token pages: confirm paths and casingVerify these files exist at the specified paths and that “CW20 Standard” casing matches its filename to prevent 404s in GitBook.
| * [INJ coin](defi/tokens/inj-coin.md) | ||
| * [Token Factory](defi/tokens/token-factory.md) | ||
| * [CW20 Standard](defi/tokens/cw20-standard.md) | ||
| * [Order Book](defi/order-book/README.md) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add child page for Market Types
The new defi/order-book/market-types.md isn’t linked. Add it under “Order Book” to avoid an orphan page.
* [Order Book](defi/order-book/README.md)
+ * [Market Types](defi/order-book/market-types.md)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| * [Order Book](defi/order-book/README.md) | |
| * [Order Book](defi/order-book/README.md) | |
| * [Market Types](defi/order-book/market-types.md) |
🤖 Prompt for AI Agents
In .gitbook/SUMMARY.md around line 12, the new page
defi/order-book/market-types.md is not linked under the "Order Book" section,
leaving it orphaned; add a child entry for Market Types below the Order Book
line (e.g., a new list item linking to defi/order-book/market-types.md) so the
page appears in the sidebar and is discoverable.
Summary by CodeRabbit