| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | use crate::{    asset_manager::AssetDefinition,    sqlite::{Batch, SQLite},    AccountId, Amount, AssetManager, Error, Ledger, Status, TransactionId,};use sqlx::sqlite::SqlitePoolOptions;pub async fn get_persistance_instance(    name: &str,) -> (    AssetManager,    Ledger<'static, Batch<'static>, SQLite<'static>>,) {    let pool = SqlitePoolOptions::new()        .max_connections(1)        .idle_timeout(None)        .max_lifetime(None)        .connect(format!("sqlite:///tmp/{}.db", name).as_str())        .await        .expect("pool");    let assets = AssetManager::new(vec![        AssetDefinition::new(1, "BTC", 8),        AssetDefinition::new(2, "USD", 4),    ]);    let db = SQLite::new(pool, assets.clone());    db.setup().await.expect("setup");    (assets.clone(), Ledger::new(db, assets))}pub async fn get_instance() -> (    AssetManager,    Ledger<'static, Batch<'static>, SQLite<'static>>,) {    let pool = SqlitePoolOptions::new()        .max_connections(1)        .idle_timeout(None)        .max_lifetime(None)        .connect(":memory:")        .await        .expect("pool");    let assets = AssetManager::new(vec![        AssetDefinition::new(1, "BTC", 8),        AssetDefinition::new(2, "USD", 4),    ]);    let db = SQLite::new(pool, assets.clone());    db.setup().await.expect("setup");    (assets.clone(), Ledger::new(db, assets))}pub async fn withdrawal(    ledger: &Ledger<'static, Batch<'static>, SQLite<'static>>,    account_id: &AccountId,    status: Status,    amount: Amount,) -> Result<TransactionId, Error> {    Ok(ledger        .withdrawal(account_id, amount, status, "Test".to_owned())        .await?        .id()        .clone())}pub async fn deposit(    ledger: &Ledger<'static, Batch<'static>, SQLite<'static>>,    account_id: &AccountId,    amount: Amount,) -> TransactionId {    ledger        .deposit(account_id, amount, Status::Settled, "Test".to_owned())        .await        .expect("valid tx")        .id()        .clone()}mod deposit;mod negative_deposit;mod tx;mod withdrawal;
 |