Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
})
}
})
subtask(
TASK_COMPILE_SOLIDITY_RUN_SOLC,
async (args: { input: any; solcPath: string }, hre, runSuper) => {
const ignoreRxList = hre.network.config.ignoreRxList || []
const ignore = (filename: string) =>
ignoreRxList.reduce(
(ignored: boolean, rx: string | RegExp) =>
ignored || new RegExp(rx).test(filename),
false
)
if (hre.network.ovm !== true) {
// Separate the EVM and OVM inputs.
for (const file of Object.keys(args.input.sources)) {
// Ignore any contract that has this tag or in ignore list
if (
args.input.sources[file].content.includes('// @unsupported: evm') ||
ignore(file)
// Otherwise, write the content to the cache. We probably want to do some sort of hash
// verification against these files but it's OK for now. The real "TODO" here is to instead
// figure out how to properly extend and/or hack Hardat's CompilerDownloader class.
const compilerContent = await compilerContentResponse.text()
fs.writeFileSync(cachedCompilerPath, compilerContent)
fs.writeFileSync(cachedCompilerVersionPath, remoteCompilerVersion)
return cachedCompilerPath
}
// TODO: implement a more elegant fix for this.
// 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]
}
}
return runSuper(args)
} else {
return hre.run(TASK_COMPILE_SOLIDITY_RUN_SOLC, {
...argsAny,
solcPath: argsAny.solcJsPath,