models

package
v0.0.0-...-2630fec Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

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 DecodePaginationToken[T any](token string) (*T, error)

func GetPaginationToken

func GetPaginationToken[PaginationType any](d PaginationType) (string, error)

Types

type Address

type Address struct {
	ID      uint
	Address string `gorm:"uniqueIndex"`
}

type Block

type Block = indexer_models.Block

type BlockEvent

type BlockEvent struct {
	ID uint
	// These fields uniquely identify every block event
	// Index refers to the position of the event in the block event lifecycle array
	// LifecyclePosition refers to whether the event is a BeginBlock or EndBlock event
	Index             uint64                 `gorm:"uniqueIndex:eventBlockPositionIndex,priority:3"`
	LifecyclePosition BlockLifecyclePosition `gorm:"uniqueIndex:eventBlockPositionIndex,priority:2"`
	BlockID           uint                   `gorm:"uniqueIndex:eventBlockPositionIndex,priority:1"`
	Block             Block
	BlockEventTypeID  uint
	BlockEventType    BlockEventType
}

type BlockEventAttribute

type BlockEventAttribute struct {
	ID           uint
	BlockEvent   BlockEvent
	BlockEventID uint `gorm:"uniqueIndex:eventAttributeIndex,priority:1"`
	Value        string
	Index        uint64 `gorm:"uniqueIndex:eventAttributeIndex,priority:2"`
	// Keys are limited to a smallish subset of string values set by the Cosmos SDK and external modules
	// Save DB space by storing the key as a foreign key
	BlockEventAttributeKeyID uint
	BlockEventAttributeKey   BlockEventAttributeKey
}

type BlockEventAttributeKey

type BlockEventAttributeKey struct {
	ID  uint
	Key string `gorm:"uniqueIndex"`
}

type BlockEventParser

type BlockEventParser struct {
	ID                     uint
	BlockLifecyclePosition BlockLifecyclePosition `gorm:"uniqueIndex:idx_block_event_parser_identifier_lifecycle_position"`
	Identifier             string                 `gorm:"uniqueIndex:idx_block_event_parser_identifier_lifecycle_position"`
}

type BlockEventParserError

type BlockEventParserError struct {
	ID                 uint
	BlockEventParserID uint
	BlockEventParser   BlockEventParser
	BlockEventID       uint
	BlockEvent         BlockEvent
	Error              string
}

type BlockEventType

type BlockEventType struct {
	ID   uint
	Type string `gorm:"uniqueIndex"`
}

type BlockLifecyclePosition

type BlockLifecyclePosition int

Used to keep track of BeginBlock and EndBlock events

const (
	BeginBlockEvent BlockLifecyclePosition = iota
	EndBlockEvent
)

type BtcInfo

type BtcInfo struct {
	ID             string `bson:"_id"`
	BtcHeight      uint64 `bson:"btc_height"`
	ConfirmedTvl   uint64 `bson:"confirmed_tvl"`
	UnconfirmedTvl uint64 `bson:"unconfirmed_tvl"`
}

type Chain

type Chain struct {
	ID      uint   `gorm:"primaryKey"`
	ChainID string `gorm:"uniqueIndex"` // e.g. osmosis-1
	Name    string // e.g. Osmosis
}

type CommandInfo

type CommandInfo struct {
	Chain            string   `json:"chain"`
	CommandID        string   `json:"command_id"`
	LogIndex         uint     `json:"log_index"`
	BatchID          string   `json:"batch_id"`
	BlockNumber      uint64   `json:"block_number"`
	BlockTimestamp   int64    `json:"block_timestamp"`
	CreatedAt        TimeInfo `json:"created_at"`
	Executed         bool     `json:"executed"`
	TransactionIndex uint     `json:"transaction_index"`
	TransferID       uint     `json:"transfer_id"`
	TransactionHash  string   `json:"transaction_hash"`
}

CommandInfo represents the command information

type ConfirmDocument

type ConfirmDocument struct {
	BlockNumber           uint64 `json:"blockNumber,omitempty"`
	BlockTimestamp        int64  `json:"block_timestamp,omitempty"`
	ConfirmaionTxHash     string `json:"confirmation_txhash,omitempty"`
	Event                 string `json:"event,omitempty"`
	PollId                string `json:"poll_id,omitempty"`
	SourceChain           string `json:"sourceChain,omitempty"`
	SourceTransactionHash string `json:"sourceTransactionHash,omitempty"`
	TransactionHash       string `json:"transactionHash,omitempty"`
	TransactionIndex      uint64 `json:"transactionIndex,omitempty"`
}

