osmosis

Prop 790: Upload Orderbook as CW Pool

This proposal would add orderbooks as a new pool type. These pools allow limit orders to be placed at arbitrary price points while being compatible with all other deployments of liquidity on Osmosis.
## What are Orderbooks?
Orderbooks enable users to place orders at specific prices, ensuring priority execution at the desired price without depending on the availability of prior liquidity in pools. They also empower market makers to offer narrower spreads compared to the fixed spreads enforced by concentrated liquidity, where the swap fee acts as a minimum spread for the pool. The reduced spread also allows more competitive prices for highly correlated pairs, such as pairs of asset variants or stablecoins.

Limit orders have two main benefits.
* Trades that would otherwise see high slippage may be fulfilled with zero slippage once the target price is reached. Examples of these trades are buying a large amount of a highly liquid asset like ATOM or a small amount of an illiquid asset on Osmosis, such as PEPE.
* Traders who want to buy or sell at a specific price may set their desired target price for execution rather than watching the market for manual trading or using centralized services.

Implementing as a Cosmwasm pool type will integrate orderbooks into the sidecar routing service, and limit orders will automatically be factored into routes for swaps using this service. Therefore, Osmosis's existing volume will immediately flow through orderbooks when they have limit orders offering better execution prices than other sources of liquidity on Osmosis.

This implementation of an onchain orderbook uses a mechanism invented by the Osmosis Foundation that aims to be the most performant implementation of any currently live orderbook DEX in terms of runtime complexity. A complete whitepaper describing the mechanism will be released soon, but the implementation can be reviewed in the Github repo below, which was open sourced immediately prior to this post.

Osmosis governance will retain the admin of the order book contract to ensure transparency and decentralization. Osmosis contributors control a moderator account as a security measure, which can only freeze pools in case of a security vulnerability.
## Contract Details
Commit: 9f7e2aea2da983ab4943d039b351b55dbcf36fd3
Compiler Version: optimizer-arm64:0.16.0
Checksum: 41e1e49ff96e826ad61a96ee28cab6ec132e2d82f0064874a9e0faecd3b0cc73
Code repository: https://github.com/osmosis-labs/orderbook
Forum Thread:https://forum.osmosis.zone/t/upload-orderbook-contracts-as-cw-pool/2815