-
Notifications
You must be signed in to change notification settings - Fork 119
/
test_common.go
32 lines (27 loc) · 1.14 KB
/
test_common.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
package test
import (
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
sifapp "github.com/Sifchain/sifnode/app"
)
func CreateTestApp(isCheckTx bool) (*sifapp.SifchainApp, sdk.Context) {
app := sifapp.Setup(isCheckTx)
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
app.AccountKeeper.SetParams(ctx, authtypes.DefaultParams())
initTokens := sdk.TokensFromConsensusPower(1000, sdk.DefaultPowerReduction)
_ = sifapp.AddTestAddrs(app, ctx, 6, initTokens)
return app, ctx
}
func CreateTestAppMargin(isCheckTx bool) (sdk.Context, *sifapp.SifchainApp) {
sifapp.SetConfig((false))
app := sifapp.Setup(isCheckTx)
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
return ctx, app
}
func CreateTestAppMarginFromGenesis(isCheckTx bool, genesisTransformer func(*sifapp.SifchainApp, sifapp.GenesisState) sifapp.GenesisState) (sdk.Context, *sifapp.SifchainApp) {
sifapp.SetConfig(false)
app := sifapp.SetupFromGenesis(isCheckTx, genesisTransformer)
ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{})
return ctx, app
}