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) 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) GetAllPlans(ctx sdk.Context) (plans []types.PlanI)
- func (k Keeper) GetAllQueuedStakedCoinsByFarmer(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)
- func (k Keeper) GetLastEpochTime(ctx sdk.Context) (time.Time, 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) 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) IterateAllPlans(ctx sdk.Context, cb func(plan types.PlanI) (stop bool))
- func (k Keeper) IterateCurrentEpochs(ctx sdk.Context, ...)
- func (k Keeper) IterateHistoricalRewards(ctx sdk.Context, ...)
- func (k Keeper) IterateOutstandingRewards(ctx sdk.Context, ...)
- 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) 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) 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 = 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 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) AllocationInfos ¶
func (k Keeper) AllocationInfos(ctx sdk.Context) []AllocationInfo
func (Keeper) CalculateRewards ¶
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 (Keeper) DecreaseTotalStakings ¶
func (Keeper) DeleteHistoricalRewards ¶
func (Keeper) DeleteOutstandingRewards ¶
func (Keeper) DeletePublicPlanProposal ¶
func (k Keeper) DeletePublicPlanProposal(ctx sdk.Context, proposals []*types.DeleteRequestProposal) error
DeletePublicPlanProposal delets public plan proposal once the governance proposal is passed.
func (Keeper) DeleteQueuedStaking ¶
func (Keeper) DeleteStaking ¶
func (Keeper) DeleteTotalStakings ¶
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis returns the farming module's genesis state.
func (Keeper) GeneratePrivatePlanFarmingPoolAddress ¶
func (Keeper) GetAllPlans ¶
GetAllPlans returns all plans in the Keeper.
func (Keeper) GetAllQueuedStakedCoinsByFarmer ¶
func (Keeper) GetAllStakedCoinsByFarmer ¶
func (Keeper) GetCodec ¶
func (k Keeper) GetCodec() codec.BinaryCodec
GetCodec return codec.Codec object used by the keeper
func (Keeper) GetCurrentEpoch ¶
func (Keeper) GetCurrentEpochDays ¶
GetCurrentEpochDays returns the current epoch days.
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 (Keeper) GetLastEpochTime ¶
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 (Keeper) GetQueuedStaking ¶
func (k Keeper) GetQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress) (queuedStaking types.QueuedStaking, found bool)
func (Keeper) GetRewardsReservePoolAcc ¶
func (k Keeper) GetRewardsReservePoolAcc(ctx sdk.Context) sdk.AccAddress
GetRewardsReservePoolAcc returns temporary module account for Reward coins 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 specific staking identified by id.
func (Keeper) GetStakingReservePoolAcc ¶
func (k Keeper) GetStakingReservePoolAcc(ctx sdk.Context) sdk.AccAddress
GetStakingReservePoolAcc returns module account for Staking Reserve Pool account
func (Keeper) GetTotalStakings ¶
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 (Keeper) IncreaseTotalStakings ¶
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) IterateCurrentEpochs ¶
func (Keeper) IterateHistoricalRewards ¶
func (Keeper) IterateOutstandingRewards ¶
func (Keeper) IterateQueuedStakings ¶
func (k Keeper) IterateQueuedStakings(ctx sdk.Context, cb func(stakingCoinDenom string, farmerAcc sdk.AccAddress, queuedStaking types.QueuedStaking) (stop bool))
func (Keeper) IterateQueuedStakingsByFarmer ¶
func (k Keeper) IterateQueuedStakingsByFarmer(ctx sdk.Context, farmerAcc sdk.AccAddress, cb func(stakingCoinDenom string, queuedStaking types.QueuedStaking) (stop bool))
func (Keeper) IterateStakings ¶
func (Keeper) IterateStakingsByFarmer ¶
func (Keeper) MarshalPlan ¶
MarshalPlan protobuf serializes an Plan interface
func (Keeper) ProcessQueuedCoins ¶
ProcessQueuedCoins moves queued coins into staked coins.
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 an plan for the plan mapper 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) SetCurrentEpoch ¶
func (Keeper) SetCurrentEpochDays ¶
SetCurrentEpochDays sets the current epoch days.
func (Keeper) SetGlobalPlanId ¶
SetGlobalPlanId set the global Plan ID counter.
func (Keeper) SetHistoricalRewards ¶
func (Keeper) SetOutstandingRewards ¶
func (Keeper) SetQueuedStaking ¶
func (k Keeper) SetQueuedStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress, queuedStaking types.QueuedStaking)
func (Keeper) SetStaking ¶
func (k Keeper) SetStaking(ctx sdk.Context, stakingCoinDenom string, farmerAcc sdk.AccAddress, staking types.Staking)
SetStaking implements Staking.
func (Keeper) SetTotalStakings ¶
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 an Plan interface from raw encoded plan bytes of a Proto-based Plan type
func (Keeper) Unstake ¶
Unstake unstakes an amount of staking coins from the staking reserve account.
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) ValidateRemainingRewardsAmount ¶
ValidateRemainingRewardsAmount checks that the balance of the RewardPoolAddresses of all plans greater than the total amount of unwithdrawn reward coins in all reward objects
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 ¶
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)
func (Querier) Stakings ¶
func (k Querier) Stakings(c context.Context, req *types.QueryStakingsRequest) (*types.QueryStakingsResponse, error)
func (Querier) TotalStakings ¶
func (k Querier) TotalStakings(c context.Context, req *types.QueryTotalStakingsRequest) (*types.QueryTotalStakingsResponse, error)