Prerequisites
- Rust toolchain with
wasm32-unknown-unknowntarget - 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 Each command outputs the deployed contract address. Save these addresses
for the initialization step.
cargo stylus deploy. You need a private key with Sepolia
ETH:4
Initialize deployed contracts
After deployment, each contract must be initialized. Use
cast send from
Foundry: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:packages/sdk/src/chain.ts to wire them into the TypeScript adapters.