From a97614a7f5b74deefc8191b9e0925d2ae3de5710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Eckel?= Date: Tue, 23 Apr 2024 11:37:53 +0200 Subject: [PATCH] improved code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jürgen Eckel --- util/issue_commands.go | 10 +++------- x/machine/keeper/msg_server_attest_machine.go | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/util/issue_commands.go b/util/issue_commands.go index e11e874..89d42a8 100644 --- a/util/issue_commands.go +++ b/util/issue_commands.go @@ -101,18 +101,14 @@ func SendUpdateRedeemClaim(goCtx context.Context, beneficiary string, id uint64, buildSignBroadcastTx(goCtx, loggingContext, sendingValidatorAddress, msg) } -func SendPLMNTTokens(goCtx context.Context, beneficiary sdk.AccAddress, amount uint64, denominator string) { +func SendTokens(goCtx context.Context, beneficiary sdk.AccAddress, amount uint64, denominator string) { sendingValidatorAddress := config.GetConfig().ValidatorAddress coin := sdk.NewCoin(denominator, sdk.NewIntFromUint64(amount)) coins := sdk.NewCoins(coin) - orgAddr, err := sdk.AccAddressFromBech32(sendingValidatorAddress) - if err != nil { - ctx := sdk.UnwrapSDKContext(goCtx) - GetAppLogger().Error(ctx, "sending PLMNT tokens: couldn't convert validator address to Address object") - } + orgAddr := sdk.MustAccAddressFromBech32(sendingValidatorAddress) msg := banktypes.NewMsgSend(orgAddr, beneficiary, coins) - loggingContext := "sending PLMNT tokens" + loggingContext := "sending " + denominator + " tokens" buildSignBroadcastTx(goCtx, loggingContext, sendingValidatorAddress, msg) } diff --git a/x/machine/keeper/msg_server_attest_machine.go b/x/machine/keeper/msg_server_attest_machine.go index 8d73605..21e952e 100644 --- a/x/machine/keeper/msg_server_attest_machine.go +++ b/x/machine/keeper/msg_server_attest_machine.go @@ -77,7 +77,7 @@ func (k msgServer) sendInitialFundingTokensToMachine(goCtx context.Context, mach logMsg := fmt.Sprintf("transferring %v tokens to address %s", keeperParams.GetDaoMachineFundingAmount(), machineAddress.String()) util.GetAppLogger().Info(ctx, logMsg) - util.SendPLMNTTokens(goCtx, machineAddress, keeperParams.GetDaoMachineFundingAmount(), keeperParams.DaoMachineFundingDenom) + util.SendTokens(goCtx, machineAddress, keeperParams.GetDaoMachineFundingAmount(), keeperParams.GetDaoMachineFundingDenom()) } func validateExtendedPublicKey(issuer string, cfg chaincfg.Params) bool {