db

package
v0.0.0-...-b8dc01b Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: GPL-3.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_FAMILY                = "f"
	VALIDATOR_BALANCES_FAMILY     = "vb"
	ATTESTATIONS_FAMILY           = "at"
	PROPOSALS_FAMILY              = "pr"
	SYNC_COMMITTEES_FAMILY        = "sc"
	INCOME_DETAILS_COLUMN_FAMILY  = "id"
	STATS_COLUMN_FAMILY           = "stats"
	MACHINE_METRICS_COLUMN_FAMILY = "mm"
	SERIES_FAMILY                 = "series"

	SUM_COLUMN = "sum"
)
View Source
const (
	DATA_COLUMN                    = "d"
	INDEX_COLUMN                   = "i"
	DEFAULT_FAMILY_BLOCKS          = "default"
	METADATA_UPDATES_FAMILY_BLOCKS = "blocks"
	ACCOUNT_METADATA_FAMILY        = "a"
	CONTRACT_METADATA_FAMILY       = "c"
	ERC20_METADATA_FAMILY          = "erc20"
	ERC721_METADATA_FAMILY         = "erc721"
	ERC1155_METADATA_FAMILY        = "erc1155"

	MAX_INT = 9223372036854775807
	MIN_INT = -9223372036854775808
)
View Source
const (
	ACCOUNT_COLUMN_NAME = "NAME"
	ACCOUNT_IS_CONTRACT = "ISCONTRACT"

	CONTRACT_NAME = "CONTRACTNAME"
	CONTRACT_ABI  = "ABI"

	ERC20_COLUMN_DECIMALS    = "DECIMALS"
	ERC20_COLUMN_TOTALSUPPLY = "TOTALSUPPLY"
	ERC20_COLUMN_SYMBOL      = "SYMBOL"

	ERC20_COLUMN_PRICE = "PRICE"

	ERC20_COLUMN_NAME           = "NAME"
	ERC20_COLUMN_DESCRIPTION    = "DESCRIPTION"
	ERC20_COLUMN_LOGO_FORMAT    = "LOGOFORMAT"
	ERC20_COLUMN_LINK           = "LINK"
	ERC20_COLUMN_OGIMAGE        = "OGIMAGE"
	ERC20_COLUMN_OGIMAGE_FORMAT = "OGIMAGEFORMAT"
)

Variables

View Source
var (
	ERC20TOPIC   []byte
	ERC721TOPIC  []byte
	ERC1155Topic []byte
)
View Source
var (
	GASNOW_RAPID_COLUMN    = "RAPI"
	GASNOW_FAST_COLUMN     = "FAST"
	GASNOW_STANDARD_COLUMN = "STAN"
	GASNOW_SLOW_COLUMN     = "SLOW"
)
View Source
var DBPGX *pgxpool.Conn
View Source
var EmbedMigrations embed.FS
View Source
var ErrBlockNotFound = errors.New("block not found")
View Source
var FrontendReaderDB *sqlx.DB

FrontendWriterDB is a pointer to the auth-database

View Source
var FrontendWriterDB *sqlx.DB
View Source
var ReaderDb *sqlx.DB
View Source
var WriterDb *sqlx.DB

DB is a pointer to the explorer-database

View Source
var ZERO_ADDRESS []byte = []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}

Functions

func AddAuthorizeCode

func AddAuthorizeCode(userId uint64, code, clientId string, appId uint64) error

AddAuthorizeCode registers a code that can be used in exchange for an access token

func AddSubscription

func AddSubscription(userID uint64, network string, eventName types.EventName, eventFilter string, eventThreshold float64) error

AddSubscription adds a new subscription to the database.

func AddToWatchlist

func AddToWatchlist(watchlist []WatchlistEntry, network string) error

func ApplyEmbeddedDbSchema

func ApplyEmbeddedDbSchema(version int64) error

func CalculateMevFromBlock

func CalculateMevFromBlock(block *types.Eth1Block) *big.Int

func CalculateTxFeeFromTransaction

func CalculateTxFeeFromTransaction(tx *types.Eth1Transaction, blockBaseFee *big.Int) *big.Int

func CalculateTxFeesFromBlock

func CalculateTxFeesFromBlock(block *types.Eth1Block) *big.Int

func ChangeProductIDFromStripe

func ChangeProductIDFromStripe(tx *sql.Tx, stripeSubscriptionID string, productID string) error

func CountSentMail

func CountSentMail(email string) error

CountSentMail increases the count of sent mails in the table `mails_sent` for this day.

func CreateAPIKey

func CreateAPIKey(userID uint64) error

CreateAPIKey creates an API key for the user and saves it to the database

func CreateBLSToExecutionChangesNodeJob

func CreateBLSToExecutionChangesNodeJob(nj *types.NodeJob) (*types.NodeJob, error)

func CreateNodeJob

func CreateNodeJob(data []byte) (*types.NodeJob, error)

func CreateVoluntaryExitNodeJob

func CreateVoluntaryExitNodeJob(nj *types.NodeJob) (*types.NodeJob, error)

func DeleteAdConfiguration

func DeleteAdConfiguration(id string) error

delete ad configuration

func DeleteAllSubscription

func DeleteAllSubscription(userID uint64, network string, eventName types.EventName) error

func DeleteSubscription

func DeleteSubscription(userID uint64, network string, eventName types.EventName, eventFilter string) error

DeleteSubscription removes a subscription from the database.

func DeleteUserByEmail

func DeleteUserByEmail(email string) error

DeleteUserByEmail deletes a user.

func DeleteUserById

func DeleteUserById(id uint64) error

DeleteUserById deletes a user.

func DisableAllSubscriptionsFromStripeUser

func DisableAllSubscriptionsFromStripeUser(stripeCustomerID string) error

func GetActiveValidatorCount

func GetActiveValidatorCount() (uint64, error)

GetActiveValidatorCount will return the total-validator-count

func GetAdConfigurations

func GetAdConfigurations() ([]*types.AdConfig, error)

get all ad configurations

func GetAdConfigurationsForTemplate

func GetAdConfigurationsForTemplate(ids []string, noAds bool) ([]*types.AdConfig, error)

get the ad configuration for a specific template that are active

func GetAddressWithdrawals

func GetAddressWithdrawals(address []byte, limit uint64, offset uint64) ([]*types.Withdrawals, error)

GetAddressWithdrawals returns the withdrawals for an address

func GetAddressWithdrawalsTotal

func GetAddressWithdrawalsTotal(address []byte) (uint64, error)

GetAddressWithdrawalsTotal returns the total withdrawals for an address

