keeper

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MatureCountPerBlock = 100
)

Variables

This section is empty.

Functions

func FilteredPaginate added in v0.8.0

func FilteredPaginate(cdc codec.Codec,
	prefixStore storetypes.KVStore,
	pageRequest *pagiquery.PageRequest,
	onResult func(key []byte, value []byte, accumulate bool) (bool, error),
) (*pagiquery.PageResponse, error)

func GetIterator added in v0.8.0

func GetIterator(prefixStore storetypes.KVStore, start []byte, reverse bool) db.Iterator

func NewMsgServerImpl added in v0.8.0

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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

func NewQuerier

func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier creates a new querier for pot clients.

func Paginate added in v0.8.0

func Paginate(
	prefixStore storetypes.KVStore,
	pageRequest *pagiquery.PageRequest,
	onResult func(key []byte, value []byte) error,
) (*pagiquery.PageResponse, error)

func UnmarshalIndividualReward added in v0.8.0

func UnmarshalIndividualReward(cdc codec.Codec, value []byte) (v types.Reward, err error)

Types

type Keeper

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

Keeper of the pot store

func NewKeeper

func NewKeeper(cdc codec.Codec, key sdk.StoreKey, paramSpace paramstypes.Subspace, feeCollectorName string,
	bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, stakingKeeper types.StakingKeeper,
	registerKeeper types.RegisterKeeper, distrKeeper types.DistrKeeper,
) Keeper

NewKeeper creates a pot keeper

func (Keeper) BondDenom

func (k Keeper) BondDenom(ctx sdk.Context) (res string)

BondDenom - Bondable coin denomination

func (Keeper) CalcCommunityTax added in v0.9.0

func (k Keeper) CalcCommunityTax(ctx sdk.Context, rewardBeforeTax sdk.Dec) (reward sdk.Coin, tax sdk.Dec)

func (Keeper) CalcMiningRewardInTotal

func (k Keeper) CalcMiningRewardInTotal(ctx sdk.Context, distributeGoal types.DistributeGoal) (types.DistributeGoal, error)

allocate mining reward from foundation account

func (Keeper) CalcRewardForMetaNode added in v0.8.0

func (k Keeper) CalcRewardForMetaNode(ctx sdk.Context, distributeGoalBalance types.DistributeGoal, rewardDetailMap map[string]types.Reward,
) map[string]types.Reward

Iteration for calculating reward of meta nodes

func (Keeper) CalcRewardForResourceNode

func (k Keeper) CalcRewardForResourceNode(ctx sdk.Context, totalConsumedNoz sdk.Dec, trafficList []types.SingleWalletVolume,
	distributeGoal types.DistributeGoal, rewardDetailMap map[string]types.Reward,
) map[string]types.Reward

Iteration for calculating reward of resource nodes

func (Keeper) CalcTrafficRewardInTotal

func (k Keeper) CalcTrafficRewardInTotal(
	ctx sdk.Context, distributeGoal types.DistributeGoal, totalConsumedNoz sdk.Dec,
) (types.DistributeGoal, error)

func (Keeper) DistributePotReward

func (k Keeper) DistributePotReward(ctx sdk.Context, trafficList []types.SingleWalletVolume, epoch sdk.Int) (err error)

func (Keeper) FoundationDeposit added in v0.5.0

func (k Keeper) FoundationDeposit(ctx sdk.Context, amount sdk.Coins, from sdk.AccAddress) (err error)

func (Keeper) GetCirculationSupply added in v0.10.0

func (k Keeper) GetCirculationSupply(ctx sdk.Context) (circulationSupply sdk.Coins)

func (Keeper) GetCommunityTax added in v0.9.0

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

func (Keeper) GetCurrentNozPrice added in v0.11.0

func (k Keeper) GetCurrentNozPrice(St, Pt, Lt sdk.Int) (currentNozPrice sdk.Dec)

func (Keeper) GetImmatureTotalReward

func (k Keeper) GetImmatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAddress) (value sdk.Coins)

func (Keeper) GetIndividualReward

func (k Keeper) GetIndividualReward(ctx sdk.Context, walletAddress sdk.AccAddress, matureEpoch sdk.Int) (value types.Reward, found bool)

