Skip to content

Commit 7ebf6e5

Browse files
committed
fix linter
1 parent 5534126 commit 7ebf6e5

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

contract_manager/scripts/transfer_balance_entropy_chains.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ async function transferOnChain(
157157
transferAmountEth = transferAmount;
158158
} else {
159159
// transferRatio is guaranteed to be defined at this point
160-
transferAmountEth = (balanceEth - gasCostEth) * transferRatio!;
160+
if (transferRatio === undefined) {
161+
throw new Error(
162+
"Transfer ratio must be defined when amount is not specified",
163+
);
164+
}
165+
transferAmountEth = (balanceEth - gasCostEth) * transferRatio;
161166
}
162167

163168
// Round to 10 decimal places to avoid Web3 conversion errors
@@ -299,7 +304,12 @@ function getSelectedChains(argv: {
299304
);
300305
selectedChains = [];
301306

302-
for (const chainId of argv.chain!) {
307+
if (!argv.chain) {
308+
throw new Error(
309+
"Chain argument must be defined for specific chain selection",
310+
);
311+
}
312+
for (const chainId of argv.chain) {
303313
if (!entropyChainIds.has(chainId)) {
304314
throw new Error(
305315
`Chain ${chainId} does not have entropy contracts deployed`,
@@ -360,7 +370,10 @@ async function main() {
360370
if (argv.amount !== undefined) {
361371
transferMethod = `${argv.amount} ETH (fixed amount)`;
362372
} else {
363-
transferMethod = `${(argv.ratio! * 100).toFixed(1)}% of available balance`;
373+
if (argv.ratio === undefined) {
374+
throw new Error("Ratio must be defined when amount is not specified");
375+
}
376+
transferMethod = `${(argv.ratio * 100).toFixed(1)}% of available balance`;
364377
}
365378

366379
console.log(`\nConfiguration:`);

0 commit comments

Comments
 (0)