diff --git a/.env b/.env index bcea7390578..fdf19de754b 100644 --- a/.env +++ b/.env @@ -36,6 +36,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="master" CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" CELOTOOL_DOCKER_IMAGE_TAG="celotool-c8e3392aa2ca44ff83b4035700ece5fd12ed2b84" +CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" +CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" + +# Schedule for an oracle deployed via celotool, expressed in crontab syntax +# This schedule is "every 5th minute" +ORACLE_CRON_SCHEDULE="*/5 * * * *" + +ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" +ORACLE_DOCKER_IMAGE_TAG="default" + TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-d3d165a7db548d175cd703c86c20c1657c04368d" diff --git a/.env.alfajores b/.env.alfajores index 8089f0318e7..154cbac68ee 100644 --- a/.env.alfajores +++ b/.env.alfajores @@ -32,6 +32,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="9575a01c12438e1adc6bb610c891cb5066aaa7aa" CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" CELOTOOL_DOCKER_IMAGE_TAG="celotool-552b1accf90404fdcd886670d150af0a5cae116f" +CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" +CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" + +# Schedule for an oracle deployed via celotool, expressed in crontab syntax +# This schedule is "every 5th minute" +ORACLE_CRON_SCHEDULE="*/5 * * * *" + +ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" +ORACLE_DOCKER_IMAGE_TAG="default" + TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-552b1accf90404fdcd886670d150af0a5cae116f" diff --git a/.env.alfajoresstaging b/.env.alfajoresstaging index ea8268163ad..3d6e13d49d4 100644 --- a/.env.alfajoresstaging +++ b/.env.alfajoresstaging @@ -34,6 +34,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="9575a01c12438e1adc6bb610c891cb5066aaa7aa" CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" CELOTOOL_DOCKER_IMAGE_TAG="celotool-552b1accf90404fdcd886670d150af0a5cae116f" +CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" +CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" + +# Schedule for an oracle deployed via celotool, expressed in crontab syntax +# This schedule is "every 5th minute" +ORACLE_CRON_SCHEDULE="*/5 * * * *" + +ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" +ORACLE_DOCKER_IMAGE_TAG="default" + TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-552b1accf90404fdcd886670d150af0a5cae116f" diff --git a/.env.baklavastaging b/.env.baklavastaging new file mode 100644 index 00000000000..ad33044b0f9 --- /dev/null +++ b/.env.baklavastaging @@ -0,0 +1,107 @@ +# Don't use "//" for comments in this file. +# This file is meant to be executed as a bash script for testing. +ENV_TYPE="staging" + +GETH_VERBOSITY=2 + +VM_BASED=true + +KUBERNETES_CLUSTER_NAME="baklavastaging" +KUBERNETES_CLUSTER_ZONE="us-west1-a" +CLUSTER_DOMAIN_NAME="celo-testnet" + +TESTNET_PROJECT_NAME="celo-testnet" + +BLOCKSCOUT_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/blockscout" +BLOCKSCOUT_DOCKER_IMAGE_TAG="c42d9c2f3ef5e79c152c44a82fa0f12233dcfb5c" +BLOCKSCOUT_WEB_REPLICAS=3 +# Increment this value everytime you redeploy blockscout. Or else the deployment will fail due to the +# existing database. +BLOCKSCOUT_DB_SUFFIX="0" +BLOCKSCOUT_SUBNETWORK_NAME="Baklava Staging" + +ETHSTATS_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/ethstats" +ETHSTATS_DOCKER_IMAGE_TAG="bbc89603d872af1c6b37cf00e8220ed26237fc91" +ETHSTATS_TRUSTED_ADDRESSES="" +ETHSTATS_BANNED_ADDRESSES="" + +GETH_NODE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/geth" +# When upgrading change this to latest commit hash from the master of the geth repo +# `geth $ git show | head -n 1` +GETH_NODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d" + +GETH_BOOTNODE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/geth-all" +# When upgrading change this to latest commit hash from the master of the geth repo +# `geth $ git show | head -n 1` +GETH_BOOTNODE_DOCKER_IMAGE_TAG="a85db20179b503b802430aef7085d35aa761c63d" + +CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" +CELOTOOL_DOCKER_IMAGE_TAG="celotool-51ae8e72be34a614346950b6fbd8ba3b94223947" + +CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" +CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" + +# Schedule for an oracle deployed via celotool, expressed in crontab syntax +# This schedule is "every 5th minute" +ORACLE_CRON_SCHEDULE="*/5 * * * *" + +ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" +ORACLE_DOCKER_IMAGE_TAG="baklavastaging" + +TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" +TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-51ae8e72be34a614346950b6fbd8ba3b94223947" + +ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY="us.gcr.io/celo-testnet/celo-monorepo" +ATTESTATION_SERVICE_DOCKER_IMAGE_TAG="attestation-service-c8e3392aa2ca44ff83b4035700ece5fd12ed2b84" + +GETH_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet-production/geth-exporter" +GETH_EXPORTER_DOCKER_IMAGE_TAG="ed7d21bd50592709173368cd697ef73c1774a261" + +# Genesis Vars +NETWORK_ID=31416 +CONSENSUS_TYPE="istanbul" +BLOCK_TIME=5 +# Minimum epoch length is 15 minutes +EPOCH=180 +LOOKBACK=12 +ISTANBUL_REQUEST_TIMEOUT_MS=10000 + +# the number of load test clients that will be given funds in the genesis & migrations +LOAD_TEST_CLIENTS=10 +# every 3.6 seconds, so that 1000 transactions are sent by a client every hour +LOAD_TEST_TX_DELAY_MS=3600 + +VALIDATORS=70 +PROXIED_VALIDATORS=35 +TX_NODES=5 +# STATIC_IPS_FOR_GETH_NODES=false +# Whether tx_nodes/validators stateful set should use ssd persistent disks +# GETH_NODES_SSD_DISKS=true +IN_MEMORY_DISCOVERY_TABLE=false +# PING_IP_FROM_PACKET=false + +# Testnet vars +# GETH_NODES_BACKUP_CRONJOB_ENABLED=true +# CONTRACT_CRONJOBS_ENABLED=true +CLUSTER_CREATION_FLAGS="--enable-autoscaling --min-nodes 3 --max-nodes 8 --machine-type=n1-standard-4" + + +GETH_NODE_CPU_REQUEST=400m +GETH_NODE_MEMORY_REQUEST=2.5G + +VERIFICATION_POOL_URL="https://us-central1-celo-testnet.cloudfunctions.net/handleVerificationRequestbaklavastaging/v0.1/sms/" +VERIFICATION_REWARDS_URL="https://us-central1-celo-testnet.cloudfunctions.net/handleVerificationRequestbaklavastaging/v0.1/rewards/" + +STACKDRIVER_MONITORING_DASHBOARD="https://app.google.stackdriver.com/dashboards/11713866848730522797?project=celo-testnet" +STACKDRIVER_NOTIFICATION_CHANNEL_APPLICATIONS="12047595356119796119" +STACKDRIVER_NOTIFICATION_CHANNEL_PROTOCOL="12047595356119796119" +STACKDRIVER_NOTIFICATION_APPLICATIONS_PREFIX="notification-service-,blockchain-api-,faucet-" + +MOBILE_WALLET_PLAYSTORE_LINK="https://play.google.com/apps/internaltest/4700990475000634666" + +# NOTIFICATION_SERVICE_FIREBASE_DB="https://console.firebase.google.com/u/0/project/celo-org-mobile/database/celo-org-mobile-int/data" + +PROMTOSD_SCRAPE_INTERVAL="5m" +PROMTOSD_EXPORT_INTERVAL="5m" + +SMS_RETRIEVER_HASH_CODE=l5k6LvdPDXS diff --git a/.env.integration b/.env.integration index 86243ff42ca..d100f72e6b6 100644 --- a/.env.integration +++ b/.env.integration @@ -36,6 +36,16 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="09a217ff58a95214cbc5189c933359707f4fdaf2" CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" CELOTOOL_DOCKER_IMAGE_TAG="celotool-5bea6d30cbe6aa4272b32a4d2cfed5567f422ea9" +CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" +CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" + +# Schedule for an oracle deployed via celotool, expressed in crontab syntax +# This schedule is "every 5th minute" +ORACLE_CRON_SCHEDULE="*/5 * * * *" + +ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" +ORACLE_DOCKER_IMAGE_TAG="default" + TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" TRANSACTION_METRICS_EXPORTER_DOCKER_IMAGE_TAG="transaction-metrics-exporter-5bea6d30cbe6aa4272b32a4d2cfed5567f422ea9" diff --git a/dockerfiles/cli-standalone/Dockerfile b/dockerfiles/cli-standalone/Dockerfile new file mode 100644 index 00000000000..b80f5c2a4c6 --- /dev/null +++ b/dockerfiles/cli-standalone/Dockerfile @@ -0,0 +1,15 @@ +FROM node:10-alpine + +RUN apk update && apk add python git make gcc g++ bash + +RUN adduser -D -S celo + +USER celo + +RUN mkdir /home/celo/.npm-global +ENV PATH=/home/celo/.npm-global/bin:$PATH +ENV NPM_CONFIG_PREFIX=/home/celo/.npm-global + +WORKDIR /home/celo/ + +RUN npm install -g @celo/celocli@0.0.30-beta2 diff --git a/packages/attestation-service/package.json b/packages/attestation-service/package.json index 78d677b816a..a2adb35626d 100644 --- a/packages/attestation-service/package.json +++ b/packages/attestation-service/package.json @@ -27,7 +27,7 @@ "lint": "tslint -c tslint.json --project ." }, "dependencies": { - "@celo/contractkit": "0.2.1-dev", + "@celo/contractkit": "0.2.3-dev", "@celo/utils": "^0.1.0", "bignumber.js": "^7.2.0", "body-parser": "1.19.0", diff --git a/packages/celotool/package.json b/packages/celotool/package.json index 1deb65bf3c0..01e5dce5420 100644 --- a/packages/celotool/package.json +++ b/packages/celotool/package.json @@ -9,7 +9,7 @@ "@celo/verification-pool-api": "^1.0.0", "@celo/utils": "^0.1.0", "@celo/walletkit": "^0.0.14", - "@celo/contractkit": "0.2.1-dev", + "@celo/contractkit": "0.2.3-dev", "@google-cloud/monitoring": "0.7.1", "@google-cloud/pubsub": "^0.28.1", "@google-cloud/storage": "^2.4.3", diff --git a/packages/celotool/src/cmds/deploy/destroy/oracle.ts b/packages/celotool/src/cmds/deploy/destroy/oracle.ts new file mode 100644 index 00000000000..b7286f0074a --- /dev/null +++ b/packages/celotool/src/cmds/deploy/destroy/oracle.ts @@ -0,0 +1,15 @@ +import { switchToClusterFromEnv } from 'src/lib/cluster' +import { removeHelmRelease } from 'src/lib/oracle' +import { DestroyArgv } from '../../deploy/destroy' + +export const command = 'oracle' + +export const describe = 'destroy the oracle package' + +export const builder = {} + +export const handler = async (argv: DestroyArgv) => { + await switchToClusterFromEnv() + + await removeHelmRelease(argv.celoEnv) +} diff --git a/packages/celotool/src/cmds/deploy/initial/oracle.ts b/packages/celotool/src/cmds/deploy/initial/oracle.ts new file mode 100644 index 00000000000..367dcee8772 --- /dev/null +++ b/packages/celotool/src/cmds/deploy/initial/oracle.ts @@ -0,0 +1,17 @@ +import { InitialArgv } from 'src/cmds/deploy/initial' +import { switchToClusterFromEnv } from 'src/lib/cluster' +import { installHelmChart } from 'src/lib/oracle' +import yargs from 'yargs' + +export const command = 'oracle' + +export const describe = 'deploy the oracle for the specified network' + +export const builder = (argv: yargs.Argv) => { + return argv +} + +export const handler = async (argv: InitialArgv) => { + await switchToClusterFromEnv() + await installHelmChart(argv.celoEnv) +} diff --git a/packages/celotool/src/lib/attestation-service.ts b/packages/celotool/src/lib/attestation-service.ts index 4bea856f58f..bef21c322e6 100644 --- a/packages/celotool/src/lib/attestation-service.ts +++ b/packages/celotool/src/lib/attestation-service.ts @@ -46,7 +46,6 @@ async function helmParameters(celoEnv: string) { envVar.ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY )}`, `--set attestation_service.image.tag=${fetchEnv(envVar.ATTESTATION_SERVICE_DOCKER_IMAGE_TAG)}`, - `--set attestation_service.image.tag=${fetchEnv(envVar.ATTESTATION_SERVICE_DOCKER_IMAGE_TAG)}`, `--set attestation_service.nexmo.apiKey="${fetchEnv(envVar.NEXMO_KEY)}"`, `--set attestation_service.nexmo.apiSecret="${fetchEnv(envVar.NEXMO_SECRET)}"`, `--set attestation_service.sms_retriever_hash_code="${fetchEnv( diff --git a/packages/celotool/src/lib/endpoints.ts b/packages/celotool/src/lib/endpoints.ts index 13597b9be35..0c56bbd1fb7 100644 --- a/packages/celotool/src/lib/endpoints.ts +++ b/packages/celotool/src/lib/endpoints.ts @@ -15,3 +15,7 @@ export function getEthstatsUrl(argv: CeloEnvArgv) { export function getBlockchainApiUrl(argv: CeloEnvArgv) { return `https://${argv.celoEnv}-dot-${fetchEnv(envVar.TESTNET_PROJECT_NAME)}.appspot.com` } + +export function getFornoUrl(celoEnv: string) { + return `https://${celoEnv}-forno.${fetchEnv(envVar.CLUSTER_DOMAIN_NAME)}.org` +} diff --git a/packages/celotool/src/lib/env-utils.ts b/packages/celotool/src/lib/env-utils.ts index ed1a2a2173e..1aaabea3d48 100644 --- a/packages/celotool/src/lib/env-utils.ts +++ b/packages/celotool/src/lib/env-utils.ts @@ -13,6 +13,8 @@ export enum envVar { ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY = 'ATTESTATION_SERVICE_DOCKER_IMAGE_REPOSITORY', ATTESTATION_SERVICE_DOCKER_IMAGE_TAG = 'ATTESTATION_SERVICE_DOCKER_IMAGE_TAG', BLOCK_TIME = 'BLOCK_TIME', + CELOCLI_STANDALONE_IMAGE_REPOSITORY = 'CELOCLI_STANDALONE_IMAGE_REPOSITORY', + CELOCLI_STANDALONE_IMAGE_TAG = 'CELOCLI_STANDALONE_IMAGE_TAG', CELOTOOL_CELOENV = 'CELOTOOL_CELOENV', CELOTOOL_CONFIRMED = 'CELOTOOL_CONFIRMED', CELOTOOL_DOCKER_IMAGE_REPOSITORY = 'CELOTOOL_DOCKER_IMAGE_REPOSITORY', @@ -62,6 +64,9 @@ export enum envVar { NEXMO_KEY = 'NEXMO_KEY', NEXMO_SECRET = 'NEXMO_SECRET', NOTIFICATION_SERVICE_FIREBASE_DB = 'NOTIFICATION_SERVICE_FIREBASE_DB', + ORACLE_CRON_SCHEDULE = 'ORACLE_CRON_SCHEDULE', + ORACLE_DOCKER_IMAGE_REPOSITORY = 'ORACLE_DOCKER_IMAGE_REPOSITORY', + ORACLE_DOCKER_IMAGE_TAG = 'ORACLE_DOCKER_IMAGE_TAG', PROMTOSD_EXPORT_INTERVAL = 'PROMTOSD_EXPORT_INTERVAL', PROMTOSD_SCRAPE_INTERVAL = 'PROMTOSD_SCRAPE_INTERVAL', SMS_RETRIEVER_HASH_CODE = 'SMS_RETRIEVER_HASH_CODE', diff --git a/packages/celotool/src/lib/oracle.ts b/packages/celotool/src/lib/oracle.ts new file mode 100644 index 00000000000..da213a94542 --- /dev/null +++ b/packages/celotool/src/lib/oracle.ts @@ -0,0 +1,35 @@ +import { getFornoUrl } from 'src/lib/endpoints' +import { envVar, fetchEnv } from 'src/lib/env-utils' +import { installGenericHelmChart, removeGenericHelmChart } from 'src/lib/helm_deploy' + +const helmChartPath = '../helm-charts/oracle' + +export async function installHelmChart(celoEnv: string) { + return installGenericHelmChart( + celoEnv, + releaseName(celoEnv), + helmChartPath, + helmParameters(celoEnv) + ) +} +export async function removeHelmRelease(celoEnv: string) { + await removeGenericHelmChart(releaseName(celoEnv)) +} + +function helmParameters(celoEnv: string) { + return [ + `--set celotool.image.repository=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_REPOSITORY)}`, + `--set celotool.image.tag=${fetchEnv(envVar.CELOTOOL_DOCKER_IMAGE_TAG)}`, + `--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, + `--set oracle.cronSchedule="${fetchEnv(envVar.ORACLE_CRON_SCHEDULE)}"`, + `--set oracle.image.repository=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_REPOSITORY)}`, + `--set oracle.image.tag=${fetchEnv(envVar.ORACLE_DOCKER_IMAGE_TAG)}`, + `--set celocli.nodeUrl=${getFornoUrl(celoEnv)}`, + `--set celocli.image.repository=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_REPOSITORY)}`, + `--set celocli.image.tag=${fetchEnv(envVar.CELOCLI_STANDALONE_IMAGE_TAG)}`, + ] +} + +function releaseName(celoEnv: string) { + return `${celoEnv}-oracle` +} diff --git a/packages/cli/package.json b/packages/cli/package.json index 2c589cb8782..b7438da1bdd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -31,7 +31,7 @@ "test": "TZ=UTC jest --runInBand" }, "dependencies": { - "@celo/contractkit": "0.2.1-dev", + "@celo/contractkit": "0.2.3-dev", "@celo/utils": "^0.1.0", "@oclif/command": "^1", "@oclif/config": "^1", diff --git a/packages/contractkit/package.json b/packages/contractkit/package.json index 2b9f0a8a09c..2ef4102e033 100644 --- a/packages/contractkit/package.json +++ b/packages/contractkit/package.json @@ -1,6 +1,6 @@ { "name": "@celo/contractkit", - "version": "0.2.1-dev", + "version": "0.2.3-dev", "description": "Celo's ContractKit to interact with Celo network", "main": "./lib/index.js", "types": "./lib/index.d.ts", diff --git a/packages/helm-charts/oracle/.helmignore b/packages/helm-charts/oracle/.helmignore new file mode 100644 index 00000000000..50af0317254 --- /dev/null +++ b/packages/helm-charts/oracle/.helmignore @@ -0,0 +1,22 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/packages/helm-charts/oracle/Chart.yaml b/packages/helm-charts/oracle/Chart.yaml new file mode 100644 index 00000000000..10ccf946e82 --- /dev/null +++ b/packages/helm-charts/oracle/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: oracle +version: 0.1.0 diff --git a/packages/helm-charts/oracle/templates/oracle.cronjob.yaml b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml new file mode 100644 index 00000000000..f962a6dfbe9 --- /dev/null +++ b/packages/helm-charts/oracle/templates/oracle.cronjob.yaml @@ -0,0 +1,75 @@ +apiVersion: batch/v1beta1 +kind: CronJob +metadata: + name: {{ .Release.Name }} + labels: + app: oracle + chart: oracle + release: {{ .Release.Service }} + component: oracle +spec: + schedule: "{{ .Values.oracle.cronSchedule }}" + concurrencyPolicy: Forbid + jobTemplate: + spec: + backoffLimit: 1 + template: + spec: + initContainers: + - name: get-current-price + image: {{ .Values.oracle.image.repository }}:{{ .Values.oracle.image.tag }} + imagePullPolicy: IfNotPresent + command: + - sh + - "-c" + - | + ./current_rate.sh > /celo/.celo/current_price + volumeMounts: + - name: data + mountPath: /celo/.celo + - name: get-account + image: {{ .Values.celotool.image.repository }}:{{ .Values.celotool.image.tag }} + imagePullPolicy: IfNotPresent + command: ["/bin/sh"] + args: + - "-c" + - | + celotooljs.sh generate bip32 --mnemonic "$MNEMONIC" --accountType price_oracle --index 0 > /celo/.celo/pkey + celotooljs.sh generate account-address --private-key `cat /celo/.celo/pkey` > /celo/.celo/account + volumeMounts: + - name: data + mountPath: /celo/.celo + env: + - name: MNEMONIC + valueFrom: + secretKeyRef: + name: {{ .Release.Name }} + key: MNEMONIC + containers: + - name: report-price + image: {{ .Values.celocli.image.repository }}:{{ .Values.celocli.image.tag }} + imagePullPolicy: IfNotPresent + command: ["/bin/sh"] + args: + - "-c" + - | + PRICE=`cat /celo/.celo/current_price` + echo 'current price:' + echo $PRICE + PK=`cat /celo/.celo/pkey` + ACCOUNT=`cat /celo/.celo/account` + celocli config:set --node {{ .Values.celocli.nodeUrl }} + celocli oracle:report StableToken --numerator $PRICE --privateKey $PK --from $ACCOUNT + volumeMounts: + - name: data + mountPath: /celo/.celo + env: + - name: MNEMONIC + valueFrom: + secretKeyRef: + name: {{ .Release.Name }} + key: MNEMONIC + restartPolicy: Never + volumes: + - name: data + emptyDir: {} diff --git a/packages/helm-charts/oracle/templates/oracle.secret.yaml b/packages/helm-charts/oracle/templates/oracle.secret.yaml new file mode 100644 index 00000000000..dac777fb212 --- /dev/null +++ b/packages/helm-charts/oracle/templates/oracle.secret.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Release.Name }} + labels: + app: oracle + chart: oracle + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +type: Opaque +data: + MNEMONIC: {{ .Values.mnemonic | b64enc | quote }} \ No newline at end of file diff --git a/packages/mobile/package.json b/packages/mobile/package.json index 495f1677abb..a87d63dc5cc 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -44,7 +44,7 @@ }, "dependencies": { "@celo/client": "9575a01", - "@celo/contractkit": "0.2.1-dev", + "@celo/contractkit": "0.2.3-dev", "@celo/react-components": "1.0.0", "@celo/react-native-sms-retriever": "git+https://github.com/celo-org/react-native-sms-retriever#b88e502", "@celo/utils": "^0.1.1", diff --git a/packages/protocol/migrations/08_stabletoken.ts b/packages/protocol/migrations/08_stabletoken.ts index 8d45be380c9..b6d552b6fd7 100644 --- a/packages/protocol/migrations/08_stabletoken.ts +++ b/packages/protocol/migrations/08_stabletoken.ts @@ -7,6 +7,7 @@ import { getDeployedProxiedContract, } from '@celo/protocol/lib/web3-utils' import { config } from '@celo/protocol/migrationsConfig' +import { ensureHexLeader } from '@celo/utils/lib/address' import { toFixed } from '@celo/utils/lib/fixidity' import { FeeCurrencyWhitelistInstance, @@ -46,7 +47,7 @@ module.exports = deploymentForCoreContract( for (const oracle of config.stableToken.oracles) { console.info(`Adding ${oracle} as an Oracle for StableToken`) - await sortedOracles.addOracle(stableToken.address, oracle) + await sortedOracles.addOracle(stableToken.address, ensureHexLeader(oracle)) } // We need to seed the exchange rate, and that must be done with an account