Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func FarmingPoolsEscrowAmountInvariant(k Keeper) sdk.Invariant
- func HandlePublicPlanProposal(ctx sdk.Context, k Keeper, plansAny []*codectypes.Any) error
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- type Keeper
- func (k Keeper) Claim(ctx sdk.Context, msg *types.MsgClaim) (types.Reward, error)
- func (k Keeper) CreateFixedAmountPlan(ctx sdk.Context, msg *types.MsgCreateFixedAmountPlan, typ types.PlanType) *types.FixedAmountPlan
- func (k Keeper) CreateRatioPlan(ctx sdk.Context, msg *types.MsgCreateRatioPlan, typ types.PlanType) *types.RatioPlan
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllPlans(ctx sdk.Context) (plans []types.PlanI)
- func (k Keeper) GetAllRewards(ctx sdk.Context) (rewards []types.Reward)
- func (k Keeper) GetAllStakings(ctx sdk.Context) (stakings []types.Staking)
- func (k Keeper) GetCodec() codec.BinaryCodec
- func (k Keeper) GetNextPlanIDWithUpdate(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPlan(ctx sdk.Context, id uint64) (plan types.PlanI, found bool)
- func (k Keeper) GetPlansByFarmerAddrIndex(ctx sdk.Context, farmerAcc sdk.AccAddress) (plans []types.PlanI)
- func (k Keeper) GetReward(ctx sdk.Context, planID uint64, farmerAcc sdk.AccAddress) (reward types.Reward, found bool)
- func (k Keeper) GetRewardsByPlanID(ctx sdk.Context, planID uint64) (rewards []types.Reward)
- func (k Keeper) GetStaking(ctx sdk.Context, planID uint64, farmerAcc sdk.AccAddress) (staking types.Staking, found bool)
- func (k Keeper) GetStakingsByPlanID(ctx sdk.Context, planID uint64) (stakings []types.Staking)
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) IterateAllPlans(ctx sdk.Context, cb func(plan types.PlanI) (stop bool))
- func (k Keeper) IterateAllRewards(ctx sdk.Context, cb func(reward types.Reward) (stop bool))
- func (k Keeper) IterateAllStakings(ctx sdk.Context, cb func(staking types.Staking) (stop bool))
- func (k Keeper) IteratePlansByFarmerAddr(ctx sdk.Context, farmerAcc sdk.AccAddress, ...)
- func (k Keeper) IterateRewardsByPlanID(ctx sdk.Context, planID uint64, cb func(reward types.Reward) (stop bool))
- func (k Keeper) IterateStakingsByPlanID(ctx sdk.Context, planID uint64, cb func(staking types.Staking) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarshalPlan(plan types.PlanI) ([]byte, error)
- func (k Keeper) NewPlan(ctx sdk.Context, plan types.PlanI) types.PlanI
- func (k Keeper) ReleaseStakingCoins(ctx sdk.Context, reserveAcc, farmer sdk.AccAddress, unstakingCoins sdk.Coins) error
- func (k Keeper) RemovePlan(ctx sdk.Context, plan types.PlanI)
- func (k Keeper) RemoveReward(ctx sdk.Context, reward types.Reward)
- func (k Keeper) RemoveStaking(ctx sdk.Context, staking types.Staking)
- func (k Keeper) ReserveStakingCoins(ctx sdk.Context, farmer, reserveAcc sdk.AccAddress, stakingCoins sdk.Coins) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPlan(ctx sdk.Context, plan types.PlanI)
- func (k Keeper) SetPlanIDByFarmerAddrIndex(ctx sdk.Context, planID uint64, farmerAcc sdk.AccAddress)
- func (k Keeper) SetReward(ctx sdk.Context, reward types.Reward)
- func (k Keeper) SetStaking(ctx sdk.Context, staking types.Staking)
- func (k Keeper) Stake(ctx sdk.Context, msg *types.MsgStake) (types.Staking, error)
- func (k Keeper) UnmarshalPlan(bz []byte) (types.PlanI, error)
- func (k Keeper) UnmarshalReward(bz []byte) (types.Reward, error)
- func (k Keeper) UnmarshalStaking(bz []byte) (types.Staking, error)
- func (k Keeper) Unstake(ctx sdk.Context, msg *types.MsgUnstake) (types.Staking, error)
- func (k Keeper) ValidateGenesis(ctx sdk.Context, genState types.GenesisState) error
- type Querier
- func (k Querier) FarmerReward(c context.Context, req *types.QueryFarmerRewardRequest) (*types.QueryFarmerRewardResponse, error)
- func (k Querier) FarmerRewards(c context.Context, req *types.QueryFarmerRewardsRequest) (*types.QueryFarmerRewardsResponse, error)
- func (k Querier) FarmerStaking(c context.Context, req *types.QueryFarmerStakingRequest) (*types.QueryFarmerStakingResponse, error)
- func (k Querier) FarmerStakings(c context.Context, req *types.QueryFarmerStakingsRequest) (*types.QueryFarmerStakingsResponse, 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) PlanRewards(c context.Context, req *types.QueryPlanRewardsRequest) (*types.QueryPlanRewardsResponse, error)
- func (k Querier) PlanStakings(c context.Context, req *types.QueryPlanStakingsRequest) (*types.QueryPlanStakingsResponse, error)
- func (k Querier) Plans(c context.Context, req *types.QueryPlansRequest) (*types.QueryPlansResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the farming module.
func FarmingPoolsEscrowAmountInvariant ¶
FarmingPoolsEscrowAmountInvariant checks that outstanding unwithdrawn fees are never negative.
func HandlePublicPlanProposal ¶
HandlePublicPlanProposal is a handler for executing a fixed amount plan creation proposal.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the farming MsgServer interface for the provided Keeper.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all farming invariants.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the farming store
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, distrKeeper types.DistributionKeeper, blockedAddrs map[string]bool, ) Keeper
NewKeeper returns a farming keeper. It handles: - creating new ModuleAccounts for each pool ReserveAccount - sending to and from ModuleAccounts - minting, burning PoolCoins
func (Keeper) CreateFixedAmountPlan ¶
func (k Keeper) CreateFixedAmountPlan(ctx sdk.Context, msg *types.MsgCreateFixedAmountPlan, typ types.PlanType) *types.FixedAmountPlan
CreateFixedAmountPlan sets fixed amount plan.
func (Keeper) CreateRatioPlan ¶
func (k Keeper) CreateRatioPlan(ctx sdk.Context, msg *types.MsgCreateRatioPlan, typ types.PlanType) *types.RatioPlan
CreateRatioPlan sets ratio plan.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the farming module's genesis state.
func (Keeper) GetAllPlans ¶
GetAllPlans returns all plans in the Keeper.
func (Keeper) GetAllRewards ¶
GetAllRewards returns all rewards in the Keeper.
func (Keeper) GetAllStakings ¶
GetAllStakings returns all stakings in the Keeper.
func (Keeper) GetCodec ¶
func (k Keeper) GetCodec() codec.BinaryCodec
GetCodec return codec.Codec object used by the keeper
func (Keeper) GetNextPlanIDWithUpdate ¶
GetNextPlanIDWithUpdate returns and increments the global Plan ID counter. If the global plan number is not set, it initializes it with value 1.
func (Keeper) GetPlansByFarmerAddrIndex ¶
func (k Keeper) GetPlansByFarmerAddrIndex(ctx sdk.Context, farmerAcc sdk.AccAddress) (plans []types.PlanI)
GetPlansByFarmerAddrIndex reads from kvstore and return a specific Plan indexed by given farmer address
func (Keeper) GetReward ¶
func (k Keeper) GetReward(ctx sdk.Context, planID uint64, farmerAcc sdk.AccAddress) (reward types.Reward, found bool)
GetReward return a specific reward
func (Keeper) GetRewardsByPlanID ¶
GetRewardsByPlanID reads from kvstore and return a specific Reward indexed by given plan id
func (Keeper) GetStaking ¶
func (k Keeper) GetStaking(ctx sdk.Context, planID uint64, farmerAcc sdk.AccAddress) (staking types.Staking, found bool)
GetStaking return a specific staking
func (Keeper) GetStakingsByPlanID ¶
GetStakingsByPlanID reads from kvstore and return a specific Staking indexed by given plan id
func (Keeper) InitGenesis ¶
func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
InitGenesis initializes the farming module's state from a given genesis state.
func (Keeper) IterateAllPlans ¶
IterateAllPlans iterates over all the stored plans and performs a callback function. Stops iteration when callback returns true.
func (Keeper) IterateAllRewards ¶
IterateAllRewards iterates over all the stored rewards and performs a callback function. Stops iteration when callback returns true.
func (Keeper) IterateAllStakings ¶
IterateAllStakings iterates over all the stored stakings and performs a callback function. Stops iteration when callback returns true.
func (Keeper) IteratePlansByFarmerAddr ¶
func (k Keeper) IteratePlansByFarmerAddr(ctx sdk.Context, farmerAcc sdk.AccAddress, cb func(plan types.PlanI) (stop bool))
IteratePlansByFarmerAddr iterates over all the stored plans and performs a callback function. Stops iteration when callback returns true.
func (Keeper) IterateRewardsByPlanID ¶
func (k Keeper) IterateRewardsByPlanID(ctx sdk.Context, planID uint64, cb func(reward types.Reward) (stop bool))
IterateRewardsByPlanID iterates over all the stored rewards and performs a callback function. Stops iteration when callback returns true.
func (Keeper) IterateStakingsByPlanID ¶
func (k Keeper) IterateStakingsByPlanID(ctx sdk.Context, planID uint64, cb func(staking types.Staking) (stop bool))
IterateStakingsByPlanID iterates over all the stored stakings and performs a callback function. Stops iteration when callback returns true.
func (Keeper) MarshalPlan ¶
MarshalPlan protobuf serializes an Plan interface
func (Keeper) ReleaseStakingCoins ¶
func (k Keeper) ReleaseStakingCoins(ctx sdk.Context, reserveAcc, farmer sdk.AccAddress, unstakingCoins sdk.Coins) error
ReleaseStakingCoins sends staking coins back to the farmer.
func (Keeper) RemovePlan ¶
RemovePlan removes an plan for the plan mapper store. NOTE: this will cause supply invariant violation if called
func (Keeper) RemoveReward ¶
RemoveReward removes an reward for the reward mapper store.
func (Keeper) RemoveStaking ¶
RemoveStaking removes an staking for the staking mapper store.
func (Keeper) ReserveStakingCoins ¶
func (k Keeper) ReserveStakingCoins(ctx sdk.Context, farmer, reserveAcc sdk.AccAddress, stakingCoins sdk.Coins) error
ReserveStakingCoins sends staking coins to the staking reserve account.
func (Keeper) SetPlanIDByFarmerAddrIndex ¶
func (k Keeper) SetPlanIDByFarmerAddrIndex(ctx sdk.Context, planID uint64, farmerAcc sdk.AccAddress)
SetPlanIDByFarmerAddrIndex sets Index by FarmerAddr TODO: need to gas cost check for existing check or update everytime
func (Keeper) SetStaking ¶
SetStaking implements Staking.
func (Keeper) Stake ¶
Stake stores staking coins to queued coins and it will be processed in the next epoch.
func (Keeper) UnmarshalPlan ¶
UnmarshalPlan returns an Plan interface from raw encoded plan bytes of a Proto-based Plan type
func (Keeper) UnmarshalReward ¶
UnmarshalReward unmarshals a Reward from bytes.
func (Keeper) UnmarshalStaking ¶
UnmarshalStaking unmarshals a Staking from bytes.
func (Keeper) Unstake ¶
Unstake unstakes an amount of staking coins from the staking reserve account.
func (Keeper) ValidateGenesis ¶
ValidateGenesis validates the farming module's genesis state.
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) FarmerReward ¶
func (k Querier) FarmerReward(c context.Context, req *types.QueryFarmerRewardRequest) (*types.QueryFarmerRewardResponse, error)
func (Querier) FarmerRewards ¶
func (k Querier) FarmerRewards(c context.Context, req *types.QueryFarmerRewardsRequest) (*types.QueryFarmerRewardsResponse, error)
func (Querier) FarmerStaking ¶
func (k Querier) FarmerStaking(c context.Context, req *types.QueryFarmerStakingRequest) (*types.QueryFarmerStakingResponse, error)
func (Querier) FarmerStakings ¶
func (k Querier) FarmerStakings(c context.Context, req *types.QueryFarmerStakingsRequest) (*types.QueryFarmerStakingsResponse, error)
func (Querier) Params ¶
func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Querier) Plan ¶
func (k Querier) Plan(c context.Context, req *types.QueryPlanRequest) (*types.QueryPlanResponse, error)
func (Querier) PlanRewards ¶
func (k Querier) PlanRewards(c context.Context, req *types.QueryPlanRewardsRequest) (*types.QueryPlanRewardsResponse, error)
func (Querier) PlanStakings ¶
func (k Querier) PlanStakings(c context.Context, req *types.QueryPlanStakingsRequest) (*types.QueryPlanStakingsResponse, error)
func (Querier) Plans ¶
func (k Querier) Plans(c context.Context, req *types.QueryPlansRequest) (*types.QueryPlansResponse, error)