store

package
v0.0.0-...-3499ab5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PendingInitialized = "pending_initialized" // Pending
	PendingQueued      = "pending_queued"      // Pending
	ActiveOngoing      = "active_ongoing"      // Active
	ActiveExiting      = "active_exiting"      // Active
	ActiveSlashed      = "active_slashed"      // Slashed
	ExitedUnSlashed    = "exited_unslashed"    // Exited
	ExitedSlashed      = "exited_slashed"      // Slashed
	WithdrawalPossible = "withdrawal_possible" // Withdrawal
	WithdrawalDone     = "withdrawal_done"     // Withdrawal
)
View Source
const (
	ValidatorPending = "Pending"
	ValidatorActive  = "Active"
	ValidatorSlashed = "Slashed"
	ValidatorExited  = "Exited"
	ValidatorUnknown = "Unknown"
)
View Source
const DefaultValidatorIndex = int64(-1)

Variables

This section is empty.

Functions

func CalcClusterOnChainBalance

func CalcClusterOnChainBalance(curBlock uint64, clusterInfo *ClusterInfo) string

func GetStatusDescription

func GetStatusDescription(status string) string

Types

type AlarmInfo

type AlarmInfo struct {
	gorm.Model
	EoaOwner                   string `gorm:"type:VARCHAR(64); uniqueIndex" json:"eoa_owner"`
	AlarmType                  int    `json:"alarm_type"`
	AlarmChannel               string `json:"alarm_channel"`
	AlarmChannelHash           string `json:"alarm_channel_hash"`
	ReportLiquidationThreshold uint64 `json:"report_liquidation_threshold"`
	ReportOperatorFeeChange    bool   `json:"report_operator_fee_change"`
	ReportNetworkFeeChange     bool   `json:"report_network_fee_change"`
	ReportProposeBlock         bool   `json:"report_propose_block"`
	ReportMissedBlock          bool   `json:"report_missed_block"`
	ReportBalanceDecrease      bool   `json:"report_balance_decrease"`
	ReportExitedButNotRemoved  bool   `json:"report_exited_but_not_removed"`
	ReportWeekly               bool   `json:"report_weekly"`
}

func (*AlarmInfo) TableName

func (s *AlarmInfo) TableName() string

type BlockChange

type BlockChange struct {
	Block  int64
	Change int
}

type BlockInfo

type BlockInfo struct {
	gorm.Model
	ClusterID   string `gorm:"type:VARCHAR(64); index" json:"cluster_id"`
	BlockNumber uint64 `json:"block_number"`
	Epoch       uint64 `json:"epoch"`
	Slot        uint64 `gorm:"uniqueIndex" json:"slot"`
	Proposer    uint64 `json:"proposer"`
	PublicKey   string `json:"public_key"`
	IsMissed    bool   `gorm:"index" json:"is_missed"`
}

func (*BlockInfo) TableName

func (s *BlockInfo) TableName() string

type ChartData

type ChartData struct {
	Name       string `json:"name"`
	Validators int    `json:"validators"`
	Operators  int    `json:"operators"`
}

type ClusterInfo

type ClusterInfo struct {
	gorm.Model
	ClusterID                string `gorm:"type:VARCHAR(64); uniqueIndex" json:"cluster_id"`
	Owner                    string `gorm:"type:VARCHAR(64); index" json:"owner"`
	EoaOwner                 string `gorm:"type:VARCHAR(64); index" json:"eoa_owner"`
	OperatorIds              string `json:"operator_ids"`
	ValidatorCount           uint32 `gorm:"index" json:"validator_count"`
	NetworkFeeIndex          uint64 `json:"network_fee_index"`
	Index                    uint64 `json:"cluster_index"`
	Active                   bool   `json:"active"`
	Balance                  string `json:"balance"`
	BurnFee                  uint64 `json:"burn_fee"`
	OnChainBalance           string `json:"on_chain_balance"`
	LiquidationBlock         uint64 `json:"liquidation_block"`
	CalcLiquidationBlock     uint64 `json:"calc_liquidation_block"`
	UpcomingBurnFee          uint64 `gorm:"default:0" json:"upcoming_burn_fee"`
	UpcomingLiquidationBlock uint64 `gorm:"default:0" json:"upcoming_liquidation_block"`
	UpcomingCalcTime         int64  `gorm:"default:0" json:"upcoming_calc_time"`
}

