Skip to content
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
2 changes: 2 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[profile.default]
solc_version = '0.8.24'
evm_version = 'cancun'
optimizer = true
optimizer-runs = 200
src = 'contracts'
out = 'out'
libs = ['node_modules', 'lib']
Expand Down
40 changes: 19 additions & 21 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// ENVVAR
// - COMPILE_VERSION: compiler version (default: 0.8.20)
// - SRC: contracts folder to compile (default: contracts)
// - COMPILE_MODE: production modes enables optimizations (default: development)
// - IR: enable IR compilation (default: false)
// - COVERAGE: enable coverage report
// - ENABLE_GAS_REPORT: enable gas report
// - COINMARKETCAP: coinmarkercat api key for USD value in gas report
// - CI: output gas report to file instead of stdout
// - COMPILER: compiler version (default: 0.8.24)
// - SRC: contracts folder to compile (default: contracts)
// - RUNS: number of optimization runs (default: 200)
// - IR: enable IR compilation (default: false)
// - COVERAGE: enable coverage report (default: false)
// - GAS: enable gas report (default: false)
// - COINMARKETCAP: coinmarketcap api key for USD value in gas report
// - CI: output gas report to file instead of stdout

const fs = require('fs');
const path = require('path');
Expand All @@ -25,11 +25,10 @@ const { argv } = require('yargs/yargs')()
type: 'string',
default: 'contracts',
},
mode: {
alias: 'compileMode',
type: 'string',
choices: ['production', 'development'],
default: 'development',
runs: {
alias: 'optimizationRuns',
type: 'number',
default: 200,
},
ir: {
alias: 'enableIR',
Expand Down Expand Up @@ -69,9 +68,6 @@ for (const f of fs.readdirSync(path.join(__dirname, 'hardhat'))) {
require(path.join(__dirname, 'hardhat', f));
}

const withOptimizations = argv.gas || argv.coverage || argv.compileMode === 'production';
const allowUnlimitedContractSize = argv.gas || argv.coverage || argv.compileMode === 'development';

/**
* @type import('hardhat/config').HardhatUserConfig
*/
Expand All @@ -80,11 +76,11 @@ module.exports = {
version: argv.compiler,
settings: {
optimizer: {
enabled: withOptimizations,
runs: 200,
enabled: true,
runs: argv.runs,
},
evmVersion: argv.evm,
viaIR: withOptimizations && argv.ir,
viaIR: argv.ir,
outputSelection: { '*': { '*': ['storageLayout'] } },
},
},
Expand All @@ -94,7 +90,7 @@ module.exports = {
'initcode-size': 'off',
},
'*': {
'code-size': withOptimizations,
'code-size': true,
'unused-param': !argv.coverage, // coverage causes unused-param warnings
'transient-storage': false,
default: 'error',
Expand All @@ -103,7 +99,9 @@ module.exports = {
networks: {
hardhat: {
hardfork: argv.evm,
allowUnlimitedContractSize,
// Exposed contracts often exceed the maximum contract size. For normal contract,
// we rely on the `code-size` compiler warning, that will cause a compilation error.
allowUnlimitedContractSize: true,
initialBaseFeePerGas: argv.coverage ? 0 : undefined,
},
},
Expand Down