mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Remove roles from SwapFactory name as implied by module and cleanup
This commit is contained in:
parent
75f89f3b25
commit
82974412b2
@ -23,7 +23,7 @@ use swap::{
|
|||||||
config::Config,
|
config::Config,
|
||||||
database::Database,
|
database::Database,
|
||||||
monero,
|
monero,
|
||||||
protocol::{alice, bob, bob::BobSwapFactory},
|
protocol::{alice, bob, bob::SwapFactory},
|
||||||
trace::init_tracing,
|
trace::init_tracing,
|
||||||
StartingBalances, SwapAmounts,
|
StartingBalances, SwapAmounts,
|
||||||
};
|
};
|
||||||
@ -82,7 +82,7 @@ async fn main() -> Result<()> {
|
|||||||
send_monero, receive_bitcoin, swap_id
|
send_monero, receive_bitcoin, swap_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let alice_factory = alice::AliceSwapFactory::new(
|
let alice_factory = alice::SwapFactory::new(
|
||||||
seed,
|
seed,
|
||||||
config,
|
config,
|
||||||
swap_id,
|
swap_id,
|
||||||
@ -127,7 +127,7 @@ async fn main() -> Result<()> {
|
|||||||
send_bitcoin, receive_monero, swap_id
|
send_bitcoin, receive_monero, swap_id
|
||||||
);
|
);
|
||||||
|
|
||||||
let bob_factory = BobSwapFactory::new(
|
let bob_factory = SwapFactory::new(
|
||||||
seed,
|
seed,
|
||||||
db_path,
|
db_path,
|
||||||
swap_id,
|
swap_id,
|
||||||
@ -172,7 +172,7 @@ async fn main() -> Result<()> {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let alice_factory = alice::AliceSwapFactory::new(
|
let alice_factory = alice::SwapFactory::new(
|
||||||
seed,
|
seed,
|
||||||
config,
|
config,
|
||||||
swap_id,
|
swap_id,
|
||||||
@ -204,7 +204,7 @@ async fn main() -> Result<()> {
|
|||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let bob_factory = BobSwapFactory::new(
|
let bob_factory = SwapFactory::new(
|
||||||
seed,
|
seed,
|
||||||
db_path,
|
db_path,
|
||||||
swap_id,
|
swap_id,
|
||||||
|
@ -50,21 +50,21 @@ pub struct Swap {
|
|||||||
pub db: Database,
|
pub db: Database,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct AliceSwapFactory {
|
pub struct SwapFactory {
|
||||||
listen_address: Multiaddr,
|
swap_id: Uuid,
|
||||||
identity: Keypair,
|
identity: Keypair,
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
|
|
||||||
db_path: PathBuf,
|
db_path: PathBuf,
|
||||||
swap_id: Uuid,
|
config: Config,
|
||||||
|
|
||||||
|
listen_address: Multiaddr,
|
||||||
|
|
||||||
pub bitcoin_wallet: Arc<bitcoin::Wallet>,
|
pub bitcoin_wallet: Arc<bitcoin::Wallet>,
|
||||||
pub monero_wallet: Arc<monero::Wallet>,
|
pub monero_wallet: Arc<monero::Wallet>,
|
||||||
config: Config,
|
|
||||||
pub starting_balances: StartingBalances,
|
pub starting_balances: StartingBalances,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AliceSwapFactory {
|
impl SwapFactory {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub async fn new(
|
pub async fn new(
|
||||||
seed: Seed,
|
seed: Seed,
|
||||||
@ -81,14 +81,14 @@ impl AliceSwapFactory {
|
|||||||
let peer_id = PeerId::from(identity.public());
|
let peer_id = PeerId::from(identity.public());
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
listen_address,
|
swap_id,
|
||||||
identity,
|
identity,
|
||||||
peer_id,
|
peer_id,
|
||||||
db_path,
|
db_path,
|
||||||
swap_id,
|
config,
|
||||||
|
listen_address,
|
||||||
bitcoin_wallet,
|
bitcoin_wallet,
|
||||||
monero_wallet,
|
monero_wallet,
|
||||||
config,
|
|
||||||
starting_balances,
|
starting_balances,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,23 +47,22 @@ pub struct Swap {
|
|||||||
pub swap_id: Uuid,
|
pub swap_id: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BobSwapFactory {
|
pub struct SwapFactory {
|
||||||
|
swap_id: Uuid,
|
||||||
identity: Keypair,
|
identity: Keypair,
|
||||||
peer_id: PeerId,
|
peer_id: PeerId,
|
||||||
|
|
||||||
db_path: PathBuf,
|
db_path: PathBuf,
|
||||||
swap_id: Uuid,
|
|
||||||
|
|
||||||
pub bitcoin_wallet: Arc<bitcoin::Wallet>,
|
|
||||||
pub monero_wallet: Arc<monero::Wallet>,
|
|
||||||
config: Config,
|
config: Config,
|
||||||
pub starting_balances: StartingBalances,
|
|
||||||
|
|
||||||
alice_connect_address: Multiaddr,
|
alice_connect_address: Multiaddr,
|
||||||
alice_connect_peer_id: PeerId,
|
alice_connect_peer_id: PeerId,
|
||||||
|
|
||||||
|
pub bitcoin_wallet: Arc<bitcoin::Wallet>,
|
||||||
|
pub monero_wallet: Arc<monero::Wallet>,
|
||||||
|
pub starting_balances: StartingBalances,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BobSwapFactory {
|
impl SwapFactory {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
seed: Seed,
|
seed: Seed,
|
||||||
@ -80,16 +79,16 @@ impl BobSwapFactory {
|
|||||||
let peer_id = identity.public().into_peer_id();
|
let peer_id = identity.public().into_peer_id();
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
swap_id,
|
||||||
identity,
|
identity,
|
||||||
peer_id,
|
peer_id,
|
||||||
db_path,
|
db_path,
|
||||||
swap_id,
|
|
||||||
bitcoin_wallet,
|
|
||||||
monero_wallet,
|
|
||||||
config,
|
config,
|
||||||
starting_balances,
|
|
||||||
alice_connect_address,
|
alice_connect_address,
|
||||||
alice_connect_peer_id,
|
alice_connect_peer_id,
|
||||||
|
bitcoin_wallet,
|
||||||
|
monero_wallet,
|
||||||
|
starting_balances,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,12 +9,7 @@ use swap::{
|
|||||||
bitcoin,
|
bitcoin,
|
||||||
config::Config,
|
config::Config,
|
||||||
monero,
|
monero,
|
||||||
protocol::{
|
protocol::{alice, alice::AliceState, bob, bob::BobState},
|
||||||
alice,
|
|
||||||
alice::{AliceState, AliceSwapFactory},
|
|
||||||
bob,
|
|
||||||
bob::{BobState, BobSwapFactory},
|
|
||||||
},
|
|
||||||
seed::Seed,
|
seed::Seed,
|
||||||
StartingBalances, SwapAmounts,
|
StartingBalances, SwapAmounts,
|
||||||
};
|
};
|
||||||
@ -27,8 +22,8 @@ use uuid::Uuid;
|
|||||||
pub struct Test {
|
pub struct Test {
|
||||||
swap_amounts: SwapAmounts,
|
swap_amounts: SwapAmounts,
|
||||||
|
|
||||||
alice_swap_factory: AliceSwapFactory,
|
alice_swap_factory: alice::SwapFactory,
|
||||||
bob_swap_factory: BobSwapFactory,
|
bob_swap_factory: bob::SwapFactory,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Test {
|
impl Test {
|
||||||
@ -344,7 +339,7 @@ where
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let alice_swap_factory = AliceSwapFactory::new(
|
let alice_swap_factory = alice::SwapFactory::new(
|
||||||
Seed::random().unwrap(),
|
Seed::random().unwrap(),
|
||||||
config,
|
config,
|
||||||
Uuid::new_v4(),
|
Uuid::new_v4(),
|
||||||
@ -370,7 +365,7 @@ where
|
|||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let bob_swap_factory = BobSwapFactory::new(
|
let bob_swap_factory = bob::SwapFactory::new(
|
||||||
Seed::random().unwrap(),
|
Seed::random().unwrap(),
|
||||||
tempdir().unwrap().path().to_path_buf(),
|
tempdir().unwrap().path().to_path_buf(),
|
||||||
Uuid::new_v4(),
|
Uuid::new_v4(),
|
||||||
|
Loading…
Reference in New Issue
Block a user