wormhole/event_database/cloud_functions
Kevin Peters e2383e257b cloud_functions: Fixed ambiguous packages, CoinGeckoID not required for transfers
The CoinGeckoID is overridden in the allowlist.
2022-10-26 15:56:10 -04:00
..
.gcloudignore cloud function housekeeping 2022-03-10 14:26:41 -06:00
.gitignore cloud_functions: tokenAllowlist implementation (#1339) 2022-07-11 12:56:30 -05:00
README.md cloud functions - docs update 2022-03-17 18:25:48 -05:00
addresses-transferred-to-cumulative.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
addresses-transferred-to.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
bigtable-endpoints.md BigTable historical queries 2021-10-13 16:20:10 +00:00
external-data.go cloud_functions: Fixed ambiguous packages, CoinGeckoID not required for transfers 2022-10-26 15:56:10 -04:00
findvalues.go cloud function housekeeping 2022-03-10 14:26:41 -06:00
go.mod cloud_functions: Fixed ambiguous packages, CoinGeckoID not required for transfers 2022-10-26 15:56:10 -04:00
go.sum cloud_functions: Fixed ambiguous packages, CoinGeckoID not required for transfers 2022-10-26 15:56:10 -04:00
nfts.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
notional-transferred-from.go cloud_functions: Performance enhancements to handle increased message volume (#1688) 2022-10-07 09:33:10 -05:00
notional-transferred-to-cumulative.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
notional-transferred-to.go cloud_functions: Use CoinGecko API IDs from allowlist in TVL calculations 2022-08-03 11:58:18 -04:00
notional-transferred.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
notional-tvl-cumulative.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
notional-tvl.go cloud_functions: Performance enhancements to handle increased message volume (#1688) 2022-10-07 09:33:10 -05:00
process-transfer.go cloud_functions: Fixed ambiguous packages, CoinGeckoID not required for transfers 2022-10-26 15:56:10 -04:00
process-vaa.go cloud_functions: Added Aptos and Xpla support 2022-10-26 15:56:10 -04:00
readrow.go BigTable: query optimizations and return payloads 2021-12-20 16:56:56 +01:00
recent.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
shared.go cloud_functions: Added Aptos and Xpla support 2022-10-26 15:56:10 -04:00
token-allowlist-devnet.json cloud_functions: Use CoinGecko API IDs from allowlist in TVL calculations 2022-08-03 11:58:18 -04:00
token-allowlist-mainnet.json cloud_functions: Added Aptos and Xpla support 2022-10-26 15:56:10 -04:00
totals.go cloud_functions: Added LOAD_CACHE env variable 2022-07-20 16:09:11 -04:00
transaction-totals.go cloud_functions: Fixed ambiguous packages, CoinGeckoID not required for transfers 2022-10-26 15:56:10 -04:00
transaction.go BigTable: query optimizations and return payloads 2021-12-20 16:56:56 +01:00
workspace.code-workspace cloud function housekeeping 2022-03-10 14:26:41 -06:00

README.md

Google Cloud functions for BigTable

This is a reference implementaion for getting data out of BigTable.

Contents

This directory holds GCP Cloud Functions, one per file, along with shared utilities in shared.go. The file names correspond to the hosted endpoints. ie endpoint .../*-notionaltvl is the file notional-tvl.go

Debugging with VSCode

prereqs

  • Golang >= 1.16 installed and available on your path.
  • The Go VSCode extension, and gopls installed.

IDE setup

  • open a new VSCode window
  • File menu --> "Open Workspace from File..."
  • Select event_database/cloud_functions/workspace.code-workspace

Opening the workspace file as described above will open both cloud_functions and functions_server, so that you get all the VSCode goodness of intellesense, ability to run the code with the Go debugger, set breakpoints, etc.

Add your environment variables to functions_server/.vscode/launch.json

Start the debug server by pressing F5. You can check your server is up by requesting http://localhost:8080/readyz.

deploying

First deploy (creation) must include all the flags to configure the environment:

gcloud functions --project your-project deploy testnet --region europe-west3 --entry-point Entry --runtime go116 --trigger-http --allow-unauthenticated --service-account=your-readonly@your-project.iam.gserviceaccount.com --update-env-vars GCP_PROJECT=your-project,BIGTABLE_INSTANCE=wormhole-testnet

gcloud functions --project your-project deploy processvaa-testnet --region europe-west3 --entry-point ProcessVAA --runtime go116 --trigger-topic new-vaa-testnet --service-account=your-readonly@your-project.iam.gserviceaccount.com --update-env-vars GCP_PROJECT=your-project,BIGTABLE_INSTANCE=wormhole-testnet

Subsequent deploys (updates) only need include flags to indentify the resource for updating: project, region, name.

gcloud functions --project your-project deploy testnet --region europe-west3 --entry-point Entry

gcloud functions --project your-project deploy processvaa-testnet --region europe-west3 --entry-point ProcessVAA

invocation

All routes accept their input(s) as query parameters, or request body. Just two different ways of querying:

GET

curl "https://region-project-id.cloudfunctions.net/testnet/readrow?emitterChain=2&emitterAddress=000000000000000000000000e982e462b094850f12af94d21d470e21be9d0e9c&sequence=0000000000000006"

POST

curl -X POST  https://region-project-id.cloudfunctions.net/testnet/readrow \
-H "Content-Type:application/json" \
-d \
'{"emitterChain":"2", "emitterAddress":"000000000000000000000000e982e462b094850f12af94d21d470e21be9d0e9c", "sequence":"0000000000000006"}'

See ./bigtable-endpoints.md for API patterns