Skip to content

Commit

Permalink
Merge pull request #307 from KomodoPlatform/dev
Browse files Browse the repository at this point in the history
0.1.5 hotfix: windows boost multiprecision bug
  • Loading branch information
tonymorony authored Jul 2, 2020
2 parents a19b148 + da1baab commit 462c77d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
#endif

#if defined(_WIN32) || defined(WIN32) || defined(__linux__)
assert(wally_init(0) == WALLY_OK);
auto wally_res = wally_init(0);
assert(wally_res == WALLY_OK);
#endif

//! Sodium Initialization
Expand Down Expand Up @@ -142,7 +143,8 @@ main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])

auto res = app.exec();
#if defined(_WIN32) || defined(WIN32) || defined(__linux__)
assert(wally_cleanup(0) == WALLY_OK);
auto wallet_exit_res = wally_cleanup(0);
assert(wallet_exit_res == WALLY_OK);
#endif
return res;
}
16 changes: 11 additions & 5 deletions src/atomic.dex.app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,7 @@ namespace atomic_dex
QVariantMap out;


spdlog::info("ticker: {}, receive ticker: {}, amount: {}", ticker.toStdString(), receive_ticker.toStdString(), amount.toStdString());
auto trade_fee_f = get_mm2().get_trade_fee(ticker.toStdString(), amount.toStdString(), false);
auto answer = get_mm2().get_trade_fixed_fee(ticker.toStdString());

Expand All @@ -908,14 +909,19 @@ namespace atomic_dex
get_mm2().apply_erc_fees(receive_ticker.toStdString(), erc_fees);
}

auto tx_fee_value = QString::fromStdString(get_formated_float(tx_fee_f));
auto final_balance_f = t_float_50(amount.toStdString()) - (trade_fee_f + tx_fee_f);
std::string final_balance = amount.toStdString();
if (final_balance_f > 0)
auto tx_fee_value = QString::fromStdString(get_formated_float(tx_fee_f));
auto final_balance_f = t_float_50(amount.toStdString()) - (trade_fee_f + tx_fee_f);
std::string final_balance = amount.toStdString();
// spdlog::info("final_balance_f: {}", get_formated_float(final_balance_f));
if (final_balance_f.convert_to<float>() > 0.0)
{
final_balance = get_formated_float(final_balance_f);
out.insert("not_enough_balance_to_pay_the_fees", false);
} else {
// spdlog::info("final_balance is: {}", final_balance);
}
else
{
spdlog::info("final_balance_f < 0");
out.insert("not_enough_balance_to_pay_the_fees", true);
auto amount_needed = t_float_50(0.00777) - final_balance_f;
out.insert("amount_needed", QString::fromStdString(get_formated_float(amount_needed)));
Expand Down
2 changes: 1 addition & 1 deletion src/atomic.dex.pch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ get_formated_float(t_float_50 value)
{
std::stringstream ss;
ss.precision(8);
ss << std::fixed << std::move(value);
ss << std::fixed << value;
return ss.str();
}

Expand Down

0 comments on commit 462c77d

Please sign in to comment.