services

package
v0.0.0-...-80b2b3e Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 66 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreservedCycles = 5
	XTZ             = 1000000

	GranadaBlockSecurityDeposit  = 640 * XTZ
	FlorenceBlockSecurityDeposit = 512 * XTZ

	GranadaEndorsementSecurityDeposit  = 2.5 * XTZ
	FlorenceEndorsementSecurityDeposit = 64 * XTZ

	GranadaBlockReward  = 20 * XTZ
	FlorenceBlockReward = 40 * XTZ
	BabylonBlockReward  = 24 * XTZ

	GradanaLowPriorityBlockReward  = 3 * XTZ
	FlorenceLowPriorityBlockReward = 6 * XTZ

	GranadaEndorsementReward  = 0.078125 * XTZ
	FlorenceEndorsementReward = 1.25 * XTZ

	BabylonEndorsementRewards = 1.75 * XTZ

	CarthageCycle = 208
	GranadaCycle  = 388

	GranadaBlockEndorsers  = 256
	FlorenceBlockEndorsers = 32

	TokensPerRoll = 8000

	TotalLocked = (GranadaBlockSecurityDeposit + GranadaEndorsementSecurityDeposit*GranadaBlockEndorsers) * BlocksInMainnetCycle * (PreservedCycles + 1)

	BlockLockEstimate = GranadaBlockReward + GranadaBlockSecurityDeposit + GranadaBlockEndorsers*(GranadaEndorsementReward+GranadaEndorsementSecurityDeposit)
)
View Source
const (
	BlocksInMainnetCycle = 4096 * 2
)

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, ws *ws.Hub, mail mailer.Mail, marketDataProvider *cmc.CoinGecko, rpcConfig client.TransportConfig, network models.Network, isTestNetwork bool)

func QuorumNewFormula

func QuorumNewFormula(prevAverPart, actualPart float64) (q float64, avP float64)

func QuorumOldFormula

func QuorumOldFormula(prevAverPart, actualPart float64) (q float64, avP float64)

Types

type Limiter

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

type Provider

type Provider interface {
	Health() error
	GetBlock() block.Repo
	GetOperationGroup() operation_groups.Repo
	GetOperation() operation.Repo
	GetOperationCounter() operation_counter.Repo
	GetAccount() account.Repo
	GetBaker() baker.Repo
	GetBaking() baking.Repo
	GetEndorsing() endorsing.Repo
	GetFutureBakingRight() future_baking_rights.Repo
	GetFutureEndorsementRight() future_endorsement_rights.Repo
	GetSnapshots() snapshots.Repo
	GetRolls() rolls.Repo
	GetDoubleBaking() double_baking.Repo
	GetDoubleEndorsement() double_endorsement.Repo
	GetVotingPeriod() voting_periods.Repo
	GetChart() chart.Repo
	GetAssets() assets.Repo
	GetThirdPartyBakers() thirdparty_bakers.Repo
	GetUserProfile() user_profile.Repo
	GetStorage() storage.Repo
	GetDailyStats() daily_stats.Repo
	GetNFT() nft.Repo
}

Provider is the abstract interface to get any repository.

type QuorumFormula

type QuorumFormula func(prevAverPart, actualPart float64) (quorum float64, averPart float64)

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.AccountListView, 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, favorites []string) (accs []models.AccountListView, count int64, err error)

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

func (*TezTracker) AccountTopBalanceList

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

func (*TezTracker) BakerList

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

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, favorites []string) (accs []models.AccountListView, count int64, err error)

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

func (*TezTracker) CreateOrUpdateUserAddress

func (t *TezTracker) CreateOrUpdateUserAddress(userAddress models.UserAddress) error

func (*TezTracker) CreateOrUpdateUserNote

func (t *TezTracker) CreateOrUpdateUserNote(note models.UserNote) error

func (*TezTracker) DeleteUserAddress

func (t *TezTracker) DeleteUserAddress(accountID string, address string) error

func (*TezTracker) DeleteUserNote