type ConfirmInfo

type ConfirmInfo struct {
	Amount           string      `json:"amount"`
	SourceChain      string      `json:"source_chain"`
	DepositAddress   string      `json:"deposit_address"`
	CreatedAt        TimeInfo    `json:"created_at"`
	DestinationChain string      `json:"destination_chain"`
	Denom            string      `json:"denom"`
	TransferID       uint        `json:"transfer_id"`
	Type             ConfirmType `json:"type"`
	TxHash           string      `json:"txhash"`
	Height           uint64      `json:"height"`
	Status           string      `json:"status"`
}

ConfirmInfo represents the confirm information

type ConfirmType

type ConfirmType string
const (
	ConfirmTypeVote ConfirmType = "vote"
)

type CreatedAtDocument

type CreatedAtDocument struct {
	Week    int64 `json:"week,omitempty"`
	Hour    int64 `json:"hour,omitempty"`
	Month   int64 `json:"month,omitempty"`
	Year    int64 `json:"year,omitempty"`
	Ms      int64 `json:"ms,omitempty"`
	Day     int64 `json:"day,omitempty"`
	Quarter int64 `json:"quarter,omitempty"`
}

type Custodial

type Custodial struct {
	ID              uint   `gorm:"primaryKey;column:id"`
	Name            string `gorm:"column:name"`
	BtcPublicKeyHex string `gorm:"uniqueIndex; not null;column:btc_public_key_hex"`
}

type CustodialGroup

type CustodialGroup struct {
	ID             uint        `gorm:"primaryKey;column:id"`
	Name           string      `gorm:"column:name"`
	TaprootAddress string      `gorm:"uniqueIndex; not null;column:taproot_address"` // Calculate from BtcPublicKeyHex of each Custodials
	Quorum         uint        `gorm:"not null;column:quorum"`
	Custodials     []Custodial `gorm:"many2many:custodial_group_members;"`
}

type DApp

type DApp struct {
	ID                   string         `gorm:"primaryKey;type:uuid;default:gen_random_uuid()"`
	ChainName            string         `gorm:"column:chain_name;not null"`
	BTCAddressHex        string         `gorm:"column:btc_address_hex"`
	PublicKeyHex         string         `gorm:"column:public_key_hex"`
	SmartContractAddress string         `gorm:"column:smart_contract_address"`
	State                bool           `gorm:"column:state"`
	ChainID              string         `gorm:"column:chain_id"`
	ChainEndpoint        string         `gorm:"column:chain_endpoint"`
	RPCUrl               string         `gorm:"column:rpc_url"`
	AccessToken          string         `gorm:"column:access_token"`
	TokenContractAddress string         `gorm:"column:token_contract_address"`
	CustodialGroupID     uint           `gorm:"not null" json:"-"`
	CustodialGroup       CustodialGroup `gorm:"constraint:OnUpdate:CASCADE,OnDelete:RESTRICT;"`
}

type DelegationByStakerPagination

type DelegationByStakerPagination struct {
	StakingTxHashHex   string `json:"staking_tx_hash_hex"`
	StakingStartHeight uint64 `json:"staking_start_height"`
}

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 Denom

type Denom struct {
	ID   uint
	Base string `gorm:"uniqueIndex"`
}

type ExpressFeeDocument

type ExpressFeeDocument struct {
	ExpressGasOverheadFee    float64 `json:"express_gas_overhead_fee,omitempty"`
	ExpressGasOverheadFeeUsd float64 `json:"express_gas_overhead_fee_usd,omitempty"`
	RelayerFee               float64 `json:"relayer_fee,omitempty"`
	RelayerFeeUsd            float64 `json:"relayer_fee_usd,omitempty"`
	Total                    float64 `json:"total,omitempty"`
	TotalUsd                 float64 `json:"total_usd,omitempty"`
}

type ExpressGasPriceRateDocument

type ExpressGasPriceRateDocument struct {
	AxelarToken            TokenDocument `json:"axelar_token,omitempty"`
	DestinationNativeToken TokenDocument `json:"destination_native_token,omitempty"`
	EthereumToken          TokenDocument `json:"ethereum_token,omitempty"`
	SourceToken            TokenDocument `json:"source_token,omitempty"`
}

