-
Notifications
You must be signed in to change notification settings - Fork 119
/
test_common.go
30 lines (27 loc) · 1.02 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
package test
import (
sifapp "github.com/Sifchain/sifnode/app"
admintypes "github.com/Sifchain/sifnode/x/admin/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)
func CreateTestApp(isCheckTx bool) (*sifapp.SifchainApp, sdk.Context, string) {
sifapp.SetConfig(false)
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)
admin := sdk.AccAddress("addr1_______________")
app.AdminKeeper.InitGenesis(ctx, admintypes.GenesisState{AdminAccounts: GetAdmins(admin.String())})
return app, ctx, admin.String()
}
func GetAdmins(address string) []*admintypes.AdminAccount {
return []*admintypes.AdminAccount{
{
AdminType: admintypes.AdminType_TOKENREGISTRY,
AdminAddress: address,
},
}
}