diff --git a/app/app.go b/app/app.go index eed6fe02..9feecfcc 100644 --- a/app/app.go +++ b/app/app.go @@ -268,6 +268,16 @@ type App struct { configurator module.Configurator } +func init() { + sdk.SetCoinDenomRegex(MantraCoinDenomRegex) +} + +// MantraCoinDenomRegex returns the mantra regex string +// this is used to override the default sdk coin denom regex +func MantraCoinDenomRegex() string { + return `[a-zA-Z][a-zA-Z0-9/:._-]{1,127}` +} + // New returns a reference to an initialized App. func New( logger log.Logger, diff --git a/app/params/config.go b/app/params/config.go index 5daa33eb..08e89f19 100644 --- a/app/params/config.go +++ b/app/params/config.go @@ -1,19 +1,10 @@ package params import ( - "cosmossdk.io/math" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" sdk "github.com/cosmos/cosmos-sdk/types" ) -const ( - HumanCoinUnit = "om" - BaseCoinUnit = "uom" - OmExponent = 6 - - DefaultBondDenom = BaseCoinUnit -) - var ( Bech32Prefix = "mantra" // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key. @@ -29,27 +20,7 @@ var ( ) func init() { - sdk.SetCoinDenomRegex(MantraCoinDenomRegex) SetAddressPrefixes() - RegisterDenoms() -} - -// MantraCoinDenomRegex returns the mantra regex string -// this is used to override the default sdk coin denom regex -func MantraCoinDenomRegex() string { - return `[a-zA-Z][a-zA-Z0-9/:._-]{1,127}` -} - -// RegisterDenoms registers token denoms. -func RegisterDenoms() { - err := sdk.RegisterDenom(HumanCoinUnit, math.LegacyOneDec()) - if err != nil { - panic(err) - } - err = sdk.RegisterDenom(BaseCoinUnit, math.LegacyNewDecWithPrec(1, OmExponent)) - if err != nil { - panic(err) - } } // SetAddressPrefixes builds the Config with Bech32 addressPrefix and publKeyPrefix for accounts, validators, and consensus nodes and verifies that addreeses have correct format.