diff --git a/libraries/chain/db_balance.cpp b/libraries/chain/db_balance.cpp index 0b5e2c02..4fb59bad 100644 --- a/libraries/chain/db_balance.cpp +++ b/libraries/chain/db_balance.cpp @@ -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().indices().get(); - 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_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 ) diff --git a/libraries/chain/include/graphene/chain/protocol/vesting.hpp b/libraries/chain/include/graphene/chain/protocol/vesting.hpp index 4915b62e..f8523e81 100644 --- a/libraries/chain/include/graphene/chain/protocol/vesting.hpp +++ b/libraries/chain/include/graphene/chain/protocol/vesting.hpp @@ -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 diff --git a/libraries/chain/include/graphene/chain/vesting_balance_object.hpp b/libraries/chain/include/graphene/chain/vesting_balance_object.hpp index 5ae93a4a..2c7d927c 100644 --- a/libraries/chain/include/graphene/chain/vesting_balance_object.hpp +++ b/libraries/chain/include/graphene/chain/vesting_balance_object.hpp @@ -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() {}