Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Migration from Truffle to Hardhat/Foundry #501

Merged
merged 9 commits into from
Feb 5, 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
3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

14 changes: 0 additions & 14 deletions .editorconfig

This file was deleted.

4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
INFURA_TOKEN="909b972ab2ff3afb8b0f8f6a9667test"
BOR_CHAIN_URL="http://localhost:9545"
ENV="local"
MNEMONIC_DEV="poly radar mass judge dismiss just intact mind resemble fringe diary casino"
17 changes: 0 additions & 17 deletions .eslintrc.js

This file was deleted.

61 changes: 41 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,51 @@ name: CI

on:
push:
branches:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2-beta
with:
node-version: '10.x'
registry-url: 'https://registry.npmjs.org'
- name: Cache npm dependencies
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-
- name: Install npm dependencies
run: npm install
- name: Process templates
run: npm run template:process
- name: Run tests
run: npm run test:ci
- uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"

- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-

- name: Install npm dependencies
run: npm install

- name: Process templates
run: npm run template:process

- name: Run Coverage and Hardhat tests
run: npm run test:ci

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Run Forge build
run: |
forge --version
forge build --sizes
id: build

- name: Run Forge tests
run: |
forge test -vvv
id: test
15 changes: 9 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
node_modules
build
artifacts
out
contractAddresses.json
.vscode


# ignore generated files
contracts/root/predicates/TransferWithSigUtils.sol
contracts/common/mixin/ChainIdMixin.sol
test-blockchain/genesis.json
test-blockchain/start.sh
test/helpers/marketplaceUtils.js
cache_hardhat
forge-cache


test-blockchain/geth
test-blockchain/history
test-blockchain/data
test-bor-docker/history
test-bor-docker/data

*.pid
*.log
Expand Down
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "lib/solady"]
path = lib/solady
url = https://github.com/vectorized/solady
[submodule "lib/deployment-log-generator"]
path = lib/deployment-log-generator
url = https://github.com/0xPolygon/deployment-log-generator
[submodule "lib/contract-deployer-template"]
path = lib/contract-deployer-template
url = https://github.com/0xPolygon/contract-deployer-template
[submodule "lib/storage-layout-checker"]
path = lib/storage-layout-checker
url = https://github.com/0xPolygon/storage-layout-checker
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11.1.0
20.6.0
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: mixed-line-ending
args: ["--fix=lf"]
description: Forces to replace line ending by the UNIX 'lf' character.
exclude: "^docs/autogen"
- repo: local
hooks:
- id: format
name: Format solidity code
description: Format solidity code with `forge fmt`
language: system
entry: forge fmt
exclude: "^lib/"
pass_filenames: true
- id: doc
name: Generate documentation
description: Generate docs with `forge doc`
language: system
# generates docs and unstages files if only the commit hash changed within the file, this way only when the documentation is updated, the documentation needs to be regenerated and only the changed files are pushed
entry: "scripts/util/doc_gen.sh"
pass_filenames: false
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: prettier
name: Format non solidity files with prettier
exclude: "^docs/autogen"
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
"bracketSpacing": false,
"explicitTypes": "always"
}
},
{
"files": "*.js",
"options": {
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"printWidth": 120,
"trailingComma": "none"
}
}
]
}
7 changes: 7 additions & 0 deletions .solcover.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
mocha: {
grep: "@skip-on-coverage", // Find everything with this tag
invert: true, // Run the grep's inverse set.
},
compileCommand: "npx hardhat compile",
};
14 changes: 0 additions & 14 deletions .solcover.js

This file was deleted.

Loading