EmerisHQ / demeris-backend

Monorepo containing all the Demeris backend code and infrastructure definitions.
GNU Affero General Public License v3.0
8 stars 1 forks source link

[Price-Oracle] Get Token id for coingecko. #372

Closed DeshErBojhaa closed 2 years ago

DeshErBojhaa commented 2 years ago

Coin-Gecko queries requires id(s) to identify a token. In ideal case this should come from the CNS table. But all corresponding column (named price_id) is null in the CNS table.

We will store + cache these token id(s) on price oracle DB.

Sample id's used by coin-gecko

{
    "id": "perra",
    "symbol": "perra",
    "name": "Perra"
  },
  {
    "id": "persistence",
    "symbol": "xprt",
    "name": "Persistence"
  },
  {
    "id": "persistence-staked-xprt",
    "symbol": "stkxprt",
    "name": "pSTAKE Staked XPRT"
  },
  {
    "id": "perth-mint-gold-token",
    "symbol": "pmgt",
    "name": "Perth Mint Gold Token"
  },
...

Where the symbol is almost always equal to the ticker column in CNS.cains.

Solution: We will introduce a new table ticker_to_gecko_id where column ticker (text) and gecko_id (text) will hold the relations. We will cache the relation on server also.

DeshErBojhaa commented 2 years ago

PR: https://github.com/allinbits/demeris-backend/issues/372