hashrate

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

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 NewBaseTerms added in v1.9.0

func NewBaseTerms(contractID, seller, buyer, validator string, startsAt time.Time, duration time.Duration, hashrateGHS float64, price *big.Int, profitTarget int8, isDeleted bool, balance *big.Int, hasFutureTerms bool, version uint32) *BaseTerms

func (*BaseTerms) Balance

func (b *BaseTerms) Balance() *big.Int

func (*BaseTerms) BlockchainState

func (p *BaseTerms) BlockchainState() BlockchainState

func (*BaseTerms) Buyer

func (b *BaseTerms) Buyer() string

func (*BaseTerms) Copy

func (b *BaseTerms) Copy() *BaseTerms

func (*BaseTerms) Duration

func (b *BaseTerms) Duration() time.Duration

func (*BaseTerms) Elapsed

func (p *BaseTerms) Elapsed() time.Duration

func (*BaseTerms) EndTime

func (p *BaseTerms) EndTime() time.Time

func (*BaseTerms) HasFutureTerms

func (b *BaseTerms) HasFutureTerms() bool

func (*BaseTerms) HashrateGHS

func (b *BaseTerms) HashrateGHS() float64

func (*BaseTerms) ID

func (b *BaseTerms) ID() string

func (*BaseTerms) IsDeleted

func (b *BaseTerms) IsDeleted() bool

func (*BaseTerms) Price

func (b *BaseTerms) Price() *big.Int

func (*BaseTerms) ProfitTarget

func (b *BaseTerms) ProfitTarget() int8

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

func (*BaseTerms) Seller

func (b *BaseTerms) Seller() string

func (*BaseTerms) StartTime

func (b *BaseTerms) StartTime() time.Time

func (*BaseTerms) Validator

func (b *BaseTerms) Validator() string

func (*BaseTerms) Version

func (b *BaseTerms) Version() uint32

type BlockchainState

type BlockchainState int
const (
	BlockchainStateAvailable BlockchainState = 0
	BlockchainStateRunning   BlockchainState = 1
)

func (BlockchainState) String

func (b BlockchainState) String() string

type EncryptedTerms

type EncryptedTerms struct {
	BaseTerms
	ValidatorUrlEncrypted string
	DestEncrypted         string
}

EncryptedTerms holds the terms of the contract where destination is encrypted

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 Terms

type Terms struct {
	BaseTerms
	ValidatorURL *url.URL
	DestURL      *url.URL
}

Terms holds the terms of the contract where destination is decrypted

func (*Terms) Decrypt added in v1.9.0

func (p *Terms) Decrypt(privateKey string) (*Terms, error)

No-op for unencrypted terms

func (*Terms) DecryptPoolDest added in v1.9.0

func (p *Terms) DecryptPoolDest(privateKey string) (*Terms, error)

No-op for unencrypted terms

func (*Terms) Dest

func (p *Terms) Dest() *url.URL

func (*Terms) Encrypt

func (t *Terms) Encrypt(privateKey string) (*Terms, error)

func (*Terms) PoolDest

func (p *Terms) PoolDest() *url.URL

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.

Jump to

Keyboard shortcuts

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