func (Keeper) GetLastDistributedEpoch added in v0.10.0

func (k Keeper) GetLastDistributedEpoch(ctx sdk.Context) (epoch sdk.Int)

func (Keeper) GetMatureTotalReward

func (k Keeper) GetMatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAddress) (value sdk.Coins)

func (Keeper) GetMaturedEpoch added in v0.10.0

func (k Keeper) GetMaturedEpoch(ctx sdk.Context) (epoch sdk.Int)

func (Keeper) GetMetrics added in v0.11.3

func (k Keeper) GetMetrics(ctx sdk.Context) types.Metrics

func (Keeper) GetMiningRewardParamByMinedToken

func (k Keeper) GetMiningRewardParamByMinedToken(ctx sdk.Context, minedToken sdk.Coin) (types.MiningRewardParam, error)

func (Keeper) GetParams

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

GetParams returns the total set of pot parameters.

func (Keeper) GetPrepayAmount added in v0.11.0

func (k Keeper) GetPrepayAmount(Lt, tokenAmount, St, Pt sdk.Int) (purchaseNoz, remainingNoz sdk.Int, err error)

func (Keeper) GetSupply added in v0.10.0

func (k Keeper) GetSupply(ctx sdk.Context) (totalSupply sdk.Coin)

func (Keeper) GetTotalConsumedNoz added in v0.9.0

func (k Keeper) GetTotalConsumedNoz(trafficList []types.SingleWalletVolume) sdk.Int

Iteration for getting total consumed OZ from traffic

func (Keeper) GetTotalMinedTokens

func (k Keeper) GetTotalMinedTokens(ctx sdk.Context) (totalMinedToken sdk.Coin)

func (Keeper) GetTotalMining added in v0.11.3

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

func (Keeper) GetTotalReward added in v0.11.0

func (k Keeper) GetTotalReward(ctx sdk.Context, epoch sdk.Int) (totalReward types.TotalReward)

func (Keeper) GetTrafficReward added in v0.7.0

func (k Keeper) GetTrafficReward(ctx sdk.Context, totalConsumedNoz sdk.Dec) (result sdk.Dec)

[S] is initial genesis deposit by all resource nodes and meta nodes at t=0 The current unissued prepay Volume Pool [pt] is the total remaining prepay wei kept by Stratos Network but not issued to Resource Node as rewards. At time t=0, pt=0 total consumed Ozone is [Y] The remaining total Ozone limit [lt] is the upper bound of total Ozone that users can purchase from Stratos blockchain. the total generated traffic rewards as [R] R = (S + Pt) * Y / (Lt + Y)

func (Keeper) GetVolumeReport

func (k Keeper) GetVolumeReport(ctx sdk.Context, epoch sdk.Int) (res types.VolumeReportRecord)

func (Keeper) HasReachedThreshold added in v0.10.0

func (k Keeper) HasReachedThreshold(ctx sdk.Context, pubKeys [][]byte) bool

func (Keeper) InitVariable added in v0.9.0

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

func (Keeper) InitialTotalSupply added in v0.10.0

func (k Keeper) InitialTotalSupply(ctx sdk.Context) (res sdk.Coin)

func (Keeper) IteratorImmatureTotal added in v0.7.0

func (k Keeper) IteratorImmatureTotal(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, immatureTotal sdk.Coins) (stop bool))

Iteration for getting total immature reward

func (Keeper) IteratorIndividualReward added in v0.7.0

func (k Keeper) IteratorIndividualReward(ctx sdk.Context, epoch sdk.Int, handler func(walletAddress sdk.AccAddress, individualReward types.Reward) (stop bool))

Iteration for getting individule reward of each owner at a specific epoch

func (Keeper) IteratorMatureTotal added in v0.7.0

func (k Keeper) IteratorMatureTotal(ctx sdk.Context, handler func(walletAddress sdk.AccAddress, matureTotal sdk.Coins) (stop bool))

IteratorMatureTotal Iteration for getting total mature reward

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MatureEpoch

func (k Keeper) MatureEpoch(ctx sdk.Context) (res int64)

func (Keeper) MiningRewardParams

