keeper

package
v5.0.0-rc9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

func CanCancelOrderInvariant

func CanCancelOrderInvariant(k Keeper) sdk.Invariant

func FitPriceToPriceInterval

func FitPriceToPriceInterval(price, interval sdk.Dec, roundUp bool) sdk.Dec

func HandleMarketParameterChangeProposal

func HandleMarketParameterChangeProposal(ctx sdk.Context, k Keeper, p *types.MarketParameterChangeProposal) error

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

func NumMMOrdersInvariant

func NumMMOrdersInvariant(k Keeper) sdk.Invariant

func OrderBookInvariant

func OrderBookInvariant(k Keeper) sdk.Invariant

func OrderBookOrderInvariant

func OrderBookOrderInvariant(k Keeper) sdk.Invariant

func OrderStateInvariant

func OrderStateInvariant(k Keeper) sdk.Invariant

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper of the module's store.

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey sdk.StoreKey,
	paramSpace paramstypes.Subspace,
	bankKeeper types.BankKeeper,
) Keeper

NewKeeper creates a new Keeper instance.

func (Keeper) CancelAllOrders

func (k Keeper) CancelAllOrders(ctx sdk.Context, ordererAddr sdk.AccAddress, marketId uint64) (orders []types.Order, err error)

func (Keeper) CancelExpiredOrders

func (k Keeper) CancelExpiredOrders(ctx sdk.Context) (err error)

func (Keeper) CancelOrder

func (k Keeper) CancelOrder(ctx sdk.Context, ordererAddr sdk.AccAddress, orderId uint64) (order types.Order, err error)

func (Keeper) ConstructMemOrderBookSide

func (k Keeper) ConstructMemOrderBookSide(
	ctx sdk.Context, market types.Market, opts types.MemOrderBookSideOptions, escrow *types.Escrow) *types.MemOrderBookSide

func (Keeper) CreateMarket

func (k Keeper) CreateMarket(
	ctx sdk.Context, creatorAddr sdk.AccAddress, baseDenom, quoteDenom string) (market types.Market, err error)

func (Keeper) DeleteNumMMOrders

func (k Keeper) DeleteNumMMOrders(ctx sdk.Context, ordererAddr sdk.AccAddress, marketId uint64)

func (Keeper) DeleteOrder

func (k Keeper) DeleteOrder(ctx sdk.Context, order types.Order)

func (Keeper) DeleteOrderBookOrderIndex

func (k Keeper) DeleteOrderBookOrderIndex(ctx sdk.Context, order types.Order)

func (Keeper) DeleteOrdersByOrdererIndex

func (k Keeper) DeleteOrdersByOrdererIndex(ctx sdk.Context, order types.Order)

func (Keeper) EscrowCoins

func (k Keeper) EscrowCoins(
	ctx sdk.Context, market types.Market, addr sdk.AccAddress, amt ...sdk.Coin) error

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the module's exported genesis.

func (Keeper) FindAllRoutes

func (k Keeper) FindAllRoutes(ctx sdk.Context, fromDenom, toDenom string, maxRoutesLen int) (allRoutes [][]uint64)

func (Keeper) GetBestOrderPrice

func (k Keeper) GetBestOrderPrice(ctx sdk.Context, marketId uint64, isBuy bool) (bestPrice sdk.Dec, found bool)

func (Keeper) GetFees

func (k Keeper) GetFees(ctx sdk.Context) (fees types.Fees)

func (Keeper) GetLastMarketId

func (k Keeper) GetLastMarketId(ctx sdk.Context) (marketId uint64)

func (Keeper) GetLastOrderId

func (k Keeper) GetLastOrderId(ctx sdk.Context) (orderId uint64)

func (Keeper) GetMarket

func (k Keeper) GetMarket(ctx sdk.Context, marketId uint64) (market types.Market, found bool)

func (Keeper) GetMarketCreationFee

func (k Keeper) GetMarketCreationFee(ctx sdk.Context) (fee sdk.Coins)

func (Keeper) GetMarketIdByDenoms

func (k Keeper) GetMarketIdByDenoms(ctx sdk.Context, baseDenom, quoteDenom string) (marketId uint64, found bool)

func (Keeper) GetMarketState

func (k Keeper) GetMarketState(ctx sdk.Context, marketId uint64) (state types.MarketState, found bool)

func (Keeper) GetMaxNumMMOrders

func (k Keeper) GetMaxNumMMOrders(ctx sdk.Context) (maxNum uint32)

func (Keeper) GetMaxOrderLifespan

