prediction

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 40 Imported by: 1

Documentation

Index

Constants

View Source
const (
	PredictSCID  = "eaa62b220fa1c411785f43c0c08ec59c761261cb58a0ccedc5b358e5ed2d2c95"
	PPredictSCID = "e5e49c9a6dc1c0dc8a94429a01bf758e705de49487cbd0b3e3550648d2460cdf"
	SportsSCID   = "ad11377c29a863523c1cc50a33ca13e861cc146a7c0496da58deaa1973e0a39f"
	PSportsSCID  = "fffdc4ea6d157880841feab335ab4755edcde4e60fec2fff661009b16f44fa94"
)
View Source
const PAYLOAD_FORMAT = uint64(1728000)

block height of last payload format change

Variables

View Source
var Imported bool
View Source
var Predict predictObjects
View Source
var PrintColor printColors
View Source
var Service service
View Source
var Sports sportsItems

Functions

func AddOwner

func AddOwner(scid, addr string)

Owner can add new co-owner to bet SC

  • addr of new co-owner

func AutoBook

func AutoBook(amt, pre, src uint64, n, abv, scid, addr, book_tx string) (tx string)

dService sports book by received tx

  • amt to send
  • pre is what team
  • n is the game number
  • addr of placed bet and to send reply message
  • src, abv and tx used in reply message

func AutoPredict

func AutoPredict(p int, amt, src uint64, scid, addr, pre_tx string) (tx string)

dService prediction place by received tx

  • amt to send
  • p is what prediction
  • addr of placed bet and to send reply message
  • src and pre_tx used in reply message

func CancelInitiatedBet

func CancelInitiatedBet(scid string, b int)

Owner cancel for initiated bet for dSports and dPrediction contracts

  • b defines sports or prediction log print

func CheckActiveGames

func CheckActiveGames(scid string) bool

Check for live dSports on SCID

func CheckActivePrediction

func CheckActivePrediction(scid string) bool

Check if dPrediction is live on SCID

func CheckBetContractOwners

func CheckBetContractOwners(contracts map[string]string)

Scan all bet contracts to verify if owner

  • Pass contracts from db store, can be nil arg

func CheckPredictionStatus

func CheckPredictionStatus()

Check dPrediction SCID for live status

func ConfirmAction

func ConfirmAction(i int, teamA, teamB string, d *dreams.AppObject)

dSports and dPrediction action confirmation

  • i defines the action to be confirmed
  • teamA, teamB needed only for dSports confirmations

func Disconnected

func Disconnected()

Do this when disconnected

func DreamsMenuIntro

func DreamsMenuIntro() (entries map[string][]string)

func EndPrediction

func EndPrediction(scid string, price int) (tx string)

dPrediction SC payout

  • price is final prediction results

func EndSports

func EndSports(scid, num, team string) (tx string)

dSports SC payout

  • num is game number
  • team is winning team for game number

func FetchPredictionFinal

func FetchPredictionFinal(scid string) (txid string)

Get dPrediction final TXID

func GetActiveGames

func GetActiveGames()

Check dSports SCID for active games

func GetBaseball

func GetBaseball(date, league string)

Gets baseball games for selected league and adds to options selection

  • date GetCurrentWeek()

func GetBasketball

func GetBasketball(date, league string)

Gets basketball games for selected league and adds to options selection

  • date GetCurrentWeek()

func GetBook

func GetBook(scid string) (info string)

Gets dSports data from SCID and return formatted info string

func GetCurrentMonth

func GetCurrentMonth(league string)

Gets the games of league for following month

func GetCurrentWeek

func GetCurrentWeek(league string)

Gets the games of league for following week

func GetFootball

func GetFootball(date, league string)

Gets football games for selected league and adds to options selection

  • date GetCurrentWeek()

func GetGameEnd

func GetGameEnd(date, game, league string)

Find and display the end time of selected game

func GetHockey

func GetHockey(date, league string)

Gets hockey games for selected league and date

func GetMma

func GetMma(date, league string)

Gets mma matches for selected league and adds to options selection

  • date GetCurrentMonth()

func GetMmaResults

func GetMmaResults(label *widget.Label, league string)

Get final result of mma league and display info

  • Pass label for display info

func GetMmaWinner

func GetMmaWinner(game, league, game_date string, diff int) (win string, fighter string)

Gets and returns the winner of mma match

  • league defines api prefix

func GetPredictCode

func GetPredictCode(pub int) string

Get dPrediction SC code for public and private SC

  • pub 1 defines private SC, else public

func GetPrediction

func GetPrediction(scid string) (info string)

Gets dPrediction data from SCID and return formatted info string

func GetScores

func GetScores(label *widget.Label, league string)

Gets past game scores for league and display info

  • Pass label for display info

func GetSoccer

func GetSoccer(date, league string)

Gets hockey games for selected league and adds to options selection

  • date GetCurrentWeek()

func GetSportsAmt

func GetSportsAmt(scid, n string) uint64

func GetSportsCode

func GetSportsCode(pub int) string

Get dSports SC code for public and private SC

  • pub 1 defines private SC, else public

func GetSportsFinals added in v0.3.1

func GetSportsFinals(scid string) (text string)

func GetSportsTeams

func GetSportsTeams(scid, n string) (string, string)

Get current dSports game teams

func GetWinner

func GetWinner(game, league, game_date string, diff int) (win string, team_name string, a_score string, b_score string)

Gets and returns the winner of game

  • league defines api prefix

func LayoutPredictItems

func LayoutPredictItems(d *dreams.AppObject) *fyne.Container

dPrediction tab layout

func LayoutSportsItems

func LayoutSportsItems(d *dreams.AppObject) *fyne.Container

dSports tab layout

func MakeIntegratedAddr

func MakeIntegratedAddr(print bool)

Prepare and display all integrated addresses for live dSports or dPrediction contract owned by wallet

  • print for debug

func P_initResults

func P_initResults(p, amt, eA, c, to, u, d, r, f, m string, ta, tb, tc int) (info string)

Formats initialized dPrediction info string

  • p defines prediction
  • amt is Dero value
  • eA is prediction end time
  • c is number of current predictions
  • to is current total prediction Dero pot value
  • u is higher predictions
  • d is lower predictions
  • r is total completed prediction rounds
  • f is prediction feed
  • m is prediction mark
  • ta, tb, tc are current contract time frames

func P_no_initResults

func P_no_initResults(fr, tx, r, m string) (info string)

Formats non-initialized dPrediction info string

  • fr is the un-split result string
  • tx is the previous payout TXID
  • r is total completed prediction rounds
  • m is prediction mark

func PickTeam

func PickTeam(scid, multi, n string, a uint64, pick int) (tx string)

Book sports team on dSports SC

  • multi defines 1x, 3x or 5x the minimum
  • n is the game number
  • a is amount to book
  • pick is team to book

func PopulatePredictions

func PopulatePredictions(contracts map[string]string)

Populate all dReams dPrediction contracts

  • Pass contracts from db store, can be nil arg

func PopulateSports

func PopulateSports(contracts map[string]string)

Populate all dReams dSports contracts

  • Pass contracts from db store, can be nil arg

func PostPrediction

func PostPrediction(scid string, price int) (tx string)

Post mark to prediction SC

  • price is the posted mark for prediction

func PredictConnectedBox

func PredictConnectedBox() fyne.Widget

Check box for dPrediction SCID

  • Hides prediction controls on disconnect

func PredictHigher

func PredictHigher(scid, addr string) (tx string)

Place higher prediction to SC

  • addr only needed if dService is placing prediction

func PredictLower

func PredictLower(scid, addr string) (tx string)

Place lower prediction to SC

  • addr only needed if dService is placing prediction

func PredictionContractEntry

func PredictionContractEntry() fyne.Widget

Entry for dPrediction SCID

  • Bound to Predict.Settings.SCID
  • Checks for valid SCID on changed

func PredictionFavorites

func PredictionFavorites() fyne.CanvasObject

List object for populating favorite dPrediction contracts, with remove favorite control

func PredictionListings

func PredictionListings(d *dreams.AppObject) fyne.CanvasObject

List object for populating public dPrediction contracts, with rating and add favorite controls

  • Pass tab for action confirmation reset

func PredictionOwned

func PredictionOwned() fyne.CanvasObject

List object for populating owned dPrediction contracts

func PredictionRefresh

func PredictionRefresh(p *dreams.ContainerStack, d *dreams.AppObject)

Refresh all dPrediction objects

func PredictionRefund

func PredictionRefund(scid, tic string)

User can refund a void dPrediction payout from SC

  • tic is the prediction id string

func RemoveOwner

func RemoveOwner(scid string, num int)

Owner can remove co-owner from bet SC

  • num defines which co-owner to remove

func RunService

func RunService(start uint64, payouts, transfers bool)

Main dService routine

  • start defines service starting height
  • payouts, transfers for service params

func S_Results

func S_Results(g, gN, l, min, eA, c, tA, tB, tAV, tBV, total string, a, b uint64) (info string)

Formats dSports info string

  • g is game name
  • gN is game number
  • l is league
  • min is minimum Dero wager
  • eA is game end time
  • c is current number of picks
  • tA, tB are team names of A and B
  • tAV, tBV is total picks for A or B
  • total is current game Dero pot total
  • a, b are current contract time frames

func ServiceIndicator

func ServiceIndicator() (ind menu.DreamsIndicator)

Ui indictor when dService is running

func ServiceRefund

func ServiceRefund(amt, src uint64, scid, addr, msg, refund_tx string) (tx string)

dService refund if bet void

  • amt to send
  • addr to send refund to
  • src, msg and refund_tx used in reply message

func SetPrediction

func SetPrediction(end, mark int, amt, dep uint64, scid, predict, feed string)

Owner sets up a dPrediction prediction

  • end is unix ending time
  • mark can be predefined or passed as 0 if mark is to be posted live
  • amt of single prediction
  • dep allows owner to add a initial deposit
  • predict is name of what is being predicted
  • feed defines where price api data is sourced from

func SetPredictionInfo

func SetPredictionInfo(scid string)

Sets dPrediction info label

func SetPredictionPrices

func SetPredictionPrices(d bool)

Update price feed for dPrediction display

func SetPrintColors

func SetPrintColors(os string)

Set up terminal log print colors

func SetSports

func SetSports(end int, amt, dep uint64, scid, league, game, feed string) (tx string)

Owner sets a dSports game

  • end is unix ending time
  • amt of single prediction
  • dep allows owner to add a initial deposit
  • game is name of game, formatted TEAM--TEAM
  • feed defines where price api data is sourced from

func SetSportsInfo

func SetSportsInfo(scid string)

Set dSports info label

func ShowPredictionControls

func ShowPredictionControls()

When called, enable and show dPrediction controls

func SportsConnectedBox

func SportsConnectedBox() fyne.Widget

Check box for dSports SCID

  • Hides sports controls on disconnect

func SportsContractEntry

func SportsContractEntry() fyne.Widget

Entry for dPrediction SCID

  • Bound to Sports.Contract.SCID
  • Checks for valid SCID on changed

func SportsFavorites

func SportsFavorites() fyne.CanvasObject

List object for populating favorite dSports contracts, with remove favorite control

func SportsListings

func SportsListings(d *dreams.AppObject) fyne.CanvasObject

List object for populating public dSports contracts, with rating and add favorite controls

  • Pass tab for action confirmation reset

func SportsOwned

func SportsOwned() fyne.CanvasObject

List object for populating owned dSports contracts

func SportsPayouts

func SportsPayouts() fyne.CanvasObject

Log entry for dSports payout results

func SportsRefund

func SportsRefund(scid, tic, n string)

User can refund a void dSports payout from SC

  • tic is the bet id string
  • n is the game number

func StartApp

func StartApp()

Start dPrediction dApp

func TrimTeamA

func TrimTeamA(s string) string

Parse dSports game string into team A string

func TrimTeamB

func TrimTeamB(s string) string

Parse dSports game string into team B string

func UploadBetContract

func UploadBetContract(c bool, pub int)

Install new bet SC

  • c defines dSports or dPrediction contract
  • pub defines public or private contract

func ValidBetContract

func ValidBetContract(scid string) bool

Check dSports/dPrediction SC for dev address

func VarUpdate

func VarUpdate(scid string, ta, tb, tc, l, hl int)

Owner update for bet SC vars

  • ta, tb, tc are contracts time limits. Only ta, tb needed for dSports
  • l is the max bet limit per initialized bet
  • hl is the max amount of games that can be ran at once

func VerifyBetSigner

func VerifyBetSigner(scid string) bool

Verify if wallet is a co owner on bet contract

func Version

func Version() semver.Version

Check prediction package version

func WinningTeam

func WinningTeam(teams, winner string) string

Format winning team name from dSports final result string

Types

This section is empty.

Jump to

Keyboard shortcuts

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