Skip to content

Commit

Permalink
Add max supply and current supply to budget object
Browse files Browse the repository at this point in the history
  • Loading branch information
abitmore committed Nov 5, 2020
1 parent f0f71ce commit af9cafe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions libraries/chain/db_maint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ void database::initialize_budget_record( fc::time_point_sec now, budget_record&
rec.from_initial_reserve = core.reserved(*this);
rec.from_accumulated_fees = core_dd.accumulated_fees;
rec.from_unused_witness_budget = dpo.witness_budget;
rec.max_supply = core.options.max_supply;

if( (dpo.last_budget_time == fc::time_point_sec())
|| (now <= dpo.last_budget_time) )
Expand Down Expand Up @@ -536,6 +537,7 @@ void database::process_budget()
_dpo.last_budget_time = now;
});

rec.current_supply = core.current_supply;
create< budget_record_object >( [&]( budget_record_object& _rec )
{
_rec.time = head_block_time();
Expand Down
22 changes: 16 additions & 6 deletions libraries/chain/include/graphene/chain/budget_record_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,36 @@ struct budget_record
{
uint64_t time_since_last_budget = 0;

// sources of budget
/// Sources of budget
///@{
share_type from_initial_reserve = 0;
share_type from_accumulated_fees = 0;
share_type from_unused_witness_budget = 0;
///@}

// witness budget requested by the committee
/// Witness budget requested by the committee
share_type requested_witness_budget = 0;

// funds that can be released from reserve at maximum rate
/// Funds that can be released from reserve at maximum rate
share_type total_budget = 0;

// sinks of budget, should sum up to total_budget
/// Sinks of budget, should sum up to total_budget
///@{
share_type witness_budget = 0;
share_type worker_budget = 0;
///@}

// unused budget
/// Unused budget
share_type leftover_worker_funds = 0;

// change in supply due to budget operations
/// Change in supply due to budget operations
share_type supply_delta = 0;

/// Maximum supply
share_type max_supply;

/// Current supply
share_type current_supply;
};

class budget_record_object : public graphene::db::abstract_object<budget_record_object>
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/graphene/chain/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#define GRAPHENE_MAX_NESTED_OBJECTS (200)

#define GRAPHENE_CURRENT_DB_VERSION "20200910"
#define GRAPHENE_CURRENT_DB_VERSION "20201105"

#define GRAPHENE_RECENTLY_MISSED_COUNT_INCREMENT 4
#define GRAPHENE_RECENTLY_MISSED_COUNT_DECREMENT 3
Expand Down
2 changes: 2 additions & 0 deletions libraries/chain/small_objects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ FC_REFLECT_DERIVED_NO_TYPENAME(
(worker_budget)
(leftover_worker_funds)
(supply_delta)
(max_supply)
(current_supply)
)

FC_REFLECT_DERIVED_NO_TYPENAME(
Expand Down

0 comments on commit af9cafe

Please sign in to comment.