Class: Sorare::Rewards::PrizePools::ComputeForDivision

Inherits:
Object
  • Object
show all
Includes:
Interactor
Defined in:
lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb

Overview

ComputeForDivision computes the prize pools of a division

Instance Method Summary collapse

Instance Method Details

#callObject



15
16
17
18
19
# File 'lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb', line 15

def call
  context.division_prize_pools = available_prize_pools.map do |available_prize_pool|
    (available_prize_pool * percentage_rewarded).round(2)
  end
end

#configObject



27
28
29
# File 'lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb', line 27

def config
  Sorare::Rewards.configuration.prize_pool_configuration
end

#percentage_rewardedObject



21
22
23
24
25
# File 'lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb', line 21

def percentage_rewarded
  @percentage_rewarded ||= (config.find do |rate_config|
    (rate_config.dig('playing_rates', 0)...rate_config.dig('playing_rates', 1)).include?(playing_rate)
  end || config.last)['percentage_rewarded']
end