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: 18 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 CanCollectInvariant

func CanCollectInvariant(k Keeper) sdk.Invariant

func HandlePoolParameterChangeProposal

func HandlePoolParameterChangeProposal(ctx sdk.Context, k Keeper, p *types.PoolParameterChangeProposal) error

func HandlePublicFarmingPlanProposal

func HandlePublicFarmingPlanProposal(ctx sdk.Context, k Keeper, p *types.PublicFarmingPlanProposal) error

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func NextOrderTick

func NextOrderTick(
	isBuy bool, liquidity sdk.Int, currentPrice, minOrderQty, minOrderQuote sdk.Dec, tickSpacing uint32) (tick int32, valid bool)

func PoolCurrentLiquidityInvariant

func PoolCurrentLiquidityInvariant(k Keeper) sdk.Invariant

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

func RewardsGrowthGlobalInvariant

func RewardsGrowthGlobalInvariant(k Keeper) sdk.Invariant

func RewardsGrowthOutsideInvariant

func RewardsGrowthOutsideInvariant(k Keeper) sdk.Invariant

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,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	exchangeKeeper types.ExchangeKeeper,
	markerKeeper types.MarkerKeeper,
) Keeper

NewKeeper creates a new Keeper instance.

func (Keeper) AddLiquidity

func (k Keeper) AddLiquidity(
	ctx sdk.Context, ownerAddr, fromAddr sdk.AccAddress, poolId uint64,
	lowerPrice, upperPrice sdk.Dec, desiredAmt sdk.Coins) (position types.Position, liquidity sdk.Int, amt sdk.Coins, err error)

func (Keeper) AfterPoolOrdersExecuted

func (k Keeper) AfterPoolOrdersExecuted(ctx sdk.Context, pool types.Pool, results []*exchangetypes.MemOrder) error

func (Keeper) AllocateFarmingRewards

func (k Keeper) AllocateFarmingRewards(ctx sdk.Context) error

func (Keeper) CanCreatePrivateFarmingPlan

func (k Keeper) CanCreatePrivateFarmingPlan(ctx sdk.Context) bool

func (Keeper) Collect

func (k Keeper) Collect(
	ctx sdk.Context, ownerAddr, toAddr sdk.AccAddress, positionId uint64, amt sdk.Coins) error

func (Keeper) CollectibleCoins

func (k Keeper) CollectibleCoins(ctx sdk.Context, positionId uint64) (fee, farmingRewards sdk.Coins, err error)

func (Keeper) CreatePool

func (k Keeper) CreatePool(ctx sdk.Context, creatorAddr sdk.AccAddress, marketId uint64, price sdk.Dec) (pool types.Pool, err error)

func (Keeper) CreatePrivateFarmingPlan

func (k Keeper) CreatePrivateFarmingPlan(
	ctx sdk.Context, creatorAddr sdk.AccAddress, description string,
	termAddr sdk.AccAddress, rewardAllocs []types.FarmingRewardAllocation, startTime, endTime time.Time,
) (plan types.FarmingPlan, err error)

func (Keeper) CreatePublicFarmingPlan

func (k Keeper) CreatePublicFarmingPlan(
	ctx sdk.Context, description string,
	farmingPoolAddr, termAddr sdk.AccAddress,
	rewardAllocs []types.FarmingRewardAllocation, startTime, endTime time.Time,
) (plan types.FarmingPlan, err error)

func (Keeper) DeleteFarmingPlan

func (k Keeper) DeleteFarmingPlan(ctx sdk.Context, plan types.FarmingPlan)

func (Keeper) DeleteLastFarmingPlanId

func (k Keeper) DeleteLastFarmingPlanId(ctx sdk.Context)

func (Keeper) DeleteLastPoolId

func (k Keeper) DeleteLastPoolId(ctx sdk.Context)

func (Keeper) DeleteLastPositionId

func (k Keeper) DeleteLastPositionId(ctx sdk.Context)

func (Keeper) DeleteNumPrivateFarmingPlans

