keeper

package
v0.23.2-rc5 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EscrowKeeper

type EscrowKeeper interface {
	GetAccount(ctx sdk.Context, id etypes.AccountID) (etypes.Account, error)
	GetPayment(ctx sdk.Context, id etypes.AccountID, pid string) (etypes.FractionalPayment, error)
	AccountClose(ctx sdk.Context, id etypes.AccountID) error
	PaymentClose(ctx sdk.Context, id etypes.AccountID, pid string) error
}

type IKeeper

type IKeeper interface {
	NewQuerier() Querier
	Codec() codec.BinaryCodec
	StoreKey() sdk.StoreKey
	CreateOrder(ctx sdk.Context, gid dtypes.GroupID, spec dtypes.GroupSpec) (types.Order, error)
	CreateBid(ctx sdk.Context, oid types.OrderID, provider sdk.AccAddress, price sdk.DecCoin) (types.Bid, error)
	CreateLease(ctx sdk.Context, bid types.Bid)
	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)
	OnOrderClosed(ctx sdk.Context, order types.Order)
	OnLeaseClosed(ctx sdk.Context, lease types.Lease, state types.Lease_State)
	OnGroupClosed(ctx sdk.Context, id dtypes.GroupID)
	GetOrder(ctx sdk.Context, id types.OrderID) (types.Order, bool)
	GetBid(ctx sdk.Context, id types.BidID) (types.Bid, bool)
	GetLease(ctx sdk.Context, id types.LeaseID) (types.Lease, bool)
	LeaseForOrder(ctx sdk.Context, oid types.OrderID) (types.Lease, bool)
	WithOrders(ctx sdk.Context, fn func(types.Order) bool)
	WithBids(ctx sdk.Context, fn func(types.Bid) bool)
	WithLeases(ctx sdk.Context, fn func(types.Lease) bool)
	WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, fn func(types.Order) bool)
	WithBidsForOrder(ctx sdk.Context, id types.OrderID, fn func(types.Bid) bool)
	BidCountForOrder(ctx sdk.Context, id types.OrderID) uint32
	GetParams(ctx sdk.Context) (params types.Params)
	SetParams(ctx sdk.Context, params types.Params)
}

TODO: use interface for all keepers, queriers

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, skey sdk.StoreKey, pspace paramtypes.Subspace, ekeeper EscrowKeeper) 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 (k Keeper) BidCountForOrder(ctx sdk.Context, id types.OrderID) uint32

func (Keeper) Codec

func (k Keeper) Codec() codec.BinaryCodec

Codec returns keeper codec

func (Keeper) CreateBid

func (k Keeper) CreateBid(ctx sdk.Context, oid types.OrderID, provider sdk.AccAddress, price sdk.DecCoin) (types.Bid, error)

CreateBid creates a bid for a order with given orderID, price for bid and provider

func (Keeper) CreateLease

func (k Keeper) CreateLease(ctx sdk.Context, bid types.Bid)

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 dtypes.GroupSpec) (types.Order, error)

CreateOrder creates a new order with given group id and specifications. It returns created order

func (Keeper) GetBid

func (k Keeper) GetBid(ctx sdk.Context, id types.BidID) (types.Bid, bool)

GetBid returns bid with given bidID from market store

func (Keeper) GetLease

func (k Keeper) GetLease(ctx sdk.Context, id types.LeaseID) (types.Lease, bool)

GetLease returns lease with given leaseID from market store

func (Keeper) GetOrder

func (k Keeper) GetOrder(ctx sdk.Context, id types.OrderID) (types.Order, bool)

GetOrder returns order with given orderID from market store

func (Keeper) GetParams

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

GetParams returns the total set of deployment parameters.

func (Keeper) LeaseForOrder

func (k Keeper) LeaseForOrder(ctx sdk.Context, oid types.OrderID) (types.Lease, bool)

LeaseForOrder returns lease for order with given ID and lease found status

func (Keeper) NewQuerier

func (k Keeper) NewQuerier() Querier

func (Keeper) OnBidClosed

func (k Keeper) OnBidClosed(ctx sdk.Context, bid types.Bid)

OnBidClosed updates bid state to closed

func (Keeper) OnBidLost

func (k Keeper) OnBidLost(ctx sdk.Context, bid types.Bid)

OnBidLost updates bid state to bid lost

func (Keeper) OnBidMatched

func (k Keeper) OnBidMatched(ctx sdk.Context, bid types.Bid)

OnBidActive updates bid state to matched

func (Keeper) OnGroupClosed

func (k Keeper) OnGroupClosed(ctx sdk.Context, id dtypes.GroupID)

OnGroupClosed updates state of all orders, bids and leases in group to closed

func (Keeper) OnLeaseClosed

func (k Keeper) OnLeaseClosed(ctx sdk.Context, lease types.Lease, state types.Lease_State)

OnLeaseClosed updates lease state to closed

func (Keeper) OnOrderClosed

func (k Keeper) OnOrderClosed(ctx sdk.Context, order types.Order)

OnOrderClosed updates order state to closed

func (Keeper) OnOrderMatched

func (k Keeper) OnOrderMatched(ctx sdk.Context, order types.Order)

OnOrderMatched updates order state to matched

func (Keeper) SetParams

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

SetParams sets the deployment parameters to the paramspace.

func (Keeper) StoreKey added in v0.24.0

func (k Keeper) StoreKey() sdk.StoreKey

StoreKey returns store key

func (Keeper) WithBids

func (k Keeper) WithBids(ctx sdk.Context, fn func(types.Bid) bool)

WithBids iterates all bids in market

func (Keeper) WithBidsForOrder

func (k Keeper) WithBidsForOrder(ctx sdk.Context, id types.OrderID, fn func(types.Bid) bool)

WithBidsForOrder iterates all bids of a order in market with given OrderID

func (Keeper) WithLeases

func (k Keeper) WithLeases(ctx sdk.Context, fn func(types.Lease) bool)

WithLeases iterates all leases in market

func (Keeper) WithOrders

func (k Keeper) WithOrders(ctx sdk.Context, fn func(types.Order) bool)

WithOrders iterates all orders in market

func (Keeper) WithOrdersForGroup

func (k Keeper) WithOrdersForGroup(ctx sdk.Context, id dtypes.GroupID, fn func(types.Order) bool)

WithOrdersForGroup iterates all orders of a group in market with given GroupID

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

Bid returns bid details based on BidID

func (Querier) Bids

Bids returns bids based on filters

func (Querier) Lease

Lease returns lease details based on LeaseID

func (Querier) Leases

Leases returns leases based on filters

func (Querier) Order

Order returns order details based on OrderID

func (Querier) Orders

Orders returns orders based on filters

Directories

Path Synopsis
keys

Jump to

Keyboard shortcuts

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