1282 {
1283 auto approve_producer = actionRoot->
add_subcommand(
"approve",
localized(
"Add one producer to list of voted producers"));
1287
1288 approve_producer->callback([this] {
1292 ("table", "voters")
1293 ("table_key", "owner")
1294 (
"lower_bound",
name(voter).to_uint64_t())
1295 (
"upper_bound",
name(voter).to_uint64_t() + 1)
1296
1297
1298 ("limit", 1)
1299 );
1301
1302
1303
1304 if( res.rows.empty() || res.rows[0].get_object()[
"owner"].as_string() !=
name(voter).
to_string() ) {
1305 std::cerr << "Voter info not found for account " << voter << std::endl;
1306 return;
1307 }
1308 SYS_ASSERT( 1 == res.rows.size(), multiple_voter_info,
"More than one voter_info for account" );
1309 auto prod_vars = res.rows[0]["producers"].get_array();
1311 for ( auto& x : prod_vars ) {
1312 prods.push_back(
name(x.as_string()) );
1313 }
1315 std::sort( prods.begin(), prods.end() );
1316 auto it = std::unique( prods.begin(), prods.end() );
1317 if (it != prods.end() ) {
1318 std::cerr <<
"Producer \"" <<
producer_name <<
"\" is already on the list." << std::endl;
1319 return;
1320 }
1323 ("proxy", "")
1324 ("producers", prods);
1327 });
1328 }
#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.