From 441cc0627f99d4bfab845636878fd63233a49325 Mon Sep 17 00:00:00 2001 From: Luis Carvalho Date: Mon, 2 Sep 2024 19:49:40 +0100 Subject: [PATCH] fix: set light node sale amount in GRAIN (#1280) # Related Github tickets - https://github.com/VolumeFi/paloma/issues/2105 # Background Fix the units on the node sale amounts. # Testing completed - [ ] test coverage exists or has been added/updated - [ ] tested in a private testnet # Breaking changes - [ ] I have checked my code for breaking changes - [ ] If there are breaking changes, there is a supporting migration. --- x/paloma/keeper/keeper.go | 4 +++- x/paloma/keeper/keeper_test.go | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/x/paloma/keeper/keeper.go b/x/paloma/keeper/keeper.go index 59a18eb3b..c6cfc95c3 100644 --- a/x/paloma/keeper/keeper.go +++ b/x/paloma/keeper/keeper.go @@ -329,7 +329,9 @@ func (k Keeper) CreateSaleLightNodeClientLicense( clientAddr string, amount math.Int, ) error { - coin := sdk.NewCoin(k.bondDenom, amount) + // The amount will be set in GRAIN, but we want it here in uGRAIN, so we + // need to multiply by 1_000_000 + coin := sdk.NewCoin(k.bondDenom, amount.Mul(math.NewInt(1_000_000))) feegranter, err := k.LightNodeClientFeegranter(ctx) if err != nil { diff --git a/x/paloma/keeper/keeper_test.go b/x/paloma/keeper/keeper_test.go index 8b7f28f6d..65d974db0 100644 --- a/x/paloma/keeper/keeper_test.go +++ b/x/paloma/keeper/keeper_test.go @@ -219,7 +219,10 @@ func TestCreateSaleLightNodeClientLicense(t *testing.T) { amount := math.NewInt(100) license := &types.LightNodeClientLicense{ ClientAddress: clientAddr, - Amount: sdk.Coin{Amount: amount, Denom: testBondDenom}, + Amount: sdk.Coin{ + Amount: amount.Mul(math.NewInt(1_000_000)), + Denom: testBondDenom, + }, VestingMonths: 24, }