type FailedBlock

type FailedBlock struct {
	ID           uint
	Height       int64 `gorm:"uniqueIndex:failedchainheight"`
	BlockchainID uint  `gorm:"uniqueIndex:failedchainheight"`
	Chain        Chain `gorm:"foreignKey:BlockchainID"`
}

type FailedEventBlock

type FailedEventBlock struct {
	ID           uint
	Height       int64 `gorm:"uniqueIndex:failedchaineventheight"`
	BlockchainID uint  `gorm:"uniqueIndex:failedchaineventheight"`
	Chain        Chain `gorm:"foreignKey:BlockchainID"`
}

type FailedMessage

type FailedMessage struct {
	ID           uint
	MessageIndex int
	TxID         uint
	Tx           Tx
}

type FailedTx

type FailedTx struct {
	ID      uint
	Hash    string `gorm:"uniqueIndex"`
	BlockID uint
	Block   Block
}

type Fee

type Fee struct {
	ID             uint            `gorm:"primaryKey"`
	TxID           uint            `gorm:"uniqueIndex:txDenomFee"`
	Amount         decimal.Decimal `gorm:"type:decimal(78,0);"`
	DenominationID uint            `gorm:"uniqueIndex:txDenomFee"`
	Denomination   Denom           `gorm:"foreignKey:DenominationID"`
	PayerAddressID uint            `gorm:"index:idx_payer_addr"`
	PayerAddress   Address         `gorm:"foreignKey:PayerAddressID"`
}

func (*Fee) BeforeCreate

func (b *Fee) BeforeCreate(tx *gorm.DB) (err error)

This lifecycle function ensures the on conflict statement is added for Fees which are associated to Txes by the Gorm slice association method for has_many

type FeesDocument

type FeesDocument struct {
	AxelarToken                 TokenDocument      `json:"axelar_token,omitempty"`
	BaseFee                     float64            `json:"base_fee,omitempty"`
	DestinationBaseFee          float64            `json:"destination_base_fee,omitempty"`
	DestinationBaseFeeString    string             `json:"destination_base_fee_string,omitempty"`
	DestinationBaseFeeUsd       float64            `json:"destination_base_fee_usd,omitempty"`
	DestinationConfirmFee       float64            `json:"destination_confirm_fee,omitempty"`
	DestinationExpressFee       ExpressFeeDocument `json:"destination_express_fee,omitempty"`
	DestinationNativeToken      TokenDocument      `json:"destination_native_token,omitempty"`
	EthereumToken               TokenDocument      `json:"ethereum_token,omitempty"`
	ExecuteGasMultiplier        float64            `json:"execute_gas_multiplier,omitempty"`
	ExecuteMinGasPrice          string             `json:"execute_min_gas_price,omitempty"`
	ExpressExecuteGasMultiplier float64            `json:"express_execute_gas_multiplier,omitempty"`
	ExpressFee                  float64            `json:"express_fee,omitempty"`
	ExpressFeeString            string             `json:"express_fee_string,omitempty"`
	ExpressFeeUsd               float64            `json:"express_fee_usd,omitempty"`
	ExpressSupported            bool               `json:"express_supported,omitempty"`
	SourceBaseFee               float64            `json:"source_base_fee,omitempty"`
	SourceBaseFeeUsd            float64            `json:"source_base_fee_usd,omitempty"`
	SourceConfirmFee            float64            `json:"source_confirm_fee,omitempty"`
	SourceExpressFee            ExpressFeeDocument `json:"source_express_fee,omitempty"`
	SourceToken                 TokenDocument      `json:"source_token,omitempty"`
}

type FinalityProviderStatsDocument

type FinalityProviderStatsDocument struct {
	FinalityProviderPkHex string `bson:"_id"` // FinalityProviderPkHex
	ActiveTvl             int64  `bson:"active_tvl"`
	TotalTvl              int64  `bson:"total_tvl"`
	ActiveDelegations     int64  `bson:"active_delegations"`
	TotalDelegations      int64  `bson:"total_delegations"`
}

type FinalityProviderStatsPagination

