-
Notifications
You must be signed in to change notification settings - Fork 12
/
app.go
71 lines (58 loc) · 2.07 KB
/
app.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
package simapp
import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
fxapp "github.com/functionx/fx-core/v2/app"
"github.com/functionx/fx-core/v2/app/helpers"
)
var (
// _ ibctesting.TestingApp = (*SimApp)(nil)
)
type SimApp struct {
*fxapp.App
// make scoped keepers public for test purposes
//ScopedIBCMockKeeper capabilitykeeper.ScopedKeeper
}
func (app *SimApp) GetAccountKeeper() authkeeper.AccountKeeper {
return app.AccountKeeper
}
// TestingApp functions
// GetBaseApp implements the TestingApp interface.
func (app *SimApp) GetBaseApp() *baseapp.BaseApp {
return app.BaseApp
}
// GetStakingKeeper implements the TestingApp interface.
func (app *SimApp) GetStakingKeeper() stakingkeeper.Keeper {
return app.StakingKeeper
}
// GetIBCKeeper implements the TestingApp interface.
func (app *SimApp) GetIBCKeeper() *ibckeeper.Keeper {
return app.IBCKeeper
}
// GetScopedIBCKeeper implements the TestingApp interface.
func (app *SimApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper {
return app.ScopedIBCKeeper
}
// GetTxConfig implements the TestingApp interface.
func (app *SimApp) GetTxConfig() client.TxConfig {
return fxapp.MakeEncodingConfig().TxConfig
}
func NewSimApp() *SimApp {
db := dbm.NewMemDB()
encCdc := fxapp.MakeEncodingConfig()
fxApp := fxapp.New(log.NewNopLogger(), db, nil, true, map[int64]bool{}, fxapp.DefaultNodeHome, 5, encCdc, helpers.EmptyAppOptions{})
// NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do
// not replicate if you do not need to test core IBC or light clients.
//scopedIBCMockKeeper := fxApp.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName)
app := &SimApp{
App: fxApp,
//ScopedIBCMockKeeper: scopedIBCMockKeeper,
}
return app
}