BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
29 namespace graphene {
namespace chain {
46 assert( elapsed_seconds > 0 );
53 total_vested =
static_cast<uint64_t
>(fc::uint128_t(
begin_balance.
value ) * elapsed_seconds
60 assert( total_vested >= 0 );
63 assert( withdrawn_already >= 0 );
65 allowed_withdraw = total_vested - withdrawn_already;
66 assert( allowed_withdraw >= 0 );
97 assert(delta_seconds >= 0);
100 delta_coin_seconds *= delta_seconds;
119 fc::uint128_t withdraw_available = cs_earned / std::max(
vesting_seconds, 1u);
193 #define VESTING_VISITOR(NAME, MAYBE_CONST) \
194 struct NAME ## _visitor \
197 std::declval<linear_vesting_policy>().NAME( \
198 std::declval<vesting_policy_context>()) \
202 const asset& balance, \
203 const time_point_sec& now, \
204 const asset& amount \
206 : ctx(balance, now, amount) {} \
208 template< typename Policy > \
210 operator()(MAYBE_CONST Policy& policy) MAYBE_CONST \
212 return policy.NAME(ctx); \
215 vesting_policy_context ctx; \
236 assert((amount <=
balance) || (!result));
242 on_deposit_visitor vtor(
balance, now, amount);
249 on_deposit_vested_visitor vtor(
balance, now, amount);
262 on_withdraw_visitor vtor(
balance, now, amount);
constexpr int64_t GRAPHENE_MAX_SHARE_SUPPLY(1000000000000000LL)
defines vesting in terms of coin-days accrued which allows for dynamic deposit/withdraw
share_type begin_balance
The total amount of asset to vest.
fc::uint128_t coin_seconds_earned
void on_withdraw(const vesting_policy_context &ctx)
bool is_deposit_vested_allowed(const vesting_policy_context &ctx) const
uint32_t vesting_duration_seconds
Duration of the vesting period, in seconds. Must be greater than 0 and greater than vesting_cliff_sec...
bool is_deposit_allowed(const fc::time_point_sec &now, const asset &amount) const
asset get_allowed_withdraw(const vesting_policy_context &ctx) const
void on_deposit(const vesting_policy_context &ctx)
#define GRAPHENE_IMPLEMENT_EXTERNAL_SERIALIZATION(type)
void deposit(const fc::time_point_sec &now, const asset &amount)
Deposit amount into vesting balance, requiring it to vest before withdrawal.
VESTING_VISITOR(on_deposit,)
void update_coin_seconds_earned(const vesting_policy_context &ctx)
bool is_deposit_allowed(const vesting_policy_context &ctx) const
vesting_policy policy
The vesting policy stores details on when funds vest, and controls when they may be withdrawn.
bool is_withdraw_allowed(const vesting_policy_context &ctx) const
bool is_withdraw_allowed(const vesting_policy_context &ctx) const
fc::time_point_sec coin_seconds_earned_last_update
void on_deposit(const vesting_policy_context &ctx)
fc::time_point_sec start_claim
asset get_allowed_withdraw(const time_point_sec &now) const
void on_withdraw(const vesting_policy_context &ctx)
void on_deposit_vested(const vesting_policy_context &ctx)
void withdraw(const fc::time_point_sec &now, const asset &amount)
void on_deposit_vested(const vesting_policy_context &)
void deposit_vested(const fc::time_point_sec &now, const asset &amount)
Deposit amount into vesting balance, making the new funds vest immediately.
fc::uint128_t compute_coin_seconds_earned(const vesting_policy_context &ctx) const
bool is_deposit_vested_allowed(const fc::time_point_sec &now, const asset &amount) const
uint32_t vesting_cliff_seconds
No amount may be withdrawn before this many seconds of the vesting period have elapsed.
bool is_deposit_allowed(const vesting_policy_context &ctx) const
visitor::result_type visit(visitor &v)
bool is_withdraw_allowed(const vesting_policy_context &ctx) const
bool is_deposit_allowed(const vesting_policy_context &ctx) const
bool sum_below_max_shares(const asset &a, const asset &b)
fc::time_point_sec begin_timestamp
This is the time at which funds begin vesting.
asset get_allowed_withdraw(const vesting_policy_context &ctx) const
void on_withdraw(const vesting_policy_context &ctx)
void on_deposit(const vesting_policy_context &ctx)
asset get_allowed_withdraw(const vesting_policy_context &ctx) const
Linear vesting balance with cliff.
bool is_withdraw_allowed(const fc::time_point_sec &now, const asset &amount) const