func GetAllAppSubscriptions

func GetAllAppSubscriptions() ([]*types.PremiumData, error)

func GetAllEpochs

func GetAllEpochs() ([]uint64, error)

GetAllEpochs will return a collection of all of the epochs from the database

func GetAppDataFromRedirectUri

func GetAppDataFromRedirectUri(callback string) (*types.OAuthAppData, error)

GetAppNameFromRedirectUri receives an oauth redirect_url and returns the registered app name, if exists

func GetAppSubscriptionCount

func GetAppSubscriptionCount(userID uint64) (int64, error)

func GetBLSChangeCount

func GetBLSChangeCount() (uint64, error)

func GetBLSChanges

func GetBLSChanges(query string, length, start uint64, orderBy, orderDir string) ([]*types.BLSChange, error)

func GetBlockNumber

func GetBlockNumber(slot uint64) (block uint64, err error)

func GetBlocks

func GetBlocks(startEpoch, endEpoch uint64) ([]*types.MinimalBlock, error)

GetBlocks will return all blocks for a range of epochs from the database

func GetByRefreshToken

func GetByRefreshToken(claimUserID, claimAppID, claimDeviceID uint64, hashedRefreshToken string) (uint64, error)

GetByRefreshToken basically used to confirm the claimed user id with the refresh token. Returns the userId if successful

func GetCurrentDayClIncome

func GetCurrentDayClIncome(validator_indices []uint64) (map[uint64]int64, map[uint64]int64, error)

func GetCurrentDayClIncomeTotal

func GetCurrentDayClIncomeTotal(validator_indices []uint64) (int64, int64, error)

func GetDashboardWithdrawals

func GetDashboardWithdrawals(validators []uint64, limit uint64, offset uint64, orderBy string, orderDir string) ([]*types.Withdrawals, error)

func GetDashboardWithdrawalsCount

func GetDashboardWithdrawalsCount(validators []uint64) (uint64, error)

func GetDataTablesState

func GetDataTablesState(user uint64, key string) (*types.DataTableSaveState, error)

GetDataTablesState retrieves the state for a given user and table

func GetDepositThresholdTime

func GetDepositThresholdTime() (*time.Time, error)

func GetEpochWithdrawals

func GetEpochWithdrawals(epoch uint64) ([]*types.WithdrawalsNotification, error)

func GetEpochWithdrawalsTotal

func GetEpochWithdrawalsTotal(epoch uint64) (total uint64, err error)

func GetEth1Deposits

func GetEth1Deposits(address string, length, start uint64) ([]*types.EthOneDepositsData, error)

func GetEth1DepositsCount

func GetEth1DepositsCount() (uint64, error)

func GetEth1DepositsJoinEth2Deposits

func GetEth1DepositsJoinEth2Deposits(query string, length, start uint64, orderBy, orderDir string, latestEpoch, validatorOnlineThresholdSlot uint64) ([]*types.EthOneDepositsData, uint64, error)

func GetEth1DepositsLeaderboard

func GetEth1DepositsLeaderboard(query string, length, start uint64, orderBy, orderDir string) ([]*types.EthOneDepositLeaderboardData, uint64, error)

func GetEth2Deposits

func GetEth2Deposits(query string, length, start uint64, orderBy, orderDir string) ([]*types.EthTwoDepositData, error)

func GetEth2DepositsCount

func GetEth2DepositsCount(search string) (uint64, error)

func GetExplorerConfigurations

func GetExplorerConfigurations() ([]*types.ExplorerConfig, error)

get all explorer configurations

func GetHistoricPrice

func GetHistoricPrice(currency string, day uint64) (float64, error)

func GetLastPendingAndProposedBlocks

func GetLastPendingAndProposedBlocks(startEpoch, endEpoch uint64) ([]*types.MinimalBlock, error)

GetLastPendingAndProposedBlocks will return all proposed and pending blocks (ignores missed slots) from the database

func GetLastWithdrawalEpoch

func GetLastWithdrawalEpoch(validators []uint64) (map[uint64]uint64, error)

func GetLatestEpoch

func GetLatestEpoch() (uint64, error)

GetLatestEpoch will return the latest epoch from the database

func GetMachineRowKey

func GetMachineRowKey(userID uint64, process string, machine string) string

func GetMailsSentCount

func GetMailsSentCount(email string, t time.Time) (int, error)

GetMailsSentCount returns the number of sent mails for the day of the passed time.

func GetMostRecentWithdrawalValidator

func GetMostRecentWithdrawalValidator() (uint64, error)

func GetNodeJob

func GetNodeJob(id string) (*types.NodeJob, error)

func GetNodeJobValidatorInfos

func GetNodeJobValidatorInfos(job *types.NodeJob) ([]types.NodeJobValidatorInfo, error)

func GetPendingBLSChangeValidatorCount

func GetPendingBLSChangeValidatorCount() (uint64, error)

func GetPendingValidatorCount

func GetPendingValidatorCount() (uint64, error)

GetPendingValidatorCount queries the pending validators currently in the queue

func GetQueueAheadOfValidator

func GetQueueAheadOfValidator(validatorIndex uint64) (uint64, error)

func GetRelayDataForIndexedBlocks

func GetRelayDataForIndexedBlocks(blocks []*types.Eth1BlockIndexed) (map[common.Hash]types.RelaysData, error)

func GetSlashingCount

func GetSlashingCount() (uint64, error)

func GetSlotBLSChange

func GetSlotBLSChange(slot uint64) ([]*types.BLSChange, error)

func GetSlotVizData

func GetSlotVizData(latestEpoch uint64) ([]*types.SlotVizEpochs, error)

func GetSlotWithdrawals

func GetSlotWithdrawals(slot uint64) ([]*types.Withdrawals, error)

func GetSubsForEventFilter

func GetSubsForEventFilter(eventName types.EventName) ([][]byte, map[string][]types.Subscription, error)

func GetSubscriptions

func GetSubscriptions(filter GetSubscriptionsFilter) ([]*types.Subscription, error)

GetSubscriptions returns the subscriptions filtered by the provided filter.

func GetTaggedValidators

func GetTaggedValidators(filter WatchlistFilter) ([]*types.TaggedValidators, error)

GetTaggedValidators returns validators that were tagged by a user

func GetTotalAmountDeposited

func GetTotalAmountDeposited() (uint64, error)

func GetTotalAmountWithdrawn

func GetTotalAmountWithdrawn() (sum uint64, count uint64, err error)

func GetTotalBLSChanges

func GetTotalBLSChanges() (uint64, error)

func GetTotalEligibleEther

func GetTotalEligibleEther() (uint64, error)

func GetTotalValidatorsCount

func GetTotalValidatorsCount() (uint64, error)

GetTotalValidatorsCount will return the total-validator-count

func GetTotalWithdrawals

func GetTotalWithdrawals() (total uint64, err error)

func GetUserAPIKeyStatistics

func GetUserAPIKeyStatistics(apikey *string) (*types.ApiStatistics, error)

func GetUserApiKeyById

func GetUserApiKeyById(id uint64) (string, error)

func GetUserAuthDataByAuthorizationCode

func GetUserAuthDataByAuthorizationCode(code string) (*types.OAuthCodeData, error)

GetUserAuthDataByAuthorizationCode checks an oauth code for validity, consumes the code and returns the userId on success

func GetUserDevicesByUserID

func GetUserDevicesByUserID(userID uint64) ([]types.PairedDevice, error)

func GetUserEmailById

func GetUserEmailById(id uint64) (string, error)

GetUserEmailById returns the email of a user.

func GetUserEmailsByIds

func GetUserEmailsByIds(ids []uint64) (map[uint64]string, error)

GetUserEmailsByIds returns the emails of users.

func GetUserIdByApiKey

func GetUserIdByApiKey(apiKey string) (*types.UserWithPremium, error)

func GetUserMonitorSharingSetting

func GetUserMonitorSharingSetting(userID uint64) (bool, error)

func GetUserPremiumSubscription

func GetUserPremiumSubscription(id uint64) (types.UserPremiumSubscription, error)

func GetUserPushTokenByIds

func GetUserPushTokenByIds(ids []uint64) (map[uint64][]string, error)

func GetUserSubscriptionIDByStripe

func GetUserSubscriptionIDByStripe(stripeSubscriptionID string) (uint64, error)

func GetValidatorBLSChange

func GetValidatorBLSChange(validatorindex uint64) (*types.BLSChange, error)

func GetValidatorDeposits

func GetValidatorDeposits(publicKey []byte) (*types.ValidatorDeposits, error)

GetValidatorDeposits will return eth1- and eth2-deposits for a public key from the database

func GetValidatorIncomeHistory

func GetValidatorIncomeHistory(validator_indices []uint64, lowerBoundDay uint64, upperBoundDay uint64) ([]types.ValidatorIncomeHistory, int64, error)

func GetValidatorIncomeHistoryChart

func GetValidatorIncomeHistoryChart(validator_indices []uint64, currency string) ([]*types.ChartDataPoint, int64, error)

func GetValidatorIndex

func GetValidatorIndex(publicKey []byte) (uint64, error)

GetValidatorIndex will return the validator-index for a public key from the database

func GetValidatorNames

func GetValidatorNames() (map[uint64]string, error)

func GetValidatorPublicKey

func GetValidatorPublicKey(index uint64) ([]byte, error)

GetValidatorPublicKey will return the public key for a specific validator from the database

func GetValidatorWithdrawals

func GetValidatorWithdrawals(validator uint64, limit uint64, offset uint64, orderBy string, orderDir string) ([]*types.Withdrawals, error)

func GetValidatorWithdrawalsCount

func GetValidatorWithdrawalsCount(validator uint64) (count, lastWithdrawalEpoch uint64, err error)

func GetValidatorsBLSChange

func GetValidatorsBLSChange(validators []uint64) ([]*types.ValidatorsBLSChange, error)

GetValidatorsBLSChange returns the BLS change for a list of validators

func GetValidatorsGotSlashed

func GetValidatorsGotSlashed(epoch uint64) ([]struct {
	Epoch                  uint64 `db:"epoch"`
	SlasherIndex           uint64 `db:"slasher"`
	SlasherPubkey          string `db:"slasher_pubkey"`
	SlashedValidatorIndex  uint64 `db:"slashedvalidator"`
	SlashedValidatorPubkey []byte `db:"slashedvalidator_pubkey"`
	Reason                 string `db:"reason"`
}, error)

GetValidatorsGotSlashed returns the validators that got slashed after `epoch` either by an attestation violation or a proposer violation

func GetValidatorsInitialWithdrawalCredentials

func GetValidatorsInitialWithdrawalCredentials(validators []uint64) ([][]byte, error)

func GetValidatorsWithdrawals

func GetValidatorsWithdrawals(validators []uint64, fromEpoch uint64, toEpoch uint64) ([]*types.Withdrawals, error)

func GetValidatorsWithdrawalsByEpoch

func GetValidatorsWithdrawalsByEpoch(validator []uint64, startEpoch uint64, endEpoch uint64) ([]*types.WithdrawalsByEpoch, error)

func GetWithdrawableValidatorCount

func GetWithdrawableValidatorCount(epoch uint64) (uint64, error)

func GetWithdrawals

func GetWithdrawals(query string, length, start uint64, orderBy, orderDir string) ([]*types.Withdrawals, error)

func InsertAdConfigurations

func InsertAdConfigurations(adConfig types.AdConfig) error

insert new ad configuration

func InsertMobileSubscription

func InsertMobileSubscription(tx *sql.Tx, userID uint64, paymentDetails types.MobileSubscription, store, receipt string, expiration int64, rejectReson string, extSubscriptionId string) error

func InsertUserDevice

func InsertUserDevice(userID uint64, hashedRefreshToken string, name string, appID uint64) (uint64, error)

InsertUserDevice Insert user device and return device id

func MobileDeviceDelete

func MobileDeviceDelete(userID, deviceID uint64) error

func MobileDeviceSettingsSelect

func MobileDeviceSettingsSelect(userID, deviceID uint64) (*sql.Rows, error)

func MobileDeviceSettingsUpdate

func MobileDeviceSettingsUpdate(userID, deviceID uint64, notifyEnabled, active string) (*sql.Rows, error)

func MobileNotificatonTokenUpdate

func MobileNotificatonTokenUpdate(userID, deviceID uint64, notifyToken string) error

func MustInitBigtableAdmin

func MustInitBigtableAdmin(ctx context.Context, project, instance string)

func MustInitDB

func MustInitDB(writer *types.DatabaseConfig, reader *types.DatabaseConfig)

func MustInitFrontendDB

func MustInitFrontendDB(writer *types.DatabaseConfig, reader *types.DatabaseConfig)

func NewTransaction

func NewTransaction() (*sql.Tx, error)

func RemoveFromWatchlist

func RemoveFromWatchlist(userId uint64, validator_publickey string, network string) error

