Skip to content

Commit

Permalink
BE-586 | Suggested improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
deividaspetraitis committed Oct 31, 2024
1 parent beee769 commit 2593bc0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 4 additions & 6 deletions orderbook/usecase/orderbook_usecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,13 +571,11 @@ func (o *OrderbookUseCaseImpl) getClaimableOrders(
result = append(result, orderbookdomain.ClaimableOrder{Order: order})
continue
}

claimable, err := o.isOrderClaimable(orderbook, order, fillThreshold)
if claimable {
result = append(result, orderbookdomain.ClaimableOrder{
Order: order,
Error: err,
})
orderToAdd := orderbookdomain.ClaimableOrder{Order: order, Error: err}

if err != nil || claimable {
result = append(result, orderToAdd)
}
}

Expand Down
14 changes: 8 additions & 6 deletions orderbook/usecase/orderbooktesting/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,24 +122,26 @@ func (s *OrderbookTestHelper) NewTick(effectiveTotalAmountSwapped string, unreal
TickState: orderbookdomain.TickState{},
UnrealizedCancels: orderbookdomain.UnrealizedCancels{},
}

if direction == "bid" {
switch direction {
case "bid":
tick.TickState.BidValues = tickValues
if unrealizedCancels != 0 {
tick.UnrealizedCancels.BidUnrealizedCancels = osmomath.NewInt(unrealizedCancels)
}
} else {
case "ask":
tick.TickState.AskValues = tickValues
if unrealizedCancels != 0 {
tick.UnrealizedCancels.AskUnrealizedCancels = osmomath.NewInt(unrealizedCancels)
}
}

if direction == "all" {
case "all":
tick.TickState.AskValues = tickValues
tick.TickState.BidValues = tickValues
if unrealizedCancels != 0 {
tick.UnrealizedCancels.AskUnrealizedCancels = osmomath.NewInt(unrealizedCancels)
tick.UnrealizedCancels.BidUnrealizedCancels = osmomath.NewInt(unrealizedCancels)
}
default:
s.T().Fatalf("invalid direction: %s", direction)
}

tick.Tick = &cosmwasmpool.OrderbookTick{
Expand Down

0 comments on commit 2593bc0

Please sign in to comment.