func (k Keeper) DeleteNumPrivateFarmingPlans(ctx sdk.Context)

func (Keeper) DeletePool

func (k Keeper) DeletePool(ctx sdk.Context, pool types.Pool)

func (Keeper) DeletePoolByReserveAddressIndex

func (k Keeper) DeletePoolByReserveAddressIndex(ctx sdk.Context, pool types.Pool)

func (Keeper) DeletePoolState

func (k Keeper) DeletePoolState(ctx sdk.Context, poolId uint64)

func (Keeper) DeletePosition

func (k Keeper) DeletePosition(ctx sdk.Context, position types.Position)

func (Keeper) DeleteTickInfo

func (k Keeper) DeleteTickInfo(ctx sdk.Context, poolId uint64, tick int32)

func (Keeper) ExportGenesis

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

ExportGenesis returns the module's exported genesis.

func (Keeper) GetDefaultMinOrderQuantity

func (k Keeper) GetDefaultMinOrderQuantity(ctx sdk.Context) (minOrderQty sdk.Dec)

func (Keeper) GetDefaultMinOrderQuote

func (k Keeper) GetDefaultMinOrderQuote(ctx sdk.Context) (minOrderQuote sdk.Dec)

func (Keeper) GetDefaultTickSpacing

func (k Keeper) GetDefaultTickSpacing(ctx sdk.Context) (tickSpacing uint32)

func (Keeper) GetFarmingPlan

func (k Keeper) GetFarmingPlan(ctx sdk.Context, planId uint64) (plan types.FarmingPlan, found bool)

func (Keeper) GetLastFarmingPlanId

func (k Keeper) GetLastFarmingPlanId(ctx sdk.Context) (planId uint64)

func (Keeper) GetLastPoolId

func (k Keeper) GetLastPoolId(ctx sdk.Context) (poolId uint64)

func (Keeper) GetLastPositionId

func (k Keeper) GetLastPositionId(ctx sdk.Context) (positionId uint64)

func (Keeper) GetMaxFarmingBlockTime

func (k Keeper) GetMaxFarmingBlockTime(ctx sdk.Context) (blockTime time.Duration)

func (Keeper) GetMaxNumPrivateFarmingPlans

func (k Keeper) GetMaxNumPrivateFarmingPlans(ctx sdk.Context) (max uint32)

func (Keeper) GetNextFarmingPlanIdWithUpdate

func (k Keeper) GetNextFarmingPlanIdWithUpdate(ctx sdk.Context) (planId uint64)

func (Keeper) GetNextPoolIdWithUpdate

func (k Keeper) GetNextPoolIdWithUpdate(ctx sdk.Context) (poolId uint64)

func (Keeper) GetNextPositionIdWithUpdate

func (k Keeper) GetNextPositionIdWithUpdate(ctx sdk.Context) (positionId uint64)

func (Keeper) GetNumPrivateFarmingPlans

func (k Keeper) GetNumPrivateFarmingPlans(ctx sdk.Context) (num uint32)

func (Keeper) GetParams

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

GetParams returns the parameters for the module.

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (pool types.Pool, found bool)

func (Keeper) GetPoolByMarket

func (k Keeper) GetPoolByMarket(ctx sdk.Context, marketId uint64) (pool types.Pool, found bool)

func (Keeper) GetPoolByReserveAddress

func (k Keeper) GetPoolByReserveAddress(ctx sdk.Context, reserveAddr sdk.AccAddress) (pool types.Pool, found bool)

func (Keeper) GetPoolCreationFee

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

func (Keeper) GetPoolState

func (k Keeper) GetPoolState(ctx sdk.Context, poolId uint64) (state types.PoolState, found bool)

func (Keeper) GetPosition

func (k Keeper) GetPosition(ctx sdk.Context, positionId uint64) (position types.Position, found bool)

func (Keeper) GetPositionByParams

func (k Keeper) GetPositionByParams(ctx sdk.Context, ownerAddr sdk.AccAddress, poolId uint64, lowerTick, upperTick int32) (position types.Position, found bool)

