polls

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: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonZeroInvoice = errors.New("Payout invoice is non-zero")
	ErrPayoutExpiry   = errors.New("Payout invoice expires too soon")
)

Functions

func ClosePoll

func ClosePoll(ctx context.Context, b Backends, poll *poll_db.DBPoll) error

closePoll initiates the poll closing process - update the poll to closed, so that it cannot receive any more votes - return payments to voters, according to the chosen repayment scheme - pay the creator the total remaining

func CreatePoll

func CreatePoll(ctx context.Context, b Backends, question, payReq, email string,
	repayScheme int64, options []string, expirySeconds, voteSats int64) (int64, error)

func StartLoops

func StartLoops(b Backends)

func ValidatePayout

func ValidatePayout(ctx context.Context, b Backends, payReq string, expirySeconds int64) error

ValidatePayout ensures that the payout invoice provided by the poll creator has a 0 amount, so we can specify any payment amount and that it has a sufficient expiry buffer so that it does not expire before we can pay them out.

Types

type Backends

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

type Option

type Option struct {
	ID    int64
	Value string
}

type Poll

type Poll struct {
	ID       int64
	Question string
	Options  []*Option
	Cost     int64
	ClosesAt time.Time
	Strategy types.RepayDetails
}

func ListActivePolls

func ListActivePolls(ctx context.Context, b Backends) ([]*Poll, error)

func ListInactivePolls

func ListInactivePolls(ctx context.Context, b Backends) ([]*Poll, error)

func LookupPoll

func LookupPoll(ctx context.Context, b Backends, id int64) (*Poll, error)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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