keeper

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServer

func NewMsgServer(k *Keeper) types.MsgServer

Types

type Keeper

type Keeper struct {

	// Addresses
	ModuleAddress string
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	storeKey storetypes.StoreKey,
	storeService corestoretypes.KVStoreService,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	operatorsKeeper types.OperatorsKeeper,
	poolsKeeper types.PoolsKeeper,
	servicesKeeper types.ServicesKeeper,
	restakingKeeper types.RestakingKeeper,
	moduleAddress string,
	authority string,
) *Keeper

func (*Keeper) AddToUserInsuranceFund

func (k *Keeper) AddToUserInsuranceFund(
	ctx sdk.Context,
	user sdk.AccAddress,
	amount sdk.Coins,
) error

AddToUserInsuranceFund adds the provided amount to the user's insurance fund. NOTE: We assume that the amount that will be added to the user's insurance fund is already present in the module account balance.

func (*Keeper) BurnCoinsUnbondingQueueIterator

func (k *Keeper) BurnCoinsUnbondingQueueIterator(ctx sdk.Context, endTime time.Time) storetypes.Iterator

BurnCoinsQueueIterator returns all the BurnCoins from time 0 until endTime.

func (*Keeper) BurnVestedRepresentation

func (k *Keeper) BurnVestedRepresentation(
	ctx sdk.Context,
	accAddress sdk.AccAddress,
	amount sdk.Coins,
) error

BurnVestedRepresentation burns the vested staking representation from the user's balance. NOTE: If the coins are restaked they will be unstaked first.

func (*Keeper) CanWithdrawFromInsuranceFund

func (k *Keeper) CanWithdrawFromInsuranceFund(ctx sdk.Context, user sdk.AccAddress, amount sdk.Coins) (bool, error)

CanWithdrawFromInsuranceFund returns true if the user can withdraw the provided amount from their insurance fund.

func (*Keeper) CompleteBurnCoins

func (k *Keeper) CompleteBurnCoins(ctx sdk.Context) error

CompleteBurnCoins runs the endblocker logic to burn the coins after the undelegation completes.

func (*Keeper) DequeueAllBurnCoinsFromUnbondingQueue

func (k *Keeper) DequeueAllBurnCoinsFromUnbondingQueue(ctx sdk.Context, currTime time.Time) (burnCoins []types.BurnCoins)

DequeueAllBurnCoinsFromUnbondingQueue returns a concatenated list of all the timeslices inclusively previous to currTime, and deletes the timeslices from the queue.

func (*Keeper) ExportGenesis

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

ExportGenesis returns the GenesisState associated with the given context

func (*Keeper) GetAllBurnCoins

func (k *Keeper) GetAllBurnCoins(ctx sdk.Context) []types.BurnCoins

GetAllBurnCoins returns all the coins that are scheduled to be burned.

func (*Keeper) GetBurnCoinsQueueTimeSlice

func (k *Keeper) GetBurnCoinsQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPairs []types.BurnCoins)

GetBurnCoinsQueueTimeSlice gets a specific burn coins queue timeslice. A timeslice is a slice of BurnCoins corresponding to the BurnCoins that needs to be burned at a certain time.

func (*Keeper) GetInsuranceFundBalance

func (k *Keeper) GetInsuranceFundBalance(ctx sdk.Context) (sdk.Coins, error)

GetInsuranceFundBalance returns the amount of coins in the insurance fund.

func (*Keeper) GetParams

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

func (*Keeper) GetUnbondedCoinsFromQueue

func (k *Keeper) GetUnbondedCoinsFromQueue(ctx sdk.Context, endTime time.Time) []types.BurnCoins

GetUnbondedCoinsFromQueue returns a concatenated list of all the timeslices inclusively previous to endTime.

func (*Keeper) GetUserInsuranceFund

func (k *Keeper) GetUserInsuranceFund(
	ctx sdk.Context,
	user sdk.AccAddress,
) (types.UserInsuranceFund, error)

GetUserInsuranceFund returns the user's insurance fund.

func (*Keeper) GetUserInsuranceFundBalance

func (k *Keeper) GetUserInsuranceFundBalance(
	ctx sdk.Context,
	user sdk.AccAddress,
) (sdk.Coins, error)

GetUserInsuranceFundBalance returns the amount of coins in the user's insurance fund.

func (*Keeper) InitGenesis

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

InitGenesis initializes the state from a GenesisState

func (*Keeper) InsertBurnCoinsToUnbondingQueue

func (k *Keeper) InsertBurnCoinsToUnbondingQueue(ctx sdk.Context, burnCoins types.BurnCoins)

InsertBurnCoinsToUnbondingQueue inserts an BurnCoin to the appropriate timeslice in the burn coins queue.

func (*Keeper) IsBurner

func (k *Keeper) IsBurner(ctx sdk.Context, user sdk.AccAddress) (bool, error)

IsBurner tells if a user have the permissions to burn tokens from a user's balance.

func (*Keeper) IsMinter

func (k *Keeper) IsMinter(ctx sdk.Context, user sdk.AccAddress) (bool, error)

IsMinter tells if a user have the permissions to mint tokens.

func (*Keeper) IterateBurnCoinsUnbondingQueue

func (k *Keeper) IterateBurnCoinsUnbondingQueue(ctx sdk.Context, endTime time.Time, iterF func(burnCoin types.BurnCoins) (bool, error)) error

IterateBurnCoinsUnbondingQueue iterates all the BurnCoins from time 0 until endTime.

func (*Keeper) Logger

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

Logger returns a module-specific logger.

func (*Keeper) MintVestedRepresentation

func (k *Keeper) MintVestedRepresentation(
	ctx sdk.Context,
	user sdk.AccAddress,
	amount sdk.Coins,
) (sdk.Coins, error)

MintVestedRepresentation mints the vested staked representation of the provided amount to the user.

func (*Keeper) SendRestrictionFn

func (k *Keeper) SendRestrictionFn(
	goCtx context.Context,
	from sdk.AccAddress,
	to sdk.AccAddress,
	amount sdk.Coins,
) (sdk.AccAddress, error)

SendRestrictionFn function that can be used in the x/bank module to block the transfer of the vested representation tokens.

func (*Keeper) SetBurnCoinsQueueTimeSlice

func (k *Keeper) SetBurnCoinsQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.BurnCoins)

SetBurnCoinsQueueTimeSlice sets a specific burn coins queue timeslice.

func (*Keeper) SetParams

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

func (*Keeper) WithdrawFromUserInsuranceFund

func (k *Keeper) WithdrawFromUserInsuranceFund(
	ctx sdk.Context,
	user sdk.AccAddress,
	amount sdk.Coins,
) error

WithdrawFromUserInsuranceFund withdraws coins from the user's insurance fund and sends them to the user.

type Querier

type Querier struct {
	*Keeper
}

func NewQuerier

func NewQuerier(keeper *Keeper) Querier

func (Querier) InsuranceFund

InsuranceFund implements types.QueryServer.

func (Querier) Params

Params implements types.QueryServer.

func (Querier) UserInsuranceFund

UserInsuranceFund implements types.QueryServer.

func (Querier) UserInsuranceFunds

UserInsuranceFunds implements types.QueryServer.

func (Querier) UserRestakableAssets

UserRestakableAssets implements types.QueryServer.

Jump to

Keyboard shortcuts

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