fix for get_vesting_balance API call
This commit is contained in:
parent
79dc2f4dde
commit
4a72f943e8
1 changed files with 23 additions and 12 deletions
|
|
@ -35,6 +35,7 @@ inline bool sum_below_max_shares(const asset& a, const asset& b)
|
||||||
}
|
}
|
||||||
|
|
||||||
asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context& ctx )const
|
asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context& ctx )const
|
||||||
|
{
|
||||||
{
|
{
|
||||||
share_type allowed_withdraw = 0;
|
share_type allowed_withdraw = 0;
|
||||||
|
|
||||||
|
|
@ -44,6 +45,15 @@ asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context&
|
||||||
assert( elapsed_seconds > 0 );
|
assert( elapsed_seconds > 0 );
|
||||||
|
|
||||||
if( elapsed_seconds >= vesting_cliff_seconds )
|
if( elapsed_seconds >= vesting_cliff_seconds )
|
||||||
|
{
|
||||||
|
// BLOCKBACK-154 fix, Begin balance for linear vesting applies only to initial account balance from genesis
|
||||||
|
// So, for any GPOS vesting, the begin balance would be 0 and should be able to withdraw balance amount based on lockin period
|
||||||
|
if(begin_balance == 0)
|
||||||
|
{
|
||||||
|
allowed_withdraw = ctx.balance.amount;
|
||||||
|
return asset( allowed_withdraw, ctx.balance.asset_id );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
share_type total_vested = 0;
|
share_type total_vested = 0;
|
||||||
if( elapsed_seconds < vesting_duration_seconds )
|
if( elapsed_seconds < vesting_duration_seconds )
|
||||||
|
|
@ -63,6 +73,7 @@ asset linear_vesting_policy::get_allowed_withdraw( const vesting_policy_context&
|
||||||
assert( allowed_withdraw >= 0 );
|
assert( allowed_withdraw >= 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return asset( allowed_withdraw, ctx.balance.asset_id );
|
return asset( allowed_withdraw, ctx.balance.asset_id );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue