Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to hardhat #612

Merged
merged 5 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.github/
.python-version
/node_modules/
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: run unit test using postgres
run: docker-compose run ibet-prime-postgres
run: docker compose run ibet-prime-postgres
migration-test-postgres:
name: 'Migration tests (PostgreSQL)'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: run unit test using postgres
run: docker-compose run ibet-prime-postgres bash --login -c "cd /app/ibet-Prime && pytest -vv --test-alembic -m 'alembic'"
run: docker compose run ibet-prime-postgres bash --login -c "cd /app/ibet-Prime && pytest -vv --test-alembic -m 'alembic'"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ __pycache__/
# pyenv
.python-version

# Node
node_modules/

# Intellij
.idea
/*.iml
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ English | [日本語](./README_JA.md)
- [PostgreSQL](https://www.postgresql.org/) - version 15
- [GoQuorum](https://github.com/ConsenSys/quorum)
- We support the official GoQuorum node of [ibet-Network](https://github.com/BoostryJP/ibet-Network).
- We use [ganache](https://github.com/trufflesuite/ganache) for local development and unit testing, and we use the latest version.
- We use [hardhat network](https://hardhat.org/hardhat-network/) for local development and unit testing, and we use the latest version.


## Supported ibet smart contract version
Expand Down Expand Up @@ -60,6 +60,11 @@ $ poetry install --no-root --only main -E ibet-explorer
$ poetry run pre-commit install
```

### Install hardhat
```bash
$ npm install
```

### Setting environment variables

The main environment variables are as follows.
Expand Down
7 changes: 6 additions & 1 deletion README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
- [PostgreSQL](https://www.postgresql.org/) - バージョン 15
- [GoQuorum](https://github.com/ConsenSys/quorum)
- [ibet-Network](https://github.com/BoostryJP/ibet-Network) の公式の GoQuorum をサポートしています。
- 最新の [ganache](https://github.com/trufflesuite/ganache) (ganache-cli) をローカル開発およびユニットテストで利用しています。
- 最新の [hardhat network](https://hardhat.org/hardhat-network/) をローカル開発およびユニットテストで利用しています。

## コントラクトのバージョン

Expand Down Expand Up @@ -61,6 +61,11 @@ $ poetry install --no-root --only main -E ibet-explorer
$ poetry run pre-commit install
```

### hardhatのインストール
```bash
$ npm install
```

### 環境変数の設定

主要な環境変数は以下の通りです。
Expand Down
19 changes: 7 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,23 @@ services:
- POSTGRES_USER=apluser
- POSTGRES_PASSWORD=apluserpass
- POSTGRES_DB=apldb
ganache:
image: "trufflesuite/ganache:latest"
hardhat-network:
build:
context: ./
dockerfile: tests/Dockerfile_hardhat
ports:
- "8545:8545"
command:
- -k
- 'berlin'
- -g
- '0'
- --chain.chainId
- '2017'
ibet-prime-postgres:
build:
context: ./
dockerfile: ./tests/Dockerfile
dockerfile: ./tests/Dockerfile_unittest
environment:
- TEST_DATABASE_URL=postgresql+psycopg://apluser:apluserpass@postgres/apldb
- WEB3_HTTP_PROVIDER=http://quorum:8545
- RESPONSE_VALIDATION_MODE=1
links:
- postgres:postgres
- ganache:quorum
- hardhat-network:quorum
depends_on:
- postgres
- ganache
- hardhat-network
16 changes: 16 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
networks: {
hardhat: {
chainId: 2017,
gasPrice: 0,
initialBaseFeePerGas: 0,
blockGasLimit: 800000000,
hardfork: "merge", // We should use "berlin", but because of the https://github.com/NomicFoundation/hardhat/issues/5052 issue we are using "merge".
throwOnTransactionFailures: false,
throwOnCallFailures: false,
allowBlocksWithSameTimestamp: true
},
},
solidity: "0.8.23",
};
Loading
Loading