RemoveFromWatchlist removes a validator for a given user from the users_validators_tag table It also deletes any subscriptions for that bookmarked validator

func SaveBlock

func SaveBlock(block *types.Block) error

func SaveChartSeriesPoint

func SaveChartSeriesPoint(date time.Time, indicator string, value any) error

func SaveDataTableState

func SaveDataTableState(user uint64, key string, state types.DataTableSaveState) error

SaveDataTableState saves the state of the current datatable state update

func SaveEpoch

func SaveEpoch(data *types.EpochData, client rpc.Client) error

SaveEpoch will stave the epoch data into the database

func SaveExplorerConfiguration

func SaveExplorerConfiguration(configs []types.ExplorerConfig) error

save current configurations

func SaveValidatorQueue

func SaveValidatorQueue(validators *types.ValidatorQueue) error

SaveValidatorQueue will save the validator queue into the database

func SetBlockStatus

func SetBlockStatus(blocks []*types.CanonBlock) error

func SetSubscriptionToExpired

func SetSubscriptionToExpired(tx *sql.Tx, id uint64) error

func SetUserMonitorSharingSetting

func SetUserMonitorSharingSetting(userID uint64, share bool) error

func StripeCreateSubscription

func StripeCreateSubscription(tx *sql.Tx, customerID, priceID, subscriptionID string, payload json.RawMessage) error

StripeCreateSubscription inserts a new subscription

func StripeGetCustomerEmail

func StripeGetCustomerEmail(customerID string) (string, error)

StripeGetCustomerEmail returns a customers email given their customerID

func StripeGetCustomerUserId

func StripeGetCustomerUserId(customerID string) (uint64, error)

func StripeGetSubscription

func StripeGetSubscription(id string) (*types.StripeSubscription, error)

StripeGetSubscription returns a subscription given a subscription_id

func StripeGetUserSubscription

func StripeGetUserSubscription(id uint64, purchaseGroup string) (types.UserSubscription, error)

StripeGetUserAPISubscription returns a users current subscription

func StripeRemoveCustomer

func StripeRemoveCustomer(customerID string) error

StripeRemoveCustomer removes the stripe customer and sets all subscriptions to inactive

func StripeUpdateCustomerID

func StripeUpdateCustomerID(email, customerID string) error

StripeUpdateCustomerID adds a stripe customer id to a user. It checks if the user already has a stripe customer id.

func StripeUpdateSubscription

func StripeUpdateSubscription(tx *sql.Tx, priceID, subscriptionID string, payload json.RawMessage) error

StripeUpdateSubscription inserts a new subscription

func StripeUpdateSubscriptionStatus

func StripeUpdateSubscriptionStatus(tx *sql.Tx, id string, status bool, payload *json.RawMessage) error

StripeUpdateSubscriptionStatus sets the status of a subscription

func SubmitBLSToExecutionChangesNodeJob

func SubmitBLSToExecutionChangesNodeJob(job *types.NodeJob) error

func SubmitBLSToExecutionChangesNodeJobs

func SubmitBLSToExecutionChangesNodeJobs() error

func SubmitNodeJobs

func SubmitNodeJobs() error

func SubmitVoluntaryExitNodeJob

func SubmitVoluntaryExitNodeJob(job *types.NodeJob) error

func SubmitVoluntaryExitNodeJobs

func SubmitVoluntaryExitNodeJobs() error

func TimestampToBigtableTimeDesc

func TimestampToBigtableTimeDesc(ts time.Time) string

func UpdateAdConfiguration

func UpdateAdConfiguration(adConfig types.AdConfig) error

update exisiting ad configuration

func UpdateBLSToExecutionChangesNodeJob

func UpdateBLSToExecutionChangesNodeJob(job *types.NodeJob) error

func UpdateBLSToExecutionChangesNodeJobs

func UpdateBLSToExecutionChangesNodeJobs() error

func UpdateCanonicalBlocks

func UpdateCanonicalBlocks(startEpoch, endEpoch uint64, blocks []*types.MinimalBlock) error

UpdateCanonicalBlocks will update the blocks for an epoch range in the database

func UpdateEpochFinalization

func UpdateEpochFinalization(finality_epoch uint64) error

UpdateEpochFinalization will update finalized-flag of unfinalized epochs

func UpdateEpochStatus

func UpdateEpochStatus(stats *types.ValidatorParticipation) error

UpdateEpochStatus will update the epoch status in the database

func UpdateMissedBlocks

func UpdateMissedBlocks(startEpoch, endEpoch uint64) error

UpdateMissedBlocks will update the missed blocks for an epoch range in the database

func UpdateMissedBlocksInEpochWithSlotCutoff

func UpdateMissedBlocksInEpochWithSlotCutoff(slot uint64) error

func UpdateNodeJobs

func UpdateNodeJobs() error

func UpdatePassword

func UpdatePassword(userId uint64, hash []byte) error

UpdatePassword updates the password of a user.

func UpdateSubscriptionLastSent

func UpdateSubscriptionLastSent(tx *sqlx.Tx, ts uint64, epoch uint64, subID uint64) error

UpdateSubscriptionLastSent updates `last_sent_ts` column of the `users_subscriptions` table.

func UpdateSubscriptionsLastSent

func UpdateSubscriptionsLastSent(subscriptionIDs []uint64, sent time.Time, epoch uint64, useDB *sqlx.DB) error

UpdateSubscriptionsLastSent updates `last_sent_ts` column of the `users_subscriptions` table.

func UpdateUserSubscription

func UpdateUserSubscription(tx *sql.Tx, id uint64, valid bool, expiration int64, rejectReason string) error

func UpdateVoluntaryExitNodeJob

func UpdateVoluntaryExitNodeJob(job *types.NodeJob) error

func UpdateVoluntaryExitNodeJobs

func UpdateVoluntaryExitNodeJobs() error

func WriteChartSeriesForDay

func WriteChartSeriesForDay(day int64) error

func WriteValidatorStatisticsForDay

func WriteValidatorStatisticsForDay(day uint64) error

Types

type Bigtable

type Bigtable struct {
	// contains filtered or unexported fields
}
var BigtableClient *Bigtable

func InitBigtable

func InitBigtable(project, instance, chainId string) (*Bigtable, error)

func (*Bigtable) CheckForGapsInBlocksTable

func (bigtable *Bigtable) CheckForGapsInBlocksTable(lookback int) (gapFound bool, start int, end int, err error)

func (*Bigtable) CheckForGapsInDataTable

func (bigtable *Bigtable) CheckForGapsInDataTable(lookback int) error

func (*Bigtable) Close

