Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(swapd): begin atomic swap implementation #246

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove tracing dep
noot committed Mar 18, 2024
commit eb55179bdef301e7d350211ee4b6a0093ea7af95
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/swapd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ structopt-toml = "0.5.1"
async-watch = "0.3.1"
eyre = "0.6"
ethers = { version = "2.0", features = ["ethers-solc", "ws"] }
tracing = "0.1"
thiserror = "1.0.57"

[dev-dependencies]
swapd = { path = ".", features = ["test-utils"] }
9 changes: 6 additions & 3 deletions bin/swapd/src/ethereum/initiator.rs
Original file line number Diff line number Diff line change
@@ -7,8 +7,8 @@ use darkfi_serial::async_trait;
use ethers::prelude::*;
use eyre::{ensure, Result, WrapErr as _};

use log::info;
use std::sync::Arc;
use tracing::info;

/// Implemented on top of the non-initiating chain
///
@@ -142,7 +142,10 @@ impl<M: Middleware + 'static, C: OtherChainClient + Send + Sync> Initiator for E
nonce,
};

info!(contract_swap_id = ?swap_id, "initiated swap on-chain");
info!(
"initiated swap on-chain: contract_swap_id = {}",
ethers::utils::hex::encode(&swap_id)
);

Ok(HandleCounterpartyKeysReceivedResult {
contract_swap_id: swap_id,
@@ -174,7 +177,7 @@ impl<M: Middleware + 'static, C: OtherChainClient + Send + Sync> Initiator for E
receipt
);

info!(contract_swap_id = ?swap_id, "contract set to ready");
info!("contract set to ready, contract_swap_id = {}", ethers::utils::hex::encode(swap_id));
Ok(())
}

2 changes: 1 addition & 1 deletion bin/swapd/src/protocol/initiator.rs
Original file line number Diff line number Diff line change
@@ -3,8 +3,8 @@ use crate::protocol::traits::{
Initiator,
};
use eyre::{eyre, Context, Result};
use log::{info, warn};
use smol::channel;
use tracing::{info, warn};

#[derive(Debug)]
pub(crate) enum Event {