Fix some compile errors

This commit is contained in:
Miha Čančula 2019-08-21 09:56:57 +02:00
parent 8f89f2f5af
commit 10b03910a5
No known key found for this signature in database
GPG key ID: 4FC9D4BD4FBAB9B9
3 changed files with 4 additions and 28 deletions

View file

@ -88,34 +88,6 @@ void database::adjust_balance(account_id_type account, asset delta )
} FC_CAPTURE_AND_RETHROW( (account)(delta) ) }
void database::adjust_balance(asset_id_type lottery_id, asset delta)
{
if( delta.amount == 0 )
return;
auto& index = get_index_type<lottery_balance_index>().indices().get<by_owner>();
auto itr = index.find(lottery_id);
if(itr == index.end())
{
FC_ASSERT( delta.amount > 0, "Insufficient Balance: ${a}'s balance is less than required ${r}",
("a",lottery_id)
("b","test")
("r",to_pretty_string(-delta)));
create<lottery_balance_object>([lottery_id,&delta](lottery_balance_object& b) {
b.lottery_id = lottery_id;
b.balance = asset(delta.amount, delta.asset_id);
});
} else {
if( delta.amount < 0 )
FC_ASSERT( itr->get_balance() >= -delta, "Insufficient Balance: ${a}'s balance of ${b} is less than required ${r}", ("a",lottery_id)("b",to_pretty_string(itr->get_balance()))("r",to_pretty_string(-delta)));
modify(*itr, [delta](lottery_balance_object& b) {
b.adjust_balance(delta);
});
}
}
void database::adjust_sweeps_vesting_balance(account_id_type account, int64_t delta)
{
if( delta == 0 )

View file

@ -26,6 +26,7 @@
namespace graphene { namespace chain {
enum vesting_balance_type { unspecified, gpos };
struct linear_vesting_policy_initializer
{
/** while vesting begins on begin_timestamp, none may be claimed before vesting_cliff_seconds have passed */
@ -72,6 +73,7 @@ namespace graphene { namespace chain {
account_id_type owner; ///< Who is able to withdraw the balance
asset amount;
vesting_policy_initializer policy;
vesting_balance_type balance_type;
account_id_type fee_payer()const { return creator; }
void validate()const

View file

@ -142,6 +142,8 @@ namespace graphene { namespace chain {
asset balance;
/// The vesting policy stores details on when funds vest, and controls when they may be withdrawn
vesting_policy policy;
/// We can have 2 types of vesting, gpos and all the rest
vesting_balance_type balance_type = vesting_balance_type::unspecified;
vesting_balance_object() {}