BBGO Karma Bot – BBG token distribution automation

Requirement

  • node 16
  • yarn
  • pm2
  • mongodb

Setup

Note that while setting a secret is optional on GitHub, it is required to be set in order to use @octokit/webhooks. Content Type must be set to application/json, application/x-www-form-urlencoded is not supported.

dotenv

GITHUB_WEBHOOK_SECRET=__secret__
GITHUB_PERSONAL_TOKEN=__personal_token__

GITHUB_OAUTH_CLIENT_ID=__oauth_client_id__
GITHUB_OAUTH_SECRET=__oauth_secret__

CONTRACT_ADDRESS=__contract_address__
CONTRACT_OWNER_ADDRESS=__owner_address__

PRIVATE_KEY=__contract_private_key__
MONGO_URL=mongodb://localhost:27017

DEPLOY_HOST=bbgo
DEPLOY_USER=root
DEPLOY_HOME=/home/karma

# DEV_PROXY=https://smee.io/sTg2t0azYc123123123123%

Local Testing

You can receive webhooks on your local machine or even browser using EventSource and smee.io.

Go to smee.io and Start a new channel. Then copy the “Webhook Proxy URL” and

  1. enter it in the GitHub App’s “Webhook URL” input
  2. set it to the DEV_PROXY environment variable

Deploy

npx shipit production deploy

Reference

GitHub

View Github