keeper

package
v5.0.0-rc6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlePublicPositionCreateProposal

func HandlePublicPositionCreateProposal(ctx sdk.Context, k Keeper, p *types.PublicPositionCreateProposal) error

func HandlePublicPositionParameterChangeProposal

func HandlePublicPositionParameterChangeProposal(ctx sdk.Context, k Keeper, p *types.PublicPositionParameterChangeProposal) error

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey sdk.StoreKey,
	paramSpace paramtypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	ammKeeper types.AMMKeeper,
) Keeper

func (Keeper) AdvanceRewardsAuctions

func (k Keeper) AdvanceRewardsAuctions(ctx sdk.Context, nextEndTime time.Time) (err error)

AdvanceRewardsAuctions advances all rewards auctions' epoch by one and sets the next auction end time.

func (Keeper) BurnShare

func (k Keeper) BurnShare(
	ctx sdk.Context, senderAddr sdk.AccAddress, publicPositionId uint64,
	share sdk.Coin) (removedLiquidity sdk.Int, position ammtypes.Position, amt sdk.Coins, err error)

BurnShare handles types.MsgBurnShare to burn public position share.

func (Keeper) CreatePublicPosition

func (k Keeper) CreatePublicPosition(
	ctx sdk.Context, poolId uint64, lowerPrice, upperPrice sdk.Dec,
	minBidAmt sdk.Int, feeRate sdk.Dec) (publicPosition types.PublicPosition, err error)

func (Keeper) DeleteBid

func (k Keeper) DeleteBid(ctx sdk.Context, bid types.Bid)

DeleteBid deletes the bid object.

func (Keeper) DeletePublicPosition

func (k Keeper) DeletePublicPosition(ctx sdk.Context, publicPosition types.PublicPosition)

DeletePublicPosition deletes the public position object from the store.

func (Keeper) DeleteRewardsAuction

func (k Keeper) DeleteRewardsAuction(ctx sdk.Context, auction types.RewardsAuction)

func (Keeper) ExportGenesis

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

ExportGenesis returns the module's exported genesis.

func (Keeper) FinishRewardsAuction

func (k Keeper) FinishRewardsAuction(ctx sdk.Context, publicPosition types.PublicPosition, auction types.RewardsAuction) error

FinishRewardsAuction finishes ongoing rewards auction by looking up the existence of winning bid. Compound accumulated farming rewards for farmers and refund all bids that are placed for the auction if winning bid exists. If not, set the compounding rewards to zero and update the auction status AuctionStatusSkipped.

func (Keeper) GetAMMPosition

func (k Keeper) GetAMMPosition(ctx sdk.Context, publicPosition types.PublicPosition) (position ammtypes.Position, found bool)

func (Keeper) GetAllBids

func (k Keeper) GetAllBids(ctx sdk.Context) (bids []types.Bid)

GetAllBids returns all bids in the store.

func (Keeper) GetAllPublicPositions

func (k Keeper) GetAllPublicPositions(ctx sdk.Context) (publicPositions []types.PublicPosition)

GetAllPublicPositions returns all public position objects stored in the store.

func (Keeper) GetAllRewardsAuctions

func (k Keeper) GetAllRewardsAuctions(ctx sdk.Context) (auctions []types.RewardsAuction)

GetAllRewardsAuctions returns all rewards auctions in the store.

func (Keeper) GetBid

func (k Keeper) GetBid(ctx sdk.Context, publicPositionId, auctionId uint64, bidderAddr sdk.AccAddress) (bid types.Bid, found bool)

GetBid returns the bid object by the given pool id and bidder address.

func (Keeper) GetLastPublicPositionId

func (k Keeper) GetLastPublicPositionId(ctx sdk.Context) uint64

func (Keeper) GetLastRewardsAuction

func (k Keeper) GetLastRewardsAuction(ctx sdk.Context, publicPositionId uint64) (auction types.RewardsAuction, found bool)

func (Keeper) GetMaxNumRecentRewardsAuctions

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

func (Keeper) GetModuleAddress

func (k Keeper) GetModuleAddress() sdk.AccAddress

GetModuleAddress returns the module account's address.

func (Keeper) GetNextPublicPositionIdWithUpdate

func (k Keeper) GetNextPublicPositionIdWithUpdate(ctx sdk.Context) uint64

func (Keeper) GetNextRewardsAuctionEndTime

func (k Keeper) GetNextRewardsAuctionEndTime(ctx sdk.Context) (t time.Time, found bool)

GetNextRewardsAuctionEndTime returns the last rewards auction end time.

func (Keeper) GetParams

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

GetParams returns the parameters for the module.

func (Keeper) GetPreviousRewardsAuction

func (k Keeper) GetPreviousRewardsAuction(ctx sdk.Context, publicPosition types.PublicPosition) (auction types.RewardsAuction, found bool)

func (Keeper) GetPublicPosition

func (k Keeper) GetPublicPosition(ctx sdk.Context, publicPositionId uint64) (publicPosition types.PublicPosition, found bool)

GetPublicPosition returns public position object by the given id.

func (Keeper) GetRewardsAuction

func (k Keeper) GetRewardsAuction(ctx sdk.Context, publicPositionId, auctionId uint64) (auction types.RewardsAuction, found bool)

GetRewardsAuction returns the reward auction object by the given auction id pool id.

func (Keeper) GetRewardsAuctionDuration

func (k Keeper) GetRewardsAuctionDuration(ctx sdk.Context) (duration time.Duration)

func (Keeper) InitGenesis

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

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

func (Keeper) IterateAllBids