func (*ClusterInfo) TableName

func (s *ClusterInfo) TableName() string

type CumulativeValue

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

type EventInfo

type EventInfo struct {
	gorm.Model
	BlockNumber uint64 `gorm:"block_number"`
	Owner       string `gorm:"type:VARCHAR(64); index" json:"owner"`
	TxHash      string `gorm:"type:VARCHAR(70); uniqueIndex:txhash_logindex" json:"tx_hash"`
	LogIndex    uint   `gorm:"uniqueIndex:txhash_logindex" json:"log_index"`
	Action      string `json:"action"`
	ClusterID   string `gorm:"index" json:"cluster_id"`
}

func (*EventInfo) TableName

func (s *EventInfo) TableName() string

type FeeAddressInfo

type FeeAddressInfo struct {
	gorm.Model
	Owner      string `gorm:"type:VARCHAR(64); uniqueIndex" json:"owner"`
	FeeAddress string `json:"fee_address"`
}

func (*FeeAddressInfo) TableName

func (s *FeeAddressInfo) TableName() string

type NetworkInfo

type NetworkInfo struct {
	gorm.Model
	UpcomingNetworkFee uint64 `json:"upcoming_network_fee"`
}

func (*NetworkInfo) TableName

func (s *NetworkInfo) TableName() string

type OperatorInfo

type OperatorInfo struct {
	gorm.Model
	Owner                string `json:"owner"`
	OperatorId           uint64 `gorm:"uniqueIndex" json:"operator_id"`
	PubKey               string `json:"pub_key"`
	OperatorName         string `json:"operator_name"`
	ValidatorCount       uint32 `json:"validator_count"`
	ClusterIds           string `json:"cluster_ids"`
	OperatorFee          string `json:"operator_fee"`
	OperatorEarnings     string `gorm:"default:-" json:"operator_earnings"`
	PrivacyStatus        bool   `json:"privacy_status"`
	WhitelistedAddress   string `json:"whitelisted_address"`
	WhitelistingContract string `json:"whitelisting_contract"`
	RegistrationBlock    int64  `gorm:"index" json:"registration_block"`
	RemoveBlock          int64  `gorm:"index" json:"remove_block"`
	PendingOperatorFee   string `gorm:"default:0;index" json:"pending_operator_fee"`
	ApprovalBeginTime    int64  `gorm:"default:0" json:"approval_begin_time"`
	ApprovalEndTime      int64  `gorm:"default:0" json:"approval_end_time"`
}

func (*OperatorInfo) TableName

func (s *OperatorInfo) TableName() string

type SSVReward

type SSVReward struct {
	gorm.Model
	MerkleRoot string          `json:"merkle_root"`
	Account    string          `gorm:"type:VARCHAR(64); uniqueIndex" json:"account"`
	Amount     decimal.Decimal `json:"amount"`
	Proofs     string          `json:"proofs"`
}

func (*SSVReward) TableName

func (s *SSVReward) TableName() string

type ScanPoint

type ScanPoint struct {
	gorm.Model
	Eth1Block uint64 `json:"eth1_block"`
	Eth2Slot  uint64 `json:"eth2_slot"`
}

func (*ScanPoint) TableName

func (s *ScanPoint) TableName() string

type Store

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

func NewStore

func NewStore(cfg *config.Config) (*Store, error)

func (*Store) AdminGetValidators

func (s *Store) AdminGetValidators(page int, itemsPerPage int) ([]ValidatorInfo, int64, error)

func (*Store) BatchUpdateOperatorValidatorCount

func (s *Store) BatchUpdateOperatorValidatorCount(operatorIds []uint64, increment bool) error

func (*Store) BatchUpdateOperatorValidatorCounts

func (s *Store) BatchUpdateOperatorValidatorCounts(operatorIds []uint64, count uint32, increment bool) error

func (*Store) CalculateChartData

func (s *Store) CalculateChartData() ([]ChartData, error)

func (*Store) CancelUpdateOperatorFee

func (s *Store) CancelUpdateOperatorFee(operatorId uint64) error

func (*Store) ClusterLiquidation

func (s *Store) ClusterLiquidation(clusterID string, liquidationBlock uint64) error

