Skip to content

C 533/add atomic order types to exchange precompile#27

Open
arrivets wants to merge 4 commits intomasterfrom
C-533/add-atomic-order-types-to-exchange-precompile
Open

C 533/add atomic order types to exchange precompile#27
arrivets wants to merge 4 commits intomasterfrom
C-533/add-atomic-order-types-to-exchange-precompile

Conversation

@arrivets
Copy link
Contributor

@arrivets arrivets commented Jan 5, 2026

goes with https://github.com/InjectiveLabs/injective-core/pull/2576

Summary by CodeRabbit

  • Documentation

    • Extended orderType field documentation to include "buyAtomic" and "sellAtomic" as permitted order types
  • Tests

    • Added test wrapper functions for spot and derivative market orders

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 5, 2026

📝 Walkthrough

Walkthrough

Documentation for orderType fields updated to include "buyAtomic" and "sellAtomic" values. Two new wrapper functions added to ExchangeTest that forward spot and derivative market orders to the exchange module while passing the test contract address.

Changes

Cohort / File(s) Summary
Documentation Updates
src/Exchange.sol
Updated orderType comment in DerivativeOrder and SpotOrder to document extended permitted values including "buyAtomic" and "sellAtomic"
Test Wrapper Functions
src/tests/ExchangeTest.sol
Added two pass-through functions: createSpotMarketOrder() and createDerivativeMarketOrder() that forward calls to exchange module with test contract address

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 Hopping through with docs so clear,
New atomic orders appear!
Wrapper functions, simple and neat,
Make testing exchanges complete.

Pre-merge checks

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: adding atomic order types (buyAtomic and sellAtomic) to the exchange precompile, which is supported by both the documentation updates in Exchange.sol and the test infrastructure additions in ExchangeTest.sol.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/Exchange.sol (1)

465-465: Minor formatting inconsistency and verify backend support.

The documentation update correctly adds the new atomic order types. However:

  1. There's an extra space after the opening parenthesis: ( "buy" should be ("buy" to match line 273's formatting.
  2. Since this PR depends on injective-core PR #2576, verify that the backend precompile implementation actually supports these new "buyAtomic" and "sellAtomic" order types.
🔎 Proposed formatting fix
-        /// order type ( "buy", "sell", "buyPostOnly", "sellPostOnly", "buyAtomic", or "sellAtomic")
+        /// order type ("buy", "sell", "buyPostOnly", "sellPostOnly", "buyAtomic", or "sellAtomic")

To verify backend support, please confirm that injective-core PR #2576 has been merged and includes support for these order types, or run integration tests against the updated backend.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ec4a903 and d3db38a.

⛔ Files ignored due to path filters (1)
  • lib/.DS_Store is excluded by !**/.DS_Store
📒 Files selected for processing (2)
  • src/Exchange.sol
  • src/tests/ExchangeTest.sol
🔇 Additional comments (3)
src/Exchange.sol (1)

273-273: Documentation update looks good.

The addition of "buyAtomic" and "sellAtomic" order types to the documentation aligns with the PR objectives.

src/tests/ExchangeTest.sol (2)

95-99: LGTM! Clean wrapper implementation.

This helper function correctly wraps the exchange module's createSpotMarketOrder method, passing the test contract as the sender. The use of calldata for input and memory for output is appropriate.


101-105: LGTM! Consistent with spot market order wrapper.

This helper function correctly mirrors the structure of createSpotMarketOrder for derivative orders, maintaining consistency in the test contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant