Skip to content

Commit

Permalink
chore(types): add MustAccAddressFromBech32 util func (#361)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
mattverse and mergify[bot] committed Oct 13, 2022
1 parent aa8367b commit a9dfefa
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions x/authz/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,14 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data *authz.GenesisState) {
continue
}

grantee, err := sdk.AccAddressFromBech32(entry.Grantee)
if err != nil {
panic(err)
}

granter, err := sdk.AccAddressFromBech32(entry.Granter)
if err != nil {
panic(err)
}

grantee := sdk.MustAccAddressFromBech32(entry.Grantee)
granter := sdk.MustAccAddressFromBech32(entry.Granter)
a, ok := entry.Authorization.GetCachedValue().(authz.Authorization)
if !ok {
panic("expected authorization")
}

err = k.SaveGrant(ctx, grantee, granter, a, entry.Expiration)
err := k.SaveGrant(ctx, grantee, granter, a, entry.Expiration)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit a9dfefa

Please sign in to comment.