Documentation
¶
Index ¶
- type BidIndexes
- type EscrowKeeper
- type IKeeper
- type Keeper
- func (k Keeper) BidCountForOrder(ctx sdk.Context, id mv1.OrderID) uint32
- func (k Keeper) Bids() *collections.IndexedMap[keys.BidPrimaryKey, types.Bid, BidIndexes]
- func (k Keeper) Codec() codec.BinaryCodec
- func (k Keeper) CreateBid(ctx sdk.Context, id mv1.BidID, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error)
- func (k Keeper) CreateLease(ctx sdk.Context, bid types.Bid) error
- func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetBid(ctx sdk.Context, id mv1.BidID) (types.Bid, bool)
- func (k Keeper) GetLease(ctx sdk.Context, id mv1.LeaseID) (mv1.Lease, bool)
- func (k Keeper) GetOrder(ctx sdk.Context, id mv1.OrderID) (types.Order, bool)
- func (k Keeper) GetParams(ctx sdk.Context) (p types.Params)
- func (k Keeper) LeaseForOrder(ctx sdk.Context, bs types.Bid_State, oid mv1.OrderID) (mv1.Lease, bool)
- func (k Keeper) Leases() *collections.IndexedMap[keys.LeasePrimaryKey, mv1.Lease, LeaseIndexes]
- func (k Keeper) NewQuerier() Querier
- func (k Keeper) OnBidClosed(ctx sdk.Context, bid types.Bid) error
- func (k Keeper) OnBidLost(ctx sdk.Context, bid types.Bid)
- func (k Keeper) OnBidMatched(ctx sdk.Context, bid types.Bid)
- func (k Keeper) OnGroupClosed(ctx sdk.Context, id dtypes.GroupID, state dtypesBeta.Group_State) error
- func (k Keeper) OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.Lease_State, ...) error
- func (k Keeper) OnOrderClosed(ctx sdk.Context, order types.Order) error
- func (k Keeper) OnOrderMatched(ctx sdk.Context, order types.Order)
- func (k Keeper) Orders() *collections.IndexedMap[keys.OrderPrimaryKey, types.Order, OrderIndexes]
- func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error
- func (k Keeper) StoreKey() storetypes.StoreKey
- func (k Keeper) WithBids(ctx sdk.Context, fn func(types.Bid) bool)
- func (k Keeper) WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, state types.Bid_State, ...)
- func (k Keeper) WithLeases(ctx sdk.Context, fn func(mv1.Lease) bool)
- func (k Keeper) WithOrders(ctx sdk.Context, fn func(types.Order) bool)
- func (k Keeper) WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, state types.Order_State, ...)
- type LeaseIndexes
- type OrderIndexes
- type Querier
- func (k Querier) Bid(c context.Context, req *types.QueryBidRequest) (*types.QueryBidResponse, error)
- func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.QueryBidsResponse, error)
- func (k Querier) Lease(c context.Context, req *types.QueryLeaseRequest) (*types.QueryLeaseResponse, error)
- func (k Querier) Leases(c context.Context, req *types.QueryLeasesRequest) (*types.QueryLeasesResponse, error)
- func (k Querier) Order(c context.Context, req *types.QueryOrderRequest) (*types.QueryOrderResponse, error)
- func (k Querier) Orders(c context.Context, req *types.QueryOrdersRequest) (*types.QueryOrdersResponse, error)
- func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BidIndexes ¶ added in v1.2.0
type BidIndexes struct {
// State indexes bids by their state (Open, Active, Lost, Closed)
State *indexes.Multi[int32, keys.BidPrimaryKey, types.Bid]
// Provider indexes bids by provider address (covers all states)
Provider *indexes.Multi[string, keys.BidPrimaryKey, types.Bid]
// OrderState indexes bids by (owner, dseq, gseq, oseq, state) for WithBidsForOrder queries
OrderState *indexes.Multi[collections.Pair[keys.OrderPrimaryKey, int32], keys.BidPrimaryKey, types.Bid]
}
BidIndexes defines the secondary indexes for the bid IndexedMap
func NewBidIndexes ¶ added in v1.2.0
func NewBidIndexes(sb *collections.SchemaBuilder) BidIndexes
NewBidIndexes creates all secondary indexes for the bid IndexedMap
func (BidIndexes) IndexesList ¶ added in v1.2.0
func (b BidIndexes) IndexesList() []collections.Index[keys.BidPrimaryKey, types.Bid]
type EscrowKeeper ¶
type IKeeper ¶
type IKeeper interface {
NewQuerier() Querier
Codec() codec.BinaryCodec
StoreKey() storetypes.StoreKey
CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error)
CreateBid(ctx sdk.Context, id mv1.BidID, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error)
CreateLease(ctx sdk.Context, bid types.Bid) error
OnOrderMatched(ctx sdk.Context, order types.Order)
OnBidMatched(ctx sdk.Context, bid types.Bid)
OnBidLost(ctx sdk.Context, bid types.Bid)
OnBidClosed(ctx sdk.Context, bid types.Bid) error
OnOrderClosed(ctx sdk.Context, order types.Order) error
OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.Lease_State, reason mv1.LeaseClosedReason) error
OnGroupClosed(ctx sdk.Context, id dtypes.GroupID, state dtypesBeta.Group_State) error
GetOrder(ctx sdk.Context, id mv1.OrderID) (types.Order, bool)
GetBid(ctx sdk.Context, id mv1.BidID) (types.Bid, bool)
GetLease(ctx sdk.Context, id mv1.LeaseID) (mv1.Lease, bool)
LeaseForOrder(ctx sdk.Context, bs types.Bid_State, oid mv1.OrderID) (mv1.Lease, bool)
WithOrders(ctx sdk.Context, fn func(types.Order) bool)
WithBids(ctx sdk.Context, fn func(types.Bid) bool)
WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, state types.Bid_State, fn func(types.Bid) bool)
WithLeases(ctx sdk.Context, fn func(mv1.Lease) bool)
WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, state types.Order_State, fn func(types.Order) bool)
BidCountForOrder(ctx sdk.Context, id mv1.OrderID) uint32
GetParams(ctx sdk.Context) (params types.Params)
SetParams(ctx sdk.Context, params types.Params) error
GetAuthority() string
}
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, skey *storetypes.KVStoreKey, ekeeper EscrowKeeper, authority string) IKeeper
NewKeeper creates and returns an instance for Market keeper
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper of the market store
func (Keeper) BidCountForOrder ¶
func (Keeper) Bids ¶ added in v1.2.0
func (k Keeper) Bids() *collections.IndexedMap[keys.BidPrimaryKey, types.Bid, BidIndexes]
Bids returns the bid IndexedMap for direct access (used by genesis and migration)
func (Keeper) CreateBid ¶
func (k Keeper) CreateBid(ctx sdk.Context, id mv1.BidID, price sdk.DecCoin, roffer types.ResourcesOffer) (types.Bid, error)
CreateBid creates a bid for a order with given orderID, price for bid and provider
func (Keeper) CreateLease ¶
CreateLease creates lease for bid with given bidID. Should only be called by the EndBlock handler or unit tests.
func (Keeper) CreateOrder ¶
func (k Keeper) CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypesBeta.GroupSpec) (types.Order, error)
CreateOrder creates a new order with given group id and specifications. It returns created order
func (Keeper) GetAuthority ¶
GetAuthority returns the x/mint module's authority.
func (Keeper) LeaseForOrder ¶
func (k Keeper) LeaseForOrder(ctx sdk.Context, bs types.Bid_State, oid mv1.OrderID) (mv1.Lease, bool)
LeaseForOrder returns lease for order with given ID and lease found status
func (Keeper) Leases ¶ added in v1.2.0
func (k Keeper) Leases() *collections.IndexedMap[keys.LeasePrimaryKey, mv1.Lease, LeaseIndexes]
Leases returns the lease IndexedMap for direct access (used by genesis and migration)
func (Keeper) NewQuerier ¶
func (Keeper) OnBidClosed ¶
OnBidClosed updates bid state to closed
func (Keeper) OnBidMatched ¶
OnBidMatched updates bid state to matched
func (Keeper) OnGroupClosed ¶
func (k Keeper) OnGroupClosed(ctx sdk.Context, id dtypes.GroupID, state dtypesBeta.Group_State) error
OnGroupClosed updates state of all orders, bids and leases in group to closed
func (Keeper) OnLeaseClosed ¶
func (k Keeper) OnLeaseClosed(ctx sdk.Context, lease mv1.Lease, state mv1.Lease_State, reason mv1.LeaseClosedReason) error
OnLeaseClosed updates lease state to closed
func (Keeper) OnOrderClosed ¶
OnOrderClosed updates order state to closed
func (Keeper) OnOrderMatched ¶
OnOrderMatched updates order state to matched
func (Keeper) Orders ¶ added in v1.2.0
func (k Keeper) Orders() *collections.IndexedMap[keys.OrderPrimaryKey, types.Order, OrderIndexes]
Orders returns the order IndexedMap for direct access (used by genesis and migration)
func (Keeper) WithBidsForOrder ¶
func (k Keeper) WithBidsForOrder(ctx sdk.Context, id mv1.OrderID, state types.Bid_State, fn func(types.Bid) bool)
WithBidsForOrder iterates all bids of an order in market with given OrderID
func (Keeper) WithLeases ¶
WithLeases iterates all leases in market
func (Keeper) WithOrders ¶
WithOrders iterates all orders in market
type LeaseIndexes ¶ added in v1.2.0
type LeaseIndexes struct {
// State indexes leases by their state (Active, InsufficientFunds, Closed)
State *indexes.Multi[int32, keys.LeasePrimaryKey, mv1.Lease]
// Provider indexes leases by provider address (covers all states, replaces old reverse keys)
Provider *indexes.Multi[string, keys.LeasePrimaryKey, mv1.Lease]
}
LeaseIndexes defines the secondary indexes for the lease IndexedMap
func NewLeaseIndexes ¶ added in v1.2.0
func NewLeaseIndexes(sb *collections.SchemaBuilder) LeaseIndexes
NewLeaseIndexes creates all secondary indexes for the lease IndexedMap
func (LeaseIndexes) IndexesList ¶ added in v1.2.0
func (l LeaseIndexes) IndexesList() []collections.Index[keys.LeasePrimaryKey, mv1.Lease]
type OrderIndexes ¶ added in v1.2.0
type OrderIndexes struct {
// State indexes orders by their state (Open, Active, Closed)
State *indexes.Multi[int32, keys.OrderPrimaryKey, types.Order]
// GroupState indexes orders by (owner, dseq, gseq, state) for WithOrdersForGroup queries
GroupState *indexes.Multi[collections.Pair[keys.GroupPartKey, int32], keys.OrderPrimaryKey, types.Order]
}
OrderIndexes defines the secondary indexes for the order IndexedMap
func NewOrderIndexes ¶ added in v1.2.0
func NewOrderIndexes(sb *collections.SchemaBuilder) OrderIndexes
NewOrderIndexes creates all secondary indexes for the order IndexedMap
func (OrderIndexes) IndexesList ¶ added in v1.2.0
func (o OrderIndexes) IndexesList() []collections.Index[keys.OrderPrimaryKey, types.Order]
type Querier ¶
type Querier struct {
Keeper
}
Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper
func (Querier) Bid ¶
func (k Querier) Bid(c context.Context, req *types.QueryBidRequest) (*types.QueryBidResponse, error)
Bid returns bid details based on BidID
func (Querier) Bids ¶
func (k Querier) Bids(c context.Context, req *types.QueryBidsRequest) (*types.QueryBidsResponse, error)
Bids returns bids based on filters
func (Querier) Lease ¶
func (k Querier) Lease(c context.Context, req *types.QueryLeaseRequest) (*types.QueryLeaseResponse, error)
Lease returns lease details based on LeaseID
func (Querier) Leases ¶
func (k Querier) Leases(c context.Context, req *types.QueryLeasesRequest) (*types.QueryLeasesResponse, error)
Leases returns leases based on filters
func (Querier) Order ¶
func (k Querier) Order(c context.Context, req *types.QueryOrderRequest) (*types.QueryOrderResponse, error)
Order returns order details based on OrderID
func (Querier) Orders ¶
func (k Querier) Orders(c context.Context, req *types.QueryOrdersRequest) (*types.QueryOrdersResponse, error)
Orders returns orders based on filters
func (Querier) Params ¶
func (k Querier) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)