Skip to content

Commit

Permalink
add docker-compose and upgrade hardhat upgrades to make it work with …
Browse files Browse the repository at this point in the history
…local anvil chains
  • Loading branch information
gravityblast committed Feb 10, 2024
1 parent d78364e commit eff30a7
Show file tree
Hide file tree
Showing 22 changed files with 963 additions and 240 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ node_modules
coverage
coverage.json
typechain
typechain-types
/.eslintcache
.turbo

Expand Down
13 changes: 1 addition & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
FROM node:20-slim as base
RUN apt-get update && \
apt-get install -y python3 curl git build-essential psmisc && \
apt-get install -y python3 build-essential && \
apt-get clean

COPY . /app
WORKDIR /app


# Check when foundry supports dumping events
# https://github.com/foundry-rs/foundry/issues/5906
RUN curl -L https://foundry.paradigm.xyz | bash

# install a previous versions that doesn't have the rpc method hardhat_metadata.
# hardhat expects an integer but the output from anvil is an hex string
RUN ~/.foundry/bin/foundryup -v nightly-34f684ddfacc5b2ed371353ba6f730c485616ffe

ENV PATH="$PNPM_HOME:$PATH"

RUN corepack enable
Expand All @@ -30,9 +21,7 @@ COPY . /app
WORKDIR /app

COPY --from=base /app/node_modules /app/node_modules
COPY --from=base /root/.foundry/bin/anvil /root/.foundry/bin/anvil

ENV DEV_CHAIN_ID=313371
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
Expand Down
24 changes: 0 additions & 24 deletions Makefile

This file was deleted.

21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
local-chain:
image: ghcr.io/foundry-rs/foundry:nightly-b174c3a4f80938636f18b3c9e49d45e6643f64a9
ports:
- "127.0.0.1:8545:8545"
entrypoint: ["anvil", "--host", "0.0.0.0", "--chain-id", "313371"]

allo-v1-setup:
image: allo-v1-setup
build:
context: .
dockerfile: ./Dockerfile
depends_on:
- local-chain
environment:
# account at index 0 of the test mnemonic
- DEPLOYER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
- DEV_CHAIN_HOST=local-chain
- DEV_CHAIN_ID=313371
restart: "no"
entrypoint: [ "bash", "-c", "sleep 2 && corepack enable && exec ./docker/deploy-contracts.sh"]
4 changes: 3 additions & 1 deletion docker/deploy-contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ time pnpm run set-protocol-fee dev && \
time pnpm run deploy-round-factory dev && \
time pnpm run deploy-round-implementation dev && \
time pnpm run link-round-implementation dev && \
time pnpm run link-allo-settings dev
time pnpm run link-allo-settings dev && \

echo "🟢 Allo V1 deployed and populated"

# pnpm run create-program dev
# pnpm run create-qf-contract dev
Expand Down
1 change: 0 additions & 1 deletion docker/start-chain.sh

This file was deleted.

5 changes: 4 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,10 @@ const config: HardhatUserConfig = {
// with hardcoded deterministic addresses for deployed contracts
dev: createTestnetConfig(
"dev",
`http://${process.env.DEV_CHAIN_HOST ?? "127.0.0.1"}:8545`,
`http://${process.env.DEV_CHAIN_HOST ?? "127.0.0.1"}:${getEnvVarNumber(
"DEV_CHAIN_PORT",
8545
)}`,
"test test test test test test test test test test test junk"
),
hardhat: {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@nomiclabs/hardhat-solhint": "^2.0.1",
"@nomiclabs/hardhat-waffle": "^2.0.5",
"@openzeppelin/hardhat-upgrades": "^1.22.1",
"@openzeppelin/hardhat-upgrades": "^2.5.0",
"@primitivefi/hardhat-dodoc": "^0.2.3",
"@typechain/ethers-v5": "^7.2.0",
"@typechain/hardhat": "^2.3.1",
"@typechain/hardhat": "^9.1.0",
"@types/chai": "^4.3.4",
"@types/mocha": "^9.1.1",
"@types/node": "^12.20.55",
Expand All @@ -98,8 +98,8 @@
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-promise": "^5.2.0",
"ethereum-waffle": "^3.4.4",
"ethers": "^5.7.2",
"hardhat": "^2.17.2",
"ethers": "^6.7.1",
"hardhat": "^2.17.4",
"hardhat-abi-exporter": "^2.10.1",
"hardhat-gas-reporter": "^1.0.9",
"husky": "^8.0.3",
Expand All @@ -110,7 +110,7 @@
"solhint": "^3.4.1",
"solidity-coverage": "^0.7.22",
"ts-node": "^10.9.1",
"typechain": "^5.2.0",
"typechain": "^8.3.1",
"typescript": "^4.9.5"
},
"dependencies": {
Expand Down
Loading

0 comments on commit eff30a7

Please sign in to comment.