Skip to content

Commit

Permalink
Merge branch 'stargate' of github.com:crypto-com/chain-main into star…
Browse files Browse the repository at this point in the history
…gate
  • Loading branch information
tomtau committed Sep 14, 2020
2 parents 39a742d + 2d6a634 commit eef87d0
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions app/prefix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package app

import (
"log"

sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
CoinType = 394
FundraiserPath = "44'/394'/0'/0/1"
)

var (
AccountAddressPrefix = "cro"
AccountPubKeyPrefix = "cropub"
ValidatorAddressPrefix = "crocncl"
ValidatorPubKeyPrefix = "crocnclpub"
ConsNodeAddressPrefix = "crocnclcons"
ConsNodePubKeyPrefix = "crocnclconspub"
HumanCoinUnit = "cro"
BaseCoinUnit = "basecro" // 10^-8 AKA "carson"
)

func SetConfig() {
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(AccountAddressPrefix, AccountPubKeyPrefix)
config.SetBech32PrefixForValidator(ValidatorAddressPrefix, ValidatorPubKeyPrefix)
config.SetBech32PrefixForConsensusNode(ConsNodeAddressPrefix, ConsNodePubKeyPrefix)

config.SetCoinType(CoinType)
config.SetFullFundraiserPath(FundraiserPath)

croUnit := sdk.OneDec()
err := sdk.RegisterDenom(HumanCoinUnit, croUnit)
if err != nil {
log.Fatal(err)
}

carsonUnit := sdk.NewDecWithPrec(1, 8) // 10^-8 (carson)
err = sdk.RegisterDenom(BaseCoinUnit, carsonUnit)

if err != nil {
log.Fatal(err)
}

config.Seal()
}
1 change: 1 addition & 0 deletions cmd/chain-maind/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
// NewRootCmd creates a new root command for simd. It is called once in the
// main function.
func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
app.SetConfig()
encodingConfig := app.MakeEncodingConfig()
initClientCtx := client.Context{}.
WithJSONMarshaler(encodingConfig.Marshaler).
Expand Down

0 comments on commit eef87d0

Please sign in to comment.