keeper

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTextInvalidRequest = consts.ErrTextInvalidRequest
	ErrTextNilReserver    = "stored reserver should not have been nil"
)

nolint

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the bank MsgServer interface for the provided Keeper.

Types

type ExpectedKeepers

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

ExpectedKeepers contains expected keepers parameter needed by NewKeeper

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper is the type for module properties

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey sdk.StoreKey,
	ps paramtypes.Subspace,
	expectedKeepers ExpectedKeepers,
) *Keeper

NewKeeper returns a new keeper object

func (Keeper) AcceptRewards

func (k Keeper) AcceptRewards(ctx sdk.Context, senderModuleAccName string,
	rewardAmount sdk.Int) error

AcceptRewards gets rewards from module account and transfer to SRPool module account

func (Keeper) BettorLoses

func (k Keeper) BettorLoses(ctx sdk.Context, address sdk.AccAddress,
	betAmount sdk.Int, extraPayout sdk.Int, uniqueLock string) error

BettorLoses unlocks the extra payout in the `sr_pool`. It transfers the bet amount (house winnings) from the `bet_reserve` to the `winnings_collector` module account of SR. It should be called when the bettor loses the bet. payout = bet amount * odds value extra payout = payout - bet amount

func (Keeper) BettorWins

func (k Keeper) BettorWins(
	ctx sdk.Context,
	bettorAddress sdk.AccAddress,
	betAmount sdk.Int,
	extraPayout sdk.Int,
	uniqueLock string,
) error

BettorWins pays the payout to the bettor from the `bet_reserve` of the SR. Also, it transfers the extra payout locked in the `sr_pool` to the `bet_reserve`. It should be called when the bettor wins the bet. payout = bet amount * odds value extra payout = payout - bet amount

func (Keeper) DepositDenom

func (k Keeper) DepositDenom(ctx sdk.Context) (res string)

DepositDenom returns deposit coin denomination

func (Keeper) GetBetReserveAcc

func (k Keeper) GetBetReserveAcc(ctx sdk.Context) authtypes.ModuleAccountI

GetBetReserveAcc returns the `bet_reserve` module account

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetReserver

func (k Keeper) GetReserver(ctx sdk.Context) (reserver types.Reserver)

GetReserver returns the reserver

func (Keeper) GetSRPoolAcc

func (k Keeper) GetSRPoolAcc(ctx sdk.Context) authtypes.ModuleAccountI

GetSRPoolAcc returns the `sr_pool` module account

func (Keeper) GetSRPoolBalance

func (k Keeper) GetSRPoolBalance(ctx sdk.Context) sdk.Coin

GetSRPoolBalance returns the balance of `sr_pool` module account

func (Keeper) GetWinningsCollectorAcc

func (k Keeper) GetWinningsCollectorAcc(ctx sdk.Context) authtypes.ModuleAccountI

GetWinningsCollectorAcc returns the `winnings_collector` module account

func (Keeper) Logger

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

Logger returns a logger for logging error/debug/info logs

func (Keeper) Params

Params returns the Params for the strategic reserve

func (Keeper) ProcessBetPlacement

func (k Keeper) ProcessBetPlacement(
	ctx sdk.Context,
	bettorAddress sdk.AccAddress,
	betFee sdk.Coin,
	betAmount sdk.Int,
	extraPayout sdk.Int,
	uniqueLock string,
	endTs uint64,
) error

ProcessBetPlacement transfers the bet fee from the bettor's account to the bet module account and the bet amount from the given bettor's account to the `bet_reserve` account of SR and locks the extra payout in the `sr_pool` account of SR. payout = bet amount * odds value extra payout = payout - bet amount

func (Keeper) RefundBettor

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

RefundBettor refunds back the bet amount from the `bet_reserve` to the bettor in case a sports event gets cancelled or aborted. It should be called when a sports event is cancelled or aborted and the bet amount needs to be refunded back to the bettor. payout = bet amount * odds value extra payout = payout - bet amount

func (Keeper) Reserver

Reserver returns current reserver.

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetReserver

func (k Keeper) SetReserver(ctx sdk.Context, reserver types.Reserver)

SetReserver sets the reserver

Jump to

Keyboard shortcuts

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