https://github.com/dfinity/oisy-trade
Order book DEX
https://github.com/dfinity/oisy-trade
br-protected-2
Last synced: 10 days ago
JSON representation
Order book DEX
- Host: GitHub
- URL: https://github.com/dfinity/oisy-trade
- Owner: dfinity
- License: apache-2.0
- Created: 2026-03-27T09:48:25.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-07-20T13:26:51.000Z (11 days ago)
- Last Synced: 2026-07-20T14:11:41.358Z (11 days ago)
- Topics: br-protected-2
- Language: Rust
- Homepage: https://dfinity.github.io/oisy-trade/
- Size: 1.83 MB
- Stars: 9
- Watchers: 0
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Notice: NOTICE
Awesome Lists containing this project
README
# OISY TRADE
[](https://github.com/dfinity/oisy-trade/actions/workflows/ci.yml)
[](LICENSE)
[](https://www.rust-lang.org/)
[](https://internetcomputer.org/)
> OISY TRADE is an order-book DEX on the [Internet Computer](https://internetcomputer.org/).
π **[Full documentation β](https://dfinity.github.io/oisy-trade/)**
## Table of Contents
- [Key Features](#key-features)
- [Architecture](#architecture)
- [Deployment](#deployment)
- [Usage](#usage)
- [Development](#development)
- **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
- **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](https://dfinity.github.io/oisy-trade/development/design.html) for the full architecture.
| Environment | Canister ID | Listings |
|---------------------|--------------------------------------------------------------------------------------------------------------|-------------------|
| π Production | [`sy2xe-miaaa-aaaar-qb7sq-cai`](https://dashboard.internetcomputer.org/canister/sy2xe-miaaa-aaaar-qb7sq-cai) |
- ICP/ckUSDT
- More to come soon!
| π§ͺ Staging | [`proc5-daaaa-aaaar-qb5va-cai`](https://dashboard.internetcomputer.org/canister/proc5-daaaa-aaaar-qb5va-cai) | Trade test tokens |
Walk through the main OISY TRADE flows against the staging canister using only the [`icp` CLI](https://cli.internetcomputer.org/): 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](https://dfinity.github.io/oisy-trade/usage/for-users.html).
### π€Agents
Talk to your agent to interact with OISY TRADE π.
> Buy 0.01 SOL at a limit price of 0.037 ETH per SOL

See the [Agents guide](https://dfinity.github.io/oisy-trade/usage/for-agents.html).
### Prerequisites
Install [`mise`](https://mise.jdx.dev/) and then run `mise install` from the repository root to set up Rust, `just`, and other pinned tools defined in [`mise.toml`](mise.toml).
Additionally:
- [icp CLI](https://cli.internetcomputer.org/)
- [Docker](https://docs.docker.com/get-docker/) with `buildx` (only for `just docker-build`)
### 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:
```bash
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](https://cli.internetcomputer.org/) with an identity that has deployment permissions.
By default the `hsm` identity is used; override with `just deploy `. 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:
```bash
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](https://release-plz.dev/) in two manual steps:
1. **Open the release PR.** Run the [`Release`](.github/workflows/release.yml) workflow (Actions β Release β *Run workflow*). It opens a PR that bumps the crate versions and updates the changelogs from the [conventional commits](https://www.conventionalcommits.org/) made since the last release.
2. **Merge the release PR.** Review and merge it. Merging triggers the [`Publish`](.github/workflows/publish.yml) 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](https://crates.io/).
The pipeline does not deploy β releasing and deploying are separate steps.