Documentation
¶
Index ¶
- Variables
- type BaseTerms
- func (b *BaseTerms) Balance() *big.Int
- func (p *BaseTerms) BlockchainState() BlockchainState
- func (b *BaseTerms) Buyer() string
- func (b *BaseTerms) Copy() *BaseTerms
- func (b *BaseTerms) Duration() time.Duration
- func (p *BaseTerms) Elapsed() time.Duration
- func (p *BaseTerms) EndTime() time.Time
- func (b *BaseTerms) HasFutureTerms() bool
- func (b *BaseTerms) HashrateGHS() float64
- func (b *BaseTerms) ID() string
- func (b *BaseTerms) IsDeleted() bool
- func (b *BaseTerms) Price() *big.Int
- func (b *BaseTerms) PriceLMR() float64
- func (b *BaseTerms) ProfitTarget() int8
- func (b *BaseTerms) ResetStartTime()
- func (b *BaseTerms) Seller() string
- func (b *BaseTerms) StartTime() time.Time
- func (b *BaseTerms) Validator() string
- func (b *BaseTerms) Version() uint32
- type BlockchainState
- type EncryptedTerms
- type Terms
- type ValidationStage
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidDestURL = fmt.Errorf("invalid url") ErrCannotDecryptDest = fmt.Errorf("cannot decrypt") )
Functions ¶
This section is empty.
Types ¶
type BaseTerms ¶
type BaseTerms struct {
// contains filtered or unexported fields
}
BaseTerms holds the terms of the contract with common methods for both encrypted and decrypted terms
func (*BaseTerms) BlockchainState ¶
func (p *BaseTerms) BlockchainState() BlockchainState
func (*BaseTerms) HasFutureTerms ¶
func (*BaseTerms) HashrateGHS ¶
func (*BaseTerms) ProfitTarget ¶
func (*BaseTerms) ResetStartTime ¶
func (b *BaseTerms) ResetStartTime()
ResetStartTime needed to change internal state after closeout event so contract will be considered not running TODO: refactor for better state handling
type BlockchainState ¶
type BlockchainState int
const ( BlockchainStateAvailable BlockchainState = 0 BlockchainStateRunning BlockchainState = 1 )
func (BlockchainState) String ¶
func (b BlockchainState) String() string
type EncryptedTerms ¶
EncryptedTerms holds the terms of the contract where destination is encrypted
func NewTerms ¶
func NewTerms(contractID, seller, buyer string, startsAt time.Time, duration time.Duration, hashrate float64, price *big.Int, profitTarget int8, state BlockchainState, isDeleted bool, balance *big.Int, hasFutureTerms bool, version uint32, validatorUrlEncrypted string, destEncrypted string, validatorAddress string) *EncryptedTerms
func (*EncryptedTerms) Decrypt ¶
func (t *EncryptedTerms) Decrypt(privateKey string) (*Terms, error)
Decrypt decrypts the validator url, if error returns the terms with dest set to nil and error
func (*EncryptedTerms) DecryptPoolDest ¶
func (t *EncryptedTerms) DecryptPoolDest(privateKey string) (*Terms, error)
Decrypt decrypts the destination pool url, if error returns the terms with dest set to nil and error
type ValidationStage ¶
type ValidationStage int8
const ( ValidationStageNotApplicable ValidationStage = 0 ValidationStageNotValidating ValidationStage = 1 ValidationStageValidating ValidationStage = 2 ValidationStageFinished ValidationStage = 3 )
func (ValidationStage) String ¶
func (s ValidationStage) String() string
Directories
¶
Path | Synopsis |
---|---|
Package avgcounter implements a simple EMA (Exponential Moving Average) counter.
|
Package avgcounter implements a simple EMA (Exponential Moving Average) counter. |
Click to show internal directories.
Click to hide internal directories.