keeper

package
v1.2.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountsBalancesInvariants

func AccountsBalancesInvariants(k *Keeper) sdk.Invariant

AccountsBalancesInvariants checks that the pools, operators and services accounts have the correct balance based on the delegations that are stored in the store

func NewMsgServer

func NewMsgServer(keeper *Keeper) types.MsgServer

func OperatorDelegationToOperatorDelegationResponse

func OperatorDelegationToOperatorDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.Delegation) (types.DelegationResponse, error)

OperatorDelegationToOperatorDelegationResponse converts a OperatorDelegation to a OperatorDelegationResponse

func OperatorsDelegatorsSharesInvariant

func OperatorsDelegatorsSharesInvariant(k *Keeper) sdk.Invariant

OperatorsDelegatorsSharesInvariant checks that the sum of all delegators shares for each operator is equal to the total delegators shares stored in the operator object

func PoolDelegationToPoolDelegationResponse

func PoolDelegationToPoolDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.Delegation) (types.DelegationResponse, error)

PoolDelegationToPoolDelegationResponse converts a PoolDelegation to a PoolDelegationResponse

func PoolsDelegatorsSharesInvariant

func PoolsDelegatorsSharesInvariant(k *Keeper) sdk.Invariant

PoolsDelegatorsSharesInvariant checks that the sum of all delegators shares for each pool is equal to the total delegators shares stored in the pool object

func PositiveOperatorsDelegationsInvariant

func PositiveOperatorsDelegationsInvariant(k *Keeper) sdk.Invariant

PositiveOperatorsDelegationsInvariant checks that all stored operator delegations have > 0 shares.

func PositivePoolsDelegationsInvariant

func PositivePoolsDelegationsInvariant(k *Keeper) sdk.Invariant

PositivePoolsDelegationsInvariant checks that all stored pools delegations have > 0 shares

func PositiveServicesDelegationsInvariant

func PositiveServicesDelegationsInvariant(k *Keeper) sdk.Invariant

PositiveServicesDelegationsInvariant checks that all stored service delegations have > 0 shares.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper)

func ServiceDelegationToServiceDelegationResponse

func ServiceDelegationToServiceDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.Delegation) (types.DelegationResponse, error)

ServiceDelegationToServiceDelegationResponse converts a ServiceDelegation to a ServiceDelegationResponse

func ServicesDelegatorsSharesInvariant

func ServicesDelegatorsSharesInvariant(k *Keeper) sdk.Invariant

ServicesDelegatorsSharesInvariant checks that the sum of all delegators shares for each service is equal to the total delegators shares stored in the service object

Types

type Keeper

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

func NewKeeper

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

func (*Keeper) AddOperatorTokensAndShares

func (k *Keeper) AddOperatorTokensAndShares(
	ctx sdk.Context, operator operatorstypes.Operator, tokensToAdd sdk.Coins,
) (operatorOut operatorstypes.Operator, addedShares sdk.DecCoins, err error)

AddOperatorTokensAndShares adds the given amount of tokens to the operator and returns the added shares

func (*Keeper) AddPoolTokensAndShares

func (k *Keeper) AddPoolTokensAndShares(
	ctx sdk.Context, pool poolstypes.Pool, tokensToAdd sdk.Coin,
) (poolOut poolstypes.Pool, addedShares sdk.DecCoin, err error)

AddPoolTokensAndShares adds the given amount of tokens to the pool and returns the added shares

func (*Keeper) AddServiceTokensAndShares

func (k *Keeper) AddServiceTokensAndShares(
	ctx sdk.Context, service servicestypes.Service, tokensToAdd sdk.Coins,
) (serviceOut servicestypes.Service, addedShares sdk.DecCoins, err error)

AddServiceTokensAndShares adds the given amount of tokens to the service and returns the added shares

func (*Keeper) AfterOperatorDelegationModified

