Skip to content

Commit

Permalink
undo some unnecessary changes in auth
Browse files Browse the repository at this point in the history
  • Loading branch information
facundomedica committed Oct 21, 2024
1 parent 6919c4d commit 0d8f5c4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
10 changes: 0 additions & 10 deletions runtime/moduleaccounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ func (m *ModuleAccountsService) Register(moduleName string) error {
return nil
}

// func (m *ModuleAccountsService) Account(ctx context.Context, name string) (sdk.ModuleAccountI, error) {
// addr := m.accounts[name]
// if addr == nil {
// return nil, errors.Errorf("module account %s not registered", name)
// }

// acc := m.ak.GetOrSetModuleAccount(ctx, name, addr)
// return acc, nil
// }

// Address implements moduleaccounts.Service.
func (m *ModuleAccountsService) Address(name string) []byte {
return m.accounts[name]
Expand Down
19 changes: 0 additions & 19 deletions x/auth/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,25 +251,6 @@ func (ak AccountKeeper) GetModuleAddressAndPermissions(moduleName string) (addr
return permAddr.GetAddress(), permAddr.GetPermissions()
}

// GetOrSetModuleAccount hopefully temporary until I can figure out a better way to handle this @facu
func (ak AccountKeeper) GetOrSetModuleAccount(ctx context.Context, moduleName string, addr []byte) sdk.ModuleAccountI {
acc := ak.GetAccount(ctx, addr)
if acc != nil {
macc, ok := acc.(sdk.ModuleAccountI)
if !ok {
panic("account is not a module account")
}
return macc
}

// create a new module account
macc := types.NewEmptyModuleAccount(moduleName)
maccI := (ak.NewAccount(ctx, macc)).(sdk.ModuleAccountI) // set the account number
ak.SetModuleAccount(ctx, maccI)

return maccI
}

// GetModuleAccountAndPermissions gets the module account from the auth account store and its
// registered permissions
func (ak AccountKeeper) GetModuleAccountAndPermissions(ctx context.Context, moduleName string) (sdk.ModuleAccountI, []string) {
Expand Down

0 comments on commit 0d8f5c4

Please sign in to comment.