keeper

package
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 14 Imported by: 23

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k Keeper) sdk.Invariant

AllInvariants runs all invariants of the farm module.

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the farm MsgServer interface for the provided Keeper.

func ParamKeyTable

func ParamKeyTable() paramstypes.KeyTable

ParamKeyTable for farm module

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all invariants

func RewardInvariant

func RewardInvariant(k Keeper) sdk.Invariant

RewardInvariant checks whether the amount of module account is consistent with the recorded in the farm

Types

type GovHook added in v1.5.2

type GovHook struct {
	// contains filtered or unexported fields
}

func NewGovHook added in v1.5.2

func NewGovHook(k Keeper) GovHook

func (GovHook) AfterProposalDeposit added in v1.5.2

func (h GovHook) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress)

func (GovHook) AfterProposalFailedMinDeposit added in v1.5.2

func (h GovHook) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64)

AfterProposalFailedMinDeposit callback when the proposal is deleted due to insufficient collateral

func (GovHook) AfterProposalSubmission added in v1.5.2

func (h GovHook) AfterProposalSubmission(ctx sdk.Context, proposalID uint64)

func (GovHook) AfterProposalVote added in v1.5.2

func (h GovHook) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress)

func (GovHook) AfterProposalVotingPeriodEnded added in v1.5.2

func (h GovHook) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64)

AfterProposalVotingPeriodEnded callback when proposal voting is complete

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper of the farm store

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey sdk.StoreKey,
	bk types.BankKeeper,
	ak types.AccountKeeper,
	dk types.DistrKeeper,
	gk types.GovKeeper,
	validateLPToken types.ValidateLPToken,
	paramSpace paramstypes.Subspace,
	feeCollectorName, communityPoolName 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

func (k Keeper) CreatePoolFee(ctx sdk.Context) (fee sdk.Coin)

CreatePoolFee returns the create pool fee

func (Keeper) DeductPoolCreationFee added in v1.5.2

func (k Keeper) DeductPoolCreationFee(ctx sdk.Context, creator sdk.AccAddress) error

DeductPoolCreationFee performs fee handling for creating farm pool

func (Keeper) DeleteFarmInfo

func (k Keeper) DeleteFarmInfo(ctx sdk.Context, poolId, address string)

func (Keeper) DequeueActivePool

func (k Keeper) DequeueActivePool(ctx sdk.Context, poolId string, expiredHeight int64)

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 (k Keeper) EnqueueActivePool(ctx sdk.Context, poolId string, expiredHeight int64)

func (Keeper) Expired

func (k Keeper) Expired(ctx sdk.Context, pool types.FarmPool) bool

func (Keeper) FarmPool

func (Keeper) FarmPools

func (Keeper) Farmer

func (Keeper) GetAllEscrowInfo added in v1.5.2

func (k Keeper) GetAllEscrowInfo(ctx sdk.Context) (infos []types.EscrowInfo)

func (Keeper) GetEscrowInfo added in v1.5.2

func (k Keeper) GetEscrowInfo(ctx sdk.Context, proposalId uint64) (types.EscrowInfo, bool)

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

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams gets all parameteras as types.Params

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context, poolId string) (types.FarmPool, bool)

GetPool return the specified farm pool

func (Keeper) GetRewardRules

func (k Keeper) GetRewardRules(ctx sdk.Context, poolId string) (rules types.RewardRules)

func (Keeper) GetSequence added in v1.5.2

func (k Keeper) GetSequence(ctx sdk.Context) uint64

func (Keeper) HandleCreateFarmProposal added in v1.5.2

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

func (k Keeper) Harvest(ctx sdk.Context, poolId string, sender sdk.AccAddress) (sdk.Coins, error)

Harvest creates an new farm pool

func (Keeper) IteratorActivePool

func (k Keeper) IteratorActivePool(ctx sdk.Context, fun func(pool types.FarmPool))

func (Keeper) IteratorAllFarmInfo

func (k Keeper) IteratorAllFarmInfo(ctx sdk.Context, fun func(farmer types.FarmInfo))

func (Keeper) IteratorAllPools

func (k Keeper) IteratorAllPools(ctx sdk.Context, fun func(pool types.FarmPool))

func (Keeper) IteratorExpiredPool

func (k Keeper) IteratorExpiredPool(ctx sdk.Context, height int64, fun func(pool types.FarmPool))

func (Keeper) IteratorFarmInfo

func (k Keeper) IteratorFarmInfo(ctx sdk.Context, address string, fun func(farmer types.FarmInfo))

func (Keeper) IteratorRewardRules

func (k Keeper) IteratorRewardRules(ctx sdk.Context, poolId string, fun func(r types.RewardRule))

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

func (Keeper) MaxRewardCategories

func (k Keeper) MaxRewardCategories(ctx sdk.Context) (maxRewardCategories uint32)

MaxRewardCategories returns the maxRewardCategories

func (Keeper) Params

func (Keeper) Refund

func (k Keeper) Refund(ctx sdk.Context, pool types.FarmPool) (sdk.Coins, error)

Refund refund the remaining reward to pool creator

func (Keeper) SetEscrowInfo added in v1.5.2

func (k Keeper) SetEscrowInfo(ctx sdk.Context, info types.EscrowInfo)

func (Keeper) SetFarmInfo

func (k Keeper) SetFarmInfo(ctx sdk.Context, farmer types.FarmInfo)

SetFarmer save the farmer information

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, params types.Params)

SetParams sets the params to the store

func (Keeper) SetPool

func (k Keeper) SetPool(ctx sdk.Context, pool types.FarmPool)

CreatePool creates an new farm pool

func (Keeper) SetRewardRule

func (k Keeper) SetRewardRule(ctx sdk.Context, poolId string, rule types.RewardRule)

func (Keeper) SetRewardRules

func (k Keeper) SetRewardRules(ctx sdk.Context, poolId string, rules types.RewardRules)

func (Keeper) SetSequence added in v1.5.2

func (k Keeper) SetSequence(ctx sdk.Context, seq uint64)

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 added in v1.5.2

func (k Keeper) TaxRate(ctx sdk.Context) (taxRate sdk.Dec)

MaxRewardCategories returns the maxRewardCategories

func (Keeper) Unstake

func (k Keeper) Unstake(ctx sdk.Context, poolId string, lpToken sdk.Coin, sender sdk.AccAddress) (_ sdk.Coins, err error)

Unstake withdraw lp token from farm pool

type Migrator added in v1.5.2

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator added in v1.5.2

func NewMigrator(k Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v1.5.2

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL