sorare-rewards 1.4.3 → 1.4.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +1 -1
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +14 -15
- data/lib/sorare/rewards/configuration.rb +1 -1
- data/lib/sorare/rewards/interactors/allocations/compute_for_game_week.rb +2 -1
- data/lib/sorare/rewards/interactors/allocations/compute_for_league.rb +4 -3
- data/lib/sorare/rewards/interactors/allocations/compute_for_quality.rb +4 -3
- data/lib/sorare/rewards/interactors/allocations/compute_for_rarity.rb +2 -1
- data/lib/sorare/rewards/interactors/build.rb +2 -1
- data/lib/sorare/rewards/interactors/cards/pick_for_division.rb +2 -1
- data/lib/sorare/rewards/interactors/cards/pick_for_division_and_rarity.rb +2 -1
- data/lib/sorare/rewards/interactors/cards/pick_for_division_rarity_and_quality.rb +3 -1
- data/lib/sorare/rewards/interactors/cards/pick_for_game_week.rb +2 -1
- data/lib/sorare/rewards/interactors/cards/pick_for_league.rb +3 -1
- data/lib/sorare/rewards/interactors/pick.rb +2 -1
- data/lib/sorare/rewards/interactors/prize_pools/compute_for_division.rb +2 -1
- data/lib/sorare/rewards/interactors/prize_pools/compute_for_game_week.rb +2 -1
- data/lib/sorare/rewards/interactors/prize_pools/compute_for_league.rb +4 -3
- data/lib/sorare/rewards/interactors/supply/compute_for_game_week.rb +2 -1
- data/lib/sorare/rewards/interactors/supply/compute_for_quality.rb +2 -1
- data/lib/sorare/rewards/interactors/supply/compute_for_rarity.rb +3 -2
- data/lib/sorare/rewards/interactors/tiers/qualify_players.rb +2 -1
- data/lib/sorare/rewards/interactors/tiers/qualify_supply.rb +2 -1
- data/lib/sorare/rewards/version.rb +1 -1
- data/sorare-rewards.gemspec +4 -3
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae70a652e6cbbcea1dac9494772d3ab72ddf6bdc0a354ee6da775f5a532226d5
|
4
|
+
data.tar.gz: 71a370d2608c2b709ef67372d6def7e391520ece05ee96fcc4f043d26de74a63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ac8909193f8ac893553263ef02a345aa672833b3abd5522c4e69be9fe8bb76d9aea1f7bcffbfbbbcf0fd7f35d597c0f2e2eff2006c33eae4f6aecb40854eee8
|
7
|
+
data.tar.gz: cff95ecc875be592e58d92fd26849889f499cfcaebedde6c07aee31425031a0cfb6655487f54a1c6fb228b724ec1b4d6a43764e29ff78cc25cfb5f23ff5e0ee5
|
data/.gitlab-ci.yml
CHANGED
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,20 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
sorare-rewards (1.4.
|
5
|
-
activesupport (
|
6
|
-
|
4
|
+
sorare-rewards (1.4.7)
|
5
|
+
activesupport (>= 6.1.4)
|
6
|
+
interactor_with_steroids (>= 1.0.0)
|
7
7
|
json (~> 2)
|
8
8
|
yaml (~> 0.2.0)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
activesupport (
|
13
|
+
activesupport (7.0.1)
|
14
14
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
15
|
i18n (>= 1.6, < 2)
|
16
16
|
minitest (>= 5.1)
|
17
17
|
tzinfo (~> 2.0)
|
18
|
-
zeitwerk (~> 2.3)
|
19
18
|
addressable (2.8.0)
|
20
19
|
public_suffix (>= 2.0.2, < 5.0)
|
21
20
|
ast (2.4.2)
|
@@ -24,19 +23,20 @@ GEM
|
|
24
23
|
rexml
|
25
24
|
diff-lcs (1.4.4)
|
26
25
|
hashdiff (1.0.1)
|
27
|
-
i18n (1.
|
26
|
+
i18n (1.9.1)
|
28
27
|
concurrent-ruby (~> 1.0)
|
29
|
-
|
30
|
-
|
28
|
+
interactor_with_steroids (1.1.2)
|
29
|
+
activesupport
|
30
|
+
json (2.6.1)
|
31
31
|
minitest (5.15.0)
|
32
32
|
ostruct (0.4.0)
|
33
33
|
parallel (1.21.0)
|
34
|
-
parser (3.0.
|
34
|
+
parser (3.1.0.0)
|
35
35
|
ast (~> 2.4.1)
|
36
36
|
public_suffix (4.0.6)
|
37
37
|
rainbow (3.0.0)
|
38
38
|
rake (12.3.3)
|
39
|
-
regexp_parser (2.
|
39
|
+
regexp_parser (2.2.0)
|
40
40
|
rexml (3.2.5)
|
41
41
|
rspec (3.10.0)
|
42
42
|
rspec-core (~> 3.10.0)
|
@@ -51,16 +51,16 @@ GEM
|
|
51
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
52
|
rspec-support (~> 3.10.0)
|
53
53
|
rspec-support (3.10.2)
|
54
|
-
rubocop (1.
|
54
|
+
rubocop (1.24.1)
|
55
55
|
parallel (~> 1.10)
|
56
56
|
parser (>= 3.0.0.0)
|
57
57
|
rainbow (>= 2.2.2, < 4.0)
|
58
58
|
regexp_parser (>= 1.8, < 3.0)
|
59
59
|
rexml
|
60
|
-
rubocop-ast (>= 1.
|
60
|
+
rubocop-ast (>= 1.15.1, < 2.0)
|
61
61
|
ruby-progressbar (~> 1.7)
|
62
62
|
unicode-display_width (>= 1.4.0, < 3.0)
|
63
|
-
rubocop-ast (1.
|
63
|
+
rubocop-ast (1.15.1)
|
64
64
|
parser (>= 3.0.1.1)
|
65
65
|
rubocop-rake (0.6.0)
|
66
66
|
rubocop (~> 1.0)
|
@@ -75,7 +75,6 @@ GEM
|
|
75
75
|
crack (>= 0.3.2)
|
76
76
|
hashdiff (>= 0.4.0, < 2.0.0)
|
77
77
|
yaml (0.2.0)
|
78
|
-
zeitwerk (2.5.1)
|
79
78
|
|
80
79
|
PLATFORMS
|
81
80
|
ruby
|
@@ -84,7 +83,7 @@ DEPENDENCIES
|
|
84
83
|
ostruct (~> 0.4.0)
|
85
84
|
rake (~> 12.0)
|
86
85
|
rspec (~> 3.10)
|
87
|
-
rubocop (~> 1.
|
86
|
+
rubocop (~> 1.24.1)
|
88
87
|
rubocop-rake (~> 0.6.0)
|
89
88
|
rubocop-rspec (~> 2.5.0)
|
90
89
|
sorare-rewards!
|
@@ -19,7 +19,7 @@ module Sorare
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def load_yaml_configuration_file(filename)
|
22
|
-
YAML.safe_load(File.read("#{File.dirname(__FILE__)}/#{filename}"),
|
22
|
+
YAML.safe_load(File.read("#{File.dirname(__FILE__)}/#{filename}"), aliases: true)
|
23
23
|
.with_indifferent_access
|
24
24
|
end
|
25
25
|
end
|
@@ -10,7 +10,8 @@ module Sorare
|
|
10
10
|
class ComputeForGameWeek
|
11
11
|
include Interactor
|
12
12
|
|
13
|
-
|
13
|
+
receive :supply, :public_seed, :salt
|
14
|
+
hold :randomizer, :game_week_allocations
|
14
15
|
|
15
16
|
def call
|
16
17
|
context.randomizer = Sorare::Rewards::Random.new(public_seed, salt)
|
@@ -10,7 +10,8 @@ module Sorare
|
|
10
10
|
class ComputeForLeague
|
11
11
|
include Interactor
|
12
12
|
|
13
|
-
|
13
|
+
receive :supply, :config, :randomizer
|
14
|
+
hold :league_allocations
|
14
15
|
|
15
16
|
def call
|
16
17
|
context.league_allocations = allocate_and_format!
|
@@ -19,9 +20,9 @@ module Sorare
|
|
19
20
|
def allocate_and_format!
|
20
21
|
each_rarity_allocation do |rarity|
|
21
22
|
(allocations[rarity].first || {}).keys.index_with do |division|
|
22
|
-
allocations[rarity].each_with_index.
|
23
|
+
allocations[rarity].each_with_index.to_h do |qualified_allocations, tier|
|
23
24
|
[Sorare::Rewards.configuration.transform_tier.call(tier), qualified_allocations[division]]
|
24
|
-
end
|
25
|
+
end
|
25
26
|
end
|
26
27
|
end
|
27
28
|
end
|
@@ -9,7 +9,8 @@ module Sorare
|
|
9
9
|
class ComputeForQuality
|
10
10
|
include Interactor
|
11
11
|
|
12
|
-
|
12
|
+
receive :supply, :config, :randomizer
|
13
|
+
hold :allocated, :quality_allocations
|
13
14
|
|
14
15
|
def call
|
15
16
|
check_config!
|
@@ -20,9 +21,9 @@ module Sorare
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def allocations
|
23
|
-
config.length.times.
|
24
|
+
config.length.times.to_h do |division|
|
24
25
|
[Sorare::Rewards.configuration.transform_division.call(division + 1), allocated[division]]
|
25
|
-
end
|
26
|
+
end
|
26
27
|
end
|
27
28
|
|
28
29
|
def allocate!
|
@@ -22,7 +22,8 @@ module Sorare
|
|
22
22
|
class PickForDivision
|
23
23
|
include Interactor
|
24
24
|
|
25
|
-
|
25
|
+
receive :league, :allocations, :pickers
|
26
|
+
hold :cards_picked
|
26
27
|
|
27
28
|
def call
|
28
29
|
context.cards_picked = allocations.keys.index_with do |rarity|
|
@@ -17,7 +17,8 @@ module Sorare
|
|
17
17
|
class PickForDivisionAndRarity
|
18
18
|
include Interactor
|
19
19
|
|
20
|
-
|
20
|
+
receive :league, :rarity, :allocations, :pickers
|
21
|
+
hold :cards_picked
|
21
22
|
|
22
23
|
def call
|
23
24
|
context.cards_picked = supply!
|
@@ -15,7 +15,9 @@ module Sorare
|
|
15
15
|
|
16
16
|
MISSING_CARDS = 'There are not enough cards to fulfill the requirements'
|
17
17
|
|
18
|
-
|
18
|
+
receive :picker, :allocations, :league, :rarity, force: false
|
19
|
+
hold :cards_picked
|
20
|
+
|
19
21
|
delegate :game_week, to: :league
|
20
22
|
|
21
23
|
def call
|
@@ -17,7 +17,9 @@ module Sorare
|
|
17
17
|
class PickForLeague
|
18
18
|
include Interactor
|
19
19
|
|
20
|
-
|
20
|
+
receive :league, :allocations
|
21
|
+
hold :pickers, :cards_picked
|
22
|
+
|
21
23
|
delegate :game_week, to: :league
|
22
24
|
delegate :public_seed, :salt, to: :game_week
|
23
25
|
|
@@ -19,7 +19,8 @@ module Sorare
|
|
19
19
|
class Pick
|
20
20
|
include Interactor
|
21
21
|
|
22
|
-
|
22
|
+
receive :card_allocations, :game_week, :salt
|
23
|
+
hold :cards_picked
|
23
24
|
|
24
25
|
# Depending on the way the allocations interpreter is implemented it could be done by him or we
|
25
26
|
# update the allocations process to match the structure
|
@@ -9,7 +9,8 @@ module Sorare
|
|
9
9
|
class ComputeForDivision
|
10
10
|
include Interactor
|
11
11
|
|
12
|
-
|
12
|
+
receive :playing_rate, :available_prize_pools
|
13
|
+
hold :division_prize_pools
|
13
14
|
|
14
15
|
def call
|
15
16
|
context.division_prize_pools = available_prize_pools.map do |available_prize_pool|
|
@@ -9,20 +9,21 @@ module Sorare
|
|
9
9
|
class ComputeForLeague
|
10
10
|
include Interactor
|
11
11
|
|
12
|
-
|
12
|
+
receive :league
|
13
|
+
hold :league_prize_pools
|
13
14
|
|
14
15
|
def call
|
15
16
|
context.league_prize_pools = prize_pools!
|
16
17
|
end
|
17
18
|
|
18
19
|
def prize_pools!
|
19
|
-
league.each_division_prize_pools.
|
20
|
+
league.each_division_prize_pools.to_h do |division, prize_pools|
|
20
21
|
[
|
21
22
|
Sorare::Rewards.configuration.transform_division.call(division),
|
22
23
|
ComputeForDivision.call!(playing_rate: league.playing_rate, available_prize_pools: prize_pools)
|
23
24
|
.division_prize_pools
|
24
25
|
]
|
25
|
-
end
|
26
|
+
end
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|
@@ -9,7 +9,8 @@ module Sorare
|
|
9
9
|
class ComputeForQuality
|
10
10
|
include Interactor
|
11
11
|
|
12
|
-
|
12
|
+
receive :randomizer, :total_supply, :tier_supply, :rewarded, :rewardable
|
13
|
+
hold :quality_supply
|
13
14
|
|
14
15
|
def call
|
15
16
|
context.quality_supply = total_supply.zero? ? 0 : quality_supply
|
@@ -9,8 +9,9 @@ module Sorare
|
|
9
9
|
class ComputeForRarity
|
10
10
|
include Interactor
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
receive :randomizer, :league, :rarity, :supply
|
13
|
+
hold :rarity_supply, :rewardable
|
14
|
+
|
14
15
|
delegate :game_week, to: :league
|
15
16
|
|
16
17
|
def call
|
data/sorare-rewards.gemspec
CHANGED
@@ -29,14 +29,15 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
|
-
spec.add_dependency 'activesupport', '
|
33
|
-
spec.add_dependency '
|
32
|
+
spec.add_dependency 'activesupport', '>= 6.1.4'
|
33
|
+
spec.add_dependency 'interactor_with_steroids', '>= 1.0.0'
|
34
34
|
spec.add_dependency 'json', '~> 2'
|
35
35
|
spec.add_dependency 'yaml', '~> 0.2.0'
|
36
36
|
spec.add_development_dependency 'ostruct', '~> 0.4.0'
|
37
37
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
38
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
38
|
+
spec.add_development_dependency 'rubocop', '~> 1.24.1'
|
39
39
|
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
40
40
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.5.0'
|
41
41
|
spec.add_development_dependency 'webmock', '~> 3.14.0'
|
42
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
42
43
|
end
|
metadata
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sorare-rewards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sorare team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 6.1.4
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 6.1.4
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: interactor_with_steroids
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: json
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.
|
103
|
+
version: 1.24.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.
|
110
|
+
version: 1.24.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rubocop-rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,6 +211,7 @@ licenses:
|
|
211
211
|
metadata:
|
212
212
|
homepage_uri: https://gitlab.com/sorare/sorare-rewards
|
213
213
|
source_code_uri: https://gitlab.com/sorare/sorare-rewards
|
214
|
+
rubygems_mfa_required: 'true'
|
214
215
|
post_install_message:
|
215
216
|
rdoc_options: []
|
216
217
|
require_paths:
|
@@ -226,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
227
|
- !ruby/object:Gem::Version
|
227
228
|
version: '0'
|
228
229
|
requirements: []
|
229
|
-
rubygems_version: 3.
|
230
|
+
rubygems_version: 3.1.6
|
230
231
|
signing_key:
|
231
232
|
specification_version: 4
|
232
233
|
summary: '["Sorare", "reward", "allocation", "algorithm"]'
|