Skip to content

Commit

Permalink
fix: linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Jan 29, 2025
1 parent 77a0188 commit cf4a0c5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
17 changes: 9 additions & 8 deletions x/migration/keeper/morse_account_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,37 @@ package keeper
import (
"context"

"cosmossdk.io/store/prefix"
"github.com/cosmos/cosmos-sdk/runtime"

"github.com/pokt-network/poktroll/x/migration/types"
"cosmossdk.io/store/prefix"
)

// SetMorseAccountState set morseAccountState in the store
func (k Keeper) SetMorseAccountState(ctx context.Context, morseAccountState types.MorseAccountState) {
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.MorseAccountStateKey))
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.MorseAccountStateKey))
b := k.cdc.MustMarshal(&morseAccountState)
store.Set([]byte{0}, b)
}

// GetMorseAccountState returns morseAccountState
func (k Keeper) GetMorseAccountState(ctx context.Context) (val types.MorseAccountState, found bool) {
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.MorseAccountStateKey))

b := store.Get([]byte{0})
if b == nil {
return val, false
}
if b == nil {
return val, false
}

k.cdc.MustUnmarshal(b, &val)
return val, true
}

// RemoveMorseAccountState removes morseAccountState from the store
func (k Keeper) RemoveMorseAccountState(ctx context.Context) {
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx))
store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.MorseAccountStateKey))
store.Delete([]byte{0})
}
7 changes: 4 additions & 3 deletions x/migration/keeper/query_morse_account_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"context"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/pokt-network/poktroll/x/migration/types"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/pokt-network/poktroll/x/migration/types"
)

func (k Keeper) MorseAccountState(goCtx context.Context, req *types.QueryGetMorseAccountStateRequest) (*types.QueryGetMorseAccountStateResponse, error) {
Expand All @@ -17,8 +18,8 @@ func (k Keeper) MorseAccountState(goCtx context.Context, req *types.QueryGetMors

val, found := k.GetMorseAccountState(ctx)
if !found {
return nil, status.Error(codes.NotFound, "not found")
return nil, status.Error(codes.NotFound, "not found")
}

return &types.QueryGetMorseAccountStateResponse{MorseAccountState: val}, nil
}
}
1 change: 0 additions & 1 deletion x/migration/keeper/query_morse_account_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ func TestMorseAccountStateQuery(t *testing.T) {
})
}
}

0 comments on commit cf4a0c5

Please sign in to comment.