type FinalityProviderStatsPagination struct {
	FinalityProviderPkHex string `json:"finality_provider_pk_hex"`
	ActiveTvl             int64  `json:"active_tvl"`
}

type GMPDocument

type GMPDocument struct {
	Approved                              GMPStepDocument             `json:"approved,omitempty"`
	Call                                  GMPStepDocument             `json:"call,omitempty"`
	Confirm                               ConfirmDocument             `json:"confirm,omitempty"`
	Executed                              GMPStepDocument             `json:"executed,omitempty"`
	ExpressGasPriceRate                   ExpressGasPriceRateDocument `json:"express_gas_price_rate,omitempty"`
	Fees                                  FeesDocument                `json:"fees,omitempty"`
	Gas                                   GasDocument                 `json:"gas,omitempty"`
	GasPaid                               GMPStepDocument             `json:"gas_paid,omitempty"`
	GasPriceRate                          ExpressGasPriceRateDocument `json:"gas_price_rate,omitempty"`
	Refunded                              GMPStepDocument             `json:"refunded,omitempty"`
	IsInvalidPayloadHash                  bool                        `json:"is_invalid_payload_hash,omitempty"`
	CommandID                             string                      `json:"command_id,omitempty"`
	IsInvalidSourceAddress                bool                        `json:"is_invalid_source_address,omitempty"`
	IsInvalidContractAddress              bool                        `json:"is_invalid_contract_address,omitempty"`
	IsInvalidDestinationChain             bool                        `json:"is_invalid_destination_chain,omitempty"`
	IsCallFromRelayer                     bool                        `json:"is_call_from_relayer,omitempty"`
	IsInvalidSymbol                       bool                        `json:"is_invalid_symbol,omitempty"`
	IsInvalidAmount                       bool                        `json:"is_invalid_amount,omitempty"`
	IsInvalidCall                         bool                        `json:"is_invalid_call,omitempty"`
	TimeSpent                             TimeSpentDocument           `json:"time_spent,omitempty"`
	IsInvalidGasPaid                      bool                        `json:"is_invalid_gas_paid,omitempty"`
	IsInvalidGasPaidMismatchSourceAddress bool                        `json:"is_invalid_gas_paid_mismatch_source_address,omitempty"`
	IsInsufficientFee                     bool                        `json:"is_insufficient_fee,omitempty"`
	ConfirmFailed                         bool                        `json:"confirm_failed,omitempty"`
	ConfirmFailedEvent                    *string                     `json:"confirm_failed_event,omitempty,omitempty"`
	ExecutingAt                           int64                       `json:"executing_at,omitempty"`
	IsNotEnoughGas                        bool                        `json:"is_not_enough_gas,omitempty"`
	ExecutePendingTransactionHash         *string                     `json:"execute_pending_transaction_hash,omitempty,omitempty"`
	NotEnoughGasToExecute                 bool                        `json:"not_enough_gas_to_execute,omitempty"`
	ExecuteNonce                          *string                     `json:"execute_nonce,omitempty,omitempty"`
	RefundingAt                           int64                       `json:"refunding_at,omitempty"`
	ToRefund                              bool                        `json:"to_refund,omitempty"`
	IsExecuteFromRelayer                  bool                        `json:"is_execute_from_relayer,omitempty"`
	RefundNonce                           *string                     `json:"refund_nonce,omitempty,omitempty"`
	ID                                    string                      `json:"id,omitempty"`
	Status                                string                      `json:"status,omitempty"`
	SimplifiedStatus                      string                      `json:"simplified_status,omitempty"`
	GasStatus                             string                      `json:"gas_status,omitempty"`
	IsTwoWay                              bool                        `json:"is_two_way,omitempty"`
	CreatedAtDocument
}

type GMPStepDocument

