Documentation ¶
Index ¶
- Constants
- func SignersIntoProto(s []*Signer) []*datapb.Signer
- func SignersToStringList(s []*Signer) []string
- func SpecPropertyKeyIsEmpty(key *SpecPropertyKey) bool
- func ToBoolean(value string) (bool, error)
- func ToDecimal(value string) (num.Decimal, error)
- func ToInteger(value string) (*num.Int, error)
- func ToTimestamp(value string) (int64, error)
- type Data
- func (d Data) Debug() []zap.Field
- func (d Data) FromInternalOracle() bool
- func (d Data) GetBoolean(propertyName string) (bool, error)
- func (d Data) GetDataTimestampNano() (int64, error)
- func (d Data) GetDecimal(propertyName string) (num.Decimal, error)
- func (d Data) GetInteger(propertyName string) (*num.Int, error)
- func (d Data) GetString(propertyName string) (string, error)
- func (d Data) GetTimestamp(propertyName string) (int64, error)
- func (d Data) GetUint(name string) (*num.Uint, error)
- type DataSourceType
- type ETHAddress
- type Filters
- type InternalTimeTrigger
- func (i InternalTimeTrigger) DeepClone() *InternalTimeTrigger
- func (i InternalTimeTrigger) IntoProto() *datapb.InternalTimeTrigger
- func (i InternalTimeTrigger) IsTriggered(timeNow time.Time) bool
- func (i *InternalTimeTrigger) SetInitial(initial, timeNow time.Time)
- func (i *InternalTimeTrigger) SetNextTrigger(timeNow time.Time)
- func (i InternalTimeTrigger) String() string
- type InternalTimeTriggers
- type PubKey
- type Signer
- func CreateSignerFromString(s string, t SignerType) *Signer
- func DeserializeSigner(content []byte) *Signer
- func NewSigner(t SignerType) *Signer
- func SignerAsHex(signer *Signer) (*Signer, error)
- func SignerAsString(signer *Signer) (*Signer, error)
- func SignerFromProto(s *datapb.Signer) *Signer
- func SignersFromProto(s []*datapb.Signer) []*Signer
- func (s Signer) DeepClone() *Signer
- func (s Signer) GetSignerETHAddress() *ETHAddress
- func (s Signer) GetSignerPubKey() *PubKey
- func (s Signer) GetSignerType() SignerType
- func (s Signer) IntoProto() *datapb.Signer
- func (s Signer) IsEmpty() bool
- func (s *Signer) Serialize() ([]byte, error)
- func (s Signer) String() string
- type SignerETHAddress
- func (s SignerETHAddress) AsHex(prepend bool) (signer, error)
- func (s SignerETHAddress) AsString() (signer, error)
- func (s SignerETHAddress) DeepClone() signer
- func (s SignerETHAddress) GetSignerType() SignerType
- func (s SignerETHAddress) IntoProto() *datapb.Signer_EthAddress
- func (s SignerETHAddress) IsEmpty() bool
- func (s SignerETHAddress) Serialize() []byte
- func (s SignerETHAddress) String() string
- type SignerPubKey
- func (s SignerPubKey) AsHex(prepend bool) (signer, error)
- func (s SignerPubKey) AsString() (signer, error)
- func (s SignerPubKey) DeepClone() signer
- func (s SignerPubKey) GetSignerType() SignerType
- func (s SignerPubKey) IntoProto() *datapb.Signer_PubKey
- func (s SignerPubKey) IsEmpty() bool
- func (s SignerPubKey) Serialize() []byte
- func (s SignerPubKey) String() string
- type SignerType
- type SpecCondition
- type SpecConditionOperator
- type SpecConditions
- type SpecFilter
- type SpecFilters
- type SpecPropertyKey
- type SpecPropertyKeyType
- type SpecSigners
- type SpecStatus
- type Timer
Constants ¶
const ( SignerPubKeyPrepend = 0x00 ETHAddressPrepend = 0x01 )
Variables ¶
This section is empty.
Functions ¶
func SignersIntoProto ¶
SignersIntoProto returns a list of signers after checking the list length.
func SignersToStringList ¶
func SpecPropertyKeyIsEmpty ¶
func SpecPropertyKeyIsEmpty(key *SpecPropertyKey) bool
func ToTimestamp ¶
Types ¶
type Data ¶
type Data struct { // EthKey is currently just the spec id, which is suboptimal as multiple specs calling the same // contracts at the same time will duplicate data. This is a temporary solution until we have // a better method of making a key of (contract address, args, block height/time + previous height/time) // 'previous' being required so that receivers can check if the their trigger would have fired. EthKey string Signers []*Signer Data map[string]string MetaData map[string]string }
Data holds normalized data coming from an oracle.
func (Data) FromInternalOracle ¶
FromInternalOracle returns true if the oracle data has been emitted by an internal oracle.
func (Data) GetBoolean ¶
GetBoolean converts the value associated to propertyName into a boolean.
func (Data) GetDataTimestampNano ¶
GetDataTimestampNano gets the eth block time (or vega time) associated with the oracle data.
func (Data) GetDecimal ¶
GetDecimal converts the value associated to propertyName into a decimal.
func (Data) GetInteger ¶
GetInteger converts the value associated to propertyName into an integer.
func (Data) GetTimestamp ¶
GetTimestamp converts the value associated to propertyName into a timestamp.
type DataSourceType ¶
type DataSourceType interface { String() string DeepClone() DataSourceType ToDefinitionProto() (*vegapb.DataSourceDefinition, error) GetFilters() []*SpecFilter }
type ETHAddress ¶
type ETHAddress struct {
Address string
}
ETHAddress.
func (ETHAddress) DeepClone ¶
func (e ETHAddress) DeepClone() *ETHAddress
func (ETHAddress) IntoProto ¶
func (e ETHAddress) IntoProto() *datapb.ETHAddress
func (ETHAddress) String ¶
func (e ETHAddress) String() string
type Filters ¶
type Filters struct {
// contains filtered or unexported fields
}
func NewFilters ¶
func NewFilters(filtersFromSpec []*SpecFilter, isExtType bool) (Filters, error)
func (Filters) EnsureBoundableProperty ¶
func (f Filters) EnsureBoundableProperty(property string, propType datapb.PropertyKey_Type) error
type InternalTimeTrigger ¶
type InternalTimeTrigger struct { // This is optional to reflect the proto, but it will always be set by the governance Initial *time.Time Every int64 // contains filtered or unexported fields }
func InternalTimeTriggerFromProto ¶
func InternalTimeTriggerFromProto( protoTrigger *datapb.InternalTimeTrigger, ) *InternalTimeTrigger
func (InternalTimeTrigger) DeepClone ¶
func (i InternalTimeTrigger) DeepClone() *InternalTimeTrigger
func (InternalTimeTrigger) IntoProto ¶
func (i InternalTimeTrigger) IntoProto() *datapb.InternalTimeTrigger
func (InternalTimeTrigger) IsTriggered ¶
func (i InternalTimeTrigger) IsTriggered(timeNow time.Time) bool
func (*InternalTimeTrigger) SetInitial ¶
func (i *InternalTimeTrigger) SetInitial(initial, timeNow time.Time)
func (*InternalTimeTrigger) SetNextTrigger ¶
func (i *InternalTimeTrigger) SetNextTrigger(timeNow time.Time)
func (InternalTimeTrigger) String ¶
func (i InternalTimeTrigger) String() string
type InternalTimeTriggers ¶
type InternalTimeTriggers [1]*InternalTimeTrigger
func InternalTimeTriggersFromProto ¶
func InternalTimeTriggersFromProto(protoTriggers []*datapb.InternalTimeTrigger) InternalTimeTriggers
func (InternalTimeTriggers) DeepClone ¶
func (i InternalTimeTriggers) DeepClone() InternalTimeTriggers
func (InternalTimeTriggers) Empty ¶
func (i InternalTimeTriggers) Empty() error
func (InternalTimeTriggers) IntoProto ¶
func (i InternalTimeTriggers) IntoProto() []*datapb.InternalTimeTrigger
func (InternalTimeTriggers) IsTriggered ¶
func (i InternalTimeTriggers) IsTriggered(now time.Time) bool
func (InternalTimeTriggers) String ¶
func (i InternalTimeTriggers) String() string
type Signer ¶
type Signer struct {
Signer signer
}
func CreateSignerFromString ¶
func CreateSignerFromString(s string, t SignerType) *Signer
func DeserializeSigner ¶
func NewSigner ¶
func NewSigner(t SignerType) *Signer
func SignerAsHex ¶
SignerAsHex represents the signer as a hex encoded string. We export this function as a standalone option because there are cases when we are not sure what is the signer type we deal with.
func SignerAsString ¶
SignerAsString represents the Signer content as a string.
func SignerFromProto ¶
func SignersFromProto ¶
SignersFromProto returns a list of signers. The list is allowed to be empty.
func (Signer) GetSignerETHAddress ¶
func (s Signer) GetSignerETHAddress() *ETHAddress
func (Signer) GetSignerPubKey ¶
func (Signer) GetSignerType ¶
func (s Signer) GetSignerType() SignerType
func (Signer) IntoProto ¶
IntoProto will always return a `datapb.Signer` that needs to be checked if it has any content afterwards.
type SignerETHAddress ¶
type SignerETHAddress struct {
ETHAddress *ETHAddress
}
func DeserializeETHAddress ¶
func DeserializeETHAddress(data []byte) *SignerETHAddress
func ETHAddressFromProto ¶
func ETHAddressFromProto(s *datapb.Signer_EthAddress) *SignerETHAddress
func (SignerETHAddress) AsHex ¶
func (s SignerETHAddress) AsHex(prepend bool) (signer, error)
func (SignerETHAddress) AsString ¶
func (s SignerETHAddress) AsString() (signer, error)
func (SignerETHAddress) DeepClone ¶
func (s SignerETHAddress) DeepClone() signer
func (SignerETHAddress) GetSignerType ¶
func (s SignerETHAddress) GetSignerType() SignerType
func (SignerETHAddress) IntoProto ¶
func (s SignerETHAddress) IntoProto() *datapb.Signer_EthAddress
func (SignerETHAddress) IsEmpty ¶
func (s SignerETHAddress) IsEmpty() bool
func (SignerETHAddress) Serialize ¶
func (s SignerETHAddress) Serialize() []byte
func (SignerETHAddress) String ¶
func (s SignerETHAddress) String() string
type SignerPubKey ¶
type SignerPubKey struct {
PubKey *PubKey
}
func DeserializePubKey ¶
func DeserializePubKey(data []byte) *SignerPubKey
func PubKeyFromProto ¶
func PubKeyFromProto(s *datapb.Signer_PubKey) *SignerPubKey
func (SignerPubKey) AsHex ¶
func (s SignerPubKey) AsHex(prepend bool) (signer, error)
func (SignerPubKey) AsString ¶
func (s SignerPubKey) AsString() (signer, error)
func (SignerPubKey) DeepClone ¶
func (s SignerPubKey) DeepClone() signer
func (SignerPubKey) GetSignerType ¶
func (s SignerPubKey) GetSignerType() SignerType
func (SignerPubKey) IntoProto ¶
func (s SignerPubKey) IntoProto() *datapb.Signer_PubKey
func (SignerPubKey) IsEmpty ¶
func (s SignerPubKey) IsEmpty() bool
func (SignerPubKey) Serialize ¶
func (s SignerPubKey) Serialize() []byte
func (SignerPubKey) String ¶
func (s SignerPubKey) String() string
type SignerType ¶
type SignerType int
const ( SignerTypeUnspecified SignerType = iota SignerTypePubKey SignerTypeEthAddress )
type SpecCondition ¶
type SpecCondition struct { Operator SpecConditionOperator Value string }
SpecCondition mirrors datapb.Condition type.
func DeepCloneSpecConditions ¶
func DeepCloneSpecConditions(conditions []*SpecCondition) []*SpecCondition
func SpecConditionFromProto ¶
func SpecConditionFromProto(protoCondition *datapb.Condition) *SpecCondition
func SpecConditionsFromProto ¶
func SpecConditionsFromProto(protoConditions []*datapb.Condition) []*SpecCondition
func (*SpecCondition) DeepClone ¶
func (c *SpecCondition) DeepClone() *SpecCondition
func (SpecCondition) IntoProto ¶
func (c SpecCondition) IntoProto() *datapb.Condition
func (SpecCondition) String ¶
func (c SpecCondition) String() string
type SpecConditionOperator ¶
type SpecConditionOperator = datapb.Condition_Operator
type SpecConditions ¶
type SpecConditions []*SpecCondition
func (SpecConditions) IntoProto ¶
func (sc SpecConditions) IntoProto() []*datapb.Condition
func (SpecConditions) String ¶
func (sc SpecConditions) String() string
type SpecFilter ¶
type SpecFilter struct { Key *SpecPropertyKey Conditions []*SpecCondition }
func DeepCloneSpecFilters ¶
func DeepCloneSpecFilters(filters []*SpecFilter) []*SpecFilter
func SpecFilterFromProto ¶
func SpecFilterFromProto(protoFilter *datapb.Filter) *SpecFilter
func SpecFiltersFromProto ¶
func SpecFiltersFromProto(protoFilters []*datapb.Filter) []*SpecFilter
func (*SpecFilter) DeepClone ¶
func (f *SpecFilter) DeepClone() *SpecFilter
DeepClone clones the filter receiver taking into account if its fields are empty.
func (*SpecFilter) IntoProto ¶
func (f *SpecFilter) IntoProto() *datapb.Filter
IntoProto return proto version of the filter receiver taking into account if its fields are empty.
func (SpecFilter) String ¶
func (f SpecFilter) String() string
type SpecFilters ¶
type SpecFilters []*SpecFilter
func (SpecFilters) IntoProto ¶
func (df SpecFilters) IntoProto() []*datapb.Filter
func (SpecFilters) String ¶
func (df SpecFilters) String() string
type SpecPropertyKey ¶
type SpecPropertyKey struct { Name string Type SpecPropertyKeyType NumberDecimalPlaces *uint64 }
func SpecPropertyKeyFromProto ¶
func SpecPropertyKeyFromProto(protoKey *datapb.PropertyKey) *SpecPropertyKey
func (*SpecPropertyKey) DeepClone ¶
func (k *SpecPropertyKey) DeepClone() *SpecPropertyKey
func (SpecPropertyKey) IntoProto ¶
func (k SpecPropertyKey) IntoProto() *datapb.PropertyKey
func (SpecPropertyKey) String ¶
func (k SpecPropertyKey) String() string
type SpecPropertyKeyType ¶
type SpecPropertyKeyType = datapb.PropertyKey_Type
type SpecSigners ¶
type SpecSigners []*Signer
func (SpecSigners) String ¶
func (s SpecSigners) String() string
type SpecStatus ¶
type SpecStatus = vegapb.DataSourceSpec_Status
type Timer ¶
type Timer interface { DataSourceType IsTriggered(time.Time) bool GetTimeTriggers() InternalTimeTriggers }