func (*Store) CreateBlock

func (s *Store) CreateBlock(info *BlockInfo) error

func (*Store) CreateEvent

func (s *Store) CreateEvent(events []*EventInfo) error

func (*Store) CreateOperator

func (s *Store) CreateOperator(info *OperatorInfo) error

func (*Store) CreateOrUpdateAlarmInfo

func (s *Store) CreateOrUpdateAlarmInfo(info *AlarmInfo) error

func (*Store) CreateOrUpdateCluster

func (s *Store) CreateOrUpdateCluster(info *ClusterInfo) error

func (*Store) CreateOrUpdateClusterFeeAddress

func (s *Store) CreateOrUpdateClusterFeeAddress(info *FeeAddressInfo) error

func (*Store) CreateOrUpdateSSVReward

func (s *Store) CreateOrUpdateSSVReward(merkleRoot, account string, amountInt *big.Int, proofs string) error

func (*Store) CreateValidator

func (s *Store) CreateValidator(info *ValidatorInfo) error

func (*Store) DeleteAlarmByEoaOwner

func (s *Store) DeleteAlarmByEoaOwner(eoaOwner string) error

DeleteAlarmByEoaOwner Unscoped delete

func (*Store) ExitValidator

func (s *Store) ExitValidator(publicKey string, exitBlock int64) error

func (*Store) Get30DayLiquidationRankingClusters

func (s *Store) Get30DayLiquidationRankingClusters(page int, itemsPerPage int, curBlock uint64) ([]ClusterInfo, int64, error)

func (*Store) Get30DaySimulatedLiquidationRankingClusters

func (s *Store) Get30DaySimulatedLiquidationRankingClusters(page int, itemsPerPage int, curBlock uint64) ([]ClusterInfo, int64, error)

func (*Store) GetActiveButExitedValidatorCount

func (s *Store) GetActiveButExitedValidatorCount(clusterId string) (int64, error)

func (*Store) GetActiveButExitedValidators

func (s *Store) GetActiveButExitedValidators(page int, itemsPerPage int) ([]ValidatorInfo, int64, error)

func (*Store) GetActiveButExitedValidatorsByClusterId

func (s *Store) GetActiveButExitedValidatorsByClusterId(clusterId string) ([]ValidatorInfo, error)

func (*Store) GetActiveClusterCount

func (s *Store) GetActiveClusterCount() (int64, error)

func (*Store) GetActiveClusters

func (s *Store) GetActiveClusters() ([]ClusterInfo, error)

func (*Store) GetActiveOperatorCount

func (s *Store) GetActiveOperatorCount() (int64, error)

func (*Store) GetActiveValidatorCount

func (s *Store) GetActiveValidatorCount() (int64, error)

func (*Store) GetAlarmByEoaOwner

func (s *Store) GetAlarmByEoaOwner(eoaOwner string) (*AlarmInfo, error)

func (*Store) GetAllAlarmInfos

func (s *Store) GetAllAlarmInfos() ([]AlarmInfo, error)

func (*Store) GetAllBlocks

func (s *Store) GetAllBlocks() ([]BlockInfo, error)

func (*Store) GetAllClusterByEoaOwner

func (s *Store) GetAllClusterByEoaOwner(owner string) ([]ClusterInfo, error)

func (*Store) GetAllClusters

func (s *Store) GetAllClusters() ([]ClusterInfo, error)

func (*Store) GetAllSSVRewardAccount

func (s *Store) GetAllSSVRewardAccount() ([]string, error)

func (*Store) GetAllValidatorsByClusterId

func (s *Store) GetAllValidatorsByClusterId(clusterId string) ([]ValidatorInfo, error)

GetAllValidatorsByClusterId should check is_slashed == false

func (*Store) GetBlockByClusterId

func (s *Store) GetBlockByClusterId(page int, itemsPerPage int, clusterID string) ([]BlockInfo, int64, error)

func (*Store) GetBlockInfoByClusterId

func (s *Store) GetBlockInfoByClusterId(clusterId string) (int64, int64, error)

func (*Store) GetClusterByClusterId

func (s *Store) GetClusterByClusterId(clusterId string) (*ClusterInfo, error)

func (*Store) GetClusterByOwner