func (k Keeper) GetMaxOrderLifespan(ctx sdk.Context) (maxLifespan time.Duration)

func (Keeper) GetMaxOrderPriceRatio

func (k Keeper) GetMaxOrderPriceRatio(ctx sdk.Context) (maxRatio sdk.Dec)

func (Keeper) GetMaxSwapRoutesLen

func (k Keeper) GetMaxSwapRoutesLen(ctx sdk.Context) (maxLen uint32)

func (Keeper) GetNextMarketIdWithUpdate

func (k Keeper) GetNextMarketIdWithUpdate(ctx sdk.Context) (marketId uint64)

func (Keeper) GetNextOrderIdWithUpdate

func (k Keeper) GetNextOrderIdWithUpdate(ctx sdk.Context) (orderId uint64)

func (Keeper) GetNumMMOrders

func (k Keeper) GetNumMMOrders(ctx sdk.Context, ordererAddr sdk.AccAddress, marketId uint64) (num uint32, found bool)

func (Keeper) GetOrder

func (k Keeper) GetOrder(ctx sdk.Context, orderId uint64) (order types.Order, found bool)

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the parameters for the module.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)

InitGenesis initializes the module's state from a provided genesis state.

func (Keeper) IterateAllMarkets

func (k Keeper) IterateAllMarkets(ctx sdk.Context, cb func(market types.Market) (stop bool))

func (Keeper) IterateAllNumMMOrders

func (k Keeper) IterateAllNumMMOrders(ctx sdk.Context, cb func(ordererAddr sdk.AccAddress, marketId uint64, numMMOrders uint32) (stop bool))

func (Keeper) IterateAllOrderBookOrderIds

func (k Keeper) IterateAllOrderBookOrderIds(ctx sdk.Context, cb func(orderId uint64) (stop bool))

func (Keeper) IterateAllOrders

func (k Keeper) IterateAllOrders(ctx sdk.Context, cb func(order types.Order) (stop bool))

func (Keeper) IterateOrderBookSide

func (k Keeper) IterateOrderBookSide(
	ctx sdk.Context, marketId uint64, isBuy bool, priceLimit *sdk.Dec,
	cb func(price sdk.Dec, orders []types.Order) (stop bool))

func (Keeper) IterateOrderBookSideByMarket

func (k Keeper) IterateOrderBookSideByMarket(ctx sdk.Context, marketId uint64, isBuy bool, cb func(order types.Order) (stop bool))

func (Keeper) IterateOrdersByMarket

func (k Keeper) IterateOrdersByMarket(ctx sdk.Context, marketId uint64, cb func(order types.Order) (stop bool))

func (Keeper) IterateOrdersByOrderer

func (k Keeper) IterateOrdersByOrderer(ctx sdk.Context, ordererAddr sdk.AccAddress, cb func(order types.Order) (stop bool))

func (Keeper) IterateOrdersByOrdererAndMarket

func (k Keeper) IterateOrdersByOrdererAndMarket(ctx sdk.Context, ordererAddr sdk.AccAddress, marketId uint64, cb func(order types.Order) (stop bool))

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) LookupMarket

func (k Keeper) LookupMarket(ctx sdk.Context, marketId uint64) (found bool)

func (Keeper) LookupOrder

func (k Keeper) LookupOrder(ctx sdk.Context, orderId uint64) (found bool)

func (Keeper) LookupOrderBookOrderIndex

func (k Keeper) LookupOrderBookOrderIndex(ctx sdk.Context, marketId uint64, isBuy bool, price sdk.Dec, orderId uint64) (found bool)

func (Keeper) MustGetMarket

func (k Keeper) MustGetMarket(ctx sdk.Context, marketId uint64) (market types.Market)

func (Keeper) MustGetMarketState

func (k Keeper) MustGetMarketState(ctx sdk.Context, marketId uint64) types.MarketState

func (Keeper) MustGetOrder

func (k Keeper) MustGetOrder(ctx sdk.Context, orderId uint64) (order types.Order)

func (Keeper) PlaceBatchLimitOrder

func (k Keeper) PlaceBatchLimitOrder(
	ctx sdk.Context, marketId uint64, ordererAddr sdk.AccAddress,
	isBuy bool, price, qty sdk.Dec, lifespan time.Duration) (order types.Order, err error)

func (Keeper) PlaceLimitOrder

func (k Keeper) PlaceLimitOrder(
	ctx sdk.Context, marketId uint64, ordererAddr sdk.AccAddress,
	isBuy bool, price, qty sdk.Dec, lifespan time.Duration) (orderId uint64, order types.Order, res types.ExecuteOrderResult, err error)

