keeper

package
v5.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2023 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleLiquidFarmCreateProposal

func HandleLiquidFarmCreateProposal(ctx sdk.Context, k Keeper, p *types.LiquidFarmCreateProposal) error

func HandleLiquidFarmParameterChangeProposal

func HandleLiquidFarmParameterChangeProposal(ctx sdk.Context, k Keeper, p *types.LiquidFarmParameterChangeProposal) 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, liquidFarmId uint64,
	share sdk.Coin) (removedLiquidity sdk.Int, position ammtypes.Position, amt sdk.Coins, err error)

BurnShare handles types.MsgBurnShare to burn liquid farm share.

func (Keeper) CreateLiquidFarm

func (k Keeper) CreateLiquidFarm(
	ctx sdk.Context, poolId uint64, lowerPrice, upperPrice sdk.Dec,
	minBidAmt sdk.Int, feeRate sdk.Dec) (liquidFarm types.LiquidFarm, err error)

func (Keeper) DeleteBid

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

DeleteBid deletes the bid object.

func (Keeper) DeleteLiquidFarm

func (k Keeper) DeleteLiquidFarm(ctx sdk.Context, liquidFarm types.LiquidFarm)

DeleteLiquidFarm deletes the liquid farm 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, liquidFarm types.LiquidFarm, 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) GetAllBids

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

GetAllBids returns all bids in the store.

func (Keeper) GetAllLiquidFarms

func (k Keeper) GetAllLiquidFarms(ctx sdk.Context) (liquidFarms []types.LiquidFarm)

GetAllLiquidFarms returns all liquid farm 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, liquidFarmId, 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) GetLastLiquidFarmId

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

func (Keeper) GetLastRewardsAuction

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

func (Keeper) GetLiquidFarm

func (k Keeper) GetLiquidFarm(ctx sdk.Context, liquidFarmId uint64) (liquidFarm types.LiquidFarm, found bool)

GetLiquidFarm returns liquid farm object by the given id.

func (Keeper) GetLiquidFarmPosition

func (k Keeper) GetLiquidFarmPosition(ctx sdk.Context, liquidFarm types.LiquidFarm) (position ammtypes.Position, found bool)

func (Keeper) GetMaxNumRecentRewardsAuctions

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

func (Keeper) GetNextLiquidFarmIdWithUpdate

func (k Keeper) GetNextLiquidFarmIdWithUpdate(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, liquidFarm types.LiquidFarm) (auction types.RewardsAuction, found bool)

func (Keeper) GetRewardsAuction

func (k Keeper) GetRewardsAuction(ctx sdk.Context, liquidFarmId, 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) IterateAllLiquidFarms

func (k Keeper) IterateAllLiquidFarms(ctx sdk.Context, cb func(liquidFarm types.LiquidFarm) (stop bool))

IterateAllLiquidFarms iterates through all liquid farm 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, liquidFarmId, auctionId uint64, cb func(bid types.Bid) (stop bool))

func (Keeper) IterateRewardsAuctionsByLiquidFarm

func (k Keeper) IterateRewardsAuctionsByLiquidFarm(ctx sdk.Context, liquidFarmId 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) LookupLiquidFarm

func (k Keeper) LookupLiquidFarm(ctx sdk.Context, liquidFarmId uint64) (found bool)

func (Keeper) LookupRewardsAuction

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

func (Keeper) MintShare

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

func (Keeper) MustGetLiquidFarmPosition

func (k Keeper) MustGetLiquidFarmPosition(ctx sdk.Context, liquidFarm types.LiquidFarm) ammtypes.Position

func (Keeper) PlaceBid

func (k Keeper) PlaceBid(
	ctx sdk.Context, bidderAddr sdk.AccAddress, liquidFarmId, 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) SetLastLiquidFarmId

func (k Keeper) SetLastLiquidFarmId(ctx sdk.Context, liquidFarmId uint64)

func (Keeper) SetLiquidFarm

func (k Keeper) SetLiquidFarm(ctx sdk.Context, liquidFarm types.LiquidFarm)

SetLiquidFarm stores liquid farm object with the given id.

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) 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, liquidFarm types.LiquidFarm, auction types.RewardsAuction) error

SkipRewardsAuction skips rewards auction since there is no bid.

func (Keeper) StartNewRewardsAuction

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

StartNewRewardsAuction creates a new rewards auction and increment the liquid farm'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) LiquidFarm

LiquidFarm queries the particular LiquidFarm object.

func (Querier) LiquidFarms

LiquidFarms queries all LiquidFarm objects.

func (Querier) Params

Params queries the parameters of the module.

func (Querier) Rewards

Rewards queries all rewards accumulated for the liquid farm.

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