func queryGetParams(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) ([]byte, sdk.Error) {
	params := keeper.GetParams(ctx)
	bz, err := codec.MarshalJSONIndent(keeper.cdc, params)
	if err != nil {
		return nil, sdk.ErrInternal(sdk.AppendMsgToErr("could not marshal result to JSON", err.Error()))
	}
	return bz, nil
}
queryGetParams fetches the cdp module parameters
TODO does this need to exist? Can you use cliCtx.QueryStore instead?
package cdp
import (
	"fmt"
	"github.com/cosmos/cosmos-sdk/codec"
	sdk "github.com/cosmos/cosmos-sdk/types"
	abci "github.com/tendermint/tendermint/abci/types"
)
const (
	QueryGetCdps   = "cdps"
	QueryGetParams = "params"
)
func NewQuerier(keeper Keeper) sdk.Querier {
	return func(ctx sdk.Context, path []string, req abci.RequestQuery) (res []byte, err sdk.Error) {
		switch path[0] {
		case QueryGetCdps:
			return queryGetCdps(ctx, req, keeper)
		case QueryGetParams:
			return queryGetParams(ctx, req, keeper)
		default:
			return nil, sdk.ErrUnknownRequest("unknown cdp query endpoint")
		}
	}
}
type QueryCdpsParams struct {
	CollateralDenom       string          
	Owner                 sdk.AccAddress  
	UnderCollateralizedAt sdk.Dec         
}
func queryGetCdps(ctx sdk.Context, req abci.RequestQuery, keeper Keeper) ([]byte, sdk.Error) {
	var requestParams QueryCdpsParams
	err := keeper.cdc.UnmarshalJSON(req.Data, &requestParams)
	if err != nil {
		return nil, sdk.ErrInternal(fmt.Sprintf("failed to parse params: %s", err))
	}
	var cdps CDPs
	if len(requestParams.Owner) != 0 {
		if len(requestParams.CollateralDenom) != 0 {
			cdp, found := keeper.GetCDP(ctx, requestParams.Owner, requestParams.CollateralDenom)
			if !found {
				cdp = CDP{Owner: requestParams.Owner, CollateralDenom: requestParams.CollateralDenom, CollateralAmount: sdk.ZeroInt(), Debt: sdk.ZeroInt()}
			}
			cdps = CDPs{cdp}
		} else {
			return nil, sdk.ErrInternal("getting all CDPs belonging to one owner not implemented")
		}
	} else {
		var errSdk sdk.Error  
		cdps, errSdk = keeper.GetCDPs(ctx, requestParams.CollateralDenom, requestParams.UnderCollateralizedAt)
		if errSdk != nil {
			return nil, errSdk
		}
	}
	bz, err := codec.MarshalJSONIndent(keeper.cdc, cdps)
	if err != nil {
		return nil, sdk.ErrInternal(sdk.AppendMsgToErr("could not marshal result to JSON", err.Error()))
	}
	return bz, nil
}