Comment on page

Data provider utilities

KlayOracle contains a couple of utitilties written as Makefiles
Some of the key utilities
  • generate adapter ID
    For each feed defined by the data provider, an adapter ID needs to be generated. This ID uniquely identifies that feed when being processed by the node. This also ensures that the oracle contract defined can uniquely identify the adapter.
    To generate the adapter ID:
    • For each data feed you want to define, create the adapter JSON file within the feed path. All of the required properties for the adapter file should have been defined, except for the adapterID, which should be an empty string.
    • Let’s assume we’ve created two data feeds, KLAY_USD.json and WEMIX_USD.json within the feeds folder of our data provider package
    • Run the following command:
      • ADAPTERS=KLAY_USD.json WEMIX_USD.json make adapter-id-gen
    The generate adapter ID generates an ID for each of the feeds defined in the ADAPTERS array.
    Once the command runs successfully, the feed file is compressed into 1 line.
    If you’d like to decompress or prettify the output, copy the contents of the file and head to JSONFormatter.
  • dryrun
    This command mimics the aggregation mechanism of the data provider and verifies that the adapter configuration defined is correct and would run correctly on the node.
    To dry run,
    • Run the following command:
      • ADAPTERS=KLAY_USD.json make adapter-dry-run
    • This generates an output