Skip to content

Commit

Permalink
fix: do not block bank sends to stakeibc module accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
hallazzang committed Jun 20, 2024
1 parent 6672cb2 commit 9640044
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ import (
apphook "github.com/milkyway-labs/milkyway/app/hook"
ibcwasmhooks "github.com/milkyway-labs/milkyway/app/ibc-hooks"
appkeepers "github.com/milkyway-labs/milkyway/app/keepers"
"github.com/milkyway-labs/milkyway/utils"
"github.com/milkyway-labs/milkyway/x/bank"
bankkeeper "github.com/milkyway-labs/milkyway/x/bank/keeper"
"github.com/milkyway-labs/milkyway/x/epochs"
Expand Down Expand Up @@ -417,7 +418,7 @@ func NewMilkyWayApp(
appCodec,
runtime.NewKVStoreService(keys[banktypes.StoreKey]),
app.AccountKeeper,
app.ModuleAccountAddrs(),
app.BlacklistedModuleAccountAddrs(),
authorityAddr,
logger,
)
Expand Down Expand Up @@ -1306,6 +1307,21 @@ func (app *MilkyWayApp) ModuleAccountAddrs() map[string]bool {
return modAccAddrs
}

// ModuleAccountAddrs returns all the app's module account addresses.
func (app *MilkyWayApp) BlacklistedModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool)
// DO NOT REMOVE: StringMapKeys fixes non-deterministic map iteration
for _, acc := range utils.StringMapKeys(maccPerms) {
// don't blacklist stakeibc module account, so that it can ibc transfer tokens
if acc == stakeibctypes.ModuleName ||
acc == stakeibctypes.RewardCollectorName {
continue
}
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
}
return modAccAddrs
}

// LegacyAmino returns SimApp's amino codec.
//
// NOTE: This is solely to be used for testing purposes as it may be desirable
Expand Down

0 comments on commit 9640044

Please sign in to comment.