services

package
v0.0.0-...-71505b4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreservedCycles            = 5
	XTZ                        = 1000000
	BlockSecurityDeposit       = 512 * XTZ
	EndorsementSecurityDeposit = 64 * XTZ
	BlockReward                = 16 * XTZ
	EndorsementReward          = 2 * XTZ
	BlockEndorsers             = 32
	BlockLockEstimate          = BlockReward + BlockSecurityDeposit + BlockEndorsers*(EndorsementReward+EndorsementSecurityDeposit)
)
View Source
const BlocksInMainnetCycle = 4096

Variables

View Source
var ErrNotFound = fmt.Errorf("not found")

ErrNotFound is an error returned when the requested entity doesn't exist in the repository.

Functions

func AddToCron

func AddToCron(cron *gron.Cron, cfg config.Config, db *gorm.DB, rpcConfig client.TransportConfig, network models.Network, isTestNetwork bool)

Types

type Limiter

type Limiter interface {
	Limit() uint
	Offset() uint
}

type Provider

type Provider interface {
	GetBlock() block.Repo
	GetOperationGroup() operation_groups.Repo
	GetOperation() operation.Repo
	GetAccount() account.Repo
	GetBaker() baker.Repo
	GetFutureBakingRight() future_baking_rights.Repo
	GetSnapshots() snapshots.Repo
	GetDoubleBaking() double_baking.Repo
}

Provider is the abstract interface to get any repository.

type TezTracker

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

TezTracker is the main service for tezos tracker. It has methods to process all the user's requests.

func New

func New(rp Provider, net models.Network) *TezTracker

New creates a new TexTracker service using the repository provider.

func (*TezTracker) AccountDelegatorsList

func (t *TezTracker) AccountDelegatorsList(accountID string, limits Limiter) ([]models.Account, int64, error)

AccountDelegatorsList retrives up to limit of delegators accounts for the specified accountID.

func (*TezTracker) AccountList

func (t *TezTracker) AccountList(before string, limits Limiter) (accs []models.Account, count int64, err error)

AccountList retrives up to limit of account before the specified id.

func (*TezTracker) BakerList

func (t *TezTracker) BakerList(limits Limiter) (bakers []models.Baker, count int64, err error)

BakerList retrives up to limit of bakers after the specified id.

func (*TezTracker) BakingRightsList

func (t *TezTracker) BakingRightsList(blockLevelOrHash []string, priorityTo int, limiter Limiter) (count int64, blocksWithRights []models.Block, err error)

func (*TezTracker) BlockList

func (t *TezTracker) BlockList(beforeLevel uint64, limits Limiter) ([]models.Block, int64, error)

BlockList retrives up to limit of blocks before the specified level.

func (*TezTracker) BlocksInCycle

func (t *TezTracker) BlocksInCycle() int64

func (*TezTracker) ContractList

func (t *TezTracker) ContractList(before string, limits Limiter) (accs []models.Account, count int64, err error)

ContractList retrives up to limit of contract before the specified id.

func (*TezTracker) FutureBakingRightsList

func (t *TezTracker) FutureBakingRightsList(priorityTo int, limiter Limiter) (count int64, blocksWithRights []models.FutureBlockBakingRight, err error)

func (*TezTracker) GetAccount

func (t *TezTracker) GetAccount(id string) (acc models.Account, err error)

GetAccount retrieves an account by its ID.

func (*TezTracker) GetBakerInfo

func (t *TezTracker) GetBakerInfo(accountID string) (bi *models.BakerInfo, err error)

func (*TezTracker) GetBlockBakingRights

func (t *TezTracker) GetBlockBakingRights(hashOrLevel string) (rights []models.FutureBakingRight, count int64, err error)

GetBlockEndorsements finds a block and returns endorsements for it.

func (*TezTracker) GetBlockEndorsements

func (t *TezTracker) GetBlockEndorsements(hashOrLevel string) (operations []models.Operation, count int64, err error)

GetBlockEndorsements finds a block and returns endorsements for it.

func (*TezTracker) GetBlockWithOperationGroups

func (t *TezTracker) GetBlockWithOperationGroups(hashOrLevel string) (block models.Block, err error)

GetBlockWithOperationGroups retrieves a block by hash or by level. It loads OperationGroups into the found block.

func (*TezTracker) GetCurrentCycle

func (t *TezTracker) GetCurrentCycle() (int64, error)

func (*TezTracker) GetDoubleBakings

func (t *TezTracker) GetDoubleBakings(ids, inBlocks []string, limits Limiter) (operations []models.DoubleBakingEvidence, count int64, err error)

GetOperations gets the operations filtering by operation kinds and blocks wiht pagination.

func (*TezTracker) GetOperations

func (t *TezTracker) GetOperations(ids, kinds, inBlocks, accountIDs []string, limits Limiter, before int64) (operations []models.Operation, count int64, err error)

GetOperations gets the operations filtering by operation kinds and blocks wiht pagination.

func (*TezTracker) GetStakingRatio

func (t *TezTracker) GetStakingRatio() (float64, error)

GetStakingRatio calculates the rough ratio of staked balance to the total supply.

func (*TezTracker) HeadBlock

func (t *TezTracker) HeadBlock() (models.Block, error)

HeadBlock retrieves the last added block from the repository.

func (*TezTracker) Snapshots

func (t *TezTracker) Snapshots(limiter Limiter) (count int64, snapshots []models.Snapshot, err error)

Directories

Path Synopsis
Package mock_services is a generated GoMock package.
Package mock_services is a generated GoMock package.

Jump to

Keyboard shortcuts

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