func (k Keeper) IterateAllBids(ctx sdk.Context, cb func(bid types.Bid) (stop bool))

IterateAllBids iterates over all the stored bids and performs a callback function. Stops iteration when callback returns true.

func (Keeper) IterateAllPublicPositions

func (k Keeper) IterateAllPublicPositions(ctx sdk.Context, cb func(publicPosition types.PublicPosition) (stop bool))

IterateAllPublicPositions iterates through all public position objects stored in the store and invokes callback function for each item. Stops the iteration when the callback function for each time.

func (Keeper) IterateAllRewardsAuctions

func (k Keeper) IterateAllRewardsAuctions(ctx sdk.Context, cb func(auction types.RewardsAuction) (stop bool))

IterateAllRewardsAuctions iterates over all the stored auctions and performs a callback function. Stops iteration when callback returns true.

func (Keeper) IterateBidsByRewardsAuction

func (k Keeper) IterateBidsByRewardsAuction(ctx sdk.Context, publicPositionId, auctionId uint64, cb func(bid types.Bid) (stop bool))

func (Keeper) IteratePublicPositionsByPool

func (k Keeper) IteratePublicPositionsByPool(ctx sdk.Context, poolId uint64, cb func(publicPosition types.PublicPosition) (stop bool))

func (Keeper) IterateRewardsAuctionsByPublicPosition

func (k Keeper) IterateRewardsAuctionsByPublicPosition(ctx sdk.Context, publicPositionId uint64, cb func(auction types.RewardsAuction) (stop bool))

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) LookupPublicPosition

func (k Keeper) LookupPublicPosition(ctx sdk.Context, publicPositionId uint64) (found bool)

func (Keeper) LookupPublicPositionByParams

func (k Keeper) LookupPublicPositionByParams(ctx sdk.Context, poolId uint64, lowerTick, upperTick int32) (found bool)

func (Keeper) LookupRewardsAuction

func (k Keeper) LookupRewardsAuction(ctx sdk.Context, publicPositionId, auctionId uint64) (found bool)

func (Keeper) MintShare

func (k Keeper) MintShare(
	ctx sdk.Context, senderAddr sdk.AccAddress, publicPositionId uint64,
	desiredAmt sdk.Coins) (mintedShare sdk.Coin, position ammtypes.Position, liquidity sdk.Int, amt sdk.Coins, err error)

func (Keeper) MustGetAMMPosition

func (k Keeper) MustGetAMMPosition(ctx sdk.Context, publicPosition types.PublicPosition) ammtypes.Position

func (Keeper) PlaceBid

func (k Keeper) PlaceBid(
	ctx sdk.Context, bidderAddr sdk.AccAddress, publicPositionId, auctionId uint64, share sdk.Coin) (bid types.Bid, err error)

PlaceBid handles types.MsgPlaceBid and stores bid object.

func (Keeper) SetBid

func (k Keeper) SetBid(ctx sdk.Context, bid types.Bid)

SetBid stores a bid object with the given pool id.

func (Keeper) SetLastPublicPositionId

func (k Keeper) SetLastPublicPositionId(ctx sdk.Context, publicPositionId uint64)

func (Keeper) SetMaxNumRecentRewardsAuctions

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

func (Keeper) SetNextRewardsAuctionEndTime

func (k Keeper) SetNextRewardsAuctionEndTime(ctx sdk.Context, t time.Time)

SetNextRewardsAuctionEndTime stores the last rewards auction end time.

func (Keeper) SetParams

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

SetParams sets the parameters for the module.

func (Keeper) SetPublicPosition

func (k Keeper) SetPublicPosition(ctx sdk.Context, publicPosition types.PublicPosition)

SetPublicPosition stores public position object with the given id.

func (Keeper) SetPublicPositionByParamsIndex

func (k Keeper) SetPublicPositionByParamsIndex(ctx sdk.Context, publicPosition types.PublicPosition)

func (Keeper) SetPublicPositionsByPoolIndex

func (k Keeper) SetPublicPositionsByPoolIndex(ctx sdk.Context, publicPosition types.PublicPosition)

func (Keeper) SetRewardsAuction

func (k Keeper) SetRewardsAuction(ctx sdk.Context, auction types.RewardsAuction)

SetRewardsAuction stores rewards auction.

func (Keeper) SetRewardsAuctionDuration

func (k Keeper) SetRewardsAuctionDuration(ctx sdk.Context, duration time.Duration)

func (Keeper) SkipRewardsAuction

func (k Keeper) SkipRewardsAuction(ctx sdk.Context, publicPosition types.PublicPosition, auction types.RewardsAuction) error

SkipRewardsAuction skips rewards auction since there is no bid.

func (Keeper) StartNewRewardsAuction

func (k Keeper) StartNewRewardsAuction(ctx sdk.Context, publicPosition types.PublicPosition, endTime time.Time) (auctionId uint64)

StartNewRewardsAuction creates a new rewards auction and increment the public position's last rewards auction id.

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

Bids queries all Bid objects.

func (Querier) ExchangeRate

ExchangeRate queries exchange rate, such as mint rate and burn rate per 1 sb.

func (Querier) Params

Params queries the parameters of the module.

func (Querier) PublicPosition

PublicPosition queries the particular public position object.

func (Querier) PublicPositions

PublicPositions queries all public position objects.

func (Querier) Rewards

Rewards queries all rewards accumulated for the public position.

func (Querier) RewardsAuction

RewardsAuction queries the particular RewardsAuction object.

func (Querier) RewardsAuctions

RewardsAuctions queries all RewardsAuction objects.

Jump to

Keyboard shortcuts

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