func (Keeper) PlaceMMBatchLimitOrder

func (k Keeper) PlaceMMBatchLimitOrder(
	ctx sdk.Context, marketId uint64, ordererAddr sdk.AccAddress,
	isBuy bool, price, qty sdk.Dec, lifespan time.Duration) (order types.Order, err error)

func (Keeper) PlaceMMLimitOrder

func (k Keeper) PlaceMMLimitOrder(
	ctx sdk.Context, marketId uint64, ordererAddr sdk.AccAddress,
	isBuy bool, price, qty sdk.Dec, lifespan time.Duration) (orderId uint64, order types.Order, res types.ExecuteOrderResult, err error)

func (Keeper) PlaceMarketOrder

func (k Keeper) PlaceMarketOrder(
	ctx sdk.Context, marketId uint64, ordererAddr sdk.AccAddress,
	isBuy bool, qty sdk.Dec) (orderId uint64, res types.ExecuteOrderResult, err error)

func (Keeper) ReleaseCoins

func (k Keeper) ReleaseCoins(
	ctx sdk.Context, market types.Market, addr sdk.AccAddress, amt ...sdk.Coin) error

func (Keeper) RunBatchMatching

func (k Keeper) RunBatchMatching(ctx sdk.Context, market types.Market) (err error)

func (Keeper) SetFees

func (k Keeper) SetFees(ctx sdk.Context, fees types.Fees)

func (Keeper) SetLastMarketId

func (k Keeper) SetLastMarketId(ctx sdk.Context, marketId uint64)

func (Keeper) SetLastOrderId

func (k Keeper) SetLastOrderId(ctx sdk.Context, orderId uint64)

func (Keeper) SetMarket

func (k Keeper) SetMarket(ctx sdk.Context, market types.Market)

func (Keeper) SetMarketByDenomsIndex

func (k Keeper) SetMarketByDenomsIndex(ctx sdk.Context, market types.Market)

func (Keeper) SetMarketCreationFee

func (k Keeper) SetMarketCreationFee(ctx sdk.Context, fee sdk.Coins)

func (Keeper) SetMarketState

func (k Keeper) SetMarketState(ctx sdk.Context, marketId uint64, state types.MarketState)

func (Keeper) SetMaxNumMMOrders

func (k Keeper) SetMaxNumMMOrders(ctx sdk.Context, maxNum uint32)

func (Keeper) SetMaxOrderLifespan

func (k Keeper) SetMaxOrderLifespan(ctx sdk.Context, maxLifespan time.Duration)

func (Keeper) SetMaxOrderPriceRatio

func (k Keeper) SetMaxOrderPriceRatio(ctx sdk.Context, maxRatio sdk.Dec)

func (Keeper) SetMaxSwapRouteLen

func (k Keeper) SetMaxSwapRouteLen(ctx sdk.Context, maxLen uint32)

func (Keeper) SetNumMMOrders

func (k Keeper) SetNumMMOrders(ctx sdk.Context, ordererAddr sdk.AccAddress, marketId uint64, num uint32)

func (Keeper) SetOrder

func (k Keeper) SetOrder(ctx sdk.Context, order types.Order)

func (Keeper) SetOrderBookOrderIndex

func (k Keeper) SetOrderBookOrderIndex(ctx sdk.Context, order types.Order)

func (*Keeper) SetOrderSources

func (k *Keeper) SetOrderSources(sources ...types.OrderSource) *Keeper

func (Keeper) SetOrdersByOrdererIndex

func (k Keeper) SetOrdersByOrdererIndex(ctx sdk.Context, order types.Order)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the parameters for the module.

func (Keeper) SwapExactAmountIn

func (k Keeper) SwapExactAmountIn(
	ctx sdk.Context, ordererAddr sdk.AccAddress,
	routes []uint64, input, minOutput sdk.DecCoin, simulate bool) (output sdk.DecCoin, results []types.SwapRouteResult, err error)

type Querier

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper.

func (Querier) MakeMarketResponse

func (k Querier) MakeMarketResponse(ctx sdk.Context, market types.Market) types.MarketResponse

func (Querier) MakeOrderBooks

func (k Querier) MakeOrderBooks(ctx sdk.Context, market types.Market, lastPrice sdk.Dec, maxNumPriceLevels int) []types.OrderBook

func (Querier) Market

func (Querier) Order

func (Querier) Params

Params queries the parameters of the module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL