From f2fa91c3727dcf1eb3b1eccf3710c407ed21e61f Mon Sep 17 00:00:00 2001 From: milad Date: Tue, 28 Nov 2023 13:11:37 +0330 Subject: [PATCH] addressed PR comments --- modules/bank/handle_msg.go | 2 +- modules/bank/module.go | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/modules/bank/handle_msg.go b/modules/bank/handle_msg.go index cabe292bf..c98624a70 100644 --- a/modules/bank/handle_msg.go +++ b/modules/bank/handle_msg.go @@ -63,7 +63,7 @@ func (m *Module) updateBalanceForEventType(index int, tx *juno.Tx, eventType str return err } - if coin.Denom == m.govDenom { + if coin.Denom == m.baseDenom { continue } diff --git a/modules/bank/module.go b/modules/bank/module.go index aa7e904ce..3ab11fe75 100644 --- a/modules/bank/module.go +++ b/modules/bank/module.go @@ -9,6 +9,8 @@ import ( junomessages "github.com/forbole/juno/v5/modules/messages" "github.com/forbole/juno/v5/modules" + + "github.com/CoreumFoundation/coreum/v3/pkg/config/constant" ) var ( @@ -23,7 +25,7 @@ type Module struct { messageParser junomessages.MessageAddressesParser keeper source.Source - govDenom string + baseDenom string } // NewModule returns a new Module instance @@ -39,7 +41,7 @@ func NewModule( db: db, messageParser: messageParser, keeper: keeper, - govDenom: getGovTokenFromAddressPrefix(addressPrefix), + baseDenom: getBaseTokenFromAddressPrefix(addressPrefix), } } @@ -48,14 +50,14 @@ func (m *Module) Name() string { return "bank" } -func getGovTokenFromAddressPrefix(addressPrefix string) string { +func getBaseTokenFromAddressPrefix(addressPrefix string) string { switch addressPrefix { - case "core": - return "ucore" - case "testcore": - return "utestcore" - case "devcore": - return "udevcore" + case constant.AddressPrefixMain: + return constant.DenomMain + case constant.AddressPrefixTest: + return constant.DenomTest + case constant.AddressPrefixDev: + return constant.DenomDev default: return "" }