keeper

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryVolumeReport      = "volume_report"
	QueryPotRewards        = "pot_rewards"
	QueryPotRewardsByEpoch = "pot_rewards_by_epoch"
	QueryPotRewardsByOwner = "pot_rewards_by_owner"
	QueryDefaultLimit      = 100
)
View Source
const (
	StratosBech32Prefix = "st"
)

Variables

View Source
var (
	AccountPubKeyPrefix    = StratosBech32Prefix + "pub"
	ValidatorAddressPrefix = StratosBech32Prefix + "valoper"
	ValidatorPubKeyPrefix  = StratosBech32Prefix + "valoperpub"
	ConsNodeAddressPrefix  = StratosBech32Prefix + "valcons"
	ConsNodePubKeyPrefix   = StratosBech32Prefix + "valconspub"
	SdsNodeP2PKeyPrefix    = StratosBech32Prefix + "sdsp2p"
)

Functions

func MakeTestCodec

func MakeTestCodec() *codec.Codec

create a codec used only for testing

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier creates a new querier for pot clients.

func SetConfig

func SetConfig()

Types

type Keeper

type Keeper struct {
	BankKeeper     bank.Keeper
	SupplyKeeper   supply.Keeper
	AccountKeeper  auth.AccountKeeper
	StakingKeeper  staking.Keeper
	RegisterKeeper register.Keeper
	// contains filtered or unexported fields
}

Keeper of the pot store

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSpace params.Subspace, feeCollectorName string,
	bankKeeper bank.Keeper, supplyKeeper supply.Keeper, accountKeeper auth.AccountKeeper, stakingKeeper staking.Keeper,
	registerKeeper register.Keeper,
) Keeper

NewKeeper creates a pot keeper

func (Keeper) BondDenom

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

BondDenom - Bondable coin denomination

func (Keeper) CalcMiningRewardInTotal

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

allocate mining reward from foundation account

func (Keeper) CalcRewardForIndexingNode

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

func (Keeper) CalcRewardForResourceNode

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

func (Keeper) CalcTrafficRewardInTotal

func (k Keeper) CalcTrafficRewardInTotal(
	ctx sdk.Context, trafficList []types.SingleNodeVolume, distributeGoal types.DistributeGoal,
) (sdk.Dec, types.DistributeGoal, error)

func (Keeper) DeleteVolumeReport

func (k Keeper) DeleteVolumeReport(ctx sdk.Context, key []byte)

func (Keeper) DistributePotReward

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

func (Keeper) GetEpochReward added in v0.4.0

func (k Keeper) GetEpochReward(ctx sdk.Context, epoch sdk.Int) (value []types.Reward)

func (Keeper) GetFoundationAccount

func (k Keeper) GetFoundationAccount(ctx sdk.Context) (acc sdk.AccAddress)

func (Keeper) GetImmatureTotalReward

func (k Keeper) GetImmatureTotalReward(ctx sdk.Context, acc sdk.AccAddress) (value sdk.Int)

func (Keeper) GetIndividualReward

func (k Keeper) GetIndividualReward(ctx sdk.Context, acc sdk.AccAddress, epoch sdk.Int) (value sdk.Int)

func (Keeper) GetInitialUOzonePrice

func (k Keeper) GetInitialUOzonePrice(ctx sdk.Context) (price sdk.Int)

func (Keeper) GetMatureTotalReward

func (k Keeper) GetMatureTotalReward(ctx sdk.Context, acc sdk.AccAddress) (value sdk.Int)

func (Keeper) GetMinedTokens

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

func (Keeper) GetMiningRewardParamByMinedToken

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

func (Keeper) GetNodesRewards added in v0.4.0

func (k Keeper) GetNodesRewards(ctx sdk.Context, params QueryPotRewardsParams) (res []NodeRewardsInfo)

func (Keeper) GetNodesRewardsByOwner added in v0.4.0

func (k Keeper) GetNodesRewardsByOwner(ctx sdk.Context, params QueryPotRewardsByOwnerParams) (res []NodeRewardsInfo)