func (bigtable *Bigtable) Close()

func (*Bigtable) DeleteBlock

func (bigtable *Bigtable) DeleteBlock(blockNumber uint64, blockHash []byte) error

Deletes all block data from bigtable

func (*Bigtable) DeleteEpoch

func (bigtable *Bigtable) DeleteEpoch(epoch uint64) error

Deletes all block data from bigtable

func (*Bigtable) DeleteRowsWithPrefix

func (bigtable *Bigtable) DeleteRowsWithPrefix(prefix string)

func (*Bigtable) GetAddressBlocksMinedTableData

func (bigtable *Bigtable) GetAddressBlocksMinedTableData(address string, search string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressErc1155TableData

func (bigtable *Bigtable) GetAddressErc1155TableData(address string, search string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressErc20TableData

func (bigtable *Bigtable) GetAddressErc20TableData(address []byte, search string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressErc721TableData

func (bigtable *Bigtable) GetAddressErc721TableData(address string, search string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressInternalTableData

func (bigtable *Bigtable) GetAddressInternalTableData(address []byte, search string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressName

func (bigtable *Bigtable) GetAddressName(address []byte) (string, error)

func (*Bigtable) GetAddressNames

func (bigtable *Bigtable) GetAddressNames(addresses map[string]string) error

func (*Bigtable) GetAddressTransactionsTableData

func (bigtable *Bigtable) GetAddressTransactionsTableData(address []byte, search string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressUnclesMinedTableData

func (bigtable *Bigtable) GetAddressUnclesMinedTableData(address string, search string, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetAddressesNamesArMetadata

func (bigtable *Bigtable) GetAddressesNamesArMetadata(names *map[string]string, inputMetadata *map[string]*types.ERC20Metadata) (map[string]string, map[string]*types.ERC20Metadata, error)

func (*Bigtable) GetAggregatedValidatorIncomeDetailsHistory

func (bigtable *Bigtable) GetAggregatedValidatorIncomeDetailsHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]*itypes.ValidatorEpochIncome, error)

GetValidatorIncomeDetailsHistory returns the validator income details startEpoch & endEpoch are inclusive

func (*Bigtable) GetArbitraryTokenTransfersForTransaction

func (bigtable *Bigtable) GetArbitraryTokenTransfersForTransaction(transaction []byte) ([]*types.Transfer, error)

currently only erc20

func (*Bigtable) GetBalanceForAddress

func (bigtable *Bigtable) GetBalanceForAddress(address []byte, token []byte) (*types.Eth1AddressBalance, error)

func (*Bigtable) GetBlockFromBlocksTable

func (bigtable *Bigtable) GetBlockFromBlocksTable(number uint64) (*types.Eth1Block, error)

func (*Bigtable) GetBlockKeys

func (bigtable *Bigtable) GetBlockKeys(blockNumber uint64, blockHash []byte) ([]string, error)

func (*Bigtable) GetBlocksDescending

func (bigtable *Bigtable) GetBlocksDescending(start, limit uint64) ([]*types.Eth1BlockIndexed, error)

GetBlocksDescending gets blocks starting at block start

func (*Bigtable) GetBlocksIndexedMultiple

func (bigtable *Bigtable) GetBlocksIndexedMultiple(blockNumbers []uint64, limit uint64) ([]*types.Eth1BlockIndexed, error)

func (*Bigtable) GetClient

func (bigtable *Bigtable) GetClient() *gcp_bigtable.Client

func (*Bigtable) GetContractMetadata

func (bigtable *Bigtable) GetContractMetadata(address []byte) (*types.ContractMetadata, error)

func (*Bigtable) GetDataTable

func (bigtable *Bigtable) GetDataTable() *gcp_bigtable.Table

func (*Bigtable) GetERC20MetadataForAddress

func (bigtable *Bigtable) GetERC20MetadataForAddress(address []byte) (*types.ERC20Metadata, error)

func (*Bigtable) GetEpochIncomeHistory

func (bigtable *Bigtable) GetEpochIncomeHistory(epoch uint64) (*itypes.ValidatorEpochIncome, error)

func (*Bigtable) GetEpochIncomeHistoryDescending

func (bigtable *Bigtable) GetEpochIncomeHistoryDescending(startEpoch uint64, endEpoch uint64) (*itypes.ValidatorEpochIncome, error)

func (*Bigtable) GetEth1BlocksForAddress

func (bigtable *Bigtable) GetEth1BlocksForAddress(prefix string, limit int64) ([]*types.Eth1BlockIndexed, string, error)

func (*Bigtable) GetEth1ERC1155ForAddress

func (bigtable *Bigtable) GetEth1ERC1155ForAddress(prefix string, limit int64) ([]*types.ETh1ERC1155Indexed, string, error)

func (*Bigtable) GetEth1ERC20ForAddress

func (bigtable *Bigtable) GetEth1ERC20ForAddress(prefix string, limit int64) ([]*types.Eth1ERC20Indexed, string, error)

func (*Bigtable) GetEth1ERC721ForAddress

func (bigtable *Bigtable) GetEth1ERC721ForAddress(prefix string, limit int64) ([]*types.Eth1ERC721Indexed, string, error)

func (*Bigtable) GetEth1ItxForAddress

func (bigtable *Bigtable) GetEth1ItxForAddress(prefix string, limit int64) ([]*types.Eth1InternalTransactionIndexed, string, error)

func (*Bigtable) GetEth1TxForAddress

func (bigtable *Bigtable) GetEth1TxForAddress(prefix string, limit int64) ([]*types.Eth1TransactionIndexed, string, error)

func (*Bigtable) GetEth1TxForToken

func (bigtable *Bigtable) GetEth1TxForToken(prefix string, limit int64) ([]*types.Eth1ERC20Indexed, string, error)

func (*Bigtable) GetEth1UnclesForAddress

func (bigtable *Bigtable) GetEth1UnclesForAddress(prefix string, limit int64) ([]*types.Eth1UncleIndexed, string, error)

func (*Bigtable) GetFullBlockDescending

func (bigtable *Bigtable) GetFullBlockDescending(start, limit uint64) ([]*types.Eth1Block, error)

GetFullBlockDescending gets blocks starting at block start

func (*Bigtable) GetFullBlocksDescending

func (bigtable *Bigtable) GetFullBlocksDescending(stream chan<- *types.Eth1Block, high, low uint64) error

GetFullBlockDescending gets blocks starting at block start

func (*Bigtable) GetGasNowHistory

func (bigtable *Bigtable) GetGasNowHistory(ts, pastTs time.Time) ([]types.GasNowHistory, error)

func (*Bigtable) GetIndexedEth1Transaction

func (bigtable *Bigtable) GetIndexedEth1Transaction(txHash []byte) (*types.Eth1TransactionIndexed, error)

func (*Bigtable) GetInternalTransfersForTransaction

func (bigtable *Bigtable) GetInternalTransfersForTransaction(transaction []byte, from []byte) ([]types.Transfer, error)

func (*Bigtable) GetLastBlockInBlocksTable

func (bigtable *Bigtable) GetLastBlockInBlocksTable() (int, error)

func (*Bigtable) GetLastBlockInDataTable

func (bigtable *Bigtable) GetLastBlockInDataTable() (int, error)

func (Bigtable) GetMachineMetricsForNotifications

func (bigtable Bigtable) GetMachineMetricsForNotifications(rowKeys gcp_bigtable.RowList) (map[uint64]map[string]*types.MachineMetricSystemUser, error)

Returns a map[userID]map[machineName]machineData machineData contains the latest machine data in CurrentData and 5 minute old data in fiveMinuteOldData (defined in limit) as well as the insert timestamps of both

func (Bigtable) GetMachineMetricsMachineCount

func (bigtable Bigtable) GetMachineMetricsMachineCount(userID uint64) (uint64, error)

func (Bigtable) GetMachineMetricsMachineNames

func (bigtable Bigtable) GetMachineMetricsMachineNames(userID uint64) ([]string, error)

func (Bigtable) GetMachineMetricsNode

func (bigtable Bigtable) GetMachineMetricsNode(userID uint64, limit, offset int) ([]*types.MachineMetricNode, error)

func (Bigtable) GetMachineMetricsSystem

func (bigtable Bigtable) GetMachineMetricsSystem(userID uint64, limit, offset int) ([]*types.MachineMetricSystem, error)

func (Bigtable) GetMachineMetricsValidator

func (bigtable Bigtable) GetMachineMetricsValidator(userID uint64, limit, offset int) ([]*types.MachineMetricValidator, error)

func (*Bigtable) GetMetadatTable

func (bigtable *Bigtable) GetMetadatTable() *gcp_bigtable.Table

func (*Bigtable) GetMetadata

func (bigtable *Bigtable) GetMetadata(startToken string, limit int) ([]string, []*types.Eth1AddressBalance, error)

func (*Bigtable) GetMetadataForAddress

func (bigtable *Bigtable) GetMetadataForAddress(address []byte) (*types.Eth1AddressMetadata, error)

func (*Bigtable) GetMetadataUpdates

func (bigtable *Bigtable) GetMetadataUpdates(prefix string, startToken string, limit int) ([]string, []*types.Eth1AddressBalance, error)

func (*Bigtable) GetMetadataUpdatesTable

func (bigtable *Bigtable) GetMetadataUpdatesTable() *gcp_bigtable.Table

func (*Bigtable) GetMethodLabel

func (bigtable *Bigtable) GetMethodLabel(id []byte, invokesContract bool) string

get a method label for its byte signature with defaults

func (*Bigtable) GetMethodSignature

func (bigtable *Bigtable) GetMethodSignature(hex string) (*string, error)

get a method signature by it's hex representation

func (*Bigtable) GetMethodSignatureImportStatus

func (bigtable *Bigtable) GetMethodSignatureImportStatus() (*types.MethodSignatureImportStatus, error)

Get the status of the last signature import run

func (*Bigtable) GetMostRecentBlockFromDataTable

func (bigtable *Bigtable) GetMostRecentBlockFromDataTable() (*types.Eth1BlockIndexed, error)

func (*Bigtable) GetTokenTransactionsTableData

func (bigtable *Bigtable) GetTokenTransactionsTableData(token []byte, address []byte, pageToken string) (*types.DataTableResponse, error)

func (*Bigtable) GetValidatorAttestationHistory

func (bigtable *Bigtable) GetValidatorAttestationHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64][]*types.ValidatorAttestation, error)

func (*Bigtable) GetValidatorBalanceHistory

func (bigtable *Bigtable) GetValidatorBalanceHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64][]*types.ValidatorBalance, error)

func (*Bigtable) GetValidatorBalanceStatistics

func (bigtable *Bigtable) GetValidatorBalanceStatistics(startEpoch, endEpoch uint64) (map[uint64]*types.ValidatorBalanceStatistic, error)

func (*Bigtable) GetValidatorEffectiveness

func (bigtable *Bigtable) GetValidatorEffectiveness(validators []uint64, epoch uint64) ([]*types.ValidatorEffectiveness, error)

returns the validator attestation effectiveness in %

func (*Bigtable) GetValidatorIncomeDetailsHistory

func (bigtable *Bigtable) GetValidatorIncomeDetailsHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]map[uint64]*itypes.ValidatorEpochIncome, error)

