keeper

package
v0.0.0-...-abdbe5d Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 20 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 sdkmath.LegacyDec, 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 NewQueryServerImpl

func NewQueryServerImpl(k Keeper) types.QueryServer

NewQueryServerImpl returns an implementation of the QueryServer interface for the provided Keeper.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all module invariants

func SetBalance

func SetBalance(
	ctx context.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 {
	Schema     collections.Schema
	Params     collections.Item[types.Params]
	RewardPool collections.Map[uint64, types.RewardPool]
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	addressCodec address.Codec,
	storeService store.KVStoreService,
	logger log.Logger,
	authority string,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	profileKeeper types.ProfileKeeper,
	launchKeeper types.LaunchKeeper,
) Keeper

func (Keeper) AddressCodec

func (k Keeper) AddressCodec() address.Codec

AddressCodec returns the address codec.

func (Keeper) DistributeRewards

func (k Keeper) DistributeRewards(
	ctx context.Context,
	launchID uint64,
	signatureCounts networktypes.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) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the module's authority.

func (*Keeper) GetLaunchKeeper

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

GetLaunchKeeper gets the profile keeper interface of the module

func (*Keeper) GetProfileKeeper

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

GetProfileKeeper gets the profile keeper interface of the module

func (Keeper) ListRewardPool

func (k Keeper) ListRewardPool(ctx sdk.Context) ([]types.RewardPool, error)

ListRewardPool returns all rewardPool

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns a module-specific logger.

Jump to

Keyboard shortcuts

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