chain-registry icon indicating copy to clipboard operation
chain-registry copied to clipboard

Allow for any Price Oracle for assets

Open JeremyParish69 opened this issue 3 years ago • 2 comments

currently, we allow for "coingecko_id" for each asset, but what about other price oracles, like CoinMarketCap, or Dex spot prices, like Osmosis' OSMO/asset spot price?

we could have a generic price oracle object that contains the id for coingecko, as well CMC and Osmosis and others. E.g.,:

"oracle_ids":
{
  "coingecko": "circle",
  "coinmarketcap": "usdcircle",
  "osmosis": "pool:uusdc",
  "crescent": usdc-bcre-pool",
  "sefi": "sscrtusdc",
  "junoswap": "amm:juno-usdc"
}

This is what we have now:

  "coingecko_id": {
    "type": "string",
    "description": "[OPTIONAL] The coingecko id to fetch asset data from coingecko v3 api. See https://api.coingecko.com/api/v3/coins/list"
  }

JeremyParish69 avatar Jun 29 '22 21:06 JeremyParish69

+1 for more generalization instead of specific to a single vendor — this is good.

pyramation avatar Jul 14 '22 06:07 pyramation

Here is my schema suggestion:

"oracle_ids": {
  "type": "object",
  "properties": {
    "coingecko_id": {
      "type": "string"
    },
    "coinmarketcap_id": {
      "type": "string"
    },
    "osmosis": {
      "type": "object"
      "properties": {
        "osmo_spot": {
          "type": "number"
        },
        "atom_spot": {
          "type": "number"
        },
        "usd_spot": {
          "type": "number"
        },
        "other_spot": {
          "type": "number"
        },
        "largest_spot": {
          "type": "number"
        }
      }
    }
  }
}

wouldn't be too difficult to transform existing data to match this schema...

JeremyParish69 avatar Jul 23 '22 23:07 JeremyParish69