Skip to content

Commit

Permalink
refactor orders module to exchange module
Browse files Browse the repository at this point in the history
  • Loading branch information
albertchon committed Feb 25, 2021
1 parent 96af996 commit dcb7146
Show file tree
Hide file tree
Showing 24 changed files with 8,804 additions and 5,328 deletions.
2 changes: 1 addition & 1 deletion chain/client/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
keyscodec "github.com/InjectiveLabs/sdk-go/chain/crypto/codec"

evm "github.com/InjectiveLabs/sdk-go/chain/evm/types"
orders "github.com/InjectiveLabs/sdk-go/chain/orders/types"
orders "github.com/InjectiveLabs/sdk-go/chain/exchange/types"
peggy "github.com/InjectiveLabs/sdk-go/chain/peggy/types"
ctypes "github.com/InjectiveLabs/sdk-go/chain/types"
)
Expand Down
8 changes: 4 additions & 4 deletions chain/client/contract_discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/ethereum/go-ethereum/common"
log "github.com/xlab/suplog"

ordertypes "github.com/InjectiveLabs/sdk-go/chain/orders/types"
exchangetypes "github.com/InjectiveLabs/sdk-go/chain/exchange/types"
)

type ContractSet struct {
Expand All @@ -19,7 +19,7 @@ type ContractDiscoverer interface {
GetContractSet(ctx context.Context) ContractSet
}

func NewContractDiscoverer(ordersQuerier ordertypes.QueryClient) ContractDiscoverer {
func NewContractDiscoverer(ordersQuerier exchangetypes.QueryClient) ContractDiscoverer {
return &contractDiscoverer{
queryClient: ordersQuerier,
logger: log.WithFields(log.Fields{
Expand All @@ -30,7 +30,7 @@ func NewContractDiscoverer(ordersQuerier ordertypes.QueryClient) ContractDiscove
}

type contractDiscoverer struct {
queryClient ordertypes.QueryClient
queryClient exchangetypes.QueryClient
logger log.Logger
}

Expand All @@ -42,7 +42,7 @@ func (c *contractDiscoverer) GetContractSet(ctx context.Context) (set ContractSe
case <-ctx.Done():
return
default:
resp, err := c.queryClient.QueryDerivativeMarkets(ctx, &ordertypes.QueryDerivativeMarketsRequest{})
resp, err := c.queryClient.QueryDerivativeMarkets(ctx, &exchangetypes.QueryDerivativeMarketsRequest{})
if err != nil {
c.logger.WithError(err).Warningln("failed to query derivative markets, retry in 10s")
time.Sleep(defaultRetryDelay)
Expand Down
4 changes: 2 additions & 2 deletions chain/orders/types/codec.go → chain/exchange/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
)

var (
// ModuleCdc references the global orders module codec. Note, the codec should
// ModuleCdc references the global exchange module codec. Note, the codec should
// ONLY be used in certain instances of tests and for JSON encoding.
//
// The actual codec used for serialization should be provided to modules/orders and
// The actual codec used for serialization should be provided to modules/exchange and
// defined at the application level.
ModuleCdc = codec.NewProtoCodec(codectypes.NewInterfaceRegistry())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var (
ErrOrderNotFound = sdkerrors.Register(ModuleName, 2, "no active order found for the hash")
ErrPairSuspended = sdkerrors.Register(ModuleName, 3, "trade pair suspended")
ErrPairNotFound = sdkerrors.Register(ModuleName, 4, "trade pair not found")
ErrPairExists = sdkerrors.Register(ModuleName, 5, "trade pair exists")
ErrSpotMarketExists = sdkerrors.Register(ModuleName, 5, "trade pair exists")
ErrPairMismatch = sdkerrors.Register(ModuleName, 6, "trade pair mismatch")
ErrBadField = sdkerrors.Register(ModuleName, 7, "struct field error")
ErrMarketNotFound = sdkerrors.Register(ModuleName, 8, "derivative market not found")
Expand Down
File renamed without changes.
Loading

0 comments on commit dcb7146

Please sign in to comment.