keeper

package
v0.4.31 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EPOCH_BLOCK_DIVIDER uint64 = 5 // determines how many blocks from the previous epoch will be included in the average block time calculation
	MIN_SAMPLE_STEP     uint64 = 1 // the minimal sample step when calculating the average block time
)
View Source
const INVALID_INDEX = -2

Variables

This section is empty.

Functions

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 sdk.StoreKey,
	ps paramtypes.Subspace,

	bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, specKeeper types.SpecKeeper, epochStorageKeeper types.EpochstorageKeeper,
) *Keeper

func (Keeper) AddEpochPayment added in v0.4.3

func (k Keeper) AddEpochPayment(ctx sdk.Context, chainID string, epoch uint64, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, usedCU uint64, uniqueIdentifier string) (uint64, error)

func (Keeper) AddProviderPaymentInEpoch added in v0.4.3

func (k Keeper) AddProviderPaymentInEpoch(ctx sdk.Context, chainID string, epoch uint64, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, usedCU uint64, uniqueIdentifier string) (userPayment *types.ProviderPaymentStorage, usedCUConsumerTotal uint64, err error)

func (Keeper) AddUniquePaymentStorageClientProvider added in v0.4.3

func (k Keeper) AddUniquePaymentStorageClientProvider(ctx sdk.Context, chainID string, block uint64, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, uniqueIdentifier string, usedCU uint64) (isUnique bool, entryAddr *types.UniquePaymentStorageClientProvider)

func (Keeper) BailEntry

func (k Keeper) BailEntry(ctx sdk.Context, account sdk.AccAddress, isProvider bool, chainID string, bail sdk.Coin) error

func (Keeper) BurnClientStake added in v0.4.3

func (k Keeper) BurnClientStake(ctx sdk.Context, chainID string, clientAddressToBurn sdk.AccAddress, burnAmount sdk.Coin, failBurnOnLeftover bool) (bool, error)

func (Keeper) BurnCoinsPerCU added in v0.4.3

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

BurnCoinsPerCU returns the BurnCoinsPerCU param

func (Keeper) CheckUnstakingForCommit

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

func (Keeper) ClientMaxCUProviderForBlock added in v0.4.3

func (k Keeper) ClientMaxCUProviderForBlock(ctx sdk.Context, blockHeight uint64, clientEntry *epochstoragetypes.StakeEntry) (uint64, error)

func (Keeper) Clients added in v0.4.3

func (Keeper) CreditStakeEntry

func (k Keeper) CreditStakeEntry(ctx sdk.Context, chainID string, lookUpAddress sdk.AccAddress, creditAmount sdk.Coin, isProvider bool) (bool, error)

func (Keeper) DataReliabilityReward added in v0.4.3

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

func (Keeper) EncodeUniquePaymentKey

func (k Keeper) EncodeUniquePaymentKey(ctx sdk.Context, userAddress sdk.AccAddress, providerAddress sdk.AccAddress, uniqueIdentifier string, chainID string) string

func (Keeper) EnforceClientCUsUsageInEpoch

func (k Keeper) EnforceClientCUsUsageInEpoch(ctx sdk.Context, chainID string, cuSum uint64, blockHeight int64, allowedCU uint64, clientAddr sdk.AccAddress, totalCUInEpochForUserProvider uint64, providerAddr sdk.AccAddress, epochStart uint64) (ammountToPay uint64, err error)

func (Keeper) EpochBlocksOverlap

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

func (Keeper) FraudSlashingAmount added in v0.4.3

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

FraudSlashingAmount returns the FraudSlashingAmount param

func (Keeper) FraudStakeSlashingFactor added in v0.4.3

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

FraudStakeSlashingFactor returns the FraudStakeSlashingFactor param

func (Keeper) GetAllEpochPayments

func (k Keeper) GetAllEpochPayments(ctx sdk.Context) (list []types.EpochPayments)

GetAllEpochPayments returns all epochPayments

func (Keeper) GetAllProviderPaymentStorage

