1335 {
1336 auto approve_producer = actionRoot->
add_subcommand(
"unapprove",
localized(
"Remove one producer from list of voted producers"));
1340
1341 approve_producer->callback([this] {
1345 ("table", "voters")
1346 ("table_key", "owner")
1347 (
"lower_bound",
name(voter).to_uint64_t())
1348 (
"upper_bound",
name(voter).to_uint64_t() + 1)
1349
1350
1351 ("limit", 1)
1352 );
1354
1355
1356
1357 if( res.rows.empty() || res.rows[0].get_object()[
"owner"].as_string() !=
name(voter).
to_string() ) {
1358 std::cerr << "Voter info not found for account " << voter << std::endl;
1359 return;
1360 }
1361 SYS_ASSERT( 1 == res.rows.size(), multiple_voter_info,
"More than one voter_info for account" );
1362 auto prod_vars = res.rows[0]["producers"].get_array();
1364 for ( auto& x : prod_vars ) {
1365 prods.push_back(
name(x.as_string()) );
1366 }
1368 if (it == prods.end() ) {
1369 std::cerr <<
"Cannot remove: producer \"" <<
producer_name <<
"\" is not on the list." << std::endl;
1370 return;
1371 }
1372 prods.erase( it, prods.end() );
1375 ("proxy", "")
1376 ("producers", prods);
1379 });
1380 }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
App * add_subcommand(std::string subcommand_name="", std::string subcommand_description="")
Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag.
Option * add_option(std::string option_name, callback_t option_callback, std::string option_description="", bool defaulted=false, std::function< std::string()> func={})
CRTP * required(bool value=true)
Set the option as required.
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
#define localized(str,...)
fc::string to_string(double)
const string get_table_func
chain::action create_action(const vector< permission_level > &authorization, const account_name &code, const action_name &act, const fc::variant &args)
vector< chain::permission_level > get_account_permissions(const vector< string > &permissions)
void add_standard_transaction_options(CLI::App *cmd, string default_permission="")
void send_actions(std::vector< chain::action > &&actions, packed_transaction::compression_type compression=packed_transaction::compression_type::none)
vector< string > tx_permission
fc::variant call(const std::string &url, const std::string &path, const T &v)
Immutable except for fc::from_variant.