Transpile 7bce2b72
This commit is contained in:
20
hardhat/env-artifacts.js
Normal file
20
hardhat/env-artifacts.js
Normal file
@ -0,0 +1,20 @@
|
||||
const { HardhatError } = require('hardhat/internal/core/errors');
|
||||
|
||||
extendEnvironment(env => {
|
||||
const artifactsRequire = env.artifacts.require;
|
||||
|
||||
env.artifacts.require = (name) => {
|
||||
for (const suffix of ['UpgradeableWithInit', 'Upgradeable', '']) {
|
||||
try {
|
||||
return artifactsRequire(name + suffix);
|
||||
} catch (e) {
|
||||
if (HardhatError.isHardhatError(e) && e.number === 700 && suffix !== '') {
|
||||
continue;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Error('Unreachable');
|
||||
};
|
||||
});
|
||||
10
hardhat/env-contract.js
Normal file
10
hardhat/env-contract.js
Normal file
@ -0,0 +1,10 @@
|
||||
extendEnvironment(env => {
|
||||
const { contract } = env;
|
||||
|
||||
env.contract = function (name, body) {
|
||||
// remove the default account from the accounts list used in tests, in order
|
||||
// to protect tests against accidentally passing due to the contract
|
||||
// deployer being used subsequently as function caller
|
||||
contract(name, accounts => body(accounts.slice(1)));
|
||||
};
|
||||
});
|
||||
10
hardhat/task-get-compiler-input.js
Normal file
10
hardhat/task-get-compiler-input.js
Normal file
@ -0,0 +1,10 @@
|
||||
// adds storageLayout to solc outputSelection, necessary for storage gaps
|
||||
|
||||
const { internalTask } = require('hardhat/config');
|
||||
const { TASK_COMPILE_SOLIDITY_GET_COMPILER_INPUT } = require('hardhat/builtin-tasks/task-names');
|
||||
|
||||
internalTask(TASK_COMPILE_SOLIDITY_GET_COMPILER_INPUT, async (args, bre, runSuper) => {
|
||||
const input = await runSuper();
|
||||
input.settings.outputSelection['*']['*'].push('storageLayout');
|
||||
return input;
|
||||
});
|
||||
19
hardhat/task-test-get-files.js
Normal file
19
hardhat/task-test-get-files.js
Normal file
@ -0,0 +1,19 @@
|
||||
// ignores the proxy tests
|
||||
|
||||
const { internalTask } = require('hardhat/config');
|
||||
|
||||
const { TASK_TEST_GET_TEST_FILES } = require('hardhat/builtin-tasks/task-names');
|
||||
const glob = require('glob');
|
||||
const path = require('path');
|
||||
const { promisify } = require('util');
|
||||
|
||||
internalTask(TASK_TEST_GET_TEST_FILES)
|
||||
.setAction(async ({ testFiles }, { config }) => {
|
||||
if (testFiles.length !== 0) {
|
||||
return testFiles;
|
||||
}
|
||||
return await promisify(glob)(
|
||||
path.join(config.paths.tests, '**/*.js'),
|
||||
{ ignore: [path.join(config.paths.tests, 'proxy/**/*')] },
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user