func (k Keeper) MiningRewardParams(ctx sdk.Context) (res []types.MiningRewardParam)

func (Keeper) NozSupply added in v0.11.0

func (k Keeper) NozSupply(ctx sdk.Context) (remaining, total sdk.Int)

NozSupply calc remaining/total supply for noz

func (Keeper) RemoveIndividualReward added in v0.10.0

func (k Keeper) RemoveIndividualReward(ctx sdk.Context, individualRewardKey []byte)

func (Keeper) RestoreTotalSupply added in v0.10.0

func (k Keeper) RestoreTotalSupply(ctx sdk.Context) (minted, burned sdk.Coins)

Restore total supply to 100M stos

func (Keeper) RewardDenom added in v0.6.0

func (k Keeper) RewardDenom(ctx sdk.Context) (res string)

func (Keeper) RewardMatureAndSubSlashing added in v0.10.0

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

RewardMatureAndSubSlashing mature rewards and deduct slashing for all nodes

func (Keeper) SafeMintCoins added in v0.10.0

func (k Keeper) SafeMintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error

func (Keeper) SetImmatureTotalReward added in v0.7.0

func (k Keeper) SetImmatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAddress, value sdk.Coins)

func (Keeper) SetIndividualReward added in v0.7.0

func (k Keeper) SetIndividualReward(ctx sdk.Context, walletAddress sdk.AccAddress, matureEpoch sdk.Int, value types.Reward)

func (Keeper) SetLastDistributedEpoch added in v0.10.0

func (k Keeper) SetLastDistributedEpoch(ctx sdk.Context, epoch sdk.Int)

func (Keeper) SetMatureTotalReward added in v0.7.0

func (k Keeper) SetMatureTotalReward(ctx sdk.Context, walletAddress sdk.AccAddress, value sdk.Coins)

func (Keeper) SetMaturedEpoch added in v0.10.0

func (k Keeper) SetMaturedEpoch(ctx sdk.Context, epoch sdk.Int)

func (Keeper) SetParams

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

SetParams sets the pot parameters to the param space.

func (Keeper) SetTotalMinedTokens added in v0.7.0

func (k Keeper) SetTotalMinedTokens(ctx sdk.Context, totalMinedToken sdk.Coin)

func (Keeper) SetVolumeReport

func (k Keeper) SetVolumeReport(ctx sdk.Context, epoch sdk.Int, reportRecord types.VolumeReportRecord)

func (Keeper) SlashingResourceNode added in v0.6.2

func (k Keeper) SlashingResourceNode(ctx sdk.Context, p2pAddr stratos.SdsAddress, walletAddr sdk.AccAddress,
	nozAmt sdk.Int, suspend bool) (tokenAmt sdk.Int, nodeType registertypes.NodeType, err error)

This function only record slashing amount.

Deduct slashing amount when: 1, calculate upcoming mature reward, deduct from mature_total & upcoming mature reward. 2, meta node decrease deposit . 3, resource node decrease deposit .

func (Keeper) VolumeReport added in v0.6.0

func (k Keeper) VolumeReport(ctx sdk.Context, walletVolumes types.WalletVolumes, reporter stratos.SdsAddress,
	epoch sdk.Int, reportReference string, txHash string) (err error)

func (Keeper) Withdraw

func (k Keeper) Withdraw(ctx sdk.Context, amount sdk.Coins, walletAddress sdk.AccAddress, targetAddress sdk.AccAddress) error

type Migrator added in v0.8.0

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

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

func NewMigrator added in v0.8.0

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2 added in v0.8.0

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

Migrate1to2 migrates from version 1 to 2.

type Querier added in v0.8.0

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper

func (Querier) CirculationSupply added in v0.10.0

func (Querier) Metrics added in v0.11.3

func (Querier) Params added in v0.8.0

func (Querier) RewardsByEpoch added in v0.10.0

func (Querier) RewardsByOwner added in v0.10.0

func (Querier) SlashingByOwner added in v0.10.0

func (Querier) TotalMinedToken added in v0.10.0

func (Querier) TotalRewardByEpoch added in v0.11.0

func (Querier) VolumeReport added in v0.8.0

Jump to

Keyboard shortcuts

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