Documentation ¶
Index ¶
- Constants
- func GetDB(appCtx context.Context, log *zap.Logger, uri, databaseName string) (*mongo.Database, error)
- type AttestToken
- type Fetcher
- type GuardianSetDoc
- type IndexingTimestamps
- type MissingVaaUpdate
- type MongoConnections
- type MongoStatus
- type ObservationUpdate
- type Repository
- func (r *Repository) FindOldestMissingIds(ctx context.Context, emitterId *emitterId, size int64) ([]uint64, error)
- func (r *Repository) GetMongoStatus(ctx context.Context) (*MongoStatus, error)
- func (s *Repository) HasVAA(ctx context.Context, emitterId *emitterId, seq uint64) (bool, error)
- func (s *Repository) RunStat(ctx context.Context, detailsC <-chan *tokenTransferDetails, ...)
- func (s *Repository) UpsertGuardianSet(gs *common.GuardianSet) error
- func (s *Repository) UpsertHeartbeat(hb *gossipv1.Heartbeat) error
- func (s *Repository) UpsertObservation(o *gossipv1.SignedObservation) error
- func (s *Repository) UpsertVaa(ctx context.Context, v *vaa.VAA, serializedVaa []byte) error
- type StatisticUpdate
- type TokenTransfer
- type TokenTransferUpdate
- type TokenUpdate
- type Uint64
- type VaaUpdate
Constants ¶
View Source
const AttestTokenPayloadId = 2
View Source
const TokenTransferPayloadId = 1
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttestToken ¶
type AttestToken struct { TokenAddress vaa.Address TokenChain vaa.ChainID Decimals uint8 Symbol string Name string }
func DecodeAttestToken ¶
func DecodeAttestToken(data []byte) (*AttestToken, error)
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetch missing vaa from guardian nodes
func NewFetcher ¶
type GuardianSetDoc ¶
type IndexingTimestamps ¶
type MissingVaaUpdate ¶
type MissingVaaUpdate struct {
ID string `bson:"_id"`
}
type MongoConnections ¶
type MongoConnections struct { Current int32 `bson:"current"` Available int32 `bson:"available"` TotalCreated int32 `bson:"totalCreated"` }
MongoConnections represents a mongo server connection.
type MongoStatus ¶
type MongoStatus struct { Ok int32 `bson:"ok"` Host string `bson:"host"` Version string `bson:"version"` Process string `bson:"process"` Pid int32 `bson:"pid"` Uptime int32 `bson:"uptime"` Connections *MongoConnections `bson:"connections"` }
MongoStatus represent a mongo server status.
type ObservationUpdate ¶
type ObservationUpdate struct { MessageID string `bson:"messageId"` EmitterChain vaa.ChainID `bson:"emitterChain"` Emitter string `bson:"emitterAddr"` TargetChain vaa.ChainID `bson:"targetChain"` Sequence uint64 `bson:"sequence"` Hash []byte `bson:"hash"` TxId []byte `bson:"txId"` GuardianAddr string `bson:"guardianAddr"` Signature []byte `bson:"signature"` UpdatedAt *time.Time `bson:"updatedAt"` }
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
TODO separate and maybe share between fly and web
func NewRepository ¶
func NewRepository( ctx context.Context, db *mongo.Database, log *zap.Logger, governanceChain vaa.ChainID, governanceEmitter vaa.Address, statDuration time.Duration, ) *Repository
TODO wrap repository with a service that filters using redis
func (*Repository) FindOldestMissingIds ¶
func (*Repository) GetMongoStatus ¶
func (r *Repository) GetMongoStatus(ctx context.Context) (*MongoStatus, error)
GetMongoStatus get mongo server status
func (*Repository) RunStat ¶
func (s *Repository) RunStat(ctx context.Context, detailsC <-chan *tokenTransferDetails, duration time.Duration)
func (*Repository) UpsertGuardianSet ¶
func (s *Repository) UpsertGuardianSet(gs *common.GuardianSet) error
func (*Repository) UpsertHeartbeat ¶
func (s *Repository) UpsertHeartbeat(hb *gossipv1.Heartbeat) error
func (*Repository) UpsertObservation ¶
func (s *Repository) UpsertObservation(o *gossipv1.SignedObservation) error
type StatisticUpdate ¶
type StatisticUpdate struct { ID string `bson:"_id"` Date *time.Time `bson:"date"` EmitterChain vaa.ChainID `bson:"emitterChain"` EmitterAddr string `bson:"emitterAddr"` TargetChain vaa.ChainID `bson:"targetChain"` TokenChain vaa.ChainID `bson:"tokenChain"` TokenAddress string `bson:"tokenAddress"` TotalVAACount uint32 `bson:"totalVAACount"` TotalTransferAmount string `bson:"totalTransferAmount"` TotalNotionalUSD float64 `bson:"totalNotionalUSD"` UpdatedAt *time.Time `bson:"updatedAt"` }
type TokenTransfer ¶
type TokenTransfer struct { Amount big.Int TokenAddress vaa.Address TokenChain vaa.ChainID TargetAddress []byte }
func DecodeTokenTransfer ¶
func DecodeTokenTransfer(data []byte) (*TokenTransfer, error)
type TokenTransferUpdate ¶
type TokenTransferUpdate struct { ID string `bson:"_id"` EmitterChain vaa.ChainID `bson:"emitterChain"` EmitterAddr string `bson:"emitterAddr"` TargetChain vaa.ChainID `bson:"targetChain"` TokenAddress string `bson:"tokenAddress"` Symbol string `bson:"symbol"` TokenChain vaa.ChainID `bson:"tokenChain"` ToAddress string `bson:"toAddress"` Amount string `bson:"amount"` NotionalUSD float64 `bson:"notionalUSD"` PriceUSD string `bson:"priceUSD"` Timestamp *time.Time `bson:"timestamp"` }
type TokenUpdate ¶
type TokenUpdate struct { ID string `bson:"_id"` TokenAddress string `bson:"tokenAddress"` TokenChain vaa.ChainID `bson:"tokenChain"` Decimals uint8 `bson:"decimals"` Symbol string `bson:"symbol"` Name string `bson:"name"` NativeAddress string `bson:"nativeAddress"` CoinGeckoCoinId string `bson:"coinGeckoCoinId"` UpdatedAt *time.Time `bson:"updatedAt"` }
type VaaUpdate ¶
type VaaUpdate struct { ID string `bson:"_id"` Version uint8 `bson:"version"` EmitterChain vaa.ChainID `bson:"emitterChain"` EmitterAddr string `bson:"emitterAddr"` TargetChain vaa.ChainID `bson:"targetChain"` Sequence uint64 `bson:"sequence"` GuardianSetIndex uint32 `bson:"guardianSetIndex"` TxId []byte `bson:"txId,omitempty"` Vaa []byte `bson:"vaas"` Timestamp *time.Time `bson:"timestamp"` UpdatedAt *time.Time `bson:"updatedAt"` }
Click to show internal directories.
Click to hide internal directories.