Skip to content

Commit

Permalink
Merge pull request #84 from marinade-finance/fix/bid-distribution
Browse files Browse the repository at this point in the history
fix: bid distribution
  • Loading branch information
butonium authored Aug 12, 2024
2 parents c122055 + 5ac520c commit 5ecaffe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions bid-distribution/src/settlement_claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ pub fn generate_bid_settlements(
Decimal::from(*settlement_config.marinade_fee_bps()) / Decimal::from(10000);
let effective_bid = validator.effective_bid / Decimal::from(1000);

if sam_target_stake + mnde_target_stake == Decimal::ZERO {
continue;
}

let total_active_stake: u64 = stake_meta_index
.iter_grouped_stake_metas(&validator.vote_account)
.unwrap()
Expand All @@ -90,7 +86,12 @@ pub fn generate_bid_settlements(
.map(|meta| meta.active_delegation_lamports)
.sum();

let stake_sam_percentage = sam_target_stake / (sam_target_stake + mnde_target_stake);
let stake_sam_percentage = if mnde_target_stake == Decimal::ZERO {
Decimal::ONE
} else {
sam_target_stake / (sam_target_stake + mnde_target_stake)
};

let initial_sam_stake = (Decimal::from(total_active_stake) * stake_sam_percentage)
.to_u64()
.unwrap();
Expand Down

0 comments on commit 5ecaffe

Please sign in to comment.