Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
delegate_bandwidth_subcommand Struct Reference

Public Member Functions

 delegate_bandwidth_subcommand (CLI::App *actionRoot)
 

Public Attributes

string from_str
 
string receiver_str
 
string stake_net_amount
 
string stake_cpu_amount
 
string stake_storage_amount
 
string buy_ram_amount
 
uint32_t buy_ram_bytes = 0
 
bool transfer = false
 

Detailed Description

Definition at line 1522 of file main.cpp.

Constructor & Destructor Documentation

◆ delegate_bandwidth_subcommand()

delegate_bandwidth_subcommand::delegate_bandwidth_subcommand ( CLI::App * actionRoot)
inline

Definition at line 1532 of file main.cpp.

1532 {
1533 auto delegate_bandwidth = actionRoot->add_subcommand("delegatebw", localized("Delegate bandwidth"));
1534 delegate_bandwidth->add_option("from", from_str, localized("The account to delegate bandwidth from"))->required();
1535 delegate_bandwidth->add_option("receiver", receiver_str, localized("The account to receive the delegated bandwidth"))->required();
1536 delegate_bandwidth->add_option("stake_net_quantity", stake_net_amount, localized("The amount of tokens to stake for network bandwidth"))->required();
1537 delegate_bandwidth->add_option("stake_cpu_quantity", stake_cpu_amount, localized("The amount of tokens to stake for CPU bandwidth"))->required();
1538 delegate_bandwidth->add_option("--buyram", buy_ram_amount, localized("The amount of tokens to buy RAM with"));
1539 delegate_bandwidth->add_option("--buy-ram-bytes", buy_ram_bytes, localized("The amount of RAM to buy in bytes"));
1540 delegate_bandwidth->add_flag("--transfer", transfer, localized("Transfer voting power and right to unstake tokens to receiver"));
1541 add_standard_transaction_options(delegate_bandwidth, "from@active");
1542
1543 delegate_bandwidth->callback([this] {
1545 ("from", from_str)
1546 ("receiver", receiver_str)
1547 ("stake_net_quantity", to_asset(stake_net_amount))
1548 ("stake_cpu_quantity", to_asset(stake_cpu_amount))
1549 ("transfer", transfer);
1550 auto accountPermissions = get_account_permissions(tx_permission, {name(from_str), config::active_name});
1551 std::vector<chain::action> acts{create_action(accountPermissions, config::system_account_name, "delegatebw"_n, act_payload)};
1552 SYSC_ASSERT( !(buy_ram_amount.size()) || !buy_ram_bytes, "ERROR: --buyram and --buy-ram-bytes cannot be set at the same time" );
1553 if (buy_ram_amount.size()) {
1555 } else if (buy_ram_bytes) {
1557 }
1558 send_actions(std::move(acts));
1559 });
1560 }
std::string name
App * add_subcommand(std::string subcommand_name="", std::string subcommand_description="")
Add a subcommand. Inherits INHERITABLE and OptionDefaults, and help flag.
Definition CLI11.hpp:5538
Option * add_option(std::string option_name, callback_t option_callback, std::string option_description="", bool defaulted=false, std::function< std::string()> func={})
Definition CLI11.hpp:5099
CRTP * required(bool value=true)
Set the option as required.
Definition CLI11.hpp:3400
An order-preserving dictionary of variants.
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition variant.hpp:191
#define localized(str,...)
Definition localize.hpp:10
chain::action create_action(const vector< permission_level > &authorization, const account_name &code, const action_name &act, const fc::variant &args)
Definition main.cpp:683
#define SYSC_ASSERT(TEST,...)
Definition main.cpp:134
asset to_asset(account_name code, const string &s)
Definition main.cpp:812
vector< chain::permission_level > get_account_permissions(const vector< string > &permissions)
Definition main.cpp:238
chain::action create_buyram(const name &creator, const name &newaccount, const asset &quantity)
Definition main.cpp:687
void add_standard_transaction_options(CLI::App *cmd, string default_permission="")
Definition main.cpp:202
void send_actions(std::vector< chain::action > &&actions, packed_transaction::compression_type compression=packed_transaction::compression_type::none)
Definition main.cpp:616
vector< string > tx_permission
Definition main.cpp:198
chain::action create_buyrambytes(const name &creator, const name &newaccount, uint32_t numbytes)
Definition main.cpp:696
Here is the call graph for this function:

Member Data Documentation

◆ buy_ram_amount

string delegate_bandwidth_subcommand::buy_ram_amount

Definition at line 1528 of file main.cpp.

◆ buy_ram_bytes

uint32_t delegate_bandwidth_subcommand::buy_ram_bytes = 0

Definition at line 1529 of file main.cpp.

◆ from_str

string delegate_bandwidth_subcommand::from_str

Definition at line 1523 of file main.cpp.

◆ receiver_str

string delegate_bandwidth_subcommand::receiver_str

Definition at line 1524 of file main.cpp.

◆ stake_cpu_amount

string delegate_bandwidth_subcommand::stake_cpu_amount

Definition at line 1526 of file main.cpp.

◆ stake_net_amount

string delegate_bandwidth_subcommand::stake_net_amount

Definition at line 1525 of file main.cpp.

◆ stake_storage_amount

string delegate_bandwidth_subcommand::stake_storage_amount

Definition at line 1527 of file main.cpp.

◆ transfer

bool delegate_bandwidth_subcommand::transfer = false

Definition at line 1530 of file main.cpp.


The documentation for this struct was generated from the following file: