utils

package
v0.4.3-beta Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaimStakingRewardsIfNecessary

func ClaimStakingRewardsIfNecessary(
	ctx cosmos.Context,
	bankKeeper BankKeeper,
	distributionKeeper DistributionKeeper,
	stakingKeeper StakingKeeper,
	addr cosmos.AccAddress,
	amount cosmos.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 cosmos.Context,
	stakingKeeper StakingKeeper,
	distributionKeeper DistributionKeeper,
	addr cosmos.AccAddress,
	amount cosmos.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 cosmos.Context, addr cosmos.AccAddress, denom string) cosmos.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 cosmos.Context, delAddr cosmos.AccAddress, valAddr cosmos.ValAddress) (cosmos.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 cosmos.Context) string
	IterateDelegations(ctx cosmos.Context, delegator cosmos.AccAddress, fn func(index int64, delegation stakingmodule.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 cosmos.Context, feeTx cosmos.FeeTx) (cosmos.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