service

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OccurrencePrefix = "Occurrence/"
)

Variables

This section is empty.

Functions

func CalculateDistributionAmount added in v0.3.1

func CalculateDistributionAmount(prev uint64, curr uint64) (distributionAmt uint64)

Types

type DistributionService

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

func NewDistributionService

func NewDistributionService(pmClient IPlanetmintClient, eClient IElementsClient, r2pClient r2p.IR2PClient, shamirClient shamir.IShamirCoordinatorClient, db *leveldb.DB) *DistributionService

func (*DistributionService) Distribute

func (ds *DistributionService) Distribute()

Distributes 10% of received funds to all validators

func (*DistributionService) GetLastOccurrence

func (ds *DistributionService) GetLastOccurrence() (occurrence *Occurrence, err error)

func (*DistributionService) GetOccurrence

func (ds *DistributionService) GetOccurrence(timestamp int64) (occurrence *Occurrence, err error)

func (*DistributionService) Run

func (ds *DistributionService) Run(cronExp string) (err error)

Run starts cronjob like thread to periodically check for DAO rewards to distribute to validators

func (*DistributionService) StoreOccurrence

func (ds *DistributionService) StoreOccurrence(timestamp int64, amount uint64) (err error)

type ElementsClient

type ElementsClient struct{}

func NewElementsClient

func NewElementsClient() *ElementsClient

func (*ElementsClient) ListReceivedByAddress

func (ec *ElementsClient) ListReceivedByAddress(url string, params []string) (receivedTx []types.ListReceivedByAddressResult, err error)

type IElementsClient

type IElementsClient interface {
	ListReceivedByAddress(url string, params []string) (receivedTx []types.ListReceivedByAddressResult, err error)
}

type IPlanetmintClient

type IPlanetmintClient interface {
	GetValidatorAddresses() (addresses []string, err error)
	GetValidatorDelegationAddresses(validatorAddress string) (addresses []string, err error)
}

type Occurrence

type Occurrence struct {
	Timestamp int64  `json:"timestamp"`
	Amount    uint64 `json:"amount"`
}

type PlanetmintClient

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

func NewPlanetmintClient

func NewPlanetmintClient(host string) *PlanetmintClient

func (*PlanetmintClient) GetValidatorAddresses

func (pmc *PlanetmintClient) GetValidatorAddresses() (addresses []string, err error)

func (*PlanetmintClient) GetValidatorDelegationAddresses

func (pmc *PlanetmintClient) GetValidatorDelegationAddresses(validatorAddress string) (addresses []string, err error)

Jump to

Keyboard shortcuts

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