votes

package
v0.0.0-...-4a24cc8 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, b Backends, pollID, optionID, sats, expiry int64, note string) (int64, error)

Create initiates the process of voting for an option. It queries LND for an invoice, saved it in the votes DB and returns it to the user.

func GetResults

func GetResults(ctx context.Context, b Backends, pollID int64) (map[int64]int64, error)

GetResults returns a map of options IDs to vote counts. Note that only paid votes are included.

func ReleaseVotesForPoll

func ReleaseVotesForPoll(ctx context.Context, b Backends, pollID int64, shouldRepay ext_types.RepaySchemeFunc) (int64, error)

func StartLoops

func StartLoops(b Backends)

Types

type Backends

type Backends interface {
	GetDB() *sql.DB
	GetLND() lnd.Client
}

type Vote

type Vote struct {
	ID       int64
	PollID   int64
	OptionID int64
	Amount   int64
	Hash     string
	Preimage []byte
	PayReq   string
}

func GetVotes

func GetVotes(ctx context.Context, b Backends, pollID int64) ([]*Vote, error)

func Lookup

func Lookup(ctx context.Context, b Backends, id int64) (*Vote, error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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