From cd268bdb5d72af44077888d12ea11ffc7dcba2ec Mon Sep 17 00:00:00 2001 From: Kristen Borges Date: Mon, 6 Apr 2020 15:56:07 -0700 Subject: [PATCH] Add default eth amount to config as well Update docs, including a missing description of the optional amount param --- env-var.list | 1 + .../kube/thesis-ops/heimdall-hubot-deployment.yaml | 2 ++ scripts/eth-account.js | 8 +++++--- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/env-var.list b/env-var.list index a7f7f282..924973f1 100644 --- a/env-var.list +++ b/env-var.list @@ -11,3 +11,4 @@ ZOOM_EXPECTED_MEETING_DURATION=$ZOOM_EXPECTED_MEETING_DURATION CONTRACT_OWNER_ADDRESS=$CONTRACT_OWNER_ADDRESS CONTRACT_OWNER_ETH_ACCOUNT_PRIVATE_KEY=$CONTRACT_OWNER_ETH_ACCOUNT_PRIVATE_KEY ETH_HOST_URL=$ETH_HOST_URL +ETH_FAUCET_AMOUNT=$ETH_FAUCET_AMOUNT diff --git a/infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml b/infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml index 00d1617a..47317d6a 100644 --- a/infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml +++ b/infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml @@ -88,6 +88,8 @@ spec: key: contract-owner-eth-account-private-key - name: ETH_HOST_URL value: "https://ropsten.infura.io/v3/59fb36a36fa4474b890c13dd30038be5" + - name: ETH_FAUCET_AMOUNT + value: "5" ports: - containerPort: 8080 resources: diff --git a/scripts/eth-account.js b/scripts/eth-account.js index c9bcc4ce..d3d043a5 100644 --- a/scripts/eth-account.js +++ b/scripts/eth-account.js @@ -5,9 +5,10 @@ // CONTRACT_OWNER_ADDRESS - Address for the keep-test owner account on Ropsten. // CONTRACT_OWNER_ETH_ACCOUNT_PRIVATE_KEY - Private key for the keep-test owner account on Ropsten. This value should NEVER be committed to source control. // ETH_HOST_URL - Url for the specified network (in this case Ropsten). +// ETH_FAUCET_AMOUNT - Default amount, in ETH, to send when fund is called without optional amount // // Commands: -// hubot eth-account fund - Transfers 5 ether to the specified address. +// hubot eth-account fund - Transfers ether to the specified address (default amount, if none provided, is 5). // hubot eth-account create - Creates a new account on the Ropsten ETH testnet and returns a keyfile JSON (including private key! This is not for use in production!). This command funds the new account as well. // // Author: @@ -24,8 +25,9 @@ const ethUrl = process.env.ETH_HOST_URL // Contract owner info const contractOwnerAddress = process.env.CONTRACT_OWNER_ADDRESS +// The value for CONTRACT_OWNER_ETH_ACCOUNT_PRIVATE_KEY should NEVER be committed to source control. const contractOwnerProvider = new HDWalletProvider( - process.env.CONTRACT_OWNER_ETH_ACCOUNT_PRIVATE_KEY, // This value should NEVER be committed to source control. + process.env.CONTRACT_OWNER_ETH_ACCOUNT_PRIVATE_KEY, ethUrl, ) const authorizer = contractOwnerAddress @@ -45,7 +47,7 @@ const web3_options = { // address is required. const web3 = new Web3(contractOwnerProvider, null, web3_options) -const etherToTransfer = "5" +const etherToTransfer = process.env.ETH_FAUCET_AMOUNT const { TextMessage } = require("hubot")