Skip to content

Commit

Permalink
feat: hardhat plugin for compiler settings
Browse files Browse the repository at this point in the history
  • Loading branch information
chancehudson committed Mar 31, 2023
1 parent e0079dc commit 50b3bdd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/pre.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ await fs.mkdir(buildDir)
await fs.writeFile(path.join(buildDir, 'package.json'), JSON.stringify(finalPackage))

await fs.cp(path.join(__dirname, '../contracts'), buildDir, { recursive: true })
await fs.cp(path.join(__dirname, '../src/hardhat.js'), path.join(buildDir, 'hardhat.js'), { recursive: false })
await fs.rm(path.join(buildDir, 'Test.sol'))

await fs.cp(path.join(__dirname, '../README.md'), path.join(buildDir, 'README.md'))
24 changes: 24 additions & 0 deletions src/hardhat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { extendConfig } = require('hardhat/config')

extendConfig((config, userConfig) => {
if (typeof config.solidity === 'string') {
const version = config.solidity
config.solidity = {
compilers: [
{ version },
]
}
}
if (typeof config.solidity.overrides !== 'object') {
config.solidity.overrides = {}
}
config.solidity.overrides['poseidon-solidity/*'] = {
version: '0.7.6',
settings: {
optimizer: {
enabled: true,
runs: 2**32 - 1
}
}
}
})

0 comments on commit 50b3bdd

Please sign in to comment.