Skip to content

Commit

Permalink
Remove negated conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
DimaStebaev committed Sep 18, 2023
1 parent edb7f37 commit 23f7484
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
1 change: 0 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module.exports = {
"never"
],

"no-negated-condition": "warn",
"no-shadow": "warn",
"no-ternary": "warn",
"no-undefined": "warn",
Expand Down
6 changes: 3 additions & 3 deletions src/contractFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ const getLibrariesToUpgrade = async (
if (manifest.libraries[libraryName] === undefined) {

Check warning on line 122 in src/contractFactory.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Unexpected use of undefined

Check warning on line 122 in src/contractFactory.ts

View workflow job for this annotation

GitHub Actions / test (16.x)

Unexpected use of undefined

Check warning on line 122 in src/contractFactory.ts

View workflow job for this annotation

GitHub Actions / test (16.x)

Unexpected use of undefined

Check warning on line 122 in src/contractFactory.ts

View workflow job for this annotation

GitHub Actions / test (20.x)

Unexpected use of undefined

Check warning on line 122 in src/contractFactory.ts

View workflow job for this annotation

GitHub Actions / test (18.x)

Unexpected use of undefined

Check warning on line 122 in src/contractFactory.ts

View workflow job for this annotation

GitHub Actions / test (20.x)

Unexpected use of undefined
librariesToUpgrade.push(libraryName);
} else if (
hashBytecode(byteCodes.get(libraryName) as string) !==
hashBytecode(byteCodes.get(libraryName) as string) ===
manifest.libraries[libraryName].bytecodeHash
) {
librariesToUpgrade.push(libraryName);
} else {
oldLibraries[libraryName] =
manifest.libraries[libraryName].address;
} else {
librariesToUpgrade.push(libraryName);
}
}
return {
Expand Down
39 changes: 18 additions & 21 deletions src/submitters/auto-submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,34 +127,31 @@ export class AutoSubmitter extends Submitter {

private static _getSchainHash () {
// Query Context to get schain hash
if (!process.env.SCHAIN_HASH) {
if (!process.env.SCHAIN_NAME) {
console.log(chalk.red("Set schain name" +
" to SCHAIN_NAME environment variable"));
console.log(chalk.red("or schain hash" +
" to SCHAIN_HASH environment variable"));
throw Error("Schain is not set");
} else {
return ethers.utils.solidityKeccak256(
["string"],
[process.env.SCHAIN_NAME]
);
}
} else {
if (process.env.SCHAIN_HASH) {
return process.env.SCHAIN_HASH;
}
if (process.env.SCHAIN_NAME) {
return ethers.utils.solidityKeccak256(
["string"],
[process.env.SCHAIN_NAME]
);
}
console.log(chalk.red("Set schain name" +
" to SCHAIN_NAME environment variable"));
console.log(chalk.red("or schain hash" +
" to SCHAIN_HASH environment variable"));
throw Error("Schain is not set");
}

private static _getMainnetChainId () {
if (!process.env.MAINNET_CHAIN_ID) {
console.log(chalk.red("Set chainId of mainnet" +
" to MAINNET_CHAIN_ID environment variable"));
console.log(chalk.red("Use 1 for Ethereum mainnet" +
" or 5 for Goerli"));
throw Error("Mainnet chainId is not set");
} else {
if (process.env.MAINNET_CHAIN_ID) {
return Number.parseInt(process.env.MAINNET_CHAIN_ID);
}
console.log(chalk.red("Set chainId of mainnet" +
" to MAINNET_CHAIN_ID environment variable"));
console.log(chalk.red("Use 1 for Ethereum mainnet" +
" or 5 for Goerli"));
throw Error("Mainnet chainId is not set");
}

private static async _versionFunctionExists () {
Expand Down
6 changes: 3 additions & 3 deletions src/submitters/submitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ export abstract class Submitter {
// Protected

protected static _atomicityWarning () {
if (!process.env.ALLOW_NOT_ATOMIC_UPGRADE) {
if (process.env.ALLOW_NOT_ATOMIC_UPGRADE) {
console.log(chalk.yellow("Not atomic upgrade is performing"));
} else {
console.log(chalk.red("The upgrade will consist" +
" of multiple transactions and will not be atomic"));
console.log(chalk.red("If not atomic upgrade is OK" +
" set ALLOW_NOT_ATOMIC_UPGRADE environment variable"));
process.exit(EXIT_CODES.NOT_ATOMIC_UPGRADE);
} else {
console.log(chalk.yellow("Not atomic upgrade is performing"));
}
}
}

0 comments on commit 23f7484

Please sign in to comment.