Skip to content

Commit

Permalink
refactor: optimize kv store calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Duong Minh Ngoc committed Jan 17, 2024
1 parent bf777a4 commit 68a1e27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions x/feeabs/keeper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ func (k Keeper) SetHostZoneConfig(ctx sdk.Context, chainConfig types.HostChainFe
}

func (k Keeper) DeleteHostZoneConfig(ctx sdk.Context, ibcDenom string) error {
store := ctx.KVStore(k.storeKey)
hostZoneConfig, ok := k.GetHostZoneConfig(ctx, ibcDenom)
if ok {
key := types.GetKeyHostZoneConfigByOsmosisIBCDenom(hostZoneConfig.OsmosisPoolTokenDenomIn)
store.Delete(key)
if !ok {
return types.ErrHostZoneConfigNotFound
}

key := types.GetKeyHostZoneConfigByFeeabsIBCDenom(ibcDenom)
store := ctx.KVStore(k.storeKey)

key := types.GetKeyHostZoneConfigByOsmosisIBCDenom(hostZoneConfig.OsmosisPoolTokenDenomIn)
store.Delete(key)

key = types.GetKeyHostZoneConfigByFeeabsIBCDenom(ibcDenom)
store.Delete(key)

return nil
Expand Down
2 changes: 1 addition & 1 deletion x/feeabs/types/build_memo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package types

import (
"encoding/json"
fmt "fmt"
"fmt"
"time"
)

Expand Down

0 comments on commit 68a1e27

Please sign in to comment.