func (s *Store) GetClusterByOwner(page, itemsPerPage int, owner string) ([]ClusterInfo, int64, error)

func (*Store) GetClusterFeeAddress

func (s *Store) GetClusterFeeAddress(owner string) (FeeAddressInfo, error)

func (*Store) GetClusterOfflineValidatorCount

func (s *Store) GetClusterOfflineValidatorCount(clusterId string) (int64, error)

func (*Store) GetClusters

func (s *Store) GetClusters(page int, itemsPerPage int) ([]ClusterInfo, int64, error)

func (*Store) GetEventByAccount

func (s *Store) GetEventByAccount(page int, itemsPerPage int, owner string) ([]EventInfo, int64, error)

func (*Store) GetEventByClusterId

func (s *Store) GetEventByClusterId(page int, itemsPerPage int, clusterID string) ([]EventInfo, int64, error)

func (*Store) GetLatestBlocks

func (s *Store) GetLatestBlocks() ([]BlockInfo, error)

func (*Store) GetLatestEvents

func (s *Store) GetLatestEvents() ([]EventInfo, error)

func (*Store) GetLatestValidators

func (s *Store) GetLatestValidators() ([]ValidatorInfo, error)

func (*Store) GetMaxOperatorId

func (s *Store) GetMaxOperatorId() (uint64, error)

func (*Store) GetMerkleRoot

func (s *Store) GetMerkleRoot() (string, error)

func (*Store) GetNetworkInfo

func (s *Store) GetNetworkInfo() (*NetworkInfo, error)

func (*Store) GetNoUpdatedClustersOwner

func (s *Store) GetNoUpdatedClustersOwner() ([]string, error)

func (*Store) GetOperatorByOperatorId

func (s *Store) GetOperatorByOperatorId(operatorId uint64) (*OperatorInfo, error)

func (*Store) GetOperatorByOperatorName

func (s *Store) GetOperatorByOperatorName(page, itemsPerPage int, operatorName string) ([]OperatorInfo, int64, error)

func (*Store) GetOperatorByOwner

func (s *Store) GetOperatorByOwner(page, itemsPerPage int, owner string) ([]OperatorInfo, int64, error)

func (*Store) GetOperatorValidatorCount

func (s *Store) GetOperatorValidatorCount(clusterIdsStr string) (uint32, error)

func (*Store) GetOperators

func (s *Store) GetOperators(page int, itemsPerPage int) ([]OperatorInfo, int64, error)

func (*Store) GetSSVReward

func (s *Store) GetSSVReward(account string) SSVReward

func (*Store) GetScanPoint

func (s *Store) GetScanPoint() (uint64, uint64, error)

func (*Store) GetTotalBlockCount

func (s *Store) GetTotalBlockCount() (int64, error)

func (*Store) GetValidatorByClusterId

func (s *Store) GetValidatorByClusterId(page int, itemsPerPage int, clusterId string) ([]ValidatorInfo, int64, error)

func (*Store) GetValidatorByOwner

func (s *Store) GetValidatorByOwner(page int, itemsPerPage int, owner string) ([]ValidatorInfo, int64, error)

func (*Store) GetValidatorByPubKeyAndBlock

func (s *Store) GetValidatorByPubKeyAndBlock(publicKey string, block uint64) (*ValidatorInfo, error)

func (*Store) GetValidatorByPublicKey

func (s *Store) GetValidatorByPublicKey(publicKey string) (*ValidatorInfo, error)

func (*Store) GetValidatorByValidatorIndex

func (s *Store) GetValidatorByValidatorIndex(validatorIndex int64) (*ValidatorInfo, error)

func (*Store) GetValidatorTotalBlockCount

func (s *Store) GetValidatorTotalBlockCount(pubKey string) (int64, error)

func (*Store) GetValidators

func (s *Store) GetValidators(page int, itemsPerPage int) ([]ValidatorInfo, int64, error)

func (*Store) RemoveOperator

func (s *Store) RemoveOperator(operatorId uint64, removeBlock int64) error

func (*Store) RemoveValidator

func (s *Store) RemoveValidator(publicKey, clusterId string, removeBlock int64) error

func (*Store) TxHashLogIndexIsExist

func (s *Store) TxHashLogIndexIsExist(txHash string, logIndex uint) bool

