handler

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(keepers Keepers) baseapp.MsgServiceHandler

NewHandler returns a handler for "market" type messages

func NewServer

func NewServer(k Keepers) types.MsgServer

NewServer returns an implementation of the market MsgServer interface for the provided Keeper.

func RecordMissedEligibleBidsAtLeaseMatch

func RecordMissedEligibleBidsAtLeaseMatch(
	ctx sdk.Context,
	k Keepers,
	order mtypes.Order,
	winning mv1.BidID,
)

RecordMissedEligibleBidsAtLeaseMatch walks registered providers that satisfied the same order requirements as MsgCreateBid and records a missed-bid availability signal for each one that did not submit a bid before the winning lease was created. Must run while the order is still OrderOpen, before OnOrderMatched mutates state.

Types

type AuditKeeper

type AuditKeeper interface {
	GetProviderAttributes(ctx sdk.Context, id sdk.Address) (atypes.AuditedProviders, bool)
}

type AuthzKeeper

type AuthzKeeper interface {
	DeleteGrant(ctx context.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) error
	GetAuthorization(ctx context.Context, grantee sdk.AccAddress, granter sdk.AccAddress, msgType string) (authz.Authorization, *time.Time)
	SaveGrant(ctx context.Context, grantee sdk.AccAddress, granter sdk.AccAddress, authorization authz.Authorization, expiration *time.Time) error
	GetGranteeGrantsByMsgType(ctx context.Context, grantee sdk.AccAddress, msgType string, onGrant authzkeeper.OnGrantFn)
}

type BankKeeper

type BankKeeper interface {
	SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins
	SpendableCoin(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin
}

type DeploymentKeeper

type DeploymentKeeper interface {
	GetGroup(ctx sdk.Context, id dtypes.GroupID) (dbeta.Group, bool)
	OnBidClosed(ctx sdk.Context, id dtypes.GroupID) error
	OnLeaseClosed(ctx sdk.Context, id dtypes.GroupID) (dbeta.Group, error)
}

DeploymentKeeper Interface includes deployment methods

type EscrowKeeper

type EscrowKeeper interface {
	AccountCreate(ctx sdk.Context, id escrowid.Account, owner sdk.AccAddress, deposits []etypes.Depositor) error
	AccountDeposit(ctx sdk.Context, id escrowid.Account, deposits []etypes.Depositor) error
	AccountClose(ctx sdk.Context, id escrowid.Account) error
	PaymentCreate(ctx sdk.Context, id escrowid.Payment, provider sdk.AccAddress, rate sdk.DecCoin) error
	PaymentWithdraw(ctx sdk.Context, id escrowid.Payment) error
	PaymentClose(ctx sdk.Context, id escrowid.Payment) error
	AuthorizeDeposits(sctx sdk.Context, msg sdk.Msg) ([]etypes.Depositor, error)
}

type Keepers

type Keepers struct {
	Escrow     EscrowKeeper
	Market     keeper.IKeeper
	Deployment DeploymentKeeper
	Provider   ProviderKeeper
	Audit      AuditKeeper
	Account    govtypes.AccountKeeper
	Authz      AuthzKeeper
	Bank       BankKeeper
	// Reputation is optional. When set, the market handler calls into it
	// after successful bid creation so the reputation module can record
	// chain-derived provider availability. nil disables the hook (used
	// by tests, simulation, and chains that don't ship x/reputation).
	Reputation MarketReputationHook
}

Keepers include all modules keepers

type MarketReputationHook

type MarketReputationHook interface {
	// RecordAvailabilityOnline is called after a bid is successfully
	// created on-chain or a healthy attestation is recorded. `provider`
	// is the bid's provider bech32. The hook MUST NOT return an error
	// (it is best-effort) and MUST be cheap so it does not extend tx
	// processing time.
	RecordAvailabilityOnline(ctx sdk.Context, provider, source, reference string)
	// RecordAvailabilityOffline is invoked for hard-negative signals
	// (e.g. a failed health attestation). The hook MUST only be called
	// when the provider was actually eligible for the missed action.
	RecordAvailabilityOffline(ctx sdk.Context, provider, source, reference string)
	// RecordAvailabilityDegraded is the soft-negative path used when
	// the signal is ambiguous (e.g. degraded health, partial failure).
	RecordAvailabilityDegraded(ctx sdk.Context, provider, source, reference string)
}

MarketReputationHook is the optional surface the market handler uses to notify x/reputation of bid lifecycle events. It is intentionally small so the reputation module can hook in without the market keeper taking a hard import dependency. The reputation keeper is the canonical implementation; tests or alternative chains can provide a no-op or in-memory hook instead.

type ProviderKeeper

type ProviderKeeper interface {
	Get(ctx sdk.Context, id sdk.Address) (ptypes.Provider, bool)
	WithProviders(ctx sdk.Context, fn func(ptypes.Provider) bool)
}

ProviderKeeper Interface includes provider methods

Jump to

Keyboard shortcuts

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