keeper

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) BettorLoses

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

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

func (Keeper) BettorWins

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

BettorWins pays the payout to the bettor from the `bet_reserve` of the SR. Also, it transfers the payout profit locked in the `sr_pool` to the `bet_reserve`. It should be called when the bettor wins the bet. payout = bet amount * odds value payout profit = 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) 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.Int,
	betAmount sdk.Int,
	payoutProfit sdk.Int,
	uniqueLock string,
) 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 payout profit (or SR's contribution) in the `sr_pool` account of SR. payout = bet amount * odds value payout profit = payout - bet amount

func (Keeper) RefundBettor

func (k Keeper) RefundBettor(ctx sdk.Context, bettorAddress sdk.AccAddress,
	betAmount sdk.Int, payoutProfit 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 payout profit = 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