func (k *Keeper) AfterOperatorDelegationModified(ctx sdk.Context, operatorID uint32, delegator string) error

AfterOperatorDelegationModified implements types.RestakingHooks

func (*Keeper) AfterPoolDelegationModified

func (k *Keeper) AfterPoolDelegationModified(ctx sdk.Context, poolID uint32, delegator string) error

AfterPoolDelegationModified implements types.RestakingHooks

func (*Keeper) AfterServiceDelegationModified

func (k *Keeper) AfterServiceDelegationModified(ctx sdk.Context, serviceID uint32, delegator string) error

AfterServiceDelegationModified implements types.RestakingHooks

func (*Keeper) AfterUnbondingInitiated

func (k *Keeper) AfterUnbondingInitiated(ctx sdk.Context, unbondingDelegationID uint64) error

AfterUnbondingInitiated implements types.RestakingHooks

func (*Keeper) BeforeOperatorDelegationCreated

func (k *Keeper) BeforeOperatorDelegationCreated(ctx sdk.Context, operatorID uint32, delegator string) error

BeforeOperatorDelegationCreated implements types.RestakingHooks

func (*Keeper) BeforeOperatorDelegationRemoved

func (k *Keeper) BeforeOperatorDelegationRemoved(ctx sdk.Context, operatorID uint32, delegator string) error

BeforeOperatorDelegationRemoved implements types.RestakingHooks

func (*Keeper) BeforeOperatorDelegationSharesModified

func (k *Keeper) BeforeOperatorDelegationSharesModified(ctx sdk.Context, operatorID uint32, delegator string) error

BeforeOperatorDelegationSharesModified implements types.RestakingHooks

func (*Keeper) BeforePoolDelegationCreated

func (k *Keeper) BeforePoolDelegationCreated(ctx sdk.Context, poolID uint32, delegator string) error

BeforePoolDelegationCreated implements types.RestakingHooks

func (*Keeper) BeforePoolDelegationRemoved

func (k *Keeper) BeforePoolDelegationRemoved(ctx sdk.Context, poolID uint32, delegator string) error

BeforePoolDelegationRemoved implements types.RestakingHooks

func (*Keeper) BeforePoolDelegationSharesModified

func (k *Keeper) BeforePoolDelegationSharesModified(ctx sdk.Context, poolID uint32, delegator string) error

BeforePoolDelegationSharesModified implements types.RestakingHooks

func (*Keeper) BeforeServiceDelegationCreated

func (k *Keeper) BeforeServiceDelegationCreated(ctx sdk.Context, serviceID uint32, delegator string) error

BeforeServiceDelegationCreated implements types.RestakingHooks

func (*Keeper) BeforeServiceDelegationRemoved

func (k *Keeper) BeforeServiceDelegationRemoved(ctx sdk.Context, serviceID uint32, delegator string) error

BeforeServiceDelegationRemoved implements types.RestakingHooks

func (*Keeper) BeforeServiceDelegationSharesModified

func (k *Keeper) BeforeServiceDelegationSharesModified(ctx sdk.Context, serviceID uint32, delegator string) error

BeforeServiceDelegationSharesModified implements types.RestakingHooks

func (*Keeper) CompleteMatureUnbondingDelegations

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

CompleteMatureUnbondingDelegations runs the endblocker logic for delegations

func (*Keeper) CompleteUnbonding

func (k *Keeper) CompleteUnbonding(ctx sdk.Context, data types.DTData) (sdk.Coins, error)

CompleteUnbonding completes the unbonding of all mature entries in the retrieved unbonding delegation object and returns the total unbonding balance or an error upon failure.

func (*Keeper) DelegateToOperator

func (k *Keeper) DelegateToOperator(ctx sdk.Context, operatorID uint32, amount sdk.Coins, delegator string) (sdk.DecCoins, error)

DelegateToOperator sends the given amount to the operator account and saves the delegation for the given user

func (*Keeper) DelegateToPool

func (k *Keeper) DelegateToPool(ctx sdk.Context, amount sdk.Coin, delegator string) (sdk.DecCoins, error)

DelegateToPool sends the given amount to the pool account and saves the delegation for the given user

func (*Keeper) DelegateToService

func (k *Keeper) DelegateToService(ctx sdk.Context, serviceID uint32, amount sdk.Coins, delegator string) (sdk.DecCoins, error)

DelegateToService sends the given amount to the service account and saves the delegation for the given user

func (*Keeper) DeleteUnbondingIndex

func (k *Keeper) DeleteUnbondingIndex(ctx sdk.Context, id uint64)

DeleteUnbondingIndex removes a mapping from UnbondingId to unbonding operation

func (*Keeper) DequeueAllMatureUBDQueue

func (k *Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []types.DTData)

DequeueAllMatureUBDQueue 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

ExportGenesis returns a new GenesisState instance containing the information currently present inside the store

func (*Keeper) GetAllDelegations

func (k *Keeper) GetAllDelegations(ctx sdk.Context) []types.Delegation

GetAllDelegations returns all the delegations

func (*Keeper) GetAllOperatorDelegations

func (k *Keeper) GetAllOperatorDelegations(ctx sdk.Context) []types.Delegation

GetAllOperatorDelegations returns all the operator delegations

func (*Keeper) GetAllOperatorUnbondingDelegations

func (k *Keeper) GetAllOperatorUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation

GetAllOperatorUnbondingDelegations returns all the operator unbonding delegations

func (*Keeper) GetAllOperatorsParams

func (k *Keeper) GetAllOperatorsParams(ctx sdk.Context) []types.OperatorParamsRecord

GetAllOperatorsParams returns all the operators params

func (*Keeper) GetAllPoolDelegations

func (k *Keeper) GetAllPoolDelegations(ctx sdk.Context) []types.Delegation

GetAllPoolDelegations returns all the pool delegations

func (*Keeper) GetAllPoolUnbondingDelegations

func (k *Keeper) GetAllPoolUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation

GetAllPoolUnbondingDelegations returns all the pool unbonding delegations

func (*Keeper) GetAllServiceDelegations

func (k *Keeper) GetAllServiceDelegations(ctx sdk.Context) []types.Delegation

GetAllServiceDelegations returns all the service delegations

func (*Keeper) GetAllServiceUnbondingDelegations

func (k *Keeper) GetAllServiceUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation

GetAllServiceUnbondingDelegations returns all the service unbonding delegations

func (*Keeper) GetAllServicesParams

func (k *Keeper) GetAllServicesParams(ctx sdk.Context) []types.ServiceParamsRecord

GetAllServicesParams returns all the services params

func (*Keeper) GetAllUnbondingDelegations

func (k *Keeper) GetAllUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation

GetAllUnbondingDelegations returns all the unbonding delegations

func (*Keeper) GetAllUserOperatorUnbondingDelegations

func (k *Keeper) GetAllUserOperatorUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation

GetAllUserOperatorUnbondingDelegations returns all the user's unbonding delegations from a operator

func (*Keeper) GetAllUserPoolUnbondingDelegations

func (k *Keeper) GetAllUserPoolUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation

GetAllUserPoolUnbondingDelegations returns all the user's unbonding delegations from a pool

func (*Keeper) GetAllUserRestakedCoins

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

GetAllUserRestakedCoins returns all the user's restaked coins

func (*Keeper) GetAllUserServiceUnbondingDelegations

func (k *Keeper) GetAllUserServiceUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation

GetAllUserServiceUnbondingDelegations returns all the user's unbonding delegations from a service

func (*Keeper) GetAllUserUnbondingDelegations

func (k *Keeper) GetAllUserUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation

GetAllUserUnbondingDelegations returns all the user's unbonding delegations