GetValidatorIncomeDetailsHistory returns the validator income details startEpoch & endEpoch are inclusive

func (*Bigtable) GetValidatorMissedAttestationHistory

func (bigtable *Bigtable) GetValidatorMissedAttestationHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]map[uint64]bool, error)

func (*Bigtable) GetValidatorMissedAttestationsCount

func (bigtable *Bigtable) GetValidatorMissedAttestationsCount(validators []uint64, firstEpoch uint64, lastEpoch uint64) (map[uint64]*types.ValidatorMissedAttestationsStatistic, error)

func (*Bigtable) GetValidatorProposalHistory

func (bigtable *Bigtable) GetValidatorProposalHistory(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64][]*types.ValidatorProposal, error)

func (*Bigtable) GetValidatorSyncCommitteesStats

func (bigtable *Bigtable) GetValidatorSyncCommitteesStats(validators []uint64, startEpoch uint64, endEpoch uint64) (types.SyncCommitteesStats, error)

func (*Bigtable) GetValidatorSyncDutiesHistoryOrdered

func (bigtable *Bigtable) GetValidatorSyncDutiesHistoryOrdered(validatorIndex uint64, startEpoch uint64, endEpoch uint64, reverseOrdering bool) ([]*types.ValidatorSyncParticipation, error)

func (*Bigtable) GetValidatorSyncDutiesStatistics

func (bigtable *Bigtable) GetValidatorSyncDutiesStatistics(validators []uint64, startEpoch uint64, endEpoch uint64) (map[uint64]*types.ValidatorSyncDutiesStatistic, error)

func (*Bigtable) SaveAddressName

func (bigtable *Bigtable) SaveAddressName(address []byte, name string) error

func (*Bigtable) SaveAttestationAssignments

