Skip to content

Commit

Permalink
chore(codec): use BinaryCodec rather than Codec
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-zaremba committed Apr 16, 2024
1 parent bcd1639 commit a96fc93
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions util/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func SetBinValue[T BinMarshalable](store sdk.KVStore, key []byte, value T, errFi
// instead of GetValue.
// Returns a boolean indicating whether any data was found. If the return is false, the object
// is not changed by this function.
func GetValueCdc(store sdk.KVStore, cdc codec.Codec, key []byte, object codec.ProtoMarshaler, errField string) bool {
func GetValueCdc(store sdk.KVStore, cdc codec.BinaryCodec, key []byte, object codec.ProtoMarshaler, errField string) bool {
if bz := store.Get(key); len(bz) > 0 {
err := cdc.Unmarshal(bz, object)
if err != nil {
Expand All @@ -88,7 +88,7 @@ func GetValueCdc(store sdk.KVStore, cdc codec.Codec, key []byte, object codec.Pr
// SetValueCdc is similar to the SetValue, but uses codec for marshaling. For Protobuf objects the
// result is the same, unless codec.Any is used. In the latter case this function MUST be used,
// instead of SetValue.
func SetValueCdc(store sdk.KVStore, cdc codec.Codec, key []byte, object codec.ProtoMarshaler, errField string) error {
func SetValueCdc(store sdk.KVStore, cdc codec.BinaryCodec, key []byte, object codec.ProtoMarshaler, errField string) error {
bz, err := cdc.Marshal(object)
if err != nil {
return fmt.Errorf("failed to encode %s, %s", errField, err.Error())
Expand Down
4 changes: 2 additions & 2 deletions x/incentive/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
)

type Keeper struct {
cdc codec.Codec
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
bankKeeper incentive.BankKeeper
leverageKeeper incentive.LeverageKeeper
}

func NewKeeper(
cdc codec.Codec,
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
bk incentive.BankKeeper,
lk incentive.LeverageKeeper,
Expand Down
4 changes: 2 additions & 2 deletions x/leverage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

type Keeper struct {
cdc codec.Codec
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
bankKeeper types.BankKeeper
oracleKeeper types.OracleKeeper
Expand All @@ -28,7 +28,7 @@ type Keeper struct {
}

func NewKeeper(
cdc codec.Codec,
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
b types.BankKeeper,
o types.OracleKeeper,
Expand Down
6 changes: 3 additions & 3 deletions x/metoken/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

// Builder constructs Keeper by preparing all related dependencies (notably the store).
type Builder struct {
cdc codec.Codec
cdc codec.BinaryCodec
storeKey storetypes.StoreKey
bankKeeper metoken.BankKeeper
leverageKeeper metoken.LeverageKeeper
Expand All @@ -22,7 +22,7 @@ type Builder struct {

// NewBuilder returns Builder object.
func NewBuilder(
cdc codec.Codec,
cdc codec.BinaryCodec,
storeKey storetypes.StoreKey,
bankKeeper metoken.BankKeeper,
leverageKeeper metoken.LeverageKeeper,
Expand All @@ -40,7 +40,7 @@ func NewBuilder(
}

type Keeper struct {
cdc codec.Codec
cdc codec.BinaryCodec
store sdk.KVStore
bankKeeper metoken.BankKeeper
leverageKeeper metoken.LeverageKeeper
Expand Down

0 comments on commit a96fc93

Please sign in to comment.