Polar Bear Systems · Technology Lead: Murtaza Ali Imtiaz This repository is published under a restricted proprietary licence for portfolio and reference purposes. See LICENSE-PBS for permitted use.
| Tool | Version | Install |
|---|---|---|
| Rust stable toolchain | ≥ 1.85.0 | rustup update stable |
rustfmt |
(with toolchain) | rustup component add rustfmt |
clippy |
(with toolchain) | rustup component add clippy |
git clone https://github.com/murtazaai/polar-bear-rig-onchain
cd polar-bear-rig-onchain
cp .env.example .env
# Edit .env: set ANTHROPIC_API_KEY=sk-ant-...
cargo build # debug
cargo build --release # optimised
# Full pipeline (dry-run)
cargo run --release -- --mode full --wallet <DEVNET_ADDRESS> --amount 0.1
# Individual subsystems
cargo run --release -- --mode balance
cargo run --release -- --mode quote
cargo run --release -- --mode signer
cargo run --example signer_demo
cargo run --example balance_demo
cargo run --example jupiter_dry_run
cargo test # all deterministic tests
cargo test --test test_signer_context # signer isolation only
cargo test --test test_balance # Lamports conversion only
cargo test --test test_jupiter # Jupiter constants only
ANTHROPIC_API_KEY=sk-ant-... cargo test --test providers -- --ignored --test-threads=1
cargo fmt --all # format
cargo clippy --all-targets -- -D warnings # lint (zero warnings)
cargo doc --open # browse API docs
RUSTDOCFLAGS="--cfg docsrs" cargo doc # with docsrs conditional items
- Edition: Rust 2024
- Max line width: 100 characters (enforced by
rustfmt.toml) - Imports: always import both
rig::client::CompletionClientandrig::client::ProviderClientwhen calling.agent()on any rig-core 0.36+ Anthropic client - Doc comments:
//!for module-level docs;///for items; never///on macro invocation sites (tokio::task_local!etc.) - Error handling: always
anyhow::Result; propagate with?; nounwrapin library code - Signer storage: always
tokio::task_local!(neverthread_local!in async code)
- Add a new
struct MyToolinsrc/agent/tools.rs. - Implement
rig::tool::Toolfor it. - Wire it into
agent::build()insrc/agent/mod.rswith.tool(MyTool). - Add a test in the appropriate
tests/file.
- Add a variant to the
Modeenum insrc/main.rs. - Add a
run_<mode>async function. - Wire it into the
match args.modeblock. - Document it in
CHANGELOG.md.