Documentation ¶
Index ¶
- func AccountsBalancesInvariants(k *Keeper) sdk.Invariant
- func NewMsgServer(keeper *Keeper) types.MsgServer
- func OperatorDelegationToOperatorDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.Delegation) (types.DelegationResponse, error)
- func OperatorsDelegatorsSharesInvariant(k *Keeper) sdk.Invariant
- func PoolDelegationToPoolDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.Delegation) (types.DelegationResponse, error)
- func PoolsDelegatorsSharesInvariant(k *Keeper) sdk.Invariant
- func PositiveOperatorsDelegationsInvariant(k *Keeper) sdk.Invariant
- func PositivePoolsDelegationsInvariant(k *Keeper) sdk.Invariant
- func PositiveServicesDelegationsInvariant(k *Keeper) sdk.Invariant
- func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper)
- func ServiceDelegationToServiceDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.Delegation) (types.DelegationResponse, error)
- func ServicesDelegatorsSharesInvariant(k *Keeper) sdk.Invariant
- type Keeper
- func (k *Keeper) AddOperatorTokensAndShares(ctx sdk.Context, operator operatorstypes.Operator, tokensToAdd sdk.Coins) (operatorOut operatorstypes.Operator, addedShares sdk.DecCoins, err error)
- func (k *Keeper) AddPoolTokensAndShares(ctx sdk.Context, pool poolstypes.Pool, tokensToAdd sdk.Coin) (poolOut poolstypes.Pool, addedShares sdk.DecCoin, err error)
- func (k *Keeper) AddServiceTokensAndShares(ctx sdk.Context, service servicestypes.Service, tokensToAdd sdk.Coins) (serviceOut servicestypes.Service, addedShares sdk.DecCoins, err error)
- func (k *Keeper) AfterOperatorDelegationModified(ctx sdk.Context, operatorID uint32, delegator string) error
- func (k *Keeper) AfterPoolDelegationModified(ctx sdk.Context, poolID uint32, delegator string) error
- func (k *Keeper) AfterServiceDelegationModified(ctx sdk.Context, serviceID uint32, delegator string) error
- func (k *Keeper) AfterUnbondingInitiated(ctx sdk.Context, unbondingDelegationID uint64) error
- func (k *Keeper) BeforeOperatorDelegationCreated(ctx sdk.Context, operatorID uint32, delegator string) error
- func (k *Keeper) BeforeOperatorDelegationRemoved(ctx sdk.Context, operatorID uint32, delegator string) error
- func (k *Keeper) BeforeOperatorDelegationSharesModified(ctx sdk.Context, operatorID uint32, delegator string) error
- func (k *Keeper) BeforePoolDelegationCreated(ctx sdk.Context, poolID uint32, delegator string) error
- func (k *Keeper) BeforePoolDelegationRemoved(ctx sdk.Context, poolID uint32, delegator string) error
- func (k *Keeper) BeforePoolDelegationSharesModified(ctx sdk.Context, poolID uint32, delegator string) error
- func (k *Keeper) BeforeServiceDelegationCreated(ctx sdk.Context, serviceID uint32, delegator string) error
- func (k *Keeper) BeforeServiceDelegationRemoved(ctx sdk.Context, serviceID uint32, delegator string) error
- func (k *Keeper) BeforeServiceDelegationSharesModified(ctx sdk.Context, serviceID uint32, delegator string) error
- func (k *Keeper) CompleteMatureUnbondingDelegations(ctx sdk.Context) error
- func (k *Keeper) CompleteUnbonding(ctx sdk.Context, data types.DTData) (sdk.Coins, error)
- func (k *Keeper) DelegateToOperator(ctx sdk.Context, operatorID uint32, amount sdk.Coins, delegator string) (sdk.DecCoins, error)
- func (k *Keeper) DelegateToPool(ctx sdk.Context, amount sdk.Coin, delegator string) (sdk.DecCoins, error)
- func (k *Keeper) DelegateToService(ctx sdk.Context, serviceID uint32, amount sdk.Coins, delegator string) (sdk.DecCoins, error)
- func (k *Keeper) DeleteUnbondingIndex(ctx sdk.Context, id uint64)
- func (k *Keeper) DequeueAllMatureUBDQueue(ctx sdk.Context, currTime time.Time) (matureUnbonds []types.DTData)
- func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k *Keeper) GetAllDelegations(ctx sdk.Context) []types.Delegation
- func (k *Keeper) GetAllOperatorDelegations(ctx sdk.Context) []types.Delegation
- func (k *Keeper) GetAllOperatorUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation
- func (k *Keeper) GetAllOperatorsParams(ctx sdk.Context) []types.OperatorParamsRecord
- func (k *Keeper) GetAllPoolDelegations(ctx sdk.Context) []types.Delegation
- func (k *Keeper) GetAllPoolUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation
- func (k *Keeper) GetAllServiceDelegations(ctx sdk.Context) []types.Delegation
- func (k *Keeper) GetAllServiceUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation
- func (k *Keeper) GetAllServicesParams(ctx sdk.Context) []types.ServiceParamsRecord
- func (k *Keeper) GetAllUnbondingDelegations(ctx sdk.Context) []types.UnbondingDelegation
- func (k *Keeper) GetAllUserOperatorUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation
- func (k *Keeper) GetAllUserPoolUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation
- func (k *Keeper) GetAllUserRestakedCoins(ctx sdk.Context, userAddress string) (sdk.DecCoins, error)
- func (k *Keeper) GetAllUserServiceUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation
- func (k *Keeper) GetAllUserUnbondingDelegations(ctx sdk.Context, userAddress string) []types.UnbondingDelegation
- func (k *Keeper) GetDelegationForTarget(ctx sdk.Context, target types.DelegationTarget, delegator string) (types.Delegation, bool)
- func (k *Keeper) GetDelegationTargetFromDelegation(ctx sdk.Context, delegation types.Delegation) (types.DelegationTarget, bool)
- func (k *Keeper) GetOperatorDelegation(ctx sdk.Context, operatorID uint32, userAddress string) (types.Delegation, bool)
- func (k *Keeper) GetOperatorParams(ctx sdk.Context, operatorID uint32) (params types.OperatorParams)
- func (k *Keeper) GetOperatorUnbondingDelegation(ctx sdk.Context, operatorID uint32, delegatorAddress string) (types.UnbondingDelegation, bool)
- func (k *Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k *Keeper) GetPoolDelegation(ctx sdk.Context, poolID uint32, userAddress string) (types.Delegation, bool)
- func (k *Keeper) GetPoolUnbondingDelegation(ctx sdk.Context, poolID uint32, delegator string) (types.UnbondingDelegation, bool)
- func (k *Keeper) GetServiceDelegation(ctx sdk.Context, serviceID uint32, userAddress string) (types.Delegation, bool)
- func (k *Keeper) GetServiceParams(ctx sdk.Context, operatorID uint32) (params types.ServiceParams)
- func (k *Keeper) GetServiceUnbondingDelegation(ctx sdk.Context, serviceID uint32, delegator string) (types.UnbondingDelegation, bool)
- func (k *Keeper) GetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time) (dvPairs []types.DTData)
- func (k *Keeper) GetUnbondingDelegation(ctx sdk.Context, delegatorAddress string, ubdType types.DelegationType, ...) (types.UnbondingDelegation, bool)
- func (k *Keeper) IncrementUnbondingID(ctx sdk.Context) (unbondingID uint64)
- func (k *Keeper) InitGenesis(ctx sdk.Context, data *types.GenesisState)
- func (k *Keeper) InsertUBDQueue(ctx sdk.Context, ubd types.UnbondingDelegation, completionTime time.Time)
- func (k *Keeper) IterateAllOperatorDelegations(ctx sdk.Context, cb func(del types.Delegation) (stop bool))
- func (k *Keeper) IterateAllPoolDelegations(ctx sdk.Context, cb func(del types.Delegation) (stop bool))
- func (k *Keeper) IterateAllServiceDelegations(ctx sdk.Context, cb func(del types.Delegation) (stop bool))
- func (k *Keeper) IterateUserDelegations(ctx sdk.Context, userAddress string, ...) error
- func (k *Keeper) IterateUserOperatorDelegations(ctx sdk.Context, userAddress string, ...) error
- func (k *Keeper) IterateUserPoolDelegations(ctx sdk.Context, userAddress string, ...) error
- func (k *Keeper) IterateUserServiceDelegations(ctx sdk.Context, userAddress string, ...) error
- func (k *Keeper) Logger(ctx sdk.Context) log.Logger
- func (k *Keeper) PerformDelegation(ctx sdk.Context, data types.DelegationData) (sdk.DecCoins, error)
- func (k *Keeper) PerformUndelegation(ctx sdk.Context, data types.UndelegationData) (time.Time, error)
- func (k *Keeper) RemoveDelegation(ctx sdk.Context, delegation types.Delegation)
- func (k *Keeper) RemoveOperatorDelegation(ctx sdk.Context, delegation types.Delegation)
- func (k *Keeper) RemovePoolDelegation(ctx sdk.Context, delegation types.Delegation)
- func (k *Keeper) RemoveServiceDelegation(ctx sdk.Context, delegation types.Delegation)
- func (k *Keeper) RemoveTargetTokensAndShares(ctx sdk.Context, data types.UndelegationData) (sdk.Coins, error)
- func (k *Keeper) RemoveUnbondingDelegation(ctx sdk.Context, ubd types.UnbondingDelegation) error
- func (k *Keeper) SaveOperatorParams(ctx sdk.Context, operatorID uint32, params types.OperatorParams)
- func (k *Keeper) SaveServiceParams(ctx sdk.Context, serviceID uint32, params types.ServiceParams)
- func (k *Keeper) SetDelegation(ctx sdk.Context, delegation types.Delegation) error
- func (k *Keeper) SetHooks(rs types.RestakingHooks) *Keeper
- func (k *Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *Keeper) SetUBDQueueTimeSlice(ctx sdk.Context, timestamp time.Time, keys []types.DTData)
- func (k *Keeper) SetUnbondingDelegation(ctx sdk.Context, ud types.UnbondingDelegation) ([]byte, error)
- func (k *Keeper) SetUnbondingDelegationByUnbondingID(ctx sdk.Context, ubd types.UnbondingDelegation, ubdKey []byte, id uint64)
- func (k *Keeper) SetUnbondingDelegationEntry(ctx sdk.Context, data types.UndelegationData, creationHeight int64, ...) (types.UnbondingDelegation, error)
- func (k *Keeper) UBDQueueIterator(ctx sdk.Context, endTime time.Time) storetypes.Iterator
- func (k *Keeper) Unbond(ctx sdk.Context, data types.UndelegationData) (amount sdk.Coins, err error)
- func (k *Keeper) UnbondRestakedAssets(ctx sdk.Context, user sdk.AccAddress, amount sdk.Coins) (time.Time, error)
- func (k *Keeper) UnbondingTime(ctx sdk.Context) time.Duration
- func (k *Keeper) UndelegateFromOperator(ctx sdk.Context, operatorID uint32, amount sdk.Coins, delegator string) (time.Time, error)
- func (k *Keeper) UndelegateFromPool(ctx sdk.Context, amount sdk.Coin, delegator string) (time.Time, error)
- func (k *Keeper) UndelegateFromService(ctx sdk.Context, serviceID uint32, amount sdk.Coins, delegator string) (time.Time, error)
- func (k *Keeper) ValidateUnbondAmount(ctx sdk.Context, delAddr string, target types.DelegationTarget, amt sdk.Coins) (shares sdk.DecCoins, err error)
- type Querier
- func (k Querier) DelegatorOperator(goCtx context.Context, req *types.QueryDelegatorOperatorRequest) (*types.QueryDelegatorOperatorResponse, error)
- func (k Querier) DelegatorOperatorDelegations(goCtx context.Context, req *types.QueryDelegatorOperatorDelegationsRequest) (*types.QueryDelegatorOperatorDelegationsResponse, error)
- func (k Querier) DelegatorOperatorUnbondingDelegations(goCtx context.Context, ...) (*types.QueryDelegatorOperatorUnbondingDelegationsResponse, error)
- func (k Querier) DelegatorOperators(goCtx context.Context, req *types.QueryDelegatorOperatorsRequest) (*types.QueryDelegatorOperatorsResponse, error)
- func (k Querier) DelegatorPool(goCtx context.Context, req *types.QueryDelegatorPoolRequest) (*types.QueryDelegatorPoolResponse, error)
- func (k Querier) DelegatorPoolDelegations(goCtx context.Context, req *types.QueryDelegatorPoolDelegationsRequest) (*types.QueryDelegatorPoolDelegationsResponse, error)
- func (k Querier) DelegatorPoolUnbondingDelegations(goCtx context.Context, ...) (*types.QueryDelegatorPoolUnbondingDelegationsResponse, error)
- func (k Querier) DelegatorPools(goCtx context.Context, req *types.QueryDelegatorPoolsRequest) (*types.QueryDelegatorPoolsResponse, error)
- func (k Querier) DelegatorService(goCtx context.Context, req *types.QueryDelegatorServiceRequest) (*types.QueryDelegatorServiceResponse, error)
- func (k Querier) DelegatorServiceDelegations(goCtx context.Context, req *types.QueryDelegatorServiceDelegationsRequest) (*types.QueryDelegatorServiceDelegationsResponse, error)
- func (k Querier) DelegatorServiceUnbondingDelegations(goCtx context.Context, ...) (*types.QueryDelegatorServiceUnbondingDelegationsResponse, error)
- func (k Querier) DelegatorServices(goCtx context.Context, req *types.QueryDelegatorServicesRequest) (*types.QueryDelegatorServicesResponse, error)
- func (k Querier) OperatorDelegation(goCtx context.Context, req *types.QueryOperatorDelegationRequest) (*types.QueryOperatorDelegationResponse, error)
- func (k Querier) OperatorDelegations(goCtx context.Context, req *types.QueryOperatorDelegationsRequest) (*types.QueryOperatorDelegationsResponse, error)
- func (k Querier) OperatorParams(goCtx context.Context, req *types.QueryOperatorParamsRequest) (*types.QueryOperatorParamsResponse, error)
- func (k Querier) OperatorUnbondingDelegation(goCtx context.Context, req *types.QueryOperatorUnbondingDelegationRequest) (*types.QueryOperatorUnbondingDelegationResponse, error)
- func (k Querier) OperatorUnbondingDelegations(goCtx context.Context, req *types.QueryOperatorUnbondingDelegationsRequest) (*types.QueryOperatorUnbondingDelegationsResponse, error)
- func (k Querier) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Querier) PoolDelegation(goCtx context.Context, req *types.QueryPoolDelegationRequest) (*types.QueryPoolDelegationResponse, error)
- func (k Querier) PoolDelegations(goCtx context.Context, req *types.QueryPoolDelegationsRequest) (*types.QueryPoolDelegationsResponse, error)
- func (k Querier) PoolUnbondingDelegation(goCtx context.Context, req *types.QueryPoolUnbondingDelegationRequest) (*types.QueryPoolUnbondingDelegationResponse, error)
- func (k Querier) PoolUnbondingDelegations(goCtx context.Context, req *types.QueryPoolUnbondingDelegationsRequest) (*types.QueryPoolUnbondingDelegationsResponse, error)
- func (k Querier) ServiceDelegation(goCtx context.Context, req *types.QueryServiceDelegationRequest) (*types.QueryServiceDelegationResponse, error)
- func (k Querier) ServiceDelegations(goCtx context.Context, req *types.QueryServiceDelegationsRequest) (*types.QueryServiceDelegationsResponse, error)
- func (k Querier) ServiceParams(goCtx context.Context, req *types.QueryServiceParamsRequest) (*types.QueryServiceParamsResponse, error)
- func (k Querier) ServiceUnbondingDelegation(goCtx context.Context, req *types.QueryServiceUnbondingDelegationRequest) (*types.QueryServiceUnbondingDelegationResponse, error)
- func (k Querier) ServiceUnbondingDelegations(goCtx context.Context, req *types.QueryServiceUnbondingDelegationsRequest) (*types.QueryServiceUnbondingDelegationsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountsBalancesInvariants ¶
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 OperatorDelegationToOperatorDelegationResponse ¶
func OperatorDelegationToOperatorDelegationResponse(ctx sdk.Context, k *Keeper, delegation types.Delegation) (types.DelegationResponse, error)
OperatorDelegationToOperatorDelegationResponse converts a OperatorDelegation to a OperatorDelegationResponse
func OperatorsDelegatorsSharesInvariant ¶
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 ¶
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 ¶
PositiveOperatorsDelegationsInvariant checks that all stored operator delegations have > 0 shares.
func PositivePoolsDelegationsInvariant ¶
PositivePoolsDelegationsInvariant checks that all stored pools delegations have > 0 shares
func PositiveServicesDelegationsInvariant ¶
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 ¶
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 ¶
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 ¶
CompleteMatureUnbondingDelegations runs the endblocker logic for delegations
func (*Keeper) CompleteUnbonding ¶
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 ¶
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 ¶
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) 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 ¶
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 ¶
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) 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 ¶
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 ¶
SaveServiceParams stored the given params for the given service
func (*Keeper) SetDelegation ¶
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) SetUBDQueueTimeSlice ¶
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 ¶
UBDQueueIterator returns all the unbonding queue timeslices from time 0 until endTime.
func (*Keeper) Unbond ¶
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 ¶
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 (Querier) DelegatorOperator ¶
func (k Querier) DelegatorOperator(goCtx context.Context, req *types.QueryDelegatorOperatorRequest) (*types.QueryDelegatorOperatorResponse, error)
DelegatorOperator queries the operator for the given delegator address and operator id
func (Querier) DelegatorOperatorDelegations ¶
func (k Querier) DelegatorOperatorDelegations(goCtx context.Context, req *types.QueryDelegatorOperatorDelegationsRequest) (*types.QueryDelegatorOperatorDelegationsResponse, error)
DelegatorOperatorDelegations queries the operator delegations for the given delegator address
func (Querier) DelegatorOperatorUnbondingDelegations ¶
func (k Querier) DelegatorOperatorUnbondingDelegations(goCtx context.Context, req *types.QueryDelegatorOperatorUnbondingDelegationsRequest) (*types.QueryDelegatorOperatorUnbondingDelegationsResponse, error)
DelegatorOperatorUnbondingDelegations queries the operator unbonding delegations for the given delegator address
func (Querier) DelegatorOperators ¶
func (k Querier) DelegatorOperators(goCtx context.Context, req *types.QueryDelegatorOperatorsRequest) (*types.QueryDelegatorOperatorsResponse, error)
DelegatorOperators queries the operators for the given delegator address
func (Querier) DelegatorPool ¶
func (k Querier) DelegatorPool(goCtx context.Context, req *types.QueryDelegatorPoolRequest) (*types.QueryDelegatorPoolResponse, error)
DelegatorPool queries the pool for the given delegator address and pool id
func (Querier) DelegatorPoolDelegations ¶
func (k Querier) DelegatorPoolDelegations(goCtx context.Context, req *types.QueryDelegatorPoolDelegationsRequest) (*types.QueryDelegatorPoolDelegationsResponse, error)
DelegatorPoolDelegations queries the pool delegations for the given delegator address
func (Querier) DelegatorPoolUnbondingDelegations ¶
func (k Querier) DelegatorPoolUnbondingDelegations(goCtx context.Context, req *types.QueryDelegatorPoolUnbondingDelegationsRequest) (*types.QueryDelegatorPoolUnbondingDelegationsResponse, error)
DelegatorPoolUnbondingDelegations queries the pool unbonding delegations for the given delegator address
func (Querier) DelegatorPools ¶
func (k Querier) DelegatorPools(goCtx context.Context, req *types.QueryDelegatorPoolsRequest) (*types.QueryDelegatorPoolsResponse, error)
DelegatorPools queries the pools for the given delegator address
func (Querier) DelegatorService ¶
func (k Querier) DelegatorService(goCtx context.Context, req *types.QueryDelegatorServiceRequest) (*types.QueryDelegatorServiceResponse, error)
DelegatorService queries the service for the given delegator address and service id
func (Querier) DelegatorServiceDelegations ¶
func (k Querier) DelegatorServiceDelegations(goCtx context.Context, req *types.QueryDelegatorServiceDelegationsRequest) (*types.QueryDelegatorServiceDelegationsResponse, error)
DelegatorServiceDelegations queries the service delegations for the given delegator address
func (Querier) DelegatorServiceUnbondingDelegations ¶
func (k Querier) DelegatorServiceUnbondingDelegations(goCtx context.Context, req *types.QueryDelegatorServiceUnbondingDelegationsRequest) (*types.QueryDelegatorServiceUnbondingDelegationsResponse, error)
DelegatorServiceUnbondingDelegations queries the service unbonding delegations for the given delegator address
func (Querier) DelegatorServices ¶
func (k Querier) DelegatorServices(goCtx context.Context, req *types.QueryDelegatorServicesRequest) (*types.QueryDelegatorServicesResponse, error)
DelegatorServices queries the services for the given delegator address
func (Querier) OperatorDelegation ¶
func (k Querier) OperatorDelegation(goCtx context.Context, req *types.QueryOperatorDelegationRequest) (*types.QueryOperatorDelegationResponse, error)
OperatorDelegation queries the operator delegation for the given operator id and user address
func (Querier) OperatorDelegations ¶
func (k Querier) OperatorDelegations(goCtx context.Context, req *types.QueryOperatorDelegationsRequest) (*types.QueryOperatorDelegationsResponse, error)
OperatorDelegations queries the operator delegations for the given operator id
func (Querier) OperatorParams ¶
func (k Querier) OperatorParams(goCtx context.Context, req *types.QueryOperatorParamsRequest) (*types.QueryOperatorParamsResponse, error)
OperatorParams queries the operator params for the given operator id
func (Querier) OperatorUnbondingDelegation ¶
func (k Querier) OperatorUnbondingDelegation(goCtx context.Context, req *types.QueryOperatorUnbondingDelegationRequest) (*types.QueryOperatorUnbondingDelegationResponse, error)
OperatorUnbondingDelegation queries the operator unbonding delegation for the given operator id and user address
func (Querier) OperatorUnbondingDelegations ¶
func (k Querier) OperatorUnbondingDelegations(goCtx context.Context, req *types.QueryOperatorUnbondingDelegationsRequest) (*types.QueryOperatorUnbondingDelegationsResponse, error)
OperatorUnbondingDelegations queries the operator unbonding delegations for the given operator id
func (Querier) Params ¶
func (k Querier) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params queries the restaking module parameters
func (Querier) PoolDelegation ¶
func (k Querier) PoolDelegation(goCtx context.Context, req *types.QueryPoolDelegationRequest) (*types.QueryPoolDelegationResponse, error)
PoolDelegation queries the pool delegation for the given pool id and user address
func (Querier) PoolDelegations ¶
func (k Querier) PoolDelegations(goCtx context.Context, req *types.QueryPoolDelegationsRequest) (*types.QueryPoolDelegationsResponse, error)
PoolDelegations queries the pool delegations for the given pool id
func (Querier) PoolUnbondingDelegation ¶
func (k Querier) PoolUnbondingDelegation(goCtx context.Context, req *types.QueryPoolUnbondingDelegationRequest) (*types.QueryPoolUnbondingDelegationResponse, error)
PoolUnbondingDelegation queries the pool unbonding delegation for the given pool id and user address
func (Querier) PoolUnbondingDelegations ¶
func (k Querier) PoolUnbondingDelegations(goCtx context.Context, req *types.QueryPoolUnbondingDelegationsRequest) (*types.QueryPoolUnbondingDelegationsResponse, error)
PoolUnbondingDelegations queries the pool unbonding delegations for the given pool id
func (Querier) ServiceDelegation ¶
func (k Querier) ServiceDelegation(goCtx context.Context, req *types.QueryServiceDelegationRequest) (*types.QueryServiceDelegationResponse, error)
ServiceDelegation queries the service delegation for the given service id and user address
func (Querier) ServiceDelegations ¶
func (k Querier) ServiceDelegations(goCtx context.Context, req *types.QueryServiceDelegationsRequest) (*types.QueryServiceDelegationsResponse, error)
ServiceDelegations queries the service delegations for the given service id
func (Querier) ServiceParams ¶
func (k Querier) ServiceParams(goCtx context.Context, req *types.QueryServiceParamsRequest) (*types.QueryServiceParamsResponse, error)
ServiceParams queries the service params for the given service id
func (Querier) ServiceUnbondingDelegation ¶
func (k Querier) ServiceUnbondingDelegation(goCtx context.Context, req *types.QueryServiceUnbondingDelegationRequest) (*types.QueryServiceUnbondingDelegationResponse, error)
ServiceUnbondingDelegation queries the service unbonding delegation for the given service id and user address
func (Querier) ServiceUnbondingDelegations ¶
func (k Querier) ServiceUnbondingDelegations(goCtx context.Context, req *types.QueryServiceUnbondingDelegationsRequest) (*types.QueryServiceUnbondingDelegationsResponse, error)
ServiceUnbondingDelegations queries the service unbonding delegations for the given service id