func (k Keeper) GetAllProviderPaymentStorage(ctx sdk.Context) (list []types.ProviderPaymentStorage)

GetAllProviderPaymentStorage returns all providerPaymentStorage

func (Keeper) GetAllUniquePaymentStorageClientProvider

func (k Keeper) GetAllUniquePaymentStorageClientProvider(ctx sdk.Context) (list []types.UniquePaymentStorageClientProvider)

GetAllUniquePaymentStorageClientProvider returns all uniquePaymentStorageClientProvider

func (Keeper) GetAllowedCUForBlock added in v0.4.3

func (k Keeper) GetAllowedCUForBlock(ctx sdk.Context, blockHeight uint64, entry *epochstoragetypes.StakeEntry) (uint64, error)

func (Keeper) GetConsumerFromUniquePayment

func (k Keeper) GetConsumerFromUniquePayment(uniquePaymentStorageClientProvider *types.UniquePaymentStorageClientProvider) string

func (Keeper) GetEpochPayments

func (k Keeper) GetEpochPayments(
	ctx sdk.Context,
	index string,
) (val types.EpochPayments, found bool)

GetEpochPayments returns a epochPayments from its index

func (Keeper) GetEpochPaymentsFromBlock

func (k Keeper) GetEpochPaymentsFromBlock(ctx sdk.Context, epoch uint64) (epochPayment types.EpochPayments, found bool, key string)

func (Keeper) GetPairing

Gets a client's provider list in a specific chain. Also returns the start block of the current epoch, time (in seconds) until there's a new pairing, the block that the chain in the request's spec was changed

func (Keeper) GetPairingForClient

func (k Keeper) GetPairingForClient(ctx sdk.Context, chainID string, clientAddress sdk.AccAddress) (providers []epochstoragetypes.StakeEntry, errorRet error)

function used to get a new pairing from relayer and client first argument has all metadata, second argument is only the addresses

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetProviderPaymentStorage

func (k Keeper) GetProviderPaymentStorage(
	ctx sdk.Context,
	index string,
) (val types.ProviderPaymentStorage, found bool)

GetProviderPaymentStorage returns a providerPaymentStorage from its index

func (Keeper) GetProviderPaymentStorageKey

func (k Keeper) GetProviderPaymentStorageKey(ctx sdk.Context, chainID string, epoch uint64, providerAddress sdk.AccAddress) string

func (Keeper) GetTotalUsedCUForConsumerPerEpoch added in v0.4.3

func (k Keeper) GetTotalUsedCUForConsumerPerEpoch(ctx sdk.Context, consumerAddress string, uniquePaymentStorage []*types.UniquePaymentStorageClientProvider, providerAddress string) (usedCUProviderTotal uint64, failed error)

func (Keeper) GetUniquePaymentStorageClientProvider

func (k Keeper) GetUniquePaymentStorageClientProvider(
	ctx sdk.Context,
	index string,
) (val types.UniquePaymentStorageClientProvider, found bool)

GetUniquePaymentStorageClientProvider returns a uniquePaymentStorageClientProvider from its index

func (Keeper) IsEpochStart added in v0.4.3

func (k Keeper) IsEpochStart(ctx sdk.Context) (res bool)

we dont want to do the calculation here too, epochStorage keeper did it

func (Keeper) JailEntry

func (k Keeper) JailEntry(ctx sdk.Context, account sdk.AccAddress, isProvider bool, chainID string, jailStartBlock uint64, jailBlocks uint64, bail sdk.Coin) error

func (Keeper) Logger

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

func (Keeper) MinStakeClient added in v0.4.3

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

MinStakeClient returns the MinStakeClient param

func (Keeper) MinStakeProvider added in v0.4.3

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

MinStakeProvider returns the MinStakeProvider param

func (Keeper) MintCoinsPerCU added in v0.4.3

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

MintCoinsPerCU returns the MintCoinsPerCU param

func (Keeper) Params

func (Keeper) Providers

func (Keeper) QoSWeight

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

