keeper

package
v4.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const DAY_SECONDS = 60 * 60 * 24

Variables

This section is empty.

Functions

func GetIprpcRewardIDBytes

func GetIprpcRewardIDBytes(id uint64) []byte

GetIprpcRewardIDBytes returns the byte representation of the ID

func GetIprpcRewardIDFromBytes

func GetIprpcRewardIDFromBytes(bz []byte) uint64

GetIprpcRewardIDFromBytes returns ID in uint64 format from a byte array

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

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,
	bankKeeper types.BankKeeper,
	accountKeeper types.AccountKeeper,
	specKeeper types.SpecKeeper,
	epochStorageKeeper types.EpochstorageKeeper,
	downtimeKeeper types.DowntimeKeeper,
	stakingKeeper types.StakingKeeper,
	dualstakingKeeper types.DualStakingKeeper,
	distributionKeeper types.DistributionKeeper,
	feeCollectorName string,
	timerStoreKeeper types.TimerStoreKeeper,
	authority string,
) *Keeper

func (Keeper) AggregateCU

func (k Keeper) AggregateCU(ctx sdk.Context, subscription, provider string, chainID string, cu uint64)

func (Keeper) AggregateRewards

func (k Keeper) AggregateRewards(ctx sdk.Context, provider, chainid string, adjustment sdk.Dec, rewards math.Int)

func (Keeper) AllocationPoolMonthsLeft

func (k Keeper) AllocationPoolMonthsLeft(ctx sdk.Context) int64

AllocationPoolMonthsLeft returns the amount of months the allocation pools have left before all their are depleted

func (Keeper) BeginBlock

func (k Keeper) BeginBlock(ctx sdk.Context)

redeclaring BeginBlock for testing (this is not called outside of unit tests)

func (Keeper) BlocksToNextTimerExpiry

func (k Keeper) BlocksToNextTimerExpiry(ctx sdk.Context) int64

BlocksToNextTimerExpiry extracts the timer's expiry block from the timer's subkey and returns the amount of blocks remaining (according to the current block height) the calculated blocks are multiplied with a slack factor (for error margin)

func (Keeper) BondedTargetFactor

func (k Keeper) BondedTargetFactor(ctx sdk.Context) cosmosMath.LegacyDec

BondedTargetFactor calculates the bonded target factor which is used to calculate the validators block rewards

func (Keeper) BurnPoolTokens

func (k Keeper) BurnPoolTokens(ctx sdk.Context, pool types.Pool, amt math.Int, denom string) error

BurnPoolTokens removes coins from a pool module account

func (Keeper) CalculateContributionPercentages

func (k Keeper) CalculateContributionPercentages(ctx sdk.Context, reward math.Int) (validatorsParticipation math.LegacyDec, communityParticipation math.LegacyDec, err error)

CalculateContributionPercentages calculates the providers' rewards participation to the validators and community pool

func (Keeper) CalculateValidatorsAndCommunityParticipationRewards

func (k Keeper) CalculateValidatorsAndCommunityParticipationRewards(ctx sdk.Context, reward sdk.Coin) (validatorsCoins sdk.Coins, communityCoins sdk.Coins, err error)

func (Keeper) ContributeToValidatorsAndCommunityPool

func (k Keeper) ContributeToValidatorsAndCommunityPool(ctx sdk.Context, reward sdk.Coin, senderModule string) (updatedReward sdk.Coin, err error)

ContributeToValidatorsAndCommunityPool transfers some of the providers' rewards to the validators and community pool the function return the updated reward after the participation deduction

func (Keeper) DistributeBlockReward

func (k Keeper) DistributeBlockReward(ctx sdk.Context)

func (Keeper) DistributeMonthlyBonusRewards

func (k Keeper) DistributeMonthlyBonusRewards(ctx sdk.Context)

Distribute bonus rewards to providers across all chains based on performance

func (Keeper) ExportRewardsRefillTS

