Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func CanWithdrawInvariant(k Keeper) sdk.Invariant
- func HandleFarmingPlanProposal(ctx sdk.Context, k Keeper, p *types.FarmingPlanProposal) error
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func OutstandingRewardsInvariant(k Keeper) sdk.Invariant
- func ReferenceCountInvariant(k Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func TotalFarmingAmountInvariant(k Keeper) sdk.Invariant
- type Keeper
- func (k Keeper) AllocateRewards(ctx sdk.Context) error
- func (k Keeper) CanCreatePrivatePlan(ctx sdk.Context) bool
- func (k Keeper) CreatePrivatePlan(ctx sdk.Context, creatorAddr sdk.AccAddress, description string, ...) (types.Plan, error)
- func (k Keeper) CreatePublicPlan(ctx sdk.Context, description string, farmingPoolAddr sdk.AccAddress, ...) (types.Plan, error)
- func (k Keeper) DeleteHistoricalRewards(ctx sdk.Context, denom string, period uint64)
- func (k Keeper) DeletePosition(ctx sdk.Context, farmerAddr sdk.AccAddress, denom string)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) Farm(ctx sdk.Context, farmerAddr sdk.AccAddress, coin sdk.Coin) (withdrawnRewards sdk.Coins, err error)
- func (k Keeper) GetFarm(ctx sdk.Context, denom string) (farm types.Farm, found bool)
- func (k Keeper) GetFeeCollector(ctx sdk.Context) (feeCollector string)
- func (k Keeper) GetHistoricalRewards(ctx sdk.Context, denom string, period uint64) (hist types.HistoricalRewards, found bool)
- func (k Keeper) GetLastBlockTime(ctx sdk.Context) (t time.Time, found bool)
- func (k Keeper) GetLastPlanId(ctx sdk.Context) (id uint64, found bool)
- func (k Keeper) GetMaxBlockDuration(ctx sdk.Context) (d time.Duration)
- func (k Keeper) GetMaxNumPrivatePlans(ctx sdk.Context) (num uint32)
- func (k Keeper) GetNumPrivatePlans(ctx sdk.Context) (num uint64)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPlan(ctx sdk.Context, id uint64) (plan types.Plan, found bool)
- func (k Keeper) GetPosition(ctx sdk.Context, farmerAddr sdk.AccAddress, denom string) (position types.Position, found bool)
- func (k Keeper) GetPrivatePlanCreationFee(ctx sdk.Context) (fee sdk.Coins)
- func (k Keeper) Harvest(ctx sdk.Context, farmerAddr sdk.AccAddress, denom string) (withdrawnRewards sdk.Coins, err error)
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) IterateAllFarms(ctx sdk.Context, cb func(denom string, farm types.Farm) (stop bool))
- func (k Keeper) IterateAllHistoricalRewards(ctx sdk.Context, ...)
- func (k Keeper) IterateAllPlans(ctx sdk.Context, cb func(plan types.Plan) (stop bool))
- func (k Keeper) IterateAllPositions(ctx sdk.Context, cb func(position types.Position) (stop bool))
- func (k Keeper) IteratePositionsByFarmer(ctx sdk.Context, farmerAddr sdk.AccAddress, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) PoolRewardWeight(ctx sdk.Context, pool liquiditytypes.Pool, pair liquiditytypes.Pair) sdk.Dec
- func (k Keeper) Rewards(ctx sdk.Context, farmerAddr sdk.AccAddress, denom string) sdk.DecCoins
- func (k Keeper) SetFarm(ctx sdk.Context, denom string, farm types.Farm)
- func (k Keeper) SetFeeCollector(ctx sdk.Context, feeCollector string)
- func (k Keeper) SetHistoricalRewards(ctx sdk.Context, denom string, period uint64, hist types.HistoricalRewards)
- func (k Keeper) SetLastBlockTime(ctx sdk.Context, t time.Time)
- func (k Keeper) SetLastPlanId(ctx sdk.Context, id uint64)
- func (k Keeper) SetMaxBlockDuration(ctx sdk.Context, d time.Duration)
- func (k Keeper) SetMaxNumPrivatePlans(ctx sdk.Context, num uint32)
- func (k Keeper) SetNumPrivatePlans(ctx sdk.Context, num uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPlan(ctx sdk.Context, plan types.Plan)
- func (k Keeper) SetPosition(ctx sdk.Context, position types.Position)
- func (k Keeper) SetPrivatePlanCreationFee(ctx sdk.Context, fee sdk.Coins)
- func (k Keeper) TerminateEndedPlans(ctx sdk.Context) (err error)
- func (k Keeper) TerminatePlan(ctx sdk.Context, plan types.Plan) error
- func (k Keeper) TotalRewards(ctx sdk.Context, farmerAddr sdk.AccAddress) (rewards sdk.DecCoins)
- func (k Keeper) Unfarm(ctx sdk.Context, farmerAddr sdk.AccAddress, coin sdk.Coin) (withdrawnRewards sdk.Coins, err error)
- type Querier
- func (k Querier) Farm(c context.Context, req *types.QueryFarmRequest) (*types.QueryFarmResponse, error)
- func (k Querier) HistoricalRewards(c context.Context, req *types.QueryHistoricalRewardsRequest) (*types.QueryHistoricalRewardsResponse, error)
- func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) Plan(c context.Context, req *types.QueryPlanRequest) (*types.QueryPlanResponse, error)
- func (k Querier) Plans(c context.Context, req *types.QueryPlansRequest) (*types.QueryPlansResponse, error)
- func (k Querier) Position(c context.Context, req *types.QueryPositionRequest) (*types.QueryPositionResponse, error)
- func (k Querier) Positions(c context.Context, req *types.QueryPositionsRequest) (*types.QueryPositionsResponse, error)
- func (k Querier) Rewards(c context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
- func (k Querier) TotalRewards(c context.Context, req *types.QueryTotalRewardsRequest) (*types.QueryTotalRewardsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
func CanWithdrawInvariant ¶
CanWithdrawInvariant checks that all farmers can withdraw their rewards.
func HandleFarmingPlanProposal ¶
HandleFarmingPlanProposal is a handler for executing a farming plan proposal.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func OutstandingRewardsInvariant ¶
OutstandingRewardsInvariant checks that the outstanding rewards of all farms are not smaller than the farm's current accrued rewards, and the reward pool has sufficient balances for those rewards.
func ReferenceCountInvariant ¶
ReferenceCountInvariant checks that the all historical rewards object has consistent reference counts with all farms and positions.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
func TotalFarmingAmountInvariant ¶
TotalFarmingAmountInvariant checks that all farm's total farming amount are equal to the sum of all the positions' farming amount which belong to the farm.
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, liquidityKeeper types.LiquidityKeeper, ) Keeper
NewKeeper creates a new Keeper instance.
func (Keeper) AllocateRewards ¶
AllocateRewards allocates the current block's rewards to the farms based on active plans.
func (Keeper) CanCreatePrivatePlan ¶
CanCreatePrivatePlan returns true if the current number of non-terminated private plans is less than the limit.
func (Keeper) CreatePrivatePlan ¶
func (k Keeper) CreatePrivatePlan( ctx sdk.Context, creatorAddr sdk.AccAddress, description string, rewardAllocs []types.RewardAllocation, startTime, endTime time.Time, ) (types.Plan, error)
CreatePrivatePlan creates a new private farming plan.
func (Keeper) CreatePublicPlan ¶
func (k Keeper) CreatePublicPlan( ctx sdk.Context, description string, farmingPoolAddr sdk.AccAddress, rewardAllocs []types.RewardAllocation, startTime, endTime time.Time, ) (types.Plan, error)
CreatePublicPlan creates a new public farming plan.
func (Keeper) DeleteHistoricalRewards ¶
func (Keeper) DeletePosition ¶
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the module's exported genesis.
func (Keeper) Farm ¶
func (k Keeper) Farm(ctx sdk.Context, farmerAddr sdk.AccAddress, coin sdk.Coin) (withdrawnRewards sdk.Coins, err error)
Farm locks the coin. The farmer's rewards accrued in the given coin's denom are sent to the farmer. Farm creates a new farm object for the given coin's denom, if there wasn't.
func (Keeper) GetFeeCollector ¶
func (Keeper) GetHistoricalRewards ¶
func (Keeper) GetLastBlockTime ¶
func (Keeper) GetLastPlanId ¶
func (Keeper) GetMaxBlockDuration ¶
func (Keeper) GetMaxNumPrivatePlans ¶
func (Keeper) GetPosition ¶
func (Keeper) GetPrivatePlanCreationFee ¶
func (Keeper) Harvest ¶
func (k Keeper) Harvest(ctx sdk.Context, farmerAddr sdk.AccAddress, denom string) (withdrawnRewards sdk.Coins, err error)
Harvest sends the farmer's rewards accrued in the denom to the farmer.
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) IterateAllFarms ¶
func (Keeper) IterateAllHistoricalRewards ¶
func (Keeper) IterateAllPlans ¶
func (Keeper) IterateAllPositions ¶
func (Keeper) IteratePositionsByFarmer ¶
func (Keeper) PoolRewardWeight ¶
func (k Keeper) PoolRewardWeight(ctx sdk.Context, pool liquiditytypes.Pool, pair liquiditytypes.Pair) sdk.Dec
PoolRewardWeight returns the pool's reward weight.
func (Keeper) Rewards ¶
Rewards returns the farmer's rewards accrued in the denom so far. Rewards is a convenient query method existing for external modules.
func (Keeper) SetFeeCollector ¶
func (Keeper) SetHistoricalRewards ¶
func (Keeper) SetMaxBlockDuration ¶
func (Keeper) SetMaxNumPrivatePlans ¶
func (Keeper) SetPrivatePlanCreationFee ¶
func (Keeper) TerminateEndedPlans ¶
TerminateEndedPlans iterates through all plans and terminate the plans which should be ended by the current block time.
func (Keeper) TerminatePlan ¶
TerminatePlan mark the plan as terminated and send remaining balances in the farming pool to the termination address.
func (Keeper) TotalRewards ¶
TotalRewards returns the farmer's rewards accrued in all denoms so far. TotalRewards is a convenient query method existing for external modules.
func (Keeper) Unfarm ¶
func (k Keeper) Unfarm(ctx sdk.Context, farmerAddr sdk.AccAddress, coin sdk.Coin) (withdrawnRewards sdk.Coins, err error)
Unfarm unlocks the coin. The farmer's rewards accrued in the given coin's denom are sent to the farmer. If the remaining farming coin amount becomes zero, the farming position is deleted.
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) Farm ¶
func (k Querier) Farm(c context.Context, req *types.QueryFarmRequest) (*types.QueryFarmResponse, error)
func (Querier) HistoricalRewards ¶
func (k Querier) HistoricalRewards(c context.Context, req *types.QueryHistoricalRewardsRequest) (*types.QueryHistoricalRewardsResponse, error)
func (Querier) Params ¶
func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the parameters of the lending module.
func (Querier) Plan ¶
func (k Querier) Plan(c context.Context, req *types.QueryPlanRequest) (*types.QueryPlanResponse, error)
func (Querier) Plans ¶
func (k Querier) Plans(c context.Context, req *types.QueryPlansRequest) (*types.QueryPlansResponse, error)
func (Querier) Position ¶
func (k Querier) Position(c context.Context, req *types.QueryPositionRequest) (*types.QueryPositionResponse, error)
func (Querier) Positions ¶
func (k Querier) Positions(c context.Context, req *types.QueryPositionsRequest) (*types.QueryPositionsResponse, error)
func (Querier) Rewards ¶
func (k Querier) Rewards(c context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
func (Querier) TotalRewards ¶
func (k Querier) TotalRewards(c context.Context, req *types.QueryTotalRewardsRequest) (*types.QueryTotalRewardsResponse, error)