Skip to content

Commit

Permalink
Merge PR: remove the bankkeeper check before any send/multi-send tx (#…
Browse files Browse the repository at this point in the history
…314)

* FINISH: remove the bankkeeper check before any send/multi-send tx

* OPTIMIZE: recover go.sum

* OPTIMIZE: remove const for send disable check
  • Loading branch information
RevelationOfTuring authored Aug 7, 2020
1 parent 0fa8a15 commit cdbfdc8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
8 changes: 0 additions & 8 deletions x/token/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ func handleMsgTokenMint(ctx sdk.Context, keeper Keeper, msg types.MsgTokenMint,
}

func handleMsgMultiSend(ctx sdk.Context, keeper Keeper, msg types.MsgMultiSend, logger log.Logger) sdk.Result {
if !keeper.bankKeeper.GetSendEnabled(ctx) {
return types.ErrSendDisabled(DefaultCodespace).Result()
}

var transfers string
var coinNum int
for _, transferUnit := range msg.Transfers {
Expand Down Expand Up @@ -286,10 +282,6 @@ func handleMsgMultiSend(ctx sdk.Context, keeper Keeper, msg types.MsgMultiSend,
}

func handleMsgSend(ctx sdk.Context, keeper Keeper, msg types.MsgSend, logger log.Logger) sdk.Result {
if !keeper.bankKeeper.GetSendEnabled(ctx) {
return types.ErrSendDisabled(DefaultCodespace).Result()
}

err := keeper.SendCoinsFromAccountToAccount(ctx, msg.FromAddress, msg.ToAddress, msg.Amount)
if err != nil {
return sdk.ErrInsufficientCoins(fmt.Sprintf("insufficient coins(need %s)",
Expand Down
6 changes: 0 additions & 6 deletions x/token/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,13 @@ const (
CodeInvalidAsset sdk.CodeType = 6
CodeInvalidCommon sdk.CodeType = 7
CodeBlockedRecipient sdk.CodeType = 8
CodeSendDisabled sdk.CodeType = 9
)

// ErrBlockedRecipient returns an error when a transfer is tried on a blocked recipient
func ErrBlockedRecipient(codespace sdk.CodespaceType, blockedAddr string) sdk.Error {
return sdk.NewError(codespace, CodeBlockedRecipient, "failed. %s is not allowed to receive transactions", blockedAddr)
}

// ErrSendDisabled returns an error when the transaction sending is disabled in bank module
func ErrSendDisabled(codespace sdk.CodespaceType) sdk.Error {
return sdk.NewError(codespace, CodeSendDisabled, "failed. send transactions are currently disabled")
}

func ErrInvalidDexList(codespace sdk.CodespaceType, message string) sdk.Error {
return sdk.NewError(codespace, CodeInvalidDexList, message)
}
Expand Down

0 comments on commit cdbfdc8

Please sign in to comment.