keeper

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

type Keeper struct {
	BetKeeper types.BetKeeper
	// contains filtered or unexported fields
}

keeper of the strategicreserve store

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key sdk.StoreKey,
	ps paramtypes.Subspace,
	expectedKeepers SdkExpectedKeepers,
) *Keeper

NewKeeper creates a new strategicreserve Keeper instance

func (Keeper) BatchOrderBookSettlements added in v0.0.6

func (k Keeper) BatchOrderBookSettlements(ctx sdk.Context) error

BatchOrderBookSettlements settles order books

func (Keeper) BettorLoses

func (k Keeper) BettorLoses(ctx sdk.Context, address sdk.AccAddress,
	betAmount sdk.Int,
	payoutProfit sdk.Int,
	uniqueLock string,
	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 fulfillemnt records and, removes the payout lock.

func (Keeper) BettorWins

func (k Keeper) BettorWins(
	ctx sdk.Context,
	bettorAddress sdk.AccAddress,
	betAmount sdk.Int,
	payoutProfit sdk.Int,
	uniqueLock string,
	betFulfillments []*bettypes.BetFulfillment,
	orderBookUID string,
) (err 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) GetAllHistoricalParticipationExposures added in v0.0.6

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.6

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.6

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.6

func (k Keeper) GetAllOrderBooks(ctx sdk.Context) (list []types.OrderBook, err error)

GetAllOrderBooks returns all order books used during genesis dump.

func (Keeper) GetAllParticipationBetPair added in v0.0.6

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 added in v0.0.6

func (k Keeper) GetAllParticipationExposures(ctx sdk.Context) (list []types.ParticipationExposure, err error)

GetAllParticipationExposures returns all participation exposures used during genesis dump.

func (Keeper) GetAllPayoutLock added in v0.0.6

func (k Keeper) GetAllPayoutLock(ctx sdk.Context) (list [][]byte, err error)

GetAllPayoutLock returns all payout locks used during genesis dump.

func (Keeper) GetBatchSettlementCount added in v0.0.6

func (k Keeper) GetBatchSettlementCount(ctx sdk.Context) (res uint64)

GetBatchSettlementCount - number of deposits to be settled in end blocker.

func (Keeper) GetExposureByOrderBookAndOdds added in v0.0.6

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.6

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 added in v0.0.6

func (k Keeper) GetFirstUnsettledResolvedOrderBook(ctx sdk.Context) (string, bool)

GetFirstUnsettledResolvedOrderBook returns first element of resolved strategicreserve that have active deposits

func (Keeper) GetMaxOrderBookParticipationsAllowed added in v0.0.6

func (k Keeper) GetMaxOrderBookParticipationsAllowed(ctx sdk.Context) (res uint64)

GetMaxOrderBookParticipationsAllowed - Max number of book participations allowed.

func (Keeper) GetOddsExposuresByOrderBook added in v0.0.6

func (k Keeper) GetOddsExposuresByOrderBook(ctx sdk.Context, bookUID string) (list []types.OrderBookOddsExposure, err error)

GetOddsExposuresByOrderBook returns all exposures for an order book.

func (Keeper) GetOrderBook added in v0.0.6

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.6

func (k Keeper) GetOrderBookOddsExposure(ctx sdk.Context, bookUID, oddsUID string) (val types.OrderBookOddsExposure, found bool)

GetOrderBookOddsExposure returns a specific book odds exposure.

func (Keeper) GetOrderBookParticipation added in v0.0.6

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 added in v0.0.6

func (k Keeper) GetOrderBookStats(ctx sdk.Context) (val types.OrderBookStats)

GetOrderBookStats returns order-book stats

func (Keeper) GetParams

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

Get all parameters as types.Params

func (Keeper) GetParticipationsOfOrderBook added in v0.0.6

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.7

func (k Keeper) GetRequeueThreshold(ctx sdk.Context) (res uint64)

GetRequeueThreshold - threshold below which a participation is requeued in fullfillment queue.

func (Keeper) HistoricalParticipationExposures added in v0.0.6

HistoricalParticipationExposures queries historical participation exposures info for given strategicreserve

func (Keeper) InitiateOrderBook added in v0.0.6

func (k Keeper) InitiateOrderBook(ctx sdk.Context, marketUID string, srContribution sdk.Int, oddsUIDs []string) (err error)

InitiateOrderBook initiates an order book for a given market.

func (Keeper) InitiateOrderBookParticipation added in v0.0.6

func (k Keeper) InitiateOrderBookParticipation(
	ctx sdk.Context, addr sdk.AccAddress, bookUID string, liquidity, fee sdk.Int,
) (index uint64, err error)

InitiateOrderBookParticipation starts a participation on a book for a certain account.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns the logger of the keeper

func (Keeper) MoveToHistoricalParticipationExposure added in v0.0.6

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 added in v0.0.6

OrderBook queries strategicreserve info for given order book id

func (Keeper) OrderBookExposure added in v0.0.6

OrderBookExposure queries book exposure info for given order book id and odds id

func (Keeper) OrderBookExposures added in v0.0.6

OrderBookExposures queries exposures info for given strategicreserve

func (Keeper) OrderBookParticipation added in v0.0.6

OrderBookParticipation queries book participation info for given order book id and participation index

func (Keeper) OrderBookParticipations added in v0.0.6

OrderBookParticipations queries participations info for given strategicreserve

func (Keeper) OrderBooks added in v0.0.6

OrderBooks queries all order books that match the given status

func (Keeper) Params

Params returns the params of the module

func (Keeper) ParticipationExposure added in v0.0.6

ParticipationExposure queries participation exposure info for given order book id and participation index

func (Keeper) ParticipationExposures added in v0.0.6

ParticipationExposures queries participation exposures info for given strategicreserve

func (Keeper) ParticipationFulfilledBets added in v0.0.6

ParticipationFulfilledBets queries participation fulfilled bets info for given order book id and participation index

func (Keeper) ProcessBetPlacement

func (k Keeper) ProcessBetPlacement(
	ctx sdk.Context,
	betUID, bookUID, oddsUID string,
	maxLossMultiplier sdk.Dec,
	betAmount sdk.Int,
	payoutProfit sdk.Dec,
	bettorAddress sdk.AccAddress,
	betFee sdk.Int,
	oddsType bettypes.OddsType,
	oddsVal string, betID uint64,
) ([]*bettypes.BetFulfillment, error)

ProcessBetPlacement processes bet placement

func (Keeper) RefundBettor

func (k Keeper) RefundBettor(
	ctx sdk.Context,
	bettorAddress sdk.AccAddress,
	betAmount, payout sdk.Int,
	uniqueLock string,
) (err error)

RefundBettor process bets in case market gets cancelled or aborted, this method transfers th bet amount from order book liquidity module account balance to the bettor account balance.

func (Keeper) RemoveUnsettledResolvedOrderBook added in v0.0.6

func (k Keeper) RemoveUnsettledResolvedOrderBook(ctx sdk.Context, orderBookUID string)

RemoveUnsettledResolvedOrderBook removes resolved order-book from the statistics

func (*Keeper) SetBetKeeper added in v0.0.6

func (k *Keeper) SetBetKeeper(betKeeper types.BetKeeper)

SetBetKeeper sets the bet module keeper to the order book keeper.

func (Keeper) SetHistoricalParticipationExposure added in v0.0.6

func (k Keeper) SetHistoricalParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)

