Skip to content

Latest commit

 

History

History
78 lines (63 loc) · 2.94 KB

File metadata and controls

78 lines (63 loc) · 2.94 KB

Chainlink Implied-price Composite Adapter

An adapter that fetches the median value from any two sets of underlying adapters, and divides the results from each set together.

Configuration

The adapter takes the following environment variables:

Required? Name Description Options Defaults to
[source]_ADAPTER_URL The adapter URL to query for any [source]

Running

See the Composite Adapter README for more information on how to get started.

Input Params

Required? Name Description Options Defaults to
dividendSources An array (string[]) or comma delimited list (string) of source adapters to query for the dividend value
dividendMinAnswers The minimum number of answers needed to return a value for the dividend 1
dividendInput The payload to send to the dividend sources {}
divisorSources An array (string[]) or comma delimited list (string) of source adapters to query for the divisor value
divisorMinAnswers The minimum number of answers needed to return a value for the divisor 1
divisorInput The payload to send to the divisor sources {}

Each source in sources needs to have a defined *_ADAPTER_URL defined as an env var.

E.g. for a request with "dividendSources": ["coingecko", "coinpaprika"], you will need to have pre-set the following env vars:

COINGECKO_ADAPTER_URL=https://coingecko_adapter_url/
COINPAPRIKA_ADAPTER_URL=https://coinpaprika_adapter_url/

Sample Input

{
  "id": "1",
  "data": {
    "dividendSources": ["coingecko"],
    "divisorSources": ["coingecko"],
    "dividendInput": {
      "from": "LINK",
      "to": "USD",
      "overrides": {
        "coingecko": {
          "LINK": "chainlink"
        }
      }
    },
    "divisorInput": {
      "from": "ETH",
      "to": "USD",
      "overrides": {
        "coingecko": {
          "ETH": "ethereum"
        }
      }
    }
  }
}

Sample Output

{
  "jobRunID": "1",
  "result": "0.005204390891874140333",
  "statusCode": 200,
  "data": {
    "result": "0.005204390891874140333"
  }
}