2018-04-06 22:12:00 -07:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
2018-05-01 13:41:04 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/wire"
|
2018-04-06 22:12:00 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
2018-04-06 22:50:46 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/stake"
|
2018-04-06 22:12:00 -07:00
|
|
|
|
2018-06-28 17:54:47 -07:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
2018-04-06 22:12:00 -07:00
|
|
|
)
|
|
|
|
|
2018-04-06 22:50:46 -07:00
|
|
|
func setGenesis(gapp *GaiaApp, accs ...*auth.BaseAccount) error {
|
2018-04-06 22:12:00 -07:00
|
|
|
genaccs := make([]GenesisAccount, len(accs))
|
|
|
|
for i, acc := range accs {
|
|
|
|
genaccs[i] = NewGenesisAccount(acc)
|
|
|
|
}
|
|
|
|
|
|
|
|
genesisState := GenesisState{
|
2018-04-06 22:50:46 -07:00
|
|
|
Accounts: genaccs,
|
2018-04-30 23:07:06 -07:00
|
|
|
StakeData: stake.DefaultGenesisState(),
|
2018-04-06 22:12:00 -07:00
|
|
|
}
|
|
|
|
|
2018-05-01 13:41:04 -07:00
|
|
|
stateBytes, err := wire.MarshalJSONIndent(gapp.cdc, genesisState)
|
2018-04-06 22:12:00 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize the chain
|
|
|
|
vals := []abci.Validator{}
|
2018-06-04 16:42:01 -07:00
|
|
|
gapp.InitChain(abci.RequestInitChain{Validators: vals, AppStateBytes: stateBytes})
|
2018-04-06 22:12:00 -07:00
|
|
|
gapp.Commit()
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|