type GMPStepDocument struct {
	Chain                string               `json:"chain,omitempty"`
	SourceChain          string               `json:"sourceChain,omitempty"`
	ContractAddress      string               `json:"contract_address,omitempty"`
	Address              string               `json:"address,omitempty"`
	Topics               []string             `json:"topics,omitempty"`
	BlockNumber          uint64               `json:"blockNumber"`
	TransactionHash      string               `json:"transactionHash,omitempty"`
	TransactionIndex     uint                 `json:"transactionIndex,omitempty"`
	BlockHash            string               `json:"blockHash,omitempty"`
	LogIndex             uint                 `json:"logIndex"`
	Removed              bool                 `json:"removed,omitempty"`
	ID                   string               `json:"id,omitempty"`
	Event                string               `json:"event,omitempty"`
	EventSignature       string               `json:"eventSignature,omitempty"`
	ReturnValues         ReturnValuesDocument `json:"returnValues,omitempty"`
	ChainType            string               `json:"chain_type,omitempty"`
	DestinationChainType string               `json:"destination_chain_type,omitempty"`
	CreatedAt            CreatedAtDocument    `json:"created_at,omitempty"`
	EventIndex           uint                 `json:"eventIndex,omitempty"`
	BlockTimestamp       int64                `json:"block_timestamp"`
	Receipt              ReceiptDocument      `json:"receipt,omitempty"`
	Transaction          TransactionDocument  `json:"transaction,omitempty"`
	LogIndexAlias        uint                 `json:"_logIndex"`
	TypeAlias            string               `json:"_type,omitempty"`
	ProposalId           string               `json:"proposal_id,omitempty"`
}

type GMPTx

type GMPTx struct {
	ID      uint `gorm:"primaryKey"`
	Hash    string
	BlockId uint
	Code    uint
	Memo    string
}

type GasDocument

type GasDocument struct {
	GasExecuteAmount    float64 `json:"gas_execute_amount,omitempty"`
	GasApproveAmount    float64 `json:"gas_approve_amount,omitempty"`
	GasExpressFeeAmount float64 `json:"gas_express_fee_amount,omitempty"`
	GasUsedAmount       float64 `json:"gas_used_amount,omitempty"`
	GasRemainAmount     float64 `json:"gas_remain_amount,omitempty"`
	GasPaidAmount       float64 `json:"gas_paid_amount,omitempty"`
	GasBaseFeeAmount    float64 `json:"gas_base_fee_amount,omitempty"`
	GasExpressAmount    float64 `json:"gas_express_amount,omitempty"`
	GasUsedValue        float64 `json:"gas_used_value,omitempty"`
}

type GasPriceInUnitsDocument

type GasPriceInUnitsDocument struct {
	Decimals uint64 `json:"decimals,omitempty"`
	Value    string `json:"value,omitempty"`
}

type LinkInfo

type LinkInfo struct {
	OriginalSourceChain      string   `json:"original_source_chain"`
	DepositAddress           string   `json:"deposit_address"`
	CreatedAt                TimeInfo `json:"created_at"`
	DestinationChain         string   `json:"destination_chain"`
	RecipientAddress         string   `json:"recipient_address"`
	Type                     string   `json:"type"`
	TxHash                   string   `json:"txhash"`
	SenderAddress            string   `json:"sender_address"`
	SourceChain              string   `json:"source_chain"`
	ID                       string   `json:"id"`
	Denom                    string   `json:"denom"`
	OriginalDestinationChain string   `json:"original_destination_chain"`
	Height                   uint64   `json:"height"`
}

LinkInfo represents the link information

type LogDocument

type LogDocument struct {
	BlockHash        string   `json:"blockHash,omitempty"`
	Address          string   `json:"address,omitempty"`
	LogIndex         uint     `json:"logIndex,omitempty"`
	Data             string   `json:"data,omitempty"`
	Removed          bool     `json:"removed,omitempty"`
	Topics           []string `json:"topics,omitempty"`
	BlockNumber      uint64   `json:"blockNumber,omitempty"`
	TransactionIndex uint     `json:"transactionIndex,omitempty"`
	TransactionHash  string   `json:"transactionHash,omitempty"`
}

type MapBlockEventAttributes

type MapBlockEventAttributes map[string]string

type Message

type Message struct {
	ID            uint
	TxID          uint `gorm:"uniqueIndex:messageIndex,priority:1"`
	Tx            Tx
	MessageTypeID uint `gorm:"foreignKey:MessageTypeID,index:idx_txid_typeid"`
	MessageType   MessageType
	MessageIndex  int `gorm:"uniqueIndex:messageIndex,priority:2"`
	MessageBytes  []byte
}

type MessageEvent

type MessageEvent struct {
	ID uint
	// These fields uniquely identify every message event
	// Index refers to the position of the event in the message event array
	Index              uint64 `gorm:"uniqueIndex:messageEventIndex,priority:2"`
	MessageID          uint   `gorm:"uniqueIndex:messageEventIndex,priority:1"`
	Message            Message
	MessageEventTypeID uint
	MessageEventType   MessageEventType
}

