forked from osmosis-labs/osmosis
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.go
63 lines (55 loc) · 2.18 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
59
60
61
62
63
package app
import (
"fmt"
"time"
dbm "github.com/cometbft/cometbft-db"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/testutil/network"
sims "github.com/cosmos/cosmos-sdk/testutil/sims"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
pruningtypes "github.com/cosmos/cosmos-sdk/store/pruning/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
)
// DefaultConfig returns a default configuration suitable for nearly all
// testing requirements.
func DefaultConfig() network.Config {
encCfg := MakeEncodingConfig()
return network.Config{
Codec: encCfg.Marshaler,
TxConfig: encCfg.TxConfig,
LegacyAmino: encCfg.Amino,
InterfaceRegistry: encCfg.InterfaceRegistry,
AccountRetriever: authtypes.AccountRetriever{},
AppConstructor: NewAppConstructor("osmosis-code-test"),
GenesisState: ModuleBasics.DefaultGenesis(encCfg.Marshaler),
TimeoutCommit: 1 * time.Second / 2,
ChainID: "osmosis-code-test",
NumValidators: 1,
BondDenom: sdk.DefaultBondDenom,
MinGasPrices: fmt.Sprintf("0.000006%s", sdk.DefaultBondDenom),
AccountTokens: sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction),
StakingTokens: sdk.TokensFromConsensusPower(500, sdk.DefaultPowerReduction),
BondedTokens: sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction),
PruningStrategy: pruningtypes.PruningOptionNothing,
CleanupDir: true,
SigningAlgo: string(hd.Secp256k1Type),
KeyringOptions: []keyring.Option{},
}
}
// NewAppConstructor returns a new Osmosis app given encoding type configs.
func NewAppConstructor(chainId string) network.AppConstructor {
return func(val network.ValidatorI) servertypes.Application {
valCtx := val.GetCtx()
appConfig := val.GetAppConfig()
return NewOsmosisApp(
valCtx.Logger, dbm.NewMemDB(), nil, true, make(map[int64]bool), valCtx.Config.RootDir, 0,
sims.EmptyAppOptions{},
EmptyWasmOpts,
baseapp.SetMinGasPrices(appConfig.MinGasPrices),
baseapp.SetChainID(chainId),
)
}
}