feat(docs): add Orderbook integration page#314
Draft
JohnnyWyles wants to merge 2 commits into
Draft
Conversation
Document the sumtree-orderbook CosmWasm contract as an integration surface: how to discover live orderbook markets, place / cancel / claim orders, query book state, and route swaps through SQS. Content sourced from: - osmosis-labs/orderbook contract source (contracts/sumtree-orderbook/src/msg.rs) for the ExecuteMsg and QueryMsg surface. - osmosis-labs/orderbook-claimbot README for the batch_claim flow and scanning logic. - osmosis-labs/sqs router/usecase/pools/routable_cw_orderbook_pool.go for the routing integration shape. Notes on what was deliberately not included: - No specific contract addresses. Orderbook markets are governance- instantiated CosmWasm contracts that rotate over time; the page tells integrators to read live SQS pools or chain state at submission time. - No specific code IDs for the same reason. - The two cross-references to the SQS integration page use absolute https://docs.osmosis.zone URLs because the SQS page lives on a parallel PR and is not yet on main. The URLs will resolve once that PR lands and can be relativised then. sidebar_position: 14 (next to sqs.md / rpc.md / rest.md / grpc.md, the API-integration cluster).
A pass through the page running every documented query against pool
1930 on mainnet and reading the SQS Go source (instead of READMEs)
surfaced several errors:
- place_limit example uses claim_bounty 0.0001 (matching the Osmosis
frontend's hardcoded value in use-place-limit.ts) instead of an
inflated example.
- calc_out_amt_given_in renamed to calc_out_amount_given_in - the
former does not exist on the deployed contract (code id 885), the
variant in source is the only one currently usable.
- orderbook_state response shape corrected to the actual flat fields
(quote_denom, base_denom, current_tick, next_bid_tick,
next_ask_tick) instead of describing it as the full Orderbook
struct.
- orders_by_owner and orders_by_tick now document the
{ orders, count } response shape.
- Routing through SQS rewritten from sqs/router/usecase/pools/
routable_cw_orderbook_pool.go and pools_usecase.go: SQS walks
ticks in-process via TickToPrice rather than calling
calc_out_amount_given_in at quote time; orderbooks are auto-
discovered by matching code_id against the OrderbookCodeIDs
config list, so new instances from existing code ids need no
operator action; documents the public canonical-orderbook and
canonical-orderbooks endpoints; narrows the "register your code
id" caveat to brand-new code ids only.
- Admin and moderator section rewritten from auth.rs. Now lists the
full message surface (transfer_admin, cancel_admin_transfer,
claim_admin, reject_admin_transfer, renounce_adminship,
offer_moderator, claim_moderator, reject_moderator_offer,
set_active, set_maker_fee, set_maker_fee_recipient) and assigns
each to its actual caller role per the ensure_is_* checks.
Specifically: set_maker_fee and set_maker_fee_recipient are
admin-only despite living in the enum's "Shared messages" section
(the source comment was misleading); set_active is the only
truly shared message.
- Instantiation section now documents that admin (Osmosis governance
module account) and moderator (DAODAO circuit-breaker subDAO)
are compile-time constants set in constants.rs, ignoring
info.sender. The instantiating address gets no special privilege.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New page at
docs/overview/integrate/orderbook.mddocumenting the sumtree-orderbook CosmWasm contract as an integration surface for the Osmosis docs site.What the page covers
/pools, thex/cosmwasmpoolqueries, and direct contract addressing.base_denom,quote_denom), with explicit documentation that the admin is hardcoded to the Osmosis governance module account and the moderator is hardcoded to a DAODAO circuit-breaker subDAO at compile time (verified viaconstants.rsand a liveauth.admin/auth.moderatorquery against pool 1930).osmosisd tx wasm executeexamples forplace_limit,cancel_limit,claim_limit, andbatch_claim. Theplace_limitexample usesclaim_bounty: "0.0001"to match the hardcoded value inosmosis-frontend/packages/web/hooks/limit-orders/use-place-limit.ts.spot_price,calc_out_amount_given_in,get_total_pool_liquidity,get_swap_fee.denoms,orderbook_state(documented with its actual flat-field response shape),is_active,all_ticks,ticks_by_id,orders_by_ownerandorders_by_tick(both with the{ orders, count }response shape),get_maker_fee,get_unrealized_cancels.routable_cw_orderbook_pool.goandpools_usecase.gorather than the SQS README:code_idagainst the configuredOrderbookCodeIDslist. New contract instances from an existing code id are picked up automatically./pools/canonical-orderbookand/pools/canonical-orderbooksendpoints.TickToPrice; it does not call the contract at quote time. The fillis a standard
osmosis.poolmanager.v1beta1.MsgSwapExactAmountIn.instances.
auth.rsand reconciled against theensure_is_*checks in each dispatcher.Documents the full admin/moderator/offered-address message surface plus the
authnamespace. Notes the inconsistency whereset_maker_feeandset_maker_fee_recipientare admin-only despite appearing in the enum's "Shared messages" section.Sources
Every claim on the page was verified against either the live contract on pool 1930 (via direct LCD queries) or the upstream
Osmosis-labs source:
osmosis-labs/orderbook—contracts/sumtree-orderbook/src/{msg.rs,auth.rs,order.rs,constants.rs}osmosis-labs/orderbook-claimbot— README and inspector source for the claim-bot scanning algorithmosmosis-labs/sqs—router/usecase/pools/routable_cw_orderbook_pool.go,pools/usecase/pools_usecase.go,domain/config.goosmosis-labs/osmosis-frontend—packages/web/hooks/limit-orders/use-place-limit.tsfor the liveclaim_bountyconstantNotes for the reviewer
https://docs.osmosis.zoneURLs because the SQS page lives on the parallel PR feat(docs): add Sidecar Query Server (SQS) integration page #310 and is not yet onmain. They resolve as soon as feat(docs): add Sidecar Query Server (SQS) integration page #310 lands and can be relativised in a follow-up.sidebar_position: 14slots immediately aftersqs.md(13), next to the API-integration cluster.Verification
yarn buildclean.auth { admin: {} }/auth { moderator: {} }on pool 1930.place_limitexample reads correctly —--amountmust matchquantityof the side'scollateral denom (quote for bids, base for asks)