cli_wallet: Implement propose_parameter_change to more easily make proposals
This commit is contained in:
parent
cb3c23a17b
commit
1d2dc6abda
3 changed files with 94 additions and 3 deletions
|
|
@ -57,8 +57,16 @@ namespace graphene { namespace chain {
|
||||||
optional<uint32_t> review_period_seconds;
|
optional<uint32_t> review_period_seconds;
|
||||||
extensions_type extensions;
|
extensions_type extensions;
|
||||||
|
|
||||||
/// Constructs a proposal_create_operation suitable for committee proposals, with fee, expiration time and review
|
/**
|
||||||
/// period set appropriately.
|
* Constructs a proposal_create_operation suitable for committee
|
||||||
|
* proposals, with expiration time and review period set
|
||||||
|
* appropriately. No proposed_ops are added. When used to
|
||||||
|
* create a proposal to change chain parameters, this method
|
||||||
|
* expects to receive the currently effective parameters, not
|
||||||
|
* the proposed parameters. (The proposed parameters will go
|
||||||
|
* in proposed_ops, and proposed_ops is untouched by this
|
||||||
|
* function.)
|
||||||
|
*/
|
||||||
static proposal_create_operation committee_proposal(const chain_parameters& param, fc::time_point_sec head_block_time );
|
static proposal_create_operation committee_proposal(const chain_parameters& param, fc::time_point_sec head_block_time );
|
||||||
|
|
||||||
account_id_type fee_payer()const { return fee_paying_account; }
|
account_id_type fee_payer()const { return fee_paying_account; }
|
||||||
|
|
@ -148,4 +156,3 @@ FC_REFLECT( graphene::chain::proposal_update_operation, (fee)(fee_paying_account
|
||||||
(active_approvals_to_add)(active_approvals_to_remove)(owner_approvals_to_add)(owner_approvals_to_remove)
|
(active_approvals_to_add)(active_approvals_to_remove)(owner_approvals_to_add)(owner_approvals_to_remove)
|
||||||
(key_approvals_to_add)(key_approvals_to_remove)(extensions) )
|
(key_approvals_to_add)(key_approvals_to_remove)(extensions) )
|
||||||
FC_REFLECT( graphene::chain::proposal_delete_operation, (fee)(fee_paying_account)(using_owner_authority)(proposal)(extensions) )
|
FC_REFLECT( graphene::chain::proposal_delete_operation, (fee)(fee_paying_account)(using_owner_authority)(proposal)(extensions) )
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1186,6 +1186,31 @@ class wallet_api
|
||||||
*/
|
*/
|
||||||
operation get_prototype_operation(string operation_type);
|
operation get_prototype_operation(string operation_type);
|
||||||
|
|
||||||
|
/** Creates a transaction to propose a parameter change.
|
||||||
|
*
|
||||||
|
* Multiple parameters can be specified if an atomic change is
|
||||||
|
* desired.
|
||||||
|
*
|
||||||
|
* @param proposing_account The account paying the fee to propose the tx
|
||||||
|
* @param changed_values The values to change; all other chain parameters are filled in with default values
|
||||||
|
* @param broadcast true if you wish to broadcast the transaction
|
||||||
|
* @return the signed version of the transaction
|
||||||
|
*/
|
||||||
|
signed_transaction propose_parameter_change(
|
||||||
|
const string& proposing_account,
|
||||||
|
const variant_object& changed_values,
|
||||||
|
bool broadcast = false);
|
||||||
|
|
||||||
|
/** Propose a fee change.
|
||||||
|
*
|
||||||
|
* Not implemented.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
signed_transaction propose_fee_change(
|
||||||
|
const string& proposing_account,
|
||||||
|
const variant_object& changed_values,
|
||||||
|
bool broadcast = false);
|
||||||
|
|
||||||
void dbg_make_uia(string creator, string symbol);
|
void dbg_make_uia(string creator, string symbol);
|
||||||
void dbg_make_mia(string creator, string symbol);
|
void dbg_make_mia(string creator, string symbol);
|
||||||
void flood_network(string prefix, uint32_t number_of_transactions);
|
void flood_network(string prefix, uint32_t number_of_transactions);
|
||||||
|
|
@ -1317,6 +1342,8 @@ FC_API( graphene::wallet::wallet_api,
|
||||||
(serialize_transaction)
|
(serialize_transaction)
|
||||||
(sign_transaction)
|
(sign_transaction)
|
||||||
(get_prototype_operation)
|
(get_prototype_operation)
|
||||||
|
(propose_parameter_change)
|
||||||
|
(propose_fee_change)
|
||||||
(dbg_make_uia)
|
(dbg_make_uia)
|
||||||
(dbg_make_mia)
|
(dbg_make_mia)
|
||||||
(flood_network)
|
(flood_network)
|
||||||
|
|
|
||||||
|
|
@ -1840,6 +1840,45 @@ public:
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signed_transaction propose_parameter_change(
|
||||||
|
const string& proposing_account,
|
||||||
|
const variant_object& changed_values,
|
||||||
|
bool broadcast = false)
|
||||||
|
{
|
||||||
|
FC_ASSERT( !changed_values.contains("current_fees") );
|
||||||
|
|
||||||
|
const chain_parameters& current_params = get_global_properties().parameters;
|
||||||
|
chain_parameters new_params = current_params;
|
||||||
|
fc::reflector<chain_parameters>::visit(
|
||||||
|
fc::from_variant_visitor<chain_parameters>( changed_values, new_params )
|
||||||
|
);
|
||||||
|
|
||||||
|
committee_member_update_global_parameters_operation update_op;
|
||||||
|
update_op.new_parameters = new_params;
|
||||||
|
|
||||||
|
proposal_create_operation prop_op = proposal_create_operation::committee_proposal(
|
||||||
|
current_params, get_dynamic_global_properties().time );
|
||||||
|
prop_op.fee_paying_account = get_account(proposing_account).id;
|
||||||
|
|
||||||
|
prop_op.proposed_ops.emplace_back( update_op );
|
||||||
|
current_params.current_fees->set_fee( prop_op.proposed_ops.back().op );
|
||||||
|
|
||||||
|
signed_transaction tx;
|
||||||
|
tx.operations.push_back(prop_op);
|
||||||
|
set_operation_fees(tx, current_params.current_fees);
|
||||||
|
tx.validate();
|
||||||
|
|
||||||
|
return sign_transaction(tx, broadcast);
|
||||||
|
}
|
||||||
|
|
||||||
|
signed_transaction propose_fee_change(
|
||||||
|
const string& proposing_account,
|
||||||
|
const variant_object& changed_values,
|
||||||
|
bool broadcast = false)
|
||||||
|
{
|
||||||
|
FC_ASSERT( false, "not implemented" );
|
||||||
|
}
|
||||||
|
|
||||||
void dbg_make_uia(string creator, string symbol)
|
void dbg_make_uia(string creator, string symbol)
|
||||||
{
|
{
|
||||||
asset_options opts;
|
asset_options opts;
|
||||||
|
|
@ -2558,6 +2597,24 @@ void wallet_api::flood_network(string prefix, uint32_t number_of_transactions)
|
||||||
my->flood_network(prefix, number_of_transactions);
|
my->flood_network(prefix, number_of_transactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signed_transaction wallet_api::propose_parameter_change(
|
||||||
|
const string& proposing_account,
|
||||||
|
const variant_object& changed_values,
|
||||||
|
bool broadcast /* = false */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return my->propose_parameter_change( proposing_account, changed_values, broadcast );
|
||||||
|
}
|
||||||
|
|
||||||
|
signed_transaction wallet_api::propose_fee_change(
|
||||||
|
const string& proposing_account,
|
||||||
|
const variant_object& changed_values,
|
||||||
|
bool broadcast /* = false */
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return my->propose_fee_change( proposing_account, changed_values, broadcast );
|
||||||
|
}
|
||||||
|
|
||||||
global_property_object wallet_api::get_global_properties() const
|
global_property_object wallet_api::get_global_properties() const
|
||||||
{
|
{
|
||||||
return my->get_global_properties();
|
return my->get_global_properties();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue