1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! An SDK to interact with the [Rubicon](https://rubicon.finance) protocol, built on top of [ethers-rs](https://github.com/gakonst/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.
//!
//! # Example
//! ```
//! 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")
//!     .build()
//!     .unwrap()
//!     .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

mod contracts;
pub mod events;
#[cfg(feature = "ierc20")]
pub mod ierc20;
pub mod session;
pub use session::*;

pub mod prelude {
    pub use super::events::*;
    #[cfg(feature = "ierc20")]
    pub use super::ierc20::*;
    pub use super::session::*;
    pub use numeraire::prelude::*;
}