Skip to main content
ouroborai includes four Stylus (Rust) contracts compiled to WASM for 10-100x gas savings on computation-heavy operations. This guide covers deploying them to Arbitrum Sepolia for testing.

Prerequisites

  • Rust toolchain with wasm32-unknown-unknown target
  • cargo-stylus CLI (cargo install cargo-stylus)
  • cast from Foundry for contract interaction
  • A funded Arbitrum Sepolia wallet (ETH for gas)
Get Sepolia ETH from the Arbitrum Sepolia faucet or bridge from Ethereum Sepolia via the Arbitrum bridge.

Contracts Overview

Deployment

1

Run tests locally

Before deploying, confirm all 115 Rust tests pass:
All four contracts share a workspace Cargo.toml and use the stylus-test feature flag for test utilities.
2

Validate with cargo-stylus

Check that the contract compiles to valid Stylus WASM. Run this for each contract:
Each check validates the WASM binary size, ABI compatibility, and entrypoint structure against the Stylus runtime.
3

Deploy each contract

Deploy using cargo stylus deploy. You need a private key with Sepolia ETH:
Each command outputs the deployed contract address. Save these addresses for the initialization step.
4

Initialize deployed contracts

After deployment, each contract must be initialized. Use cast send from Foundry:
Each contract can only be initialized once. Calling initialize a second time reverts with “already initialized”.
5

Register protocols (LiquidationMonitor and RouteOptimizer)

After initialization, register the protocols and DEXes each contract should monitor:
6

Verify with cast call

Confirm the contracts are functioning:

Deploying to Mainnet

The process is identical for Arbitrum One mainnet. Replace the RPC endpoint:
After mainnet deployment, update the contract addresses in packages/sdk/src/chain.ts to wire them into the TypeScript adapters.
Store deployed contract addresses in a shared configuration file or environment variables so all services reference the same deployment.