Documentation ¶
Index ¶
- Variables
- func Consume(ctx context.Context, group sarama.ConsumerGroup, settings *config.Settings, ...) error
- func ContainsString(v []string, x string) bool
- func GetWeekNum(t time.Time) int
- func GetWeekNumForCron(t time.Time) int
- func NumToWeekEnd(n int) time.Time
- func NumToWeekStart(n int) time.Time
- type ActivityResp
- type Client
- type ConnectionMethod
- type DeviceData
- type DeviceDataClient
- type DeviceIntegrationsResp
- type DeviceListResp
- type LevelInfo
- type RewardsTask
- type StreakInput
- type StreakOutput
- type Transfer
- type TransferStatusProcessor
Constants ¶
This section is empty.
Variables ¶
View Source
var LevelInfos = []*LevelInfo{
{Level: 1, MinWeeks: 0, Points: 0},
{Level: 2, MinWeeks: 4, Points: 1000},
{Level: 3, MinWeeks: 21, Points: 2000},
{Level: 4, MinWeeks: 36, Points: 3000},
}
Functions ¶
func Consume ¶ added in v1.0.0
func Consume(ctx context.Context, group sarama.ConsumerGroup, settings *config.Settings, statusProc *TransferStatusProcessor) error
func ContainsString ¶
func GetWeekNum ¶
GetWeekNum calculates the number of the week in which the given time lies for DIMO point issuance, which at the time of writing starts at 2022-01-31 05:00 UTC. Indexing is zero-based.
func GetWeekNumForCron ¶
GetWeekNumForCron calculates the week number for the current run of the cron job. We expect the job to run every Monday at 05:00 UTC, but due to skew we just round the time.
func NumToWeekEnd ¶
func NumToWeekStart ¶
Types ¶
type ActivityResp ¶
type Client ¶ added in v1.0.0
type Client struct { Producer sarama.SyncProducer Consumer sarama.ConsumerGroup RequestTopic string StatusTopic string ContractAddress common.Address // contains filtered or unexported fields }
func (*Client) BatchTransfer ¶ added in v1.0.0
type ConnectionMethod ¶
type DeviceData ¶
type DeviceDataClient ¶
type DeviceDataClient interface { GetLastActivity(userDeviceID string) (lastActivity time.Time, seen bool, err error) DescribeActiveDevices(start, end time.Time) ([]*DeviceData, error) GetIntegrations(userDeviceID string, start, end time.Time) (ints []string, err error) }
func NewDeviceDataClient ¶
func NewDeviceDataClient(settings *config.Settings) DeviceDataClient
type DeviceIntegrationsResp ¶
type DeviceListResp ¶
type DeviceListResp struct { Aggregations struct { ActiveDevices struct { AfterKey struct { Subject *string `json:"subject"` } `json:"after_key"` Buckets []struct { Key struct { Subject string `json:"subject"` } `json:"key"` Integrations struct { Buckets []struct { Key string `json:"key"` } `json:"buckets"` } `json:"integrations"` UnitIDs struct { Buckets []struct { Key string `json:"key"` } `json:"buckets"` } `json:"unit_ids"` } `json:"buckets"` } `json:"active_devices"` } `json:"aggregations"` }
type RewardsTask ¶
type RewardsTask struct { Settings *config.Settings Logger *zerolog.Logger DataService DeviceDataClient DB func() *database.DBReaderWriter TransferService Transfer }
func (*RewardsTask) Calculate ¶
func (t *RewardsTask) Calculate(issuanceWeek int) error
type StreakInput ¶
type StreakOutput ¶
func ComputeStreak ¶
func ComputeStreak(i StreakInput) StreakOutput
func FakeStreak ¶ added in v1.3.0
func FakeStreak(connectionStreak int) StreakOutput
type Transfer ¶ added in v1.0.0
type Transfer interface { // BatchTransfer(requestID string, users []common.Address, values []*big.Int, vehicleIds []string) error TransferUserTokens(ctx context.Context, week int) error }
func NewTokenTransferService ¶ added in v1.0.0
func NewTokenTransferService( settings *config.Settings, producer sarama.SyncProducer, contractAddress common.Address, db func() *database.DBReaderWriter) Transfer
type TransferStatusProcessor ¶ added in v1.0.0
type TransferStatusProcessor struct { ABI *abi.ABI DB func() *database.DBReaderWriter Logger *zerolog.Logger DidntQualifyEvent abi.Event TokensTransferredEvent abi.Event }
func NewStatusProcessor ¶ added in v1.0.0
func NewStatusProcessor(pdb func() *database.DBReaderWriter, logger *zerolog.Logger) (*TransferStatusProcessor, error)
Click to show internal directories.
Click to hide internal directories.