Skip to content

Commit

Permalink
guard clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Feb 24, 2024
1 parent 71f08cb commit 03725d0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions x/manifest/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,30 @@ func BeginBlocker(ctx context.Context, k keeper.Keeper, mk mintkeeper.Keeper, bk
return err
}

// If there is no one to pay out, skip
if len(params.StakeHolders) == 0 {
return nil
}

// Calculate the per block inflation rewards to pay out in coins
mintedCoin := k.BlockRewardsProvision(ctx, params.Inflation.MintDenom)
mintedCoins := sdk.NewCoins(mintedCoin)

// If no inflation payout this block, skip
if mintedCoin.IsZero() {
return nil
}

// mint the tokens to the network
if err := mk.MintCoins(ctx, mintedCoins); err != nil {
return err
}

// Payout all the stakeholders with their respective share of the minted coins
if err := k.PayoutStakeholders(ctx, mintedCoin); err != nil {
return err
}

// send the minted coins to the fee collector account
// if err := mk.AddCollectedFees(ctx, mintedCoins); err != nil {
// return err
// }

if mintedCoin.Amount.IsInt64() {
defer telemetry.ModuleSetGauge(minttypes.ModuleName, float32(mintedCoin.Amount.Int64()), "minted_tokens")
}
Expand Down

0 comments on commit 03725d0

Please sign in to comment.