From 660e601b74090bafefc618cf2fca736c47831631 Mon Sep 17 00:00:00 2001 From: Hieu Vu <72878483+hieuvubk@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:37:57 +0700 Subject: [PATCH] rename --- x/bank/v2/depinject.go | 4 ++-- x/bank/v2/keeper/keeper.go | 8 ++++---- x/bank/v2/types/expected_keepers.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/x/bank/v2/depinject.go b/x/bank/v2/depinject.go index a7df5a89afc0..2ba0128bc40d 100644 --- a/x/bank/v2/depinject.go +++ b/x/bank/v2/depinject.go @@ -32,7 +32,7 @@ type ModuleInputs struct { Cdc codec.Codec Environment appmodule.Environment AddressCodec address.Codec - AccountKeeper types.AccountKeeper + AuthKeeper types.AuthKeeper } type ModuleOutputs struct { @@ -54,7 +54,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { } } - k := keeper.NewKeeper(authority, in.AddressCodec, in.Environment, in.Cdc, in.AccountKeeper) + k := keeper.NewKeeper(authority, in.AddressCodec, in.Environment, in.Cdc, in.AuthKeeper) m := NewAppModule(in.Cdc, k) return ModuleOutputs{ diff --git a/x/bank/v2/keeper/keeper.go b/x/bank/v2/keeper/keeper.go index ab84d084d88d..8f2dcbf8c644 100644 --- a/x/bank/v2/keeper/keeper.go +++ b/x/bank/v2/keeper/keeper.go @@ -24,7 +24,7 @@ import ( type Keeper struct { appmodulev2.Environment - ak types.AccountKeeper + ak types.AuthKeeper authority []byte addressCodec address.Codec schema collections.Schema @@ -33,7 +33,7 @@ type Keeper struct { supply collections.Map[string, math.Int] } -func NewKeeper(authority []byte, addressCodec address.Codec, env appmodulev2.Environment, cdc codec.BinaryCodec, ak types.AccountKeeper) *Keeper { +func NewKeeper(authority []byte, addressCodec address.Codec, env appmodulev2.Environment, cdc codec.BinaryCodec, ak types.AuthKeeper) *Keeper { sb := collections.NewSchemaBuilder(env.KVStoreService) k := &Keeper{ @@ -58,7 +58,7 @@ func NewKeeper(authority []byte, addressCodec address.Codec, env appmodulev2.Env // MintCoins creates new coins from thin air and adds it to the module account. // An error is returned if the module account does not exist or is unauthorized. func (k Keeper) MintCoins(ctx context.Context, moduleName string, amounts sdk.Coins) error { - + // TODO: Mint restriction acc := k.ak.GetModuleAccount(ctx, moduleName) if acc == nil { @@ -129,7 +129,7 @@ func (k Keeper) SendCoins(ctx context.Context, from, to string, amt sdk.Coins) e return fmt.Errorf("%s is not an address or module name", to) } } - + // TODO: Send restriction err = k.subUnlockedCoins(ctx, fromAddr, amt) diff --git a/x/bank/v2/types/expected_keepers.go b/x/bank/v2/types/expected_keepers.go index 87a033a5e7fb..aecd62fd57d3 100644 --- a/x/bank/v2/types/expected_keepers.go +++ b/x/bank/v2/types/expected_keepers.go @@ -6,9 +6,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// AccountKeeper defines the account contract that must be fulfilled when +// AuthKeeper defines the account contract that must be fulfilled when // creating a x/bank keeper. -type AccountKeeper interface { +type AuthKeeper interface { GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI GetModuleAddress(moduleName string) sdk.AccAddress