Skip to content

Commit

Permalink
feat: add locked_capacity to daily statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed May 25, 2020
1 parent 25abaf7 commit c1e0bf9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/models/daily_statistic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ class DailyStatistic < ApplicationRecord
VALID_INDICATORS = %w(
transactions_count addresses_count total_dao_deposit live_cells_count dead_cells_count avg_hash_rate avg_difficulty uncle_rate
total_depositors_count address_balance_distribution total_tx_fee occupied_capacity daily_dao_deposit daily_dao_depositors_count
circulation_ratio daily_dao_withdraw nodes_count circulating_supply
circulation_ratio daily_dao_withdraw nodes_count circulating_supply burnt
).freeze

def burnt
treasury_amount + MarketData::BURN_QUOTA
end
end

# == Schema Information
Expand Down Expand Up @@ -47,4 +51,5 @@ class DailyStatistic < ApplicationRecord
# average_block_time :jsonb
# nodes_distribution :jsonb
# nodes_count :integer
# locked_capacity :decimal(30, )
#
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddLockedCapacityToDailyStatistic < ActiveRecord::Migration[6.0]
def change
add_column :daily_statistics, :locked_capacity, :decimal, precision: 30
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_05_13_032346) do
ActiveRecord::Schema.define(version: 2020_05_25_100826) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -218,6 +218,7 @@
t.jsonb "average_block_time"
t.jsonb "nodes_distribution"
t.integer "nodes_count"
t.decimal "locked_capacity", precision: 30
end

create_table "dao_contracts", force: :cascade do |t|
Expand Down

0 comments on commit c1e0bf9

Please sign in to comment.