Skip to content

Commit

Permalink
fix: Prevent GMR to produce zero values
Browse files Browse the repository at this point in the history
  • Loading branch information
red-0ne authored and okdas committed Oct 8, 2024
1 parent 56f7052 commit 050e08d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/tokenomics/keeper/token_logic_modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,11 @@ func calculateGlobalPerClaimMintInflationFromSettlementAmount(settlementCoin sdk
// TODO_MAINNET: Consider using fixed point arithmetic for deterministic results.
settlementAmtFloat := new(big.Float).SetUint64(settlementCoin.Amount.Uint64())
newMintAmtFloat := new(big.Float).Mul(settlementAmtFloat, big.NewFloat(MintPerClaimedTokenGlobalInflation))
// DEV_NOTE: If new mint is less than 1 and more than 0, ceil it to 1 so that
// we never expect to process a claim with 0 minted tokens.
if newMintAmtFloat.Cmp(big.NewFloat(1)) < 0 && newMintAmtFloat.Cmp(big.NewFloat(0)) > 0 {
newMintAmtFloat = big.NewFloat(1)
}
newMintAmtInt, _ := newMintAmtFloat.Int64()
mintAmtCoin := cosmostypes.NewCoin(volatile.DenomuPOKT, math.NewInt(newMintAmtInt))
return mintAmtCoin, *newMintAmtFloat
Expand Down

0 comments on commit 050e08d

Please sign in to comment.