keeper

package
v0.0.0-...-f54dcd4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService store.KVStoreService,
	ak dstrtypes.AccountKeeper,
	bk dstrtypes.BankKeeper,
	sk dstrtypes.StakingKeeper,
	feeCollectorName, authority string,
) Keeper

NewKeeper creates a new distribution Keeper instance, embedding or wrapping a real distribution keeper.

Typically, we don't need to do this but since the original distribution keeper doesn't expose private fields that we need access to, we "hijack" them by re-creating a constructor to capture those private fields before passing them onto the real constructor.

func (Keeper) WithdrawDelegationRewards

func (k Keeper) WithdrawDelegationRewards(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) (sdk.Coins, error)

WithdrawDelegationRewards override the original function to "extend" functionality, by prohibiting withdrawal of rewards if the delegation account is a vesting account.

Specifically, we prohibit withdrawal of rewards if the delegation account is has ANY tokens left that are still escrowed/vesting.

Note, this is just an example of how a chain can prohibit withdrawal of rewards for vesting accounts. A more sophisticated implementation could allow for withdrawal up to a certain threshold or perhaps based on a function of total vested so far. Regardless, the example shows how any such mechanism can be implemented.

Jump to

Keyboard shortcuts

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