commenced removal of pricing_record touchpoints for MVP release

This commit is contained in:
Some Random Crypto Guy
2024-05-07 14:34:19 +01:00
parent 7bafd2866c
commit 34b2f9b315
59 changed files with 400 additions and 443 deletions
+108 -231
View File
@@ -1,5 +1,5 @@
// Copyright (c) 2014-2022, The Monero Project
// Portions Copyright (c) 2023, Fulmo (author: SRCG)
// Portions Copyright (c) 2023, Salvium (author: SRCG)
//
// All rights reserved.
//
@@ -187,7 +187,7 @@ namespace
const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", sw::tr("Generate non-deterministic view and spend keys"), false};
const command_line::arg_descriptor<uint64_t> arg_restore_height = {"restore-height", sw::tr("Restore from specific blockchain height"), 0};
const command_line::arg_descriptor<std::string> arg_restore_date = {"restore-date", sw::tr("Restore from estimated blockchain height on specified date"), ""};
const command_line::arg_descriptor<bool> arg_do_not_relay = {"do-not-relay", sw::tr("The newly created transaction will not be relayed to the Fulmo network"), false};
const command_line::arg_descriptor<bool> arg_do_not_relay = {"do-not-relay", sw::tr("The newly created transaction will not be relayed to the Salvium network"), false};
const command_line::arg_descriptor<bool> arg_create_address_file = {"create-address-file", sw::tr("Create an address file for new wallets"), false};
const command_line::arg_descriptor<std::string> arg_subaddress_lookahead = {"subaddress-lookahead", tools::wallet2::tr("Set subaddress lookahead sizes to <major>:<minor>"), ""};
const command_line::arg_descriptor<bool> arg_use_english_language_names = {"use-english-language-names", sw::tr("Display English language names"), false};
@@ -263,7 +263,7 @@ namespace
const char* USAGE_MMS("mms [<subcommand> [<subcommand_parameters>]]");
const char* USAGE_MMS_INIT("mms init <required_signers>/<authorized_signers> <own_label> <own_transport_address>");
const char* USAGE_MMS_INFO("mms info");
const char* USAGE_MMS_SIGNER("mms signer [<number> <label> [<transport_address> [<fulmo_address>]]]");
const char* USAGE_MMS_SIGNER("mms signer [<number> <label> [<transport_address> [<salvium_address>]]]");
const char* USAGE_MMS_LIST("mms list");
const char* USAGE_MMS_NEXT("mms next [sync]");
const char* USAGE_MMS_SYNC("mms sync");
@@ -493,7 +493,7 @@ namespace
std::stringstream prompt;
prompt << sw::tr("For URL: ") << url
<< ", " << dnssec_str << std::endl
<< sw::tr(" Fulmo Address = ") << addresses[0]
<< sw::tr(" Salvium Address = ") << addresses[0]
<< std::endl
<< sw::tr("Is this OK?")
;
@@ -2290,25 +2290,25 @@ bool simple_wallet::public_nodes(const std::vector<std::string> &args)
bool simple_wallet::welcome(const std::vector<std::string> &args)
{
message_writer() << tr("Welcome to Fulmo, the private cryptocurrency that you can actually use.");
message_writer() << tr("Welcome to Salvium, the private cryptocurrency that you can actually use.");
message_writer() << "";
message_writer() << tr("Fulmo, like Bitcoin, is a cryptocurrency. That is, it is digital money.");
message_writer() << tr("Unlike Bitcoin, your Fulmo transactions and balance stay private and are not visible to the world by default.");
message_writer() << tr("Salvium, like Bitcoin, is a cryptocurrency. That is, it is digital money.");
message_writer() << tr("Unlike Bitcoin, your Salvium transactions and balance stay private and are not visible to the world by default.");
message_writer() << tr("However, you have the option of making those available to select parties if you choose to.");
message_writer() << "";
message_writer() << tr("Fulmo protects your privacy on the blockchain, and while Fulmo strives to improve all the time,");
message_writer() << tr("no privacy technology can be 100% perfect, Fulmo included.");
message_writer() << tr("Fulmo cannot protect you from malware, and it may not be as effective as we hope against powerful adversaries.");
message_writer() << tr("Flaws in Fulmo may be discovered in the future, and attacks may be developed to peek under some");
message_writer() << tr("of the layers of privacy Fulmo provides. Be safe and practice defense in depth.");
message_writer() << tr("Salvium protects your privacy on the blockchain, and while Salvium strives to improve all the time,");
message_writer() << tr("no privacy technology can be 100% perfect, Salvium included.");
message_writer() << tr("Salvium cannot protect you from malware, and it may not be as effective as we hope against powerful adversaries.");
message_writer() << tr("Flaws in Salvium may be discovered in the future, and attacks may be developed to peek under some");
message_writer() << tr("of the layers of privacy Salvium provides. Be safe and practice defense in depth.");
message_writer() << "";
message_writer() << tr("Welcome to Fulmo and flexible financial privacy. For more information see https://fulmo.network");
message_writer() << tr("Welcome to Salvium and flexible financial privacy. For more information see https://salvium.network");
return true;
}
bool simple_wallet::version(const std::vector<std::string> &args)
{
message_writer() << "Fulmo '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")";
message_writer() << "Salvium '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")";
return true;
}
@@ -2444,7 +2444,7 @@ bool simple_wallet::show_qr_code(const std::vector<std::string> &args)
WTEXTON();
try
{
const std::string address = "fulmo:" + m_wallet->get_subaddress_as_str({m_current_subaddress_account, subaddress_index});
const std::string address = "salvium:" + m_wallet->get_subaddress_as_str({m_current_subaddress_account, subaddress_index});
const qrcodegen::QrCode qr = qrcodegen::QrCode::encodeText(address.c_str(), qrcodegen::QrCode::Ecc::LOW);
for (int y = -2; y < qr.getSize() + 2; y+=2)
{
@@ -2644,15 +2644,15 @@ bool simple_wallet::set_unit(const std::vector<std::string> &args/* = std::vecto
const std::string &unit = args[1];
unsigned int decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT;
if (unit == "fulmo")
if (unit == "sal")
decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT;
else if (unit == "millimo")
else if (unit == "millisal")
decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT - 3;
else if (unit == "micromo")
else if (unit == "microsal")
decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT - 6;
else if (unit == "nanomo")
else if (unit == "nanosal")
decimal_point = CRYPTONOTE_DISPLAY_DECIMAL_POINT - 9;
else if (unit == "picomo")
else if (unit == "picosal")
decimal_point = 0;
else
{
@@ -3152,23 +3152,23 @@ bool simple_wallet::help(const std::vector<std::string> &args/* = std::vector<st
message_writer() << tr("\"balance\" - Show balance.");
message_writer() << tr("\"address all\" - Show all addresses.");
message_writer() << tr("\"address new\" - Create new subaddress.");
message_writer() << tr("\"transfer <address> <amount> [<asset_type>]\" - Send FULM or F$ to an address.");
message_writer() << tr("\"transfer <address> <amount> [<asset_type>]\" - Send SAL or F$ to an address.");
message_writer() << tr("\"return_payment <tx_hash>\" - Return a previously-received amount to sender.");
message_writer() << tr("\"burn <amount> <asset_type>\" - destroy coins forever.");
message_writer() << tr("\"convert <amount> <source_asset> <dest_asset> [<slippage_limit>]\" - convert between coin types.");
message_writer() << tr("\"lock_for_yield <amount>\" - lock FULM in order to earn yield.");
message_writer() << tr("\"lock_for_yield <amount>\" - lock SAL in order to earn yield.");
message_writer() << tr("\"price_info\" - Display current pricing information for supported assets.");
message_writer() << tr("\"supply_info\" - Display circulating supply information.");
message_writer() << tr("\"yield_info\" - Display current stats on Fulmo yield.");
message_writer() << tr("\"yield_info\" - Display current stats on Salvium yield.");
message_writer() << tr("\"show_transfers [in|out|pending|failed|pool]\" - Show transactions.");
message_writer() << tr("\"sweep_all <address> [<asset_type>]\" - Send whole balance to another wallet.");
message_writer() << tr("\"seed\" - Show secret 25 words that can be used to recover this wallet.");
message_writer() << tr("\"refresh\" - Synchronize wallet with the Fulmo network.");
message_writer() << tr("\"refresh\" - Synchronize wallet with the Salvium network.");
message_writer() << tr("\"status\" - Check current status of wallet.");
message_writer() << tr("\"version\" - Check software version.");
message_writer() << tr("\"exit\" - Exit wallet.");
message_writer() << "";
message_writer() << tr("\"donate <amount> [<asset_type>]\" - Donate FULM or F4 to the development team.");
message_writer() << tr("\"donate <amount> [<asset_type>]\" - Donate SAL or F$ to the development team.");
message_writer() << "";
}
else if ((args.size() == 1) && (args.front() == "all"))
@@ -3348,15 +3348,15 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("lock_for_yield",
boost::bind(&simple_wallet::lock_for_yield, this, _1),
tr(USAGE_LOCK_FOR_YIELD),
tr("Locks <amount> of FULM in order to earn yield"));
tr("Locks <amount> of SAL in order to earn yield"));
m_cmd_binder.set_handler("price_info",
boost::bind(&simple_wallet::price_info, this, _1),
tr(USAGE_PRICE_INFO),
tr("Displays the current exchange rate information for FULM <--> FUSD conversions"));
tr("Displays the current exchange rate information for SAL <--> VSD conversions"));
m_cmd_binder.set_handler("supply_info",
boost::bind(&simple_wallet::supply_info, this, _1),
tr(USAGE_SUPPLY_INFO),
tr("Displays the current circulating supply information for FULM and FUSD currencies"));
tr("Displays the current circulating supply information for SAL and VSD currencies"));
m_cmd_binder.set_handler("yield_info",
boost::bind(&simple_wallet::yield_info, this, _1),
tr(USAGE_YIELD_INFO),
@@ -3364,7 +3364,7 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("donate",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::donate, _1),
tr(USAGE_DONATE),
tr("Donate <amount> of <asset_type> to the development team (donate.fulmo.network)."));
tr("Donate <amount> of <asset_type> to the development team (donate.salvium.network)."));
m_cmd_binder.set_handler("sign_transfer",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::sign_transfer, _1),
tr(USAGE_SIGN_TRANSFER),
@@ -3439,8 +3439,8 @@ simple_wallet::simple_wallet()
"ask-password <0|1|2 (or never|action|decrypt)>\n "
" action: ask the password before many actions such as transfer, etc\n "
" decrypt: same as action, but keeps the spend key encrypted in memory when not needed\n "
"unit <fulmo|millimo|micromo|nanomo>\n "
" Set the default Fulmo (sub-)unit.\n "
"unit <sal|millisal|microsal|nanosal>\n "
" Set the default Salvium (sub-)unit.\n "
"min-outputs-count [n]\n "
" Try to keep at least that many outputs of value at least min-outputs-value.\n "
"min-outputs-value [n]\n "
@@ -3458,9 +3458,9 @@ simple_wallet::simple_wallet()
"auto-low-priority <1|0>\n "
" Whether to automatically use the low priority fee level when it's safe to do so.\n "
"segregate-pre-fork-outputs <1|0>\n "
" Set this if you intend to spend outputs on both Fulmo AND a key reusing fork.\n "
" Set this if you intend to spend outputs on both Salvium AND a key reusing fork.\n "
"key-reuse-mitigation2 <1|0>\n "
" Set this if you are not sure whether you will spend on a key reusing Fulmo fork later.\n "
" Set this if you are not sure whether you will spend on a key reusing Salvium fork later.\n "
"subaddress-lookahead <major>:<minor>\n "
" Set the lookahead sizes for the subaddress hash table.\n "
"segregation-height <n>\n "
@@ -3474,7 +3474,7 @@ simple_wallet::simple_wallet()
"track-uses <1|0>\n "
" Whether to keep track of owned outputs uses.\n "
"setup-background-mining <1|0>\n "
" Whether to enable background mining. Set this to support the network and to get a chance to receive new Fulmo.\n "
" Whether to enable background mining. Set this to support the network and to get a chance to receive new Salvium.\n "
"device-name <device_name[:device_spec]>\n "
" Device name for hardware wallet.\n "
"export-format <\"binary\"|\"ascii\">\n "
@@ -3675,7 +3675,7 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("mms signer",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::mms, _1),
tr(USAGE_MMS_SIGNER),
tr("Set or modify authorized signer info (single-word label, transport address, Fulmo address), or list all signers"));
tr("Set or modify authorized signer info (single-word label, transport address, Salvium address), or list all signers"));
m_cmd_binder.set_handler("mms list",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::mms, _1),
tr(USAGE_MMS_LIST),
@@ -3800,7 +3800,7 @@ simple_wallet::simple_wallet()
m_cmd_binder.set_handler("welcome",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::welcome, _1),
tr(USAGE_WELCOME),
tr("Prints basic info about Fulmo for first time users"));
tr("Prints basic info about Salvium for first time users"));
m_cmd_binder.set_handler("version",
boost::bind(&simple_wallet::on_command, this, &simple_wallet::version, _1),
tr(USAGE_VERSION),
@@ -3944,7 +3944,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
CHECK_SIMPLE_VARIABLE("refresh-type", set_refresh_type, tr("full (slowest, no assumptions); optimize-coinbase (fast, assumes the whole coinbase is paid to a single address); no-coinbase (fastest, assumes we receive no coinbase transaction), default (same as optimize-coinbase)"));
CHECK_SIMPLE_VARIABLE("priority", set_default_priority, tr("0, 1, 2, 3, or 4, or one of ") << join_priority_strings(", "));
CHECK_SIMPLE_VARIABLE("ask-password", set_ask_password, tr("0|1|2 (or never|action|decrypt)"));
CHECK_SIMPLE_VARIABLE("unit", set_unit, tr("fulmo, millimo, micromo, nanomo"));
CHECK_SIMPLE_VARIABLE("unit", set_unit, tr("sal, millisal, microsal, nanosal"));
CHECK_SIMPLE_VARIABLE("max-reorg-depth", set_max_reorg_depth, tr("unsigned integer"));
CHECK_SIMPLE_VARIABLE("min-outputs-count", set_min_output_count, tr("unsigned integer"));
CHECK_SIMPLE_VARIABLE("min-outputs-value", set_min_output_value, tr("amount"));
@@ -4758,7 +4758,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
bool ssl = false;
if (m_wallet->check_connection(NULL, &ssl) && !ssl)
message_writer(console_color_red, true) << boost::format(tr("Using your own without SSL exposes your RPC traffic to monitoring"));
message_writer(console_color_red, true) << boost::format(tr("You are strongly encouraged to connect to the Fulmo network using your own daemon"));
message_writer(console_color_red, true) << boost::format(tr("You are strongly encouraged to connect to the Salvium network using your own daemon"));
message_writer(console_color_red, true) << boost::format(tr("If you or someone you trust are operating this daemon, you can use --trusted-daemon"));
COMMAND_RPC_GET_INFO::request req;
@@ -4779,7 +4779,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
check_background_mining(password);
if (welcome)
message_writer(console_color_yellow, true) << tr("If you are new to Fulmo, type \"welcome\" for a brief overview.");
message_writer(console_color_yellow, true) << tr("If you are new to Salvium, type \"welcome\" for a brief overview.");
m_last_activity_time = time(NULL);
return true;
@@ -5010,7 +5010,7 @@ boost::optional<epee::wipeable_string> simple_wallet::new_wallet(const boost::pr
"Use the \"help\" command to see a simplified list of available commands.\n"
"Use \"help all\" command to see the list of all available commands.\n"
"Use \"help <command>\" to see a command's documentation.\n"
"Always use the \"exit\" command when closing fulmo-wallet-cli to save \n"
"Always use the \"exit\" command when closing salvium-wallet-cli to save \n"
"your current session's state. Otherwise, you might need to synchronize \n"
"your wallet again (your wallet keys are NOT at risk in any case).\n")
;
@@ -5393,7 +5393,7 @@ void simple_wallet::start_background_mining()
return;
}
}
success_msg_writer() << tr("Background mining enabled. Thank you for supporting the Fulmo network.");
success_msg_writer() << tr("Background mining enabled. Thank you for supporting the Salvium network.");
}
//----------------------------------------------------------------------------------------------------
void simple_wallet::stop_background_mining()
@@ -5465,7 +5465,7 @@ void simple_wallet::check_background_mining(const epee::wipeable_string &passwor
{
message_writer() << tr("The daemon is not set up to background mine.");
message_writer() << tr("With background mining enabled, the daemon will mine when idle and not on battery.");
message_writer() << tr("Enabling this supports the network you are using, and makes you eligible for receiving new Fulmo");
message_writer() << tr("Enabling this supports the network you are using, and makes you eligible for receiving new Salvium");
std::string accepted = input_line(tr("Do you want to do it now? (Y/Yes/N/No): "));
if (std::cin.eof() || !command_line::is_yes(accepted)) {
m_wallet->setup_background_mining(tools::wallet2::BackgroundMiningNo);
@@ -5750,7 +5750,7 @@ void simple_wallet::on_money_received(uint64_t height, const crypto::hash &txid,
if (burnt != 0) {
burn << " (" << print_money(amount) << " yet " << print_money(burnt) << " was burnt)";
}
message_writer(asset_type == "FULM" ? console_color_green : console_color_yellow, false) << "\r" <<
message_writer(asset_type == "SAL" ? console_color_green : console_color_yellow, false) << "\r" <<
tr("Height ") << height << ", " <<
tr("txid ") << txid << ", " <<
print_money(amount - burnt) << burn.str() << " " << asset_type << ", " <<
@@ -6531,7 +6531,7 @@ void simple_wallet::check_for_inactivity_lock(bool user)
m_in_command = true;
if (!user)
{
const std::string speech = tr("I locked your Fulmo wallet to protect you while you were away\nsee \"help set\" to configure/disable");
const std::string speech = tr("I locked your Salvium wallet to protect you while you were away\nsee \"help set\" to configure/disable");
std::vector<std::pair<std::string, size_t>> lines = tools::split_string_by_width(speech, 45);
size_t max_len = 0;
@@ -6775,7 +6775,7 @@ bool simple_wallet::transfer_main(
de.slippage_limit = 0;
++i;
} else {
if (boost::starts_with(local_args[i], "fulmo:"))
if (boost::starts_with(local_args[i], "salvium:"))
fail_msg_writer() << tr("Invalid last argument: ") << local_args.back() << ": " << error;
else
fail_msg_writer() << tr("Invalid last argument: ") << local_args.back();
@@ -6836,19 +6836,20 @@ bool simple_wallet::transfer_main(
std::vector<tools::wallet2::pending_tx> ptx_vector;
uint64_t bc_height, unlock_block = 0;
std::string err;
const crypto::key_image ki_return = crypto::null_ki;
switch (transfer_type)
{
case Burn:
unlock_block = 0;
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::BURN, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices);
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::BURN, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, ki_return);
break;
case Convert:
unlock_block = CONVERT_LOCK_PERIOD;
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::CONVERT, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices);
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::CONVERT, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, ki_return);
break;
case LockForYield:
unlock_block = get_config(m_wallet->nettype()).YIELD_LOCK_PERIOD;
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::YIELD, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices);
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::YIELD, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, ki_return);
break;
case TransferLocked:
/*
@@ -6860,13 +6861,13 @@ bool simple_wallet::transfer_main(
}
*/
unlock_block = locked_blocks;
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices);
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, unlock_block /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, ki_return);
break;
default:
LOG_ERROR("Unknown transfer method, using default");
/* FALLTHRU */
case Transfer:
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, 0 /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices);
ptx_vector = m_wallet->create_transactions_2(dsts, source_asset, dest_asset, cryptonote::transaction_type::TRANSFER, fake_outs_count, 0 /* unlock_time */, priority, extra, m_current_subaddress_account, subaddr_indices, ki_return);
break;
}
@@ -7118,10 +7119,10 @@ bool simple_wallet::transfer(const std::vector<std::string> &args_)
}
// Get the source asset type
std::string source_asset = "FULM";
std::string source_asset = "SAL";
std::string strLastArg = local_args.back();
std::transform(strLastArg.begin(), strLastArg.end(), strLastArg.begin(), ::toupper);
if (strLastArg == "FULM" or strLastArg == "FUSD") {
if (strLastArg == "SAL" or strLastArg == "VSD") {
source_asset = strLastArg;
local_args.pop_back();
}
@@ -7153,10 +7154,10 @@ bool simple_wallet::locked_transfer(const std::vector<std::string> &args_)
}
// Get the source asset type
std::string source_asset = "FULM";
std::string source_asset = "SAL";
std::string strLastArg = local_args.back();
std::transform(strLastArg.begin(), strLastArg.end(), strLastArg.begin(), ::toupper);
if (strLastArg == "FULM" or strLastArg == "FUSD") {
if (strLastArg == "SAL" or strLastArg == "VSD") {
source_asset = strLastArg;
local_args.pop_back();
}
@@ -7286,7 +7287,7 @@ bool simple_wallet::sweep_unmixable(const std::vector<std::string> &args_)
//----------------------------------------------------------------------------------------------------
bool simple_wallet::sweep_main(uint32_t account, uint64_t below, bool locked, const std::vector<std::string> &args_)
{
std::string asset_type = (args_.size() > 1) ? args_.back() : "FULM";
std::string asset_type = (args_.size() > 1) ? args_.back() : "SAL";
auto print_usage = [this, account, below]()
{
if (below)
@@ -7895,12 +7896,9 @@ bool simple_wallet::return_payment(const std::vector<std::string> &args_)
return true;
}
std::vector<std::string> local_args;
local_args.insert(local_args.end(), args_.begin(), args_.end());
// Get the TX hash we are interested in
crypto::hash txid;
if (!epee::string_tools::hex_to_pod(local_args[0], txid))
if (!epee::string_tools::hex_to_pod(args_[0], txid))
{
fail_msg_writer() << tr("failed to parse txid");
return true;
@@ -7909,6 +7907,7 @@ bool simple_wallet::return_payment(const std::vector<std::string> &args_)
// Get the TX details
tools::wallet2::transfer_container transfers;
crypto::key_image ki;
std::string asset_type;
bool found_ki = false;
m_wallet->get_transfers(transfers);
for (const auto& td: transfers) {
@@ -7917,170 +7916,40 @@ bool simple_wallet::return_payment(const std::vector<std::string> &args_)
// Found the specified entry - make sure we can return it
if (td.m_tx.type != cryptonote::transaction_type::TRANSFER) {
fail_msg_writer() << tr("incorrect TX type for txid ") << local_args[0];
fail_msg_writer() << tr("incorrect TX type for txid ") << args_[0];
return true;
}
// Verify we have a valid return_address and tx_pubkey
if (td.m_tx.return_address == crypto::null_pkey || td.m_tx.return_pubkey == crypto::null_pkey) {
fail_msg_writer() << tr("missing return_address/return_pubkey for txid ") << local_args[0];
fail_msg_writer() << tr("missing return_address/return_pubkey for txid ") << args_[0];
return true;
}
// Check that we have the key image information, and that it is usable
if (!td.m_key_image_known || td.m_key_image_partial || td.m_spent || td.m_frozen) {
fail_msg_writer() << tr("key image is unavailable (partial / unknown / spent / frozen) for txid ") << local_args[0];
fail_msg_writer() << tr("key image is unavailable (partial / unknown / spent / frozen) for txid ") << args_[0];
return true;
}
// We found the one we were looking for - take a copy of the key_image, etc.
ki = td.m_key_image;
asset_type = td.asset_type;
found_ki = true;
}
// Check we have a valid key_image
if (!found_ki) {
fail_msg_writer() << tr("key image is unavailable (partial / unknown / spent / frozen) for txid ") << local_args[0];
fail_msg_writer() << tr("key image is unavailable (partial / unknown / spent / frozen) for txid ") << args_[0];
return true;
}
// Build the arguments list
std::vector<std::string> local_args;
local_args.insert(local_args.end(), args_.begin(), args_.end());
local_args.push_back(epee::string_tools::pod_to_hex(ki));
// This is nonsense, really - priority isn't really a problem for Fulmo
uint32_t priority = 0;
priority = m_wallet->adjust_priority(priority);
// This should be fixed by the protocol - any changes would stand out like a sore thumb
size_t fake_outs_count = m_wallet->get_min_ring_size() - 1;
uint64_t adjusted_fake_outs_count = m_wallet->adjust_mixin(fake_outs_count);
if (adjusted_fake_outs_count > fake_outs_count)
{
fail_msg_writer() << (boost::format(tr("ring size %u is too small, minimum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
return true;
}
if (adjusted_fake_outs_count < fake_outs_count)
{
fail_msg_writer() << (boost::format(tr("ring size %u is too large, maximum is %u")) % (fake_outs_count+1) % (adjusted_fake_outs_count+1)).str();
return true;
}
// We will only use one output - the one we are returning - to pay for the transaction fully
size_t outputs = 1;
std::vector<uint8_t> extra;
SCOPED_WALLET_UNLOCK();
/*
try
{
// figure out what tx will be necessary
auto ptx_vector = m_wallet->create_transactions_single(ki, info.address, info.is_subaddress, outputs, fake_outs_count, 0, priority, extra);
if (ptx_vector.empty())
{
fail_msg_writer() << tr("No outputs found");
return true;
}
if (ptx_vector.size() > 1)
{
fail_msg_writer() << tr("Multiple transactions are created, which is not supposed to happen");
return true;
}
if (ptx_vector[0].selected_transfers.size() != 1)
{
fail_msg_writer() << tr("The transaction uses multiple or no inputs, which is not supposed to happen");
return true;
}
// give user total and fee, and prompt to confirm
uint64_t total_fee = ptx_vector[0].fee;
uint64_t total_sent = m_wallet->get_transfer_details(ptx_vector[0].selected_transfers.front()).amount();
std::ostringstream prompt;
if (!process_ring_members(ptx_vector, prompt, m_wallet->print_ring_members()))
return true;
prompt << boost::format(tr("Sweeping %s for a total fee of %s. Is this okay?")) %
print_money(total_sent) %
print_money(total_fee);
std::string accepted = input_line(prompt.str(), true);
if (std::cin.eof())
return true;
if (!command_line::is_yes(accepted))
{
fail_msg_writer() << tr("transaction cancelled.");
return true;
}
// actually commit the transactions
if (m_wallet->multisig())
{
CHECK_MULTISIG_ENABLED();
bool r = m_wallet->save_multisig_tx(ptx_vector, "multisig_monero_tx");
if (!r)
{
fail_msg_writer() << tr("Failed to write transaction(s) to file");
}
else
{
success_msg_writer(true) << tr("Unsigned transaction(s) successfully written to file: ") << "multisig_monero_tx";
}
}
else if (m_wallet->get_account().get_device().has_tx_cold_sign())
{
try
{
tools::wallet2::signed_tx_set signed_tx;
std::vector<cryptonote::address_parse_info> dsts_info;
dsts_info.push_back(info);
if (!cold_sign_tx(ptx_vector, signed_tx, dsts_info, [&](const tools::wallet2::signed_tx_set &tx){ return accept_loaded_tx(tx); })){
fail_msg_writer() << tr("Failed to cold sign transaction with HW wallet");
return true;
}
commit_or_save(signed_tx.ptx, m_do_not_relay);
success_msg_writer(true) << tr("Money successfully sent, transaction: ") << get_transaction_hash(ptx_vector[0].tx);
}
catch (const std::exception& e)
{
handle_transfer_exception(std::current_exception(), m_wallet->is_trusted_daemon());
}
catch (...)
{
LOG_ERROR("Unknown error");
fail_msg_writer() << tr("unknown error");
}
}
else if (m_wallet->watch_only())
{
bool r = m_wallet->save_tx(ptx_vector, "unsigned_monero_tx");
if (!r)
{
fail_msg_writer() << tr("Failed to write transaction(s) to file");
}
else
{
success_msg_writer(true) << tr("Unsigned transaction(s) successfully written to file: ") << "unsigned_monero_tx";
}
}
else
{
m_wallet->commit_tx(ptx_vector[0]);
success_msg_writer(true) << tr("Money successfully sent, transaction: ") << get_transaction_hash(ptx_vector[0].tx);
}
}
catch (const std::exception& e)
{
handle_transfer_exception(std::current_exception(), m_wallet->is_trusted_daemon());
}
catch (...)
{
LOG_ERROR("unknown error");
fail_msg_writer() << tr("unknown error");
}
*/
fail_msg_writer() << tr("return_payment() is not implemented");
return true;
fail_msg_writer() << tr("failed to locate txid ") << local_args[0];
transfer_main(Transfer, asset_type, asset_type, local_args, false);
return true;
}
//----------------------------------------------------------------------------------------------------
@@ -8101,7 +7970,7 @@ bool simple_wallet::burn(const std::vector<std::string> &args_)
std::string asset_type;
std::string strLastArg = local_args.back();
std::transform(strLastArg.begin(), strLastArg.end(), strLastArg.begin(), ::toupper);
if (strLastArg not_eq "FULM" and strLastArg not_eq "FUSD") {
if (strLastArg not_eq "SAL" and strLastArg not_eq "VSD") {
PRINT_USAGE(USAGE_BURN);
return true;
}
@@ -8114,6 +7983,9 @@ bool simple_wallet::burn(const std::vector<std::string> &args_)
//----------------------------------------------------------------------------------------------------
bool simple_wallet::convert(const std::vector<std::string> &args_)
{
// Disable until appropriate hard fork
CHECK_AND_ASSERT_MES(m_wallet->get_current_hard_fork() >= HF_VERSION_ENABLE_CONVERT, false, tr("conversions are disabled"));
// TODO: add locked versions
if (args_.size() not_eq 3 and args_.size() not_eq 4)
{
@@ -8159,7 +8031,7 @@ bool simple_wallet::convert(const std::vector<std::string> &args_)
// Get the destination asset type
std::string source_asset, dest_asset;
std::transform(strLastArg.begin(), strLastArg.end(), strLastArg.begin(), ::toupper);
if (strLastArg not_eq "FULM" and strLastArg not_eq "FUSD") {
if (strLastArg not_eq "SAL" and strLastArg not_eq "VSD") {
fail_msg_writer() << tr("invalid destination asset_type");
PRINT_USAGE(USAGE_CONVERT);
return true;
@@ -8169,7 +8041,7 @@ bool simple_wallet::convert(const std::vector<std::string> &args_)
// Get the source asset type
strLastArg = local_args.back();
std::transform(strLastArg.begin(), strLastArg.end(), strLastArg.begin(), ::toupper);
if (strLastArg not_eq "FULM" and strLastArg not_eq "FUSD") {
if (strLastArg not_eq "SAL" and strLastArg not_eq "VSD") {
fail_msg_writer() << tr("invalid source asset_type");
PRINT_USAGE(USAGE_CONVERT);
return true;
@@ -8206,11 +8078,18 @@ bool simple_wallet::lock_for_yield(const std::vector<std::string> &args_)
local_args.push_back(m_wallet->get_subaddress_as_str({m_current_subaddress_account,0}));
local_args.insert(local_args.end(), args_.begin(), args_.end());
transfer_main(LockForYield, "FULM", "FULM", local_args, false);
transfer_main(LockForYield, "SAL", "SAL", local_args, false);
return true;
}
//----------------------------------------------------------------------------------------------------
bool simple_wallet::price_info(const std::vector<std::string> &args) {
// Sanity check for conversion and oracle
if (!m_wallet->use_fork_rules(HF_VERSION_ENABLE_ORACLE, 0)) {
fail_msg_writer() << "'price_info' command disabled until HF " << HF_VERSION_ENABLE_ORACLE;
return false;
}
// get circulating supply
std::vector<std::pair<std::string, std::string>> supply_amounts;
if(!m_wallet->get_circulating_supply(supply_amounts)) {
@@ -8242,6 +8121,7 @@ bool simple_wallet::supply_info(const std::vector<std::string> &args) {
return false;
}
/*
// get pricing record
std::string err;
uint64_t bc_height = get_daemon_blockchain_height(err);
@@ -8250,34 +8130,31 @@ bool simple_wallet::supply_info(const std::vector<std::string> &args) {
fail_msg_writer() << "failed to get pricing record. Make sure you are connected to a daemon.";
return false;
}
*/
// For each asset, print the circulating supply and value
boost::multiprecision::uint128_t total_supply = 0;
for (auto supply_asset: supply_amounts) {
// SRCG: fix the following code
assert(false);
/*
// get price
uint64_t spot = pr.spot;
uint64_t ma = pr.moving_average;
double price = (double)(std::min(spot, ma)); // smaller of the ma vs spot
price /= COIN;
// get supply
boost::multiprecision::uint128_t supply_128(supply_asset.second);
supply_128 /= COIN;
uint64_t supply = supply_128.convert_to<uint64_t>();
message_writer(console_color_default, false) << boost::format(tr("%s\n\tSUPPLY:\t%d")) % supply_asset.first % supply;
/*
// get price
uint64_t spot = pr.spot;
uint64_t ma = pr.moving_average;
double price = (double)(std::min(spot, ma)); // smaller of the ma vs spot
price /= COIN;
// get mcap
uint64_t mcap = price * supply;
message_writer(console_color_default, false) << boost::format(tr("%s\n\tSUPPLY:\t%d\n\tPRICE:\t$%d\n\tMCAP:\t$%d")) % supply_asset.first % supply % price % mcap;
*/
}
// calculate current block cap
//uint64_t block_cap = cryptonote::get_block_cap(supply_amounts, pr, m_wallet->get_current_hard_fork());
//message_writer() << boost::format(tr("Current Block Cap(height %d): %d XHV")) % bc_height % print_money(block_cap);
return true;
}
//----------------------------------------------------------------------------------------------------
@@ -8342,23 +8219,23 @@ bool simple_wallet::donate(const std::vector<std::string> &args_)
{
// if not mainnet, convert donation address string to the relevant network type
address_parse_info info;
if (!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, FULMO_DONATION_ADDR))
if (!cryptonote::get_account_address_from_str(info, cryptonote::MAINNET, SALVIUM_DONATION_ADDR))
{
fail_msg_writer() << tr("Failed to parse donation address: ") << FULMO_DONATION_ADDR;
fail_msg_writer() << tr("Failed to parse donation address: ") << SALVIUM_DONATION_ADDR;
return true;
}
address_str = cryptonote::get_account_address_as_str(m_wallet->nettype(), info.is_subaddress, info.address);
}
else
{
address_str = FULMO_DONATION_ADDR;
address_str = SALVIUM_DONATION_ADDR;
}
local_args.push_back(address_str);
local_args.push_back(amount_str);
if (!payment_id_str.empty())
local_args.push_back(payment_id_str);
if (m_wallet->nettype() == cryptonote::MAINNET)
message_writer() << (boost::format(tr("Donating %s %s to The Fulmo Team (donate.fulmo.network or %s).")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % FULMO_DONATION_ADDR).str();
message_writer() << (boost::format(tr("Donating %s %s to The Salvium Team (donate.salvium.network or %s).")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % SALVIUM_DONATION_ADDR).str();
else
message_writer() << (boost::format(tr("Donating %s %s to %s.")) % amount_str % cryptonote::get_unit(cryptonote::get_default_decimal_point()) % address_str).str();
transfer(local_args);
@@ -11266,12 +11143,12 @@ int main(int argc, char* argv[])
bool should_terminate = false;
std::tie(vm, should_terminate) = wallet_args::main(
argc, argv,
"fulmo-wallet-cli [--wallet-file=<filename>|--generate-new-wallet=<filename>] [<COMMAND>]",
sw::tr("This is the command line Fulmo wallet. It needs to connect to a Fulmo\ndaemon to work correctly.\nWARNING: Do not reuse your Fulmo keys on another fork, UNLESS this fork has key reuse mitigations built in. Doing so will harm your privacy."),
"salvium-wallet-cli [--wallet-file=<filename>|--generate-new-wallet=<filename>] [<COMMAND>]",
sw::tr("This is the command line Salvium wallet. It needs to connect to a Salvium\ndaemon to work correctly.\nWARNING: Do not reuse your Salvium keys on another fork, UNLESS this fork has key reuse mitigations built in. Doing so will harm your privacy."),
desc_params,
positional_options,
[](const std::string &s, bool emphasis){ tools::scoped_message_writer(emphasis ? epee::console_color_white : epee::console_color_default, true) << s; },
"fulmo-wallet-cli.log"
"salvium-wallet-cli.log"
);
if (!vm)
@@ -11458,7 +11335,7 @@ void simple_wallet::list_mms_messages(const std::vector<mms::message> &messages)
void simple_wallet::list_signers(const std::vector<mms::authorized_signer> &signers)
{
message_writer() << boost::format("%2s %-20s %-s") % tr("#") % tr("Label") % tr("Transport Address");
message_writer() << boost::format("%2s %-20s %-s") % "" % tr("Auto-Config Token") % tr("Fulmo Address");
message_writer() << boost::format("%2s %-20s %-s") % "" % tr("Auto-Config Token") % tr("Salvium Address");
for (size_t i = 0; i < signers.size(); ++i)
{
const mms::authorized_signer &signer = signers[i];
@@ -11664,7 +11541,7 @@ void simple_wallet::mms_signer(const std::vector<std::string> &args)
}
if ((args.size() < 2) || (args.size() > 4))
{
fail_msg_writer() << tr("mms signer [<number> <label> [<transport_address> [<fulmo_address>]]]");
fail_msg_writer() << tr("mms signer [<number> <label> [<transport_address> [<salvium_address>]]]");
return;
}
@@ -11683,14 +11560,14 @@ void simple_wallet::mms_signer(const std::vector<std::string> &args)
bool ok = cryptonote::get_account_address_from_str_or_url(info, m_wallet->nettype(), args[3], oa_prompter);
if (!ok)
{
fail_msg_writer() << tr("Invalid Fulmo address");
fail_msg_writer() << tr("Invalid Salvium address");
return;
}
monero_address = info.address;
const std::vector<mms::message> &messages = ms.get_all_messages();
if ((messages.size() > 0) || state.multisig)
{
fail_msg_writer() << tr("Wallet state does not allow changing Fulmo addresses anymore");
fail_msg_writer() << tr("Wallet state does not allow changing Salvium addresses anymore");
return;
}
}
@@ -11921,7 +11798,7 @@ void simple_wallet::mms_sync(const std::vector<std::string> &args)
void simple_wallet::mms_transfer(const std::vector<std::string> &args)
{
// It's too complicated to check any arguments here, just let 'transfer_main' do the whole job
transfer_main(Transfer, "FULM", "FULM", args, true);
transfer_main(Transfer, "SAL", "SAL", args, true);
}
void simple_wallet::mms_delete(const std::vector<std::string> &args)