Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func RewardInvariant(k Keeper) sdk.Invariant
- type GovHook
- func (h GovHook) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress)
- func (h GovHook) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64)
- func (h GovHook) AfterProposalSubmission(ctx sdk.Context, proposalID uint64)
- func (h GovHook) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress)
- func (h GovHook) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64)
- type Keeper
- func (k Keeper) AdjustPool(ctx sdk.Context, poolID string, reward sdk.Coins, rewardPerBlock sdk.Coins, ...) (err error)
- func (k Keeper) CreatePool(ctx sdk.Context, description string, lptDenom string, startHeight int64, ...) (*types.FarmPool, error)
- func (k Keeper) CreatePoolFee(ctx sdk.Context) sdk.Coin
- func (k Keeper) DeductPoolCreationFee(ctx sdk.Context, creator sdk.AccAddress) error
- func (k Keeper) DeleteFarmInfo(ctx sdk.Context, poolId, address string)
- func (k Keeper) DequeueActivePool(ctx sdk.Context, poolId string, expiredHeight int64)
- func (k Keeper) DestroyPool(ctx sdk.Context, poolId string, creator sdk.AccAddress) (sdk.Coins, error)
- func (k Keeper) EnqueueActivePool(ctx sdk.Context, poolId string, expiredHeight int64)
- func (k Keeper) Expired(ctx sdk.Context, pool types.FarmPool) bool
- func (k Keeper) FarmPool(goctx context.Context, request *types.QueryFarmPoolRequest) (*types.QueryFarmPoolResponse, error)
- func (k Keeper) FarmPools(goctx context.Context, request *types.QueryFarmPoolsRequest) (*types.QueryFarmPoolsResponse, error)
- func (k Keeper) Farmer(goctx context.Context, request *types.QueryFarmerRequest) (*types.QueryFarmerResponse, error)
- func (k Keeper) GetAllEscrowInfo(ctx sdk.Context) (infos []types.EscrowInfo)
- func (k Keeper) GetEscrowInfo(ctx sdk.Context, proposalId uint64) (types.EscrowInfo, bool)
- func (k Keeper) GetFarmInfo(ctx sdk.Context, poolId, address string) (info types.FarmInfo, exist bool)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPool(ctx sdk.Context, poolId string) (types.FarmPool, bool)
- func (k Keeper) GetRewardRules(ctx sdk.Context, poolId string) (rules types.RewardRules)
- func (k Keeper) GetSequence(ctx sdk.Context) uint64
- func (k Keeper) HandleCreateFarmProposal(ctx sdk.Context, p *types.CommunityPoolCreateFarmProposal) error
- func (k Keeper) Harvest(ctx sdk.Context, poolId string, sender sdk.AccAddress) (sdk.Coins, error)
- func (k Keeper) IteratorActivePool(ctx sdk.Context, fun func(pool types.FarmPool))
- func (k Keeper) IteratorAllFarmInfo(ctx sdk.Context, fun func(farmer types.FarmInfo))
- func (k Keeper) IteratorAllPools(ctx sdk.Context, fun func(pool types.FarmPool))
- func (k Keeper) IteratorExpiredPool(ctx sdk.Context, height int64, fun func(pool types.FarmPool))
- func (k Keeper) IteratorFarmInfo(ctx sdk.Context, address string, fun func(farmer types.FarmInfo))
- func (k Keeper) IteratorRewardRules(ctx sdk.Context, poolId string, fun func(r types.RewardRule))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MaxRewardCategories(ctx sdk.Context) uint32
- func (k Keeper) Params(goctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) Refund(ctx sdk.Context, pool types.FarmPool) (sdk.Coins, error)
- func (k Keeper) SetEscrowInfo(ctx sdk.Context, info types.EscrowInfo)
- func (k Keeper) SetFarmInfo(ctx sdk.Context, farmer types.FarmInfo)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error
- func (k Keeper) SetPool(ctx sdk.Context, pool types.FarmPool)
- func (k Keeper) SetRewardRule(ctx sdk.Context, poolId string, rule types.RewardRule)
- func (k Keeper) SetRewardRules(ctx sdk.Context, poolId string, rules types.RewardRules)
- func (k Keeper) SetSequence(ctx sdk.Context, seq uint64)
- func (k Keeper) Stake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender sdk.AccAddress) (reward sdk.Coins, err error)
- func (k Keeper) TaxRate(ctx sdk.Context) math.LegacyDec
- func (k Keeper) Unstake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender sdk.AccAddress) (_ sdk.Coins, err error)
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the farm module.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the farm MsgServer interface for the provided Keeper.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all invariants
Types ¶
type GovHook ¶
type GovHook struct {
// contains filtered or unexported fields
}
GovHook implements govtypes.GovHooks
func NewGovHook ¶
NewGovHook returns a new GovHook instance.
It takes a parameter of type Keeper and returns a GovHook.
func (GovHook) AfterProposalDeposit ¶
func (h GovHook) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress)
AfterProposalDeposit is a function that...
takes in ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress.
func (GovHook) AfterProposalFailedMinDeposit ¶
AfterProposalFailedMinDeposit callback when the proposal is deleted due to insufficient collateral
func (GovHook) AfterProposalSubmission ¶
AfterProposalSubmission description of the Go function.
Takes in sdk.Context and uint64 as parameters.
func (GovHook) AfterProposalVote ¶
AfterProposalVote is a Go function.
It takes parameters ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the farm store
func NewKeeper ¶
func NewKeeper( cdc codec.Codec, storeKey storetypes.StoreKey, bk types.BankKeeper, ak types.AccountKeeper, dk types.DistrKeeper, gk types.GovKeeper, ck types.CoinswapKeeper, feeCollectorName, communityPoolName, authority string, ) Keeper
func (Keeper) AdjustPool ¶
func (k Keeper) AdjustPool( ctx sdk.Context, poolID string, reward sdk.Coins, rewardPerBlock sdk.Coins, creator sdk.AccAddress, ) (err error)
AdjustPool adjusts farm pool parameters
func (Keeper) CreatePool ¶
func (k Keeper) CreatePool( ctx sdk.Context, description string, lptDenom string, startHeight int64, rewardPerBlock sdk.Coins, totalReward sdk.Coins, editable bool, creator sdk.AccAddress, ) (*types.FarmPool, error)
CreatePool creates an new farm pool
func (Keeper) CreatePoolFee ¶
CreatePoolFee returns the create pool fee
func (Keeper) DeductPoolCreationFee ¶
DeductPoolCreationFee performs fee handling for creating farm pool
func (Keeper) DeleteFarmInfo ¶
func (Keeper) DequeueActivePool ¶
func (Keeper) DestroyPool ¶
func (k Keeper) DestroyPool(ctx sdk.Context, poolId string, creator sdk.AccAddress) (sdk.Coins, error)
Destroy destroy an exist farm pool
func (Keeper) EnqueueActivePool ¶
func (Keeper) FarmPool ¶
func (k Keeper) FarmPool(goctx context.Context, request *types.QueryFarmPoolRequest, ) (*types.QueryFarmPoolResponse, error)
func (Keeper) FarmPools ¶
func (k Keeper) FarmPools(goctx context.Context, request *types.QueryFarmPoolsRequest) (*types.QueryFarmPoolsResponse, error)
func (Keeper) Farmer ¶
func (k Keeper) Farmer(goctx context.Context, request *types.QueryFarmerRequest) (*types.QueryFarmerResponse, error)
func (Keeper) GetAllEscrowInfo ¶
func (k Keeper) GetAllEscrowInfo(ctx sdk.Context) (infos []types.EscrowInfo)
func (Keeper) GetEscrowInfo ¶
func (Keeper) GetFarmInfo ¶
func (k Keeper) GetFarmInfo(ctx sdk.Context, poolId, address string) (info types.FarmInfo, exist bool)
GetFarmer return the specified farmer
func (Keeper) GetParams ¶
GetParams sets the farm module parameters.
func (Keeper) GetPool ¶
GetPool return the specified farm pool
func (Keeper) GetRewardRules ¶
func (Keeper) HandleCreateFarmProposal ¶
func (k Keeper) HandleCreateFarmProposal(ctx sdk.Context, p *types.CommunityPoolCreateFarmProposal) error
HandleCreateFarmProposal is a handler for executing a passed community spend proposal
func (Keeper) Harvest ¶
Harvest creates an new farm pool
func (Keeper) IteratorActivePool ¶
func (Keeper) IteratorAllFarmInfo ¶
func (Keeper) IteratorAllPools ¶
func (Keeper) IteratorExpiredPool ¶
func (Keeper) IteratorFarmInfo ¶
func (Keeper) IteratorRewardRules ¶
func (Keeper) MaxRewardCategories ¶
MaxRewardCategories returns the maxRewardCategories
func (Keeper) Params ¶
func (k Keeper) Params(goctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
func (Keeper) Refund ¶
Refund refund the remaining reward to pool creator
func (Keeper) SetFarmInfo ¶
SetFarmer save the farmer information
func (Keeper) SetParams ¶
SetParams sets the farm module parameters.
func (Keeper) SetPool ¶
CreatePool creates an new farm pool
func (Keeper) SetRewardRule ¶
func (Keeper) SetRewardRules ¶
func (Keeper) Stake ¶
func (k Keeper) Stake( ctx sdk.Context, poolId string, lpToken sdk.Coin, sender sdk.AccAddress, ) (reward sdk.Coins, err error)
Stake is responsible for the user to mortgage the lp token to the system and get back the reward accumulated before then
func (Keeper) TaxRate ¶
MaxRewardCategories returns the maxRewardCategories