Documentation
¶
Overview ¶
Package governor handle the request of governor data from governor endpoint defined in the api.
Package governor handle the request of governor data from governor endpoint defined in the api.
Package governor handle the request of governor data from governor endpoint defined in the api.
Index ¶
- type AvailableNotionalByChain
- type Emitter
- type EnqueuedResponse
- type EnqueuedVAA
- type EnqueuedVaa
- type EnqueuedVaaDetail
- type EnqueuedVaaItem
- type EnqueuedVaaQuery
- type EnqueuedVaas
- type GovConfig
- type GovConfigChains
- type GovConfigfTokens
- type GovStatus
- type GovStatusChainEmitter
- type GovStatusChains
- type GovernorLimit
- type GovernorQuery
- type GovernorVaaDoc
- type MaxNotionalAvailableRecord
- type NotionalAvailable
- type NotionalAvailableDetail
- type NotionalLimit
- type NotionalLimitDetail
- type NotionalLimitQuery
- type Repository
- func (r *Repository) FindGovConfigurations(ctx context.Context, q *GovernorQuery) ([]*GovConfig, error)
- func (r *Repository) FindGovernorStatus(ctx context.Context, q *GovernorQuery) ([]*GovStatus, error)
- func (r *Repository) FindNotionalLimit(ctx context.Context, q *NotionalLimitQuery) ([]*NotionalLimit, error)
- func (r *Repository) FindOneGovernorStatus(ctx context.Context, q *GovernorQuery) (*GovStatus, error)
- func (r *Repository) GetAvailNotionByChain(ctx context.Context) ([]*AvailableNotionalByChain, error)
- func (r *Repository) GetAvailableNotional(ctx context.Context, q *NotionalLimitQuery) ([]*NotionalAvailable, error)
- func (r *Repository) GetAvailableNotionalByChainID(ctx context.Context, q *NotionalLimitQuery) ([]*NotionalAvailableDetail, error)
- func (r *Repository) GetEnqueueVass(ctx context.Context, q *EnqueuedVaaQuery) ([]*EnqueuedVaas, error)
- func (r *Repository) GetEnqueueVassByChainID(ctx context.Context, q *EnqueuedVaaQuery) ([]*EnqueuedVaaDetail, error)
- func (r *Repository) GetEnqueuedVaas(ctx context.Context) ([]*EnqueuedVaaItem, error)
- func (r *Repository) GetGovernorLimit(ctx context.Context, q *GovernorQuery) ([]*GovernorLimit, error)
- func (r *Repository) GetGovernorVaas(ctx context.Context) ([]GovernorVaaDoc, error)
- func (r *Repository) GetMaxNotionalAvailableByChainID(ctx context.Context, q *NotionalLimitQuery) (*MaxNotionalAvailableRecord, error)
- func (r *Repository) GetNotionalLimitByChainID(ctx context.Context, q *NotionalLimitQuery) ([]*NotionalLimitDetail, error)
- func (r *Repository) GetTokenList(ctx context.Context) ([]*TokenList, error)
- func (r *Repository) IsVaaEnqueued(ctx context.Context, chainID vaa.ChainID, emitter *types.Address, ...) (bool, error)
- type Service
- func (s *Service) FindGovernorConfig(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*GovConfig], error)
- func (s *Service) FindGovernorConfigByGuardianAddress(ctx context.Context, guardianAddress *types.Address) ([]*GovConfig, error)
- func (s *Service) FindGovernorStatus(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*GovStatus], error)
- func (s *Service) FindGovernorStatusByGuardianAddress(ctx context.Context, guardianAddress *types.Address, p *pagination.Pagination) (*response.Response[*GovStatus], error)
- func (s *Service) FindNotionalLimit(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*NotionalLimit], error)
- func (s *Service) GetAvailNotionByChain(ctx context.Context) ([]*AvailableNotionalByChain, error)
- func (s *Service) GetAvailableNotional(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*NotionalAvailable], error)
- func (s *Service) GetAvailableNotionalByChainID(ctx context.Context, p *pagination.Pagination, chainID vaa.ChainID) (*response.Response[[]*NotionalAvailableDetail], error)
- func (s *Service) GetEnqueueVass(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*EnqueuedVaas], error)
- func (s *Service) GetEnqueueVassByChainID(ctx context.Context, p *pagination.Pagination, chainID vaa.ChainID) (*response.Response[[]*EnqueuedVaaDetail], error)
- func (s *Service) GetEnqueuedVaas(ctx context.Context) ([]*EnqueuedVaaItem, error)
- func (s *Service) GetGovernorLimit(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*GovernorLimit], error)
- func (s *Service) GetGovernorVaas(ctx context.Context) ([]GovernorVaaDoc, error)
- func (s *Service) GetMaxNotionalAvailableByChainID(ctx context.Context, chainID vaa.ChainID) (*response.Response[*MaxNotionalAvailableRecord], error)
- func (s *Service) GetNotionalLimitByChainID(ctx context.Context, p *pagination.Pagination, chainID vaa.ChainID) (*response.Response[[]*NotionalLimitDetail], error)
- func (s *Service) GetTokenList(ctx context.Context) ([]*TokenList, error)
- func (s *Service) IsVaaEnqueued(ctx context.Context, chainID vaa.ChainID, emitter *types.Address, seq string) (bool, error)
- type TokenList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvailableNotionalByChain ¶
type AvailableNotionalByChain struct { ChainID vaa.ChainID `bson:"chainId" json:"chainId"` AvailableNotional mongo.Uint64 `bson:"availableNotional" json:"remainingAvailableNotional"` NotionalLimit mongo.Uint64 `bson:"notionalLimit" json:"notionalLimit"` MaxTransactionSize mongo.Uint64 `bson:"maxTransactionSize" json:"bigTransactionSize"` }
AvailableNotionalByChain definition. This is the structure that is used in guardian api grpc api version.
type Emitter ¶
type Emitter struct { Address string `bson:"emitteraddress" json:"emitterAddress"` TotalEnqueuedVaas mongo.Uint64 `bson:"totalenqueuedvaas" json:"totalEnqueuedVaas"` EnqueuedVaas []EnqueuedVAA `bson:"enqueuedvaas" json:"enqueuedVaas"` }
type EnqueuedResponse ¶
type EnqueuedVAA ¶
type EnqueuedVAA struct { Sequence string `bson:"sequence" json:"sequence"` ReleaseTime *time.Time `bson:"releasetime" json:"releaseTime"` Notional *mongo.Uint64 `bson:"notionalvalue" json:"notionalValue"` TxHash string `bson:"txhash" json:"txHash"` }
EnqueuedVAA definition.
type EnqueuedVaa ¶
type EnqueuedVaa struct { ChainID vaa.ChainID `bson:"chainId" json:"chainId"` EmitterAddress string `bson:"emitterAddress" json:"emitterAddress"` Sequence string `bson:"sequence" json:"sequence"` NotionalValue int64 `bson:"notionalValue" json:"notionalValue"` TxHash string `bson:"txHash" json:"txHash"` }
EnqueuedVaa definition.
func (*EnqueuedVaa) MarshalJSON ¶
func (v *EnqueuedVaa) MarshalJSON() ([]byte, error)
MarshalJSON interface implementation.
type EnqueuedVaaDetail ¶
type EnqueuedVaaDetail struct { ChainID vaa.ChainID `bson:"chainid" json:"chainId"` EmitterAddress string `bson:"emitterAddress" json:"emitterAddress"` Sequence string `bson:"sequence" json:"sequence"` NotionalValue int64 `bson:"notionalValue" json:"notionalValue"` TxHash string `bson:"txHash" json:"txHash"` ReleaseTime int64 `bson:"releaseTime" json:"releaseTime"` }
EnqueuedVaaDetail definition.
func (*EnqueuedVaaDetail) MarshalJSON ¶
func (v *EnqueuedVaaDetail) MarshalJSON() ([]byte, error)
MarshalJSON interface implementation.
type EnqueuedVaaItem ¶
type EnqueuedVaaItem struct { EmitterChain vaa.ChainID `bson:"chainid" json:"emitterChain"` EmitterAddress string `bson:"emitteraddress" json:"emitterAddress"` Sequence string `bson:"sequence" json:"sequence"` ReleaseTime int64 `bson:"releasetime" json:"releaseTime"` NotionalValue mongo.Uint64 `bson:"notionalvalue" json:"notionalValue"` TxHash string `bson:"txhash" json:"txHash"` }
EnqueuedVaaItem definition
type EnqueuedVaaQuery ¶
type EnqueuedVaaQuery struct { pagination.Pagination // contains filtered or unexported fields }
EnqueuedVaaQuery respresent a query for enqueuedVaa queries.
func QueryEnqueuedVaa ¶
func QueryEnqueuedVaa() *EnqueuedVaaQuery
QueryEnqueuedVaa create a new EnqueuedVaaQuery with default pagination values.
func (*EnqueuedVaaQuery) SetChain ¶
func (q *EnqueuedVaaQuery) SetChain(chainID vaa.ChainID) *EnqueuedVaaQuery
SetChain set the chainID field of the EnqueuedVaaQuery struct.
func (*EnqueuedVaaQuery) SetID ¶
func (q *EnqueuedVaaQuery) SetID(id string) *EnqueuedVaaQuery
SetID set the id field of the EnqueuedVaaQuery struct.
func (*EnqueuedVaaQuery) SetPagination ¶
func (q *EnqueuedVaaQuery) SetPagination(p *pagination.Pagination) *EnqueuedVaaQuery
SetPagination set the pagination field of the EnqueuedVaaQuery struct.
type EnqueuedVaas ¶
type EnqueuedVaas struct { ChainID vaa.ChainID `bson:"chainid" json:"chainId"` EnqueuedVaa []*EnqueuedVaa `bson:"enqueuedVaas" json:"enqueuedVaas"` }
EnqueuedVaas definition.
type GovConfig ¶
type GovConfig struct { ID string `bson:"_id" json:"id"` CreatedAt *time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt *time.Time `bson:"updatedAt" json:"updatedAt"` NodeName string `bson:"nodename" json:"nodeName"` Counter int `bson:"counter" json:"counter"` Chains []*GovConfigChains `bson:"chains" json:"chains"` Tokens []*GovConfigfTokens `bson:"tokens" json:"tokens"` }
GovConfigPage represent a governor configuration.
type GovConfigChains ¶
type GovConfigfTokens ¶
type GovStatus ¶
type GovStatus struct { ID string `bson:"_id" json:"id"` CreatedAt *time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt *time.Time `bson:"updatedAt" json:"updatedAt"` NodeName string `bson:"nodename" json:"nodeName"` Chains []*GovStatusChains `bson:"chains" json:"chains"` }
GovStatusPage represent a governor status.
type GovStatusChainEmitter ¶
type GovStatusChains ¶
type GovStatusChains struct { ChainID vaa.ChainID `bson:"chainid" json:"chainId"` RemainingAvailableNotional mongo.Uint64 `bson:"remainingavailablenotional" json:"remainingAvailableNotional"` Emitters []*GovStatusChainEmitter `bson:"emitters" json:"emitters"` }
type GovernorLimit ¶
type GovernorLimit struct { ChainID vaa.ChainID `bson:"chainId" json:"chainId"` AvailableNotional mongo.Uint64 `bson:"availableNotional" json:"availableNotional"` NotionalLimit mongo.Uint64 `bson:"notionalLimit" json:"notionalLimit"` MaxTransactionSize mongo.Uint64 `bson:"maxTransactionSize" json:"maxTransactionSize"` }
GovernorLimit definition.
type GovernorQuery ¶
type GovernorQuery struct { pagination.Pagination // contains filtered or unexported fields }
GovernorQuery respresent a query for the governors mongodb documents.
func NewGovernorQuery ¶
func NewGovernorQuery() *GovernorQuery
NewGovernorQuery creates a new `*GovernorQuery` with default pagination values.
func (*GovernorQuery) SetID ¶
func (q *GovernorQuery) SetID(id *types.Address) *GovernorQuery
SetID sets the `id` field of the GovernorQuery struct.
func (*GovernorQuery) SetPagination ¶
func (q *GovernorQuery) SetPagination(p *pagination.Pagination) *GovernorQuery
SetPagination set the pagination field of the GovernorQuery struct.
type GovernorVaaDoc ¶
type GovernorVaaDoc struct { ID string `bson:"_id"` ChainID vaa.ChainID `bson:"chainId"` EmitterAddress string `bson:"emitterAddress"` Sequence string `bson:"sequence"` TxHash string `bson:"txHash"` ReleaseTime time.Time `bson:"releaseTime"` Amount mongoTypes.Uint64 `bson:"amount"` Vaas []any `bson:"vaas"` }
type MaxNotionalAvailableRecord ¶
type MaxNotionalAvailableRecord struct { ID string `bson:"_id" json:"id"` ChainID vaa.ChainID `bson:"chainId" json:"chainId"` NodeName string `bson:"nodeName" json:"nodeName"` NotionalAvailable *mongo.Uint64 `bson:"availableNotional" json:"availableNotional"` Emitters []Emitter `bson:"emitters" json:"emitters"` CreatedAt *time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt *time.Time `bson:"updatedAt" json:"updatedAt"` }
MaxNotionalAvailableRecord definition.
type NotionalAvailable ¶
type NotionalAvailable struct { ChainID vaa.ChainID `bson:"chainid" json:"chainId"` AvailableNotional *mongo.Uint64 `bson:"availableNotional" json:"availableNotional"` }
NotionalAvailable represent the available notional for chainID.
type NotionalAvailableDetail ¶
type NotionalAvailableDetail struct { ID string `bson:"_id" json:"id"` ChainID vaa.ChainID `bson:"chainId" json:"chainId"` NodeName string `bson:"nodeName" json:"nodeName"` NotionalAvailable *mongo.Uint64 `bson:"availableNotional" json:"availableNotional"` CreatedAt *time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt *time.Time `bson:"updatedAt" json:"updatedAt"` }
NotionalAvailableDetail represent a notional available value.
type NotionalLimit ¶
type NotionalLimit struct { ChainID vaa.ChainID `bson:"chainid" json:"chainId"` NotionalLimit *mongo.Uint64 `bson:"notionalLimit" json:"notionalLimit"` MaxTrasactionSize *mongo.Uint64 `bson:"maxTransactionSize" json:"maxTransactionSize"` }
NotionalLimit represent the notional limit value and maximun tranasction size for a chainID.
type NotionalLimitDetail ¶
type NotionalLimitDetail struct { ID string `bson:"_id" json:"id"` ChainID vaa.ChainID `bson:"chainId" json:"chainId"` NodeName string `bson:"nodename" json:"nodeName"` NotionalLimit *mongo.Uint64 `bson:"notionalLimit" json:"notionalLimit"` MaxTrasactionSize *mongo.Uint64 `bson:"maxTransactionSize" json:"maxTransactionSize"` CreatedAt *time.Time `bson:"createdAt" json:"createdAt"` UpdatedAt *time.Time `bson:"updatedAt" json:"updatedAt"` }
NotionalLimitDetail represent a notional limit value
type NotionalLimitQuery ¶
type NotionalLimitQuery struct { pagination.Pagination // contains filtered or unexported fields }
NotionalLimitQuery
func QueryNotionalLimit ¶
func QueryNotionalLimit() *NotionalLimitQuery
QueryNotionalLimit create a new NotionalLimitQuery with default pagination values.
func (*NotionalLimitQuery) SetChain ¶
func (q *NotionalLimitQuery) SetChain(chainID vaa.ChainID) *NotionalLimitQuery
SetChain set the chainID field of the NotionalLimitQuery struct.
func (*NotionalLimitQuery) SetID ¶
func (q *NotionalLimitQuery) SetID(id string) *NotionalLimitQuery
SetID set the id field of the NotionalLimitQuery struct.
func (*NotionalLimitQuery) SetPagination ¶
func (q *NotionalLimitQuery) SetPagination(p *pagination.Pagination) *NotionalLimitQuery
SetPagination set the Pagination field of the NotionalLimitQuery struct.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository definition.
func NewRepository ¶
func NewRepository(db *mongo.Database, logger *zap.Logger) *Repository
NewRepository create a new Repository.
func (*Repository) FindGovConfigurations ¶
func (r *Repository) FindGovConfigurations( ctx context.Context, q *GovernorQuery, ) ([]*GovConfig, error)
FindGovConfigurations get a list of *GovConfig.
func (*Repository) FindGovernorStatus ¶
func (r *Repository) FindGovernorStatus( ctx context.Context, q *GovernorQuery, ) ([]*GovStatus, error)
FindGovernorStatus get a list of *GovStatus.
func (*Repository) FindNotionalLimit ¶
func (r *Repository) FindNotionalLimit( ctx context.Context, q *NotionalLimitQuery, ) ([]*NotionalLimit, error)
FindNotionalLimit get a list *NotionalLimit.
func (*Repository) FindOneGovernorStatus ¶
func (r *Repository) FindOneGovernorStatus( ctx context.Context, q *GovernorQuery, ) (*GovStatus, error)
FindOneGovernorStatus get a *GovStatus. The q parameter define the filter to apply to the query.
func (*Repository) GetAvailNotionByChain ¶
func (r *Repository) GetAvailNotionByChain( ctx context.Context, ) ([]*AvailableNotionalByChain, error)
GetAvailNotionByChain get the limits by chainID.
In this version returns the minimum value of the availableNotional per chainID by analyzing the data of all guardian nodes.
func (*Repository) GetAvailableNotional ¶
func (r *Repository) GetAvailableNotional( ctx context.Context, q *NotionalLimitQuery, ) ([]*NotionalAvailable, error)
GetAvailableNotional get a list of *NotionalAvailable.
func (*Repository) GetAvailableNotionalByChainID ¶
func (r *Repository) GetAvailableNotionalByChainID( ctx context.Context, q *NotionalLimitQuery, ) ([]*NotionalAvailableDetail, error)
GetAvailableNotionalByChainID get a list of *NotionalAvailableDetail.
func (*Repository) GetEnqueueVass ¶
func (r *Repository) GetEnqueueVass(ctx context.Context, q *EnqueuedVaaQuery) ([]*EnqueuedVaas, error)
GetEnqueueVass get a list of *EnqueuedVaas.
func (*Repository) GetEnqueueVassByChainID ¶
func (r *Repository) GetEnqueueVassByChainID( ctx context.Context, q *EnqueuedVaaQuery, ) ([]*EnqueuedVaaDetail, error)
GetEnqueueVassByChainID get a list of *EnqueuedVaaDetail by chainID.
func (*Repository) GetEnqueuedVaas ¶
func (r *Repository) GetEnqueuedVaas(ctx context.Context) ([]*EnqueuedVaaItem, error)
GetEnqueuedVaas get enqueued vaas.
func (*Repository) GetGovernorLimit ¶
func (r *Repository) GetGovernorLimit( ctx context.Context, q *GovernorQuery, ) ([]*GovernorLimit, error)
GetGovernorLimit get a list of *GovernorLimit.
func (*Repository) GetGovernorVaas ¶
func (r *Repository) GetGovernorVaas(ctx context.Context) ([]GovernorVaaDoc, error)
func (*Repository) GetMaxNotionalAvailableByChainID ¶
func (r *Repository) GetMaxNotionalAvailableByChainID( ctx context.Context, q *NotionalLimitQuery, ) (*MaxNotionalAvailableRecord, error)
GetMaxNotionalAvailableByChainID get a *MaxNotionalAvailableRecord.
func (*Repository) GetNotionalLimitByChainID ¶
func (r *Repository) GetNotionalLimitByChainID( ctx context.Context, q *NotionalLimitQuery, ) ([]*NotionalLimitDetail, error)
GetNotionalLimitByChainID get a list *NotionalLimitDetail.
func (*Repository) GetTokenList ¶
func (r *Repository) GetTokenList(ctx context.Context) ([]*TokenList, error)
GetTokenList get token lists.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(dao *Repository, cache cache.Cache, metrics metrics.Metrics, logger *zap.Logger) *Service
NewService create a new governor.Service.
func (*Service) FindGovernorConfig ¶
func (s *Service) FindGovernorConfig(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*GovConfig], error)
FindGovernorConfig get a list of governor configurations.
func (*Service) FindGovernorConfigByGuardianAddress ¶
func (s *Service) FindGovernorConfigByGuardianAddress( ctx context.Context, guardianAddress *types.Address, ) ([]*GovConfig, error)
FindGovernorConfigByGuardianAddress get a governor configuration by guardianAddress.
func (*Service) FindGovernorStatus ¶
func (s *Service) FindGovernorStatus(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*GovStatus], error)
FindGovernorStatus get a list of governor status.
func (*Service) FindGovernorStatusByGuardianAddress ¶
func (s *Service) FindGovernorStatusByGuardianAddress( ctx context.Context, guardianAddress *types.Address, p *pagination.Pagination, ) (*response.Response[*GovStatus], error)
FindGovernorStatusByGuardianAddress get a governor status by guardianAddress.
func (*Service) FindNotionalLimit ¶
func (s *Service) FindNotionalLimit(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*NotionalLimit], error)
FindNotionalLimit get a notional limit for each chainID.
func (*Service) GetAvailNotionByChain ¶
func (s *Service) GetAvailNotionByChain(ctx context.Context) ([]*AvailableNotionalByChain, error)
GetAvailNotionByChain get governor limit for each chainID. Guardian api migration.
func (*Service) GetAvailableNotional ¶
func (s *Service) GetAvailableNotional(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*NotionalAvailable], error)
GetAvailableNotional get a available notional for each chainID.
func (*Service) GetAvailableNotionalByChainID ¶
func (s *Service) GetAvailableNotionalByChainID(ctx context.Context, p *pagination.Pagination, chainID vaa.ChainID) (*response.Response[[]*NotionalAvailableDetail], error)
GetAvailableNotionalByChainID get a available notional by chainID.
func (*Service) GetEnqueueVass ¶
func (s *Service) GetEnqueueVass(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*EnqueuedVaas], error)
GetEnqueueVaas get all the enqueued vaa.
func (*Service) GetEnqueueVassByChainID ¶
func (s *Service) GetEnqueueVassByChainID(ctx context.Context, p *pagination.Pagination, chainID vaa.ChainID) (*response.Response[[]*EnqueuedVaaDetail], error)
GetEnqueueVassByChainID get enequeued vaa by chainID.
func (*Service) GetEnqueuedVaas ¶
func (s *Service) GetEnqueuedVaas(ctx context.Context) ([]*EnqueuedVaaItem, error)
GetEnqueuedVaas get enqueued vaas. Guardian api migration.
func (*Service) GetGovernorLimit ¶
func (s *Service) GetGovernorLimit(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*GovernorLimit], error)
GetGovernorLimit get governor limit.
func (*Service) GetGovernorVaas ¶
func (s *Service) GetGovernorVaas(ctx context.Context) ([]GovernorVaaDoc, error)
GetGovernorVaas get enqueued vaas. Guardian api migration.
func (*Service) GetMaxNotionalAvailableByChainID ¶
func (s *Service) GetMaxNotionalAvailableByChainID(ctx context.Context, chainID vaa.ChainID) (*response.Response[*MaxNotionalAvailableRecord], error)
GetMaxNotionalAvailableByChainID get a maximun notional value by chainID.
func (*Service) GetNotionalLimitByChainID ¶
func (s *Service) GetNotionalLimitByChainID(ctx context.Context, p *pagination.Pagination, chainID vaa.ChainID) (*response.Response[[]*NotionalLimitDetail], error)
GetNotionalLimitByChainID get a notional limit by chainID.
func (*Service) GetTokenList ¶
Get governor token list. Guardian api migration.