func (k Keeper) ExportRewardsRefillTS(ctx sdk.Context) timerstoretypes.GenesisState

ExportRewardsRefillTS exports refill pools timers data (for genesis)

func (Keeper) FundCommunityPoolFromModule

func (k Keeper) FundCommunityPoolFromModule(ctx sdk.Context, amount sdk.Coins, senderModule string) error

func (Keeper) FundIprpc

func (k Keeper) FundIprpc(ctx sdk.Context, creator string, duration uint64, fund sdk.Coins, spec string) error

func (Keeper) GetAllBasePay

func (k Keeper) GetAllBasePay(ctx sdk.Context) (list []types.BasePayWithIndex)

GetAllBasePay returns all BasePay

func (Keeper) GetAllIprpcReward

func (k Keeper) GetAllIprpcReward(ctx sdk.Context) (list []types.IprpcReward)

GetAllIprpcReward returns all IprpcReward

func (Keeper) GetAllIprpcSubscription

func (k Keeper) GetAllIprpcSubscription(ctx sdk.Context) []string

GetAllIprpcSubscription returns all subscription from the IprpcSubscription store

func (Keeper) GetCommunityTax

func (k Keeper) GetCommunityTax(ctx sdk.Context) math.LegacyDec

func (Keeper) GetCurrentIprpcReward

func (k Keeper) GetCurrentIprpcReward(ctx sdk.Context) (types.IprpcReward, bool)

GetCurrentIprpcReward gets the lowest id IprpcReward object

func (Keeper) GetIprpcReward

func (k Keeper) GetIprpcReward(ctx sdk.Context, id uint64) (val types.IprpcReward, found bool)

GetIprpcReward returns a IprpcReward from its id

func (Keeper) GetIprpcRewardsCurrentId

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

GetIprpcRewardsCurrentId get the total number of IprpcReward

func (Keeper) GetLastRewardsBlock

func (k Keeper) GetLastRewardsBlock(ctx sdk.Context) (rewardsDistributionBlock uint64, after24HoursBlock uint64, err error)

GetLastRewardsBlock returns the last block in which the IPRPC rewards were distributed and the block height of 24 hours later. This is used by the subscription module's estimate-rewards query

func (Keeper) GetMinIprpcCost

func (k Keeper) GetMinIprpcCost(ctx sdk.Context) sdk.Coin

GetMinIprpcCost gets the min iprpc cost

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) InitRewardsRefillTS

func (k Keeper) InitRewardsRefillTS(ctx sdk.Context, gs timerstoretypes.GenesisState)

InitRewardsRefillTS initializes the refill pools' timer store

func (Keeper) IsIprpcSubscription

func (k Keeper) IsIprpcSubscription(ctx sdk.Context, address string) bool

IsIprpcSubscription checks whether a subscription is IPRPC eligible subscription

func (Keeper) LeftoverBurnRate

func (k Keeper) LeftoverBurnRate(ctx sdk.Context) (res sdk.Dec)

LeftoverBurnRate returns the LeftoverBurnRate param

func (Keeper) Logger

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

func (Keeper) LowFactor

func (k Keeper) LowFactor(ctx sdk.Context) (res sdk.Dec)

LowFactor returns the LowFactor param

func (Keeper) MaxBondedTarget

func (k Keeper) MaxBondedTarget(ctx sdk.Context) (res sdk.Dec)

MaxBondedTarget returns the MaxBondedTarget param

func (Keeper) MaxRewardBoost

func (k Keeper) MaxRewardBoost(ctx sdk.Context) (res uint64)

MaxRewardBoost returns the MaxRewardBoost param

func (Keeper) MinBondedTarget

func (k Keeper) MinBondedTarget(ctx sdk.Context) (res sdk.Dec)

MinBondedTarget returns the MinBondedTarget param

func (Keeper) MovePoolToPool

func (k Keeper) MovePoolToPool(ctx sdk.Context, from types.Pool, to types.Pool)

func (Keeper) Params

