delegate

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BakingRights

type BakingRights []struct {
	Level         int       `json:"level"`
	Delegate      string    `json:"delegate"`
	Priority      int       `json:"priority"`
	EstimatedTime time.Time `json:"estimated_time"`
}

BakingRights a representation of baking rights on the Tezos network

type Delegate

type Delegate struct {
	Balance              string                 `json:"balance"`
	FrozenBalance        string                 `json:"frozen_balance"`
	FrozenBalanceByCycle []frozenBalanceByCycle `json:"frozen_balance_by_cycle"`
	StakingBalance       string                 `json:"staking_balance"`
	DelegateContracts    []string               `json:"delegated_contracts"`
	DelegatedBalance     string                 `json:"delegated_balance"`
	Deactivated          bool                   `json:"deactivated"`
	GracePeriod          int                    `json:"grace_period"`
}

Delegate is representation of a delegate on the Tezos Network

type DelegateReport

type DelegateReport struct {
	DelegatePhk      string
	Cycle            int
	Delegations      []DelegationReport
	CycleRewards     string
	TotalFeeRewards  string
	SelfBakedRewards string
	TotalRewards     string
}

DelegateReport represents a rewards report for a delegate and all their delegations for a cycle

func (*DelegateReport) GetPayments

func (dr *DelegateReport) GetPayments(minimum int) []Payment

GetPayments will convert a delegate report into payments for batch pay with a minimum requirement in mutez

type DelegateService

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

DelegateService is a struct wrapper for delegate related functions

func NewDelegateService

func NewDelegateService(tzclient tzc.TezosClient, blockService block.TezosBlockService, snapshotService snapshot.TezosSnapshotService, accountService account.TezosAccountService, constants network.Constants) *DelegateService

NewDelegateService returns a new DelegateService

func (*DelegateService) GetAllDelegates

func (d *DelegateService) GetAllDelegates() ([]string, error)

GetAllDelegates a list of all tz1 addresses at the head block

func (*DelegateService) GetAllDelegatesByHash

func (d *DelegateService) GetAllDelegatesByHash(hash string) ([]string, error)

GetAllDelegatesByHash gets a list of all tz1 addresses at a certain hash

func (*DelegateService) GetBakingRights

func (d *DelegateService) GetBakingRights(cycle int) (BakingRights, error)

GetBakingRights gets the baking rights for a specific cycle

func (*DelegateService) GetBakingRightsForDelegate

func (d *DelegateService) GetBakingRightsForDelegate(cycle int, delegatePhk string, priority int) (BakingRights, error)

GetBakingRightsForDelegate gets the baking rights for a delegate at a specific cycle with a certain priority level

func (*DelegateService) GetDelegate

func (d *DelegateService) GetDelegate(delegatePhk string) (Delegate, error)

GetDelegate retrieves information about a delegate at the head block

func (*DelegateService) GetDelegations

func (d *DelegateService) GetDelegations(delegatePhk string) ([]string, error)

GetDelegations retrieves a list of all currently delegated contracts for a delegate.

func (*DelegateService) GetDelegationsAtCycle

func (d *DelegateService) GetDelegationsAtCycle(delegatePhk string, cycle int) ([]string, error)

GetDelegationsAtCycle retrieves a list of all currently delegated contracts for a delegate at a specific cycle.

func (*DelegateService) GetEndorsingRights

func (d *DelegateService) GetEndorsingRights(cycle int) (EndorsingRights, error)

GetEndorsingRights gets the endorsing rights for a specific cycle

func (*DelegateService) GetEndorsingRightsForDelegate

func (d *DelegateService) GetEndorsingRightsForDelegate(cycle int, delegatePhk string) (EndorsingRights, error)

GetEndorsingRightsForDelegate gets the endorsing rights for a specific cycle

func (*DelegateService) GetReport

func (d *DelegateService) GetReport(delegatePhk string, cycle int, fee float64) (*DelegateReport, error)

GetReport gets the total rewards for a delegate earned and calculates the gross rewards earned by each delegation for a single cycle. Also includes the share of each delegation.

func (*DelegateService) GetRewards added in v2.0.1

func (d *DelegateService) GetRewards(delegatePhk string, cycle int) (string, error)

GetRewards gets the rewards earned by a delegate for a specific cycle.

func (*DelegateService) GetStakingBalance

func (d *DelegateService) GetStakingBalance(delegateAddr string, cycle int) (float64, error)

GetStakingBalance gets the staking balance for a delegate at a specific snapshot for a cycle.

func (*DelegateService) GetStakingBalanceAtCycle

func (d *DelegateService) GetStakingBalanceAtCycle(delegateAddr string, cycle int) (string, error)

GetStakingBalanceAtCycle gets the staking balance of a delegate at a specific cycle

type DelegationReport

type DelegationReport struct {
	DelegationPhk string
	Share         float64
	GrossRewards  string
	Fee           string
	NetRewards    string
}

DelegationReport represents a rewards report for a delegation in DelegateReport

type EndorsingRights

type EndorsingRights []struct {
	Level         int       `json:"level"`
	Delegate      string    `json:"delegate"`
	Slots         []int     `json:"slots"`
	EstimatedTime time.Time `json:"estimated_time"`
}

EndorsingRights is a representation of endorsing rights on the Tezos network

type FrozenBalanceRewards

type FrozenBalanceRewards struct {
	Deposits string `json:"deposits"`
	Fees     string `json:"fees"`
	Rewards  string `json:"rewards"`
}

FrozenBalanceRewards is a FrozenBalanceRewards query returned by the Tezos RPC API.

type Payment

type Payment struct {
	Address string
	Amount  float64
}

Payment is a helper struct for transfers

type TezosDelegateService

type TezosDelegateService interface {
	GetDelegations(delegatePhk string) ([]string, error)
	GetDelegationsAtCycle(delegatePhk string, cycle int) ([]string, error)
	GetReport(delegatePhk string, cycle int, fee float64) (*DelegateReport, error)
	// GetPayments(minimum int) []Payment
	GetRewards(delegatePhk string, cycle int) (string, error)
	GetDelegate(delegatePhk string) (Delegate, error)
	GetStakingBalanceAtCycle(delegateAddr string, cycle int) (string, error)
	GetBakingRights(cycle int) (BakingRights, error)
	GetBakingRightsForDelegate(cycle int, delegatePhk string, priority int) (BakingRights, error)
	GetEndorsingRightsForDelegate(cycle int, delegatePhk string) (EndorsingRights, error)
	GetEndorsingRights(cycle int) (EndorsingRights, error)
	GetAllDelegatesByHash(hash string) ([]string, error)
	GetAllDelegates() ([]string, error)
	GetStakingBalance(delegateAddr string, cycle int) (float64, error)
}

Jump to

Keyboard shortcuts

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