Skip to content

Commit

Permalink
fix swap error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
klim0v committed Mar 25, 2021
1 parent a2be86a commit 0069f67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions api/v2/service/estimate_coin_sell.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ func (s *Service) commissionInCoin(cState *state.CheckState, coinCommissionID ty
default:
if !commissionsCoin.IsBaseCoin() {
commissionInBaseCoin = cState.Swap().GetSwapper(commissionsCoin, types.GetBaseCoinID()).CalculateBuyForSell(commissionInBaseCoin)
}
if commissionInBaseCoin == nil {
return nil, false, s.createError(status.New(codes.FailedPrecondition, "Not possible to pay commission"), transaction.EncodeError(code.NewCommissionCoinNotSufficient("", "")))
if commissionInBaseCoin == nil {
return nil, false, s.createError(status.New(codes.FailedPrecondition, "Not possible to pay commission"), transaction.EncodeError(code.NewCommissionCoinNotSufficient("", "")))
}
}
commissionPoolSwapper := cState.Swap().GetSwapper(coinCommissionID, types.GetBaseCoinID())

Expand Down
4 changes: 2 additions & 2 deletions coreV2/transaction/buy_swap_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ func CheckSwap(rSwap swap.EditableChecker, coinIn CalculateCoin, coinOut Calcula
Code: code.MinimumValueToBuyReached,
Log: fmt.Sprintf(
"You wanted to buy minimum %s %s, but currently you buy only %s %s",
valueIn.String(), symbolOut, calculatedAmountToBuy.String(), symbolOut),
Info: EncodeError(code.NewMaximumValueToSellReached(valueIn.String(), calculatedAmountToBuy.String(), coinIn.GetFullSymbol(), coinIn.ID().String())),
valueOut.String(), symbolOut, calculatedAmountToBuy.String(), symbolOut),
Info: EncodeError(code.NewMaximumValueToSellReached(valueOut.String(), calculatedAmountToBuy.String(), coinIn.GetFullSymbol(), coinIn.ID().String())),
}
}
valueOut = calculatedAmountToBuy
Expand Down

0 comments on commit 0069f67

Please sign in to comment.