Documentation ¶
Index ¶
- Variables
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) CreateRewardsAuction(ctx sdk.Context, poolId uint64, endTime time.Time)
- func (k Keeper) DeleteBid(ctx sdk.Context, bid types.Bid)
- func (k Keeper) DeleteLiquidFarm(ctx sdk.Context, liquidFarm types.LiquidFarm)
- func (k Keeper) DeleteWinningBid(ctx sdk.Context, auctionId, poolId uint64)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) FinishRewardsAuction(ctx sdk.Context, auction types.RewardsAuction, feeRate sdk.Dec) error
- func (k Keeper) GetAllRewardsAuctions(ctx sdk.Context) (auctions []types.RewardsAuction)
- func (k Keeper) GetBid(ctx sdk.Context, poolId uint64, bidder sdk.AccAddress) (bid types.Bid, found bool)
- func (k Keeper) GetBidsByPoolId(ctx sdk.Context, poolId uint64) []types.Bid
- func (k Keeper) GetCompoundingRewards(ctx sdk.Context, poolId uint64) (rewards types.CompoundingRewards, found bool)
- func (k Keeper) GetFeeCollector(ctx sdk.Context) (feeCollector string)
- func (k Keeper) GetLastRewardsAuction(ctx sdk.Context, poolId uint64) (auction types.RewardsAuction, found bool)
- func (k Keeper) GetLastRewardsAuctionEndTime(ctx sdk.Context) (t time.Time, found bool)
- func (k Keeper) GetLastRewardsAuctionId(ctx sdk.Context, poolId uint64) uint64
- func (k Keeper) GetLiquidFarm(ctx sdk.Context, poolId uint64) (liquidFarm types.LiquidFarm, found bool)
- func (k Keeper) GetLiquidFarmsInParams(ctx sdk.Context) (liquidFarms []types.LiquidFarm)
- func (k Keeper) GetLiquidFarmsInStore(ctx sdk.Context) (liquidFarms []types.LiquidFarm)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRewardsAuction(ctx sdk.Context, auctionId uint64, poolId uint64) (auction types.RewardsAuction, found bool)
- func (k Keeper) GetRewardsAuctionDuration(ctx sdk.Context) (duration time.Duration)
- func (k Keeper) GetWinningBid(ctx sdk.Context, auctionId uint64, poolId uint64) (bid types.Bid, found bool)
- func (k Keeper) HandleRemovedLiquidFarm(ctx sdk.Context, liquidFarm types.LiquidFarm)
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) IterateBidsByPoolId(ctx sdk.Context, poolId uint64, cb func(bid types.Bid) (stop bool))
- func (k Keeper) IterateLiquidFarms(ctx sdk.Context, cb func(liquidFarm types.LiquidFarm) (stop bool))
- func (k Keeper) IterateRewardsAuctions(ctx sdk.Context, cb func(auction types.RewardsAuction) (stop bool))
- func (k Keeper) LiquidFarm(ctx sdk.Context, poolId uint64, farmer sdk.AccAddress, farmingCoin sdk.Coin) error
- func (k Keeper) LiquidUnfarm(ctx sdk.Context, poolId uint64, farmer sdk.AccAddress, unfarmingCoin sdk.Coin) (unfarmedCoin sdk.Coin, err error)
- func (k Keeper) LiquidUnfarmAndWithdraw(ctx sdk.Context, poolId uint64, farmer sdk.AccAddress, unfarmingCoin sdk.Coin) error
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) PlaceBid(ctx sdk.Context, auctionId uint64, poolId uint64, bidder sdk.AccAddress, ...) (types.Bid, error)
- func (k Keeper) RefundBid(ctx sdk.Context, auctionId uint64, poolId uint64, bidder sdk.AccAddress) error
- func (k Keeper) SetBid(ctx sdk.Context, bid types.Bid)
- func (k Keeper) SetCompoundingRewards(ctx sdk.Context, poolId uint64, rewards types.CompoundingRewards)
- func (k Keeper) SetLastRewardsAuctionEndTime(ctx sdk.Context, t time.Time)
- func (k Keeper) SetLastRewardsAuctionId(ctx sdk.Context, auctionId uint64, poolId uint64)
- func (k Keeper) SetLiquidFarm(ctx sdk.Context, liquidFarm types.LiquidFarm)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetRewardsAuction(ctx sdk.Context, auction types.RewardsAuction)
- func (k Keeper) SetWinningBid(ctx sdk.Context, auctionId uint64, bid types.Bid)
- type Querier
- func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.QueryBidsResponse, error)
- func (k Querier) ExchangeRate(c context.Context, req *types.QueryExchangeRateRequest) (*types.QueryExchangeRateResponse, error)
- func (k Querier) LiquidFarm(c context.Context, req *types.QueryLiquidFarmRequest) (*types.QueryLiquidFarmResponse, error)
- func (k Querier) LiquidFarms(c context.Context, req *types.QueryLiquidFarmsRequest) (*types.QueryLiquidFarmsResponse, error)
- func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) Rewards(c context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
- func (k Querier) RewardsAuction(c context.Context, req *types.QueryRewardsAuctionRequest) (*types.QueryRewardsAuctionResponse, error)
- func (k Querier) RewardsAuctions(c context.Context, req *types.QueryRewardsAuctionsRequest) (*types.QueryRewardsAuctionsResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( // EnableAdvanceAuction indicates whether msgServer accepts MsgAdvanceAuction or not. // Setting this true in production mode will expose unexpected vulnerability. EnableAdvanceAuction = false )
Functions ¶
func NewMsgServerImpl ¶
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 ¶
CreateRewardsAuction creates new rewards auction and store it.
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 ¶
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 ¶
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 (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 ¶
GetLastRewardsAuctionEndTime returns the last rewards auction end time.
func (Keeper) GetLastRewardsAuctionId ¶
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) 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 (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) 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) 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 ¶
SetLastRewardsAuctionEndTime stores the last rewards auction end time.
func (Keeper) SetLastRewardsAuctionId ¶
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) SetRewardsAuction ¶
func (k Keeper) SetRewardsAuction(ctx sdk.Context, auction types.RewardsAuction)
SetRewardsAuction stores rewards auction.
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 ¶
func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.QueryBidsResponse, error)
Bids queries all Bid objects.
func (Querier) ExchangeRate ¶
func (k Querier) ExchangeRate(c context.Context, req *types.QueryExchangeRateRequest) (*types.QueryExchangeRateResponse, error)
ExchangeRate queries exchange rate, such as mint rate and burn rate per 1 LFCoin.
func (Querier) LiquidFarm ¶
func (k Querier) LiquidFarm(c context.Context, req *types.QueryLiquidFarmRequest) (*types.QueryLiquidFarmResponse, error)
LiquidFarm queries the particular LiquidFarm object.
func (Querier) LiquidFarms ¶
func (k Querier) LiquidFarms(c context.Context, req *types.QueryLiquidFarmsRequest) (*types.QueryLiquidFarmsResponse, error)
LiquidFarms queries all LiquidFarm objects.
func (Querier) Params ¶
func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the parameters of the module.
func (Querier) Rewards ¶
func (k Querier) Rewards(c context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
Rewards queries all farming rewards accumulated for the liquid farm.
func (Querier) RewardsAuction ¶
func (k Querier) RewardsAuction(c context.Context, req *types.QueryRewardsAuctionRequest) (*types.QueryRewardsAuctionResponse, error)
RewardsAuction queries the particular RewardsAuction object.
func (Querier) RewardsAuctions ¶
func (k Querier) RewardsAuctions(c context.Context, req *types.QueryRewardsAuctionsRequest) (*types.QueryRewardsAuctionsResponse, error)
RewardsAuctions queries all RewardsAuction objects.