Skip to content

Commit

Permalink
Merge pull request #5 from morpho-labs/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD authored Jul 11, 2023
2 parents dde4b1b + d998d91 commit 7efb26f
Show file tree
Hide file tree
Showing 26 changed files with 7,467 additions and 22 deletions.
27 changes: 8 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
name: test
name: Foundry CI

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

env:
FOUNDRY_PROFILE: ci

jobs:
check:
test:
strategy:
fail-fast: true

name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -24,16 +18,11 @@ jobs:

- 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
run: forge test -vvv
env:
FOUNDRY_FUZZ_RUNS: 100000
FOUNDRY_FUZZ_MAX_TEST_REJECTS: 500000
FOUNDRY_INVARIANT_RUNS: 1000
FOUNDRY_INVARIANT_DEPTH: 100
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ docs/

# Dotenv file
.env

# Node modules
/node_modules

# Hardhat
/types
/cache_hardhat
/artifacts
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn commitlint --edit "${1}"
5 changes: 5 additions & 0 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

forge install
yarn
5 changes: 5 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

forge install
yarn
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 120
}
3 changes: 0 additions & 3 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
via-ir = true

# See more config options https://github.com/foundry-rs/foundry/tree/master/config
55 changes: 55 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import "@nomicfoundation/hardhat-chai-matchers";
import "@nomicfoundation/hardhat-foundry";
import "@nomicfoundation/hardhat-network-helpers";
import "@nomiclabs/hardhat-ethers";
import "@typechain/hardhat";
import * as dotenv from "dotenv";
import "ethers-maths";
import "hardhat-deal";
import "hardhat-gas-reporter";
import "hardhat-tracer";
import { HardhatUserConfig } from "hardhat/config";
import "solidity-coverage";

dotenv.config();

const config: HardhatUserConfig = {
defaultNetwork: "hardhat",
networks: {
hardhat: {
chainId: 1,
gasPrice: 0,
initialBaseFeePerGas: 0,
accounts: {
count: 102,
},
},
},
solidity: {
compilers: [
{
version: "0.8.20",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
viaIR: true,
},
},
],
},
mocha: {
timeout: 3000000,
},
typechain: {
outDir: "types/",
externalArtifacts: ["deps/**/*.json"],
},
tracer: {
defaultVerbosity: 1,
gasCost: true,
},
};

export default config;
1 change: 1 addition & 0 deletions lib/solmate
Submodule solmate added at bfc9c2
56 changes: 56 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"scripts": {
"postinstall": "husky install",
"compile": "npx hardhat compile --force",
"test": "npx hardhat test"
},
"dependencies": {
"@ethersproject/abi": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"ethers": "^5.7.2",
"ethers-maths": "^3.5.1",
"lodash": "^4.17.21",
"openzeppelin-contracts": "^4.0.0"
},
"devDependencies": {
"@commitlint/cli": "^17.6.6",
"@commitlint/config-conventional": "^17.6.6",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-foundry": "^1.0.1",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomiclabs/hardhat-ethers": "^2.2.3",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@typechain/ethers-v5": "^10.2.1",
"@typechain/hardhat": "^6.1.6",
"@types/chai": "^4.3.5",
"@types/lodash": "^4.14.195",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.5",
"chai": "^4.3.7",
"dotenv": "^16.1.3",
"hardhat": "2.15",
"hardhat-deal": "^1.3.0",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-tracer": "2.3.2",
"husky": "8.0.3",
"lint-staged": "13.2.2",
"prettier": "^2.8.8",
"solidity-coverage": "^0.8.2",
"ts-node": "^10.9.1",
"typechain": "^8.2.0",
"typescript": "5.0.4"
},
"lint-staged": {
"*.sol": "forge fmt",
"*.js": "yarn prettier",
"*.ts": "yarn prettier",
"*.json": "yarn prettier",
"*.yml": "yarn prettier"
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
}
3 changes: 3 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
solmate/=lib/solmate/src/
Loading

0 comments on commit 7efb26f

Please sign in to comment.