Skip to content

dfinity/oisy-trade

Repository files navigation

OISY TRADE

CI License: Apache 2.0 Rust Internet Computer

OISY TRADE is an order-book DEX on the Internet Computer.

📖 Full documentation →

Table of Contents

✨ Key Features

  • CEX-like experience — deposit once, trade as much as you want, withdraw anytime
  • Fully onchain order book — central limit order book (CLOB) running entirely within a single canister
  • Permissionless trading — any principal can trade on any active pair, no allowlisting required

🏗️ Architecture

  • Single canister: all order book state, matching, and settlement live in one canister.
  • Synchronous matching engine: token transfers only happen at the deposit/withdrawal edges; the matching engine operates entirely on internal balances, with no async complexity.
  • Event-sourced state: every state change is recorded in an append-only log in stable memory and replayed on upgrade, providing full auditability and simpler upgrades.

See the design document for the full architecture.

🚀 Deployment

Environment Canister ID Listings
🚀 Production sy2xe-miaaa-aaaar-qb7sq-cai Coming soon!
🧪 Staging proc5-daaaa-aaaar-qb5va-cai Trade test tokens

📘 Usage

Walk through the main OISY TRADE flows against the staging canister using only the icp CLI: discover trading pairs, approve OISY TRADE as an ICRC-2 spender, deposit, place a limit order, check its status, and withdraw.

See the Getting Started walkthrough.

🤖Agents

Talk to your agent to interact with OISY TRADE 😎.

Buy 0.01 SOL at a limit price of 0.037 ETH per SOL

Agent placing an order

See the Agents guide.

🛠️ Development

Prerequisites

Install mise and then run mise install from the repository root to set up Rust, just, and other pinned tools defined in mise.toml.

Additionally:

Build

List all available recipes with just.

Command Description
just lint Run linter
just build Build the canister WASM (native)
just docker-build Build the canister WASM reproducibly
just test Run unit and integration tests
just ci Run all checks, build, and tests

Reproducible build

just docker-build produces wasms/oisy_trade_canister.wasm.gz that is byte-identical regardless of host platform, as long as Docker is available. The build runs inside a linux/amd64 container with a digest-pinned base image and a pinned Rust toolchain; on Apple Silicon it transparently runs under Rosetta/QEMU.

CI verifies reproducibility by building the same commit twice on different runner images (ubuntu-22.04 and ubuntu-24.04) and asserting the SHA-256 hashes match.

To verify a tagged release against the canister deployed on the IC, check out the tag and run:

just docker-build
sha256sum wasms/oisy_trade_canister.wasm.gz

The resulting hash should match both the SHA-256 published in the GitHub Release notes and the canister's module hash on the IC.

Deploy to staging

Requires the icp CLI with an identity that has deployment permissions. By default the hsm identity is used; override with just deploy <identity>. Pass an optional second argument to read the identity's unlock secret (HSM PIN or encrypted-PEM password) from a file and run non-interactively:

just deploy                                   # default: hsm, interactive unlock
just deploy dev                               # non-hsm identity, interactive unlock
just deploy hsm ~/.config/icp/hsm.pin         # non-interactive with PIN file

Releasing

Releases are cut from main with release-plz in two manual steps:

  1. Open the release PR. Run the Release workflow (Actions → Release → Run workflow). It opens a PR that bumps the crate versions and updates the changelogs from the conventional commits made since the last release.
  2. Merge the release PR. Review and merge it. Merging triggers the Publish workflow, which:
    • tags the released crates,
    • builds oisy_trade_canister.wasm.gz reproducibly from the tagged commit and publishes a GitHub Release with the WASM, its SHA-256, the candid interface, and the deployment status, and
    • publishes oisy_trade_types to crates.io.

The pipeline does not deploy — releasing and deploying are separate steps.

Packages

 
 
 

Contributors

Languages