27 #include <graphene/chain/hardfork.hpp> 29 namespace graphene {
namespace chain {
37 const asset_update_operation::ext& extensions );
40 const asset_publish_feed_operation::ext& extensions );
44 const bitasset_options& options);
49 const bitasset_options& options);
52 const asset_claim_fees_operation& op);
67 : db( _db ), block_time(bt), next_maintenance_time( db.get_dynamic_global_properties().next_maintenance_time ) {}
87 if( HARDFORK_CORE_2281_PASSED( next_maintenance_time ) )
91 else if( HARDFORK_BSIP_48_75_PASSED( block_time ) )
108 if( HARDFORK_CORE_2281_PASSED( next_maintenance_time ) )
112 else if( HARDFORK_BSIP_48_75_PASSED( block_time ) )
139 if (block_time < HARDFORK_CORE_1468_TIME) {
141 "Unable to set HTLC options before hardfork 1468");
146 if (!HARDFORK_BSIP_40_PASSED(block_time)) {
148 "Unable to set Custom Authority Options before hardfork BSIP 40");
150 "Unable to define fees for custom authority operations prior to hardfork BSIP 40");
152 "Unable to define fees for custom authority operations prior to hardfork BSIP 40");
154 "Unable to define fees for custom authority operations prior to hardfork BSIP 40");
156 if (!HARDFORK_BSIP_85_PASSED(block_time)) {
158 "Unable to set maker_fee_discount_percent before hardfork BSIP 85");
160 if (!HARDFORK_BSIP_86_PASSED(block_time)) {
162 "Unable to set market_fee_network_percent before hardfork BSIP 86");
164 if (!HARDFORK_CORE_2103_PASSED(block_time)) {
166 "Unable to define fees for ticket operations prior to hardfork 2103");
168 "Unable to define fees for ticket operations prior to hardfork 2103");
170 if (!HARDFORK_LIQUIDITY_POOL_PASSED(block_time)) {
172 "Unable to define fees for liquidity pool operations prior to the LP hardfork");
174 "Unable to define fees for liquidity pool operations prior to the LP hardfork");
176 "Unable to define fees for liquidity pool operations prior to the LP hardfork");
178 "Unable to define fees for liquidity pool operations prior to the LP hardfork");
180 "Unable to define fees for liquidity pool operations prior to the LP hardfork");
182 if (!HARDFORK_CORE_2351_PASSED(block_time)) {
184 "Unable to define fees for samet fund operations prior to the core-2351 hardfork");
186 "Unable to define fees for samet fund operations prior to the core-2351 hardfork");
188 "Unable to define fees for samet fund operations prior to the core-2351 hardfork");
190 "Unable to define fees for samet fund operations prior to the core-2351 hardfork");
192 "Unable to define fees for samet fund operations prior to the core-2351 hardfork");
194 if (!HARDFORK_CORE_2362_PASSED(block_time)) {
196 "Unable to define fees for credit offer operations prior to the core-2362 hardfork");
198 "Unable to define fees for credit offer operations prior to the core-2362 hardfork");
200 "Unable to define fees for credit offer operations prior to the core-2362 hardfork");
202 "Unable to define fees for credit offer operations prior to the core-2362 hardfork");
204 "Unable to define fees for credit offer operations prior to the core-2362 hardfork");
206 "Unable to define fees for credit offer operations prior to the core-2362 hardfork");
210 FC_ASSERT( block_time >= HARDFORK_CORE_1468_TIME,
"Not allowed until hardfork 1468" );
211 if (block_time < HARDFORK_CORE_BSIP64_TIME)
216 "Memo unavailable until after HARDFORK BSIP64");
219 "HASH160 unavailable until after HARDFORK BSIP64" );
223 FC_ASSERT( block_time >= HARDFORK_CORE_1468_TIME,
"Not allowed until hardfork 1468" );
226 FC_ASSERT( block_time >= HARDFORK_CORE_1468_TIME,
"Not allowed until hardfork 1468" );
229 FC_ASSERT( HARDFORK_BSIP_40_PASSED(block_time),
"Not allowed until hardfork BSIP 40" );
232 FC_ASSERT( HARDFORK_BSIP_40_PASSED(block_time),
"Not allowed until hardfork BSIP 40" );
235 FC_ASSERT( HARDFORK_BSIP_40_PASSED(block_time),
"Not allowed until hardfork BSIP 40" );
238 FC_ASSERT( HARDFORK_CORE_2103_PASSED(block_time),
"Not allowed until hardfork 2103" );
241 FC_ASSERT( HARDFORK_CORE_2103_PASSED(block_time),
"Not allowed until hardfork 2103" );
244 FC_ASSERT( HARDFORK_LIQUIDITY_POOL_PASSED(block_time),
"Not allowed until the LP hardfork" );
247 FC_ASSERT( HARDFORK_LIQUIDITY_POOL_PASSED(block_time),
"Not allowed until the LP hardfork" );
250 FC_ASSERT( HARDFORK_LIQUIDITY_POOL_PASSED(block_time),
"Not allowed until the LP hardfork" );
253 FC_ASSERT( HARDFORK_LIQUIDITY_POOL_PASSED(block_time),
"Not allowed until the LP hardfork" );
256 FC_ASSERT( HARDFORK_LIQUIDITY_POOL_PASSED(block_time),
"Not allowed until the LP hardfork" );
259 FC_ASSERT( HARDFORK_CORE_2351_PASSED(block_time),
"Not allowed until the core-2351 hardfork" );
262 FC_ASSERT( HARDFORK_CORE_2351_PASSED(block_time),
"Not allowed until the core-2351 hardfork" );
265 FC_ASSERT( HARDFORK_CORE_2351_PASSED(block_time),
"Not allowed until the core-2351 hardfork" );
268 FC_ASSERT( HARDFORK_CORE_2351_PASSED(block_time),
"Not allowed until the core-2351 hardfork" );
271 FC_ASSERT( HARDFORK_CORE_2351_PASSED(block_time),
"Not allowed until the core-2351 hardfork" );
274 FC_ASSERT( HARDFORK_CORE_2362_PASSED(block_time),
"Not allowed until the core-2362 hardfork" );
277 FC_ASSERT( HARDFORK_CORE_2362_PASSED(block_time),
"Not allowed until the core-2362 hardfork" );
280 FC_ASSERT( HARDFORK_CORE_2362_PASSED(block_time),
"Not allowed until the core-2362 hardfork" );
283 FC_ASSERT( HARDFORK_CORE_2362_PASSED(block_time),
"Not allowed until the core-2362 hardfork" );
286 FC_ASSERT( HARDFORK_CORE_2362_PASSED(block_time),
"Not allowed until the core-2362 hardfork" );
292 bool already_contains_proposal_update =
false;
300 FC_ASSERT( !already_contains_proposal_update,
301 "At most one proposal update can be nested in a proposal!" );
302 already_contains_proposal_update =
true;
316 FC_ASSERT(
false,
"Not allowed until hardfork 214");
322 if( nested_update_count == 0 || v.
proposal.instance.value > max_update_instance )
323 max_update_instance = v.
proposal.instance.value;
324 nested_update_count++;
329 if( nested_update_count == 0 || v.
proposal.instance.value > max_update_instance )
330 max_update_instance = v.
proposal.instance.value;
331 nested_update_count++;
349 if( block_time < HARDFORK_CORE_214_TIME )
362 "Proposal expiration time is too far in the future." );
365 "Proposal review period must be less than its overall lifetime." );
368 flat_set<account_id_type> tmp_required_active_auths;
369 vector<authority> other;
373 MUST_IGNORE_CUSTOM_OP_REQD_AUTHS( block_time ) );
377 std::set_difference( tmp_required_active_auths.begin(), tmp_required_active_auths.end(),
378 _required_owner_auths.begin(), _required_owner_auths.end(),
379 std::inserter( _required_active_auths, _required_active_auths.begin() ) );
383 "Proposals containing operations requiring non-account authorities are not yet implemented." );
390 proposal_create_review_period_required,
391 "Review period not given, but at least ${min} required",
392 (
"min", global_parameters.committee_proposal_review_period) );
394 proposal_create_review_period_insufficient,
395 "Review period of ${t} specified, but at least ${min} required",
397 (
"min", global_parameters.committee_proposal_review_period) );
401 _proposed_trx.operations.push_back( op.
op );
403 _proposed_trx.validate();
417 proposal.
proposer = o.fee_paying_account;
418 if( o.review_period_seconds )
425 if( chain_time > HARDFORK_CORE_1479_TIME )
426 FC_ASSERT( vtor_1479.nested_update_count == 0 || proposal.
id.
instance() > vtor_1479.max_update_instance,
427 "Cannot update/delete a proposal with a future id!" );
428 else if( vtor_1479.nested_update_count > 0 && proposal.
id.
instance() <= vtor_1479.max_update_instance )
449 if( _proposal->review_period_time && d.
head_block_time() >= *_proposal->review_period_time )
451 "This proposal is in its review period. No new approvals may be added." );
455 FC_ASSERT( _proposal->available_active_approvals.find(
id) != _proposal->available_active_approvals.end(),
456 "", (
"id", id)(
"available", _proposal->available_active_approvals) );
460 FC_ASSERT( _proposal->available_owner_approvals.find(
id) != _proposal->available_owner_approvals.end(),
461 "", (
"id", id)(
"available", _proposal->available_owner_approvals) );
489 if( _proposal->review_period_time )
492 if( _proposal->is_authorized_to_execute(d) )
495 _executed_proposal =
true;
502 wlog(
"Proposed transaction ${id} failed to apply once approved with exception:\n----\n${reason}\n----\nWill try again when it expires.",
504 _proposal_failed =
true;
518 : &_proposal->required_active_approvals;
520 "Provided authority is not authoritative for this proposal.",
528 db().remove(*_proposal);
void operator()(const graphene::chain::htlc_redeem_operation &) const
time_point_sec expiration_time
const fc::time_point_sec next_maintenance_time
void modify(const T &obj, const Lambda &m)
chain_parameters parameters
void operator()(const graphene::chain::proposal_create_operation &v) const
void operator()(const graphene::chain::samet_fund_create_operation &) const
proposal_operation_hardfork_visitor(const database &_db, const fc::time_point_sec bt)
bitasset_options new_options
void operator()(const graphene::chain::liquidity_pool_deposit_operation &) const
void operator()(const graphene::chain::custom_authority_update_operation &) const
void check_asset_options_hf_bsip81(const fc::time_point_sec &block_time, const asset_options &options)
void check_bitasset_options_hf_bsip74(const fc::time_point_sec &block_time, const bitasset_options &options)
Create a new liquidity pool.
void operator()(const T &v) const
void operator()(const graphene::chain::samet_fund_delete_operation &) const
necessary to support nested operations inside the proposal_create_operation
void check_bitasset_options_hf_bsip87(const fc::time_point_sec &block_time, const bitasset_options &options)
extension< ext > extensions
void check_asset_options_hf_core2467(const fc::time_point_sec &next_maint_time, const asset_options &options)
vector< operation > operations
extension< ext > extensions
void operator()(const graphene::chain::samet_fund_borrow_operation &) const
time_point_sec head_block_time() const
flat_set< account_id_type > available_active_approvals
tracks the blockchain state in an extensible manner
Delete a custom authority.
std::string to_string(log_level ll=log_level::info) const
void operator()(const graphene::chain::ticket_update_operation &) const
used to transfer accumulated fees back to the issuer's balance.
The proposal_delete_operation deletes an existing transaction proposalThis operation allows the early...
void_result do_evaluate(const proposal_update_operation &o)
void check_bitasset_options_hf_bsip_48_75(const fc::time_point_sec &block_time, const bitasset_options &options)
void operator()(const graphene::chain::custom_authority_create_operation &) const
void check_bitasset_opts_hf_core2467(const fc::time_point_sec &next_maint_time, const bitasset_options &options)
processed_transaction push_proposal(const proposal_object &proposal)
Used to generate a useful error report when an exception is thrown.At each level in the stack where t...
void operator()(const graphene::chain::ticket_create_operation &) const
void operator()(const graphene::chain::liquidity_pool_delete_operation &) const
flat_set< account_id_type > required_owner_approvals
void check_asset_publish_feed_extensions_hf_bsip77(const fc::time_point_sec &block_time, const asset_publish_feed_operation::ext &extensions)
void operator()(const T &v) const
visitor::result_type visit(visitor &v)
Accept a creadit offer and create a credit deal.
Updates an existing ticket.
void_result do_apply(const proposal_update_operation &o)
Publish price feeds for market-issued assetsPrice feed providers use this operation to publish their ...
Create a new SameT Fund objectA SameT Fund is a fund which can be used by a borrower and have to be r...
Update a SameT Fund object.
flat_set< account_id_type > available_owner_approvals
Update a custom authority.
uint64_t instance() const
The proposal_create_operation creates a transaction proposal, for use in multi-sig scenariosCreates a...
extension< additional_options_type > extensions
void operator()(const proposal_update_operation &v) const
void operator()(const graphene::chain::samet_fund_repay_operation &) const
Delete a SameT Fund object.
const fc::time_point_sec block_time
extension< ext > extensions
void operator()(const graphene::chain::asset_update_operation &v) const
void validate_flags(bool is_market_issued, bool allow_disable_collateral_bid=true) const
void operator()(const graphene::chain::asset_publish_feed_operation &v) const
flat_set< public_key_type > key_approvals_to_remove
void operator()(const graphene::chain::htlc_create_operation &op) const
time_point_sec expiration_time
chain_parameters new_parameters
Transfers an amount of one asset from one account to another.
flat_set< account_id_type > active_approvals_to_remove
account_id_type fee_paying_account
microseconds seconds(int64_t s)
flat_set< account_id_type > owner_approvals_to_remove
void operator()(const graphene::chain::asset_update_bitasset_operation &v) const
#define GRAPHENE_COMMITTEE_ACCOUNT
void operator()(const graphene::chain::liquidity_pool_exchange_operation &) const
Withdraw from a liquidity pool.
std::shared_ptr< const fee_schedule > current_fees
current schedule of fees
#define FC_CAPTURE_AND_RETHROW(...)
Update options specific to BitAssetsBitAssets have some options which are not relevant to other asset...
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
optional< uint32_t > review_period_seconds
Exchange with a liquidity pool.
void operator()(const graphene::chain::credit_deal_repay_operation &) const
void_result do_evaluate(const proposal_create_operation &o)
object_id_type do_apply(const proposal_create_operation &o)
A credit deal expired without being fully repaid.
vector< op_wrapper > proposed_ops
#define GRAPHENE_NULL_ACCOUNT
Represents the canonical account with NO authority (nobody can access funds in null account) ...
Update options common to all assetsThere are a number of options which all assets in the network use...
optional< time_point_sec > review_period_time
transaction proposed_transaction
void operator()(const graphene::chain::asset_claim_fees_operation &v) const
void operator()(const graphene::chain::credit_offer_delete_operation &) const
void operator()(const graphene::chain::credit_offer_create_operation &) const
void operator()(const graphene::chain::liquidity_pool_create_operation &) const
void_result do_apply(const proposal_delete_operation &)
flat_set< account_id_type > required_active_approvals
#define GRAPHENE_RELAXED_COMMITTEE_ACCOUNT
Represents the current committee members.
void operator()(const T &v) const
flat_set< public_key_type > key_approvals_to_add
std::string to_detail_string(log_level ll=log_level::all) const
void check_asset_update_extensions_hf_bsip_48_75(const fc::time_point_sec &block_time, const asset_update_operation::ext &extensions)
void check_asset_claim_fees_hardfork_87_74_collatfee(const fc::time_point_sec &block_time, const asset_claim_fees_operation &op)
void operator()(const graphene::chain::htlc_extend_operation &) const
void check_bitasset_options_hf_bsip77(const fc::time_point_sec &block_time, const bitasset_options &options)
proposal_id_type proposal
asset amount
The amount of asset to transfer from from to to.
proposal_id_type proposal
bool using_owner_authority
void check_asset_options_hf_bsip_48_75(const fc::time_point_sec &block_time, const asset_options &options)
void operator()(const graphene::chain::committee_member_update_global_parameters_operation &op) const
The proposal_update_operation updates an existing transaction proposalThis operation allows accounts ...
optional< bitasset_options > bitasset_opts
Options only available for BitAssets. MUST be non-null if and only if the asset is market-issued...
account_id_type from
Account to transfer asset from.
void operator()(const graphene::chain::samet_fund_update_operation &) const
constexpr int64_t GRAPHENE_MAX_SHARE_SUPPLY(1000000000000000LL)
#define GRAPHENE_ASSERT(expr, exc_type, FORMAT,...)
void check_asset_options_hf_core2281(const fc::time_point_sec &next_maint_time, const asset_options &options)
Used by committee_members to update the global parameters of the blockchain.This operation allows the...
void operator()(const graphene::chain::asset_create_operation &v) const
flat_set< account_id_type > owner_approvals_to_add
void operator()(const graphene::chain::credit_offer_update_operation &) const
flat_set< public_key_type > available_key_approvals
void check_asset_options_hf_1774(const fc::time_point_sec &block_time, const asset_options &options)
Borrow from a SameT Fund.
void operator()(const graphene::chain::credit_offer_accept_operation &) const
void operator()(const graphene::chain::custom_authority_delete_operation &) const
void operation_get_required_authorities(const operation &op, flat_set< account_id_type > &active, flat_set< account_id_type > &owner, vector< authority > &other, bool ignore_custom_operation_required_auths)
asset_options new_options
flat_set< account_id_type > active_approvals_to_add
account_id_type to
Account to transfer asset to.
Deposit to a liquidity pool.
void_result do_evaluate(const proposal_delete_operation &o)
void operator()(const graphene::chain::liquidity_pool_withdraw_operation &) const
const T & create(F &&constructor)
Create a new custom authority.
asset_options common_options
Create a new credit offerA credit offer is a fund that can be used by other accounts who provide cert...
const global_property_object & get_global_properties() const
tracks the approval of a partially approved transaction