Skip to content

Commit 4f40985

Browse files
committed
few changes before rewriting proposer script
1 parent 04f58b6 commit 4f40985

File tree

2 files changed

+52
-46
lines changed

2 files changed

+52
-46
lines changed

catalyst-toolbox/src/bin/cli/rewards/full/config.rs

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,6 @@ pub(super) struct Inputs {
2828
pub(super) proposals_path: PathBuf,
2929
}
3030

31-
/// A set of files required to calculate proposer rewards. There is one set per proposal, which are
32-
/// then later merged with csv_merger.py
33-
pub(super) struct ProposalFiles {
34-
35-
}
36-
37-
38-
3931
#[derive(Debug, Deserialize)]
4032
pub(super) struct Outputs {
4133
pub(super) voter_rewards_output: PathBuf,
@@ -46,8 +38,36 @@ pub(super) struct Outputs {
4638

4739
#[derive(Debug, Deserialize)]
4840
pub(super) struct Params {
49-
pub(super) registration_threshold: u64,
41+
pub(super) voter_params: VoterParams,
42+
pub(super) proposer_params: ProposerParams,
43+
pub(super) ca_params: CaParams,
44+
pub(super) vca_params: VcaParams,
45+
}
46+
47+
#[derive(Debug, Deserialize)]
48+
pub(super) struct VoterParams {
49+
pub(super) total_rewards: u64,
5050
pub(super) vote_threshold: u64,
51+
pub(super) registration_threshold: u64,
52+
}
53+
54+
#[derive(Debug, Deserialize)]
55+
pub(super) struct ProposerParams {
56+
pub(super) total_rewards: u64,
57+
pub(super) stake_threshold: f64,
58+
pub(super) approval_threshold: f64,
59+
pub(super) pattern: String,
60+
}
61+
62+
#[derive(Debug, Deserialize)]
63+
pub(super) struct CaParams {
64+
pub(super) rewards_slots: ProposalRewardsSlotsOpt,
65+
pub(super) fund_settings: FundSettingOpt,
66+
pub(super) seed: String,
67+
}
68+
69+
#[derive(Debug, Deserialize)]
70+
pub(super) struct VcaParams {
5171
pub(super) total_rewards: u64,
5272
pub(super) rewards_agreement_rate_cutoffs: Vec<Decimal>,
5373
pub(super) rewards_agreement_rate_modifiers: Vec<Decimal>,
@@ -56,9 +76,4 @@ pub(super) struct Params {
5676
pub(super) min_rankings: usize,
5777
pub(super) max_rankings_reputation: usize,
5878
pub(super) max_rankings_rewards: usize,
59-
pub(super) rewards_slots: ProposalRewardsSlotsOpt,
60-
pub(super) fund_settings: FundSettingOpt,
61-
pub(super) ca_seed: String,
62-
pub(super) proposer_stake_threshold: f64,
63-
pub(super) proposer_approval_threshold: f64,
6479
}

catalyst-toolbox/src/bin/cli/rewards/full/mod.rs

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,10 @@ pub(super) fn full_rewards(path: &Path) -> Result<()> {
3636
},
3737
params:
3838
Params {
39-
registration_threshold,
40-
vote_threshold,
41-
total_rewards,
42-
rewards_agreement_rate_cutoffs,
43-
rewards_agreement_rate_modifiers,
44-
reputation_agreement_rate_cutoffs,
45-
reputation_agreement_rate_modifiers,
46-
min_rankings,
47-
max_rankings_reputation,
48-
max_rankings_rewards,
49-
rewards_slots,
50-
fund_settings,
51-
ca_seed,
52-
proposer_stake_threshold,
53-
proposer_approval_threshold,
39+
voter_params,
40+
proposer_params,
41+
ca_params,
42+
vca_params,
5443
},
5544
} = config;
5645

@@ -60,46 +49,48 @@ pub(super) fn full_rewards(path: &Path) -> Result<()> {
6049
&voter_rewards_output,
6150
&vote_count_path,
6251
&snapshot_path,
63-
registration_threshold,
64-
vote_threshold,
65-
total_rewards,
52+
voter_params.registration_threshold,
53+
voter_params.vote_threshold,
54+
voter_params.total_rewards,
6655
)?;
6756

6857
info!("calculating vca rewards");
6958
super::veterans::vca_rewards(
7059
reviews_csv,
7160
veterans_rewards_output,
72-
rewards_agreement_rate_cutoffs,
73-
rewards_agreement_rate_modifiers,
74-
reputation_agreement_rate_cutoffs,
75-
reputation_agreement_rate_modifiers,
76-
total_rewards.into(),
77-
min_rankings,
78-
max_rankings_reputation,
79-
max_rankings_rewards,
61+
vca_params.rewards_agreement_rate_cutoffs,
62+
vca_params.rewards_agreement_rate_modifiers,
63+
vca_params.reputation_agreement_rate_cutoffs,
64+
vca_params.reputation_agreement_rate_modifiers,
65+
vca_params.total_rewards.into(),
66+
vca_params.min_rankings,
67+
vca_params.max_rankings_reputation,
68+
vca_params.max_rankings_rewards,
8069
)?;
8170

8271
info!("calculating ca rewards");
8372
super::community_advisors::ca_rewards(
8473
assessments_path,
8574
approved_proposals_path,
86-
fund_settings,
87-
rewards_slots,
75+
ca_params.fund_settings,
76+
ca_params.rewards_slots,
8877
ca_rewards_output,
89-
ca_seed,
78+
ca_params.seed,
9079
proposal_bonus_output,
9180
)?;
9281

9382
info!("calculating proposer rewards");
9483
proposers::proposers_rewards(
9584
&proposer_script_path,
85+
&csv_merger_script_path,
9686
&block_file,
9787
&proposer_rewards_output,
98-
proposer_stake_threshold,
99-
proposer_approval_threshold,
88+
proposer_params.stake_threshold,
89+
proposer_params.approval_threshold,
10090
&proposals_path,
101-
&active_voteplans,
10291
&challenges,
92+
&active_voteplans,
93+
&proposer_params.pattern,
10394
)?;
10495

10596
Ok(())

0 commit comments

Comments
 (0)