Documentation ¶
Index ¶
- type Keeper
- func (k Keeper) BatchOrderBookSettlements(ctx sdk.Context) error
- func (k Keeper) BettorLoses(ctx sdk.Context, betFulfillments []*bettypes.BetFulfillment, ...) error
- func (k Keeper) BettorWins(ctx sdk.Context, bettorAddress sdk.AccAddress, ...) error
- func (k Keeper) CalcWithdrawalAmount(ctx sdk.Context, depositorAddress string, marketUID string, ...) (sdkmath.Int, error)
- func (k Keeper) GetAllHistoricalParticipationExposures(ctx sdk.Context) (list []types.ParticipationExposure, err error)
- func (k Keeper) GetAllOrderBookExposures(ctx sdk.Context) (list []types.OrderBookOddsExposure, err error)
- func (k Keeper) GetAllOrderBookParticipations(ctx sdk.Context) (list []types.OrderBookParticipation, err error)
- func (k Keeper) GetAllOrderBooks(ctx sdk.Context) (list []types.OrderBook, err error)
- func (k Keeper) GetAllParticipationBetPair(ctx sdk.Context) (list []types.ParticipationBetPair, err error)
- func (k Keeper) GetAllParticipationExposures(ctx sdk.Context) (list []types.ParticipationExposure, err error)
- func (k Keeper) GetBatchSettlementCount(ctx sdk.Context) (res uint64)
- func (k Keeper) GetExposureByOrderBook(ctx sdk.Context, bookUID string) (peMap map[uint64]map[string]*types.ParticipationExposure, err error)
- func (k Keeper) GetExposureByOrderBookAndOdds(ctx sdk.Context, bookUID, oddsUID string) (list []types.ParticipationExposure, err error)
- func (k Keeper) GetExposureByOrderBookAndParticipationIndex(ctx sdk.Context, bookUID string, participationIndex uint64) (list []types.ParticipationExposure, err error)
- func (k Keeper) GetFirstUnsettledResolvedOrderBook(ctx sdk.Context, index int) (string, bool)
- func (k Keeper) GetMaxOrderBookParticipationsAllowed(ctx sdk.Context) (res uint64)
- func (k Keeper) GetOddsExposuresByOrderBook(ctx sdk.Context, orderBookUID string) (list []types.OrderBookOddsExposure, err error)
- func (k Keeper) GetOrderBook(ctx sdk.Context, orderBookUID string) (val types.OrderBook, found bool)
- func (k Keeper) GetOrderBookOddsExposure(ctx sdk.Context, orderBookUID, oddsUID string) (val types.OrderBookOddsExposure, found bool)
- func (k Keeper) GetOrderBookParticipation(ctx sdk.Context, bookUID string, index uint64) (val types.OrderBookParticipation, found bool)
- func (k Keeper) GetOrderBookStats(ctx sdk.Context) (val types.OrderBookStats)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetParticipationsOfOrderBook(ctx sdk.Context, bookUID string) (list []types.OrderBookParticipation, err error)
- func (k Keeper) GetRequeueThreshold(ctx sdk.Context) (res uint64)
- func (k Keeper) HistoricalParticipationExposures(c context.Context, req *types.QueryHistoricalParticipationExposuresRequest) (*types.QueryHistoricalParticipationExposuresResponse, error)
- func (k Keeper) InitiateOrderBook(ctx sdk.Context, marketUID string, oddsUIDs []string) (err error)
- func (k Keeper) InitiateOrderBookParticipation(ctx sdk.Context, addr sdk.AccAddress, bookUID string, ...) (index uint64, err error)
- func (Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MoveToHistoricalParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)
- func (k Keeper) OrderBook(c context.Context, req *types.QueryOrderBookRequest) (*types.QueryOrderBookResponse, error)
- func (k Keeper) OrderBookExposure(c context.Context, req *types.QueryOrderBookExposureRequest) (*types.QueryOrderBookExposureResponse, error)
- func (k Keeper) OrderBookExposures(c context.Context, req *types.QueryOrderBookExposuresRequest) (*types.QueryOrderBookExposuresResponse, error)
- func (k Keeper) OrderBookParticipation(c context.Context, req *types.QueryOrderBookParticipationRequest) (*types.QueryOrderBookParticipationResponse, error)
- func (k Keeper) OrderBookParticipationExposures(c context.Context, req *types.QueryOrderBookParticipationExposuresRequest) (*types.QueryOrderBookParticipationExposuresResponse, error)
- func (k Keeper) OrderBookParticipations(c context.Context, req *types.QueryOrderBookParticipationsRequest) (*types.QueryOrderBookParticipationsResponse, error)
- func (k Keeper) OrderBooks(c context.Context, req *types.QueryOrderBooksRequest) (*types.QueryOrderBooksResponse, error)
- func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ParticipationExposures(c context.Context, req *types.QueryParticipationExposuresRequest) (*types.QueryParticipationExposuresResponse, error)
- func (k Keeper) ParticipationFulfilledBets(c context.Context, req *types.QueryParticipationFulfilledBetsRequest) (*types.QueryParticipationFulfilledBetsResponse, error)
- func (k Keeper) ProcessWager(ctx sdk.Context, betUID, bookUID, oddsUID string, maxLossMultiplier sdk.Dec, ...) ([]*bettypes.BetFulfillment, error)
- func (k Keeper) RefundBettor(ctx sdk.Context, bettorAddress sdk.AccAddress, ...) error
- func (k Keeper) RemoveUnsettledResolvedOrderBook(ctx sdk.Context, orderBookUID string)
- func (k *Keeper) SetBetKeeper(betKeeper types.BetKeeper)
- func (k Keeper) SetHistoricalParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)
- func (k *Keeper) SetHooks(gh types.OrderBookHooks) *Keeper
- func (k *Keeper) SetHouseKeeper(houseKeeper types.HouseKeeper)
- func (k *Keeper) SetMarketKeeper(marketKeeper types.MarketKeeper)
- func (k *Keeper) SetOVMKeeper(ovmKeeper types.OVMKeeper)
- func (k Keeper) SetOrderBook(ctx sdk.Context, book types.OrderBook)
- func (k Keeper) SetOrderBookAsUnsettledResolved(ctx sdk.Context, orderBookUID string) error
- func (k Keeper) SetOrderBookOddsExposure(ctx sdk.Context, boe types.OrderBookOddsExposure)
- func (k Keeper) SetOrderBookParticipation(ctx sdk.Context, participation types.OrderBookParticipation)
- func (k Keeper) SetOrderBookStats(ctx sdk.Context, stats types.OrderBookStats)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetParticipationBetPair(ctx sdk.Context, bp types.ParticipationBetPair, betID uint64)
- func (k Keeper) SetParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)
- func (k Keeper) SetParticipationExposureByIndex(ctx sdk.Context, pe types.ParticipationExposure)
- func (k Keeper) SettledOrderBookParticipationsOfHeight(c context.Context, ...) (*types.QuerySettledOrderBookParticipationsOfHeightResponse, error)
- func (k Keeper) WithdrawBetFee(ctx sdk.Context, marketCreator sdk.AccAddress, betFee sdkmath.Int) error
- func (k Keeper) WithdrawOrderBookParticipation(ctx sdk.Context, marketUID string, participationIndex uint64, ...) error
- type SdkExpectedKeepers
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
Keeper of the orderbook store
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, ps paramtypes.Subspace, expectedKeepers SdkExpectedKeepers, ) *Keeper
NewKeeper creates a new orderbook Keeper instance
func (Keeper) BatchOrderBookSettlements ¶
BatchOrderBookSettlements settles order books
func (Keeper) BettorLoses ¶
func (k Keeper) BettorLoses( ctx sdk.Context, betFulfillments []*bettypes.BetFulfillment, orderBookUID string, ) error
BettorLoses process bets in case bettor loses, adds the bet amount to the actual profit of the participation for each of the bet fulfillment records and, removes the payout lock.
func (Keeper) BettorWins ¶
func (k Keeper) BettorWins( ctx sdk.Context, bettorAddress sdk.AccAddress, betFulfillments []*bettypes.BetFulfillment, orderBookUID string, ) error
BettorWins process bets in case bettor is the winner, transfers the bet amount and the payout profit to the bettor's account and, updates actual profit of the participation to the subtracted value from the payout profit.
func (Keeper) CalcWithdrawalAmount ¶ added in v0.0.8
func (Keeper) GetAllHistoricalParticipationExposures ¶
func (k Keeper) GetAllHistoricalParticipationExposures( ctx sdk.Context, ) (list []types.ParticipationExposure, err error)
GetAllHistoricalParticipationExposures returns all participation exposures used during genesis dump.
func (Keeper) GetAllOrderBookExposures ¶ added in v0.0.8
func (k Keeper) GetAllOrderBookExposures( ctx sdk.Context, ) (list []types.OrderBookOddsExposure, err error)
GetAllOrderBookExposures returns all order book exposures used during genesis dump.
func (Keeper) GetAllOrderBookParticipations ¶ added in v0.0.8
func (k Keeper) GetAllOrderBookParticipations( ctx sdk.Context, ) (list []types.OrderBookParticipation, err error)
GetAllOrderBookParticipations returns all book participations used during genesis dump.
func (Keeper) GetAllOrderBooks ¶ added in v0.0.8
GetAllOrderBooks returns all order books used during genesis dump.
func (Keeper) GetAllParticipationBetPair ¶
func (k Keeper) GetAllParticipationBetPair( ctx sdk.Context, ) (list []types.ParticipationBetPair, err error)
GetAllParticipationBetPair returns all participation bet pairs used during genesis dump.
func (Keeper) GetAllParticipationExposures ¶
func (k Keeper) GetAllParticipationExposures( ctx sdk.Context, ) (list []types.ParticipationExposure, err error)
GetAllParticipationExposures returns all participation exposures used during genesis dump.
func (Keeper) GetBatchSettlementCount ¶
GetBatchSettlementCount - number of deposits to be settled in end blocker.
func (Keeper) GetExposureByOrderBook ¶ added in v1.1.1
func (k Keeper) GetExposureByOrderBook( ctx sdk.Context, bookUID string, ) (peMap map[uint64]map[string]*types.ParticipationExposure, err error)
GetExposureByOrderBook returns all exposures for an order book uid.
func (Keeper) GetExposureByOrderBookAndOdds ¶ added in v0.0.8
func (k Keeper) GetExposureByOrderBookAndOdds( ctx sdk.Context, bookUID, oddsUID string, ) (list []types.ParticipationExposure, err error)
GetExposureByOrderBookAndOdds returns all exposures for an order book uid and odds uid.
func (Keeper) GetExposureByOrderBookAndParticipationIndex ¶ added in v0.0.8
func (k Keeper) GetExposureByOrderBookAndParticipationIndex( ctx sdk.Context, bookUID string, participationIndex uint64, ) (list []types.ParticipationExposure, err error)
GetExposureByOrderBookAndParticipationIndex returns all exposures for an order book uid and participation index.
func (Keeper) GetFirstUnsettledResolvedOrderBook ¶
GetFirstUnsettledResolvedOrderBook returns first element of resolved orderbook that have active deposits
func (Keeper) GetMaxOrderBookParticipationsAllowed ¶ added in v0.0.8
GetMaxOrderBookParticipationsAllowed - Max number of orderbook participations allowed.
func (Keeper) GetOddsExposuresByOrderBook ¶ added in v0.0.8
func (k Keeper) GetOddsExposuresByOrderBook( ctx sdk.Context, orderBookUID string, ) (list []types.OrderBookOddsExposure, err error)
GetOddsExposuresByOrderBook returns all exposures for an order book.
func (Keeper) GetOrderBook ¶ added in v0.0.8
func (k Keeper) GetOrderBook(ctx sdk.Context, orderBookUID string) (val types.OrderBook, found bool)
GetOrderBook returns a specific order book by its uid.
func (Keeper) GetOrderBookOddsExposure ¶ added in v0.0.8
func (k Keeper) GetOrderBookOddsExposure( ctx sdk.Context, orderBookUID, oddsUID string, ) (val types.OrderBookOddsExposure, found bool)
GetOrderBookOddsExposure returns a specific book odds exposure.
func (Keeper) GetOrderBookParticipation ¶ added in v0.0.8
func (k Keeper) GetOrderBookParticipation( ctx sdk.Context, bookUID string, index uint64, ) (val types.OrderBookParticipation, found bool)
GetOrderBookParticipation returns a specific participation of an order book by index.
func (Keeper) GetOrderBookStats ¶
func (k Keeper) GetOrderBookStats(ctx sdk.Context) (val types.OrderBookStats)
GetOrderBookStats returns order-book stats
func (Keeper) GetParticipationsOfOrderBook ¶ added in v0.0.8
func (k Keeper) GetParticipationsOfOrderBook( ctx sdk.Context, bookUID string, ) (list []types.OrderBookParticipation, err error)
GetParticipationsOfOrderBook returns all participations for an order book.
func (Keeper) GetRequeueThreshold ¶ added in v0.0.8
GetRequeueThreshold - threshold below which a participation is requeued in fullfillment queue.
func (Keeper) HistoricalParticipationExposures ¶
func (k Keeper) HistoricalParticipationExposures( c context.Context, req *types.QueryHistoricalParticipationExposuresRequest, ) (*types.QueryHistoricalParticipationExposuresResponse, error)
HistoricalParticipationExposures queries historical participation exposures info for given orderbook
func (Keeper) InitiateOrderBook ¶ added in v0.0.8
InitiateOrderBook initiates an order book for a given market.
func (Keeper) InitiateOrderBookParticipation ¶ added in v0.0.8
func (k Keeper) InitiateOrderBookParticipation( ctx sdk.Context, addr sdk.AccAddress, bookUID string, depositAmount, feeAmount sdkmath.Int, ) (index uint64, err error)
InitiateOrderBookParticipation starts a participation on a book for a certain account.
func (Keeper) MoveToHistoricalParticipationExposure ¶
func (k Keeper) MoveToHistoricalParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)
MoveToHistoricalParticipationExposure removes the participation exposures and indices and sets historical participation exposures.
func (Keeper) OrderBook ¶
func (k Keeper) OrderBook( c context.Context, req *types.QueryOrderBookRequest, ) (*types.QueryOrderBookResponse, error)
OrderBook queries orderbook info for given order book id
func (Keeper) OrderBookExposure ¶ added in v0.0.8
func (k Keeper) OrderBookExposure( c context.Context, req *types.QueryOrderBookExposureRequest, ) (*types.QueryOrderBookExposureResponse, error)
OrderBookExposure queries book exposure info for given order book id and odds id
func (Keeper) OrderBookExposures ¶ added in v0.0.8
func (k Keeper) OrderBookExposures( c context.Context, req *types.QueryOrderBookExposuresRequest, ) (*types.QueryOrderBookExposuresResponse, error)
OrderBookExposures queries exposures info for given orderbook
func (Keeper) OrderBookParticipation ¶ added in v0.0.8
func (k Keeper) OrderBookParticipation( c context.Context, req *types.QueryOrderBookParticipationRequest, ) (*types.QueryOrderBookParticipationResponse, error)
OrderBookParticipation queries book participation info for given order book id and participation index
func (Keeper) OrderBookParticipationExposures ¶ added in v0.0.8
func (k Keeper) OrderBookParticipationExposures( c context.Context, req *types.QueryOrderBookParticipationExposuresRequest, ) (*types.QueryOrderBookParticipationExposuresResponse, error)
OrderBookParticipationExposures queries participation exposures info for a given orderbook
func (Keeper) OrderBookParticipations ¶ added in v0.0.8
func (k Keeper) OrderBookParticipations( c context.Context, req *types.QueryOrderBookParticipationsRequest, ) (*types.QueryOrderBookParticipationsResponse, error)
OrderBookParticipations queries participation info for a given orderbook
func (Keeper) OrderBooks ¶
func (k Keeper) OrderBooks( c context.Context, req *types.QueryOrderBooksRequest, ) (*types.QueryOrderBooksResponse, error)
OrderBooks queries all order books that match the given status
func (Keeper) Params ¶
func (k Keeper) Params( c context.Context, req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error)
Params returns the params of the module
func (Keeper) ParticipationExposures ¶
func (k Keeper) ParticipationExposures( c context.Context, req *types.QueryParticipationExposuresRequest, ) (*types.QueryParticipationExposuresResponse, error)
ParticipationExposures queries participation exposure info for given order book id and participation index
func (Keeper) ParticipationFulfilledBets ¶
func (k Keeper) ParticipationFulfilledBets( c context.Context, req *types.QueryParticipationFulfilledBetsRequest, ) (*types.QueryParticipationFulfilledBetsResponse, error)
ParticipationFulfilledBets queries participation fulfilled bets info for given order book id and participation index
func (Keeper) ProcessWager ¶ added in v1.0.1
func (k Keeper) ProcessWager( ctx sdk.Context, betUID, bookUID, oddsUID string, maxLossMultiplier sdk.Dec, betAmount sdkmath.Int, payoutProfit sdk.Dec, bettorAddress sdk.AccAddress, betFee sdkmath.Int, oddsVal string, betID uint64, odds map[string]*bettypes.BetOddsCompact, oddUIDS []string, ) ([]*bettypes.BetFulfillment, error)
ProcessWager processes bet placement
func (Keeper) RefundBettor ¶
func (k Keeper) RefundBettor( ctx sdk.Context, bettorAddress sdk.AccAddress, betAmount, betFee, _ sdkmath.Int, _ string, ) error
RefundBettor process bets in case market gets cancelled or aborted, this method transfers the bet amount from order book liquidity module account balance to the bettor account balance.
func (Keeper) RemoveUnsettledResolvedOrderBook ¶
RemoveUnsettledResolvedOrderBook removes resolved order-book from the statistics
func (*Keeper) SetBetKeeper ¶
SetBetKeeper sets the bet module keeper to the order book keeper.
func (Keeper) SetHistoricalParticipationExposure ¶
func (k Keeper) SetHistoricalParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)
SetHistoricalParticipationExposure sets a historical participation exposure.
func (*Keeper) SetHooks ¶ added in v1.3.0
func (k *Keeper) SetHooks(gh types.OrderBookHooks) *Keeper
SetHooks sets the hooks for governance
func (*Keeper) SetHouseKeeper ¶ added in v0.0.8
func (k *Keeper) SetHouseKeeper(houseKeeper types.HouseKeeper)
SetHouseKeeper sets the market module keeper to the order book keeper.
func (*Keeper) SetMarketKeeper ¶ added in v0.0.8
func (k *Keeper) SetMarketKeeper(marketKeeper types.MarketKeeper)
SetMarketKeeper sets the market module keeper to the order book keeper.
func (*Keeper) SetOVMKeeper ¶ added in v0.0.8
SetOVMKeeper sets the ovm module keeper to the market keeper.
func (Keeper) SetOrderBook ¶ added in v0.0.8
SetOrderBook sets an order book.
func (Keeper) SetOrderBookAsUnsettledResolved ¶ added in v0.0.8
SetOrderBookAsUnsettledResolved sets the orderbook as settled.
func (Keeper) SetOrderBookOddsExposure ¶ added in v0.0.8
func (k Keeper) SetOrderBookOddsExposure(ctx sdk.Context, boe types.OrderBookOddsExposure)
SetOrderBookOddsExposure sets a book odds exposure.
func (Keeper) SetOrderBookParticipation ¶ added in v0.0.8
func (k Keeper) SetOrderBookParticipation(ctx sdk.Context, participation types.OrderBookParticipation)
SetOrderBookParticipation sets a book participation.
func (Keeper) SetOrderBookStats ¶
func (k Keeper) SetOrderBookStats(ctx sdk.Context, stats types.OrderBookStats)
SetOrderBookStats sets bet statistics in the store
func (Keeper) SetParticipationBetPair ¶
func (k Keeper) SetParticipationBetPair(ctx sdk.Context, bp types.ParticipationBetPair, betID uint64)
SetParticipationBetPair sets a participation bet pair.
func (Keeper) SetParticipationExposure ¶
func (k Keeper) SetParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)
SetParticipationExposure sets a participation exposure.
func (Keeper) SetParticipationExposureByIndex ¶
func (k Keeper) SetParticipationExposureByIndex(ctx sdk.Context, pe types.ParticipationExposure)
SetParticipationExposureByIndex sets a participation exposure by index.
func (Keeper) SettledOrderBookParticipationsOfHeight ¶ added in v1.4.5
func (k Keeper) SettledOrderBookParticipationsOfHeight( c context.Context, req *types.QuerySettledOrderBookParticipationsOfHeightRequest, ) (*types.QuerySettledOrderBookParticipationsOfHeightResponse, error)
SettledOrderBookParticipationsOfHeight returns settled orderbook participations of a certain height
func (Keeper) WithdrawBetFee ¶ added in v0.0.8
type SdkExpectedKeepers ¶
type SdkExpectedKeepers struct { BankKeeper types.BankKeeper AccountKeeper types.AccountKeeper FeeGrantKeeper types.FeeGrantKeeper }
SdkExpectedKeepers contains expected keepers parameter needed by NewKeeper
Source Files ¶
- bet_settle.go
- bet_wager.go
- exposure_odds.go
- exposure_participation.go
- fund.go
- grpc_query.go
- grpc_query_exposure_odds.go
- grpc_query_exposure_participation.go
- grpc_query_orderbook.go
- grpc_query_params.go
- grpc_query_participation.go
- grpc_query_participation_bet.go
- keeper.go
- market.go
- orderbook.go
- orderbook_settle.go
- params.go
- participation.go
- participation_bet.go
- stats.go
- view.go