func (*Keeper) GetDelegationForTarget

func (k *Keeper) GetDelegationForTarget(
	ctx sdk.Context, target types.DelegationTarget, delegator string,
) (types.Delegation, bool)

GetDelegationForTarget returns the delegation for the given delegator and target.

func (*Keeper) GetDelegationTargetFromDelegation

func (k *Keeper) GetDelegationTargetFromDelegation(
	ctx sdk.Context, delegation types.Delegation,
) (types.DelegationTarget, bool)

GetDelegationTargetFromDelegation returns the target of the given delegation.

func (*Keeper) GetOperatorDelegation

func (k *Keeper) GetOperatorDelegation(ctx sdk.Context, operatorID uint32, userAddress string) (types.Delegation, bool)

GetOperatorDelegation retrieves the delegation for the given user and operator If the delegation does not exist, false is returned instead

func (*Keeper) GetOperatorParams

func (k *Keeper) GetOperatorParams(ctx sdk.Context, operatorID uint32) (params types.OperatorParams)

GetOperatorParams returns the params for the given operator, if any. If not params are found, false is returned instead.

func (*Keeper) GetOperatorUnbondingDelegation

func (k *Keeper) GetOperatorUnbondingDelegation(ctx sdk.Context, operatorID uint32, delegatorAddress string) (types.UnbondingDelegation, bool)

GetOperatorUnbondingDelegation returns the unbonding delegation for the given delegator address and operator id. If no unbonding delegation is found, false is returned instead.

func (*Keeper) GetParams

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

GetParams returns the module parameters

func (*Keeper) GetPoolDelegation

func (k *Keeper) GetPoolDelegation(ctx sdk.Context, poolID uint32, userAddress string) (types.Delegation, bool)

GetPoolDelegation retrieves the delegation for the given user and pool If the delegation does not exist, false is returned instead

func (*Keeper) GetPoolUnbondingDelegation

func (k *Keeper) GetPoolUnbondingDelegation(ctx sdk.Context, poolID uint32, delegator string) (types.UnbondingDelegation, bool)

GetPoolUnbondingDelegation returns the unbonding delegation for the given delegator address and pool id. If no unbonding delegation is found, false is returned instead.

func (*Keeper) GetServiceDelegation

func (k *Keeper) GetServiceDelegation(ctx sdk.Context, serviceID uint32, userAddress string) (types.Delegation, bool)

GetServiceDelegation retrieves the delegation for the given user and service If the delegation does not exist, false is returned instead

func (*Keeper) GetServiceParams

func (k *Keeper) GetServiceParams(ctx sdk.Context, operatorID uint32) (params types.ServiceParams)

GetServiceParams returns the params for the given service, if any. If not params are found, false is returned instead.

func (*Keeper) GetServiceUnbondingDelegation

func (k *Keeper) GetServiceUnbondingDelegation(ctx sdk.Context, serviceID uint32, delegator string) (types.UnbondingDelegation, bool)

GetServiceUnbondingDelegation returns the unbonding delegation for the given delegator address and service id. If no unbonding delegation is found, false is returned instead.

func (*Keeper) GetUBDQueueTimeSlice

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

GetUBDQueueTimeSlice gets a specific unbonding queue timeslice. A timeslice is a slice of DVPairs corresponding to unbonding delegations that expire at a certain time.

func (*Keeper) GetUnbondingDelegation

func (k *Keeper) GetUnbondingDelegation(
	ctx sdk.Context, delegatorAddress string, ubdType types.DelegationType, targetID uint32,
) (types.UnbondingDelegation, bool)

GetUnbondingDelegation returns the unbonding delegation for the given delegator and target.

func (*Keeper) IncrementUnbondingID

func (k *Keeper) IncrementUnbondingID(ctx sdk.Context) (unbondingID uint64)

IncrementUnbondingID increments and returns a unique ID for an unbonding operation

func (*Keeper) InitGenesis

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