func (Keeper) GetParams

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

GetParams returns the total set of pot parameters.

func (Keeper) GetPotRewardsByEpoch added in v0.4.0

func (k Keeper) GetPotRewardsByEpoch(ctx sdk.Context, params QueryPotRewardsByepochParams) (res []types.Reward)

func (Keeper) GetRewardAddressPool

func (k Keeper) GetRewardAddressPool(ctx sdk.Context) (addressList []sdk.AccAddress)

func (Keeper) GetTotalConsumedOzone

func (k Keeper) GetTotalConsumedOzone(trafficList []types.SingleNodeVolume) sdk.Int

func (Keeper) GetTotalMinedTokens

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

func (Keeper) GetTotalUnissuedPrepay

func (k Keeper) GetTotalUnissuedPrepay(ctx sdk.Context) (totalUnissuedPrepay sdk.Int)

func (Keeper) GetVolumeReport

func (k Keeper) GetVolumeReport(ctx sdk.Context, epoch sdk.Int) (res types.ReportRecord, err error)

func (Keeper) IsSPNode

func (k Keeper) IsSPNode(ctx sdk.Context, addr sdk.AccAddress) (found bool)

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) SetFoundationAccount

func (k Keeper) SetFoundationAccount(ctx sdk.Context, acc sdk.AccAddress)

func (Keeper) SetInitialUOzonePrice

func (k Keeper) SetInitialUOzonePrice(ctx sdk.Context, price 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) SetTotalUnissuedPrepay

func (k Keeper) SetTotalUnissuedPrepay(ctx sdk.Context, totalUnissuedPrepay sdk.Int)

func (Keeper) SetVolumeReport

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

func (Keeper) Withdraw

func (k Keeper) Withdraw(ctx sdk.Context, amount sdk.Coin, nodeAddress sdk.AccAddress, ownerAddress sdk.AccAddress) error

type NodeRewardsInfo added in v0.4.0

type NodeRewardsInfo struct {
	NodeAddress         sdk.AccAddress
	MatureTotalReward   sdk.Coin
	ImmatureTotalReward sdk.Coin
}

func NewNodeRewardsInfo added in v0.4.0

func NewNodeRewardsInfo(
	nodeAddress sdk.AccAddress,
	matureTotal,
	immatureTotal sdk.Int,
) NodeRewardsInfo

NewNodeRewardsInfo creates a new instance of NodeRewardsInfo

type QueryPotRewardsByOwnerParams added in v0.4.0

type QueryPotRewardsByOwnerParams struct {
	Page      int
	Limit     int
	OwnerAddr sdk.AccAddress
	Height    int64
}

func NewQueryPotRewardsByOwnerParams added in v0.4.0

func NewQueryPotRewardsByOwnerParams(page, limit int, ownerAddr sdk.AccAddress, height int64) QueryPotRewardsByOwnerParams

NewQueryPotRewardsByOwnerParams creates a new instance of QueryPotRewardsParams

type QueryPotRewardsByepochParams added in v0.4.0

type QueryPotRewardsByepochParams struct {
	Page      int
	Limit     int
	OwnerAddr sdk.AccAddress
	Epoch     sdk.Int
}

func NewQueryPotRewardsByepochParams added in v0.4.0

func NewQueryPotRewardsByepochParams(page, limit int, ownerAddr sdk.AccAddress, epoch sdk.Int) QueryPotRewardsByepochParams

NewQueryPotRewardsByepochParams creates a new instance of QueryPotRewardsParams

type QueryPotRewardsParams added in v0.4.0

type QueryPotRewardsParams struct {
	Page     int
	Limit    int
	NodeAddr sdk.AccAddress
	Epoch    sdk.Int
}

func NewQueryPotRewardsParams added in v0.4.0

func NewQueryPotRewardsParams(page, limit int, nodeAddr sdk.AccAddress, epoch sdk.Int) QueryPotRewardsParams

NewQueryPotRewardsParams creates a new instance of QueryPotRewardsParams

Jump to

Keyboard shortcuts

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