-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK Core Audit - simapp updates #9315
Changes from 4 commits
750ed46
9f7cb02
8d42bee
685fb26
0bd7289
a8bfeb3
da4aad6
b5a95bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ import ( | |
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/errors" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" | ||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" | ||
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" | ||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
|
@@ -443,12 +444,12 @@ func (ao EmptyAppOptions) Get(o string) interface{} { | |
// | ||
// TODO: Instead of using the mint module account, which has the | ||
// permission of minting, create a "faucet" account. (@fdymylja) | ||
func FundAccount(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error { | ||
if err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil { | ||
func FundAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, addr sdk.AccAddress, amounts sdk.Coins) error { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addressing leftover comments from #8473 cc/ @robert-zaremba There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My main desire was to move this function away from the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @robert-zaremba makes sense, to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has received enough approvals, so let's tackle #9315 (comment) as part of a separate issue: #9346 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, we could put it to |
||
if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil { | ||
return err | ||
} | ||
|
||
return app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts) | ||
return bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts) | ||
} | ||
|
||
// FundModuleAccount is a utility function that funds a module account by | ||
|
@@ -457,10 +458,10 @@ func FundAccount(app *SimApp, ctx sdk.Context, addr sdk.AccAddress, amounts sdk. | |
// | ||
// TODO: Instead of using the mint module account, which has the | ||
// permission of minting, create a "faucet" account. (@fdymylja) | ||
func FundModuleAccount(app *SimApp, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error { | ||
if err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil { | ||
func FundModuleAccount(bankKeeper bankkeeper.Keeper, ctx sdk.Context, recipientMod string, amounts sdk.Coins) error { | ||
if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil { | ||
return err | ||
} | ||
|
||
return app.BankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, recipientMod, amounts) | ||
return bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, recipientMod, amounts) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ref: #8473 cc/ @robert-zaremba