Skip to content

Commit

Permalink
Add default eth amount to config as well
Browse files Browse the repository at this point in the history
Update docs, including a missing description of the optional amount
param
  • Loading branch information
kb0rg committed Apr 6, 2020
1 parent 50d3406 commit cd268bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions env-var.list
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions infrastructure/kube/thesis-ops/heimdall-hubot-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions scripts/eth-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ETH account address> - Transfers 5 ether to the specified address.
// hubot eth-account fund <ETH account address> <optional: requested amount in ETH>- Transfers ether to the specified address (default amount, if none provided, is 5).
// hubot eth-account create <your-secret-passphrase> - 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:
Expand All @@ -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
Expand All @@ -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")

Expand Down

0 comments on commit cd268bd

Please sign in to comment.