Skip to content

Commit

Permalink
build: Add contracts compile and deploy job (#114)
Browse files Browse the repository at this point in the history
* refactor: Reduce use of private keys to admin key only

* refactor: Pull network URL from environment variable

* build: Add contracts compile and deploy
  • Loading branch information
bgins authored May 23, 2024
1 parent afbf4f8 commit dcd25f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/devnet_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,25 @@ on:

jobs:
contracts:
runs-on: "ubuntu-latest"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
context: app

- name: Compile and deploy contracts
id: compile-and-deploy-contracts
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v1

# TODO Avoid re-deploying contracts that are already on chain
- name: Deploy contracts
id: deploy-contracts
env:
WEB3_RPC_URL: ${{ secrets.WEB3_RPC_URL }}
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN_CONTRACTS_DEPLOY_DEVNET }}
run: |
echo "# TODO"
cd hardhat
npm ci
doppler run -- npx hardhat deploy --network geth
solver-build-deploy:
runs-on: ubuntu-latest
Expand Down
11 changes: 6 additions & 5 deletions hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import * as dotenv from 'dotenv'

import {
ACCOUNT_ADDRESSES,
PRIVATE_KEYS,
getAccount,
} from './utils/accounts'

const ENV_FILE = process.env.DOTENV_CONFIG_PATH || '../.env'
dotenv.config({ path: ENV_FILE })

const NETWORK = process.env.NETWORK || "geth";
const NETWORK_URL = process.env.WEB3_HTTP_URL || 'http://localhost:8545';

const INFURA_KEY = process.env.INFURA_KEY || "";

Expand All @@ -25,18 +26,18 @@ const config: HardhatUserConfig = {
networks: {
hardhat: {},
geth: {
url: 'http://localhost:8545',
url: NETWORK_URL,
chainId: 1337,
accounts: PRIVATE_KEYS,
accounts: [getAccount('admin').privateKey]
},
sepolia: {
url: `https://sepolia.infura.io/v3/${INFURA_KEY}`,
accounts: PRIVATE_KEYS,
accounts: [getAccount('admin').privateKey],
},
},
etherscan: {
apiKey: process.env.ETHERSCAN_API_KEY,
},
};

module.exports = config
module.exports = config

0 comments on commit dcd25f3

Please sign in to comment.