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