utils

package
v0.0.0-...-d51e7a6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaimStakingRewardsIfNecessary

func ClaimStakingRewardsIfNecessary(
	ctx sdk.Context,
	bankKeeper BankKeeper,
	distributionKeeper DistributionKeeper,
	stakingKeeper StakingKeeper,
	addr sdk.AccAddress,
	amount sdk.Coins,
) error

ClaimStakingRewardsIfNecessary checks if the given address has enough balance to cover the given amount. If not, it attempts to claim enough staking rewards to cover the amount.

func ClaimSufficientStakingRewards

func ClaimSufficientStakingRewards(
	ctx sdk.Context,
	stakingKeeper StakingKeeper,
	distributionKeeper DistributionKeeper,
	addr sdk.AccAddress,
	amount sdk.Coin,
) error

ClaimSufficientStakingRewards checks if the account has enough staking rewards unclaimed to cover the given amount. If more than enough rewards are unclaimed, only those up to the given amount are claimed.

Types

type BankKeeper

type BankKeeper interface {
	GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
}

BankKeeper defines the exposed interface for using functionality of the bank keeper in the context of the AnteHandler utils package.

type DistributionKeeper

type DistributionKeeper interface {
	WithdrawDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)
}

DistributionKeeper defines the exposed interface for using functionality of the distribution keeper in the context of the AnteHandler utils package.

type StakingKeeper

type StakingKeeper interface {
	BondDenom(ctx sdk.Context) string
	IterateDelegations(ctx sdk.Context, delegator sdk.AccAddress, fn func(index int64, delegation stakingtypes.DelegationI) (stop bool))
}

StakingKeeper defines the exposed interface for using functionality of the staking keeper in the context of the AnteHandler utils package.

type TxFeeChecker

type TxFeeChecker func(ctx sdk.Context, feeTx sdk.FeeTx) (sdk.Coins, int64, error)

TxFeeChecker check if the provided fee is enough and returns the effective fee and tx priority, the effective fee should be deducted later, and the priority should be returned in abci response.

Jump to

Keyboard shortcuts

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