From 54d8da780a57d051571305ff945b65bfe595aad9 Mon Sep 17 00:00:00 2001 From: Aaron Choo Date: Mon, 28 Aug 2023 14:27:57 +0800 Subject: [PATCH] fix: use coin type `330` (#23) --- app/app.go | 6 +++++- cmd/feather-cored/cmd/config.go | 11 +++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/app.go b/app/app.go index 55ddf62..2645b1f 100644 --- a/app/app.go +++ b/app/app.go @@ -163,12 +163,13 @@ import ( wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" ) -// DO NOT change the names of these variables! They are populated by the `init` function. +// DO NOT change the names and values of these variables! They are populated by the `init` function. // TODO: to prevent other users from changing these variables, we could probably just publish our own package like https://pkg.go.dev/github.com/cosmos/cosmos-sdk/version var ( AccountAddressPrefix string Name string BondDenom string + CoinType uint32 ) // TODO: What is this? @@ -261,6 +262,9 @@ func init() { Name = config.AppName BondDenom = config.BondDenom AccountAddressPrefix = config.AddressPrefix + // Feather chains' coin type should follow Terra's coin type. + // WARNING: changing this value will break feather's assumptions and functionalities. + CoinType = 330 // Set default home dir for app at ~/. userHomeDir, err := os.UserHomeDir() diff --git a/cmd/feather-cored/cmd/config.go b/cmd/feather-cored/cmd/config.go index 4432f97..bf6253e 100644 --- a/cmd/feather-cored/cmd/config.go +++ b/cmd/feather-cored/cmd/config.go @@ -7,20 +7,19 @@ import ( ) func initSDKConfig() { - // Set and seal config + // Set prefixes accountPubKeyPrefix := app.AccountAddressPrefix + "pub" validatorAddressPrefix := app.AccountAddressPrefix + "valoper" validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" + + // Set and seal config config := sdk.GetConfig() config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) + config.SetCoinType(app.CoinType) // Set coin type + sdk.DefaultBondDenom = app.BondDenom // Set default bond denom config.Seal() - - // Set other sdk overrides - - // change the default denomination in genesis - sdk.DefaultBondDenom = app.BondDenom }