Skip to content

Commit

Permalink
Merge pull request #2126 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
zmcNotafraid authored Aug 8, 2024
2 parents 09a6262 + 754bd3d commit 2944667
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ GEM
redis-objects (2.0.0.beta)
redis (~> 5.0)
regexp_parser (2.7.0)
rexml (3.2.8)
strscan (>= 3.0.9)
rexml (3.3.3)
strscan
rubocop (1.50.1)
json (~> 2.3)
parallel (~> 1.10)
Expand Down
29 changes: 13 additions & 16 deletions app/models/market_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def parsed_dao
end

def total_supply
if current_timestamp > first_released_timestamp_may
result = parsed_dao.c_i - BURN_QUOTA - yesterday_treasury_amount.to_i
else
result = parsed_dao.c_i - BURN_QUOTA
end
result = if current_timestamp > first_released_timestamp_may
parsed_dao.c_i - BURN_QUOTA - yesterday_treasury_amount.to_i
else
parsed_dao.c_i - BURN_QUOTA
end

unit == "ckb" ? (result / 10**8).truncate(8) : result
end
Expand All @@ -104,11 +104,9 @@ def circulating_supply
# 2020-05-01
def first_released_timestamp_may
@first_released_timestamp_may ||=
begin
Rails.cache.realize("first_released_timestamp_may") do
lock_address = Address.find_by_address_hash("ckb1q3w9q60tppt7l3j7r09qcp7lxnp3vcanvgha8pmvsa3jplykxn323t90gna20lusyshreg32qee4fhkt9jj2t6qrqzzqxzq8yqt8kmd9")
lock_address.present? ? lock_address.lock_script.lock_info[:estimated_unlock_time].to_i : CkbUtils.time_in_milliseconds(Time.find_zone("UTC").parse("2020-05-01"))
end
Rails.cache.realize("first_released_timestamp_may") do
lock_address = Address.find_by_address_hash("ckb1q3w9q60tppt7l3j7r09qcp7lxnp3vcanvgha8pmvsa3jplykxn323t90gna20lusyshreg32qee4fhkt9jj2t6qrqzzqxzq8yqt8kmd9")
lock_address.present? ? lock_address.lock_script.lock_info[:estimated_unlock_time].to_i : CkbUtils.time_in_milliseconds(Time.find_zone("UTC").parse("2020-05-01"))
end
end

Expand All @@ -133,11 +131,9 @@ def third_released_timestamp_may
# 2020-07-01
def first_released_timestamp_other
@first_released_timestamp_other ||=
begin
Rails.cache.realize("first_released_timestamp_may") do
lock_address = Address.find_by_address_hash("ckb1q3w9q60tppt7l3j7r09qcp7lxnp3vcanvgha8pmvsa3jplykxn32s3y29vjv73cfm8qax220dwwmpdccl4upy4s9qzzqxzq8yqyd09am")
lock_address.present? ? lock_address.lock_script.lock_info[:estimated_unlock_time].to_i : CkbUtils.time_in_milliseconds(Time.find_zone("UTC").parse("2020-07-01"))
end
Rails.cache.realize("first_released_timestamp_may") do
lock_address = Address.find_by_address_hash("ckb1q3w9q60tppt7l3j7r09qcp7lxnp3vcanvgha8pmvsa3jplykxn32s3y29vjv73cfm8qax220dwwmpdccl4upy4s9qzzqxzq8yqyd09am")
lock_address.present? ? lock_address.lock_script.lock_info[:estimated_unlock_time].to_i : CkbUtils.time_in_milliseconds(Time.find_zone("UTC").parse("2020-07-01"))
end
end

Expand All @@ -160,6 +156,7 @@ def third_released_timestamp_other
end

def yesterday_treasury_amount
DailyStatistic.order(:created_at_unixtimestamp).last.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

0 comments on commit 2944667

Please sign in to comment.