-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1531 from nervosnetwork/develop
Deploy to testnet
- Loading branch information
Showing
33 changed files
with
772 additions
and
828 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
class TypeScriptSerializer | ||
include FastJsonapi::ObjectSerializer | ||
|
||
attributes :args, :code_hash, :hash_type | ||
attributes :args, :code_hash, :hash_type, :script_hash | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
module Charts | ||
class CkbHodlWavesStatistic | ||
include Sidekiq::Worker | ||
sidekiq_options queue: "critical" | ||
|
||
def perform | ||
over_three_years = CellOutput.live.generated_before(3.years.ago.to_i * 1000).sum(:capacity) | ||
one_year_to_three_years = CellOutput.live.generated_between( | ||
3.years.ago.to_i * 1000, 1.year.ago.to_i * 1000 | ||
).sum(:capacity) | ||
six_months_to_one_year = CellOutput.live.generated_between( | ||
1.year.ago.to_i * 1000, 6.months.ago.to_i * 1000 | ||
).sum(:capacity) | ||
three_months_to_six_months = CellOutput.live.generated_between( | ||
6.months.ago.to_i * 1000, 3.months.ago.to_i * 1000 | ||
).sum(:capacity) | ||
one_month_to_three_months = CellOutput.live.generated_between( | ||
3.months.ago.to_i * 1000, 1.month.ago.to_i * 1000 | ||
).sum(:capacity) | ||
one_week_to_one_month = CellOutput.live.generated_between( | ||
1.month.ago.to_i * 1000, 1.week.ago.to_i * 1000 | ||
).sum(:capacity) | ||
day_to_one_week = CellOutput.live.generated_between( | ||
1.week.ago.to_i * 1000, 1.day.ago.to_i * 1000 | ||
).sum(:capacity) | ||
latest_day = CellOutput.live.generated_between( | ||
1.day.ago.beginning_of_day.to_i * 1000, 1.day.ago.end_of_day.to_i * 1000 | ||
).sum(:capacity) | ||
|
||
info = { | ||
total_supply: MarketData.new.indicators_json["total_supply"], | ||
updated_at: Time.current.to_i, | ||
} | ||
|
||
ckb = { | ||
over_three_years:, | ||
one_year_to_three_years:, | ||
six_months_to_one_year:, | ||
three_months_to_six_months:, | ||
one_month_to_three_months:, | ||
one_week_to_one_month:, | ||
day_to_one_week:, | ||
latest_day:, | ||
}.transform_values { |value| (value / 10**8).truncate(8) } | ||
|
||
StatisticInfo.first.update(ckb_hodl_waves: ckb.merge!(info)) | ||
end | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20231218082938_add_ckb_hodl_waves_to_statistic_info.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddCkbHodlWavesToStatisticInfo < ActiveRecord::Migration[7.0] | ||
def change | ||
add_column :statistic_infos, :ckb_hodl_waves, :jsonb | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.