func (Keeper) GetPrivateFarmingPlanCreationFee

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

func (Keeper) GetTickInfo

func (k Keeper) GetTickInfo(ctx sdk.Context, poolId uint64, tick int32) (tickInfo types.TickInfo, found bool)

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) IterateAllFarmingPlans

func (k Keeper) IterateAllFarmingPlans(ctx sdk.Context, cb func(plan types.FarmingPlan) (stop bool))

func (Keeper) IterateAllPools

func (k Keeper) IterateAllPools(ctx sdk.Context, cb func(pool types.Pool) (stop bool))

func (Keeper) IterateAllPositions

func (k Keeper) IterateAllPositions(ctx sdk.Context, cb func(position types.Position) (stop bool))

func (Keeper) IterateAllTickInfos

func (k Keeper) IterateAllTickInfos(ctx sdk.Context, cb func(poolId uint64, tick int32, tickInfo types.TickInfo) (stop bool))

func (Keeper) IteratePoolOrders

func (k Keeper) IteratePoolOrders(ctx sdk.Context, pool types.Pool, isBuy bool, cb func(price, qty, openQty sdk.Dec) (stop bool))

func (Keeper) IteratePositionsByOwner

func (k Keeper) IteratePositionsByOwner(ctx sdk.Context, ownerAddr sdk.AccAddress, cb func(position types.Position) (stop bool))

func (Keeper) IteratePositionsByOwnerAndPool

func (k Keeper) IteratePositionsByOwnerAndPool(ctx sdk.Context, ownerAddr sdk.AccAddress, poolId uint64, cb func(position types.Position) (stop bool))

func (Keeper) IteratePositionsByPool

func (k Keeper) IteratePositionsByPool(ctx sdk.Context, poolId uint64, cb func(position types.Position) (stop bool))

func (Keeper) IterateTickInfosAbove

func (k Keeper) IterateTickInfosAbove(ctx sdk.Context, poolId uint64, currentTick int32, cb func(tick int32, tickInfo types.TickInfo) (stop bool))

func (Keeper) IterateTickInfosBelow

func (k Keeper) IterateTickInfosBelow(ctx sdk.Context, poolId uint64, currentTick int32, inclusive bool, cb func(tick int32, tickInfo types.TickInfo) (stop bool))

func (Keeper) IterateTickInfosByPool

func (k Keeper) IterateTickInfosByPool(ctx sdk.Context, poolId uint64, cb func(tick int32, tickInfo types.TickInfo) (stop bool))

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) LookupPool

func (k Keeper) LookupPool(ctx sdk.Context, poolId uint64) (found bool)

func (Keeper) LookupPoolByMarket

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

func (Keeper) MustGetPool

func (k Keeper) MustGetPool(ctx sdk.Context, poolId uint64) (pool types.Pool)

func (Keeper) MustGetPoolByReserveAddress

func (k Keeper) MustGetPoolByReserveAddress(ctx sdk.Context, reserveAddr sdk.AccAddress) (pool types.Pool)

func (Keeper) MustGetPoolState

func (k Keeper) MustGetPoolState(ctx sdk.Context, poolId uint64) types.PoolState

func (Keeper) MustGetPosition

func (k Keeper) MustGetPosition(ctx sdk.Context, positionId uint64) (position types.Position)

func (Keeper) MustGetTickInfo

func (k Keeper) MustGetTickInfo(ctx sdk.Context, poolId uint64, tick int32) (tickInfo types.TickInfo)

func (Keeper) PositionAssets

func (k Keeper) PositionAssets(ctx sdk.Context, positionId uint64) (coin0, coin1 sdk.Coin, err error)

func (Keeper) RemoveLiquidity

func (k Keeper) RemoveLiquidity(
	ctx sdk.Context, ownerAddr, toAddr sdk.AccAddress, positionId uint64, liquidity sdk.Int) (position types.Position, amt sdk.Coins, err error)

func (Keeper) SetDefaultMinOrderQuantity

