keeper

package
v3.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the bank MsgServer interface for the provided Keeper.

Types

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

func (Hooks) AfterDelegationModified

func (h Hooks) AfterDelegationModified(ctx context.Context, delAddr sdk.AccAddress, _ sdk.ValAddress) error

check if after delegation is modified, the locked power is still less than total delegation

func (Hooks) AfterUnbondingInitiated

func (h Hooks) AfterUnbondingInitiated(_ context.Context, _ uint64) error

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(_ context.Context, _ sdk.ValAddress) error

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(_ context.Context, _ sdk.ConsAddress, _ sdk.ValAddress) error

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(ctx context.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

check if after delegation is removed, the locked power is still less than total delegation

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(_ context.Context, _ sdk.AccAddress, _ sdk.ValAddress) error

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(_ context.Context, _ sdk.ValAddress) error

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(_ context.Context, _ sdk.ValAddress, _ sdkmath.LegacyDec) error

type Keeper

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

Keeper of the x/restake store

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key storetypes.StoreKey,
	authKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	stakingKeeper types.StakingKeeper,
	authority string,
) Keeper

NewKeeper creates a new restake Keeper instance

func (Keeper) DeactivateVault

func (k Keeper) DeactivateVault(ctx sdk.Context, key string) error

DeactivateVault deactivates the vault.

func (Keeper) DeleteLock

func (k Keeper) DeleteLock(ctx sdk.Context, addr sdk.AccAddress, key string)

DeleteLock deletes a lock from the store.

func (Keeper) DeleteStake

func (k Keeper) DeleteStake(ctx sdk.Context, addr sdk.AccAddress)

DeleteStake deletes a stake from the store.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the module's exported genesis

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the module's authority.

func (Keeper) GetDelegationPower

func (k Keeper) GetDelegationPower(ctx sdk.Context, stakerAddr sdk.AccAddress) (sdkmath.Int, error)

GetDelegationPower returns the power from delegation

func (Keeper) GetLock

func (k Keeper) GetLock(ctx sdk.Context, addr sdk.AccAddress, key string) (types.Lock, bool)

GetLock gets a lock from store by address and key.

func (Keeper) GetLockedPower

func (k Keeper) GetLockedPower(ctx sdk.Context, stakerAddr sdk.AccAddress, key string) (sdkmath.Int, error)

GetLockedPower returns locked power of the address to the vault.

func (Keeper) GetLocks

func (k Keeper) GetLocks(ctx sdk.Context) (locks []types.Lock)

GetLocks gets all locks in the store.

func (Keeper) GetLocksByAddress

func (k Keeper) GetLocksByAddress(ctx sdk.Context, addr sdk.AccAddress) (locks []types.Lock)

GetLocksByAddress gets all locks of the address.

func (Keeper) GetLocksByAddressIterator

func (k Keeper) GetLocksByAddressIterator(ctx sdk.Context, addr sdk.AccAddress) storetypes.Iterator

GetLocksByAddressIterator gets iterator of locks of the speicfic address.

func (Keeper) GetLocksIterator

func (k Keeper) GetLocksIterator(ctx sdk.Context) storetypes.Iterator

GetLocksIterator gets iterator of lock store.

func (Keeper) GetModuleAccount

func (k Keeper) GetModuleAccount(ctx sdk.Context) sdk.ModuleAccountI

GetModuleAccount returns the restake ModuleAccount

func (Keeper) GetOrCreateVault

func (k Keeper) GetOrCreateVault(ctx sdk.Context, key string) (types.Vault, error)

GetOrCreateVault get the vault object by using key. If the vault doesn't exist, it will initialize the new vault.

func (Keeper) GetParams

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

GetParams returns the current module parameters.

func (Keeper) GetStake

func (k Keeper) GetStake(ctx sdk.Context, addr sdk.AccAddress) types.Stake

GetStake gets a stake from store by address.

func (Keeper) GetStakedPower

func (k Keeper) GetStakedPower(ctx sdk.Context, stakerAddr sdk.AccAddress) sdkmath.Int

GetStakedPower returns the power from staked coins in the module.

func (Keeper) GetStakes

func (k Keeper) GetStakes(ctx sdk.Context) (stakes []types.Stake)

GetStakes gets all stakes in the store.

func (Keeper) GetStakesIterator

func (k Keeper) GetStakesIterator(ctx sdk.Context) storetypes.Iterator

GetStakesIterator gets iterator of stake store.

func (Keeper) GetTotalPower

func (k Keeper) GetTotalPower(ctx sdk.Context, stakerAddr sdk.AccAddress) (sdkmath.Int, error)

GetTotalPower returns the total power of an address.

func (Keeper) GetVault

func (k Keeper) GetVault(ctx sdk.Context, key string) (types.Vault, bool)

GetVault gets a vault from store by key.

func (Keeper) GetVaults

func (k Keeper) GetVaults(ctx sdk.Context) (vaults []types.Vault)

GetVaults gets all vaults in the store.

func (Keeper) GetVaultsIterator

func (k Keeper) GetVaultsIterator(ctx sdk.Context) storetypes.Iterator

GetVaultsIterator gets iterator of vault store.

func (Keeper) HasVault

func (k Keeper) HasVault(ctx sdk.Context, vaultName string) bool

HasVault checks if vault exists in the store.

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState)

InitGenesis initializes the module's state from a provided genesis state.

func (Keeper) IsActiveVault

func (k Keeper) IsActiveVault(ctx sdk.Context, key string) bool

IsActiveVault checks whether the vault is active or not.

func (Keeper) IsLiquidStaker

func (k Keeper) IsLiquidStaker(addr sdk.AccAddress) bool

Checks if an account associated with a given delegation is related to liquid staking

This is determined by checking if the account has a 32-length address which will identify the following scenarios:

  • An account has tokenized their shares, and thus the delegation is owned by the tokenize share record module account
  • A liquid staking provider is delegating through an ICA account

Both ICA accounts and tokenize share record module accounts have 32-length addresses

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MustGetVault

func (k Keeper) MustGetVault(ctx sdk.Context, key string) types.Vault

MustGetVault gets a vault from store by name. Panics if can't get the vault.

func (Keeper) SetLock

func (k Keeper) SetLock(ctx sdk.Context, lock types.Lock)

SetLock sets a lock to the store.

func (Keeper) SetLockedPower

func (k Keeper) SetLockedPower(ctx sdk.Context, stakerAddr sdk.AccAddress, key string, power sdkmath.Int) error

SetLockedPower sets the new locked power of the address to the vault This function will override the previous locked power.

func (Keeper) SetModuleAccount

func (k Keeper) SetModuleAccount(ctx sdk.Context, acc sdk.ModuleAccountI)

SetModuleAccount sets a module account in the account keeper.

func (Keeper) SetParams

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

SetParams sets the module parameters.

func (Keeper) SetStake

func (k Keeper) SetStake(ctx sdk.Context, stake types.Stake)

SetStake sets a stake to the store.

func (Keeper) SetVault

func (k Keeper) SetVault(ctx sdk.Context, vault types.Vault)

SetVault sets a vault to the store.

type Querier

type Querier struct {
	Keeper
}

Querier is used as Keeper will have duplicated methods if used directly, and gRPC names take precedence over keeper.

func (Querier) Lock

Lock queries info about a lock by using address and key

func (Querier) Locks

Locks queries all locks with pagination.

func (Querier) Params

Params queries all params of the module.

func (Querier) Stake

Stake queries stake information of an address.

func (Querier) Vault

Vault queries info about a vault.

func (Querier) Vaults

Vaults queries all vaults with pagination.

Jump to

Keyboard shortcuts

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