Skip to content
Closed
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
39 changes: 18 additions & 21 deletions packages/hardhat-ovm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,26 @@ const getOvmSolcPath = async (version: string): Promise<string> => {
// Hardhat on M1 Macbooks does not run TASK_COMPILE_SOLIDITY_RUN_SOLC, but instead this runs one,
// TASK_COMPILE_SOLIDITY_RUN_SOLCJS. We reroute this task back to the solc task in the case
// of OVM compilation.
subtask(
TASK_COMPILE_SOLIDITY_RUN_SOLCJS,
async (args, hre, runSuper) => {
const argsAny = args as any
if (argsAny.real || hre.network.ovm !== true) {
for (const file of Object.keys(argsAny.input.sources)) {
// Ignore any contract that has this tag or in ignore list
if (
argsAny.input.sources[file].content.includes('// @unsupported: evm')
&& hre.network.ovm !== true
) {
delete argsAny.input.sources[file]
}
subtask(TASK_COMPILE_SOLIDITY_RUN_SOLCJS, async (args, hre, runSuper) => {
const argsAny = args as any
if (argsAny.real || hre.network.ovm !== true) {
for (const file of Object.keys(argsAny.input.sources)) {
// Ignore any contract that has this tag or in ignore list
if (
argsAny.input.sources[file].content.includes('// @unsupported: evm') &&
hre.network.ovm !== true
) {
delete argsAny.input.sources[file]
}
return runSuper(args)
} else {
return hre.run(TASK_COMPILE_SOLIDITY_RUN_SOLC, {
...argsAny,
solcPath: argsAny.solcJsPath
})
}
return runSuper(args)
} else {
return hre.run(TASK_COMPILE_SOLIDITY_RUN_SOLC, {
...argsAny,
solcPath: argsAny.solcJsPath,
})
}
)
})

subtask(
TASK_COMPILE_SOLIDITY_RUN_SOLC,
Expand Down Expand Up @@ -195,7 +192,7 @@ subtask(
const ovmOutput = await hre.run(TASK_COMPILE_SOLIDITY_RUN_SOLCJS, {
input: ovmInput,
solcJsPath: ovmSolcPath,
real: true
real: true,
})

// Just doing this to add some extra useful information to any errors in the OVM compiler output.
Expand Down