cosmos-sdk/x/genaccounts/init.go

19 lines
495 B
Go

package genaccounts
import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
)
// initialize accounts and deliver genesis transactions
func InitGenesis(ctx sdk.Context, _ *codec.Codec, accountKeeper AccountKeeper, genesisState GenesisState) {
genesisState.Sanitize()
// load the accounts
for _, gacc := range genesisState {
acc := gacc.ToAccount()
acc = accountKeeper.NewAccount(ctx, acc) // set account number
accountKeeper.SetAccount(ctx, acc)
}
}