Documentation ¶
Index ¶
- Constants
- func BuildDelegationByStakerPaginationToken(d DelegationDocument) (string, error)
- func BuildFinalityProviderStatsPaginationToken(d *FinalityProviderStatsDocument) (string, error)
- func BuildStakerStatsByStakerPaginationToken(d *StakerStatsDocument) (string, error)
- func DecodePaginationToken[T any](token string) (*T, error)
- func GetPaginationToken[PaginationType any](d PaginationType) (string, error)
- type BtcInfo
- type DAppDocument
- type DelegationByStakerPagination
- type DelegationDocument
- type FinalityProviderStatsDocument
- type FinalityProviderStatsPagination
- type OverallStatsDocument
- type StakerBtcAddress
- type StakerStatsByStakerPagination
- type StakerStatsDocument
- type StatsLockDocument
- type TimeLockDocument
- type TimelockTransaction
- type UnbondingDocument
- type UnprocessableMessageDocument
Constants ¶
View Source
const ( StatsLockCollection = "stats_lock" OverallStatsCollection = "overall_stats" FinalityProviderStatsCollection = "finality_providers_stats" StakerStatsCollection = "staker_stats" DelegationCollection = "delegations" TimeLockCollection = "timelock_queue" UnbondingCollection = "unbonding_queue" BtcInfoCollection = "btc_info" UnprocessableMsgCollection = "unprocessable_messages" DAppCollection = "dapps" GMPCollection = "gmps" )
View Source
const LatestBtcInfoId = "latest"
View Source
const (
UnbondingInitialState = "INSERTED"
)
Variables ¶
This section is empty.
Functions ¶
func BuildDelegationByStakerPaginationToken ¶
func BuildDelegationByStakerPaginationToken(d DelegationDocument) (string, error)
func BuildFinalityProviderStatsPaginationToken ¶
func BuildFinalityProviderStatsPaginationToken(d *FinalityProviderStatsDocument) (string, error)
func BuildStakerStatsByStakerPaginationToken ¶
func BuildStakerStatsByStakerPaginationToken(d *StakerStatsDocument) (string, error)
func DecodePaginationToken ¶
func GetPaginationToken ¶
Types ¶
type DAppDocument ¶
type DAppDocument struct { ID string `bson:"_id,omitempty"` ChainName string `bson:"chain_name"` BTCAddressHex string `bson:"btc_address_hex"` PublicKeyHex string `bson:"public_key_hex"` SmartContractAddress string `bson:"smart_contract_address"` State bool `bson:"state"` ChainID string `bson:"chain_id"` ChainEndpoint string `bson:"chain_endpoint"` RPCUrl string `bson:"rpc_url"` AccessToken string `bson:"access_token"` TokenContractAddress string `bson:"token_contract_address"` }
type DelegationDocument ¶
type DelegationDocument struct { StakingTxHashHex string `bson:"_id"` // Primary key StakerPkHex string `bson:"staker_pk_hex"` FinalityProviderPkHex string `bson:"finality_provider_pk_hex"` StakingValue uint64 `bson:"staking_value"` State types.DelegationState `bson:"state"` StakingTx *TimelockTransaction `bson:"staking_tx"` // Always exist UnbondingTx *TimelockTransaction `bson:"unbonding_tx,omitempty"` IsOverflow bool `bson:"is_overflow"` StakerBtcAddress *StakerBtcAddress `bson:"staker_btc_address,omitempty"` }
type OverallStatsDocument ¶
type StakerBtcAddress ¶
type StakerBtcAddress struct {
TaprootAddress string `bson:"taproot_address"`
}
The available addresses that can be derived from the given StakerPkHex
type StakerStatsByStakerPagination ¶
type StakerStatsByStakerPagination struct { StakerPkHex string `json:"staker_pk_hex"` ActiveTvl int64 `json:"active_tvl"` }
StakerStatsByStakerPagination is used to paginate the top stakers by active tvl ActiveTvl is used as the sorting key, whereas StakerPkHex is used as the secondary sorting key
type StakerStatsDocument ¶
type StatsLockDocument ¶
type StatsLockDocument struct { Id string `bson:"_id"` OverallStats bool `bson:"overall_stats"` StakerStats bool `bson:"staker_stats"` FinalityProviderStats bool `bson:"finality_provider_stats"` }
StatsLockDocument represents the document in the stats lock collection It's used as a lock to prevent concurrent stats calculation for the same staking tx hash As well as to prevent the same staking tx hash + txType to be processed multiple times The already processed stats will be marked as true in the document
func NewStatsLockDocument ¶
func NewStatsLockDocument( id string, overallStats, stakerStats, finalityProviderStats bool, ) *StatsLockDocument
type TimeLockDocument ¶
type TimeLockDocument struct { StakingTxHashHex string `bson:"staking_tx_hash_hex"` ExpireHeight uint64 `bson:"expire_height"` TxType string `bson:"tx_type"` }
func NewTimeLockDocument ¶
func NewTimeLockDocument(stakingTxHashHex string, expireHeight uint64, txType string) *TimeLockDocument
type TimelockTransaction ¶
type UnbondingDocument ¶
type UnbondingDocument struct { StakerPkHex string `bson:"staker_pk_hex"` FinalityPkHex string `bson:"finality_pk_hex"` UnbondingTxSigHex string `bson:"unbonding_tx_sig_hex"` State string `bson:"state"` UnbondingTxHashHex string `bson:"unbonding_tx_hash_hex"` // Unique Index UnbondingTxHex string `bson:"unbonding_tx_hex"` StakingTxHex string `bson:"staking_tx_hex"` StakingOutputIndex uint64 `bson:"staking_output_index"` StakingTimelock uint64 `bson:"staking_timelock"` StakingAmount uint64 `bson:"staking_amount"` StakingTxHashHex string `json:"staking_tx_hash_hex"` }
type UnprocessableMessageDocument ¶
type UnprocessableMessageDocument struct { MessageBody string `bson:"message_body"` Receipt string `bson:"receipt"` }
func NewUnprocessableMessageDocument ¶
func NewUnprocessableMessageDocument(messageBody, receipt string) *UnprocessableMessageDocument
Click to show internal directories.
Click to hide internal directories.