type MessageEventAttribute

type MessageEventAttribute struct {
	ID             uint
	MessageEvent   MessageEvent
	MessageEventID uint `gorm:"uniqueIndex:messageAttributeIndex,priority:1"`
	Value          string
	Index          uint64 `gorm:"uniqueIndex:messageAttributeIndex,priority:2"`
	// Keys are limited to a smallish subset of string values set by the Cosmos SDK and external modules
	// Save DB space by storing the key as a foreign key
	MessageEventAttributeKeyID uint
	MessageEventAttributeKey   MessageEventAttributeKey
}

type MessageEventAttributeKey

type MessageEventAttributeKey struct {
	ID  uint
	Key string `gorm:"uniqueIndex"`
}

type MessageEventType

type MessageEventType struct {
	ID   uint
	Type string `gorm:"uniqueIndex"`
}

type MessageParser

type MessageParser struct {
	ID uint
	// Should the message type be added here for clarity purposes?
	Identifier string `gorm:"uniqueIndex:idx_message_parser_identifier"`
}

type MessageParserError

type MessageParserError struct {
	ID              uint
	MessageParserID uint
	MessageParser   MessageParser
	MessageID       uint
	Message         Message
	Error           string
}

type MessageType

type MessageType struct {
	ID          uint   `gorm:"primaryKey"`
	MessageType string `gorm:"uniqueIndex;not null"`
}

type Options

type Options struct {
	Size       int      `json:"size,omitempty"`
	Offset     int      `json:"offset,omitempty"`
	EventId    string   `json:"event_id,omitempty"`
	TxHash     string   `json:"tx_hash,omitempty"`
	EventType  string   `json:"event_type,omitempty"`
	EventTypes []string `json:"event_types,omitempty"`
}

func ParseQueryOptions

func ParseQueryOptions(request *http.Request) (*Options, *types.Error)

type OverallStatsDocument

type OverallStatsDocument struct {
	Id                string `bson:"_id"`
	ActiveTvl         int64  `bson:"active_tvl"`
	TotalTvl          int64  `bson:"total_tvl"`
	ActiveDelegations int64  `bson:"active_delegations"`
	TotalDelegations  int64  `bson:"total_delegations"`
	TotalStakers      uint64 `bson:"total_stakers"`
}

type ReceiptDocument

type ReceiptDocument struct {
	BlockHash         string        `json:"blockHash,omitempty"`
	ContractAddress   *string       `json:"contractAddress,omitempty"`
	TransactionIndex  uint          `json:"transactionIndex,omitempty"`
	Type              uint8         `json:"type,omitempty"`
	Confirmations     uint          `json:"confirmations,omitempty"`
	TransactionHash   string        `json:"transactionHash,omitempty"`
	GasUsed           string        `json:"gasUsed,omitempty"`
	BlockNumber       uint64        `json:"blockNumber,omitempty"`
	CumulativeGasUsed string        `json:"cumulativeGasUsed,omitempty"`
	From              string        `json:"from,omitempty"`
	To                string        `json:"to,omitempty"`
	EffectiveGasPrice string        `json:"effectiveGasPrice,omitempty"`
	Logs              []LogDocument `json:"logs,omitempty"`
	Status            uint8         `json:"status,omitempty"`
}

type RelayDataStatus

type RelayDataStatus string
const (
	Pending   RelayDataStatus = "pending"
	Approved  RelayDataStatus = "approved"
	Success   RelayDataStatus = "success"
	Failed    RelayDataStatus = "failed"
	Undefined RelayDataStatus = "undefined"
)

func ToReadableStatus

func ToReadableStatus(status int) RelayDataStatus

type ReturnValuesDocument

type ReturnValuesDocument struct {
	CommandID                  string `json:"commandId,omitempty"`
	SourceTxHash               string `json:"sourceTxHash,omitempty"`
	SourceAddress              string `json:"sourceAddress,omitempty"`
	SourceChain                string `json:"sourceChain,omitempty"`
	SourceEventIndex           string `json:"sourceEventIndex,omitempty"`
	Sender                     string `json:"sender,omitempty"`
	ContractAddress            string `json:"contractAddress,omitempty"`
	DestinationChain           string `json:"destinationChain,omitempty"`
	DestinationContractAddress string `json:"destinationContractAddress,omitempty"`
	PayloadHash                string `json:"payloadHash,omitempty"`
	Payload                    string `json:"payload,omitempty"`
}

