Skip to content

Commit

Permalink
update observer (#162)
Browse files Browse the repository at this point in the history
* update observer

* delete IsCheckTx in dex keeper

* fix ut

Co-authored-by: yanwei.han <[email protected]>
  • Loading branch information
zhongqiuwood and yanwei.han authored May 22, 2020
1 parent e16e08b commit ab9d514
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SUM := $(shell which shasum)
COMMIT := $(shell git rev-parse HEAD)
CAT := $(if $(filter $(OS),Windows_NT),type,cat)

Version=v0.10.0
Version=v0.10.5
CosmosSDK=v0.37.9
Tendermint=v0.32.10
Iavl=v0.12.4
Expand Down
4 changes: 2 additions & 2 deletions app/protocol/protocol_v0.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,10 @@ func (p *ProtocolV0) produceKeepers() {
p.keys[order.OrderStoreKey], p.cdc, appConfig.BackendConfig.EnableBackend, orderMetrics,
)

p.streamKeeper = stream.NewKeeper(p.orderKeeper, p.tokenKeeper, p.dexKeeper, p.accountKeeper,
p.streamKeeper = stream.NewKeeper(p.orderKeeper, p.tokenKeeper, &p.dexKeeper, &p.accountKeeper,
p.cdc, p.logger, appConfig, streamMetrics)

p.backendKeeper = backend.NewKeeper(p.orderKeeper, p.tokenKeeper, p.dexKeeper, p.streamKeeper.GetMarketKeeper(),
p.backendKeeper = backend.NewKeeper(p.orderKeeper, p.tokenKeeper, &p.dexKeeper, p.streamKeeper.GetMarketKeeper(),
p.cdc, p.logger, appConfig.BackendConfig)

// 3.register the proposal types
Expand Down
2 changes: 1 addition & 1 deletion x/backend/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func getMockApp(t *testing.T, numGenAccs int, enableBackend bool, dbDir string)
mockApp.backendKeeper = NewKeeper(
mockApp.orderKeeper,
mockApp.tokenKeeper,
mockApp.dexKeeper,
&mockApp.dexKeeper,
nil,
mockApp.Cdc,
mockApp.Logger(),
Expand Down
8 changes: 4 additions & 4 deletions x/dex/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (k Keeper) SaveTokenPair(ctx sdk.Context, tokenPair *types.TokenPair) error
store.Set(types.GetTokenPairAddress(keyPair), k.cdc.MustMarshalBinaryBare(tokenPair))
store.Set(types.GetUserTokenPairAddress(tokenPair.Owner, keyPair), []byte{})

if !ctx.IsCheckTx() && k.observerKeeper != nil {
if k.observerKeeper != nil {
k.observerKeeper.OnAddNewTokenPair(ctx, tokenPair)
}

Expand Down Expand Up @@ -184,7 +184,7 @@ func (k Keeper) DeleteTokenPairByName(ctx sdk.Context, owner sdk.AccAddress, pro
// remove the user-tokenpair relationship
k.deleteUserTokenPair(ctx, owner, product)

if !ctx.IsCheckTx() && k.observerKeeper != nil {
if k.observerKeeper != nil {
k.observerKeeper.OnTokenPairUpdated(ctx)
}
}
Expand All @@ -200,7 +200,7 @@ func (k Keeper) UpdateTokenPair(ctx sdk.Context, product string, tokenPair *type
store := ctx.KVStore(k.tokenPairStoreKey)
store.Set(types.GetTokenPairAddress(product), k.cdc.MustMarshalBinaryBare(*tokenPair))

if !ctx.IsCheckTx() && k.observerKeeper != nil {
if k.observerKeeper != nil {
k.observerKeeper.OnTokenPairUpdated(ctx)
}
}
Expand Down Expand Up @@ -457,6 +457,6 @@ func (k Keeper) GetTokenPairNum(ctx sdk.Context) (tokenPairNumber uint64) {
return
}

func (k Keeper) SetObserverKeeper(sk exported.StreamKeeper) {
func (k *Keeper) SetObserverKeeper(sk exported.StreamKeeper) {
k.observerKeeper = sk
}

0 comments on commit ab9d514

Please sign in to comment.