func (t *TezTracker) DeleteUserNote(accountID string, address string) error

func (*TezTracker) EmailTokenVerification

func (t *TezTracker) EmailTokenVerification(token string) error

func (*TezTracker) EmailVerification

func (t *TezTracker) EmailVerification(accountID string) error

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.AccountListView, err error)

GetAccount retrieves an account by its ID.

func (*TezTracker) GetAccountAssetsBalance

func (t *TezTracker) GetAccountAssetsBalance(address string) (balances []models.AccountAssetBalance, err error)

func (*TezTracker) GetAccountBakedBlocksList

func (t *TezTracker) GetAccountBakedBlocksList(accountID string, cycle int64, limits Limiter) (count int64, list []models.Block, err error)

func (*TezTracker) GetAccountBakingList

func (t *TezTracker) GetAccountBakingList(accountID string, limits Limiter) (count int64, list []models.AccountBaking, err error)

func (*TezTracker) GetAccountBakingTotal

func (t *TezTracker) GetAccountBakingTotal(accountID string) (total models.AccountBaking, err error)

func (*TezTracker) GetAccountBalanceHistory

func (t *TezTracker) GetAccountBalanceHistory(id string, from, to time.Time) (balances []models.AccountBalance, err error)

func (*TezTracker) GetAccountCountByPeriod

func (t *TezTracker) GetAccountCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetAccountDelegatorsByCycle

func (t *TezTracker) GetAccountDelegatorsByCycle(accountID string, cycle int64, limits Limiter) (count int64, accountDelegators []models.AccountDelegator, err error)

func (*TezTracker) GetAccountEndorsementsList

func (t *TezTracker) GetAccountEndorsementsList(accountID string, cycle int64, limits Limiter) (count int64, list []models.Operation, err error)

func (*TezTracker) GetAccountEndorsingList

func (t *TezTracker) GetAccountEndorsingList(accountID string, limits Limiter) (count int64, list []models.AccountEndorsing, err error)

func (*TezTracker) GetAccountEndorsingTotal

func (t *TezTracker) GetAccountEndorsingTotal(accountID string) (total models.AccountEndorsing, err error)

func (*TezTracker) GetAccountFutureBakingList

func (t *TezTracker) GetAccountFutureBakingList(accountID string) (list []models.AccountBaking, err error)

func (*TezTracker) GetAccountFutureBakingRights

func (t *TezTracker) GetAccountFutureBakingRights(accountID string, cycle int64, limits Limiter) (count int64, futureRights []models.FutureBakingRight, err error)

func (*TezTracker) GetAccountFutureEndorsementRights

func (t *TezTracker) GetAccountFutureEndorsementRights(accountID string, cycle int64, limits Limiter) (count int64, futureRights []models.FutureEndorsementRight, err error)

func (*TezTracker) GetAccountFutureEndorsementsList

func (t *TezTracker) GetAccountFutureEndorsementsList(accountID string) (list []models.AccountEndorsing, err error)

func (*TezTracker) GetAccountReport

func (t *TezTracker) GetAccountReport(accountID string, from, to int64, operations []string) (resp []byte, err error)

func (*TezTracker) GetAccountRewardsList

func (t *TezTracker) GetAccountRewardsList(accountID string, limits Limiter) (count int64, rewards []models.AccountReward, err error)

func (*TezTracker) GetAccountSecurityDepositList

func (t *TezTracker) GetAccountSecurityDepositList(accountID string) (rewards []models.AccountRewardsCount, err error)

func (*TezTracker) GetAccountsWithLowBalance

