Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix supply issue #2104

Merged
merged 3 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions libraries/chain/db_maint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include <graphene/chain/account_object.hpp>
#include <graphene/chain/asset_object.hpp>
#include <graphene/chain/balance_object.hpp>
#include <graphene/chain/budget_record_object.hpp>
#include <graphene/chain/buyback_object.hpp>
#include <graphene/chain/chain_property_object.hpp>
Expand Down Expand Up @@ -970,6 +971,22 @@ void process_hf_1465( database& db )
}
}

/****
* @brief a one-time data process to correct current_supply of BTS token in the BitShares mainnet
*/
void process_hf_2103( database& db )
{
const balance_object* bal = db.find( balance_id_type( HARDFORK_CORE_2103_BALANCE_ID ) );
if( bal != nullptr && bal->balance.amount < 0 )
{
const asset_dynamic_data_object& ddo = bal->balance.asset_id(db).dynamic_data(db);
db.modify<asset_dynamic_data_object>( ddo, [bal](asset_dynamic_data_object& obj) {
obj.current_supply -= bal->balance.amount;
});
db.remove( *bal );
}
}

void update_median_feeds(database& db)
{
time_point_sec head_time = db.head_block_time();
Expand Down Expand Up @@ -1227,6 +1244,10 @@ void database::perform_chain_maintenance(const signed_block& next_block, const g
if ( dgpo.next_maintenance_time <= HARDFORK_CORE_1465_TIME && next_maintenance_time > HARDFORK_CORE_1465_TIME )
process_hf_1465(*this);

// Fix supply issue
if ( dgpo.next_maintenance_time <= HARDFORK_CORE_2103_TIME && next_maintenance_time > HARDFORK_CORE_2103_TIME )
process_hf_2103(*this);

modify(dgpo, [next_maintenance_time](dynamic_global_property_object& d) {
d.next_maintenance_time = next_maintenance_time;
d.accounts_registered_this_interval = 0;
Expand Down
5 changes: 5 additions & 0 deletions libraries/chain/hardfork.d/CORE_2103.hf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// bitshares-core issue #2103 250M BTS supply
#ifndef HARDFORK_CORE_2103_TIME
#define HARDFORK_CORE_2103_TIME (fc::time_point_sec( 1600000000 ) ) // Sep 2020
#define HARDFORK_CORE_2103_BALANCE_ID 56720 // 1.15.56720
#endif
2 changes: 1 addition & 1 deletion programs/build_helpers/cat-parts.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ file( MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/graphene/chain/" )

set( HARDFORK_REGENERATE TRUE )

file( GLOB HARDFORKS "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d/*" )
file( GLOB HARDFORKS "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d/*.hf" )
foreach( HF ${HARDFORKS} )
file( READ "${HF}" INCL )
string( CONCAT HARDFORK_CONTENT ${HARDFORK_CONTENT} ${INCL} )
Expand Down