func (k Keeper) SetDefaultMinOrderQuantity(ctx sdk.Context, minOrderQty sdk.Dec)

func (Keeper) SetDefaultMinOrderQuote

func (k Keeper) SetDefaultMinOrderQuote(ctx sdk.Context, minOrderQuote sdk.Dec)

func (Keeper) SetDefaultTickSpacing

func (k Keeper) SetDefaultTickSpacing(ctx sdk.Context, tickSpacing uint32)

func (Keeper) SetFarmingPlan

func (k Keeper) SetFarmingPlan(ctx sdk.Context, plan types.FarmingPlan)

func (Keeper) SetLastFarmingPlanId

func (k Keeper) SetLastFarmingPlanId(ctx sdk.Context, planId uint64)

func (Keeper) SetLastPoolId

func (k Keeper) SetLastPoolId(ctx sdk.Context, poolId uint64)

func (Keeper) SetLastPositionId

func (k Keeper) SetLastPositionId(ctx sdk.Context, positionId uint64)

func (Keeper) SetMaxFarmingBlockTime

func (k Keeper) SetMaxFarmingBlockTime(ctx sdk.Context, blockTime time.Duration)

func (Keeper) SetMaxNumPrivateFarmingPlans

func (k Keeper) SetMaxNumPrivateFarmingPlans(ctx sdk.Context, max uint32)

func (Keeper) SetNumPrivateFarmingPlans

func (k Keeper) SetNumPrivateFarmingPlans(ctx sdk.Context, num uint32)

func (Keeper) SetParams

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

SetParams sets the parameters for the module.

func (Keeper) SetPool

func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool)

func (Keeper) SetPoolByMarketIndex

func (k Keeper) SetPoolByMarketIndex(ctx sdk.Context, pool types.Pool)

func (Keeper) SetPoolByReserveAddressIndex

func (k Keeper) SetPoolByReserveAddressIndex(ctx sdk.Context, pool types.Pool)

func (Keeper) SetPoolCreationFee

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

func (Keeper) SetPoolState

func (k Keeper) SetPoolState(ctx sdk.Context, poolId uint64, state types.PoolState)

func (Keeper) SetPosition

func (k Keeper) SetPosition(ctx sdk.Context, position types.Position)

func (Keeper) SetPositionByParamsIndex

func (k Keeper) SetPositionByParamsIndex(ctx sdk.Context, position types.Position)

func (Keeper) SetPositionsByPoolIndex

func (k Keeper) SetPositionsByPoolIndex(ctx sdk.Context, position types.Position)

func (Keeper) SetPrivateFarmingPlanCreationFee

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

func (Keeper) SetTickInfo

func (k Keeper) SetTickInfo(ctx sdk.Context, poolId uint64, tick int32, tickInfo types.TickInfo)

func (Keeper) TerminateEndedFarmingPlans

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

func (Keeper) TerminateFarmingPlan

func (k Keeper) TerminateFarmingPlan(ctx sdk.Context, plan types.FarmingPlan) error

type OrderSource

type OrderSource struct {
	Keeper
}

func NewOrderSource

func NewOrderSource(k Keeper) OrderSource

func (OrderSource) AfterOrdersExecuted

func (k OrderSource) AfterOrdersExecuted(ctx sdk.Context, _ exchangetypes.Market, ordererAddr sdk.AccAddress, results []*exchangetypes.MemOrder) error

func (OrderSource) ConstructMemOrderBookSide

func (k OrderSource) ConstructMemOrderBookSide(
	ctx sdk.Context, market exchangetypes.Market,
	createOrder exchangetypes.CreateOrderFunc,
	opts exchangetypes.MemOrderBookSideOptions) error

func (OrderSource) Name

func (k OrderSource) Name() string

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) MakePoolResponse

func (k Querier) MakePoolResponse(ctx sdk.Context, pool types.Pool) types.PoolResponse

func (Querier) Params

Params queries the parameters of the module.

func (Querier) Pool

Jump to

Keyboard shortcuts

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