/
config.go
58 lines (49 loc) · 1.75 KB
/
config.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
package app
import (
serverconfig "github.com/cosmos/cosmos-sdk/server/config"
)
type AppConfig struct {
serverconfig.Config
CrossChain CrossChainConfig `mapstructure:"cross-chain"`
}
type CrossChainConfig struct {
SrcChainId uint32 `mapstructure:"src-chain-id"`
DestBscChainId uint32 `mapstructure:"dest-bsc-chain-id"`
DestOpChainId uint32 `mapstructure:"dest-op-chain-id"`
}
var CustomAppTemplate = serverconfig.DefaultConfigTemplate + `
###############################################################################
### CrossChain Config ###
###############################################################################
[cross-chain]
# chain-id for current chain
src-chain-id = {{ .CrossChain.SrcChainId }}
# chain-id for bsc destination chain
dest-bsc-chain-id = {{ .CrossChain.DestBscChainId }}
# chain-id for op bnb destination chain
dest-op-chain-id = {{ .CrossChain.DestOpChainId }}
`
func NewDefaultAppConfig() *AppConfig {
srvCfg := serverconfig.DefaultConfig()
// The SDK's default minimum gas price is set to "" (empty value) inside
// app.toml. If left empty by validators, the node will halt on startup.
// However, the chain developer can set a default app.toml value for their
// validators here.
//
// In summary:
// - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their
// own app.toml config,
// - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their
// own app.toml to override, or use this default value.
//
// In simapp, we set the min gas prices to 0.
srvCfg.MinGasPrices = "5000000000BNB" // 5gei
return &AppConfig{
Config: *srvCfg,
CrossChain: CrossChainConfig{
SrcChainId: 1,
DestBscChainId: 2,
DestOpChainId: 3,
},
}
}