Polar Bear (🍨) needed a demonstrable rig-onchain-kit integration showing
how a rig-core agent safely accesses Solana on-chain data and queries DEX
liquidity while enforcing cryptographic signer isolation between concurrent
HFT agent tasks.
As Technology Lead, design and implement the polar-bear-rig-onchain GitHub
repo covering: rig-onchain-kit Solana/EVM + SignerContext security boundaries. Deliverables: working Rust project on Solana devnet, Solana
balance query, Jupiter V6 dry-run swap quote, structured SignerContext
isolation audit log, and full rig-core PEV-loop governance.
- Structured the codebase as a lib + bin crate (matching the
polar-bear-rig-hftstandard) withsrc/onchain/,src/agent/, andsrc/config.rsmodules. - Upgraded from the unsafe
thread_local!pattern totokio::task_local!viawith_signer(signer, f)- the correct async-safe signer isolation model described in therig-onchain-kitdocumentation. - Fixed the
rig-core0.36+ client API:Client::new(api_key)?(fallible), bothCompletionClientandProviderClientimported for.agent()to resolve. - Built three
rig::tool::Toolimplementations:SolanaBalanceTool,JupiterQuoteTool(Jupiter V6 read-only GET,dry_run = truebaked in with a runtimeassert!guard),SignerIsolationTool(snapshots the active task-local context for the Reactor GUI audit trail). - Added
IsolationReport- serialisable JSON audit record of the signer lifecycle (context_id, pubkey, created_at, boundary_sealed flag). - Implemented
clap-driven CLI with--mode [full|balance|quote|signer]and--wallet/--amountflags, matching thepolar-bear-rig-hftUX pattern. - Applied the full tooling stack:
rustfmt.toml(100 cols, 2024 edition),.clippy.toml(MSRV 1.93.1, complexity thresholds),[lints]table,[package.metadata.docs.rs].
- Fully compilable, zero-warning Rust project (
cargo clippy -D warnings). tokio::task_local!isolation verified across three concurrent async tasks intests/test_signer_context.rs.IsolationReportJSON emitted at the end of every pipeline run - direct input to the Reactor GUI audit trail.- Jupiter V6 dry-run quote with route breakdown and price impact log.
- Structured
tracingoutput with module-tagged events at every pipeline step. cargo run --example jupiter_dry_rundemonstrates the full flow without requiring an Anthropic API key.