Documentation
¶
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) AllSuppliers(ctx context.Context, req *types.QueryAllSuppliersRequest) (*types.QueryAllSuppliersResponse, error)
- func (k Keeper) BeginBlockerActivateSupplierServices(ctx context.Context) (numSuppliersWithServicesActivation int, err error)
- func (k Keeper) EndBlockerPruneSupplierServiceConfigHistory(ctx context.Context) (numSuppliersWithPrunedHistory int, err error)
- func (k Keeper) EndBlockerUnbondSuppliers(ctx context.Context) (numUnbondedSuppliers uint64, err error)
- func (k Keeper) GetActivatedServiceConfigUpdatesIterator(ctx context.Context, activationHeight int64) sharedtypes.RecordIterator[sharedtypes.ServiceConfigUpdate]
- func (k Keeper) GetAllSuppliers(ctx context.Context) (suppliers []sharedtypes.Supplier)
- func (k Keeper) GetAllUnstakingSuppliersIterator(ctx context.Context) storetypes.Iterator
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetDeactivatedServiceConfigUpdatesIterator(ctx context.Context, deactivationHeight int64) sharedtypes.RecordIterator[sharedtypes.ServiceConfigUpdate]
- func (k Keeper) GetDehydratedSupplier(ctx context.Context, supplierOperatorAddr string) (supplier sharedtypes.Supplier, found bool)
- func (k Keeper) GetParams(ctx context.Context) (params types.Params)
- func (k Keeper) GetServiceConfigUpdatesIterator(ctx context.Context, serviceId string, currentHeight int64) sharedtypes.RecordIterator[*sharedtypes.ServiceConfigUpdate]
- func (k Keeper) GetSupplier(ctx context.Context, supplierOperatorAddr string) (supplier sharedtypes.Supplier, found bool)
- func (k Keeper) GetSupplierActiveServiceConfig(ctx context.Context, supplier *sharedtypes.Supplier, serviceId string) []*sharedtypes.SupplierServiceConfig
- func (k Keeper) Logger() log.Logger
- func (k Keeper) MigrateSupplierServiceConfigIndexes(ctx context.Context)
- func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) RemoveSupplier(ctx context.Context, supplierOperatorAddress string)
- func (k Keeper) SetAndIndexDehydratedSupplier(ctx context.Context, supplier sharedtypes.Supplier)
- func (k Keeper) SetDehydratedSupplier(ctx context.Context, supplier sharedtypes.Supplier)
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) StakeSupplier(ctx context.Context, logger cosmoslog.Logger, ...) (*sharedtypes.Supplier, error)
- func (k Keeper) Supplier(ctx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, logger log.Logger, authority string, bankKeeper types.BankKeeper, sharedKeeper types.SharedKeeper, serviceKeeper types.ServiceKeeper, ) Keeper
func (Keeper) AllSuppliers ¶
func (k Keeper) AllSuppliers( ctx context.Context, req *types.QueryAllSuppliersRequest, ) (*types.QueryAllSuppliersResponse, error)
AllSuppliers returns a paginated list of all suppliers in the store. Supports filtering by service_id, operator_address, and/or owner_address. Multiple filters can be combined (AND logic). The returned suppliers are fully hydrated with their service configurations and history.
func (Keeper) BeginBlockerActivateSupplierServices ¶ added in v0.0.14
func (k Keeper) BeginBlockerActivateSupplierServices( ctx context.Context, ) (numSuppliersWithServicesActivation int, err error)
BeginBlockerActivateSupplierServices processes suppliers that have pending service activations at the current block height. It returns the number of suppliers whose services were activated.
func (Keeper) EndBlockerPruneSupplierServiceConfigHistory ¶ added in v0.0.14
func (k Keeper) EndBlockerPruneSupplierServiceConfigHistory( ctx context.Context, ) (numSuppliersWithPrunedHistory int, err error)
EndBlockerPruneSupplierServiceConfigHistory prunes the service config history of existing suppliers. If a supplier has updated its supported set of configs, but that history is no longer needed for various reasons (servicing relays, claim settlement, etc), it can be pruned. This helps reduce onchain state bloat and avoid diverting attention from non-actionable metadata.
func (Keeper) EndBlockerUnbondSuppliers ¶ added in v0.0.5
func (k Keeper) EndBlockerUnbondSuppliers(ctx context.Context) (numUnbondedSuppliers uint64, err error)
EndBlockerUnbondSuppliers unbonds suppliers whose unbonding period has elapsed.
func (Keeper) GetActivatedServiceConfigUpdatesIterator ¶ added in v0.1.8
func (k Keeper) GetActivatedServiceConfigUpdatesIterator( ctx context.Context, activationHeight int64, ) sharedtypes.RecordIterator[sharedtypes.ServiceConfigUpdate]
GetActivatedServiceConfigUpdatesIterator returns an iterator over service configurations that become active at the specified block height.
This is used primarily by the BeginBlocker to find all service configurations that need to be activated at the current block height.
func (Keeper) GetAllSuppliers ¶
func (k Keeper) GetAllSuppliers(ctx context.Context) (suppliers []sharedtypes.Supplier)
GetAllSuppliers returns all suppliers stored in the blockchain state Each supplier is fully hydrated with its service configurations and history.
func (Keeper) GetAllUnstakingSuppliersIterator ¶ added in v0.1.8
func (k Keeper) GetAllUnstakingSuppliersIterator( ctx context.Context, ) storetypes.Iterator
GetAllUnstakingSuppliersIterator returns an iterator for all suppliers that are currently unstaking. It is used to process suppliers that have completed their unbonding period.
func (Keeper) GetAuthority ¶
GetAuthority returns the module's authority.
func (Keeper) GetDeactivatedServiceConfigUpdatesIterator ¶ added in v0.1.8
func (k Keeper) GetDeactivatedServiceConfigUpdatesIterator( ctx context.Context, deactivationHeight int64, ) sharedtypes.RecordIterator[sharedtypes.ServiceConfigUpdate]
GetDeactivatedServiceConfigUpdatesIterator returns an iterator over service configuration updates that become inactive at the specified block height.
This is used primarily by the EndBlocker to find all service configuration updates that need to be pruned from state at the current block height.
func (Keeper) GetDehydratedSupplier ¶ added in v0.1.8
func (k Keeper) GetDehydratedSupplier( ctx context.Context, supplierOperatorAddr string, ) (supplier sharedtypes.Supplier, found bool)
GetDehydratedSupplier retrieves a dehydrated supplier. It omits hydrating a Supplier object with the available indexes (e.g. service config updates and unstaking height). Useful and more efficient when the service details aren't needed.
func (Keeper) GetServiceConfigUpdatesIterator ¶ added in v0.1.8
func (k Keeper) GetServiceConfigUpdatesIterator( ctx context.Context, serviceId string, currentHeight int64, ) sharedtypes.RecordIterator[*sharedtypes.ServiceConfigUpdate]
GetServiceConfigUpdatesIterator returns an iterator over service configuration updates with activation heights less than or equal to the provided current height.
This function leverages the lexicographical ordering of big-endian encoded heights to efficiently filter configurations that should be active at the current height.
func (Keeper) GetSupplier ¶
func (k Keeper) GetSupplier( ctx context.Context, supplierOperatorAddr string, ) (supplier sharedtypes.Supplier, found bool)
GetSupplier retrieves a fully hydrated supplier from the store, including its service configurations and service config updates history. Useful when all service details are needed.
func (Keeper) GetSupplierActiveServiceConfig ¶ added in v0.1.9
func (k Keeper) GetSupplierActiveServiceConfig( ctx context.Context, supplier *sharedtypes.Supplier, serviceId string, ) []*sharedtypes.SupplierServiceConfig
The function: - Retrieves the supplier's service configuration history for the specified service ID - Returns the configuration that is active at the current block height
func (Keeper) MigrateSupplierServiceConfigIndexes ¶ added in v0.1.9
MigrateSupplierServiceConfigIndexes migrates the supplier service config indexes for all suppliers: - From the deprecated format: supplierAddress/ActivationHeight/ServiceId - To the new format: supplierAddress/ServiceId/ActivationHeight
This is necessary to ensure that the new index format is used for all suppliers and their service configurations. TODO_DELETE(@red-0ne): Remove this function after v0.1.9 upgrade
func (Keeper) Params ¶
func (k Keeper) Params( ctx context.Context, req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error)
func (Keeper) RemoveSupplier ¶
RemoveSupplier deletes a supplier from the store and removes all associated indexes
func (Keeper) SetAndIndexDehydratedSupplier ¶ added in v0.1.9
func (k Keeper) SetAndIndexDehydratedSupplier(ctx context.Context, supplier sharedtypes.Supplier)
SetAndIndexDehydratedSupplier stores a supplier record and indexes its relevant attributes for efficient querying. It modifies the Supplier structure onchain metadata to manage state bloat.
The function: - Indexes service config updates for efficient retrieval - Indexes unstaking height (if applicable) - Stores a dehydrated form of the supplier (without services and history)
func (Keeper) SetDehydratedSupplier ¶ added in v0.1.9
func (k Keeper) SetDehydratedSupplier( ctx context.Context, supplier sharedtypes.Supplier, )
SetDehydratedSupplier stores a dehydrated supplier in the store. It omits service details and history to reduce state bloat. This is useful when the service details are not needed for the current operation.
func (Keeper) StakeSupplier ¶ added in v0.0.14
func (k Keeper) StakeSupplier( ctx context.Context, logger cosmoslog.Logger, msg *suppliertypes.MsgStakeSupplier, ) (*sharedtypes.Supplier, error)
StakeSupplier stakes (or updates) the supplier according to the given msg by applying the following logic:
- the msg is validated
- if the supplier is not found, it is created (in memory) according to the valid msg
- if the supplier is found and is not unbonding, it is updated (in memory) according to the msg
- if the supplier is found and is unbonding, it is updated (in memory; and no longer unbonding)
- additional stake validation (e.g. min stake, etc.)
- EITHER any positive difference between the msg stake and any current stake is transferred from the staking supplier's account, to the supplier module's accounts.
- OR any negative difference between the msg stake and any current stake is transferred from the supplier module's account (stake escrow) to the staking supplier's account.
- the supplier staking fee is deducted from the staking supplier's account balance.
- the (new or updated) supplier is persisted.
- an EventSupplierStaked event is emitted.
func (Keeper) Supplier ¶
func (k Keeper) Supplier( ctx context.Context, req *types.QueryGetSupplierRequest, ) (*types.QueryGetSupplierResponse, error)
Supplier retrieves a specific supplier by operator address. The returned supplier can be hydrated or dehydrated based on the request flag.