InitGenesis initializes the genesis store using the provided data

func (*Keeper) InsertUBDQueue

func (k *Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.UnbondingDelegation, completionTime time.Time)

InsertUBDQueue inserts an unbonding delegation to the appropriate timeslice in the unbonding queue.

func (*Keeper) IterateAllOperatorDelegations

func (k *Keeper) IterateAllOperatorDelegations(ctx sdk.Context, cb func(del types.Delegation) (stop bool))

IterateAllOperatorDelegations iterates all the operator delegations and performs the given callback function

func (*Keeper) IterateAllPoolDelegations

func (k *Keeper) IterateAllPoolDelegations(ctx sdk.Context, cb func(del types.Delegation) (stop bool))

IterateAllPoolDelegations iterates all the pool delegations and performs the given callback function

func (*Keeper) IterateAllServiceDelegations

func (k *Keeper) IterateAllServiceDelegations(ctx sdk.Context, cb func(del types.Delegation) (stop bool))

IterateAllServiceDelegations iterates all the service delegations and performs the given callback function

func (*Keeper) IterateUserDelegations

func (k *Keeper) IterateUserDelegations(
	ctx sdk.Context, userAddress string, cb func(del types.Delegation) (stop bool, err error),
) error

IterateUserDelegations iterates over the user's delegations. The delegations will be iterated in the following order: 1. Pool delegations 2. Service delegations 3. Operator delegations

func (*Keeper) IterateUserOperatorDelegations

func (k *Keeper) IterateUserOperatorDelegations(ctx sdk.Context, userAddress string, cb func(del types.Delegation) (stop bool, err error)) error

IterateUserOperatorDelegations iterates all the operator delegations of a user and performs the given callback function

func (*Keeper) IterateUserPoolDelegations

func (k *Keeper) IterateUserPoolDelegations(ctx sdk.Context, userAddress string, cb func(del types.Delegation) (stop bool, err error)) error

IterateUserPoolDelegations iterates all the pool delegations of a user and performs the given callback function

func (*Keeper) IterateUserServiceDelegations

func (k *Keeper) IterateUserServiceDelegations(ctx sdk.Context, userAddress string, cb func(del types.Delegation) (stop bool, err error)) error

IterateUserServiceDelegations iterates all the service delegations of a user and performs the given callback function

func (*Keeper) Logger

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

Logger returns a module-specific logger.

func (*Keeper) PerformDelegation

func (k *Keeper) PerformDelegation(ctx sdk.Context, data types.DelegationData) (sdk.DecCoins, error)

PerformDelegation performs a delegation of the given amount from the delegator to the receiver. It sends the coins to the receiver address and updates the delegation object and returns the new shares of the delegation. NOTE: This is done so that if we implement other delegation types in the future we can have a single function that performs common operations for all of them.

func (*Keeper) PerformUndelegation

func (k *Keeper) PerformUndelegation(ctx sdk.Context, data types.UndelegationData) (time.Time, error)

PerformUndelegation unbonds an amount of delegator shares from a given validator. It will verify that the unbonding entries between the delegator and validator are not exceeded and unbond the staked tokens (based on shares) by creating an unbonding object and inserting it into the unbonding queue which will be processed during the staking EndBlocker.

func (*Keeper) RemoveDelegation

func (k *Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation)

RemoveDelegation removes the given delegation from the store

func (*Keeper) RemoveOperatorDelegation

func (k *Keeper) RemoveOperatorDelegation(ctx sdk.Context, delegation types.Delegation)

RemoveOperatorDelegation removes the given operator delegation from the store

func (*Keeper) RemovePoolDelegation

func (k *Keeper) RemovePoolDelegation(ctx sdk.Context, delegation types.Delegation)

RemovePoolDelegation removes the given pool delegation from the store

func (*Keeper) RemoveServiceDelegation

