Update docs

This commit is contained in:
github-actions
2022-04-26 16:51:43 +00:00
parent d75a9e5480
commit 84526a0944
151 changed files with 17094 additions and 11955 deletions

View File

@ -0,0 +1,24 @@
const { config } = require('hardhat');
const optimizationsEnabled = config.solidity.compilers.some(c => c.settings.optimizer.enabled);
/** Revert handler that supports custom errors. */
async function expectRevertCustomError (promise, reason) {
try {
await promise;
expect.fail('Expected promise to throw but it didn\'t');
} catch (revert) {
if (reason) {
if (optimizationsEnabled) {
// Optimizations currently mess with Hardhat's decoding of custom errors
expect(revert.message).to.include.oneOf([reason, 'unrecognized return data or custom error']);
} else {
expect(revert.message).to.include(reason);
}
}
}
};
module.exports = {
expectRevertCustomError,
};