From 55b67d31d41b7bff29aa515408fc22a8894e3183 Mon Sep 17 00:00:00 2001 From: binarybaron <86064887+binarybaron@users.noreply.github.com> Date: Thu, 6 Jun 2024 15:19:54 +0200 Subject: [PATCH] feat (Bob): Log extensive information about deposit requirements --- swap/src/api/request.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/swap/src/api/request.rs b/swap/src/api/request.rs index 02bf27e1..338432c3 100644 --- a/swap/src/api/request.rs +++ b/swap/src/api/request.rs @@ -882,19 +882,24 @@ where loop { let min_outstanding = bid_quote.min_quantity - max_giveable; - let min_fee = estimate_fee(min_outstanding).await?; - let min_deposit = min_outstanding + min_fee; + let min_bitcoin_lock_tx_fee = estimate_fee(min_outstanding).await?; + let min_deposit_until_swap_will_start = min_outstanding + min_bitcoin_lock_tx_fee; + let max_deposit_until_maximum_amount_is_reached = + maximum_amount - max_giveable + min_bitcoin_lock_tx_fee; tracing::info!( "Deposit at least {} to cover the min quantity with fee!", - min_deposit + min_deposit_until_swap_will_start ); tracing::info!( %deposit_address, - %min_deposit, + %min_deposit_until_swap_will_start, + %max_deposit_until_maximum_amount_is_reached, %max_giveable, %minimum_amount, %maximum_amount, + %min_bitcoin_lock_tx_fee, + price = %bid_quote.price, "Waiting for Bitcoin deposit", ); @@ -913,7 +918,7 @@ where tracing::info!(%new_balance, %max_giveable, "Received Bitcoin"); if max_giveable < bid_quote.min_quantity { - tracing::info!("Deposited amount is less than `min_quantity`"); + tracing::info!("Deposited amount is not enough to cover `min_quantity` when accounting for network fees"); continue; }