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: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// EnableAdvanceAuction indicates whether msgServer accepts MsgAdvanceAuction or not.
	// Setting this true in production mode will expose unexpected vulnerability.
	EnableAdvanceAuction = false
)

Functions

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,
	lpfarmKeeper types.LPFarmKeeper,
	liquidityKeeper types.LiquidityKeeper,
) Keeper

func (Keeper) CreateRewardsAuction

func (k Keeper) CreateRewardsAuction(ctx sdk.Context, poolId uint64, endTime time.Time)

CreateRewardsAuction creates new rewards auction and store it.

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

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

DeleteWinningBid deletes the winning bid from the store.

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, auction types.RewardsAuction, feeRate sdk.Dec) 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) 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, poolId uint64, bidder sdk.AccAddress) (bid types.Bid, found bool)

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

func (Keeper) GetBidsByPoolId

func (k Keeper) GetBidsByPoolId(ctx sdk.Context, poolId uint64) []types.Bid

GetBidsByPoolId returns all bid objects by the pool id.

func (Keeper) GetCompoundingRewards

func (k Keeper) GetCompoundingRewards(ctx sdk.Context, poolId uint64) (rewards types.CompoundingRewards, found bool)

GetCompoundingRewards returns the last farming rewards by the given pool id.

func (Keeper) GetFeeCollector

func (k Keeper) GetFeeCollector(ctx sdk.Context) (feeCollector string)

func (Keeper) GetLastRewardsAuction

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

GetLastRewardsAuction is a convenient method to look up last rewards auction id and returns the reward auction object.

func (Keeper) GetLastRewardsAuctionEndTime

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

GetLastRewardsAuctionEndTime returns the last rewards auction end time.

func (Keeper) GetLastRewardsAuctionId

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

GetLastRewardsAuctionId returns the last rewards auction id.

func (Keeper) GetLiquidFarm

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

GetLiquidFarm returns liquid farm object by the given pool id.

func (Keeper) GetLiquidFarmsInParams

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

func (Keeper) GetLiquidFarmsInStore

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

GetLiquidFarmsInStore returns all liquid farm objects stored in the store.

func (Keeper) GetParams

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

GetParams returns the parameters for the module.

func (Keeper) GetRewardsAuction

func (k Keeper) GetRewardsAuction(ctx sdk.Context, auctionId uint64, poolId 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) GetWinningBid

func (k Keeper) GetWinningBid(ctx sdk.Context, auctionId uint64, poolId uint64) (bid types.Bid, found bool)

GetWinningBid returns the winning bid object by the given pool id and auction id.

func (Keeper) HandleRemovedLiquidFarm

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

HandleRemovedLiquidFarm unfarms all farmed coin from the farm module to stop having farming rewards accumulated and sends the harvested rewards to the fee collector. It refunds all placed bids and updates an appropriate states.

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

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

IterateBidsBy PoolId iterates through all bids by pool id stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.

func (Keeper) IterateLiquidFarms

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

IterateLiquidFarms 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) IterateRewardsAuctions

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

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

func (Keeper) LiquidFarm

func (k Keeper) LiquidFarm(ctx sdk.Context, poolId uint64, farmer sdk.AccAddress, farmingCoin sdk.Coin) error

LiquidFarm handles types.MsgLiquidFarm to farm.

func (Keeper) LiquidUnfarm

func (k Keeper) LiquidUnfarm(ctx sdk.Context, poolId uint64, farmer sdk.AccAddress, unfarmingCoin sdk.Coin) (unfarmedCoin sdk.Coin, err error)

LiquidUnfarm handles types.MsgLiquidUnfarm to unfarm LFCoin. It doesn't validate if the liquid farm exists because farmers still need to be able to unfarm their LFCoin in case the liquid farm object is removed in params by governance proposal.

func (Keeper) LiquidUnfarmAndWithdraw

func (k Keeper) LiquidUnfarmAndWithdraw(ctx sdk.Context, poolId uint64, farmer sdk.AccAddress, unfarmingCoin sdk.Coin) error

LiquidUnfarmAndWithdraw handles types.MsgUnfarmAndWithdraw to unfarm LFCoin and withdraw pool coin from the pool.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) PlaceBid

func (k Keeper) PlaceBid(ctx sdk.Context, auctionId uint64, poolId uint64, bidder sdk.AccAddress, biddingCoin sdk.Coin) (types.Bid, error)

PlaceBid handles types.MsgPlaceBid and stores bid object.

func (Keeper) RefundBid

func (k Keeper) RefundBid(ctx sdk.Context, auctionId uint64, poolId uint64, bidder sdk.AccAddress) error

RefundBid handles types.MsgRefundBid and refunds bid amount to the bidder and delete the 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) SetCompoundingRewards

func (k Keeper) SetCompoundingRewards(ctx sdk.Context, poolId uint64, rewards types.CompoundingRewards)

SetCompoundingRewards stores compounding rewards with the given pool id.

func (Keeper) SetLastRewardsAuctionEndTime

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

SetLastRewardsAuctionEndTime stores the last rewards auction end time.

func (Keeper) SetLastRewardsAuctionId

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

SetLastRewardsAuctionId stores the last rewards auction id.

func (Keeper) SetLiquidFarm

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

SetLiquidFarm stores liquid farm object with the given pool id.

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

func (k Keeper) SetWinningBid(ctx sdk.Context, auctionId uint64, bid types.Bid)

SetWinningBid stores the winning bid with the 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 LFCoin.

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 farming 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