func (k *Keeper) RemoveServiceDelegation(ctx sdk.Context, delegation types.Delegation)

RemoveServiceDelegation removes the given service delegation from the store

func (*Keeper) RemoveTargetTokensAndShares

func (k *Keeper) RemoveTargetTokensAndShares(ctx sdk.Context, data types.UndelegationData) (sdk.Coins, error)

RemoveTargetTokensAndShares removes the given amount of tokens and shares from the target.

func (*Keeper) RemoveUnbondingDelegation

func (k *Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation) error

RemoveUnbondingDelegation removes the unbonding delegation object and associated index.

func (*Keeper) SaveOperatorParams

func (k *Keeper) SaveOperatorParams(ctx sdk.Context, operatorID uint32, params types.OperatorParams)

SaveOperatorParams stored the given params for the given operator

func (*Keeper) SaveServiceParams

func (k *Keeper) SaveServiceParams(ctx sdk.Context, serviceID uint32, params types.ServiceParams)

SaveServiceParams stored the given params for the given service

func (*Keeper) SetDelegation

func (k *Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation) error

SetDelegation stores the given delegation in the store

func (*Keeper) SetHooks

func (k *Keeper) SetHooks(rs types.RestakingHooks) *Keeper

SetHooks allows to set the reactions hooks

func (*Keeper) SetParams

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

SetParams sets module parameters

func (*Keeper) SetUBDQueueTimeSlice

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

SetUBDQueueTimeSlice sets a specific unbonding queue timeslice.

func (*Keeper) SetUnbondingDelegation

func (k *Keeper) SetUnbondingDelegation(ctx sdk.Context, ud types.UnbondingDelegation) ([]byte, error)

SetUnbondingDelegation stores the given unbonding delegation in the store

func (*Keeper) SetUnbondingDelegationByUnbondingID

func (k *Keeper) SetUnbondingDelegationByUnbondingID(ctx sdk.Context, ubd types.UnbondingDelegation, ubdKey []byte, id uint64)

SetUnbondingDelegationByUnbondingID sets an index to look up an UnbondingDelegation by the unbondingID of an UnbondingDelegationEntry that it contains Note, it does not set the unbonding delegation itself, use SetUnbondingDelegation(ctx, ubd) for that

func (*Keeper) SetUnbondingDelegationEntry

func (k *Keeper) SetUnbondingDelegationEntry(
	ctx sdk.Context, data types.UndelegationData, creationHeight int64, minTime time.Time, balance sdk.Coins,
) (types.UnbondingDelegation, error)

SetUnbondingDelegationEntry adds an entry to the unbonding delegation at the given addresses. It creates the unbonding delegation if it does not exist.

func (*Keeper) UBDQueueIterator

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

UBDQueueIterator returns all the unbonding queue timeslices from time 0 until endTime.

func (*Keeper) Unbond

func (k *Keeper) Unbond(ctx sdk.Context, data types.UndelegationData) (amount sdk.Coins, err error)

Unbond unbonds a particular delegation and perform associated store operations.

func (*Keeper) UnbondRestakedAssets

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

UnbondRestakedAssets unbonds the provided amount from the user's delegations. The algorithm will go over the user's delegation in the following order: pools, services and operators until the token undelegated matches the provided amount.

func (*Keeper) UnbondingTime

func (k *Keeper) UnbondingTime(ctx sdk.Context) time.Duration

UnbondingTime returns the unbonding time

func (*Keeper) UndelegateFromOperator

func (k *Keeper) UndelegateFromOperator(ctx sdk.Context, operatorID uint32, amount sdk.Coins, delegator string) (time.Time, error)

UndelegateFromOperator removes the given amount from the operator account and saves the unbonding delegation for the given user

func (*Keeper) UndelegateFromPool

func (k *Keeper) UndelegateFromPool(ctx sdk.Context, amount sdk.Coin, delegator string) (time.Time, error)