func (*Store) UpdateClusterEoaOwner

func (s *Store) UpdateClusterEoaOwner(owner string, eoaOwner string) error

func (*Store) UpdateClusterLiquidationInfo

func (s *Store) UpdateClusterLiquidationInfo(clusterID string, liquidationBlock uint64, calculateLiquidationBlock uint64, burnFee uint64, onChainBalance string) error

func (*Store) UpdateClusterStatus

func (s *Store) UpdateClusterStatus(clusterID string, status string) error

func (*Store) UpdateOperatorClusterIds

func (s *Store) UpdateOperatorClusterIds(operatorId uint64, clusterId string, increment bool) error

func (*Store) UpdateOperatorEarning

func (s *Store) UpdateOperatorEarning(operatorId uint64, earning string) error

func (*Store) UpdateOperatorFee

func (s *Store) UpdateOperatorFee(operatorId uint64, fee string) error

func (*Store) UpdateOperatorName

func (s *Store) UpdateOperatorName(operatorId uint64, name string) error

func (*Store) UpdateOperatorPrivacyStatus

func (s *Store) UpdateOperatorPrivacyStatus(operatorId uint64, status bool) error

func (*Store) UpdateOperatorValidatorCount

func (s *Store) UpdateOperatorValidatorCount(operatorId uint64, count uint32) error

func (*Store) UpdatePendingOperator

func (s *Store) UpdatePendingOperator(operatorId uint64, pendingFee string, beginTime, endTime uint64) error

func (*Store) UpdateScanEth1Block

func (s *Store) UpdateScanEth1Block(block uint64) error

func (*Store) UpdateScanEth2Slot

func (s *Store) UpdateScanEth2Slot(slot uint64) error

func (*Store) UpdateUpcomingClusterLiquidationInfo

func (s *Store) UpdateUpcomingClusterLiquidationInfo(clusterID string, upcomingLiquidationBlock uint64, upcomingCalcTime int64, upcomingBurnFee uint64) error

func (*Store) UpdateUpcomingNetworkFee

func (s *Store) UpdateUpcomingNetworkFee(fee uint64) error

func (*Store) UpdateValidatorIndex

func (s *Store) UpdateValidatorIndex(publicKey string, index int64) error

func (*Store) UpdateValidatorOnlineStatus

func (s *Store) UpdateValidatorOnlineStatus(validatorIndex int64, status bool) error

func (*Store) UpdateValidatorOnlineStatusByPubKey

func (s *Store) UpdateValidatorOnlineStatusByPubKey(pubKey string, status bool) error

func (*Store) UpdateValidatorStatus

func (s *Store) UpdateValidatorStatus(publicKey string, status string) error

func (*Store) UpdateWhitelistedAddress

func (s *Store) UpdateWhitelistedAddress(operatorId uint64, whitelistedAddress string) error

func (*Store) UpdateWhitelistingContract

func (s *Store) UpdateWhitelistingContract(operatorId uint64, whitelistingContract string) error

func (*Store) ValidatorSlash

func (s *Store) ValidatorSlash(publicKey string) error

type ValidatorInfo

type ValidatorInfo struct {
	gorm.Model
	ClusterID         string `gorm:"type:VARCHAR(64); uniqueIndex:clusterid_pubkey_registration_block; index" json:"cluster_id"`
	Owner             string `gorm:"type:VARCHAR(64); index" json:"owner"`
	OperatorIds       string `json:"operator_ids"`
	PublicKey         string `gorm:"type:VARCHAR(255); uniqueIndex:clusterid_pubkey_registration_block; index" json:"public_key"`
	ValidatorIndex    int64  `gorm:"index" json:"validator_index"`
	RegistrationBlock int64  `gorm:"uniqueIndex:clusterid_pubkey_registration_block; index" json:"registration_block"`
	RemoveBlock       int64  `gorm:"index" json:"remove_block"`
	ExitedBlock       int64  `gorm:"index" json:"exited_block"`
	IsSlashed         bool   `gorm:"default:false" json:"is_slashed"`
	IsOnline          bool   `gorm:"default:true" json:"is_online"`
	Status            string `json:"status"`
}

func (*ValidatorInfo) TableName

func (s *ValidatorInfo) TableName() string

Jump to

Keyboard shortcuts

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