cosmos / chain-registry

Creative Commons Attribution 4.0 International
507 stars 1.22k forks source link

Allow for any Price Oracle for assets #463

Open JeremyParish69 opened 2 years ago

JeremyParish69 commented 2 years ago

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"
  }
pyramation commented 2 years ago

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

JeremyParish69 commented 2 years ago

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...