Skip to content

Commit

Permalink
set customizable authority
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jul 20, 2022
1 parent 4aecd3c commit 5f9ce38
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions x/bank/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/bank/client/cli"
"github.com/cosmos/cosmos-sdk/x/bank/exported"
"github.com/cosmos/cosmos-sdk/x/bank/keeper"
v1bank "github.com/cosmos/cosmos-sdk/x/bank/migrations/v1"
"github.com/cosmos/cosmos-sdk/x/bank/simulation"
"github.com/cosmos/cosmos-sdk/x/bank/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
)

// ConsensusVersion defines the current x/bank module consensus version.
Expand Down Expand Up @@ -231,7 +233,7 @@ type bankInputs struct {
Key *store.KVStoreKey

AccountKeeper types.AccountKeeper
Authority types.Authority
Authority types.Authority `optional:"true"`

// LegacySubspace is used solely for migration of x/params managed parameters
LegacySubspace exported.Subspace
Expand Down Expand Up @@ -261,12 +263,18 @@ func provideModule(in bankInputs) bankOutputs {
}
}

authority := in.Authority
if authority == nil || len(authority) == 0 {
// default to governance authority if not provided
authority = types.Authority(authtypes.NewModuleAddress(govtypes.ModuleName))
}

bankKeeper := keeper.NewBaseKeeper(
in.Cdc,
in.Key,
in.AccountKeeper,
blockedAddresses,
in.Authority.String(),
authority.String(),
)
m := NewAppModule(in.Cdc, bankKeeper, in.AccountKeeper, in.LegacySubspace)

Expand Down

0 comments on commit 5f9ce38

Please sign in to comment.