Skip to content

Commit

Permalink
handle more coin errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Anil K authored and Anil K committed Oct 13, 2023
1 parent 38fe83d commit 056867f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion x/claim/keeper/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,18 @@ func (k Keeper) UpdateClaimRecord(ctx sdk.Context, claimRecord types.ClaimRecord
if len(existingClaimRecord.ClaimableAmount) != 0 {
amountInt := existingClaimRecord.ClaimableAmount[0].Amount
if amountInt.IsZero() {
fmt.Println("Old Amount:", amountInt, existingClaimRecord.ClaimableAmount[0])
newAmount := amountInt.Int64() / int643800 * int649322

fmt.Println("************ NEW AMOUNT ***************: ", newAmount)

newCoin := sdk.NewCoin(claimRecord.ClaimableAmount[0].Denom, sdk.NewInt(newAmount))

effectiveAmount = newCoin.Sub(existingClaimRecord.ClaimableAmount[0])
effectiveAmount, err = newCoin.SafeSub(existingClaimRecord.ClaimableAmount[0])

Check failure on line 104 in x/claim/keeper/claim.go

View workflow job for this annotation

GitHub Actions / Build

newCoin.SafeSub undefined (type "github.com/cosmos/cosmos-sdk/types".Coin has no field or method SafeSub)

Check failure on line 104 in x/claim/keeper/claim.go

View workflow job for this annotation

GitHub Actions / Tests and code coverage

newCoin.SafeSub undefined (type "github.com/cosmos/cosmos-sdk/types".Coin has no field or method SafeSub)

if err != nil {
return sdk.Coin{}, err
}

fmt.Println("************ Effective Amount ***************: ", effectiveAmount)

Expand Down

0 comments on commit 056867f

Please sign in to comment.