Documentation
¶
Index ¶
- Variables
- func IsErrTooOld(err error) bool
- type EarnRequest
- type EarnRequestBatch
- func (er EarnRequestBatch) Clone() EarnRequestBatch
- func (e EarnRequestBatch) IsPerBlock() bool
- func (e EarnRequestBatch) Size() int
- func (e EarnRequestBatch) Validate() error
- func (e EarnRequestBatch) WithReferralBonuses(referralChains [][]string, tierEarnRates map[int]float64) (EarnRequestBatch, error)
- type EarnRequestFullBatch
- func (e EarnRequestFullBatch) Clone() EarnRequestFullBatch
- func (e EarnRequestFullBatch) IsPerBlock() bool
- func (e EarnRequestFullBatch) Size() int
- func (e EarnRequestFullBatch) Validate() error
- func (e EarnRequestFullBatch) WithReferralBonuses(referralChains [][]string, tierEarnRates map[int]float64) (EarnRequestFullBatch, error)
- type PointsEarnRequest
- type PointsEarnRequestBatch
- type PointsEarnRequestFullBatch
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingStart = fmt.Errorf("must have either startBlock or startTime") ErrNegativeRate = fmt.Errorf("earn rate must be non-negative") ErrInvalidUserAddr = fmt.Errorf("invalid user address") ErrEmptySource = fmt.Errorf("source cannot be empty") ErrEmptySubSource = fmt.Errorf("subSource cannot be empty") ErrEmptyCategory = fmt.Errorf("category cannot be empty") ErrNegativeAmount = fmt.Errorf("amount must be positive") ErrMissingGrantTime = fmt.Errorf("grant time must be set") ErrEarnInf = fmt.Errorf("earn rate cannot be infinite") ErrNonPostiveMultiplier = fmt.Errorf("multiplier must be positive") ErrNonPostiveStartBlock = fmt.Errorf("start block must be positive") ErrNonPostiveStartTime = fmt.Errorf("start time must be positive") ErrInvalidEarnRate = fmt.Errorf("invalid earn rate") ErrEmptyBatch = fmt.Errorf("batch cannot be empty") )
Functions ¶
func IsErrTooOld ¶ added in v1.1.0
Types ¶
type EarnRequest ¶
type EarnRequest struct {
UserAddr string `json:"userAddr"`
Source string `json:"source"`
SubSource string `json:"subSource"`
SourceUser string `json:"-"`
StartBlock int64 `json:"startBlock"`
StartTime int64 `json:"startTime"`
EarnRate string `json:"earnRate"`
}
func (EarnRequest) Clone ¶
func (er EarnRequest) Clone() EarnRequest
func (EarnRequest) GetSourceUser ¶
func (e EarnRequest) GetSourceUser() string
func (EarnRequest) IsPerBlock ¶
func (e EarnRequest) IsPerBlock() bool
func (EarnRequest) ReferralBonuses ¶
func (e EarnRequest) ReferralBonuses(referralChain []string, tierEarnRates map[int]float64) ([]EarnRequest, error)
func (EarnRequest) Validate ¶
func (e EarnRequest) Validate() error
type EarnRequestBatch ¶
type EarnRequestBatch struct {
UserAddrs []string `json:"userAddrs"`
Source string `json:"source"`
SubSource string `json:"subSource"`
SourceUsers []string `json:"-"`
StartBlock int64 `json:"startBlock"`
StartTime int64 `json:"startTime"`
EarnRates []string `json:"earnRates"`
}
EarnRequestBatch is a batch of related earn requests
func BatchEarnRequests ¶
func BatchEarnRequests(earnRequests []EarnRequest) (EarnRequestBatch, error)
func MakeManyEarnRequestBatches ¶
func MakeManyEarnRequestBatches(earnRequests []EarnRequest, batchSize int) ([]EarnRequestBatch, error)
func (EarnRequestBatch) Clone ¶
func (er EarnRequestBatch) Clone() EarnRequestBatch
func (EarnRequestBatch) IsPerBlock ¶
func (e EarnRequestBatch) IsPerBlock() bool
func (EarnRequestBatch) Size ¶
func (e EarnRequestBatch) Size() int
func (EarnRequestBatch) Validate ¶
func (e EarnRequestBatch) Validate() error
func (EarnRequestBatch) WithReferralBonuses ¶
func (e EarnRequestBatch) WithReferralBonuses(referralChains [][]string, tierEarnRates map[int]float64) (EarnRequestBatch, error)
type EarnRequestFullBatch ¶
type EarnRequestFullBatch struct {
UserAddrs []string `json:"userAddrs"`
Sources []string `json:"sources"`
SubSources []string `json:"subSources"`
SourceUsers []string `json:"-"`
StartBlocks []int64 `json:"startBlocks"`
StartTimes []int64 `json:"startTimes"`
EarnRates []string `json:"earnRates"`
}
EarnRequestFullBatch is a batch of unrelated earn requests
func BatchUnrelatedEarnRequests ¶
func BatchUnrelatedEarnRequests(earnRequests []EarnRequest) (EarnRequestFullBatch, error)
func MakeManyEarnRequestFullBatches ¶
func MakeManyEarnRequestFullBatches(earnRequests []EarnRequest, batchSize int) ([]EarnRequestFullBatch, error)
func (EarnRequestFullBatch) Clone ¶
func (e EarnRequestFullBatch) Clone() EarnRequestFullBatch
func (EarnRequestFullBatch) IsPerBlock ¶
func (e EarnRequestFullBatch) IsPerBlock() bool
func (EarnRequestFullBatch) Size ¶
func (e EarnRequestFullBatch) Size() int
func (EarnRequestFullBatch) Validate ¶
func (e EarnRequestFullBatch) Validate() error
func (EarnRequestFullBatch) WithReferralBonuses ¶
func (e EarnRequestFullBatch) WithReferralBonuses(referralChains [][]string, tierEarnRates map[int]float64) (EarnRequestFullBatch, error)
type PointsEarnRequest ¶
type PointsEarnRequest struct {
EarnRequest
Program int64 `json:"program"`
}
func (PointsEarnRequest) IsPerBlock ¶
func (b PointsEarnRequest) IsPerBlock() bool
func (PointsEarnRequest) Validate ¶
func (b PointsEarnRequest) Validate() error
type PointsEarnRequestBatch ¶
type PointsEarnRequestBatch struct {
EarnRequestBatch
Program int64 `json:"program"`
}
func (PointsEarnRequestBatch) IsPerBlock ¶
func (b PointsEarnRequestBatch) IsPerBlock() bool
func (PointsEarnRequestBatch) Validate ¶
func (b PointsEarnRequestBatch) Validate() error
type PointsEarnRequestFullBatch ¶
type PointsEarnRequestFullBatch struct {
EarnRequestFullBatch
Program int64 `json:"program"`
}
func (PointsEarnRequestFullBatch) IsPerBlock ¶
func (b PointsEarnRequestFullBatch) IsPerBlock() bool
func (PointsEarnRequestFullBatch) Validate ¶
func (b PointsEarnRequestFullBatch) Validate() error
Click to show internal directories.
Click to hide internal directories.