Documentation ¶
Index ¶
- Variables
- func AllInvariants(k Keeper) sdk.Invariant
- func HandlePublicPlanProposal(ctx sdk.Context, k Keeper, proposal *types.PublicPlanProposal) error
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func RemainingRewardsAmountInvariant(k Keeper) sdk.Invariant
- func StakingReservedAmountInvariant(k Keeper) sdk.Invariant
- type AllocationInfo
- type Keeper
- func (k Keeper) AddPublicPlanProposal(ctx sdk.Context, proposals []*types.AddRequestProposal) error
- func (k Keeper) AdvanceEpoch(ctx sdk.Context) error
- func (k Keeper) AllRewards(ctx sdk.Context, farmerAcc sdk.AccAddress) sdk.Coins
- func (k Keeper) AllocateRewards(ctx sdk.Context) error
- func (k Keeper) AllocationInfos(ctx sdk.Context) []AllocationInfo
- func (k Keeper) CalculateRewards(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenom string, ...) (rewards sdk.DecCoins)
- func (k Keeper) CreateFixedAmountPlan(ctx sdk.Context, msg *types.MsgCreateFixedAmountPlan, ...) (types.PlanI, error)
- func (k Keeper) CreateRatioPlan(ctx sdk.Context, msg *types.MsgCreateRatioPlan, ...) (types.PlanI, error)
- func (k Keeper) DecreaseOutstandingRewards(ctx sdk.Context, stakingCoinDenom string, amount sdk.DecCoins)
- func (k Keeper) DecreaseTotalStakings(ctx sdk.Context, stakingCoinDenom string, amount sdk.Int)
- func (k Keeper) DeleteHistoricalRewards(ctx sdk.Context, stakingCoinDenom string, epoch uint64)
- func (k Keeper) DeleteOutstandingRewards(ctx sdk.Context, stakingCoinDenom string)
- func (k Keeper) DeletePublicPlanProposal(ctx sdk.Context, proposals []*types.DeleteRequestProposal) error
- func (k Keeper) DeleteQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress)
- func (k Keeper) DeleteStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress)
- func (k Keeper) DeleteTotalStakings(ctx sdk.Context, stakingCoinDenom string)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GeneratePrivatePlanFarmingPoolAddress(ctx sdk.Context, name string) (sdk.AccAddress, error)
- func (k Keeper) GetAllQueuedCoinsByFarmer(ctx sdk.Context, farmerAcc sdk.AccAddress) sdk.Coins
- func (k Keeper) GetAllStakedCoinsByFarmer(ctx sdk.Context, farmerAcc sdk.AccAddress) sdk.Coins
- func (k Keeper) GetCodec() codec.BinaryCodec
- func (k Keeper) GetCurrentEpoch(ctx sdk.Context, stakingCoinDenom string) uint64
- func (k Keeper) GetCurrentEpochDays(ctx sdk.Context) uint32
- func (k Keeper) GetFarmingFeeCollectorAcc(ctx sdk.Context) sdk.AccAddress
- func (k Keeper) GetGlobalPlanId(ctx sdk.Context) uint64
- func (k Keeper) GetHistoricalRewards(ctx sdk.Context, stakingCoinDenom string, epoch uint64) (rewards types.HistoricalRewards, found bool)
- func (k Keeper) GetLastEpochTime(ctx sdk.Context) (t time.Time, found bool)
- func (k Keeper) GetNextPlanIdWithUpdate(ctx sdk.Context) uint64
- func (k Keeper) GetOutstandingRewards(ctx sdk.Context, stakingCoinDenom string) (rewards types.OutstandingRewards, found bool)
- 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) GetPlans(ctx sdk.Context) (plans []types.PlanI)
- func (k Keeper) GetQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress) (queuedStaking types.QueuedStaking, found bool)
- func (k Keeper) GetRewardsReservePoolAcc(ctx sdk.Context) sdk.AccAddress
- func (k Keeper) GetStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress) (staking types.Staking, found bool)
- func (k Keeper) GetStakingReservePoolAcc(ctx sdk.Context) sdk.AccAddress
- func (k Keeper) GetTotalStakings(ctx sdk.Context, stakingCoinDenom string) (totalStakings types.TotalStakings, found bool)
- func (k Keeper) Harvest(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenoms []string) error
- func (k Keeper) IncreaseOutstandingRewards(ctx sdk.Context, stakingCoinDenom string, amount sdk.DecCoins)
- func (k Keeper) IncreaseTotalStakings(ctx sdk.Context, stakingCoinDenom string, amount sdk.Int)
- func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState)
- func (k Keeper) IterateCurrentEpochs(ctx sdk.Context, ...)
- func (k Keeper) IterateHistoricalRewards(ctx sdk.Context, ...)
- func (k Keeper) IterateOutstandingRewards(ctx sdk.Context, ...)
- func (k Keeper) IteratePlans(ctx sdk.Context, cb func(plan types.PlanI) (stop bool))
- func (k Keeper) IterateQueuedStakings(ctx sdk.Context, ...)
- func (k Keeper) IterateQueuedStakingsByFarmer(ctx sdk.Context, farmerAcc sdk.AccAddress, ...)
- func (k Keeper) IterateStakings(ctx sdk.Context, ...)
- func (k Keeper) IterateStakingsByFarmer(ctx sdk.Context, farmerAcc sdk.AccAddress, ...)
- 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) ProcessQueuedCoins(ctx sdk.Context)
- func (k Keeper) ReleaseStakingCoins(ctx sdk.Context, farmerAcc sdk.AccAddress, unstakingCoins sdk.Coins) error
- func (k Keeper) RemovePlan(ctx sdk.Context, plan types.PlanI)
- func (k Keeper) ReserveStakingCoins(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoins sdk.Coins) error
- func (k Keeper) Rewards(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenom string) sdk.Coins
- func (k Keeper) SetCurrentEpoch(ctx sdk.Context, stakingCoinDenom string, currentEpoch uint64)
- func (k Keeper) SetCurrentEpochDays(ctx sdk.Context, epochDays uint32)
- func (k Keeper) SetGlobalPlanId(ctx sdk.Context, id uint64)
- func (k Keeper) SetHistoricalRewards(ctx sdk.Context, stakingCoinDenom string, epoch uint64, ...)
- func (k Keeper) SetLastEpochTime(ctx sdk.Context, t time.Time)
- func (k Keeper) SetOutstandingRewards(ctx sdk.Context, stakingCoinDenom string, rewards types.OutstandingRewards)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPlan(ctx sdk.Context, plan types.PlanI)
- func (k Keeper) SetQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress, ...)
- func (k Keeper) SetStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress, ...)
- func (k Keeper) SetTotalStakings(ctx sdk.Context, stakingCoinDenom string, totalStakings types.TotalStakings)
- func (k Keeper) Stake(ctx sdk.Context, farmerAcc sdk.AccAddress, amount sdk.Coins) error
- func (k Keeper) TerminatePlan(ctx sdk.Context, plan types.PlanI) error
- func (k Keeper) UnmarshalPlan(bz []byte) (plan types.PlanI, err error)
- func (k Keeper) Unstake(ctx sdk.Context, farmerAcc sdk.AccAddress, amount sdk.Coins) error
- func (k Keeper) UpdatePublicPlanProposal(ctx sdk.Context, proposals []*types.UpdateRequestProposal) error
- func (k Keeper) ValidateOutstandingRewards(ctx sdk.Context) error
- func (k Keeper) ValidateRemainingRewardsAmount(ctx sdk.Context) error
- func (k Keeper) ValidateStakingReservedAmount(ctx sdk.Context) error
- func (k Keeper) WithdrawAllRewards(ctx sdk.Context, farmerAcc sdk.AccAddress) (sdk.Coins, error)
- func (k Keeper) WithdrawRewards(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenom string) (sdk.Coins, error)
- type Querier
- func (k Querier) CurrentEpochDays(c context.Context, req *types.QueryCurrentEpochDaysRequest) (*types.QueryCurrentEpochDaysResponse, 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) Rewards(c context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
- func (k Querier) Stakings(c context.Context, req *types.QueryStakingsRequest) (*types.QueryStakingsResponse, error)
- func (k Querier) TotalStakings(c context.Context, req *types.QueryTotalStakingsRequest) (*types.QueryTotalStakingsResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ( // EnableAdvanceEpoch indicates whether msgServer accepts MsgAdvanceEpoch or not. // Never set this to true in production mode. Doing that will expose serious attack vector. EnableAdvanceEpoch = false )
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the farming module.
func HandlePublicPlanProposal ¶
HandlePublicPlanProposal is a handler for executing a public 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.
func RemainingRewardsAmountInvariant ¶
RemainingRewardsAmountInvariant checks that the balance of the RewardPoolAddresses of all plans greater than the total amount of unwithdrawn reward coins in all reward objects
func StakingReservedAmountInvariant ¶
StakingReservedAmountInvariant checks that the balance of StakingReserveAcc greater than the amount of staked, Queued coins in all staking objects.
Types ¶
type AllocationInfo ¶
AllocationInfo holds information about an allocation for a plan.
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, 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) AddPublicPlanProposal ¶
AddPublicPlanProposal adds a new public plan once the governance proposal is passed.
func (Keeper) AdvanceEpoch ¶
AdvanceEpoch ends the current epoch. When an epoch ends, rewards are distributed and queued staking coins become staked.
func (Keeper) AllRewards ¶ added in v0.1.1
AllRewards returns truncated total rewards accumulated until the current epoch for a farmer.
func (Keeper) AllocateRewards ¶
AllocateRewards updates historical rewards and current epoch info based on the allocation infos.
func (Keeper) AllocationInfos ¶
func (k Keeper) AllocationInfos(ctx sdk.Context) []AllocationInfo
AllocationInfos returns allocation infos for the end of the current epoch. When total allocated coins for a farming pool exceeds the pool's balance, then allocation will not happen.
func (Keeper) CalculateRewards ¶
func (k Keeper) CalculateRewards(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenom string, endingEpoch uint64) (rewards sdk.DecCoins)
CalculateRewards returns rewards accumulated until endingEpoch for a farmer for a given staking coin denom.
func (Keeper) CreateFixedAmountPlan ¶
func (k Keeper) CreateFixedAmountPlan(ctx sdk.Context, msg *types.MsgCreateFixedAmountPlan, farmingPoolAcc, terminationAcc sdk.AccAddress, typ types.PlanType) (types.PlanI, error)
CreateFixedAmountPlan sets fixed amount plan.
func (Keeper) CreateRatioPlan ¶
func (k Keeper) CreateRatioPlan(ctx sdk.Context, msg *types.MsgCreateRatioPlan, farmingPoolAcc, terminationAcc sdk.AccAddress, typ types.PlanType) (types.PlanI, error)
CreateRatioPlan sets ratio plan.
func (Keeper) DecreaseOutstandingRewards ¶
func (k Keeper) DecreaseOutstandingRewards(ctx sdk.Context, stakingCoinDenom string, amount sdk.DecCoins)
DecreaseOutstandingRewards decreases outstanding rewards for a given staking coin denom by given amount. If the resulting outstanding rewards is zero, then the outstanding rewards will be deleted, not updated.
func (Keeper) DecreaseTotalStakings ¶
DecreaseTotalStakings decreases total stakings for given staking coin denom by given amount.
func (Keeper) DeleteHistoricalRewards ¶
DeleteHistoricalRewards deletes historical rewards for a given staking coin denom and an epoch number.
func (Keeper) DeleteOutstandingRewards ¶
DeleteOutstandingRewards deletes outstanding rewards for a given staking coin denom.
func (Keeper) DeletePublicPlanProposal ¶
func (k Keeper) DeletePublicPlanProposal(ctx sdk.Context, proposals []*types.DeleteRequestProposal) error
DeletePublicPlanProposal deletes public plan proposal once the governance proposal is passed.
func (Keeper) DeleteQueuedStaking ¶
func (k Keeper) DeleteQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress)
DeleteQueuedStaking deletes a queued staking for given staking coin denom and farmer.
func (Keeper) DeleteStaking ¶
DeleteStaking deletes a staking for given staking coin denom and farmer.
func (Keeper) DeleteTotalStakings ¶
DeleteTotalStakings deletes total stakings for given staking coin denom.
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the farming module's genesis state.
func (Keeper) GeneratePrivatePlanFarmingPoolAddress ¶
func (k Keeper) GeneratePrivatePlanFarmingPoolAddress(ctx sdk.Context, name string) (sdk.AccAddress, error)
GeneratePrivatePlanFarmingPoolAddress returns a unique account address of a farming pool for a private plan.
func (Keeper) GetAllQueuedCoinsByFarmer ¶ added in v0.1.1
GetAllQueuedCoinsByFarmer returns all coins that are queued for staking by a farmer.
func (Keeper) GetAllStakedCoinsByFarmer ¶
GetAllStakedCoinsByFarmer returns all coins that are staked by a farmer.
func (Keeper) GetCodec ¶
func (k Keeper) GetCodec() codec.BinaryCodec
GetCodec returns codec.Codec object used by the keeper>
func (Keeper) GetCurrentEpoch ¶
GetCurrentEpoch returns the current epoch number for a given staking coin denom.
func (Keeper) GetCurrentEpochDays ¶
GetCurrentEpochDays returns the current epoch days(period).
func (Keeper) GetFarmingFeeCollectorAcc ¶
func (k Keeper) GetFarmingFeeCollectorAcc(ctx sdk.Context) sdk.AccAddress
GetFarmingFeeCollectorAcc returns module account for the farming fee collector account.
func (Keeper) GetGlobalPlanId ¶
GetGlobalPlanId returns the global Plan ID counter.
func (Keeper) GetHistoricalRewards ¶
func (k Keeper) GetHistoricalRewards(ctx sdk.Context, stakingCoinDenom string, epoch uint64) (rewards types.HistoricalRewards, found bool)
GetHistoricalRewards returns historical rewards for a given staking coin denom and an epoch number.
func (Keeper) GetLastEpochTime ¶
GetLastEpochTime returns the last time the epoch ended.
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 0.
func (Keeper) GetOutstandingRewards ¶
func (k Keeper) GetOutstandingRewards(ctx sdk.Context, stakingCoinDenom string) (rewards types.OutstandingRewards, found bool)
GetOutstandingRewards returns outstanding rewards for a given staking coin denom.
func (Keeper) GetQueuedStaking ¶
func (k Keeper) GetQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress) (queuedStaking types.QueuedStaking, found bool)
GetQueuedStaking returns a queued staking for given staking coin denom and farmer.
func (Keeper) GetRewardsReservePoolAcc ¶
func (k Keeper) GetRewardsReservePoolAcc(ctx sdk.Context) sdk.AccAddress
GetRewardsReservePoolAcc returns module account for the rewards reserve pool account.
func (Keeper) GetStaking ¶
func (k Keeper) GetStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress) (staking types.Staking, found bool)
GetStaking returns a staking for given staking denom and farmer.
func (Keeper) GetStakingReservePoolAcc ¶
func (k Keeper) GetStakingReservePoolAcc(ctx sdk.Context) sdk.AccAddress
GetStakingReservePoolAcc returns module account for the staking reserve pool account.
func (Keeper) GetTotalStakings ¶
func (k Keeper) GetTotalStakings(ctx sdk.Context, stakingCoinDenom string) (totalStakings types.TotalStakings, found bool)
GetTotalStakings returns total stakings for given staking coin denom.
func (Keeper) Harvest ¶
func (k Keeper) Harvest(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenoms []string) error
Harvest claims farming rewards from the reward pool.
func (Keeper) IncreaseOutstandingRewards ¶
func (k Keeper) IncreaseOutstandingRewards(ctx sdk.Context, stakingCoinDenom string, amount sdk.DecCoins)
IncreaseOutstandingRewards increases outstanding rewards for a given staking coin denom by given amount.
func (Keeper) IncreaseTotalStakings ¶
IncreaseTotalStakings increases total stakings for given staking coin denom by given amount.
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) IterateCurrentEpochs ¶
func (k Keeper) IterateCurrentEpochs(ctx sdk.Context, cb func(stakingCoinDenom string, currentEpoch uint64) (stop bool))
IterateCurrentEpochs iterates through all current epoch infos stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.
func (Keeper) IterateHistoricalRewards ¶
func (k Keeper) IterateHistoricalRewards(ctx sdk.Context, cb func(stakingCoinDenom string, epoch uint64, rewards types.HistoricalRewards) (stop bool))
IterateHistoricalRewards iterates through all historical rewards stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.
func (Keeper) IterateOutstandingRewards ¶
func (k Keeper) IterateOutstandingRewards(ctx sdk.Context, cb func(stakingCoinDenom string, rewards types.OutstandingRewards) (stop bool))
IterateOutstandingRewards iterates through all outstanding rewards stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.
func (Keeper) IteratePlans ¶ added in v0.1.1
IteratePlans iterates over all the stored plans and performs a callback function. Stops iteration when callback returns true.
func (Keeper) IterateQueuedStakings ¶
func (k Keeper) IterateQueuedStakings(ctx sdk.Context, cb func(stakingCoinDenom string, farmerAcc sdk.AccAddress, queuedStaking types.QueuedStaking) (stop bool))
IterateQueuedStakings iterates through all queued stakings stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.
func (Keeper) IterateQueuedStakingsByFarmer ¶
func (k Keeper) IterateQueuedStakingsByFarmer(ctx sdk.Context, farmerAcc sdk.AccAddress, cb func(stakingCoinDenom string, queuedStaking types.QueuedStaking) (stop bool))
IterateQueuedStakingsByFarmer iterates through all queued stakings by farmer stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.
func (Keeper) IterateStakings ¶
func (k Keeper) IterateStakings(ctx sdk.Context, cb func(stakingCoinDenom string, farmerAcc sdk.AccAddress, staking types.Staking) (stop bool))
IterateStakings iterates through all stakings stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.
func (Keeper) IterateStakingsByFarmer ¶
func (k Keeper) IterateStakingsByFarmer(ctx sdk.Context, farmerAcc sdk.AccAddress, cb func(stakingCoinDenom string, staking types.Staking) (stop bool))
IterateStakingsByFarmer iterates through all stakings by a farmer stored in the store and invokes callback function for each item. Stops the iteration when the callback function returns true.
func (Keeper) MarshalPlan ¶
MarshalPlan serializes a plan.
func (Keeper) ProcessQueuedCoins ¶
ProcessQueuedCoins moves queued coins into staked coins. It causes accumulated rewards to be withdrawn to the farmer.
func (Keeper) ReleaseStakingCoins ¶
func (k Keeper) ReleaseStakingCoins(ctx sdk.Context, farmerAcc sdk.AccAddress, unstakingCoins sdk.Coins) error
ReleaseStakingCoins sends staking coins back to the farmer.
func (Keeper) RemovePlan ¶
RemovePlan removes a plan from the store. NOTE: this will cause supply invariant violation if called
func (Keeper) ReserveStakingCoins ¶
func (k Keeper) ReserveStakingCoins(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoins sdk.Coins) error
ReserveStakingCoins sends staking coins to the staking reserve account.
func (Keeper) Rewards ¶ added in v0.1.1
func (k Keeper) Rewards(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenom string) sdk.Coins
Rewards returns truncated rewards accumulated until the current epoch for a farmer for a given staking coin denom.
func (Keeper) SetCurrentEpoch ¶
SetCurrentEpoch sets the current epoch number for a given staking coin denom.
func (Keeper) SetCurrentEpochDays ¶
SetCurrentEpochDays sets the current epoch days(period).
func (Keeper) SetGlobalPlanId ¶
SetGlobalPlanId sets the global Plan ID counter.
func (Keeper) SetHistoricalRewards ¶
func (k Keeper) SetHistoricalRewards(ctx sdk.Context, stakingCoinDenom string, epoch uint64, rewards types.HistoricalRewards)
SetHistoricalRewards sets historical rewards for a given staking coin denom and an epoch number.
func (Keeper) SetLastEpochTime ¶
SetLastEpochTime sets the last time the epoch ended.
func (Keeper) SetOutstandingRewards ¶
func (k Keeper) SetOutstandingRewards(ctx sdk.Context, stakingCoinDenom string, rewards types.OutstandingRewards)
SetOutstandingRewards sets outstanding rewards for a given staking coin denom.
func (Keeper) SetQueuedStaking ¶
func (k Keeper) SetQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress, queuedStaking types.QueuedStaking)
SetQueuedStaking sets a queued staking for given staking coin denom and farmer.
func (Keeper) SetStaking ¶
func (k Keeper) SetStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress, staking types.Staking)
SetStaking sets a staking for given staking coin denom and farmer.
func (Keeper) SetTotalStakings ¶
func (k Keeper) SetTotalStakings(ctx sdk.Context, stakingCoinDenom string, totalStakings types.TotalStakings)
SetTotalStakings sets total stakings for given staking coin denom.
func (Keeper) Stake ¶
Stake stores staking coins to queued coins, and it will be processed in the next epoch.
func (Keeper) TerminatePlan ¶
TerminatePlan sends all remaining coins in the plan's farming pool to the termination address and mark the plan as terminated.
func (Keeper) UnmarshalPlan ¶
UnmarshalPlan returns a plan from raw serialized bytes of a Proto-based Plan type.
func (Keeper) Unstake ¶
Unstake unstakes an amount of staking coins from the staking reserve account. It causes accumulated rewards to be withdrawn to the farmer.
func (Keeper) UpdatePublicPlanProposal ¶
func (k Keeper) UpdatePublicPlanProposal(ctx sdk.Context, proposals []*types.UpdateRequestProposal) error
UpdatePublicPlanProposal overwrites the plan with the new plan proposal once the governance proposal is passed.
func (Keeper) ValidateOutstandingRewards ¶ added in v0.1.1
ValidateOutstandingRewards checks that the balance of the rewards reserve pool is greater than the total amount of outstanding rewards.
func (Keeper) ValidateRemainingRewardsAmount ¶
ValidateRemainingRewardsAmount checks that the balance of the rewards reserve pool is greater than the total amount of unwithdrawn rewards.
func (Keeper) ValidateStakingReservedAmount ¶
ValidateStakingReservedAmount checks that the balance of StakingReserveAcc greater than the amount of staked, queued coins in all staking objects.
func (Keeper) WithdrawAllRewards ¶
WithdrawAllRewards withdraws all accumulated rewards for a farmer.
func (Keeper) WithdrawRewards ¶
func (k Keeper) WithdrawRewards(ctx sdk.Context, farmerAcc sdk.AccAddress, stakingCoinDenom string) (sdk.Coins, error)
WithdrawRewards withdraws accumulated rewards for a farmer for a given staking coin denom. It decreases outstanding rewards and set the starting epoch of a staking.
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) CurrentEpochDays ¶
func (k Querier) CurrentEpochDays(c context.Context, req *types.QueryCurrentEpochDaysRequest) (*types.QueryCurrentEpochDaysResponse, error)
CurrentEpochDays queries current epoch days.
func (Querier) Params ¶
func (k Querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the parameters of the farming module.
func (Querier) Plan ¶
func (k Querier) Plan(c context.Context, req *types.QueryPlanRequest) (*types.QueryPlanResponse, error)
Plan queries a specific plan.
func (Querier) Plans ¶
func (k Querier) Plans(c context.Context, req *types.QueryPlansRequest) (*types.QueryPlansResponse, error)
Plans queries all plans.
func (Querier) Rewards ¶
func (k Querier) Rewards(c context.Context, req *types.QueryRewardsRequest) (*types.QueryRewardsResponse, error)
Rewards queries accumulated rewards for a farmer.
func (Querier) Stakings ¶
func (k Querier) Stakings(c context.Context, req *types.QueryStakingsRequest) (*types.QueryStakingsResponse, error)
Stakings queries stakings for a farmer.
func (Querier) TotalStakings ¶
func (k Querier) TotalStakings(c context.Context, req *types.QueryTotalStakingsRequest) (*types.QueryTotalStakingsResponse, error)
TotalStakings queries total staking coin amount for a specific staking coin denom.