Skip to content

Commit

Permalink
feat(golang): add module account for provisioning
Browse files Browse the repository at this point in the history
 - vbank/provision, which is _not_ blocked
   from receiving funds
  • Loading branch information
dckc committed Sep 13, 2022
1 parent b7b0df2 commit 6f4e845
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
18 changes: 17 additions & 1 deletion golang/cosmos/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ var (
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
vbank.ModuleName: {authtypes.Minter, authtypes.Burner},
vbanktypes.ReservePoolName: nil,
vbanktypes.ProvisionPoolName: nil,
vbanktypes.GiveawayPoolName: nil,
}
)
Expand Down Expand Up @@ -348,7 +349,7 @@ func NewAgoricApp(
keys[banktypes.StoreKey],
app.AccountKeeper,
app.GetSubspace(banktypes.ModuleName),
app.ModuleAccountAddrs(),
app.BlockedAddrs(),
)
app.AuthzKeeper = authzkeeper.NewKeeper(
keys[authzkeeper.StoreKey],
Expand Down Expand Up @@ -835,6 +836,21 @@ func (app *GaiaApp) ModuleAccountAddrs() map[string]bool {
return modAccAddrs
}

// BlockedAddrs returns the app's module account addresses that
// are blocked from receiving funds.
func (app *GaiaApp) BlockedAddrs() map[string]bool {
modAccAddrs := make(map[string]bool)
for acc := range maccPerms {
// The provision pool is not blocked from receiving funds.
if acc == vbanktypes.ProvisionPoolName {
continue
}
modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true
}

return modAccAddrs
}

// LegacyAmino returns GaiaApp's amino codec.
//
// NOTE: This is solely to be used for testing purposes as it may be desirable
Expand Down
1 change: 1 addition & 0 deletions golang/cosmos/x/vbank/types/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ const (

ReservePoolName = "vbank/reserve"
GiveawayPoolName = "vbank/giveaway"
ProvisionPoolName = "vbank/provision"
)

0 comments on commit 6f4e845

Please sign in to comment.