BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
28 namespace graphene {
namespace protocol {
30 static void validate_acceptable_collateral(
const flat_map<asset_id_type, price>& acceptable_collateral,
31 const asset_id_type* p_asset_type =
nullptr )
33 FC_ASSERT( !acceptable_collateral.empty(),
"Acceptable collateral list should not be empty" );
35 asset_id_type asset_type = ( p_asset_type != nullptr ) ? *p_asset_type
36 : acceptable_collateral.begin()->second.base.asset_id;
38 for(
const auto& collateral : acceptable_collateral )
40 const auto& collateral_asset_type = collateral.first;
41 const auto& collateral_price = collateral.second;
42 FC_ASSERT( collateral_price.base.asset_id == asset_type,
43 "Base asset ID in price of acceptable collateral should be same as offer asset type" );
44 FC_ASSERT( collateral_price.quote.asset_id == collateral_asset_type,
45 "Quote asset ID in price of acceptable collateral should be same as collateral asset type" );
46 collateral_price.validate(
true );
50 static void validate_acceptable_borrowers(
const flat_map<account_id_type, share_type>& acceptable_borrowers )
52 for(
const auto& borrower : acceptable_borrowers )
54 const auto& max_borrow_amount = borrower.second.value;
56 "Maximum amount to borrow for acceptable borrowers should not be negative" );
58 "Maximum amount to borrow for acceptable borrowers should not be greater than ${max}",
68 "Maximum duration should not be greater than ${d} days",
72 "Minimum deal amount should not be greater than ${max}",
83 return core_fee_required;
94 bool updating_something =
false;
98 updating_something =
true;
102 updating_something =
true;
105 updating_something =
true;
107 "Maximum duration should not be greater than ${d} days",
112 updating_something =
true;
115 "Minimum deal amount should not be greater than ${max}",
119 updating_something =
true;
121 updating_something =
true;
124 updating_something =
true;
129 updating_something =
true;
134 "Should change something - at least one of the optional data fields should be present" );
141 return core_fee_required;
153 "auto_repay should be less than ${c}", (
"c",cdar_count) );
163 "Asset type of repay amount and credit fee should be the same" );
172 "auto_repay should be less than ${c}", (
"c",cdar_count) );
constexpr int64_t GRAPHENE_MAX_SHARE_SUPPLY(1000000000000000LL)
extension< ext > extensions
Extensions.
share_type balance
Usable amount in the credit offer.
void validate() const override
optional< flat_map< account_id_type, share_type > > acceptable_borrowers
New allowed borrowers and their maximum amounts to borrow, optional.
uint8_t auto_repay
The specified automatic repayment type.
@ CDAR_TYPE_COUNT
Total number of available automatic repayment types.
Create a new credit offer.
flat_map< account_id_type, share_type > acceptable_borrowers
Allowed borrowers and their maximum amounts to borrow. No limitation if empty.
void validate() const override
optional< share_type > min_deal_amount
Minimum amount to borrow for each new deal, optional.
share_type calculate_fee(const fee_params_t &k) const
auto schedule(Functor &&f, const fc::time_point &t, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> fc::future< decltype(f())>
void validate() const override
optional< bool > enabled
Whether this offer is available, optional.
share_type min_deal_amount
Minimum amount to borrow for each new deal.
#define GRAPHENE_IMPLEMENT_EXTERNAL_SERIALIZATION(type)
asset repay_amount
The amount to repay.
optional< uint32_t > fee_rate
New fee rate, optional.
asset credit_fee
The credit fee relative to the amount to repay.
static uint64_t calculate_data_fee(uint64_t bytes, uint64_t price_per_kbyte)
void validate() const override
Accept a credit offer, thereby creating a credit deal.
optional< flat_map< asset_id_type, price > > acceptable_collateral
New types and rates of acceptable collateral, optional.
flat_map< asset_id_type, price > acceptable_collateral
Types and rates of acceptable collateral.
constexpr int64_t GRAPHENE_MAX_CREDIT_DEAL_DAYS
How long a credit deal will be kept, in days.
size_t pack_size(const T &v)
asset_id_type asset_type
Asset type in the credit offer.
asset borrow_amount
The amount to borrow.
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
uint32_t max_duration_seconds
The time limit that borrowed funds should be repaid.
share_type calculate_fee(const fee_params_t &k) const
A credit deal expired without being fully repaid.
void validate() const override
optional< asset > delta_amount
Delta amount, optional.
optional< time_point_sec > auto_disable_time
New time to disable automatically, optional.
asset collateral
The collateral.
void validate() const override
optional< uint32_t > max_duration_seconds
New repayment time limit, optional.
constexpr int64_t GRAPHENE_MAX_CREDIT_DEAL_SECS
How long a credit deal will be kept, in seconds.