type SendInfo

type SendInfo struct {
	TxHash                   string   `json:"txhash"`
	Height                   uint64   `json:"height"`
	Status                   string   `json:"status"`
	Type                     string   `json:"type"`
	CreatedAt                TimeInfo `json:"created_at"`
	SourceChain              string   `json:"source_chain"`
	SenderAddress            string   `json:"sender_address"`
	RecipientAddress         string   `json:"recipient_address"`
	Denom                    string   `json:"denom"`
	Amount                   float64  `json:"amount"`
	Value                    float64  `json:"value"`
	DestinationChain         string   `json:"destination_chain"`
	OriginalSourceChain      string   `json:"original_source_chain"`
	Fee                      float64  `json:"fee"`
	FeeValue                 float64  `json:"fee_value"`
	AmountReceived           float64  `json:"amount_received"`
	OriginalDestinationChain string   `json:"original_destination_chain"`
	InsufficientFee          bool     `json:"insufficient_fee"`
}

SendInfo represents the send information

type ShortenCustodialGroup

type ShortenCustodialGroup struct {
	ID             uint
	Name           string
	TaprootAddress string
}

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 StakerStatsDocument struct {
	StakerPkHex       string `bson:"_id"`
	ActiveTvl         int64  `bson:"active_tvl"`
	TotalTvl          int64  `bson:"total_tvl"`
	ActiveDelegations int64  `bson:"active_delegations"`
	TotalDelegations  int64  `bson:"total_delegations"`
}

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 TimeInfo

type TimeInfo struct {
	MS      int64 `json:"ms"`
	Hour    int64 `json:"hour"`
	Day     int64 `json:"day"`
	Week    int64 `json:"week"`
	Month   int64 `json:"month"`
	Quarter int64 `json:"quarter"`
	Year    int64 `json:"year"`
}

TimeInfo represents the timestamp information structure

func FormatTimeInfo

func FormatTimeInfo(timestamp time.Time) TimeInfo

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 TimeSpent

type TimeSpent struct {
	SendConfirm int `json:"send_confirm"`
	ConfirmVote int `json:"confirm_vote"`
	Total       int `json:"total"`
	ConfirmIBC  int `json:"confirm_ibc"`
	VoteIBC     int `json:"vote_ibc"`
}

TimeSpent represents the time spent information

type TimeSpentDocument

type TimeSpentDocument struct {
	CallConfirm      int `json:"call_confirm,omitempty"`
	CallApproved     int `json:"call_approved,omitempty"`
	Total            int `json:"total,omitempty"`
	ApprovedExecuted int `json:"approved_executed,omitempty"`
}

type TimelockTransaction

type TimelockTransaction struct {
	TxHex          string `bson:"tx_hex"`
	OutputIndex    uint64 `bson:"output_index"`
	StartTimestamp int64  `bson:"start_timestamp"`
	StartHeight    uint64 `bson:"start_height"`
	TimeLock       uint64 `bson:"timelock"`
}

type TokenDocument

type TokenDocument struct {
	Decimals        uint64                  `json:"decimals,omitempty"`
	Name            string                  `json:"name,omitempty"`
	Symbol          string                  `json:"symbol,omitempty"`
	GasPriceInUnits GasPriceInUnitsDocument `json:"gas_price_in_units,omitempty"`
	GasPriceGwei    string                  `json:"gas_price_gwei,omitempty"`
	GasPrice        string                  `json:"gas_price,omitempty"`
	ContractAddress string                  `json:"contract_address,omitempty"`
	TokenPrice      TokenPriceDocument      `json:"token_price,omitempty"`
}

type TokenPriceDocument

type TokenPriceDocument struct {
	Usd float64 `json:"usd,omitempty"`
}

type TransactionDocument

