Skip to content

Commit d46a1a3

Browse files
authored
Merge pull request #6 from primitivefinance/env/foundry
Env/foundry
2 parents ff3c1f3 + 9bdc297 commit d46a1a3

19 files changed

+173
-31
lines changed

.gitignore

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1-
artifacts
2-
cache
3-
node_modules
4-
typechain-types
51
docs
2+
node_modules
63
.env
4+
coverage
5+
coverage.json
6+
typechain-types
7+
yarn-error.log
8+
9+
#Hardhat files
10+
artifacts/
11+
hh-cache/
12+
13+
14+
# Foundry
15+
cache
16+
out
17+
optimized-out
18+
19+
.DS_Store
20+
21+
# VScode
722
.vscode
23+
24+
# Differential testing
25+
test/differential/data
26+
test/differential/scripts/node_modules

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/solstat"]
5+
path = lib/solstat
6+
url = https://github.com/primitivefinance/solstat
7+
[submodule "lib/ds-test"]
8+
path = lib/ds-test
9+
url = https://github.com/dapphub/ds-test

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16.11.0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

foundry.toml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[default]
2+
via_ir = true
3+
src = 'contracts'
4+
out = 'out'
5+
libs = ['lib', 'node_modules']
6+
test = 'test/foundry'
7+
remappings = [
8+
'ds-test=lib/ds-test/src/',
9+
'forge-std=lib/forge-std/src/',
10+
'contracts/=contracts/',
11+
]
12+
optimizer_runs = 15000
13+
fuzz_runs = 256
14+
fuzz_max_local_rejects = 65536
15+
fuzz_max_global_rejects = 1024
16+
17+
[optimized]
18+
solc = '0.8.10'
19+
out = 'optimized-out'
20+
21+
[test]
22+
solc = '0.8.10'
23+
via_ir = false
24+
src = 'test/foundry'
25+
gas_reports = ["*"]
26+
ffi = true
27+
fuzz_runs = 500
28+
29+
[lite]
30+
out = 'optimized-out'
31+
via_ir = false
32+
fuzz_runs = 1000
33+
34+
35+
36+
# See more config options https://github.com/gakonst/foundry/tree/master/config

hardhat-coverage.config.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import * as dotenv from 'dotenv'
2+
3+
import { HardhatUserConfig } from 'hardhat/config'
4+
import '@nomiclabs/hardhat-waffle'
5+
import '@typechain/hardhat'
6+
import 'hardhat-gas-reporter'
7+
import 'solidity-coverage'
8+
9+
dotenv.config()
10+
11+
// You need to export an object to set up your config
12+
// Go to https://hardhat.org/config/ to learn more
13+
14+
const config: HardhatUserConfig = {
15+
solidity: {
16+
compilers: [
17+
{
18+
version: '0.8.10',
19+
settings: {
20+
viaIR: false,
21+
optimizer: {
22+
enabled: false,
23+
},
24+
},
25+
},
26+
],
27+
},
28+
networks: {
29+
hardhat: {
30+
blockGasLimit: 30_000_000,
31+
},
32+
},
33+
gasReporter: {
34+
enabled: process.env.REPORT_GAS !== undefined,
35+
currency: 'USD',
36+
},
37+
}
38+
39+
export default config

hardhat.config.ts

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1+
import * as dotenv from 'dotenv'
2+
13
import { HardhatUserConfig } from 'hardhat/types'
24
import '@typechain/hardhat'
35
import '@nomiclabs/hardhat-ethers'
46
import '@nomiclabs/hardhat-waffle'
57
import '@primitivefi/hardhat-dodoc'
6-
import 'hardhat-tracer'
78
import 'hardhat-gas-reporter'
89

10+
dotenv.config()
11+
912
const config: HardhatUserConfig = {
13+
solidity: {
14+
compilers: [
15+
{
16+
version: '0.8.10',
17+
settings: {
18+
viaIR: false,
19+
optimizer: {
20+
enabled: true,
21+
runs: 15000,
22+
},
23+
},
24+
},
25+
],
26+
},
1027
networks: {
1128
hardhat: {
1229
allowUnlimitedContractSize: true,
13-
},
14-
},
15-
solidity: {
16-
version: '0.8.10',
17-
settings: {
18-
optimizer: {
19-
enabled: true,
20-
runs: 100,
21-
},
30+
blockGasLimit: 30_000_000,
2231
},
2332
},
2433
gasReporter: {
34+
enabled: process.env.REPORT_GAS !== undefined,
2535
currency: 'USD',
26-
gasPrice: 50,
27-
enabled: true,
2836
},
37+
// Avoid foundry cache conflict.
38+
paths: { cache: 'hh-cache' },
2939
}
3040

3141
export default config

0 commit comments

Comments
 (0)