-
Notifications
You must be signed in to change notification settings - Fork 0
/
getdata.go
28 lines (24 loc) · 840 Bytes
/
getdata.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package common
import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/fastock/fastock-chain/x/backend"
"github.com/fastock/fastock-chain/x/backend/types"
)
func GetNewOrders(ctx sdk.Context, orderKeeper types.OrderKeeper) []*backend.Order {
orders, err := backend.GetNewOrdersAtEndBlock(ctx, orderKeeper)
if err != nil {
return nil
}
return orders
}
func GetDealsAndMatchResult(ctx sdk.Context, orderKeeper types.OrderKeeper) ([]*backend.Deal, []*backend.MatchResult, error) {
deals, matchResults, err := backend.GetNewDealsAndMatchResultsAtEndBlock(ctx, orderKeeper)
return deals, matchResults, err
}
func GetMatchResults(ctx sdk.Context, orderKeeper types.OrderKeeper) []*backend.MatchResult {
_, matchResults, err := GetDealsAndMatchResult(ctx, orderKeeper)
if err != nil {
return nil
}
return matchResults
}