File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,18 @@ def cal_unclaimed_compensation
1515 # @return [Integer]
1616 def phase1_dao_interests
1717 total = 0
18- CellOutput . nervos_dao_withdrawing . live . find_each do |nervos_dao_withdrawing_cell |
18+ events = DaoEvent . processed . where ( event_type : "withdraw_from_dao" , consumed_transaction_id : nil )
19+
20+ pairs = events . map { |e | [ e . ckb_transaction_id , e . cell_index ] }
21+ conditions = pairs . map do |tx_id , cell_idx |
22+ [ "ckb_transaction_id = #{ tx_id } AND cell_index = #{ cell_idx } " ]
23+ end
24+ query = conditions . map do |cond |
25+ "(#{ cond [ 0 ] } )"
26+ end . join ( " OR " )
27+ cells = CellOutput . where ( query ) . to_a
28+
29+ cells . each do |nervos_dao_withdrawing_cell |
1930 total += CkbUtils . dao_interest ( nervos_dao_withdrawing_cell )
2031 end
2132 total
@@ -25,8 +36,8 @@ def phase1_dao_interests
2536 def unmade_dao_interests
2637 tip_dao = current_tip_block . dao
2738 total = 0
28- CellOutput . nervos_dao_deposit . live . find_each do |cell_output |
29- total += DaoCompensationCalculator . new ( cell_output , tip_dao ) . call
39+ DaoEvent . depositor . includes ( :cell_output ) . select ( :cell_output_id , :id ) . find_each do |event |
40+ total += DaoCompensationCalculator . new ( event . cell_output , tip_dao ) . call
3041 end
3142 total
3243 end
You can’t perform that action at this time.
0 commit comments