func (Keeper) Pools

func (Keeper) PopIprpcReward

func (k Keeper) PopIprpcReward(ctx sdk.Context) (types.IprpcReward, bool)

PopIprpcReward gets the lowest id IprpcReward object and removes it

func (Keeper) RefillRewardsPools

func (k Keeper) RefillRewardsPools(ctx sdk.Context, _ []byte, data []byte)

RefillRewardsPools is called once a month (as a timer callback). it does the following for validators:

  1. burns the current token in the validators distribution pool by the burn rate
  2. transfers the monthly tokens quota from the validators allocation pool to the validators distribution pool
  3. opens a new timer for the next month (and encodes the expiry block and months left to allocation pool in it)

for providers: TBD

func (Keeper) RemoveIprpcReward

func (k Keeper) RemoveIprpcReward(ctx sdk.Context, id uint64)

RemoveIprpcReward removes a IprpcReward from the store

func (Keeper) RemoveIprpcSubscription

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

RemoveIprpcSubscription removes a subscription from the IprpcSubscription store

func (Keeper) SetAllBasePay

func (k Keeper) SetAllBasePay(ctx sdk.Context, list []types.BasePayWithIndex)

SetAllBasePay sets all BasePay

func (Keeper) SetIprpcData

func (k Keeper) SetIprpcData(ctx sdk.Context, cost sdk.Coin, subs []string) error

func (Keeper) SetIprpcReward

func (k Keeper) SetIprpcReward(ctx sdk.Context, iprpcReward types.IprpcReward)

SetIprpcReward set a specific IprpcReward in the store

func (Keeper) SetIprpcRewardsCurrentId

func (k Keeper) SetIprpcRewardsCurrentId(ctx sdk.Context, current uint64)

SetIprpcRewardsCurrentId set the total number of IprpcReward

func (Keeper) SetIprpcSubscription

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

SetIprpcSubscription set a subscription in the IprpcSubscription store

func (Keeper) SetLastRewardsBlock

func (k Keeper) SetLastRewardsBlock(ctx sdk.Context) error

SetLastRewardsBlock sets the lastRewardsBlock as the current height

func (Keeper) SetMinIprpcCost

func (k Keeper) SetMinIprpcCost(ctx sdk.Context, cost sdk.Coin)

SetMinIprpcCost sets the min iprpc cost

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SpecEmissionParts

func (k Keeper) SpecEmissionParts(ctx sdk.Context) (emissions []types.SpecEmissionPart)

func (Keeper) SpecTotalPayout

func (k Keeper) SpecTotalPayout(ctx sdk.Context, totalMonthlyPayout math.Int, totalProvidersBaseRewards sdk.Dec, spec types.SpecEmissionPart) math.LegacyDec

SpecTotalPayout calculates the total bonus for a specific spec specPayoutAllocation: maximum rewards that the spec can have rewardBoost: bonus based on the total rewards providers got factored by maxboost diminishingRewards: makes sure to diminish the bonuses in case there are enough consumers on the chain

func (Keeper) TimeToNextTimerExpiry

func (k Keeper) TimeToNextTimerExpiry(ctx sdk.Context) int64

TimeToNextTimerExpiry returns the time in which the timer will expire (according to the current block time)

func (Keeper) TotalPoolTokens

func (k Keeper) TotalPoolTokens(ctx sdk.Context, pool types.Pool) sdk.Coins

TotalPoolTokens gets the total tokens supply from a pool

func (Keeper) ValidatorsSubscriptionParticipation

func (k Keeper) ValidatorsSubscriptionParticipation(ctx sdk.Context) (res sdk.Dec)

ValidatorsSubscriptionParticipation returns the ValidatorsSubscriptionParticipation param

type Migrator

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

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

func (Migrator) MigrateVersion1To2

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

MigrateVersion1To2 sets the min IPRPC cost to be 100LAVA = 100,000,000ulava

Jump to

Keyboard shortcuts

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