Skip to content

Commit

Permalink
revert part of 22ab451, and let calling modules manage the accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
jiujiteiro committed Apr 3, 2023
1 parent 12008db commit b5538a8
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions x/bank/keeper/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/bank/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)

Expand Down Expand Up @@ -158,16 +156,10 @@ func (k BaseSendKeeper) InputOutputCoins(ctx sdk.Context, input types.Input, out
func (k BaseSendKeeper) SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error {
// process restriction if they exist
if k.sendRestriction.Fn != nil {
isMint := fromAddr.Equals(k.ak.GetModuleAddress("mint")) && toAddr.Equals(k.ak.GetModuleAddress(authtypes.FeeCollectorName))
isFeeDistribution := fromAddr.Equals(k.ak.GetModuleAddress(authtypes.FeeCollectorName)) && toAddr.Equals(k.ak.GetModuleAddress(disttypes.ModuleName))

// block rewards mint and fee distribution are allowed to bypass restrictions
if !isMint && !isFeeDistribution {
var err error
toAddr, err = k.sendRestriction.Fn(ctx, fromAddr, toAddr, amt)
if err != nil {
return err
}
var err error
toAddr, err = k.sendRestriction.Fn(ctx, fromAddr, toAddr, amt)
if err != nil {
return err
}
}

Expand Down

0 comments on commit b5538a8

Please sign in to comment.