-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefix.go
43 lines (37 loc) · 1.39 KB
/
prefix.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package app
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/furya-network/furya/app/params"
)
const (
// AccountAddressPrefix prefix used for generating account address
AccountAddressPrefix = "furya"
)
var (
// AccountPubKeyPrefix used for generating public key
AccountPubKeyPrefix = AccountAddressPrefix + "pub"
// ValidatorAddressPrefix used for generating validator address
ValidatorAddressPrefix = AccountAddressPrefix + "valoper"
// ValidatorPubKeyPrefix used for generating validator public key
ValidatorPubKeyPrefix = AccountAddressPrefix + "valoperpub"
// ConsNodeAddressPrefix used for generating consensus node address
ConsNodeAddressPrefix = AccountAddressPrefix + "valcons"
// ConsNodePubKeyPrefix used for generating consensus node public key
ConsNodePubKeyPrefix = AccountAddressPrefix + "valconspub"
)
// SetConfig sets prefixes configuration
func SetConfig() {
config := sdk.GetConfig()
config.SetBech32PrefixForAccount(AccountAddressPrefix, AccountPubKeyPrefix)
config.SetBech32PrefixForValidator(ValidatorAddressPrefix, ValidatorPubKeyPrefix)
config.SetBech32PrefixForConsensusNode(ConsNodeAddressPrefix, ConsNodePubKeyPrefix)
err := sdk.RegisterDenom(params.HumanCoinUnit, sdk.OneDec())
if err != nil {
panic(err)
}
err = sdk.RegisterDenom(params.BaseCoinUnit, sdk.NewDecWithPrec(1, params.FURYAExponent))
if err != nil {
panic(err)
}
config.Seal()
}