keeper

package
v0.0.0-...-cc252f9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	QueryTodayCoinPrices = "today-coin-prices"
	QueryInfo            = "info"
	QueryDayInfo         = "day-info"
)

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries.

Types

type DayInfo

type DayInfo struct {
	GrandPrizeAmount uint64 `json:"grandPrizeAmount"`
	// AtomPriceUSD     uint64   `json:"atomPriceUSD"`
	CoinsPerf   []int64  `json:"coinsPerf"`
	CoinsVolume []uint64 `json:"coinsVolume"`
	State       uint8    `json:"state"`
}

type Info

type Info struct {
	FirstDay uint64 `json:"firstDay"`
}

type Keeper

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

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, bankKeeper types.BankKeeper,
	channelKeeper types.ChannelKeeper,
) Keeper

NewKeeper creates a new band consumer Keeper instance.

func (Keeper) AppendTodayCoinPrice

func (k Keeper) AppendTodayCoinPrice(ctx sdk.Context, coinId int64, price int64)

Append price to existing list of prices of a coin

func (Keeper) EscrowBetCollateral

func (k Keeper) EscrowBetCollateral(ctx sdk.Context, buyer sdk.AccAddress, amount sdk.Coins) error

func (Keeper) GetChannel

func (k Keeper) GetChannel(ctx sdk.Context, chainName string, port string) (string, error)

func (Keeper) GetDayCoinBettorAmount

func (k Keeper) GetDayCoinBettorAmount(ctx sdk.Context, dayId int64, coinId int64, bettor string) int64

func (Keeper) GetDayCoinBettorPaid

func (k Keeper) GetDayCoinBettorPaid(ctx sdk.Context, dayId int64, coinId int64, bettor string) bool

func (Keeper) GetDayCoinInfo

func (k Keeper) GetDayCoinInfo(ctx sdk.Context, dayId int64, coinId int64) *types.BetDayCoin

func (Keeper) GetDayCoinPrices

func (k Keeper) GetDayCoinPrices(ctx sdk.Context, dayId int64, coinId int64) []int64

Get list of all prices of a coin in a particular day

func (Keeper) GetDayCoinRanking

func (k Keeper) GetDayCoinRanking(ctx sdk.Context, dayId int64) []uint8

func (Keeper) GetDayInfo

func (k Keeper) GetDayInfo(ctx sdk.Context, dayId int64) *types.BetDay

func (Keeper) GetDayState

func (k Keeper) GetDayState(ctx sdk.Context, dayId int64) uint8

func (Keeper) GetDayWinAmount

func (k Keeper) GetDayWinAmount(ctx sdk.Context, dayId int64, winningCoinId int64, bettor string) int64

Todo: better algo that also takes into account the other coins

func (Keeper) GetLatestCoinPrice

func (k Keeper) GetLatestCoinPrice(ctx sdk.Context, coinId int64) int64

Get last price of a coin

func (Keeper) GetTotalBetsAmount

func (k Keeper) GetTotalBetsAmount(ctx sdk.Context) int64

func (Keeper) GetTotalWinsAmount

func (k Keeper) GetTotalWinsAmount(ctx sdk.Context) int64

func (Keeper) GetWinningDayCoinId

func (k Keeper) GetWinningDayCoinId(ctx sdk.Context, dayId int64) uint8

func (Keeper) HasChannel

func (k Keeper) HasChannel(ctx sdk.Context, chainName string, port string) bool

func (Keeper) Payout

func (k Keeper) Payout(ctx sdk.Context, buyer sdk.AccAddress, amount sdk.Coins)

func (Keeper) SetChannel

func (k Keeper) SetChannel(ctx sdk.Context, chainName string, port string, channel string)

func (Keeper) SetDayCoinBettorAmount

func (k Keeper) SetDayCoinBettorAmount(ctx sdk.Context, dayId int64, coinId int64, bettor string, amount int64)

func (Keeper) SetDayCoinBettorPaid

func (k Keeper) SetDayCoinBettorPaid(ctx sdk.Context, dayId int64, coinId int64, bettor string, paid bool)

func (Keeper) SetDayCoinInfo

func (k Keeper) SetDayCoinInfo(ctx sdk.Context, dayId int64, coinId int64, dayCoin *types.BetDayCoin)

func (Keeper) SetDayCoinPrices

func (k Keeper) SetDayCoinPrices(ctx sdk.Context, dayId int64, coinId int64, prices []int64)

Set prices of a coin in a particular day

func (Keeper) SetDayInfo

func (k Keeper) SetDayInfo(ctx sdk.Context, dayId int64, day *types.BetDay)

func (Keeper) SetLatestCoinPrice

func (k Keeper) SetLatestCoinPrice(ctx sdk.Context, coinId int64, price int64)

Store last price of a coin

func (Keeper) SetTotalBetsAmount

func (k Keeper) SetTotalBetsAmount(ctx sdk.Context, amount int64)

func (Keeper) SetTotalWinsAmount

func (k Keeper) SetTotalWinsAmount(ctx sdk.Context, amount int64)

type MyDayInfo

type MyDayInfo struct {
	CoinBetTotalAmount []uint64 `json:"coinBetTotalAmount"`
	TotalBetAmount     uint64   `json:"totalBetAmount"`
	TotalWinAmount     uint64   `json:"totalWinAmount"`
	Paid               bool     `json:"paid"`
}

type MyInfo

type MyInfo struct {
	TotalBetsAmount uint64 `json:"totalBetsAmount"`
	TotalWinsAmount uint64 `json:"totalWinsAmount"`
}

Jump to

Keyboard shortcuts

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