-
Notifications
You must be signed in to change notification settings - Fork 1
/
runtime.go
82 lines (69 loc) · 1.7 KB
/
runtime.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package types
// MUST be loaded before running
import (
"math"
"os"
"path/filepath"
"github.com/tendermint/tendermint/crypto"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/nimrostafarian/gridfury/address"
tokentypes "github.com/irisnet/irismod/modules/token/types"
tokenv1 "github.com/irisnet/irismod/modules/token/types/v1"
)
const (
AppName = "FuryApp"
)
var (
NativeToken tokenv1.Token
EvmToken tokenv1.Token
DefaultNodeHome string
)
func init() {
// set bech32 prefix
address.ConfigureBech32Prefix()
// set coin denom regexs
sdk.SetCoinDenomRegex(func() string {
return `[a-zA-Z][a-zA-Z0-9/-]{2,127}`
})
NativeToken = tokenv1.Token{
Symbol: "grid",
Name: "Furyhub staking token",
Scale: 6,
MinUnit: "ugrid",
InitialSupply: 2000000000,
MaxSupply: 10000000000,
Mintable: true,
Owner: sdk.AccAddress(crypto.AddressHash([]byte(tokentypes.ModuleName))).String(),
}
// TODO
EvmToken = tokenv1.Token{
Symbol: "eth",
Name: "Furyhub evm token",
Scale: 18,
MinUnit: "wei",
InitialSupply: 0,
MaxSupply: math.MaxUint64,
Mintable: true,
Owner: sdk.AccAddress(crypto.AddressHash([]byte(tokentypes.ModuleName))).String(),
}
userHomeDir, err := os.UserHomeDir()
if err != nil {
panic(err)
}
DefaultNodeHome = filepath.Join(userHomeDir, ".grid")
owner, err := sdk.AccAddressFromBech32(NativeToken.Owner)
if err != nil {
panic(err)
}
// replace the default token
tokenv1.SetNativeToken(
NativeToken.Symbol,
NativeToken.Name,
NativeToken.MinUnit,
NativeToken.Scale,
NativeToken.InitialSupply,
NativeToken.MaxSupply,
NativeToken.Mintable,
owner,
)
}