31 #include <graphene/chain/hardfork.hpp> 36 namespace graphene {
namespace chain {
43 FC_ASSERT( HARDFORK_CORE_2351_PASSED(block_time),
"Not allowed until the core-2351 hardfork" );
46 "The account is unauthorized by the asset" );
64 return new_samet_fund_object.
id;
75 FC_ASSERT( _fund->unpaid_amount == 0,
"Can only delete a SameT Fund when the unpaid amount is zero" );
86 asset released( _fund->balance, _fund->asset_type );
107 "Can only update the balance of a SameT Fund when the unpaid amount is zero" );
113 "The account is unauthorized by the asset" );
124 "New fee rate should not be the same as the original fee rate" );
145 FC_ASSERT( _fund->balance > 0,
"Balance in the SameT Fund should be positive" );
159 "Insufficient balance in the SameT Fund thus unable to borrow" );
162 "The account is unauthorized by the asset" );
178 FC_ASSERT( _fund->balance >= _fund->unpaid_amount,
"Should not borrow more than available" );
181 result.
value.impacted_accounts = flat_set<account_id_type>({ _fund->owner_account });
195 "The account is unauthorized by the asset" );
198 "Repay amount should not be greater than unpaid amount" );
205 "Insuffient fund fee, requires ${r}, offered ${p}",
223 result.
value.impacted_accounts = flat_set<account_id_type>({ _fund->owner_account });
share_type unpaid_amount
Unpaid amount.
void_result do_evaluate(const samet_fund_create_operation &op) const
void modify(const T &obj, const Lambda &m)
void_result do_evaluate(const samet_fund_repay_operation &op)
uint32_t fee_rate
Fee rate, the demominator is GRAPHENE_FEE_RATE_DENOM.
void adjust_balance(account_id_type account, asset delta)
Adjust a particular account's balance in a given asset by a delta.
bool is_authorized_asset(const database &d, const account_object &acct, const asset_object &asset_obj)
time_point_sec head_block_time() const
tracks the blockchain state in an extensible manner
const account_object * fee_paying_account
asset fund_fee
Fee for using the fund.
void_result do_evaluate(const samet_fund_delete_operation &op)
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.
object_id_type do_apply(const samet_fund_create_operation &op) const
asset_id_type asset_type
Asset type in the fund.
account_id_type owner_account
Owner of the fund.
extendable_operation_result do_apply(const samet_fund_repay_operation &op) const
optional< uint32_t > new_fee_rate
New fee rate, optional.
Delete a SameT Fund object.
optional< asset > delta_amount
Delta amount, optional.
samet_fund_id_type fund_id
ID of the SameT Fund.
#define FC_CAPTURE_AND_RETHROW(...)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
account_id_type borrower
The account who borrows from the fund.
asset do_apply(const samet_fund_delete_operation &op) const
share_type balance
Usable amount in the fund.
samet_fund_id_type fund_id
ID of the SameT Fund object.
uint32_t fee_rate
Fee rate, the demominator is GRAPHENE_FEE_RATE_DENOM.
constexpr uint32_t GRAPHENE_FEE_RATE_DENOM
Denominator for SameT Fund fee calculation.
account_id_type account
The account who repays to the SameT Fund.
void_result do_evaluate(const samet_fund_update_operation &op)
samet_fund_id_type fund_id
ID of the SameT Fund object.
asset borrow_amount
The amount to borrow.
samet_fund_id_type fund_id
ID of the SameT Fund.
void_result do_evaluate(const samet_fund_borrow_operation &op)
A SameT Fund is a fund which can be used by a borrower and have to be repaid in the same transaction...
void remove(const object &obj)
account_id_type owner_account
Owner of the fund.
asset repay_amount
The amount to repay.
account_id_type owner_account
The account who owns the SameT Fund object.
void_result do_apply(const samet_fund_update_operation &op) const
Borrow from a SameT Fund.
share_type balance
Usable amount in the fund.
const T & create(F &&constructor)
extendable_operation_result do_apply(const samet_fund_borrow_operation &op) const