30 #include <graphene/chain/hardfork.hpp> 35 namespace graphene {
namespace chain {
41 if( block_time < HARDFORK_1774_TIME )
45 "Asset extension reward percent must be less than 100% till HARDFORK_1774_TIME!");
52 FC_ASSERT( block_time >= HARDFORK_CORE_BSIP74_TIME
53 || !options.
extensions.value.margin_call_fee_ratio.valid(),
54 "A BitAsset's MCFR cannot be set before Hardfork BSIP74" );
60 if (block_time < HARDFORK_BSIP_81_TIME) {
63 "Taker fee percent should not be defined before HARDFORK_BSIP_81_TIME");
70 if ( !HARDFORK_BSIP_48_75_PASSED( block_time ) )
74 "New asset issuer permission bits should not be set before HARDFORK_BSIP_48_75_TIME" );
82 if ( !HARDFORK_BSIP_48_75_PASSED( block_time ) )
86 "Maintenance collateral ratio should not be defined by asset owner " 87 "before HARDFORK_BSIP_48_75_TIME" );
89 "Maximum short squeeze ratio should not be defined by asset owner " 90 "before HARDFORK_BSIP_48_75_TIME" );
98 if ( !HARDFORK_BSIP_48_75_PASSED( block_time ) )
102 "new_precision should not be set before HARDFORK_BSIP_48_75_TIME" );
104 "skip_core_exchange_rate should not be set before HARDFORK_BSIP_48_75_TIME" );
112 if ( !HARDFORK_BSIP_77_PASSED( block_time ) )
116 "Initial collateral ratio should not be defined before HARDFORK_BSIP_77_TIME" );
123 if ( !HARDFORK_BSIP_77_PASSED( block_time ) ) {
126 "Initial collateral ratio should not be defined before HARDFORK_BSIP_77_TIME");
134 || block_time >= HARDFORK_CORE_BSIP87_TIME,
135 "A BitAsset's FSFP cannot be set before Hardfork BSIP87" );
143 block_time >= HARDFORK_CORE_BSIP_87_74_COLLATFEE_TIME,
144 "Collateral-denominated fees are not yet active and therefore cannot be claimed." );
150 if ( !HARDFORK_CORE_2281_PASSED(next_maint_time) )
154 "New asset issuer permission bit 'disable_collateral_bidding' should not be set " 155 "before Hardfork core-2281" );
164 if ( !HARDFORK_CORE_2467_PASSED(next_maint_time) )
168 "New asset issuer permission bit 'disable_bsrm_update' should not be set " 169 "before Hardfork core-2467" );
176 if ( !HARDFORK_CORE_2467_PASSED(next_maint_time) )
179 "A BitAsset's black swan response method cannot be set before Hardfork core-2467" );
207 if( HARDFORK_CORE_2281_PASSED( next_maint_time ) )
211 else if( HARDFORK_BSIP_48_75_PASSED( now ) )
228 auto asset_symbol_itr = asset_indx.find( op.
symbol );
229 FC_ASSERT( asset_symbol_itr == asset_indx.end() );
232 if( now > HARDFORK_385_TIME )
234 auto dotpos = op.
symbol.rfind(
'.' );
235 if( dotpos != std::string::npos )
237 auto prefix = op.
symbol.substr( 0, dotpos );
238 auto asset_symbol_itr = asset_indx.find( prefix );
239 FC_ASSERT( asset_symbol_itr != asset_indx.end(),
240 "Asset ${s} may only be created by issuer of asset ${p}, but asset ${p} has not been created",
241 (
"s",op.
symbol)(
"p",prefix) );
242 FC_ASSERT( asset_symbol_itr->issuer == op.
issuer,
"Asset ${s} may only be created by issuer of ${p}, ${i}",
255 "May not create a bitasset backed by a bitasset backed by a bitasset." );
257 "May not create a blockchain-controlled market asset which is not backed by CORE.");
260 "May not create a blockchain-controlled market asset which is not backed by CORE.");
276 constexpr int64_t two = 2;
277 fee_is_odd = ( ( core_fee_paid.value % two ) != 0 );
278 core_fee_paid -= core_fee_paid.value / two;
286 bool hf_429 = fee_is_odd && d.
head_block_time() > HARDFORK_CORE_429_TIME;
290 a.current_supply = 0;
291 a.fee_pool = core_fee_paid - (hf_429 ? 1 : 0);
294 if( fee_is_odd && !hf_429 )
301 asset_bitasset_data_id_type bit_asset_id;
318 if( a.
options.core_exchange_rate.base.asset_id.instance.value == 0 )
319 a.
options.core_exchange_rate.quote.asset_id = next_asset_id;
321 a.
options.core_exchange_rate.base.asset_id = next_asset_id;
322 a.dynamic_asset_data_id = dyn_asset.
id;
323 if( op.bitasset_opts.valid() )
324 a.bitasset_data_id = bit_asset_id;
328 FC_ASSERT( new_asset.
id == next_asset_id,
"Unexpected object database error, object id mismatch" );
372 asset_reserve_invalid_on_mia,
373 "Cannot reserve ${sym} because it is a market-issued asset",
377 from_account = fee_paying_account;
384 "Can not reserve an amount that is more than the current supply" );
389 "The asset is a liquidity pool share asset thus can only reserve an amount " 390 "that is less than the current supply" );
429 static void validate_new_issuer(
const database& d,
const asset_object& a, account_id_type new_issuer )
431 FC_ASSERT(d.
find(new_issuer),
"New issuer account does not exist");
439 "May not create a blockchain-controlled market asset which is not backed by CORE.");
442 "May not create a blockchain-controlled market asset which is not backed by CORE.");
460 bool hf_bsip_48_75_passed = ( HARDFORK_BSIP_48_75_PASSED( now ) );
461 bool hf_core_2281_passed = ( HARDFORK_CORE_2281_PASSED( next_maint_time ) );
462 bool hf_core_2467_passed = ( HARDFORK_CORE_2467_PASSED( next_maint_time ) );
472 "Since Hardfork #199, updating issuer requires the use of asset_update_issuer_operation.");
479 if( hf_core_2467_passed )
484 "Unable to set non-UIA issuer permission bits on UIA" );
486 else if( bitasset_data->is_prediction_market )
488 "Unable to set disable_bsrm_update issuer permission bit on PM" );
493 if( hf_bsip_48_75_passed && a.
is_market_issued() && bitasset_data->is_prediction_market )
497 "The global_settle permission should be enabled for prediction markets" );
502 if( dyn_data.current_supply != 0 )
507 & (uint16_t)(~enabled_issuer_permissions_mask) ) & UIA_ASSET_ISSUER_PERMISSION_MASK ),
508 "Cannot reinstate previously revoked issuer permissions on a UIA if current supply is non-zero, " 509 "unless to unset non-UIA issuer permission bits.");
510 else if( hf_core_2467_passed && bitasset_data->is_prediction_market )
513 "Cannot reinstate previously revoked issuer permissions on a PM if current supply is non-zero, " 514 "unless to unset the disable_bsrm_update issuer permission bit.");
517 & (uint16_t)(~enabled_issuer_permissions_mask) ),
518 "Cannot reinstate previously revoked issuer permissions on an asset if current supply is non-zero.");
521 "Cannot update precision if current supply is non-zero" );
523 if( hf_bsip_48_75_passed )
526 "Max supply should not be smaller than current supply" );
532 if( hf_core_2281_passed )
536 else if( hf_bsip_48_75_passed )
543 if( hf_bsip_48_75_passed )
546 uint16_t valid_flags_mask = hf_core_2281_passed ? VALID_FLAGS_MASK
548 uint16_t check_bits = a.
is_market_issued() ? valid_flags_mask : UIA_VALID_FLAGS_MASK;
551 & (uint16_t)(~enabled_issuer_permissions_mask) ),
552 "Flag change is forbidden by issuer permissions" );
557 "Flag change is forbidden by issuer permissions" );
560 asset_to_update = &a;
562 "Incorrect issuer for asset! (${o.issuer} != ${a.issuer})",
566 "Can not update max supply" );
568 if( o.
extensions.value.new_precision.valid() )
571 "Specified a new precision but it does not change" );
574 FC_ASSERT( !bitasset_data->is_prediction_market,
"Can not update precision of a prediction market" );
578 .indices().
get<by_short_backing_asset>();
580 bool backing_another_asset = ( itr != idx.end() && itr->options.short_backing_asset == o.
asset_to_update );
582 "Asset ${a} is backed by this asset, can not update precision",
583 (
"a",itr->asset_id) );
629 if( !o.
extensions.value.skip_core_exchange_rate.valid() && asset_to_update->is_market_issued()
632 const auto& bitasset = ( bitasset_data ? *bitasset_data : asset_to_update->bitasset_data(d) );
633 if( !bitasset.asset_cer_updated )
645 if( o.
extensions.value.new_precision.valid() )
647 if( o.
extensions.value.skip_core_exchange_rate.valid() )
668 asset_to_update = &a;
670 "Incorrect issuer for asset! (${o.issuer} != ${a.issuer})",
700 if ( new_backing_asset.
get_id() == asset_id_type() )
706 .
get<by_short_backing_asset>();
711 const auto& child = bitasset_data.asset_id(d);
712 FC_ASSERT( child.get_id() != op.new_options.short_backing_asset,
713 "A BitAsset would be invalidated by changing this backing asset " 714 "('A' backed by 'B' backed by 'A')." );
716 FC_ASSERT( child.issuer != GRAPHENE_COMMITTEE_ACCOUNT,
717 "A blockchain-controlled market asset would be invalidated by changing this backing asset." );
719 FC_ASSERT( !new_backing_asset.is_market_issued(),
720 "A non-blockchain controlled BitAsset would be invalidated by changing this backing asset.");
741 FC_ASSERT( op.
issuer == asset_obj.
issuer,
"Only asset issuer can update bitasset_data of the asset." );
745 if( !HARDFORK_CORE_2282_PASSED( next_maint_time ) )
747 "Cannot update a bitasset after a global settlement has executed" );
751 "Can not set black_swan_response_method for Prediction Markets" );
757 const auto& old_mcr = current_bitasset_data.
options.
extensions.value.maintenance_collateral_ratio;
759 bool mcr_changed = ( ( old_mcr.valid() != new_mcr.valid() )
760 || ( old_mcr.valid() && *old_mcr != *new_mcr ) );
761 FC_ASSERT( !mcr_changed,
"No permission to update MCR" );
766 const auto& old_icr = current_bitasset_data.
options.
extensions.value.initial_collateral_ratio;
768 bool icr_changed = ( ( old_icr.valid() != new_icr.valid() )
769 || ( old_icr.valid() && *old_icr != *new_icr ) );
770 FC_ASSERT( !icr_changed,
"No permission to update ICR" );
775 const auto& old_mssr = current_bitasset_data.
options.
extensions.value.maximum_short_squeeze_ratio;
777 bool mssr_changed = ( ( old_mssr.valid() != new_mssr.valid() )
778 || ( old_mssr.valid() && *old_mssr != *new_mssr ) );
779 FC_ASSERT( !mssr_changed,
"No permission to update MSSR" );
784 if( old_bsrm != new_bsrm )
788 "Unable to update BSRM when the asset has been globally settled" );
792 if( bsrm_type::individual_settlement_to_fund == old_bsrm )
794 "Unable to update BSRM when the individual settlement pool is not empty" );
795 else if( bsrm_type::individual_settlement_to_order == old_bsrm )
797 "Unable to update BSRM when there exists an individual settlement order" );
800 if( bsrm_type::no_settlement == old_bsrm || bsrm_type::no_settlement == new_bsrm )
801 update_feeds_due_to_bsrm_change =
true;
806 bool after_hf_core_922_931 = ( next_maint_time > HARDFORK_CORE_922_931_TIME );
812 "Cannot change backing asset after a global settlement has executed" );
816 "Cannot change backing asset if there is already a current supply." );
818 FC_ASSERT( dyn.accumulated_collateral_fees == 0,
819 "Must claim collateral-denominated fees before changing backing asset." );
823 if( after_hf_core_922_931 )
826 "Cannot update an asset to be backed by itself." );
831 "The precision of the asset and backing asset must be equal." );
839 "May not modify a blockchain-controlled market asset to be backed by an asset which is not " 847 "May not modify a blockchain-controlled market asset to be backed by an asset which is not " 848 "market issued asset nor CORE." );
859 if ( new_backing_asset.
get_id() != asset_id_type() )
870 FC_ASSERT( (backing_backing_asset_id == asset_id_type()
871 || !backing_backing_asset_id(d).is_market_issued()),
872 "A BitAsset cannot be backed by a BitAsset that itself is backed by a BitAsset.");
878 if( after_hf_core_922_931 )
881 "Feed lifetime must exceed block interval." );
883 "Force settlement delay must exceed block interval." );
886 bitasset_to_update = ¤t_bitasset_data;
887 asset_to_update = &asset_obj;
908 static bool update_bitasset_object_options(
911 bool update_feeds_due_to_bsrm_change )
914 bool after_hf_core_868_890 = ( next_maint_time > HARDFORK_CORE_868_890_TIME );
917 bool after_core_hardfork_2582 = HARDFORK_CORE_2582_PASSED( head_time );
920 bool should_update_feeds =
false;
922 should_update_feeds =
true;
925 if( after_hf_core_868_890
928 should_update_feeds =
true;
932 bool backing_asset_changed =
false;
933 bool is_witness_or_committee_fed =
false;
934 if( after_hf_core_868_890
937 backing_asset_changed =
true;
938 should_update_feeds =
true;
940 is_witness_or_committee_fed =
true;
945 if( !should_update_feeds )
949 bool icr_changed = ( ( old_icr.valid() != new_icr.valid() )
950 || ( old_icr.valid() && *old_icr != *new_icr ) );
951 should_update_feeds = icr_changed;
954 if( !should_update_feeds )
958 bool mcr_changed = ( ( old_mcr.valid() != new_mcr.valid() )
959 || ( old_mcr.valid() && *old_mcr != *new_mcr ) );
960 should_update_feeds = mcr_changed;
963 if( !should_update_feeds )
967 bool mssr_changed = ( ( old_mssr.valid() != new_mssr.valid() )
968 || ( old_mssr.valid() && *old_mssr != *new_mssr ) );
969 should_update_feeds = mssr_changed;
975 const bool mcfr_changed = ( ( old_mcfr.valid() != new_mcfr.valid() )
976 || ( old_mcfr.valid() && *old_mcfr != *new_mcfr ) );
982 if( backing_asset_changed )
984 if( is_witness_or_committee_fed )
993 for(
auto& current_feed : bdo.
feeds )
995 current_feed.second.second.settlement_price =
price();
1000 bool feed_actually_changed =
false;
1001 if( should_update_feeds || update_feeds_due_to_bsrm_change )
1012 feed_actually_changed = ( after_hf_core_868_890 && !old_feed.margin_call_params_equal( bdo.
current_feed ) );
1014 if( !feed_actually_changed && after_core_hardfork_2582
1015 && !old_median_feed.margin_call_params_equal( bdo.
median_feed ) )
1016 feed_actually_changed =
true;
1020 const bool retval = feed_actually_changed || mcfr_changed;
1029 auto& db_conn = db();
1030 bool to_check_call_orders =
false;
1032 db_conn.modify( *bitasset_to_update,
1035 to_check_call_orders = update_bitasset_object_options( op, db_conn, bdo, *asset_to_update,
1036 update_feeds_due_to_bsrm_change );
1039 if( to_check_call_orders )
1041 db_conn.check_call_orders( *asset_to_update,
true,
false, bitasset_to_update );
1053 "Cannot specify more feed producers than maximum allowed" );
1057 FC_ASSERT(a.is_market_issued(),
"Cannot update feed producers on a non-BitAsset.");
1061 FC_ASSERT( a.issuer == o.
issuer,
"Only asset issuer can update feed producers of an asset" );
1063 asset_to_update = &a;
1088 for(
auto itr = a.
feeds.begin(); itr != a.
feeds.end(); )
1091 itr = a.
feeds.erase(itr);
1114 FC_ASSERT( asset_to_settle->is_market_issued(),
"Can only globally settle market-issued assets" );
1115 FC_ASSERT( asset_to_settle->can_global_settle(),
"The global_settle permission of this asset is disabled" );
1116 FC_ASSERT( asset_to_settle->issuer == op.
issuer,
"Only asset issuer can globally settle an asset" );
1117 FC_ASSERT( asset_to_settle->dynamic_data(d).current_supply > 0,
1118 "Can not globally settle an asset with zero supply" );
1122 FC_ASSERT( !_bitasset_data.has_settlement(),
1123 "This asset has been globally settled, cannot globally settle again" );
1127 if( least_collateralized_short )
1130 <= least_collateralized_short->get_collateral(),
1131 "Cannot globally settle at supplied price: least collateralized short lacks " 1132 "sufficient collateral to settle." );
1149 FC_ASSERT( asset_to_settle->is_market_issued(),
1150 "Can only force settle a predition market or a market issued asset" );
1152 const auto& bitasset = asset_to_settle->bitasset_data(d);
1153 FC_ASSERT( asset_to_settle->can_force_settle() || bitasset.has_settlement()
1154 || bitasset.has_individual_settlement(),
1155 "Either the asset need to have the force_settle flag enabled, or it need to be globally settled, " 1156 "or the individual settlement pool is not empty" );
1158 if( bitasset.is_prediction_market )
1161 "Global settlement must occur before force settling a prediction market" );
1163 else if( bitasset.current_feed.settlement_price.is_null() )
1169 "Before the core-216 hard fork, unable to force settle when there is no sufficient " 1170 " price feeds, no matter if the asset has been globally settled" );
1172 if( !bitasset.has_settlement() && !bitasset.has_individual_settlement() )
1175 "Cannot force settle with no price feed if the asset is not globally settled and the " 1176 "individual settlement pool is not empty" );
1186 "The account is not allowed to settle the asset" );
1188 "The account is not allowed to receive the backing asset" );
1191 bitasset_ptr = &bitasset;
1214 "Internal error: amount in the global settlement fund is not sufficient to pay the settlement" );
1218 FC_THROW(
"Settle amount is too small to receive anything due to rounding" );
1223 && settled_amount.
amount != 0
1224 && maint_time > HARDFORK_CORE_342_TIME )
1232 if( settled_amount.
amount > 0 )
1243 if( head_time >= HARDFORK_CORE_1780_TIME )
1246 settled_amount -= issuer_fees;
1249 if( settled_amount.
amount > 0 )
1260 result.
value.paid = vector<asset>({ pays });
1261 result.
value.received = vector<asset>({ settled_amount });
1262 result.
value.fees = vector<asset>({ issuer_fees });
1278 settled_amount = op.
amount * settlement_price;
1279 FC_ASSERT( settled_amount.
amount > 0,
"Settle amount is too small to receive anything due to rounding" );
1289 obj.current_supply -= pays.
amount;
1291 auto issuer_fees = d.
pay_market_fees( fee_paying_account, settled_amount.
asset_id(d), settled_amount, false );
1292 settled_amount -= issuer_fees;
1294 if( settled_amount.
amount > 0 )
1311 result.
value.paid = vector<asset>({ pays });
1312 result.
value.received = vector<asset>({ settled_amount });
1313 result.
value.fees = vector<asset>({ issuer_fees });
1322 const auto& bitasset = *bitasset_ptr;
1326 return pay_settle_from_gs_fund( d, op, fee_paying_account, *asset_to_settle, bitasset );
1333 result = pay_settle_from_individual_pool( d, op, fee_paying_account, *asset_to_settle, bitasset );
1339 to_settle -= result.
value.paid->front();
1347 bool after_core_hardfork_2582 = HARDFORK_CORE_2582_PASSED( head_time );
1348 if( after_core_hardfork_2582 && 0 == to_settle.
amount )
1353 s.owner = op.account;
1358 result.
value.new_objects = flat_set<object_id_type>({ settle.id });
1360 if( HARDFORK_CORE_2481_PASSED( maint_time ) )
1382 if( bitasset.is_prediction_market || now <= HARDFORK_CORE_216_TIME )
1384 FC_ASSERT( !bitasset.has_settlement(),
"No further feeds may be published after a settlement event" );
1389 "Quote asset type in settlement price should be same as backing asset of this asset" );
1391 if( now > HARDFORK_480_TIME )
1396 "Quote asset in core exchange rate should be CORE asset" );
1412 "Only active witnesses are allowed to publish price feeds for this asset" );
1417 "Only active committee members are allowed to publish price feeds for this asset" );
1422 "The account is not in the set of allowed price feed producers of this asset" );
1426 bitasset_ptr = &bitasset;
1446 o.
extensions.value.initial_collateral_ratio ) );
1450 bool after_core_hardfork_2582 = HARDFORK_CORE_2582_PASSED( head_time );
1452 if( !after_core_hardfork_2582 && old_feed.margin_call_params_equal(bad.
current_feed) )
1454 if( after_core_hardfork_2582 && old_median_feed.margin_call_params_equal(bad.
median_feed) )
1461 bool should_revive =
false;
1463 if( mia_dyn.current_supply == 0 )
1464 should_revive =
true;
1467 else if( next_maint_time <= HARDFORK_CORE_1270_TIME )
1470 auto fund_call_price = ~
price::call_price(
asset(mia_dyn.current_supply, o.
asset_id),
1480 should_revive = HARDFORK_CORE_2290_PASSED( next_maint_time ) ?
1511 container_asset = o.
extensions.value.claim_from_asset_id.valid() ?
1514 FC_ASSERT( container_asset->issuer == o.
issuer,
"Asset fees may only be claimed by the issuer" );
1516 "Asset ${a} (${id}) is not backed by asset (${fid}) and does not hold it as fees.",
1519 container_ddo = &container_asset->dynamic_asset_data_id(d);
1523 "Attempt to claim more fees than have accumulated within asset ${a} (${id}). " 1524 "Asset DDO: ${ddo}. Fee claim: ${claim}.", (
"a",container_asset->symbol)
1525 (
"id",container_asset->id)(
"ddo",*container_ddo)(
"claim",o.
amount_to_claim) );
1528 "Attempt to claim more backing-asset fees than have accumulated within asset ${a} (${id}) " 1529 "backed by (${fid}). Asset DDO: ${ddo}. Fee claim: ${claim}.", (
"a",container_asset->symbol)
uint8_t maximum_asset_feed_publishers
the maximum number of feed publishers for a given asset
extension< ext > extensions
asset_id_type asset_id
asset for which the feed is published
bool has_settlement() const
account_id_type issuer
must match issuer of asset from which we claim fees
uint32_t force_settlement_delay_sec
This is the delay between the time a long requests settlement and the chain evaluates the settlement...
asset_id_type asset_id
The asset this object belong to.
void modify(const T &obj, const Lambda &m)
black_swan_response_type get_black_swan_response_method() const
Get the effective black swan response method.
chain_parameters parameters
Update the set of feed-producing accounts for a BitAssetBitAssets have price feeds selected by taking...
bitasset_options new_options
flat_set< account_id_type > blacklist_authorities
price get_individual_settlement_price() const
Get the price of the individual settlement pool.
void check_asset_options_hf_bsip81(const fc::time_point_sec &block_time, const asset_options &options)
void adjust_balance(account_id_type account, asset delta)
Adjust a particular account's balance in a given asset by a delta.
void check_bitasset_options_hf_bsip74(const fc::time_point_sec &block_time, const bitasset_options &options)
account_id_type new_issuer
contains properties that only apply to bitassets (market issued assets)
black_swan_response_type
Defines how a BitAsset would respond to black swan events.
void check_bitasset_options_hf_bsip87(const fc::time_point_sec &block_time, const bitasset_options &options)
void check_asset_options_hf_core2467(const fc::time_point_sec &next_maint_time, const asset_options &options)
bool is_authorized_asset(const database &d, const account_object &acct, const asset_object &asset_obj)
extension< additional_options_type > extensions
account_id_type publisher
flat_set< account_id_type > new_feed_producers
void for_each(list< Types... >, Callable c)
Invoke the provided callable with an argument wrapper<Type>() for each type in the list...
extension< ext > extensions
void apply_force_settlement(const force_settlement_object &new_settlement, const asset_bitasset_data_object &bitasset, const asset_object &asset_obj)
Process a new force-settlement request.
time_point_sec head_block_time() const
This class represents an account on the object graphAccounts are the primary unit of authority on the...
tracks the blockchain state in an extensible manner
asset_id_type asset_to_update
void_result do_evaluate(const asset_update_issuer_operation &o)
bool can_owner_update_icr() const
const IndexType & get_index_type() const
bitasset_options::black_swan_response_type get_black_swan_response_method() const
Get the effective black swan response method of this bitasset.
asset amount
Amount of asset to force settle. This must be a market-issued asset.
The asset_options struct contains options available on all assets in the network. ...
used to transfer accumulated fees back to the issuer's balance.
uint32_t _current_block_num
const limit_order_object * find_settled_debt_order(const asset_id_type &a) const
asset_id_type asset_to_update
void check_bitasset_options_hf_bsip_48_75(const fc::time_point_sec &block_time, const bitasset_options &options)
bool has_individual_settlement() const
tracks debt and call price information
void check_bitasset_opts_hf_core2467(const fc::time_point_sec &next_maint_time, const bitasset_options &options)
bool is_prediction_market
For BitAssets, set this to true if the asset implements a prediction market; false otherwise...
Schedules a market-issued asset for automatic settlementHolders of market-issued assests may request ...
asset get_balance(account_id_type owner, asset_id_type asset_id) const
Retrieve a particular account's balance in a given asset.
void_result do_evaluate(const asset_update_bitasset_operation &o)
void_result do_apply(const asset_publish_feed_operation &o)
defines market parameters for margin positions, extended with an initial_collateral_ratio field ...
void check_asset_publish_feed_extensions_hf_bsip77(const fc::time_point_sec &block_time, const asset_publish_feed_operation::ext &extensions)
object_id_type do_apply(const asset_create_operation &o)
asset_id_type asset_to_update
uint8_t maximum_asset_whitelist_authorities
maximum number of accounts which an asset may list as authorities for its whitelist OR blacklist ...
account_id_type issuer
ID of the account which issued this asset.
void_result do_evaluate(const asset_reserve_operation &o)
time_point_sec settlement_date
Publish price feeds for market-issued assetsPrice feed providers use this operation to publish their ...
fc::optional< uint16_t > initial_collateral_ratio
After BSIP77, price feed producers can feed ICR too.
uint8_t precision
Number of digits to the right of decimal point, must be less than or equal to 12. ...
asset pay_market_fees(const account_object *seller, const asset_object &recv_asset, const asset &receives, const bool &is_maker, const optional< asset > &calculated_market_fees={})
share_type accumulated_collateral_fees
accumulated collateral-denominated fees (for bitassets)
void revive_bitasset(const asset_object &bitasset, const asset_bitasset_data_object &bad)
void_result do_apply(const asset_update_issuer_operation &o)
asset multiply_and_round_up(const price &p) const
Multiply and round up.
const asset_bitasset_data_object & bitasset_data(const DB &db) const
void_result do_evaluate(const asset_issue_operation &o)
bool check_call_orders(const asset_object &mia, bool enable_black_swan=true, bool for_new_limit_order=false, const asset_bitasset_data_object *bitasset_ptr=nullptr, bool mute_exceptions=false, bool skip_matching_settle_orders=false)
string symbol
The ticker symbol of this asset.
bool is_prediction_market
True if this asset implements a Prediction Market.
extension< ext > extensions
void cancel_bid(const collateral_bid_object &bid, bool create_virtual_op=true)
fc::optional< uint16_t > reward_percent
share_type individual_settlement_debt
used to take an asset out of circulation, returning to the issuer
price current_maintenance_collateralization
void validate_flags(bool is_market_issued, bool allow_disable_collateral_bid=true) const
void_result do_apply(const asset_claim_pool_operation &o)
bool can_force_settle() const
object_id< SpaceID, TypeID > get_id() const
const T & get(const object_id_type &id) const
uint16_t maintenance_collateral_ratio
const T * find(const object_id_type &id) const
The price struct stores asset prices in the BitShares system.
#define GRAPHENE_100_PERCENT
operation_result do_apply(const operation_type &op)
void_result do_apply(const asset_claim_fees_operation &o)
const object & get(object_id_type id) const
uint8_t minimum_feeds
Minimum number of unexpired feeds required to extract a median feed from.
#define GRAPHENE_COMMITTEE_ACCOUNT
uint16_t issuer_permissions
The flags which the issuer has permission to update. See asset_issuer_permission_flags.
asset_dynamic_data_id_type dynamic_asset_data_id
Current supply, fee pool, and collected fees are stored in a separate object as they change frequentl...
bool is_market_issued() const
string symbol
Ticker symbol for this asset, i.e. "USD".
tracks bitassets scheduled for force settlement at some point in the future.
#define FC_CAPTURE_AND_RETHROW(...)
Update options specific to BitAssetsBitAssets have some options which are not relevant to other asset...
account_id_type from_account
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
price_feed_with_icr current_feed
This is the currently active price feed, calculated from median_feed and other parameters.
account_id_type account
Account requesting the force settlement. This account pays the fee.
void_result do_apply(const asset_update_operation &o)
tracks the asset information that changes frequentlyBecause the asset_object is very large it doesn't...
void globally_settle_asset(const asset_object &bitasset, const price &settle_price, bool check_margin_calls=false)
uint32_t feed_lifetime_sec
Time before a price feed expires.
account_id_type issuer
Must be asset_to_issue->asset_id->issuer.
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
Update options common to all assetsThere are a number of options which all assets in the network use...
void update_bitasset_current_feed(const asset_bitasset_data_object &bitasset, bool skip_median_update=false)
bool can_owner_update_bsrm() const
const asset_dynamic_data_object & get_core_dynamic_data() const
uint16_t get_enabled_issuer_permissions_mask() const
bids of collateral for debt after a black swan
virtual void pay_fee() override
void_result do_evaluate(const asset_claim_pool_operation &o)
void_result do_evaluate(const operation_type &op)
time_point_sec next_maintenance_time
account_id_type issuer
This account must sign and pay the fee for this operation. Later, this account may update the asset...
share_type individual_settlement_fund
Amount of collateral which is available for force settlement due to individual settlements.
asset_id_type asset_to_update
Can not bid collateral after a global settlement.
Transfers BTS from the fee pool of a specified asset back to the issuer's balance.
void_result do_evaluate(const asset_update_operation &o)
void_result do_evaluate(const operation_type &op)
share_type fee_pool
in core asset
fc::optional< bool > skip_core_exchange_rate
void_result do_evaluate(const asset_create_operation &o)
share_type amount
core asset
void_result do_apply(const operation_type &o) 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)
share_type accumulated_fees
fees accumulate to be paid out over time
void check_bitasset_options_hf_bsip77(const fc::time_point_sec &block_time, const bitasset_options &options)
tracks the parameters of an assetAll assets have a globally unique symbol name that controls how they...
uint8_t precision
Maximum number of digits after the decimal point (must be <= 12)
void check_asset_options_hf_bsip_48_75(const fc::time_point_sec &block_time, const asset_options &options)
the bitasset is to be fed by witnesses
const call_order_object * find_least_collateralized_short(const asset_bitasset_data_object &bitasset, bool force_by_collateral_index) const
void_result do_apply(const asset_issue_operation &o)
bool can_create_new_supply() const
allow the bitasset owner to force a global settlement, permission only
optional< bitasset_options > bitasset_opts
Options only available for BitAssets. MUST be non-null if and only if the asset is market-issued...
bitasset_options options
The tunable options for BitAssets are stored in this field.
void_result do_evaluate(const asset_claim_fees_operation &o)
asset amount_to_claim
fee.asset_id must != asset_id
void_result do_apply(const asset_reserve_operation &o)
fc::optional< uint16_t > taker_fee_percent
uint16_t flags
The currently active flags on this permission. See asset_issuer_permission_flags. ...
void_result do_apply(const asset_update_bitasset_operation &o)
flat_set< account_id_type > whitelist_authorities
void_result do_evaluate(const asset_publish_feed_operation &o)
#define GRAPHENE_ASSERT(expr, exc_type, FORMAT,...)
void_result do_apply(const operation_type &op)
void check_asset_options_hf_core2281(const fc::time_point_sec &next_maint_time, const asset_options &options)
Update issuer of an assetAn issuer has general administrative power of an asset and in some cases als...
void check_children_of_bitasset(const database &d, const asset_update_bitasset_operation &op, const asset_object &new_backing_asset)
asset_id_type asset_to_settle
const dynamic_global_property_object & get_dynamic_global_properties() const
price current_initial_collateralization
void_result do_evaluate(const operation_type &o)
bool is_liquidity_pool_share_asset() const
the bitasset is to be fed by the committee
share_type current_supply
The number of shares currently in existence.
flat_map< account_id_type, pair< time_point_sec, price_feed_with_icr > > feeds
void check_asset_options_hf_1774(const fc::time_point_sec &block_time, const asset_options &options)
bool can_owner_update_mssr() const
fc::optional< uint8_t > new_precision
void_result do_evaluate(const asset_fund_fee_pool_operation &op)
bool asset_cer_updated
Track whether core_exchange_rate in corresponding asset_object has updated.
additional_asset_options_t extensions
asset_options new_options
the bitasset owner can not update BSRM, permission only
void cancel_settle_order(const force_settlement_object &order)
asset_id_type short_backing_asset
const T & create(F &&constructor)
share_type settlement_fund
Amount of collateral which is available for force settlement due to global settlement.
uint8_t block_interval
interval in seconds between blocks
asset_options common_options
account_id_type issuer
must equal issuer of asset_to_settle
The bitasset_options struct contains configurable options available only to BitAssets.
bool can_owner_update_mcr() const
account_id_type issue_to_account
fc::time_point_sec _current_block_time
price_feed_with_icr median_feed
This is the median of values from the currently active feeds.
allows global settling of bitassets (black swan or prediction markets)
#define GRAPHENE_WITNESS_ACCOUNT
Represents the current witnesses.
bool can_update_max_supply() const
optional< account_id_type > new_issuer
If the asset is to be given a new issuer, specify his ID here.
void_result do_apply(const asset_fund_fee_pool_operation &op)
const global_property_object & get_global_properties() const
price core_exchange_rate
Price at which automatically exchanging this asset for CORE from fee pool occurs (used for paying fee...