SetHistoricalParticipationExposure sets a historical participation exposure.

func (*Keeper) SetMarketKeeper added in v0.0.6

func (k *Keeper) SetMarketKeeper(marketKeeper types.MarketKeeper)

SetMarketKeeper sets the market module keeper to the order book keeper.

func (Keeper) SetOrderBook added in v0.0.6

func (k Keeper) SetOrderBook(ctx sdk.Context, book types.OrderBook)

SetOrderBook sets an order book.

func (Keeper) SetOrderBookAsSettled added in v0.0.6

func (k Keeper) SetOrderBookAsSettled(ctx sdk.Context, orderBookUID string) error

SetOrderBookAsSettled sets the orderbook as settled.

func (Keeper) SetOrderBookOddsExposure added in v0.0.6

func (k Keeper) SetOrderBookOddsExposure(ctx sdk.Context, boe types.OrderBookOddsExposure)

SetOrderBookOddsExposure sets a book odds exposure.

func (Keeper) SetOrderBookParticipation added in v0.0.6

func (k Keeper) SetOrderBookParticipation(ctx sdk.Context, participation types.OrderBookParticipation)

SetOrderBookParticipation sets a book participation.

func (Keeper) SetOrderBookStats added in v0.0.6

func (k Keeper) SetOrderBookStats(ctx sdk.Context, stats types.OrderBookStats)

SetOrderBookStats sets bet statistics in the store

func (Keeper) SetParams

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

set the params

func (Keeper) SetParticipationBetPair added in v0.0.6

func (k Keeper) SetParticipationBetPair(ctx sdk.Context, bp types.ParticipationBetPair, betID uint64)

SetParticipationBetPair sets a participation bet pair.

func (Keeper) SetParticipationExposure added in v0.0.6

func (k Keeper) SetParticipationExposure(ctx sdk.Context, pe types.ParticipationExposure)

SetParticipationExposure sets a participation exposure.

func (Keeper) SetParticipationExposureByIndex added in v0.0.6

func (k Keeper) SetParticipationExposureByIndex(ctx sdk.Context, pe types.ParticipationExposure)

SetParticipationExposureByIndex sets a participation exposure by index.

func (Keeper) SetPayoutLock added in v0.0.6

func (k Keeper) SetPayoutLock(ctx sdk.Context, uniqueLock string)

SetPayoutLock sets a lock for the payout element

func (Keeper) WithdrawOrderBookParticipation added in v0.0.6

func (k Keeper) WithdrawOrderBookParticipation(
	ctx sdk.Context, depositorAddr, bookUID string, participationIndex uint64, mode housetypes.WithdrawalMode, amount sdk.Int,
) (sdk.Int, error)

WithdrawOrderBookParticipation withdraws the order book participation to the bettor's account

type SdkExpectedKeepers added in v0.0.6

type SdkExpectedKeepers struct {
	BankKeeper    types.BankKeeper
	AccountKeeper types.AccountKeeper
}

SdkExpectedKeepers contains expected keepers parameter needed by NewKeeper

Jump to

Keyboard shortcuts

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