Skip to content

Commit

Permalink
chore(mm2_main): replace lib.rs by mm2.rs as the root lib (#2178)
Browse files Browse the repository at this point in the history
Having lib.rs forced us to write #[path = 'file/path.rs'] directive for every module we define, even the trivial ones that didn't need no #[path].

This commit fixes this by setting mm2.rs as the root lib for mm2_main.
  • Loading branch information
mariocynicys authored Aug 8, 2024
1 parent 3675f64 commit 7723b50
Show file tree
Hide file tree
Showing 62 changed files with 264 additions and 286 deletions.
1 change: 0 additions & 1 deletion mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ run-docker-tests = []
for-tests = []

[lib]
name = "coins"
path = "lp_coins.rs"
doctest = false

Expand Down
5 changes: 2 additions & 3 deletions mm2src/common/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,9 @@ pub fn stack_trace_frame(instr_ptr: *mut c_void, buf: &mut dyn Write, symbol: &b
// Skip common and less than informative frames.

match name {
"mm2::crash_reports::rust_seh_handler"
"common::crash_reports::rust_seh_handler"
| "veh_exception_filter"
| "common::stack_trace"
| "common::log_stacktrace"
// Super-main on Windows.
| "__scrt_common_main_seh" => return,
_ => (),
Expand All @@ -396,7 +395,7 @@ pub fn stack_trace_frame(instr_ptr: *mut c_void, buf: &mut dyn Write, symbol: &b
|| name.starts_with("core::ops::")
|| name.starts_with("futures::")
|| name.starts_with("hyper::")
|| name.starts_with("mm2::crash_reports::signal_handler")
|| name.starts_with("common::crash_reports::signal_handler")
|| name.starts_with("panic_unwind::")
|| name.starts_with("std::")
|| name.starts_with("scoped_tls::")
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_bin_lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use enum_primitive_derive::Primitive;
use mm2_core::mm_ctx::MmArc;
use mm2_main::mm2::lp_dispatcher::{dispatch_lp_event, StopCtxEvent};
use mm2_main::lp_dispatcher::{dispatch_lp_event, StopCtxEvent};
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
#[cfg(target_arch = "wasm32")] use wasm_bindgen::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_bin_lib/src/mm2_bin.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(not(target_arch = "wasm32"))] use mm2_main::mm2::mm2_main;
#[cfg(not(target_arch = "wasm32"))] use mm2_main::mm2_main;

#[cfg(not(target_arch = "wasm32"))]
const MM_VERSION: &str = env!("MM_VERSION");
Expand Down
6 changes: 2 additions & 4 deletions mm2src/mm2_bin_lib/src/mm2_native_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ pub unsafe extern "C" fn mm2_main(conf: *const c_char, log_cb: extern "C" fn(lin
return;
}
let ctx_cb = &|ctx| CTX.store(ctx, Ordering::Relaxed);
match catch_unwind(move || {
mm2_main::mm2::run_lp_main(Some(&conf), ctx_cb, MM_VERSION.into(), MM_DATETIME.into())
}) {
match catch_unwind(move || mm2_main::run_lp_main(Some(&conf), ctx_cb, MM_VERSION.into(), MM_DATETIME.into())) {
Ok(Ok(_)) => log!("run_lp_main finished"),
Ok(Err(err)) => log!("run_lp_main error: {}", err),
Err(err) => log!("run_lp_main panic: {:?}", any_to_str(&*err)),
Expand Down Expand Up @@ -125,7 +123,7 @@ pub extern "C" fn mm2_test(torch: i32, log_cb: extern "C" fn(line: *const c_char
},
};
let conf = json::to_string(&ctx.conf).unwrap();
let hy_res = mm2_main::mm2::rpc::lp_commands_legacy::stop(ctx);
let hy_res = mm2_main::rpc::lp_commands_legacy::stop(ctx);
let r = match block_on(hy_res) {
Ok(r) => r,
Err(err) => {
Expand Down
6 changes: 3 additions & 3 deletions mm2src/mm2_bin_lib/src/mm2_wasm_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use super::*;
use common::log::{register_callback, LogLevel, WasmCallback};
use common::{console_err, console_info, deserialize_from_js, executor, serialize_to_js, set_panic_hook};
use enum_primitive_derive::Primitive;
use mm2_main::mm2::LpMainParams;
use mm2_main::LpMainParams;
use mm2_rpc::data::legacy::MmVersionResponse;
use mm2_rpc::wasm_rpc::WasmRpcResponse;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -110,12 +110,12 @@ pub fn mm2_main(params: JsValue, log_cb: js_sys::Function) -> Result<(), JsValue
let ctx_cb = |ctx| CTX.store(ctx, Ordering::Relaxed);
// TODO figure out how to use catch_unwind here
// use futures::FutureExt;
// match mm2::lp_main(params, &ctx_cb).catch_unwind().await {
// match mm2_main::lp_main(params, &ctx_cb).catch_unwind().await {
// Ok(Ok(_)) => console_info!("run_lp_main finished"),
// Ok(Err(err)) => console_err!("run_lp_main error: {}", err),
// Err(err) => console_err!("run_lp_main panic: {:?}", any_to_str(&*err)),
// };
match mm2_main::mm2::lp_main(params, &ctx_cb, MM_VERSION.into(), MM_DATETIME.into()).await {
match mm2_main::lp_main(params, &ctx_cb, MM_VERSION.into(), MM_DATETIME.into()).await {
Ok(()) => console_info!("run_lp_main finished"),
Err(err) => console_err!("run_lp_main error: {}", err),
};
Expand Down
1 change: 1 addition & 0 deletions mm2src/mm2_main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version = "0.1.0"
edition = "2018"

[lib]
path = "src/mm2.rs"
doctest = false

[features]
Expand Down
7 changes: 3 additions & 4 deletions mm2src/mm2_main/src/database.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/// The module responsible to work with SQLite database
///
#[path = "database/my_orders.rs"]
pub mod my_orders;
#[path = "database/my_swaps.rs"] pub mod my_swaps;
#[path = "database/stats_nodes.rs"] pub mod stats_nodes;
#[path = "database/stats_swaps.rs"] pub mod stats_swaps;
pub mod my_swaps;
pub mod stats_nodes;
pub mod stats_swaps;

use crate::CREATE_MY_SWAPS_TABLE;
use common::log::{debug, error, info};
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/database/my_orders.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(deprecated)] // TODO: remove this once rusqlite is >= 0.29

use crate::mm2::lp_ordermatch::{FilteringOrder, MakerOrder, MyOrdersFilter, RecentOrdersSelectResult, TakerOrder};
use crate::lp_ordermatch::{FilteringOrder, MakerOrder, MyOrdersFilter, RecentOrdersSelectResult, TakerOrder};
/// This module contains code to work with my_orders table in MM2 SQLite DB
use common::log::debug;
use common::{now_ms, PagingOptions};
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/database/my_swaps.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(deprecated)] // TODO: remove this once rusqlite is >= 0.29

/// This module contains code to work with my_swaps table in MM2 SQLite DB
use crate::mm2::lp_swap::{MyRecentSwapsUuids, MySwapsFilter, SavedSwap, SavedSwapIo};
use crate::lp_swap::{MyRecentSwapsUuids, MySwapsFilter, SavedSwap, SavedSwapIo};
use common::log::debug;
use common::PagingOptions;
use db_common::sqlite::rusqlite::{Connection, Error as SqlError, Result as SqlResult, ToSql};
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/database/stats_nodes.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// This module contains code to work with nodes table for stats collection in MM2 SQLite DB
use crate::mm2::lp_stats::{NodeInfo, NodeVersionStat};
use crate::lp_stats::{NodeInfo, NodeVersionStat};
use common::log::debug;
use db_common::sqlite::rusqlite::{params_from_iter, Error as SqlError, Result as SqlResult};
use mm2_core::mm_ctx::MmArc;
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/database/stats_swaps.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(deprecated)] // TODO: remove this once rusqlite is >= 0.29

use crate::mm2::lp_swap::{MakerSavedSwap, SavedSwap, SavedSwapIo, TakerSavedSwap};
use crate::lp_swap::{MakerSavedSwap, SavedSwap, SavedSwapIo, TakerSavedSwap};
use common::log::{debug, error};
use db_common::{owned_named_params,
sqlite::{rusqlite::{params_from_iter, Connection, OptionalExtension},
Expand Down
20 changes: 0 additions & 20 deletions mm2src/mm2_main/src/lib.rs

This file was deleted.

4 changes: 2 additions & 2 deletions mm2src/mm2_main/src/lp_dispatcher.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::mm2::lp_ordermatch::TradingBotEvent;
use crate::mm2::lp_swap::MakerSwapStatusChanged;
use crate::lp_ordermatch::TradingBotEvent;
use crate::lp_swap::MakerSwapStatusChanged;
use async_std::sync::RwLock;
use mm2_core::{event_dispatcher::{Dispatcher, EventUniqueId},
mm_ctx::{from_ctx, MmArc}};
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_main/src/lp_init/init_context.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::mm2::lp_native_dex::init_hw::InitHwTaskManagerShared;
use crate::lp_native_dex::init_hw::InitHwTaskManagerShared;
#[cfg(target_arch = "wasm32")]
use crate::mm2::lp_native_dex::init_metamask::InitMetamaskManagerShared;
use crate::lp_native_dex::init_metamask::InitMetamaskManagerShared;
use mm2_core::mm_ctx::{from_ctx, MmArc};
use rpc_task::RpcTaskManager;
use std::sync::Arc;
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_init/init_hw.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::mm2::lp_native_dex::init_context::MmInitContext;
use crate::lp_native_dex::init_context::MmInitContext;
use async_trait::async_trait;
use common::{HttpStatusCode, SuccessResponse};
use crypto::hw_rpc_task::{HwConnectStatuses, HwRpcTaskAwaitingStatus, HwRpcTaskUserAction, HwRpcTaskUserActionRequest,
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/lp_init/init_metamask.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::mm2::lp_native_dex::init_context::MmInitContext;
use crate::lp_native_dex::init_context::MmInitContext;
use async_trait::async_trait;
use common::{HttpStatusCode, SerdeInfallible, SuccessResponse};
use crypto::metamask::{from_metamask_error, MetamaskError, MetamaskRpcError, WithMetamaskRpcError};
Expand Down
6 changes: 3 additions & 3 deletions mm2src/mm2_main/src/lp_message_service.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#[path = "notification/telegram/telegram.rs"] pub mod telegram;

use crate::mm2::lp_message_service::telegram::{ChatIdRegistry, TelegramError, TgClient};
use crate::lp_message_service::telegram::{ChatIdRegistry, TelegramError, TgClient};
use async_trait::async_trait;
use derive_more::Display;
use futures::lock::Mutex as AsyncMutex;
Expand Down Expand Up @@ -121,8 +121,8 @@ pub async fn init_message_service(ctx: &MmArc) -> Result<(), MmError<InitMessage

#[cfg(all(test, not(target_arch = "wasm32")))]
mod message_service_tests {
use crate::mm2::lp_message_service::telegram::{ChatIdRegistry, TgClient};
use crate::mm2::lp_message_service::MessageService;
use crate::lp_message_service::telegram::{ChatIdRegistry, TgClient};
use crate::lp_message_service::MessageService;
use common::block_on;
use std::collections::HashMap;
use std::env::var;
Expand Down
21 changes: 10 additions & 11 deletions mm2src/mm2_main/src/lp_native_dex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ use std::time::Duration;
use std::{fs, usize};

#[cfg(not(target_arch = "wasm32"))]
use crate::mm2::database::init_and_migrate_sql_db;
use crate::mm2::heartbeat_event::HeartbeatEvent;
use crate::mm2::lp_message_service::{init_message_service, InitMessageServiceError};
use crate::mm2::lp_network::{lp_network_ports, p2p_event_process_loop, NetIdError};
use crate::mm2::lp_ordermatch::{broadcast_maker_orders_keep_alive_loop, clean_memory_loop, init_ordermatch_context,
lp_ordermatch_loop, orders_kick_start, BalanceUpdateOrdermatchHandler,
OrdermatchInitError};
use crate::mm2::lp_swap::{running_swaps_num, swap_kick_starts};
use crate::mm2::lp_wallet::{initialize_wallet_passphrase, WalletInitError};
use crate::mm2::rpc::spawn_rpc;
use crate::database::init_and_migrate_sql_db;
use crate::heartbeat_event::HeartbeatEvent;
use crate::lp_message_service::{init_message_service, InitMessageServiceError};
use crate::lp_network::{lp_network_ports, p2p_event_process_loop, NetIdError};
use crate::lp_ordermatch::{broadcast_maker_orders_keep_alive_loop, clean_memory_loop, init_ordermatch_context,
lp_ordermatch_loop, orders_kick_start, BalanceUpdateOrdermatchHandler, OrdermatchInitError};
use crate::lp_swap::{running_swaps_num, swap_kick_starts};
use crate::lp_wallet::{initialize_wallet_passphrase, WalletInitError};
use crate::rpc::spawn_rpc;

cfg_native! {
use db_common::sqlite::rusqlite::Error as SqlError;
Expand Down Expand Up @@ -319,7 +318,7 @@ fn default_seednodes(netid: u16) -> Vec<RelayAddress> {

#[cfg(not(target_arch = "wasm32"))]
fn default_seednodes(netid: u16) -> Vec<RelayAddress> {
use crate::mm2::lp_network::addr_to_ipv4_string;
use crate::lp_network::addr_to_ipv4_string;
if netid == 8762 {
DEFAULT_NETID_SEEDNODES
.iter()
Expand Down
4 changes: 2 additions & 2 deletions mm2src/mm2_main/src/lp_network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ use mm2_net::p2p::P2PContext;
use serde::de;
use std::net::ToSocketAddrs;

use crate::mm2::lp_ordermatch;
use crate::mm2::{lp_stats, lp_swap};
use crate::lp_ordermatch;
use crate::{lp_stats, lp_swap};

pub type P2PRequestResult<T> = Result<T, MmError<P2PRequestError>>;
pub type P2PProcessResult<T> = Result<T, MmError<P2PProcessError>>;
Expand Down
40 changes: 18 additions & 22 deletions mm2src/mm2_main/src/lp_ordermatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@ use std::time::Duration;
use trie_db::NodeCodec as NodeCodecT;
use uuid::Uuid;

use crate::mm2::lp_network::{broadcast_p2p_msg, request_any_relay, request_one_peer, subscribe_to_topic, P2PRequest,
P2PRequestError};
use crate::mm2::lp_swap::maker_swap_v2::{self, MakerSwapStateMachine, MakerSwapStorage};
use crate::mm2::lp_swap::taker_swap_v2::{self, TakerSwapStateMachine, TakerSwapStorage};
use crate::mm2::lp_swap::{calc_max_maker_vol, check_balance_for_maker_swap, check_balance_for_taker_swap,
check_other_coin_balance_for_swap, detect_secret_hash_algo, dex_fee_amount_from_taker_coin,
generate_secret, get_max_maker_vol, insert_new_swap_to_db, is_pubkey_banned,
lp_atomic_locktime, p2p_keypair_and_peer_id_to_broadcast,
p2p_private_and_peer_id_to_broadcast, run_maker_swap, run_taker_swap, swap_v2_topic,
AtomicLocktimeVersion, CheckBalanceError, CheckBalanceResult, CoinVolumeInfo, MakerSwap,
RunMakerSwapInput, RunTakerSwapInput, SwapConfirmationsSettings, TakerSwap, LEGACY_SWAP_TYPE};
use crate::lp_network::{broadcast_p2p_msg, request_any_relay, request_one_peer, subscribe_to_topic, P2PRequest,
P2PRequestError};
use crate::lp_swap::maker_swap_v2::{self, MakerSwapStateMachine, MakerSwapStorage};
use crate::lp_swap::taker_swap_v2::{self, TakerSwapStateMachine, TakerSwapStorage};
use crate::lp_swap::{calc_max_maker_vol, check_balance_for_maker_swap, check_balance_for_taker_swap,
check_other_coin_balance_for_swap, detect_secret_hash_algo, dex_fee_amount_from_taker_coin,
generate_secret, get_max_maker_vol, insert_new_swap_to_db, is_pubkey_banned, lp_atomic_locktime,
p2p_keypair_and_peer_id_to_broadcast, p2p_private_and_peer_id_to_broadcast, run_maker_swap,
run_taker_swap, swap_v2_topic, AtomicLocktimeVersion, CheckBalanceError, CheckBalanceResult,
CoinVolumeInfo, MakerSwap, RunMakerSwapInput, RunTakerSwapInput, SwapConfirmationsSettings,
TakerSwap, LEGACY_SWAP_TYPE};

#[cfg(any(test, feature = "run-docker-tests"))]
use crate::mm2::lp_swap::taker_swap::FailAt;
use crate::lp_swap::taker_swap::FailAt;

pub use best_orders::{best_orders_rpc, best_orders_rpc_v2};
pub use orderbook_depth::orderbook_depth_rpc;
Expand All @@ -95,25 +95,21 @@ cfg_wasm32! {
pub type OrdermatchDbLocked<'a> = DbLocked<'a, OrdermatchDb>;
}

#[path = "lp_ordermatch/best_orders.rs"] mod best_orders;
#[path = "lp_ordermatch/lp_bot.rs"] mod lp_bot;
mod best_orders;
mod lp_bot;
pub use lp_bot::{start_simple_market_maker_bot, stop_simple_market_maker_bot, StartSimpleMakerBotRequest,
TradingBotEvent};

#[path = "lp_ordermatch/my_orders_storage.rs"]
mod my_orders_storage;
#[path = "lp_ordermatch/new_protocol.rs"] mod new_protocol;
#[path = "lp_ordermatch/order_requests_tracker.rs"]
mod new_protocol;
mod order_requests_tracker;
#[path = "lp_ordermatch/orderbook_depth.rs"] mod orderbook_depth;
#[path = "lp_ordermatch/orderbook_rpc.rs"] mod orderbook_rpc;
mod orderbook_depth;
mod orderbook_rpc;
#[cfg(all(test, not(target_arch = "wasm32")))]
#[path = "ordermatch_tests.rs"]
pub mod ordermatch_tests;

#[cfg(target_arch = "wasm32")]
#[path = "lp_ordermatch/ordermatch_wasm_db.rs"]
mod ordermatch_wasm_db;
#[cfg(target_arch = "wasm32")] mod ordermatch_wasm_db;

pub const ORDERBOOK_PREFIX: TopicPrefix = "orbk";
#[cfg(not(test))]
Expand Down
6 changes: 3 additions & 3 deletions mm2src/mm2_main/src/lp_ordermatch/best_orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use uuid::Uuid;

use super::{addr_format_from_protocol_info, is_my_order, mm2_internal_pubkey_hex, orderbook_address,
BaseRelProtocolInfo, OrderbookP2PItemWithProof, OrdermatchContext, OrdermatchRequest, RpcOrderbookEntryV2};
use crate::mm2::lp_network::{request_any_relay, P2PRequest};
use crate::lp_network::{request_any_relay, P2PRequest};

#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
#[serde(rename_all = "lowercase")]
Expand Down Expand Up @@ -404,8 +404,8 @@ pub async fn best_orders_rpc_v2(
#[cfg(all(test, not(target_arch = "wasm32")))]
mod best_orders_test {
use super::*;
use crate::mm2::lp_ordermatch::ordermatch_tests::make_random_orders;
use crate::mm2::lp_ordermatch::{OrderbookItem, TrieProof};
use crate::lp_ordermatch::ordermatch_tests::make_random_orders;
use crate::lp_ordermatch::{OrderbookItem, TrieProof};
use common::new_uuid;
use std::iter::FromIterator;

Expand Down
10 changes: 5 additions & 5 deletions mm2src/mm2_main/src/lp_ordermatch/lp_bot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ use std::ops::Deref;
use std::{collections::HashMap, sync::Arc};

#[path = "simple_market_maker.rs"] mod simple_market_maker_bot;
use crate::mm2::lp_dispatcher::{LpEvents, StopCtxEvent};
use crate::mm2::lp_message_service::{MessageServiceContext, MAKER_BOT_ROOM_ID};
use crate::mm2::lp_ordermatch::lp_bot::simple_market_maker_bot::{tear_down_bot, BOT_DEFAULT_REFRESH_RATE,
PRECISION_FOR_NOTIFICATION};
use crate::mm2::lp_swap::MakerSwapStatusChanged;
use crate::lp_dispatcher::{LpEvents, StopCtxEvent};
use crate::lp_message_service::{MessageServiceContext, MAKER_BOT_ROOM_ID};
use crate::lp_ordermatch::lp_bot::simple_market_maker_bot::{tear_down_bot, BOT_DEFAULT_REFRESH_RATE,
PRECISION_FOR_NOTIFICATION};
use crate::lp_swap::MakerSwapStatusChanged;
pub use simple_market_maker_bot::{start_simple_market_maker_bot, stop_simple_market_maker_bot,
StartSimpleMakerBotRequest};

Expand Down
21 changes: 10 additions & 11 deletions mm2src/mm2_main/src/lp_ordermatch/my_orders_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,10 @@ pub trait MyOrdersFilteringHistory {
#[cfg(not(target_arch = "wasm32"))]
mod native_impl {
use super::*;
use crate::mm2::database::my_orders::{insert_maker_order, insert_taker_order, select_orders_by_filter,
select_status_by_uuid, update_maker_order, update_order_status,
update_was_taker};
use crate::mm2::lp_ordermatch::{my_maker_order_file_path, my_maker_orders_dir, my_order_history_file_path,
my_taker_order_file_path, my_taker_orders_dir};
use crate::database::my_orders::{insert_maker_order, insert_taker_order, select_orders_by_filter,
select_status_by_uuid, update_maker_order, update_order_status, update_was_taker};
use crate::lp_ordermatch::{my_maker_order_file_path, my_maker_orders_dir, my_order_history_file_path,
my_taker_order_file_path, my_taker_orders_dir};
use mm2_io::fs::{read_dir_json, read_json, remove_file_async, write_json, FsJsonError};

const USE_TMP_FILE: bool = true;
Expand Down Expand Up @@ -350,10 +349,10 @@ mod native_impl {
#[cfg(target_arch = "wasm32")]
mod wasm_impl {
use super::*;
use crate::mm2::lp_ordermatch::ordermatch_wasm_db::{DbTransactionError, InitDbError, MyActiveMakerOrdersTable,
MyActiveTakerOrdersTable, MyFilteringHistoryOrdersTable,
MyHistoryOrdersTable};
use crate::mm2::lp_ordermatch::OrdermatchContext;
use crate::lp_ordermatch::ordermatch_wasm_db::{DbTransactionError, InitDbError, MyActiveMakerOrdersTable,
MyActiveTakerOrdersTable, MyFilteringHistoryOrdersTable,
MyHistoryOrdersTable};
use crate::lp_ordermatch::OrdermatchContext;
use common::log::warn;
use mm2_rpc::data::legacy::TakerAction;
use num_traits::ToPrimitive;
Expand Down Expand Up @@ -694,8 +693,8 @@ mod wasm_impl {
mod tests {
use super::wasm_impl::{maker_order_to_filtering_history_item, taker_order_to_filtering_history_item};
use super::*;
use crate::mm2::lp_ordermatch::ordermatch_wasm_db::{ItemId, MyFilteringHistoryOrdersTable};
use crate::mm2::lp_ordermatch::{OrdermatchContext, TakerRequest};
use crate::lp_ordermatch::ordermatch_wasm_db::{ItemId, MyFilteringHistoryOrdersTable};
use crate::lp_ordermatch::{OrdermatchContext, TakerRequest};
use common::{new_uuid, now_ms};
use futures::compat::Future01CompatExt;
use itertools::Itertools;
Expand Down
Loading

0 comments on commit 7723b50

Please sign in to comment.