rewards

package
v0.0.0-...-92012d3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MPL-2.0 Imports: 17 Imported by: 1

README

Rewards Microservice

Purpose

To provide BAT-Rewards API.

to run

go run ../main.go serve rewards

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBaseCurrencyEmpty - empty base currency
	ErrBaseCurrencyEmpty = errors.New("currency cannot be empty")
	// ErrBaseCurrencyInvalid - indicates there is a validation issue with the currency
	ErrBaseCurrencyInvalid = errors.New("invalid currency")
)

Functions

func GetParametersHandler

func GetParametersHandler(service *Service) handlers.AppHandler

GetParametersHandler - handler to get reward parameters

Types

type AutoContribute

type AutoContribute struct {
	Choices       []float64 `json:"choices,omitempty"`
	DefaultChoice float64   `json:"defaultChoice,omitempty"`
}

AutoContribute - reward parameters about ac (votes)

type BaseCurrency

type BaseCurrency string

BaseCurrency - type for base currency input

func (*BaseCurrency) Decode

func (rbc *BaseCurrency) Decode(ctx context.Context, v []byte) error

Decode - implement decodable

func (*BaseCurrency) String

func (rbc *BaseCurrency) String() string

String - stringer implmentation

func (*BaseCurrency) Validate

func (rbc *BaseCurrency) Validate(ctx context.Context) error

Validate - implement validatable

type Config

type Config struct {
	TOSVersion int
}

Config contains the rewards.Service configuration.

type ParametersV1

type ParametersV1 struct {
	PayoutStatus     *custodian.PayoutStatus `json:"payoutStatus"`
	CustodianRegions *custodian.Regions      `json:"custodianRegions"`
	BATRate          float64                 `json:"batRate,omitempty"`
	AutoContribute   AutoContribute          `json:"autocontribute,omitempty"`
	Tips             Tips                    `json:"tips,omitempty"`
	Transition       bool                    `json:"vbatExpired"`
	VBATDeadline     *time.Time              `json:"vbatDeadline,omitempty"`
	TOSVersion       int                     `json:"tosVersion,omitempty"`
}

ParametersV1 - structure of reward parameters

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service contains datastore

func InitService

func InitService(ctx context.Context, cfg Config) (*Service, error)

InitService initializes a new instance of the rewards service.

func (*Service) GetParameters

func (s *Service) GetParameters(ctx context.Context, currency *BaseCurrency) (*ParametersV1, error)

GetParameters - respond to caller with the rewards parameters

func (*Service) Jobs

func (s *Service) Jobs() []srv.Job

Jobs - Implement srv.JobService interface

type Tips

type Tips struct {
	DefaultTipChoices     []float64 `json:"defaultTipChoices,omitempty"`
	DefaultMonthlyChoices []float64 `json:"defaultMonthlyChoices,omitempty"`
}

Tips - reward parameters about tips (suggestions)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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