func (bigtable *Bigtable) SaveAttestationAssignments(epoch uint64, assignments map[string]uint64) error

func (*Bigtable) SaveAttestations

func (bigtable *Bigtable) SaveAttestations(blocks map[uint64]map[string]*types.Block) error

func (*Bigtable) SaveBalances

func (bigtable *Bigtable) SaveBalances(balances []*types.Eth1AddressBalance, deleteKeys []string) error

func (*Bigtable) SaveBlock

func (bigtable *Bigtable) SaveBlock(block *types.Eth1Block) error

func (*Bigtable) SaveBlockKeys

func (bigtable *Bigtable) SaveBlockKeys(blockNumber uint64, blockHash []byte, keys string) error

func (*Bigtable) SaveBlocks

func (bigtable *Bigtable) SaveBlocks(block *types.Eth1Block) error

func (*Bigtable) SaveContractMetadata

func (bigtable *Bigtable) SaveContractMetadata(address []byte, metadata *types.ContractMetadata) error

func (*Bigtable) SaveERC20Metadata

func (bigtable *Bigtable) SaveERC20Metadata(address []byte, metadata *types.ERC20Metadata) error

func (*Bigtable) SaveERC20TokenPrices

func (bigtable *Bigtable) SaveERC20TokenPrices(prices []*types.ERC20TokenPrice) error

func (*Bigtable) SaveGasNowHistory

func (bigtable *Bigtable) SaveGasNowHistory(slow, standard, rapid, fast *big.Int) error

func (*Bigtable) SaveMachineMetric

func (bigtable *Bigtable) SaveMachineMetric(process string, userID uint64, machine string, data []byte) error

func (*Bigtable) SaveMethodSignatureImportStatus

func (bigtable *Bigtable) SaveMethodSignatureImportStatus(status types.MethodSignatureImportStatus) error

Save the status of the last signature import run

func (*Bigtable) SaveMethodSignatures

func (bigtable *Bigtable) SaveMethodSignatures(signatures []types.MethodSignature) error

Save a list of method signatures

func (*Bigtable) SaveProposalAssignments

func (bigtable *Bigtable) SaveProposalAssignments(epoch uint64, assignments map[uint64]uint64) error

func (*Bigtable) SaveProposals

func (bigtable *Bigtable) SaveProposals(blocks map[uint64]map[string]*types.Block) error

func (*Bigtable) SaveSyncComitteeDuties

func (bigtable *Bigtable) SaveSyncComitteeDuties(blocks map[uint64]map[string]*types.Block) error

func (*Bigtable) SaveSyncCommitteesAssignments

func (bigtable *Bigtable) SaveSyncCommitteesAssignments(startSlot, endSlot uint64, validators []uint64) error

func (*Bigtable) SaveValidatorBalances

func (bigtable *Bigtable) SaveValidatorBalances(epoch uint64, validators []*types.Validator) error

func (*Bigtable) SaveValidatorIncomeDetails

func (bigtable *Bigtable) SaveValidatorIncomeDetails(epoch uint64, rewards map[uint64]*itypes.ValidatorEpochIncome) error

func (*Bigtable) SearchForAddress

func (bigtable *Bigtable) SearchForAddress(addressPrefix []byte, limit int) ([]*types.Eth1AddressSearchItem, error)

func (*Bigtable) TransformBlock

