Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add fortune exchange oracle to e2e environment #1706

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"dist/typechain-types"
],
"scripts": {
"clean": "hardhat clean && rm -rf abis cache artifacts typechain-types",
"precompile": "npm run clean",
"clean": "hardhat clean && rm -rf abis cache artifacts typechain-types dist",
"compile": "hardhat compile",
"verify": "hardhat verify",
"test": "hardhat test",
Expand All @@ -33,9 +32,9 @@
"format:contracts": "prettier --write '**/*.sol'",
"format:scripts": "prettier --write '**/*.ts'",
"format": "yarn format:contracts && yarn format:scripts",
"build": "npm run compile && tsc",
"prebuild": "rm -rf dist",
"prepublish": "npm run build"
"build": "yarn compile && tsc",
"prebuild": "yarn clean",
"prepublish": "yarn build"
},
"repository": {
"type": "git",
Expand Down
22 changes: 15 additions & 7 deletions scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.PHONY: check-file fortune

check-legacy-abis:
@if [ ! -d "../packages/core/abis/legacy" ]; then \
yarn workspace @human-protocol/core build; \
check-core-folders:
@if [ ! -d "../packages/core/abis/legacy" ] || [ ! -d "../packages/core/typechain-types" ]; then \
yarn workspace @human-protocol/sdk build; \
fi

create-env-files:
Expand All @@ -14,15 +14,21 @@ create-env-files:
cp ./fortune/.env.jl-client ../packages/apps/job-launcher/client/.env.local ; \
fi

@if [ ! -f "../packages/apps/fortune/exchange-oracle/server/.env.local" ]; then \
cp ./fortune/.env.exco-server ../packages/apps/fortune/exchange-oracle/server/.env.local ; \
fi

hardhat-node:
yarn workspace @human-protocol/core local

subgraph:
sleep 5
$(MAKE) check-legacy-abis
docker compose -f ./fortune/docker-compose.yml up -d graph-node
NETWORK=localhost yarn workspace @human-protocol/subgraph generate
sleep 10
check-container-health:
@while [ $$(docker inspect --format='{{.State.Health.Status}}' graph-node) != "healthy" ]; do \
sleep 2; \
done; \
echo "Container is healthy."
yarn workspace @human-protocol/subgraph create-local
yarn workspace @human-protocol/subgraph deploy-local

Expand All @@ -42,14 +48,16 @@ job-launcher-client:

fortune-exchange-oracle:
yarn workspace @human-protocol/fortune-exchange-oracle-server setup:local
NODE_ENV=local yarn workspace @human-protocol/fortune-exchange-oracle-server migration:run
NODE_ENV=local yarn workspace @human-protocol/fortune-exchange-oracle-server start

fortune-recording-oracle:
yarn workspace @human-protocol/fortune-recording-oracle setup:local

reputation-oracle:
yarn workspace @human-protocol/reputation-oracle setup:local

fortune:
fortune: check-core-folders
@echo "RUNNING FORTUNE..."
@trap 'echo "STOPPING FORTUNE.."; kill -9 $$PID_HARDHAT $$PID_JL_CLIENT $$PID_JL_SERVER $$PID_EXO $$PID_RECO; docker compose -f ./fortune/docker-compose.yml down; exit 0' SIGINT ERR; \
$(MAKE) hardhat-node & PID_HARDHAT=$$!; \
Expand Down
25 changes: 25 additions & 0 deletions scripts/fortune/.env.exco-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# General
NODE_ENV=development
PORT=5003

# Database
POSTGRES_HOST=0.0.0.0
POSTGRES_USER=default
POSTGRES_PASSWORD=qwerty
POSTGRES_DATABASE=exchange-oracle
POSTGRES_SYNC=false
POSTGRES_PORT=5432
POSTGRES_SSL=false
POSTGRES_LOGGING='all'

# S3
S3_ENDPOINT=localhost
S3_PORT=9000
S3_ACCESS_KEY=access-key
S3_SECRET_KEY=secret-key

WEB3_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a #0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC

PGP_ENCRYPT=false
# PGP_PRIVATE_KEY=
# PGP_PASSPHRASE=
5 changes: 4 additions & 1 deletion scripts/fortune/.env.jl-server
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ STRIPE_APP_VERSION=1.0.0
STRIPE_APP_INFO_URL=https://github.com/humanprotocol/human-protocol/tree/main/packages/apps/job-launcher/server

#Sendgrid
SENDGRID_API_KEY=
SENDGRID_API_KEY=

#Cron jobs secret
CRON_SECRET=secret
1 change: 1 addition & 0 deletions scripts/fortune/initdb/create-dbs.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CREATE DATABASE "job-launcher";
CREATE DATABASE "graph-node";
CREATE DATABASE "exchange-oracle";
CREATE DATABASE "reputation-oracle";
Loading