Skip to content

Commit

Permalink
feat: address balance ranking
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Dec 8, 2019
1 parent 656ebf5 commit 4fd300d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/models/statistic_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ def miner_ranking
MinerRanking.new.ranking
end

def address_balance_ranking
Rails.cache.realize("address_balance_ranking", expires_in: 4.hour) do
addresses = Address.order(balance: :desc).limit(50)
addresses.each.with_index(1).map do |address, index|
{ ranking: index.to_s, address: address.address_hash, balance: address.balance.to_s }
end
end
end

def blockchain_info
CkbSync::Api.instance.get_blockchain_info
end
Expand Down

0 comments on commit 4fd300d

Please sign in to comment.