func (Keeper) RemoveAllEpochPaymentsForBlock added in v0.4.3

func (k Keeper) RemoveAllEpochPaymentsForBlock(ctx sdk.Context, blockForDelete uint64) error

func (Keeper) RemoveEpochPayments

func (k Keeper) RemoveEpochPayments(
	ctx sdk.Context,
	index string,
)

RemoveEpochPayments removes a epochPayments from the store

func (Keeper) RemoveOldEpochPayment

func (k Keeper) RemoveOldEpochPayment(ctx sdk.Context) (err error)

func (Keeper) RemoveProviderPaymentStorage

func (k Keeper) RemoveProviderPaymentStorage(
	ctx sdk.Context,
	index string,
)

RemoveProviderPaymentStorage removes a providerPaymentStorage from the store

func (Keeper) RemoveUniquePaymentStorageClientProvider

func (k Keeper) RemoveUniquePaymentStorageClientProvider(
	ctx sdk.Context,
	index string,
)

RemoveUniquePaymentStorageClientProvider removes a uniquePaymentStorageClientProvider from the store

func (Keeper) ServicersToPairCount added in v0.4.3

func (k Keeper) ServicersToPairCount(ctx sdk.Context, block uint64) (res uint64, err error)

func (Keeper) ServicersToPairCountRaw added in v0.4.3

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

ServicersToPairCount returns the ServicersToPairCount param

func (Keeper) SetEpochPayments

func (k Keeper) SetEpochPayments(ctx sdk.Context, epochPayments types.EpochPayments)

SetEpochPayments set a specific epochPayments in the store from its index

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetProviderPaymentStorage

func (k Keeper) SetProviderPaymentStorage(ctx sdk.Context, providerPaymentStorage types.ProviderPaymentStorage)

SetProviderPaymentStorage set a specific providerPaymentStorage in the store from its index

func (Keeper) SetUniquePaymentStorageClientProvider

func (k Keeper) SetUniquePaymentStorageClientProvider(ctx sdk.Context, uniquePaymentStorageClientProvider types.UniquePaymentStorageClientProvider)

SetUniquePaymentStorageClientProvider set a specific uniquePaymentStorageClientProvider in the store from its index

func (Keeper) SlashEntry

func (k Keeper) SlashEntry(ctx sdk.Context, account sdk.AccAddress, isProvider bool, chainID string, percentage sdk.Dec) (sdk.Coin, error)

func (Keeper) SlashLimit added in v0.4.3

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

func (Keeper) StakeNewEntry

func (k Keeper) StakeNewEntry(ctx sdk.Context, provider bool, creator string, chainID string, amount sdk.Coin, endpoints []epochstoragetypes.Endpoint, geolocation uint64, vrfpk string, moniker string) error

func (Keeper) StakeToMaxCUList added in v0.4.3

func (k Keeper) StakeToMaxCUList(ctx sdk.Context, block uint64) (res types.StakeToMaxCUList, err error)

func (Keeper) StakeToMaxCUListRaw added in v0.4.3

func (k Keeper) StakeToMaxCUListRaw(ctx sdk.Context) (res types.StakeToMaxCUList)

func (Keeper) UnpayLimit added in v0.4.3

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

func (Keeper) UnstakeEntry

func (k Keeper) UnstakeEntry(ctx sdk.Context, provider bool, chainID string, creator string) error

func (Keeper) UserEntry

func (Keeper) ValidatePairingForClient

func (k Keeper) ValidatePairingForClient(ctx sdk.Context, chainID string, clientAddress sdk.AccAddress, providerAddress sdk.AccAddress, block uint64) (isValidPairing bool, userStake *epochstoragetypes.StakeEntry, foundIndex int, errorRet error)

func (Keeper) VerifyPairingData

func (k Keeper) VerifyPairingData(ctx sdk.Context, chainID string, clientAddress sdk.AccAddress, block uint64) (clientStakeEntryRet *epochstoragetypes.StakeEntry, errorRet error)

Jump to

Keyboard shortcuts

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