UndelegateFromPool removes the given amount from the pool account and saves the unbonding delegation for the given user

func (*Keeper) UndelegateFromService

func (k *Keeper) UndelegateFromService(ctx sdk.Context, serviceID uint32, amount sdk.Coins, delegator string) (time.Time, error)

UndelegateFromService removes the given amount from the service account and saves the unbonding delegation for the given user

func (*Keeper) ValidateUnbondAmount

func (k *Keeper) ValidateUnbondAmount(
	ctx sdk.Context, delAddr string, target types.DelegationTarget, amt sdk.Coins,
) (shares sdk.DecCoins, err error)

ValidateUnbondAmount validates that a given unbond or redelegation amount is valid based on upon the converted shares. If the amount is valid, the total amount of respective shares is returned, otherwise an error is returned.

type Querier

type Querier struct {
	*Keeper
}

func NewQuerier

func NewQuerier(keeper *Keeper) Querier

func (Querier) DelegatorOperator

DelegatorOperator queries the operator for the given delegator address and operator id

func (Querier) DelegatorOperatorDelegations

DelegatorOperatorDelegations queries the operator delegations for the given delegator address

func (Querier) DelegatorOperatorUnbondingDelegations

DelegatorOperatorUnbondingDelegations queries the operator unbonding delegations for the given delegator address

func (Querier) DelegatorOperators

DelegatorOperators queries the operators for the given delegator address

func (Querier) DelegatorPool

DelegatorPool queries the pool for the given delegator address and pool id

func (Querier) DelegatorPoolDelegations

DelegatorPoolDelegations queries the pool delegations for the given delegator address

func (Querier) DelegatorPoolUnbondingDelegations

DelegatorPoolUnbondingDelegations queries the pool unbonding delegations for the given delegator address

func (Querier) DelegatorPools

DelegatorPools queries the pools for the given delegator address

func (Querier) DelegatorService

DelegatorService queries the service for the given delegator address and service id

func (Querier) DelegatorServiceDelegations

DelegatorServiceDelegations queries the service delegations for the given delegator address

func (Querier) DelegatorServiceUnbondingDelegations

DelegatorServiceUnbondingDelegations queries the service unbonding delegations for the given delegator address

func (Querier) DelegatorServices

DelegatorServices queries the services for the given delegator address

func (Querier) OperatorDelegation

OperatorDelegation queries the operator delegation for the given operator id and user address

func (Querier) OperatorDelegations

OperatorDelegations queries the operator delegations for the given operator id

func (Querier) OperatorParams

OperatorParams queries the operator params for the given operator id

func (Querier) OperatorUnbondingDelegation

OperatorUnbondingDelegation queries the operator unbonding delegation for the given operator id and user address

func (Querier) OperatorUnbondingDelegations

OperatorUnbondingDelegations queries the operator unbonding delegations for the given operator id

func (Querier) Params

Params queries the restaking module parameters

func (Querier) PoolDelegation

PoolDelegation queries the pool delegation for the given pool id and user address

func (Querier) PoolDelegations

PoolDelegations queries the pool delegations for the given pool id

func (Querier) PoolUnbondingDelegation

PoolUnbondingDelegation queries the pool unbonding delegation for the given pool id and user address

func (Querier) PoolUnbondingDelegations

PoolUnbondingDelegations queries the pool unbonding delegations for the given pool id

func (Querier) ServiceDelegation

ServiceDelegation queries the service delegation for the given service id and user address

func (Querier) ServiceDelegations

ServiceDelegations queries the service delegations for the given service id

func (Querier) ServiceParams

ServiceParams queries the service params for the given service id

func (Querier) ServiceUnbondingDelegation

ServiceUnbondingDelegation queries the service unbonding delegation for the given service id and user address

func (Querier) ServiceUnbondingDelegations

ServiceUnbondingDelegations queries the service unbonding delegations for the given service id

Jump to

Keyboard shortcuts

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