Skip to content

Commit

Permalink
chore: make totalInflationShareWeight a LegacyDec
Browse files Browse the repository at this point in the history
  • Loading branch information
shifty11 committed May 23, 2024
1 parent 64bcc0b commit deda791
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions x/bundles/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ func SplitInflation(ctx sdk.Context, k bundlesKeeper.Keeper, bk util.BankKeeper,
distributed := uint64(0)

// calculate total inflation share weight of pools to get each pool's reward share
totalInflationShareWeight := uint64(0)
totalInflationShareWeight := math.LegacyZeroDec()

for _, pool := range pk.GetAllPools(ctx) {
// only include active pools
if err := k.AssertPoolCanRun(ctx, pool.Id); err == nil {
totalInflationShareWeight += uint64(pool.InflationShareWeight.TruncateInt64())
totalInflationShareWeight = totalInflationShareWeight.Add(pool.InflationShareWeight)
}
}

// if the total inflation share weight is zero all rewards go the chain
if totalInflationShareWeight == 0 {
if totalInflationShareWeight.IsZero() {
return
}

Expand All @@ -60,7 +60,7 @@ func SplitInflation(ctx sdk.Context, k bundlesKeeper.Keeper, bk util.BankKeeper,
if err := k.AssertPoolCanRun(ctx, pool.Id); err == nil {
// calculate pool share based of inflation share weight
amount := uint64(pool.InflationShareWeight.
Quo(math.LegacyNewDec(int64(totalInflationShareWeight))).
Quo(totalInflationShareWeight).
Mul(math.LegacyNewDec(protocolBlockProvision)).
TruncateInt64())

Expand Down

0 comments on commit deda791

Please sign in to comment.