Skip to content

Commit

Permalink
Update hardhat-scripts/deploy-strategy.ts
Browse files Browse the repository at this point in the history
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
robotoer and coderabbitai[bot] authored Dec 19, 2024
1 parent 8543964 commit 92ba27f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions hardhat-scripts/deploy-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,25 @@ dotenv.config();

function stringToAddressArray(input: string): string[] {
if (!input) return [];
return input.split(",").map((addr) => addr.trim());
return input.split(",").map((addr) => {
const trimmed = addr.trim();
if (!hre.ethers.isAddress(trimmed)) {
throw new Error(`Invalid address: ${trimmed}`);
}
return trimmed;
});
}

function stringToUintArray(input: string): number[] {
if (!input) return [];
return input.split(",").map((num) => parseInt(num.trim()));
return input.split(",").map((num) => {
const trimmed = num.trim();
const parsed = parseInt(trimmed);
if (isNaN(parsed) || parsed.toString() !== trimmed) {
throw new Error(`Invalid number: ${trimmed}`);
}
return parsed;
});
}

async function checkUnderlyingVaultAsset(
Expand Down

0 comments on commit 92ba27f

Please sign in to comment.