Crate rubi

source ·
Expand description

An SDK to interact with the Rubicon protocol, built on top of ethers-rs

How to use rbcn

The basic entry point to Rubicon is through RubiconSession. We expect most users to wrap this in a std::sync::Arc and share it across Tokio tasks.


use rbcn::prelude::*;
use std::sync::Arc;

let provider = Provider::<Ws>::connect("this is your provider URL").await.unwrap();
let wallet: LocalWallet = MnemonicBuilder::<English>::default()
    .phrase("this is your wallet phrase")
    .with_chain_id(10_u64); // 10 is the chain id for Optimism
let client: SignerMiddleware<Provider<_>, LocalWallet> = SignerMiddleware::new(provider, wallet);

let conn = Arc::new(RubiconSession::new_mainnet(client));
println!("Connected to Rubicon with address = {:?}", conn.get_address());

Crate Layout

Most everything you will need is found in prelude.

This crate does have a number of feature flags. They include:

  • full: enables all features
  • ierc20: enables the [ierc20] module, and the [ierc20::Token] struct that comes with it


pub use session::*;