keeper

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 23 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,
	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 context.Context, user string, 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 context.Context, endTime time.Time) (storetypes.Iterator, error)

BurnCoinsUnbondingQueueIterator returns all the BurnCoins from time 0 until endTime.

func (*Keeper) BurnLockedRepresentation

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

BurnLockedRepresentation burns the locked 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 context.Context, user string, 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 context.Context, currTime time.Time) (burnCoins []types.BurnCoins, err error)

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 context.Context) []types.BurnCoins

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

func (*Keeper) GetAllUserActiveLockedRepresentations

func (k *Keeper) GetAllUserActiveLockedRepresentations(ctx context.Context, userAddress string) (sdk.DecCoins, error)

GetAllUserActiveLockedRepresentations gets all the locked representation tokens that are restaked or are currently unbonding for the provided user.

func (*Keeper) GetAllUserRestakedLockedRepresentations

func (k *Keeper) GetAllUserRestakedLockedRepresentations(ctx context.Context, userAddress string) (sdk.DecCoins, error)

GetAllUserRestakedLockedRepresentations returns all restaked coins that are locked representation tokens for the provided user.

func (*Keeper) GetAllUserUnbondingLockedRepresentations

func (k *Keeper) GetAllUserUnbondingLockedRepresentations(ctx context.Context, userAddress string) sdk.Coins

GetAllUserUnbondingLockedRepresentations returns all the locked representation tokens that are currently unbonding for the provided user.

func (*Keeper) GetAllUsersInsuranceFundsEntries

func (k *Keeper) GetAllUsersInsuranceFundsEntries(ctx sdk.Context) ([]types.UserInsuranceFundEntry, error)

func (*Keeper) GetBurnCoinsQueueTimeSlice

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

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 context.Context) (sdk.Coins, error)

GetInsuranceFundBalance returns the amount of coins in the insurance fund.

func (*Keeper) GetParams

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

func (*Keeper) GetUnbondedCoinsFromQueue

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

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

func (*Keeper) GetUserInsuranceFund

func (k *Keeper) GetUserInsuranceFund(ctx context.Context, user string) (types.UserInsuranceFund, error)

GetUserInsuranceFund returns the user's insurance fund.

func (*Keeper) GetUserInsuranceFundBalance

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

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

func (*Keeper) GetUserUsedInsuranceFund

func (k *Keeper) GetUserUsedInsuranceFund(ctx context.Context, userAddress string) (sdk.Coins, error)

GetUserUsedInsuranceFund returns the amount of coins that are used to cover the user's locked representation tokens that have been restaked.

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 context.Context, burnCoins types.BurnCoins) error

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

func (*Keeper) IsBurner

func (k *Keeper) IsBurner(ctx context.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 context.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 context.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) MintLockedRepresentation

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

MintLockedRepresentation mints the locked staked representation of the provided amount to the user.

func (*Keeper) OnRecvPacket

func (k *Keeper) OnRecvPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	data transfertypes.FungibleTokenPacketData,
	msgDepositInsurance types.MsgDepositInsurance,
) error

OnRecvPacket processes the packet received from the IBC handler

func (*Keeper) RestakeRestrictionFn

func (k *Keeper) RestakeRestrictionFn(ctx context.Context, restakerAddress string, amount sdk.Coins, _ restakingtypes.DelegationTarget) error

func (*Keeper) SendRestrictionFn

func (k *Keeper) SendRestrictionFn(ctx 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 locked representation tokens.

func (*Keeper) SetBurnCoinsQueueTimeSlice

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

SetBurnCoinsQueueTimeSlice sets a specific burn coins queue timeslice.

func (*Keeper) SetParams

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

func (*Keeper) WithdrawFromUserInsuranceFund

func (k *Keeper) WithdrawFromUserInsuranceFund(ctx context.Context, user string, 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