keeper

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

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 module.

func CalculateRewards

func CalculateRewards(blockRatio, signatureRatio sdk.Dec, coins sdk.Coins) (sdk.Coins, error)

CalculateRewards calculates the reward relative to the signature and block ratio

func InsufficientRewardsBalanceInvariant

func InsufficientRewardsBalanceInvariant(k Keeper) sdk.Invariant

InsufficientRewardsBalanceInvariant checks if module account balance is greater or equal than the sum of all `remainingCoins` for all reward pools

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all module invariants

func SetBalance

func SetBalance(
	ctx sdk.Context,
	bankKeeper types.BankKeeper,
	provider sdk.AccAddress,
	coins sdk.Coins,
	poolCoins sdk.Coins,
) error

SetBalance set balance to Coins on the module account calling the transfer depending on the balance difference

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,
	authKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	profileKeeper types.ProfileKeeper,
	launchKeeper types.LaunchKeeper,
) *Keeper

func (Keeper) DistributeRewards

func (k Keeper) DistributeRewards(
	ctx sdk.Context,
	launchID uint64,
	signatureCounts spntypes.SignatureCounts,
	lastBlockHeight int64,
	closeRewardPool bool,
) error

DistributeRewards distributes rewards based on the monitoring packet this `closeRewardPool` is a boolean that specifies if the reward pool must be closed after the reward distribution. In a model where rewards are distributed in a single round, this boolean is always `true`. In this way, if the monitoring packet is distributed earlier and `lastBlockHeight < rewardPool.LastRewardHeight` only a portion of the rewards will be distributed and the remaining is refunded to the reward's provider. When rewards are distributed periodically, this value is set to `false` so the reward pool is not closed as long as `lastBlockHeight` does not reach `rewardPool.LastRewardHeight`

func (Keeper) GetAllRewardPool

func (k Keeper) GetAllRewardPool(ctx sdk.Context) (list []types.RewardPool)

GetAllRewardPool returns all rewardPool

func (*Keeper) GetLaunchKeeper

func (k *Keeper) GetLaunchKeeper() types.LaunchKeeper

GetLaunchKeeper gets the profile keeper interface of the module

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (*Keeper) GetProfileKeeper

func (k *Keeper) GetProfileKeeper() types.ProfileKeeper

GetProfileKeeper gets the profile keeper interface of the module

func (Keeper) GetRewardPool

func (k Keeper) GetRewardPool(ctx sdk.Context, launchID uint64) (val types.RewardPool, found bool)

GetRewardPool returns a rewardPool from its index

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) RemoveRewardPool

func (k Keeper) RemoveRewardPool(ctx sdk.Context, launchID uint64)

RemoveRewardPool removes a rewardPool from the store

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetRewardPool

func (k Keeper) SetRewardPool(ctx sdk.Context, rewardPool types.RewardPool)

SetRewardPool set a specific rewardPool in the store from its index

Jump to

Keyboard shortcuts

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