Skip to content

Latest commit

 

History

History
51 lines (27 loc) · 1.91 KB

README.md

File metadata and controls

51 lines (27 loc) · 1.91 KB

PoolTogether Stats Functions

Cloud functions to automatically update PoolTogether stats.

NodeJS TypeScript Firebase


Functions

Scheduled Data Query Functions

These are multiple chain-specific scheduled cloud functions, querying for all updated data on a chain since its last runtime.

This data is saved in storage buckets on Firebase, where they can be easily queried.

Currently, these functions run every 1 hour.

Scheduled Stats Query Functions

These are multiple chain-specific scheduled cloud functions, querying for wallet balances and aggregated stats for more efficient front-end queries.

These functions run 10 minutes after the initial data query functions.

Scheduled Player Data Function

This function runs 10 minutes after all on-chain data and stats are queried, in order to parse through all the data acquired and organize it by player (wallet).

This data is neatly put into Firestore, where it can be easily queried.

API

This API is a cloud function facilitating data queries from front-end apps.

It's OpenAPI documentation can be found here.

Self-Deployment

These cloud functions are ready for deployment through Firebase:

  1. Install dependencies by navigating to the functions folder and using npm i.

  2. Add your project ID in .firebaserc (an example file is provided).

  3. Create a storage bucket and set its name on functions/index.ts.

  4. Use firebase deploy to deploy the functions.

If you run into function deployment issues, try deploying each function individually through firebase deploy --only functions:ethDataQueries, for example.