added the initial framework for the Fulmo-specific commands in the CLI wallet; more branding / renaming work
This commit is contained in:
@@ -157,7 +157,7 @@ endif()
|
||||
|
||||
set_property(TARGET blockchain_import
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-import")
|
||||
OUTPUT_NAME "fulmo-blockchain-import")
|
||||
install(TARGETS blockchain_import DESTINATION bin)
|
||||
|
||||
monero_add_executable(blockchain_export
|
||||
@@ -178,7 +178,7 @@ target_link_libraries(blockchain_export
|
||||
|
||||
set_property(TARGET blockchain_export
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-export")
|
||||
OUTPUT_NAME "fulmo-blockchain-export")
|
||||
install(TARGETS blockchain_export DESTINATION bin)
|
||||
|
||||
monero_add_executable(blockchain_blackball
|
||||
@@ -200,7 +200,7 @@ target_link_libraries(blockchain_blackball
|
||||
|
||||
set_property(TARGET blockchain_blackball
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-mark-spent-outputs")
|
||||
OUTPUT_NAME "fulmo-blockchain-mark-spent-outputs")
|
||||
install(TARGETS blockchain_blackball DESTINATION bin)
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ target_link_libraries(blockchain_usage
|
||||
|
||||
set_property(TARGET blockchain_usage
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-usage")
|
||||
OUTPUT_NAME "fulmo-blockchain-usage")
|
||||
install(TARGETS blockchain_usage DESTINATION bin)
|
||||
|
||||
monero_add_executable(blockchain_ancestry
|
||||
@@ -243,7 +243,7 @@ target_link_libraries(blockchain_ancestry
|
||||
|
||||
set_property(TARGET blockchain_ancestry
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-ancestry")
|
||||
OUTPUT_NAME "fulmo-blockchain-ancestry")
|
||||
install(TARGETS blockchain_ancestry DESTINATION bin)
|
||||
|
||||
monero_add_executable(blockchain_depth
|
||||
@@ -264,7 +264,7 @@ target_link_libraries(blockchain_depth
|
||||
|
||||
set_property(TARGET blockchain_depth
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-depth")
|
||||
OUTPUT_NAME "fulmo-blockchain-depth")
|
||||
install(TARGETS blockchain_depth DESTINATION bin)
|
||||
|
||||
monero_add_executable(blockchain_stats
|
||||
@@ -285,7 +285,7 @@ target_link_libraries(blockchain_stats
|
||||
|
||||
set_property(TARGET blockchain_stats
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-stats")
|
||||
OUTPUT_NAME "fulmo-blockchain-stats")
|
||||
install(TARGETS blockchain_stats DESTINATION bin)
|
||||
|
||||
monero_add_executable(blockchain_prune_known_spent_data
|
||||
@@ -307,7 +307,7 @@ target_link_libraries(blockchain_prune_known_spent_data
|
||||
|
||||
set_property(TARGET blockchain_prune_known_spent_data
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-prune-known-spent-data")
|
||||
OUTPUT_NAME "fulmo-blockchain-prune-known-spent-data")
|
||||
install(TARGETS blockchain_prune_known_spent_data DESTINATION bin)
|
||||
|
||||
monero_add_executable(blockchain_prune
|
||||
@@ -316,7 +316,7 @@ monero_add_executable(blockchain_prune
|
||||
|
||||
set_property(TARGET blockchain_prune
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-prune")
|
||||
OUTPUT_NAME "fulmo-blockchain-prune")
|
||||
install(TARGETS blockchain_prune DESTINATION bin)
|
||||
|
||||
target_link_libraries(blockchain_prune
|
||||
|
||||
@@ -71,5 +71,5 @@ target_link_libraries(daemon
|
||||
${Blocks})
|
||||
set_property(TARGET daemon
|
||||
PROPERTY
|
||||
OUTPUT_NAME "elbowd")
|
||||
OUTPUT_NAME "fulmod")
|
||||
install(TARGETS daemon DESTINATION bin)
|
||||
|
||||
@@ -46,7 +46,7 @@ target_link_libraries(cn_deserialize
|
||||
|
||||
set_property(TARGET cn_deserialize
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-utils-deserialize")
|
||||
OUTPUT_NAME "fulmo-utils-deserialize")
|
||||
|
||||
|
||||
set(object_sizes_sources
|
||||
@@ -67,7 +67,7 @@ target_link_libraries(object_sizes
|
||||
|
||||
set_property(TARGET object_sizes
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-utils-object-sizes")
|
||||
OUTPUT_NAME "fulmo-utils-object-sizes")
|
||||
|
||||
|
||||
set(dns_checks_sources
|
||||
@@ -89,5 +89,5 @@ target_link_libraries(dns_checks
|
||||
|
||||
set_property(TARGET dns_checks
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-utils-dns-checks")
|
||||
OUTPUT_NAME "fulmo-utils-dns-checks")
|
||||
|
||||
|
||||
@@ -50,5 +50,5 @@ add_dependencies(gen_multisig
|
||||
version)
|
||||
set_property(TARGET gen_multisig
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-gen-trusted-multisig")
|
||||
OUTPUT_NAME "fulmo-gen-trusted-multisig")
|
||||
install(TARGETS gen_multisig DESTINATION bin)
|
||||
|
||||
@@ -45,5 +45,5 @@ add_dependencies(gen_ssl_cert
|
||||
version)
|
||||
set_property(TARGET gen_ssl_cert
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-gen-ssl-cert")
|
||||
OUTPUT_NAME "fulmo-gen-ssl-cert")
|
||||
install(TARGETS gen_ssl_cert DESTINATION bin)
|
||||
|
||||
@@ -196,7 +196,11 @@ namespace
|
||||
const char* USAGE_SWEEP_ACCOUNT("sweep_account <account> [index=<N1>[,<N2>,...] | index=all] [<priority>] [<ring_size>] [outputs=<N>] <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_BELOW("sweep_below <amount_threshold> [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SWEEP_SINGLE("sweep_single [<priority>] [<ring_size>] [outputs=<N>] <key_image> <address> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_BURN("burn [index=<N1>[,<N2>,...]] <amount> <asset_type>");
|
||||
const char* USAGE_CONVERT("convert [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] (<URI> | <address> <source_amount>) <source_asset> <dest_asset> [<payment_id>]");
|
||||
const char* USAGE_PRICE_INFO("price_info");
|
||||
const char* USAGE_SUPPLY_INFO("supply_info");
|
||||
const char* USAGE_YIELD_INFO("yield_info");
|
||||
const char* USAGE_DONATE("donate [index=<N1>[,<N2>,...]] [<priority>] [<ring_size>] <amount> [<payment_id (obsolete)>]");
|
||||
const char* USAGE_SIGN_TRANSFER("sign_transfer [export_raw] [<filename>]");
|
||||
const char* USAGE_SET_LOG("set_log <level>|{+,-,}<categories>");
|
||||
@@ -3108,10 +3112,26 @@ simple_wallet::simple_wallet()
|
||||
boost::bind(&simple_wallet::on_command, this, &simple_wallet::sweep_single, _1),
|
||||
tr(USAGE_SWEEP_SINGLE),
|
||||
tr("Send a single output of the given key image to an address without change."));
|
||||
m_cmd_binder.set_handler("burn",
|
||||
boost::bind(&simple_wallet::burn, this, _1),
|
||||
tr(USAGE_BURN),
|
||||
tr("PERMANENTLY destroys (burns) <amount> of <asset_type>"));
|
||||
m_cmd_binder.set_handler("convert",
|
||||
boost::bind(&simple_wallet::convert, this, _1),
|
||||
tr(USAGE_CONVERT),
|
||||
tr("Converts <amount> Fulmo (FULM) to Fulmo Dollars (FUSD), with optional <priority> [0-5]"));
|
||||
tr("Converts <amount> <source_asset> into <dest_asset>, with optional <priority> [0-5]"));
|
||||
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"));
|
||||
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"));
|
||||
m_cmd_binder.set_handler("yield_info",
|
||||
boost::bind(&simple_wallet::yield_info, this, _1),
|
||||
tr(USAGE_YIELD_INFO),
|
||||
tr("Displays the statistics for yield returns over the last <NN> blocks"));
|
||||
m_cmd_binder.set_handler("donate",
|
||||
boost::bind(&simple_wallet::on_command, this, &simple_wallet::donate, _1),
|
||||
tr(USAGE_DONATE),
|
||||
@@ -7484,6 +7504,32 @@ bool simple_wallet::sweep_below(const std::vector<std::string> &args_)
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::burn(const std::vector<std::string> &args_)
|
||||
{
|
||||
// TODO: add locked versions
|
||||
if (args_.size() < 3)
|
||||
{
|
||||
PRINT_USAGE(USAGE_BURN);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> local_args = args_;
|
||||
|
||||
// Get the asset type
|
||||
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") {
|
||||
PRINT_USAGE(USAGE_BURN);
|
||||
return true;
|
||||
}
|
||||
asset_type = strLastArg;
|
||||
local_args.pop_back();
|
||||
|
||||
transfer_main(Transfer, asset_type, "", local_args, false);
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::convert(const std::vector<std::string> &args_)
|
||||
{
|
||||
// TODO: add locked versions
|
||||
@@ -7530,6 +7576,75 @@ bool simple_wallet::convert(const std::vector<std::string> &args_)
|
||||
return true;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::price_info(const std::vector<std::string> &args) {
|
||||
// get circulating supply
|
||||
std::vector<std::pair<std::string, std::string>> supply_amounts;
|
||||
if(!m_wallet->get_circulating_supply(supply_amounts)) {
|
||||
fail_msg_writer() << "failed to get circulating supply. Make sure you are connected to a daemon.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// get pricing record
|
||||
std::string err;
|
||||
uint64_t bc_height = get_daemon_blockchain_height(err);
|
||||
oracle::pricing_record pr;
|
||||
if (!m_wallet->get_pricing_record(pr, bc_height-1)) {
|
||||
fail_msg_writer() << "failed to get pricing record. Make sure you are connected to a daemon.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::supply_info(const std::vector<std::string> &args) {
|
||||
// get circulating supply
|
||||
std::vector<std::pair<std::string, std::string>> supply_amounts;
|
||||
if(!m_wallet->get_circulating_supply(supply_amounts)) {
|
||||
fail_msg_writer() << "failed to get circulating supply. Make sure you are connected to a daemon.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// get pricing record
|
||||
std::string err;
|
||||
uint64_t bc_height = get_daemon_blockchain_height(err);
|
||||
oracle::pricing_record pr;
|
||||
if (!m_wallet->get_pricing_record(pr, bc_height-1)) {
|
||||
fail_msg_writer() << "failed to get pricing record. Make sure you are connected to a daemon.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::yield_info(const std::vector<std::string> &args) {
|
||||
// get circulating supply
|
||||
std::vector<std::pair<std::string, std::string>> supply_amounts;
|
||||
if(!m_wallet->get_circulating_supply(supply_amounts)) {
|
||||
fail_msg_writer() << "failed to get circulating supply. Make sure you are connected to a daemon.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// get pricing record
|
||||
std::string err;
|
||||
uint64_t bc_height = get_daemon_blockchain_height(err);
|
||||
oracle::pricing_record pr;
|
||||
if (!m_wallet->get_pricing_record(pr, bc_height-1)) {
|
||||
fail_msg_writer() << "failed to get pricing record. Make sure you are connected to a daemon.";
|
||||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool simple_wallet::donate(const std::vector<std::string> &args_)
|
||||
{
|
||||
std::vector<std::string> local_args = args_;
|
||||
|
||||
@@ -169,7 +169,6 @@ namespace cryptonote
|
||||
bool show_blockchain_height(const std::vector<std::string> &args);
|
||||
bool transfer_main(int transfer_type, const std::string& source_asset, const std::string& dest_asset, const std::vector<std::string> &args, bool called_by_mms);
|
||||
bool transfer(const std::vector<std::string> &args);
|
||||
bool convert(const std::vector<std::string> &args);
|
||||
bool locked_transfer(const std::vector<std::string> &args);
|
||||
bool locked_sweep_all(const std::vector<std::string> &args);
|
||||
bool sweep_main(uint32_t account, uint64_t below, bool locked, const std::vector<std::string> &args);
|
||||
@@ -178,6 +177,11 @@ namespace cryptonote
|
||||
bool sweep_below(const std::vector<std::string> &args);
|
||||
bool sweep_single(const std::vector<std::string> &args);
|
||||
bool sweep_unmixable(const std::vector<std::string> &args);
|
||||
bool burn(const std::vector<std::string> &args);
|
||||
bool convert(const std::vector<std::string> &args);
|
||||
bool price_info(const std::vector<std::string> &args);
|
||||
bool supply_info(const std::vector<std::string> &args);
|
||||
bool yield_info(const std::vector<std::string> &args);
|
||||
bool donate(const std::vector<std::string> &args);
|
||||
bool sign_transfer(const std::vector<std::string> &args);
|
||||
bool submit_transfer(const std::vector<std::string> &args);
|
||||
|
||||
@@ -1645,6 +1645,9 @@ private:
|
||||
|
||||
static std::string get_default_daemon_address() { CRITICAL_REGION_LOCAL(default_daemon_address_lock); return default_daemon_address; }
|
||||
|
||||
bool get_pricing_record(oracle::pricing_record& pr, const uint64_t height);
|
||||
bool get_circulating_supply(std::vector<std::pair<std::string, std::string>> &amounts);
|
||||
|
||||
private:
|
||||
/*!
|
||||
* \brief Stores wallet information to wallet file.
|
||||
|
||||
Reference in New Issue
Block a user