func (bigtable *Bigtable) TransformBlock(block *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformBlock extracts blocks from bigtable more specifically from the table blocks. It transforms the block and strips any information that is not necessary for a blocks view It writes blocks to table data: Row: <chainID>:B:<reversePaddedBlockNumber> Family: f Column: data Cell: Proto<Eth1BlockIndexed>

It indexes blocks by: Row: <chainID>:I:B:<Miner>:<reversePaddedBlockNumber> Family: f Column: <chainID>:B:<reversePaddedBlockNumber> Cell: nil

func (*Bigtable) TransformERC1155

func (bigtable *Bigtable) TransformERC1155(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformERC1155 accepts an eth1 block and creates bigtable mutations for erc1155 transfer events. Example: https://etherscan.io/tx/0xcffdd4b44ba9361a769a559c360293333d09efffeab79c36125bb4b20bd04270#eventlog It transforms the logs contained within a block and writes the transformed logs to bigtable It writes erc1155 events to the table data: Row: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Family: f Column: data Cell: Proto<Eth1ERC1155Indexed> Example scan: "1:ERC1155:cffdd4b44ba9361a769a559c360293333d09efffeab79c36125bb4b20bd04270" returns mainnet erc1155 event(s) for transaction 0xcffdd4b44ba9361a769a559c360293333d09efffeab79c36125bb4b20bd04270

It indexes erc1155 events by: Row: <chainID>:I:ERC1155:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TOKEN_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TO_ADDRESS>:TO:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<FROM_ADDRESS>:FROM:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<FROM_ADDRESS>:TOKEN_SENT:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC1155:<TO_ADDRESS>:TOKEN_RECEIVED:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC1155:<txHash>:<paddedLogIndex> Cell: nil

func (*Bigtable) TransformERC20

func (bigtable *Bigtable) TransformERC20(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

https://etherscan.io/tx/0xb10588bde42cb8eb14e72d24088bd71ad3903857d23d50b3ba4187c0cb7d3646#eventlog TransformERC20 accepts an eth1 block and creates bigtable mutations for ERC20 transfer events. It transforms the logs contained within a block and writes the transformed logs to bigtable It writes ERC20 events to the table data: Row: <chainID>:ERC20:<txHash>:<paddedLogIndex> Family: f Column: data Cell: Proto<Eth1ERC20Indexed> Example scan: "1:ERC20:b10588bde42cb8eb14e72d24088bd71ad3903857d23d50b3ba4187c0cb7d3646" returns mainnet ERC20 event(s) for transaction 0xb10588bde42cb8eb14e72d24088bd71ad3903857d23d50b3ba4187c0cb7d3646

It indexes ERC20 events by: Row: <chainID>:I:ERC20:<TOKEN_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<FROM_ADDRESS>:TO:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<TO_ADDRESS>:FROM:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<FROM_ADDRESS>:TOKEN_SENT:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC20:<TO_ADDRESS>:TOKEN_RECEIVED:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC20:<txHash>:<paddedLogIndex> Cell: nil

func (*Bigtable) TransformERC721

func (bigtable *Bigtable) TransformERC721(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

example: https://etherscan.io/tx/0x4d3a6c56cecb40637c070601c275df9cc7b599b5dc1d5ac2473c92c7a9e62c64#eventlog TransformERC721 accepts an eth1 block and creates bigtable mutations for erc721 transfer events. It transforms the logs contained within a block and writes the transformed logs to bigtable It writes erc721 events to the table data: Row: <chainID>:ERC721:<txHash>:<paddedLogIndex> Family: f Column: data Cell: Proto<Eth1ERC721Indexed> Example scan: "1:ERC721:4d3a6c56cecb40637c070601c275df9cc7b599b5dc1d5ac2473c92c7a9e62c64" returns mainnet ERC721 event(s) for transaction 0x4d3a6c56cecb40637c070601c275df9cc7b599b5dc1d5ac2473c92c7a9e62c64

It indexes ERC721 events by: Row: <chainID>:I:ERC721:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TOKEN_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<FROM_ADDRESS>:TO:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TO_ADDRESS>:FROM:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<FROM_ADDRESS>:TOKEN_SENT:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

Row: <chainID>:I:ERC721:<TO_ADDRESS>:TOKEN_RECEIVED:<TOKEN_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<PaddedLogIndex> Family: f Column: <chainID>:ERC721:<txHash>:<paddedLogIndex> Cell: nil

func (*Bigtable) TransformItx

func (bigtable *Bigtable) TransformItx(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformItx extracts internal transactions from bigtable more specifically from the table blocks. It transforms the internal transactions contained within a block and strips any information that is not necessary for our frontend views It writes internal transactions to table data: Row: <chainID>:ITX:<TX_HASH>:<paddedITXIndex> Family: f Column: data Cell: Proto<Eth1InternalTransactionIndexed>

It indexes internal transactions by: Row: <chainID>:I:ITX:<FROM_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil Row: <chainID>:I:ITX:<TO_ADDRESS>:TIME:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil Row: <chainID>:I:ITX:<FROM_ADDRESS>:TO:<TO_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil Row: <chainID>:I:ITX:<TO_ADDRESS>:FROM:<FROM_ADDRESS>:<reversePaddedBigtableTimestamp>:<paddedTxIndex>:<paddedITXIndex> Family: f Column: <chainID>:ITX:<HASH>:<paddedITXIndex> Cell: nil

func (*Bigtable) TransformTx

func (bigtable *Bigtable) TransformTx(blk *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformTx extracts transactions from bigtable more specifically from the table blocks.

func (*Bigtable) TransformUncle

func (bigtable *Bigtable) TransformUncle(block *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformUncle accepts an eth1 block and creates bigtable mutations. It transforms the uncles contained within a block, extracts the necessary information to create a view and writes that information to bigtable It writes uncles to table data: Row: <chainID>:U:<reversePaddedNumber> Family: f Column: data Cell: Proto<Eth1UncleIndexed> Example scan: "1:U:" returns mainnet uncles mined in desc order Example scan: "1:U:984886725" returns mainnet uncles mined after block 15113275 (1000000000 - 984886725)

It indexes uncles by: Row: <chainID>:I:U:<Miner>:TIME:<reversePaddedBigtableTimestamp> Family: f Column: <chainID>:U:<reversePaddedNumber> Cell: nil Example lookup: "1:I:U:ea674fdde714fd979de3edf0f56aa9716b898ec8:TIME:" returns mainnet uncles mined by ethermine in desc order

func (*Bigtable) TransformWithdrawals

func (bigtable *Bigtable) TransformWithdrawals(block *types.Eth1Block, cache *freecache.Cache) (bulkData *types.BulkMutations, bulkMetadataUpdates *types.BulkMutations, err error)

TransformWithdrawals accepts an eth1 block and creates bigtable mutations. It transforms the withdrawals contained within a block, extracts the necessary information to create a view and writes that information to bigtable It writes uncles to table data: Row: <chainID>:W:<reversePaddedNumber>:<reversedWithdrawalIndex> Family: f Column: data Cell: Proto<Eth1WithdrawalIndexed> Example scan: "1:W:" returns withdrawals in desc order Example scan: "1:W:984886725" returns mainnet withdrawals included after block 15113275 (1000000000 - 984886725)

It indexes withdrawals by: Row: <chainID>:I:W:<Address>:TIME:<reversePaddedBigtableTimestamp> Family: f Column: <chainID>:W:<reversePaddedNumber> Cell: nil Example lookup: "1:I:W:ea674fdde714fd979de3edf0f56aa9716b898ec8:TIME:" returns withdrawals received by ethermine in desc order

func (*Bigtable) WriteBulk

func (bigtable *Bigtable) WriteBulk(mutations *types.BulkMutations, table *gcp_bigtable.Table) error

type BigtableAdmin

type BigtableAdmin struct {
	// contains filtered or unexported fields
}
var BigAdminClient *BigtableAdmin

func (*BigtableAdmin) SetupBigtableCache

func (admin *BigtableAdmin) SetupBigtableCache() error

func (*BigtableAdmin) TearDownCache

func (admin *BigtableAdmin) TearDownCache() error

type CreateFamily

type CreateFamily struct {
	Name   string
	Policy gcp_bigtable.GCPolicy
}

type GetSubscriptionsFilter

type GetSubscriptionsFilter struct {
	EventNames    *[]types.EventName
	UserIDs       *[]uint64
	EventFilters  *[]string
	Search        string
	Limit         uint64
	Offset        uint64
	JoinValidator bool
}

GetSubscriptionsFilter can be passed to GetSubscriptions() to filter subscriptions.

type IndexFilter

type IndexFilter string
const (
	FILTER_TIME           IndexFilter = "TIME"
	FILTER_TO             IndexFilter = "TO"
	FILTER_FROM           IndexFilter = "FROM"
	FILTER_TOKEN_RECEIVED IndexFilter = "TOKEN_RECEIVED"
	FILTER_TOKEN_SENT     IndexFilter = "TOKEN_SENT"
	FILTER_METHOD         IndexFilter = "METHOD"
	FILTER_CONTRACT       IndexFilter = "CONTRACT"
	FILTER_ERROR          IndexFilter = "ERROR"
)

type PremiumResult

type PremiumResult struct {
	Package string `db:"product_id"`
	Store   string `db:"store"`
}

func GetUserPremiumPackage

func GetUserPremiumPackage(userID uint64) (PremiumResult, error)

type WatchlistEntry

type WatchlistEntry struct {
	UserId              uint64
	Validator_publickey string
}

type WatchlistFilter

type WatchlistFilter struct {
	Tag            types.Tag
	UserId         uint64
	Validators     *pq.ByteaArray
	JoinValidators bool
	Network        string
}

Jump to

Keyboard shortcuts

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