BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
asset_object.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #pragma once
25 #include <graphene/chain/types.hpp>
28 
29 #include <boost/multi_index/composite_key.hpp>
30 
41 namespace graphene { namespace chain {
42  class asset_bitasset_data_object;
43 
56  class asset_dynamic_data_object : public abstract_object<asset_dynamic_data_object,
57  implementation_ids, impl_asset_dynamic_data_object_type>
58  {
59  public:
66  };
67 
75  class asset_object : public graphene::db::abstract_object<asset_object, protocol_ids, asset_object_type>
76  {
77  public:
81  static bool is_valid_symbol( const string& symbol );
82 
84  bool is_market_issued()const { return bitasset_data_id.valid(); }
88  bool can_force_settle()const { return (0 == (options.flags & disable_force_settle)); }
90  bool can_global_settle()const { return (0 != (options.issuer_permissions & global_settle)); }
92  bool charges_market_fees()const { return (0 != (options.flags & charge_market_fee)); }
94  bool is_transfer_restricted()const { return (0 != (options.flags & transfer_restricted)); }
95  bool can_override()const { return (0 != (options.flags & override_authority)); }
96  bool allow_confidential()const
99  bool can_update_max_supply()const { return (0 == (options.flags & lock_max_supply)); }
101  bool can_create_new_supply()const { return (0 == (options.flags & disable_new_supply)); }
111  bool can_bid_collateral()const { return (0 == (options.flags & disable_collateral_bidding)); }
112 
114  asset amount(share_type a)const { return asset(a, asset_id_type(id)); }
117  asset amount_from_string(string amount_string)const;
119  string amount_to_string(share_type amount)const;
121  string amount_to_string(const asset& amount)const
125  { return amount_to_string(amount) + " " + symbol; }
129 
131  string symbol;
133  uint8_t precision = 0;
135  account_id_type issuer;
136 
138 
140  asset_dynamic_data_id_type dynamic_asset_data_id;
142  optional<asset_bitasset_data_id_type> bitasset_data_id;
143 
144  optional<account_id_type> buyback_account;
145 
147  optional<liquidity_pool_id_type> for_liquidity_pool;
148 
150  uint32_t creation_block_num = 0;
152  time_point_sec creation_time;
153 
154  void validate()const
155  {
156  // UIAs may not be prediction markets, have force settlement, or global settlements
157  if( !is_market_issued() )
158  {
162  }
163  }
164 
165  template<class DB>
166  const asset_bitasset_data_object& bitasset_data(const DB& db)const
167  {
169  "Asset ${a} (${id}) is not a market issued asset.",
170  ("a",this->symbol)("id",this->id) );
171  return db.get( *bitasset_data_id );
172  }
173 
174  template<class DB>
175  const asset_dynamic_data_object& dynamic_data(const DB& db)const
176  { return db.get(dynamic_asset_data_id); }
177 
181  template<class DB>
182  share_type reserved( const DB& db )const
184 
186  template<class DB>
187  bool can_accumulate_fee(const DB& db, const asset& fee) const {
188  return (( fee.asset_id == get_id() ) ||
189  ( is_market_issued() && fee.asset_id == bitasset_data(db).options.short_backing_asset ));
190  }
191 
192  /***
193  * @brief receive a fee asset to accrue in dynamic_data object
194  *
195  * Asset owners define various fees (market fees, force-settle fees, etc.) to be
196  * collected for the asset owners. These fees are typically denominated in the asset
197  * itself, but for bitassets some of the fees are denominated in the collateral
198  * asset. This will place the fee in the right container.
199  */
200  template<class DB>
201  void accumulate_fee(DB& db, const asset& fee) const
202  {
203  if (fee.amount == 0) return;
204  FC_ASSERT( fee.amount >= 0, "Fee amount must be non-negative." );
205  const auto& dyn_data = dynamic_asset_data_id(db);
206  if (fee.asset_id == get_id()) { // fee same as asset
207  db.modify( dyn_data, [&fee]( asset_dynamic_data_object& obj ){
208  obj.accumulated_fees += fee.amount;
209  });
210  } else { // fee different asset; perhaps collateral-denominated fee
212  "Asset ${a} (${id}) cannot accept fee of asset (${fid}).",
213  ("a",this->symbol)("id",this->id)("fid",fee.asset_id) );
214  const auto & bad = bitasset_data(db);
215  FC_ASSERT( fee.asset_id == bad.options.short_backing_asset,
216  "Asset ${a} (${id}) cannot accept fee of asset (${fid}).",
217  ("a",this->symbol)("id",this->id)("fid",fee.asset_id) );
218  db.modify( dyn_data, [&fee]( asset_dynamic_data_object& obj ){
220  });
221  }
222  }
223 
224  };
225 
230  {
235 
238  {}
239 
240  price_feed_with_icr( const price_feed& pf, const optional<uint16_t>& icr = {} )
241  : price_feed( pf ), initial_collateral_ratio( icr.valid() ? *icr : pf.maintenance_collateral_ratio )
242  {}
243 
246  price get_initial_collateralization()const;
247  };
248 
255  class asset_bitasset_data_object : public abstract_object<asset_bitasset_data_object,
256  implementation_ids, impl_asset_bitasset_data_object_type>
257  {
258  public:
260  asset_id_type asset_id;
261 
264 
268  flat_map<account_id_type, pair<time_point_sec,price_feed_with_icr>> feeds;
275 
279 
289 
291  bool is_prediction_market = false;
292 
297 
299  bool is_globally_settled()const { return !settlement_price.is_null(); }
300 
315 
329 
335  {
337  return ( ( individual_settlement_debt != 0 ) &&
338  ( bsrm_type::individual_settlement_to_fund == get_black_swan_response_method() ) );
339  }
340 
343  {
346  }
347 
350  {
352  }
353 
356  {
357  return current_feed.margin_call_order_price( options.extensions.value.margin_call_fee_ratio );
358  }
359 
362  {
363  return current_feed.margin_call_order_ratio( options.extensions.value.margin_call_fee_ratio );
364  }
365 
368  {
369  return current_feed.margin_call_pays_ratio( options.extensions.value.margin_call_fee_ratio );
370  }
371 
373  bool asset_cer_updated = false;
374 
376  bool feed_cer_updated = false;
377 
379  bool need_to_update_cer() const
380  {
382  }
383 
385  time_point_sec feed_expiration_time()const
386  {
387  uint32_t current_feed_seconds = current_feed_publication_time.sec_since_epoch();
388  if( (std::numeric_limits<uint32_t>::max() - current_feed_seconds) <= options.feed_lifetime_sec )
389  return time_point_sec::maximum();
390  else
392  }
395  bool feed_is_expired_before_hf_615(time_point_sec current_time)const
396  { return feed_expiration_time() >= current_time; }
398  bool feed_is_expired(time_point_sec current_time)const
399  { return feed_expiration_time() <= current_time; }
400 
401  /******
402  * @brief calculate the median feed
403  *
404  * This calculates the median feed from @ref feeds, feed_lifetime_sec
405  * in @ref options, and the given parameters.
406  * It may update the @ref median_feed, @ref current_feed_publication_time,
407  * @ref current_initial_collateralization and
408  * @ref current_maintenance_collateralization member variables.
409  *
410  * @param current_time the current time to use in the calculations
411  * @param next_maintenance_time the next chain maintenance time
412  *
413  * @note Called by @ref database::update_bitasset_current_feed() which updates @ref current_feed afterwards.
414  */
415  void update_median_feeds(time_point_sec current_time, time_point_sec next_maintenance_time);
416  private:
419  void refresh_cache();
420  };
421 
424  {
425  using result_type = asset_id_type;
427  {
428  return obj.options.short_backing_asset;
429  }
430  };
431 
432  struct by_short_backing_asset;
433  struct by_feed_expiration;
434  struct by_cer_update;
435 
436  using bitasset_data_multi_index_type = multi_index_container<
437  asset_bitasset_data_object,
438  indexed_by<
439  ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
440  ordered_non_unique< tag<by_short_backing_asset>, bitasset_backing_asst_extractor >,
441  ordered_unique< tag<by_feed_expiration>,
442  composite_key< asset_bitasset_data_object,
443  const_mem_fun< asset_bitasset_data_object, time_point_sec,
445  member< asset_bitasset_data_object, asset_id_type, &asset_bitasset_data_object::asset_id >
446  >
447  >,
448  ordered_non_unique< tag<by_cer_update>,
449  const_mem_fun< asset_bitasset_data_object, bool,
451  >
452  >
453  >;
455 
456  struct by_symbol;
457  struct by_type;
458  struct by_issuer;
459  using asset_object_multi_index_type = multi_index_container<
460  asset_object,
461  indexed_by<
462  ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
463  ordered_unique< tag<by_symbol>, member<asset_object, string, &asset_object::symbol> >,
464  ordered_unique< tag<by_type>,
465  composite_key< asset_object,
466  const_mem_fun<asset_object, bool, &asset_object::is_market_issued>,
467  member< object, object_id_type, &object::id >
468  >
469  >,
470  ordered_unique< tag<by_issuer>,
471  composite_key< asset_object,
472  member< asset_object, account_id_type, &asset_object::issuer >,
473  member< object, object_id_type, &object::id >
474  >
475  >
476  >
477  >;
479 
480 } } // graphene::chain
481 
485 
487  (initial_collateral_ratio) )
488 
489 // Note: this is left here but not moved to a cpp file due to the extended_asset_object struct in API.
491  (symbol)
492  (precision)
493  (issuer)
494  (options)
495  (dynamic_asset_data_id)
496  (bitasset_data_id)
497  (buyback_account)
498  (for_liquidity_pool)
499  (creation_block_num)
500  (creation_time)
501  )
502 
505 
507 
graphene::chain::price_feed_with_icr::initial_collateral_ratio
uint16_t initial_collateral_ratio
Definition: asset_object.hpp:234
graphene::chain::asset_bitasset_data_object::feed_expiration_time
time_point_sec feed_expiration_time() const
The time when current_feed would expire.
Definition: asset_object.hpp:385
graphene::chain::asset_dynamic_data_object::fee_pool
share_type fee_pool
in core asset
Definition: asset_object.hpp:65
graphene::chain::asset_bitasset_data_object::settlement_price
price settlement_price
Definition: asset_object.hpp:311
graphene::chain::asset_object::creation_time
time_point_sec creation_time
The time when the asset object was created.
Definition: asset_object.hpp:152
graphene::chain::asset_bitasset_data_object::settlement_fund
share_type settlement_fund
Amount of collateral which is available for force settlement due to global settlement.
Definition: asset_object.hpp:313
graphene::chain::asset_object::amount_to_string
string amount_to_string(const asset &amount) const
Convert an asset to a textual representation, i.e. "123.45".
Definition: asset_object.hpp:121
graphene::protocol::disable_new_supply
@ disable_new_supply
unable to create new supply for the asset
Definition: types.hpp:212
graphene::chain::asset_object::allow_confidential
bool allow_confidential() const
Definition: asset_object.hpp:96
graphene::chain::price_feed_with_icr::price_feed_with_icr
price_feed_with_icr()
Definition: asset_object.hpp:236
graphene::chain::asset_object::can_override
bool can_override() const
Definition: asset_object.hpp:95
graphene::chain::asset_bitasset_data_object::update_median_feeds
void update_median_feeds(time_point_sec current_time, time_point_sec next_maintenance_time)
Definition: asset_object.cpp:47
graphene::chain::asset_object::for_liquidity_pool
optional< liquidity_pool_id_type > for_liquidity_pool
The ID of the liquidity pool if the asset is the share asset of a liquidity pool.
Definition: asset_object.hpp:147
graphene::chain::asset_object::validate
void validate() const
Definition: asset_object.hpp:154
graphene::chain::asset_object::amount_to_pretty_string
string amount_to_pretty_string(share_type amount) const
Convert an asset to a textual representation with symbol, i.e. "123.45 USD".
Definition: asset_object.hpp:124
graphene::chain::asset_object::bitasset_data_id
optional< asset_bitasset_data_id_type > bitasset_data_id
Extra data associated with BitAssets. This field is non-null if and only if is_market_issued() return...
Definition: asset_object.hpp:142
graphene::protocol::price_feed::core_exchange_rate
price core_exchange_rate
Price at which automatically exchanging this asset for CORE from fee pool occurs (used for paying fee...
Definition: asset.hpp:183
graphene::protocol::price
The price struct stores asset prices in the BitShares system.
Definition: asset.hpp:108
graphene::chain::asset_bitasset_data_object::is_prediction_market
bool is_prediction_market
True if this asset implements a Prediction Market.
Definition: asset_object.hpp:291
graphene::protocol::bitasset_options::black_swan_response_type
black_swan_response_type
Defines how a BitAsset would respond to black swan events.
Definition: asset_ops.hpp:112
graphene::chain::asset_object::amount_to_pretty_string
string amount_to_pretty_string(const asset &amount) const
Convert an asset to a textual representation with symbol, i.e. "123.45 USD".
Definition: asset_object.hpp:127
graphene::chain::asset_object::bitasset_data
const asset_bitasset_data_object & bitasset_data(const DB &db) const
Definition: asset_object.hpp:166
FC_REFLECT_TYPENAME
FC_REFLECT_TYPENAME(fc::log_message)
graphene::chain::asset_bitasset_data_object::individual_settlement_fund
share_type individual_settlement_fund
Amount of collateral due to individual settlements.
Definition: asset_object.hpp:327
graphene::protocol::bitasset_options::get_black_swan_response_method
black_swan_response_type get_black_swan_response_method() const
Get the effective black swan response method.
Definition: asset_ops.hpp:180
graphene::chain::price_feed_with_icr::price_feed_with_icr
price_feed_with_icr(const price_feed &pf, const optional< uint16_t > &icr={})
Definition: asset_object.hpp:240
graphene::chain::asset_dynamic_data_object::current_supply
share_type current_supply
The number of shares currently in existence.
Definition: asset_object.hpp:61
graphene::chain::asset_bitasset_data_object::get_margin_call_pays_ratio
ratio_type get_margin_call_pays_ratio() const
Get margin call pays ratio (MCPR) of this bitasset.
Definition: asset_object.hpp:367
graphene::chain::asset_object::is_liquidity_pool_share_asset
bool is_liquidity_pool_share_asset() const
Definition: asset_object.hpp:86
graphene::chain::asset_bitasset_data_object::force_settled_volume
share_type force_settled_volume
This is the volume of this asset which has been force-settled this maintanence interval.
Definition: asset_object.hpp:294
graphene::chain::asset_object::can_force_settle
bool can_force_settle() const
Definition: asset_object.hpp:88
generic_index.hpp
graphene::chain::asset_object::amount_to_string
string amount_to_string(share_type amount) const
Convert an asset to a textual representation, i.e. "123.45".
Definition: asset_object.cpp:207
graphene::chain::asset_object::can_owner_update_mssr
bool can_owner_update_mssr() const
Definition: asset_object.hpp:107
graphene::chain::asset_object
tracks the parameters of an asset
Definition: asset_object.hpp:75
graphene::protocol::bitasset_options::feed_lifetime_sec
uint32_t feed_lifetime_sec
Time before a price feed expires.
Definition: asset_ops.hpp:156
graphene::chain::asset_bitasset_data_object::current_maintenance_collateralization
price current_maintenance_collateralization
Definition: asset_object.hpp:283
MAP_OBJECT_ID_TO_TYPE
#define MAP_OBJECT_ID_TO_TYPE(OBJECT)
Definition: object_id.hpp:93
graphene::protocol::price_feed::settlement_price
price settlement_price
Definition: asset.hpp:180
graphene::chain::asset_object::is_transfer_restricted
bool is_transfer_restricted() const
Definition: asset_object.hpp:94
graphene::chain::asset_object::symbol
string symbol
Ticker symbol for this asset, i.e. "USD".
Definition: asset_object.hpp:131
graphene::chain::asset_object_multi_index_type
multi_index_container< asset_object, indexed_by< ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >, ordered_unique< tag< by_symbol >, member< asset_object, string, &asset_object::symbol > >, ordered_unique< tag< by_type >, composite_key< asset_object, const_mem_fun< asset_object, bool, &asset_object::is_market_issued >, member< object, object_id_type, &object::id > > >, ordered_unique< tag< by_issuer >, composite_key< asset_object, member< asset_object, account_id_type, &asset_object::issuer >, member< object, object_id_type, &object::id > > > > > asset_object_multi_index_type
Definition: asset_object.hpp:477
graphene::chain::asset_dynamic_data_object::confidential_supply
share_type confidential_supply
total asset held in confidential balances
Definition: asset_object.hpp:62
fc::time_point_sec::maximum
static time_point_sec maximum()
Definition: time.hpp:86
graphene::chain::asset_object::dynamic_asset_data_id
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...
Definition: asset_object.hpp:140
graphene::protocol::asset_options
The asset_options struct contains options available on all assets in the network.
Definition: asset_ops.hpp:47
graphene::chain::asset_object::can_global_settle
bool can_global_settle() const
Definition: asset_object.hpp:90
graphene::chain::asset_object::amount_from_string
asset amount_from_string(string amount_string) const
Definition: asset_object.cpp:152
graphene::protocol::disable_mssr_update
@ disable_mssr_update
the bitasset owner can not update MSSR, permission only
Definition: types.hpp:221
graphene::protocol::bitasset_options
The bitasset_options struct contains configurable options available only to BitAssets.
Definition: asset_ops.hpp:109
graphene::chain::bitasset_backing_asst_extractor
Key extractor for short backing asset.
Definition: asset_object.hpp:423
graphene::db::abstract_object
Definition: object.hpp:107
graphene::protocol::lock_max_supply
@ lock_max_supply
the max supply of the asset can not be updated
Definition: types.hpp:211
graphene::protocol::charge_market_fee
@ charge_market_fee
market trades in this asset may be charged
Definition: types.hpp:194
graphene::chain::bitasset_backing_asst_extractor::operator()
result_type operator()(const asset_bitasset_data_object &obj) const
Definition: asset_object.hpp:426
graphene::chain::asset_dynamic_data_object::accumulated_fees
share_type accumulated_fees
fees accumulate to be paid out over time
Definition: asset_object.hpp:63
graphene::chain::asset_bitasset_data_object::is_current_feed_price_capped
bool is_current_feed_price_capped() const
Definition: asset_object.hpp:277
graphene::chain::asset_bitasset_data_object::asset_cer_updated
bool asset_cer_updated
Track whether core_exchange_rate in corresponding asset_object has updated.
Definition: asset_object.hpp:373
graphene::protocol::asset_options::max_supply
share_type max_supply
Definition: asset_ops.hpp:50
asset_ops.hpp
graphene::chain::asset_bitasset_data_object::max_force_settlement_volume
share_type max_force_settlement_volume(share_type current_supply) const
Calculate the maximum force settlement volume per maintenance interval, given the current share suppl...
Definition: asset_object.cpp:33
graphene::chain::asset_object::precision
uint8_t precision
Maximum number of digits after the decimal point (must be <= 12)
Definition: asset_object.hpp:133
graphene::protocol::disable_force_settle
@ disable_force_settle
disable force settling
Definition: types.hpp:198
fc::optional::valid
bool valid() const
Definition: optional.hpp:186
graphene::chain::asset_dynamic_data_object
tracks the asset information that changes frequently
Definition: asset_object.hpp:56
FC_REFLECT_DERIVED
#define FC_REFLECT_DERIVED(TYPE, INHERITS, MEMBERS)
Specializes fc::reflector for TYPE where type inherits other reflected classes.
Definition: reflect.hpp:305
fc::time_point_sec
Definition: time.hpp:74
graphene::protocol::asset::asset_id
asset_id_type asset_id
Definition: asset.hpp:37
GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO
#define GRAPHENE_DEFAULT_MAINTENANCE_COLLATERAL_RATIO
Call when collateral only pays off 175% the debt.
Definition: config.hpp:116
graphene::chain::asset_object::can_create_new_supply
bool can_create_new_supply() const
Definition: asset_object.hpp:101
graphene::protocol::asset_options::issuer_permissions
uint16_t issuer_permissions
The flags which the issuer has permission to update. See asset_issuer_permission_flags.
Definition: asset_ops.hpp:61
graphene::chain::asset_bitasset_data_object::feed_is_expired
bool feed_is_expired(time_point_sec current_time) const
Definition: asset_object.hpp:398
graphene::protocol::price::is_null
bool is_null() const
Definition: asset.cpp:229
graphene::protocol::price_feed
defines market parameters for margin positions
Definition: asset.hpp:160
GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION
#define GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION(type)
Definition: types.hpp:85
graphene::chain::asset_bitasset_data_object
contains properties that only apply to bitassets (market issued assets)
Definition: asset_object.hpp:255
graphene::protocol::disable_icr_update
@ disable_icr_update
the bitasset owner can not update ICR, permission only
Definition: types.hpp:220
graphene::chain::asset_object::accumulate_fee
void accumulate_fee(DB &db, const asset &fee) const
Definition: asset_object.hpp:201
graphene::chain::asset_bitasset_data_object::current_feed
price_feed_with_icr current_feed
This is the currently active price feed, calculated from median_feed and other parameters.
Definition: asset_object.hpp:272
graphene::chain::asset_bitasset_data_object::feed_is_expired_before_hf_615
bool feed_is_expired_before_hf_615(time_point_sec current_time) const
Definition: asset_object.hpp:395
graphene::chain::asset_bitasset_data_object::median_feed
price_feed_with_icr median_feed
This is the median of values from the currently active feeds.
Definition: asset_object.hpp:270
graphene::chain::asset_bitasset_data_object::get_individual_settlement_price
price get_individual_settlement_price() const
Get the price of the individual settlement pool.
Definition: asset_object.hpp:342
graphene::chain::asset_bitasset_data_object::get_margin_call_order_price
price get_margin_call_order_price() const
Get margin call order price (MCOP) of this bitasset.
Definition: asset_object.hpp:355
graphene::chain::asset_bitasset_data_object::is_individually_settled_to_fund
bool is_individually_settled_to_fund() const
Definition: asset_object.hpp:334
graphene::chain::asset_object::can_bid_collateral
bool can_bid_collateral() const
Definition: asset_object.hpp:111
graphene::protocol::global_settle
@ global_settle
allow the bitasset owner to force a global settlement, permission only
Definition: types.hpp:199
graphene::chain::asset_object::can_update_max_supply
bool can_update_max_supply() const
Definition: asset_object.hpp:99
graphene::protocol::disable_confidential
@ disable_confidential
disallow the asset to be used with confidential transactions
Definition: types.hpp:200
graphene::protocol::asset_options::flags
uint16_t flags
The currently active flags on this permission. See asset_issuer_permission_flags.
Definition: asset_ops.hpp:63
graphene::chain::asset_object::dynamic_data
const asset_dynamic_data_object & dynamic_data(const DB &db) const
Definition: asset_object.hpp:175
graphene::chain::price_feed_with_icr::get_initial_collateralization
price get_initial_collateralization() const
Definition: asset_object.cpp:145
graphene::chain::asset_object::charges_market_fees
bool charges_market_fees() const
Definition: asset_object.hpp:92
graphene::chain::bitasset_data_multi_index_type
multi_index_container< asset_bitasset_data_object, indexed_by< ordered_unique< tag< by_id >, member< object, object_id_type, &object::id > >, ordered_non_unique< tag< by_short_backing_asset >, bitasset_backing_asst_extractor >, ordered_unique< tag< by_feed_expiration >, composite_key< asset_bitasset_data_object, const_mem_fun< asset_bitasset_data_object, time_point_sec, &asset_bitasset_data_object::feed_expiration_time >, member< asset_bitasset_data_object, asset_id_type, &asset_bitasset_data_object::asset_id > > >, ordered_non_unique< tag< by_cer_update >, const_mem_fun< asset_bitasset_data_object, bool, &asset_bitasset_data_object::need_to_update_cer > > > > bitasset_data_multi_index_type
Definition: asset_object.hpp:453
graphene::chain::asset_dynamic_data_object::accumulated_collateral_fees
share_type accumulated_collateral_fees
accumulated collateral-denominated fees (for bitassets)
Definition: asset_object.hpp:64
FC_ASSERT
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
graphene::chain::asset_object::issuer
account_id_type issuer
ID of the account which issued this asset.
Definition: asset_object.hpp:135
graphene::chain::asset_object::can_owner_update_mcr
bool can_owner_update_mcr() const
Definition: asset_object.hpp:103
graphene::protocol::asset::amount
share_type amount
Definition: asset.hpp:36
graphene::chain::asset_object::reserved
share_type reserved(const DB &db) const
Definition: asset_object.hpp:182
graphene::protocol::price_feed::maintenance_collateral_ratio
uint16_t maintenance_collateral_ratio
Definition: asset.hpp:186
graphene::chain::asset_bitasset_data_object::current_feed_publication_time
time_point_sec current_feed_publication_time
This is the publication time of the oldest feed which was factored into current_feed.
Definition: asset_object.hpp:274
graphene::chain::asset_object::amount
asset amount(share_type a) const
Helper function to get an asset object with the given amount in this asset's type.
Definition: asset_object.hpp:114
graphene::chain::asset_bitasset_data_object::get_black_swan_response_method
bitasset_options::black_swan_response_type get_black_swan_response_method() const
Get the effective black swan response method of this bitasset.
Definition: asset_object.hpp:349
types.hpp
graphene::db::generic_index
Definition: generic_index.hpp:43
graphene::chain::asset_bitasset_data_object::feed_cer_updated
bool feed_cer_updated
Track whether core exchange rate in current feed has updated.
Definition: asset_object.hpp:376
graphene::protocol::price_feed::margin_call_pays_ratio
ratio_type margin_call_pays_ratio(const fc::optional< uint16_t > &margin_call_fee_ratio) const
Definition: asset.cpp:334
graphene::db::abstract_object< asset_object, protocol_ids, asset_object_type >::get_id
object_id< SpaceID, TypeID > get_id() const
Definition: object.hpp:113
graphene::chain::asset_bitasset_data_object::get_margin_call_order_ratio
ratio_type get_margin_call_order_ratio() const
Get margin call order ratio (MCOR) of this bitasset.
Definition: asset_object.hpp:361
fc::optional
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
graphene::protocol::disable_collateral_bidding
@ disable_collateral_bidding
Can not bid collateral after a global settlement.
Definition: types.hpp:223
graphene::protocol::transfer_restricted
@ transfer_restricted
require the issuer to be one party to every transfer
Definition: types.hpp:197
graphene::chain::price_feed_with_icr
defines market parameters for margin positions, extended with an initial_collateral_ratio field
Definition: asset_object.hpp:229
graphene::chain::asset_object::is_valid_symbol
static bool is_valid_symbol(const string &symbol)
graphene::chain::asset_object::can_accumulate_fee
bool can_accumulate_fee(const DB &db, const asset &fee) const
Definition: asset_object.hpp:187
graphene::protocol::asset
Definition: asset.hpp:31
graphene::chain::asset_object::options
asset_options options
Definition: asset_object.hpp:137
graphene::chain::asset_object::is_market_issued
bool is_market_issued() const
Definition: asset_object.hpp:84
graphene::chain::asset_bitasset_data_object::feeds
flat_map< account_id_type, pair< time_point_sec, price_feed_with_icr > > feeds
Definition: asset_object.hpp:268
graphene::chain::asset_object::can_owner_update_bsrm
bool can_owner_update_bsrm() const
Definition: asset_object.hpp:109
graphene::chain::asset_bitasset_data_object::individual_settlement_debt
share_type individual_settlement_debt
Definition: asset_object.hpp:325
graphene::protocol::override_authority
@ override_authority
issuer may transfer asset back to himself
Definition: types.hpp:196
graphene::chain::asset_object::buyback_account
optional< account_id_type > buyback_account
Definition: asset_object.hpp:144
graphene::chain::asset_bitasset_data_object::current_initial_collateralization
price current_initial_collateralization
Definition: asset_object.hpp:288
graphene::chain::asset_bitasset_data_object::need_to_update_cer
bool need_to_update_cer() const
Whether need to update core_exchange_rate in asset_object.
Definition: asset_object.hpp:379
graphene::protocol::price_feed::margin_call_order_ratio
ratio_type margin_call_order_ratio(const fc::optional< uint16_t > &margin_call_fee_ratio) const
Definition: asset.cpp:326
graphene::protocol::ratio_type
boost::rational< int32_t > ratio_type
Definition: types.hpp:150
graphene::chain::asset_object::can_owner_update_icr
bool can_owner_update_icr() const
Definition: asset_object.hpp:105
graphene::protocol::bitasset_options::short_backing_asset
asset_id_type short_backing_asset
Definition: asset_ops.hpp:171
graphene::protocol::disable_bsrm_update
@ disable_bsrm_update
the bitasset owner can not update BSRM, permission only
Definition: types.hpp:222
graphene
Definition: api.cpp:48
graphene::chain::asset_object::creation_block_num
uint32_t creation_block_num
The block number when the asset object was created.
Definition: asset_object.hpp:150
graphene::protocol::bitasset_options::extensions
extension< ext > extensions
Definition: asset_ops.hpp:173
graphene::chain::asset_bitasset_data_object::options
bitasset_options options
The tunable options for BitAssets are stored in this field.
Definition: asset_object.hpp:263
graphene::chain::bitasset_backing_asst_extractor::result_type
asset_id_type result_type
Definition: asset_object.hpp:425
graphene::protocol::disable_mcr_update
@ disable_mcr_update
the bitasset owner can not update MCR, permission only
Definition: types.hpp:219
graphene::protocol::price_feed::margin_call_order_price
price margin_call_order_price(const fc::optional< uint16_t > &margin_call_fee_ratio) const
Definition: asset.cpp:308
graphene::chain::asset_bitasset_data_object::is_globally_settled
bool is_globally_settled() const
Definition: asset_object.hpp:299
graphene::db::object
base for all database objects
Definition: object.hpp:61
graphene::chain::asset_bitasset_data_object::asset_id
asset_id_type asset_id
The asset this object belong to.
Definition: asset_object.hpp:260
fc::safe
Definition: safe.hpp:26