Skip to content

Serves data on the Olympus protocol to the CoinGecko API

Notifications You must be signed in to change notification settings

OlympusDAO/coingecko-api

Repository files navigation

CoinGecko API

Purpose

This project serves the circulating supply of OHM to CoinGecko, so that it can be displayed accurately on the token page.

Architecture

This is a very simple app, architected in the following way:

  • treasury-subgraph API endpoint. See: treasury-subgraph
  • Firestore database
  • Serverless function (in GCP)
  • Hosting in Firebase, so that the URL endpoint is static
    • A custom domain under olympusdao.finance is also manually mapped to the production URL endpoint

When the function's trigger URL is hit, the following are performed:

  1. Check if there is a value in the cache (Firestore) and returns it, if so.

    • Values are currently cached for 1 hour, in order to reduce queries to the GraphQL endpoint (which incur a charge).
  2. If there is no valid cached value, an API query is performed. If successful, the cache is updated and the value is returned.

  3. If no value is returned by the API query, HTTP status 500 is returned by the function.

Deployment

Deployment is handled by Pulumi, with hosting on GCP.

To deploy:

  1. Copy the .env.sample file and fill in any variables
  2. Obtain the JSON credentials file for the project's service account and save as gcp_credentials.json. Firebase requires a service account for deployment, hence the need to jump through this hoop.
  3. Run pulumi stack select and select/create the required stack
  4. Run pulumi refresh to grab the current state from GCP
  5. Run pulumi up to deploy.

If the GCP project is shared between stacks, you may need to import the default Firestore database: pulumi import gcp:firestore/database:Database default "(default)"

Notes

  • To force the deployed function to ignore the cache, append ?cache=false to the URL

About

Serves data on the Olympus protocol to the CoinGecko API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published