code.vegaprotocol.io/vega@v0.79.0/protos/sources/vega/data_source.proto (about)

     1  syntax = "proto3";
     2  
     3  package vega;
     4  
     5  import "google/protobuf/struct.proto";
     6  import "vega/data/v1/data.proto";
     7  import "vega/data/v1/spec.proto";
     8  
     9  option go_package = "code.vegaprotocol.io/vega/protos/vega";
    10  
    11  // Represents the top level object that handles data sources.
    12  // Data source definition can be external or internal, with whatever
    13  // number of data sources are defined for each type in the child objects below.
    14  message DataSourceDefinition {
    15    oneof source_type {
    16      DataSourceDefinitionInternal internal = 1;
    17      DataSourceDefinitionExternal external = 2;
    18    }
    19  }
    20  
    21  // Describes which property of the data source data is to be
    22  // used for price source.
    23  message SpecBindingForCompositePrice {
    24    // The property name of price.
    25    string price_source_property = 1;
    26  }
    27  
    28  // Internal data source used for emitting timestamps.
    29  message DataSourceSpecConfigurationTime {
    30    // Conditions that the timestamps should meet in order to be considered.
    31    repeated vega.data.v1.Condition conditions = 1;
    32  }
    33  
    34  // Internal data source used for emitting timestamps automatically using predefined intervals and conditions.
    35  message DataSourceSpecConfigurationTimeTrigger {
    36    // Conditions that the timestamps need to meet in order to be considered.
    37    repeated vega.data.v1.Condition conditions = 1;
    38    // An internal time trigger
    39    repeated vega.data.v1.InternalTimeTrigger triggers = 2;
    40  }
    41  
    42  // Top level object used for all internal data sources.
    43  // It contains one of any of the defined source type variants.
    44  message DataSourceDefinitionInternal {
    45    // Types of internal data sources
    46    oneof source_type {
    47      DataSourceSpecConfigurationTime time = 1;
    48      DataSourceSpecConfigurationTimeTrigger time_trigger = 2;
    49    }
    50  }
    51  
    52  // DataSourceDefinitionExternal is the top level object used for all external
    53  // data sources. It contains one of any of the defined `SourceType` variants.
    54  message DataSourceDefinitionExternal {
    55    // Types of External data sources
    56    oneof source_type {
    57      DataSourceSpecConfiguration oracle = 1;
    58      // Contains the data specification that is received from Ethereum sources.
    59      EthCallSpec eth_oracle = 2;
    60    }
    61  }
    62  
    63  // All types of external data sources use the same configuration set for meeting
    64  // requirements in order for the data to be useful for Vega - valid signatures
    65  // and matching filters.
    66  message DataSourceSpecConfiguration {
    67    // Signers is the list of authorized signatures that signed the data for this
    68    // source. All the signatures in the data source data should be contained in
    69    // this external source. All the signatures in the data should be contained in
    70    // this list.
    71    repeated vega.data.v1.Signer signers = 1;
    72  
    73    // Filters describes which source data are considered of interest or not for
    74    // the product (or the risk model).
    75    repeated vega.data.v1.Filter filters = 2;
    76  }
    77  
    78  // Specifies a data source that derives its content from calling a read method
    79  // on an Ethereum contract.
    80  message EthCallSpec {
    81    // Ethereum address of the contract to call.
    82    string address = 1;
    83    // The ABI of that contract.
    84    string abi = 2;
    85    // Name of the method on the contract to call.
    86    string method = 3;
    87    // List of arguments to pass to method call.
    88    // Protobuf 'Value' wraps an arbitrary JSON type that is mapped to an Ethereum
    89    // type according to the ABI.
    90    repeated google.protobuf.Value args = 4;
    91    // Conditions for determining when to call the contract method.
    92    EthCallTrigger trigger = 5;
    93    // Number of confirmations required before the query is considered verified
    94    uint64 required_confirmations = 6;
    95    // Filters the data returned from the contract method
    96    repeated vega.data.v1.Filter filters = 7;
    97    // Normalisers are used to convert the data returned from the contract method
    98    // into a standard format. The key of the map is the name of the property,
    99    // which identifies the specific piece of data to other parts of the data
   100    // sourcing framework, for example filters. The value is a JSONPath expression
   101    // for expressing where in the contract call result the required data is
   102    // located, for example $[0] indicates the first result. $[1].price would look
   103    // in the second result returned from the contract for a structure with a key
   104    // called 'price' and use that if it exists.
   105    repeated Normaliser normalisers = 8;
   106  
   107    // The ID of the EVM based chain which is to be used to source the oracle data.
   108    uint64 source_chain_id = 9;
   109  }
   110  
   111  message Normaliser {
   112    string name = 1;
   113    string expression = 2;
   114  }
   115  
   116  // Determines when the contract method should be called.
   117  message EthCallTrigger {
   118    oneof trigger {
   119      EthTimeTrigger time_trigger = 1;
   120    }
   121  }
   122  
   123  // Trigger for an Ethereum call based on the Ethereum block timestamp. Can be
   124  // one-off or repeating.
   125  message EthTimeTrigger {
   126    // Trigger when the Ethereum time is greater or equal to this time, in Unix
   127    // seconds.
   128    optional uint64 initial = 1;
   129    // Repeat the call every n seconds after the initial call. If no time for
   130    // initial call was specified, begin repeating immediately.
   131    optional uint64 every = 2;
   132    // If repeating, stop once Ethereum time is greater than this time, in Unix
   133    // seconds. If not set, then repeat indefinitely.
   134    optional uint64 until = 3;
   135  }
   136  
   137  // Data source spec describes the data source base that a product or a risk
   138  // model wants to get from the data source engine. This message contains
   139  // additional information used by the API.
   140  message DataSourceSpec {
   141    // Hash generated from the DataSpec data.
   142    string id = 1;
   143    // Creation date and time
   144    int64 created_at = 2;
   145    // Last Updated timestamp
   146    int64 updated_at = 3;
   147  
   148    DataSourceDefinition data = 4;
   149  
   150    // Status describes the status of the data source spec
   151    Status status = 5;
   152  
   153    // Status describe the status of the data source spec
   154    enum Status {
   155      // Default value.
   156      STATUS_UNSPECIFIED = 0;
   157      // STATUS_ACTIVE describes an active data source spec.
   158      STATUS_ACTIVE = 1;
   159      // STATUS_DEACTIVATED describes a data source spec that is not listening to
   160      // data anymore.
   161      STATUS_DEACTIVATED = 2;
   162    }
   163  }
   164  
   165  message ExternalDataSourceSpec {
   166    DataSourceSpec spec = 1;
   167  }