From 8e37c1a6061464acb936b6dc6bf750634a5114ba Mon Sep 17 00:00:00 2001 From: Miles Zhang Date: Tue, 27 Aug 2024 11:20:12 +0800 Subject: [PATCH] hotfix: revert market data total_supply Signed-off-by: Miles Zhang --- app/models/market_data.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/models/market_data.rb b/app/models/market_data.rb index 3e4e5cfb2..cc444a20b 100644 --- a/app/models/market_data.rb +++ b/app/models/market_data.rb @@ -87,7 +87,7 @@ def parsed_dao def total_supply result = if current_timestamp > first_released_timestamp_may - parsed_dao.c_i - BURN_QUOTA - (parsed_dao.s_i - unmade_dao_interests) + parsed_dao.c_i - BURN_QUOTA - yesterday_treasury_amount.to_i else parsed_dao.c_i - BURN_QUOTA end @@ -167,4 +167,9 @@ def third_released_timestamp_other lock_address.present? ? lock_address.lock_script.lock_info[:estimated_unlock_time].to_i : CkbUtils.time_in_milliseconds(Time.find_zone("UTC").parse("2022-12-31")) end end + + def yesterday_treasury_amount + treasury_amounts = DailyStatistic.order(created_at_unixtimestamp: :desc).first(2).pluck(:treasury_amount) + treasury_amounts[0] == "0" ? treasury_amounts[1] : treasury_amounts[0] + end end