type TransactionDocument struct {
	BlockHash            string `json:"blockHash,omitempty"`
	YParity              string `json:"yParity,omitempty"`
	TransactionIndex     uint   `json:"transactionIndex,omitempty"`
	Type                 uint8  `json:"type,omitempty"`
	Nonce                uint64 `json:"nonce,omitempty"`
	R                    string `json:"r,omitempty"`
	S                    string `json:"s,omitempty"`
	ChainID              int64  `json:"chainId,omitempty"`
	V                    uint64 `json:"v,omitempty"`
	BlockNumber          uint64 `json:"blockNumber,omitempty"`
	Gas                  string `json:"gas,omitempty"`
	MaxPriorityFeePerGas string `json:"maxPriorityFeePerGas,omitempty"`
	From                 string `json:"from,omitempty"`
	To                   string `json:"to,omitempty"`
	MaxFeePerGas         string `json:"maxFeePerGas,omitempty"`
	Value                uint64 `json:"value,omitempty"`
	Hash                 string `json:"hash,omitempty"`
	GasPrice             string `json:"gasPrice,omitempty"`
}

type TransferDocument

type TransferDocument struct {
	ID               string       `json:"id"`
	Type             TransferType `json:"type"`
	Status           string       `json:"status"`
	SimplifiedStatus string       `json:"simplified_status"`
	TransferID       uint         `json:"transfer_id"`

	// Relationships
	Send      SendInfo    `json:"send"`
	TimeSpent TimeSpent   `json:"time_spent"`
	Confirm   ConfirmInfo `json:"confirm"`
	Link      LinkInfo    `json:"link"`
	Command   CommandInfo `json:"command"`
	Vote      VoteInfo    `json:"vote"`
}

Transfer represents the main transfer record

type TransferType

type TransferType string
const (
	TransferTypeSendToken      TransferType = "send_token"
	TransferTypeDepositAddress TransferType = "deposit_address"
)

type Tx

type Tx struct {
	ID              uint
	Hash            string `gorm:"uniqueIndex"`
	Code            uint32
	BlockID         uint
	Block           Block
	Memo            string
	SignerAddresses []Address `gorm:"many2many:tx_signer_addresses;"`
	Fees            []Fee
}

type TxMessage

type TxMessage struct {
	ID            uint `gorm:"primaryKey"`
	TxID          uint `gorm:"uniqueIndex:txMessageIndex,priority:1"`
	MessageID     uint `gorm:"uniqueIndex:txMessageIndex,priority:2"`
	BlockId       uint
	MessageDetail string
	Tx            GMPTx `gorm:"foreignKey:TxID;references:ID"`
}

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

type VaultDocument

type VaultDocument struct {
	ID                              string `json:"id,omitempty"`
	Status                          string `json:"status,omitempty"`
	SimplifiedStatus                string `json:"simplified_status,omitempty"`
	SourceChain                     string `json:"source_chain,omitempty"`
	DestinationChain                string `json:"destination_chain,omitempty"`
	DestinationSmartContractAddress string `json:"destination_smart_contract_address,omitempty"`
	CreatedAt                       uint64 `json:"created_at,omitempty"`
	UpdatedAt                       uint64 `json:"updated_at,omitempty"`
	SourceTxHash                    string `json:"source_tx_hash,omitempty"`
	SourceTxHex                     string `json:"source_tx_hex,omitempty"`
	StakerPubkey                    string `json:"staker_pubkey,omitempty"`
	Amount                          string `json:"amount,omitempty"`
	ExecutedAmount                  string `json:"executed_amount,omitempty"`
	ExecutedRefTxHash               string `json:"executed_ref_tx_hash,omitempty"`
}

type VoteEvent

type VoteEvent string
const (
	VoteEventTokenSent VoteEvent = "token_sent"
)

type VoteInfo

type VoteInfo struct {
	TransactionID    string    `json:"transaction_id"`
	PollID           string    `json:"poll_id"`
	SourceChain      string    `json:"source_chain"`
	CreatedAt        TimeInfo  `json:"created_at"`
	DestinationChain string    `json:"destination_chain"`
	Confirmation     bool      `json:"confirmation"`
	Type             VoteType  `json:"type"`
	Event            VoteEvent `json:"event"`
	TxHash           string    `json:"txhash"`
	Height           uint64    `json:"height"`
	Status           string    `json:"status"`
	TransferID       uint      `json:"transfer_id"`
	Success          bool      `json:"success"`
}

type VoteType

type VoteType string
const (
	VoteTypeVote VoteType = "vote"
)

Jump to

Keyboard shortcuts

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