Skip to content

Commit

Permalink
Add safe round up to division
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Jun 6, 2024
1 parent 8b379cc commit 26cc06a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions x/market/keeper/drop.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func dropAmounts(drops sdk.Int, pool types.Pool, member1 types.Member, member2 t
tmp := big.NewInt(0)
tmp.Mul(drops.BigInt(), member1.Balance.BigInt())
tmp.Quo(tmp, pool.Drops.BigInt())
dropAmtMember1 := sdk.NewIntFromBigInt(tmp)
dropAmtMember1 := sdk.NewIntFromBigInt(tmp).Add(sdk.NewIntFromUint64(1))
tmp = big.NewInt(0)

if dropAmtMember1.LTE(sdk.ZeroInt()) {
Expand All @@ -408,7 +408,7 @@ func dropAmounts(drops sdk.Int, pool types.Pool, member1 types.Member, member2 t
// `dropAmtMember2 = (drops * member2.Balance) / pool.Drops`
tmp.Mul(drops.BigInt(), member2.Balance.BigInt())
tmp.Quo(tmp, pool.Drops.BigInt())
dropAmtMember2 := sdk.NewIntFromBigInt(tmp)
dropAmtMember2 := sdk.NewIntFromBigInt(tmp).Add(sdk.NewIntFromUint64(1))
//tmp = big.NewInt(0)

if dropAmtMember2.LTE(sdk.ZeroInt()) {
Expand Down

0 comments on commit 26cc06a

Please sign in to comment.