func (t *TezTracker) GetAccountsWithLowBalance(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetActiveAccounts

func (t *TezTracker) GetActiveAccounts(period string) (items []models.AggTimeInt, err error)

func (*TezTracker) GetAssetReport

func (t *TezTracker) GetAssetReport(assetID string, from, to int64, operations []string) (resp []byte, err error)

func (*TezTracker) GetBakerChartInfo

func (t *TezTracker) GetBakerChartInfo(limits Limiter) (data []models.BakerChartData, err error)

func (*TezTracker) GetBakerInfo

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

TODO change this method

func (*TezTracker) GetBakersStakeChange

func (t *TezTracker) GetBakersStakeChange() (items []models.BakerDelegators, err error)

func (*TezTracker) GetBakersVoting

func (t *TezTracker) GetBakersVoting() (voting models.BakersVoting, err error)

func (*TezTracker) GetBallotVoters

func (t *TezTracker) GetBallotVoters(id int64, limits Limiter) (votes []models.ProposalVoter, count int64, 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) GetBlocksPriorityByCycle

func (t *TezTracker) GetBlocksPriorityByCycle(limits Limiter) (data []models.BlockPriority, err error)

func (*TezTracker) GetChartsInfo

func (t *TezTracker) GetChartsInfo(from, to int64, period string, columns []string) (data []models.ChartData, err error)

func (*TezTracker) GetContractCountByPeriod

func (t *TezTracker) GetContractCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetCurrentCycle

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

func (*TezTracker) GetDoubleBakings

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

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

func (*TezTracker) GetDoubleEndorsements

func (t *TezTracker) GetDoubleEndorsements(hashes, inBlocks []string, limits Limiter) (operations []models.DoubleOperationEvidenceExtended, count int64, err error)

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

func (*TezTracker) GetHoldingPoints

func (t *TezTracker) GetHoldingPoints() (items []models.HoldingPoint, err error)

func (*TezTracker) GetInactiveAccounts

func (t *TezTracker) GetInactiveAccounts(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetLostBlocksCountAgg

func (t *TezTracker) GetLostBlocksCountAgg(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetLostEndorsingCountAgg

func (t *TezTracker) GetLostEndorsingCountAgg(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetLostRewards

func (t *TezTracker) GetLostRewards(period string) (items []models.AggTimeInt, err error)

func (*TezTracker) GetNFTContract

func (t *TezTracker) GetNFTContract(contractID string) (contract models.NFTContract, err error)

func (*TezTracker) GetNFTContractDistribution

func (t *TezTracker) GetNFTContractDistribution(contractID string) (distribution models.NFTDistribution, err error)

func (*TezTracker) GetNFTContractOperations

func (t *TezTracker) GetNFTContractOperations(contractID string, limits Limiter) (operations []models.Operation, count int64, err error)

func (*TezTracker) GetNFTContractOperationsChart

func (t *TezTracker) GetNFTContractOperationsChart(contractID, period string, from, to int64) (chart []models.ChartData, err error)

func (*TezTracker) GetNFTContractOwnership

func (t *TezTracker) GetNFTContractOwnership(contractID string) (ownership models.NFTContractOwnership, err error)

func (*TezTracker) GetNFTContractToken

func (t *TezTracker) GetNFTContractToken(contractID string, tokenID int64) (token models.NFTToken, err error)

func (*TezTracker) GetNFTContractTokens

func (t *TezTracker) GetNFTContractTokens(contractID string, limits Limiter) (tokens []models.NFTToken, count int64, err error)

func (*TezTracker) GetNFTContracts

func (t *TezTracker) GetNFTContracts(limits Limiter) (contracts []models.NFTContract, count int64, err error)

GetBlockEndorsements finds a block and returns endorsements for it.

func (*TezTracker) GetNFTHolders

func (t *TezTracker) GetNFTHolders(contractID string, tokenID int64, limiter Limiter) (holders []models.AssetHolder, count int64, err error)

func (*TezTracker) GetNumberOfDelegators

func (t *TezTracker) GetNumberOfDelegators() (items []models.BakerDelegators, err error)

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) GetOrCreateUser

func (t *TezTracker) GetOrCreateUser(account string) (user models.User, err error)

func (*TezTracker) GetPeriodNonVoters

func (t *TezTracker) GetPeriodNonVoters(id int64, limits Limiter) (proposals []models.Voter, count int64, err error)

func (*TezTracker) GetProposalVoters

func (t *TezTracker) GetProposalVoters(id int64, limits Limiter) (votes []models.ProposalVoter, count int64, err error)

func (*TezTracker) GetProtocolsList

func (t *TezTracker) GetProtocolsList(limits Limiter) (protocols []models.Protocol, count int64, err error)

func (*TezTracker) GetStakingRatio

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

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

func (*TezTracker) GetThirdPartyBakers

func (t *TezTracker) GetThirdPartyBakers() (bakers []models.ThirdPartyBakerAgg, err error)

func (*TezTracker) GetTotalAccountCountByPeriod

func (t *TezTracker) GetTotalAccountCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetTotalContractCountByPeriod

func (t *TezTracker) GetTotalContractCountByPeriod(filter models.AggTimeFilter) (items []models.AggTimeInt, err error)

func (*TezTracker) GetUserAddresses

func (t *TezTracker) GetUserAddresses(accountID string) (addresses []models.UserAddressWithBalance, err error)

func (*TezTracker) GetUserNotes

func (t *TezTracker) GetUserNotes(accountID string) (notes []models.UserNoteWithBalance, err error)

func (*TezTracker) GetWhaleTransfers

func (t *TezTracker) GetWhaleTransfers(limits Limiter, period string) (transfers []models.Operation, err error)

func (*TezTracker) HeadBlock

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

HeadBlock retrieves the last added block from the repository.

func (*TezTracker) Health

func (t *TezTracker) Health() (err error)

func (*TezTracker) LargestSources

func (t *TezTracker) LargestSources(limits Limiter, period, side string) (source []models.Account, err error)

func (*TezTracker) ProposalsByPeriodID

func (t *TezTracker) ProposalsByPeriodID(id *int64, limits Limiter) (proposals []models.VotingProposal, count int64, err error)

func (*TezTracker) PublicBakerList

func (t *TezTracker) PublicBakerList(limits Limiter, favorites []string) (publicBakers []models.PublicBaker, count int64, err error)

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

func (*TezTracker) PublicBakersSearchList

func (t *TezTracker) PublicBakersSearchList() (list []models.PublicBakerSearch, err error)

func (*TezTracker) SaveActiveAccountsInCache

func (t *TezTracker) SaveActiveAccountsInCache() error

func (*TezTracker) SaveHoldingPoints

func (t *TezTracker) SaveHoldingPoints() error

func (*TezTracker) SaveLostRewardsInCache

func (t *TezTracker) SaveLostRewardsInCache() error

func (*TezTracker) SendNewVerifications

func (t *TezTracker) SendNewVerifications(pusher mailer.Mail) error

func (*TezTracker) Snapshots

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

func (*TezTracker) TokenHolders

func (t *TezTracker) TokenHolders(assetID string) (holders []models.AssetHolder, err error)

func (*TezTracker) TokenInfo

func (t *TezTracker) TokenInfo(assetID string) (info models.AssetInfo, err error)

func (*TezTracker) TokenOperations

func (t *TezTracker) TokenOperations(assetIDs, operationsTypes, accountIDs []string, blockLevels []int64, limits Limiter) (count int64, operations []models.AssetOperationReport, err error)

func (*TezTracker) TokenTotalSupply

func (t *TezTracker) TokenTotalSupply(assetID string) (totalSupply int64, err error)

func (*TezTracker) TokensList

func (t *TezTracker) TokensList(limiter Limiter) (count int64, assets []models.AssetInfo, err error)

func (*TezTracker) UpdateBakersSocialMedia

func (t *TezTracker) UpdateBakersSocialMedia() error

func (*TezTracker) UpdateUser

func (t *TezTracker) UpdateUser(newUser models.User) error

func (*TezTracker) VotingPeriodStats

func (t *TezTracker) VotingPeriodStats(id *int64) (info models.PeriodStats, err error)

func (*TezTracker) VotingPeriodsList

func (t *TezTracker) VotingPeriodsList() ([]models.PeriodInfo, error)

Jump to

Keyboard shortcuts

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