diff --git a/x/tokenmint/keeper/mint.go b/x/tokenmint/keeper/mint.go index 0a803774d..a98c495f5 100644 --- a/x/tokenmint/keeper/mint.go +++ b/x/tokenmint/keeper/mint.go @@ -110,7 +110,12 @@ func (k *Keeper) MintNewTokensForApp(ctx sdk.Context, appMappingId uint64, asset if err := k.MintCoin(ctx, types.ModuleName, sdk.NewCoin(assetData.Denom, amount)); err != nil { return err } - if err := k.SendCoinFromModuleToAccount(ctx, types.ModuleName, sdk.AccAddress(address), sdk.NewCoin(assetData.Denom, amount)); err != nil { + userAddress, err := sdk.AccAddressFromBech32(address) + + if err != nil { + return err + } + if err := k.SendCoinFromModuleToAccount(ctx, types.ModuleName, userAddress, sdk.NewCoin(assetData.Denom, amount)); err != nil { return err } k.UpdateAssetDataInTokenMintByApp(ctx, appMappingId, assetId, true, amount) diff --git a/x/tokenmint/keeper/msg_server.go b/x/tokenmint/keeper/msg_server.go index d1cffb120..89e711da1 100644 --- a/x/tokenmint/keeper/msg_server.go +++ b/x/tokenmint/keeper/msg_server.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "time" "github.com/comdex-official/comdex/x/tokenmint/types" @@ -92,7 +93,12 @@ func (k *msgServer) MsgMintNewTokens(c context.Context, msg *types.MsgMintNewTok if err := k.MintCoin(ctx, types.ModuleName, sdk.NewCoin(assetData.Denom, *assetDataInApp.GenesisSupply)); err != nil { return nil, err } - if err := k.SendCoinFromModuleToAccount(ctx, types.ModuleName, sdk.AccAddress(assetDataInApp.Recipient), sdk.NewCoin(assetData.Denom, *assetDataInApp.GenesisSupply)); err != nil { + userAddress, err := sdk.AccAddressFromBech32(assetDataInApp.Recipient) + + if err != nil { + return nil, err + } + if err := k.SendCoinFromModuleToAccount(ctx, types.ModuleName, userAddress, sdk.NewCoin(assetData.Denom, *assetDataInApp.GenesisSupply)); err != nil { return nil, err } @@ -112,13 +118,20 @@ func (k *msgServer) MsgMintNewTokens(c context.Context, msg *types.MsgMintNewTok if found { return nil, types.ErrorGensisMintingForTokenalreadyDone } + userAddress, err := sdk.AccAddressFromBech32(assetDataInApp.Recipient) + + if err != nil { + return nil, err + } if err := k.MintCoin(ctx, types.ModuleName, sdk.NewCoin(assetData.Denom, *assetDataInApp.GenesisSupply)); err != nil { return nil, err } - if err := k.SendCoinFromModuleToAccount(ctx, types.ModuleName, sdk.AccAddress(assetDataInApp.Recipient), sdk.NewCoin(assetData.Denom, *assetDataInApp.GenesisSupply)); err != nil { + fmt.Println(types.ModuleName, "module name ") + if err := k.SendCoinFromModuleToAccount(ctx, types.ModuleName, userAddress, sdk.NewCoin(assetData.Denom, *assetDataInApp.GenesisSupply)); err != nil { return nil, err } + // fmt.Println(sdk.AccAddress(assetDataInApp.Recipient), "reciepient address ") var newTokenMintappData types.MintedTokens newTokenMintappData.AssetId = msg.AssetId